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

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.  * UMPushInbox.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.  *------------------------------------------------------------------------------
  76.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  77.  *============================================================================
  78.  ****************************************************************************/
  79. #ifndef _MMI_UMPUSHINBOX_C
  80. #define _MMI_UMPUSHINBOX_C
  81. #include "MMI_features.h"
  82. #if defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT)
  83. #ifdef __MMI_UNIFIED_MESSAGE__
  84. #include "PixtelDataTypes.h"
  85. #include "Unicodexdcl.h"
  86. #include "HistoryGprot.h"
  87. #include "GlobalDefs.h"
  88. #include "CommonScreens.h"
  89. #include "SettingProfile.h"
  90. #include "NVRAMType.h"
  91. #include "NVRAMProt.h"
  92. #include "NVRAMEnum.h"
  93. #include "worldclock.h"
  94. #include "wgui_categories.h"
  95. #include "wgui_categories_inputs.h"
  96. #include "wap_ps_struct.h"
  97. #include "wapadp.h"
  98. #include "ddl.h"
  99. #include "jcal.h"
  100. #include "jdd_memapi.h"
  101. #include "jdi_communicator.h"
  102. #include "jdi_BrowserDatatype.h"
  103. #include "JBrowserMMIDefs.h"
  104. #include "JBrowserMMIProts.h"
  105. #include "JBrowserMMITypes.h"
  106. // #include "JBrowserStartup.h"
  107. /* PMT DARA  PROFILE HANDLER 020106 */
  108. #include "JProfileHandlerTypes.h"
  109. #include "JProfileHandlerProts.h"
  110. #include "UnifiedMessageGProt.h"
  111. #include "UnifiedMessageDef.h"
  112. #include "time.h"
  113. #include "JPushInboxCommonAPIs.h"
  114. #include "JPushInboxUM.h"
  115. #include "JPushInboxCommonUI.h"
  116. #include "wgui_status_icons.h"
  117. #include "app_datetime.h"
  118. #include "JMMSUMHandling.h"
  119. /* extern SERVICE_VALUE *g_brw_service_msg_list_p[BRW_MAX_PUSH_MESSAGES]; */
  120. /* extern U16 g_brw_index_current_highlighted_item; */
  121. /* extern kal_uint8 PhnsetGetHomeCity(void); */
  122. extern FLOAT mmi_dt_get_tz(void);
  123. /*****************************************************************************
  124.  * FUNCTION
  125.  *  mmi_um_brw_get_push_time_stamp
  126.  * DESCRIPTION
  127.  *  Decide time stamp and covert it from GMT to local time.
  128.  * PARAMETERS
  129.  *  pServiceValue       [IN]     - push message structure.
  130.  * RETURNS
  131.  *  Created time(in second);else return received time(in second). 
  132.  *****************************************************************************/
  133. static U32 mmi_um_brw_get_push_time_stamp(SERVICE_VALUE *pServiceValue)
  134. {
  135.     U32 tzdiff = 0;
  136.     U32 converted_timestamp = 0;
  137.     FLOAT tz = 0.0;
  138.     UI_time datetime = {0};
  139.     applib_time_struct time;
  140.     if (pServiceValue->pSICreated != NULL)
  141.     {
  142. datetime.nYear = pServiceValue->pSICreated->year;
  143. if (datetime.nYear > 2090)
  144. {
  145. datetime.nYear = datetime.nYear - 100;
  146. }
  147. datetime.nMonth = pServiceValue->pSICreated->month;
  148. datetime.nDay = pServiceValue->pSICreated->day;
  149. datetime.nHour = pServiceValue->pSICreated->hour;
  150. datetime.nMin = pServiceValue->pSICreated->minute;
  151. datetime.nSec = pServiceValue->pSICreated->seconds;
  152.     }
  153.     else if (pServiceValue->pSIRcvd != NULL)
  154. {
  155. datetime.nYear = pServiceValue->pSIRcvd->year;
  156. if (datetime.nYear > 2090)
  157. {
  158. datetime.nYear = datetime.nYear - 100;
  159. }
  160. datetime.nMonth = pServiceValue->pSIRcvd->month;
  161. datetime.nDay = pServiceValue->pSIRcvd->day;
  162. datetime.nHour = pServiceValue->pSIRcvd->hour;
  163. datetime.nMin = pServiceValue->pSIRcvd->minute;
  164. datetime.nSec = pServiceValue->pSIRcvd->seconds;
  165.     }
  166. converted_timestamp = mmi_dt_mytime_2_utc_sec((MYTIME*) & datetime, MMI_TRUE);
  167.     tz = mmi_dt_get_tz();
  168.     if(tz < 0)
  169.     {
  170.         time = applib_conv_tz_to_mytime(tz * (-1));
  171.     }
  172.     else
  173.     {
  174.         time = applib_conv_tz_to_mytime(tz);
  175.     }
  176.     tzdiff =  time.nHour * 3600 + time.nMin * 60 + time.nSec;
  177.     if(tz > 0)
  178.     {
  179.      converted_timestamp += tzdiff;
  180.     }
  181.     else
  182.     {
  183.      converted_timestamp -= tzdiff;
  184.     }
  185.     return converted_timestamp;
  186. }
  187. /*****************************************************************************
  188.  * FUNCTION
  189.  *  mmi_um_brw_get_message_count_req
  190.  * DESCRIPTION
  191.  *  Handler for MSG_ID_MMI_UM_GET_MSG_NUM_REQ request.
  192.  * PARAMETERS
  193.  *  msg_count_req       [?]     - request information.
  194.  * RETURNS
  195.  *  void
  196.  *****************************************************************************/
  197. void mmi_um_brw_get_message_count_req(void *msg_count_req)
  198. {
  199.     /*----------------------------------------------------------------*/
  200.     /* Local Variables                                                */
  201.     /*----------------------------------------------------------------*/
  202.     /*----------------------------------------------------------------*/
  203.     /* Code Body                                                      */
  204.     /*----------------------------------------------------------------*/
  205.     switch (((mmi_um_get_msg_num_req_struct*) msg_count_req)->msg_type)
  206.     {
  207.         case UM_MSG_TYPE_MMS:
  208.         {
  209. mmi_um_jmms_get_push_message_count_req();
  210.             break;
  211.         }
  212.         case UM_MSG_TYPE_WAP_PUSH:
  213.         {
  214.             mmi_um_brx_get_push_messages_count_req();
  215.             break;
  216.         }
  217.     }
  218. }
  219. /*****************************************************************************
  220.  * FUNCTION
  221.  *  mmi_um_brw_get_message_list_req
  222.  * DESCRIPTION
  223.  *  Handler for MSG_ID_MMI_UM_GET_LIST_REQ request.
  224.  * PARAMETERS
  225.  *  msg_list_req        [?]     - request information.
  226.  * RETURNS
  227.  *  void
  228.  *****************************************************************************/
  229. void mmi_um_brw_get_message_list_req(void *msg_list_req)
  230. {
  231.     /*----------------------------------------------------------------*/
  232.     /* Local Variables                                                */
  233.     /*----------------------------------------------------------------*/
  234.     /*----------------------------------------------------------------*/
  235.     /* Code Body                                                      */
  236.     /*----------------------------------------------------------------*/
  237.     switch (((mmi_um_get_list_req_struct*) msg_list_req)->msg_type)
  238.     {
  239.         case UM_MSG_TYPE_MMS:
  240.         {
  241.             mmi_um_jmms_get_mms_message_list_req((mmi_um_get_list_req_struct*) msg_list_req);
  242.             break;
  243.         }
  244.         case UM_MSG_TYPE_WAP_PUSH:
  245.         {
  246.             mmi_um_brw_get_push_messages_list_req(msg_list_req);
  247.             break;
  248.         }
  249.     }
  250. }
  251. /*****************************************************************************
  252.  * FUNCTION
  253.  *  mmi_um_brw_get_message_info_req
  254.  * DESCRIPTION
  255.  *  Handler for MSG_ID_MMI_UM_GET_MSG_INFO_REQ request.
  256.  * PARAMETERS
  257.  *  msg_info_req        [?]     - request information.
  258.  * RETURNS
  259.  *  void
  260.  *****************************************************************************/
  261. void mmi_um_brw_get_message_info_req(void *msg_info_req)
  262. {
  263.     /*----------------------------------------------------------------*/
  264.     /* Local Variables                                                */
  265.     /*----------------------------------------------------------------*/
  266.     /*----------------------------------------------------------------*/
  267.     /* Code Body                                                      */
  268.     /*----------------------------------------------------------------*/
  269.     switch (((mmi_um_get_msg_info_req_struct*) msg_info_req)->msg_type)
  270.     {
  271.         case UM_MSG_TYPE_MMS:
  272.         {
  273. mmi_um_jmms_get_mms_message_info_req((mmi_um_get_msg_info_req_struct*) msg_info_req);
  274.             break;
  275.         }
  276.         case UM_MSG_TYPE_WAP_PUSH:
  277.         {
  278.             mmi_um_brw_get_push_messages_info_req(
  279.                 ((mmi_um_get_msg_info_req_struct*) msg_info_req)->start_entry,
  280.                 ((mmi_um_get_msg_info_req_struct*) msg_info_req)->msg_number);
  281.             break;
  282.         }
  283.     }
  284. }
  285. /*****************************************************************************
  286.  * FUNCTION
  287.  *  mmi_um_brw_delete_all_messages_req
  288.  * DESCRIPTION
  289.  *  Handler for MSG_ID_MMI_UM_DELETE_FOLDER_REQ request.
  290.  * PARAMETERS
  291.  *  msg_delete_all_req      [?]     - request information.
  292.  * RETURNS
  293.  *  void
  294.  *****************************************************************************/
  295. void mmi_um_brw_delete_all_messages_req(void *msg_delete_all_req)
  296. {
  297.     /*----------------------------------------------------------------*/
  298.     /* Local Variables                                                */
  299.     /*----------------------------------------------------------------*/
  300.     /*----------------------------------------------------------------*/
  301.     /* Code Body                                                      */
  302.     /*----------------------------------------------------------------*/
  303.     switch (((mmi_um_delete_folder_req_struct*) msg_delete_all_req)->msg_type)
  304.     {
  305.         case UM_MSG_TYPE_MMS:
  306.         {
  307. mmi_um_jmms_delete_all_mms_message_req((mmi_um_delete_folder_req_struct*) msg_delete_all_req);
  308.             break;
  309.         }
  310.         case UM_MSG_TYPE_WAP_PUSH:
  311.         {
  312.             mmi_um_brw_delete_all_push_messages_req(msg_delete_all_req);
  313.             break;
  314.         }
  315.     }
  316. }
  317. /*****************************************************************************
  318.  * FUNCTION
  319.  *  mmi_um_brw_delete_all_messages_rsp
  320.  * DESCRIPTION
  321.  *  Function to recieve information that if user has confirmed
  322.  *  to delete all push messages or not.
  323.  * PARAMETERS
  324.  *  msg_delete_all_rsp      [?]     - confirmation of deletion of all messages.
  325.  * RETURNS
  326.  *  void
  327.  *****************************************************************************/
  328. void mmi_um_brw_delete_all_messages_rsp(void *msg_delete_all_rsp)
  329. {
  330.     /*----------------------------------------------------------------*/
  331.     /* Local Variables                                                */
  332.     /*----------------------------------------------------------------*/
  333.     /*----------------------------------------------------------------*/
  334.     /* Code Body                                                      */
  335.     /*----------------------------------------------------------------*/
  336.     mmi_um_delete_all_res_struct *delete_all_rsp = (mmi_um_delete_all_res_struct*)msg_delete_all_rsp;
  337.     switch (delete_all_rsp->msg_type)
  338.     {
  339.         case UM_MSG_TYPE_MMS:
  340.         {
  341. mmi_um_delete_all_mms_messages_rsp((U16)delete_all_rsp->result);
  342.             break;
  343.         }
  344.         case UM_MSG_TYPE_WAP_PUSH:
  345.         {
  346.             mmi_um_brw_delete_all_push_messages_rsp((U16)delete_all_rsp->result);
  347.             break;
  348.         }
  349.     }
  350. }
  351. /*****************************************************************************
  352.  * FUNCTION
  353.  *  mmi_um_brw_mms_ready_ind
  354.  * DESCRIPTION
  355.  *  Function to send an indication to UM that browser is ready.
  356.  * PARAMETERS
  357.  *  void
  358.  * RETURNS
  359.  *  void
  360.  *****************************************************************************/
  361. void mmi_um_brw_mms_ready_ind(void)
  362. {
  363.     /*----------------------------------------------------------------*/
  364.     /* Local Variables                                                */
  365.     /*----------------------------------------------------------------*/
  366.     MYQUEUE Message;
  367.     mmi_um_ready_ind_struct *push_um_ready_ind;
  368.     /*----------------------------------------------------------------*/
  369.     /* Code Body                                                      */
  370.     /*----------------------------------------------------------------*/
  371.     push_um_ready_ind = (mmi_um_ready_ind_struct*) OslConstructDataPtr(sizeof(mmi_um_ready_ind_struct));
  372.     push_um_ready_ind->result = KAL_TRUE;
  373.     push_um_ready_ind->msg_type = UM_MSG_TYPE_MMS;
  374.     /* Prepare response structure */
  375.     Message.oslSrcId = MOD_MMI;
  376.     Message.oslDestId = MOD_MMI;
  377.     Message.oslMsgId = MSG_ID_MMI_UM_READY_IND;
  378.     /* Send Response to MMI Queue */
  379.     Message.oslDataPtr = (oslParaType*) push_um_ready_ind;
  380.     Message.oslPeerBuffPtr = NULL;
  381.     OslMsgSendExtQueue(&Message);
  382. }
  383. /*****************************************************************************
  384.  * FUNCTION
  385.  *  mmi_um_brx_get_push_messages_count_req
  386.  * DESCRIPTION
  387.  *  Function to get count of unread and read push messages and send response to UM.
  388.  * PARAMETERS
  389.  *  void
  390.  * RETURNS
  391.  *  void
  392.  *****************************************************************************/
  393. void mmi_um_brx_get_push_messages_count_req(void)
  394. {
  395.     /*----------------------------------------------------------------*/
  396.     /* Local Variables                                                */
  397.     /*----------------------------------------------------------------*/
  398.     MYQUEUE Message;
  399.     U32 brw_total_msg_count, brw_unread_msg_count;
  400.     mmi_um_get_msg_num_rsp_struct *push_count_rsp;
  401.     /*----------------------------------------------------------------*/
  402.     /* Code Body                                                      */
  403.     /*----------------------------------------------------------------*/
  404.     g_mmi_brw_delete_push_notification = MMI_FALSE;
  405.     /* update the copy of local pointers */
  406.     mmi_brw_create_push_msg_list();
  407.     mmi_brw_get_push_statistics(&brw_total_msg_count, &brw_unread_msg_count);
  408.     push_count_rsp = (mmi_um_get_msg_num_rsp_struct*) OslConstructDataPtr(sizeof(mmi_um_get_msg_num_rsp_struct));
  409.     push_count_rsp->result = KAL_TRUE;
  410.     push_count_rsp->msg_type = UM_MSG_TYPE_WAP_PUSH;
  411.     push_count_rsp->inbox_unread_msg_number = brw_unread_msg_count;
  412.     push_count_rsp->inbox_read_msg_number = brw_total_msg_count - brw_unread_msg_count;
  413.     push_count_rsp->unsent_msg_number = 0;
  414.     push_count_rsp->sent_msg_number = 0;
  415.     push_count_rsp->draft_msg_number = 0;
  416.     /* Prepare response structure */
  417.     Message.oslSrcId = MOD_WAP /* MOD_MMI */;
  418.     Message.oslDestId = MOD_MMI;
  419.     Message.oslMsgId = MSG_ID_MMI_UM_GET_MSG_NUM_RSP;
  420.     /* Send Response to MMI Queue */
  421.     Message.oslDataPtr = (oslParaType*) push_count_rsp;
  422.     Message.oslPeerBuffPtr = NULL;
  423.     OslMsgSendExtQueue(&Message);
  424. }
  425. /*****************************************************************************
  426.  * FUNCTION
  427.  *  mmi_um_brw_get_push_messages_list_req
  428.  * DESCRIPTION
  429.  *  Function to get push message list information and send response to UM.
  430.  * PARAMETERS
  431.  *  msg_list_req        [?]         
  432.  *  start_entry(?)      [IN]        - indicates the index of node in the jataayu list from which the information is to be sent
  433.  * RETURNS
  434.  *  void
  435.  *****************************************************************************/
  436. void mmi_um_brw_get_push_messages_list_req(void *msg_list_req)
  437. {
  438.     /*----------------------------------------------------------------*/
  439.     /* Local Variables                                                */
  440.     /*----------------------------------------------------------------*/
  441.     MYQUEUE Message;
  442.     U32 msg_counter = 0;
  443.     U32 start_entry = 0;
  444.     U32 brw_total_msg_count = 0;
  445.     U32 brw_unread_msg_count = 0;
  446.     mmi_um_get_list_rsp_struct *push_list_rsp = NULL;
  447.     mmi_um_get_list_req_struct *um_msg_list_req = NULL;
  448.     /*----------------------------------------------------------------*/
  449.     /* Code Body                                                      */
  450.     /*----------------------------------------------------------------*/
  451.     g_mmi_brw_delete_push_notification = MMI_FALSE;
  452.     um_msg_list_req = (mmi_um_get_list_req_struct*) msg_list_req;
  453.     start_entry = um_msg_list_req->start_entry;
  454.     
  455.     /* Buffer should free while entering the inbox screen  */
  456.     mmi_brw_push_free_service_value_struct(&g_current_service_message);
  457.     
  458.     mmi_brw_get_push_statistics(&brw_total_msg_count, &brw_unread_msg_count);
  459.     push_list_rsp = (mmi_um_get_list_rsp_struct*) OslConstructDataPtr(sizeof(mmi_um_get_list_rsp_struct));
  460.     push_list_rsp->result = KAL_TRUE;
  461.     push_list_rsp->msg_type = UM_MSG_TYPE_WAP_PUSH;
  462.     if (UM_MSG_BOX_TYPE_INBOX == um_msg_list_req->msg_box_type)
  463.     {
  464.         push_list_rsp->msg_box_type = UM_MSG_BOX_TYPE_INBOX;
  465.         push_list_rsp->start_entry = start_entry;
  466.         if ((brw_total_msg_count - start_entry) <= MMI_UM_MAX_GET_LIST_MSG_NUMBER)
  467.         {
  468.             push_list_rsp->msg_number = brw_total_msg_count - start_entry;
  469.         }
  470.         else
  471.         {
  472.             push_list_rsp->msg_number = MMI_UM_MAX_GET_LIST_MSG_NUMBER;
  473.             push_list_rsp->more = KAL_TRUE;
  474.         }
  475.         for (msg_counter = start_entry; msg_counter < (push_list_rsp->msg_number + start_entry); msg_counter++)
  476.         {
  477.             push_list_rsp->list_info[msg_counter].msg_index = msg_counter;
  478.             push_list_rsp->list_info[msg_counter].timestamp =
  479.                 mmi_um_brw_get_push_time_stamp(g_brw_service_msg_list_p[msg_counter]);
  480.         }
  481.     }
  482.     else /* UM_MSG_BOX_TYPE_INBOX != um_msg_list_req->msg_box_type */
  483.     {
  484.         /* As push message can not be a part of outbox, sent or draft folder */
  485.         push_list_rsp->msg_box_type = um_msg_list_req->msg_box_type;
  486.         push_list_rsp->start_entry = 0;
  487. push_list_rsp->msg_number = 0;
  488.     }
  489.     /* Prepare response structure */
  490.     Message.oslSrcId = MOD_WAP /* MOD_MMI */;
  491.     Message.oslDestId = MOD_MMI;
  492.     Message.oslMsgId = MSG_ID_MMI_UM_GET_LIST_RSP;
  493.     /* Send Response to MMI Queue */
  494.     Message.oslDataPtr = (oslParaType*) push_list_rsp;
  495.     Message.oslPeerBuffPtr = NULL;
  496.     OslMsgSendExtQueue(&Message);
  497. }
  498. /*****************************************************************************
  499.  * FUNCTION
  500.  *  mmi_um_brw_get_push_messages_info_req
  501.  * DESCRIPTION
  502.  *  Function to get push message list information and send response to UM.
  503.  * PARAMETERS
  504.  *  start_entry     [IN]        - indicates the index of node in the jataayu list from which the information is to be sent
  505.  *  total_msgs      [IN]        - indicated that for how many messages information is to retrived
  506.  * RETURNS
  507.  *  void
  508.  *****************************************************************************/
  509. void mmi_um_brw_get_push_messages_info_req(U32 start_entry, U32 total_msgs)
  510. {
  511.     /*----------------------------------------------------------------*/
  512.     /* Local Variables                                                */
  513.     /*----------------------------------------------------------------*/
  514.     MYQUEUE Message;
  515.     U32 msg_counter, rcvd_message_len = 0;
  516.     struct tm expiry_timestamp;
  517.     time_t current_secs_since_1970 = 0, expiry_secs_since_1970 = 0;
  518.     mmi_um_get_msg_info_rsp_struct *push_info_rsp;
  519.     /*----------------------------------------------------------------*/
  520.     /* Code Body                                                      */
  521.     /*----------------------------------------------------------------*/
  522.     push_info_rsp = (mmi_um_get_msg_info_rsp_struct*) OslConstructDataPtr(sizeof(mmi_um_get_msg_info_rsp_struct));
  523.     push_info_rsp->result = KAL_TRUE;
  524.     push_info_rsp->msg_type = UM_MSG_TYPE_WAP_PUSH;
  525.     push_info_rsp->msg_box_type = UM_MSG_BOX_TYPE_INBOX;
  526.     push_info_rsp->start_entry = start_entry;
  527.     push_info_rsp->msg_number = total_msgs;
  528.     for (msg_counter = start_entry; msg_counter < total_msgs + start_entry; msg_counter++)
  529.     {
  530.         push_info_rsp->msg_info[msg_counter - start_entry].msg_index = msg_counter;
  531.         push_info_rsp->msg_info[msg_counter - start_entry].timestamp =
  532.             mmi_um_brw_get_push_time_stamp(g_brw_service_msg_list_p[msg_counter]);
  533.         push_info_rsp->msg_info[msg_counter - start_entry].address_type = UM_ADDR_TYPE_PHONE_NUMBER;    /* to be ignored */
  534.         push_info_rsp->msg_info[msg_counter - start_entry].address_length = 0;
  535.         memset(push_info_rsp->msg_info[msg_counter - start_entry].address, 0, MMI_UM_MAX_ADDR_LEN);
  536.         if (g_brw_service_msg_list_p[msg_counter]->service_flag == SERVICE_INDICATION)
  537.         {
  538.             rcvd_message_len = pfnUnicodeStrlen((S8*) g_brw_service_msg_list_p[msg_counter]->pmMessage);
  539.             if (0 != rcvd_message_len)
  540.             {
  541.                 if ((rcvd_message_len * ENCODING_LENGTH) < MMI_UM_MAX_SUBJECT_LEN - ENCODING_LENGTH)
  542.                 {
  543.                     push_info_rsp->msg_info[msg_counter - start_entry].subject_length = rcvd_message_len;
  544.                     pfnUnicodeStrncpy(
  545.                         (S8*) push_info_rsp->msg_info[msg_counter - start_entry].subject,
  546.                         (S8*) g_brw_service_msg_list_p[msg_counter]->pmMessage,
  547.                         rcvd_message_len);
  548.                     pfnUnicodeStrcat((S8*) push_info_rsp->msg_info[msg_counter - start_entry].subject, "");
  549.                 }
  550.                 else
  551.                 {
  552.                     push_info_rsp->msg_info[msg_counter - start_entry].subject_length = MMI_UM_MAX_SUBJECT_LEN;
  553.                     pfnUnicodeStrncpy(
  554.                         (S8*) push_info_rsp->msg_info[msg_counter - start_entry].subject,
  555.                         (S8*) g_brw_service_msg_list_p[msg_counter]->pmMessage,
  556.                         (MMI_UM_MAX_SUBJECT_LEN / ENCODING_LENGTH) - 4);
  557.                     pfnUnicodeStrcat((S8*) push_info_rsp->msg_info[msg_counter - start_entry].subject, "...");
  558.                 }
  559.             }
  560.             else /* if message body for SI is not available then href should dispaly as subject */
  561.             {
  562.                 rcvd_message_len = pfnUnicodeStrlen((S8*) g_brw_service_msg_list_p[msg_counter]->pmHref);
  563.                 if ((rcvd_message_len * ENCODING_LENGTH) < MMI_UM_MAX_SUBJECT_LEN - ENCODING_LENGTH)
  564.                 {
  565.                     push_info_rsp->msg_info[msg_counter - start_entry].subject_length = rcvd_message_len;
  566.                     pfnUnicodeStrncpy(
  567.                         (S8*) push_info_rsp->msg_info[msg_counter - start_entry].subject,
  568.                         (S8*) g_brw_service_msg_list_p[msg_counter]->pmHref,
  569.                         rcvd_message_len);
  570.                     pfnUnicodeStrcat((S8*) push_info_rsp->msg_info[msg_counter - start_entry].subject, "");
  571.                 }
  572.                 else
  573.                 {
  574.                     push_info_rsp->msg_info[msg_counter - start_entry].subject_length = MMI_UM_MAX_SUBJECT_LEN;
  575.                     pfnUnicodeStrncpy(
  576.                         (S8*) push_info_rsp->msg_info[msg_counter - start_entry].subject,
  577.                         (S8*) g_brw_service_msg_list_p[msg_counter]->pmHref,
  578.                         (MMI_UM_MAX_SUBJECT_LEN / ENCODING_LENGTH) - 4);
  579.                     pfnUnicodeStrcat((S8*) push_info_rsp->msg_info[msg_counter - start_entry].subject, "...");
  580.                 }
  581.             }
  582.         }
  583.         else    /* SERVICE_LOADING */
  584.         {
  585.             rcvd_message_len = pfnUnicodeStrlen((S8*) g_brw_service_msg_list_p[msg_counter]->pmHref);
  586.             if ((rcvd_message_len * ENCODING_LENGTH) < MMI_UM_MAX_SUBJECT_LEN - ENCODING_LENGTH)
  587.             {
  588.                 push_info_rsp->msg_info[msg_counter - start_entry].subject_length = rcvd_message_len;
  589.                 pfnUnicodeStrncpy(
  590.                     (S8*) push_info_rsp->msg_info[msg_counter - start_entry].subject,
  591.                     (S8*) g_brw_service_msg_list_p[msg_counter]->pmHref,
  592.                     rcvd_message_len);
  593.                 pfnUnicodeStrcat((S8*) push_info_rsp->msg_info[msg_counter - start_entry].subject, "");
  594.             }
  595.             else
  596.             {
  597.                 push_info_rsp->msg_info[msg_counter - start_entry].subject_length = MMI_UM_MAX_SUBJECT_LEN;
  598.                 pfnUnicodeStrncpy(
  599.                     (S8*) push_info_rsp->msg_info[msg_counter - start_entry].subject,
  600.                     (S8*) g_brw_service_msg_list_p[msg_counter]->pmHref,
  601.                     (MMI_UM_MAX_SUBJECT_LEN / ENCODING_LENGTH) - 4);
  602.                 pfnUnicodeStrcat((S8*) push_info_rsp->msg_info[msg_counter - start_entry].subject, "...");
  603.             }
  604.         }
  605.         if (g_brw_service_msg_list_p[msg_counter]->service_flag == SERVICE_INDICATION)
  606.         {
  607.             if (g_brw_service_msg_list_p[msg_counter]->pSIExpires != NULL)
  608.             {
  609.                 expiry_timestamp.tm_mon = g_brw_service_msg_list_p[msg_counter]->pSIExpires->month - 1; /* month scale to 0 to 11 */
  610.                 expiry_timestamp.tm_year = g_brw_service_msg_list_p[msg_counter]->pSIExpires->year - 1900;      /* offset since 1900 */
  611.                 expiry_timestamp.tm_mday = g_brw_service_msg_list_p[msg_counter]->pSIExpires->day;
  612.                 expiry_timestamp.tm_hour = g_brw_service_msg_list_p[msg_counter]->pSIExpires->hour;
  613.                 expiry_timestamp.tm_min = g_brw_service_msg_list_p[msg_counter]->pSIExpires->minute;
  614.                 expiry_timestamp.tm_sec = g_brw_service_msg_list_p[msg_counter]->pSIExpires->seconds;
  615.                 /* Get difference of seconds of expiry time from 1970 (as per UTC standard) */
  616.                 expiry_secs_since_1970 = (time_t) mktime(&expiry_timestamp);
  617.                 /* Get difference of seconds of current time from 1970 (as per UTC standard) */
  618.                 current_secs_since_1970 = get_current_utc_time();
  619.             }
  620.             if (g_brw_service_msg_list_p[msg_counter]->bIsRead == 0)
  621.             {
  622.                 if ((expiry_secs_since_1970 > current_secs_since_1970) ||
  623.                     (g_brw_service_msg_list_p[msg_counter]->pSIExpires == NULL))
  624.                 {
  625.                     push_info_rsp->msg_info[msg_counter - start_entry].icon_id = IMG_ID_BRW_PUSH_UNREAD;
  626.                 }
  627.                 else
  628.                 {
  629.                     push_info_rsp->msg_info[msg_counter - start_entry].icon_id = IMG_ID_BRW_PUSH_EXPIRED_UNREAD;
  630.                 }
  631.             }
  632.             else
  633.             {
  634.                 if ((expiry_secs_since_1970 > current_secs_since_1970) ||
  635.                     (g_brw_service_msg_list_p[msg_counter]->pSIExpires == NULL))
  636.                 {
  637.                     push_info_rsp->msg_info[msg_counter - start_entry].icon_id = IMG_ID_BRW_PUSH_READ;
  638.                 }
  639.                 else
  640.                 {
  641.                     push_info_rsp->msg_info[msg_counter - start_entry].icon_id = IMG_ID_BRW_PUSH_EXPIRED_READ;
  642.                 }
  643.             }
  644.         }
  645.         else
  646.         {
  647.             if (g_brw_service_msg_list_p[msg_counter]->bIsRead == 0)
  648.             {
  649.                 push_info_rsp->msg_info[msg_counter - start_entry].icon_id = IMG_ID_BRW_PUSH_UNREAD;
  650.             }
  651.             else
  652.             {
  653.                 push_info_rsp->msg_info[msg_counter - start_entry].icon_id = IMG_ID_BRW_PUSH_READ;
  654.             }
  655.         }
  656.     }
  657.     /* Prepare response structure */
  658.     Message.oslSrcId = MOD_WAP /* MOD_MMI */;
  659.     Message.oslDestId = MOD_MMI;
  660.     Message.oslMsgId = MSG_ID_MMI_UM_GET_MSG_INFO_RSP;
  661.     /* Send Response to MMI Queue */
  662.     Message.oslDataPtr = (oslParaType*) push_info_rsp;
  663.     Message.oslPeerBuffPtr = NULL;
  664.     OslMsgSendExtQueue(&Message);
  665. }
  666. /*****************************************************************************
  667.  * FUNCTION
  668.  *  mmi_um_brw_delete_all_push_messages_req
  669.  * DESCRIPTION
  670.  *  Function to delete all push messages and send response to UM.
  671.  * PARAMETERS
  672.  *  msg_delete_all_req      [?]     
  673.  * RETURNS
  674.  *  void
  675.  *****************************************************************************/
  676. void mmi_um_brw_delete_all_push_messages_req(void *msg_delete_all_req)
  677. {
  678.     /*----------------------------------------------------------------*/
  679.     /* Local Variables                                                */
  680.     /*----------------------------------------------------------------*/
  681.     MYQUEUE Message;
  682.     U32 msg_counter, brw_total_msg_count, brw_unread_msg_count;
  683.     mmi_um_delete_folder_rsp_struct *push_delete_all_rsp;
  684.     mmi_um_delete_folder_req_struct *um_msg_delete_all_req = NULL;
  685.     /*----------------------------------------------------------------*/
  686.     /* Code Body                                                      */
  687.     /*----------------------------------------------------------------*/
  688.     um_msg_delete_all_req = (mmi_um_delete_folder_req_struct*) msg_delete_all_req;
  689.     /* Added by Vivek - 25072006 */
  690.     if (UM_MSG_BOX_TYPE_INBOX & um_msg_delete_all_req->msg_box_type)
  691.     {
  692.         mmi_brw_get_push_statistics(&brw_total_msg_count, &brw_unread_msg_count);
  693.         /* Delete all messages one by one */
  694.         for (msg_counter = 0; msg_counter < brw_total_msg_count; msg_counter++)
  695.         {
  696.             mmi_brw_delete_push_msg(0);
  697.         }
  698.         /* Added by Vivek - 24072006 */
  699.         mmi_brw_push_free_service_value_struct(&g_current_service_message);
  700.         /* Save to persistant storage */
  701.         mmi_brw_save_current_push_info();
  702.         /* hide unread push message icon on idle screen */
  703.         HideStatusIcon(STATUS_ICON_WAP);
  704.     }
  705.     push_delete_all_rsp =
  706.         (mmi_um_delete_folder_rsp_struct*) OslConstructDataPtr(sizeof(mmi_um_delete_folder_rsp_struct));
  707.     push_delete_all_rsp->msg_type = UM_MSG_TYPE_WAP_PUSH;
  708.     push_delete_all_rsp->result = KAL_TRUE;
  709.     /* Prepare response structure */
  710.     Message.oslSrcId = MOD_WAP /* MOD_MMI */;
  711.     Message.oslDestId = MOD_MMI;
  712.     Message.oslMsgId = MSG_ID_MMI_UM_DELETE_FOLDER_RSP;
  713.     /* Send Response to MMI Queue */
  714.     Message.oslDataPtr = (oslParaType*) push_delete_all_rsp;
  715.     Message.oslPeerBuffPtr = NULL;
  716.     OslMsgSendExtQueue(&Message);
  717. }
  718. /*****************************************************************************
  719.  * FUNCTION
  720.  *  mmi_um_brw_push_ready_ind
  721.  * DESCRIPTION
  722.  *  Function to send an indication to UM that browser is ready.
  723.  * PARAMETERS
  724.  *  void
  725.  * RETURNS
  726.  *  void
  727.  *****************************************************************************/
  728. void mmi_um_brw_push_ready_ind()
  729. {
  730.     /*----------------------------------------------------------------*/
  731.     /* Local Variables                                                */
  732.     /*----------------------------------------------------------------*/
  733.     MYQUEUE Message;
  734.     mmi_um_ready_ind_struct *push_um_ready_ind;
  735.     /*----------------------------------------------------------------*/
  736.     /* Code Body                                                      */
  737.     /*----------------------------------------------------------------*/
  738.     push_um_ready_ind = (mmi_um_ready_ind_struct*) OslConstructDataPtr(sizeof(mmi_um_ready_ind_struct));
  739.     push_um_ready_ind->result = KAL_TRUE;
  740.     push_um_ready_ind->msg_type = UM_MSG_TYPE_WAP_PUSH;
  741.     /* Prepare response structure */
  742.     Message.oslSrcId = MOD_WAP /* MOD_MMI */;
  743.     Message.oslDestId = MOD_MMI;
  744.     Message.oslMsgId = MSG_ID_MMI_UM_READY_IND;
  745.     /* Send Response to MMI Queue */
  746.     Message.oslDataPtr = (oslParaType*) push_um_ready_ind;
  747.     Message.oslPeerBuffPtr = NULL;
  748.     OslMsgSendExtQueue(&Message);
  749. }
  750. /*****************************************************************************
  751.  * FUNCTION
  752.  *  mmi_um_brw_new_push_message_ind
  753.  * DESCRIPTION
  754.  *  Function to send an indication to UM that a new push message has arrived.
  755.  * PARAMETERS
  756.  *  pServiceValue       [?]     
  757.  * RETURNS
  758.  *  void
  759.  *****************************************************************************/
  760. void mmi_um_brw_new_push_message_ind(SERVICE_VALUE *pServiceValue)
  761. {
  762.     /*----------------------------------------------------------------*/
  763.     /* Local Variables                                                */
  764.     /*----------------------------------------------------------------*/
  765.     MYQUEUE Message;
  766.     mmi_um_new_msg_ind_struct *push_new_msg_ind;
  767.     /*----------------------------------------------------------------*/
  768.     /* Code Body                                                      */
  769.     /*----------------------------------------------------------------*/
  770.     /* update the copy of local pointers */
  771.     mmi_brw_create_push_msg_list();
  772.     push_new_msg_ind = (mmi_um_new_msg_ind_struct*) OslConstructDataPtr(sizeof(mmi_um_new_msg_ind_struct));
  773.     push_new_msg_ind->msg_type = UM_MSG_TYPE_WAP_PUSH;
  774.     push_new_msg_ind->msg_box_type = UM_MSG_BOX_TYPE_INBOX;
  775.     push_new_msg_ind->msg_index = 0;
  776.     push_new_msg_ind->timestamp = mmi_um_brw_get_push_time_stamp(pServiceValue);
  777.     /* Prepare response structure */
  778.     Message.oslSrcId = MOD_WAP /* MOD_MMI */;
  779.     Message.oslDestId = MOD_MMI;
  780.     Message.oslMsgId = MSG_ID_MMI_UM_NEW_MSG_IND;
  781.     Message.oslDataPtr = (oslParaType*) push_new_msg_ind;
  782.     Message.oslPeerBuffPtr = NULL;
  783.     OslMsgSendExtQueue(&Message);
  784. }
  785. /*****************************************************************************
  786.  * FUNCTION
  787.  *  mmi_um_brw_delete_all_push_messages_ind
  788.  * DESCRIPTION
  789.  *  Function to send an indication to UM that a user has
  790.  *  selected to delete all push messages.
  791.  * PARAMETERS
  792.  *  void
  793.  * RETURNS
  794.  *  void
  795.  *****************************************************************************/
  796. void mmi_um_brw_delete_all_push_messages_ind(void)
  797. {
  798.     /*----------------------------------------------------------------*/
  799.     /* Local Variables                                                */
  800.     /*----------------------------------------------------------------*/
  801.     MYQUEUE Message;
  802.     mmi_um_delete_all_ind_struct *push_delete_all_ind;
  803.     /*----------------------------------------------------------------*/
  804.     /* Code Body                                                      */
  805.     /*----------------------------------------------------------------*/
  806.     push_delete_all_ind = (mmi_um_delete_all_ind_struct*) OslConstructDataPtr(sizeof(mmi_um_delete_all_ind_struct));
  807.     push_delete_all_ind->msg_type = UM_MSG_TYPE_WAP_PUSH;
  808.     push_delete_all_ind->msg_box_type = UM_MSG_BOX_TYPE_INBOX;
  809.     /* Prepare response structure */
  810.     Message.oslSrcId = MOD_WAP /* MOD_MMI */;
  811.     Message.oslDestId = MOD_MMI;
  812.     Message.oslMsgId = MSG_ID_MMI_UM_DELETE_ALL_IND;
  813.     /* Send Response to MMI Queue */
  814.     Message.oslDataPtr = (oslParaType*) push_delete_all_ind;
  815.     Message.oslPeerBuffPtr = NULL;
  816.     OslMsgSendExtQueue(&Message);
  817. }
  818. /*****************************************************************************
  819.  * FUNCTION
  820.  *  mmi_um_brw_delete_all_push_messages_rsp
  821.  * DESCRIPTION
  822.  *  Function to recieve information that if user has confirmed
  823.  *  to delete all push messages or not.
  824.  * PARAMETERS
  825.  *  result      [IN]        - confirmation of deletion of all messages.
  826.  * RETURNS
  827.  *  void
  828.  *****************************************************************************/
  829. void mmi_um_brw_delete_all_push_messages_rsp(U16 result)
  830. {
  831.     /*----------------------------------------------------------------*/
  832.     /* Local Variables                                                */
  833.     /*----------------------------------------------------------------*/
  834.     /*----------------------------------------------------------------*/
  835.     /* Code Body                                                      */
  836.     /*----------------------------------------------------------------*/
  837.     if (result == KAL_TRUE)
  838.     {
  839.         DeleteNHistory(2);
  840.     }
  841. }
  842. /*****************************************************************************
  843.  * FUNCTION
  844.  *  mmi_um_brw_highlight_push_messages_ind
  845.  * DESCRIPTION
  846.  *  Function to send information to UM about the currently highlighted item.
  847.  * PARAMETERS
  848.  *  void
  849.  * RETURNS
  850.  *  void
  851.  *****************************************************************************/
  852. void mmi_um_brw_highlight_push_messages_ind(void)
  853. {
  854.     /*----------------------------------------------------------------*/
  855.     /* Local Variables                                                */
  856.     /*----------------------------------------------------------------*/
  857.     MYQUEUE Message;
  858.     mmi_um_highlight_msg_ind_struct *push_highlight_ind;
  859.     /*----------------------------------------------------------------*/
  860.     /* Code Body                                                      */
  861.     /*----------------------------------------------------------------*/
  862.     push_highlight_ind =
  863.         (mmi_um_highlight_msg_ind_struct*) OslConstructDataPtr(sizeof(mmi_um_highlight_msg_ind_struct));
  864.     push_highlight_ind->msg_type = UM_MSG_TYPE_WAP_PUSH;
  865.     push_highlight_ind->msg_box_type = UM_MSG_BOX_TYPE_INBOX;
  866.     push_highlight_ind->msg_index = g_brw_index_current_highlighted_item - 1;
  867.     /* Prepare response structure */
  868.     Message.oslSrcId = MOD_WAP /* MOD_MMI */;
  869.     Message.oslDestId = MOD_MMI;
  870.     Message.oslMsgId = MSG_ID_MMI_UM_HIGHLIGHT_MSG_IND;
  871.     /* Send Response to MMI Queue */
  872.     Message.oslDataPtr = (oslParaType*) push_highlight_ind;
  873.     Message.oslPeerBuffPtr = NULL;
  874.     OslMsgSendExtQueue(&Message);
  875. }
  876. /*****************************************************************************
  877.  * FUNCTION
  878.  *  mmi_um_brw_refresh_ind
  879.  * DESCRIPTION
  880.  *  Function to refresh UM message information.
  881.  * PARAMETERS
  882.  *  void
  883.  * RETURNS
  884.  *  void
  885.  *****************************************************************************/
  886. void mmi_um_brw_refresh_ind(void)
  887. {
  888.     /*----------------------------------------------------------------*/
  889.     /* Local Variables                                                */
  890.     /*----------------------------------------------------------------*/
  891.     /*----------------------------------------------------------------*/
  892.     /* Code Body                                                      */
  893.     /*----------------------------------------------------------------*/
  894. }
  895. /*****************************************************************************
  896.  * FUNCTION
  897.  *  mmi_um_jataayu_entry_message_wap_push
  898.  * DESCRIPTION
  899.  *  Screen Entry function which is called when the user selects to
  900.  *  view a particular push message.
  901.  * PARAMETERS
  902.  *  msg_box_type        [IN]        - type of message box.
  903.  *  msg_index           [IN]        - index of selected message.
  904.  * RETURNS
  905.  *  void
  906.  *****************************************************************************/
  907. void mmi_um_jataayu_entry_message_wap_push(UmMsgBoxType msg_box_type, kal_uint16 msg_index)
  908. {
  909.     /*----------------------------------------------------------------*/
  910.     /* Local Variables                                                */
  911.     /*----------------------------------------------------------------*/
  912.     /*----------------------------------------------------------------*/
  913.     /* Code Body                                                      */
  914.     /*----------------------------------------------------------------*/
  915.     g_brw_index_current_highlighted_item = msg_index;
  916.     mmi_brw_entry_read_push_message();
  917. }
  918. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  919. #endif /* defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT) */ 
  920. #endif /* _MMI_UMPUSHINBOX_C */