⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jmmsjsrhandler.c

📁 MTK手机平台的MMI部分的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
                eRet = JC_ERR_MEMORY_ALLOCATION;
                mmi_jmms_free_mms_pdu_memory(g_jmms_context);

                while (pContentTypeParams != NULL)
                {
                    node = pContentTypeParams->pNext;

                    if (pContentTypeParams->pszName != NULL)
                    {
                        jdd_MemFree(pContentTypeParams->pszName);
                        pContentTypeParams->pszName = NULL;
                    }
                    if (pContentTypeParams->pszValue != NULL)
                    {
                        jdd_MemFree(pContentTypeParams->pszValue);
                        pContentTypeParams->pszValue = NULL;
                    }
                    jdd_MemFree(pContentTypeParams);
                    pContentTypeParams = node;
                }

                goto END;
            }

            pTempContentTypeParams = pTempContentTypeParams->pNext;
            pTempContentTypeParams->pszName = jdi_UtilsStrdup("start");
            pTempContentTypeParams->pszValue = jdi_UtilsStrdup((JC_INT8*) (message->start_cnt_id));
        }

        if (pTempContentTypeParams != NULL)
        {
            pTempContentTypeParams->pNext = NULL;
        }
        jdi_MsgSetContentTypeParams(hMsgHandle, pContentTypeParams);
    }

    /* free any allocated memory */
    if (g_jmms_context->hMM1 != NULL)
    {
        /*eRet = jdi_MM1Cleanup(g_jmms_context->hMM1, E_FALSE);*/
        /* Memory Leak Fix: jdi_MM1Cleanup is allocating memory for data chunk after freeing the context */
        eRet = jdi_MM1DeInitialize(g_jmms_context->hMM1);
        g_jmms_context->hMM1 = NULL;
    }

    eRet = jdi_MM1Initialize(&(g_jmms_context->hMM1));

    eRet = mmi_jmms_jsr_form_send_request_pdu(g_jmms_context->hMM1, (MESSAGING_HANDLER*) hMsgHandle);
    if (eRet != JC_OK)
    {
        mmi_jmms_free_mms_pdu_memory(g_jmms_context);
        goto END;
    }

    if (hMsgHandle != NULL)
    {
        mmi_jmms_jdi_msg_deinit(hMsgHandle);
        hMsgHandle = NULL;

        /* /manish-changing on 24 May to prevent End Key Bug */
        g_jmms_context->to_p = NULL;
        g_jmms_context->Cc_p = NULL;
        g_jmms_context->bcc_p = NULL;
        g_jmms_context->from_p = NULL;
        g_jmms_context->MsgHeader_type_p = NULL;
        g_jmms_context->MsgHeaders_p = NULL;
        g_jmms_context->subject = NULL;
        g_jmms_context->version = NULL;
    }

    return mmi_jmms_java_mms_error(JC_OK);

  END:

    if (address != NULL)
    {
        jdd_MemFree(address);
        address = NULL;
    }

    if (temp_address != NULL)
    {
        jdd_MemFree(temp_address);
        temp_address = NULL;
    }

    if (hMsgHandle != NULL)
    {
        mmi_jmms_jdi_msg_deinit(hMsgHandle);
        hMsgHandle = NULL;

        /* /manish adding here on 24 May */
        g_jmms_context->to_p = NULL;
        g_jmms_context->Cc_p = NULL;
        g_jmms_context->bcc_p = NULL;
        g_jmms_context->from_p = NULL;
        g_jmms_context->MsgHeader_type_p = NULL;
        g_jmms_context->MsgHeaders_p = NULL;
        g_jmms_context->subject = NULL;
        g_jmms_context->version = NULL;
    }

    if (g_jmms_context->hMM1 != NULL)
    {
        /*jdi_MM1Cleanup(g_jmms_context->hMM1, E_FALSE);*/
        /* Memory Leak Fix: jdi_MM1Cleanup is allocating memory for data chunk after freeing the context */
        jdi_MM1DeInitialize(g_jmms_context->hMM1);
        g_jmms_context->hMM1 = NULL;
    }

    /* /manish adding here on 24 May */
    mmi_jmms_free_addresses_list();

    return mmi_jmms_java_mms_error(eRet);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_jmms_jsr_form_send_request_pdu
 * DESCRIPTION
 *  
 * PARAMETERS
 *  hMM1            [IN]        
 *  pMessaging      [?]         [?]
 * RETURNS
 *  
 *****************************************************************************/
