JMMSProtocol.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:298k
源码类别:
MTK
开发平台:
C/C++
- jdd_MemFree(g_jmms_context->pSendContent->pBuffer);
- g_jmms_context->pSendContent->pBuffer = NULL;
- }
- if (g_jmms_context->pSendContent->pStream != NULL)
- {
- if (g_jmms_context->jmms_fs_handle == NULL)
- {
- jdd_FSInitialize(&g_jmms_context->jmms_fs_handle);
- }
- jdd_FSDelete(g_jmms_context->jmms_fs_handle, g_jmms_context->pSendContent->pStream);
- jdd_MemFree(g_jmms_context->pSendContent->pStream);
- }
- jdd_MemFree(g_jmms_context->pSendContent);
- g_jmms_context->pSendContent = NULL;
- }
- if (g_jmms_context->pSaveContent != NULL)
- {
- if (g_jmms_context->pSaveContent->bIsStream == E_FALSE)
- {
- jdd_MemFree(g_jmms_context->pSaveContent->pBuffer);
- g_jmms_context->pSaveContent->pBuffer = NULL;
- }
- if (g_jmms_context->pSaveContent->pStream != NULL)
- {
- if (g_jmms_context->jmms_fs_handle == NULL)
- {
- jdd_FSInitialize(&g_jmms_context->jmms_fs_handle);
- }
- jdd_FSDelete(g_jmms_context->jmms_fs_handle, g_jmms_context->pSaveContent->pStream);
- jdd_MemFree(g_jmms_context->pSaveContent->pStream);
- }
- jdd_MemFree(g_jmms_context->pSaveContent);
- g_jmms_context->pSaveContent = NULL;
- }
- if (g_jmms_context->pParseContent != NULL)
- {
- if (g_jmms_context->pParseContent->pFileName != NULL)
- {
- jdd_MemFree(g_jmms_context->pParseContent->pFileName);
- }
- jdd_MemFree(g_jmms_context->pParseContent);
- g_jmms_context->pParseContent = NULL;
- }
- mmi_jmms_deinit_view();
- //#ifdef __MMI_MMS_SIGNATURE__
- mmi_jmms_reset_fw_flag_of_inbox();
- g_jmms_context->auto_signature_added = MMI_FALSE;
- //#endif /* __MMI_MMS_SIGNATURE__ */
- #ifdef __MMI_UNIFIED_MESSAGE__
- mmi_jmms_reset_fw_flag_of_message();
- #endif
- if (g_jmms_context->async_send_context.params != NULL)
- {
- jdd_MemFree(g_jmms_context->async_send_context.params);
- g_jmms_context->async_send_context.params = NULL;
- }
- if (g_jmms_context->async_save_context.params != NULL)
- {
- jdd_MemFree(g_jmms_context->async_save_context.params);
- g_jmms_context->async_save_context.params = NULL;
- }
- mmi_jmms_delete_compose_temp_files();
- if (g_jmms_context->compose_context != NULL)
- {
- jdd_MemFree(g_jmms_context->compose_context);
- g_jmms_context->compose_context = NULL;
- }
- if (g_jmms_context->jmms_fs_handle != NULL)
- {
- jdd_FSDeinitialize(g_jmms_context->jmms_fs_handle);
- g_jmms_context->jmms_fs_handle = NULL;
- }
- }
- /* Himanshu 21/11/2006 Free the media buffer used in Compose Screen */
- if(g_media_buffer_p != NULL)
- {
- jdd_MemFree(g_media_buffer_p);
- g_media_buffer_p = NULL;
- }
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_deinit_mms_context END"));
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_free_message_header
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_free_message_header(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_free_message_header"));
- if (g_jmms_context->last_scr_id == SCR_ID_JMMS_OUTBOX_OPTIONS
- || g_jmms_context->last_scr_id == SCR_ID_JMMS_DRAFTS_OPTIONS)
- {
- ///it menas MMS Sent was from "Sent" in Drafts or
- //"Resent" in Outbox
- mmi_jmms_deinit_mms_context(g_jmms_context);
- g_jmms_context->nSent_retry_counter = 0;
- return;
- }
- else
- {
- if (g_jmms_context->msg_handle != NULL)
- {
- MESSAGING_HANDLER *pMessagingHandler = NULL;
- pMessagingHandler = (MESSAGING_HANDLER*) (g_jmms_context->msg_handle);
- if (pMessagingHandler->pMessageHeaders != NULL)
- {
- FreeMessageHeaders(&(pMessagingHandler->pMessageHeaders));
- pMessagingHandler->pMessageHeaders = NULL;
- g_jmms_context->to_p = NULL;
- g_jmms_context->Cc_p = NULL;
- g_jmms_context->bcc_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;
- /* / 7 March */
- if (g_jmms_context->jmms_fs_handle != NULL)
- {
- jdd_FSDeinitialize(g_jmms_context->jmms_fs_handle);
- g_jmms_context->jmms_fs_handle = NULL;
- }
- g_jmms_context->nSent_retry_counter = 0;
- }
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_free_mms_pdu_memory
- * DESCRIPTION
- *
- * PARAMETERS
- * jmms_context [?] [?] [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_free_mms_pdu_memory(jmms_context_struct *jmms_context)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_free_mms_pdu_memory"));
- if (jmms_context->to_p != NULL)
- {
- jdd_MemFree(jmms_context->to_p);
- jmms_context->to_p = NULL;
- }
- if (jmms_context->Cc_p != NULL)
- {
- jdd_MemFree(jmms_context->Cc_p);
- jmms_context->Cc_p = NULL;
- }
- if (jmms_context->bcc_p != NULL)
- {
- jdd_MemFree(jmms_context->bcc_p);
- jmms_context->bcc_p = NULL;
- }
- if (jmms_context->MsgHeader_type_p != NULL)
- {
- jdd_MemFree(jmms_context->MsgHeader_type_p);
- jmms_context->MsgHeader_type_p = NULL;
- }
- if (jmms_context->MsgHeaders_p != NULL)
- {
- jdd_MemFree(jmms_context->MsgHeaders_p);
- jmms_context->MsgHeaders_p = NULL;
- }
- if (jmms_context->subject != NULL)
- {
- jdd_MemFree(jmms_context->subject);
- jmms_context->subject = NULL;
- }
- if (jmms_context->version != NULL)
- {
- jdd_MemFree(jmms_context->version);
- jmms_context->version = NULL;
- }
- if (jmms_context->activated_mmsc_url != NULL)
- {
- jdd_MemFree(jmms_context->activated_mmsc_url);
- jmms_context->activated_mmsc_url = NULL;
- }
- if (jmms_context->from_p != NULL)
- {
- jdd_MemFree(jmms_context->from_p);
- jmms_context->from_p = NULL;
- }
- jmms_context->nSent_retry_counter = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_comm_stop_callback
- * DESCRIPTION
- *
- * PARAMETERS
- * jmms_context [?] [?] [?]
- * uiReferenceID [IN]
- * eRetCode [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_comm_stop_callback(jmms_context_struct *jmms_context, JC_UINT32 uiReferenceID, JC_RETCODE eRetCode)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- jmms_communication_state_node *comm_node = NULL;
- // sandeep start to fix bug number PMT005980
- //#ifdef __MMI_UNIFIED_MESSAGE__
- JC_RETCODE eRet = JC_OK;
- //#endif
- // sandeep end to fix bug number PMT005980
- JC_CHAR *pFolderName = NULL;
- JC_CHAR pOutBox[7 * ENCODING_LENGTH];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s%d %s%d", "mmi_jmms_comm_stop_callback, Reference id: ", uiReferenceID,
- "Error code: ", eRetCode));
- #ifdef __MMI_UNIFIED_MESSAGE__
- comm_node = mmi_jmms_get_comm_state(jmms_context, uiReferenceID);
- #endif
- if (eRetCode == JC_ERR_USER_CANCELLED)
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS User Cancelled the Comunication Request"));
- #ifdef MMI_JMMS_JAVA_MMS_SUPPORT
- #ifndef __MMI_UNIFIED_MESSAGE__
- comm_node = mmi_jmms_get_comm_state(jmms_context, uiReferenceID);
- #endif
- if (comm_node == NULL)
- {
- return;
- }
- if (comm_node->mms_communication_state == E_TYPE_NEW_JAVA_MMS_SEND)
- {
- mmi_jmms_free_comm_node(jmms_context, uiReferenceID);
- if (jmms_context->jsr_mms_send_cancel_callback != NULL)
- {
- (*(jmms_context->jsr_mms_send_cancel_callback)) (JSR_RESULT_OK);
- }
- return;
- }
- #endif /* MMI_JMMS_JAVA_MMS_SUPPORT */
- /* 2 March- need care */
- #ifdef __MMI_UNIFIED_MESSAGE__
- if (mmi_um_get_current_msg_box_type() != UM_MSG_BOX_TYPE_UNSENT
- && g_jmms_context->save_mms == TRUE && g_jmms_context->last_scr_id == IDLE_SCREEN_ID)
- {
- eRet = mmi_jmms_send_and_store_mms("Outbox", jmms_context->msg_handle, comm_node);
- if (eRet == JC_OK)
- {
- DisplayPopup(
- (U8*) GetString(STR_ID_JMMS_COMM_ABORTED_MMS_STORED),
- IMG_GLOBAL_ERROR,
- 1,
- JMMS_POPUP_TIME,
- (U8) ERROR_TONE);
- }
- else
- {
- if (eRet == E_MEMORY_FULL_ERROR)
- {
- mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_COMM_ABORTED_AND_FAIL_STORE_MEMORY);
- }
- else if (eRet == JC_ERR_MEMORY_ALLOCATION || eRet == JC_ERR_FILE_WRITE)
- {
- mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_COMM_ABORTED_AND_FAIL_STORE_MEM_FULL);
- }
- else
- {
- mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_COMM_ABORTED_AND_FAIL_STORE);
- }
- }
- }
- else
- {
- DisplayPopup(
- (U8*) GetString(STR_ID_JMMS_COMM_ABORTED),
- IMG_GLOBAL_INFO,
- 1,
- JMMS_POPUP_TIME,
- (U8) SUCCESS_TONE);
- }
- if (IsScreenPresent(SCR_ID_JMMS_WRITE_MMS))
- {
- DeleteUptoScrID(g_jmms_context->last_scr_id);
- }
- else if (IsScreenPresent(SCR_ID_UM_UNSENT))
- {
- DeleteUptoScrID(SCR_ID_UM_UNSENT);
- }
- else if (IsScreenPresent(SCR_ID_UM_DRAFT))
- {
- DeleteUptoScrID(SCR_ID_UM_DRAFT);
- }
- else if (IsScreenPresent(SCR_ID_UM_INBOX))
- {
- DeleteUptoScrID(SCR_ID_UM_INBOX);
- }
- else if(IsScreenPresent(SCR_ID_UM_SENT))
- {
- DeleteUptoScrID(SCR_ID_UM_SENT);
- }
- else if (g_jmms_context->last_scr_id == IDLE_SCREEN_ID)
- {
- /*Dilip 8th Sept 2006 to remove memory leak*/
- if(g_end_key_processing_handler) g_end_key_processing_handler();
- //DisplayIdleScreen();
- /*Dilip End 8th sept 2006 */
- }
- mmi_jmms_free_message_header();
- mmi_jmms_free_comm_node(jmms_context, uiReferenceID);
- #else /* __MMI_UNIFIED_MESSAGE__ */
- // sandeep start to fix bug number PMT005980
- eRet = mmi_jmms_jdi_get_active_folder(g_jmms_context->hStoreHandle, &(pFolderName), NULL);
- if(eRet == JC_OK)
- {
- AnsiiToUnicodeString((PS8)pOutBox, (PS8)MMI_JMMS_OUTBOX);
- if (
- (jc_tcscmp(pOutBox, pFolderName) != 0)
- && (g_jmms_context->save_mms == TRUE )
- && (g_jmms_context->last_scr_id == IDLE_SCREEN_ID))
- {
- eRet = mmi_jmms_send_and_store_mms("Outbox", g_jmms_context->msg_handle, comm_node);
- if (eRet == JC_OK)
- {
- DisplayPopup(
- (U8*) GetString(STR_ID_JMMS_COMM_ABORTED_MMS_STORED),
- /* MAUI_00018340 Start */
- IMG_GLOBAL_INFO,
- /* MAUI_00018340 End */
- 1,
- JMMS_POPUP_TIME,
- (U8) ERROR_TONE);
- }
- else
- {
- if (eRet == E_MEMORY_FULL_ERROR)
- {
- mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_COMM_ABORTED_AND_FAIL_STORE_MEMORY);
- }
- else if (eRet == JC_ERR_MEMORY_ALLOCATION || eRet == JC_ERR_FILE_WRITE)
- {
- mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_COMM_ABORTED_AND_FAIL_STORE_MEM_FULL);
- }
- else
- {
- mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_COMM_ABORTED_AND_FAIL_STORE);
- }
- }
- }
- else
- {
- DisplayPopup((U8*) GetString(STR_ID_JMMS_COMM_ABORTED), IMG_GLOBAL_INFO, 1, JMMS_POPUP_TIME, (U8) SUCCESS_TONE);
- }
- }
- else
- {
- DisplayPopup((U8*) GetString(STR_ID_JMMS_COMM_ABORTED), IMG_GLOBAL_INFO, 1, JMMS_POPUP_TIME, (U8) SUCCESS_TONE);
- }
- DeleteUptoScrID(g_jmms_context->last_scr_id);
- mmi_jmms_free_message_header();
- // sandeep end to fix bug number PMT005980
- mmi_jmms_free_comm_node(jmms_context, uiReferenceID);
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- }
- else
- {
- #ifdef MMI_JMMS_JAVA_MMS_SUPPORT
- comm_node = mmi_jmms_get_comm_state(jmms_context, uiReferenceID);
- if (comm_node == NULL)
- {
- return;
- }
- if ((comm_node->mms_communication_state == E_TYPE_NEW_JAVA_MMS_SEND) &&
- (jmms_context->jsr_mms_send_cancel_callback != NULL))
- {
- mmi_jmms_free_comm_node(jmms_context, uiReferenceID);
- (*(jmms_context->jsr_mms_send_cancel_callback)) (JSR_RESULT_ERROR);
- return;
- }
- #endif /* MMI_JMMS_JAVA_MMS_SUPPORT */
- /* /error in cancelling the send/download */
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_error_ind_callback
- * DESCRIPTION
- *
- * PARAMETERS
- * jmms_context [?] [?] [?]
- * uiReferenceID [IN]
- * eRetCode [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_error_ind_callback(jmms_context_struct *jmms_context, JC_UINT32 uiReferenceID, JC_RETCODE eRetCode)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE eRet = JC_OK;
- JC_EVENT_DATA eventData = {0, };
- mmi_jmms_temp_event_struct info = {0, };
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "mmi_jmms_error_ind_callback, Reference ID: ", uiReferenceID));
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "JMMS Error Ind Error Code:", eRetCode));
- eventData.destTaskInfo.iAppID = E_TASK_MMS_UI;
- eventData.destTaskInfo.iTaskID = E_TASK_MMS_UI;
- eventData.srcTaskInfo.iAppID = E_TASK_MMS_UI;
- eventData.srcTaskInfo.iTaskID = E_TASK_MMS_UI;
- eventData.uiEventInfoSize = sizeof(mmi_jmms_temp_event_struct);
- eventData.iEventType = E_COMM_ERROR_INDICATION_EVENT;
- eRet = jdd_QueueAlloc(&eventData);
- if (JC_OK != eRet)
- {
- return;
- }
- info.jmms_context = jmms_context;
- info.uiReferenceID = uiReferenceID;
- info.eRetCode = eRetCode;
- jc_memcpy(eventData.pEventInfo, &info, sizeof(mmi_jmms_temp_event_struct));
- jdd_QueueSend(&eventData);
- jdi_CommunicationFreeReference(jmms_context->hCommHandle, uiReferenceID);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_retry_for_error_in_comm
- * DESCRIPTION
- *
- * PARAMETERS
- * pEventData [?] [?] [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_retry_for_error_in_comm(mmi_jmms_temp_event_struct *pEventData)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_jmms_temp_event_struct *info = {0, };
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- info = (mmi_jmms_temp_event_struct*) (pEventData);
- mmi_jmms_retry_communication(info->jmms_context, E_FROM_ERROR_CALLBACK, info->uiReferenceID, info->eRetCode);
- mmi_jmms_free_comm_node(info->jmms_context, info->uiReferenceID);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_create_and_send_new_mms
- * DESCRIPTION
- *
- * PARAMETERS
- * message_setting [IN]
- * jmms_context [?] [?] [?]
- * is_create_for_send [IN]
- * RETURNS
- *
- *****************************************************************************/
- JC_RETCODE mmi_jmms_create_and_send_new_mms(
- U16 message_setting,
- jmms_context_struct *jmms_context,
- MMI_BOOL is_create_for_send)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE eRet = JC_OK;
- MESSAGE_SEND *pMessageSend = NULL;
- MESSAGE_HEADERS *pMsgHeaders = NULL;
- U8 ret = 0;
- S32 len = 0;
- MSG_HANDLE hMsgHandle = jmms_context->msg_handle;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* free any allocated memory */
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_create_and_send_new_mms"));
- mmi_jmms_free_mms_pdu_memory(g_jmms_context);
- g_jmms_context->MsgHeaders_p = (MESSAGE_HEADERS*) jdd_MemAlloc(sizeof(MESSAGE_HEADERS), 1);
- if (NULL == g_jmms_context->MsgHeaders_p)
- {
- mmi_jmms_free_mms_pdu_memory(g_jmms_context);
- return JC_ERR_MEMORY_ALLOCATION;
- }
- g_jmms_context->MsgHeader_type_p = (MESSAGE_SEND*) jdd_MemAlloc(sizeof(MESSAGE_SEND), 1);
- if (NULL == g_jmms_context->MsgHeader_type_p)
- {
- mmi_jmms_free_mms_pdu_memory(g_jmms_context);
- return JC_ERR_MEMORY_ALLOCATION;
- }
- pMsgHeaders = g_jmms_context->MsgHeaders_p;
- pMessageSend = g_jmms_context->MsgHeader_type_p;
- eRet = mmi_jmms_set_mmsc_version();
- if (eRet != JC_OK)
- {
- mmi_jmms_free_mms_pdu_memory(g_jmms_context);
- return eRet;
- }
- pMessageSend->pVersion = (JC_INT8*) g_jmms_context->version;
- if (wap_get_user_agent_brand() == EM_WAP_USERAGENT_BRAND_SE)
- {
- pMessageSend->uiDate = get_current_utc_time();
- }
- /* MAUI_00227929 Start */
- // if (message_setting == E_USE_LOCAL_SETTINGS) /* /used when mms send is called from write message and send options are used */
- // {
- pMessageSend->bDeliveryReport =
- (g_jmms_context->sending_settings.delivery_report == 1) ? E_TRUE : E_FALSE;
- pMessageSend->bReadReport =
- (g_jmms_context->sending_settings.read_report == 1) ? E_TRUE : E_FALSE;
- pMessageSend->bHideSender =
- (g_jmms_context->sending_settings.hide_sender == 1) ? E_TRUE : E_FALSE;
- pMessageSend->uiExpiryTime = 0;
- switch (g_jmms_context->sending_settings.validity_period)
- {
- case E_VALIDITY_PERIOD_MAX:
- if (wap_get_user_agent_brand() != EM_WAP_USERAGENT_BRAND_SE)
- {
- pMessageSend->uiExpiryTime = MAX_VALIDITY_PERIOD_VALUE;
- }
- break;
- case E_VALIDITY_PERIOD_1HR:
- pMessageSend->uiExpiryTime = 3600;
- break;
- case E_VALIDITY_PERIOD_12HRS:
- pMessageSend->uiExpiryTime = 12 * 3600;
- break;
- case E_VALIDITY_PERIOD_1DAY:
- pMessageSend->uiExpiryTime = 1 * 24 * 3600;
- break;
- case E_VALIDITY_PERIOD_1WEEK:
- pMessageSend->uiExpiryTime = 1 * 7 * 24 * 3600;
- break;
- default:
- if (wap_get_user_agent_brand() != EM_WAP_USERAGENT_BRAND_SE)
- {
- pMessageSend->uiExpiryTime = MAX_VALIDITY_PERIOD_VALUE;
- }
- break;
- }
- switch (g_jmms_context->sending_settings.delivery_time)
- {
- case E_IMMEDIATE:
- pMessageSend->uiDeliveryTime = 0;
- break;
- case E_1_HR:
- pMessageSend->uiDeliveryTime = 3600;
- break;
- case E_12_HRS:
- pMessageSend->uiDeliveryTime = 12 * 3600;
- break;
- case E_24_HRS:
- pMessageSend->uiDeliveryTime = 24 * 3600;
- break;
- default:
- pMessageSend->uiDeliveryTime = 0;
- break;
- }
- /* MAUI_00018625 Start */
- pMessageSend->eMsgPriority = (g_jmms_context->sending_settings.priority) ;
- /* MAUI_00018625 End */
- if (g_jmms_context->sending_settings.reply_charging == E_ON)
- {
- pMessageSend->pReplyChargingInfo = (REPLY_CHARGING*) jdd_MemAlloc(sizeof(REPLY_CHARGING), 1);
- if (pMessageSend->pReplyChargingInfo == NULL)
- {
- mmi_jmms_free_mms_pdu_memory(g_jmms_context);
- return JC_ERR_MEMORY_ALLOCATION;
- }
- switch (g_jmms_context->sending_settings.request_type)
- {
- case E_FULL_MMS:
- pMessageSend->pReplyChargingInfo->eReplyCharging = E_REQUEST_REPLY_CHARGING;
- break;
- case E_TEXT_ONLY:
- pMessageSend->pReplyChargingInfo->eReplyCharging = E_REQUEST_TEXT_ONLY_REPLY_CHARGING;
- break;
- default:
- pMessageSend->pReplyChargingInfo->eReplyCharging = E_REQUEST_REPLY_CHARGING;
- break;
- }
- pMessageSend->pReplyChargingInfo->uiRelativeTime =
- (JC_UINT32) (gui_atoi
- ((UI_string_type) g_jmms_context->sending_settings.
- deadline_for_reply_buffer) * 3600);
- pMessageSend->pReplyChargingInfo->uiSize =
- ((JC_UINT32)
- gui_atoi((UI_string_type) g_jmms_context->sending_settings.
- reply_msg_size_buffer)) * 1000;
- }
- //}
- /* else if (message_setting == E_USE_NVRAM_SETTINGS)
- {
- pMessageSend->bDeliveryReport = (mmi_jmms_sending_settings_delivery_report() == 1) ? E_TRUE : E_FALSE;
- pMessageSend->bReadReport = (mmi_jmms_sending_settings_read_report() == 1) ? E_TRUE : E_FALSE;
- pMessageSend->bHideSender = (mmi_jmms_sending_settings_hide_sender() == 1) ? E_TRUE : E_FALSE;
- pMessageSend->uiExpiryTime = (JC_UINT32) mmi_jmms_sending_settings_validity_period();
- if (pMessageSend->uiExpiryTime == MAX_VALIDITY_PERIOD_VALUE)
- {
- if (wap_get_user_agent_brand() == EM_WAP_USERAGENT_BRAND_SE)
- {
- pMessageSend->uiExpiryTime = 0;
- }
- }
- pMessageSend->uiDeliveryTime = (JC_UINT32) mmi_jmms_sending_settings_delivery_time();
- pMessageSend->eMsgPriority = mmi_jmms_sending_settings_priority();
- if (mmi_jmms_sending_settings_reply_charging_status() == E_ON)
- {
- pMessageSend->pReplyChargingInfo = (REPLY_CHARGING*) jdd_MemAlloc(sizeof(REPLY_CHARGING), 1);
- if (pMessageSend->pReplyChargingInfo == NULL)
- {
- mmi_jmms_free_mms_pdu_memory(g_jmms_context);
- return JC_ERR_MEMORY_ALLOCATION;
- }
- pMessageSend->pReplyChargingInfo->eReplyCharging = mmi_jmms_sending_settings_reply_charging_request_type();
- pMessageSend->pReplyChargingInfo->uiRelativeTime =
- ((JC_UINT32) mmi_jmms_sending_settings_deadline_for_reply()) * 3600;
- pMessageSend->pReplyChargingInfo->uiSize =
- ((JC_UINT32) mmi_jmms_sending_settings_reply_charging_size()) * 1024;
- }
- }*/
- /* MAUI_00227929 End */
- /* Added by Deepali for reply charging. */
- if (g_jmms_context->rc_info != NULL)
- {
- pMessageSend->pReplyChargingInfo->pszReplyId =
- (JC_INT8*) jdi_UtilsStrdup(g_jmms_context->rc_info->pReplyMsgID);
- if (g_jmms_context->rc_info != NULL)
- {
- if (g_jmms_context->rc_info->pReplyMsgID != NULL)
- {
- jdd_MemFree(g_jmms_context->rc_info->pReplyMsgID);
- }
- jdd_MemFree(g_jmms_context->rc_info);
- g_jmms_context->rc_info = NULL;
- }
- }
- pMessageSend->bExpiryAbs = E_FALSE;
- pMessageSend->bDeliveryAbs = E_FALSE;
- if (g_jmms_context->num_to_addresses > 0)
- {
- g_jmms_context->to_p = mmi_jmms_get_to_addresses();
- if (g_jmms_context->to_p == NULL)
- {
- mmi_jmms_free_mms_pdu_memory(g_jmms_context);
- return JC_ERR_MEMORY_ALLOCATION;
- }
- pMessageSend->pTo = (JC_CHAR*) g_jmms_context->to_p;
- }
- if (g_jmms_context->num_cc_addresses > 0)
- {
- g_jmms_context->Cc_p = mmi_jmms_get_cc_addresses();
- if (JC_OK != ret)
- {
- mmi_jmms_free_mms_pdu_memory(g_jmms_context);
- return JC_ERR_MEMORY_ALLOCATION;
- }
- pMessageSend->pCc = (JC_CHAR*) g_jmms_context->Cc_p;
- }
- if (g_jmms_context->num_bcc_addresses > 0)
- {
- g_jmms_context->bcc_p = mmi_jmms_get_bcc_addresses();
- if (JC_OK != ret)
- {
- mmi_jmms_free_mms_pdu_memory(g_jmms_context);
- return JC_ERR_MEMORY_ALLOCATION;
- }
- pMessageSend->pBcc = (JC_CHAR*) g_jmms_context->bcc_p;
- }
- len = pfnUnicodeStrlen((S8*) g_jmms_context->subject_input_buffer);
- g_jmms_context->subject = (S8*) jdd_MemAlloc(sizeof(S8), (len + 1) * ENCODING_LENGTH);
- if ((g_jmms_context->subject == NULL) && (len != 0))
- {
- mmi_jmms_free_mms_pdu_memory(g_jmms_context);
- return JC_ERR_MEMORY_ALLOCATION;
- }
- if (g_jmms_context->subject)
- {
- if (GetUCS2Flag((S8*) g_jmms_context->subject_input_buffer) == FALSE)
- {
- U8 count = 0;
- U32 str_len = 0;
- S8 temp[MAX_SUBJECT_LENGTH + 1];
- UnicodeToAnsii(temp, (S8*) g_jmms_context->subject_input_buffer);
- str_len = strlen(temp);
- for (count = 0; count < (str_len); count++)
- {
- if (temp[count] == 0x0D && temp[count + 1] == 0x0A)
- {
- temp[count] = 0x20;
- strcpy((S8*) (temp + count + 1), (S8*) (temp + count + 2));
- str_len--;
- }
- }
- AnsiiToUnicodeString(g_jmms_context->subject, temp);
- }
- else
- {
- pfnUnicodeStrcpy((S8*) g_jmms_context->subject, (S8*) g_jmms_context->subject_input_buffer);
- }
- pMessageSend->pSubject = (JC_CHAR*) g_jmms_context->subject;
- }
- pMsgHeaders->eMsgType = E_MSG_TYPE_SEND;
- pMsgHeaders->pHeaders = pMessageSend;
- if (is_create_for_send == MMI_TRUE)
- {
- g_jmms_context->progress_screen_title = STR_ID_PROGRESS_SENDING;
- memset(g_jmms_context->g_jmms_progress_str, 0x00, MAX_PROGRESS_SCREEN_HINT_LEN * ENCODING_LENGTH);
- mmi_jmms_entry_communication_progress_screen();
- /* PMT VIKAS START 20060325 */
- //#ifdef __MMI_MMS_SIGNATURE__
- mmi_jmms_insert_auto_signature();
- //#endif
- // mmi_jmms_entry_communication_progress_screen();
- eRet = mmi_jmms_jdi_set_msg_headers(hMsgHandle, pMsgHeaders);
- if (JC_OK != eRet)
- {
- mmi_jmms_free_mms_pdu_memory(g_jmms_context);
- return eRet;
- }
- /* PMT VIKAS END 20060325 */
- /******************************************************************************
- This part of the function is modified to make the MMS send process asynch.
- Modified By : Raj Kumar Gupta
- Date of Modification : 09 June 2006
- *****************************************************************************/
- /* Register the function that to be execute after the completion of the
- encapsulation */
- mmi_jmms_add_send_callback_node(mmi_jmms_create_and_send_new_mms_async_callback);
- mmi_jmms_send_mms(hMsgHandle, E_TYPE_NEW_MMS, E_TRUE, 1, E_TRUE);
- }
- /* PMT VIKAS START 20060325 */
- else
- {
- eRet = mmi_jmms_jdi_set_msg_headers(hMsgHandle, pMsgHeaders);
- if (JC_OK != eRet)
- {
- mmi_jmms_free_mms_pdu_memory(g_jmms_context);
- return eRet;
- }
- }
- /* PMT VIKAS END 20060325 */
- return JC_OK;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_create_and_send_new_mms_async_callback
- * DESCRIPTION
- *
- * PARAMETERS
- * eRet [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_create_and_send_new_mms_async_callback(JC_RETCODE eRet)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d", "mmi_jmms_create_and_send_new_mms_async_callback, Ret Code:", eRet));
- if (JC_OK != eRet)
- {
- /* PMT VIKAS START 20060405 */
- //#ifdef __MMI_MMS_SIGNATURE__
- mmi_jmms_del_inserted_auto_signature_slide();
- //#endif
- /* PMT VIKAS END 20060405 */
- if (eRet == E_JMMS_STORAGE_FULL)
- {
- mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT_STORE_FUL);
- }
- /* Added by - Raj Kumar Gupta on 31 August, 2006 */
- else if(eRet == E_COMMUNICATION_ABORTED)
- {
- DisplayPopup(
- (U8*) GetString(STR_ID_JMMS_COMM_ABORTED),
- IMG_GLOBAL_INFO,
- 1,
- JMMS_POPUP_TIME,
- (U8) SUCCESS_TONE);
- }
- else
- {
- mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT);
- }
- mmi_jmms_free_message_header();
- DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, g_jmms_context->last_scr_id);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_save_mms
- * DESCRIPTION
- *
- * PARAMETERS
- * folder_name [?] [?] [?]
- * hMsgHandle [IN]
- * is_store_update [IN]
- * msg_index [IN]
- * err_cb [IN]
- * RETURNS
- *
- *****************************************************************************/
- /* IN THIS we have message handle as input, directly save from handle, first make file then save. */
- JC_RETCODE mmi_jmms_save_mms(
- S8 *folder_name,
- MSG_HANDLE hMsgHandle,
- MMI_BOOL is_store_update,
- JC_UINT32 msg_index,
- error_callback err_cb)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /* CONTENT_DATA EncapsulatedContent = {0, }; */
- JC_RETCODE eRet = JC_OK;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_save_mms"));
- if (g_jmms_context->pSaveContent != NULL)
- {
- jdd_MemFree(g_jmms_context->pSaveContent);
- }
- g_jmms_context->pSaveContent = (CONTENT_DATA*) jdd_MemAlloc(sizeof(CONTENT_DATA), 1);
- if (g_jmms_context->async_save_context.params != NULL)
- {
- jdd_MemFree(g_jmms_context->async_save_context.params);
- }
- g_jmms_context->async_save_context.params =
- (jmms_async_save_params_struct*) jdd_MemAlloc(sizeof(jmms_async_save_params_struct), 1);
- memcpy(g_jmms_context->async_save_context.params->folder_name, folder_name, strlen(folder_name) + 1);
- g_jmms_context->async_save_context.params->is_store_update = is_store_update;
- g_jmms_context->async_save_context.params->msg_index = msg_index;
- g_jmms_context->async_save_context.params->hMsgHandle = hMsgHandle;
- g_jmms_context->pSaveContent->bIsStream = E_TRUE;
- g_jmms_context->pSaveContent->cbWriteCallback = mmi_jmms_write_callback;
- jdi_UtilsCharToTchar(
- (JC_CHAR **) & (g_jmms_context->pSaveContent->pStream),
- "@mms\temp\jmms_tempEncFile.bin");
- g_jmms_context->pSaveContent->pFileName = g_jmms_context->pSaveContent->pStream;
- eRet = mmi_jmms_jdi_encapsulate_buffer(hMsgHandle, g_jmms_context->pSaveContent);
- mmi_jmms_add_save_callback_node(err_cb);
- mmi_jmms_add_save_callback_node(mmi_jmms_save_mms_async_callback);
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS ENCODING START"));
- if (eRet == JC_ERR_MMS_ENCODE_PENDING)
- {
- mmi_jmms_save_continue_start_timer(hMsgHandle);
- return eRet;
- }
- mmi_jmms_decrement_save_callback_node(eRet);
- return eRet;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_save_mms_async_callback
- * DESCRIPTION
- *
- * PARAMETERS
- * eRet [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_save_mms_async_callback(JC_RETCODE eRet)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MESSAGE_HEADERS *MsgHeaders = NULL;
- jmms_async_save_params_struct save_params;
- // CONTENT_DATA content = {0, }; // COMPILER WARNING REMOVAL
- //sandeep starts
- RETRIEVE_FILTERS StoreRetFilter = {0, };
- MESSAGE_LIST *pMessageList=NULL;
- //sandeep ends
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s%d", "mmi_jmms_save_mms_async_callback with Ret Code: ", eRet));
- memcpy(&save_params, (g_jmms_context->async_save_context.params), sizeof(jmms_async_save_params_struct));
- if (JC_OK != eRet || g_jmms_context->async_save_context.params == NULL)
- {
- goto ERROR_HANDLE;
- }
- g_jmms_context->pSaveContent->cbWriteCallback = NULL;
- g_jmms_context->pSaveContent->cbReadCallback = mmi_jmms_read_callback;
- eRet = mmi_jmms_jdi_get_msg_headers(save_params.hMsgHandle, &MsgHeaders);
- if (eRet != JC_OK || MsgHeaders == NULL)
- {
- goto ERROR_HANDLE;
- }
- if (save_params.is_store_update == MMI_FALSE)
- {
- #ifdef __MMI_UNIFIED_MESSAGE__
- {
- JC_UINT32 temp_extrabyte1 = 0x01000000, temp_extrabyte2 = 0x02000000;
- if (g_jmms_context->num_attachments > 0)
- {
- eRet = mmi_jmms_save_message_buffer_in_Store(
- save_params.folder_name,
- &(save_params.msg_index),
- MsgHeaders,
- g_jmms_context->pSaveContent,
- &temp_extrabyte1);
- }
- else
- {
- eRet = mmi_jmms_save_message_buffer_in_Store(
- save_params.folder_name,
- &(save_params.msg_index),
- MsgHeaders,
- g_jmms_context->pSaveContent,
- &temp_extrabyte2);
- }
- }
- #else /* __MMI_UNIFIED_MESSAGE__ */
- eRet = mmi_jmms_save_message_buffer_in_Store(
- save_params.folder_name,
- &(save_params.msg_index),
- MsgHeaders,
- g_jmms_context->pSaveContent,
- NULL);
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- }
- else
- {
- #ifdef __MMI_UNIFIED_MESSAGE__
- if (g_jmms_context->num_attachments > 0)
- {
- eRet = mmi_jmms_store_update_message(
- save_params.folder_name,
- &(save_params.msg_index),
- MsgHeaders,
- g_jmms_context->pSaveContent,
- 0x01000000);
- }
- else
- {
- eRet = mmi_jmms_store_update_message(
- save_params.folder_name,
- &(save_params.msg_index),
- MsgHeaders,
- g_jmms_context->pSaveContent,
- 0x02000000);
- }
- #else /* __MMI_UNIFIED_MESSAGE__ */
- eRet = mmi_jmms_store_update_message(
- save_params.folder_name,
- &(save_params.msg_index),
- MsgHeaders,
- g_jmms_context->pSaveContent,
- 0);
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- }
- if (eRet != JC_OK)
- {
- goto ERROR_HANDLE;
- }
- //sandeep starts
- //eRet = mmi_jmms_get_message(save_params.folder_name, &content, save_params.msg_index);
- StoreRetFilter.uiStartIndex = 1;
- StoreRetFilter.eRetrieve = E_RETRIEVE_BY_INDEX;
- StoreRetFilter.uiNumMessage = 0;
- eRet=mmi_jmms_jdi_get_msg_list(g_jmms_context->hStoreHandle,&pMessageList,&StoreRetFilter);
- //sandeep ends
- if(eRet == JC_OK)
- {
- eRet = mmi_jmms_jdi_store_update_extra_byte_1(g_jmms_context->hStoreHandle, save_params.msg_index, get_current_utc_time());
- }
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s%d", "JMMS Store Save API returned with Ret Code: ", eRet));
- ERROR_HANDLE:
- if (g_jmms_context->pSaveContent != NULL)
- {
- if (g_jmms_context->pSaveContent->bIsStream == E_FALSE)
- {
- jdd_MemFree(g_jmms_context->pSaveContent->pBuffer);
- g_jmms_context->pSaveContent->pBuffer = NULL;
- }
- if (g_jmms_context->pSaveContent->pStream != NULL)
- {
- if (g_jmms_context->jmms_fs_handle == NULL)
- {
- if (jdd_FSInitialize(&g_jmms_context->jmms_fs_handle) != JC_OK)
- {
- jdd_MemFree(g_jmms_context->async_save_context.params);
- g_jmms_context->async_save_context.params = NULL;
- mmi_jmms_decrement_save_callback_node(JC_ERR_FILE_SYS_INIT);
- return;
- }
- }
- jdd_FSDelete(g_jmms_context->jmms_fs_handle, g_jmms_context->pSaveContent->pStream);
- if (g_jmms_context->jmms_fs_handle != NULL)
- {
- jdd_FSDeinitialize(g_jmms_context->jmms_fs_handle);
- g_jmms_context->jmms_fs_handle = NULL;
- }
- jdd_MemFree(g_jmms_context->pSaveContent->pStream);
- }
- jdd_MemFree(g_jmms_context->pSaveContent);
- g_jmms_context->pSaveContent = NULL;
- }
- jdd_MemFree(g_jmms_context->async_save_context.params);
- g_jmms_context->async_save_context.params = NULL;
- mmi_jmms_decrement_save_callback_node(eRet);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_send_and_store_mms
- * DESCRIPTION
- *
- * PARAMETERS
- * folder_name [?] [?] [?]
- * hMsgHandle [IN]
- * comm_node [?] [?] [?]
- * RETURNS
- *
- *****************************************************************************/
- /* It is called in case of send and save, PDU is already in file. */
- JC_RETCODE mmi_jmms_send_and_store_mms(
- S8 *folder_name,
- MSG_HANDLE hMsgHandle,
- jmms_communication_state_node *comm_node)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_UINT32 msg_index = 0;
- CONTENT_DATA EncapsulatedContent = {0, };
- MESSAGE_HEADERS *MsgHeaders = NULL;
- JC_RETCODE eRet = JC_OK;
- JC_UINT32 uiFileLength = 0;
- JDD_FILE hFile = NULL;
- //sandeep starts
- RETRIEVE_FILTERS StoreRetFilter = {0, };
- MESSAGE_LIST *pMessageList=NULL;
- //sandeep ends
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_send_and_store_mms"));
- EncapsulatedContent.bIsStream = E_TRUE;
- EncapsulatedContent.cbWriteCallback = NULL;
- EncapsulatedContent.cbReadCallback = mmi_jmms_read_callback;
- EncapsulatedContent.pStream = comm_node->pFileName_used_for_Send;
- EncapsulatedContent.pFileName = comm_node->pFileName_used_for_Send;
- if (g_jmms_context->jmms_fs_handle == NULL)
- {
- if (jdd_FSInitialize(&g_jmms_context->jmms_fs_handle) != JC_OK)
- {
- eRet = JC_ERR_FILE_OPEN;
- goto ERROR_HANDLE;
- }
- }
- hFile = jdd_FSOpen(g_jmms_context->jmms_fs_handle, (JC_CHAR*) EncapsulatedContent.pStream, E_OPEN_READ_MODE);
- if (hFile == NULL)
- {
- eRet = JC_ERR_FILE_OPEN;
- goto ERROR_HANDLE;
- }
- eRet = jdd_FSGetSize(hFile, &uiFileLength);
- if (JC_OK != eRet)
- {
- eRet = JC_ERR_FILE_OPEN;
- goto ERROR_HANDLE;
- }
- EncapsulatedContent.uiTotalSize = uiFileLength;
- if (hFile != NULL)
- {
- jdd_FSClose(hFile);
- hFile = NULL;
- }
- if (g_jmms_context->jmms_fs_handle != NULL)
- {
- jdd_FSDeinitialize(g_jmms_context->jmms_fs_handle);
- g_jmms_context->jmms_fs_handle = NULL;
- }
- eRet = mmi_jmms_jdi_get_msg_headers(hMsgHandle, &MsgHeaders);
- if (eRet != JC_OK || MsgHeaders == NULL)
- {
- goto ERROR_HANDLE;
- }
- #ifdef __MMI_UNIFIED_MESSAGE__
- {
- JC_UINT32 temp_extrabyte1 = 0x01000000, temp_extrabyte2 = 0x02000000;
- if (g_jmms_context->num_attachments > 0)
- {
- eRet = mmi_jmms_save_message_buffer_in_Store(
- folder_name,
- &msg_index,
- MsgHeaders,
- &EncapsulatedContent,
- &temp_extrabyte1);
- }
- else
- {
- eRet = mmi_jmms_save_message_buffer_in_Store(
- folder_name,
- &msg_index,
- MsgHeaders,
- &EncapsulatedContent,
- &temp_extrabyte2);
- }
- }
- #else /* __MMI_UNIFIED_MESSAGE__ */
- eRet = mmi_jmms_save_message_buffer_in_Store(folder_name, &msg_index, MsgHeaders, &EncapsulatedContent, 0);
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- if (eRet != JC_OK)
- {
- goto ERROR_HANDLE;
- }
- //sandeep starts
- //eRet = mmi_jmms_get_message(save_params.folder_name, &content, save_params.msg_index);
- StoreRetFilter.uiStartIndex = 1;
- StoreRetFilter.eRetrieve = E_RETRIEVE_BY_INDEX;
- StoreRetFilter.uiNumMessage = 0;
- eRet=mmi_jmms_jdi_get_msg_list(g_jmms_context->hStoreHandle,&pMessageList,&StoreRetFilter);
- //sandeep ends
- if(eRet == JC_OK)
- {
- eRet = mmi_jmms_jdi_store_update_extra_byte_1(g_jmms_context->hStoreHandle, msg_index, get_current_utc_time());
- }
- ERROR_HANDLE:
- if (hFile != NULL)
- {
- jdd_FSClose(hFile);
- hFile = NULL;
- }
- if (g_jmms_context->jmms_fs_handle != NULL)
- {
- jdd_FSDeinitialize(g_jmms_context->jmms_fs_handle);
- g_jmms_context->jmms_fs_handle = NULL;
- }
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s%d", "mmi_jmms_send_and_store_mms returns: ", eRet));
- return eRet;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_send_mms
- * DESCRIPTION
- *
- * PARAMETERS
- * hMsgHandle [IN]
- * comm_state [IN]
- * bIsStream [IN]
- * retry_counter [IN]
- * bIsAsynch [IN]
- * RETURNS
- *
- *****************************************************************************/
- JC_RETCODE mmi_jmms_send_mms(
- MSG_HANDLE hMsgHandle,
- U16 comm_state,
- JC_BOOLEAN bIsStream,
- U8 retry_counter,
- JC_BOOLEAN bIsAsynch)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE eRet = JC_OK;
- static U32 unique_value = 0;
- jmms_async_send_params_struct *paramList = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* PMT VIKAS START 20060401 */
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_send_mms"));
- if((comm_state == E_TYPE_NOTIFICATION_RESPONSE) ||
- (comm_state == E_TYPE_READ_REPORT_PDU) ||
- (comm_state == E_TYPE_READ_REPORT_MMS) ||
- (comm_state == E_TYPE_ACK_RESPONSE))
- {
- eRet = mmi_jmms_send_synchronous_mms(
- hMsgHandle,
- comm_state,bIsStream,retry_counter,bIsAsynch,&unique_value);
- return eRet;
- }
- /* PMT VIKAS END 20060401 */
- if (bIsStream == E_TRUE)
- {
- JC_INT8 Temp[50] = {0, };
- unique_value++;
- if (unique_value > 200000)
- {
- unique_value = 0;
- }
- jc_sprintf(Temp, "%s%d", "@mms\temp\jmms_tempSendBuff", unique_value);
- if (g_jmms_context->pSendContent != NULL)
- {
- jdd_MemFree(g_jmms_context->pSendContent);
- }
- g_jmms_context->pSendContent = (CONTENT_DATA*) jdd_MemAlloc(sizeof(CONTENT_DATA), 1);
- jdi_UtilsCharToTchar(&(g_jmms_context->pSendContent->pFileName), Temp);
- g_jmms_context->pSendContent->pStream = (void*)g_jmms_context->pSendContent->pFileName;
- g_jmms_context->pSendContent->bIsStream = E_TRUE;
- g_jmms_context->pSendContent->cbWriteCallback = mmi_jmms_write_callback;
- }
- /******************************************************************************
- This modification is made to make the send MMS process async.
- Modified By : Raj Kumar Gupta
- Date of Modification : 08 June 2006
- *****************************************************************************/
- if (g_jmms_context->async_send_context.params != NULL)
- {
- jdd_MemFree(g_jmms_context->async_send_context.params);
- }
- paramList = (jmms_async_send_params_struct*) jdd_MemAlloc(sizeof(jmms_async_send_params_struct), 1);
- paramList->bIsStream = bIsStream;
- paramList->comm_state = comm_state;
- paramList->hMsgHandle = hMsgHandle;
- paramList->retry_counter = retry_counter;
- g_jmms_context->async_send_context.params = paramList;
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS ENCAPSULATION START"));
- eRet = mmi_jmms_jdi_encapsulate_buffer(hMsgHandle, g_jmms_context->pSendContent);
- /* Register the function that to be execute after the completion of the
- encapsulation */
- mmi_jmms_add_send_callback_node(mmi_jmms_send_mms_async_callback);
- /* Check whether Encapsulation is completed or not */
- if (eRet == JC_ERR_MMS_ENCODE_PENDING)
- {
- if (bIsAsynch == E_TRUE)
- {
- /* Start the Timer */
- mmi_jmms_send_continue_start_timer(hMsgHandle);
- }
- else
- {
- while (eRet == JC_ERR_MMS_ENCODE_PENDING)
- {
- eRet = mmi_jmms_jdi_msg_encapsulate_continue(hMsgHandle);
- }
- /* To execute the function that to be called after the completion of
- the encapsulation */
- mmi_jmms_decrement_send_callback_node(eRet);
- }
- }
- else
- {
- /* To execute the function that to be called after the completion of
- the encapsulation */
- mmi_jmms_decrement_send_callback_node(eRet);
- }
- return eRet;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_send_synchronous_mms
- * DESCRIPTION
- *
- * PARAMETERS
- * hMsgHandle [IN]
- * comm_state [IN]
- * bIsStream [IN]
- * retry_counter [IN]
- * bIsAsynch [IN]
- * unique_id_p [IN]
- * RETURNS
- * JC_RETCODE
- *****************************************************************************/
- JC_RETCODE mmi_jmms_send_synchronous_mms(
- MSG_HANDLE hMsgHandle,
- U16 comm_state,
- JC_BOOLEAN bIsStream,
- U8 retry_counter,
- JC_BOOLEAN bIsAsynch,U32* unique_id_p)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE eRet = JC_OK;
- CONTENT_DATA* content_data_p = NULL;
- JC_UINT32 uiReferenceID = 1;
- COMM_FETCH_URL fetchUrlInfo = {0, };
- U32 fs_not_init =0;
- JC_CHAR *fileptr = NULL;
- U8 *temp = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_send_synchronous_mms"));
- if (bIsStream == E_TRUE)
- {
- JC_INT8 Temp[50] = {0, };
- (*unique_id_p)++;
- if ((*unique_id_p) > 200000)
- {
- (*unique_id_p) = 0;
- }
- jc_sprintf(Temp, "%s%d", "@mms\temp\jmms_tempSendBuff", (*unique_id_p));
- content_data_p = (CONTENT_DATA*) jdd_MemAlloc(sizeof(CONTENT_DATA), 1);
- jdi_UtilsCharToTchar(&(content_data_p->pFileName), Temp);
- content_data_p->pStream = (void*)content_data_p->pFileName;
- content_data_p->bIsStream = E_TRUE;
- content_data_p->cbWriteCallback = mmi_jmms_write_callback;
- }
- else
- ASSERT(0);
- eRet = mmi_jmms_jdi_encapsulate_buffer(hMsgHandle, content_data_p);
- while (eRet == JC_ERR_MMS_ENCODE_PENDING)
- {
- eRet = mmi_jmms_jdi_msg_encapsulate_continue(hMsgHandle);
- }
- if (JC_OK != eRet)
- {
- if (eRet == JC_ERR_MEMORY_ALLOCATION || eRet == JC_ERR_FILE_WRITE)
- {
- eRet = E_JMMS_STORAGE_FULL;
- }
- }
- else
- {
- fetchUrlInfo.eContentMode = E_COMM_BUFFER;
- temp = mmi_jmms_get_activated_mmsc_url(g_jmms_context);
- fetchUrlInfo.pszURL = (JC_CHAR*) temp;
- fetchUrlInfo.pszContentType = "application/vnd.wap.mms-message";
- fetchUrlInfo.bIsFile = E_TRUE;
- fetchUrlInfo.uUserDataMode.pmFileName = content_data_p->pFileName;
- fetchUrlInfo.uiPostLen = content_data_p->uiTotalSize;
- fetchUrlInfo.pHeadersInfo = (COMM_HEADERS *)jdd_MemAlloc(sizeof(COMM_HEADERS), 1);
- fetchUrlInfo.pHeadersInfo->pszName = "Accept";
- fetchUrlInfo.pHeadersInfo->psValue = "*/*";
- fetchUrlInfo.pHeadersInfo->uiValueSize = 3;
- fetchUrlInfo.pHeadersInfo->pszCharset = "utf-8";
- fetchUrlInfo.pHeadersInfo->pNext = NULL;
- fetchUrlInfo.eCommFetchType = E_COMM_FETCH_POST;
- eRet = jdi_CommunicationFetchURL(g_jmms_context->hCommHandle, &fetchUrlInfo, &uiReferenceID);
- if (eRet == JC_OK)
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "JMMS Synch Send , Request id",
- uiReferenceID));
- fileptr = jdi_UtilsTcsDup(content_data_p->pFileName);
- eRet = mmi_jmms_add_comm_node(
- g_jmms_context,
- uiReferenceID,
- comm_state,
- fileptr,
- 0,
- retry_counter,
- NULL);
- if (eRet != JC_OK)
- {
- jdi_CommunicationFreeReference(g_jmms_context->hCommHandle, uiReferenceID);
- eRet = E_JMMS_GENERAL_ERROR;
- }
- }
- else
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s: %d %s %d",
- "mmi_jmms_send_synchronous_mms with request Id",
- g_jmms_context->uiReferenceID, "Returned error code: ", eRet));
- }
- if (eRet == JC_OK)
- {
- switch (comm_state)
- {
- case E_TYPE_NOTIFICATION_RESPONSE:
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "Synch Send Request for Notf-Response", uiReferenceID));
- break;
- case E_TYPE_ACK_RESPONSE:
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "Synch Send Request for Ack-Response", uiReferenceID));
- break;
- case E_TYPE_READ_REPORT_PDU:
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "Synch Send Request for Read Report PDU", uiReferenceID));
- break;
- case E_TYPE_READ_REPORT_MMS:
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "Synch Send Request for Read Report MMS", uiReferenceID));
- break;
- }
- }
- if (eRet != JC_OK)
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s: %d", "Sync Sending returns, Error Code:", eRet));
- if (content_data_p != NULL && content_data_p->pStream != NULL)
- {
- if (g_jmms_context->jmms_fs_handle == NULL)
- {
- if (jdd_FSInitialize(&g_jmms_context->jmms_fs_handle) != JC_OK)
- {
- fs_not_init = 1;
- }
- }
- if(!fs_not_init)
- {
- jdd_FSDelete(g_jmms_context->jmms_fs_handle, content_data_p->pStream);
- if (g_jmms_context->jmms_fs_handle != NULL)
- {
- jdd_FSDeinitialize(g_jmms_context->jmms_fs_handle);
- g_jmms_context->jmms_fs_handle = NULL;
- }
- }
- }
- if (fileptr != NULL)
- {
- jdd_MemFree(fileptr);
- }
- }
- if (content_data_p != NULL)
- {
- if (content_data_p->pStream != NULL)
- {
- jdd_MemFree(content_data_p->pStream);
- }
- if (content_data_p->pBuffer != NULL)
- {
- jdd_MemFree(content_data_p->pBuffer);
- }
- jdd_MemFree(content_data_p);
- }
- if(fetchUrlInfo.pHeadersInfo != NULL)
- {
- jdd_MemFree(fetchUrlInfo.pHeadersInfo);
- }
- if (g_jmms_context->activated_mmsc_url != NULL)
- {
- jdd_MemFree(g_jmms_context->activated_mmsc_url);
- g_jmms_context->activated_mmsc_url = NULL;
- }
- }
- return eRet;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_send_mms_async_callback
- * DESCRIPTION
- *
- * PARAMETERS
- * eRet [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_send_mms_async_callback(JC_RETCODE eRet)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *temp = NULL;
- JC_UINT32 uiReferenceID = 1;
- COMM_FETCH_URL fetchUrlInfo = {0, };
- jmms_async_send_params_struct *paramList = NULL;
- JC_CHAR *fileptr = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d", "mmi_jmms_send_mms_async_callback, Return Code:", eRet));
- if (g_jmms_context->async_send_context.params == NULL)
- {
- return;
- }
- paramList = g_jmms_context->async_send_context.params;
- if (JC_OK != eRet)
- {
- if (eRet == JC_ERR_MEMORY_ALLOCATION || eRet == JC_ERR_FILE_WRITE)
- {
- eRet = E_JMMS_STORAGE_FULL;
- }
- goto END;
- }
- fetchUrlInfo.eContentMode = E_COMM_BUFFER;
- temp = mmi_jmms_get_activated_mmsc_url(g_jmms_context);
- fetchUrlInfo.pszURL = (JC_CHAR*) temp;
- fetchUrlInfo.pszContentType = "application/vnd.wap.mms-message";
- if (g_jmms_context->pSendContent->bIsStream == E_FALSE)
- {
- fetchUrlInfo.bIsFile = E_FALSE;
- fetchUrlInfo.uUserDataMode.pucPostData = g_jmms_context->pSendContent->pBuffer;
- }
- else
- {
- fetchUrlInfo.bIsFile = E_TRUE;
- fetchUrlInfo.uUserDataMode.pmFileName = g_jmms_context->pSendContent->pFileName;
- }
- fetchUrlInfo.uiPostLen = g_jmms_context->pSendContent->uiTotalSize;
- //fetchUrlInfo.pHeadersInfo = NULL;
- fetchUrlInfo.pHeadersInfo = (COMM_HEADERS *)jdd_MemAlloc(sizeof(COMM_HEADERS), 1);
- fetchUrlInfo.pHeadersInfo->pszName = "Accept";
- fetchUrlInfo.pHeadersInfo->psValue = "*/*";
- fetchUrlInfo.pHeadersInfo->uiValueSize = 3;
- fetchUrlInfo.pHeadersInfo->pszCharset = "utf-8";
- fetchUrlInfo.pHeadersInfo->pNext = NULL;
- fetchUrlInfo.eCommFetchType = E_COMM_FETCH_POST;
- if (paramList->comm_state == E_TYPE_NEW_MMS || paramList->comm_state == E_TYPE_NEW_JAVA_MMS_SEND) /* both java mms and normal mms should not */
- { /* sent together otherwise refrece id will */
- /* /overlapped */
- /*
- * For New MMS Send need to use the g_jmms_context->uiReferenceID variable beacuse Sending screen
- * is there and Sending can be cancelled. Also don't use this variable for Immediate Retrieval etc.
- * because during Sending/Defered Downlaod there can be immediate retrieval so this varaiable can be overwritten.
- *
- * This variable is used during Sending/Deffered Downloading beacause Sending/Deffered Downlaoding can be
- * cancelled by user and so we require this value in jdi_CommunicationStopReq().
- * Also there is no harm on using the same varaible for sending and deffered retrieval because sending and
- * deffered retrieval cann't be both together.
- */
- g_jmms_context->uiReferenceID = 0;
- eRet = jdi_CommunicationFetchURL(g_jmms_context->hCommHandle, &fetchUrlInfo, &(g_jmms_context->uiReferenceID));
- if (eRet == JC_OK)
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "JMMS Comm Fetch URL for New MMS SEND, Request Id: ",
- g_jmms_context->uiReferenceID));
- fileptr = jdi_UtilsTcsDup(g_jmms_context->pSendContent->pFileName);
- eRet = mmi_jmms_add_comm_node(
- g_jmms_context,
- g_jmms_context->uiReferenceID,
- paramList->comm_state,
- fileptr,
- 0,
- paramList->retry_counter,
- NULL);
- if (eRet != JC_OK)
- {
- jdi_CommunicationFreeReference(g_jmms_context->hCommHandle, g_jmms_context->uiReferenceID);
- g_jmms_context->uiReferenceID = 0;
- eRet = E_JMMS_GENERAL_ERROR;
- goto END;
- }
- }
- else
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s: %d %s %d",
- "JMMS jdi_CommunicationFetchURL for NEW MMS Send with request Id",
- g_jmms_context->uiReferenceID, "Returned error code: ", eRet));
- }
- }
- else
- {
- eRet = jdi_CommunicationFetchURL(g_jmms_context->hCommHandle, &fetchUrlInfo, &uiReferenceID);
- if (eRet == JC_OK)
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "JMMS Comm Fetch URL for MMS Send, Request id",
- uiReferenceID));
- fileptr = jdi_UtilsTcsDup(g_jmms_context->pSendContent->pFileName);
- eRet = mmi_jmms_add_comm_node(
- g_jmms_context,
- uiReferenceID,
- paramList->comm_state,
- fileptr,
- 0,
- paramList->retry_counter,
- NULL);
- if (eRet != JC_OK)
- {
- jdi_CommunicationFreeReference(g_jmms_context->hCommHandle, uiReferenceID);
- eRet = E_JMMS_GENERAL_ERROR;
- goto END;
- }
- }
- else
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s: %d %s %d",
- "JMMS jdi_CommunicationFetchURL for Send MMS with request Id",
- g_jmms_context->uiReferenceID, "Returned error code: ", eRet));
- }
- }
- if (eRet == JC_OK)
- {
- switch (paramList->comm_state)
- {
- case E_TYPE_NEW_MMS:
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "JMMS Send Request for New MMS",
- g_jmms_context->uiReferenceID));
- break;
- case E_TYPE_NEW_JAVA_MMS_SEND:
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "JMMS Send Request for New Java MMS",
- g_jmms_context->uiReferenceID));
- break;
- case E_TYPE_NOTIFICATION_RESPONSE:
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "JMMS Send Request for Notf-Response", uiReferenceID));
- break;
- case E_TYPE_ACK_RESPONSE:
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "JMMS Send Request for Ack-Response", uiReferenceID));
- break;
- case E_TYPE_READ_REPORT_PDU:
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "JMMS Send Request for Read Report PDU", uiReferenceID));
- break;
- case E_TYPE_READ_REPORT_MMS:
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "JMMS Send Request for Read Report MMS", uiReferenceID));
- break;
- }
- }
- END:
- if (eRet != JC_OK)
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s: %d", "mmi_jmms_send_mms_async_callback, Error Code:", eRet));
- if (g_jmms_context->pSendContent != NULL && g_jmms_context->pSendContent->pStream != NULL)
- {
- if (g_jmms_context->jmms_fs_handle == NULL)
- {
- if (jdd_FSInitialize(&g_jmms_context->jmms_fs_handle) != JC_OK)
- {
- jdd_MemFree(g_jmms_context->async_send_context.params);
- g_jmms_context->async_send_context.params = NULL;
- mmi_jmms_decrement_send_callback_node(JC_ERR_FILE_SYS_INIT);
- return;
- }
- }
- jdd_FSDelete(g_jmms_context->jmms_fs_handle, g_jmms_context->pSendContent->pStream);
- if (g_jmms_context->jmms_fs_handle != NULL)
- {
- jdd_FSDeinitialize(g_jmms_context->jmms_fs_handle);
- g_jmms_context->jmms_fs_handle = NULL;
- }
- }
- if (fileptr != NULL)
- {
- jdd_MemFree(fileptr);
- }
- }
- if (g_jmms_context->pSendContent != NULL)
- {
- if (g_jmms_context->pSendContent->pStream != NULL)
- {
- jdd_MemFree(g_jmms_context->pSendContent->pStream);
- }
- if (g_jmms_context->pSendContent->pBuffer != NULL)
- {
- jdd_MemFree(g_jmms_context->pSendContent->pBuffer);
- }
- jdd_MemFree(g_jmms_context->pSendContent);
- g_jmms_context->pSendContent = NULL;
- }
- if(fetchUrlInfo.pHeadersInfo != NULL)
- {
- jdd_MemFree(fetchUrlInfo.pHeadersInfo);
- }
- if (g_jmms_context->activated_mmsc_url != NULL)
- {
- jdd_MemFree(g_jmms_context->activated_mmsc_url);
- g_jmms_context->activated_mmsc_url = NULL;
- }
- jdd_MemFree(g_jmms_context->async_send_context.params);
- g_jmms_context->async_send_context.params = NULL;
- mmi_jmms_decrement_send_callback_node(eRet);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_resend_mms
- * DESCRIPTION
- *
- * PARAMETERS
- * comm_node [?] [?] [?]
- * retry_counter [IN]
- * RETURNS
- *
- *****************************************************************************/
- JC_RETCODE mmi_jmms_resend_mms(jmms_communication_state_node *comm_node, U8 retry_counter)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- COMM_FETCH_URL fetchUrlInfo = {0, };
- JC_UINT32 uiReferenceID = 1;
- JC_RETCODE eRet = JC_OK;
- CONTENT_DATA EncapsulatedContent = {0, };
- U8 *temp = NULL;
- JC_UINT32 uiFileLength = 0;
- JDD_FILE hFile = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* PMT VIKAS START 20060401 */
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_resend_mms"));
- /* PMT VIKAS END 20060401 */
- if (comm_node->pFileName_used_for_Send == NULL)
- {
- eRet = JC_ERR_FILE_OPEN;
- goto END;
- }
- EncapsulatedContent.pStream = comm_node->pFileName_used_for_Send;
- EncapsulatedContent.pFileName = EncapsulatedContent.pStream;
- EncapsulatedContent.bIsStream = E_TRUE;
- EncapsulatedContent.cbWriteCallback = mmi_jmms_write_callback;
- if (g_jmms_context->jmms_fs_handle == NULL)
- {
- if (jdd_FSInitialize(&g_jmms_context->jmms_fs_handle) != JC_OK)
- {
- eRet = JC_ERR_FILE_OPEN;
- goto END;
- }
- }
- hFile = jdd_FSOpen(g_jmms_context->jmms_fs_handle, (JC_CHAR*) EncapsulatedContent.pStream, E_OPEN_READ_MODE);
- if (hFile == NULL)
- {
- eRet = JC_ERR_FILE_OPEN;
- goto END;
- }
- eRet = jdd_FSGetSize(hFile, &uiFileLength);
- if (JC_OK != eRet)
- {
- eRet = JC_ERR_FILE_OPEN;
- goto END;
- }
- EncapsulatedContent.uiTotalSize = uiFileLength;
- if (hFile != NULL)
- {
- jdd_FSClose(hFile);
- hFile = NULL;
- }
- /* / 7 March */
- if (g_jmms_context->jmms_fs_handle != NULL)
- {
- jdd_FSDeinitialize(g_jmms_context->jmms_fs_handle);
- g_jmms_context->jmms_fs_handle = NULL;
- }
- fetchUrlInfo.eContentMode = E_COMM_BUFFER;
- temp = mmi_jmms_get_activated_mmsc_url(g_jmms_context);
- fetchUrlInfo.pszURL = (JC_CHAR*) temp;
- /* if(EncapsulatedContent.VIEW_MODE.contentInline.pBuffer!=NULL) */
- fetchUrlInfo.pszContentType = "application/vnd.wap.mms-message";
- fetchUrlInfo.bIsFile = E_TRUE;
- fetchUrlInfo.uUserDataMode.pmFileName = EncapsulatedContent.pFileName;
- fetchUrlInfo.uiPostLen = EncapsulatedContent.uiTotalSize;
- //fetchUrlInfo.pHeadersInfo = NULL;
- fetchUrlInfo.pHeadersInfo = (COMM_HEADERS *)jdd_MemAlloc(sizeof(COMM_HEADERS), 1);
- fetchUrlInfo.pHeadersInfo->pszName = "Accept";
- fetchUrlInfo.pHeadersInfo->psValue = "*/*";
- fetchUrlInfo.pHeadersInfo->uiValueSize = 3;
- fetchUrlInfo.pHeadersInfo->pszCharset = "utf-8";
- fetchUrlInfo.pHeadersInfo->pNext = NULL;
- fetchUrlInfo.eCommFetchType = E_COMM_FETCH_POST;
- if (comm_node->mms_communication_state == E_TYPE_NEW_MMS
- || comm_node->mms_communication_state == E_TYPE_NEW_JAVA_MMS_SEND)
- {
- g_jmms_context->uiReferenceID = 0;
- eRet = jdi_CommunicationFetchURL(g_jmms_context->hCommHandle, &fetchUrlInfo, &(g_jmms_context->uiReferenceID));
- if (eRet == JC_OK)
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "JMMS Comm Fetch Resend MMS",
- g_jmms_context->uiReferenceID));
- eRet = mmi_jmms_update_comm_node(
- g_jmms_context,
- g_jmms_context->uiReferenceID,
- comm_node->uiReferenceID,
- retry_counter);
- if (eRet != JC_OK)
- {
- jdi_CommunicationFreeReference(g_jmms_context->hCommHandle, g_jmms_context->uiReferenceID);
- g_jmms_context->uiReferenceID = 0;
- eRet = JC_ERR_MEMORY_ALLOCATION;
- }
- }
- }
- else
- {
- eRet = jdi_CommunicationFetchURL(g_jmms_context->hCommHandle, &fetchUrlInfo, &(uiReferenceID));
- if (eRet == JC_OK)
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "JMMS Comm Fetch Resend", uiReferenceID));
- eRet = mmi_jmms_update_comm_node(g_jmms_context, uiReferenceID, comm_node->uiReferenceID, retry_counter);
- if (eRet != JC_OK)
- {
- jdi_CommunicationFreeReference(g_jmms_context->hCommHandle, uiReferenceID);
- eRet = JC_ERR_MEMORY_ALLOCATION;
- }
- /* PRINT_INFORMATION_2(( MMI_TRACE_INFO, "%s(%d)","JMMS Comm Node Updated",uiReferenceID)); */
- }
- }
- END:
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s%d", "mmi_jmms_resend_mms Returns with:", eRet));
- if(fetchUrlInfo.pHeadersInfo != NULL)
- {
- jdd_MemFree(fetchUrlInfo.pHeadersInfo);
- }
- return eRet;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_entry_communication_progress_screen
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_entry_communication_progress_screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 len = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_entry_communication_progress_screen"));
- EntryNewScreen(SCR_ID_JMMS_PROGRESS, NULL, mmi_jmms_entry_communication_progress_screen, NULL);
- if (g_jmms_context->g_jmms_progress_str[0] == 0x00)
- {
- len = pfnUnicodeStrlen((S8*) GetString(STR_ID_JMMS_PLEASE_WAIT));
- if (len > (MAX_PROGRESS_SCREEN_HINT_LEN - 1))
- {
- pfnUnicodeStrncpy(
- g_jmms_context->g_jmms_progress_str,
- GetString(STR_ID_JMMS_PLEASE_WAIT),
- (MAX_PROGRESS_SCREEN_HINT_LEN - 1));
- }
- else
- {
- pfnUnicodeStrcpy(g_jmms_context->g_jmms_progress_str, GetString(STR_ID_JMMS_PLEASE_WAIT));
- if ((len + 1) < (MAX_PROGRESS_SCREEN_HINT_LEN))
- {
- pfnUnicodeStrcat(g_jmms_context->g_jmms_progress_str, "n");
- }
- }
- }
- ShowCategory66Screen(
- STR_MMS_MENUENTRY,
- GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
- 0,
- 0,
- STR_GLOBAL_ABORT,
- IMG_GLOBAL_BACK,
- (U8*) (g_jmms_context->g_jmms_progress_str),
- IMG_GLOBAL_PROGRESS,
- NULL);
- ClearAllKeyHandler();
- SetRightSoftkeyFunction(mmi_jmms_cancel_mms_sending, KEY_EVENT_UP);
- mmi_jmms_set_end_key_progressing_handler();
- // SetKeyHandler(mmi_jmms_end_comm, KEY_END, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_end_comm
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_end_comm(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- jmms_communication_state_node *comm_node = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* PMT VIKAS START 20060325 */
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_end_comm"));
- #if defined (__USB_IN_NORMAL_MODE__)
- if (mmi_usb_is_in_mass_storage_mode())
- {
- mmi_jmms_cancel_comm_in_usb_mode();
- return;
- }
- #endif
- if (g_jmms_context->uiReferenceID != 0)
- {
- //#ifdef __MMI_MMS_SIGNATURE__
- mmi_jmms_del_inserted_auto_signature_slide();
- //#endif
- /* PMT VIKAS END 20060325 */
- #ifndef __MMI_UNIFIED_MESSAGE__
- // sandeep start to fix bug number PMT005980
- // mmi_jmms_deinit_mms_context(g_jmms_context);
- // sandeep end to fix bug number PMT005980
- #endif
- jdi_CommunicationStopReq(g_jmms_context->hCommHandle, g_jmms_context->uiReferenceID);
- jdi_CommunicationFreeReference(g_jmms_context->hCommHandle, g_jmms_context->uiReferenceID);
- comm_node = mmi_jmms_get_comm_state(g_jmms_context, g_jmms_context->uiReferenceID);
- if(comm_node) /* Vikram : This is required to stop retry incase of user abort*/
- comm_node->retry_counter = STOP_RETRY_COUNTER;
- g_jmms_context->uiReferenceID = 0;
- // sandeep start to fix bug number PMT005980
- // #ifdef __MMI_UNIFIED_MESSAGE__
- if (g_jmms_context->last_scr_id != SCR_ID_JMMS_OUTBOX_OPTIONS)
- {
- g_jmms_context->save_mms = MMI_TRUE;
- }
- // #endif /* __MMI_UNIFIED_MESSAGE__ */
- // sandeep start to fix bug number PMT005980
- g_jmms_context->last_scr_id = IDLE_SCREEN_ID;
- }
- /* By Raj Kumar Gupta to enable the End Key on Connecting Screen */
- else if( GetActiveScreenId() == SCR_ID_JMMS_PROGRESS )
- {
- // StopTimer(JMMS_ASYNC_PROCESS_TIMER);
- mmi_jmms_decrement_send_callback_node(E_COMMUNICATION_ABORTED);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_cancel_comm_in_usb_mode
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_cancel_comm_in_usb_mode(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- jmms_communication_state_node *comm_node = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "USB Mode: Stop All Comm"));
- comm_node = g_jmms_context->comm_state;
- while(comm_node)
- {
- if(comm_node->mms_communication_state != E_TYPE_NOTIFICATION_RESPONSE &&
- comm_node->mms_communication_state != E_TYPE_READ_REPORT_PDU &&
- comm_node->mms_communication_state != E_TYPE_ACK_RESPONSE &&
- comm_node->mms_communication_state != E_TYPE_READ_REPORT_MMS)
- {
- jdi_CommunicationStopReq(g_jmms_context->hCommHandle, g_jmms_context->uiReferenceID);
- mmi_jmms_free_comm_node(g_jmms_context, comm_node->uiReferenceID);
- comm_node = g_jmms_context->comm_state;
- }
- else
- {
- comm_node = comm_node->next;
- }
- }
- mmi_jmms_stop_download_busy();/* Added incase the download blinking is started but the comm node is not added to the list*/
- mmi_jmms_update_status_icon_indicator();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_cancel_mms_sending
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_cancel_mms_sending(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- jmms_communication_state_node *comm_node = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* PMT VIKAS START 20060325 */
- //#ifdef __MMI_MMS_SIGNATURE__
- mmi_jmms_del_inserted_auto_signature_slide();
- //#endif
- //PMT VIKAS END 20060325
- ///abort the communication
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s (%d)", "mmi_jmms_cancel_mms_sending, Reference id",
- g_jmms_context->uiReferenceID));
- /* Added by - Raj Kumar Gupta on 31 August, 2006 */
- if( g_jmms_context->uiReferenceID != 0 )
- {
- jdi_CommunicationStopReq(g_jmms_context->hCommHandle, g_jmms_context->uiReferenceID);
- jdi_CommunicationFreeReference(g_jmms_context->hCommHandle, g_jmms_context->uiReferenceID);
- comm_node = mmi_jmms_get_comm_state(g_jmms_context, g_jmms_context->uiReferenceID);
- if(comm_node) /* Vikram : This is required to stop retry incase of user abort*/
- comm_node->retry_counter = STOP_RETRY_COUNTER;
- }
- else
- {
- StopTimer(JMMS_ASYNC_SEND_TIMER);
- mmi_jmms_decrement_send_callback_node(E_COMMUNICATION_ABORTED);
- goto END;
- }
- g_jmms_context->uiReferenceID = 0;
- mmi_jmms_update_status_icon_indicator();
- END:
- /*Dilip Start 4 sept 2006*/
- #ifdef __MMI_UNIFIED_MESSAGE__
- if(IsScreenPresent(SCR_ID_JMMS_WRITE_MMS))
- {
- DeleteUptoScrID(SCR_ID_JMMS_WRITE_MMS);
- }
- else if (IsScreenPresent(SCR_ID_UM_UNSENT))
- {
- DeleteUptoScrID(SCR_ID_UM_UNSENT);
- }
- else if (IsScreenPresent(SCR_ID_UM_DRAFT))
- {
- DeleteUptoScrID(SCR_ID_UM_DRAFT);
- }
- else if (IsScreenPresent(SCR_ID_UM_INBOX))
- {
- DeleteUptoScrID(SCR_ID_UM_INBOX);
- }
- else if(IsScreenPresent(SCR_ID_UM_SENT))
- {
- DeleteUptoScrID(SCR_ID_UM_SENT);
- }
- #else
- return;
- #endif
- /*Dilip End 4 sept 2006*/
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_get_to_addresses
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- *
- *****************************************************************************/
- S8 *mmi_jmms_get_to_addresses(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 len = 0;
- jmms_address_list *address_node;
- S8 *pTo = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- address_node = g_jmms_context->to_address_p;
- while (address_node != NULL)
- {
- len = len + (pfnUnicodeStrlen(address_node->address)) * ENCODING_LENGTH + ENCODING_LENGTH;
- address_node = address_node->next;
- }
- pTo = (S8*) jdd_MemAlloc(sizeof(S8), len);
- if (NULL == pTo)
- {
- return NULL;
- }
- address_node = g_jmms_context->to_address_p;
- while (address_node != NULL)
- {
- pfnUnicodeStrcat((S8*) pTo, (const S8*)address_node->address);
- address_node = address_node->next;
- if (address_node != NULL)
- {
- pfnUnicodeStrcat((S8*) pTo, (const S8*)";");
- }
- }
- return pTo;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_get_cc_addresses
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- *
- *****************************************************************************/
- S8 *mmi_jmms_get_cc_addresses(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 len = 0;
- jmms_address_list *address_node;
- S8 *pCc = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- address_node = g_jmms_context->cc_address_p;
- while (address_node != NULL)
- {
- len = len + (pfnUnicodeStrlen(address_node->address)) * ENCODING_LENGTH + ENCODING_LENGTH;
- address_node = address_node->next;
- }
- pCc = (S8*) jdd_MemAlloc(sizeof(S8), len);
- if (NULL == pCc)
- {
- return NULL;
- }
- address_node = g_jmms_context->cc_address_p;
- while (address_node != NULL)
- {
- pfnUnicodeStrcat((S8*) pCc, (const S8*)address_node->address);
- address_node = address_node->next;
- if (address_node != NULL)
- {
- pfnUnicodeStrcat((S8*) pCc, (const S8*)";");
- }
- }
- return pCc;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_get_bcc_addresses
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- *
- *****************************************************************************/
- S8 *mmi_jmms_get_bcc_addresses(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 len = 0;
- jmms_address_list *address_node;
- S8 *pBcc = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- address_node = g_jmms_context->bcc_address_p;
- while (address_node != NULL)
- {
- len = len + (pfnUnicodeStrlen(address_node->address)) * ENCODING_LENGTH + ENCODING_LENGTH;
- address_node = address_node->next;
- }
- pBcc = (S8*) jdd_MemAlloc(sizeof(S8), len);
- if (NULL == pBcc)
- {
- return NULL;
- }
- address_node = g_jmms_context->bcc_address_p;
- while (address_node != NULL)
- {
- pfnUnicodeStrcat((S8*) pBcc, (const S8*)address_node->address);
- address_node = address_node->next;
- if (address_node != NULL)
- {
- pfnUnicodeStrcat((S8*) pBcc, (const S8*)";");
- }
- }
- return pBcc;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_check_for_idle_screen
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_check_for_idle_screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 currScrenID;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- currScrenID = GetActiveScreenId();
- if (currScrenID == IDLE_SCREEN_ID)
- {
- g_jmms_context->store_context->current_folder_name = 0;
- if (mmi_jmms_need_mms_ind())
- {
- TurnOnBacklight(GPIO_BACKLIGHT_SHORT_TIME);
- mmi_jmms_entry_new_mms_ind();
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_show_new_mms_pop_up
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_show_new_mms_pop_up(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 currScrenID;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- currScrenID = GetActiveScreenId();
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_show_new_mms_pop_up"));
- #if defined (__USB_IN_NORMAL_MODE__) && !defined (__MMI_UNIFIED_MESSAGE__)
- if (mmi_jmms_check_usb_mode() == 0)
- #endif
- {
- #if defined (__MMI_UNIFIED_MESSAGE__)
- if ((currScrenID == IDLE_SCREEN_ID) || (currScrenID == SCR_ID_UM_NEW_MSG_IND)|| (currScrenID == SCR_ID_UM_NEW_MSG_DUMMY_IND))
- #else
- if (currScrenID == IDLE_SCREEN_ID)
- #endif
- {
- if (mmi_jmms_need_mms_ind())
- {
- TurnOnBacklight(GPIO_BACKLIGHT_SHORT_TIME);
- mmi_jmms_entry_new_mms_ind();
- PlayMessageArrivalTone();
- }
- }
- else
- {
- /* manish as part of bug Fixing */
- if ((!isInCall()) && (!AlmIsTonePlaying())) /* if no call is there only then show it */
- {
- TurnOnBacklight(GPIO_BACKLIGHT_SHORT_TIME);
- mmi_msg_entry_new_msg_popup(MSG_NEW_JMMS_MMS);
- }
- /*Dilip Start 12th sept 2006 to give beep sound when MMS is recievd in call*/
- else if(isInCall() == MMI_TRUE)
- {
- playRequestedTone(SMS_IN_CALL_TONE);
- }
- /*Dilip END 12th sept 2006 to give beep sound when MMS is recievd in call*/
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_retry_communication
- * DESCRIPTION
- *
- * PARAMETERS
- * jmms_context [?] [?] [?]
- * calling_function [IN]
- * uiReferenceID [IN]
- * error_code [IN]
- * RETURNS
- *
- *****************************************************************************/
- JC_RETCODE mmi_jmms_retry_communication(
- jmms_context_struct *jmms_context,
- U16 calling_function,
- JC_UINT32 uiReferenceID,
- JC_RETCODE error_code)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE eRet = JC_OK;
- jmms_communication_state_node *comm_node = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* PMT VIKAS START 20060401 */
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d", "mmi_jmms_retry_communication, Reference Id:", uiReferenceID));
- /* PMT VIKAS END 20060401 */
- comm_node = mmi_jmms_get_comm_state(jmms_context, uiReferenceID);
- /* To avoid crash incase comm_node is NULL*/
- if (comm_node == NULL)
- {
- return E_UNKNOWN_MSG;
- }
- if(comm_node->retry_counter == STOP_RETRY_COUNTER)
- return eRet;
- switch (comm_node->mms_communication_state)
- {
- case E_TYPE_NEW_MMS:
- #ifdef MMI_JMMS_JAVA_MMS_SUPPORT
- case E_TYPE_NEW_JAVA_MMS_SEND:
- #endif
- if (comm_node->retry_counter < MAX_MMS_SEND_TRY_COUNTER)
- {
- comm_node->retry_counter++;
- eRet = mmi_jmms_resend_mms(comm_node, comm_node->retry_counter);
- if (JC_OK != eRet)
- {
- goto END;
- }
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s: %d", "JMMS Resending New MMS Try No",
- comm_node->retry_counter));
- }
- else
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS Resending New MMS Try Complete"));
- eRet = E_JMMS_RETRY_COMPLETE;
- goto END;
- }
- break;
- case E_TYPE_READ_REPORT_PDU:
- case E_TYPE_READ_REPORT_MMS:
- if (comm_node->retry_counter < MAX_MMS_SIGNAL_TRY_COUNTER)
- {
- comm_node->retry_counter++;
- eRet = mmi_jmms_resend_mms(comm_node, comm_node->retry_counter);
- if (JC_OK != eRet)
- {
- goto END;
- }
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s: %d", "JMMS Resending Read Report Try No",
- comm_node->retry_counter));
- }
- else
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS Resending Read Report Try Complete"));
- eRet = E_JMMS_RETRY_COMPLETE; /* /no try counter left */
- goto END;
- }
- break;
- case E_TYPE_ACK_RESPONSE:
- case E_TYPE_NOTIFICATION_RESPONSE:
- if (comm_node->retry_counter < MAX_MMS_SIGNAL_TRY_COUNTER)
- {
- comm_node->retry_counter++;
- eRet = mmi_jmms_resend_mms(comm_node, comm_node->retry_counter);
- if (JC_OK != eRet)
- {
- goto END;
- }
- if (comm_node->mms_communication_state == E_TYPE_ACK_RESPONSE)
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s: %d", "JMMS Resending ACK Try No",
- comm_node->retry_counter));
- }
- else
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s: %d", "JMMS Resending Notify-Response Try No",
- comm_node->retry_counter));
- }
- }
- else
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS Resending ACK Try Complete"));
- eRet = E_JMMS_RETRY_COMPLETE; /* /no try counter left */
- goto END;
- }
- break;
- case E_TYPE_IMMEDIATE_RETRIEVAL_FETCH:
- case E_TYPE_DEFFERED_RETRIEVAL_FETCH:
- if (comm_node->retry_counter < MAX_MMS_DOWNLOAD_TRY_COUNTER)
- {
- if (comm_node->mms_content_location != NULL)
- {
- comm_node->retry_counter++;
- eRet = mmi_jmms_download_mms(
- comm_node->mms_content_location,
- comm_node->mms_communication_state,
- comm_node->msg_index,
- comm_node->retry_counter);
- if (JC_OK != eRet)
- {
- goto END;
- }
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s: %d", "JMMS Redownlaoding MMS Try No:",
- comm_node->retry_counter));
- }
- }
- else
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS Redownloading MMS Try Complete"));
- eRet = E_JMMS_RETRY_COMPLETE; /* /no try counter left */
- goto END;
- }
- break;
- } /* /switch(jmms_context->mms_communication_state) */
- if (eRet == JC_OK)
- {
- if (GetActiveScreenId() == SCR_ID_JMMS_PROGRESS)
- {
- ChangeTitleString((U8*)GetString(STR_ID_JMMS_RETRY));
- draw_title();
- cat66_update_progress_string();
- }
- }
- END:
- if (eRet != JC_OK)
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d", "Error in mmi_jmms_retry_communication, Error Code: ", eRet));
- mmi_jmms_handle_error_in_communication(jmms_context, calling_function, comm_node, error_code);
- /*Vikram: For communication retry, DeleteUptoScrId is not correct as this will delete the CM marker screen or other screen*/
- /*Dilip Start 24 Aug 2006*/
- /*
- #ifdef __MMI_UNIFIED_MESSAGE__
- if (IsScreenPresent(SCR_ID_UM_UNSENT))
- {
- DeleteUptoScrID(SCR_ID_UM_UNSENT);
- }
- else if (IsScreenPresent(SCR_ID_UM_DRAFT))
- {
- DeleteUptoScrID(SCR_ID_UM_DRAFT);
- }
- else if (IsScreenPresent(SCR_ID_UM_INBOX))
- {
- DeleteUptoScrID(SCR_ID_UM_INBOX);
- }
- else if(IsScreenPresent(SCR_ID_UM_SENT))
- {
- DeleteUptoScrID(SCR_ID_UM_SENT);
- }
- #endif
- */
- /*Dilip End 24 Aug 2006*/
- mmi_jmms_free_comm_node(jmms_context, comm_node->uiReferenceID);
- }
- return eRet;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_handle_error_in_communication
- * DESCRIPTION
- *
- * PARAMETERS
- * jmms_context [?] [?] [?]
- * calling_function [IN]
- * comm_node [?] [?] [?]
- * error_code [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_handle_error_in_communication(
- jmms_context_struct *jmms_context,
- U16 calling_function,
- jmms_communication_state_node *comm_node,
- JC_RETCODE error_code)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE eRet = JC_OK;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_handle_error_in_communication"));
- switch (comm_node->mms_communication_state)
- {
- case E_TYPE_NEW_MMS:
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS Communication state: NEW MMS"));
- if (calling_function == E_FROM_ERROR_CALLBACK)
- {
- #ifdef __MMI_UNIFIED_MESSAGE__
- if (!IsScreenPresent(SCR_ID_JMMS_OUTBOX_OPTIONS))
- #else
- if (g_jmms_context->last_scr_id != SCR_ID_JMMS_OUTBOX_OPTIONS)
- #endif
- {
- #ifndef __MMI_UNIFIED_MESSAGE__
- if (g_jmms_context->save_mms == MMI_TRUE)
- {
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s",
- "JMMS, MMS not from Outbox, so Sending and storing the MMS in Outbox"));
- /********** Raj Kumar Gupta on September 20, 2006 */
- if (comm_node->uiReferenceID != 0)
- {
- jdi_CommunicationFreeReference(g_jmms_context->hCommHandle, comm_node->uiReferenceID);
- }
- /********** Raj Kumar Gupta on September 20, 2006 */
- eRet = mmi_jmms_send_and_store_mms("Outbox", jmms_context->msg_handle, comm_node);