JMMSProtocol.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:298k
源码类别:

MTK

开发平台:

C/C++

  1.                         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d", "JMMS, mmi_jmms_send_and_store_mms returned:",
  2.                                              eRet));
  3.                         if (eRet == JC_OK)
  4.                         {
  5.                         #ifdef __MMI_UNIFIED_MESSAGE__
  6.                             if (IsScreenPresent(SCR_ID_JMMS_DRAFTS_OPTIONS))
  7.                         #else 
  8.                             if (g_jmms_context->last_scr_id == SCR_ID_JMMS_DRAFTS_OPTIONS)
  9.                         #endif 
  10.                             {
  11.                                 /* /it means mmms was sent using "Sent" Option in Drafts */
  12.                                 mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT_AND_STORED);
  13.                                 mmi_jmms_drafts_delete_on_sent();
  14.                             }
  15.                             else
  16.                             {
  17.                                 //TODO:: display error pop up with preoper string for error 
  18.                                 ///by knowing error type status (error_code parameter)
  19.                                 mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT_AND_STORED);
  20.                             #ifdef __MMI_UNIFIED_MESSAGE__
  21.                                 if (IsScreenPresent(SCR_ID_JMMS_PREVIEW))
  22.                                 {
  23.                                     DeleteScreenFromToNnodes(SCR_ID_JMMS_PROGRESS, 5);
  24.                                 }
  25. else if(!IsScreenPresent(SCR_ID_UM_MAIN))
  26.   {
  27. DeleteScreenFromToNnodes(SCR_ID_JMMS_PROGRESS, 3);
  28.   }
  29. else
  30.                                 {
  31.                                     DeleteScreenFromToNnodes(SCR_ID_JMMS_PROGRESS, 4);
  32.                                 }
  33.                             #else /* __MMI_UNIFIED_MESSAGE__ */ 
  34.                                 DeleteScreenFromToNnodes(SCR_ID_JMMS_PROGRESS, 3);    // sachin  
  35.                             #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  36.                                 ///back to main mms screen if come from write mms
  37.                                 ///back to "Send to other" option screen if from there etc.
  38.                             }
  39.                         }
  40.                         else
  41.                         {
  42.                             //TODO:: display error pop up with preoper string for error of sent
  43.                             ///by knowing error type status (error_code parameter)
  44.                             if (eRet == E_MEMORY_FULL_ERROR)
  45.                             {
  46.                                 mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT_AND_FAIL_STORE_MEMORY);
  47.                             }
  48.                             else if (eRet == JC_ERR_MEMORY_ALLOCATION || eRet == JC_ERR_FILE_WRITE)
  49.                             {
  50.                                 if(g_jmms_context->save_mms == MMI_TRUE)
  51.                                 {
  52.                                 mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT_AND_FAIL_STORE_MEM_FULL);
  53.                             }
  54.                             else
  55.                             {
  56.                                     mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_MEMORY_FULL_REACH);
  57.                                 }
  58.                             }
  59.                             else
  60.                             {
  61.                                 mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT_AND_FAIL_STORE);
  62.                             }
  63.                             /* /called from 'Sent" option in Drafts folder */
  64. #ifdef __MMI_UNIFIED_MESSAGE__
  65. if(IsScreenPresent(SCR_ID_JMMS_PREVIEW))
  66. {
  67. DeleteScreenFromToNnodes(SCR_ID_JMMS_PROGRESS, 5);
  68. }
  69. else if (IsScreenPresent(SCR_ID_JMMS_DRAFTS_OPTIONS))
  70.                     {
  71.                     DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, SCR_ID_UM_DRAFT);
  72.             }
  73. else if(!IsScreenPresent(SCR_ID_UM_MAIN))
  74.   {
  75. DeleteScreenFromToNnodes(SCR_ID_JMMS_PROGRESS, 3);
  76.   }
  77. else
  78. {
  79. DeleteScreenFromToNnodes(SCR_ID_JMMS_PROGRESS, 4);
  80. }
  81. #else
  82.                         if (g_jmms_context->last_scr_id == SCR_ID_JMMS_DRAFTS_OPTIONS)
  83.                     {
  84.                     DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, g_jmms_context->last_scr_id);
  85.             }
  86. else
  87. DeleteScreenFromToNnodes(SCR_ID_JMMS_PROGRESS, 3);
  88. #endif
  89.                         }
  90.                     #ifndef __MMI_UNIFIED_MESSAGE__
  91.                     }
  92.                     else
  93.                     {
  94.                         /* /it means called from "Send Only" option */
  95. // sandeep start 22 Nov for bug number PMT006053
  96. eRet = mmi_jmms_send_and_store_mms("Outbox", jmms_context->msg_handle, comm_node);
  97. if(eRet == JC_OK)
  98. {
  99. mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT_AND_STORED);
  100. }
  101. else
  102. {
  103. if (eRet == E_MEMORY_FULL_ERROR)
  104. {
  105. mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_COMM_ABORTED_AND_FAIL_STORE_MEMORY);
  106. }
  107. else if (eRet == JC_ERR_MEMORY_ALLOCATION || eRet == JC_ERR_FILE_WRITE)
  108. {
  109. mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_COMM_ABORTED_AND_FAIL_STORE_MEM_FULL);
  110. }
  111. else
  112. {
  113. mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_COMM_ABORTED_AND_FAIL_STORE);
  114. }
  115. }
  116.                         //mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT);
  117. // sandeep end 22 Nov for bug number PMT006053
  118.                         DeleteScreenFromToNnodes(SCR_ID_JMMS_PROGRESS, 3);
  119.                     }
  120.                     #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  121.                 }
  122.                 else
  123.                 {
  124.                     //it meas user selects "Resent" from Outbox.
  125.                     ///in this case update the MMS into the outbox
  126.                     eRet = mmi_jmms_send_and_store_mms("Outbox", jmms_context->msg_handle, comm_node);
  127.                     if( JC_OK == eRet)
  128.                     {
  129.                         eRet = mmi_jmms_delete_message(MMI_JMMS_OUTBOX, g_jmms_context->store_context->nMsgs_in_Current_folder - (g_jmms_context->nCurr_scr_hilited_index));
  130.                     }
  131.                     else if(E_MEMORY_FULL_ERROR == eRet)
  132.                     {
  133.                         mmi_jmms_add_memory_full_node_if_not_already();
  134.                     }
  135.                     mmi_jmms_handle_error_string(error_code, E_TYPE_NEW_MMS);
  136. #ifdef __MMI_UNIFIED_MESSAGE__
  137. if(IsScreenPresent(SCR_ID_UM_UNSENT))
  138. DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, SCR_ID_UM_UNSENT);
  139. else
  140.                             DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, IDLE_SCREEN_ID);
  141. #else
  142. DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, g_jmms_context->last_scr_id);
  143. #endif
  144.                 }
  145.                 mmi_jmms_deinit_mms_context(jmms_context);
  146.             }
  147.             else
  148.             {
  149.                 // TODO:: need to display string accordinbg to error_code
  150.                 mmi_jmms_handle_error_string(error_code, E_TYPE_NEW_MMS);
  151.                 if (g_jmms_context->last_scr_id == SCR_ID_JMMS_OUTBOX_OPTIONS
  152.                     || g_jmms_context->last_scr_id == SCR_ID_JMMS_DRAFTS_OPTIONS)
  153.                 {
  154.                     ///it means mms sent from "ReSent" in Outbox or "Sent" in Drafts
  155.                     ///for these deinit the complete mms context
  156.                     mmi_jmms_deinit_mms_context(jmms_context);
  157.                 }
  158.                 else
  159.                 {
  160.                     mmi_jmms_free_message_header();
  161.                 }
  162.                 DeleteScreenIfPresent(SCR_ID_JMMS_PROGRESS);
  163.                 DeleteScreenIfPresent(SCR_ID_JMMS_SENT_OPTIONS);
  164.                 DeleteScreenIfPresent(SCR_ID_JMMS_DRAFTS_OPTIONS);
  165.                 DeleteScreenIfPresent(SCR_ID_JMMS_OUTBOX_OPTIONS);
  166.                 DeleteScreenIfPresent(SCR_ID_WRITE_MMS_DONE_OPTIONS);
  167. //                DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, g_jmms_context->last_scr_id);
  168.             }
  169.             break;
  170.         #ifdef MMI_JMMS_JAVA_MMS_SUPPORT
  171.         case E_TYPE_NEW_JAVA_MMS_SEND:
  172.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS Communication state: NEW JAVA MMS"));
  173.             mmi_jmms_deinit_mms_context(jmms_context);
  174.             (*(jmms_context->jsr_mms_send_callback)) (JSR_RESULT_ERROR);
  175.             break;
  176.         #endif /* MMI_JMMS_JAVA_MMS_SUPPORT */ 
  177.         case E_TYPE_ACK_RESPONSE:
  178.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS Communication state: MMS ACK Response"));
  179.             break;
  180.         case E_TYPE_NOTIFICATION_RESPONSE:
  181.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS Communication state: MMS Notification response"));
  182.             break;
  183.         case E_TYPE_READ_REPORT_PDU:
  184.         case E_TYPE_READ_REPORT_MMS:
  185.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS Communication state: MMS Read Report"));
  186.             if (eRet == E_JMMS_STORAGE_FULL)
  187.             {
  188.                 eRet = mmi_jmms_add_pending_mms_info_node(
  189.                         (U16) STR_ID_JMMS_STORAGE_ERROR_READ_REPORT_SENT,
  190.                         (U8) E_MSG_TYPE_IDLE_SCREEN_POP_UP,
  191.                         NULL);
  192.             }
  193.             else
  194.             {
  195.                 eRet = mmi_jmms_add_pending_mms_info_node(
  196.                         (U16) STR_ID_JMMS_ERROR_READ_REPORT_SENT,
  197.                         (U8) E_MSG_TYPE_IDLE_SCREEN_POP_UP,
  198.                         NULL);
  199.             }
  200.             if (eRet == JC_OK)
  201.             {
  202.                 mmi_jmms_check_for_idle_screen();
  203.             }
  204.             break;
  205.         case E_TYPE_IMMEDIATE_RETRIEVAL_FETCH:
  206.         case E_TYPE_DEFFERED_RETRIEVAL_FETCH:
  207.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS Communication state: MMS Download"));
  208.             jdi_CommunicationFreeReference(g_jmms_context->hCommHandle, comm_node->uiReferenceID);
  209.             mmi_jmms_update_status_icon_indicator();
  210.             if (comm_node->mms_communication_state == E_TYPE_DEFFERED_RETRIEVAL_FETCH)
  211.             {
  212.                 if (calling_function == E_FROM_ERROR_CALLBACK)
  213.                 {
  214.                     mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_DOWNLAOD);
  215.                 }
  216.                 else
  217.                 {
  218.                     mmi_jmms_handle_error_string(error_code, E_TYPE_DEFFERED_RETRIEVAL_FETCH);
  219.                 }
  220.             #ifdef __MMI_UNIFIED_MESSAGE__
  221. if(IsScreenPresent(SCR_ID_UM_INBOX))
  222. DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, SCR_ID_UM_INBOX);    /* sachin */
  223. else
  224.                     DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, IDLE_SCREEN_ID);    /* sachin */
  225.             #else 
  226.                 DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, g_jmms_context->last_scr_id);
  227.             #endif 
  228.             }
  229.             else if (comm_node->mms_communication_state == E_TYPE_IMMEDIATE_RETRIEVAL_FETCH)
  230.             {
  231.                 /*
  232.                     Changes are made to fix PMTSW00004306.
  233.                  */
  234.                 /*eRet = mmi_jmms_add_pending_mms_info_node(
  235.                         (U16) STR_ID_JMMS_ERROR_MMS_DOWNLAOD_STORE_FUL,
  236.                         (U8) E_MSG_TYPE_IDLE_SCREEN_POP_UP,
  237.                         NULL);*/    
  238.                 U16 currScrenID = GetActiveScreenId();
  239. //sandeep starts
  240.             #if defined (__MMI_UNIFIED_MESSAGE__)
  241.                 eRet = mmi_jmms_add_pending_mms_info_node(
  242.                         (U16) comm_node->msg_index, //sandeep pass message index in case of UM
  243.                         (U8) E_MSG_TYPE_RECEIVE,
  244.                         NULL);
  245. if ((currScrenID == IDLE_SCREEN_ID) || (currScrenID == SCR_ID_UM_NEW_MSG_IND)|| (currScrenID == SCR_ID_UM_NEW_MSG_DUMMY_IND))
  246.                 {
  247.                     if (eRet == JC_OK)
  248.                     {
  249.                         mmi_jmms_check_for_idle_screen();
  250.                     }
  251.                 }
  252. #else
  253.                 eRet = mmi_jmms_add_pending_mms_info_node(
  254.                         (U16) STR_ID_JMMS_NEW_MMS_NOTIFICATION,
  255.                         (U8) E_MSG_TYPE_IDLE_SCREEN_POP_UP,
  256.                         NULL);
  257. if (currScrenID == IDLE_SCREEN_ID)
  258. {
  259. if (eRet == JC_OK)
  260. {
  261. mmi_jmms_check_for_idle_screen();
  262. }
  263. }
  264.             #endif
  265. //sandeep ends
  266.             
  267.                 else
  268.                 {
  269.                     mmi_jmms_show_new_mms_pop_up();
  270.                 }
  271.             }
  272.     }
  273. //#ifdef __MMI_MMS_SIGNATURE__
  274.     mmi_jmms_del_inserted_auto_signature_slide();
  275. //#endif 
  276. }
  277. /*****************************************************************************
  278.  * FUNCTION
  279.  *  mmi_jmms_handle_error_string
  280.  * DESCRIPTION
  281.  *  
  282.  * PARAMETERS
  283.  *  error_code              [IN]        
  284.  *  communication_state     [IN]        
  285.  * RETURNS
  286.  *  void
  287.  *****************************************************************************/
  288. void mmi_jmms_handle_error_string(JC_RETCODE error_code, U16 communication_state)
  289. {
  290.     /*----------------------------------------------------------------*/
  291.     /* Local Variables                                                */
  292.     /*----------------------------------------------------------------*/
  293.     /*----------------------------------------------------------------*/
  294.     /* Code Body                                                      */
  295.     /*----------------------------------------------------------------*/
  296.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s%d", "mmi_jmms_handle_error_string, Error Code:", error_code));
  297.     if (communication_state == E_TYPE_NEW_MMS)
  298.     {
  299.         /* /These are error code for Send Conf. Pdu reposne */
  300.         switch (error_code)
  301.         {
  302.             case E_RESP_ERR_SENDING_ADDR_UNRESOLVED:
  303.             case E_RESP_TRANSIENT_SENDING_ADDR_UNRESOLVED:
  304.             case E_RESP_PERMANENT_SENDING_ADDRESS_UNRESOLVED:
  305.                 mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_ADDR_UNRESOLVED);
  306.                 return;
  307.             case E_RESP_ERR_NETWORK_PROBLEM:
  308.                 mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_NETWORK_PROBLEM);
  309.                 return;
  310.             case E_RESP_ERR_CONTENT_NOT_ACCEPTED:
  311.             case E_RESP_ERR_UNSUPPORTED_MSG:
  312.             case E_RESP_PERMANENT_MSG_FORMAT_CORRUPT:
  313.             case E_RESP_PERMANENT_MSG_NOT_FOUND:
  314.             case E_RESP_PERMANENT_CONTENT_NOT_ACCEPTED:
  315.                 mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_INVALID_MSG);
  316.                 return;
  317.             case E_RESP_PERMANENT_REPLY_CHARGING_NOT_ACCEPTED:
  318.             case E_RESP_PERMANENT_REPLY_CHARGING_FORWARD_DENIED:
  319.             case E_RESP_PERMANET_REPLY_CHARGING_NOT_SUPPORTED:
  320.                 mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_REPLY_CHARGING);
  321.                 return;
  322.             case E_RESP_PERMANENT_ADDRESS_HIDING_NOT_SUPPORTED:
  323.                 mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_ADDR_HIDING);
  324.                 return;
  325.             case E_RESP_ERR_SERVICE_DENIED:
  326.                 mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_SERVER_DENIED);
  327.                 return;
  328.         }
  329.     }
  330.     switch (error_code)
  331.     {
  332.         case JMMS_WRONG_CONTENT_TYPE_ERROR:
  333.             mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_WRONG_CONTENT_TYPE);
  334.             return;
  335.         case 300:
  336.         case 301:
  337.         case 302:
  338.         case 303:
  339.         case 304:
  340.         case 305:
  341.         case 306:
  342.         case 307:
  343.             mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_REDIRECTION);
  344.             return;
  345.         case 400:
  346.         case 401:
  347.         case 402:
  348.         case 403:
  349.         case 404:
  350.         case 405:
  351.         case 406:
  352.         case 407:
  353.         case 408:
  354.         case 409:
  355.         case 410:
  356.         case 411:
  357.         case 412:
  358.         case 413:
  359.         case 414:
  360.         case 415:
  361.         case 416:
  362.         case 417:
  363.             mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_CLIENT);
  364.             return;
  365.         case 500:
  366.         case 501:
  367.         case 502:
  368.         case 503:
  369.         case 504:
  370.         case 505:
  371.             mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_SERVER);
  372.             return;
  373.         case JC_ERR_FILE_FULL:
  374.             if(communication_state == E_TYPE_NEW_MMS)
  375.             {
  376.                 mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT_AND_FAIL_STORE_MEM_FULL);
  377.             }
  378.             else
  379.             {
  380.                 mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_DOWNLAOD_STORE_FUL);
  381.             }
  382.             return;
  383.         default:
  384.             if (communication_state == E_TYPE_NEW_MMS)
  385.             {
  386.                 mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT);
  387.                 return;
  388.             }
  389.             else if (communication_state == E_TYPE_DEFFERED_RETRIEVAL_FETCH)
  390.             {
  391.                 mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_DOWNLAOD);
  392.                 return;
  393.             }
  394.     }
  395.     return;
  396. }
  397. /*****************************************************************************
  398.  * FUNCTION
  399.  *  mmi_jmms_get_em_mms_version
  400.  * DESCRIPTION
  401.  *  
  402.  * PARAMETERS
  403.  *  void
  404.  * RETURNS
  405.  *  
  406.  *****************************************************************************/
  407. S8 *mmi_jmms_get_em_mms_version(void)
  408. {
  409.     /*----------------------------------------------------------------*/
  410.     /* Local Variables                                                */
  411.     /*----------------------------------------------------------------*/
  412.     /*----------------------------------------------------------------*/
  413.     /* Code Body                                                      */
  414.     /*----------------------------------------------------------------*/
  415.     switch (wap_custom_get_mms_version())
  416.     {
  417.         case EM_MMS_VERSION_10:
  418.             /* Change MMS agent to version 1.0 no matter MMSC */
  419.             return "1.0";
  420.         case EM_MMS_VERSION_11:
  421.             /* Change MMS agent to version 1.1 no matter MMSC */
  422.             return "1.1";
  423.         case EM_MMS_VERSION_12:
  424.             /* Change MMS agent to version 1.2 no matter MMSC */
  425.             return "1.2";
  426.         default:
  427.             return "1.0";
  428.     }
  429. }
  430. /*****************************************************************************
  431.  * FUNCTION
  432.  *  mmi_jmms_set_mmsc_version
  433.  * DESCRIPTION
  434.  *  
  435.  * PARAMETERS
  436.  *  void
  437.  * RETURNS
  438.  *  
  439.  *****************************************************************************/
  440. JC_RETCODE mmi_jmms_set_mmsc_version(void)
  441. {
  442.     /*----------------------------------------------------------------*/
  443.     /* Local Variables                                                */
  444.     /*----------------------------------------------------------------*/
  445.     FS_HANDLE fh = 0;
  446.     S32 ret_code, len = 0;
  447.     U32 read_len = 0, index;
  448.     S8 *file_buffer = NULL;
  449.     S8 file_name[(MAX_FILE_LENGTH + 1) * ENCODING_LENGTH];
  450.     U8 *temp_uniocde_url = NULL;
  451.     JC_RETCODE eRet = JC_OK;
  452.     /*----------------------------------------------------------------*/
  453.     /* Code Body                                                      */
  454.     /*----------------------------------------------------------------*/
  455.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_set_mmsc_version"));
  456.     g_jmms_context->version = jdd_MemAlloc(sizeof(S8), (MAX_VERSION_LENGTH + 1) * ENCODING_LENGTH);
  457.     if (g_jmms_context->version == NULL)
  458.     {
  459.         eRet = JC_ERR_MEMORY_ALLOCATION;
  460.         goto END;
  461.     }
  462.     /* /mmsc_url is mmsc url set in message settings */
  463.     temp_uniocde_url = mmi_jmms_get_activated_mmsc_url(g_jmms_context);
  464.     if (temp_uniocde_url == NULL)
  465.     {
  466.         eRet = JC_ERR_MEMORY_ALLOCATION;
  467.         goto END;
  468.     }
  469.     /*
  470.      * These modification is made to not to convert the version string into the unicode string.
  471.      * 
  472.      * Modified by : Raj Kumar Gupta
  473.      * Date        : July 27, 2006
  474.      */
  475.     if (wap_custom_get_mms_version() == EM_MMS_VERSION_DEFAULT)
  476.     {
  477.         if ((g_jmms_context->nSent_last_MMSC_URL != NULL)
  478.             && (strcmp((S8*) (g_jmms_context->nSent_last_MMSC_URL), (S8*) temp_uniocde_url) == 0))
  479.         {
  480.             strcpy((S8*) g_jmms_context->version, (S8*) g_jmms_context->nSent_last_version);
  481.         }
  482.         else
  483.         {
  484.             AnsiiToUnicodeString((PS8) file_name, (PS8) MMS_MMSC_URLS_FILE_NAME);
  485.             fh = FS_Open((const WCHAR*)file_name, FS_READ_ONLY);
  486.             if (fh > 0) /* /file exists */
  487.             {
  488.                 len = GetFSFileSize(fh);
  489.                 file_buffer = (S8*) jdd_MemAlloc(sizeof(S8), len);
  490.                 if ((NULL == file_buffer) && (len > 0))
  491.                 {
  492.                     eRet = JC_ERR_MEMORY_ALLOCATION;
  493.                     goto END;
  494.                 }
  495.                 if (len > 0)
  496.                 {
  497.                     ret_code = FS_Read(fh, file_buffer, len, &read_len);
  498.                     if (ret_code < 0)
  499.                     {
  500.                         eRet = ret_code;
  501.                         goto END;
  502.                     }
  503.                 }
  504.                 if (fh > 0)
  505.                 {
  506.                     FS_Close(fh);
  507.                 }
  508.                 len = 0;
  509.                 index = 0;
  510.                 while ((read_len - index) != 0)
  511.                 {
  512.                     len = (pfnUnicodeStrlen(file_buffer + index) + 1) * ENCODING_LENGTH;
  513.                     if (pfnUnicodeStrcmp((S8*) (file_buffer + index), (S8*) temp_uniocde_url) == 0)
  514.                     {
  515.                         index = index + len;
  516.                         UnicodeToAnsii((S8*) g_jmms_context->version, (S8*) (file_buffer + index));
  517.                         break;
  518.                     }
  519.                     else
  520.                     {
  521.                         index = index + len;
  522.                         len = (pfnUnicodeStrlen(file_buffer + index) + 1) * ENCODING_LENGTH;
  523.                         index = index + len;
  524.                     }
  525.                 }
  526.                 read_len = read_len - index;
  527.                 if (read_len == 0)  /* /entry not found */
  528.                 {
  529.                     /* /set the defualt version for MMS */
  530.                     strcpy((PS8) g_jmms_context->version, (PS8) (mmi_jmms_get_em_mms_version()));
  531.                 }
  532.                 if (file_buffer)
  533.                 {
  534.                     jdd_MemFree(file_buffer);
  535.                     file_buffer = NULL;
  536.                 }
  537.             }
  538.             else
  539.             {
  540.                 /* set the defualt version for MMS */
  541.                 strcpy((PS8) g_jmms_context->version, (PS8) (mmi_jmms_get_em_mms_version()));
  542.             }
  543.         }
  544.     }
  545.     else
  546.     {
  547.         strcpy((PS8) g_jmms_context->version, (PS8) (mmi_jmms_get_em_mms_version()));
  548.     }
  549.   END:
  550.     if (file_buffer)
  551.     {
  552.         jdd_MemFree(file_buffer);
  553.         file_buffer = NULL;
  554.     }
  555.     return eRet;
  556. }
  557. /*****************************************************************************
  558.  * FUNCTION
  559.  *  mmi_jmms_read_callback
  560.  * DESCRIPTION
  561.  *  
  562.  * PARAMETERS
  563.  *  pStream         [?]         [?]         [?]
  564.  *  uiOffset        [IN]        
  565.  *  uiSize          [IN]        
  566.  *  pBuffer         [?]         [?]         [?]
  567.  *  pSizeRead       [?]         [?]         [?]
  568.  * RETURNS
  569.  *  
  570.  *****************************************************************************/
  571. JC_RETCODE mmi_jmms_read_callback(
  572.             void *pStream,
  573.             JC_INT32 uiOffset,
  574.             JC_UINT32 uiSize,
  575.             JC_UINT8 *pBuffer,
  576.             JC_UINT32 *pSizeRead)
  577. {
  578.     /*----------------------------------------------------------------*/
  579.     /* Local Variables                                                */
  580.     /*----------------------------------------------------------------*/
  581.     JC_RETCODE eRet = JC_OK;
  582.     JDD_FILE hFile = NULL;
  583.     /*----------------------------------------------------------------*/
  584.     /* Code Body                                                      */
  585.     /*----------------------------------------------------------------*/
  586.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS Read Callback"));
  587.     if (pStream == NULL || pBuffer == NULL)
  588.     {
  589.         eRet = JC_ERR_INVALID_PARAMETER;
  590.         goto error;
  591.     }
  592.     if (g_jmms_context->jmms_fs_handle == NULL)
  593.     {
  594.         if (jdd_FSInitialize(&g_jmms_context->jmms_fs_handle) != JC_OK)
  595.         {
  596.             eRet = JC_ERR_FILE_OPEN;
  597.             goto error;
  598.         }
  599.     }
  600.     hFile = jdd_FSOpen(g_jmms_context->jmms_fs_handle, (JC_CHAR*) pStream, E_OPEN_READ_MODE);
  601.     if (hFile == NULL)
  602.     {
  603.         eRet = JC_ERR_FILE_OPEN;
  604.         goto error;
  605.     }
  606.     if (uiOffset > 0)
  607.     {
  608.         eRet = jdd_FSSeek(hFile, uiOffset, E_FILE_SEEK_SET);
  609.         if (eRet != JC_OK)
  610.         {
  611.             goto error;
  612.         }
  613.     }
  614.     *pSizeRead = jdd_FSRead(pBuffer, sizeof(JC_INT8), uiSize, hFile);
  615.     if (*pSizeRead != uiSize)
  616.     {
  617.         eRet = JC_ERR_FILE_READ;
  618.     }
  619.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "File Name: %s, bytes read = %d", pStream, *pSizeRead));
  620.   error:
  621.     if (hFile != NULL)
  622.     {
  623.         jdd_FSClose(hFile);
  624.     }
  625.     if (g_jmms_context->jmms_fs_handle != NULL)
  626.     {
  627.         jdd_FSDeinitialize(g_jmms_context->jmms_fs_handle);
  628.         g_jmms_context->jmms_fs_handle = NULL;
  629.     }
  630.     return eRet;
  631. }
  632. /*****************************************************************************
  633.  * FUNCTION
  634.  *  mmi_jmms_write_callback
  635.  * DESCRIPTION
  636.  *  
  637.  * PARAMETERS
  638.  *  pStream     [?]         [?]         [?]
  639.  *  pBuffer     [?]         [?]         [?]
  640.  *  uiSize      [IN]        
  641.  * RETURNS
  642.  *  
  643.  *****************************************************************************/
  644. JC_RETCODE mmi_jmms_write_callback(void *pStream, JC_UINT8 *pBuffer, JC_UINT32 uiSize)
  645. {
  646.     /*----------------------------------------------------------------*/
  647.     /* Local Variables                                                */
  648.     /*----------------------------------------------------------------*/
  649.     JC_RETCODE eRet = JC_OK;
  650.     JC_INT32 iBytesWritten = 0;
  651.     JDD_FILE hFile = NULL;
  652.     /*----------------------------------------------------------------*/
  653.     /* Code Body                                                      */
  654.     /*----------------------------------------------------------------*/
  655.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS Write Callback"));
  656.     if (pStream == NULL || pBuffer == NULL)
  657.     {
  658.         eRet = JC_ERR_NULL_POINTER;
  659.         goto error;
  660.     }
  661.     if (uiSize == 0)
  662.     {
  663.         eRet = JC_ERR_INVALID_PARAMETER;
  664.         goto error;
  665.     }
  666.     if (g_jmms_context->jmms_fs_handle == NULL)
  667.     {
  668.         if (jdd_FSInitialize(&g_jmms_context->jmms_fs_handle) != JC_OK)
  669.         {
  670.             eRet = JC_ERR_FILE_OPEN;
  671.             goto error;
  672.         }
  673.     }
  674.     hFile = jdd_FSOpen(g_jmms_context->jmms_fs_handle, (JC_CHAR*) pStream, E_CREATE_APPEND_WRITE_MODE);
  675.     if (hFile == NULL)
  676.     {
  677.         eRet = JC_ERR_FILE_OPEN;
  678.         goto error;
  679.     }
  680.     iBytesWritten = jdd_FSWrite(pBuffer, 1, uiSize, hFile);
  681.     if (iBytesWritten != uiSize)
  682.     {
  683.         eRet = JC_ERR_FILE_WRITE;
  684.     }
  685.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "File Name: %s, bytes written = %d", pStream, iBytesWritten));
  686.   error:
  687.     if (hFile != NULL)
  688.     {
  689.         jdd_FSClose(hFile);
  690.     }
  691.     if (g_jmms_context->jmms_fs_handle != NULL)
  692.     {
  693.         jdd_FSDeinitialize(g_jmms_context->jmms_fs_handle);
  694.         g_jmms_context->jmms_fs_handle = NULL;
  695.     }
  696.     
  697.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "JMMS Write Callback return: %d", eRet));
  698.     return eRet;
  699. }
  700. /*****************************************************************************
  701.  * FUNCTION
  702.  *  mmi_jmms_handle_notification_ack_response
  703.  * DESCRIPTION
  704.  *  
  705.  * PARAMETERS
  706.  *  jmms_context        [?]     [?]     [?]
  707.  *  pURLInd             [?]     [?]     [?]
  708.  *  Content             [?]     [?]     [?]
  709.  * RETURNS
  710.  *  
  711.  *****************************************************************************/
  712. JC_RETCODE mmi_jmms_handle_notification_ack_response(
  713.             jmms_context_struct *jmms_context,
  714.             COMM_FETCH_URL_IND_RESP *pURLInd,
  715.             CONTENT_DATA *Content)
  716. {
  717.     /*----------------------------------------------------------------*/
  718.     /* Local Variables                                                */
  719.     /*----------------------------------------------------------------*/
  720.     JC_RETCODE eRet = JC_OK;
  721.     /*----------------------------------------------------------------*/
  722.     /* Code Body                                                      */
  723.     /*----------------------------------------------------------------*/
  724.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_handle_notification_ack_response"));
  725.     mmi_jmms_free_comm_node(jmms_context, pURLInd->uiRequestID);
  726.     eRet = jdi_CommunicationFreeReference(jmms_context->hCommHandle, pURLInd->uiRequestID);
  727.     pURLInd->uiRequestID = 0;
  728.     return eRet;
  729. }
  730. /*****************************************************************************
  731.  * FUNCTION
  732.  *  mmi_jmms_handle_read_report_pdu_response
  733.  * DESCRIPTION
  734.  *  
  735.  * PARAMETERS
  736.  *  jmms_context        [?]     [?]     [?]
  737.  *  pURLInd             [?]     [?]     [?]
  738.  *  Content             [?]     [?]     [?]
  739.  * RETURNS
  740.  *  
  741.  *****************************************************************************/
  742. JC_RETCODE mmi_jmms_handle_read_report_pdu_response(
  743.             jmms_context_struct *jmms_context,
  744.             COMM_FETCH_URL_IND_RESP *pURLInd,
  745.             CONTENT_DATA *Content)
  746. {
  747.     /*----------------------------------------------------------------*/
  748.     /* Local Variables                                                */
  749.     /*----------------------------------------------------------------*/
  750.     JC_RETCODE eRet = JC_OK;
  751.     /*----------------------------------------------------------------*/
  752.     /* Code Body                                                      */
  753.     /*----------------------------------------------------------------*/
  754.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_handle_read_report_pdu_response"));
  755.     eRet = mmi_jmms_add_pending_mms_info_node(
  756.             (U16) STR_ID_JMMS_SUCCESS_READ_REPORT_SENT,
  757.             (U8) E_MSG_TYPE_IDLE_SCREEN_POP_UP,
  758.             NULL);
  759.     if (eRet == JC_OK)
  760.     {
  761.         mmi_jmms_check_for_idle_screen();
  762.     }
  763.     mmi_jmms_free_comm_node(jmms_context, pURLInd->uiRequestID);
  764.     eRet = jdi_CommunicationFreeReference(jmms_context->hCommHandle, pURLInd->uiRequestID);
  765.     pURLInd->uiRequestID = 0;
  766.     return eRet;
  767. }
  768. /*****************************************************************************
  769.  * FUNCTION
  770.  *  mmi_jmms_handle_read_report_mms_response
  771.  * DESCRIPTION
  772.  *  
  773.  * PARAMETERS
  774.  *  jmms_context        [?]     [?]     [?]
  775.  *  pURLInd             [?]     [?]     [?]
  776.  *  Content             [?]     [?]     [?]
  777.  * RETURNS
  778.  *  
  779.  *****************************************************************************/
  780. JC_RETCODE mmi_jmms_handle_read_report_mms_response(
  781.             jmms_context_struct *jmms_context,
  782.             COMM_FETCH_URL_IND_RESP *pURLInd,
  783.             CONTENT_DATA *Content)
  784. {
  785.     /*----------------------------------------------------------------*/
  786.     /* Local Variables                                                */
  787.     /*----------------------------------------------------------------*/
  788.     JC_RETCODE eRet = JC_OK;
  789.     MSG_HANDLE hTempMsg = NULL;
  790.     MESSAGE_HEADERS *pMsgHeaders = NULL;
  791.     EMM1MessageType eMsg;
  792.     /*----------------------------------------------------------------*/
  793.     /* Code Body                                                      */
  794.     /*----------------------------------------------------------------*/
  795.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_handle_read_report_mms_response"));
  796.     eRet = mmi_jmms_jdi_parse_msg_buffer(&hTempMsg, Content, E_TYPE_MMS, E_FALSE);
  797.     /* Async changes start */
  798.     while (eRet == JC_ERR_MMS_PARSE_PENDING)
  799.     {
  800.         eRet = mmi_jmms_jdi_msg_parse_continue(hTempMsg);
  801.     };
  802.     /* Async changes end */
  803.     if (eRet != JC_OK)
  804.     {
  805.         eRet = mmi_jmms_add_pending_mms_info_node(
  806.                 (U16) STR_ID_JMMS_ERROR_READ_REPORT_SENT,
  807.                 (U8) E_MSG_TYPE_IDLE_SCREEN_POP_UP,
  808.                 NULL);
  809.         if (eRet == JC_OK)
  810.         {
  811.             mmi_jmms_check_for_idle_screen();
  812.         }
  813.         goto CaseEnd;
  814.     }
  815.     eRet = mmi_jmms_jdi_get_msg_headers(hTempMsg, &pMsgHeaders);
  816.     if (eRet != JC_OK)
  817.     {
  818.         eRet = mmi_jmms_add_pending_mms_info_node(
  819.                 (U16) STR_ID_JMMS_ERROR_READ_REPORT_SENT,
  820.                 (U8) E_MSG_TYPE_IDLE_SCREEN_POP_UP,
  821.                 NULL);
  822.         if (eRet == JC_OK)
  823.         {
  824.             mmi_jmms_check_for_idle_screen();
  825.         }
  826.         goto CaseEnd;
  827.     }
  828.     eMsg = pMsgHeaders->eMsgType;
  829.     switch (pMsgHeaders->eMsgType)
  830.     {
  831.         case E_MSG_TYPE_SEND_RESPONSE:
  832.         {
  833.             MESSAGE_SEND_RESPONSE *pSendHdr = (MESSAGE_SEND_RESPONSE*) pMsgHeaders->pHeaders;
  834.             if (E_RESP_OK == pSendHdr->eStatus)
  835.             {
  836.                 eRet = mmi_jmms_add_pending_mms_info_node(
  837.                         (U16) STR_ID_JMMS_SUCCESS_READ_REPORT_SENT,
  838.                         (U8) E_MSG_TYPE_IDLE_SCREEN_POP_UP,
  839.                         NULL);
  840.             }
  841.             else
  842.             {
  843.                 eRet = mmi_jmms_add_pending_mms_info_node(
  844.                         (U16) STR_ID_JMMS_ERROR_READ_REPORT_SENT,
  845.                         (U8) E_MSG_TYPE_IDLE_SCREEN_POP_UP,
  846.                         NULL);
  847.             }
  848.             if (eRet == JC_OK)
  849.             {
  850.                 mmi_jmms_check_for_idle_screen();
  851.             }
  852.         }
  853.             break;
  854.     }
  855.   CaseEnd:
  856.     /* /added for retry mechanism */
  857.     mmi_jmms_free_comm_node(jmms_context, pURLInd->uiRequestID);
  858.     if (NULL != hTempMsg)
  859.     {
  860.         mmi_jmms_jdi_msg_deinit(hTempMsg);
  861.         hTempMsg = NULL;
  862.     }
  863.     eRet = jdi_CommunicationFreeReference(jmms_context->hCommHandle, pURLInd->uiRequestID);
  864.     pURLInd->uiRequestID = 0;
  865.     return eRet;
  866. }
  867. /*****************************************************************************
  868.  * FUNCTION
  869.  *  mmi_jmms_handle_immediate_downlaod_response
  870.  * DESCRIPTION
  871.  *  
  872.  * PARAMETERS
  873.  *  jmms_context        [?]     [?]     [?]
  874.  *  pURLInd             [?]     [?]     [?]
  875.  *  Content             [?]     [?]     [?]
  876.  * RETURNS
  877.  *  
  878.  *****************************************************************************/
  879. JC_RETCODE mmi_jmms_handle_immediate_downlaod_response(
  880.             jmms_context_struct *jmms_context,
  881.             COMM_FETCH_URL_IND_RESP *pURLInd,
  882.             CONTENT_DATA *Content)
  883. {
  884.     /*----------------------------------------------------------------*/
  885.     /* Local Variables                                                */
  886.     /*----------------------------------------------------------------*/
  887.     /* JC_UINT32 msgid = 0; */
  888.     JC_RETCODE eRet = JC_OK;
  889.     MSG_HANDLE hTempMsg = NULL;
  890.     MESSAGE_HEADERS *pMsgHeaders = NULL;
  891.     JC_INT8 *content_type = NULL;
  892.     JC_UINT32 msg_index;
  893.     JC_RETCODE ret_val = JC_OK;
  894.     /*----------------------------------------------------------------*/
  895.     /* Code Body                                                      */
  896.     /*----------------------------------------------------------------*/
  897.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_handle_immediate_downlaod_response"));
  898.     eRet = mmi_jmms_jdi_parse_msg_buffer(&hTempMsg, Content, E_TYPE_MMS, E_FALSE);
  899.     /* Async changes start */
  900.     while (eRet == JC_ERR_MMS_PARSE_PENDING)
  901.     {
  902.         eRet = mmi_jmms_jdi_msg_parse_continue(hTempMsg);
  903.     }
  904.     /* Async changes end */
  905.     if (JC_OK != eRet)
  906.     {
  907.         goto Endcase;
  908.     }
  909.     eRet = mmi_jmms_jdi_get_msg_headers(hTempMsg, &pMsgHeaders);
  910.     if (eRet != JC_OK || pMsgHeaders == NULL)
  911.     {
  912.         goto Endcase;
  913.     }
  914.     ///putting here as found that stroe_update change the file name
  915.     ///so require to use before that
  916.     eRet = jmms_mmi_notification_response_for_immediate_retrieval(*Content);
  917.     if (pMsgHeaders->eMsgType == E_MSG_TYPE_RECEIVE)
  918.     {
  919.         jmms_communication_state_node *comm_node = NULL;
  920.         comm_node = mmi_jmms_get_comm_state(jmms_context, pURLInd->uiRequestID);
  921.         if (comm_node == NULL)
  922.         {
  923.             eRet = mmi_jmms_add_pending_mms_info_node(
  924.                     (U16) STR_ID_JMMS_NEW_MMS_NOT_SAVED,
  925.                     (U8) E_MSG_TYPE_IDLE_SCREEN_POP_UP,
  926.                     NULL);
  927.             if (eRet == JC_OK)
  928.             {
  929.                 mmi_jmms_check_for_idle_screen();
  930.             }
  931.             goto Endcase;
  932.         }
  933.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "(%d) Comm Node index = %d", __LINE__, comm_node->msg_index));
  934.         if (comm_node->msg_index == 0)  /* /it means notification didn't save successfully */
  935.         {
  936.         #ifdef __MMI_UNIFIED_MESSAGE__
  937.             mmi_jmms_get_content_type(Content, &content_type);
  938.             if (MMI_TRUE == mmi_jsr_check_recv_mms_for_java(content_type))
  939.             {
  940.                 JC_UINT32 temp_extrabyte = 0x02000000;
  941.                 eRet = mmi_jmms_save_message_buffer_in_Store("Inbox", &msg_index, pMsgHeaders, Content, &temp_extrabyte);
  942.             }
  943.             else
  944.         #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  945.                 eRet = mmi_jmms_save_message_buffer_in_Store("Inbox", &msg_index, pMsgHeaders, Content, NULL);
  946.             if (eRet != JC_OK)
  947.             {
  948.                 if (eRet == JC_ERR_MEMORY_ALLOCATION || eRet == JC_ERR_FILE_WRITE)
  949.                 {
  950.                     eRet = mmi_jmms_add_pending_mms_info_node(
  951.                             (U16) STR_ID_JMMS_NEW_MMS_MEMORY_NOT_SAVED,
  952.                             (U8) E_MSG_TYPE_IDLE_SCREEN_POP_UP,
  953.                             NULL);
  954.                 }
  955.                 else
  956.                 {
  957.                     eRet = mmi_jmms_add_pending_mms_info_node(
  958.                             (U16) STR_ID_JMMS_NEW_MMS_NOT_SAVED,
  959.                             (U8) E_MSG_TYPE_IDLE_SCREEN_POP_UP,
  960.                             NULL);
  961.                 }
  962.                 if (eRet == JC_OK)
  963.                 {
  964.                     mmi_jmms_check_for_idle_screen();
  965.                 }
  966.                 goto Endcase;
  967.             }
  968.         }
  969.         else    /* /update the notification */
  970.         {
  971.             msg_index = (comm_node->msg_index);
  972.             ret_val = mmi_jmms_get_content_type(Content, &content_type);
  973.         #ifdef __MMI_UNIFIED_MESSAGE__
  974.             if (MMI_TRUE == mmi_jsr_check_recv_mms_for_java(content_type))
  975.             {
  976.                 eRet = mmi_jmms_store_update_message("Inbox", &(msg_index), pMsgHeaders, Content, 0x02000000);
  977.             }
  978.             else
  979.         #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  980.                 eRet = mmi_jmms_store_update_message("Inbox", &(msg_index), pMsgHeaders, Content, 0);
  981.             if (eRet != JC_OK)
  982.             {
  983.                 eRet = mmi_jmms_add_pending_mms_info_node(
  984.                         (U16) STR_ID_JMMS_NEW_MMS_NOT_SAVED,
  985.                         (U8) E_MSG_TYPE_IDLE_SCREEN_POP_UP,
  986.                         NULL);
  987.                 if (eRet == JC_OK)
  988.                 {
  989.                     mmi_jmms_check_for_idle_screen();
  990.                 }
  991.                 goto Endcase;
  992.             }
  993.             ///to handle the case when current scrn is Inbox Msgs List screen
  994.             /// and Notification need to be updated by Msg recieved
  995.         #ifdef __MMI_UNIFIED_MESSAGE__
  996.     if ( (IsScreenPresent(SCR_ID_UM_INBOX)) || (GetActiveScreenId() == SCR_ID_UM_INBOX) )
  997.         #else /* amit checked in inbox screen is present the reset the count*/
  998.     if ( (IsScreenPresent(SCR_ID_JMMS_INBOX)) || (GetActiveScreenId() == SCR_ID_JMMS_INBOX) )
  999.         #endif 
  1000.             {
  1001.                 /* /to forcefully run the condition in mmi_jmms_entry_inbox_screen() */
  1002.             #ifdef __MMI_UNIFIED_MESSAGE__
  1003.                 mmi_um_jmms_highlight_mms_message_ind();
  1004.             #endif 
  1005.                 g_jmms_context->store_context->update_nmsgs_in_current_folder = 1;
  1006.             }
  1007.         }
  1008.     #ifdef MMI_JMMS_JAVA_MMS_SUPPORT
  1009.         ///Manish chnaging  as found that stroe_update change the file name
  1010.         ///so require to use before that
  1011.         ////eRet=mmi_jmms_get_content_type(Content,&content_type);
  1012.         if (ret_val == JC_OK)
  1013.         {
  1014.             if (mmi_jsr_check_recv_mms_for_java(content_type))
  1015.             {
  1016.                 if ((!isInCall()) && (!AlmIsTonePlaying())) /* if no call is there only then show it */
  1017.                 {
  1018.                     mmi_jmms_update_status_icon_indicator();
  1019.                     mmi_msg_entry_new_msg_popup(MSG_NEW_JMMS_JAVA_MMS);
  1020.                 }
  1021.                 else
  1022.                 {
  1023.                     eRet = mmi_jmms_add_pending_mms_info_node(
  1024.                             (U16) STR_ID_JMMS_NEW_JAVA_MMS,
  1025.                             (U8) E_MSG_TYPE_IDLE_SCREEN_POP_UP,
  1026.                             NULL);
  1027.                     if (eRet == JC_OK)
  1028.                     {
  1029.                         mmi_jmms_check_for_idle_screen();
  1030.                     }
  1031.                 }
  1032.                 goto Endcase;
  1033.             }
  1034.             /* } */
  1035.         }
  1036.         if (content_type != NULL)
  1037.         {
  1038.             jdd_MemFree(content_type);
  1039.             content_type = NULL;
  1040.         }
  1041.     #endif /* MMI_JMMS_JAVA_MMS_SUPPORT */ 
  1042.         eRet = mmi_jmms_add_pending_mms_info_node((U16) msg_index, (U8) E_MSG_TYPE_RECEIVE, NULL);
  1043.         if (eRet == JC_OK)
  1044.         {
  1045.             mmi_jmms_update_status_icon_indicator();
  1046.             mmi_jmms_show_new_mms_pop_up();
  1047.         }
  1048.     }
  1049.   Endcase:
  1050.     if (content_type != NULL)
  1051.     {
  1052.         jdd_MemFree(content_type);
  1053.         content_type = NULL;
  1054.     }
  1055.     mmi_jmms_free_comm_node(jmms_context, pURLInd->uiRequestID);
  1056.     if (NULL != hTempMsg)
  1057.     {
  1058.         mmi_jmms_jdi_msg_deinit(hTempMsg);
  1059.         hTempMsg = NULL;
  1060.     }
  1061.     eRet = jdi_CommunicationFreeReference(jmms_context->hCommHandle, pURLInd->uiRequestID);
  1062.     pURLInd->uiRequestID = 0;
  1063.     return eRet;
  1064. }
  1065. /*****************************************************************************
  1066.  * FUNCTION
  1067.  *  mmi_jmms_handle_deffered_downlaod_response
  1068.  * DESCRIPTION
  1069.  *  
  1070.  * PARAMETERS
  1071.  *  jmms_context        [?]     [?]     [?]
  1072.  *  pURLInd             [?]     [?]     [?]
  1073.  *  Content             [?]     [?]     [?]
  1074.  * RETURNS
  1075.  *  
  1076.  *****************************************************************************/
  1077. JC_RETCODE mmi_jmms_handle_deffered_downlaod_response(
  1078.             jmms_context_struct *jmms_context,
  1079.             COMM_FETCH_URL_IND_RESP *pURLInd,
  1080.             CONTENT_DATA *Content)
  1081. {
  1082.     /*----------------------------------------------------------------*/
  1083.     /* Local Variables                                                */
  1084.     /*----------------------------------------------------------------*/
  1085. #ifdef MMI_JMMS_JAVA_MMS_SUPPORT
  1086.     MMI_BOOL flag = MMI_FALSE;
  1087. #endif /* MMI_JMMS_JAVA_MMS_SUPPORT */ 
  1088.     JC_RETCODE eRet = JC_OK;
  1089.     MSG_HANDLE hTempMsg = NULL;
  1090.     MESSAGE_HEADERS *pMsgHeaders = NULL;
  1091.     JC_INT8 *content_type = NULL;
  1092.     /* JC_UINT32 msg_index = 0; */
  1093.     MMI_BOOL intterupt_handling = MMI_FALSE;
  1094.     /*----------------------------------------------------------------*/
  1095.     /* Code Body                                                      */
  1096.     /*----------------------------------------------------------------*/
  1097.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_handle_deffered_downlaod_response"));
  1098.     eRet = mmi_jmms_jdi_parse_msg_buffer(&hTempMsg, Content, E_TYPE_MMS, E_FALSE);
  1099.     /* Async changes start */
  1100.     while (eRet == JC_ERR_MMS_PARSE_PENDING)
  1101.     {
  1102.         eRet = mmi_jmms_jdi_msg_parse_continue(hTempMsg);
  1103.     }
  1104.     /* Async changes end */
  1105.     if (JC_OK != eRet)
  1106.     {
  1107.         goto EndofDeferredcase;
  1108.     }
  1109.     eRet = mmi_jmms_jdi_get_msg_headers(hTempMsg, &pMsgHeaders);
  1110.     if (eRet != JC_OK || pMsgHeaders == NULL)
  1111.     {
  1112.         goto EndofDeferredcase;
  1113.     }
  1114.     mmi_jmms_update_status_icon_indicator();
  1115. #ifdef MMI_JMMS_JAVA_MMS_SUPPORT
  1116.     eRet = mmi_jmms_get_content_type(Content, &content_type);
  1117.     if (eRet == JC_OK)
  1118.     {
  1119.         flag = mmi_jsr_check_recv_mms_for_java(content_type);
  1120.         if (flag == MMI_TRUE)
  1121.         {
  1122.             jmms_communication_state_node *comm_node = NULL;
  1123.             comm_node = mmi_jmms_get_comm_state(jmms_context, pURLInd->uiRequestID);
  1124.             if (comm_node == NULL)
  1125.             {
  1126.                 mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SAVING);
  1127.                 if (g_jmms_context->last_scr_id == IDLE_SCREEN_ID)
  1128.                 {
  1129.                     DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, IDLE_SCREEN_ID);
  1130.                 }
  1131.                 else
  1132.                 {
  1133.                 #ifdef __MMI_UNIFIED_MESSAGE__
  1134.                     HistoryReplace(SCR_ID_UM_INBOX, SCR_ID_UM_INBOX, mmi_um_jmms_pre_entry_inbox_including_highlighter);
  1135.                     DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, SCR_ID_UM_INBOX);
  1136.                 #else /* __MMI_UNIFIED_MESSAGE__ */ 
  1137.                     /* /Todo: tets it. */
  1138.                     HistoryReplace(SCR_ID_JMMS_INBOX, SCR_ID_JMMS_INBOX, mmi_jmms_entry_inbox);
  1139.                     DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, SCR_ID_JMMS_INBOX);
  1140.                 #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1141.                 }
  1142.             }
  1143.             else
  1144.             {
  1145.                 ///putting here the ACK.as found that stroe_update change the file name
  1146.                 ///so require to use before that
  1147.                 jmms_mmi_ack_for_deffered_retrieval(*Content);
  1148.             #ifdef __MMI_UNIFIED_MESSAGE__
  1149.                 eRet = mmi_jmms_store_update_message("Inbox", &(comm_node->msg_index), pMsgHeaders, Content, 0x02000000);
  1150.             #else 
  1151.                 eRet = mmi_jmms_store_update_message("Inbox", &(comm_node->msg_index), pMsgHeaders, Content, 0);
  1152.             #endif 
  1153.                 if (eRet != JC_OK)
  1154.                 {
  1155.                     mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SAVING);
  1156.                     if (g_jmms_context->last_scr_id == IDLE_SCREEN_ID)
  1157.                     {
  1158.                         DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, IDLE_SCREEN_ID);
  1159.                     }
  1160.                     else
  1161.                     {
  1162.                     #ifdef __MMI_UNIFIED_MESSAGE__
  1163.                         HistoryReplace(
  1164.                             SCR_ID_UM_INBOX,
  1165.                             SCR_ID_UM_INBOX,
  1166.                             mmi_um_jmms_pre_entry_inbox_including_highlighter);
  1167.                         DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, SCR_ID_UM_INBOX);
  1168.                     #else /* __MMI_UNIFIED_MESSAGE__ */ 
  1169.                         /* /Todo: tets it. */
  1170.                         HistoryReplace(SCR_ID_JMMS_INBOX, SCR_ID_JMMS_INBOX, mmi_jmms_entry_inbox);
  1171.                         DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, SCR_ID_JMMS_INBOX);
  1172.                     #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1173.                     }
  1174.                 }
  1175.                 else
  1176.                 {
  1177.                     ///TODO:: change pop up to New Java MMS
  1178.                     ///"This is JAVA MMS.Please Use JAVA Midlet to Access It"
  1179.                 #ifdef __MMI_UNIFIED_MESSAGE__
  1180.                     mmi_jmms_set_msg_type(
  1181.                         g_jmms_context->store_context->nMsgs_in_Current_folder - comm_node->msg_index,
  1182.                         E_MSG_JAVA_MESSAGE);
  1183.                 #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1184.                     if (GetActiveScreenId() != SCR_ID_JMMS_PROGRESS)
  1185.                     {
  1186.                         mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_NEW_JAVA_MMS);
  1187.                     }
  1188.                     else
  1189.                     {
  1190.                         mmi_jmms_update_status_icon_indicator();
  1191.                         mmi_msg_entry_new_msg_popup(MSG_NEW_JMMS_JAVA_MMS);
  1192.                     }
  1193.                     if (g_jmms_context->last_scr_id == IDLE_SCREEN_ID)
  1194.                     {
  1195.                         DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, IDLE_SCREEN_ID);
  1196.                     }
  1197.                     else
  1198.                     {
  1199.                     #ifdef __MMI_UNIFIED_MESSAGE__
  1200.                         HistoryReplace(
  1201.                             SCR_ID_UM_INBOX,
  1202.                             SCR_ID_UM_INBOX,
  1203.                             mmi_um_jmms_pre_entry_inbox_including_highlighter);
  1204.                         DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, SCR_ID_UM_INBOX);
  1205.                     #else /* __MMI_UNIFIED_MESSAGE__ */ 
  1206.                         /* /Todo: tets it. */
  1207.                         HistoryReplace(SCR_ID_JMMS_INBOX, SCR_ID_JMMS_INBOX, mmi_jmms_entry_inbox);
  1208.                         DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, SCR_ID_JMMS_INBOX);
  1209.                     #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1210.                     }
  1211.                 }
  1212.             }
  1213.             eRet = JC_OK;
  1214.             if (content_type != NULL)
  1215.             {
  1216.                 jdd_MemFree(content_type);
  1217.                 content_type = NULL;
  1218.             }
  1219.             goto EndofDeferredcase;
  1220.         }
  1221.     }
  1222.     if (content_type != NULL)
  1223.     {
  1224.         jdd_MemFree(content_type);
  1225.         content_type = NULL;
  1226.     }
  1227. #endif /* MMI_JMMS_JAVA_MMS_SUPPORT */ 
  1228.     eRet = mmi_jmms_handle_deffered_retrieved_mms((*Content));
  1229.     if (eRet == JC_OK)
  1230.     {
  1231.         ///Todo:: test it
  1232.         ////manish hello
  1233.         if (GetActiveScreenId() != SCR_ID_JMMS_PROGRESS)
  1234.         {
  1235.             intterupt_handling = MMI_TRUE;
  1236.             /* /Todo: need to test it */
  1237.             mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_MMS_DOWNLAOD_SUCCESS);
  1238.         }
  1239.         if (g_jmms_context->last_scr_id == IDLE_SCREEN_ID)
  1240.         {
  1241.             DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, IDLE_SCREEN_ID);
  1242.         }
  1243.         else
  1244.         {
  1245.         #ifdef __MMI_UNIFIED_MESSAGE__
  1246.             HistoryReplace(SCR_ID_UM_INBOX, SCR_ID_UM_INBOX, mmi_um_jmms_pre_entry_inbox_including_highlighter);
  1247.             DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, SCR_ID_UM_INBOX);
  1248.         #else /* __MMI_UNIFIED_MESSAGE__ */ 
  1249.             /* /Todo: tets it. */
  1250.             HistoryReplace(SCR_ID_JMMS_INBOX, SCR_ID_JMMS_INBOX, mmi_jmms_entry_inbox);
  1251.             DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, SCR_ID_JMMS_INBOX);
  1252.         #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1253.         }
  1254.     }
  1255.     if (eRet != E_UNKNOWN_MSG)
  1256.     {
  1257.         JC_RETCODE error_code = JC_OK;
  1258.         jmms_communication_state_node *comm_node = NULL;
  1259.         comm_node = mmi_jmms_get_comm_state(jmms_context, pURLInd->uiRequestID);
  1260.         if (comm_node == NULL)
  1261.         {
  1262.             mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SAVING);
  1263.             if (g_jmms_context->last_scr_id == IDLE_SCREEN_ID)
  1264.             {
  1265.                 DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, IDLE_SCREEN_ID);
  1266.             }
  1267.             else
  1268.             {
  1269.             #ifdef __MMI_UNIFIED_MESSAGE__
  1270.                 HistoryReplace(SCR_ID_UM_INBOX, SCR_ID_UM_INBOX, mmi_um_jmms_pre_entry_inbox_including_highlighter);
  1271.                 DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, SCR_ID_JMMS_INBOX);
  1272.             #else /* __MMI_UNIFIED_MESSAGE__ */ 
  1273.                 /* /Todo: tets it. */
  1274.                 HistoryReplace(SCR_ID_JMMS_INBOX, SCR_ID_JMMS_INBOX, mmi_jmms_entry_inbox);
  1275.                 DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, SCR_ID_JMMS_INBOX);
  1276.             #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1277.             }
  1278.         }
  1279.         else
  1280.         {
  1281.             ///putting here the ACK.as found that stroe_update change the file name
  1282.             ///so require to use before that
  1283.             jmms_mmi_ack_for_deffered_retrieval(*Content);
  1284.             error_code = mmi_jmms_store_update_message("Inbox", &(comm_node->msg_index), pMsgHeaders, Content, 0);
  1285.             if (error_code != JC_OK)
  1286.             {
  1287.                 mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SAVING);
  1288.                 if (g_jmms_context->last_scr_id == IDLE_SCREEN_ID)
  1289.                 {
  1290.                     DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, IDLE_SCREEN_ID);
  1291.                 }
  1292.                 else
  1293.                 {
  1294.                 #ifdef __MMI_UNIFIED_MESSAGE__
  1295.                     HistoryReplace(SCR_ID_UM_INBOX, SCR_ID_UM_INBOX, mmi_um_jmms_pre_entry_inbox_including_highlighter);
  1296.                     DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, SCR_ID_JMMS_INBOX);
  1297.                 #else /* __MMI_UNIFIED_MESSAGE__ */ 
  1298.                     /* /Todo: tets it. */
  1299.                     HistoryReplace(SCR_ID_JMMS_INBOX, SCR_ID_JMMS_INBOX, mmi_jmms_entry_inbox);
  1300.                     DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, SCR_ID_JMMS_INBOX);
  1301.                 #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1302.                 }
  1303.             }
  1304.             else
  1305.             {
  1306.             #ifdef __MMI_UNIFIED_MESSAGE__
  1307.                 mmi_jmms_set_msg_type(
  1308.                     g_jmms_context->store_context->nMsgs_in_Current_folder - comm_node->msg_index,
  1309.                     E_MSG_RECEIVE);
  1310.             #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1311.                 if (intterupt_handling == MMI_FALSE)
  1312.                 {
  1313.                     g_jmms_context->is_unread_msg_deleted = 0;
  1314.                     mmi_jmms_set_msg_as_read((U8) ((comm_node->msg_index) - 1));
  1315.                 #ifdef __MMI_UNIFIED_MESSAGE__
  1316.                     g_jmms_context->show_property_screen = MMI_TRUE;
  1317.                 #endif 
  1318.                     /* /manish hello */
  1319.                     mmi_jmms_handle_read_report(g_jmms_context->MsgHeader_type_p);
  1320.                 }
  1321.                 else
  1322.                 {
  1323.                     /* /check -set for interuupt */
  1324.                     g_jmms_context->progress_screen_title = (U16) (comm_node->msg_index);
  1325.                 }
  1326.                 jmms_context->mms_index = comm_node->msg_index;
  1327.             }
  1328.         }
  1329.         ///Manish chnaging  as found that stroe_update change the file name
  1330.         ///so require to use before that
  1331.         /////error_code=jmms_mmi_ack_for_deffered_retrieval(*Content);
  1332.     }
  1333.   EndofDeferredcase:
  1334.     if (content_type != NULL)
  1335.     {
  1336.         jdd_MemFree(content_type);
  1337.         content_type = NULL;
  1338.     }
  1339.     mmi_jmms_free_comm_node(jmms_context, pURLInd->uiRequestID);
  1340.     if (NULL != hTempMsg)
  1341.     {
  1342.         mmi_jmms_jdi_msg_deinit(hTempMsg);
  1343.         hTempMsg = NULL;
  1344.     }
  1345.     eRet = jdi_CommunicationFreeReference(jmms_context->hCommHandle, pURLInd->uiRequestID);
  1346.     pURLInd->uiRequestID = 0;
  1347.     return eRet;
  1348. }
  1349. /*****************************************************************************
  1350.  * FUNCTION
  1351.  *  mmi_jmms_handle_new_mms_send_response
  1352.  * DESCRIPTION
  1353.  *  
  1354.  * PARAMETERS
  1355.  *  jmms_context        [?]     [?]     [?]
  1356.  *  pURLInd             [?]     [?]     [?]
  1357.  *  Content             [?]     [?]     [?]
  1358.  * RETURNS
  1359.  *  
  1360.  *****************************************************************************/
  1361. JC_RETCODE mmi_jmms_handle_new_mms_send_response(
  1362.             jmms_context_struct *jmms_context,
  1363.             COMM_FETCH_URL_IND_RESP *pURLInd,
  1364.             CONTENT_DATA *Content)
  1365. {
  1366.     /*----------------------------------------------------------------*/
  1367.     /* Local Variables                                                */
  1368.     /*----------------------------------------------------------------*/
  1369.     MESSAGE_HEADERS *pMsgHeaders = NULL;
  1370.     EMM1MessageType eMsg;
  1371.     U8 num_retries = 0;
  1372.     S8 temp_version[MAX_VERSION_LENGTH + 1];
  1373.     JC_RETCODE eRet = JC_OK;
  1374.     MSG_HANDLE hTempMsg = NULL;
  1375.     /*----------------------------------------------------------------*/
  1376.     /* Code Body                                                      */
  1377.     /*----------------------------------------------------------------*/
  1378.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_handle_new_mms_send_response"));
  1379.     eRet = mmi_jmms_jdi_parse_msg_buffer(&hTempMsg, Content, E_TYPE_MMS, E_FALSE);
  1380.     /* Async changes begin */
  1381.     while (eRet == JC_ERR_MMS_PARSE_PENDING)
  1382.     {
  1383.         eRet = mmi_jmms_jdi_msg_parse_continue(hTempMsg);
  1384.     }
  1385.     /* Async changes end */
  1386.     if (eRet != JC_OK)
  1387.     {
  1388.         mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT);
  1389.         goto END;
  1390.     }
  1391.     eRet = mmi_jmms_jdi_get_msg_headers(hTempMsg, &pMsgHeaders);
  1392.     if (eRet != JC_OK)
  1393.     {
  1394.         mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT);
  1395.         goto END;
  1396.     }
  1397.     eMsg = pMsgHeaders->eMsgType;
  1398.     switch (pMsgHeaders->eMsgType)
  1399.     {
  1400.         case E_MSG_TYPE_SEND_RESPONSE:
  1401.         {
  1402.             MESSAGE_SEND_RESPONSE *pSendHdr = (MESSAGE_SEND_RESPONSE*) pMsgHeaders->pHeaders;
  1403.             U8 *temp_uniocde_url = NULL;
  1404.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s%d", "JMMS send response, Status:", pSendHdr->eStatus));
  1405.             if (E_RESP_OK == pSendHdr->eStatus)
  1406.             {
  1407.                 PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS send response: OK"));
  1408.                 num_retries = jmms_context->nSent_retry_counter;
  1409.                 temp_uniocde_url = mmi_jmms_get_activated_mmsc_url(jmms_context);
  1410.                 /* / replace temp_uniocde_url by url set in message settings */
  1411.                 jmms_context->nSent_last_MMSC_URL = (S8*) temp_uniocde_url;
  1412.                 /*
  1413.                  * No need to convert into Unicode string.
  1414.                  * 
  1415.                  * Modified by : Raj Kumar Gupta
  1416.                  * Date     : July 27, 2006
  1417.                  */
  1418.                 /* /version should always be in ansii */
  1419.                 strcpy((PS8) jmms_context->nSent_last_version, (PS8) pSendHdr->pVersion);
  1420.                 if (num_retries >= 1)   /* /MMS was sent in 2 retries due to version problem */
  1421.                 {                       /* store such mmsc urls in a file */
  1422.                     /* /wrie/update the MMSC URL and version into file */
  1423.                     mmi_jmms_update_mmsc_url_version(
  1424.                         jmms_context->nSent_last_MMSC_URL,
  1425.                         jmms_context->nSent_last_version);
  1426.                 }
  1427.                 if (g_jmms_context->save_mms == MMI_TRUE)
  1428.                 {
  1429.                     jmms_communication_state_node *comm_node = NULL;
  1430.                     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS send response: Save MMS True"));
  1431.                     comm_node = mmi_jmms_get_comm_state(jmms_context, pURLInd->uiRequestID);
  1432.                     if (comm_node == NULL)
  1433.                     {
  1434.                         mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_MMS_SENT_NOT_SAVE);
  1435.                     }
  1436.                     else
  1437.                     {
  1438.                         eRet = mmi_jmms_send_and_store_mms("Sent", jmms_context->msg_handle, comm_node);
  1439.                         if (eRet == JC_OK)
  1440.                         {
  1441.                             mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_SUCCESS_MMS_SENT);
  1442.                         }
  1443.                         else
  1444.                         {
  1445.                             if (eRet == E_MEMORY_FULL_ERROR)
  1446.                             {
  1447.                                 mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_MMS_SENT_NOT_SAVE_MEMORY);
  1448.                             }
  1449.                             else if (eRet == JC_ERR_MEMORY_ALLOCATION || eRet == JC_ERR_FILE_WRITE)
  1450.                             {
  1451.                                 mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_MMS_SENT_NOT_SAVE_MEMORY_FULL);
  1452.                             }
  1453.                             else
  1454.                             {
  1455.                                 mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_MMS_SENT_NOT_SAVE);
  1456.                             }
  1457.                         }
  1458.                     }
  1459.                 }
  1460.                 else
  1461.                 {
  1462.                     mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_SUCCESS_MMS_SENT_ONLY);
  1463.                 }
  1464.             #ifdef __MMI_UNIFIED_MESSAGE__
  1465. /* Sandeep start Nov 14 */
  1466.   /* if (IsScreenPresent(SCR_ID_UM_INBOX))
  1467.                 {
  1468.                     DeleteUptoScrID(SCR_ID_UM_INBOX);
  1469.                 }
  1470.                 else if (IsScreenPresent(SCR_ID_UM_SENT))
  1471.                 {
  1472.                     DeleteUptoScrID(SCR_ID_UM_SENT);
  1473.                 } */
  1474. /* Sandeep start Nov 14 */
  1475.                if (IsScreenPresent(SCR_ID_JMMS_OUTBOX_OPTIONS))
  1476.                 {
  1477.                     mmi_jmms_outbox_delete_on_sent();
  1478.                 }
  1479.                 else if (IsScreenPresent(SCR_ID_JMMS_DRAFTS_OPTIONS))
  1480.                 {
  1481.                     mmi_jmms_drafts_delete_on_sent();
  1482.                 }
  1483.                 else if (IsScreenPresent(SCR_ID_JMMS_PREVIEW))
  1484.                 {
  1485.                     DeleteScreenFromToNnodes(SCR_ID_JMMS_PROGRESS, 5);
  1486.                 }
  1487.                 else if (!IsScreenPresent(SCR_ID_UM_MAIN))
  1488.                 {
  1489.                     DeleteScreenFromToNnodes(SCR_ID_JMMS_PROGRESS, 3);
  1490.                 }
  1491.                 else
  1492.                 {
  1493.                     DeleteScreenFromToNnodes(SCR_ID_JMMS_PROGRESS, 4);
  1494.                 }
  1495.             #else /* __MMI_UNIFIED_MESSAGE__ */ 
  1496. if (IsScreenPresent(SCR_ID_JMMS_INBOX))
  1497.                 {
  1498.                     DeleteUptoScrID(SCR_ID_JMMS_INBOX);
  1499.                 }
  1500.                 else if (IsScreenPresent(SCR_ID_JMMS_OUTBOX))
  1501.                 {
  1502.                     DeleteUptoScrID(SCR_ID_JMMS_OUTBOX);
  1503.                 }
  1504.                 if (g_jmms_context->last_scr_id == SCR_ID_JMMS_OUTBOX_OPTIONS)
  1505.                 {
  1506.                     mmi_jmms_outbox_delete_on_sent();
  1507.                 }
  1508.                 else if (g_jmms_context->last_scr_id == SCR_ID_JMMS_DRAFTS_OPTIONS)
  1509.                 {
  1510.                     mmi_jmms_drafts_delete_on_sent();
  1511.                 }
  1512.                 else
  1513.                 {
  1514.                     DeleteScreenFromToNnodes(SCR_ID_JMMS_PROGRESS, 3);
  1515.                 }
  1516.             #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1517.                 mmi_jmms_deinit_mms_context(jmms_context);
  1518.                 mmi_jmms_free_comm_node(jmms_context, pURLInd->uiRequestID);
  1519.                 goto END1;
  1520.             }
  1521.             else
  1522.             {
  1523.                 if (pSendHdr->eStatus == E_RESP_ERR_UNSUPPORTED_MSG
  1524.                     || pSendHdr->eStatus == E_RESP_ERR_MESG_NOT_FOUND
  1525.                     || pSendHdr->eStatus == E_RESP_ERR_MSG_FORMAT_CORRUPT)
  1526.                 {
  1527.                     jmms_context->nSent_retry_counter++;
  1528.                     if (jmms_context->nSent_retry_counter >= 3) /* /TODO:: may need to change to 3 i.e. also for 1.1 */
  1529.                     {
  1530.                         mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT);
  1531.                         goto END;
  1532.                     }
  1533.                     else
  1534.                     {
  1535.                         if (GetActiveScreenId() == SCR_ID_JMMS_PROGRESS)
  1536.                         {
  1537.                             ChangeTitleString((U8*)GetString(STR_ID_JMMS_RETRY));
  1538.                             draw_title();
  1539.                             cat66_update_progress_string();
  1540.                         }
  1541. /* Sandeep Start 16 Nov to fix MAUI00226856 */
  1542.                         strcpy((PS8) temp_version, (PS8) "1.0");
  1543.                         if (strcmp((S8*) jmms_context->version, (S8*) temp_version) == 0)
  1544.                         {
  1545.                             strcpy((PS8) jmms_context->version, (PS8) "1.1");
  1546.                         }
  1547.                         else
  1548.                         {
  1549.                             strcpy((PS8) temp_version, (PS8) "1.1");
  1550.                             if (strcmp((S8*) jmms_context->version, (S8*) temp_version) == 0)
  1551.                             {
  1552.                             strcpy((PS8) jmms_context->version, (PS8) "1.2");
  1553.                         }
  1554.                         else
  1555.                         {
  1556.                             strcpy((PS8) temp_version, (PS8) "1.2");
  1557.                             if (strcmp((S8*) jmms_context->version, (S8*) temp_version) == 0)
  1558.                             {
  1559.                                 strcpy((PS8) jmms_context->version, (PS8) "1.0");
  1560.                             }
  1561.                             else
  1562.                             {
  1563. jmms_communication_state_node *comm_node = NULL;
  1564. comm_node = mmi_jmms_get_comm_state(jmms_context, pURLInd->uiRequestID);
  1565. eRet = mmi_jmms_send_and_store_mms("Outbox", jmms_context->msg_handle, comm_node);
  1566. if(eRet == JC_OK)
  1567. {
  1568. mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT_AND_STORED);
  1569.                                 goto END;
  1570.                             }
  1571. else
  1572. {
  1573. if (eRet == E_MEMORY_FULL_ERROR)
  1574. {
  1575. mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_COMM_ABORTED_AND_FAIL_STORE_MEMORY);
  1576. goto END;
  1577.                         }
  1578. else if (eRet == JC_ERR_MEMORY_ALLOCATION || eRet == JC_ERR_FILE_WRITE)
  1579. {
  1580. mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_COMM_ABORTED_AND_FAIL_STORE_MEM_FULL);
  1581. goto END;
  1582. }
  1583. else
  1584. {
  1585. mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_COMM_ABORTED_AND_FAIL_STORE);
  1586. goto END;
  1587. }
  1588. }
  1589. }
  1590. }
  1591. }
  1592. /* Sandeep end 16 Nov to fix MAUI00226856 */
  1593.                         if (NULL != hTempMsg)
  1594.                         {
  1595.                             mmi_jmms_jdi_msg_deinit(hTempMsg);
  1596.                             hTempMsg = NULL;
  1597.                         }
  1598.                         mmi_jmms_free_comm_node(jmms_context, pURLInd->uiRequestID);
  1599.                         eRet = jdi_CommunicationFreeReference(jmms_context->hCommHandle, pURLInd->uiRequestID);
  1600.                         if (JC_OK != eRet)
  1601.                         {
  1602.                             pURLInd->uiRequestID = 0;
  1603.                             mmi_jmms_free_message_header();
  1604.                             mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT);
  1605.                             DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, g_jmms_context->last_scr_id);
  1606.                             return eRet;
  1607.                         }
  1608.                         pURLInd->uiRequestID = 0;
  1609.                         /* Register the function that to be execute after the completion of the 
  1610.                            encapsulation */
  1611.                         mmi_jmms_add_send_callback_node(mmi_jmms_handle_new_mms_send_response_asynch_callback);
  1612.                         mmi_jmms_send_mms(jmms_context->msg_handle, E_TYPE_NEW_MMS, E_TRUE, 1, E_TRUE);
  1613.                         return JC_OK;
  1614.                     }
  1615.                 }
  1616.                 else if (pSendHdr->eStatus == E_RESP_ERR_NETWORK_PROBLEM ||     // TODO:: need to check right status
  1617.                          pSendHdr->eStatus == E_RESP_ERR_SERVICE_DENIED)
  1618.                 {
  1619.                     /* /added for retry mechanism */
  1620.                     if (pURLInd->uiRequestID)
  1621.                     {
  1622.                         eRet = jdi_CommunicationFreeReference(jmms_context->hCommHandle, pURLInd->uiRequestID);
  1623.                         if (JC_OK != eRet)
  1624.                         {
  1625.                             /* 2 March -- need care */
  1626.                             mmi_jmms_free_message_header();
  1627.                             mmi_jmms_free_comm_node(jmms_context, pURLInd->uiRequestID);
  1628.                             pURLInd->uiRequestID = 0;
  1629.                             mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT);
  1630.                             DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, g_jmms_context->last_scr_id);
  1631.                             return eRet;
  1632.                         }
  1633.                     }
  1634.                     eRet = mmi_jmms_retry_communication(
  1635.                             jmms_context,
  1636.                             E_FROM_URL_CALLBACK,
  1637.                             pURLInd->uiRequestID,
  1638.                             pSendHdr->eStatus);
  1639.                     if (JC_OK != eRet && eRet != E_JMMS_RETRY_COMPLETE) /* /if eRet=E_JMMS_RETRY_COMPLETE then it means error already handled */
  1640.                     {
  1641.                         mmi_jmms_free_message_header();
  1642.                         mmi_jmms_free_comm_node(jmms_context, pURLInd->uiRequestID);
  1643.                         pURLInd->uiRequestID = 0;
  1644.                         mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT);
  1645.                         DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, g_jmms_context->last_scr_id);
  1646.                         return eRet;
  1647.                     }
  1648.                     mmi_jmms_free_comm_node(jmms_context, pURLInd->uiRequestID);
  1649.                     pURLInd->uiRequestID = 0;
  1650.                     return eRet;
  1651.                 }
  1652.                 else
  1653.                 {
  1654. /*Dilip Start 24 Aug 2006*/               
  1655. #ifdef __MMI_UNIFIED_MESSAGE__
  1656.                     if (IsScreenPresent(SCR_ID_UM_UNSENT))
  1657.                     {
  1658.                         DeleteUptoScrID(SCR_ID_UM_UNSENT);
  1659.                     }
  1660.                     else if (IsScreenPresent(SCR_ID_UM_DRAFT))
  1661.                     {
  1662.                         DeleteUptoScrID(SCR_ID_UM_DRAFT);
  1663.                     }
  1664.                     else if (IsScreenPresent(SCR_ID_UM_INBOX))
  1665.                     {
  1666.                         DeleteUptoScrID(SCR_ID_UM_INBOX);
  1667.                     }
  1668.                     else if(IsScreenPresent(SCR_ID_UM_SENT))
  1669.                     {
  1670.                         DeleteUptoScrID(SCR_ID_UM_SENT);
  1671.                     }
  1672. #endif
  1673. /*Dilip End 24 Aug 2006*/ 
  1674.                     //TODO:: display error pop up with preoper string for error 
  1675.                     ///by knowing error type status
  1676.                     /* sandeep start to fix MAUI_00420829 */
  1677.                     mmi_jmms_handle_error_string(pSendHdr->eStatus, E_TYPE_NEW_MMS);
  1678.                     //mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT);
  1679.                    /* sandeep end to fix MAUI_00420829 */
  1680.                 }
  1681.             }
  1682.         }
  1683.             break;
  1684.         default:
  1685.             mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_UNABLE_PARSE_SENT_RESPONSE);
  1686.     }   /* /end of  switch(pMsgHeaders->eMsgType) */
  1687.   END:
  1688.    /* These lines are added to remove the auto signature or blank slide in case of 
  1689.       MMS sending fail. --- By Raj Kumar Gupta on August 29, 2006 */
  1690.    //#ifdef __MMI_MMS_SIGNATURE__
  1691.         mmi_jmms_del_inserted_auto_signature_slide();
  1692.     //#endif 
  1693.     /* End of changes */
  1694. //    DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, g_jmms_context->last_scr_id);
  1695.     DeleteScreenIfPresent(SCR_ID_JMMS_PROGRESS);
  1696.     DeleteScreenIfPresent(SCR_ID_JMMS_SENT_OPTIONS);
  1697.     DeleteScreenIfPresent(SCR_ID_JMMS_DRAFTS_OPTIONS);
  1698.     DeleteScreenIfPresent(SCR_ID_JMMS_OUTBOX_OPTIONS);
  1699.     DeleteScreenIfPresent(SCR_ID_WRITE_MMS_DONE_OPTIONS);
  1700.     mmi_jmms_free_comm_node(jmms_context, pURLInd->uiRequestID);
  1701.   END1:
  1702.     ///for E_TYPE_IMMEDIATE_RETRIEVAL_FETCH state has been set to E_TYPE_NOTIFICATION_RESPONSE
  1703.     ///soo don't set to E_TYPE_NULL      
  1704.     /* free any allocated memory */
  1705.     mmi_jmms_free_message_header();
  1706.     if (NULL != hTempMsg)
  1707.     {
  1708.         mmi_jmms_jdi_msg_deinit(hTempMsg);
  1709.     }
  1710.     eRet = jdi_CommunicationFreeReference(jmms_context->hCommHandle, pURLInd->uiRequestID);
  1711.     pURLInd->uiRequestID = 0;
  1712.     return eRet;
  1713. }
  1714. /*****************************************************************************
  1715.  * FUNCTION
  1716.  *  mmi_jmms_handle_new_mms_send_response_asynch_callback
  1717.  * DESCRIPTION
  1718.  *  
  1719.  * PARAMETERS
  1720.  *  eRet        [IN]        
  1721.  * RETURNS
  1722.  *  void
  1723.  *****************************************************************************/
  1724. void mmi_jmms_handle_new_mms_send_response_asynch_callback(JC_RETCODE eRet)
  1725. {
  1726.     /*----------------------------------------------------------------*/
  1727.     /* Local Variables                                                */
  1728.     /*----------------------------------------------------------------*/
  1729.     /*----------------------------------------------------------------*/
  1730.     /* Code Body                                                      */
  1731.     /*----------------------------------------------------------------*/
  1732.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_handle_new_mms_send_response_asynch_callback"));
  1733.     if (JC_OK != eRet)
  1734.     {
  1735.         mmi_jmms_free_message_header();
  1736.         if (eRet == E_JMMS_STORAGE_FULL)
  1737.         {
  1738.             mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT_STORE_FUL);
  1739.         }
  1740.         /* Added by - Raj Kumar Gupta on 31 August, 2006 */
  1741.         else if(eRet == E_COMMUNICATION_ABORTED)
  1742.         {
  1743.             DisplayPopup(
  1744.                     (U8*) GetString(STR_ID_JMMS_COMM_ABORTED),
  1745.                     IMG_GLOBAL_INFO,
  1746.                     1,
  1747.                     JMMS_POPUP_TIME,
  1748.                     (U8) SUCCESS_TONE);
  1749.         }
  1750.         else
  1751.         {
  1752.             mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT);
  1753.         }
  1754.         DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, g_jmms_context->last_scr_id);
  1755.     }
  1756. }
  1757. #ifdef MMI_JMMS_JAVA_MMS_SUPPORT
  1758. /*****************************************************************************
  1759.  * FUNCTION
  1760.  *  mmi_jmms_jsr_mms_send_response
  1761.  * DESCRIPTION
  1762.  *  
  1763.  * PARAMETERS
  1764.  *  jmms_context        [?]         [?]         [?]
  1765.  *  pURLInd             [?]         [?]         [?]
  1766.  *  Content             [IN]        
  1767.  * RETURNS
  1768.  *  
  1769.  *****************************************************************************/
  1770. JC_RETCODE mmi_jmms_jsr_mms_send_response(
  1771.             jmms_context_struct *jmms_context,
  1772.             COMM_FETCH_URL_IND_RESP *pURLInd,
  1773.             CONTENT_DATA Content)
  1774. {
  1775.     /*----------------------------------------------------------------*/
  1776.     /* Local Variables                                                */
  1777.     /*----------------------------------------------------------------*/
  1778.     JC_RETCODE eRet = JC_OK;
  1779.     MSG_HANDLE hTempMsg = NULL;
  1780.     MESSAGE_HEADERS *pMsgHeaders = NULL;
  1781.     EMM1MessageType eMsg;
  1782.     U8 num_retries = 0;
  1783.     S8 temp_version[MAX_VERSION_LENGTH + 1];
  1784.     /*----------------------------------------------------------------*/
  1785.     /* Code Body                                                      */
  1786.     /*----------------------------------------------------------------*/
  1787.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_jsr_mms_send_response"));
  1788.     eRet = mmi_jmms_jdi_parse_msg_buffer(&hTempMsg, &Content, E_TYPE_MMS, E_FALSE);
  1789.     /* Async changes begin */
  1790.     while (eRet == JC_ERR_MMS_PARSE_PENDING)
  1791.     {
  1792.         eRet = mmi_jmms_jdi_msg_parse_continue(hTempMsg);
  1793.     };
  1794.     /* Async changes end */
  1795.     if (eRet != JC_OK)
  1796.     {
  1797.         (*(jmms_context->jsr_mms_send_callback)) (JSR_RESULT_ERROR);
  1798.         goto END;
  1799.     }
  1800.     eRet = mmi_jmms_jdi_get_msg_headers(hTempMsg, &pMsgHeaders);
  1801.     if (eRet != JC_OK)
  1802.     {
  1803.         (*(jmms_context->jsr_mms_send_callback)) (JSR_RESULT_ERROR);
  1804.         goto END;
  1805.     }
  1806.     eMsg = pMsgHeaders->eMsgType;
  1807.     switch (pMsgHeaders->eMsgType)
  1808.     {
  1809.         case E_MSG_TYPE_SEND_RESPONSE:
  1810.         {
  1811.             MESSAGE_SEND_RESPONSE *pSendHdr = (MESSAGE_SEND_RESPONSE*) pMsgHeaders->pHeaders;
  1812.             U8 *temp_uniocde_url = NULL;
  1813.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s%d", "JMMS JSR send response, Status:", pSendHdr->eStatus));
  1814.             if (E_RESP_OK == pSendHdr->eStatus)
  1815.             {
  1816.                 PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s%d", "JMMS JSR send response, OK"));
  1817.                 num_retries = jmms_context->nSent_retry_counter;
  1818.                 temp_uniocde_url = mmi_jmms_get_activated_mmsc_url(jmms_context);
  1819.                 jmms_context->nSent_last_MMSC_URL = (S8*) temp_uniocde_url;
  1820.                 /*
  1821.                  * No need to convert into Unicode string.
  1822.                  * 
  1823.                  * Modified by : Raj Kumar Gupta
  1824.                  * Date     : July 27, 2006
  1825.                  */
  1826.                 /* /version should always be in ansii */
  1827.                 strcpy((PS8) jmms_context->nSent_last_version, (PS8) pSendHdr->pVersion);
  1828.                 if (num_retries >= 1)   /* /MMS was sent in 2 retries due to version problem */
  1829.                 {                       /* store such mmsc urls in a file */
  1830.                     /* /wrie/update the MMSC URL and version into file */
  1831.                     mmi_jmms_update_mmsc_url_version(
  1832.                         jmms_context->nSent_last_MMSC_URL,
  1833.                         jmms_context->nSent_last_version);
  1834.                 }
  1835.                 (*(jmms_context->jsr_mms_send_callback)) (JSR_RESULT_OK);
  1836.                 goto END;
  1837.             }
  1838.             else
  1839.             {
  1840.                 if (pSendHdr->eStatus == E_RESP_ERR_UNSUPPORTED_MSG
  1841.                     || pSendHdr->eStatus == E_RESP_ERR_MESG_NOT_FOUND
  1842.                     || pSendHdr->eStatus == E_RESP_ERR_MSG_FORMAT_CORRUPT)
  1843.                 {
  1844.                     jmms_context->nSent_retry_counter++;
  1845.                     if (jmms_context->nSent_retry_counter >= 2) /* /TODO:: may need to change to 3 i.e. also for 1.1 */
  1846.                     {
  1847.                         (*(jmms_context->jsr_mms_send_callback)) (JSR_RESULT_ERROR);
  1848.                         goto END;
  1849.                     }
  1850.                     else
  1851.                     {
  1852.                         strcpy((PS8) temp_version, (PS8) "1.0");
  1853.                         if (strcmp((S8*) jmms_context->version, (S8*) temp_version) == 0)
  1854.                         {
  1855.                             strcpy((PS8) jmms_context->version, (PS8) "1.2");
  1856.                         }
  1857.                         else
  1858.                         {
  1859.                             strcpy((PS8) temp_version, (PS8) "1.2");
  1860.                             if (strcmp((S8*) jmms_context->version, (S8*) temp_version) == 0)
  1861.                             {
  1862.                                 strcpy((PS8) jmms_context->version, (PS8) "1.0");
  1863.                             }
  1864.                             else
  1865.                             {
  1866.                                 // TODO:: may need to check for 1.1 also
  1867.                                 (*(jmms_context->jsr_mms_send_callback)) (JSR_RESULT_ERROR);
  1868.                                 goto END;
  1869.                             }
  1870.                         }
  1871.                         if (NULL != hTempMsg)
  1872.                         {
  1873.                             mmi_jmms_jdi_msg_deinit(hTempMsg);
  1874.                             hTempMsg = NULL;
  1875.                         }
  1876.                         ///manish - commenting 
  1877.                         ///mmi_jmms_free_comm_node(jmms_context,pURLInd->uiRequestID);
  1878.                         eRet = jdi_CommunicationFreeReference(jmms_context->hCommHandle, pURLInd->uiRequestID);
  1879.                         if (JC_OK != eRet)
  1880.                         {
  1881.                             pURLInd->uiRequestID = 0;
  1882.                             (*(jmms_context->jsr_mms_send_callback)) (JSR_RESULT_ERROR);
  1883.                             return eRet;
  1884.                         }
  1885.                         pURLInd->uiRequestID = 0;
  1886.                         {
  1887.                             jmms_communication_state_node *comm_node = NULL;
  1888.                             comm_node = mmi_jmms_get_comm_state(jmms_context, pURLInd->uiRequestID);
  1889.                             if (comm_node == NULL)
  1890.                             {
  1891.                                 pURLInd->uiRequestID = 0;
  1892.                                 (*(jmms_context->jsr_mms_send_callback)) (JSR_RESULT_ERROR);
  1893.                                 return eRet;
  1894.                             }
  1895.                             eRet = mmi_jmms_resend_mms(comm_node, 1);
  1896.                             if (JC_OK != eRet)
  1897.                             {
  1898.                                 pURLInd->uiRequestID = 0;
  1899.                                 (*(jmms_context->jsr_mms_send_callback)) (JSR_RESULT_ERROR);
  1900.                                 return eRet;
  1901.                             }
  1902.                         }
  1903.                         if (JC_OK != eRet)
  1904.                         {
  1905.                             (*(jmms_context->jsr_mms_send_callback)) (JSR_RESULT_ERROR);
  1906.                         }
  1907.                         return eRet;
  1908.                     }
  1909.                 }
  1910.                 else if (pSendHdr->eStatus == E_RESP_ERR_NETWORK_PROBLEM ||     // TODO:: need to check right status
  1911.                          pSendHdr->eStatus == E_RESP_ERR_SERVICE_DENIED)
  1912.                 {
  1913.                     /* /added for retry mechanism */
  1914.                     if (pURLInd->uiRequestID)
  1915.                     {
  1916.                         eRet = jdi_CommunicationFreeReference(jmms_context->hCommHandle, pURLInd->uiRequestID);
  1917.                         if (JC_OK != eRet)
  1918.                         {
  1919.                             mmi_jmms_free_comm_node(jmms_context, pURLInd->uiRequestID);
  1920.                             pURLInd->uiRequestID = 0;
  1921.                             (*(jmms_context->jsr_mms_send_callback)) (JSR_RESULT_ERROR);
  1922.                             return eRet;
  1923.                         }
  1924.                     }
  1925.                     eRet = mmi_jmms_retry_communication(
  1926.                             jmms_context,
  1927.                             E_FROM_URL_CALLBACK,
  1928.                             pURLInd->uiRequestID,
  1929.                             pSendHdr->eStatus);
  1930.                     if (JC_OK != eRet && eRet != E_JMMS_RETRY_COMPLETE)
  1931.                     {
  1932.                         mmi_jmms_free_comm_node(jmms_context, pURLInd->uiRequestID);
  1933.                         pURLInd->uiRequestID = 0;
  1934.                         (*(jmms_context->jsr_mms_send_callback)) (JSR_RESULT_ERROR);
  1935.                         return eRet;
  1936.                     }
  1937.                     mmi_jmms_free_comm_node(jmms_context, pURLInd->uiRequestID);
  1938.                     pURLInd->uiRequestID = 0;
  1939.                     return eRet;
  1940.                 }
  1941.                 else
  1942.                 {
  1943.                     (*(jmms_context->jsr_mms_send_callback)) (JSR_RESULT_ERROR);
  1944.                 }
  1945.             }
  1946.         }
  1947.             break;
  1948.         default:
  1949.             (*(jmms_context->jsr_mms_send_callback)) (JSR_RESULT_ERROR);
  1950.     }   /* /end of switch switch(pMsgHeaders->eMsgType) */
  1951.   END:
  1952.     mmi_jmms_free_comm_node(jmms_context, pURLInd->uiRequestID);
  1953.     if (NULL != hTempMsg)
  1954.     {
  1955.         mmi_jmms_jdi_msg_deinit(hTempMsg);
  1956.     }
  1957.     eRet = jdi_CommunicationFreeReference(jmms_context->hCommHandle, pURLInd->uiRequestID);
  1958.     pURLInd->uiRequestID = 0;
  1959.     return eRet;
  1960. }
  1961. #endif /* MMI_JMMS_JAVA_MMS_SUPPORT */ /* //MMI_JMMS_JAVA_MMS_SUPPORT */
  1962. /*****************************************************************************
  1963.  * FUNCTION
  1964.  *  mmi_jmms_handle_pop_up_for_interupt
  1965.  * DESCRIPTION
  1966.  *  
  1967.  * PARAMETERS
  1968.  *  strid       [IN]        
  1969.  * RETURNS
  1970.  *  void
  1971.  *****************************************************************************/
  1972. void mmi_jmms_handle_pop_up_for_interupt(U16 strid)
  1973. {
  1974.     /*----------------------------------------------------------------*/
  1975.     /* Local Variables                                                */
  1976.     /*----------------------------------------------------------------*/
  1977.     /*----------------------------------------------------------------*/
  1978.     /* Code Body                                                      */
  1979.     /*----------------------------------------------------------------*/
  1980.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_handle_pop_up_for_interupt"));
  1981.     if (GetActiveScreenId() != SCR_ID_JMMS_PROGRESS)
  1982.     {
  1983.         U16 k;
  1984.         MMI_BOOL ret;
  1985.         history hist;
  1986. historyNode *saved_history;
  1987.         interupt_screen_title = strid;
  1988.         memset(&hist, 0, sizeof(history));
  1989.         if (GetCurrScrnId() == SCR_ID_JMMS_PROGRESS)
  1990.         {
  1991.             hist.scrnID = SCR_ID_JMMS_POP_SCREEN;
  1992.             hist.entryFuncPtr = mmi_jmms_entry_general_pop_screen_in_case_interupt;
  1993.             AddHistory(hist);
  1994. /* This is a workaround to make sure that if small screen is the current screen on MMI.
  1995. Its state is not changed and SCR_ID_JMMS_POP_SCREEN is not saved as small screen */
  1996. GetHistoryPointer(SCR_ID_JMMS_POP_SCREEN,&saved_history);
  1997. if(saved_history->isSmallScreen==1)
  1998. {
  1999. saved_history->isSmallScreen=0;
  2000. set_small_screen();
  2001. }
  2002.         }
  2003.         else
  2004.         {
  2005.             /* for test */
  2006.             ret = GetNextScrnIdOf(SCR_ID_JMMS_PROGRESS, &k);
  2007.             if (ret == MMI_TRUE)
  2008.             {
  2009.                 hist.scrnID = SCR_ID_JMMS_POP_SCREEN;
  2010.                 hist.entryFuncPtr = mmi_jmms_entry_general_pop_screen_in_case_interupt;
  2011.                 InsertHistoryBeforeThisScrnReference(k, &hist);
  2012.             }
  2013.         }
  2014.     }
  2015.     else
  2016.     {
  2017.         if (strid == STR_ID_JMMS_SUCCESS_MMS_SENT || strid == STR_ID_JMMS_SUCCESS_MMS_SENT_ONLY)
  2018.         {
  2019.             DisplayPopup((U8*) GetString(strid), IMG_GLOBAL_ACTIVATED, 1, JMMS_POPUP_TIME, SUCCESS_TONE);
  2020.         }
  2021.         else
  2022.         {
  2023.             DisplayPopup((U8*) GetString(strid), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  2024.         }
  2025.     }
  2026. }
  2027. /*****************************************************************************
  2028.  * FUNCTION
  2029.  *  mmi_jmms_entry_general_pop_screen_in_case_interupt
  2030.  * DESCRIPTION
  2031.  *  
  2032.  * PARAMETERS
  2033.  *  void
  2034.  * RETURNS
  2035.  *  void
  2036.  *****************************************************************************/
  2037. void mmi_jmms_entry_general_pop_screen_in_case_interupt(void)
  2038. {
  2039.     /*----------------------------------------------------------------*/
  2040.     /* Local Variables                                                */
  2041.     /*----------------------------------------------------------------*/
  2042.     /*----------------------------------------------------------------*/
  2043.     /* Code Body                                                      */
  2044.     /*----------------------------------------------------------------*/
  2045.     EntryNewScreen(SCR_ID_JMMS_POP_SCREEN, NULL, mmi_jmms_entry_general_pop_screen_in_case_interupt, NULL);
  2046.     ShowCategory2Screen(
  2047.         STR_MMS_MENUENTRY,
  2048.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  2049.         0,
  2050.         0,
  2051.         STR_GLOBAL_BACK,
  2052.         IMG_GLOBAL_BACK,
  2053.         interupt_screen_title,
  2054.         NULL);
  2055.     if (interupt_screen_title == STR_ID_JMMS_MMS_DOWNLAOD_SUCCESS)
  2056.     {
  2057.         SetRightSoftkeyFunction(mmi_jmms_back_msg_download_sucess, KEY_EVENT_UP);
  2058. if (isInCall() == FALSE)
  2059. SetKeyHandler(mmi_jmms_end_key_downlaod_sucess_pop_screen, KEY_END, KEY_EVENT_DOWN);    /* /delete the link list */
  2060.     }
  2061.     else
  2062.     {
  2063.         SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2064.     }
  2065. }
  2066. /*****************************************************************************
  2067.  * FUNCTION
  2068.  *  mmi_jmms_end_key_downlaod_sucess_pop_screen
  2069.  * DESCRIPTION
  2070.  *  
  2071.  * PARAMETERS
  2072.  *  void
  2073.  * RETURNS
  2074.  *  void
  2075.  *****************************************************************************/
  2076. void mmi_jmms_end_key_downlaod_sucess_pop_screen(void)
  2077. {
  2078.     /*----------------------------------------------------------------*/
  2079.     /* Local Variables                                                */
  2080.     /*----------------------------------------------------------------*/
  2081.     /*----------------------------------------------------------------*/
  2082.     /* Code Body                                                      */
  2083.     /*----------------------------------------------------------------*/
  2084.     mmi_jmms_deinit_mms_context(g_jmms_context);
  2085.     GoBackToHistory(IDLE_SCREEN_ID);
  2086. }
  2087. /*****************************************************************************
  2088.  * FUNCTION
  2089.  *  mmi_jmms_back_msg_download_sucess
  2090.  * DESCRIPTION
  2091.  *  
  2092.  * PARAMETERS
  2093.  *  void
  2094.  * RETURNS
  2095.  *  void
  2096.  *****************************************************************************/
  2097. void mmi_jmms_back_msg_download_sucess(void)
  2098. {
  2099.     /*----------------------------------------------------------------*/
  2100.     /* Local Variables                                                */
  2101.     /*----------------------------------------------------------------*/
  2102.     /*----------------------------------------------------------------*/
  2103.     /* Code Body                                                      */
  2104.     /*----------------------------------------------------------------*/
  2105.     g_jmms_context->is_unread_msg_deleted = 0;
  2106.     mmi_jmms_set_msg_as_read((U8) g_jmms_context->mms_index);
  2107. #ifdef __MMI_UNIFIED_MESSAGE__
  2108.     g_jmms_context->show_property_screen = MMI_TRUE;
  2109. #endif 
  2110.     mmi_jmms_handle_read_report(g_jmms_context->MsgHeader_type_p);
  2111. }
  2112. /* PMT VIKAS START 20060401 */
  2113. #include"wgui_status_icons.h"
  2114. /*****************************************************************************
  2115.  * FUNCTION
  2116.  *  mmi_jmms_show_mms_status_icon
  2117.  * DESCRIPTION
  2118.  *  To show MMS indicator icon
  2119.  * PARAMETERS
  2120.  *  status      [IN]        
  2121.  * STATUS
  2122.  * RETURNS
  2123.  *  void
  2124.  *****************************************************************************/
  2125. void mmi_jmms_show_mms_status_icon(mmi_jmms_status_icon_type status)
  2126. {
  2127.     /*----------------------------------------------------------------*/
  2128.     /* Local Variables                                                */
  2129.     /*----------------------------------------------------------------*/
  2130.     /*----------------------------------------------------------------*/
  2131.     /* Code Body                                                      */
  2132.     /*----------------------------------------------------------------*/
  2133.     switch (status)
  2134.     {
  2135.         case MMS_STATUS_OFF:
  2136.             HideStatusIcon(STATUS_ICON_MMS_UNREAD);
  2137.             HideStatusIcon(STATUS_ICON_MMS_BUSY);
  2138.             break;
  2139.         case MMS_STATUS_NEW_MESSAGE:
  2140.             HideStatusIcon(STATUS_ICON_MMS_BUSY);
  2141.             HideStatusIcon(STATUS_ICON_MMS_UNREAD);
  2142.             ShowStatusIcon(STATUS_ICON_MMS_UNREAD);
  2143.             break;
  2144.         case MMS_STATUS_BUSY:
  2145.             HideStatusIcon(STATUS_ICON_MMS_UNREAD);
  2146.             HideStatusIcon(STATUS_ICON_MMS_BUSY);
  2147.             BlinkStatusIcon(STATUS_ICON_MMS_BUSY);
  2148.             break;
  2149.         case MMS_STATUS_FULL:
  2150.             HideStatusIcon(STATUS_ICON_MMS_UNREAD);
  2151.             HideStatusIcon(STATUS_ICON_MMS_BUSY);
  2152.             BlinkStatusIcon(STATUS_ICON_MMS_UNREAD);
  2153.             break;
  2154.         default:
  2155.             HideStatusIcon(STATUS_ICON_MMS_UNREAD);
  2156.             HideStatusIcon(STATUS_ICON_MMS_BUSY);
  2157.             break;
  2158.     }
  2159.     UpdateStatusIcons();
  2160. }
  2161. /*****************************************************************************
  2162.  * FUNCTION
  2163.  *  mmi_jmms_set_mms_downloading_busy
  2164.  * DESCRIPTION
  2165.  *  To handle MMS downloading indicator
  2166.  * PARAMETERS
  2167.  *  void
  2168.  * RETURNS
  2169.  *  void
  2170.  *****************************************************************************/
  2171. void mmi_jmms_set_mms_downloading_busy(void)
  2172. {
  2173.     /*----------------------------------------------------------------*/
  2174.     /* Local Variables                                                */
  2175.     /*----------------------------------------------------------------*/
  2176.     /*----------------------------------------------------------------*/
  2177.     /* Code Body                                                      */
  2178.     /*----------------------------------------------------------------*/
  2179.     g_mms_downloading_busy++;
  2180. }
  2181. /*****************************************************************************
  2182.  * FUNCTION
  2183.  *  mmi_jmms_reset_mms_downloading_busy
  2184.  * DESCRIPTION
  2185.  *  
  2186.  * PARAMETERS
  2187.  *  void
  2188.  * RETURNS
  2189.  *  void
  2190.  *****************************************************************************/
  2191. void mmi_jmms_reset_mms_downloading_busy(void)
  2192. {
  2193.     /*----------------------------------------------------------------*/
  2194.     /* Local Variables                                                */
  2195.     /*----------------------------------------------------------------*/
  2196.     /*----------------------------------------------------------------*/
  2197.     /* Code Body                                                      */
  2198.     /*----------------------------------------------------------------*/
  2199.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s%d ", "mmi_jmms_reset_mms_downloading_busy Val=", g_mms_downloading_busy));
  2200.     if (g_mms_downloading_busy != 0)
  2201.     {
  2202.         g_mms_downloading_busy--;
  2203.     }
  2204. }
  2205. /*****************************************************************************
  2206.  * FUNCTION
  2207.  *  mmi_jmms_is_download_busy
  2208.  * DESCRIPTION
  2209.  *  
  2210.  * PARAMETERS
  2211.  *  void
  2212.  * RETURNS
  2213.  *  
  2214.  *****************************************************************************/
  2215. U8 mmi_jmms_is_download_busy(void)
  2216. {
  2217.     /*----------------------------------------------------------------*/
  2218.     /* Local Variables                                                */
  2219.     /*----------------------------------------------------------------*/
  2220.     /*----------------------------------------------------------------*/
  2221.     /* Code Body                                                      */
  2222.     /*----------------------------------------------------------------*/
  2223.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s%d", "Download Busy=",g_mms_downloading_busy));
  2224.     return g_mms_downloading_busy;
  2225. }
  2226. /*****************************************************************************
  2227.  * FUNCTION
  2228.  *  mmi_jmms_stop_download_busy
  2229.  * DESCRIPTION
  2230.  *  
  2231.  * PARAMETERS
  2232.  *  void
  2233.  * RETURNS
  2234.  *  void
  2235.  *****************************************************************************/
  2236. void mmi_jmms_stop_download_busy(void)
  2237. {
  2238.     /*----------------------------------------------------------------*/
  2239.     /* Local Variables                                                */
  2240.     /*----------------------------------------------------------------*/
  2241.     /*----------------------------------------------------------------*/
  2242.     /* Code Body                                                      */
  2243.     /*----------------------------------------------------------------*/
  2244.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s%d", "Download Busy=",g_mms_downloading_busy));
  2245.     g_mms_downloading_busy = 0;
  2246.     return;
  2247. }
  2248. /*****************************************************************************
  2249.  * FUNCTION
  2250.  *  mmi_jmms_update_status_icon_indicator
  2251.  * DESCRIPTION
  2252.  *  To set indicator icon
  2253.  * PARAMETERS
  2254.  *  void
  2255.  * RETURNS
  2256.  *  void
  2257.  *****************************************************************************/
  2258. void mmi_jmms_update_status_icon_indicator(void)
  2259. {
  2260.     /*----------------------------------------------------------------*/
  2261.     /* Local Variables                                                */
  2262.     /*----------------------------------------------------------------*/
  2263.     U8 unread_msgs = 0;
  2264.     U8 total_num_messages;
  2265.     JC_RETCODE eRet = JC_OK;
  2266.     /*----------------------------------------------------------------*/
  2267.     /* Code Body                                                      */
  2268.     /*----------------------------------------------------------------*/
  2269.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_update_status_icon_indicator"));
  2270.     if (mmi_jmms_is_download_busy() > 0)
  2271.     {
  2272.         mmi_jmms_show_mms_status_icon(MMS_STATUS_BUSY);
  2273.     }
  2274.     else
  2275.     {
  2276.         eRet = mmi_jmms_get_total_number_of_messages(&total_num_messages);
  2277.         if (eRet != JC_OK)
  2278.         {
  2279.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s%d", "No Update, eRet = ",eRet));
  2280.             return;
  2281.         }
  2282.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s%d", "Total Messages=",total_num_messages));
  2283.         if (total_num_messages >= (MAX_POSSIBLE_MESSAGES_THRESHOLD))
  2284.         {
  2285.             mmi_jmms_show_mms_status_icon(MMS_STATUS_FULL);
  2286.         }
  2287.         else
  2288.         {
  2289.             mmi_jmms_get_number_of_unread_messages_in_inbox(&unread_msgs);
  2290.             if (unread_msgs > 0)
  2291.             {
  2292.                 mmi_jmms_show_mms_status_icon(MMS_STATUS_NEW_MESSAGE);
  2293.             }
  2294.             else
  2295.             {
  2296.                 mmi_jmms_show_mms_status_icon(MMS_STATUS_OFF);
  2297.             }
  2298.         }
  2299.     }
  2300. }
  2301. /* PMT VIKAS END 20060401 */
  2302. /*****************************************************************************
  2303.  * FUNCTION
  2304.  *  mmi_jmms_add_memory_full_node_if_not_already
  2305.  * DESCRIPTION
  2306.  *  
  2307.  * PARAMETERS
  2308.  *  void
  2309.  * RETURNS
  2310.  *  void
  2311.  *****************************************************************************/
  2312. void mmi_jmms_add_memory_full_node_if_not_already(void)
  2313. {
  2314.     /*----------------------------------------------------------------*/
  2315.     /* Local Variables                                                */
  2316.     /*----------------------------------------------------------------*/
  2317.     JC_RETCODE eRet = JC_OK;
  2318.     MMI_BOOL found = MMI_FALSE;
  2319.     jmms_pending_mms_info_struct *node1 = NULL;
  2320.     /*----------------------------------------------------------------*/
  2321.     /* Code Body                                                      */
  2322.     /*----------------------------------------------------------------*/
  2323.     node1 = g_jmms_context->pending_mms_info_list;
  2324.     while (node1 != NULL)
  2325.     {
  2326.         if (node1->Index == STR_ID_JMMS_ERROR_MMS_MEMORY_FULL)
  2327.         {
  2328.             found = MMI_TRUE;
  2329.             break;
  2330.         }
  2331.         node1 = node1->next;
  2332.     }
  2333.     if (found == MMI_FALSE)
  2334.     {
  2335.         eRet = mmi_jmms_add_pending_mms_info_node(
  2336.                 (U16) STR_ID_JMMS_ERROR_MMS_MEMORY_FULL,
  2337.                 (U8) E_MSG_TYPE_IDLE_SCREEN_POP_UP,
  2338.                 NULL);
  2339.         if (eRet == JC_OK)
  2340.         {
  2341.             mmi_jmms_check_for_idle_screen();
  2342.         }
  2343.     }
  2344. }
  2345. /*****************************************************************************
  2346.  * FUNCTION
  2347.  *  mmi_jmms_remove_memory_full_node_if_present
  2348.  * DESCRIPTION
  2349.  *  
  2350.  * PARAMETERS
  2351.  *  void
  2352.  * RETURNS
  2353.  *  void
  2354.  *****************************************************************************/
  2355. void mmi_jmms_remove_memory_full_node_if_present(void)
  2356. {
  2357.     /*----------------------------------------------------------------*/
  2358.     /* Local Variables                                                */
  2359.     /*----------------------------------------------------------------*/
  2360.     jmms_pending_mms_info_struct *node1 = NULL;
  2361.     jmms_pending_mms_info_struct *node2 = NULL;
  2362.     /*----------------------------------------------------------------*/
  2363.     /* Code Body                                                      */
  2364.     /*----------------------------------------------------------------*/
  2365.     node1 = g_jmms_context->pending_mms_info_list;
  2366.     node2 = g_jmms_context->pending_mms_info_list;
  2367.     while (node1 != NULL)
  2368.     {
  2369.         if (node1->Index == STR_ID_JMMS_ERROR_MMS_MEMORY_FULL)
  2370.         {
  2371.             node2->next = node1->next;
  2372.             if (node1->mms_url != NULL)
  2373.             {
  2374.                 jdd_MemFree(node1->mms_url);
  2375.             }
  2376.             if(node1 == g_jmms_context->pending_mms_info_list)
  2377.                 g_jmms_context->pending_mms_info_list = node1->next;
  2378.             jdd_MemFree(node1);
  2379.             node1 = NULL;
  2380.             break;
  2381.         }
  2382.         node2 = node1;
  2383.         node1 = node1->next;
  2384.     }
  2385. }
  2386. /*****************************************************************************
  2387.  * FUNCTION
  2388.  *  mmi_jmms_end_key_progressing
  2389.  * DESCRIPTION
  2390.  *  
  2391.  * PARAMETERS
  2392.  *  void
  2393.  * RETURNS
  2394.  *  void
  2395.  *****************************************************************************/
  2396. static void mmi_jmms_end_key_progressing(void)
  2397. {
  2398. mmi_jmms_end_comm();
  2399. g_end_key_processing_handler();
  2400. }
  2401. /*****************************************************************************
  2402.  * FUNCTION
  2403.  *  mmi_jmms_set_end_key_progressing_handler
  2404.  * DESCRIPTION
  2405.  *  
  2406.  * PARAMETERS
  2407.  *  void
  2408.  * RETURNS
  2409.  *  void
  2410.  *****************************************************************************/
  2411. static void mmi_jmms_set_end_key_progressing_handler(void)
  2412. {
  2413.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_set_end_key_progressing_handler"));
  2414.     if(!isInCall())
  2415.     {
  2416.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "End Key is Set for Communication"));
  2417.     g_end_key_processing_handler=GetKeyHandler(KEY_END,KEY_EVENT_DOWN);
  2418.     SetKeyHandler(mmi_jmms_end_key_progressing, KEY_END, KEY_EVENT_DOWN);
  2419.     }
  2420. }
  2421. /*****************************************************************************
  2422.  * FUNCTION
  2423.  *  mmi_jmms_update_pending_downloads
  2424.  * DESCRIPTION
  2425.  *  This function updates the message Index of notifications pending for download
  2426.  * PARAMETERS
  2427.  * JC_UINT32T
  2428.  * RETURNS
  2429.  *  JC_RETCODE
  2430.  *****************************************************************************/
  2431. JC_RETCODE mmi_jmms_update_pending_downloads(JC_UINT32 msg_index)
  2432. {
  2433.     
  2434.     jmms_communication_state_node *comm_node = NULL;
  2435.     /*----------------------------------------------------------------*/
  2436.     /* Code Body                                                      */
  2437.     /*----------------------------------------------------------------*/
  2438.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "mmi_jmms_update_pending_downloads:",
  2439.                          msg_index));
  2440.     comm_node = g_jmms_context->comm_state;
  2441.     ASSERT(msg_index);
  2442.     while (comm_node != NULL)
  2443.     {
  2444.         if ((comm_node->mms_communication_state == E_TYPE_IMMEDIATE_RETRIEVAL_FETCH)||
  2445.             (comm_node->mms_communication_state == E_TYPE_DEFFERED_RETRIEVAL_FETCH))
  2446.         {
  2447.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "Notofication found. Msg Id:",
  2448.                          comm_node->msg_index));
  2449.             if(comm_node->msg_index > msg_index)
  2450.             {
  2451.                 --comm_node->msg_index;
  2452.             }
  2453.             else if (comm_node->msg_index == msg_index)
  2454.             {
  2455.                 ASSERT(0);
  2456.             }
  2457.         }
  2458.         comm_node = comm_node->next;
  2459.     }
  2460.     return JC_OK;
  2461. }
  2462. #endif /* (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT)) */