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

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_main_mms_ui.C
  15.  *
  16.  * Project:
  17.  * --------
  18.  *  MAUI
  19.  *
  20.  * Description:
  21.  * ------------
  22.  *  This is main mms file
  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.  *
  74.  * removed!
  75.  * removed!
  76.  * removed!
  77.  *
  78.  * removed!
  79.  * removed!
  80.  * removed!
  81.  *
  82.  * removed!
  83.  * removed!
  84.  * removed!
  85.  *
  86.  * removed!
  87.  * removed!
  88.  * removed!
  89.  *
  90.  * removed!
  91.  * removed!
  92.  * removed!
  93.  *
  94.  * removed!
  95.  * removed!
  96.  * removed!
  97.  *
  98.  * removed!
  99.  * removed!
  100.  * removed!
  101.  *
  102.  * removed!
  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.  * removed!
  132.  * removed!
  133.  * removed!
  134.  *
  135.  * removed!
  136.  * removed!
  137.  * removed!
  138.  *
  139.  * removed!
  140.  * removed!
  141.  * removed!
  142.  *
  143.  * removed!
  144.  * removed!
  145.  * removed!
  146.  *
  147.  * removed!
  148.  * removed!
  149.  * removed!
  150.  *
  151.  * removed!
  152.  * removed!
  153.  * removed!
  154.  *
  155.  *------------------------------------------------------------------------------
  156.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  157.  *============================================================================
  158.  ****************************************************************************/
  159. #ifndef _MMI_JMMSSECONDARYMMI_C
  160. #define _MMI_JMMSSECONDARYMMI_C
  161. /***************************************************************************** 
  162. * Include
  163. *****************************************************************************/
  164. #include "MMI_features.h"
  165. #if (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT))
  166. #include "PixtelDataTypes.h"
  167. #include "Unicodexdcl.h"
  168. #include "HistoryGprot.h"
  169. #include "GlobalDefs.h"
  170. #include "SettingProfile.h"
  171. #include "DebugInitDef.h"
  172. #include "CommonScreens.h"
  173. #include "EventsGprot.h"
  174. #include "wgui_inputs.h"
  175. #include "wgui_datetime.h"
  176. #include "wgui_categories.h"
  177. #include "wgui_categories_inputs.h"
  178. #include "MainMenuDef.h"
  179. #include "JMMSStoreHandling.h"
  180. #include "JMMSConfig.h"
  181. #include "JMMSMainMMS.h"
  182. #include "JMMSUseDetails.h"
  183. #include "JMMSJSRHandler.h"
  184. #include <ddl.h>
  185. #include <jcal.h>
  186. #include <jcalnet.h>
  187. #include "jdi_wspdatatype.h"
  188. #include "jdi_transport.h"
  189. #include <jdi_communicator.h>
  190. #include "jdd_memapi.h"
  191. #include "jdd_fileapi.h"
  192. #include <MessagingDatatypes.h>
  193. #include <MessagingAPI.h>
  194. #ifdef __MMI_USB_SUPPORT__
  195. #include "USBDeviceGprot.h"
  196. #endif
  197. #include "JMMSExdcl.h"
  198. #include "JBrowserMMIDefs.h"
  199. #include "MessagesResourceData.h"
  200. #include "JMMSCoreAPI.h"
  201. #include "JMMSResEnum.h"
  202. #include "JMMSCoreAPI.h"
  203. #include "JMMSDrafts.h"
  204. #include "JMMSExdcl.h"
  205. /* /#include "JMMSGdcl.h" */
  206. #include "JMMSCompose.h"
  207. #include "JMMSGprot.h"
  208. #include "JMMSInbox.h"
  209. #include "JMMSJSRHandler.h"
  210. #include "JMMSMainMMS.h"
  211. #include "JMMSMessageSettingsUtils.h"
  212. #include "JMMSOutbox.h"
  213. #include "JMMSProtocols.h"
  214. #include "JMMSPushHandling.h"
  215. #include "JMMSResEnum.h"
  216. #include "JMMSSent.h"
  217. #include "JMMSStoreHandling.h"
  218. #include "JMMSStructs.h"
  219. #include "JMMSTemplates.h"
  220. #include "JMMSUseDetails.h"
  221. #include "JMMSView.h"
  222. #include "JMMSWriteMMS.h"
  223. #include "JSRProts.h"
  224. #include "miscutils.h"
  225. #include "DateTimeGprot.h"
  226. #include "DateTimeType.h"
  227. #include "JMMSPlutoMMIInterface.h"
  228. #include "FileSystemDef.h"
  229. #include "FileMgr.h"
  230. #include "TimerEvents.h"
  231. #ifdef __MMI_UNIFIED_MESSAGE__
  232. #include "UnifiedMessageDef.h"
  233. #include "UnifiedMessageProt.h"
  234. #include "JMMSUMHandling.h"
  235. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  236. /***************************************************************************** 
  237. * Define
  238. *****************************************************************************/
  239. /***************************************************************************** 
  240. * Typedef 
  241. *****************************************************************************/
  242. /***************************************************************************** 
  243. * Local Variable
  244. *****************************************************************************/
  245. /***************************************************************************** 
  246. * Local Function
  247. *****************************************************************************/
  248. void mmi_jmms_reset_fw_flag_of_message(void);
  249. /***************************************************************************** 
  250. * Global Variable
  251. *****************************************************************************/
  252. /***************************************************************************** 
  253. * Global Function
  254. *****************************************************************************/
  255. extern int wap_is_ready(void);
  256. extern jdd_MemSetActiveModuleID(ETaskID taskId);
  257. #ifndef __MMI_UNIFIED_MESSAGE__
  258. /*****************************************************************************
  259.  * FUNCTION
  260.  *  mmi_jmms_highlight_main_mms
  261.  * DESCRIPTION
  262.  *  This function is gihlight handler of main MMS menu item.
  263.  * PARAMETERS
  264.  *  void
  265.  * RETURNS
  266.  *  void
  267.  *****************************************************************************/
  268. void mmi_jmms_highlight_main_mms(void)
  269. {
  270.     /*----------------------------------------------------------------*/
  271.     /* Local Variables                                                */
  272.     /*----------------------------------------------------------------*/
  273.     /*----------------------------------------------------------------*/
  274.     /* Code Body                                                      */
  275.     /*----------------------------------------------------------------*/
  276.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  277.     SetLeftSoftkeyFunction(mmi_jmms_entry_main_menu, KEY_EVENT_UP);
  278.     SetKeyHandler(mmi_jmms_entry_main_menu, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  279.     SetKeyHandler(mmi_jmms_entry_main_menu, KEY_WAP, KEY_EVENT_DOWN);
  280. }   /* end of mmi_mms_highlight_main_mms */
  281. /*****************************************************************************
  282.  * FUNCTION
  283.  *  mmi_jmms_main_mms_init
  284.  * DESCRIPTION
  285.  *  This function init the hilight handlers of main MMS menu items.
  286.  *  This is called at boot up time
  287.  * PARAMETERS
  288.  *  void
  289.  * RETURNS
  290.  *  void
  291.  *****************************************************************************/
  292. void mmi_jmms_main_mms_init(void)
  293. {
  294.     /*----------------------------------------------------------------*/
  295.     /* Local Variables                                                */
  296.     /*----------------------------------------------------------------*/
  297.     /*----------------------------------------------------------------*/
  298.     /* Code Body                                                      */
  299.     /*----------------------------------------------------------------*/
  300.     SetHiliteHandler(MENU_ID_JMMS_WRITE_MESSAGE, mmi_jmms_highlight_write_message);
  301.     SetHiliteHandler(MENU_ID_JMMS_INBOX, mmi_jmms_highlight_inbox);
  302.     SetHiliteHandler(MENU_ID_JMMS_OUTBOX, mmi_jmms_highlight_outbox);
  303.     SetHiliteHandler(MENU_ID_JMMS_SENT, mmi_jmms_highlight_sent);
  304.     SetHiliteHandler(MENU_ID_JMMS_DRAFTS, mmi_jmms_highlight_drafts);
  305.     SetHiliteHandler(MENU_ID_JMMS_TEMPLATES, mmi_jmms_highlight_templates);
  306.     SetHiliteHandler(MENU_ID_JMMS_MMS_SETTINGS, mmi_jmms_highlight_messages_settings);
  307.     SetHintHandler(MENU_ID_JMMS_INBOX, mmi_jmms_hint_inbox);
  308.     SetHintHandler(MENU_ID_JMMS_OUTBOX, mmi_jmms_hint_outbox);
  309.     SetHintHandler(MENU_ID_JMMS_SENT, mmi_jmms_hint_sent);
  310.     SetHintHandler(MENU_ID_JMMS_DRAFTS, mmi_jmms_hint_drafts);
  311. }
  312. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  313. /*****************************************************************************
  314.  * FUNCTION
  315.  *  mmi_jmms_entry_main_menu
  316.  * DESCRIPTION
  317.  *  This is the entry fn for main mms screen
  318.  * PARAMETERS
  319.  *  void
  320.  * RETURNS
  321.  *  void
  322.  *****************************************************************************/
  323. void mmi_jmms_entry_main_menu(void)
  324. {
  325.     /*----------------------------------------------------------------*/
  326.     /* Local Variables                                                */
  327.     /*----------------------------------------------------------------*/
  328.     PU8 gui_buffer;                     /* Buffer holding history data */
  329.     U16 str_item_list[MAX_SUB_MENUS];   /* Stores the strings id of submenus returned */
  330.     U16 num_item;                       /* Stores no of children in the submenu */
  331.     U16 item_icons[MAX_SUB_MENUS];
  332.     PU8 popup_list[MAX_SUB_MENUS];
  333.     /*----------------------------------------------------------------*/
  334.     /* Code Body                                                      */
  335.     /*----------------------------------------------------------------*/
  336. if (!wap_is_ready())
  337.     {
  338.         DisplayPopup((U8*) GetString(STR_ID_BRW_WAP_NOT_READY), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  339. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS: WAP is not ready"));
  340.         return;
  341.     }
  342. if(g_jmms_context->init_done == JMMS_READY_WITHOUT_STORE)
  343. {
  344.         DisplayPopup((U8*) GetString(STR_ID_JMMS_MEMORY_FULL), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  345. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS: Store is not ready"));
  346.         return;
  347. }
  348.     jdd_MemSetActiveModuleID(E_TASK_MMS_UI);
  349.     EntryNewScreen(SCR_ID_JMMS_MAIN_MENU, NULL, mmi_jmms_entry_main_menu, NULL);
  350.     mmi_jmms_reset_fw_flag_of_message();
  351.     gui_buffer = GetCurrGuiBuffer(SCR_ID_JMMS_MAIN_MENU);
  352.     num_item = GetNumOfChild(MESSAGES_MENU_MMS_MENUID);
  353.     GetSequenceStringIds_Ext(MESSAGES_MENU_MMS_MENUID, str_item_list);
  354.     GetSequenceImageIds_Ext(MESSAGES_MENU_MMS_MENUID, item_icons);
  355.     SetParentHandler(MESSAGES_MENU_MMS_MENUID);
  356.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  357.     ConstructHintsList(MESSAGES_MENU_MMS_MENUID, popup_list);
  358.     /* reset the open msg status- for At delete */
  359.     g_jmms_context->msg_open_status[0] = 0;
  360.     g_jmms_context->msg_open_status[1] = 0;
  361. g_jmms_context->nCurr_scr_hilited_index = 0;
  362.     ShowCategory52Screen(
  363.         STR_MMS_MENUENTRY,
  364.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  365.         STR_GLOBAL_OK,
  366.         IMG_GLOBAL_OK,
  367.         STR_GLOBAL_BACK,
  368.         IMG_GLOBAL_BACK,
  369.         num_item,
  370.         str_item_list,
  371.         item_icons,
  372.         (U8 **) popup_list,
  373.         0,
  374.         0,
  375.         gui_buffer);
  376.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  377.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  378.     mmi_jmms_delete_compose_temp_files();
  379. }
  380. #ifndef __MMI_UNIFIED_MESSAGE__
  381. /*****************************************************************************
  382.  * FUNCTION
  383.  *  mmi_jmms_exit_main_menu
  384.  * DESCRIPTION
  385.  *  THis is the exit fn for main mms screen
  386.  * PARAMETERS
  387.  *  void
  388.  * RETURNS
  389.  *  void
  390.  *****************************************************************************/
  391. void mmi_jmms_exit_main_menu(void)
  392. {
  393.     /*----------------------------------------------------------------*/
  394.     /* Local Variables                                                */
  395.     /*----------------------------------------------------------------*/
  396.     /*----------------------------------------------------------------*/
  397.     /* Code Body                                                      */
  398.     /*----------------------------------------------------------------*/
  399.     /* /deinit_the store_module(gmsgcontext->store handle) */
  400. }
  401. /*****************************************************************************
  402.  * FUNCTION
  403.  *  mmi_jmms_hint_inbox
  404.  * DESCRIPTION
  405.  *  This is the hint handler of inbox menu item
  406.  * PARAMETERS
  407.  *  index       [IN]        
  408.  * RETURNS
  409.  *  void
  410.  *****************************************************************************/
  411. void mmi_jmms_hint_inbox(U16 index)
  412. {
  413.     /*----------------------------------------------------------------*/
  414.     /* Local Variables                                                */
  415.     /*----------------------------------------------------------------*/
  416.     U8 value[10];
  417.     U8 number = 0;
  418.     JC_RETCODE eRet = JC_OK;
  419.     /*----------------------------------------------------------------*/
  420.     /* Code Body                                                      */
  421.     /*----------------------------------------------------------------*/
  422.     eRet = mmi_mms_get_number_of_messages(MMI_JMMS_INBOX, &number);
  423.     if (eRet != JC_OK)
  424.     {
  425.         number = 0;
  426.     }
  427. /* MAUI_00018221 Start */    
  428. memset((PS8) hintData[index], 0, sizeof(hintData[index]));// sanjeev added
  429. sprintf((S8*) value, "%d ", number);
  430.     AnsiiToUnicodeString((S8*) hintData[index], (S8*) value);
  431. pfnUnicodeStrcat((PS8) hintData[index], (S8*) GetString(STR_ID_JMMS_MSGS));
  432. /* MAUI_00018221 End */
  433. }
  434. /*****************************************************************************
  435.  * FUNCTION
  436.  *  mmi_jmms_hint_outbox
  437.  * DESCRIPTION
  438.  *  This is the hint handler of outbox menu item
  439.  * PARAMETERS
  440.  *  index       [IN]        
  441.  * RETURNS
  442.  *  void
  443.  *****************************************************************************/
  444. void mmi_jmms_hint_outbox(U16 index)
  445. {
  446.     /*----------------------------------------------------------------*/
  447.     /* Local Variables                                                */
  448.     /*----------------------------------------------------------------*/
  449.     U8 value[10];
  450.     U8 number = 0;
  451.     JC_RETCODE eRet = JC_OK;
  452.     /*----------------------------------------------------------------*/
  453.     /* Code Body                                                      */
  454.     /*----------------------------------------------------------------*/
  455.     eRet = mmi_mms_get_number_of_messages(MMI_JMMS_OUTBOX, &number);
  456.     if (eRet != JC_OK)
  457.     {
  458.         number = 0;
  459.     }
  460. /* MAUI_00018221 Start */    
  461. memset((PS8) hintData[index], 0, sizeof(hintData[index]));// sanjeev added
  462. sprintf((S8*) value, "%d ", number);
  463.     AnsiiToUnicodeString((S8*) hintData[index], (S8*) value);
  464. pfnUnicodeStrcat((PS8) hintData[index], (S8*) GetString(STR_ID_JMMS_MSGS));
  465. /* MAUI_00018221 End */
  466. }
  467. /*****************************************************************************
  468.  * FUNCTION
  469.  *  mmi_jmms_hint_sent
  470.  * DESCRIPTION
  471.  *  This is the hint handler of sent menu item
  472.  * PARAMETERS
  473.  *  index       [IN]        
  474.  * RETURNS
  475.  *  void
  476.  *****************************************************************************/
  477. void mmi_jmms_hint_sent(U16 index)
  478. {
  479.     /*----------------------------------------------------------------*/
  480.     /* Local Variables                                                */
  481.     /*----------------------------------------------------------------*/
  482.     U8 value[10];
  483.     U8 number = 0;
  484.     JC_RETCODE eRet = JC_OK;
  485.     /*----------------------------------------------------------------*/
  486.     /* Code Body                                                      */
  487.     /*----------------------------------------------------------------*/
  488.     eRet = mmi_mms_get_number_of_messages(MMI_JMMS_SENT, &number);
  489.     if (eRet != JC_OK)
  490.     {
  491.         number = 0;
  492.     }
  493. /* MAUI_00018221 Start */    
  494. memset((PS8) hintData[index], 0, sizeof(hintData[index]));// sanjeev added
  495. sprintf((S8*) value, "%d ", number);
  496.     AnsiiToUnicodeString((S8*) hintData[index], (S8*) value);
  497. pfnUnicodeStrcat((PS8) hintData[index], (S8*) GetString(STR_ID_JMMS_MSGS));
  498. /* MAUI_00018221 End */
  499. }
  500. /*****************************************************************************
  501.  * FUNCTION
  502.  *  mmi_jmms_hint_drafts
  503.  * DESCRIPTION
  504.  *  This is the hint handler of drafts menu item
  505.  * PARAMETERS
  506.  *  index       [IN]        
  507.  * RETURNS
  508.  *  void
  509.  *****************************************************************************/
  510. void mmi_jmms_hint_drafts(U16 index)
  511. {
  512.     /*----------------------------------------------------------------*/
  513.     /* Local Variables                                                */
  514.     /*----------------------------------------------------------------*/
  515.     U8 value[10];
  516.     U8 number = 0;
  517.     JC_RETCODE eRet = JC_OK;
  518.     /*----------------------------------------------------------------*/
  519.     /* Code Body                                                      */
  520.     /*----------------------------------------------------------------*/
  521.     eRet = mmi_mms_get_number_of_messages(MMI_JMMS_DRAFTS, &number);
  522.     if (eRet != JC_OK)
  523.     {
  524.         number = 0;
  525.     }
  526. /* MAUI_00018221 Start */    
  527. memset((PS8) hintData[index], 0, sizeof(hintData[index]));// sanjeev added
  528. sprintf((S8*) value, "%d ", number);
  529.     AnsiiToUnicodeString((S8*) hintData[index], (S8*) value);
  530. pfnUnicodeStrcat((PS8) hintData[index], (S8*) GetString(STR_ID_JMMS_MSGS));
  531. /* MAUI_00018221 End */
  532. }
  533. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  534. /*****************************************************************************
  535.  * FUNCTION
  536.  *  mmi_jmms_folder_list_highlight_hdlr
  537.  * DESCRIPTION
  538.  *  This is the highlight handler menu items of main mms screen
  539.  * PARAMETERS
  540.  *  index       [IN]        
  541.  * RETURNS
  542.  *  void
  543.  *****************************************************************************/
  544. void mmi_jmms_folder_list_highlight_hdlr(S32 index)
  545. {
  546.     /*----------------------------------------------------------------*/
  547.     /* Local Variables                                                */
  548.     /*----------------------------------------------------------------*/
  549.     /*----------------------------------------------------------------*/
  550.     /* Code Body                                                      */
  551.     /*----------------------------------------------------------------*/
  552.     g_jmms_context->nCurr_scr_hilited_index = (U8) index;
  553. }
  554. /*****************************************************************************
  555.  * FUNCTION
  556.  *  mmi_jmms_get_folder_msg_list
  557.  * DESCRIPTION
  558.  *  
  559.  * PARAMETERS
  560.  *  msgs_list           [IN]        
  561.  *  foldername          [?]         [?]         [?]
  562.  *  total_num_msgs      [IN]        
  563.  * RETURNS
  564.  *  
  565.  *****************************************************************************/
  566. JC_RETCODE mmi_jmms_get_folder_msg_list(jmms_folder_msgs_list **msgs_list, S8 *foldername, U8 total_num_msgs)
  567. {
  568.     /*----------------------------------------------------------------*/
  569.     /* Local Variables                                                */
  570.     /*----------------------------------------------------------------*/
  571.     JC_RETCODE eRet = JC_OK;
  572.     RETRIEVE_FILTERS StoreRetFilter = {0, };
  573.     MESSAGE_LIST *pMessageList = NULL;
  574.     MESSAGE_LIST *pTempMsgList = NULL;
  575.     jmms_folder_msgs_list *msgs_list_node = NULL;
  576. #ifdef __MMI_UNIFIED_MESSAGE__
  577.     S32 msg_counter = 0;
  578.     um_jmms_attachment_present_list *temp_pending_list_p = NULL;
  579. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  580.     /*----------------------------------------------------------------*/
  581.     /* Code Body                                                      */
  582.     /*----------------------------------------------------------------*/
  583.     StoreRetFilter.uiStartIndex = g_jmms_context->store_context->jmms_start_index;
  584.     StoreRetFilter.eRetrieve = E_RETRIEVE_BY_INDEX;
  585.     if (g_jmms_context->store_context->jmms_start_index <= total_num_msgs)
  586.     {
  587.         if ((StoreRetFilter.uiStartIndex + NUM_MSGS_IN_ONE_UNIT - 1) < total_num_msgs)
  588.         {
  589.             StoreRetFilter.uiNumMessage = NUM_MSGS_IN_ONE_UNIT;
  590.         }
  591.         else
  592.         {
  593.             StoreRetFilter.uiNumMessage = total_num_msgs - StoreRetFilter.uiStartIndex + 1;
  594.         }
  595.         eRet = mmi_jmms_get_messages_list(foldername, &pTempMsgList, &StoreRetFilter);
  596.         if (eRet != JC_OK || pTempMsgList == NULL)
  597.         {
  598.             return JC_ERR_MEMORY_ALLOCATION;
  599.         }
  600.     }
  601.     pMessageList = pTempMsgList;
  602. #ifdef __MMI_UNIFIED_MESSAGE__
  603.     msg_counter = total_num_msgs;   /* StoreRetFilter.uiStartIndex + StoreRetFilter.uiNumMessage - 1; */
  604. #endif 
  605.     while (pMessageList != NULL)
  606.     {
  607.     #ifdef __MMI_UNIFIED_MESSAGE__
  608.         MMI_BOOL is_parsing_check_required = MMI_FALSE;
  609.     #endif 
  610.         msgs_list_node = (jmms_folder_msgs_list*) jdd_MemAlloc(sizeof(jmms_folder_msgs_list), 1);
  611.         if (msgs_list_node == NULL)
  612.         {
  613.             return JC_ERR_MEMORY_ALLOCATION;
  614.         }
  615.     #ifdef __MMI_UNIFIED_MESSAGE__
  616.         msgs_list_node->um_msg_info = (mmi_um_msg_info_struct*) jdd_MemAlloc(sizeof(mmi_um_msg_info_struct), 1);
  617.         if (msgs_list_node->um_msg_info == NULL)
  618.         {
  619.             mmi_jmms_free_attacment_pending_status_list();
  620.             temp_pending_list_p = NULL;
  621.             return JC_ERR_MEMORY_ALLOCATION;
  622.         }
  623.     #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  624.         switch (pMessageList->pMessageHeaders->eMsgType)
  625.         {
  626.             case E_MSG_TYPE_NOTIFICATION:
  627.             {
  628.                 MESSAGE_NOTIFICATION *notification_p;
  629. #ifndef __MMI_UNIFIED_MESSAGE__
  630.                 S32 len = 0;
  631. #endif
  632.                 notification_p = (MESSAGE_NOTIFICATION*) (pMessageList->pMessageHeaders->pHeaders);
  633.                 msgs_list_node->msg_type = E_MSG_NOTIFICATION;
  634.                 if (notification_p->pSubject == NULL)
  635.                 {
  636.                 #ifdef __MMI_UNIFIED_MESSAGE__
  637.                     mmi_um_jmms_add_mms_sub_for_list_info(
  638.                         &msgs_list_node->um_msg_info,
  639.                         (JC_CHAR*) GetString(STR_ID_NO_SUBJECT),
  640.                         (msg_counter - StoreRetFilter.uiStartIndex));
  641.                 #else /* __MMI_UNIFIED_MESSAGE__ */ 
  642.                     msgs_list_node->subject_as_caption = (S8*) GetString(STR_ID_NO_SUBJECT);
  643.                 #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  644.                 }
  645.                 else
  646.                 {
  647.                 #ifdef __MMI_UNIFIED_MESSAGE__
  648.                     mmi_um_jmms_add_mms_sub_for_list_info(
  649.                         &msgs_list_node->um_msg_info,
  650.                         (JC_CHAR*) (notification_p->pSubject),
  651.                         (msg_counter - StoreRetFilter.uiStartIndex));
  652.                 #else /* __MMI_UNIFIED_MESSAGE__ */ 
  653.                     len = (pfnUnicodeStrlen((S8*) (notification_p->pSubject)) + 1) * ENCODING_LENGTH;
  654.                     if (len > (MAX_SUBJECT_LENGTH * ENCODING_LENGTH))
  655.                     {
  656.                         len = (MAX_SUBJECT_LENGTH + 1) * ENCODING_LENGTH;
  657.                     }
  658.                     msgs_list_node->subject_as_caption = (S8*) jdd_MemAlloc(sizeof(S8), len);
  659.                     if (msgs_list_node->subject_as_caption == NULL)
  660.                     {
  661.                         jdd_MemFree(msgs_list_node);
  662.                         return JC_ERR_MEMORY_ALLOCATION;
  663.                     }
  664.                     memcpy(
  665.                         (S8*) (msgs_list_node->subject_as_caption),
  666.                         (S8*) (notification_p->pSubject),
  667.                         len - ENCODING_LENGTH);
  668.                 #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  669.                 }
  670.             #ifdef __MMI_UNIFIED_MESSAGE__
  671.                 if (notification_p->pFrom != NULL)
  672.                 {
  673.                     mmi_um_jmms_add_mms_address_for_list_info(
  674.                         &msgs_list_node->um_msg_info,
  675.                         notification_p->pFrom,
  676.                         (msg_counter - StoreRetFilter.uiStartIndex));
  677.                 }
  678.                 msgs_list_node->um_msg_info->timestamp = (*notification_p).uiReceivedTime;
  679.                 is_parsing_check_required = MMI_FALSE;
  680.             #else /* __MMI_UNIFIED_MESSAGE__ */ 
  681.                 if (notification_p->pFrom != NULL)
  682.                 {
  683.                     len = (pfnUnicodeStrlen((S8*) (notification_p->pFrom)) + 1) * ENCODING_LENGTH;
  684.                     msgs_list_node->address_as_hint = (S8*) jdd_MemAlloc(sizeof(S8), len);
  685.                     if (msgs_list_node->address_as_hint == NULL)
  686.                     {
  687.                         jdd_MemFree(msgs_list_node);
  688.                         return JC_ERR_MEMORY_ALLOCATION;
  689.                     }
  690.                     memcpy(
  691.                         (S8*) (msgs_list_node->address_as_hint),
  692.                         (S8*) (notification_p->pFrom),
  693.                         len - ENCODING_LENGTH);
  694.                 }
  695.             #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  696.                 break;
  697.             }
  698.             case E_MSG_TYPE_RECEIVE:
  699.             {
  700.                 MESSAGE_RETRIEVAL *retrieval_p;
  701. #ifndef __MMI_UNIFIED_MESSAGE__
  702.                 S32 len = 0;
  703. #endif
  704.                 MMI_BOOL is_java_mms = MMI_FALSE;
  705.                 retrieval_p = (MESSAGE_RETRIEVAL*) (pMessageList->pMessageHeaders->pHeaders);
  706.                 // TODO:: need to test for Java MMS
  707.             #ifdef __MMI_UNIFIED_MESSAGE__
  708.                 if ((pMessageList->uiExtraBytes & 0x00FFFFFF) > 0 &&
  709.                     (pMessageList->uiExtraBytes & 0x00FFFFFF) < MMI_JMMS_MAX_JAVA_MSG_ID)
  710.             #else /* __MMI_UNIFIED_MESSAGE__ */ 
  711.                 if (pMessageList->uiExtraBytes > 0 && pMessageList->uiExtraBytes < MMI_JMMS_MAX_JAVA_MSG_ID)
  712.             #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  713.                 {
  714.                     is_java_mms = MMI_TRUE;
  715.                 }
  716.                 /* is_java_mms = mmi_jsr_is_java_msg(pMessageList->uiExtraBytes); */
  717.                 if (is_java_mms == MMI_TRUE)
  718.                 {
  719.                     msgs_list_node->msg_type = E_MSG_JAVA_MESSAGE;
  720.                 #ifdef __MMI_UNIFIED_MESSAGE__
  721.                     is_parsing_check_required = MMI_FALSE;
  722.                 #endif 
  723.                 }
  724.                 else
  725.                 {
  726.                     msgs_list_node->msg_type = E_MSG_RECEIVE;
  727.                 #ifdef __MMI_UNIFIED_MESSAGE__
  728.                     is_parsing_check_required = MMI_TRUE;
  729.                 #endif 
  730.                 }
  731.             #ifdef __MMI_UNIFIED_MESSAGE__
  732.                 if (retrieval_p->pSubject == NULL)
  733.                 {
  734.                     mmi_um_jmms_add_mms_sub_for_list_info(
  735.                         &msgs_list_node->um_msg_info,
  736.                         (JC_CHAR*) GetString(STR_ID_NO_SUBJECT),
  737.                         (msg_counter - StoreRetFilter.uiStartIndex));
  738.                 }
  739.                 else
  740.                 {
  741.                     mmi_um_jmms_add_mms_sub_for_list_info(
  742.                         &msgs_list_node->um_msg_info,
  743.                         retrieval_p->pSubject,
  744.                         (msg_counter - StoreRetFilter.uiStartIndex));
  745.                 }
  746.             #else /* __MMI_UNIFIED_MESSAGE__ */ 
  747.                 if (retrieval_p->pSubject == NULL)
  748.                 {
  749.                     msgs_list_node->subject_as_caption = (S8*) GetString(STR_ID_NO_SUBJECT);
  750.                 }
  751.                 else
  752.                 {
  753.                     len = (pfnUnicodeStrlen((S8*) (retrieval_p->pSubject)) + 1) * ENCODING_LENGTH;
  754.                     if (len > (MAX_SUBJECT_LENGTH * ENCODING_LENGTH))
  755.                     {
  756.                         len = (MAX_SUBJECT_LENGTH + 1) * ENCODING_LENGTH;
  757.                     }
  758.                     msgs_list_node->subject_as_caption = (S8*) jdd_MemAlloc(sizeof(S8), len);
  759.                     if (msgs_list_node->subject_as_caption == NULL)
  760.                     {
  761.                         jdd_MemFree(msgs_list_node);
  762.                         return JC_ERR_MEMORY_ALLOCATION;
  763.                     }
  764.                     memcpy(
  765.                         (S8*) (msgs_list_node->subject_as_caption),
  766.                         (S8*) (retrieval_p->pSubject),
  767.                         len - ENCODING_LENGTH);
  768.                 }
  769.             #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  770.             #ifdef __MMI_UNIFIED_MESSAGE__
  771.                 if (retrieval_p->pFrom != NULL)
  772.                 {
  773.                     mmi_um_jmms_add_mms_address_for_list_info(
  774.                         &msgs_list_node->um_msg_info,
  775.                         retrieval_p->pFrom,
  776.                         (msg_counter - StoreRetFilter.uiStartIndex));
  777.                 }
  778.                 msgs_list_node->um_msg_info->timestamp = retrieval_p->uiDate;
  779.             #else /* __MMI_UNIFIED_MESSAGE__ */ 
  780.                 if (retrieval_p->pFrom != NULL)
  781.                 {
  782.                     len = (pfnUnicodeStrlen((S8*) (retrieval_p->pFrom)) + 1) * ENCODING_LENGTH;
  783.                     msgs_list_node->address_as_hint = (S8*) jdd_MemAlloc(sizeof(S8), len);
  784.                     if (msgs_list_node->address_as_hint == NULL)
  785.                     {
  786.                         jdd_MemFree(msgs_list_node);
  787.                         return JC_ERR_MEMORY_ALLOCATION;
  788.                     }
  789.                     memcpy(
  790.                         (S8*) (msgs_list_node->address_as_hint),
  791.                         (S8*) (retrieval_p->pFrom),
  792.                         len - ENCODING_LENGTH);
  793.                 }
  794.             #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  795.                 break;
  796.             }
  797.             case E_MSG_TYPE_DELIVERY_REPORT:
  798.             {
  799.             #ifdef __MMI_UNIFIED_MESSAGE__
  800.                 DELIVERY_REPORT *delivery_p;
  801.                 delivery_p = (DELIVERY_REPORT*) (pMessageList->pMessageHeaders->pHeaders);
  802.                 mmi_um_jmms_add_mms_sub_for_list_info(
  803.                     &msgs_list_node->um_msg_info,
  804.                     (JC_CHAR*) GetString(STR_ID_JMMS_DELIVERY_REPORT),
  805.                     (msg_counter - StoreRetFilter.uiStartIndex));
  806.                 msgs_list_node->um_msg_info->timestamp = delivery_p->uiDate;
  807.                 is_parsing_check_required = MMI_FALSE;
  808.             #else /* __MMI_UNIFIED_MESSAGE__ */ 
  809.                 msgs_list_node->subject_as_caption = (S8*) GetString(STR_ID_JMMS_DELIVERY_REPORT);
  810.             #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  811.                 msgs_list_node->msg_type = E_MSG_DELIVERY_REPORT;
  812.                 break;
  813.             }
  814.             case E_MSG_TYPE_READ_REPORT_RESPONSE:
  815.             {
  816.             #ifdef __MMI_UNIFIED_MESSAGE__
  817.                 READ_REPORT_RESPONSE *read_report_p;
  818.                 read_report_p = (READ_REPORT_RESPONSE*) (pMessageList->pMessageHeaders->pHeaders);
  819.                 mmi_um_jmms_add_mms_sub_for_list_info(
  820.                     &msgs_list_node->um_msg_info,
  821.                     (JC_CHAR*) GetString(STR_ID_SETTINGS_READ_REPORT),
  822.                     (msg_counter - StoreRetFilter.uiStartIndex));
  823.                 if (read_report_p->pFrom != NULL)
  824.                 {
  825.                     mmi_um_jmms_add_mms_address_for_list_info(
  826.                         &msgs_list_node->um_msg_info,
  827.                         read_report_p->pFrom,
  828.                         (msg_counter - StoreRetFilter.uiStartIndex));
  829.                 }
  830.                 msgs_list_node->um_msg_info->timestamp = (*read_report_p).uiReceivedTime;
  831.                 is_parsing_check_required = MMI_FALSE;
  832.             #else /* __MMI_UNIFIED_MESSAGE__ */ 
  833.                 msgs_list_node->subject_as_caption = (S8*) GetString(STR_ID_SETTINGS_READ_REPORT);
  834.             #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  835.                 msgs_list_node->msg_type = E_MSG_READ_REPORT;
  836.                 break;
  837.             }
  838.             case E_MSG_TYPE_SEND:
  839.             {
  840.                 MESSAGE_SEND *send_p;
  841. #ifndef __MMI_UNIFIED_MESSAGE__
  842.                 S32 len = 0;
  843. #endif
  844.                 send_p = (MESSAGE_SEND*) (pMessageList->pMessageHeaders->pHeaders);
  845.             #ifdef __MMI_UNIFIED_MESSAGE__
  846.                 if (send_p->pSubject == NULL)
  847.                 {
  848.                     mmi_um_jmms_add_mms_sub_for_list_info(
  849.                         &msgs_list_node->um_msg_info,
  850.                         (JC_CHAR*) GetString(STR_ID_NO_SUBJECT),
  851.                         (msg_counter - StoreRetFilter.uiStartIndex));
  852.                 }
  853.                 else
  854.                 {
  855.                     mmi_um_jmms_add_mms_sub_for_list_info(
  856.                         &msgs_list_node->um_msg_info,
  857.                         send_p->pSubject,
  858.                         (msg_counter - StoreRetFilter.uiStartIndex));
  859.                 }
  860.                 if(send_p->uiDate != 0)
  861.                 {
  862.                     msgs_list_node->um_msg_info->timestamp = send_p->uiDate;
  863.                 }
  864.                else
  865.                 {
  866.                     U32 extra_byte_1 = 0;
  867.                     JC_RETCODE eRet1;
  868.                     msgs_list_node->um_msg_info->timestamp = 0;
  869. // Deepali: PMTSW00004395
  870.                     eRet1 = mmi_jmms_jdi_store_get_extra_byte_1(g_jmms_context->hStoreHandle, (total_num_msgs - (msg_counter - StoreRetFilter.uiStartIndex)), &extra_byte_1);
  871.                     if(eRet1 == JC_OK)
  872.                     {
  873.                         msgs_list_node->um_msg_info->timestamp = extra_byte_1;
  874.                     }
  875.                 }
  876.                 mmi_um_jmms_create_new_mms_hint_for_sent(
  877.                     &msgs_list_node->um_msg_info,
  878.                     send_p->pTo,
  879.                     send_p->pCc,
  880.                     send_p->pBcc,
  881.                     (msg_counter - StoreRetFilter.uiStartIndex));
  882.                 is_parsing_check_required = MMI_TRUE;
  883.             #else /* __MMI_UNIFIED_MESSAGE__ */ 
  884.                 if (send_p->pSubject == NULL)
  885.                 {
  886.                     msgs_list_node->subject_as_caption = (S8*) GetString(STR_ID_NO_SUBJECT);
  887.                 }
  888.                 else
  889.                 {
  890.                     len = (pfnUnicodeStrlen((S8*) (send_p->pSubject)) + 1) * ENCODING_LENGTH;
  891.                     if (len > (MAX_SUBJECT_LENGTH * ENCODING_LENGTH))
  892.                     {
  893.                         len = (MAX_SUBJECT_LENGTH + 1) * ENCODING_LENGTH;
  894.                     }
  895.                     msgs_list_node->subject_as_caption = (S8*) jdd_MemAlloc(sizeof(S8), len);
  896.                     if (msgs_list_node->subject_as_caption == NULL)
  897.                     {
  898.                         jdd_MemFree(msgs_list_node);
  899.                         return JC_ERR_MEMORY_ALLOCATION;
  900.                     }
  901.                     memcpy(
  902.                         (S8*) (msgs_list_node->subject_as_caption),
  903.                         (S8*) (send_p->pSubject),
  904.                         len - ENCODING_LENGTH);
  905.                 }
  906.                 mmi_jmms_create_new_mms_hint(&msgs_list_node, send_p->pTo, send_p->pCc, send_p->pBcc);
  907.             #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  908.                 break;
  909.             }
  910.         }   /* /end of switch */
  911.     #ifdef __MMI_UNIFIED_MESSAGE__
  912.         /* Attachment handling */
  913.         if ((pMessageList->uiExtraBytes) >> 24 == 0 && MMI_TRUE == is_parsing_check_required)
  914.         {
  915.             temp_pending_list_p =
  916.                 (um_jmms_attachment_present_list*) jdd_MemAlloc(sizeof(um_jmms_attachment_present_list), 1);
  917.             if (temp_pending_list_p == NULL)
  918.             {
  919.                 mmi_jmms_free_attacment_pending_status_list();
  920.                 return JC_ERR_MEMORY_ALLOCATION;
  921.             }
  922.             temp_pending_list_p->index_to_parse = msg_counter - StoreRetFilter.uiStartIndex;
  923.             temp_pending_list_p->next = NULL;
  924.             mmi_um_jmms_add_new_node_attachment_pending_list(temp_pending_list_p);
  925.             msgs_list_node->attachment_status = 0;
  926.         }
  927.         else
  928.         {
  929.             if (((*pMessageList).uiExtraBytes) >> 24 == 0 && MMI_FALSE == is_parsing_check_required)
  930.             {
  931.                 msgs_list_node->attachment_status = E_JMMS_ATTACHMENT_NOT_PRESENT;
  932.             }
  933.             else
  934.             {
  935.                 msgs_list_node->attachment_status = ((*pMessageList).uiExtraBytes) >> 24;       /* attachment_status */
  936.             }
  937.         }
  938.         /* Attachment handling End */
  939.         msgs_list_node->um_msg_info->msg_index = msg_counter - StoreRetFilter.uiStartIndex;
  940.         msgs_list_node->msg_index = msgs_list_node->um_msg_info->msg_index;
  941.     #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  942.         if ((*msgs_list) == NULL)
  943.         {
  944.             *msgs_list = msgs_list_node;
  945.             msgs_list_node = NULL;
  946.         }
  947.         else
  948.         {
  949.         #ifdef __MMI_UNIFIED_MESSAGE__
  950.             /* To sort the message list on bases of timestamp */
  951.             if (msgs_list_node->um_msg_info->timestamp > (*msgs_list)->um_msg_info->timestamp)
  952.             {
  953.                 jmms_folder_msgs_list *temp;
  954.                 temp = (*msgs_list);
  955.                 *msgs_list = msgs_list_node;
  956.                 (*msgs_list)->next = temp;
  957.                 msgs_list_node = NULL;
  958.             }
  959.             else
  960.             {
  961.                 jmms_folder_msgs_list *temp_message_list = NULL;
  962.                 jmms_folder_msgs_list *temp = NULL, *prev = NULL;
  963.                 temp_message_list = (*msgs_list);
  964.                 while (temp_message_list != NULL)
  965.                 {
  966.                     if (msgs_list_node->um_msg_info->timestamp > temp_message_list->um_msg_info->timestamp)
  967.                     {
  968.                         break;
  969.                     }
  970.                     prev = temp_message_list;
  971.                     temp_message_list = temp_message_list->next;
  972.                 }
  973.                 temp = temp_message_list;
  974.                 prev->next = msgs_list_node;
  975.                 msgs_list_node->next = temp;
  976.                 msgs_list_node = NULL;
  977.             }
  978.         #else /* __MMI_UNIFIED_MESSAGE__ */ 
  979.             ///implement the link list as stack so that last msg can be shown
  980.             //as first
  981.             jmms_folder_msgs_list *temp;
  982.             temp = (*msgs_list);
  983.             *msgs_list = msgs_list_node;
  984.             (*msgs_list)->next = temp;
  985.             msgs_list_node = NULL;
  986.         #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  987.         }
  988.     #ifdef __MMI_UNIFIED_MESSAGE__
  989.         msg_counter--;
  990.     #endif 
  991.         pMessageList = pMessageList->pNext;
  992.     }
  993.     if ((StoreRetFilter.uiStartIndex + StoreRetFilter.uiNumMessage - 1) >= total_num_msgs)
  994.     {
  995.     #ifndef __MMI_UNIFIED_MESSAGE__
  996.         U16 currScrenID = 0;
  997.         currScrenID = GetActiveScreenId();
  998.         if (currScrenID != SCR_ID_JMMS_GET_MSGS_PROGRESS_SCREEN)
  999.         {
  1000.             if (strcmp((S8*) MMI_JMMS_INBOX, (S8*) foldername) == 0)
  1001.             {
  1002.                 HistoryReplace(SCR_ID_JMMS_GET_MSGS_PROGRESS_SCREEN, SCR_ID_JMMS_INBOX, mmi_jmms_entry_inbox_screen);
  1003.             }
  1004.             else if (strcmp((S8*) MMI_JMMS_OUTBOX, (S8*) foldername) == 0)
  1005.             {
  1006.                 HistoryReplace(SCR_ID_JMMS_GET_MSGS_PROGRESS_SCREEN, SCR_ID_JMMS_OUTBOX, mmi_jmms_entry_outbox_screen);
  1007.             }
  1008.             else if (strcmp((S8*) MMI_JMMS_SENT, (S8*) foldername) == 0)
  1009.             {
  1010.                 HistoryReplace(SCR_ID_JMMS_GET_MSGS_PROGRESS_SCREEN, SCR_ID_JMMS_SENT, mmi_jmms_entry_sent_screen);
  1011.             }
  1012.             else if (strcmp((S8*) MMI_JMMS_DRAFTS, (S8*) foldername) == 0)
  1013.             {
  1014.                 HistoryReplace(SCR_ID_JMMS_GET_MSGS_PROGRESS_SCREEN, SCR_ID_JMMS_DRAFTS, mmi_jmms_entry_drafts_screen);
  1015.             }
  1016.             return eRet;
  1017.         }
  1018.     #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1019.     #ifdef __MMI_UNIFIED_MESSAGE__
  1020.         mmi_um_jmms_folder_list_callback();
  1021.         mmi_um_jmms_set_folder_list_callback_function(mmi_um_jmms_dummy_folder_list_callback);
  1022.     #else /* __MMI_UNIFIED_MESSAGE__ */ 
  1023.         if (strcmp((S8*) MMI_JMMS_INBOX, (S8*) foldername) == 0)
  1024.         {
  1025.             mmi_jmms_entry_inbox_screen();
  1026.         }
  1027.         else if (strcmp((S8*) MMI_JMMS_OUTBOX, (S8*) foldername) == 0)
  1028.         {
  1029.             mmi_jmms_entry_outbox_screen();
  1030.         }
  1031.         else if (strcmp((S8*) MMI_JMMS_SENT, (S8*) foldername) == 0)
  1032.         {
  1033.             mmi_jmms_entry_sent_screen();
  1034.         }
  1035.         else if (strcmp((S8*) MMI_JMMS_DRAFTS, (S8*) foldername) == 0)
  1036.         {
  1037.             mmi_jmms_entry_drafts_screen();
  1038.         }
  1039.     #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1040.         DeleteScreenIfPresent(SCR_ID_JMMS_GET_MSGS_PROGRESS_SCREEN);
  1041.         g_jmms_context->store_context->jmms_start_index = 1;
  1042.     }
  1043.     else
  1044.     {
  1045.         g_jmms_context->store_context->jmms_start_index =
  1046.             g_jmms_context->store_context->jmms_start_index + StoreRetFilter.uiNumMessage;
  1047.         eRet = mmi_jmms_send_get_msg_list_event(foldername, total_num_msgs);
  1048.     }
  1049.     return eRet;
  1050. }
  1051. #ifndef __MMI_UNIFIED_MESSAGE__
  1052. /*****************************************************************************
  1053.  * FUNCTION
  1054.  *  mmi_jmms_create_new_mms_hint
  1055.  * DESCRIPTION
  1056.  *  
  1057.  * PARAMETERS
  1058.  *  node        [IN]        
  1059.  *  to          [?]         [?]         [?]
  1060.  *  cc          [?]         [?]         [?]
  1061.  *  bcc         [?]         [?]         [?]
  1062.  * RETURNS
  1063.  *  void
  1064.  *****************************************************************************/
  1065. void mmi_jmms_create_new_mms_hint(jmms_folder_msgs_list **node, JC_CHAR *to, JC_CHAR *cc, JC_CHAR *bcc)
  1066. {
  1067.     /*----------------------------------------------------------------*/
  1068.     /* Local Variables                                                */
  1069.     /*----------------------------------------------------------------*/
  1070.     S8 *str = NULL;
  1071.     S32 len = 0;
  1072.     S32 start_index = 0;
  1073.     MMI_BOOL is_email = MMI_FALSE;
  1074.     S32 len_to_copy = 0;
  1075.     /*----------------------------------------------------------------*/
  1076.     /* Code Body                                                      */
  1077.     /*----------------------------------------------------------------*/
  1078.     if (to != NULL)
  1079.     {
  1080.         str = (S8*) (to);
  1081.         len = 0;
  1082.         start_index = 0;
  1083.         while (((*str) != ';') && ((*str) != ''))
  1084.         {
  1085.             if ((*str) == '@')
  1086.             {
  1087.                 is_email = MMI_TRUE;
  1088.             }
  1089.             len++;
  1090.             str = str + ENCODING_LENGTH;
  1091.         }
  1092.         if (is_email == MMI_FALSE && len > (MAX_POSSIBLE_NUMBER_LENGHT_SENT))
  1093.         {
  1094.             len_to_copy = MAX_POSSIBLE_NUMBER_LENGHT_SENT;
  1095.         }
  1096.         else if (is_email == MMI_TRUE && len > (MAX_POSSIBLE_EMAIL_LENGHT_SENT))
  1097.         {
  1098.             len_to_copy = MAX_POSSIBLE_EMAIL_LENGHT_SENT;
  1099.         }
  1100.         else
  1101.         {
  1102.             len_to_copy = len;
  1103.         }
  1104.         (*node)->address_as_hint = (S8*) jdd_MemAlloc(sizeof(S8), (len_to_copy + 1) * ENCODING_LENGTH);
  1105.         if ((*node)->address_as_hint == NULL)
  1106.         {
  1107.             goto END;
  1108.         }
  1109.         pfnUnicodeStrncpy((S8*) ((*node)->address_as_hint), (S8*) (to + start_index), len_to_copy);
  1110.         return;
  1111.     }
  1112.     if (cc != NULL)
  1113.     {
  1114.         str = (S8*) (cc);
  1115.         len = 0;
  1116.         start_index = 0;
  1117.         is_email = MMI_FALSE;
  1118.         while (((*str) != ';') && ((*str) != ''))
  1119.         {
  1120.             len++;
  1121.             if ((*str) == '@')
  1122.             {
  1123.                 is_email = MMI_TRUE;
  1124.             }
  1125.             str = str + ENCODING_LENGTH;
  1126.         }
  1127.         if (is_email == MMI_FALSE && len > (MAX_POSSIBLE_NUMBER_LENGHT_SENT))
  1128.         {
  1129.             len_to_copy = MAX_POSSIBLE_NUMBER_LENGHT_SENT;
  1130.         }
  1131.         else if (is_email == MMI_TRUE && len > (MAX_POSSIBLE_EMAIL_LENGHT_SENT))
  1132.         {
  1133.             len_to_copy = MAX_POSSIBLE_EMAIL_LENGHT_SENT;
  1134.         }
  1135.         else
  1136.         {
  1137.             len_to_copy = len;
  1138.         }
  1139.         (*node)->address_as_hint = (S8*) jdd_MemAlloc(sizeof(S8), (len_to_copy + 1) * ENCODING_LENGTH);
  1140.         if ((*node)->address_as_hint == NULL)
  1141.         {
  1142.             goto END;
  1143.         }
  1144.         pfnUnicodeStrncpy((S8*) ((*node)->address_as_hint), (S8*) (cc + start_index), len_to_copy);
  1145.         return;
  1146.     }
  1147.     /* /Make the BCc Addresses list */
  1148.     if (bcc != NULL)
  1149.     {
  1150.         str = (S8*) (bcc);
  1151.         len = 0;
  1152.         start_index = 0;
  1153.         is_email = MMI_FALSE;
  1154.         while (((*str) != ';') && ((*str) != ''))
  1155.         {
  1156.             len++;
  1157.             if ((*str) == '@')
  1158.             {
  1159.                 is_email = MMI_TRUE;
  1160.             }
  1161.             str = str + ENCODING_LENGTH;
  1162.         }
  1163.         if (is_email == MMI_FALSE && len > (MAX_POSSIBLE_NUMBER_LENGHT_SENT))
  1164.         {
  1165.             len_to_copy = MAX_POSSIBLE_NUMBER_LENGHT_SENT;
  1166.         }
  1167.         else if (is_email == MMI_TRUE && len > (MAX_POSSIBLE_EMAIL_LENGHT_SENT))
  1168.         {
  1169.             len_to_copy = MAX_POSSIBLE_EMAIL_LENGHT_SENT;
  1170.         }
  1171.         else
  1172.         {
  1173.             len_to_copy = len;
  1174.         }
  1175.         (*node)->address_as_hint = (S8*) jdd_MemAlloc(sizeof(S8), (len_to_copy + 1) * ENCODING_LENGTH);
  1176.         if ((*node)->address_as_hint == NULL)
  1177.         {
  1178.             goto END;
  1179.         }
  1180.         pfnUnicodeStrncpy((S8*) ((*node)->address_as_hint), (S8*) (bcc + start_index), len_to_copy);
  1181.         return;
  1182.     }
  1183.     return;
  1184.   END:
  1185.     mmi_jmms_free_msgs_list(&(g_jmms_context->store_context->messages_list));
  1186. }
  1187. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1188. #ifdef __MMI_UNIFIED_MESSAGE__
  1189. /*****************************************************************************
  1190.  * FUNCTION
  1191.  *  mmi_jmms_set_msg_type
  1192.  * DESCRIPTION
  1193.  *  
  1194.  * PARAMETERS
  1195.  *  index           [IN]        
  1196.  *  msg_type        [IN]        
  1197.  * RETURNS
  1198.  *  
  1199.  *****************************************************************************/
  1200. U16 mmi_jmms_set_msg_type(U8 index, U16 msg_type)
  1201. {
  1202.     /*----------------------------------------------------------------*/
  1203.     /* Local Variables                                                */
  1204.     /*----------------------------------------------------------------*/
  1205.     jmms_folder_msgs_list *msgs_list_node = NULL;
  1206.     /*----------------------------------------------------------------*/
  1207.     /* Code Body                                                      */
  1208.     /*----------------------------------------------------------------*/
  1209.     msgs_list_node = g_jmms_context->store_context->messages_list;
  1210.     while (msgs_list_node != NULL)
  1211.     {
  1212.         if (msgs_list_node->msg_index == index)
  1213.         {
  1214.             break;
  1215.         }
  1216.         msgs_list_node = msgs_list_node->next;
  1217.     }
  1218.     if (msgs_list_node == NULL)
  1219.     {
  1220.         return E_MSG_UNKNOWN;
  1221.     }
  1222.     msgs_list_node->msg_type = msg_type;
  1223.     return msgs_list_node->msg_type;
  1224. }
  1225. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1226. /*****************************************************************************
  1227.  * FUNCTION
  1228.  *  mmi_jmms_get_msg_type
  1229.  * DESCRIPTION
  1230.  *  
  1231.  * PARAMETERS
  1232.  *  index       [IN]        
  1233.  * RETURNS
  1234.  *  
  1235.  *****************************************************************************/
  1236. U16 mmi_jmms_get_msg_type(U8 index)
  1237. {
  1238.     /*----------------------------------------------------------------*/
  1239.     /* Local Variables                                                */
  1240.     /*----------------------------------------------------------------*/
  1241.     jmms_folder_msgs_list *msgs_list_node = NULL;
  1242. #ifndef __MMI_UNIFIED_MESSAGE__
  1243.     U8 count = 0;
  1244. #endif
  1245.     /*----------------------------------------------------------------*/
  1246.     /* Code Body                                                      */
  1247.     /*----------------------------------------------------------------*/
  1248.     msgs_list_node = g_jmms_context->store_context->messages_list;
  1249. #ifdef __MMI_UNIFIED_MESSAGE__
  1250.     while (msgs_list_node != NULL)
  1251.     {
  1252.         if (msgs_list_node->msg_index == index)
  1253.         {
  1254.             break;
  1255.         }
  1256.         msgs_list_node = msgs_list_node->next;
  1257.     }
  1258. #else /* __MMI_UNIFIED_MESSAGE__ */ 
  1259.     while (count != index && msgs_list_node != NULL)
  1260.     {
  1261.         msgs_list_node = msgs_list_node->next;
  1262.         count++;
  1263.     }
  1264. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1265.     if (msgs_list_node == NULL)
  1266.     {
  1267.         return E_MSG_UNKNOWN;
  1268.     }
  1269.     return msgs_list_node->msg_type;
  1270. }
  1271. /*****************************************************************************
  1272.  * FUNCTION
  1273.  *  mmi_jmms_free_msgs_list
  1274.  * DESCRIPTION
  1275.  *  
  1276.  * PARAMETERS
  1277.  *  msgs_list       [IN]        
  1278.  * RETURNS
  1279.  *  void
  1280.  *****************************************************************************/
  1281. void mmi_jmms_free_msgs_list(jmms_folder_msgs_list **msgs_list)
  1282. {
  1283.     /*----------------------------------------------------------------*/
  1284.     /* Local Variables                                                */
  1285.     /*----------------------------------------------------------------*/
  1286.     jmms_folder_msgs_list *list;
  1287.     jmms_folder_msgs_list *list1;
  1288.     /*----------------------------------------------------------------*/
  1289.     /* Code Body                                                      */
  1290.     /*----------------------------------------------------------------*/
  1291.     list1 = *msgs_list;
  1292.     list = *msgs_list;
  1293.     while (list != NULL)
  1294.     {
  1295.         list1 = list->next;
  1296.     #ifdef __MMI_UNIFIED_MESSAGE__
  1297.         if (list->um_msg_info != NULL)
  1298.         {
  1299.             jdd_MemFree(list->um_msg_info);
  1300.             list->um_msg_info = NULL;
  1301.         }
  1302.     #else /* __MMI_UNIFIED_MESSAGE__ */ 
  1303.         if (list->address_as_hint != NULL)
  1304.         {
  1305.             jdd_MemFree(list->address_as_hint);
  1306.             list->address_as_hint = NULL;
  1307.         }
  1308.     #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1309.         /* nedd to strcmp all static subjects, Don't call jdd_memfree for them */
  1310.     #ifndef __MMI_UNIFIED_MESSAGE__
  1311.         if (list->subject_as_caption != NULL
  1312.             && (pfnUnicodeStrcmp((S8*) (list->subject_as_caption), (S8*) GetString(STR_ID_NO_SUBJECT)) != 0)
  1313.             && (pfnUnicodeStrcmp((S8*) (list->subject_as_caption), (S8*) GetString(STR_ID_JMMS_DELIVERY_REPORT))
  1314.                 != 0) &&
  1315.             (pfnUnicodeStrcmp((S8*) (list->subject_as_caption), (S8*) GetString(STR_ID_SETTINGS_READ_REPORT)) != 0))
  1316.         {
  1317.             jdd_MemFree(list->subject_as_caption);
  1318.             list->subject_as_caption = NULL;
  1319.         }
  1320.     #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1321.         jdd_MemFree(list);
  1322.         list = NULL;
  1323.         list = list1;
  1324.     }
  1325.     *msgs_list = NULL;
  1326. }
  1327. #ifndef __MMI_UNIFIED_MESSAGE__
  1328. /*****************************************************************************
  1329.  * FUNCTION
  1330.  *  mmi_jmms_back_from_msgs_list_screen
  1331.  * DESCRIPTION
  1332.  *  
  1333.  * PARAMETERS
  1334.  *  void
  1335.  * RETURNS
  1336.  *  void
  1337.  *****************************************************************************/
  1338. void mmi_jmms_back_from_msgs_list_screen(void)
  1339. {
  1340.     /*----------------------------------------------------------------*/
  1341.     /* Local Variables                                                */
  1342.     /*----------------------------------------------------------------*/
  1343.     /*----------------------------------------------------------------*/
  1344.     /* Code Body                                                      */
  1345.     /*----------------------------------------------------------------*/
  1346.     mmi_jmms_free_msgs_list(&(g_jmms_context->store_context->messages_list));
  1347.     GoBackToHistory(SCR_ID_JMMS_MAIN_MENU);
  1348. }
  1349. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1350. /*****************************************************************************
  1351.  * FUNCTION
  1352.  *  mmi_jmms_deinit
  1353.  * DESCRIPTION
  1354.  *  
  1355.  * PARAMETERS
  1356.  *  void
  1357.  * RETURNS
  1358.  *  void
  1359.  *****************************************************************************/
  1360. void mmi_jmms_deinit(void)
  1361. {
  1362.     /*----------------------------------------------------------------*/
  1363.     /* Local Variables                                                */
  1364.     /*----------------------------------------------------------------*/
  1365.     /*----------------------------------------------------------------*/
  1366.     /* Code Body                                                      */
  1367.     /*----------------------------------------------------------------*/
  1368.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_deinit Enter"));
  1369.     if (g_jmms_context != NULL)
  1370.     {
  1371.         if(!jmms_is_ready()) 
  1372.         {
  1373.             return;
  1374.         }
  1375.         mmi_jmms_parse_continue_stop_timer();
  1376.         mmi_jmms_deinit_view();
  1377.         mmi_jmms_end_comm();
  1378.         mmi_jmms_deinit_mms_context(g_jmms_context);
  1379.         StopTimer(JMMS_ASYNC_SEND_TIMER);
  1380.         StopTimer(JMMS_ASYNC_SAVE_TIMER);
  1381.         mmi_jmms_clean_send_callback_list();
  1382.         mmi_jmms_clean_save_callback_list();
  1383.         if (g_jmms_context->orig_file_name_replace_mms)
  1384.         {
  1385.             jdd_MemFree(g_jmms_context->orig_file_name_replace_mms);
  1386.             g_jmms_context->orig_file_name_replace_mms = NULL;
  1387.         }
  1388.         if (g_jmms_context->store_context != NULL && g_jmms_context->store_context->messages_list != NULL)
  1389.         {
  1390.             mmi_jmms_free_msgs_list(&(g_jmms_context->store_context->messages_list));
  1391.         }
  1392.         mmi_jmms_free_use_details_adrresses_list();
  1393.         /* free msg headers- properties */
  1394.         mmi_jmms_free_recieved_msg_header();
  1395.         mmi_jmms_free_notification_header();
  1396.         mmi_jmms_free_delivery_report_header();
  1397.         mmi_jmms_free_report_report_header();
  1398.         mmi_jmms_free_new_mms_sent_header();
  1399.         /* reset the open msg status- for At delete */
  1400.         g_jmms_context->msg_open_status[0] = 0;
  1401.         g_jmms_context->msg_open_status[1] = 0;
  1402.         g_jmms_context->is_add_media_warning = 0;
  1403. g_jmms_context->progress_screen_in_history=0;
  1404.     }
  1405.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_deinit Exit"));
  1406. }
  1407. /*****************************************************************************
  1408.  * FUNCTION
  1409.  *  mmi_jmms_send_get_msg_list_event
  1410.  * DESCRIPTION
  1411.  *  
  1412.  * PARAMETERS
  1413.  *  foldername          [?]         [?]         [?]
  1414.  *  total_num_msgs      [IN]        
  1415.  * RETURNS
  1416.  *  
  1417.  *****************************************************************************/
  1418. JC_RETCODE mmi_jmms_send_get_msg_list_event(S8 *foldername, U8 total_num_msgs)
  1419. {
  1420.     /*----------------------------------------------------------------*/
  1421.     /* Local Variables                                                */
  1422.     /*----------------------------------------------------------------*/
  1423.     JC_RETCODE eRet = JC_OK;
  1424.     JC_EVENT_DATA eventData = {0, };
  1425.     mmi_jmms_get_msg_list_queue_event_struct folder_info = {0, };
  1426.     /*----------------------------------------------------------------*/
  1427.     /* Code Body                                                      */
  1428.     /*----------------------------------------------------------------*/
  1429.     eventData.destTaskInfo.iAppID = E_TASK_MMS_UI;
  1430.     eventData.destTaskInfo.iTaskID = E_TASK_MMS_UI;
  1431.     eventData.srcTaskInfo.iAppID = E_TASK_MMS_UI;
  1432.     eventData.srcTaskInfo.iTaskID = E_TASK_MMS_UI;
  1433.     eventData.uiEventInfoSize = sizeof(mmi_jmms_get_msg_list_queue_event_struct);
  1434.     eventData.iEventType = E_MMS_GET_MSG_LIST_EVENT;
  1435.     if (strcmp((S8*) "Inbox", (S8*) foldername) == 0)
  1436.     {
  1437.         folder_info.folder_name = E_JMMS_INBOX;
  1438.     }
  1439.     else if (strcmp((S8*) "Outbox", (S8*) foldername) == 0)
  1440.     {
  1441.         folder_info.folder_name = E_JMMS_OUTBOX;
  1442.     }
  1443.     else if (strcmp((S8*) "Sent", (S8*) foldername) == 0)
  1444.     {
  1445.         folder_info.folder_name = E_JMMS_SENT;
  1446.     }
  1447.     else if (strcmp((S8*) "Drafts", (S8*) foldername) == 0)
  1448.     {
  1449.         folder_info.folder_name = E_JMMS_DRAFTS;
  1450.     }
  1451.     folder_info.total_num_msgs = total_num_msgs;
  1452.     eRet = jdd_QueueAlloc(&eventData);
  1453.     if (JC_OK != eRet)
  1454.     {
  1455.         return eRet;
  1456.     }
  1457.     jc_memcpy(eventData.pEventInfo, &folder_info, sizeof(mmi_jmms_get_msg_list_queue_event_struct));
  1458.     eRet = jdd_QueueSend(&eventData);
  1459.     if (JC_OK != eRet)
  1460.     {
  1461.         return eRet;
  1462.     }
  1463.     return eRet;
  1464. }
  1465. /*****************************************************************************
  1466.  * FUNCTION
  1467.  *  mmi_jmms_recieve_get_msg_list_event
  1468.  * DESCRIPTION
  1469.  *  
  1470.  * PARAMETERS
  1471.  *  pEventData      [?]     [?]     [?]
  1472.  * RETURNS
  1473.  *  void
  1474.  *****************************************************************************/
  1475. void mmi_jmms_recieve_get_msg_list_event(mmi_jmms_get_msg_list_queue_event_struct *pEventData)
  1476. {
  1477.     /*----------------------------------------------------------------*/
  1478.     /* Local Variables                                                */
  1479.     /*----------------------------------------------------------------*/
  1480.     mmi_jmms_get_msg_list_queue_event_struct *folder_info;
  1481.     JC_RETCODE eRet = JC_OK;
  1482.     U16 currScrenID = 0;
  1483.     /*----------------------------------------------------------------*/
  1484.     /* Code Body                                                      */
  1485.     /*----------------------------------------------------------------*/
  1486.     folder_info = (mmi_jmms_get_msg_list_queue_event_struct*) (pEventData);
  1487.     if (folder_info->folder_name == E_JMMS_INBOX)
  1488.     {
  1489.         eRet = mmi_jmms_get_folder_msg_list(
  1490.                 &(g_jmms_context->store_context->messages_list),
  1491.                 MMI_JMMS_INBOX,
  1492.                 folder_info->total_num_msgs);
  1493.     }
  1494.     else if (folder_info->folder_name == E_JMMS_OUTBOX)
  1495.     {
  1496.         eRet = mmi_jmms_get_folder_msg_list(
  1497.                 &(g_jmms_context->store_context->messages_list),
  1498.                 MMI_JMMS_OUTBOX,
  1499.                 folder_info->total_num_msgs);
  1500.     }
  1501.     else if (folder_info->folder_name == E_JMMS_DRAFTS)
  1502.     {
  1503.         eRet = mmi_jmms_get_folder_msg_list(
  1504.                 &(g_jmms_context->store_context->messages_list),
  1505.                 MMI_JMMS_DRAFTS,
  1506.                 folder_info->total_num_msgs);
  1507.     }
  1508.     else if (folder_info->folder_name == E_JMMS_SENT)
  1509.     {
  1510.         eRet = mmi_jmms_get_folder_msg_list(
  1511.                 &(g_jmms_context->store_context->messages_list),
  1512.                 MMI_JMMS_SENT,
  1513.                 folder_info->total_num_msgs);
  1514.     }
  1515.     if (eRet != JC_OK)
  1516.     {
  1517.         currScrenID = GetActiveScreenId();
  1518.         mmi_jmms_free_msgs_list(&(g_jmms_context->store_context->messages_list));
  1519.     #ifndef __MMI_UNIFIED_MESSAGE__
  1520.         if (currScrenID == SCR_ID_JMMS_GET_MSGS_PROGRESS_SCREEN)
  1521.         {
  1522.             DisplayPopup(
  1523.                 (U8*) GetString(STR_ID_JMMS_ERROR_GET_MSG_LIST),
  1524.                 IMG_GLOBAL_ERROR,
  1525.                 1,
  1526.                 JMMS_POPUP_TIME,
  1527.                 (U8) ERROR_TONE);
  1528.             DeleteUptoScrID(SCR_ID_JMMS_MAIN_MENU);
  1529.         }
  1530.         else
  1531.         {
  1532.             /* to avoid the show of pop up over Phone call or some other screen */
  1533.             HistoryReplace(
  1534.                 SCR_ID_JMMS_GET_MSGS_PROGRESS_SCREEN,
  1535.                 SCR_ID_JMMS_GET_MSGS_ERROR_SCREEN,
  1536.                 mmi_jmms_entry_msgs_get_error_screen);
  1537.         }
  1538.     #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1539.     }
  1540.     return;
  1541. }
  1542. #ifndef __MMI_UNIFIED_MESSAGE__
  1543. /*****************************************************************************
  1544.  * FUNCTION
  1545.  *  mmi_jmms_entry_get_msgs_progress_screen
  1546.  * DESCRIPTION
  1547.  *  
  1548.  * PARAMETERS
  1549.  *  void
  1550.  * RETURNS
  1551.  *  void
  1552.  *****************************************************************************/
  1553. void mmi_jmms_entry_get_msgs_progress_screen(void)
  1554. {
  1555.     /*----------------------------------------------------------------*/
  1556.     /* Local Variables                                                */
  1557.     /*----------------------------------------------------------------*/
  1558.     /*----------------------------------------------------------------*/
  1559.     /* Code Body                                                      */
  1560.     /*----------------------------------------------------------------*/
  1561.     EntryNewScreen(SCR_ID_JMMS_GET_MSGS_PROGRESS_SCREEN, NULL, mmi_jmms_entry_get_msgs_progress_screen, NULL);
  1562.     // TODO::put an animated image
  1563.     ShowCategory8Screen(
  1564.         STR_MMS_MENUENTRY,
  1565.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  1566.         0,
  1567.         0,
  1568.         0,
  1569.         0,
  1570.         STR_ID_JMMS_LOADING_MMS,
  1571.         IMG_GLOBAL_PROGRESS,
  1572.         NULL);
  1573.     ClearAllKeyHandler();
  1574.     ClearKeyHandler(KEY_END, KEY_EVENT_UP);
  1575.     ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  1576.     ClearKeyHandler(KEY_END, KEY_LONG_PRESS);
  1577.     ClearKeyHandler(KEY_END, KEY_REPEAT);
  1578. }
  1579. /*****************************************************************************
  1580.  * FUNCTION
  1581.  *  mmi_jmms_entry_msgs_get_error_screen
  1582.  * DESCRIPTION
  1583.  *  
  1584.  * PARAMETERS
  1585.  *  void
  1586.  * RETURNS
  1587.  *  void
  1588.  *****************************************************************************/
  1589. void mmi_jmms_entry_msgs_get_error_screen(void)
  1590. {
  1591.     /*----------------------------------------------------------------*/
  1592.     /* Local Variables                                                */
  1593.     /*----------------------------------------------------------------*/
  1594.     /*----------------------------------------------------------------*/
  1595.     /* Code Body                                                      */
  1596.     /*----------------------------------------------------------------*/
  1597.     EntryNewScreen(SCR_ID_JMMS_GET_MSGS_ERROR_SCREEN, NULL, mmi_jmms_entry_msgs_get_error_screen, NULL);
  1598.     ShowCategory2Screen(
  1599.         STR_MMS_MENUENTRY,
  1600.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  1601.         0,
  1602.         0,
  1603.         STR_GLOBAL_BACK,
  1604.         IMG_GLOBAL_BACK,
  1605.         STR_ID_JMMS_ERROR_GET_MSG_LIST,
  1606.         NULL);
  1607.     SetRightSoftkeyFunction(mmi_jmms_back_from_msgs_list_screen, KEY_EVENT_UP);
  1608. }
  1609. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1610. //PMT VIKAS START 20060325
  1611. //Function store and return the size of MMS base on type pass
  1612. /*****************************************************************************
  1613.  * FUNCTION
  1614.  *  mmi_jmms_save_size_of_mms
  1615.  * DESCRIPTION
  1616.  *  
  1617.  * PARAMETERS
  1618.  *  temp_size       [?]         [?]         [?]
  1619.  *  type            [IN]        
  1620.  * RETURNS
  1621.  *  void
  1622.  *****************************************************************************/
  1623. static void mmi_jmms_save_size_of_mms(S32 *temp_size, S32 type)
  1624. {
  1625.     /*----------------------------------------------------------------*/
  1626.     /* Local Variables                                                */
  1627.     /*----------------------------------------------------------------*/
  1628.     static S32 message_size = 0;
  1629.     /*----------------------------------------------------------------*/
  1630.     /* Code Body                                                      */
  1631.     /*----------------------------------------------------------------*/
  1632.     if (type == MMS_SIZE_STORE)
  1633.     {
  1634.         message_size = *temp_size;
  1635.     }
  1636.     else
  1637.     {
  1638.         *temp_size = message_size;
  1639.     }
  1640. }
  1641. /* PMT VIKAS END 20060325 */
  1642. /*****************************************************************************
  1643.  * FUNCTION
  1644.  *  mmi_jmms_show_mms_properties
  1645.  * DESCRIPTION
  1646.  *  
  1647.  * PARAMETERS
  1648.  *  msg_type        [IN]        
  1649.  *  folder_name     [?]         [?]         [?]
  1650.  * RETURNS
  1651.  *  void
  1652.  *****************************************************************************/
  1653. void mmi_jmms_show_mms_properties(U16 msg_type, S8 *folder_name)
  1654. {
  1655.     /*----------------------------------------------------------------*/
  1656.     /* Local Variables                                                */
  1657.     /*----------------------------------------------------------------*/
  1658.     JC_RETCODE eRet = JC_OK;
  1659.     U8 number = 0;
  1660.     RETRIEVE_FILTERS StoreRetFilter = {0, };
  1661.     MESSAGE_LIST *pMessageList = NULL;
  1662.     MESSAGE_LIST *pTempMessageList = NULL;
  1663.     U32 extra_byte_1 = 0;
  1664.     /*----------------------------------------------------------------*/
  1665.     /* Code Body                                                      */
  1666.     /*----------------------------------------------------------------*/
  1667.     /* mmi_mms_get_number_of_messages(folder_name, &number); */
  1668. number = g_jmms_context->store_context->nMsgs_in_Current_folder;
  1669.     if(strcmp((S8*)folder_name, (S8*)MMI_JMMS_TEMPLATES) == 0)
  1670.     {
  1671.         StoreRetFilter.uiStartIndex = g_jmms_context->nCurr_scr_hilited_index + 1;
  1672.     }
  1673.     else
  1674.     {
  1675.         StoreRetFilter.uiStartIndex = number - g_jmms_context->nCurr_scr_hilited_index;
  1676.     }
  1677.     StoreRetFilter.eRetrieve = E_RETRIEVE_BY_INDEX;
  1678.     StoreRetFilter.uiNumMessage = 1;
  1679.     eRet = mmi_jmms_get_messages_list(folder_name, &pTempMessageList, &StoreRetFilter);
  1680.     pMessageList = pTempMessageList;
  1681.     if (eRet != JC_OK || pMessageList == NULL)
  1682.     {
  1683.         mmi_jmms_error_handler(eRet);
  1684.         return;
  1685.     }
  1686.     /* PMT VIKAS START 20060325 */
  1687.     mmi_jmms_save_size_of_mms((S32*) & pMessageList->uiBufferLen, MMS_SIZE_STORE);
  1688.     /* PMT VIKAS END 20060325 */
  1689.     switch (msg_type)
  1690.     {
  1691.         case E_MSG_NOTIFICATION:
  1692.             if (pMessageList->pMessageHeaders->eMsgType != E_MSG_TYPE_NOTIFICATION)
  1693.             {
  1694.                 DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  1695.                 return;
  1696.             }
  1697.             /* g_jmms_context->MsgHeader_type_p=(MESSAGE_NOTIFICATION *)(pMessageList->pMessageHeaders->pHeaders); */
  1698.             eRet = mmi_jmms_create_notification_header(pMessageList->pMessageHeaders->pHeaders);
  1699.             if (eRet != JC_OK)
  1700.             {
  1701.                 mmi_jmms_error_handler(eRet);
  1702.                 return;
  1703.             }
  1704.             mmi_jmms_show_notification_properties();
  1705.             /* /g_jmms_context->MsgHeader_type_p=NULL; */
  1706.             break;
  1707.         case E_MSG_RECEIVE:
  1708.             if (pMessageList->pMessageHeaders->eMsgType != E_MSG_TYPE_RECEIVE)
  1709.             {
  1710.                 DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  1711.                 return;
  1712.             }
  1713.             /* /g_jmms_context->MsgHeader_type_p=(MESSAGE_RETRIEVAL *)(pMessageList->pMessageHeaders->pHeaders); */
  1714.             eRet = mmi_jmms_create_recieved_msg_header(pMessageList->pMessageHeaders->pHeaders);
  1715.             if (eRet != JC_OK)
  1716.             {
  1717.                 mmi_jmms_error_handler(eRet);
  1718.                 return;
  1719.             }
  1720.             mmi_jmms_show_retrieved_mms_properties();
  1721.             /* /g_jmms_context->MsgHeader_type_p=NULL; */
  1722.             break;
  1723.         case E_MSG_JAVA_MESSAGE:
  1724.         {
  1725.             JC_RETCODE eRet = JC_OK;
  1726.             CONTENT_DATA Content = {0, };
  1727.             if (pMessageList->pMessageHeaders->eMsgType != E_MSG_TYPE_RECEIVE)
  1728.             {
  1729.                 DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  1730.                 return;
  1731.             }
  1732.             Content.bIsStream = E_TRUE;
  1733.             eRet = mmi_jmms_get_message("Inbox", &Content, StoreRetFilter.uiStartIndex);
  1734.             if (eRet != JC_OK)
  1735.             {
  1736.                 goto CaseEnd;
  1737.             }
  1738.         #ifdef __MMI_UNIFIED_MESSAGE__
  1739.             if (g_jmms_context->msg_handle)
  1740.             {
  1741.                 eRet = mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  1742.                 g_jmms_context->msg_handle = NULL;
  1743.             }
  1744.         #else /* __MMI_UNIFIED_MESSAGE__ */ 
  1745.             mmi_jmms_deinit_mms_context(g_jmms_context);
  1746.         #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1747.             eRet = mmi_jmms_jdi_parse_msg_buffer(&g_jmms_context->msg_handle, &Content, E_TYPE_MMS, E_FALSE);
  1748.             /* Async changes begin */
  1749.             while (eRet == JC_ERR_MMS_PARSE_PENDING)
  1750.             {
  1751.                 eRet = mmi_jmms_jdi_msg_parse_continue(g_jmms_context->msg_handle);
  1752.             };
  1753.             /* Async changes end */
  1754.             if (eRet != JC_OK)
  1755.             {
  1756.                 goto CaseEnd;
  1757.             }
  1758.             eRet = mmi_jmms_jdi_get_msg_headers(
  1759.                     g_jmms_context->msg_handle,
  1760.                     (MESSAGE_HEADERS **) (&(g_jmms_context->MsgHeaders_p)));
  1761.             if (JC_OK != eRet)
  1762.             {
  1763.                 goto CaseEnd;
  1764.             }
  1765.             g_jmms_context->MsgHeader_type_p =
  1766.                 (MESSAGE_RETRIEVAL*) ((MESSAGE_HEADERS*) g_jmms_context->MsgHeaders_p)->pHeaders;
  1767.             /* umesh end */
  1768.             mmi_jmms_entry_java_mms_properties();
  1769.           CaseEnd:
  1770.             if (Content.pFileName != NULL)
  1771.             {
  1772.                 jdd_MemFree(Content.pFileName);
  1773.                 Content.pFileName = NULL;
  1774.             }
  1775.             if (eRet != JC_OK)
  1776.             {
  1777.                 DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  1778.                 mmi_jmms_deinit_mms_context(g_jmms_context);
  1779.             }
  1780.             break;
  1781.         }
  1782.         case E_MSG_DELIVERY_REPORT:
  1783.             mmi_jmms_update_status_icon_indicator();
  1784.             if (pMessageList->pMessageHeaders->eMsgType != E_MSG_TYPE_DELIVERY_REPORT)
  1785.             {
  1786.                 DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  1787.                 return;
  1788.             }
  1789.             /* g_jmms_context->MsgHeader_type_p=(DELIVERY_REPORT *)(pMessageList->pMessageHeaders->pHeaders); */
  1790.             eRet = mmi_jmms_create_delivery_report_header(pMessageList->pMessageHeaders->pHeaders);
  1791.             if (eRet != JC_OK)
  1792.             {
  1793.                 mmi_jmms_error_handler(eRet);
  1794.                 return;
  1795.             }
  1796.             mmi_jmms_entry_view_delivery_report();
  1797.             /* /g_jmms_context->MsgHeader_type_p=NULL; */
  1798.             break;
  1799.         case E_MSG_READ_REPORT:
  1800.             mmi_jmms_update_status_icon_indicator();
  1801.             if (pMessageList->pMessageHeaders->eMsgType != E_MSG_TYPE_READ_REPORT_RESPONSE)
  1802.             {
  1803.                 DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  1804.                 return;
  1805.             }
  1806.             /* /g_jmms_context->MsgHeader_type_p=(READ_REPORT_RESPONSE *)(pMessageList->pMessageHeaders->pHeaders); */
  1807.             eRet = mmi_jmms_create_read_report_header(pMessageList->pMessageHeaders->pHeaders);
  1808.             if (eRet != JC_OK)
  1809.             {
  1810.                 mmi_jmms_error_handler(eRet);
  1811.                 return;
  1812.             }
  1813.             mmi_jmms_entry_view_read_report();
  1814.             /* /g_jmms_context->MsgHeader_type_p=NULL; */
  1815.             break;
  1816.         case E_MSG_NEW_MMS_SEND:
  1817.         {
  1818.             if (pMessageList->pMessageHeaders->eMsgType != E_MSG_TYPE_SEND)
  1819.             {
  1820.                 DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  1821.                 return;
  1822.             }
  1823.             /* /g_jmms_context->MsgHeader_type_p=(MESSAGE_SEND *)(pMessageList->pMessageHeaders->pHeaders); */
  1824.             eRet = mmi_jmms_create_new_mms_sent_header(pMessageList->pMessageHeaders->pHeaders);
  1825.             if (eRet != JC_OK)
  1826.             {
  1827.                 mmi_jmms_error_handler(eRet);
  1828.                 return;
  1829.             }
  1830.             if(g_jmms_context->msg_handle && ((MESSAGING_HANDLER *)g_jmms_context->msg_handle)->mms_file_handle)
  1831.             {
  1832.                 mmi_jmms_jdi_store_get_extra_byte_open_mms(g_jmms_context->hStoreHandle, ((MESSAGING_HANDLER *)g_jmms_context->msg_handle)->mms_file_handle, &extra_byte_1);
  1833.             }
  1834.             else
  1835.             {
  1836.                 mmi_jmms_jdi_store_get_extra_byte_1(g_jmms_context->hStoreHandle, StoreRetFilter.uiStartIndex, &extra_byte_1);                
  1837.             }
  1838.             if (((MESSAGE_SEND*) (g_jmms_context->send_msg_p))->uiDate == 0)
  1839.             {
  1840.                 ((MESSAGE_SEND*) (g_jmms_context->send_msg_p))->uiDate = extra_byte_1;
  1841.             }
  1842.             mmi_jmms_entry_new_mms_sent_properties();
  1843.             /* /g_jmms_context->MsgHeader_type_p=NULL; */
  1844.             break;
  1845.         }
  1846.         case E_MSG_NEW_MMS_TEMPLATES:
  1847.         {
  1848.             if (pMessageList->pMessageHeaders->eMsgType != E_MSG_TYPE_SEND)
  1849.             {
  1850.                 DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  1851.                 return;
  1852.             }
  1853.             /* /g_jmms_context->MsgHeader_type_p=(MESSAGE_SEND *)(pMessageList->pMessageHeaders->pHeaders); */
  1854.             eRet = mmi_jmms_create_new_mms_sent_header(pMessageList->pMessageHeaders->pHeaders);
  1855.             if (eRet != JC_OK)
  1856.             {
  1857.                 mmi_jmms_error_handler(eRet);
  1858.                 return;
  1859.             }
  1860.             mmi_jmms_entry_new_mms_template_properties();
  1861.             /* /g_jmms_context->MsgHeader_type_p=NULL; */
  1862.             break;
  1863.         }
  1864.         default:
  1865.             DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  1866.             return;
  1867.     }
  1868. }
  1869. /*****************************************************************************
  1870.  * FUNCTION
  1871.  *  mmi_jmms_create_new_mms_sent_header
  1872.  * DESCRIPTION
  1873.  *  
  1874.  * PARAMETERS
  1875.  *  send_msg_header     [?]     [?]     [?]
  1876.  * RETURNS
  1877.  *  
  1878.  *****************************************************************************/
  1879. JC_RETCODE mmi_jmms_create_new_mms_sent_header(MESSAGE_SEND *send_msg_header)
  1880. {
  1881.     /*----------------------------------------------------------------*/
  1882.     /* Local Variables                                                */
  1883.     /*----------------------------------------------------------------*/
  1884.     MESSAGE_SEND *send_msg_p = NULL;
  1885.     JC_RETCODE eRet = JC_OK;
  1886.     /*----------------------------------------------------------------*/
  1887.     /* Code Body                                                      */
  1888.     /*----------------------------------------------------------------*/
  1889.     send_msg_p = (MESSAGE_SEND*) jdd_MemAlloc(sizeof(MESSAGE_SEND), 1);
  1890.     if (send_msg_p == NULL)
  1891.     {
  1892.         eRet = JC_ERR_MEMORY_ALLOCATION;
  1893.         goto ERROR_HANDLE;
  1894.     }
  1895.     if (send_msg_header->pTo != NULL)
  1896.     {
  1897.         send_msg_p->pTo = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), jc_tcslen(send_msg_header->pTo) + 1);
  1898.         if (send_msg_p->pTo == NULL)
  1899.         {
  1900.             eRet = JC_ERR_MEMORY_ALLOCATION;
  1901.             goto ERROR_HANDLE;
  1902.         }
  1903.         jc_tcscpy(send_msg_p->pTo, send_msg_header->pTo);
  1904.     }
  1905.     if (send_msg_header->pCc != NULL)
  1906.     {
  1907.         send_msg_p->pCc = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), jc_tcslen(send_msg_header->pCc) + 1);
  1908.         if (send_msg_p->pCc == NULL)
  1909.         {
  1910.             eRet = JC_ERR_MEMORY_ALLOCATION;
  1911.             goto ERROR_HANDLE;
  1912.         }
  1913.         jc_tcscpy(send_msg_p->pCc, send_msg_header->pCc);
  1914.     }
  1915.     if (send_msg_header->pBcc != NULL)
  1916.     {
  1917.         send_msg_p->pBcc = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), jc_tcslen(send_msg_header->pBcc) + 1);
  1918.         if (send_msg_p->pBcc == NULL)
  1919.         {
  1920.             eRet = JC_ERR_MEMORY_ALLOCATION;
  1921.             goto ERROR_HANDLE;
  1922.         }
  1923.         jc_tcscpy(send_msg_p->pBcc, send_msg_header->pBcc);
  1924.     }
  1925.     if (send_msg_header->pSubject != NULL)
  1926.     {
  1927.         send_msg_p->pSubject = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), jc_tcslen(send_msg_header->pSubject) + 1);
  1928.         if (send_msg_p->pSubject == NULL)
  1929.         {
  1930.             eRet = JC_ERR_MEMORY_ALLOCATION;
  1931.             goto ERROR_HANDLE;
  1932.         }
  1933.         jc_tcscpy(send_msg_p->pSubject, send_msg_header->pSubject);
  1934.     }
  1935.     send_msg_p->eMsgPriority = send_msg_header->eMsgPriority;
  1936.     send_msg_p->eMsgClass = send_msg_header->eMsgClass;
  1937.     send_msg_p->uiDate = send_msg_header->uiDate;
  1938.     g_jmms_context->send_msg_p = (MESSAGE_SEND*) (send_msg_p);
  1939.   ERROR_HANDLE:
  1940.     if (eRet != JC_OK && send_msg_p != NULL)
  1941.     {
  1942.         mmi_jmms_free_new_mms_sent_header();
  1943.     }
  1944.     return eRet;
  1945. }
  1946. /*****************************************************************************
  1947.  * FUNCTION
  1948.  *  mmi_jmms_free_new_mms_sent_header
  1949.  * DESCRIPTION
  1950.  *  
  1951.  * PARAMETERS
  1952.  *  void
  1953.  * RETURNS
  1954.  *  void
  1955.  *****************************************************************************/
  1956. void mmi_jmms_free_new_mms_sent_header(void)
  1957. {
  1958.     /*----------------------------------------------------------------*/
  1959.     /* Local Variables                                                */
  1960.     /*----------------------------------------------------------------*/
  1961.     MESSAGE_SEND *send_msg_p = NULL;
  1962.     /*----------------------------------------------------------------*/
  1963.     /* Code Body                                                      */
  1964.     /*----------------------------------------------------------------*/
  1965.     send_msg_p = (MESSAGE_SEND*) g_jmms_context->send_msg_p;
  1966.     if (send_msg_p == NULL)
  1967.     {
  1968.         return;
  1969.     }
  1970.     if (send_msg_p->pTo != NULL)
  1971.     {
  1972.         jdd_MemFree(send_msg_p->pTo);
  1973.         send_msg_p->pTo = NULL;
  1974.     }
  1975.     if (send_msg_p->pCc != NULL)
  1976.     {
  1977.         jdd_MemFree(send_msg_p->pCc);
  1978.         send_msg_p->pCc = NULL;
  1979.     }
  1980.     if (send_msg_p->pBcc != NULL)
  1981.     {
  1982.         jdd_MemFree(send_msg_p->pBcc);
  1983.         send_msg_p->pBcc = NULL;
  1984.     }
  1985.     if (send_msg_p->pSubject != NULL)
  1986.     {
  1987.         jdd_MemFree(send_msg_p->pSubject);
  1988.         send_msg_p->pSubject = NULL;
  1989.     }
  1990.     jdd_MemFree(send_msg_p);
  1991.     send_msg_p = NULL;
  1992.     g_jmms_context->send_msg_p = NULL;
  1993. }
  1994. /*****************************************************************************
  1995.  * FUNCTION
  1996.  *  mmi_jmms_create_read_report_header
  1997.  * DESCRIPTION
  1998.  *  
  1999.  * PARAMETERS
  2000.  *  read_report_header      [?]     [?]     [?]
  2001.  * RETURNS
  2002.  *  
  2003.  *****************************************************************************/
  2004. JC_RETCODE mmi_jmms_create_read_report_header(READ_REPORT_RESPONSE *read_report_header)
  2005. {
  2006.     /*----------------------------------------------------------------*/
  2007.     /* Local Variables                                                */
  2008.     /*----------------------------------------------------------------*/
  2009.     READ_REPORT_RESPONSE *read_report_p = NULL;
  2010.     JC_RETCODE eRet = JC_OK;
  2011.     /*----------------------------------------------------------------*/
  2012.     /* Code Body                                                      */
  2013.     /*----------------------------------------------------------------*/
  2014.     read_report_p = (READ_REPORT_RESPONSE*) jdd_MemAlloc(sizeof(READ_REPORT_RESPONSE), 1);
  2015.     if (read_report_p == NULL)
  2016.     {
  2017.         eRet = JC_ERR_MEMORY_ALLOCATION;
  2018.         goto ERROR_HANDLE;
  2019.     }
  2020.     read_report_p->eReadStatus = read_report_header->eReadStatus;
  2021.     if (read_report_header->pTo != NULL)
  2022.     {
  2023.         read_report_p->pTo = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), jc_tcslen(read_report_header->pTo) + 1);
  2024.         if (read_report_p->pTo == NULL)
  2025.         {
  2026.             eRet = JC_ERR_MEMORY_ALLOCATION;
  2027.             goto ERROR_HANDLE;
  2028.         }
  2029.         jc_tcscpy(read_report_p->pTo, read_report_header->pTo);
  2030.     }
  2031.     if (read_report_header->pFrom != NULL)
  2032.     {
  2033.         read_report_p->pFrom = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), jc_tcslen(read_report_header->pFrom) + 1);
  2034.         if (read_report_p->pFrom == NULL)
  2035.         {
  2036.             eRet = JC_ERR_MEMORY_ALLOCATION;
  2037.             goto ERROR_HANDLE;
  2038.         }
  2039.         jc_tcscpy(read_report_p->pFrom, read_report_header->pFrom);
  2040.     }
  2041.     if (read_report_header->pMessageID != NULL)
  2042.     {
  2043.         read_report_p->pMessageID = (JC_INT8*) jdi_UtilsStrdup(read_report_header->pMessageID);
  2044.     }
  2045.     read_report_p->uiReceivedTime = read_report_header->uiReceivedTime;
  2046.     g_jmms_context->read_report_p = (READ_REPORT_RESPONSE*) (read_report_p);
  2047.   ERROR_HANDLE:
  2048.     if (eRet != JC_OK && read_report_p != NULL)
  2049.     {
  2050.         mmi_jmms_free_report_report_header();
  2051.     }
  2052.     return eRet;
  2053. }
  2054. /*****************************************************************************
  2055.  * FUNCTION
  2056.  *  mmi_jmms_free_report_report_header
  2057.  * DESCRIPTION
  2058.  *  
  2059.  * PARAMETERS
  2060.  *  void
  2061.  * RETURNS
  2062.  *  void
  2063.  *****************************************************************************/
  2064. void mmi_jmms_free_report_report_header(void)
  2065. {
  2066.     /*----------------------------------------------------------------*/
  2067.     /* Local Variables                                                */
  2068.     /*----------------------------------------------------------------*/
  2069.     READ_REPORT_RESPONSE *read_report_p = NULL;
  2070.     /*----------------------------------------------------------------*/
  2071.     /* Code Body                                                      */
  2072.     /*----------------------------------------------------------------*/
  2073.     read_report_p = (READ_REPORT_RESPONSE*) g_jmms_context->read_report_p;
  2074.     if (read_report_p == NULL)
  2075.     {
  2076.         return;
  2077.     }
  2078.     if (read_report_p->pTo != NULL)
  2079.     {
  2080.         jdd_MemFree(read_report_p->pTo);
  2081.         read_report_p->pTo = NULL;
  2082.     }
  2083.     if (read_report_p->pFrom != NULL)
  2084.     {
  2085.         jdd_MemFree(read_report_p->pFrom);
  2086.         read_report_p->pFrom = NULL;
  2087.     }
  2088.     if (read_report_p->pMessageID != NULL)
  2089.     {
  2090.         jdd_MemFree(read_report_p->pMessageID);
  2091.         read_report_p->pMessageID = NULL;
  2092.     }
  2093.     jdd_MemFree(read_report_p);
  2094.     read_report_p = NULL;
  2095.     g_jmms_context->read_report_p = NULL;
  2096. }
  2097. /*****************************************************************************
  2098.  * FUNCTION
  2099.  *  mmi_jmms_create_delivery_report_header
  2100.  * DESCRIPTION
  2101.  *  
  2102.  * PARAMETERS
  2103.  *  delivery_header     [?]     [?]     [?]
  2104.  * RETURNS
  2105.  *  
  2106.  *****************************************************************************/
  2107. JC_RETCODE mmi_jmms_create_delivery_report_header(DELIVERY_REPORT *delivery_header)
  2108. {
  2109.     /*----------------------------------------------------------------*/
  2110.     /* Local Variables                                                */
  2111.     /*----------------------------------------------------------------*/
  2112.     DELIVERY_REPORT *delivery_p = NULL;
  2113.     JC_RETCODE eRet = JC_OK;
  2114.     /*----------------------------------------------------------------*/
  2115.     /* Code Body                                                      */
  2116.     /*----------------------------------------------------------------*/
  2117.     delivery_p = (DELIVERY_REPORT*) jdd_MemAlloc(sizeof(DELIVERY_REPORT), 1);
  2118.     if (delivery_p == NULL)
  2119.     {
  2120.         eRet = JC_ERR_MEMORY_ALLOCATION;
  2121.         goto ERROR_HANDLE;
  2122.     }
  2123.     delivery_p->eDeliveryStatus = delivery_header->eDeliveryStatus;
  2124.     if (delivery_header->pTo != NULL)
  2125.     {
  2126.         delivery_p->pTo = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), jc_tcslen(delivery_header->pTo) + 1);
  2127.         if (delivery_p->pTo == NULL)
  2128.         {
  2129.             eRet = JC_ERR_MEMORY_ALLOCATION;
  2130.             goto ERROR_HANDLE;
  2131.         }
  2132.         jc_tcscpy(delivery_p->pTo, delivery_header->pTo);
  2133.     }
  2134.     if (delivery_header->pMessageID != NULL)
  2135.     {
  2136.         delivery_p->pMessageID = (JC_INT8*) jdi_UtilsStrdup(delivery_header->pMessageID);
  2137.     }
  2138.     delivery_p->uiDate = delivery_header->uiDate;
  2139.     g_jmms_context->delivery_p = (DELIVERY_REPORT*) (delivery_p);
  2140.   ERROR_HANDLE:
  2141.     if (eRet != JC_OK && delivery_p != NULL)
  2142.     {
  2143.         mmi_jmms_free_delivery_report_header();
  2144.     }
  2145.     return eRet;
  2146. }
  2147. /*****************************************************************************
  2148.  * FUNCTION
  2149.  *  mmi_jmms_free_delivery_report_header
  2150.  * DESCRIPTION
  2151.  *  
  2152.  * PARAMETERS
  2153.  *  void
  2154.  * RETURNS
  2155.  *  void
  2156.  *****************************************************************************/
  2157. void mmi_jmms_free_delivery_report_header(void)
  2158. {
  2159.     /*----------------------------------------------------------------*/
  2160.     /* Local Variables                                                */
  2161.     /*----------------------------------------------------------------*/
  2162.     DELIVERY_REPORT *delivery_p = NULL;
  2163.     /*----------------------------------------------------------------*/
  2164.     /* Code Body                                                      */
  2165.     /*----------------------------------------------------------------*/
  2166.     delivery_p = (DELIVERY_REPORT*) g_jmms_context->delivery_p;
  2167.     if (delivery_p == NULL)
  2168.     {
  2169.         return;
  2170.     }
  2171.     if (delivery_p->pTo != NULL)
  2172.     {
  2173.         jdd_MemFree(delivery_p->pTo);
  2174.         delivery_p->pTo = NULL;
  2175.     }
  2176.     if (delivery_p->pMessageID != NULL)
  2177.     {
  2178.         jdd_MemFree(delivery_p->pMessageID);
  2179.         delivery_p->pMessageID = NULL;
  2180.     }
  2181.     jdd_MemFree(delivery_p);
  2182.     delivery_p = NULL;
  2183.     g_jmms_context->delivery_p = NULL;
  2184. }
  2185. /*****************************************************************************
  2186.  * FUNCTION
  2187.  *  mmi_jmms_create_notification_header
  2188.  * DESCRIPTION
  2189.  *  
  2190.  * PARAMETERS
  2191.  *  notf_header     [?]     [?]     [?]
  2192.  * RETURNS
  2193.  *  
  2194.  *****************************************************************************/
  2195. JC_RETCODE mmi_jmms_create_notification_header(MESSAGE_NOTIFICATION *notf_header)
  2196. {
  2197.     /*----------------------------------------------------------------*/
  2198.     /* Local Variables                                                */
  2199.     /*----------------------------------------------------------------*/
  2200.     MESSAGE_NOTIFICATION *notification_p = NULL;
  2201.     JC_RETCODE eRet = JC_OK;
  2202.     /*----------------------------------------------------------------*/
  2203.     /* Code Body                                                      */
  2204.     /*----------------------------------------------------------------*/
  2205.     notification_p = (MESSAGE_NOTIFICATION*) jdd_MemAlloc(sizeof(MESSAGE_NOTIFICATION), 1);
  2206.     if (notification_p == NULL)
  2207.     {
  2208.         eRet = JC_ERR_MEMORY_ALLOCATION;
  2209.         goto ERROR_HANDLE;
  2210.     }
  2211.     if (notf_header->pFrom != NULL)
  2212.     {
  2213.         notification_p->pFrom = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), jc_tcslen(notf_header->pFrom) + 1);
  2214.         if (notification_p->pFrom == NULL)
  2215.         {
  2216.             eRet = JC_ERR_MEMORY_ALLOCATION;
  2217.             goto ERROR_HANDLE;
  2218.         }
  2219.         jc_tcscpy(notification_p->pFrom, notf_header->pFrom);
  2220.     }
  2221.     if (notf_header->pSubject != NULL)
  2222.     {
  2223.         notification_p->pSubject = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), jc_tcslen(notf_header->pSubject) + 1);
  2224.         if (notification_p->pSubject == NULL)
  2225.         {
  2226.             eRet = JC_ERR_MEMORY_ALLOCATION;
  2227.             goto ERROR_HANDLE;
  2228.         }
  2229.         jc_tcscpy(notification_p->pSubject, notf_header->pSubject);
  2230.     }
  2231.     notification_p->uiExpiryTime = notf_header->uiExpiryTime;
  2232.     notification_p->uiMessageSize = notf_header->uiMessageSize;
  2233.     notification_p->eMsgPriority = notf_header->eMsgPriority;
  2234.     notification_p->eMsgClass = notf_header->eMsgClass;
  2235.     notification_p->uiReceivedTime = notf_header->uiReceivedTime;
  2236.     g_jmms_context->notification_p = (MESSAGE_NOTIFICATION*) (notification_p);
  2237.   ERROR_HANDLE:
  2238.     if (eRet != JC_OK && notification_p != NULL)
  2239.     {
  2240.         mmi_jmms_free_notification_header();
  2241.     }
  2242.     return eRet;
  2243. }
  2244. /*****************************************************************************
  2245.  * FUNCTION
  2246.  *  mmi_jmms_free_notification_header
  2247.  * DESCRIPTION
  2248.  *  
  2249.  * PARAMETERS
  2250.  *  void
  2251.  * RETURNS
  2252.  *  void
  2253.  *****************************************************************************/
  2254. void mmi_jmms_free_notification_header(void)
  2255. {
  2256.     /*----------------------------------------------------------------*/
  2257.     /* Local Variables                                                */
  2258.     /*----------------------------------------------------------------*/
  2259.     MESSAGE_NOTIFICATION *notification_p = NULL;
  2260.     /*----------------------------------------------------------------*/
  2261.     /* Code Body                                                      */
  2262.     /*----------------------------------------------------------------*/
  2263.     notification_p = (MESSAGE_NOTIFICATION*) (g_jmms_context->notification_p);
  2264.     if (notification_p == NULL)
  2265.     {
  2266.         return;
  2267.     }
  2268.     if (notification_p->pFrom != NULL)
  2269.     {
  2270.         jdd_MemFree(notification_p->pFrom);
  2271.         notification_p->pFrom = NULL;
  2272.     }
  2273.     if (notification_p->pSubject != NULL)
  2274.     {
  2275.         jdd_MemFree(notification_p->pSubject);
  2276.         notification_p->pSubject = NULL;
  2277.     }
  2278.     jdd_MemFree(notification_p);
  2279.     notification_p = NULL;
  2280.     g_jmms_context->notification_p = NULL;
  2281. }
  2282. /*****************************************************************************
  2283.  * FUNCTION
  2284.  *  mmi_jmms_create_recieved_msg_header
  2285.  * DESCRIPTION
  2286.  *  
  2287.  * PARAMETERS
  2288.  *  recieve_header      [?]     [?]     [?]
  2289.  * RETURNS
  2290.  *  
  2291.  *****************************************************************************/
  2292. JC_RETCODE mmi_jmms_create_recieved_msg_header(MESSAGE_RETRIEVAL *recieve_header)
  2293. {
  2294.     /*----------------------------------------------------------------*/
  2295.     /* Local Variables                                                */
  2296.     /*----------------------------------------------------------------*/
  2297.     MESSAGE_RETRIEVAL *retrieval_p = NULL;
  2298.     JC_RETCODE eRet = JC_OK;
  2299.     /*----------------------------------------------------------------*/
  2300.     /* Code Body                                                      */
  2301.     /*----------------------------------------------------------------*/
  2302.     retrieval_p = (MESSAGE_RETRIEVAL*) jdd_MemAlloc(sizeof(MESSAGE_RETRIEVAL), 1);
  2303.     if (retrieval_p == NULL)
  2304.     {
  2305.         eRet = JC_ERR_MEMORY_ALLOCATION;
  2306.         goto ERROR_HANDLE;
  2307.     }
  2308.     if (recieve_header->pFrom != NULL)
  2309.     {
  2310.         retrieval_p->pFrom = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), jc_tcslen(recieve_header->pFrom) + 1);
  2311.         if (retrieval_p->pFrom == NULL)
  2312.         {
  2313.             eRet = JC_ERR_MEMORY_ALLOCATION;
  2314.             goto ERROR_HANDLE;
  2315.         }
  2316.         jc_tcscpy(retrieval_p->pFrom, recieve_header->pFrom);
  2317.     }
  2318.     if (recieve_header->pTo != NULL)
  2319.     {
  2320.         retrieval_p->pTo = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), jc_tcslen(recieve_header->pTo) + 1);
  2321.         if (retrieval_p->pTo == NULL)
  2322.         {
  2323.             eRet = JC_ERR_MEMORY_ALLOCATION;
  2324.             goto ERROR_HANDLE;
  2325.         }
  2326.         jc_tcscpy(retrieval_p->pTo, recieve_header->pTo);
  2327.     }
  2328.     if (recieve_header->pCc != NULL)
  2329.     {
  2330.         retrieval_p->pCc = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), jc_tcslen(recieve_header->pCc) + 1);
  2331.         if (retrieval_p->pCc == NULL)
  2332.         {
  2333.             eRet = JC_ERR_MEMORY_ALLOCATION;
  2334.             goto ERROR_HANDLE;
  2335.         }
  2336.         jc_tcscpy(retrieval_p->pCc, recieve_header->pCc);
  2337.     }
  2338.     if (recieve_header->pSubject != NULL)
  2339.     {
  2340.         retrieval_p->pSubject = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), jc_tcslen(recieve_header->pSubject) + 1);
  2341.         if (retrieval_p->pSubject == NULL)
  2342.         {
  2343.             eRet = JC_ERR_MEMORY_ALLOCATION;
  2344.             goto ERROR_HANDLE;
  2345.         }
  2346.         jc_tcscpy(retrieval_p->pSubject, recieve_header->pSubject);
  2347.     }
  2348.     retrieval_p->eMsgPriority = recieve_header->eMsgPriority;
  2349.     retrieval_p->eMsgClass = recieve_header->eMsgClass;
  2350.     retrieval_p->uiDate = recieve_header->uiDate;
  2351.     g_jmms_context->retrieval_p = (MESSAGE_RETRIEVAL*) (retrieval_p);
  2352.   ERROR_HANDLE:
  2353.     if (eRet != JC_OK && retrieval_p != NULL)
  2354.     {
  2355.         mmi_jmms_free_recieved_msg_header();
  2356.     }
  2357.     return eRet;
  2358. }
  2359. /*****************************************************************************
  2360.  * FUNCTION
  2361.  *  mmi_jmms_free_recieved_msg_header
  2362.  * DESCRIPTION
  2363.  *  
  2364.  * PARAMETERS
  2365.  *  void
  2366.  * RETURNS
  2367.  *  void
  2368.  *****************************************************************************/
  2369. void mmi_jmms_free_recieved_msg_header(void)
  2370. {
  2371.     /*----------------------------------------------------------------*/
  2372.     /* Local Variables                                                */
  2373.     /*----------------------------------------------------------------*/
  2374.     MESSAGE_RETRIEVAL *retrieval_p = NULL;
  2375.     /*----------------------------------------------------------------*/
  2376.     /* Code Body                                                      */
  2377.     /*----------------------------------------------------------------*/
  2378.     retrieval_p = (MESSAGE_RETRIEVAL*) (g_jmms_context->retrieval_p);
  2379.     if (retrieval_p == NULL)
  2380.     {
  2381.         return;
  2382.     }
  2383.     if (retrieval_p->pFrom != NULL)
  2384.     {
  2385.         jdd_MemFree(retrieval_p->pFrom);
  2386.         retrieval_p->pFrom = NULL;
  2387.     }
  2388.     if (retrieval_p->pTo != NULL)
  2389.     {
  2390.         jdd_MemFree(retrieval_p->pTo);
  2391.         retrieval_p->pTo = NULL;
  2392.     }
  2393.     if (retrieval_p->pCc != NULL)
  2394.     {
  2395.         jdd_MemFree(retrieval_p->pCc);
  2396.         retrieval_p->pCc = NULL;
  2397.     }
  2398.     if (retrieval_p->pSubject != NULL)
  2399.     {
  2400.         jdd_MemFree(retrieval_p->pSubject);
  2401.         retrieval_p->pSubject = NULL;
  2402.     }
  2403.     jdd_MemFree(retrieval_p);
  2404.     retrieval_p = NULL;
  2405.     g_jmms_context->retrieval_p = NULL;
  2406. }
  2407. /*****************************************************************************
  2408.  * FUNCTION
  2409.  *  mmi_jmms_entry_new_mms_sent_properties
  2410.  * DESCRIPTION
  2411.  *  
  2412.  * PARAMETERS
  2413.  *  void
  2414.  * RETURNS
  2415.  *  void
  2416.  *****************************************************************************/
  2417. void mmi_jmms_entry_new_mms_sent_properties(void)
  2418. {
  2419.     /*----------------------------------------------------------------*/
  2420.     /* Local Variables                                                */
  2421.     /*----------------------------------------------------------------*/
  2422.     PU8 gui_buffer; /* Buffer holding history data */
  2423.     S8 temp[14];
  2424.     MYTIME time, time1;
  2425.     /* PMT VIKAS START 20060325 */
  2426.     S32 size = 0, size_kb = 0, size_bytes = 0;
  2427.     /*----------------------------------------------------------------*/
  2428.     /* Code Body                                                      */
  2429.     /*----------------------------------------------------------------*/
  2430.     /* PMT VIKAS END 20060325 */
  2431.     EntryNewScreen(SCR_ID_JMMS_RETRIEVED_MMS_PROPERTIES, NULL, mmi_jmms_entry_new_mms_sent_properties, NULL);
  2432.     gui_buffer = GetCurrGuiBuffer(SCR_ID_JMMS_RETRIEVED_MMS_PROPERTIES);
  2433.     /* /TO */
  2434.     pfnUnicodeStrcpy((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_TO));
  2435.     memset(temp, 0x00, 14);
  2436.     AnsiiToUnicodeString((PS8) temp, (PS8) "n----n");
  2437.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2438.     if (((MESSAGE_SEND*) g_jmms_context->send_msg_p)->pTo == NULL)
  2439.     {
  2440.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
  2441.     }
  2442.     else
  2443.     {
  2444.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) ((MESSAGE_SEND*) g_jmms_context->send_msg_p)->pTo);
  2445.     }
  2446.     /* /CC */
  2447.     memset(temp, 0x00, 14);
  2448.     AnsiiToUnicodeString((PS8) temp, (PS8) "nn");
  2449.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2450.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_CC));
  2451.     memset(temp, 0x00, 14);
  2452.     AnsiiToUnicodeString((PS8) temp, (PS8) "n----n");
  2453.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2454.     if (((MESSAGE_SEND*) g_jmms_context->send_msg_p)->pCc == NULL)
  2455.     {
  2456.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
  2457.     }
  2458.     else
  2459.     {
  2460.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) ((MESSAGE_SEND*) g_jmms_context->send_msg_p)->pCc);
  2461.     }
  2462.     /* /BCC */
  2463.     memset(temp, 0x00, 14);
  2464.     AnsiiToUnicodeString((PS8) temp, (PS8) "nn");
  2465.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2466.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_BCC));
  2467.     memset(temp, 0x00, 14);
  2468.     AnsiiToUnicodeString((PS8) temp, (PS8) "n----n");
  2469.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2470.     if (((MESSAGE_SEND*) g_jmms_context->send_msg_p)->pBcc == NULL)
  2471.     {
  2472.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
  2473.     }
  2474.     else
  2475.     {
  2476.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) ((MESSAGE_SEND*) g_jmms_context->send_msg_p)->pBcc);
  2477.     }
  2478.     /* /Subject */
  2479.     memset(temp, 0x00, 14);
  2480.     AnsiiToUnicodeString((PS8) temp, (PS8) "nn");
  2481.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2482.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_SUBJECT));
  2483.     memset(temp, 0x00, 14);
  2484.     AnsiiToUnicodeString((PS8) temp, (PS8) "n----n");
  2485.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2486.     if (((MESSAGE_SEND*) g_jmms_context->send_msg_p)->pSubject == NULL)
  2487.     {
  2488.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
  2489.     }
  2490.     else
  2491.     {
  2492.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) ((MESSAGE_SEND*) g_jmms_context->send_msg_p)->pSubject);
  2493.     }
  2494.     /* /Priority */
  2495.     memset(temp, 0x00, 14);
  2496.     AnsiiToUnicodeString((PS8) temp, (PS8) "nn");
  2497.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2498.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_SETTINGS_PRIORITY));
  2499.     memset(temp, 0x00, 14);
  2500.     AnsiiToUnicodeString((PS8) temp, (PS8) "n----n");
  2501.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2502. /* MAUI_00017989 Start */
  2503. /* MAUI_00018625 Start */
  2504.     switch (((MESSAGE_SEND*) g_jmms_context->send_msg_p)->eMsgPriority )
  2505. /* MAUI_00018625 End */
  2506. /* MAUI_00017989 End */
  2507.     {
  2508.         case E_MSG_PRIORITY_LOW:
  2509.             pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_SETTINGS_LOW));
  2510.             break;
  2511.         case E_MSG_PRIORITY_NORMAL:
  2512.             pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_GLOBAL_NORMAL));
  2513.             break;
  2514.         case E_MSG_PRIORITY_HIGH:
  2515.             pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_SETTINGS_HIGH));
  2516.             break;
  2517.         default:
  2518.             pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_UNKNOWN));
  2519.             break;
  2520.     }
  2521.     /* //message class */
  2522.     memset(temp, 0x00, 14);
  2523.     AnsiiToUnicodeString((PS8) temp, (PS8) "nn");
  2524.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2525.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_MSG_CLASS));
  2526.     memset(temp, 0x00, 14);
  2527.     AnsiiToUnicodeString((PS8) temp, (PS8) "n----n");
  2528.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2529.     switch (((MESSAGE_SEND*) g_jmms_context->send_msg_p)->eMsgClass)
  2530.     {
  2531.         case E_MSG_PERSONAL_CLASS:
  2532.             pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_PERSONEL_MSG_CLASS));
  2533.             break;
  2534.         case E_MSG_ADVERTISEMENT_CLASS:
  2535.             pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_SETTINGS_ADVERTISMENT));
  2536.             break;
  2537.         case E_MSG_INFORMATION_CLASS:
  2538.             pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_INFORMATIONAL_MSG_CLASS));
  2539.             break;
  2540.         case E_MSG_AUTO_CLASS:
  2541.             pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_AUTO_MSG_CLASS));
  2542.             break;
  2543.         default:
  2544.             pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_UNKNOWN));
  2545.             break;
  2546.     }
  2547.     /* /Creation Date */
  2548.     memset(temp, 0x00, 14);
  2549.     AnsiiToUnicodeString((PS8) temp, (PS8) "nn");
  2550.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2551.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_DATE));
  2552.     memset(temp, 0x00, 14);
  2553.     AnsiiToUnicodeString((PS8) temp, (PS8) "n----n");
  2554.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2555.     if (((MESSAGE_SEND*) (g_jmms_context->send_msg_p))->uiDate == 0)
  2556.     {
  2557.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
  2558.     }
  2559.     else
  2560.     {
  2561.         U8 dttemp[40];
  2562.         FLOAT timezone;
  2563.         timezone = mmi_dt_get_tz();
  2564.         mmi_dt_utc_sec_2_mytime((U32) ((MESSAGE_SEND*) g_jmms_context->send_msg_p)->uiDate, &time1, MMI_TRUE);
  2565.         mmi_dt_utc_to_rtc(timezone, time1, time);
  2566.         /* PMT RAJ KUMAR GUPTA on Sep 05, 2006 */
  2567.         /* Date */
  2568.         memset(dttemp, 0x00, 40);
  2569.         date_string(&time, (UI_string_type)dttemp, DT_IDLE_SCREEN);
  2570.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) dttemp);
  2571.         
  2572.         memset(temp, 0x00, 6);
  2573.         AnsiiToUnicodeString((PS8) temp, (PS8) "n");
  2574.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2575.         /* Time */
  2576.         memset(dttemp, 0x00, 40);
  2577.         time_string(&time, (UI_string_type)dttemp, DT_IDLE_SCREEN);
  2578.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) dttemp);
  2579.         /* END of changes - RAJ KUMAR GUPTA */
  2580.     }
  2581.     //PMT VIKAS START 20060325
  2582.     ///MMS Size            
  2583.     memset(temp, 0x00, 14);
  2584.     AnsiiToUnicodeString((PS8) temp, (PS8) "nn");
  2585.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2586.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_SIZE));
  2587.     memset(temp, 0x00, 14);
  2588.     AnsiiToUnicodeString((PS8) temp, (PS8) "n----n");
  2589.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2590.     mmi_jmms_save_size_of_mms(&size, MMS_SIZE_RETRIVE);
  2591.     size_kb = size / 1024;
  2592.     size_bytes = size % 1024;
  2593.     if (size_kb >= 1)
  2594.     {
  2595.         size_kb++;
  2596.         memset(temp, 0x00, 14);
  2597.         gui_itoa((S32) size_kb, (UI_string_type) temp, 10);
  2598.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2599.         memset(temp, 0x00, 4);
  2600.         AnsiiToUnicodeString((PS8) temp, (PS8) " ");
  2601.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2602.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_KB));
  2603.     }
  2604.     else
  2605.     {
  2606.         memset(temp, 0x00, 14);
  2607.         gui_itoa((S32) size_bytes, (UI_string_type) temp, 10);
  2608.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2609.         memset(temp, 0x00, 4);
  2610.         AnsiiToUnicodeString((PS8) temp, (PS8) " ");
  2611.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2612.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_BYTES));
  2613.     }
  2614.     /* PMT VIKAS END 20060325 */
  2615.     ShowCategory78Screen(
  2616. /* MAUI_00018481 Start */
  2617. STR_ID_JMMS_OPTIONS_PROPERTIES,
  2618. /* MAUI_00018481 End */
  2619.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  2620.         NULL,
  2621.         NULL,
  2622.         STR_GLOBAL_BACK,
  2623.         IMG_GLOBAL_BACK,
  2624.         NULL,
  2625.         (U8*) subMenuData,
  2626.         pfnUnicodeStrlen((S8*) subMenuData),
  2627.         gui_buffer);
  2628.     SetRightSoftkeyFunction(mm_jmms_back_from_sent_msg_properties, KEY_EVENT_UP);
  2629.     SetKeyHandler(mm_jmms_back_from_sent_msg_properties, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2630. if (isInCall() == FALSE)
  2631. SetKeyHandler(mm_jmms_end_from_sent_msg_properties, KEY_END, KEY_EVENT_DOWN);
  2632.     return;
  2633. }
  2634. /*Added by dilip on 10th sept to show Template properties screen*/
  2635. /*****************************************************************************
  2636.  * FUNCTION
  2637.  *  mmi_jmms_entry_new_mms_template_properties
  2638.  * DESCRIPTION
  2639.  *  
  2640.  * PARAMETERS
  2641.  *  void
  2642.  * RETURNS
  2643.  *  void
  2644.  *****************************************************************************/
  2645. void mmi_jmms_entry_new_mms_template_properties(void)
  2646. {
  2647.     /*----------------------------------------------------------------*/
  2648.     /* Local Variables                                                */
  2649.     /*----------------------------------------------------------------*/
  2650.     PU8 gui_buffer; /* Buffer holding history data */
  2651.     S8 temp[14];
  2652.     /* PMT VIKAS START 20060325 */
  2653.     S32 size = 0, size_kb = 0, size_bytes = 0;
  2654.     /*----------------------------------------------------------------*/
  2655.     /* Code Body                                                      */
  2656.     /*----------------------------------------------------------------*/
  2657.     /* PMT VIKAS END 20060325 */
  2658.     EntryNewScreen(SCR_ID_JMMS_RETRIEVED_MMS_PROPERTIES, NULL, mmi_jmms_entry_new_mms_template_properties, NULL);
  2659.     gui_buffer = GetCurrGuiBuffer(SCR_ID_JMMS_RETRIEVED_MMS_PROPERTIES);
  2660.    
  2661.     /* /Subject */
  2662.     pfnUnicodeStrcpy((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_SUBJECT));
  2663.     memset(temp, 0x00, 14);
  2664.     AnsiiToUnicodeString((PS8) temp, (PS8) "n----n");
  2665.     pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
  2666.     if (((MESSAGE_SEND*) g_jmms_context->send_msg_p)->pSubject == NULL)
  2667.     {
  2668.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
  2669.     }
  2670.     else
  2671.     {
  2672.         pfnUnicodeStrcat((S8*) subMenuData, (S8*) ((MESSAGE_SEND*) g_jmms_context->send_msg_p)->pSubject);
  2673.     }