JC_RETCODE mmi_jmms_jsr_form_send_request_pdu(MM1_HANDLE hMM1, MESSAGING_HANDLER *pMessaging)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    JC_RETCODE eRet = JC_OK;
    MESSAGE_SEND *pSendInfo = NULL;
    JC_INT8 cMajorVersion = DEFAULT_MMS_MAJOR_VERSION;
    JC_INT8 cMinorVersion = E_MMS_MINOR_VERSION_2;

   /****** thanik 07-04-06 */
    MM1_HDR_PARAM *pContentTypeParams = NULL;   /* For content type */
    MM1_HDR_PARAM *pTempContentTypeParams = NULL;
    MM1_HDR_PARAM *node = NULL;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
   /**** thanik**/

    eRet = jdi_MM1SetMessageType(hMM1, E_MMS_SEND_REQUEST_VALUE);
    if (eRet != JC_OK)
    {
        goto error;
    }
    if (pMessaging->pMessageHeaders != NULL)
    {
        pSendInfo = (MESSAGE_SEND*) pMessaging->pMessageHeaders->pHeaders;
    }
    if (pSendInfo != NULL)
    {
        JC_CHAR *pFormattedAddress = NULL;

        if (pSendInfo->pVersion)
        {
            cMajorVersion = (JC_INT8) (jc_atoi(pSendInfo->pVersion));
            cMinorVersion = (JC_INT8) (jc_atoi((pSendInfo->pVersion) + 2));
        }
        eRet = jdi_MM1SetVersion(hMM1, cMajorVersion, cMinorVersion);
        if (eRet != JC_OK)
        {
            goto error;
        }
        if (pSendInfo->uiDate)
        {
            jdi_MM1SetDate(hMM1, pSendInfo->uiDate);
        }
        else
        {
            jdi_MM1SetDate(hMM1, jdd_TimerGetCurrentTime());
        }
        if (pSendInfo->pFrom)
        {
            GetFormattedAddress(&pFormattedAddress, pSendInfo->pFrom);
            if (pFormattedAddress != NULL)
            {
                eRet = jdi_MM1SetFromAddress(hMM1, E_FALSE, pFormattedAddress, E_NONE);
                jdd_MemFree(pFormattedAddress);
                pFormattedAddress = NULL;
            }
            else
            {
                eRet = jdi_MM1SetFromAddress(hMM1, E_FALSE, pSendInfo->pFrom, E_NONE);
            }
            if (eRet != JC_OK)
            {
                goto error;
            }
        }
        if (pSendInfo->pTo)
        {
            GetFormattedAddress(&pFormattedAddress, pSendInfo->pTo);
            if (pFormattedAddress != NULL)
            {
                eRet = jdi_MM1SetToAddress(hMM1, pFormattedAddress, E_NONE);
                jdd_MemFree(pFormattedAddress);
                pFormattedAddress = NULL;
            }
            else
            {
                eRet = jdi_MM1SetToAddress(hMM1, pSendInfo->pTo, E_NONE);
            }
            if (eRet != JC_OK)
            {
                goto error;
            }
        }
        if (pSendInfo->pCc)
        {
            GetFormattedAddress(&pFormattedAddress, pSendInfo->pCc);
            if (pFormattedAddress != NULL)
            {
                eRet = jdi_MM1SetCCAddress(hMM1, pFormattedAddress, E_NONE);
                jdd_MemFree(pFormattedAddress);
                pFormattedAddress = NULL;
            }
            else
            {
                eRet = jdi_MM1SetCCAddress(hMM1, pSendInfo->pCc, E_NONE);
            }
            if (eRet != JC_OK)
            {
                goto error;
            }
        }
        if (pSendInfo->pBcc)
        {
            GetFormattedAddress(&pFormattedAddress, pSendInfo->pBcc);
            if (pFormattedAddress != NULL)
            {
                eRet = jdi_MM1SetBCCAddress(hMM1, pFormattedAddress, E_NONE);
                jdd_MemFree(pFormattedAddress);
                pFormattedAddress = NULL;
            }
            else
            {
                eRet = jdi_MM1SetBCCAddress(hMM1, pSendInfo->pBcc, E_NONE);
            }
            if (eRet != JC_OK)
            {
                goto error;
            }
        }
        if (pSendInfo->pSubject)
        {
            eRet = jdi_MM1SetSubject(hMM1, pSendInfo->pSubject, E_NONE);
            if (eRet != JC_OK)
            {
                goto error;
            }
        }
        eRet = jdi_MM1SetMessageClass(hMM1, (EMM1MessageClass) pSendInfo->eMsgClass);
        if (eRet != JC_OK)
        {
            goto error;
        }
        if (pSendInfo->uiExpiryTime)
        {
            eRet = jdi_MM1SetExpiryTime(hMM1, pSendInfo->uiExpiryTime, E_FALSE);
            if (eRet != JC_OK)
            {
                goto error;
            }
        }
        if (pSendInfo->uiDeliveryTime)
        {
            eRet = jdi_MM1SetDeliveryTime(hMM1, pSendInfo->uiDeliveryTime, E_FALSE);
            if (eRet != JC_OK)
            {
                goto error;
            }
        }
        if (pSendInfo->eMsgPriority > 0)
        {
            eRet = jdi_MM1SetPriority(hMM1, (EMM1MessagePriority) (pSendInfo->eMsgPriority - 1));
        }
        else
        {
            eRet = jdi_MM1SetPriority(hMM1, E_NORMAL_MESSAGE_PRIORITY);
        }
        eRet = jdi_MM1SetSenderVisibility(hMM1, ((pSendInfo->bHideSender == E_TRUE) ? E_FALSE : E_TRUE));
        if (eRet != JC_OK)
        {
            goto error;
        }
        eRet = jdi_MM1SetDeliveryReport(hMM1, pSendInfo->bDeliveryReport);
        if (eRet != JC_OK)
        {
            goto error;
        }
        eRet = jdi_MM1SetReadReplyReport(hMM1, pSendInfo->bReadReport);
        if (eRet != JC_OK)
        {
            goto error;
        }

    #ifdef ENABLE_MMS_VER_1_2
        if (cMinorVersion >= E_MMS_MINOR_VERSION_2 && pSendInfo->pMBoxInfo)
        {
            if (pSendInfo->pMBoxInfo->bMBoxStore == E_TRUE)
            {
                eRet = jdi_MM1SetMMStore(hMM1, pSendInfo->pMBoxInfo->bMBoxStore);
                if (eRet != JC_OK)
                {
                    goto error;
                }
                eRet = jdi_MM1SetMMState(hMM1, (EMM1StoreStates) pSendInfo->pMBoxInfo->eMBoxState);
                if (eRet != JC_OK)
                {
                    goto error;
                }
            }
            if (pSendInfo->pMBoxInfo->pMBoxFlagsType && pSendInfo->pMBoxInfo->pMBoxFlagsType->pAddTokens)
            {
                eRet = jdi_MM1SetMMFlags(hMM1, E_ADD, pSendInfo->pMBoxInfo->pMBoxFlagsType->pAddTokens, E_UCS_2);
            }
            else if (pSendInfo->pMBoxInfo->pMBoxFlagsType && pSendInfo->pMBoxInfo->pMBoxFlagsType->pFilterTokens)
            {
                eRet = jdi_MM1SetMMFlags(hMM1, E_REMOVE, pSendInfo->pMBoxInfo->pMBoxFlagsType->pFilterTokens, E_UCS_2);
            }
            else if (pSendInfo->pMBoxInfo->pMBoxFlagsType && pSendInfo->pMBoxInfo->pMBoxFlagsType->pFilterTokens)
            {
                eRet = jdi_MM1SetMMFlags(hMM1, E_FILTER, pSendInfo->pMBoxInfo->pMBoxFlagsType->pFilterTokens, E_UCS_2);
            }
            if (eRet != JC_OK)
            {
                goto error;
            }
        }
    #endif /* ENABLE_MMS_VER_1_2 */ 

        if (cMinorVersion > E_MMS_MINOR_VERSION_0 && pSendInfo->pReplyChargingInfo != NULL)
        {
            MM1_REPLY_CHARGING MM1ReplyChargingInfo;

            jc_memset(&MM1ReplyChargingInfo, 0x00, sizeof(MM1_REPLY_CHARGING));
            MM1ReplyChargingInfo.eReplyCharging = (EMM1ReplyCharging) pSendInfo->pReplyChargingInfo->eReplyCharging;
            MM1ReplyChargingInfo.uiRelativeTime = pSendInfo->pReplyChargingInfo->uiRelativeTime;
            MM1ReplyChargingInfo.uiSize = pSendInfo->pReplyChargingInfo->uiSize;
            if (pSendInfo->pReplyChargingInfo->eReplyCharging == E_REPLY_CHARGING_NOT_SUPPORTED)        /* i.e, if the message is a reply to a reply-charging req message */
            {
                MM1ReplyChargingInfo.pszReplyId = pSendInfo->pReplyChargingInfo->pszReplyId;
            }
            eRet = jdi_MM1SetReplyCharging(hMM1, &MM1ReplyChargingInfo);
            if (eRet != JC_OK)
            {
                goto error;
            }
        }
      /***** 27-03-06 ***/
        if (pMessaging->pParams != NULL)
        {
         /******** Thanik *** 07-04-06***/
            pContentTypeParams = (MM1_HDR_PARAM*) jdd_MemAlloc(sizeof(MM1_HDR_PARAM), 1);
            if (pContentTypeParams == NULL)
            {
                eRet = JC_ERR_MEMORY_ALLOCATION;
                goto error;
            }
            pContentTypeParams->pszName = jdi_UtilsStrdup(pMessaging->pParams->pszName);
            pContentTypeParams->pszValue = jdi_UtilsStrdup(pMessaging->pParams->pszValue);

            if(pMessaging->pParams->pNext != NULL)
            {
                pContentTypeParams->pNext = (MM1_HDR_PARAM*) jdd_MemAlloc(sizeof(MM1_HDR_PARAM), 1);
                if (pContentTypeParams->pNext == NULL)
                {
                    eRet = JC_ERR_MEMORY_ALLOCATION;
                    goto error;
                }

                pTempContentTypeParams = pContentTypeParams->pNext;
                pTempContentTypeParams->pszName = jdi_UtilsStrdup(pMessaging->pParams->pNext->pszName);
                pTempContentTypeParams->pszValue = jdi_UtilsStrdup(pMessaging->pParams->pNext->pszValue);
            }

            if(pMessaging->pParams->pNext != NULL && pMessaging->pParams->pNext->pNext != NULL)
            {
                pTempContentTypeParams->pNext = (MM1_HDR_PARAM*) jdd_MemAlloc(sizeof(MM1_HDR_PARAM), 1);
                if (pTempContentTypeParams->pNext == NULL)
                {
                    eRet = JC_ERR_MEMORY_ALLOCATION;
                    goto error;
                }

                pT

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -