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

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2002
  8. *
  9. *****************************************************************************/
  10. /*****************************************************************************
  11.  *
  12.  * Filename:
  13.  * ---------
  14.  *  jmms_push_handling.C
  15.  *
  16.  * Project:
  17.  * --------
  18.  *  MAUI
  19.  *
  20.  * Description:
  21.  * ------------
  22.  *  This file conains the store APIs for interacting with Jatayu Store module
  23.  *
  24.  * Author:
  25.  * -------
  26.  * -------
  27.  *
  28.  *============================================================================
  29.  *             HISTORY
  30.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  31.  *------------------------------------------------------------------------------
  32.  * removed!
  33.  *
  34.  * removed!
  35.  * removed!
  36.  * removed!
  37.  *
  38.  * removed!
  39.  * removed!
  40.  * removed!
  41.  *
  42.  * removed!
  43.  * removed!
  44.  * removed!
  45.  *
  46.  * removed!
  47.  * removed!
  48.  * removed!
  49.  *
  50.  * removed!
  51.  * removed!
  52.  * removed!
  53.  *
  54.  * removed!
  55.  * removed!
  56.  * removed!
  57.  *
  58.  * removed!
  59.  * removed!
  60.  * removed!
  61.  *
  62.  * removed!
  63.  * removed!
  64.  * removed!
  65.  *
  66.  * removed!
  67.  * removed!
  68.  * removed!
  69.  *
  70.  * removed!
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * removed!
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  *
  99.  * removed!
  100.  * removed!
  101.  * removed!
  102.  *
  103.  * removed!
  104.  * removed!
  105.  * removed!
  106.  *
  107.  * removed!
  108.  * removed!
  109.  * removed!
  110.  *
  111.  * removed!
  112.  * removed!
  113.  * removed!
  114.  *
  115.  * removed!
  116.  * removed!
  117.  * removed!
  118.  *
  119.  * removed!
  120.  * removed!
  121.  * removed!
  122.  *
  123.  * removed!
  124.  * removed!
  125.  * removed!
  126.  *
  127.  * removed!
  128.  * removed!
  129.  * removed!
  130.  *
  131.  *------------------------------------------------------------------------------
  132.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  133.  *============================================================================
  134.  ****************************************************************************/
  135. /***************************************************************************** 
  136. * Include
  137. *****************************************************************************/
  138. #include "MMI_features.h"
  139. #if (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT))
  140. #include "PixtelDataTypes.h"
  141. #include "Unicodexdcl.h"
  142. #include "HistoryGprot.h"
  143. #include "GlobalDefs.h"
  144. #include "SettingProfile.h"
  145. #include "DebugInitDef.h"
  146. #include "CommonScreens.h"
  147. #include "EventsGprot.h"
  148. #include "wgui_inputs.h"
  149. #include "wgui_datetime.h"
  150. #include "wgui_categories.h"
  151. #include "wgui_categories_inputs.h"
  152. #include "wgui_categories_popup.h"
  153. #include "ProfileGprots.h"      /* playRequestedTone() */
  154. #include "MainMenuDef.h"
  155. #include "IdleAppDef.h"
  156. #include "QuickAccessMenuItemProt.h"
  157. #include "TimerEvents.h"
  158. #include <ddl.h>
  159. #include <jcal.h>
  160. #include <jcalnet.h>
  161. #include "jdi_wspdatatype.h"
  162. #include "jdi_transport.h"
  163. #include <miscutils.h>
  164. #include <jdi_communicator.h>
  165. #include <MessagingDatatypes.h>
  166. #include <MessagingAPI.h>
  167. #include "JsrTypes.h"
  168. #include "JMMSView.h"
  169. #include "DateTimeDef.h"
  170. #include "DateTimeType.h"
  171. #include "DateTimeGprot.h"
  172. #include "MessagesResourceData.h"
  173. #include "DebugInitDef.h"       /* Debug Info */
  174. #include "JMMSConfig.h"
  175. #include "JMMSMessageSettings.h"
  176. #include "JMMSCoreAPI.h"
  177. #include "JMMSDrafts.h"
  178. #include "JMMSExdcl.h"
  179. /* /#include "JMMSGdcl.h" */
  180. #include "JMMSCompose.h"
  181. #include "JMMSGprot.h"
  182. #include "JMMSInbox.h"
  183. #include "JMMSJSRHandler.h"
  184. #include "JMMSMainMMS.h"
  185. #include "JMMSMessageSettingsUtils.h"
  186. #include "JMMSOutbox.h"
  187. #include "JMMSProtocols.h"
  188. #include "JMMSPushHandling.h"
  189. #include "JMMSResEnum.h"
  190. #include "JMMSSent.h"
  191. #include "JMMSStoreHandling.h"
  192. #include "JMMSStructs.h"
  193. #include "JMMSTemplates.h"
  194. #include "JMMSUseDetails.h"
  195. #include "JMMSView.h"
  196. #include "JMMSWriteMMS.h"
  197. #include "wapadp.h"
  198. #include "JPushInboxCommonUI.h"
  199. #include "JMMSPlutoMMIInterface.h"
  200. #ifdef __USB_IN_NORMAL_MODE__
  201. #include "USBDeviceGprot.h"
  202. #endif
  203. #ifdef  __MMI_KEYPAD_LOCK_PROMPT_TEXT__
  204. #include "KeyBrd.h"
  205. #endif
  206. #ifdef __MMI_UNIFIED_MESSAGE__
  207. #include "UnifiedMessageDef.h"
  208. #include "UnifiedMessageProt.h"
  209. #include "JMMSUMHandling.h"
  210. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  211. /***************************************************************************** 
  212. * Define
  213. *****************************************************************************/
  214. //Define for the read report prepend string
  215. #define STR_JMMS_READ_REPORT_PREPEND_STRING "Read:"
  216. /***************************************************************************** 
  217. * Typedef 
  218. *****************************************************************************/
  219. /***************************************************************************** 
  220. * Local Variable
  221. *****************************************************************************/
  222. /***************************************************************************** 
  223. * Local Function
  224. *****************************************************************************/
  225. /***************************************************************************** 
  226. * Global Variable
  227. *****************************************************************************/
  228. extern void EntryScrAfterPessingRSK(void);
  229. extern em_wap_user_agent_brand_enum wap_get_user_agent_brand(void);
  230. U16 DeleteScreenFromToNnodes(U16 ScrId, U16 num_nodes);
  231. U8 DeleteFromScrUptoScr(U16 beyondScrnid, U16 tillScrnid);
  232. /***************************************************************************** 
  233. * Global Function
  234. *****************************************************************************/
  235. /*****************************************************************************
  236.  * FUNCTION
  237.  *  mmi_jmms_update_roaming_status
  238.  * DESCRIPTION
  239.  *  
  240.  * PARAMETERS
  241.  *  isRoaming       [IN]        
  242.  * RETURNS
  243.  *  void
  244.  *****************************************************************************/
  245. void mmi_jmms_update_roaming_status(unsigned long isRoaming)
  246. {
  247.     /*----------------------------------------------------------------*/
  248.     /* Local Variables                                                */
  249.     /*----------------------------------------------------------------*/
  250.     /*----------------------------------------------------------------*/
  251.     /* Code Body                                                      */
  252.     /*----------------------------------------------------------------*/
  253.     if (g_jmms_context != NULL)
  254.     {
  255.         g_jmms_context->curr_roaming_state = (U32) isRoaming;
  256.     }
  257. }
  258. #ifndef __MMI_UNIFIED_MESSAGE__
  259. #define REFRESH_INBOX_TIMEOUT       1000
  260. /*****************************************************************************
  261.  * FUNCTION
  262.  *  mmi_jmms_go_back_refresh_inbox
  263.  * DESCRIPTION
  264.  *  
  265.  * PARAMETERS
  266.  *  void
  267.  * RETURNS
  268.  *  void
  269.  *****************************************************************************/
  270. void mmi_jmms_go_back_refresh_inbox(void)
  271. {
  272.     /*----------------------------------------------------------------*/
  273.     /* Local Variables                                                */
  274.     /*----------------------------------------------------------------*/
  275.     /*----------------------------------------------------------------*/
  276.     /* Code Body                                                      */
  277.     /*----------------------------------------------------------------*/
  278.     StopTimer(POPUP_TIMER);
  279.     GoBackHistory();
  280. }
  281. /*****************************************************************************
  282.  * FUNCTION
  283.  *  mmi_jmms_exit_refresh_inbox
  284.  * DESCRIPTION
  285.  *  
  286.  * PARAMETERS
  287.  *  void
  288.  * RETURNS
  289.  *  void
  290.  *****************************************************************************/
  291. void mmi_jmms_exit_refresh_inbox(void)
  292. {
  293. /*----------------------------------------------------------------*/
  294.     /* Local Variables                                                */
  295.     /*----------------------------------------------------------------*/
  296.     /*----------------------------------------------------------------*/
  297.     /* Code Body                                                      */
  298.     /*----------------------------------------------------------------*/
  299. StopTimer(POPUP_TIMER);
  300. }
  301. /*****************************************************************************
  302.  * FUNCTION
  303.  *  mmi_jmms_refresh_inbox
  304.  * DESCRIPTION
  305.  *  
  306.  * PARAMETERS
  307.  *  void
  308.  * RETURNS
  309.  *  void
  310.  *****************************************************************************/
  311. void mmi_jmms_refresh_inbox_no_screen_update(void)
  312. {
  313. if ((IsScreenPresent(SCR_ID_JMMS_INBOX)) || (GetActiveScreenId() == SCR_ID_JMMS_INBOX))
  314. {
  315. g_jmms_context->store_context->update_nmsgs_in_current_folder=1;
  316. g_jmms_context->nCurr_scr_hilited_index=0;
  317. }
  318. }
  319. /*****************************************************************************
  320.  * FUNCTION
  321.  *  mmi_jmms_refresh_inbox
  322.  * DESCRIPTION
  323.  *  
  324.  * PARAMETERS
  325.  *  void
  326.  * RETURNS
  327.  *  void
  328.  *****************************************************************************/
  329. void mmi_jmms_refresh_inbox(void)
  330. {
  331.     /*----------------------------------------------------------------*/
  332.     /* Local Variables                                                */
  333.     /*----------------------------------------------------------------*/
  334.     /*----------------------------------------------------------------*/
  335.     /* Code Body                                                      */
  336.     /*----------------------------------------------------------------*/
  337. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_refresh_inbox"));
  338. mmi_jmms_refresh_inbox_no_screen_update();
  339. if(GetActiveScreenId() != SCR_ID_JMMS_INBOX)
  340. return;
  341. StartTimer(POPUP_TIMER, REFRESH_INBOX_TIMEOUT, mmi_jmms_go_back_refresh_inbox);
  342. EntryNewScreen(POPUP_SCREENID, mmi_jmms_exit_refresh_inbox, NULL, NULL);
  343. ShowCategory66Screen(
  344.         STR_MMS_MENUENTRY,
  345.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  346.         0,
  347.         0,
  348. 0,
  349.         0,
  350.         (U8*) GetString(STR_ID_JMMS_LOADING_MMS),
  351.         IMG_GLOBAL_PROGRESS,
  352.         NULL);
  353.  ClearAllKeyHandler();
  354. }
  355. #endif
  356. /*****************************************************************************
  357.  * FUNCTION
  358.  *  mmi_jmms_handle_new_mms_notification
  359.  * DESCRIPTION
  360.  *  
  361.  * PARAMETERS
  362.  *  view_content        [?]         [?]         [?]
  363.  *  hMsgHandle          [IN]        
  364.  *  pNotifyIndHdrs      [?]         [?]         [?]
  365.  * RETURNS
  366.  *  void
  367.  *****************************************************************************/
  368. void mmi_jmms_handle_new_mms_notification(
  369.         CONTENT_DATA *view_content,
  370.         MSG_HANDLE hMsgHandle,
  371.         MESSAGE_NOTIFICATION *pNotifyIndHdrs)
  372. {
  373.     /*----------------------------------------------------------------*/
  374.     /* Local Variables                                                */
  375.     /*----------------------------------------------------------------*/
  376. #ifndef __MMI_MMS_OMA_CONF_273__
  377.     JC_UINT32 temp;
  378. #endif
  379.     U32 roaming_status;
  380.     U8 retrieval_mode;
  381.     JC_RETCODE eRet = JC_OK;
  382.     JC_UINT32 msg_index;
  383.     /* JC_UINT32 msgid = 0; */
  384.     MESSAGE_HEADERS *pMsgHdrs = NULL;
  385.     JC_UINT32 mms_index = 0;
  386.     /*----------------------------------------------------------------*/
  387.     /* Code Body                                                      */
  388.     /*----------------------------------------------------------------*/
  389.     /* /check the retrival mnode */
  390.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_handle_new_mms_notification"));
  391.     roaming_status = g_jmms_context->curr_roaming_state;
  392.     if (roaming_status == 1)
  393.     {
  394.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "jmms Roaming status is 1."));
  395.         if (E_ROAMING_RETRIEVAL_AS_HOME == (U16) mmi_jmms_retrieval_settings_roaming_retrieval_mode())
  396.         {
  397.             retrieval_mode = mmi_jmms_retrieval_settings_home_network_retrieval_mode();
  398.         }
  399.         else
  400.         {
  401.             retrieval_mode = mmi_jmms_retrieval_settings_roaming_retrieval_mode();
  402.         }
  403.     }
  404.     else
  405.     {
  406.         retrieval_mode = mmi_jmms_retrieval_settings_home_network_retrieval_mode();
  407.     }
  408.     if (retrieval_mode == E_ROAMING_RETRIEVAL_RESTRICTED)   /* /E_ROAMING_RETRIEVAL_IMMEDAITE and E_HOME_NOETWORK_RETRIEVAL_IMMEDAITE */
  409.         /* have same values */
  410.     {
  411.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "jmms Retrival Mode: %s", "RETRIEVAL_RESTRICTED"));
  412.         eRet = mmi_jmms_notification_reponse(pNotifyIndHdrs, E_MSG_REJECTED);
  413.         return;
  414.     }
  415. #ifndef __MMI_MMS_OMA_CONF_273__
  416.     /* /check the filters */
  417.     temp = 1024 * (JC_UINT32) mmi_jmms_retrieval_settings_msg_size_filter();    /* in bytes */
  418. #endif /* __MMI_MMS_OMA_CONF_273__ */ 
  419.     if ((pNotifyIndHdrs->eMsgClass == E_MSG_ADVERTISEMENT_CLASS &&
  420.          E_REJECT == mmi_jmms_retrieval_settings_advertisment_filter()) || ((pNotifyIndHdrs->pFrom == NULL) &&
  421.                                                                             E_REJECT ==
  422.                                                                             mmi_jmms_retrieval_settings_anonymous_filter
  423.                                                                             ())
  424. #ifndef __MMI_MMS_OMA_CONF_273__
  425.         || (pNotifyIndHdrs->uiMessageSize > temp)
  426. #endif 
  427.         )
  428.     {
  429.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "jmms send the notification response with Reject Status"));
  430.         /* /send the notfication response with reject status */
  431.         eRet = mmi_jmms_notification_reponse(pNotifyIndHdrs, E_MSG_REJECTED);
  432.         return;
  433.     }
  434. #ifdef  __MMI_MMS_OMA_CONF_273__ 
  435.     if(pNotifyIndHdrs->uiMessageSize > MAX_MMS_MSG_SIZE)
  436.     {
  437.     retrieval_mode = E_ROAMING_RETRIEVAL_DEFFERED;
  438.     }
  439. #endif
  440. #ifdef __USB_IN_NORMAL_MODE__
  441.     if (mmi_jmms_check_usb_mode() == 1)
  442.     {
  443.         retrieval_mode = E_ROAMING_RETRIEVAL_DEFFERED;
  444.     }
  445. #endif /* __USB_IN_NORMAL_MODE__ */ 
  446.     if (retrieval_mode == E_ROAMING_RETRIEVAL_IMMEDAITE)
  447.     {
  448.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "jmms retrival mode: %s", "RETRIEVAL_IMMEDAITE"));
  449.         eRet = mmi_jmms_jdi_get_msg_headers(hMsgHandle, &pMsgHdrs);
  450.         if (JC_OK == eRet)
  451.         {
  452.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "jmms saving the notification into InBox."));
  453.             /* save notification in inbox. */
  454.             eRet = mmi_jmms_save_message_buffer_in_Store("Inbox", &(mms_index), pMsgHdrs, view_content, NULL);
  455.             if(eRet == JC_OK)
  456.                mmi_jmms_set_msg_as_unread(mms_index-1);
  457.             if (eRet != JC_OK)
  458.             {
  459. mms_index = 0;  /* it means notification didn't save successfully */
  460.                     if (eRet == JC_ERR_MEMORY_ALLOCATION || eRet == JC_ERR_FILE_WRITE)
  461.                     {
  462.                         eRet = mmi_jmms_add_pending_mms_info_node(
  463.                                 (U16) STR_ID_JMMS_MEMORY_ERROR_NEW_MMS_NOTIF_SAVING,
  464.                                 (U8) E_MSG_TYPE_IDLE_SCREEN_POP_UP,
  465.                                 NULL);
  466.                     }
  467.                     else
  468.                     {
  469.                         eRet = mmi_jmms_add_pending_mms_info_node(
  470.                                 (U16) STR_ID_JMMS_ERROR_NEW_MMS_NOTIF_SAVING,
  471.                                 (U8) E_MSG_TYPE_IDLE_SCREEN_POP_UP,
  472.                                 NULL);
  473.                     }
  474.                     if (eRet == JC_OK)
  475.                     {
  476.                         mmi_jmms_check_for_idle_screen();
  477.                     }
  478. return;
  479.             }
  480. else
  481. {
  482. #ifdef __MMI_UNIFIED_MESSAGE__
  483. mmi_um_jmms_refresh_ind();
  484. #else
  485. mmi_jmms_refresh_inbox();
  486. #endif
  487. }
  488.         /* PMT VIKAS START 20060401 */
  489.     //mmi_jmms_update_status_icon_indicator();
  490. /* PMT VIKAS END 20060401 */
  491.         }
  492.         else
  493.         {
  494.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "jmms fail to get the MMS Header %d", eRet));
  495.         }
  496.         mmi_jmms_download_mms(pNotifyIndHdrs->pContentLocation, E_TYPE_IMMEDIATE_RETRIEVAL_FETCH, mms_index, 1);
  497.     }
  498.     else if (retrieval_mode == E_ROAMING_RETRIEVAL_DEFFERED)
  499.     {
  500.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "jmms Retrival Mode: %s", "RETRIEVAL_DEFFERED"));
  501.         eRet = mmi_jmms_notification_reponse(pNotifyIndHdrs, E_MSG_DEFERRED);
  502.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "jmms saving the notification into InBox return: %d", eRet));
  503.         if (eRet == JC_OK)
  504.         {
  505.             eRet = mmi_jmms_jdi_get_msg_headers(hMsgHandle, &pMsgHdrs);
  506.             if (JC_OK == eRet)
  507.             {
  508.                 PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "jmms saving the notification into InBox"));
  509.                 /* save notification in inbox. */
  510.                 eRet = mmi_jmms_save_message_buffer_in_Store("Inbox", &msg_index, pMsgHdrs, view_content, NULL);
  511.                 if(eRet == JC_OK)
  512.                     mmi_jmms_set_msg_as_unread(msg_index-1);
  513.                 /* PMT VIKAS START 20060401 */
  514.                 mmi_jmms_update_status_icon_indicator();
  515.                 /* PMT VIKAS END 20060401 */
  516.             
  517.                 PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s:%d", "save result", eRet));
  518.                 if (eRet == JC_OK)
  519.                 {
  520.                     eRet = mmi_jmms_add_pending_mms_info_node(
  521.                             (U16) msg_index,
  522.                             (U8) E_MSG_TYPE_NOTIFICATION,
  523.                             (S8*) pNotifyIndHdrs->pContentLocation);
  524.                     if (eRet == JC_OK)
  525.                     {
  526.                         /* Display pop up according to idle screen or not. */
  527.                         mmi_jmms_show_new_mms_pop_up();
  528.                     }
  529. #ifndef __MMI_UNIFIED_MESSAGE__
  530. mmi_jmms_refresh_inbox_no_screen_update();
  531. #endif
  532.                 }
  533.                 else
  534.                 {
  535.                     if (eRet == JC_ERR_MEMORY_ALLOCATION || eRet == JC_ERR_FILE_WRITE)
  536.                     {
  537.                         eRet = mmi_jmms_add_pending_mms_info_node(
  538.                                 (U16) STR_ID_JMMS_MEMORY_ERROR_NEW_MMS_NOTIF_SAVING,
  539.                                 (U8) E_MSG_TYPE_IDLE_SCREEN_POP_UP,
  540.                                 NULL);
  541.                     }
  542.                     else
  543.                     {
  544.                         eRet = mmi_jmms_add_pending_mms_info_node(
  545.                                 (U16) STR_ID_JMMS_ERROR_NEW_MMS_NOTIF_SAVING,
  546.                                 (U8) E_MSG_TYPE_IDLE_SCREEN_POP_UP,
  547.                                 NULL);
  548.                     }
  549.                     if (eRet == JC_OK)
  550.                     {
  551.                         mmi_jmms_check_for_idle_screen();
  552.                     }
  553.                 }
  554.             }
  555.             else
  556.             {
  557.                 eRet = mmi_jmms_add_pending_mms_info_node(
  558.                         (U16) STR_ID_JMMS_ERROR_NEW_MMS_NOTIF_SAVING,
  559.                         (U8) E_MSG_TYPE_IDLE_SCREEN_POP_UP,
  560.                         NULL);
  561.                 if (eRet == JC_OK)
  562.                 {
  563.                     mmi_jmms_check_for_idle_screen();
  564.                 }
  565.             }
  566.         }
  567.     }
  568. }
  569. ///msg_index is used for immediate retrieval fetch to store the index of mms to be
  570. //updated after downlaoding of mms
  571. /*****************************************************************************
  572.  * FUNCTION
  573.  *  mmi_jmms_download_mms
  574.  * DESCRIPTION
  575.  *  
  576.  * PARAMETERS
  577.  *  content_location        [?]         [?]         [?]
  578.  *  comm_state              [IN]        
  579.  *  msg_index               [IN]        
  580.  *  retry_counter           [IN]        
  581.  * RETURNS
  582.  *  
  583.  *****************************************************************************/
  584. JC_RETCODE mmi_jmms_download_mms(JC_INT8 *content_location, U16 comm_state, JC_UINT32 msg_index, U8 retry_counter)
  585. {
  586.     /*----------------------------------------------------------------*/
  587.     /* Local Variables                                                */
  588.     /*----------------------------------------------------------------*/
  589.     JC_RETCODE eRet = JC_OK;
  590.     COMM_FETCH_URL fetchUrlInfo = {0, };
  591.     JC_UINT32 uiReferenceID = 1;
  592.     S8 *temp_url = NULL;
  593.     S32 len = 0;
  594.     S8 *mms_content_location = NULL;
  595.     /*----------------------------------------------------------------*/
  596.     /* Code Body                                                      */
  597.     /*----------------------------------------------------------------*/
  598.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_download_mms"));
  599.     fetchUrlInfo.eContentMode = E_COMM_BUFFER;
  600.     len = (strlen((S8*) content_location) + 1);
  601.     /* adding for retry mechanism */
  602.     mms_content_location = (S8*) jdd_MemAlloc(sizeof(S8), len);
  603.     if (mms_content_location == NULL)
  604.     {
  605.         eRet = JC_ERR_MEMORY_ALLOCATION;
  606.         goto END;
  607.     }
  608.     /* /commenitng for retry mechnaism */
  609.     temp_url = (S8*) jdd_MemAlloc(sizeof(S8), len * ENCODING_LENGTH);
  610.     if (temp_url == NULL)
  611.     {
  612.         eRet = JC_ERR_MEMORY_ALLOCATION;
  613.         goto END;
  614.     }
  615.     strcpy((char*)mms_content_location, (const char*)content_location);
  616.     AnsiiToUnicodeString((S8*) temp_url, (S8*) content_location);
  617.     fetchUrlInfo.pszURL = (JC_CHAR*) temp_url;
  618.     fetchUrlInfo.pszContentType = NULL;
  619.     fetchUrlInfo.uUserDataMode.pucPostData = NULL;
  620.     fetchUrlInfo.bIsFile = E_FALSE;
  621.     fetchUrlInfo.uiPostLen = 0;
  622.     fetchUrlInfo.pHeadersInfo = NULL;
  623.     fetchUrlInfo.eCommFetchType = E_COMM_FETCH_GET;
  624.     if (comm_state == E_TYPE_DEFFERED_RETRIEVAL_FETCH)
  625.     {
  626.         /*
  627.          * For deffered Retrieval need to use the g_jmms_context->uiReferenceID variable beacuse downloading screen
  628.          * is there and downloading can be cancelled. Also don't use this variable for Immediate Retrieval etc.
  629.          * because during Sending/Defered Downlaod there can be immediate retrieval so this varaiable can be overwritten.
  630.          * 
  631.          * This variable is used during Sending/Deffered Downloading beacause Sending/Deffered Downlaoding can be 
  632.          * cancelled by user and so we require this value in jdi_CommunicationStopReq().
  633.          * Also there is no harm on using the same varaible for sending and deffered retrieval because sending and 
  634.          * deffered retrieval cann't be both together.
  635.          */
  636.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "jmms comm State: %s", "E_TYPE_DEFFERED_RETRIEVAL_FETCH"));
  637.         g_jmms_context->uiReferenceID = 0;
  638.         eRet = jdi_CommunicationFetchURL(g_jmms_context->hCommHandle, &fetchUrlInfo, &g_jmms_context->uiReferenceID);
  639.         if (eRet == JC_OK)
  640.         {
  641.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "JMMS Comm Fetch Download", g_jmms_context->uiReferenceID));
  642.             eRet = mmi_jmms_add_comm_node(
  643.                     g_jmms_context,
  644.                     g_jmms_context->uiReferenceID,
  645.                     comm_state,
  646.                     NULL,
  647.                     msg_index,
  648.                     retry_counter,
  649.                     mms_content_location);
  650.             if (eRet != JC_OK)
  651.             {
  652.                 PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms fail to add comm node", eRet));
  653.                 jdi_CommunicationFreeReference(g_jmms_context->hCommHandle, g_jmms_context->uiReferenceID);
  654.                 g_jmms_context->uiReferenceID = 0;
  655.                 eRet = JC_ERR_MEMORY_ALLOCATION;
  656.             }
  657.         }
  658.     }
  659.     else
  660.     {
  661.         eRet = jdi_CommunicationFetchURL(g_jmms_context->hCommHandle, &fetchUrlInfo, &uiReferenceID);
  662.         if (eRet == JC_OK)
  663.         {
  664.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "JMMS Comm Fetch Download", uiReferenceID));
  665.             eRet = mmi_jmms_add_comm_node(
  666.                     g_jmms_context,
  667.                     uiReferenceID,
  668.                     comm_state,
  669.                     NULL,
  670.                     msg_index,
  671.                     retry_counter,
  672.                     mms_content_location);
  673.             if (eRet != JC_OK)
  674.             {
  675.                 PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms fail to add comm node", eRet));
  676.                 jdi_CommunicationFreeReference(g_jmms_context->hCommHandle, uiReferenceID);
  677.                 eRet = JC_ERR_MEMORY_ALLOCATION;
  678.             }
  679.         }
  680.     }
  681.   END:
  682.     if (temp_url != NULL)
  683.     {
  684.         jdd_MemFree(temp_url);
  685.     }
  686.     if (eRet != JC_OK)
  687.     {
  688.         if (mms_content_location != NULL)
  689.         {
  690.             jdd_MemFree(mms_content_location);
  691.         }
  692.     }
  693.     return eRet;
  694. }
  695. /*****************************************************************************
  696.  * FUNCTION
  697.  *  mmi_jmms_notification_reponse
  698.  * DESCRIPTION
  699.  *  
  700.  * PARAMETERS
  701.  *  pNotification       [?]         [?]         [?]
  702.  *  eMessageStatus      [IN]        
  703.  * RETURNS
  704.  *  
  705.  *****************************************************************************/
  706. JC_RETCODE mmi_jmms_notification_reponse(MESSAGE_NOTIFICATION *pNotification, EMessageStatus eMessageStatus)
  707. {
  708.     /*----------------------------------------------------------------*/
  709.     /* Local Variables                                                */
  710.     /*----------------------------------------------------------------*/
  711.     JC_RETCODE eRet = JC_OK;
  712.     NOTIFICATION_RESPONSE *pNotRespHdr = NULL;
  713.     MESSAGE_HEADERS *pMsgHeaders = NULL;
  714.     MSG_HANDLE mms_signal_handle = NULL;
  715.     /*----------------------------------------------------------------*/
  716.     /* Code Body                                                      */
  717.     /*----------------------------------------------------------------*/
  718.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_notification_reponse"));
  719.     if (pNotification == NULL || pNotification->pTransactionID == NULL || pNotification->pVersion == NULL)
  720.     {
  721.         eRet = JC_ERR_INVALID_PARAMETER;
  722.         goto ERROR_HANDLE;
  723.     }
  724.     eRet = mmi_jmms_jdi_msg_init(&mms_signal_handle, NULL);
  725.     if (JC_OK != eRet)
  726.     {
  727.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms msg Initialization Failed", eRet));
  728.         goto ERROR_HANDLE;
  729.     }
  730.     pMsgHeaders = (MESSAGE_HEADERS*) jdd_MemAlloc(sizeof(MESSAGE_HEADERS), 1);
  731.     if (pMsgHeaders == NULL)
  732.     {
  733.         eRet = JC_ERR_MEMORY_ALLOCATION;
  734.         goto ERROR_HANDLE;
  735.     }
  736.     eRet = mmi_jmms_jdi_set_msg_headers(mms_signal_handle, pMsgHeaders);
  737.     if (eRet != JC_OK)
  738.     {
  739.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms fail to set the message header", eRet));
  740.         goto ERROR_HANDLE;
  741.     }
  742.     pNotRespHdr = (NOTIFICATION_RESPONSE*) jdd_MemAlloc(sizeof(NOTIFICATION_RESPONSE), 1);
  743.     if (pNotRespHdr == NULL)
  744.     {
  745.         eRet = JC_ERR_MEMORY_ALLOCATION;
  746.         goto ERROR_HANDLE;
  747.     }
  748.     pNotRespHdr->pVersion = (JC_INT8*) jdi_UtilsStrdup(pNotification->pVersion);
  749.     pNotRespHdr->pTransactionID = jdi_UtilsStrdup(pNotification->pTransactionID);
  750.     pNotRespHdr->eMessageStatus = eMessageStatus;
  751.     pNotRespHdr->bDeliveryReport = (JC_BOOLEAN) mmi_jmms_retrieval_settings_delivery_report();
  752.     pMsgHeaders->eMsgType = E_MSG_TYPE_NOTIFICATION_RESPONSE;
  753.     pMsgHeaders->pHeaders = pNotRespHdr;
  754.     eRet = mmi_jmms_jdi_set_msg_headers(mms_signal_handle, pMsgHeaders);
  755.     if (JC_OK != eRet)
  756.     {
  757.         goto ERROR_HANDLE;
  758.     }
  759.     eRet = mmi_jmms_send_mms(mms_signal_handle, E_TYPE_NOTIFICATION_RESPONSE, E_TRUE, 1, E_FALSE);
  760.   ERROR_HANDLE:
  761.     if (mms_signal_handle != NULL)
  762.     {
  763.         mmi_jmms_jdi_msg_deinit(mms_signal_handle);
  764.         mms_signal_handle = NULL;
  765.     }
  766.     return eRet;
  767. }
  768. /*****************************************************************************
  769.  * FUNCTION
  770.  *  jmms_mmi_notification_response_for_immediate_retrieval
  771.  * DESCRIPTION
  772.  *  
  773.  * PARAMETERS
  774.  *  ViewContent     [IN]        
  775.  * RETURNS
  776.  *  
  777.  *****************************************************************************/
  778. JC_RETCODE jmms_mmi_notification_response_for_immediate_retrieval(CONTENT_DATA ViewContent)
  779. {
  780.     /*----------------------------------------------------------------*/
  781.     /* Local Variables                                                */
  782.     /*----------------------------------------------------------------*/
  783.     JC_RETCODE eRet = JC_OK;
  784.     NOTIFICATION_RESPONSE *pNotRespHdr = NULL;
  785.     MESSAGE_HEADERS *pMsgHeaders = NULL;
  786.     MESSAGE_RETRIEVAL *pNotifyIndHdrs = NULL;
  787.     MSG_HANDLE mms_signal_handle = NULL;
  788.     /*----------------------------------------------------------------*/
  789.     /* Code Body                                                      */
  790.     /*----------------------------------------------------------------*/
  791.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "jmms_mmi_notification_response_for_immediate_retrieval"));
  792.     eRet = mmi_jmms_jdi_parse_msg_buffer(&mms_signal_handle, &ViewContent, E_TYPE_MMS, E_FALSE);
  793.     /* Async changes begin */
  794.     while (eRet == JC_ERR_MMS_PARSE_PENDING)
  795.     {
  796.         eRet = mmi_jmms_jdi_msg_parse_continue(mms_signal_handle);
  797.     }
  798.     /* Async changes end */
  799.     if (JC_OK != eRet && mms_signal_handle != NULL)
  800.     {
  801.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms error in parsing", eRet));
  802.         mmi_jmms_jdi_msg_deinit(mms_signal_handle);
  803.         mms_signal_handle = NULL;
  804.         return eRet;
  805.     }
  806.     eRet = mmi_jmms_jdi_get_msg_headers(mms_signal_handle, &pMsgHeaders);
  807.     if (JC_OK != eRet)
  808.     {
  809.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms fail to get the message header", eRet));
  810.         mmi_jmms_jdi_msg_deinit(mms_signal_handle);
  811.         mms_signal_handle = NULL;
  812.         return eRet;
  813.     }
  814.     if (pMsgHeaders->eMsgType != E_MSG_TYPE_RECEIVE)
  815.     {
  816.         mmi_jmms_jdi_msg_deinit(mms_signal_handle);
  817.         mms_signal_handle = NULL;
  818.         return E_UNKNOWN_MSG;
  819.     }
  820.     pNotifyIndHdrs = (MESSAGE_RETRIEVAL*) pMsgHeaders->pHeaders;
  821.     if (pNotifyIndHdrs == NULL || pNotifyIndHdrs->pTransactionID == NULL || pNotifyIndHdrs->pVersion == NULL)
  822.     {
  823.         eRet = JC_ERR_INVALID_PARAMETER;
  824.         goto ERROR_HANDLE;
  825.     }
  826.     pNotRespHdr = (NOTIFICATION_RESPONSE*) jdd_MemAlloc(sizeof(NOTIFICATION_RESPONSE), 1);
  827.     if (pNotRespHdr == NULL)
  828.     {
  829.         eRet = JC_ERR_MEMORY_ALLOCATION;
  830.         goto ERROR_HANDLE;
  831.     }
  832.     pNotRespHdr->pVersion = jdi_UtilsStrdup(pNotifyIndHdrs->pVersion);
  833.     pNotRespHdr->pTransactionID = jdi_UtilsStrdup(pNotifyIndHdrs->pTransactionID);
  834.     pNotRespHdr->eMessageStatus = E_MSG_RETRIEVED;
  835.     pNotRespHdr->bDeliveryReport = (JC_BOOLEAN) mmi_jmms_retrieval_settings_delivery_report();
  836.     if (NULL != mms_signal_handle)
  837.     {
  838.         mmi_jmms_jdi_msg_deinit(mms_signal_handle);
  839.         mms_signal_handle = NULL;
  840.     }
  841.     eRet = mmi_jmms_jdi_msg_init(&mms_signal_handle, NULL);
  842.     if (JC_OK != eRet)
  843.     {
  844.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms msg Initialization Failed", eRet));
  845.         mms_signal_handle = NULL;
  846.         goto ERROR_HANDLE;
  847.     }
  848.     pMsgHeaders = (MESSAGE_HEADERS*) jdd_MemAlloc(sizeof(MESSAGE_HEADERS), 1);
  849.     if (pMsgHeaders == NULL)
  850.     {
  851.         eRet = JC_ERR_MEMORY_ALLOCATION;
  852.         goto ERROR_HANDLE;
  853.     }
  854.     pMsgHeaders->eMsgType = E_MSG_TYPE_NOTIFICATION_RESPONSE;
  855.     pMsgHeaders->pHeaders = pNotRespHdr;
  856.     eRet = mmi_jmms_jdi_set_msg_headers(mms_signal_handle, pMsgHeaders);
  857.     if (JC_OK != eRet)
  858.     {
  859.         goto ERROR_HANDLE;
  860.     }
  861.     eRet = mmi_jmms_send_mms(mms_signal_handle, E_TYPE_NOTIFICATION_RESPONSE, E_TRUE, 1, E_FALSE);
  862.   ERROR_HANDLE:
  863.     if (mms_signal_handle != NULL)
  864.     {
  865.         mmi_jmms_jdi_msg_deinit(mms_signal_handle);
  866.         mms_signal_handle = NULL;
  867.     }
  868.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s%d",
  869.                          "jmms mms_mmi_notification_response_for_immediate_retrieval return value: ", eRet));
  870.     return eRet;
  871. }
  872. /*****************************************************************************
  873.  * FUNCTION
  874.  *  mmi_jmms_entry_show_mms_screen
  875.  * DESCRIPTION
  876.  *  
  877.  * PARAMETERS
  878.  *  void
  879.  * RETURNS
  880.  *  void
  881.  *****************************************************************************/
  882. void mmi_jmms_entry_show_mms_screen(void)
  883. {
  884.     /*----------------------------------------------------------------*/
  885.     /* Local Variables                                                */
  886.     /*----------------------------------------------------------------*/
  887.     PU8 gui_buffer; /* Buffer holding history data */
  888.     S8 temp[14];
  889.     U8 dttemp[40];
  890.     MYTIME time1, time;
  891.     FLOAT timezone;
  892.     /*----------------------------------------------------------------*/
  893.     /* Code Body                                                      */
  894.     /*----------------------------------------------------------------*/
  895.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_entry_show_mms_screen"));
  896.     timezone = mmi_dt_get_tz();
  897.     EntryNewScreen(SCR_ID_JMMS_NEW_MMS, NULL, mmi_jmms_entry_show_mms_screen, NULL);
  898.     gui_buffer = GetCurrGuiBuffer(SCR_ID_JMMS_NEW_MMS);
  899.     pfnUnicodeStrcpy((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_FROM));
  900.     memset(temp, 0x00, 14);
  901.     AnsiiToUnicodeString((PS8) temp, (PS8) "n----n");
  902.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  903.     if (((MESSAGE_RETRIEVAL*) g_jmms_context->MsgHeader_type_p)->pFrom == NULL)
  904.     {
  905.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
  906.     }
  907.     else
  908.     {
  909.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) ((MESSAGE_RETRIEVAL*) g_jmms_context->MsgHeader_type_p)->pFrom);
  910.     }
  911.     /* /TO */
  912.     memset(temp, 0x00, 14);
  913.     AnsiiToUnicodeString((PS8) temp, (PS8) "nn");
  914.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  915.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_TO));
  916.     memset(temp, 0x00, 14);
  917.     AnsiiToUnicodeString((PS8) temp, (PS8) "n----n");
  918.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  919.     if (((MESSAGE_RETRIEVAL*) g_jmms_context->MsgHeader_type_p)->pTo == NULL)
  920.     {
  921.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
  922.     }
  923.     else
  924.     {
  925.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) ((MESSAGE_RETRIEVAL*) g_jmms_context->MsgHeader_type_p)->pTo);
  926.     }
  927.     /* /CC */
  928.     memset(temp, 0x00, 14);
  929.     AnsiiToUnicodeString((PS8) temp, (PS8) "nn");
  930.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  931.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_CC));
  932.     memset(temp, 0x00, 14);
  933.     AnsiiToUnicodeString((PS8) temp, (PS8) "n----n");
  934.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  935.     if (((MESSAGE_RETRIEVAL*) g_jmms_context->MsgHeader_type_p)->pCc == NULL)
  936.     {
  937.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
  938.     }
  939.     else
  940.     {
  941.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) ((MESSAGE_RETRIEVAL*) g_jmms_context->MsgHeader_type_p)->pCc);
  942.     }
  943.     /* /Subject */
  944.     memset(temp, 0x00, 14);
  945.     AnsiiToUnicodeString((PS8) temp, (PS8) "nn");
  946.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  947.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_SUBJECT));
  948.     memset(temp, 0x00, 14);
  949.     AnsiiToUnicodeString((PS8) temp, (PS8) "n----n");
  950.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  951.     if (((MESSAGE_RETRIEVAL*) g_jmms_context->MsgHeader_type_p)->pSubject == NULL)
  952.     {
  953.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
  954.     }
  955.     else
  956.     {
  957.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) ((MESSAGE_RETRIEVAL*) g_jmms_context->MsgHeader_type_p)->pSubject);
  958.     }
  959.     /* /Date */
  960.     memset(temp, 0x00, 14);
  961.     AnsiiToUnicodeString((PS8) temp, (PS8) "nn");
  962.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  963.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_DATE));
  964.     memset(temp, 0x00, 14);
  965.     AnsiiToUnicodeString((PS8) temp, (PS8) "n----n");
  966.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  967.     mmi_dt_utc_sec_2_mytime((U32) ((MESSAGE_RETRIEVAL*) g_jmms_context->MsgHeader_type_p)->uiDate, &time1, MMI_TRUE);
  968.     mmi_dt_utc_to_rtc(timezone, time1, time);
  969.     /* PMT RAJ KUMAR GUPTA on Sep 05, 2006 */
  970.     /* Date */
  971.     memset(dttemp, 0x00, 40);
  972.     date_string(&time, (UI_string_type)dttemp, DT_IDLE_SCREEN);
  973.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) dttemp);
  974.     memset(temp, 0x00, 6);
  975.     AnsiiToUnicodeString((PS8) temp, (PS8) "n");
  976.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  977.     /* Time */
  978.     memset(dttemp, 0x00, 40);
  979.     time_string(&time, (UI_string_type)dttemp, DT_IDLE_SCREEN);
  980.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) dttemp);
  981.     /* END of Changes - RAJ KUMAR GUPTA*/
  982.     ShowCategory78Screen(
  983.         STR_MMS_MENUENTRY,
  984.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  985.         STR_ID_JMMS_PLAY,
  986.         IMG_GLOBAL_BACK,
  987.         STR_GLOBAL_BACK,
  988.         IMG_GLOBAL_BACK,
  989.         NULL,
  990.         (U8*) subMenuData,
  991.         pfnUnicodeStrlen((S8*) subMenuData),
  992.         gui_buffer);
  993.     SetRightSoftkeyFunction(mmi_jmms_back_msg_view_entry, KEY_EVENT_UP);
  994.     SetKeyHandler(mmi_jmms_back_msg_view_entry, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  995.     SetLeftSoftkeyFunction(mmi_jmms_play_mms, KEY_EVENT_UP);
  996.     SetKeyHandler(mmi_jmms_play_mms, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  997.     SetKeyHandler(mmi_jmms_play_mms, KEY_WAP, KEY_EVENT_DOWN);
  998. if (isInCall() == FALSE)
  999.     SetKeyHandler(mmi_jmms_end_mms_play, KEY_END, KEY_EVENT_DOWN);
  1000.     DeleteScreenIfPresent(SCR_ID_JMMS_READ_REPORT_QUERY);
  1001. }
  1002. /*****************************************************************************
  1003.  * FUNCTION
  1004.  *  mmi_jmms_end_mms_play
  1005.  * DESCRIPTION
  1006.  *  
  1007.  * PARAMETERS
  1008.  *  void
  1009.  * RETURNS
  1010.  *  void
  1011.  *****************************************************************************/
  1012. void mmi_jmms_end_mms_play(void)
  1013. {
  1014.     /*----------------------------------------------------------------*/
  1015.     /* Local Variables                                                */
  1016.     /*----------------------------------------------------------------*/
  1017.     /*----------------------------------------------------------------*/
  1018.     /* Code Body                                                      */
  1019.     /*----------------------------------------------------------------*/
  1020.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_end_mms_play"));
  1021.     mmi_jmms_deinit_mms_context(g_jmms_context);
  1022.     mmi_jmms_free_delivery_report_header();
  1023.     mmi_jmms_free_report_report_header();
  1024.     DisplayIdleScreen();
  1025. }
  1026. /*****************************************************************************
  1027.  * FUNCTION
  1028.  *  mmi_jmms_play_mms
  1029.  * DESCRIPTION
  1030.  *  
  1031.  * PARAMETERS
  1032.  *  void
  1033.  * RETURNS
  1034.  *  void
  1035.  *****************************************************************************/
  1036. void mmi_jmms_play_mms(void)
  1037. {
  1038.     /*----------------------------------------------------------------*/
  1039.     /* Local Variables                                                */
  1040.     /*----------------------------------------------------------------*/
  1041.     CONTENT_DATA Content = {0, };
  1042.     JC_RETCODE eRet = JC_OK;
  1043.     /*----------------------------------------------------------------*/
  1044.     /* Code Body                                                      */
  1045.     /*----------------------------------------------------------------*/
  1046.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_play_mms"));
  1047.     mmi_jmms_deinit_mms_context(g_jmms_context);
  1048.     Content.bIsStream = E_TRUE;
  1049.     eRet = mmi_jmms_get_message("Inbox", &Content, g_jmms_context->mms_index);
  1050.     if (eRet != JC_OK)
  1051.     {
  1052.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms fail to get the message from InBox.", eRet));
  1053.         mmi_jmms_error_handler(eRet);
  1054.         goto END;
  1055.     }
  1056. #ifdef __MMI_UNIFIED_MESSAGE__
  1057. mmi_jmms_deinit_view();
  1058. #endif 
  1059.     eRet = mmi_jmms_pre_entry_mms_view(&Content);
  1060.     if (g_jmms_context->last_scr_id != IDLE_SCREEN_ID && g_jmms_context->last_scr_id == SCR_ID_JMMS_INBOX_OPTIONS)
  1061.     {
  1062.         /* it means download from Inbox */
  1063.     #ifdef __MMI_UNIFIED_MESSAGE__
  1064.         HistoryReplace(SCR_ID_UM_INBOX, SCR_ID_UM_INBOX, mmi_um_jmms_pre_entry_inbox_including_highlighter);
  1065.     #else 
  1066.         HistoryReplace(SCR_ID_JMMS_INBOX, SCR_ID_JMMS_INBOX, mmi_jmms_entry_inbox);
  1067.     #endif 
  1068.     }
  1069.     DeleteScreenIfPresent(SCR_ID_JMMS_READ_REPORT_QUERY);
  1070.     DeleteScreenIfPresent(SCR_ID_JMMS_PROGRESS);
  1071.     DeleteScreenIfPresent(SCR_ID_JMMS_POP_SCREEN);
  1072.     DeleteScreenIfPresent(SCR_ID_JMMS_INBOX_OPTIONS);
  1073.     DeleteScreenIfPresent(SCR_ID_JMMS_NEW_MMS);
  1074.     DeleteScreenIfPresent(SCR_ID_JMMS_RETRIEVED_MMS_PROPERTIES);
  1075.     if (eRet == JC_ERR_MMS_PARSE_PENDING)
  1076.     {
  1077.         return;
  1078.     }
  1079.   END:
  1080.     if (eRet != JC_OK && g_jmms_context->msg_handle != NULL)
  1081.     {
  1082.         eRet = mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  1083.         g_jmms_context->msg_handle = NULL;
  1084.     }
  1085. }
  1086. /*****************************************************************************
  1087.  * FUNCTION
  1088.  *  mmi_jmms_back_msg_view_entry
  1089.  * DESCRIPTION
  1090.  *  
  1091.  * PARAMETERS
  1092.  *  void
  1093.  * RETURNS
  1094.  *  void
  1095.  *****************************************************************************/
  1096. void mmi_jmms_back_msg_view_entry(void)
  1097. {
  1098.     /*----------------------------------------------------------------*/
  1099.     /* Local Variables                                                */
  1100.     /*----------------------------------------------------------------*/
  1101.     /*----------------------------------------------------------------*/
  1102.     /* Code Body                                                      */
  1103.     /*----------------------------------------------------------------*/
  1104.     mmi_jmms_deinit_mms_context(g_jmms_context);
  1105.     mmi_jmms_free_delivery_report_header();
  1106.     mmi_jmms_free_report_report_header();
  1107.     if (g_jmms_context->last_scr_id == IDLE_SCREEN_ID)
  1108.     {
  1109.         DisplayIdleScreen();
  1110.     }
  1111.     else
  1112.     {
  1113.     #ifdef __MMI_UNIFIED_MESSAGE__
  1114.         HistoryReplace(SCR_ID_UM_INBOX, SCR_ID_UM_INBOX, mmi_um_jmms_pre_entry_inbox_including_highlighter);
  1115.         GoBackToHistory(SCR_ID_UM_INBOX);
  1116.     #else /* __MMI_UNIFIED_MESSAGE__ */ 
  1117. /* PMTSW00006306 Fix : Lines commented as it will clear old history and issue in highlight handler */
  1118.  //       HistoryReplace(SCR_ID_JMMS_INBOX, SCR_ID_JMMS_INBOX, mmi_jmms_entry_inbox_screen);
  1119.         GoBackToHistory(SCR_ID_JMMS_INBOX);
  1120.     #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1121.     }
  1122. }
  1123. /*****************************************************************************
  1124.  * FUNCTION
  1125.  *  mmi_jmms_need_mms_ind
  1126.  * DESCRIPTION
  1127.  *  
  1128.  * PARAMETERS
  1129.  *  void
  1130.  * RETURNS
  1131.  *  
  1132.  *****************************************************************************/
  1133. U8 mmi_jmms_need_mms_ind(void)
  1134. {
  1135.     /*----------------------------------------------------------------*/
  1136.     /* Local Variables                                                */
  1137.     /*----------------------------------------------------------------*/
  1138.     U8 need_ind = 0;
  1139.     /*----------------------------------------------------------------*/
  1140.     /* Code Body                                                      */
  1141.     /*----------------------------------------------------------------*/
  1142. #if !defined(__MMI_UNIFIED_MESSAGE__) && defined (__USB_IN_NORMAL_MODE__)
  1143.     if (mmi_usb_is_in_mass_storage_mode() == KAL_FALSE)
  1144. #endif 
  1145.     {
  1146.         if (g_jmms_context != NULL && g_jmms_context->pending_mms_info_list != NULL)
  1147.     #ifdef __MMI_UNIFIED_MESSAGE__
  1148.             if (g_jmms_context->pending_mms_info_list->type == E_MSG_TYPE_IDLE_SCREEN_POP_UP)
  1149.     #endif 
  1150.             {
  1151.                 need_ind = 1;
  1152.             }
  1153.     }
  1154.     return need_ind;
  1155. }
  1156. /*****************************************************************************
  1157.  * FUNCTION
  1158.  *  mmi_jmms_entry_new_mms_ind
  1159.  * DESCRIPTION
  1160.  *  
  1161.  * PARAMETERS
  1162.  *  void
  1163.  * RETURNS
  1164.  *  void
  1165.  *****************************************************************************/
  1166. void mmi_jmms_entry_new_mms_ind(void)
  1167. {
  1168.     /*----------------------------------------------------------------*/
  1169.     /* Local Variables                                                */
  1170.     /*----------------------------------------------------------------*/
  1171.     U16 strid = 0;
  1172.     /*----------------------------------------------------------------*/
  1173.     /* Code Body                                                      */
  1174.     /*----------------------------------------------------------------*/
  1175.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_entry_new_mms_ind"));
  1176.     if (g_jmms_context == NULL)
  1177.     {
  1178.         g_jmms_context = (jmms_context_struct*) jdd_MemAlloc(sizeof(jmms_context_struct), 1);
  1179.         if (g_jmms_context == NULL)
  1180.         {
  1181.             DisplayPopup((PU8) GetString(STR_ID_JMMS_OUT_OF_MEMORY), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
  1182.             return;
  1183.         }
  1184.     }
  1185.     if (g_jmms_context->pending_mms_info_list == NULL)
  1186.     {
  1187.         return;
  1188.     }
  1189.     EntryNewScreen(SCR_ID_JMMS_NEW_MMS_IND, NULL, NULL, NULL);
  1190. /* sandeep start in error situations like when fail to save mms notification ring tone should not play
  1191. // amit start
  1192. PlayMessageArrivalTone();
  1193. // amit end tone play on idle screen
  1194. */
  1195.     GetCurrEndKeyDownHandler();
  1196.     if (g_jmms_context->pending_mms_info_list->type == E_MSG_TYPE_DELIVERY_REPORT
  1197.         || g_jmms_context->pending_mms_info_list->type == E_MSG_TYPE_READ_REPORT_RESPONSE
  1198.         || g_jmms_context->pending_mms_info_list->type == E_MSG_TYPE_RECEIVE)
  1199.     {
  1200.         strid = STR_ID_JMMS_READ_NEW_MMS;
  1201.     }
  1202.     else if (g_jmms_context->pending_mms_info_list->type == E_MSG_TYPE_NOTIFICATION)
  1203.     {
  1204.         strid = STR_ID_JMMS_DOWNLOAD_NEW_MMS;
  1205.     }
  1206.     else if (g_jmms_context->pending_mms_info_list->type != E_MSG_TYPE_IDLE_SCREEN_POP_UP)
  1207.     {
  1208.         return;
  1209.     }
  1210. #ifdef __MMI_UNIFIED_MESSAGE__
  1211.     if (g_jmms_context->pending_mms_info_list->type != E_MSG_TYPE_IDLE_SCREEN_POP_UP)
  1212.     {
  1213.         mmi_um_jmms_new_mms_message_ind(g_jmms_context->pending_mms_info_list->Index);
  1214.     }
  1215.     else
  1216. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1217.     {   /* vikas added */
  1218.         if (g_keylock_context.gKeyPadLockFlag == 0)
  1219.         {
  1220.             if (g_jmms_context->pending_mms_info_list->type == E_MSG_TYPE_IDLE_SCREEN_POP_UP)
  1221.             {
  1222.                 ShowCategory2Screen(
  1223.                     STR_MMS_MENUENTRY,
  1224.                     GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  1225.                     0,
  1226.                     0,
  1227.                     STR_GLOBAL_BACK,
  1228.                     IMG_GLOBAL_BACK,
  1229.                     g_jmms_context->pending_mms_info_list->Index,
  1230.                     NULL);
  1231.                 SetRightSoftkeyFunction(mmi_jmms_delete_mms_pop_up_node, KEY_EVENT_UP);
  1232. if (isInCall() == FALSE)
  1233.                 SetKeyHandler(mmi_jmms_free_mms_pop_ups_list, KEY_END, KEY_EVENT_DOWN); /* /delete the link list */
  1234.             }
  1235.             else
  1236.             {
  1237.                 ShowCategory154Screen(
  1238.                     0,
  1239.                     0,
  1240.                     STR_GLOBAL_YES,
  1241.                     IMG_GLOBAL_YES,
  1242.                     STR_GLOBAL_NO,
  1243.                     IMG_GLOBAL_NO,
  1244.                     (PU8) GetString(strid),
  1245.                     NULL,
  1246.                     IMG_NEW_MESSAGE_NOTIFICATION_MSG,
  1247.                     NULL);
  1248.                 SetRightSoftkeyFunction(mmi_jmms_delete_mms_pop_up_node, KEY_EVENT_UP);
  1249.                 SetLeftSoftkeyFunction(mmi_jmms_handle_mms_pop_up, KEY_EVENT_UP);
  1250. if (isInCall() == FALSE)
  1251.                 {
  1252.                 SetKeyHandler(mmi_jmms_free_mms_pop_ups_list, KEY_END, KEY_EVENT_DOWN); /* /delete the link list */
  1253.                      //sandeep
  1254.                      //PlayMessageArrivalTone();
  1255.      //sandeep
  1256.                 }
  1257.             }
  1258.         }
  1259.         else    /* keypad is locked */
  1260.         {
  1261.         #if defined(__MMI_KEYPAD_LOCK_PATTERN_1__) || defined(__MMI_KEYPAD_LOCK_PATTERN_3__) || defined(__MMI_KEYPAD_LOCK_PATTERN_4__)    //KP Jerry add "__MMI_KEYPAD_LOCK_PATTERN_3__" on 2007-3-26
  1262.             if (g_jmms_context->pending_mms_info_list->type == E_MSG_TYPE_IDLE_SCREEN_POP_UP)
  1263.             {
  1264.                 ShowCategory2Screen(
  1265.                     STR_MMS_MENUENTRY,
  1266.                     GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  1267.                     0,
  1268.                     0,
  1269. #ifdef __MMI_TOUCH_SCREEN__
  1270. SCREEN_LOCKED_TEXT,
  1271. #else
  1272.                     KEYPAD_LOCKED_RSK_TEXT,
  1273. #endif
  1274.                     0,
  1275.                     g_jmms_context->pending_mms_info_list->Index,
  1276.                     NULL);
  1277.             }
  1278.             else
  1279.             {
  1280.                 ShowCategory154Screen(
  1281.                     0,
  1282.                     0,
  1283.                     0,
  1284.                     0,
  1285.                     #ifdef __MMI_TOUCH_SCREEN__
  1286. SCREEN_LOCKED_TEXT,
  1287. #else
  1288.                     KEYPAD_LOCKED_RSK_TEXT,
  1289. #endif
  1290.                     0,
  1291.                     (PU8) GetString(strid),
  1292.                     NULL,
  1293.                     IMG_NEW_MESSAGE_NOTIFICATION_MSG,
  1294.                     NULL);
  1295.                 if (isInCall() == FALSE)
  1296.                 {
  1297.                      //sandeep
  1298.                      //PlayMessageArrivalTone();
  1299.      //sandeep
  1300.                 }
  1301.             }
  1302.         #else /* __MMI_KEYPAD_LOCK_PATTERN_1__ || __MMI_KEYPAD_LOCK_PATTERN_3__ ||__MMI_KEYPAD_LOCK_PATTERN_4__ */      //KP Jerry add "__MMI_KEYPAD_LOCK_PATTERN_3__" on 2007-3-27
  1303.             if (g_jmms_context->pending_mms_info_list->type == E_MSG_TYPE_IDLE_SCREEN_POP_UP)
  1304.             {
  1305.                 ShowCategory2Screen(
  1306.                     STR_MMS_MENUENTRY,
  1307.                     GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  1308.                     #ifdef __MMI_TOUCH_SCREEN__
  1309. SCREEN_LOCKED_TEXT.
  1310. #else
  1311.                     KEYPAD_LOCKED_RSK_TEXT,
  1312. #endif
  1313. ,
  1314.                     0,
  1315.                     0,
  1316.                     0,
  1317.                     g_jmms_context->pending_mms_info_list->Index,
  1318.                     NULL);
  1319.             }
  1320.             else
  1321.             {
  1322.                 ShowCategory154Screen(
  1323.                     0,
  1324.                     0,
  1325.                     #ifdef __MMI_TOUCH_SCREEN__
  1326. SCREEN_LOCKED_TEXT,
  1327. #else
  1328.                     KEYPAD_LOCKED_RSK_TEXT,
  1329. #endif
  1330. ,
  1331.                     0,
  1332.                     0,
  1333.                     0,
  1334.                     (PU8) GetString(strid),
  1335.                     NULL,
  1336.                     IMG_NEW_MESSAGE_NOTIFICATION_MSG,
  1337.                     NULL);
  1338.                 if (isInCall() == FALSE)
  1339.                 {
  1340.                      //sandeep
  1341.      PlayMessageArrivalTone();
  1342.      //sandeep
  1343.                 }
  1344.             }
  1345.         #endif /* __MMI_KEYPAD_LOCK_PATTERN_1__ || __MMI_KEYPAD_LOCK_PATTERN_3__ || __MMI_KEYPAD_LOCK_PATTERN_4__ */      //KP Jerry add "__MMI_KEYPAD_LOCK_PATTERN_3__" on 2007-3-27
  1346.         #if defined(__MMI_KEYPAD_LOCK_PROMPT_TEXT__)
  1347.             SetGroupKeyHandler(
  1348.                 EntryScrKeyPadLockOnPessingAnyKey,
  1349.                 (PU16) PresentAllKeys,
  1350.                 (U8) TOTAL_KEYS,
  1351.                 (U16) KEY_EVENT_DOWN);
  1352.         #endif /* defined(__MMI_KEYPAD_LOCK_PROMPT_TEXT__) */ 
  1353.         #if defined(__MMI_TOUCH_SCREEN__) && (!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__) || defined(__MMI_SLIDE__)) //KP Jerry add "!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__)" on 2007-3-26
  1354. #ifdef __MMI_KEYPAD_LOCK_PROMPT_TEXT__
  1355. #if defined(__MMI_KEYPAD_LOCK_PATTERN_1__) || defined(__MMI_KEYPAD_LOCK_PATTERN_3__) || defined(__MMI_KEYPAD_LOCK_PATTERN_4__)     //KP Jerry add "__MMI_KEYPAD_LOCK_PATTERN_3__" on 2007-3-27
  1356. SetRightSoftkeyFunction(EntryScrKeyPadLockOnPessingAnyKey, KEY_EVENT_DOWN);
  1357. #endif 
  1358. #ifdef __MMI_KEYPAD_LOCK_PATTERN_2__
  1359. SetLeftSoftkeyFunction(EntryScrKeyPadLockOnPessingAnyKey, KEY_EVENT_DOWN);
  1360. #endif 
  1361. #else
  1362. ClearKeyHandler(KEY_LSK, KEY_EVENT_DOWN);
  1363. ClearKeyHandler(KEY_LSK, KEY_EVENT_UP);
  1364. ClearKeyHandler(KEY_RSK, KEY_EVENT_DOWN);
  1365. ClearKeyHandler(KEY_RSK, KEY_EVENT_UP);
  1366. #endif /* __MMI_KEYPAD_LOCK_PROMPT_TEXT__ */ 
  1367. SetKeyHandler(EntryScrAfterPessingRSK, KEY_SEND, KEY_EVENT_DOWN);
  1368.         #else/* __MMI_TOUCH_SCREEN__ && !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ */ //KP Jerry add "!__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__" on 2007-3-26 
  1369. #if defined(__MMI_KEYPAD_LOCK_PATTERN_1__) || defined(__MMI_KEYPAD_LOCK_PATTERN_3__) || defined(__MMI_KEYPAD_LOCK_PATTERN_4__)     //KP Jerry add "__MMI_KEYPAD_LOCK_PATTERN_3__" on 2007-3-27
  1370. SetRightSoftkeyFunction(EntryScrAfterPessingRSK, KEY_EVENT_DOWN);
  1371. #endif 
  1372. #ifdef __MMI_KEYPAD_LOCK_PATTERN_2__
  1373. SetLeftSoftkeyFunction(EntryScrAfterPessingRSK, KEY_EVENT_DOWN);
  1374. #endif 
  1375.         #endif /* __MMI_TOUCH_SCREEN__ && !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ */ //KP Jerry add "!__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__" on 2007-3-26 
  1376.         ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  1377.         #ifdef __MMI_TOUCH_SCREEN__
  1378.             mmi_idle_pen_block(); 
  1379.         #endif
  1380.         }
  1381.     }   /* vikas added */
  1382. }
  1383. /*****************************************************************************
  1384.  * FUNCTION
  1385.  *  mmi_jmms_delete_mms_pop_up_node
  1386.  * DESCRIPTION
  1387.  *  
  1388.  * PARAMETERS
  1389.  *  void
  1390.  * RETURNS
  1391.  *  void
  1392.  *****************************************************************************/
  1393. void mmi_jmms_delete_mms_pop_up_node(void)
  1394. {
  1395.     /*----------------------------------------------------------------*/
  1396.     /* Local Variables                                                */
  1397.     /*----------------------------------------------------------------*/
  1398.     jmms_pending_mms_info_struct *node = NULL;
  1399.     /*----------------------------------------------------------------*/
  1400.     /* Code Body                                                      */
  1401.     /*----------------------------------------------------------------*/
  1402.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_delete_mms_pop_up_node"));
  1403.     node = g_jmms_context->pending_mms_info_list;
  1404.     if (node == NULL)
  1405.     {
  1406.         GoBackToHistory(IDLE_SCREEN_ID);
  1407.         return;
  1408.     }
  1409.     if (node->type == E_MSG_TYPE_DELIVERY_REPORT)
  1410.     {
  1411.         jmms_pending_mms_delivery_reports_struct *node1 = NULL;
  1412.         if (g_jmms_context->pending_delivery_reports != NULL)
  1413.         {
  1414.             node1 = g_jmms_context->pending_delivery_reports->next;
  1415.             if (g_jmms_context->pending_delivery_reports->to_p != NULL)
  1416.             {
  1417.                 jdd_MemFree(g_jmms_context->pending_delivery_reports->to_p);
  1418.             }
  1419.             jdd_MemFree(g_jmms_context->pending_delivery_reports);
  1420.             g_jmms_context->pending_delivery_reports = node1;
  1421.         }
  1422.     }
  1423.     else if (node->type == E_MSG_TYPE_READ_REPORT_RESPONSE)
  1424.     {
  1425.         jmms_pending_mms_read_reports_struct *node1 = NULL;
  1426.         if (g_jmms_context->pending_read_reports != NULL)
  1427.         {
  1428.             node1 = g_jmms_context->pending_read_reports->next;
  1429.             if (g_jmms_context->pending_read_reports->from_p != NULL)
  1430.             {
  1431.                 jdd_MemFree(g_jmms_context->pending_read_reports->from_p);
  1432.             }
  1433.             jdd_MemFree(g_jmms_context->pending_read_reports);
  1434.             g_jmms_context->pending_read_reports = node1;
  1435.         }
  1436.     }
  1437.     g_jmms_context->pending_mms_info_list = node->next;
  1438.     if (node->mms_url != NULL)
  1439.     {
  1440.         jdd_MemFree(node->mms_url);
  1441.     }
  1442.     jdd_MemFree(node);
  1443.     node = NULL;
  1444.     GoBackToHistory(IDLE_SCREEN_ID);
  1445.     return;
  1446. }
  1447. /*****************************************************************************
  1448.  * FUNCTION
  1449.  *  mmi_jmms_handle_mms_pop_up
  1450.  * DESCRIPTION
  1451.  *  
  1452.  * PARAMETERS
  1453.  *  void
  1454.  * RETURNS
  1455.  *  void
  1456.  *****************************************************************************/
  1457. void mmi_jmms_handle_mms_pop_up(void)
  1458. {
  1459.     /*----------------------------------------------------------------*/
  1460.     /* Local Variables                                                */
  1461.     /*----------------------------------------------------------------*/
  1462.     jmms_pending_mms_info_struct *node = NULL;
  1463.     JC_RETCODE eRet = JC_OK;
  1464.     JC_INT32 index = 0;
  1465.     CONTENT_DATA Content = {0, };
  1466.     U8 type;
  1467.     /*----------------------------------------------------------------*/
  1468.     /* Code Body                                                      */
  1469.     /*----------------------------------------------------------------*/
  1470.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_handle_mms_pop_up"));
  1471.     node = g_jmms_context->pending_mms_info_list->next;
  1472.     index = (JC_INT32) g_jmms_context->pending_mms_info_list->Index;
  1473.     type = g_jmms_context->pending_mms_info_list->type;
  1474.     ///set the msg status as open for At Delete
  1475.     ///It will reset on going to idle screen
  1476.     g_jmms_context->msg_open_status[0] = E_JMMS_INBOX;
  1477.     /* PMT HIMANSHU START 20060425 */
  1478.     g_jmms_context->msg_open_status[1] = (U32) mmi_jmms_get_message_id(MMI_JMMS_INBOX, index);
  1479.     /* PMT HIMANSHU END 20060425 */
  1480.     switch (type)
  1481.     {
  1482.         case E_MSG_TYPE_NOTIFICATION:
  1483.         {
  1484.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "jmms msg type: %s", "E_MSG_TYPE_NOTIFICATION"));
  1485.             if (g_jmms_context->pending_mms_info_list->mms_url == NULL)
  1486.             {
  1487.                 jdd_MemFree(g_jmms_context->pending_mms_info_list);
  1488.                 g_jmms_context->pending_mms_info_list = NULL;
  1489.                 g_jmms_context->pending_mms_info_list = node;
  1490.                 return;
  1491.             }
  1492.             eRet = mmi_jmms_download_mms(
  1493.                     (JC_INT8*) g_jmms_context->pending_mms_info_list->mms_url,
  1494.                     E_TYPE_DEFFERED_RETRIEVAL_FETCH,
  1495.                     index,
  1496.                     1);
  1497.             if (eRet == JC_OK)
  1498.             {
  1499.                 g_jmms_context->last_scr_id = IDLE_SCREEN_ID;
  1500.                 g_jmms_context->progress_screen_title = STR_ID_JMMS_MMS_DOWNLOADING;
  1501.                 memset(g_jmms_context->g_jmms_progress_str, 0x00, MAX_PROGRESS_SCREEN_HINT_LEN * ENCODING_LENGTH);
  1502.                 mmi_jmms_entry_communication_progress_screen();
  1503.             }
  1504.             else
  1505.             {
  1506.                 PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms fail to download the message", eRet));
  1507.             }
  1508.             mmi_jmms_free_pending_mms_info_node();
  1509.             g_jmms_context->pending_mms_info_list = node;
  1510.             return;
  1511.         }
  1512.         case E_MSG_TYPE_DELIVERY_REPORT:
  1513.         {
  1514.             jmms_pending_mms_delivery_reports_struct *node1 = NULL;
  1515.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "jmms msg type: %s", "E_MSG_TYPE_DELIVERY_REPORT"));
  1516.             if (g_jmms_context->pending_delivery_reports == NULL)
  1517.             {
  1518.                 /* no delivery report node present */
  1519.                 mmi_jmms_free_pending_mms_info_node();
  1520.                 g_jmms_context->pending_mms_info_list = node;
  1521.                 return;
  1522.             }
  1523.             g_jmms_context->last_scr_id = IDLE_SCREEN_ID;
  1524.             eRet = mmi_jmms_create_delivery_report_header_for_idle_screen(g_jmms_context->pending_delivery_reports);
  1525.             if (eRet != JC_OK)
  1526.             {
  1527.                 mmi_jmms_error_handler(eRet);
  1528.             }
  1529.             else
  1530.             {
  1531.                 /* /for setting read status */
  1532.                 mmi_jmms_set_msg_as_read((U8) (index - 1));
  1533.                 mmi_jmms_entry_show_delivery_report_screen();
  1534.             }
  1535.             /* /free the delivery report node */
  1536.             node1 = g_jmms_context->pending_delivery_reports->next;
  1537.             if (g_jmms_context->pending_delivery_reports->to_p != NULL)
  1538.             {
  1539.                 jdd_MemFree(g_jmms_context->pending_delivery_reports->to_p);
  1540.             }
  1541.             jdd_MemFree(g_jmms_context->pending_delivery_reports);
  1542.             g_jmms_context->pending_delivery_reports = node1;
  1543.             /* free the node for general message */
  1544.             mmi_jmms_free_pending_mms_info_node();
  1545.             g_jmms_context->pending_mms_info_list = node;
  1546.             return;
  1547.         }
  1548.         case E_MSG_TYPE_READ_REPORT_RESPONSE:
  1549.         {
  1550.             jmms_pending_mms_read_reports_struct *node1 = NULL;
  1551.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "jmms msg type: %s", "E_MSG_TYPE_READ_REPORT_RESPONSE"));
  1552.             if (g_jmms_context->pending_read_reports == NULL)
  1553.             {
  1554.                 //no report report node present
  1555.                 //free the node for general message
  1556.                 mmi_jmms_free_pending_mms_info_node();
  1557.                 g_jmms_context->pending_mms_info_list = node;
  1558.                 return;
  1559.             }
  1560.             g_jmms_context->last_scr_id = IDLE_SCREEN_ID;
  1561.             eRet = mmi_jmms_create_read_report_header_for_idle_screen(g_jmms_context->pending_read_reports);
  1562.             if (eRet != JC_OK)
  1563.             {
  1564.                 mmi_jmms_error_handler(eRet);
  1565.             }
  1566.             else
  1567.             {
  1568.                 /* /for setting read status */
  1569.                 mmi_jmms_set_msg_as_read((U8) (index - 1));
  1570.                 mmi_jmms_entry_show_read_report_screen();
  1571.             }
  1572.             /* /free the read report node */
  1573.             node1 = g_jmms_context->pending_read_reports->next;
  1574.             if (g_jmms_context->pending_read_reports->from_p != NULL)
  1575.             {
  1576.                 jdd_MemFree(g_jmms_context->pending_read_reports->from_p);
  1577.             }
  1578.             jdd_MemFree(g_jmms_context->pending_read_reports);
  1579.             g_jmms_context->pending_read_reports = node1;
  1580.             /* free the node for general message */
  1581.             mmi_jmms_free_pending_mms_info_node();
  1582.             g_jmms_context->pending_mms_info_list = node;
  1583.             return;
  1584.         }
  1585.     }   /* /switch(type) */
  1586.     mmi_jmms_free_pending_mms_info_node();
  1587.     g_jmms_context->pending_mms_info_list = node;
  1588.     Content.bIsStream = E_TRUE;
  1589.     eRet = mmi_jmms_get_message("Inbox", &Content, index);
  1590.     if (eRet != JC_OK)
  1591.     {
  1592.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms fail to get messages from InBox.", eRet));
  1593.         DisplayPopup((PU8) GetString(STR_ID_JMMS_ERROR_GET_MSG_LIST), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
  1594.         goto END;
  1595.     }
  1596.     mmi_jmms_deinit_mms_context(g_jmms_context);
  1597.     eRet = mmi_jmms_jdi_parse_msg_buffer(&g_jmms_context->msg_handle, &Content, E_TYPE_MMS, E_FALSE);
  1598.     /* Async changes begin */
  1599.     while (eRet == JC_ERR_MMS_PARSE_PENDING)
  1600.     {
  1601.         eRet = mmi_jmms_jdi_msg_parse_continue(g_jmms_context->msg_handle);
  1602.     }
  1603.     /* Async changes end */
  1604.     if (JC_OK != eRet)
  1605.     {
  1606.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms parsing failed!", eRet));
  1607.         if (g_jmms_context->msg_handle != NULL)
  1608.         {
  1609.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Deinitializing the msg header."));
  1610.             mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  1611.             g_jmms_context->msg_handle = NULL;
  1612.         }
  1613.         goto END;
  1614.     }
  1615.     eRet = mmi_jmms_jdi_get_msg_headers(g_jmms_context->msg_handle, (MESSAGE_HEADERS **) (&g_jmms_context->MsgHeaders_p));
  1616.     if (JC_OK != eRet)
  1617.     {
  1618.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms fail to get the msg header", eRet));
  1619.         mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  1620.         g_jmms_context->msg_handle = NULL;
  1621.         goto END;
  1622.     }
  1623.     switch (((MESSAGE_HEADERS*) g_jmms_context->MsgHeaders_p)->eMsgType)
  1624.     {
  1625.         case E_MSG_TYPE_RECEIVE:
  1626.         {
  1627.             g_jmms_context->MsgHeader_type_p =
  1628.                 (MESSAGE_RETRIEVAL*) ((MESSAGE_HEADERS*) g_jmms_context->MsgHeaders_p)->pHeaders;
  1629.             /* /for setting read status */
  1630.             mmi_jmms_set_msg_as_read((U8) (index - 1));
  1631.             g_jmms_context->mms_index = index;
  1632.             g_jmms_context->last_scr_id = IDLE_SCREEN_ID;
  1633.             g_jmms_context->is_unread_msg_deleted = 0;
  1634.         #ifdef __MMI_UNIFIED_MESSAGE__
  1635.             g_jmms_context->show_property_screen = MMI_FALSE;
  1636.         #endif 
  1637.             mmi_jmms_handle_read_report(g_jmms_context->MsgHeader_type_p);
  1638.             break;
  1639.         }
  1640.         default:
  1641.             break;
  1642.     }
  1643.     if (Content.pFileName != NULL)
  1644.     {
  1645.         jdd_MemFree(Content.pFileName);
  1646.         Content.pFileName = NULL;
  1647.     }
  1648.     return;
  1649.   END:
  1650.     if (Content.pFileName != NULL)
  1651.     {
  1652.         jdd_MemFree(Content.pFileName);
  1653.         Content.pFileName = NULL;
  1654.     }
  1655.     //GoBackToHistory(IDLE_SCREEN_ID);
  1656.     return;
  1657. }
  1658. /*****************************************************************************
  1659.  * FUNCTION
  1660.  *  mmi_jmms_create_read_report_header_for_idle_screen
  1661.  * DESCRIPTION
  1662.  *  
  1663.  * PARAMETERS
  1664.  *  read_report_header      [?]     [?]     [?]
  1665.  * RETURNS
  1666.  *  
  1667.  *****************************************************************************/
  1668. JC_RETCODE mmi_jmms_create_read_report_header_for_idle_screen(jmms_pending_mms_read_reports_struct *read_report_header)
  1669. {
  1670.     /*----------------------------------------------------------------*/
  1671.     /* Local Variables                                                */
  1672.     /*----------------------------------------------------------------*/
  1673.     READ_REPORT_RESPONSE *read_report_p = NULL;
  1674.     JC_RETCODE eRet = JC_OK;
  1675.     /*----------------------------------------------------------------*/
  1676.     /* Code Body                                                      */
  1677.     /*----------------------------------------------------------------*/
  1678.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_create_read_report_header_for_idle_screen"));
  1679.     read_report_p = (READ_REPORT_RESPONSE*) jdd_MemAlloc(sizeof(READ_REPORT_RESPONSE), 1);
  1680.     if (read_report_p == NULL)
  1681.     {
  1682.         eRet = JC_ERR_MEMORY_ALLOCATION;
  1683.         goto ERROR_HANDLE;
  1684.     }
  1685.     read_report_p->eReadStatus = read_report_header->status;
  1686.     if (read_report_header->from_p != NULL)
  1687.     {
  1688.         read_report_p->pFrom =
  1689.             (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), jc_tcslen((JC_CHAR*) (read_report_header->from_p)) + 1);
  1690.         if (read_report_p->pFrom == NULL)
  1691.         {
  1692.             eRet = JC_ERR_MEMORY_ALLOCATION;
  1693.             goto ERROR_HANDLE;
  1694.         }
  1695.         jc_tcscpy(read_report_p->pFrom, (JC_CHAR*) (read_report_header->from_p));
  1696.     }
  1697.     read_report_p->uiReceivedTime = read_report_header->date;
  1698.     g_jmms_context->read_report_p = (READ_REPORT_RESPONSE*) (read_report_p);
  1699.   ERROR_HANDLE:
  1700.     if (eRet != JC_OK && read_report_p != NULL)
  1701.     {
  1702.         mmi_jmms_free_report_report_header();
  1703.     }
  1704.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "mmi_jmms_create_read_report_header_for_idle_screen Return value",
  1705.                          eRet));
  1706.     return eRet;
  1707. }
  1708. /*****************************************************************************
  1709.  * FUNCTION
  1710.  *  mmi_jmms_create_delivery_report_header_for_idle_screen
  1711.  * DESCRIPTION
  1712.  *  
  1713.  * PARAMETERS
  1714.  *  delivery_header     [?]     [?]     [?]
  1715.  * RETURNS
  1716.  *  
  1717.  *****************************************************************************/
  1718. JC_RETCODE mmi_jmms_create_delivery_report_header_for_idle_screen(
  1719.             jmms_pending_mms_delivery_reports_struct *delivery_header)
  1720. {
  1721.     /*----------------------------------------------------------------*/
  1722.     /* Local Variables                                                */
  1723.     /*----------------------------------------------------------------*/
  1724.     DELIVERY_REPORT *delivery_p = NULL;
  1725.     JC_RETCODE eRet = JC_OK;
  1726.     /*----------------------------------------------------------------*/
  1727.     /* Code Body                                                      */
  1728.     /*----------------------------------------------------------------*/
  1729.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_create_delivery_report_header_for_idle_screen"));
  1730.     mmi_jmms_free_delivery_report_header();
  1731.     delivery_p = (DELIVERY_REPORT*) jdd_MemAlloc(sizeof(DELIVERY_REPORT), 1);
  1732.     if (delivery_p == NULL)
  1733.     {
  1734.         eRet = JC_ERR_MEMORY_ALLOCATION;
  1735.         goto ERROR_HANDLE;
  1736.     }
  1737.     if (delivery_header->to_p != NULL)
  1738.     {
  1739.         delivery_p->pTo = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), jc_tcslen((JC_CHAR*) (delivery_header->to_p)) + 1);
  1740.         if (delivery_p->pTo == NULL)
  1741.         {
  1742.             eRet = JC_ERR_MEMORY_ALLOCATION;
  1743.             goto ERROR_HANDLE;
  1744.         }
  1745.         jc_tcscpy(delivery_p->pTo, (JC_CHAR*) (delivery_header->to_p));
  1746.     }
  1747.     delivery_p->eDeliveryStatus = delivery_header->status;
  1748.     delivery_p->uiDate = delivery_header->date;
  1749.     g_jmms_context->delivery_p = (DELIVERY_REPORT*) (delivery_p);
  1750.   ERROR_HANDLE:
  1751.     if (eRet != JC_OK && delivery_p != NULL)
  1752.     {
  1753.         mmi_jmms_free_delivery_report_header();
  1754.     }
  1755.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)",
  1756.                          "mmi_jmms_create_delivery_report_header_for_idle_screen Return value", eRet));
  1757.     return eRet;
  1758. }
  1759. /*****************************************************************************
  1760.  * FUNCTION
  1761.  *  mmi_jmms_handle_read_report
  1762.  * DESCRIPTION
  1763.  *  
  1764.  * PARAMETERS
  1765.  *  pMsgRetrieval       [?]     [?]     [?]
  1766.  * RETURNS
  1767.  *  void
  1768.  *****************************************************************************/
  1769. void mmi_jmms_handle_read_report(MESSAGE_RETRIEVAL *pMsgRetrieval)
  1770. {
  1771.     /*----------------------------------------------------------------*/
  1772.     /* Local Variables                                                */
  1773.     /*----------------------------------------------------------------*/
  1774.     U8 read_report_status;
  1775.     /*----------------------------------------------------------------*/
  1776.     /* Code Body                                                      */
  1777.     /*----------------------------------------------------------------*/
  1778.     /* PMT VIKAS START 20060401 */
  1779.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_handle_read_report"));
  1780.     mmi_jmms_update_status_icon_indicator();
  1781.     /* PMT VIKAS END 20060401 */
  1782.     if (pMsgRetrieval->bReadReport == MMI_TRUE)
  1783.     {
  1784.         read_report_status = mmi_jmms_retrieval_settings_read_report();
  1785.         switch (read_report_status)
  1786.         {
  1787.             case E_READ_REPORT_SEND_ON_REQUEST:
  1788.                 mmi_jmms_show_read_report_query_screen();
  1789.                 break;
  1790.             case E_READ_REPORT_SEND_ALWAYS:
  1791.         #ifdef __MMI_UNIFIED_MESSAGE__
  1792.                 if (g_jmms_context->show_property_screen == MMI_FALSE)
  1793.                 {
  1794.                     mmi_jmms_create_and_send_read_report();
  1795.                     if (g_jmms_context->is_unread_msg_deleted == 0)
  1796.                     {
  1797.                         mmi_jmms_play_mms();
  1798.                     }
  1799.                 }
  1800.                 else
  1801.                 {
  1802.                     if (g_jmms_context->is_unread_msg_deleted == 0)
  1803.                     {
  1804.                         mmi_jmms_entry_show_mms_screen();
  1805.                     }
  1806.                     mmi_jmms_create_and_send_read_report();
  1807.                 }
  1808.         #else /* __MMI_UNIFIED_MESSAGE__ */ 
  1809.                 if (g_jmms_context->is_unread_msg_deleted == 0)
  1810.                 {
  1811.                     mmi_jmms_entry_show_mms_screen();
  1812.                 }
  1813.                 mmi_jmms_create_and_send_read_report();
  1814.         #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1815.                 break;
  1816.             case E_READ_REPORT_SEND_NEVER:
  1817.             #ifdef __MMI_UNIFIED_MESSAGE__
  1818.                 if (g_jmms_context->show_property_screen == MMI_FALSE)
  1819.                 {
  1820.                     mmi_jmms_play_mms();
  1821.                 }
  1822.                 else
  1823.             #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1824.                 if (g_jmms_context->is_unread_msg_deleted == 0)
  1825.                 {
  1826.                     mmi_jmms_entry_show_mms_screen();
  1827.                 }
  1828.                 break;
  1829.         }
  1830.     }
  1831.     else
  1832.     {
  1833.     #ifdef __MMI_UNIFIED_MESSAGE__
  1834.         if (g_jmms_context->show_property_screen == MMI_FALSE && g_jmms_context->is_unread_msg_deleted == 0)
  1835.         {
  1836.             mmi_jmms_play_mms();
  1837.         }
  1838.         else
  1839.     #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1840.         if (g_jmms_context->is_unread_msg_deleted == 0)
  1841.         {
  1842.             mmi_jmms_entry_show_mms_screen();
  1843.         }
  1844.     }
  1845.     DeleteScreenIfPresent(SCR_ID_JMMS_POP_SCREEN);
  1846. }
  1847. /*****************************************************************************
  1848.  * FUNCTION
  1849.  *  mmi_jmms_show_read_report_query_screen
  1850.  * DESCRIPTION
  1851.  *  
  1852.  * PARAMETERS
  1853.  *  void
  1854.  * RETURNS
  1855.  *  void
  1856.  *****************************************************************************/
  1857. void mmi_jmms_show_read_report_query_screen(void)
  1858. {
  1859.     /*----------------------------------------------------------------*/
  1860.     /* Local Variables                                                */
  1861.     /*----------------------------------------------------------------*/
  1862.     PU8 guiBuffer; /* Buffer holding history data */
  1863.     /*----------------------------------------------------------------*/
  1864.     /* Code Body                                                      */
  1865.     /*----------------------------------------------------------------*/
  1866.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_show_read_report_query_screen"));
  1867.     guiBuffer = GetCurrGuiBuffer(SCR_ID_JMMS_READ_REPORT_QUERY);
  1868.     EntryNewScreen(SCR_ID_JMMS_READ_REPORT_QUERY, mmi_jmms_exit_read_report_query_screen, mmi_jmms_show_read_report_query_screen, NULL);
  1869.     ShowCategory165Screen(
  1870.         STR_GLOBAL_YES,
  1871.         IMG_GLOBAL_YES,
  1872.         STR_GLOBAL_NO,
  1873.         IMG_GLOBAL_NO,
  1874.         get_string(STR_ID_JMMS_READ_REPORT_REQUEST),
  1875.         IMG_GLOBAL_QUESTION,
  1876.         guiBuffer);
  1877.     playRequestedTone(WARNING_TONE);
  1878.     SetLeftSoftkeyFunction(mmi_jmms_handle_read_report_confirm, KEY_EVENT_UP);
  1879.     if (g_jmms_context->is_unread_msg_deleted == 0)
  1880.     {
  1881.         SetRightSoftkeyFunction(mmi_jmms_entry_show_mms_screen, KEY_EVENT_UP);
  1882.     }
  1883.     else
  1884.     {
  1885.         SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1886.     }
  1887. if (isInCall() == FALSE)
  1888.     SetKeyHandler(mmi_jmms_end_mms_play, KEY_END, KEY_EVENT_DOWN);
  1889. }
  1890. /*****************************************************************************
  1891.  * FUNCTION
  1892.  *  mmi_jmms_exit_read_report_query_screen
  1893.  * DESCRIPTION
  1894.  *  Exit fn for read report query confirmation screen
  1895.  * PARAMETERS
  1896.  *  void
  1897.  * RETURNS
  1898.  *  void
  1899.  *****************************************************************************/
  1900. void mmi_jmms_exit_read_report_query_screen(void)
  1901. {
  1902.     /*----------------------------------------------------------------*/
  1903.     /* Local Variables                                                */
  1904.     /*----------------------------------------------------------------*/
  1905.     /*----------------------------------------------------------------*/
  1906.     /* Code Body                                                      */
  1907.     /*----------------------------------------------------------------*/
  1908.     stopRequestedTone(WARNING_TONE);
  1909. }
  1910. /*****************************************************************************
  1911.  * FUNCTION
  1912.  *  mmi_jmms_handle_read_report_confirm
  1913.  * DESCRIPTION
  1914.  *  
  1915.  * PARAMETERS
  1916.  *  void
  1917.  * RETURNS
  1918.  *  void
  1919.  *****************************************************************************/
  1920. void mmi_jmms_handle_read_report_confirm(void)
  1921. {
  1922.     /*----------------------------------------------------------------*/
  1923.     /* Local Variables                                                */
  1924.     /*----------------------------------------------------------------*/
  1925.     /*----------------------------------------------------------------*/
  1926.     /* Code Body                                                      */
  1927.     /*----------------------------------------------------------------*/
  1928. #ifdef __MMI_UNIFIED_MESSAGE__
  1929.     if (g_jmms_context->show_property_screen == MMI_FALSE)
  1930.     {
  1931.         mmi_jmms_create_and_send_read_report();
  1932.         if (g_jmms_context->is_unread_msg_deleted == 0)
  1933.         {
  1934.             mmi_jmms_play_mms();
  1935.         }
  1936.     }
  1937.     else
  1938.     {
  1939.         if (g_jmms_context->is_unread_msg_deleted == 0)
  1940.         {
  1941.             mmi_jmms_entry_show_mms_screen();
  1942.         }
  1943.         else
  1944.         {
  1945.             GoBackHistory();
  1946.         }
  1947.         mmi_jmms_create_and_send_read_report();
  1948.     }
  1949. #else /* __MMI_UNIFIED_MESSAGE__ */ 
  1950.     if (g_jmms_context->is_unread_msg_deleted == 0)
  1951.     {
  1952.         mmi_jmms_entry_show_mms_screen();
  1953.     }
  1954.     else
  1955.     {
  1956.         GoBackHistory();
  1957.     }
  1958.     mmi_jmms_create_and_send_read_report();
  1959. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1960. }
  1961. /*****************************************************************************
  1962.  * FUNCTION
  1963.  *  mmi_jmms_free_pending_mms_info_node
  1964.  * DESCRIPTION
  1965.  *  
  1966.  * PARAMETERS
  1967.  *  void
  1968.  * RETURNS
  1969.  *  void
  1970.  *****************************************************************************/
  1971. void mmi_jmms_free_pending_mms_info_node(void)
  1972. {
  1973.     /*----------------------------------------------------------------*/
  1974.     /* Local Variables                                                */
  1975.     /*----------------------------------------------------------------*/
  1976.     /*----------------------------------------------------------------*/
  1977.     /* Code Body                                                      */
  1978.     /*----------------------------------------------------------------*/
  1979.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_free_pending_mms_info_node"));
  1980.     if (g_jmms_context->pending_mms_info_list->mms_url != NULL)
  1981.     {
  1982.         jdd_MemFree(g_jmms_context->pending_mms_info_list->mms_url);
  1983.     }
  1984.     jdd_MemFree(g_jmms_context->pending_mms_info_list);
  1985.     g_jmms_context->pending_mms_info_list = NULL;
  1986. }
  1987. /*****************************************************************************
  1988.  * FUNCTION
  1989.  *  mmi_jmms_free_mms_pop_ups_list
  1990.  * DESCRIPTION
  1991.  *  
  1992.  * PARAMETERS
  1993.  *  void
  1994.  * RETURNS
  1995.  *  void
  1996.  *****************************************************************************/
  1997. void mmi_jmms_free_mms_pop_ups_list(void)
  1998. {
  1999.     /*----------------------------------------------------------------*/
  2000.     /* Local Variables                                                */
  2001.     /*----------------------------------------------------------------*/
  2002.     /*----------------------------------------------------------------*/
  2003.     /* Code Body                                                      */
  2004.     /*----------------------------------------------------------------*/
  2005.     mmi_jmms_delete_mms_pop_ups_list();
  2006.     GoBackToHistory(IDLE_SCREEN_ID);
  2007. }
  2008. /*****************************************************************************
  2009.  * FUNCTION
  2010.  *  mmi_jmms_delete_mms_pop_ups_list
  2011.  * DESCRIPTION
  2012.  *  
  2013.  * PARAMETERS
  2014.  *  void
  2015.  * RETURNS
  2016.  *  void
  2017.  *****************************************************************************/
  2018. void mmi_jmms_delete_mms_pop_ups_list(void)
  2019. {
  2020.     /*----------------------------------------------------------------*/
  2021.     /* Local Variables                                                */
  2022.     /*----------------------------------------------------------------*/
  2023.     /*----------------------------------------------------------------*/
  2024.     /* Code Body                                                      */
  2025.     /*----------------------------------------------------------------*/
  2026.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_delete_mms_pop_ups_list"));
  2027.     if (g_jmms_context->pending_delivery_reports != NULL)
  2028.     {
  2029.         jmms_pending_mms_delivery_reports_struct *node1 = NULL;
  2030.         do
  2031.         {
  2032.             node1 = g_jmms_context->pending_delivery_reports->next;
  2033.             if (g_jmms_context->pending_delivery_reports->to_p != NULL)
  2034.             {
  2035.                 jdd_MemFree(g_jmms_context->pending_delivery_reports->to_p);
  2036.             }
  2037.             jdd_MemFree(g_jmms_context->pending_delivery_reports);
  2038.             g_jmms_context->pending_delivery_reports = node1;
  2039.         } while (node1 != NULL);
  2040.     }
  2041.     /* free all read reports nodes */
  2042.     if (g_jmms_context->pending_read_reports != NULL)
  2043.     {
  2044.         jmms_pending_mms_read_reports_struct *node1 = NULL;
  2045.         do
  2046.         {
  2047.             node1 = g_jmms_context->pending_read_reports->next;
  2048.             if (g_jmms_context->pending_read_reports->from_p != NULL)
  2049.             {
  2050.                 jdd_MemFree(g_jmms_context->pending_read_reports->from_p);
  2051.             }
  2052.             jdd_MemFree(g_jmms_context->pending_read_reports);
  2053.             g_jmms_context->pending_read_reports = node1;
  2054.         } while (node1 != NULL);
  2055.     }
  2056.     /* free all general mesage nodes */
  2057.     if (g_jmms_context->pending_mms_info_list != NULL)
  2058.     {
  2059.         jmms_pending_mms_info_struct *node1 = NULL;
  2060.         do
  2061.         {
  2062.             node1 = g_jmms_context->pending_mms_info_list->next;
  2063.             if (g_jmms_context->pending_mms_info_list->mms_url != NULL)
  2064.             {
  2065.                 jdd_MemFree(g_jmms_context->pending_mms_info_list->mms_url);
  2066.             }
  2067.             jdd_MemFree(g_jmms_context->pending_mms_info_list);
  2068.             g_jmms_context->pending_mms_info_list = node1;
  2069.         } while (node1 != NULL);
  2070.     }
  2071. }
  2072. /*****************************************************************************
  2073.  * FUNCTION
  2074.  *  mmi_jmms_delete_mms_pop_ups_list_on_inbox_entry
  2075.  * DESCRIPTION
  2076.  *  
  2077.  * PARAMETERS
  2078.  *  void
  2079.  * RETURNS
  2080.  *  void
  2081.  *****************************************************************************/
  2082. void mmi_jmms_delete_mms_pop_ups_list_on_inbox_entry(void)
  2083. {
  2084.     /*----------------------------------------------------------------*/
  2085.     /* Local Variables                                                */
  2086.     /*----------------------------------------------------------------*/
  2087.     /*----------------------------------------------------------------*/
  2088.     /* Code Body                                                      */
  2089.     /*----------------------------------------------------------------*/
  2090.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_delete_mms_pop_ups_list_on_inbox_entry"));
  2091.     if (g_jmms_context->pending_delivery_reports != NULL)
  2092.     {
  2093.         jmms_pending_mms_delivery_reports_struct *node1 = NULL;
  2094.         do
  2095.         {
  2096.             node1 = g_jmms_context->pending_delivery_reports->next;
  2097.             if (g_jmms_context->pending_delivery_reports->to_p != NULL)
  2098.             {
  2099.                 jdd_MemFree(g_jmms_context->pending_delivery_reports->to_p);
  2100.             }
  2101.             jdd_MemFree(g_jmms_context->pending_delivery_reports);
  2102.             g_jmms_context->pending_delivery_reports = node1;
  2103.         } while (node1 != NULL);
  2104.     }
  2105.     /* free all read reports nodes */
  2106.     if (g_jmms_context->pending_read_reports != NULL)
  2107.     {
  2108.         jmms_pending_mms_read_reports_struct *node1 = NULL;
  2109.         do
  2110.         {
  2111.             node1 = g_jmms_context->pending_read_reports->next;
  2112.             if (g_jmms_context->pending_read_reports->from_p != NULL)
  2113.             {
  2114.                 jdd_MemFree(g_jmms_context->pending_read_reports->from_p);
  2115.             }
  2116.             jdd_MemFree(g_jmms_context->pending_read_reports);
  2117.             g_jmms_context->pending_read_reports = node1;
  2118.         } while (node1 != NULL);
  2119.     }
  2120.     /* free all general mesage nodes except E_MSG_TYPE_IDLE_SCREEN_POP_UP */
  2121.     if (g_jmms_context->pending_mms_info_list != NULL)
  2122.     {
  2123.         jmms_pending_mms_info_struct *node = NULL;
  2124.         jmms_pending_mms_info_struct *pre_node = NULL;
  2125.         node = g_jmms_context->pending_mms_info_list;
  2126.         pre_node = node;
  2127.         while (node != NULL)
  2128.         {
  2129.             if (node->type != E_MSG_TYPE_IDLE_SCREEN_POP_UP)
  2130.             {
  2131.                 jmms_pending_mms_info_struct *next_node = NULL;
  2132.                 next_node = node->next;
  2133.                 if (g_jmms_context->pending_mms_info_list == node)
  2134.                 {
  2135.                     g_jmms_context->pending_mms_info_list = next_node;
  2136.                     pre_node = next_node;
  2137.                 }
  2138.                 else
  2139.                 {
  2140.                     pre_node->next = node->next;
  2141.                 }
  2142.                 if (node->mms_url != NULL)
  2143.                 {
  2144.                     jdd_MemFree(node->mms_url);
  2145.                 }
  2146.                 jdd_MemFree(node);
  2147.                 node = next_node;
  2148.             }
  2149.             else
  2150.             {
  2151.                 pre_node = node;
  2152.                 node = node->next;
  2153.             }
  2154.         }
  2155.     }
  2156. }
  2157. /*****************************************************************************
  2158.  * FUNCTION
  2159.  *  mmi_jmms_entry_show_read_report_screen
  2160.  * DESCRIPTION
  2161.  *  
  2162.  * PARAMETERS
  2163.  *  void
  2164.  * RETURNS
  2165.  *  void
  2166.  *****************************************************************************/
  2167. void mmi_jmms_entry_show_read_report_screen(void)
  2168. {
  2169.     /*----------------------------------------------------------------*/
  2170.     /* Local Variables                                                */
  2171.     /*----------------------------------------------------------------*/
  2172.     PU8 gui_buffer; /* Buffer holding history data */
  2173.     S8 temp[14];
  2174.     U8 dttemp[40];
  2175.     MYTIME time;
  2176.     FLOAT timezone;
  2177.     /*----------------------------------------------------------------*/
  2178.     /* Code Body                                                      */
  2179.     /*----------------------------------------------------------------*/
  2180.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_entry_show_read_report_screen"));
  2181.     timezone = mmi_dt_get_tz();
  2182.     EntryNewScreen(SCR_ID_JMMS_NEW_MMS, NULL, mmi_jmms_entry_show_read_report_screen, NULL);
  2183.     gui_buffer = GetCurrGuiBuffer(SCR_ID_JMMS_NEW_MMS);
  2184.     /* STATUS */
  2185.     pfnUnicodeStrcpy((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_STATUS));
  2186.     memset(temp, 0x00, 14);
  2187.     AnsiiToUnicodeString((PS8) temp, (PS8) "n----n");
  2188.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2189.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s%d", "jmms read status: ", g_jmms_context->read_report_p->eReadStatus));
  2190.     switch (g_jmms_context->read_report_p->eReadStatus)
  2191.     {
  2192.         case E_STATUS_READ:
  2193.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "jmms read status: E_STATUS_READ."));
  2194.             pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_READ_REPORT_READ));
  2195.             break;
  2196.         case E_STATUS_DELETED:
  2197.             pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_READ_REPORT_DELETED));
  2198.             break;
  2199.         default:
  2200.             pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_UNKNOWN));
  2201.             break;
  2202.     }
  2203.     /* FROM */
  2204.     memset(temp, 0x00, 4);
  2205.     AnsiiToUnicodeString((PS8) temp, (PS8) "nn");
  2206.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2207.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_FROM));
  2208.     memset(temp, 0x00, 14);
  2209.     AnsiiToUnicodeString((PS8) temp, (PS8) "n----n");
  2210.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2211.     if (g_jmms_context->read_report_p->pFrom == NULL)
  2212.     {
  2213.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
  2214.     }
  2215.     else
  2216.     {
  2217.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) (g_jmms_context->read_report_p->pFrom));
  2218.     }
  2219.     /* Date */
  2220.     memset(dttemp, 0x00, 40);
  2221.     date_string(&time, (UI_string_type)dttemp, DT_IDLE_SCREEN);
  2222.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) dttemp);
  2223.     /* Time */
  2224.     memset(temp, 0x00, 6);
  2225.     AnsiiToUnicodeString((PS8) temp, (PS8) "n");
  2226.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2227.     memset(dttemp, 0x00, 40);
  2228.     time_string(&time, (UI_string_type)dttemp, DT_IDLE_SCREEN);
  2229.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) dttemp);
  2230.     ShowCategory78Screen(
  2231.         STR_ID_SETTINGS_READ_REPORT,
  2232.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  2233.         STR_GLOBAL_OK,
  2234.         IMG_GLOBAL_OK,
  2235.         NULL,
  2236.         NULL,
  2237.         NULL,
  2238.         (U8*) subMenuData,
  2239.         pfnUnicodeStrlen((S8*) subMenuData),
  2240.         gui_buffer);
  2241.     SetLeftSoftkeyFunction(mmi_jmms_back_msg_view_entry, KEY_EVENT_UP);
  2242.     SetKeyHandler(mmi_jmms_back_msg_view_entry, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2243.     SetKeyHandler(mmi_jmms_back_msg_view_entry, KEY_WAP, KEY_EVENT_DOWN);
  2244. if (isInCall() == FALSE)
  2245.     SetKeyHandler(mmi_jmms_end_mms_play, KEY_END, KEY_EVENT_DOWN);
  2246.     return;
  2247. }
  2248. /*****************************************************************************
  2249.  * FUNCTION
  2250.  *  mmi_jmms_entry_show_delivery_report_screen
  2251.  * DESCRIPTION
  2252.  *  
  2253.  * PARAMETERS
  2254.  *  void
  2255.  * RETURNS
  2256.  *  void
  2257.  *****************************************************************************/
  2258. void mmi_jmms_entry_show_delivery_report_screen(void)
  2259. {
  2260.     /*----------------------------------------------------------------*/
  2261.     /* Local Variables                                                */
  2262.     /*----------------------------------------------------------------*/
  2263.     PU8 gui_buffer; /* Buffer holding history data */
  2264.     S8 temp[14];
  2265.     U8 dttemp[40];
  2266.     MYTIME time1, time;
  2267.     FLOAT timezone;
  2268.     /*----------------------------------------------------------------*/
  2269.     /* Code Body                                                      */
  2270.     /*----------------------------------------------------------------*/
  2271.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_entry_show_delivery_report_screen"));
  2272.     timezone = mmi_dt_get_tz();
  2273. /* sandeep start to Fix bug number PMT00006350 */
  2274. mmi_jmms_update_status_icon_indicator();
  2275. /* sandeep end to Fix bug number PMT00006350 */
  2276.     EntryNewScreen(SCR_ID_JMMS_NEW_MMS, NULL, mmi_jmms_entry_show_delivery_report_screen, NULL);
  2277.     gui_buffer = GetCurrGuiBuffer(SCR_ID_JMMS_NEW_MMS);
  2278.     /* STATUS */
  2279.     pfnUnicodeStrcpy((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_STATUS));
  2280.     memset(temp, 0x00, 14);
  2281.     AnsiiToUnicodeString((PS8) temp, (PS8) "n----n");
  2282.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2283.     switch (g_jmms_context->delivery_p->eDeliveryStatus)
  2284.     {
  2285.         case E_MSG_EXPIRED:
  2286.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "jmms Delievery Status: E_MSG_EXPIRED."));
  2287.             pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_DELIVERY_STATUS_EXPIRED));
  2288.             break;
  2289.         case E_MSG_RETRIEVED:
  2290.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "jmms Delievery Status: E_MSG_RETRIEVED."));
  2291.             pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_DELIVERY_STATUS_RETRIEVED));
  2292.             break;
  2293.         case E_MSG_REJECTED:
  2294.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "jmms Delievery Status: E_MSG_REJECTED."));
  2295.             pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_DELIVERY_STATUS_REJECTED));
  2296.             break;
  2297.         case E_MSG_DEFERRED:
  2298.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "jmms Delievery Status: E_MSG_DEFERRED."));
  2299.             pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_DELIVERY_STATUS_DEFFERED));
  2300.             break;
  2301.         case E_MSG_UNRECOGNIZED:
  2302.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "jmms Delievery Status: E_MSG_UNRECOGNIZED."));
  2303.             pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_DELIVERY_STATUS_UNRECOGNISED));
  2304.             break;
  2305.         case E_MSG_INDETERMINATE:
  2306.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "jmms Delievery Status:E_MSG_INDETERMINATE."));
  2307.             pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_DELIVERY_STATUS_INDETERMINATE));
  2308.             break;
  2309.         case E_MSG_FORWARDED:
  2310.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "jmms Delievery Status: E_MSG_FORWARDED."));
  2311.             pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_DELIVERY_STATUS_FORWARDED));
  2312.             break;
  2313.         case E_MSG_UNREACHABLE:
  2314.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "jmms Delievery Status: E_MSG_UNREACHABLE."));
  2315.             pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_DELIVERY_STATUS_UNREACHABLE));
  2316.             break;
  2317.         default:
  2318.             pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_UNKNOWN));
  2319.             break;
  2320.     }
  2321.     /* TO */
  2322.     memset(temp, 0x00, 4);
  2323.     AnsiiToUnicodeString((PS8) temp, (PS8) "nn");
  2324.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2325.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_TO));
  2326.     memset(temp, 0x00, 14);
  2327.     AnsiiToUnicodeString((PS8) temp, (PS8) "n----n");
  2328.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2329.     if (g_jmms_context->delivery_p->pTo == NULL)
  2330.     {
  2331.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
  2332.     }
  2333.     else
  2334.     {
  2335.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) (g_jmms_context->delivery_p->pTo));
  2336.     }
  2337.     /* /Date */
  2338.     memset(temp, 0x00, 6);
  2339.     AnsiiToUnicodeString((PS8) temp, (PS8) "nn");
  2340.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2341.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_DATE));
  2342.     memset(temp, 0x00, 14);
  2343.     AnsiiToUnicodeString((PS8) temp, (PS8) "n----n");
  2344.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2345.     mmi_dt_utc_sec_2_mytime((U32) (g_jmms_context->delivery_p->uiDate), &time1, MMI_TRUE);
  2346.     mmi_dt_utc_to_rtc(timezone, time1, time);
  2347.     /* PMT RAJ KUMAR GUPTA on Sep 05, 2006 */
  2348.     /* Date */
  2349.     memset(dttemp, 0x00, 40);
  2350.     date_string(&time, (UI_string_type)dttemp, DT_IDLE_SCREEN);
  2351.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) dttemp);
  2352.     memset(temp, 0x00, 6);
  2353.     AnsiiToUnicodeString((PS8) temp, (PS8) "n");
  2354.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2355.     /* Time*/
  2356.     memset(dttemp, 0x00, 40);
  2357.     time_string(&time, (UI_string_type)dttemp, DT_IDLE_SCREEN);
  2358.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) dttemp);
  2359.     /* End of Changes - RAJ KUMAR GUPTA */
  2360.     ShowCategory78Screen(
  2361.         STR_ID_JMMS_DELIVERY_REPORT,
  2362.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  2363.         STR_GLOBAL_OK,
  2364.         IMG_GLOBAL_OK,
  2365.         NULL,
  2366.         NULL,
  2367.         NULL,
  2368.         (U8*) subMenuData,
  2369.         pfnUnicodeStrlen((S8*) subMenuData),
  2370.         gui_buffer);
  2371.     SetLeftSoftkeyFunction(mmi_jmms_back_msg_view_entry, KEY_EVENT_UP);
  2372.     SetKeyHandler(mmi_jmms_back_msg_view_entry, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2373.     SetKeyHandler(mmi_jmms_back_msg_view_entry, KEY_WAP, KEY_EVENT_DOWN);
  2374. if (isInCall() == FALSE)
  2375.     SetKeyHandler(mmi_jmms_end_mms_play, KEY_END, KEY_EVENT_DOWN);
  2376.     return;
  2377. }
  2378. /*****************************************************************************
  2379.  * FUNCTION
  2380.  *  mmi_jmms_handle_deffered_retrieved_mms
  2381.  * DESCRIPTION
  2382.  *  
  2383.  * PARAMETERS
  2384.  *  Content     [IN]        
  2385.  * RETURNS
  2386.  *  
  2387.  *****************************************************************************/
  2388. JC_RETCODE mmi_jmms_handle_deffered_retrieved_mms(CONTENT_DATA Content)
  2389. {
  2390.     /*----------------------------------------------------------------*/
  2391.     /* Local Variables                                                */
  2392.     /*----------------------------------------------------------------*/
  2393.     JC_RETCODE eRet = JC_OK;
  2394.     /*----------------------------------------------------------------*/
  2395.     /* Code Body                                                      */
  2396.     /*----------------------------------------------------------------*/
  2397.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_handle_deffered_retrieved_mms"));
  2398.     if (g_jmms_context->msg_handle != NULL)
  2399.     {
  2400.         mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  2401.         g_jmms_context->msg_handle = NULL;
  2402.     }
  2403.     eRet = mmi_jmms_jdi_parse_msg_buffer(&g_jmms_context->msg_handle, &Content, E_TYPE_MMS, E_FALSE);
  2404.     /* Async changes begin */
  2405.     while (eRet == JC_ERR_MMS_PARSE_PENDING)
  2406.     {
  2407.         eRet = mmi_jmms_jdi_msg_parse_continue(g_jmms_context->msg_handle);
  2408.     };
  2409.     /* Async changes end */
  2410.     if (JC_OK != eRet && g_jmms_context->msg_handle != NULL)
  2411.     {
  2412.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms parsing failed! Deinitializing the Msg Handler.", eRet));
  2413.         mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  2414.         g_jmms_context->msg_handle = NULL;
  2415.         return eRet;
  2416.     }
  2417.     eRet = mmi_jmms_jdi_get_msg_headers(g_jmms_context->msg_handle, (MESSAGE_HEADERS **) (&g_jmms_context->MsgHeaders_p));
  2418.     if (JC_OK != eRet)
  2419.     {
  2420.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms failed to get the message Header.", eRet));
  2421.         mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  2422.         g_jmms_context->msg_handle = NULL;
  2423.         return eRet;
  2424.     }
  2425.     if ((((MESSAGE_HEADERS*) g_jmms_context->MsgHeaders_p)->eMsgType) != E_MSG_TYPE_RECEIVE)
  2426.     {
  2427.         mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  2428.         g_jmms_context->msg_handle = NULL;
  2429.         return E_UNKNOWN_MSG;
  2430.     }
  2431.     g_jmms_context->MsgHeader_type_p =
  2432.         (MESSAGE_RETRIEVAL*) ((MESSAGE_HEADERS*) g_jmms_context->MsgHeaders_p)->pHeaders;
  2433.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "mmi_jmms_handle_deffered_retrieved_mms Return value", eRet));
  2434.     return eRet;
  2435. }
  2436. /*****************************************************************************
  2437.  * FUNCTION
  2438.  *  jmms_mmi_ack_for_deffered_retrieval
  2439.  * DESCRIPTION
  2440.  *  
  2441.  * PARAMETERS
  2442.  *  Content     [IN]        
  2443.  * RETURNS
  2444.  *  
  2445.  *****************************************************************************/
  2446. JC_RETCODE jmms_mmi_ack_for_deffered_retrieval(CONTENT_DATA Content)
  2447. {
  2448.     /*----------------------------------------------------------------*/
  2449.     /* Local Variables                                                */
  2450.     /*----------------------------------------------------------------*/
  2451.     JC_RETCODE eRet = JC_OK;
  2452.     MESSAGE_HEADERS *pMsgHeaders = NULL;
  2453.     MESSAGE_ACK *pAck = NULL;
  2454.     MESSAGE_RETRIEVAL *pNotifyIndHdrs = NULL;
  2455.     MSG_HANDLE mms_signal_handle = NULL;
  2456.     /*----------------------------------------------------------------*/
  2457.     /* Code Body                                                      */
  2458.     /*----------------------------------------------------------------*/
  2459.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "jmms_mmi_ack_for_deffered_retrieval"));
  2460.     eRet = mmi_jmms_jdi_parse_msg_buffer(&mms_signal_handle, &Content, E_TYPE_MMS, E_FALSE);
  2461.     /* Async changes begin */
  2462.     while (eRet == JC_ERR_MMS_PARSE_PENDING)
  2463.     {
  2464.         eRet = mmi_jmms_jdi_msg_parse_continue(mms_signal_handle);
  2465.     };
  2466.     /* Async changes end */
  2467.     if (JC_OK != eRet && mms_signal_handle != NULL)
  2468.     {
  2469.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms parsing failed! Deinitializing the Msg Handler.", eRet));
  2470.         mmi_jmms_jdi_msg_deinit(mms_signal_handle);
  2471.         mms_signal_handle = NULL;
  2472.         return eRet;
  2473.     }
  2474.     eRet = mmi_jmms_jdi_get_msg_headers(mms_signal_handle, &pMsgHeaders);
  2475.     if (JC_OK != eRet)
  2476.     {
  2477.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms fail to get the Msg Header", eRet));
  2478.         mmi_jmms_jdi_msg_deinit(mms_signal_handle);
  2479.         mms_signal_handle = NULL;
  2480.         return eRet;
  2481.     }
  2482.     pNotifyIndHdrs = (MESSAGE_RETRIEVAL*) pMsgHeaders->pHeaders;
  2483.     if (pNotifyIndHdrs == NULL || pNotifyIndHdrs->pTransactionID == NULL || pNotifyIndHdrs->pVersion == NULL)
  2484.     {
  2485.         eRet = JC_ERR_INVALID_PARAMETER;
  2486.         goto ERROR_HANDLE;
  2487.     }
  2488.     pAck = (MESSAGE_ACK*) jdd_MemAlloc(sizeof(MESSAGE_ACK), 1);
  2489.     if (pAck == NULL)
  2490.     {
  2491.         eRet = JC_ERR_MEMORY_ALLOCATION;
  2492.         goto ERROR_HANDLE;
  2493.     }
  2494.     pAck->bDeliveryReport = (JC_BOOLEAN) mmi_jmms_retrieval_settings_delivery_report();
  2495.     pAck->pVersion = jdi_UtilsStrdup(pNotifyIndHdrs->pVersion);
  2496.     pAck->pTransactionID = jdi_UtilsStrdup(pNotifyIndHdrs->pTransactionID);
  2497.     if (NULL != mms_signal_handle)
  2498.     {
  2499.         mmi_jmms_jdi_msg_deinit(mms_signal_handle);
  2500.         mms_signal_handle = NULL;
  2501.     }
  2502.     eRet = mmi_jmms_jdi_msg_init(&mms_signal_handle, NULL);
  2503.     if (JC_OK != eRet)
  2504.     {
  2505.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms Msg initialization failed.", eRet));
  2506.         mms_signal_handle = NULL;
  2507.         goto ERROR_HANDLE;
  2508.     }
  2509.     pMsgHeaders = (MESSAGE_HEADERS*) jdd_MemAlloc(sizeof(MESSAGE_HEADERS), 1);
  2510.     if (pMsgHeaders == NULL)
  2511.     {
  2512.         eRet = JC_ERR_MEMORY_ALLOCATION;
  2513.         goto ERROR_HANDLE;
  2514.     }
  2515.     pMsgHeaders->eMsgType = E_MSG_TYPE_ACKNOWLEDGE;
  2516.     pMsgHeaders->pHeaders = pAck;
  2517.     eRet = mmi_jmms_jdi_set_msg_headers(mms_signal_handle, pMsgHeaders);
  2518.     if (JC_OK != eRet)
  2519.     {
  2520.         goto ERROR_HANDLE;
  2521.     }
  2522.     mmi_jmms_send_mms(mms_signal_handle, E_TYPE_ACK_RESPONSE, E_TRUE, 1, E_FALSE);
  2523.   ERROR_HANDLE:
  2524.     if (mms_signal_handle != NULL)
  2525.     {
  2526.         mmi_jmms_jdi_msg_deinit(mms_signal_handle);
  2527.         mms_signal_handle = NULL;
  2528.     }
  2529.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms_mmi_ack_for_deffered_retrieval Return value", eRet));
  2530.     return eRet;
  2531. }
  2532. /*****************************************************************************
  2533.  * FUNCTION
  2534.  *  mmi_jmms_create_and_send_read_report
  2535.  * DESCRIPTION
  2536.  *  
  2537.  * PARAMETERS
  2538.  *  void
  2539.  * RETURNS
  2540.  *  void
  2541.  *****************************************************************************/
  2542. void mmi_jmms_create_and_send_read_report(void)
  2543. {
  2544.     /*----------------------------------------------------------------*/
  2545.     /* Local Variables                                                */
  2546.     /*----------------------------------------------------------------*/
  2547.     JC_RETCODE eRet = JC_OK;
  2548.     MESSAGE_RETRIEVAL *pRetrieveHdrs = NULL;
  2549.     U16 temp_comm_state = E_TYPE_NULL;
  2550.     MSG_HANDLE read_report_handle = NULL;
  2551.     /*----------------------------------------------------------------*/
  2552.     /* Code Body                                                      */
  2553.     /*----------------------------------------------------------------*/
  2554.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_create_and_send_read_report"));
  2555.     pRetrieveHdrs = (MESSAGE_RETRIEVAL*) g_jmms_context->MsgHeader_type_p;
  2556.     if (jc_strcmp(pRetrieveHdrs->pVersion, "1.0") == 0)
  2557.     {
  2558.         eRet = mmi_jmms_set_read_reply_message(
  2559.                 &read_report_handle,
  2560.                 pRetrieveHdrs->pMessageID,
  2561.                 pRetrieveHdrs->pFrom,
  2562.                 pRetrieveHdrs->pSubject);
  2563.         if (eRet == JC_OK)
  2564.         {
  2565.             temp_comm_state = E_TYPE_READ_REPORT_MMS;
  2566.         }
  2567.     }
  2568.     else
  2569.     {
  2570.         eRet = mmi_jmms_set_read_reply_pdu(
  2571.                 &read_report_handle,
  2572.                 pRetrieveHdrs->pMessageID,
  2573.                 pRetrieveHdrs->pFrom,
  2574.                 pRetrieveHdrs->pVersion);
  2575.         if (eRet == JC_OK)
  2576.         {
  2577.             temp_comm_state = E_TYPE_READ_REPORT_PDU;
  2578.         }
  2579.     }
  2580.     if (eRet == JC_OK)
  2581.     {
  2582.         eRet = mmi_jmms_send_mms(read_report_handle, temp_comm_state, E_TRUE, 1, E_FALSE);
  2583.     }
  2584.     if (eRet != JC_OK)
  2585.     {
  2586.         if (eRet == E_JMMS_STORAGE_FULL)
  2587.         {
  2588.             eRet = mmi_jmms_add_pending_mms_info_node(
  2589.                     (U16) STR_ID_JMMS_STORAGE_ERROR_READ_REPORT_SENT,
  2590.                     (U8) E_MSG_TYPE_IDLE_SCREEN_POP_UP,
  2591.                     NULL);
  2592.         }
  2593.         else
  2594.         {
  2595.             eRet = mmi_jmms_add_pending_mms_info_node(
  2596.                     (U16) STR_ID_JMMS_ERROR_READ_REPORT_SENT,
  2597.                     (U8) E_MSG_TYPE_IDLE_SCREEN_POP_UP,
  2598.                     NULL);
  2599.         }
  2600.         if (eRet == JC_OK)
  2601.         {
  2602.             mmi_jmms_check_for_idle_screen();
  2603.         }
  2604.     }
  2605.     else    /* /in case of error mmi_jmms_set_read_reply_pdu || */
  2606.         /* mmi_jmms_set_read_reply_message themselves will free the handle */
  2607.     {
  2608.         if (read_report_handle != NULL)
  2609.         {
  2610.             mmi_jmms_jdi_msg_deinit(read_report_handle);
  2611.             read_report_handle = NULL;
  2612.         }
  2613.     }
  2614.     return;
  2615. }
  2616. /*****************************************************************************
  2617.  * FUNCTION
  2618.  *  mmi_jmms_set_read_reply_message
  2619.  * DESCRIPTION
  2620.  *  
  2621.  * PARAMETERS
  2622.  *  phMsgHandle     [?]     [?]     [?]
  2623.  *  MessageID       [?]     [?]     [?]
  2624.  *  pToAddress      [?]     [?]     [?]
  2625.  *  pSubject        [?]     [?]     [?]
  2626.  * RETURNS
  2627.  *  
  2628.  *****************************************************************************/
  2629. JC_RETCODE mmi_jmms_set_read_reply_message(
  2630.             MSG_HANDLE *phMsgHandle,
  2631.             JC_INT8 *MessageID,
  2632.             JC_CHAR *pToAddress,
  2633.             JC_CHAR *pSubject)
  2634. {
  2635.     /*----------------------------------------------------------------*/
  2636.     /* Local Variables                                                */
  2637.     /*----------------------------------------------------------------*/
  2638.     JC_RETCODE eRet = JC_OK;
  2639.     MESSAGE_HEADERS *pRRHeaders = NULL;
  2640.     MESSAGE_SEND *pRRSendHeaders = NULL;
  2641.     JC_UINT32 MediaId = 0;
  2642.     S8 *temp_string = NULL;
  2643.     U32 len = 0, temp_len = 0;
  2644.     MEDIA_INFO MediaInfo = {0, };
  2645.     /*----------------------------------------------------------------*/
  2646.     /* Code Body                                                      */
  2647.     /*----------------------------------------------------------------*/
  2648.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_set_read_reply_message"));
  2649.     if (phMsgHandle == NULL || MessageID == NULL || pToAddress == NULL)
  2650.     {
  2651.         eRet = JC_ERR_INVALID_PARAMETER;
  2652.         goto ERROR_HANDLE;
  2653.     }
  2654.     eRet = mmi_jmms_jdi_msg_init(phMsgHandle, NULL);
  2655.     if (eRet != JC_OK)
  2656.     {
  2657.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms msg initialization failed.", eRet));
  2658.         goto ERROR_HANDLE;
  2659.     }
  2660.     eRet = mmi_jmms_jdi_set_msg_type(*phMsgHandle, E_TYPE_MMS);
  2661.     if (JC_OK != eRet)
  2662.     {
  2663.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms fail to set the MMS type", eRet));
  2664.         goto ERROR_HANDLE;
  2665.     }
  2666.     eRet = mmi_jmms_jdi_set_presentation_type(*phMsgHandle, E_PRESENTATION_NONE);
  2667.     if (JC_OK != eRet)
  2668.     {
  2669.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms fail to set the presentation type", eRet));
  2670.         goto ERROR_HANDLE;
  2671.     }
  2672.     /* pMediaInfo = (MEDIA_INFO *)jdd_MemAlloc(sizeof(MEDIA_INFO), 1) ;
  2673.        if(pMediaInfo == NULL)
  2674.        {
  2675.        eRet = JC_ERR_MEMORY_ALLOCATION ;
  2676.        goto ERROR_HANDLE ;
  2677.        } */
  2678.     MediaInfo.eMediaType = E_MEDIA_TEXT;
  2679.     MediaInfo.pMimeInfo = (MEDIA_MIME_INFO*) jdd_MemAlloc(sizeof(MEDIA_MIME_INFO), 1);
  2680.     if (MediaInfo.pMimeInfo == NULL)
  2681.     {
  2682.         eRet = JC_ERR_MEMORY_ALLOCATION;
  2683.         goto ERROR_HANDLE;
  2684.     }
  2685.     MediaInfo.pMimeInfo->MimeHeaders.pContentType =
  2686.         (JC_INT8*) jdd_MemAlloc(jc_strlen("text/plain") + 1, sizeof(JC_INT8));
  2687.     if (MediaInfo.pMimeInfo->MimeHeaders.pContentType == NULL)
  2688.     {
  2689.         eRet = JC_ERR_MEMORY_ALLOCATION;
  2690.         goto ERROR_HANDLE;
  2691.     }
  2692.     else
  2693.     {
  2694.         jc_strcpy(MediaInfo.pMimeInfo->MimeHeaders.pContentType, "text/plain");
  2695.     }
  2696.     if (g_jmms_context->is_unread_msg_deleted == 1)
  2697.     {
  2698.         len = (pfnUnicodeStrlen((S8*) GetString(STR_ID_JMMS_READ_REPORT_DELETE_MSG))) * ENCODING_LENGTH;
  2699.     }
  2700.     else
  2701.     {
  2702.         len = (pfnUnicodeStrlen((S8*) GetString(STR_ID_JMMS_READ_REPORT_MSG))) * ENCODING_LENGTH;
  2703.     }
  2704.     len = len + ((pfnUnicodeStrlen((S8*) GetString(STR_ID_JMMS_READ_REPORT_MSG_ID))) * ENCODING_LENGTH);
  2705.     temp_len = (strlen((const char*)MessageID)) * ENCODING_LENGTH;
  2706.     len = len + temp_len;
  2707.     MediaInfo.pMimeInfo->ContentData.pBuffer = jdd_MemAlloc(sizeof(S8), len + ENCODING_LENGTH);
  2708.     if (MediaInfo.pMimeInfo->ContentData.pBuffer == NULL)
  2709.     {
  2710.         eRet = JC_ERR_MEMORY_ALLOCATION;
  2711.         goto ERROR_HANDLE;
  2712.     }
  2713.     temp_string = jdd_MemAlloc(sizeof(S8), temp_len + ENCODING_LENGTH);
  2714.     if (temp_string == NULL)
  2715.     {
  2716.         eRet = JC_ERR_MEMORY_ALLOCATION;
  2717.         goto ERROR_HANDLE;
  2718.     }
  2719.     AnsiiToUnicodeString((S8*) temp_string, (S8*) MessageID);
  2720.     if (g_jmms_context->is_unread_msg_deleted == 1)
  2721.     {
  2722.         pfnUnicodeStrcpy(
  2723.             (S8*) (MediaInfo.pMimeInfo->ContentData.pBuffer),
  2724.             (S8*) GetString(STR_ID_JMMS_READ_REPORT_DELETE_MSG));
  2725.         g_jmms_context->is_unread_msg_deleted = 0;
  2726.     }
  2727.     else
  2728.     {
  2729.         pfnUnicodeStrcpy(
  2730.             (S8*) (MediaInfo.pMimeInfo->ContentData.pBuffer),
  2731.             (S8*) GetString(STR_ID_JMMS_READ_REPORT_MSG));
  2732.     }
  2733.     pfnUnicodeStrcat(
  2734.         (S8*) (MediaInfo.pMimeInfo->ContentData.pBuffer),
  2735.         (S8*) GetString(STR_ID_JMMS_READ_REPORT_MSG_ID));
  2736.     pfnUnicodeStrcat((S8*) (MediaInfo.pMimeInfo->ContentData.pBuffer), (S8*) temp_string);
  2737.     if (temp_string != NULL)
  2738.     {
  2739.         jdd_MemFree(temp_string);
  2740.         temp_string = NULL;
  2741.     }
  2742.     jdi_UtilsCharToTchar(&(MediaInfo.PresentationInfo.pRegionName), "Text");
  2743.     MediaInfo.pMimeInfo->ContentData.uiCurSize = MediaInfo.pMimeInfo->ContentData.uiTotalSize = len + ENCODING_LENGTH;
  2744.     eRet = mmi_jmms_jdi_add_media(*phMsgHandle, &MediaInfo, 1, &MediaId);
  2745.     if (eRet != JC_OK)
  2746.     {
  2747.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms fail to add media.", eRet));
  2748.         goto ERROR_HANDLE;
  2749.     }
  2750.     pRRHeaders = jdd_MemAlloc(sizeof(MESSAGE_HEADERS), 1);
  2751.     if (pRRHeaders == NULL)
  2752.     {
  2753.         eRet = JC_ERR_MEMORY_ALLOCATION;
  2754.         goto ERROR_HANDLE;
  2755.     }
  2756.     pRRHeaders->eMsgType = E_MSG_TYPE_SEND;
  2757.     pRRSendHeaders = (MESSAGE_SEND*) jdd_MemAlloc(sizeof(MESSAGE_SEND), 1);
  2758.     if (pRRSendHeaders == NULL)
  2759.     {
  2760.         eRet = JC_ERR_MEMORY_ALLOCATION;
  2761.         goto ERROR_HANDLE;
  2762.     }
  2763.     pRRSendHeaders->eMsgClass = E_MSG_AUTO_CLASS;
  2764.     pRRSendHeaders->eMsgPriority = (U32) E_MSG_PRIORITY_NORMAL;
  2765.     if (wap_get_user_agent_brand() == EM_WAP_USERAGENT_BRAND_SE)
  2766.     {
  2767.         pRRSendHeaders->uiDate = get_current_utc_time();
  2768.         pRRSendHeaders->uiExpiryTime = 0;
  2769.     }
  2770.     else
  2771.     {
  2772.         pRRSendHeaders->uiExpiryTime = (U32) MAX_VALIDITY_PERIOD_VALUE;
  2773.     }
  2774.     if (pSubject != NULL)
  2775.     {
  2776.         len = (pfnUnicodeStrlen((S8*) pSubject)) * ENCODING_LENGTH;
  2777.         len = len + ((strlen((S8*) STR_JMMS_READ_REPORT_PREPEND_STRING)) * ENCODING_LENGTH);
  2778.         pRRSendHeaders->pSubject = jdd_MemAlloc(sizeof(S8), (len + ENCODING_LENGTH ));
  2779.         if (pRRSendHeaders->pSubject == NULL)
  2780.         {
  2781.             eRet = JC_ERR_MEMORY_ALLOCATION;
  2782.             goto ERROR_HANDLE;
  2783.         }
  2784.         AnsiiToUnicodeString((S8*) pRRSendHeaders->pSubject, (S8*) STR_JMMS_READ_REPORT_PREPEND_STRING);      
  2785.         pfnUnicodeStrcat((S8*) (pRRSendHeaders->pSubject), (S8*) (pSubject));
  2786.     }
  2787.     else
  2788.     {
  2789.         len =(strlen((S8*) STR_JMMS_READ_REPORT_PREPEND_STRING))* ENCODING_LENGTH;
  2790.         pRRSendHeaders->pSubject = jdd_MemAlloc(sizeof(S8), len + ENCODING_LENGTH );
  2791.         if (pRRSendHeaders->pSubject == NULL)
  2792.         {
  2793.             eRet = JC_ERR_MEMORY_ALLOCATION;
  2794.             goto ERROR_HANDLE;
  2795.         }
  2796.         AnsiiToUnicodeString((S8*) pRRSendHeaders->pSubject, (S8*) STR_JMMS_READ_REPORT_PREPEND_STRING);           
  2797.     }
  2798.     pRRSendHeaders->pTo = jdd_MemAlloc(jc_tcslen(pToAddress) + 1, sizeof(JC_CHAR));
  2799.     if (pRRSendHeaders->pTo == NULL)
  2800.     {
  2801.         eRet = JC_ERR_MEMORY_ALLOCATION;
  2802.         goto ERROR_HANDLE;
  2803.     }
  2804.     jc_tcscpy(pRRSendHeaders->pTo, pToAddress);
  2805.     pRRSendHeaders->pVersion = jdd_MemAlloc(sizeof(JC_INT8), MAX_VERSION_LENGTH + 1);
  2806.     if (pRRSendHeaders->pVersion)
  2807.     {
  2808.         jc_strcpy(pRRSendHeaders->pVersion, "1.0");
  2809.     }
  2810.     pRRHeaders->pHeaders = pRRSendHeaders;
  2811.     eRet = mmi_jmms_jdi_set_msg_headers(*phMsgHandle, pRRHeaders);
  2812.   ERROR_HANDLE:
  2813.     if (eRet != JC_OK)
  2814.     {
  2815.         if (*phMsgHandle != NULL)
  2816.         {
  2817.             mmi_jmms_jdi_msg_deinit(*phMsgHandle);
  2818.             phMsgHandle = NULL;
  2819.         }
  2820.     }
  2821.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "mmi_jmms_set_read_reply_message Return value", eRet));
  2822.     return eRet;
  2823. }
  2824. /*****************************************************************************
  2825.  * FUNCTION
  2826.  *  mmi_jmms_set_read_reply_pdu
  2827.  * DESCRIPTION
  2828.  *  
  2829.  * PARAMETERS
  2830.  *  phMsgHandle     [?]     [?]     [?]
  2831.  *  MessageID       [?]     [?]     [?]
  2832.  *  pToAddress      [?]     [?]     [?]
  2833.  *  pVersion        [?]     [?]     [?]
  2834.  * RETURNS
  2835.  *  
  2836.  *****************************************************************************/
  2837. JC_RETCODE mmi_jmms_set_read_reply_pdu(
  2838.             MSG_HANDLE *phMsgHandle,
  2839.             JC_INT8 *MessageID,
  2840.             JC_CHAR *pToAddress,
  2841.             JC_INT8 *pVersion)
  2842. {
  2843.     /*----------------------------------------------------------------*/
  2844.     /* Local Variables                                                */
  2845.     /*----------------------------------------------------------------*/
  2846.     JC_RETCODE eRet = JC_OK;
  2847.     READ_REPORT *pReadReport = NULL;
  2848.     MESSAGE_HEADERS *pReadReportPDU = {0, };
  2849.     /*----------------------------------------------------------------*/
  2850.     /* Code Body                                                      */
  2851.     /*----------------------------------------------------------------*/
  2852.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_set_read_reply_pdu"));
  2853.     if (phMsgHandle == NULL || MessageID == NULL || pToAddress == NULL)
  2854.     {
  2855.         eRet = JC_ERR_INVALID_PARAMETER;
  2856.         goto ERROR_HANDLE;
  2857.     }
  2858.     eRet = mmi_jmms_jdi_msg_init(phMsgHandle, NULL);
  2859.     if (eRet != JC_OK)
  2860.     {
  2861.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "jmms msg Initialization failed.", eRet));
  2862.         goto ERROR_HANDLE;
  2863.     }
  2864.     pReadReportPDU = (MESSAGE_HEADERS*) jdd_MemAlloc(sizeof(MESSAGE_HEADERS), 1);
  2865.     if (pReadReportPDU == NULL)
  2866.     {
  2867.         eRet = JC_ERR_MEMORY_ALLOCATION;
  2868.         goto ERROR_HANDLE;
  2869.     }
  2870.     pReadReport = (READ_REPORT*) jdd_MemAlloc(sizeof(READ_REPORT), 1);
  2871.     if (pReadReport == NULL)
  2872.     {
  2873.         eRet = JC_ERR_MEMORY_ALLOCATION;
  2874.         goto ERROR_HANDLE;
  2875.     }
  2876.     if (g_jmms_context->is_unread_msg_deleted == 1)
  2877.     {
  2878.         pReadReport->eReadStatus = E_STATUS_DELETED;
  2879.         g_jmms_context->is_unread_msg_deleted = 0;
  2880.     }
  2881.     else
  2882.     {
  2883.         pReadReport->eReadStatus = E_STATUS_READ;
  2884.     }
  2885.     pReadReport->pMessageID = jdi_UtilsStrdup(MessageID);
  2886.     pReadReport->pTo = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), jc_tcslen(pToAddress) + 1);
  2887.     if (pReadReport->pTo == NULL)
  2888.     {
  2889.         eRet = JC_ERR_MEMORY_ALLOCATION;
  2890.         goto ERROR_HANDLE;
  2891.     }
  2892.     jc_tcscpy(pReadReport->pTo, pToAddress);
  2893.     pReadReport->pVersion = jdi_UtilsStrdup(pVersion);
  2894.     if (wap_get_user_agent_brand() == EM_WAP_USERAGENT_BRAND_SE)
  2895.     {
  2896.         pReadReport->uiDate = get_current_utc_time();
  2897.     }
  2898.     pReadReportPDU->eMsgType = E_MSG_TYPE_READ_REPORT;
  2899.     pReadReportPDU->pHeaders = pReadReport;
  2900.     eRet = mmi_jmms_jdi_set_msg_headers(*phMsgHandle, pReadReportPDU);
  2901.   ERROR_HANDLE:
  2902.     if (eRet != JC_OK)
  2903.     {
  2904.         if (*phMsgHandle != NULL)
  2905.         {
  2906.             mmi_jmms_jdi_msg_deinit(*phMsgHandle);
  2907.             phMsgHandle = NULL;
  2908.         }
  2909.     }
  2910.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "mmi_jmms_set_read_reply_pdu Return value", eRet));
  2911.     return eRet;
  2912. }
  2913. #endif /* (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT)) */