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

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) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  * JMMSUMHandling.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   This file contains all the function calls for handling UM requests.
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  *
  91.  *------------------------------------------------------------------------------
  92.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  93.  *============================================================================
  94.  ****************************************************************************/
  95. #ifndef _MMI_JMMSUMHANDLE_C
  96. #define _MMI_JMMSUMHANDLE_C
  97. #include "MMI_features.h"
  98. #if defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT)
  99. #ifdef __MMI_UNIFIED_MESSAGE__
  100. #include "PixtelDataTypes.h"
  101. #include "Unicodexdcl.h"
  102. #include "HistoryGprot.h"
  103. #include "GlobalDefs.h"
  104. #include "CommonScreens.h"
  105. #include "SettingProfile.h"
  106. #include "NVRAMType.h"
  107. #include "NVRAMProt.h"
  108. #include "NVRAMEnum.h"
  109. #include "MessagesResourceData.h"
  110. #include "wgui_categories.h"
  111. #include "wgui_categories_inputs.h"
  112. #include "wap_ps_struct.h"
  113. #include "wapadp.h"
  114. #include "ddl.h"
  115. #include "jcal.h"
  116. #include "jdd_memapi.h"
  117. #include "jdi_communicator.h"
  118. #include "jdi_BrowserDatatype.h"
  119. #include "JBrowserMMIDefs.h"
  120. #include "JBrowserMMIProts.h"
  121. #include "JBrowserMMITypes.h"
  122. // #include "JBrowserStartup.h"
  123. /* PMT DARA  PROFILE HANDLER 020106 */
  124. #include "JProfileHandlerTypes.h"
  125. #include "JProfileHandlerProts.h"
  126. #include "time.h"
  127. #include "JMMSCoreAPI.h"
  128. #include "JMMSStoreHandling.h"
  129. #include "JMMSMainMMS.h"
  130. #include "JMMSStructs.h"
  131. #include "JMMSConfig.h"
  132. #include "JMMSExdcl.h"
  133. #include "JMMSUMHandling.h"
  134. #include "JMMSInbox.h"
  135. #include "JMMSOutbox.h"
  136. #include "JMMSDrafts.h"
  137. #include "JMMSSent.h"
  138. #include "JMMSTemplates.h"
  139. #include "JPushInboxCommonAPIs.h"
  140. #include "JPushInboxUM.h"
  141. #include "JPushInboxCommonUI.h"
  142. #include "wgui_status_icons.h"
  143. #include "SubLCDHistoryGprot.h"
  144. #include "jdi_MMSErr.h"
  145. #include "JMMSResEnum.h"
  146. #include "UnifiedMessageProt.h"
  147. #include "DateTimeGprot.h"
  148. #include "app_datetime.h"
  149. #include "PhoneBookGprot.h"
  150. #include "JMMSProtocols.h"   // compiler warning removal
  151. extern void *g_um_jmms_rsp_struct = NULL;
  152. extern void mmi_jmms_set_folder_message_size(S32 number);
  153. void (*mmi_um_jmms_folder_list_callback) (void) = NULL;
  154. /*****************************************************************************
  155.  * FUNCTION
  156.  *  mmi_um_jmms_set_folder_list_callback_function
  157.  * DESCRIPTION
  158.  *  
  159.  * PARAMETERS
  160.  *  f       [IN]        
  161.  * RETURNS
  162.  *  void
  163.  *****************************************************************************/
  164. void mmi_um_jmms_set_folder_list_callback_function(void (*f) (void))
  165. {
  166.     /*----------------------------------------------------------------*/
  167.     /* Local Variables                                                */
  168.     /*----------------------------------------------------------------*/
  169.     /*----------------------------------------------------------------*/
  170.     /* Code Body                                                      */
  171.     /*----------------------------------------------------------------*/
  172.     mmi_um_jmms_folder_list_callback = f;
  173. }
  174. /*****************************************************************************
  175.  * FUNCTION
  176.  *  mmi_um_jmms_dummy_folder_list_callback
  177.  * DESCRIPTION
  178.  *  
  179.  * PARAMETERS
  180.  *  void
  181.  * RETURNS
  182.  *  void
  183.  *****************************************************************************/
  184. void mmi_um_jmms_dummy_folder_list_callback(void)
  185. {
  186.     /*----------------------------------------------------------------*/
  187.     /* Local Variables                                                */
  188.     /*----------------------------------------------------------------*/
  189.     /*----------------------------------------------------------------*/
  190.     /* Code Body                                                      */
  191.     /*----------------------------------------------------------------*/
  192.     /* dummy call */
  193.     return;
  194. }
  195. /*****************************************************************************
  196.  * FUNCTION
  197.  *  mmi_jmms_delete_all_msgs_list
  198.  * DESCRIPTION
  199.  *  
  200.  * PARAMETERS
  201.  *  folder_type_list        [IN]        
  202.  * RETURNS
  203.  *  
  204.  *****************************************************************************/
  205. JC_RETCODE mmi_jmms_delete_all_msgs_list(UmMsgBoxType folder_type_list)
  206. {
  207.     /*----------------------------------------------------------------*/
  208.     /* Local Variables                                                */
  209.     /*----------------------------------------------------------------*/
  210.     JC_RETCODE eRet = JC_OK;
  211.     U8 msgs = 0;
  212.     /*----------------------------------------------------------------*/
  213.     /* Code Body                                                      */
  214.     /*----------------------------------------------------------------*/
  215.     /* folder_type = UM_MSG_BOX_TYPE_INBOX | UM_MSG_BOX_TYPE_UNSENT | UM_MSG_BOX_TYPE_SENT | UM_MSG_BOX_TYPE_DRAFT; */
  216.     if (folder_type_list & UM_MSG_BOX_TYPE_INBOX)
  217.     {
  218.         if(mmi_jmms_is_immediate_retrival_underway())
  219.         {
  220.             return -1;
  221.         }
  222.         eRet = mmi_mms_get_number_of_messages(MMI_JMMS_INBOX, &msgs);
  223.         if (eRet == JC_OK && msgs != 0)
  224.         {
  225.             eRet = mmi_jmms_delete_all_message(MMI_JMMS_INBOX);
  226.             /* reset all msgs status as unread */
  227.             mmi_jmms_delete_all_msgs_status();
  228.             if (g_jmms_context->store_context != NULL && g_jmms_context->store_context->messages_list != NULL)
  229.             {
  230.                 mmi_jmms_free_msgs_list(&(g_jmms_context->store_context->messages_list));
  231.             }
  232.             if (eRet != JC_OK)
  233.             {
  234.                 return eRet;
  235.             }
  236.         }
  237.         if (eRet != JC_OK)
  238.         {
  239.             return eRet;
  240.         }
  241.     }
  242.     if (folder_type_list & UM_MSG_BOX_TYPE_UNSENT)
  243.     {
  244.         eRet = mmi_mms_get_number_of_messages(MMI_JMMS_OUTBOX, &msgs);
  245.         if (eRet == JC_OK && msgs != 0)
  246.         {
  247.             eRet = mmi_jmms_delete_all_message(MMI_JMMS_OUTBOX);
  248.             if (g_jmms_context->store_context != NULL && g_jmms_context->store_context->messages_list != NULL)
  249.             {
  250.                 mmi_jmms_free_msgs_list(&(g_jmms_context->store_context->messages_list));
  251.             }
  252.         }
  253.         if (eRet != JC_OK)
  254.         {
  255.             return eRet;
  256.         }
  257.     }
  258.     if (folder_type_list & UM_MSG_BOX_TYPE_SENT)
  259.     {
  260.         eRet = mmi_mms_get_number_of_messages(MMI_JMMS_SENT, &msgs);
  261.         if (eRet == JC_OK && msgs != 0)
  262.         {
  263.             eRet = mmi_jmms_delete_all_message(MMI_JMMS_SENT);
  264.             if (g_jmms_context->store_context != NULL && g_jmms_context->store_context->messages_list != NULL)
  265.             {
  266.                 mmi_jmms_free_msgs_list(&(g_jmms_context->store_context->messages_list));
  267.             }
  268.         }
  269.         if (eRet != JC_OK)
  270.         {
  271.             return eRet;
  272.         }
  273.     }
  274.     if (folder_type_list & UM_MSG_BOX_TYPE_DRAFT)
  275.     {
  276.         eRet = mmi_mms_get_number_of_messages(MMI_JMMS_DRAFTS, &msgs);
  277.         if (eRet == JC_OK && msgs != 0)
  278.         {
  279.             eRet = mmi_jmms_delete_all_message(MMI_JMMS_DRAFTS);
  280.             if (g_jmms_context->store_context != NULL && g_jmms_context->store_context->messages_list != NULL)
  281.             {
  282.                 mmi_jmms_free_msgs_list(&(g_jmms_context->store_context->messages_list));
  283.             }
  284.         }
  285.         if (eRet != JC_OK)
  286.         {
  287.             return eRet;
  288.         }
  289.     }
  290.     return eRet;
  291. }
  292. /*****************************************************************************
  293.  * FUNCTION
  294.  *  mmi_um_jataayu_entry_message_mms
  295.  * DESCRIPTION
  296.  *  
  297.  * PARAMETERS
  298.  *  msg_box_type        [IN]        
  299.  *  msg_index           [IN]        
  300.  * RETURNS
  301.  *  void
  302.  *****************************************************************************/
  303. void mmi_um_jataayu_entry_message_mms(UmMsgBoxType msg_box_type, kal_uint16 msg_index)
  304. {
  305.     /*----------------------------------------------------------------*/
  306.     /* Local Variables                                                */
  307.     /*----------------------------------------------------------------*/
  308.     U8 total_msgs = 0;
  309.     /*----------------------------------------------------------------*/
  310.     /* Code Body                                                      */
  311.     /*----------------------------------------------------------------*/
  312.     g_jmms_context->nCurr_scr_hilited_index = msg_index;
  313.     mmi_um_jmms_free_msgs_list();
  314.     switch (msg_box_type)
  315.     {
  316.         case UM_MSG_BOX_TYPE_INBOX:
  317.             mmi_mms_get_number_of_messages(MMI_JMMS_INBOX, &total_msgs);
  318.             g_jmms_context->store_context->nMsgs_in_Current_folder = total_msgs;
  319. g_jmms_context->store_context->update_nmsgs_in_current_folder = 0;
  320.             g_jmms_context->store_context->current_folder_name = E_JMMS_INBOX;
  321.             g_jmms_context->store_context->jmms_start_index = 1;
  322.             /* set the open msg status- for At delete */
  323.             g_jmms_context->msg_open_status[0] = E_JMMS_INBOX;
  324.             g_jmms_context->msg_open_status[1] =
  325.                 (U32) mmi_jmms_get_message_id(
  326.                         MMI_JMMS_INBOX,
  327.                         g_jmms_context->store_context->nMsgs_in_Current_folder - g_jmms_context->nCurr_scr_hilited_index);
  328. g_jmms_context->last_scr_id = 0;      /* To fix LSK option issue for Notification, RReport,DReport & JSR Mesages */
  329.             mmi_jmms_inbox_view();
  330.             break;
  331.         case UM_MSG_BOX_TYPE_UNSENT:
  332.             mmi_mms_get_number_of_messages(MMI_JMMS_OUTBOX, &total_msgs);
  333.             g_jmms_context->store_context->nMsgs_in_Current_folder = total_msgs;
  334. g_jmms_context->store_context->update_nmsgs_in_current_folder = 0;
  335.             g_jmms_context->store_context->current_folder_name = E_JMMS_OUTBOX;
  336.             g_jmms_context->store_context->jmms_start_index = 1;
  337.             /* set the open msg status- for At delete */
  338.             g_jmms_context->msg_open_status[0] = E_JMMS_OUTBOX;
  339.             g_jmms_context->msg_open_status[1] =
  340.                 (U32) mmi_jmms_get_message_id(
  341.                         MMI_JMMS_OUTBOX,
  342.                         g_jmms_context->store_context->nMsgs_in_Current_folder - g_jmms_context->nCurr_scr_hilited_index);
  343.             mmi_jmms_outbox_view();
  344.             break;
  345.         case UM_MSG_BOX_TYPE_SENT:
  346.             mmi_mms_get_number_of_messages(MMI_JMMS_SENT, &total_msgs);
  347.             g_jmms_context->store_context->nMsgs_in_Current_folder = total_msgs;
  348. g_jmms_context->store_context->update_nmsgs_in_current_folder = 0;
  349.             g_jmms_context->store_context->current_folder_name = E_JMMS_SENT;
  350.             g_jmms_context->store_context->jmms_start_index = 1;
  351.             /* set the open msg status- for At delete */
  352.             g_jmms_context->msg_open_status[0] = E_JMMS_SENT;
  353.             g_jmms_context->msg_open_status[1] =
  354.                 (U32) mmi_jmms_get_message_id(
  355.                         MMI_JMMS_SENT,
  356.                         g_jmms_context->store_context->nMsgs_in_Current_folder - g_jmms_context->nCurr_scr_hilited_index);
  357.             mmi_um_jmms_set_folder_list_callback_function(mmi_jmms_sent_view);
  358.             mmi_jmms_sent_view();
  359.             break;
  360.         case UM_MSG_BOX_TYPE_DRAFT:
  361.             mmi_mms_get_number_of_messages(MMI_JMMS_DRAFTS, &total_msgs);
  362.             g_jmms_context->store_context->nMsgs_in_Current_folder = total_msgs;
  363. g_jmms_context->store_context->update_nmsgs_in_current_folder = 0;
  364.             g_jmms_context->store_context->current_folder_name = E_JMMS_DRAFTS;
  365.             g_jmms_context->store_context->jmms_start_index = 1;
  366.             /* set the open msg status- for At delete */
  367.             g_jmms_context->msg_open_status[0] = E_JMMS_DRAFTS;
  368.             g_jmms_context->msg_open_status[1] =
  369.                 (U32) mmi_jmms_get_message_id(
  370.                         MMI_JMMS_DRAFTS,
  371.                         g_jmms_context->store_context->nMsgs_in_Current_folder - g_jmms_context->nCurr_scr_hilited_index);
  372.             mmi_jmms_drafts_view();
  373.             break;
  374.     }
  375. }
  376. /*****************************************************************************
  377.  * FUNCTION
  378.  *  mmi_um_jmms_free_msgs_list
  379.  * DESCRIPTION
  380.  *  
  381.  * PARAMETERS
  382.  *  void
  383.  * RETURNS
  384.  *  void
  385.  *****************************************************************************/
  386. void mmi_um_jmms_free_msgs_list(void)
  387. {
  388.     /*----------------------------------------------------------------*/
  389.     /* Local Variables                                                */
  390.     /*----------------------------------------------------------------*/
  391.     jmms_folder_msgs_list *list;
  392.     jmms_folder_msgs_list *list1;
  393.     /*----------------------------------------------------------------*/
  394.     /* Code Body                                                      */
  395.     /*----------------------------------------------------------------*/
  396.     if (g_jmms_context->store_context != NULL && g_jmms_context->store_context->messages_list != NULL)
  397.     {
  398.         list = g_jmms_context->store_context->messages_list;        
  399.         while (list != NULL)
  400.         {
  401.             list1 = list->next;
  402.             if (list->um_msg_info != NULL && list->um_msg_info->msg_index != g_jmms_context->nCurr_scr_hilited_index)
  403.             {
  404.                 jdd_MemFree(list->um_msg_info);
  405.                 list->um_msg_info = NULL;
  406.             }
  407.             list = list1;
  408.         }        
  409.     }
  410. }
  411. /*****************************************************************************
  412.  * FUNCTION
  413.  *  mmi_um_jmms_create_new_mms_hint_for_sent
  414.  * DESCRIPTION
  415.  *  
  416.  * PARAMETERS
  417.  *  mms_info_rsp        [IN]        
  418.  *  to                  [?]         
  419.  *  cc                  [?]         
  420.  *  bcc                 [?]         
  421.  *  msg_counter         [IN]        
  422.  * RETURNS
  423.  *  void
  424.  *****************************************************************************/
  425. void mmi_um_jmms_create_new_mms_hint_for_sent(
  426.         mmi_um_msg_info_struct **mms_info_rsp,
  427.         JC_CHAR *to,
  428.         JC_CHAR *cc,
  429.         JC_CHAR *bcc,
  430.         S32 msg_counter)
  431. {
  432.     /*----------------------------------------------------------------*/
  433.     /* Local Variables                                                */
  434.     /*----------------------------------------------------------------*/
  435.     S8 *str = NULL;
  436.     S32 len = 0;
  437.     S32 start_index = 0;
  438.     MMI_BOOL is_email = MMI_FALSE;
  439.     S32 len_to_copy = 0;
  440.     /*----------------------------------------------------------------*/
  441.     /* Code Body                                                      */
  442.     /*----------------------------------------------------------------*/
  443.     if (to != NULL)
  444.     {
  445.         str = (S8*) (to);
  446.         len = 0;
  447.         start_index = 0;
  448.         while (((*str) != ';') && ((*str) != ''))
  449.         {
  450.             if ((*str) == '@')
  451.             {
  452.                 is_email = MMI_TRUE;
  453.             }
  454.             len++;
  455.             str = str + ENCODING_LENGTH;
  456.         }
  457.         if (is_email == MMI_FALSE && len > (MAX_POSSIBLE_NUMBER_LENGHT_SENT))
  458.         {
  459.             len_to_copy = MAX_POSSIBLE_NUMBER_LENGHT_SENT;
  460.         }
  461.         else if (is_email == MMI_TRUE && len > (MAX_POSSIBLE_EMAIL_LENGHT_SENT))
  462.         {
  463.             len_to_copy = MAX_POSSIBLE_EMAIL_LENGHT_SENT;
  464.         }
  465.         else
  466.         {
  467.             len_to_copy = len;
  468.         }
  469.         if (is_email == MMI_TRUE)
  470.         {
  471.             (*mms_info_rsp)->address_type = UM_ADDR_TYPE_EMAIL_ADDRESS;
  472.         }
  473.         else
  474.         {
  475.             (*mms_info_rsp)->address_type = UM_ADDR_TYPE_PHONE_NUMBER;
  476.         }
  477.         pfnUnicodeStrncpy((S8*) (*mms_info_rsp)->address, (S8*) (to + start_index), len_to_copy);
  478.         (*mms_info_rsp)->address_length = len_to_copy;
  479.         return;
  480.     }
  481.     if (cc != NULL)
  482.     {
  483.         str = (S8*) (cc);
  484.         len = 0;
  485.         start_index = 0;
  486.         is_email = MMI_FALSE;
  487.         while (((*str) != ';') && ((*str) != ''))
  488.         {
  489.             len++;
  490.             if ((*str) == '@')
  491.             {
  492.                 is_email = MMI_TRUE;
  493.             }
  494.             str = str + ENCODING_LENGTH;
  495.         }
  496.         if (is_email == MMI_FALSE && len > (MAX_POSSIBLE_NUMBER_LENGHT_SENT))
  497.         {
  498.             len_to_copy = MAX_POSSIBLE_NUMBER_LENGHT_SENT;
  499.         }
  500.         else if (is_email == MMI_TRUE && len > (MAX_POSSIBLE_EMAIL_LENGHT_SENT))
  501.         {
  502.             len_to_copy = MAX_POSSIBLE_EMAIL_LENGHT_SENT;
  503.         }
  504.         else
  505.         {
  506.             len_to_copy = len;
  507.         }
  508.         if (is_email == MMI_TRUE)
  509.         {
  510.             (*mms_info_rsp)->address_type = UM_ADDR_TYPE_EMAIL_ADDRESS;
  511.         }
  512.         else
  513.         {
  514.             (*mms_info_rsp)->address_type = UM_ADDR_TYPE_PHONE_NUMBER;
  515.         }
  516.         pfnUnicodeStrncpy((S8*) (*mms_info_rsp)->address, (S8*) (cc + start_index), len_to_copy);
  517.         (*mms_info_rsp)->address_length = len_to_copy;
  518.         return;
  519.     }
  520.     /* /Make the BCc Addresses list */
  521.     if (bcc != NULL)
  522.     {
  523.         str = (S8*) (bcc);
  524.         len = 0;
  525.         start_index = 0;
  526.         is_email = MMI_FALSE;
  527.         while (((*str) != ';') && ((*str) != ''))
  528.         {
  529.             len++;
  530.             if ((*str) == '@')
  531.             {
  532.                 is_email = MMI_TRUE;
  533.             }
  534.             str = str + ENCODING_LENGTH;
  535.         }
  536.         if (is_email == MMI_FALSE && len > (MAX_POSSIBLE_NUMBER_LENGHT_SENT))
  537.         {
  538.             len_to_copy = MAX_POSSIBLE_NUMBER_LENGHT_SENT;
  539.         }
  540.         else if (is_email == MMI_TRUE && len > (MAX_POSSIBLE_EMAIL_LENGHT_SENT))
  541.         {
  542.             len_to_copy = MAX_POSSIBLE_EMAIL_LENGHT_SENT;
  543.         }
  544.         else
  545.         {
  546.             len_to_copy = len;
  547.         }
  548.         if (is_email == MMI_TRUE)
  549.         {
  550.             (*mms_info_rsp)->address_type = UM_ADDR_TYPE_EMAIL_ADDRESS;
  551.         }
  552.         else
  553.         {
  554.             (*mms_info_rsp)->address_type = UM_ADDR_TYPE_PHONE_NUMBER;
  555.         }
  556.         pfnUnicodeStrncpy((S8*) (*mms_info_rsp)->address, (S8*) (bcc + start_index), len_to_copy);
  557.         (*mms_info_rsp)->address_length = len_to_copy;
  558.         return;
  559.     }
  560.     (*mms_info_rsp)->address_length = 0;
  561.     return;
  562. }
  563. /*****************************************************************************
  564.  * FUNCTION
  565.  *  mmi_um_jmms_add_mms_sub_for_list_info
  566.  * DESCRIPTION
  567.  *  
  568.  * PARAMETERS
  569.  *  mms_info_rsp        [IN]        
  570.  *  subject_p           [?]         
  571.  *  msg_counter         [IN]        
  572.  * RETURNS
  573.  *  void
  574.  *****************************************************************************/
  575. void mmi_um_jmms_add_mms_sub_for_list_info(mmi_um_msg_info_struct **mms_info_rsp, JC_CHAR *subject_p, S32 msg_counter)
  576. {
  577.     /*----------------------------------------------------------------*/
  578.     /* Local Variables                                                */
  579.     /*----------------------------------------------------------------*/
  580.     S32 len_to_copy = 0;
  581.     /*----------------------------------------------------------------*/
  582.     /* Code Body                                                      */
  583.     /*----------------------------------------------------------------*/
  584.     len_to_copy = pfnUnicodeStrlen((S8*) (subject_p)) * ENCODING_LENGTH;
  585.     if (len_to_copy > MMI_UM_MAX_SUBJECT_LEN)
  586.     {
  587.         len_to_copy = MMI_UM_MAX_SUBJECT_LEN;
  588.     }
  589.     pfnUnicodeStrncpy((S8*) (*mms_info_rsp)->subject, (S8*) (subject_p), len_to_copy);
  590.     (*mms_info_rsp)->subject_length = len_to_copy;
  591.     return;
  592. }
  593. /*****************************************************************************
  594.  * FUNCTION
  595.  *  mmi_um_jmms_add_mms_address_for_list_info
  596.  * DESCRIPTION
  597.  *  
  598.  * PARAMETERS
  599.  *  mms_info_p      [IN]        
  600.  *  from_p          [?]         
  601.  *  msg_counter     [IN]        
  602.  * RETURNS
  603.  *  void
  604.  *****************************************************************************/
  605. void mmi_um_jmms_add_mms_address_for_list_info(mmi_um_msg_info_struct **mms_info_p, JC_CHAR *from_p, S32 msg_counter)
  606. {
  607.     /*----------------------------------------------------------------*/
  608.     /* Local Variables                                                */
  609.     /*----------------------------------------------------------------*/
  610.     S8 *str = NULL;
  611.     S32 len = 0;
  612.     S32 start_index = 0;
  613.     MMI_BOOL is_email = MMI_FALSE;
  614.     S32 len_to_copy = 0;
  615.     /*----------------------------------------------------------------*/
  616.     /* Code Body                                                      */
  617.     /*----------------------------------------------------------------*/
  618.     if (from_p != NULL)
  619.     {
  620.         str = (S8*) (from_p);
  621.         len = 0;
  622.         start_index = 0;
  623.         while (((*str) != ';') && ((*str) != ''))
  624.         {
  625.             if ((*str) == '@')
  626.             {
  627.                 is_email = MMI_TRUE;
  628.             }
  629.             len++;
  630.             str = str + ENCODING_LENGTH;
  631.         }
  632.         if (is_email == MMI_FALSE && len > (MAX_POSSIBLE_NUMBER_LENGHT_SENT))
  633.         {
  634.             len_to_copy = MAX_POSSIBLE_NUMBER_LENGHT_SENT;
  635.         }
  636.         else if (is_email == MMI_TRUE && len > (MAX_POSSIBLE_EMAIL_LENGHT_SENT))
  637.         {
  638.             len_to_copy = MAX_POSSIBLE_EMAIL_LENGHT_SENT;
  639.         }
  640.         else
  641.         {
  642.             len_to_copy = len;
  643.         }
  644.         if (is_email == MMI_TRUE)
  645.         {
  646.             (*mms_info_p)->address_type = UM_ADDR_TYPE_EMAIL_ADDRESS;
  647.         }
  648.         else
  649.         {
  650.             (*mms_info_p)->address_type = UM_ADDR_TYPE_PHONE_NUMBER;
  651.         }
  652.         pfnUnicodeStrncpy((S8*) (*mms_info_p)->address, (S8*) (from_p + start_index), len_to_copy);
  653.         (*mms_info_p)->address_length = len_to_copy;
  654.         return;
  655.     }
  656.     (*mms_info_p)->address_length = len_to_copy;
  657.     return;
  658. }
  659. /*****************************************************************************
  660.  * FUNCTION
  661.  *  mmi_um_jmms_at_delete_pre_set
  662.  * DESCRIPTION
  663.  *  
  664.  * PARAMETERS
  665.  *  void
  666.  * RETURNS
  667.  *  void
  668.  *****************************************************************************/
  669. void mmi_um_jmms_at_delete_pre_set(void)
  670. {
  671.     /*----------------------------------------------------------------*/
  672.     /* Local Variables                                                */
  673.     /*----------------------------------------------------------------*/
  674.     /*----------------------------------------------------------------*/
  675.     /* Code Body                                                      */
  676.     /*----------------------------------------------------------------*/
  677.     g_jmms_context->msg_open_status[0] = 0;
  678.     g_jmms_context->msg_open_status[1] = 0;
  679. }
  680. /*****************************************************************************
  681.  * FUNCTION
  682.  *  mmi_um_jmms_store_update_message
  683.  * DESCRIPTION
  684.  *  
  685.  * PARAMETERS
  686.  *  pFolderName         [?]         
  687.  *  uiExtraBytes        [IN]        
  688.  *  media_count         [IN]        
  689.  *  uiMsgIndex          [IN]        
  690.  * RETURNS
  691.  *  
  692.  *****************************************************************************/
  693. JC_RETCODE mmi_um_jmms_store_update_message(
  694.             S8 *pFolderName,
  695.             JC_UINT32 uiExtraBytes,
  696.             U8 media_count,
  697.             JC_UINT32 uiMsgIndex)
  698. {
  699.     /*----------------------------------------------------------------*/
  700.     /* Local Variables                                                */
  701.     /*----------------------------------------------------------------*/
  702.     MESSAGE_HEADERS *pMsgHeaders = NULL;
  703.     JC_RETCODE eRet = JC_OK;
  704.     /*----------------------------------------------------------------*/
  705.     /* Code Body                                                      */
  706.     /*----------------------------------------------------------------*/
  707.     eRet = mmi_jmms_jdi_get_msg_headers(g_jmms_context->msg_handle, &pMsgHeaders);
  708.     if (eRet != JC_OK || pMsgHeaders == NULL)
  709.     {
  710.         return eRet;
  711.     }
  712.     if (media_count > 0)
  713.     {
  714.         uiExtraBytes = uiExtraBytes | 0x01000000;
  715.         mmi_um_update_status_attachment(
  716.             g_jmms_context->g_attachment_pending_list->index_to_parse,
  717.             E_JMMS_ATTACHMENT_PRESENT);
  718.     }
  719.     else
  720.     {
  721.         uiExtraBytes = uiExtraBytes | 0x02000000;
  722.         mmi_um_update_status_attachment(
  723.             g_jmms_context->g_attachment_pending_list->index_to_parse,
  724.             E_JMMS_ATTACHMENT_NOT_PRESENT);
  725.     }
  726.     if (g_jmms_context->msg_handle != NULL)
  727.     {
  728.         mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  729.         g_jmms_context->msg_handle = NULL;
  730.     }
  731.     eRet = mmi_jmms_store_update_message_extrabyte(pFolderName, uiMsgIndex, uiExtraBytes);
  732.     return eRet;
  733. }
  734. /*****************************************************************************
  735.  * FUNCTION
  736.  *  mmi_jmms_free_attacment_pending_status_list
  737.  * DESCRIPTION
  738.  *  
  739.  * PARAMETERS
  740.  *  void
  741.  * RETURNS
  742.  *  void
  743.  *****************************************************************************/
  744. void mmi_jmms_free_attacment_pending_status_list(void)
  745. {
  746.     /*----------------------------------------------------------------*/
  747.     /* Local Variables                                                */
  748.     /*----------------------------------------------------------------*/
  749.     um_jmms_attachment_present_list *temp_pending_list_p = g_jmms_context->g_attachment_pending_list;
  750.     /*----------------------------------------------------------------*/
  751.     /* Code Body                                                      */
  752.     /*----------------------------------------------------------------*/
  753.     while (temp_pending_list_p != NULL)
  754.     {
  755.         g_jmms_context->g_attachment_pending_list = g_jmms_context->g_attachment_pending_list->next;
  756.         jdd_MemFree(temp_pending_list_p);
  757.         temp_pending_list_p = g_jmms_context->g_attachment_pending_list;
  758.     }
  759.     temp_pending_list_p = NULL;
  760.     g_jmms_context->g_attachment_pending_list = NULL;
  761.     return;
  762. }
  763. /*****************************************************************************
  764.  * FUNCTION
  765.  *  mmi_um_jmms_add_new_node_attachment_pending_list
  766.  * DESCRIPTION
  767.  *  
  768.  * PARAMETERS
  769.  *  temp_pending_list_p     [?]     
  770.  * RETURNS
  771.  *  void
  772.  *****************************************************************************/
  773. void mmi_um_jmms_add_new_node_attachment_pending_list(um_jmms_attachment_present_list *temp_pending_list_p)
  774. {
  775.     /*----------------------------------------------------------------*/
  776.     /* Local Variables                                                */
  777.     /*----------------------------------------------------------------*/
  778.     um_jmms_attachment_present_list *pending_list_p = g_jmms_context->g_attachment_pending_list;
  779.     /*----------------------------------------------------------------*/
  780.     /* Code Body                                                      */
  781.     /*----------------------------------------------------------------*/
  782.     if (pending_list_p == NULL)
  783.     {
  784.         g_jmms_context->g_attachment_pending_list = temp_pending_list_p;
  785.     }
  786.     else
  787.     {
  788.         while (pending_list_p->next != NULL)
  789.         {
  790.             pending_list_p = pending_list_p->next;
  791.         }
  792.         pending_list_p->next = temp_pending_list_p;
  793.     }
  794. }
  795. /*****************************************************************************
  796.  * FUNCTION
  797.  *  mmi_um_jmms_parse_attachment_async_callback
  798.  * DESCRIPTION
  799.  *  
  800.  * PARAMETERS
  801.  *  eRet        [IN]        
  802.  * RETURNS
  803.  *  void
  804.  *****************************************************************************/
  805. void mmi_um_jmms_parse_attachment_async_callback(JC_RETCODE eRet)
  806. {
  807.     /*----------------------------------------------------------------*/
  808.     /* Local Variables                                                */
  809.     /*----------------------------------------------------------------*/
  810.     U8 media_count = 0;
  811.     U32 uiExtraBytes = 0;
  812.     mmi_um_get_list_rsp_struct *mms_info_rsp = NULL;
  813.     um_jmms_attachment_present_list *temp_pending_list_p = NULL;
  814.     U8 number = 0;
  815.     /*----------------------------------------------------------------*/
  816.     /* Code Body                                                      */
  817.     /*----------------------------------------------------------------*/
  818.     mms_info_rsp = (mmi_um_get_list_rsp_struct*) g_um_jmms_rsp_struct;
  819.     temp_pending_list_p = g_jmms_context->g_attachment_pending_list;
  820.     if (temp_pending_list_p != NULL && eRet == JC_OK)
  821.     {
  822.         mmi_jmms_jdi_get_media_count(g_jmms_context->msg_handle, 0, &media_count, E_TRUE);
  823.         switch (mms_info_rsp->msg_box_type)
  824.         {
  825.             case UM_MSG_BOX_TYPE_INBOX:
  826.                 mmi_mms_get_number_of_messages(MMI_JMMS_INBOX, &number);
  827.                 uiExtraBytes =
  828.                     (U32) mmi_jmms_get_message_id(MMI_JMMS_INBOX, (U16) (number - temp_pending_list_p->index_to_parse));
  829.                 eRet = mmi_um_jmms_store_update_message(
  830.                         MMI_JMMS_INBOX,
  831.                         uiExtraBytes,
  832.                         media_count,
  833.                         (number - temp_pending_list_p->index_to_parse));
  834.                 break;
  835.             case UM_MSG_BOX_TYPE_UNSENT:
  836.                 mmi_mms_get_number_of_messages(MMI_JMMS_OUTBOX, &number);
  837.                 uiExtraBytes =
  838.                     (U32) mmi_jmms_get_message_id(
  839.                             MMI_JMMS_OUTBOX,
  840.                             (U16) (number - temp_pending_list_p->index_to_parse));
  841.                 eRet = mmi_um_jmms_store_update_message(
  842.                         MMI_JMMS_OUTBOX,
  843.                         uiExtraBytes,
  844.                         media_count,
  845.                         (number - temp_pending_list_p->index_to_parse));
  846.                 break;
  847.             case UM_MSG_BOX_TYPE_SENT:
  848.                 mmi_mms_get_number_of_messages(MMI_JMMS_SENT, &number);
  849.                 uiExtraBytes =
  850.                     (U32) mmi_jmms_get_message_id(MMI_JMMS_SENT, (U16) (number - temp_pending_list_p->index_to_parse));
  851.                 eRet = mmi_um_jmms_store_update_message(
  852.                         MMI_JMMS_SENT,
  853.                         uiExtraBytes,
  854.                         media_count,
  855.                         (number - temp_pending_list_p->index_to_parse));
  856.                 break;
  857.             case UM_MSG_BOX_TYPE_DRAFT:
  858.                 mmi_mms_get_number_of_messages(MMI_JMMS_DRAFTS, &number);
  859.                 uiExtraBytes =
  860.                     (U32) mmi_jmms_get_message_id(
  861.                             MMI_JMMS_DRAFTS,
  862.                             (U16) (number - temp_pending_list_p->index_to_parse));
  863.                 eRet = mmi_um_jmms_store_update_message(
  864.                         MMI_JMMS_DRAFTS,
  865.                         uiExtraBytes,
  866.                         media_count,
  867.                         (number - temp_pending_list_p->index_to_parse));
  868.         }
  869.     }
  870.     if (g_jmms_context->pParseContent != NULL)
  871.     {
  872.         if (g_jmms_context->pParseContent->pFileName != NULL)
  873.         {
  874.             jdd_MemFree(g_jmms_context->pParseContent->pFileName);
  875.             g_jmms_context->pParseContent->pFileName = NULL;
  876.         }
  877.         jdd_MemFree(g_jmms_context->pParseContent);
  878.         g_jmms_context->pParseContent = NULL;
  879.     }
  880.     if (g_jmms_context->msg_handle != NULL)
  881.     {
  882.         mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  883.         g_jmms_context->msg_handle = NULL;
  884.     }
  885.     /* if (eRet!=JC_OK)
  886.        {
  887.        mmi_jmms_free_attacment_pending_status_list();
  888.        mmi_um_jmms_get_message_list_rsp();
  889.        return;
  890.        } */
  891.     if (temp_pending_list_p != NULL)
  892.     {
  893.         g_jmms_context->g_attachment_pending_list = g_jmms_context->g_attachment_pending_list->next;
  894.         jdd_MemFree(temp_pending_list_p);
  895.         temp_pending_list_p = NULL;
  896.         if (g_jmms_context->g_attachment_pending_list != NULL)
  897.         {
  898.             mmi_um_jmms_parse_mms_for_attachment();
  899.         }
  900.         else
  901.         {
  902.             mmi_um_jmms_get_message_list_rsp();
  903.         }
  904.     }
  905.     else
  906.     {
  907.         mmi_um_jmms_get_message_list_rsp();
  908.     }
  909.     return;
  910. }
  911. /*****************************************************************************
  912.  * FUNCTION
  913.  *  mmi_um_update_status_attachment
  914.  * DESCRIPTION
  915.  *  
  916.  * PARAMETERS
  917.  *  msg_index               [IN]        
  918.  *  attachment_status       [IN]        
  919.  * RETURNS
  920.  *  void
  921.  *****************************************************************************/
  922. void mmi_um_update_status_attachment(U16 msg_index, mmi_jmms_mms_attachment_status_enum attachment_status)
  923. {
  924.     /*----------------------------------------------------------------*/
  925.     /* Local Variables                                                */
  926.     /*----------------------------------------------------------------*/
  927.     jmms_folder_msgs_list *msg_list_p = g_jmms_context->store_context->messages_list;
  928.     /*----------------------------------------------------------------*/
  929.     /* Code Body                                                      */
  930.     /*----------------------------------------------------------------*/
  931.     while (msg_list_p != NULL)
  932.     {
  933.         if (msg_list_p->um_msg_info->msg_index == msg_index)
  934.         {
  935.             msg_list_p->attachment_status = attachment_status;
  936.             return;
  937.         }
  938.         msg_list_p = msg_list_p->next;
  939.     }
  940.     return;
  941. }
  942. /*****************************************************************************
  943.  * FUNCTION
  944.  *  mmi_um_jmms_get_fill_list_info
  945.  * DESCRIPTION
  946.  *  
  947.  * PARAMETERS
  948.  *  mms_info_rsp        [?]     
  949.  *  msg_info_req        [?]     
  950.  * RETURNS
  951.  *  void
  952.  *****************************************************************************/
  953. void mmi_um_jmms_get_fill_list_info(
  954.         mmi_um_get_msg_info_rsp_struct *mms_info_rsp,
  955.         mmi_um_get_msg_info_req_struct *msg_info_req)
  956. {
  957.     /*----------------------------------------------------------------*/
  958.     /* Local Variables                                                */
  959.     /*----------------------------------------------------------------*/
  960.     U32 tzdiff = 0;
  961.     S32 msg_counter = 0;
  962.     jmms_folder_msgs_list *msg_list_p = g_jmms_context->store_context->messages_list;
  963.     S8 *name = NULL;
  964.     applib_time_struct time;
  965.     FLOAT tz;
  966.     /*----------------------------------------------------------------*/
  967.     /* Code Body                                                      */
  968.     /*----------------------------------------------------------------*/
  969.     tz = mmi_dt_get_tz();
  970.     if(tz < 0)
  971.     {
  972.         time = applib_conv_tz_to_mytime(tz * (-1));
  973.     }
  974.     else
  975.     {
  976.         time = applib_conv_tz_to_mytime(tz);
  977.     }
  978.     tzdiff =  time.nHour * 3600 + time.nMin * 60 + time.nSec;  //mmi_dt_mytime_2_utc_sec(&time, MMI_TRUE);
  979.     while (msg_list_p != NULL && msg_list_p->um_msg_info->msg_index != mms_info_rsp->start_entry)
  980.     {
  981.         msg_list_p = msg_list_p->next;
  982.     }
  983.     for (msg_counter = 0; (msg_list_p != NULL && msg_counter <= mms_info_rsp->msg_number); msg_counter++)
  984.     {
  985.         mms_info_rsp->msg_info[msg_counter].timestamp = msg_list_p->um_msg_info->timestamp;
  986.         if(mms_info_rsp->msg_info[msg_counter].timestamp)
  987.         {
  988.             if(tz > 0)
  989.             {
  990.                 mms_info_rsp->msg_info[msg_counter].timestamp += tzdiff;
  991.             }
  992.             else
  993.             {
  994.                 mms_info_rsp->msg_info[msg_counter].timestamp -= tzdiff;
  995.             }
  996.         }
  997.         switch (msg_list_p->attachment_status)
  998.         {
  999.             case E_JMMS_ATTACHMENT_PRESENT:
  1000.                 mms_info_rsp->msg_info[msg_counter].icon_id = IMG_ID_JMMS_MMS_WITH_ATTACHMENT;
  1001.                 break;
  1002.             case E_JMMS_ATTACHMENT_NOT_PRESENT:
  1003.                 mms_info_rsp->msg_info[msg_counter].icon_id = IMG_ID_JMMS_MMS_WITHOUT_ATTACHMENT;
  1004.                 break;
  1005.             default:
  1006.                 mms_info_rsp->msg_info[msg_counter].icon_id = IMG_ID_JMMS_MMS_WITHOUT_ATTACHMENT;
  1007.                 break;
  1008.                 break;
  1009.         }
  1010.         mms_info_rsp->msg_info[msg_counter].msg_index = msg_list_p->um_msg_info->msg_index;
  1011.         pfnUnicodeStrcpy((S8*) mms_info_rsp->msg_info[msg_counter].address, (S8*) msg_list_p->um_msg_info->address);
  1012.         mms_info_rsp->msg_info[msg_counter].address_length = msg_list_p->um_msg_info->address_length;
  1013.         mms_info_rsp->msg_info[msg_counter].address_type = msg_list_p->um_msg_info->address_type;
  1014.         pfnUnicodeStrcpy((S8*) mms_info_rsp->msg_info[msg_counter].subject, (S8*) msg_list_p->um_msg_info->subject);
  1015.         mms_info_rsp->msg_info[msg_counter].subject_length = msg_list_p->um_msg_info->subject_length;
  1016.         if (mms_info_rsp->msg_info[msg_counter].address_type == UM_ADDR_TYPE_PHONE_NUMBER)
  1017.         {
  1018.             name = (S8*) lookUpNumber((PS8) mms_info_rsp->msg_info[msg_counter].address);
  1019.             if (pfnUnicodeStrlen(name))
  1020.             {
  1021.                 pfnUnicodeStrncpy(
  1022.                     (S8*) mms_info_rsp->msg_info[msg_counter].address,
  1023.                     (S8*) name,
  1024.                     pfnUnicodeStrlen(name));
  1025.                 mms_info_rsp->msg_info[msg_counter].address_length = pfnUnicodeStrlen(name);
  1026.             }
  1027.         }
  1028.         name = NULL;
  1029.         msg_list_p = msg_list_p->next;
  1030.     }   /* End of For Loop */
  1031. }
  1032. /*****************************************************************************
  1033.  * FUNCTION
  1034.  *  mmi_um_jmms_parse_mms_for_attachment
  1035.  * DESCRIPTION
  1036.  *  
  1037.  * PARAMETERS
  1038.  *  void
  1039.  * RETURNS
  1040.  *  void
  1041.  *****************************************************************************/
  1042. void mmi_um_jmms_parse_mms_for_attachment(void)
  1043. {
  1044.     /*----------------------------------------------------------------*/
  1045.     /* Local Variables                                                */
  1046.     /*----------------------------------------------------------------*/
  1047.     JC_RETCODE eRet = JC_OK;
  1048.     U8 number = 0;
  1049.     um_jmms_attachment_present_list *temp_pending_list_p = NULL;
  1050.     mmi_um_get_list_rsp_struct *mms_info_rsp = NULL;
  1051.     /*----------------------------------------------------------------*/
  1052.     /* Code Body                                                      */
  1053.     /*----------------------------------------------------------------*/
  1054.     mms_info_rsp = (mmi_um_get_list_rsp_struct*) g_um_jmms_rsp_struct;
  1055.     temp_pending_list_p = g_jmms_context->g_attachment_pending_list;
  1056.     if (g_jmms_context->pParseContent == NULL)
  1057.     {
  1058.         g_jmms_context->pParseContent = (CONTENT_DATA*) jdd_MemAlloc(sizeof(CONTENT_DATA), 1);
  1059.     }
  1060.     g_jmms_context->pParseContent->bIsStream = E_TRUE;
  1061.     if (g_jmms_context->msg_handle != NULL)
  1062.     {
  1063.         mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  1064.         g_jmms_context->msg_handle = NULL;
  1065.     }
  1066.     if (temp_pending_list_p != NULL)
  1067.     {
  1068.         switch (mms_info_rsp->msg_box_type)
  1069.         {
  1070.             case UM_MSG_BOX_TYPE_INBOX:
  1071.                 mmi_mms_get_number_of_messages(MMI_JMMS_INBOX, &number);
  1072.                 eRet = mmi_jmms_get_message(
  1073.                         MMI_JMMS_INBOX,
  1074.                         g_jmms_context->pParseContent,
  1075.                         number - temp_pending_list_p->index_to_parse);
  1076.                 break;
  1077.             case UM_MSG_BOX_TYPE_UNSENT:
  1078.                 mmi_mms_get_number_of_messages(MMI_JMMS_OUTBOX, &number);
  1079.                 eRet = mmi_jmms_get_message(
  1080.                         MMI_JMMS_OUTBOX,
  1081.                         g_jmms_context->pParseContent,
  1082.                         number - temp_pending_list_p->index_to_parse);
  1083.                 break;
  1084.             case UM_MSG_BOX_TYPE_SENT:
  1085.                 mmi_mms_get_number_of_messages(MMI_JMMS_SENT, &number);
  1086.                 eRet = mmi_jmms_get_message(
  1087.                         MMI_JMMS_SENT,
  1088.                         g_jmms_context->pParseContent,
  1089.                         number - temp_pending_list_p->index_to_parse);
  1090.                 break;
  1091.             case UM_MSG_BOX_TYPE_DRAFT:
  1092.                 mmi_mms_get_number_of_messages(MMI_JMMS_DRAFTS, &number);
  1093.                 eRet = mmi_jmms_get_message(
  1094.                         MMI_JMMS_DRAFTS,
  1095.                         g_jmms_context->pParseContent,
  1096.                         number - temp_pending_list_p->index_to_parse);
  1097.                 break;
  1098.         }
  1099.         if (eRet != JC_OK)
  1100.         {
  1101.             mmi_um_jmms_parse_attachment_async_callback(eRet);
  1102.             return;
  1103.         }
  1104.         eRet = mmi_jmms_jdi_parse_msg_buffer(
  1105.                 &g_jmms_context->msg_handle,
  1106.                 g_jmms_context->pParseContent,
  1107.                 E_TYPE_MMS,
  1108.                 E_TRUE);
  1109.         if (eRet == JC_ERR_MMS_PARSE_PENDING)
  1110.         {
  1111.             mmi_jmms_parse_continue_start_timer(
  1112.                 g_jmms_context->msg_handle,
  1113.                 mmi_um_jmms_parse_attachment_async_callback, mmi_jmms_only_abort_parsing_progress);
  1114.             return;
  1115.         }
  1116.     }
  1117.     mmi_um_jmms_parse_attachment_async_callback(eRet);
  1118.     return;
  1119. }
  1120. /*****************************************************************************
  1121.  * FUNCTION
  1122.  *  mmi_um_jmms_get_fill_list
  1123.  * DESCRIPTION
  1124.  *  
  1125.  * PARAMETERS
  1126.  *  mms_list_rsp        [?]     
  1127.  *  msg_list_req        [?]     
  1128.  * RETURNS
  1129.  *  void
  1130.  *****************************************************************************/
  1131. void mmi_um_jmms_get_fill_list(mmi_um_get_list_rsp_struct *mms_list_rsp, mmi_um_get_list_req_struct *msg_list_req)
  1132. {
  1133.     /*----------------------------------------------------------------*/
  1134.     /* Local Variables                                                */
  1135.     /*----------------------------------------------------------------*/
  1136.     JC_RETCODE eRet = JC_OK;
  1137.     /*----------------------------------------------------------------*/
  1138.     /* Code Body                                                      */
  1139.     /*----------------------------------------------------------------*/
  1140.     g_jmms_context->store_context->jmms_start_index = mms_list_rsp->start_entry + 1;
  1141.     switch (mms_list_rsp->msg_box_type)
  1142.     {
  1143.         case UM_MSG_BOX_TYPE_INBOX:
  1144.             eRet = mmi_jmms_get_folder_msg_list(
  1145.                     &(g_jmms_context->store_context->messages_list),
  1146.                     MMI_JMMS_INBOX,
  1147.                     mms_list_rsp->msg_number);
  1148.             break;
  1149.         case UM_MSG_BOX_TYPE_UNSENT:
  1150.             eRet = mmi_jmms_get_folder_msg_list(
  1151.                     &(g_jmms_context->store_context->messages_list),
  1152.                     MMI_JMMS_OUTBOX,
  1153.                     mms_list_rsp->msg_number);
  1154.             break;
  1155.         case UM_MSG_BOX_TYPE_SENT:
  1156.             eRet = mmi_jmms_get_folder_msg_list(
  1157.                     &(g_jmms_context->store_context->messages_list),
  1158.                     MMI_JMMS_SENT,
  1159.                     mms_list_rsp->msg_number);
  1160.             break;
  1161.         case UM_MSG_BOX_TYPE_DRAFT:
  1162.             eRet = mmi_jmms_get_folder_msg_list(
  1163.                     &(g_jmms_context->store_context->messages_list),
  1164.                     MMI_JMMS_DRAFTS,
  1165.                     mms_list_rsp->msg_number);
  1166.             break;
  1167.     }
  1168.     if (eRet != JC_OK || g_jmms_context->store_context->messages_list == NULL)
  1169.     {
  1170.         return;
  1171.     }
  1172. }
  1173. /*****************************************************************************
  1174.  * FUNCTION
  1175.  *  mmi_um_jmms_generate_list
  1176.  * DESCRIPTION
  1177.  *  
  1178.  * PARAMETERS
  1179.  *  mms_list_rsp        [?]     
  1180.  * RETURNS
  1181.  *  
  1182.  *****************************************************************************/
  1183. JC_RETCODE mmi_um_jmms_generate_list(mmi_um_get_list_rsp_struct *mms_list_rsp)
  1184. {
  1185.     /*----------------------------------------------------------------*/
  1186.     /* Local Variables                                                */
  1187.     /*----------------------------------------------------------------*/
  1188.     JC_RETCODE eRet = JC_OK;
  1189.     S32 msg_counter = 0;
  1190.     U32 tzdiff = 0;
  1191.     applib_time_struct time;
  1192.     FLOAT tz;
  1193.     jmms_folder_msgs_list *msg_list_p = g_jmms_context->store_context->messages_list;
  1194.     /*----------------------------------------------------------------*/
  1195.     /* Code Body                                                      */
  1196.     /*----------------------------------------------------------------*/
  1197.     msg_counter = 0;
  1198.     if (msg_list_p == NULL)
  1199.     {
  1200.         return JC_ERR_MEMORY_ALLOCATION;
  1201.     }
  1202.     tz = mmi_dt_get_tz();
  1203.     if(tz < 0)
  1204.     {
  1205.         time = applib_conv_tz_to_mytime(tz * (-1));
  1206.     }
  1207.     else
  1208.     {
  1209.         time = applib_conv_tz_to_mytime(tz);
  1210.     }
  1211.     tzdiff =  time.nHour * 3600 + time.nMin * 60 + time.nSec;
  1212.     while (msg_list_p != NULL)
  1213.     {
  1214.         mms_list_rsp->list_info[msg_counter].timestamp = msg_list_p->um_msg_info->timestamp;
  1215.         if(mms_list_rsp->list_info[msg_counter].timestamp)
  1216.         {
  1217.             if(tz > 0)
  1218.             {
  1219.                 mms_list_rsp->list_info[msg_counter].timestamp += tzdiff;
  1220.             }
  1221.             else
  1222.             {
  1223.                 mms_list_rsp->list_info[msg_counter].timestamp -= tzdiff;
  1224.             }
  1225.         }
  1226.         mms_list_rsp->list_info[msg_counter].msg_index = msg_list_p->um_msg_info->msg_index;
  1227.         msg_counter++;
  1228.         msg_list_p = msg_list_p->next;
  1229.     }
  1230.     return eRet;
  1231. }
  1232. /*****************************************************************************
  1233.  * FUNCTION
  1234.  *  mmi_um_jmms_delete_all
  1235.  * DESCRIPTION
  1236.  *  
  1237.  * PARAMETERS
  1238.  *  void
  1239.  * RETURNS
  1240.  *  void
  1241.  *****************************************************************************/
  1242. void mmi_um_jmms_delete_all(void)
  1243. {
  1244.     /*----------------------------------------------------------------*/
  1245.     /* Local Variables                                                */
  1246.     /*----------------------------------------------------------------*/
  1247.     /*----------------------------------------------------------------*/
  1248.     /* Code Body                                                      */
  1249.     /*----------------------------------------------------------------*/
  1250.     if (g_jmms_context->msg_handle != NULL)
  1251.     {
  1252.         mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  1253.         g_jmms_context->msg_handle = NULL;
  1254.     }
  1255.     switch (g_jmms_context->store_context->current_folder_name)
  1256.     {
  1257.         case E_JMMS_INBOX:
  1258.             HistoryReplace(SCR_ID_UM_INBOX, SCR_ID_UM_INBOX, mmi_um_jmms_pre_entry_inbox);
  1259.             DeleteUptoScrID(SCR_ID_UM_INBOX);
  1260.             mmi_um_delete_highlight_folder(UM_MSG_BOX_TYPE_INBOX);
  1261.             break;
  1262.         case E_JMMS_OUTBOX:
  1263.             HistoryReplace(SCR_ID_UM_UNSENT, SCR_ID_UM_UNSENT, mmi_um_jmms_pre_entry_outbox);
  1264.             DeleteUptoScrID(SCR_ID_UM_UNSENT);
  1265.             mmi_um_delete_highlight_folder(UM_MSG_BOX_TYPE_UNSENT);
  1266.             break;
  1267.         case E_JMMS_SENT:
  1268.             HistoryReplace(SCR_ID_UM_SENT, SCR_ID_UM_SENT, mmi_um_jmms_pre_entry_sent);
  1269.             DeleteUptoScrID(SCR_ID_UM_SENT);
  1270.             mmi_um_delete_highlight_folder(UM_MSG_BOX_TYPE_SENT);
  1271.             break;
  1272.         case E_JMMS_DRAFTS:
  1273.             HistoryReplace(SCR_ID_UM_DRAFT, SCR_ID_UM_DRAFT, mmi_um_jmms_pre_entry_draft);
  1274.             DeleteUptoScrID(SCR_ID_UM_DRAFT);
  1275.             mmi_um_delete_highlight_folder(UM_MSG_BOX_TYPE_DRAFT);
  1276.             break;
  1277.     }
  1278. }
  1279. /*****************************************************************************
  1280.  * FUNCTION
  1281.  *  mmi_um_jmms_get_push_message_count_req
  1282.  * DESCRIPTION
  1283.  *  
  1284.  * PARAMETERS
  1285.  *  void
  1286.  * RETURNS
  1287.  *  void
  1288.  *****************************************************************************/
  1289. void mmi_um_jmms_get_push_message_count_req(void)
  1290. {
  1291.     /*----------------------------------------------------------------*/
  1292.     /* Local Variables                                                */
  1293.     /*----------------------------------------------------------------*/
  1294.     MYQUEUE Message;
  1295.     mmi_um_get_msg_num_rsp_struct *mms_count_rsp_p;
  1296.     U8 total_num_unread_messages = 0;
  1297.     U8 number = 0;
  1298.     /*----------------------------------------------------------------*/
  1299.     /* Code Body                                                      */
  1300.     /*----------------------------------------------------------------*/
  1301.     mms_count_rsp_p = (mmi_um_get_msg_num_rsp_struct*) OslConstructDataPtr(sizeof(mmi_um_get_msg_num_rsp_struct));
  1302.     mms_count_rsp_p->result = KAL_TRUE;
  1303.     mms_count_rsp_p->msg_type = UM_MSG_TYPE_MMS;
  1304.     mmi_jmms_get_number_of_unread_messages_in_inbox(&total_num_unread_messages);        /* mms_count_rsp_p->inbox_unread_msg_number = 0; */
  1305.     mmi_mms_get_number_of_messages(MMI_JMMS_INBOX, &number);
  1306.     mms_count_rsp_p->inbox_unread_msg_number = total_num_unread_messages;
  1307.     mms_count_rsp_p->inbox_read_msg_number = number - total_num_unread_messages;
  1308.     mmi_mms_get_number_of_messages(MMI_JMMS_OUTBOX, &number);
  1309.     mms_count_rsp_p->unsent_msg_number = number;
  1310.     mmi_mms_get_number_of_messages(MMI_JMMS_SENT, &number);
  1311.     mms_count_rsp_p->sent_msg_number = number;
  1312.     mmi_mms_get_number_of_messages(MMI_JMMS_DRAFTS, &number);
  1313.     mms_count_rsp_p->draft_msg_number = number;
  1314.     if (g_jmms_context->store_context != NULL && g_jmms_context->store_context->messages_list != NULL)
  1315.     {
  1316.         mmi_jmms_free_msgs_list(&(g_jmms_context->store_context->messages_list));
  1317.     }
  1318.     /* Prepare response structure */
  1319.     Message.oslSrcId = MOD_WAP;
  1320.     Message.oslDestId = MOD_MMI;
  1321.     Message.oslMsgId = MSG_ID_MMI_UM_GET_MSG_NUM_RSP;
  1322.     Message.oslDataPtr = (oslParaType*) mms_count_rsp_p;
  1323.     Message.oslPeerBuffPtr = NULL;
  1324.     OslMsgSendExtQueue(&Message);
  1325. }
  1326. /*****************************************************************************
  1327.  * FUNCTION
  1328.  *  mmi_um_jmms_get_message_list_rsp
  1329.  * DESCRIPTION
  1330.  *  
  1331.  * PARAMETERS
  1332.  *  void
  1333.  * RETURNS
  1334.  *  void
  1335.  *****************************************************************************/
  1336. void mmi_um_jmms_get_message_list_rsp(void)
  1337. {
  1338.     /*----------------------------------------------------------------*/
  1339.     /* Local Variables                                                */
  1340.     /*----------------------------------------------------------------*/
  1341.     MYQUEUE Message;
  1342.     mmi_um_get_list_rsp_struct *mms_list_rsp = NULL;
  1343.     /*----------------------------------------------------------------*/
  1344.     /* Code Body                                                      */
  1345.     /*----------------------------------------------------------------*/
  1346.     mms_list_rsp = (mmi_um_get_list_rsp_struct*) g_um_jmms_rsp_struct;
  1347.     mms_list_rsp->result = KAL_TRUE;
  1348.     mmi_um_jmms_generate_list(mms_list_rsp);
  1349.     /* Prepare response structure */
  1350.     Message.oslSrcId = MOD_WAP;
  1351.     Message.oslDestId = MOD_MMI;
  1352.     Message.oslMsgId = MSG_ID_MMI_UM_GET_LIST_RSP;
  1353.     /* Send Response to MMI Queue */
  1354.     Message.oslDataPtr = (oslParaType*) mms_list_rsp;
  1355.     Message.oslPeerBuffPtr = NULL;
  1356.     OslMsgSendExtQueue(&Message);
  1357. }
  1358. /*****************************************************************************
  1359.  * FUNCTION
  1360.  *  mmi_um_jmms_get_mms_message_list_req
  1361.  * DESCRIPTION
  1362.  *  
  1363.  * PARAMETERS
  1364.  *  msg_list_req        [?]     
  1365.  * RETURNS
  1366.  *  void
  1367.  *****************************************************************************/
  1368. void mmi_um_jmms_get_mms_message_list_req(mmi_um_get_list_req_struct *msg_list_req)
  1369. {
  1370.     /*----------------------------------------------------------------*/
  1371.     /* Local Variables                                                */
  1372.     /*----------------------------------------------------------------*/
  1373.     mmi_um_get_list_rsp_struct *mms_list_rsp;
  1374.     U8 number = 0;
  1375.     /*----------------------------------------------------------------*/
  1376.     /* Code Body                                                      */
  1377.     /*----------------------------------------------------------------*/
  1378.     switch (msg_list_req->msg_box_type)
  1379.     {
  1380.         case UM_MSG_BOX_TYPE_INBOX:
  1381.             mmi_mms_get_number_of_messages(MMI_JMMS_INBOX, &number);
  1382.             break;
  1383.         case UM_MSG_BOX_TYPE_UNSENT:
  1384.             mmi_mms_get_number_of_messages(MMI_JMMS_OUTBOX, &number);
  1385.             break;
  1386.         case UM_MSG_BOX_TYPE_SENT:
  1387.             mmi_mms_get_number_of_messages(MMI_JMMS_SENT, &number);
  1388.             break;
  1389.         case UM_MSG_BOX_TYPE_DRAFT:
  1390.             mmi_mms_get_number_of_messages(MMI_JMMS_DRAFTS, &number);
  1391.             break;
  1392.     }
  1393.     mms_list_rsp = (mmi_um_get_list_rsp_struct*) OslConstructDataPtr(sizeof(mmi_um_get_list_rsp_struct));
  1394.  //   memset(mms_list_rsp, 0, sizeof(mmi_um_get_list_rsp_struct));
  1395.     mms_list_rsp->msg_type = UM_MSG_TYPE_MMS;
  1396.     mms_list_rsp->msg_box_type = msg_list_req->msg_box_type;
  1397.     mms_list_rsp->start_entry = msg_list_req->start_entry;
  1398.     if (mms_list_rsp->start_entry + MMI_UM_MAX_GET_LIST_MSG_NUMBER < number)
  1399.     {
  1400.         mms_list_rsp->msg_number = MMI_UM_MAX_GET_LIST_MSG_NUMBER;
  1401.         mms_list_rsp->more = TRUE;
  1402.     }
  1403.     else
  1404.     {
  1405.         mms_list_rsp->msg_number = number - mms_list_rsp->start_entry;
  1406.         mms_list_rsp->more = FALSE;
  1407.     }
  1408.     g_um_jmms_rsp_struct = (void*)mms_list_rsp;
  1409.     mmi_um_jmms_set_folder_list_callback_function(mmi_um_jmms_parse_mms_for_attachment);
  1410.     if (g_jmms_context->store_context != NULL && g_jmms_context->store_context->messages_list != NULL)
  1411.     {
  1412.         mmi_jmms_free_msgs_list(&(g_jmms_context->store_context->messages_list));
  1413.     }
  1414.     mmi_um_jmms_get_fill_list(mms_list_rsp, ((mmi_um_get_list_req_struct*) msg_list_req));
  1415. }
  1416. /*****************************************************************************
  1417.  * FUNCTION
  1418.  *  mmi_um_jmms_get_mms_message_info_req
  1419.  * DESCRIPTION
  1420.  *  
  1421.  * PARAMETERS
  1422.  *  msg_info_req        [?]     
  1423.  * RETURNS
  1424.  *  void
  1425.  *****************************************************************************/
  1426. void mmi_um_jmms_get_mms_message_info_req(mmi_um_get_msg_info_req_struct *msg_info_req)
  1427. {
  1428.     /*----------------------------------------------------------------*/
  1429.     /* Local Variables                                                */
  1430.     /*----------------------------------------------------------------*/
  1431.     MYQUEUE Message;
  1432.     mmi_um_get_msg_info_rsp_struct *mms_info_rsp = NULL;
  1433.     /*----------------------------------------------------------------*/
  1434.     /* Code Body                                                      */
  1435.     /*----------------------------------------------------------------*/
  1436.     mms_info_rsp = (mmi_um_get_msg_info_rsp_struct*) OslConstructDataPtr(sizeof(mmi_um_get_msg_info_rsp_struct));
  1437.  //   memset(mms_info_rsp, 0, sizeof(mmi_um_get_msg_info_rsp_struct));
  1438.     mms_info_rsp->result = KAL_TRUE;
  1439.     mms_info_rsp->msg_type = UM_MSG_TYPE_MMS;
  1440.     mms_info_rsp->msg_box_type = msg_info_req->msg_box_type;
  1441.     mms_info_rsp->start_entry = msg_info_req->start_entry;
  1442.     mms_info_rsp->msg_number = msg_info_req->msg_number;
  1443.     mmi_um_jmms_get_fill_list_info(mms_info_rsp, msg_info_req);
  1444.     mmi_um_jmms_at_delete_pre_set();
  1445.     /* Prepare response structure */
  1446.     Message.oslSrcId = MOD_WAP;
  1447.     Message.oslDestId = MOD_MMI;
  1448.     Message.oslMsgId = MSG_ID_MMI_UM_GET_MSG_INFO_RSP;
  1449.     /* Send Response to MMI Queue */
  1450.     Message.oslDataPtr = (oslParaType*) mms_info_rsp;
  1451.     Message.oslPeerBuffPtr = NULL;
  1452.     OslMsgSendExtQueue(&Message);
  1453. }
  1454. /*****************************************************************************
  1455.  * FUNCTION
  1456.  *  mmi_um_jmms_delete_all_mms_message_req
  1457.  * DESCRIPTION
  1458.  *  
  1459.  * PARAMETERS
  1460.  *  msg_delete_all_req      [?]     
  1461.  * RETURNS
  1462.  *  void
  1463.  *****************************************************************************/
  1464. void mmi_um_jmms_delete_all_mms_message_req(mmi_um_delete_folder_req_struct *msg_delete_all_req)
  1465. {
  1466.     /*----------------------------------------------------------------*/
  1467.     /* Local Variables                                                */
  1468.     /*----------------------------------------------------------------*/
  1469.     MYQUEUE Message;
  1470.     mmi_um_delete_folder_rsp_struct *mms_delete_all_rsp = NULL;
  1471.     JC_RETCODE eRet = JC_OK;
  1472.     S16 number = 0;
  1473.     /*----------------------------------------------------------------*/
  1474.     /* Code Body                                                      */
  1475.     /*----------------------------------------------------------------*/
  1476.     mms_delete_all_rsp =
  1477.         (mmi_um_delete_folder_rsp_struct*) OslConstructDataPtr(sizeof(mmi_um_delete_folder_rsp_struct));
  1478.     /* memset(mms_delete_all_rsp, 0, sizeof(mmi_um_delete_folder_rsp_struct)); */
  1479.     mms_delete_all_rsp->msg_type = msg_delete_all_req->msg_type;
  1480.     number = mmi_jmms_get_number_of_messages_from_msg_box_type(msg_delete_all_req->msg_box_type);
  1481. if(number >= 0)
  1482. {
  1483. if(number == 0)
  1484. {
  1485. mms_delete_all_rsp->result = KAL_TRUE;
  1486. }
  1487. else
  1488. {
  1489. #ifdef __USB_IN_NORMAL_MODE__
  1490. if(mmi_jmms_check_usb_mode() == 0)
  1491. #endif /*__USB_IN_NORMAL_MODE__*/
  1492. {
  1493. eRet = mmi_jmms_delete_all_msgs_list(msg_delete_all_req->msg_box_type);
  1494. if (eRet == JC_OK)
  1495. {
  1496. mms_delete_all_rsp->result = KAL_TRUE;
  1497. }
  1498. else
  1499. {
  1500. mms_delete_all_rsp->result = KAL_FALSE;
  1501. }
  1502. }
  1503. #ifdef __USB_IN_NORMAL_MODE__
  1504. else
  1505. {
  1506. mms_delete_all_rsp->result = KAL_FALSE;
  1507. }
  1508. #endif
  1509. }
  1510. }
  1511. else
  1512. {
  1513. mms_delete_all_rsp->result = KAL_FALSE;
  1514. }
  1515.     /* Prepare response structure */
  1516.     Message.oslSrcId = MOD_WAP;
  1517.     Message.oslDestId = MOD_MMI;
  1518.     Message.oslMsgId = MSG_ID_MMI_UM_DELETE_FOLDER_RSP;
  1519.     /* Send Response to MMI Queue */
  1520.     Message.oslDataPtr = (oslParaType*) mms_delete_all_rsp;
  1521.     Message.oslPeerBuffPtr = NULL;
  1522.     OslMsgSendExtQueue(&Message);
  1523. }
  1524. /*****************************************************************************
  1525.  * FUNCTION
  1526.  *  mmi_um_jmms_ready_ind
  1527.  * DESCRIPTION
  1528.  *  Function to send an indication to UM that browser is ready.
  1529.  * PARAMETERS
  1530.  *  void
  1531.  * RETURNS
  1532.  *  void
  1533.  *****************************************************************************/
  1534. void mmi_um_jmms_ready_ind(void)
  1535. {
  1536.     /*----------------------------------------------------------------*/
  1537.     /* Local Variables                                                */
  1538.     /*----------------------------------------------------------------*/
  1539.     MYQUEUE Message;
  1540.     mmi_um_ready_ind_struct *mms_um_ready_ind;
  1541.     /*----------------------------------------------------------------*/
  1542.     /* Code Body                                                      */
  1543.     /*----------------------------------------------------------------*/
  1544.     mms_um_ready_ind = (mmi_um_ready_ind_struct*) OslConstructDataPtr(sizeof(mmi_um_ready_ind_struct));
  1545.     mms_um_ready_ind->result = KAL_TRUE;
  1546.     mms_um_ready_ind->msg_type = UM_MSG_TYPE_MMS;
  1547.     /* Prepare response structure */
  1548.     Message.oslSrcId = MOD_WAP;
  1549.     Message.oslDestId = MOD_MMI;
  1550.     Message.oslMsgId = MSG_ID_MMI_UM_READY_IND;
  1551.     /* Send Response to MMI Queue */
  1552.     Message.oslDataPtr = (oslParaType*) mms_um_ready_ind;
  1553.     Message.oslPeerBuffPtr = NULL;
  1554.     OslMsgSendExtQueue(&Message);
  1555. }
  1556. /*****************************************************************************
  1557.  * FUNCTION
  1558.  *  mmi_um_delete_all_mms_messages_rsp
  1559.  * DESCRIPTION
  1560.  *  Function to recieve information that if user has confirmed
  1561.  *  to delete all mms messages or not.
  1562.  * PARAMETERS
  1563.  *  result      [IN]        - confirmation of deletion of all messages.
  1564.  * RETURNS
  1565.  *  void
  1566.  *****************************************************************************/
  1567. void mmi_um_delete_all_mms_messages_rsp(U16 result)
  1568. {
  1569.     /*----------------------------------------------------------------*/
  1570.     /* Local Variables                                                */
  1571.     /*----------------------------------------------------------------*/
  1572.     /*----------------------------------------------------------------*/
  1573.     /* Code Body                                                      */
  1574.     /*----------------------------------------------------------------*/
  1575.     if (result == KAL_TRUE && !(IsScreenPresent(SCR_ID_UM_INBOX) || IsScreenPresent(SCR_ID_UM_UNSENT)
  1576.         || IsScreenPresent(SCR_ID_UM_SENT) ||IsScreenPresent(SCR_ID_UM_DRAFT) ))
  1577.     {
  1578.         DeleteUptoScrID(SCR_ID_UM_MAIN);
  1579.     }
  1580. }
  1581. /*****************************************************************************
  1582.  * FUNCTION
  1583.  *  mmi_um_delete_highlight_folder
  1584.  * DESCRIPTION
  1585.  *  
  1586.  * PARAMETERS
  1587.  *  folder      [IN]        
  1588.  * RETURNS
  1589.  *  void
  1590.  *****************************************************************************/
  1591. void mmi_um_delete_highlight_folder(um_msg_delete_folder_enum folder)
  1592. {
  1593.     /*----------------------------------------------------------------*/
  1594.     /* Local Variables                                                */
  1595.     /*----------------------------------------------------------------*/
  1596.     MYQUEUE Message;
  1597.     mmi_um_delete_all_ind_struct *mms_delete_all_ind;
  1598.     /*----------------------------------------------------------------*/
  1599.     /* Code Body                                                      */
  1600.     /*----------------------------------------------------------------*/
  1601.     mms_delete_all_ind = (mmi_um_delete_all_ind_struct*) OslConstructDataPtr(sizeof(mmi_um_delete_all_ind_struct));
  1602.     mms_delete_all_ind->msg_type = UM_MSG_TYPE_MMS;
  1603.     mms_delete_all_ind->msg_box_type = folder;
  1604.     /* Prepare response structure */
  1605.     Message.oslSrcId = MOD_WAP;
  1606.     Message.oslDestId = MOD_MMI;
  1607.     Message.oslMsgId = MSG_ID_MMI_UM_DELETE_ALL_IND;
  1608.     /* Send Response to MMI Queue */
  1609.     Message.oslDataPtr = (oslParaType*) mms_delete_all_ind;
  1610.     Message.oslPeerBuffPtr = NULL;
  1611.     OslMsgSendExtQueue(&Message);
  1612. }
  1613. /*****************************************************************************
  1614.  * FUNCTION
  1615.  *  mmi_um_jmms_new_mms_timestamp
  1616.  * DESCRIPTION
  1617.  *  Function to send an indication to UM that a new mms message has arrived.
  1618.  * PARAMETERS
  1619.  *  void
  1620.  *  pServiceValue       [?](?)
  1621.  * RETURNS
  1622.  *  void
  1623.  *****************************************************************************/
  1624. U64 mmi_um_jmms_new_mms_timestamp(U16 msg_index)
  1625. {
  1626.     /*----------------------------------------------------------------*/
  1627.     /* Local Variables                                                */
  1628.     /*----------------------------------------------------------------*/
  1629.     JC_RETCODE eRet = JC_OK;
  1630.     RETRIEVE_FILTERS StoreRetFilter = {0, };
  1631.     MESSAGE_LIST *pMessageList = NULL;
  1632.     MESSAGE_LIST *pTempMsgList = NULL;
  1633.     U64 timestamp = 0;
  1634.     /*----------------------------------------------------------------*/
  1635.     /* Code Body                                                      */
  1636.     /*----------------------------------------------------------------*/
  1637.     StoreRetFilter.uiStartIndex = msg_index;
  1638.     StoreRetFilter.uiNumMessage = 1;
  1639.     StoreRetFilter.eRetrieve = E_RETRIEVE_BY_INDEX;
  1640.     eRet = mmi_jmms_get_messages_list("Inbox", &pTempMsgList, &StoreRetFilter);
  1641.     if (eRet != JC_OK || pTempMsgList == NULL)
  1642.     {
  1643.         return timestamp;   /* JC_ERR_MEMORY_ALLOCATION; */
  1644.     }
  1645.     pMessageList = pTempMsgList;
  1646.     switch (pMessageList->pMessageHeaders->eMsgType)
  1647.     {
  1648.         case E_MSG_TYPE_NOTIFICATION:
  1649.         {
  1650.             MESSAGE_NOTIFICATION *notification_p;
  1651.             notification_p = (MESSAGE_NOTIFICATION*) (pMessageList->pMessageHeaders->pHeaders);
  1652.             timestamp = (*notification_p).uiReceivedTime;
  1653.             break;
  1654.         }
  1655.         case E_MSG_TYPE_RECEIVE:
  1656.         {
  1657.             MESSAGE_RETRIEVAL *retrieval_p;
  1658.             retrieval_p = (MESSAGE_RETRIEVAL*) (pMessageList->pMessageHeaders->pHeaders);
  1659.             timestamp = retrieval_p->uiDate;
  1660.             break;
  1661.         }
  1662.         case E_MSG_TYPE_DELIVERY_REPORT:
  1663.         {
  1664.             DELIVERY_REPORT *delivery_p;
  1665.             delivery_p = (DELIVERY_REPORT*) (pMessageList->pMessageHeaders->pHeaders);
  1666.             timestamp = delivery_p->uiDate;
  1667.             break;
  1668.         }
  1669.         case E_MSG_TYPE_READ_REPORT_RESPONSE:
  1670.         {
  1671.             READ_REPORT_RESPONSE *read_report_p;
  1672.             read_report_p = (READ_REPORT_RESPONSE*) (pMessageList->pMessageHeaders->pHeaders);
  1673.             timestamp = (*read_report_p).uiReceivedTime;
  1674.             break;
  1675.         }
  1676.     }
  1677.     return timestamp;
  1678. }
  1679. /*****************************************************************************
  1680.  * FUNCTION
  1681.  *  mmi_um_jmms_new_mms_message_ind
  1682.  * DESCRIPTION
  1683.  *  
  1684.  * PARAMETERS
  1685.  *  void
  1686.  * RETURNS
  1687.  *  void
  1688.  *****************************************************************************/
  1689. void mmi_um_jmms_new_mms_message_ind(U16 msg_index)
  1690. {
  1691.     /*----------------------------------------------------------------*/
  1692.     /* Local Variables                                                */
  1693.     /*----------------------------------------------------------------*/
  1694.     MYQUEUE Message;
  1695.     mmi_um_new_msg_ind_struct *mms_new_msg_ind;
  1696.     /*----------------------------------------------------------------*/
  1697.     /* Code Body                                                      */
  1698.     /*----------------------------------------------------------------*/
  1699.     mms_new_msg_ind = (mmi_um_new_msg_ind_struct*) OslConstructDataPtr(sizeof(mmi_um_new_msg_ind_struct));
  1700.     mms_new_msg_ind->msg_type = UM_MSG_TYPE_MMS;
  1701.     mms_new_msg_ind->msg_box_type = UM_MSG_BOX_TYPE_INBOX;
  1702.     mms_new_msg_ind->msg_index = msg_index;
  1703.     mms_new_msg_ind->timestamp = mmi_um_jmms_new_mms_timestamp(msg_index);
  1704.     /* Prepare response structure */
  1705.     Message.oslSrcId = MOD_WAP;
  1706.     Message.oslDestId = MOD_MMI;
  1707.     Message.oslMsgId = MSG_ID_MMI_UM_NEW_MSG_IND;
  1708.     Message.oslDataPtr = (oslParaType*) mms_new_msg_ind;
  1709.     Message.oslPeerBuffPtr = NULL;
  1710.     OslMsgSendExtQueue(&Message);
  1711. }
  1712. /*****************************************************************************
  1713.  * FUNCTION
  1714.  *  mmi_um_jmms_refresh_ind
  1715.  * DESCRIPTION
  1716.  *  
  1717.  * PARAMETERS
  1718.  *  void
  1719.  * RETURNS
  1720.  *  void
  1721.  *****************************************************************************/
  1722. void mmi_um_jmms_refresh_ind(void)
  1723. {
  1724.     /*----------------------------------------------------------------*/
  1725.     /* Local Variables                                                */
  1726.     /*----------------------------------------------------------------*/
  1727.     MYQUEUE Message;
  1728.     mmi_um_refresh_ind_struct *mms_ref_msg_ind;
  1729.     /*----------------------------------------------------------------*/
  1730.     /* Code Body                                                      */
  1731.     /*----------------------------------------------------------------*/
  1732.     mms_ref_msg_ind = (mmi_um_refresh_ind_struct*) OslConstructDataPtr(sizeof(mmi_um_refresh_ind_struct));
  1733.     mms_ref_msg_ind->msg_type = UM_MSG_TYPE_MMS;
  1734.     mms_ref_msg_ind->msg_box_type = mmi_um_get_current_msg_box_type();
  1735.     /* Prepare response structure */
  1736.     Message.oslSrcId = MOD_WAP;
  1737.     Message.oslDestId = MOD_MMI;
  1738.     Message.oslMsgId = MSG_ID_MMI_UM_REFRESH_IND;
  1739.     Message.oslDataPtr = (oslParaType*) mms_ref_msg_ind;
  1740.     Message.oslPeerBuffPtr = NULL;
  1741.     OslMsgSendExtQueue(&Message);
  1742. }
  1743. /*****************************************************************************
  1744.  * FUNCTION
  1745.  *  mmi_um_jmms_highlight_mms_message_ind
  1746.  * DESCRIPTION
  1747.  *  Function to send information to UM about the currently highlighted item.
  1748.  * PARAMETERS
  1749.  *  void
  1750.  * RETURNS
  1751.  *  void
  1752.  *****************************************************************************/
  1753. void mmi_um_jmms_highlight_mms_message_ind(void)
  1754. {
  1755.     /*----------------------------------------------------------------*/
  1756.     /* Local Variables                                                */
  1757.     /*----------------------------------------------------------------*/
  1758.     MYQUEUE Message;
  1759.     mmi_um_highlight_msg_ind_struct *mms_highlight_ind;
  1760.     /*----------------------------------------------------------------*/
  1761.     /* Code Body                                                      */
  1762.     /*----------------------------------------------------------------*/
  1763.     mms_highlight_ind =
  1764.         (mmi_um_highlight_msg_ind_struct*) OslConstructDataPtr(sizeof(mmi_um_highlight_msg_ind_struct));
  1765.     mms_highlight_ind->msg_type = UM_MSG_TYPE_MMS;
  1766.     mms_highlight_ind->msg_box_type = mmi_um_get_current_msg_box_type();
  1767.     mms_highlight_ind->msg_index = g_jmms_context->nCurr_scr_hilited_index;
  1768.     /* Prepare response structure */
  1769.     Message.oslSrcId = MOD_WAP;
  1770.     Message.oslDestId = MOD_MMI;
  1771.     Message.oslMsgId = MSG_ID_MMI_UM_HIGHLIGHT_MSG_IND;
  1772.     /* Send Response to MMI Queue */
  1773.     Message.oslDataPtr = (oslParaType*) mms_highlight_ind;
  1774.     Message.oslPeerBuffPtr = NULL;
  1775.     OslMsgSendExtQueue(&Message);
  1776. }
  1777. /*****************************************************************************
  1778.  * FUNCTION
  1779.  *  mmi_um_jmms_pre_entry_inbox
  1780.  * DESCRIPTION
  1781.  *  
  1782.  * PARAMETERS
  1783.  *  void
  1784.  * RETURNS
  1785.  *  void
  1786.  *****************************************************************************/
  1787. void mmi_um_jmms_pre_entry_inbox(void)
  1788. {
  1789.     /*----------------------------------------------------------------*/
  1790.     /* Local Variables                                                */
  1791.     /*----------------------------------------------------------------*/
  1792.     /*----------------------------------------------------------------*/
  1793.     /* Code Body                                                      */
  1794.     /*----------------------------------------------------------------*/
  1795.     mmi_um_jmms_at_delete_pre_set();
  1796.     mmi_um_pre_entry_inbox();
  1797. }
  1798. /*****************************************************************************
  1799.  * FUNCTION
  1800.  *  mmi_um_jmms_pre_entry_outbox
  1801.  * DESCRIPTION
  1802.  *  
  1803.  * PARAMETERS
  1804.  *  void
  1805.  * RETURNS
  1806.  *  void
  1807.  *****************************************************************************/
  1808. void mmi_um_jmms_pre_entry_outbox(void)
  1809. {
  1810.     /*----------------------------------------------------------------*/
  1811.     /* Local Variables                                                */
  1812.     /*----------------------------------------------------------------*/
  1813.     /*----------------------------------------------------------------*/
  1814.     /* Code Body                                                      */
  1815.     /*----------------------------------------------------------------*/
  1816.     mmi_um_jmms_at_delete_pre_set();
  1817.     mmi_um_pre_entry_unsent();
  1818. }
  1819. /*****************************************************************************
  1820.  * FUNCTION
  1821.  *  mmi_um_jmms_pre_entry_sent
  1822.  * DESCRIPTION
  1823.  *  
  1824.  * PARAMETERS
  1825.  *  void
  1826.  * RETURNS
  1827.  *  void
  1828.  *****************************************************************************/
  1829. void mmi_um_jmms_pre_entry_sent(void)
  1830. {
  1831.     /*----------------------------------------------------------------*/
  1832.     /* Local Variables                                                */
  1833.     /*----------------------------------------------------------------*/
  1834.     /*----------------------------------------------------------------*/
  1835.     /* Code Body                                                      */
  1836.     /*----------------------------------------------------------------*/
  1837.     mmi_um_jmms_at_delete_pre_set();
  1838.     mmi_um_pre_entry_sent();
  1839. }
  1840. /*****************************************************************************
  1841.  * FUNCTION
  1842.  *  mmi_um_jmms_pre_entry_draft
  1843.  * DESCRIPTION
  1844.  *  
  1845.  * PARAMETERS
  1846.  *  void
  1847.  * RETURNS
  1848.  *  void
  1849.  *****************************************************************************/
  1850. void mmi_um_jmms_pre_entry_draft(void)
  1851. {
  1852.     /*----------------------------------------------------------------*/
  1853.     /* Local Variables                                                */
  1854.     /*----------------------------------------------------------------*/
  1855.     /*----------------------------------------------------------------*/
  1856.     /* Code Body                                                      */
  1857.     /*----------------------------------------------------------------*/
  1858.     mmi_um_jmms_at_delete_pre_set();
  1859.     mmi_um_pre_entry_draft();
  1860. }
  1861. /*****************************************************************************
  1862.  * FUNCTION
  1863.  *  mmi_um_get_curr_folder_name
  1864.  * DESCRIPTION
  1865.  *  
  1866.  * PARAMETERS
  1867.  *  void
  1868.  * RETURNS
  1869.  *  
  1870.  *****************************************************************************/
  1871. U16 mmi_um_get_curr_folder_name(void)
  1872. {
  1873.     /*----------------------------------------------------------------*/
  1874.     /* Local Variables                                                */
  1875.     /*----------------------------------------------------------------*/
  1876.     U16 folderScrnId = 0;
  1877.     /*----------------------------------------------------------------*/
  1878.     /* Code Body                                                      */
  1879.     /*----------------------------------------------------------------*/
  1880.     switch (mmi_um_get_current_msg_box_type())
  1881.     {
  1882.         case UM_MSG_BOX_TYPE_INBOX:
  1883.             folderScrnId = SCR_ID_UM_INBOX;
  1884.             break;
  1885.         case UM_MSG_BOX_TYPE_UNSENT:
  1886.             folderScrnId = SCR_ID_UM_UNSENT;
  1887.             break;
  1888.         case UM_MSG_BOX_TYPE_SENT:
  1889.             folderScrnId = SCR_ID_UM_SENT;
  1890.             break;
  1891.         case UM_MSG_BOX_TYPE_DRAFT:
  1892.             folderScrnId = SCR_ID_UM_DRAFT;
  1893.             break;
  1894.         default:
  1895.             folderScrnId = 0;
  1896.             break;
  1897.     }
  1898.     return folderScrnId;
  1899. }
  1900. /*****************************************************************************
  1901.  * FUNCTION
  1902.  *  mmi_um_jmms_pre_entry_inbox_including_highlighter
  1903.  * DESCRIPTION
  1904.  *  
  1905.  * PARAMETERS
  1906.  *  void
  1907.  * RETURNS
  1908.  *  void
  1909.  *****************************************************************************/
  1910. void mmi_um_jmms_pre_entry_inbox_including_highlighter(void)
  1911. {
  1912.     /*----------------------------------------------------------------*/
  1913.     /* Local Variables                                                */
  1914.     /*----------------------------------------------------------------*/
  1915.     /*----------------------------------------------------------------*/
  1916.     /* Code Body                                                      */
  1917.     /*----------------------------------------------------------------*/
  1918.     mmi_um_jmms_at_delete_pre_set();
  1919.     mmi_um_jmms_highlight_mms_message_ind();
  1920.     mmi_um_pre_entry_inbox();
  1921. }
  1922. /*****************************************************************************
  1923.  * FUNCTION
  1924.  *  mmi_um_jmms_pre_entry_draft_including_highlighter
  1925.  * DESCRIPTION
  1926.  *  
  1927.  * PARAMETERS
  1928.  *  void
  1929.  * RETURNS
  1930.  *  void
  1931.  *****************************************************************************/
  1932. void mmi_um_jmms_pre_entry_draft_including_highlighter(void)
  1933. {
  1934.     /*----------------------------------------------------------------*/
  1935.     /* Local Variables                                                */
  1936.     /*----------------------------------------------------------------*/
  1937.     /*----------------------------------------------------------------*/
  1938.     /* Code Body                                                      */
  1939.     /*----------------------------------------------------------------*/
  1940.     mmi_um_jmms_at_delete_pre_set();
  1941.     mmi_um_jmms_highlight_mms_message_ind();
  1942.     mmi_um_pre_entry_draft();
  1943. }
  1944. /*****************************************************************************
  1945.  * FUNCTION
  1946.  *  mmi_jmms_get_number_of_messages_from_msg_box_type
  1947.  * DESCRIPTION
  1948.  *  
  1949.  * PARAMETERS
  1950.  *  void
  1951.  * RETURNS
  1952.  *  void
  1953.  *****************************************************************************/
  1954. S16 mmi_jmms_get_number_of_messages_from_msg_box_type(UmMsgBoxType msg_box_type)
  1955. {
  1956. JC_RETCODE eRet = 0;
  1957. U8 number = 0;
  1958. S16 total = 0;
  1959. if(msg_box_type & UM_MSG_BOX_TYPE_INBOX)
  1960. {
  1961. eRet = mmi_mms_get_number_of_messages(MMI_JMMS_INBOX, &number);
  1962. if(eRet != JC_OK)
  1963. {
  1964. goto ERROR;
  1965. }
  1966. total += number;
  1967. }
  1968. if(msg_box_type & UM_MSG_BOX_TYPE_UNSENT)
  1969. {
  1970. eRet = mmi_mms_get_number_of_messages(MMI_JMMS_OUTBOX, &number);
  1971. if(eRet != JC_OK)
  1972. {
  1973. goto ERROR;
  1974. }
  1975. total += number;
  1976. }
  1977. if(msg_box_type & UM_MSG_BOX_TYPE_SENT)
  1978. {
  1979. eRet = mmi_mms_get_number_of_messages(MMI_JMMS_SENT, &number);
  1980. if(eRet != JC_OK)
  1981. {
  1982. goto ERROR;
  1983. }
  1984. total += number;
  1985. }
  1986. if(msg_box_type & UM_MSG_BOX_TYPE_DRAFT)
  1987. {
  1988. eRet = mmi_mms_get_number_of_messages(MMI_JMMS_DRAFTS, &number);
  1989. if(eRet != JC_OK)
  1990. {
  1991. goto ERROR;
  1992. }
  1993. total += number;
  1994. }
  1995. ERROR:
  1996. if(eRet != JC_OK)
  1997. {
  1998. total = -1;
  1999. }
  2000. return total;
  2001. }
  2002. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  2003. #endif /* defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT) */ 
  2004. #endif /* _MMI_JMMSUMHANDLE_C */