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

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2002
  8. *
  9. *****************************************************************************/
  10. /*****************************************************************************
  11.  *
  12.  * Filename:
  13.  * ---------
  14.  *  jmms_write_mms_ui.C
  15.  *
  16.  * Project:
  17.  * --------
  18.  *  MAUI
  19.  *
  20.  * Description:
  21.  * ------------
  22.  *  This file contains the write mms ui and addresses addition,edit,deletion logics
  23.  *
  24.  * Author:
  25.  * -------
  26.  * -------
  27.  *
  28.  *============================================================================
  29.  *             HISTORY
  30.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  31.  *------------------------------------------------------------------------------
  32.  * removed!
  33.  *
  34.  * removed!
  35.  * removed!
  36.  * removed!
  37.  *
  38.  * removed!
  39.  * removed!
  40.  * removed!
  41.  *
  42.  * removed!
  43.  * removed!
  44.  * removed!
  45.  *
  46.  * removed!
  47.  * removed!
  48.  * removed!
  49.  *
  50.  * removed!
  51.  * removed!
  52.  * removed!
  53.  *
  54.  * removed!
  55.  * removed!
  56.  * removed!
  57.  *
  58.  * removed!
  59.  * removed!
  60.  * removed!
  61.  *
  62.  * removed!
  63.  * removed!
  64.  * removed!
  65.  *
  66.  * removed!
  67.  * removed!
  68.  * removed!
  69.  *
  70.  * removed!
  71.  * removed!
  72.  * removed!
  73.  *
  74.  * removed!
  75.  * removed!
  76.  * removed!
  77.  *
  78.  * removed!
  79.  * removed!
  80.  * removed!
  81.  *
  82.  * removed!
  83.  * removed!
  84.  * removed!
  85.  *
  86.  * removed!
  87.  * removed!
  88.  * removed!
  89.  *
  90.  * removed!
  91.  * removed!
  92.  * removed!
  93.  *
  94.  * removed!
  95.  * removed!
  96.  * removed!
  97.  *
  98.  * removed!
  99.  * removed!
  100.  * removed!
  101.  *
  102.  * removed!
  103.  * removed!
  104.  * removed!
  105.  *
  106.  * removed!
  107.  * removed!
  108.  * removed!
  109.  *
  110.  * removed!
  111.  * removed!
  112.  * removed!
  113.  *
  114.  * removed!
  115.  * removed!
  116.  * removed!
  117.  *
  118.  * removed!
  119.  * removed!
  120.  * removed!
  121.  *
  122.  * removed!
  123.  * removed!
  124.  * removed!
  125.  *
  126.  * removed!
  127.  * removed!
  128.  * removed!
  129.  *
  130.  * removed!
  131.  * removed!
  132.  * removed!
  133.  *
  134.  *------------------------------------------------------------------------------
  135.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  136.  *============================================================================
  137.  ****************************************************************************/
  138. /***************************************************************************** 
  139. * Include
  140. *****************************************************************************/
  141. #include "MMI_features.h"
  142. #if (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT))
  143. #include "PixtelDataTypes.h"
  144. #include "Unicodexdcl.h"
  145. #include "HistoryGprot.h"
  146. #include "GlobalDefs.h"
  147. #include "SettingProfile.h"
  148. #include "DebugInitDef.h"
  149. #include "CommonScreens.h"
  150. #include "EventsGprot.h"
  151. #include "wgui_inputs.h"
  152. #include "wgui_categories.h"
  153. #include "wgui_categories_inputs.h"
  154. #include "MainMenuDef.h"
  155. #include "JMMSConfig.h"
  156. #include "JMMSMessageSettings.h"
  157. #include "JMMSCoreAPI.h"
  158. #include "JMMSDrafts.h"
  159. #include "JMMSExdcl.h"
  160. #include "JMMSCompose.h"
  161. #include "JMMSGprot.h"
  162. #include "JMMSInbox.h"
  163. #include "JMMSJSRHandler.h"
  164. #include "JMMSMainMMS.h"
  165. #include "JMMSMessageSettingsUtils.h"
  166. #include "JMMSOutbox.h"
  167. #include "JMMSProtocols.h"
  168. #include "JMMSPushHandling.h"
  169. #include "JMMSResEnum.h"
  170. #include "JMMSSent.h"
  171. #include "JMMSStoreHandling.h"
  172. #include "JMMSStructs.h"
  173. #include "JMMSTemplates.h"
  174. #include "JMMSUseDetails.h"
  175. #include "JMMSView.h"
  176. #include "JMMSWriteMMS.h"
  177. #include "ddlbase.h"
  178. #include "jcerror.h"
  179. #include "jcevent.h"
  180. #include "jcutils.h"
  181. #include "jdi_MMSErr.h"
  182. #include "MessagingDataTypes.h"
  183. #include "jdd_memapi.h"
  184. #include "MessagesResourceData.h"
  185. #include "PhoneBookDef.h"
  186. #include "PhoneBookGprot.h"
  187. #include "miscutils.h"
  188. #include "TimerEvents.h"
  189. #include "MMI_features_camera.h"
  190. #include "CameraResDefs.h"
  191. #ifdef __MMI_UNIFIED_MESSAGE__
  192. #include "JMMSUMHandling.h"
  193. #include "UnifiedMessageDef.h"
  194. #include "UnifiedMessageProt.h"
  195. #include "FileManagerDef.h"
  196. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  197. #include "wapadp.h"  // compiler warning removal
  198. /***************************************************************************** 
  199. * Define
  200. *****************************************************************************/
  201. /***************************************************************************** 
  202. * Typedef 
  203. *****************************************************************************/
  204. /***************************************************************************** 
  205. * Local Variable
  206. *****************************************************************************/
  207. /***************************************************************************** 
  208. * Local Function
  209. *****************************************************************************/
  210. static pBOOL mmi_jmms_get_item_data(S32 item_index, UI_string_type str_buff, PU8 *img_buff_p, U8 str_img_mask);
  211. /***************************************************************************** 
  212. * Global Variable
  213. *****************************************************************************/
  214. static U16 g_address_option_index;
  215. static U16 g_address_list_right_soft_key = STR_GLOBAL_BACK;
  216. static U8 g_hilite_address_item;
  217. /***************************************************************************** 
  218. * Global Function
  219. *****************************************************************************/
  220. extern void set_leading_zero(U8 u8type);
  221. extern void EntryPhbFromMMSNumber(void);
  222. extern void EntryPhbFromMMSEmail(void);
  223. extern JC_RETCODE IsMMSRestrictedMode(MESSAGING_HANDLER *pMessagingHandle, EContentClass eContentClass);  // COMPILER WARNING REMOVAL
  224. extern MMI_BOOL is_add_media_as_drm;
  225. /*****************************************************************************
  226.  * FUNCTION
  227.  *  mmi_jmms_highlight_write_message
  228.  * DESCRIPTION
  229.  *  This function is the highlight handler of write message
  230.  * PARAMETERS
  231.  *  void
  232.  * RETURNS
  233.  *  void
  234.  *****************************************************************************/
  235. void mmi_jmms_highlight_write_message(void)
  236. {
  237.     /*----------------------------------------------------------------*/
  238.     /* Local Variables                                                */
  239.     /*----------------------------------------------------------------*/
  240.     /*----------------------------------------------------------------*/
  241.     /* Code Body                                                      */
  242.     /*----------------------------------------------------------------*/
  243.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  244.     SetLeftSoftkeyFunction(mmi_jmms_entry_write_message, KEY_EVENT_UP);
  245.     SetKeyHandler(mmi_jmms_entry_write_message, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  246.     SetKeyHandler(mmi_jmms_entry_write_message, KEY_WAP, KEY_EVENT_DOWN);
  247. }
  248. /*****************************************************************************
  249.  * FUNCTION
  250.  *  mmi_jmms_write_message_init
  251.  * DESCRIPTION
  252.  *  This function init the hilight handlers of write mms menu items.
  253.  *  This is called at boot up time
  254.  * PARAMETERS
  255.  *  void
  256.  * RETURNS
  257.  *  void
  258.  *****************************************************************************/
  259. void mmi_jmms_write_message_init(void)
  260. {
  261.     /*----------------------------------------------------------------*/
  262.     /* Local Variables                                                */
  263.     /*----------------------------------------------------------------*/
  264.     /*----------------------------------------------------------------*/
  265.     /* Code Body                                                      */
  266.     /*----------------------------------------------------------------*/
  267.     /* options Highlight handlers */
  268.     SetHiliteHandler(MENU_ID_JMMS_WRITE_MMS_ADD_NUMBER, mmi_jmms_highlight_write_mms_add_number);
  269.     SetHiliteHandler(MENU_ID_JMMS_WRITE_MMS_ADD_EMAIL, mmi_jmms_highlight_write_mms_add_email);
  270.     SetHiliteHandler(MENU_ID_JMMS_WRITE_MMS_EDIT, mmi_jmms_highlight_write_mms_edit);
  271.     SetHiliteHandler(MENU_ID_JMMS_WRITE_MMS_DELETE, mmi_jmms_highlight_write_mms_delete);
  272.     SetHiliteHandler(MENU_ID_JMMS_WRITE_MMS_DELETE_ALL, mmi_jmms_highlight_write_mms_delete_all);
  273.     SetHiliteHandler(MENU_ID_JMMS_WRITE_MMS_DONE_SEND_ONLY, mmi_jmms_highlight_write_mms_done_send_only);
  274.     SetHiliteHandler(MENU_ID_JMMS_WRITE_MMS_DONE_SAVE_AND_SEND, mmi_jmms_highlight_write_mms_done_save_and_send);
  275.     SetHiliteHandler(MENU_ID_JMMS_WRITE_MMS_DONE_SAVE_TO_DRAFTS, mmi_jmms_highlight_write_mms_done_save_to_drafts);
  276.     SetHiliteHandler(MENU_ID_JMMS_WRITE_MMS_DONE_SEND_OPTIONS, mmi_jmms_highlight_write_mms_done_send_options);
  277.     SetHiliteHandler(MENU_ID_JMMS_WRITE_MMS_DONE_EXIT, mmi_jmms_highlight_write_mms_done_exit);
  278. }
  279. /*****************************************************************************
  280.  * FUNCTION
  281.  *  mmi_jmms_entry_write_message
  282.  * DESCRIPTION
  283.  *  This function is pre entry function for writing a new MMS
  284.  *  new MMS
  285.  * PARAMETERS
  286.  *  void
  287.  * RETURNS
  288.  *  void
  289.  *****************************************************************************/
  290. void mmi_jmms_entry_write_message(void)
  291. {
  292.     /*----------------------------------------------------------------*/
  293.     /* Local Variables                                                */
  294.     /*----------------------------------------------------------------*/
  295.     /*----------------------------------------------------------------*/
  296.     /* Code Body                                                      */
  297.     /*----------------------------------------------------------------*/
  298. if(g_jmms_context->init_done == JMMS_READY_WITHOUT_STORE)
  299. {
  300.         DisplayPopup((U8*) GetString(STR_ID_JMMS_MEMORY_FULL), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  301. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS: Store is not ready"));
  302.         return;
  303. }
  304.     g_jmms_context->g_use_local_send_setings = 0;
  305.     g_jmms_context->store_context->current_folder_name = E_JMMS_WRITE_MMS;
  306.     mmi_jmms_init_msg_context_struct(); /* this will different for different ways to come here */
  307. /* MAUI_00227929 Start */
  308. mmi_jmms_fill_mms_sending_settings(); // sanjeev added for newly added setting structure.
  309. /* MAUI_00227929 End */
  310.     /* deepali */
  311.     if (g_jmms_context->compose_context == NULL)
  312.     {
  313.         g_jmms_context->compose_context =
  314.             (jmms_compose_context_struct*) jdd_MemAlloc(sizeof(jmms_compose_context_struct), 1);
  315.         if (g_jmms_context->compose_context == NULL)
  316.         {
  317.             DisplayPopup((PU8) GetString(STR_ID_JMMS_OUT_OF_MEMORY), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
  318.             return;
  319.         }
  320.     }
  321.     if (JMMS_COMP_OK == mmi_jmms_compose_new_mms())
  322.     {
  323.         mmi_jmms_entry_write_message_screen();
  324.     }
  325. }
  326. /*****************************************************************************
  327.  * FUNCTION
  328.  *  mmi_jmms_init_msg_context_struct
  329.  * DESCRIPTION
  330.  *  This function is for initlizing the global context structure for writing a
  331.  *  new MMS
  332.  * PARAMETERS
  333.  *  void
  334.  * RETURNS
  335.  *  void
  336.  *****************************************************************************/
  337. void mmi_jmms_init_msg_context_struct(void)
  338. {
  339.     /*----------------------------------------------------------------*/
  340.     /* Local Variables                                                */
  341.     /*----------------------------------------------------------------*/
  342.     /*----------------------------------------------------------------*/
  343.     /* Code Body                                                      */
  344.     /*----------------------------------------------------------------*/
  345.     if (g_jmms_context->msg_handle != NULL)
  346.     {
  347.         mmi_jmms_deinit_mms_context(g_jmms_context);
  348.     }
  349.     else
  350.     {
  351. #ifdef __MMI_UNIFIED_MESSAGE__
  352. if(g_jmms_context->message_to_fw == MMI_TRUE)
  353. {
  354.             mmi_jmms_deinit_mms_context(g_jmms_context);
  355. }
  356. else
  357. {
  358. #endif
  359.             mmi_jmms_free_addresses_list();
  360. mmi_jmms_free_mms_pdu_memory(g_jmms_context);
  361. #ifdef __MMI_UNIFIED_MESSAGE__
  362.         }
  363. #endif
  364.     }
  365.     g_jmms_context->nCurr_scr_hilited_index = 0;
  366.     g_jmms_context->nCurr_focused_med_type = 0;
  367.     g_jmms_context->num_attachments = 0;
  368.     g_jmms_context->nSent_retry_counter = 0;
  369.     memset(g_jmms_context->subject_input_buffer, 0x00, (MAX_SUBJECT_LENGTH + 1) * ENCODING_LENGTH);
  370.     g_jmms_context->g_write_mms_right_soft_key = STR_GLOBAL_BACK;
  371. }
  372. /*****************************************************************************
  373.  * FUNCTION
  374.  *  mmi_jmms_entry_write_message_screen_in_history
  375.  * DESCRIPTION
  376.  *  Entry fn for Write MMS
  377.  * PARAMETERS
  378.  *  void
  379.  * RETURNS
  380.  *  void
  381.  *****************************************************************************/
  382. void mmi_jmms_entry_write_message_screen_in_history(void)
  383. {
  384.     /*----------------------------------------------------------------*/
  385.     /* Local Variables                                                */
  386.     /*----------------------------------------------------------------*/
  387.     history hist;
  388.     historyNode *saved_history;
  389.     /*----------------------------------------------------------------*/
  390.     /* Code Body                                                      */
  391.     /*----------------------------------------------------------------*/
  392.     memset(&hist, 0, sizeof(history));
  393.     hist.scrnID = SCR_ID_JMMS_WRITE_MMS_HISTORY;
  394.     hist.entryFuncPtr = mmi_jmms_entry_write_message_screen;
  395.     AddHistory(hist);
  396.     /* This is a workaround to make sure that if small screen is the current screen on MMI.
  397.        Its state is not changed and SCR_ID_JMMS_WRITE_MMS_HISTORY is not saved as small screen */
  398.     GetHistoryPointer(SCR_ID_JMMS_WRITE_MMS_HISTORY, &saved_history);
  399.     if (saved_history->isSmallScreen == 1)
  400.     {
  401.         saved_history->isSmallScreen = 0;
  402.         set_small_screen();
  403.     }
  404. }
  405. /*****************************************************************************
  406.  * FUNCTION
  407.  *  mmi_jmms_entry_write_message_screen
  408.  * DESCRIPTION
  409.  *  Entry fn for Write MMS
  410.  * PARAMETERS
  411.  *  void
  412.  * RETURNS
  413.  *  void
  414.  *****************************************************************************/
  415. void mmi_jmms_entry_write_message_screen(void)
  416. {
  417.     /*----------------------------------------------------------------*/
  418.     /* Local Variables                                                */
  419.     /*----------------------------------------------------------------*/
  420.     U8 *guiBuffer;
  421.     U8 *inputBuffer;        /* added for inline edit history */
  422.     U16 inputBufferSize;    /* added for inline edit history */
  423.     U16 image_list[WRITE_MMS_INLINE_TOTAL] = {0};
  424.     /*----------------------------------------------------------------*/
  425.     /* Code Body                                                      */
  426.     /*----------------------------------------------------------------*/
  427.     #ifdef __MMI_UNIFIED_MESSAGE__
  428.     mmi_jmms_jdi_deinitview(g_jmms_context->msg_handle);
  429.     #endif
  430.     if (g_jmms_context->compose_context == NULL)
  431.     {
  432.         g_jmms_context->compose_context =
  433.             (jmms_compose_context_struct*) jdd_MemAlloc(sizeof(jmms_compose_context_struct), 1);
  434.         if (g_jmms_context->compose_context == NULL)
  435.         {
  436.             DisplayPopup((PU8) GetString(STR_ID_JMMS_OUT_OF_MEMORY), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
  437.             return;
  438.         }
  439.     }
  440.     EntryNewScreen(SCR_ID_JMMS_WRITE_MMS, mmi_jmms_exit_write_message, NULL, NULL);
  441.     set_leading_zero(FALSE);
  442.     guiBuffer = GetCurrGuiBuffer(SCR_ID_JMMS_WRITE_MMS);
  443.     InitializeCategory57Screen();
  444.     mmi_jmms_write_mms_fill_inline_struct();
  445.     RegisterHighlightHandler(mmi_jmms_write_mms_highlight_hdlr);
  446.     inputBuffer = GetCurrNInputBuffer(SCR_ID_JMMS_WRITE_MMS, &inputBufferSize); /* added for inline edit history */
  447.     if (inputBuffer)    /* added for inline edit history */
  448.     {
  449.         SetCategory57Data(wgui_inline_items, WRITE_MMS_INLINE_TOTAL, inputBuffer);      /* sets the data */
  450.     }
  451.     image_list[E_WRITE_MMS_TO] = IMG_ID_WRITE_MMS_TO;
  452.     image_list[E_WRITE_MMS_CC] = IMG_ID_WRITE_MMS_CC;
  453.     image_list[E_WRITE_MMS_BCC] = IMG_ID_WRITE_MMS_BCC;
  454.     image_list[E_WRITE_MMS_SUBJECT] = IMG_ID_WRITE_MMS_SUBJECT;
  455.     image_list[E_WRITE_MMS_ATTACHMENT_CAPTION] = IMG_ID_WRITE_MMS_ATTACHMENT;
  456.     image_list[E_WRITE_MMS_EDIT_CONTENT_CAPTION] = IMG_ID_WRITE_MMS_EDIT_CONTENT;
  457.     ShowCategory57Screen(
  458.         NULL,
  459.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  460.         NULL,
  461.         NULL,
  462.         (g_jmms_context->g_write_mms_right_soft_key),
  463.         NULL,
  464.         WRITE_MMS_INLINE_TOTAL,
  465.         image_list,
  466.         wgui_inline_items,
  467.         0,
  468.         guiBuffer);
  469.     SetCategory57RightSoftkeyFunctions(mmi_jmms_done_write_mms, GoBackHistory);
  470. //    SetKeyHandler(mmi_jmms_free_addresses_list_on_end, KEY_END, KEY_EVENT_DOWN);
  471. }
  472. /*****************************************************************************
  473.  * FUNCTION
  474.  *  mmi_jmms_free_addresses_list_on_end
  475.  * DESCRIPTION
  476.  *  This fn will free the addresses list and retrun back to idle screen
  477.  * PARAMETERS
  478.  *  void
  479.  * RETURNS
  480.  *  void
  481.  *****************************************************************************/
  482. /*void mmi_jmms_free_addresses_list_on_end(void)
  483. {
  484.     mmi_jmms_free_addresses_list();
  485.     DisplayIdleScreen();
  486. }
  487. */
  488. /*****************************************************************************
  489.  * FUNCTION
  490.  *  mmi_jmms_free_addresses_list
  491.  * DESCRIPTION
  492.  *  This fn will free the addresses(To,Cc,Bcc) list
  493.  * PARAMETERS
  494.  *  void
  495.  * RETURNS
  496.  *  void
  497.  *****************************************************************************/
  498. void mmi_jmms_free_addresses_list(void)
  499. {
  500.     /*----------------------------------------------------------------*/
  501.     /* Local Variables                                                */
  502.     /*----------------------------------------------------------------*/
  503.     jmms_address_list *address_node;
  504.     /*----------------------------------------------------------------*/
  505.     /* Code Body                                                      */
  506.     /*----------------------------------------------------------------*/
  507.     if (g_jmms_context->to_address_p != NULL)
  508.     {
  509.         address_node = g_jmms_context->to_address_p;
  510.         while (address_node != NULL)
  511.         {
  512.             g_jmms_context->to_address_p = address_node->next;
  513.             jdd_MemFree(address_node->address);
  514.             jdd_MemFree(address_node);
  515.             address_node = g_jmms_context->to_address_p;
  516.         }
  517.     }
  518.     g_jmms_context->num_to_addresses = 0;
  519.     g_jmms_context->to_address_p = NULL;
  520.     address_node = g_jmms_context->cc_address_p;
  521.     if (g_jmms_context->cc_address_p != NULL)
  522.     {
  523.         address_node = g_jmms_context->cc_address_p;
  524.         while (address_node != NULL)
  525.         {
  526.             g_jmms_context->cc_address_p = address_node->next;
  527.             jdd_MemFree(address_node->address);
  528.             jdd_MemFree(address_node);
  529.             address_node = g_jmms_context->cc_address_p;
  530.         }
  531.     }
  532.     g_jmms_context->num_cc_addresses = 0;
  533.     g_jmms_context->cc_address_p = NULL;
  534.     address_node = g_jmms_context->bcc_address_p;
  535.     if (g_jmms_context->bcc_address_p != NULL)
  536.     {
  537.         address_node = g_jmms_context->bcc_address_p;
  538.         while (address_node != NULL)
  539.         {
  540.             g_jmms_context->bcc_address_p = address_node->next;
  541.             jdd_MemFree(address_node->address);
  542.             jdd_MemFree(address_node);
  543.             address_node = g_jmms_context->bcc_address_p;
  544.         }
  545.     }
  546.     g_jmms_context->num_bcc_addresses = 0;
  547.     g_jmms_context->bcc_address_p = NULL;
  548.     g_jmms_context->num_total_addresses = 0;
  549. }
  550. /*****************************************************************************
  551.  * FUNCTION
  552.  *  mmi_jmms_write_mms_fill_inline_struct
  553.  * DESCRIPTION
  554.  *  Fills the inline structure for write mms screen
  555.  * PARAMETERS
  556.  *  void
  557.  * RETURNS
  558.  *  void
  559.  *****************************************************************************/
  560. void mmi_jmms_write_mms_fill_inline_struct(void)
  561. {
  562.     /*----------------------------------------------------------------*/
  563.     /* Local Variables                                                */
  564.     /*----------------------------------------------------------------*/
  565.     S8 *to_caption = NULL;
  566.     S8 *cc_caption = NULL;
  567.     S8 *bcc_caption = NULL;
  568.     S8 *attachment_caption = g_jmms_context->g_jmms_files_caption_buff;
  569.     S8 *slides_caption = g_jmms_context->g_jmms_slide_caption_buff;
  570.     S32 len = 0, temp_len = 0;
  571.     U8 no_attachments;
  572.     /* PMT VIKAS START 20050325 */
  573.     S8 str[20];
  574.     S8 tempstr[20 * ENCODING_LENGTH] = {0x00};
  575.     U8 page_count;
  576.     U32 mms_size;
  577.     U32 size_kb;
  578.     U32 size_bytes;
  579. float32 size_mb =0, size_gb = 0;
  580.     /*----------------------------------------------------------------*/
  581.     /* Code Body                                                      */
  582.     /*----------------------------------------------------------------*/
  583.     /* PMT VIKAS END 20050325 */
  584.     /* TO */
  585.     SetInlineItemActivation(&wgui_inline_items[E_WRITE_MMS_TO], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  586.     if (g_jmms_context->num_to_addresses == 0)
  587.     {
  588.         to_caption = GetString(STR_ID_WRITE_MMS_TO_BLANK_CAPTION);
  589.     }
  590.     else if (g_jmms_context->num_to_addresses == 1)
  591.     {
  592.         to_caption = g_jmms_context->to_address_p->address;
  593.     }
  594.     else
  595.     {
  596.         to_caption = g_jmms_context->g_jmms_to_caption_buff;
  597.         memset(to_caption, 0x00, (MAX_RECIPIENTS_CAPTION_LENGTH + 1) * ENCODING_LENGTH);
  598.         sprintf(str, "%d ", g_jmms_context->num_to_addresses);
  599.         AnsiiToUnicodeString((PS8) to_caption, (PS8) str);
  600.         len = pfnUnicodeStrlen((PS8) to_caption);
  601.         temp_len = len;
  602.         len = len + pfnUnicodeStrlen((PS8) GetString(STR_ID_JMMS_RECIPIENTS));
  603.         if (len > MAX_RECIPIENTS_CAPTION_LENGTH)
  604.         {
  605.             len = MAX_RECIPIENTS_CAPTION_LENGTH - temp_len;
  606.             pfnUnicodeStrncat((S8*) to_caption, (const S8*)GetString(STR_ID_JMMS_RECIPIENTS), len);
  607.         }
  608.         else
  609.         {
  610.             pfnUnicodeStrcat((S8*) to_caption, (const S8*)GetString(STR_ID_JMMS_RECIPIENTS));
  611.         }
  612.     }
  613.     SetInlineItemDisplayOnly(&wgui_inline_items[E_WRITE_MMS_TO], (U8*) (to_caption));
  614.     /* CC */
  615.     SetInlineItemActivation(&wgui_inline_items[E_WRITE_MMS_CC], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  616.     if (g_jmms_context->num_cc_addresses == 0)
  617.     {
  618.         cc_caption = GetString(STR_ID_WRITE_MMS_CC_BLANK_CAPTION);
  619.     }
  620.     else if (g_jmms_context->num_cc_addresses == 1)
  621.     {
  622.         cc_caption = g_jmms_context->cc_address_p->address;
  623.     }
  624.     else
  625.     {
  626.         cc_caption = g_jmms_context->g_jmms_cc_caption_buff;
  627.         memset(cc_caption, 0x00, (MAX_RECIPIENTS_CAPTION_LENGTH + 1) * ENCODING_LENGTH);
  628.         sprintf(str, "%d ", g_jmms_context->num_cc_addresses);
  629.         AnsiiToUnicodeString((PS8) cc_caption, (PS8) str);
  630.         len = pfnUnicodeStrlen((PS8) cc_caption);
  631.         temp_len = len;
  632.         len = len + pfnUnicodeStrlen((PS8) GetString(STR_ID_JMMS_RECIPIENTS));
  633.         if (len > MAX_RECIPIENTS_CAPTION_LENGTH)
  634.         {
  635.             len = MAX_RECIPIENTS_CAPTION_LENGTH - temp_len;
  636.             pfnUnicodeStrncat((S8*) cc_caption, (const S8*)GetString(STR_ID_JMMS_RECIPIENTS), len);
  637.         }
  638.         else
  639.         {
  640.             pfnUnicodeStrcat((S8*) cc_caption, (const S8*)GetString(STR_ID_JMMS_RECIPIENTS));
  641.         }
  642.     }
  643.     SetInlineItemDisplayOnly(&wgui_inline_items[E_WRITE_MMS_CC], (U8*) cc_caption);
  644.     /* BCC */
  645.     SetInlineItemActivation(&wgui_inline_items[E_WRITE_MMS_BCC], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  646.     if (g_jmms_context->num_bcc_addresses == 0)
  647.     {
  648.         bcc_caption = GetString(STR_ID_WRITE_MMS_BCC_BLANK_CAPTION);
  649.     }
  650.     else if (g_jmms_context->num_bcc_addresses == 1)
  651.     {
  652.         bcc_caption = g_jmms_context->bcc_address_p->address;
  653.     }
  654.     else
  655.     {
  656.         bcc_caption = g_jmms_context->g_jmms_bcc_caption_buff;
  657.         memset(bcc_caption, 0x00, (MAX_RECIPIENTS_CAPTION_LENGTH + 1) * ENCODING_LENGTH);
  658.         sprintf(str, "%d ", g_jmms_context->num_bcc_addresses);
  659.         AnsiiToUnicodeString((PS8) bcc_caption, (PS8) str);
  660.         len = pfnUnicodeStrlen((PS8) bcc_caption);
  661.         temp_len = len;
  662.         len = len + pfnUnicodeStrlen((PS8) GetString(STR_ID_JMMS_RECIPIENTS));
  663.         if (len > MAX_RECIPIENTS_CAPTION_LENGTH)
  664.         {
  665.             len = MAX_RECIPIENTS_CAPTION_LENGTH - temp_len;
  666.             pfnUnicodeStrncat((S8*) bcc_caption, (const S8*)GetString(STR_ID_JMMS_RECIPIENTS), len);
  667.         }
  668.         else
  669.         {
  670.             pfnUnicodeStrcat((S8*) bcc_caption, (const S8*)GetString(STR_ID_JMMS_RECIPIENTS));
  671.         }
  672.     }
  673.     SetInlineItemDisplayOnly(&wgui_inline_items[E_WRITE_MMS_BCC], (U8*) bcc_caption);
  674.     /* Subject */
  675.     SetInlineItemActivation(&wgui_inline_items[E_WRITE_MMS_SUBJECT], KEY_LSK, KEY_EVENT_UP);
  676.     SetInlineItemFullScreenEdit(
  677.         &wgui_inline_items[E_WRITE_MMS_SUBJECT],
  678.         STR_ID_WRITE_MMS_SUBJECT,
  679.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  680.         (PU8) g_jmms_context->subject_input_buffer,
  681.         MAX_SUBJECT_LENGTH + 1,
  682.         INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  683.     SetInlineFullScreenEditCustomFunction(
  684.         &wgui_inline_items[E_WRITE_MMS_SUBJECT],
  685.         mmi_jmms_write_mms_subject_custom_func);
  686.     /* Attachments */
  687.     SetInlineItemActivation(
  688.         &wgui_inline_items[E_WRITE_MMS_ATTACHMENT_CAPTION],
  689.         INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT,
  690.         0);
  691.     SetInlineItemCaption(&wgui_inline_items[E_WRITE_MMS_ATTACHMENT_CAPTION], (U8*) GetString(STR_ID_JMMS_ATTACHMENT));
  692.     SetInlineItemActivation(&wgui_inline_items[E_WRITE_MMS_ATTACHMENT], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  693.     memset(attachment_caption, 0x00, (MAX_FILES_CAPTION_LENGTH + 1) * ENCODING_LENGTH);
  694.     mmi_jmms_jdi_get_media_count(g_jmms_context->msg_handle, 0, &(no_attachments), E_TRUE);
  695.     g_jmms_context->num_attachments = no_attachments;
  696.     sprintf(str, "%d ", g_jmms_context->num_attachments);
  697.     AnsiiToUnicodeString((PS8) attachment_caption, (PS8) str);
  698.     len = pfnUnicodeStrlen((PS8) attachment_caption);
  699.     temp_len = len;
  700.     len = len + pfnUnicodeStrlen((PS8) GetString(STR_ID_JMMS_FILES));
  701.     if (len > MAX_FILES_CAPTION_LENGTH)
  702.     {
  703.         len = MAX_FILES_CAPTION_LENGTH - temp_len;
  704.         pfnUnicodeStrncat((S8*) attachment_caption, (const S8*)GetString(STR_ID_JMMS_FILES), len);
  705.     }
  706.     else
  707.     {
  708.         pfnUnicodeStrcat((S8*) attachment_caption, (const S8*)GetString(STR_ID_JMMS_FILES));
  709.     }
  710.     SetInlineItemDisplayOnly(&wgui_inline_items[E_WRITE_MMS_ATTACHMENT], (U8*) attachment_caption);
  711.     /* Edit Content */
  712.     SetInlineItemActivation(
  713.         &wgui_inline_items[E_WRITE_MMS_EDIT_CONTENT_CAPTION],
  714.         INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT,
  715.         0);
  716.     SetInlineItemCaption(
  717.         &wgui_inline_items[E_WRITE_MMS_EDIT_CONTENT_CAPTION],
  718.         (U8*) GetString(STR_ID_WRITE_MMS_EDIT_CONTENT));
  719.     SetInlineItemActivation(&wgui_inline_items[E_WRITE_MMS_EDIT_CONTENT], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  720.     mmi_jmms_jdi_get_total_pages(g_jmms_context->msg_handle, &page_count);
  721.     memset(slides_caption, 0x00, (MAX_SLIDES_CAPTION_LENGTH + 1) * ENCODING_LENGTH);
  722.     sprintf(str, "%d ", page_count);
  723.     AnsiiToUnicodeString((PS8) slides_caption, (PS8) str);
  724.     len = pfnUnicodeStrlen((PS8) slides_caption);
  725.     temp_len = len;
  726.     len = len + pfnUnicodeStrlen((PS8) GetString(STR_ID_JMMS_SLIDES));
  727.     if (len > MAX_SLIDES_CAPTION_LENGTH)
  728.     {
  729.         pfnUnicodeStrncat(
  730.             (S8*) slides_caption,
  731.             (const S8*)GetString(STR_ID_JMMS_SLIDES),
  732.             MAX_SLIDES_CAPTION_LENGTH - temp_len);
  733.         goto END;
  734.     }
  735.     else
  736.     {
  737.         pfnUnicodeStrcat((S8*) slides_caption, (const S8*)GetString(STR_ID_JMMS_SLIDES));
  738.     }
  739.     //PMT VIKAS START 20050325
  740.     //To add slide size
  741.     mmi_jmms_jdi_get_size(g_jmms_context->msg_handle, 0, &mms_size);
  742.     size_kb = mms_size / 1024;
  743.     size_bytes = mms_size % 1024;
  744. size_mb = (float32)size_kb/1024 ;
  745. size_gb = size_mb/1024;
  746. if (size_gb > 1.0 && size_mb > 1024)
  747.     {
  748.         sprintf(str, " (%0.02f ", size_gb);
  749.         AnsiiToUnicodeString((PS8) tempstr, (PS8) str);
  750.         temp_len = len;
  751.         len = len + pfnUnicodeStrlen((PS8) tempstr);
  752.         if (len > MAX_SLIDES_CAPTION_LENGTH)
  753.         {
  754.             pfnUnicodeStrncat((S8*) slides_caption, (S8*) tempstr, MAX_SLIDES_CAPTION_LENGTH - temp_len);
  755.             goto END;
  756.         }
  757.         else
  758.         {
  759.             pfnUnicodeStrcat((S8*) slides_caption, (S8*) tempstr);
  760.         }
  761.         temp_len = len;
  762.         len = len + pfnUnicodeStrlen((PS8) GetString(STR_ID_JMMS_GB));
  763.         if (len > MAX_SLIDES_CAPTION_LENGTH)
  764.         {
  765.             pfnUnicodeStrncat(
  766.                 (S8*) slides_caption,
  767.                 (S8*) GetString(STR_ID_JMMS_GB),
  768.                 MAX_SLIDES_CAPTION_LENGTH - temp_len);
  769.             goto END;
  770.         }
  771.         else
  772.         {
  773.             pfnUnicodeStrcat((S8*) slides_caption, (S8*) GetString(STR_ID_JMMS_GB));
  774.         }
  775.     }
  776. else if (size_mb > 1.0 && size_kb > 1024)
  777.     {
  778.         sprintf(str, " (%0.02f ", size_mb);
  779.         AnsiiToUnicodeString((PS8) tempstr, (PS8) str);
  780.         temp_len = len;
  781.         len = len + pfnUnicodeStrlen((PS8) tempstr);
  782.         if (len > MAX_SLIDES_CAPTION_LENGTH)
  783.         {
  784.             pfnUnicodeStrncat((S8*) slides_caption, (S8*) tempstr, MAX_SLIDES_CAPTION_LENGTH - temp_len);
  785.             goto END;
  786.         }
  787.         else
  788.         {
  789.             pfnUnicodeStrcat((S8*) slides_caption, (S8*) tempstr);
  790.         }
  791.         temp_len = len;
  792.         len = len + pfnUnicodeStrlen((PS8) GetString(STR_ID_JMMS_MB));
  793.         if (len > MAX_SLIDES_CAPTION_LENGTH)
  794.         {
  795.             pfnUnicodeStrncat(
  796.                 (S8*) slides_caption,
  797.                 (S8*) GetString(STR_ID_JMMS_MB),
  798.                 MAX_SLIDES_CAPTION_LENGTH - temp_len);
  799.             goto END;
  800.         }
  801.         else
  802.         {
  803.             pfnUnicodeStrcat((S8*) slides_caption, (S8*) GetString(STR_ID_JMMS_MB));
  804.         }
  805.     }
  806.     else if (size_kb >= 1)
  807.     {
  808.         size_kb++;
  809.         sprintf(str, " (%d ", size_kb);
  810.         AnsiiToUnicodeString((PS8) tempstr, (PS8) str);
  811.         temp_len = len;
  812.         len = len + pfnUnicodeStrlen((PS8) tempstr);
  813.         if (len > MAX_SLIDES_CAPTION_LENGTH)
  814.         {
  815.             pfnUnicodeStrncat((S8*) slides_caption, (S8*) tempstr, MAX_SLIDES_CAPTION_LENGTH - temp_len);
  816.             goto END;
  817.         }
  818.         else
  819.         {
  820.             pfnUnicodeStrcat((S8*) slides_caption, (S8*) tempstr);
  821.         }
  822.         temp_len = len;
  823.         len = len + pfnUnicodeStrlen((PS8) GetString(STR_ID_JMMS_KB));
  824.         if (len > MAX_SLIDES_CAPTION_LENGTH)
  825.         {
  826.             pfnUnicodeStrncat(
  827.                 (S8*) slides_caption,
  828.                 (S8*) GetString(STR_ID_JMMS_KB),
  829.                 MAX_SLIDES_CAPTION_LENGTH - temp_len);
  830.             goto END;
  831.         }
  832.         else
  833.         {
  834.             pfnUnicodeStrcat((S8*) slides_caption, (S8*) GetString(STR_ID_JMMS_KB));
  835.         }
  836.     }
  837.     else
  838.     {
  839.         sprintf(str, " (%d ", mms_size);
  840.         AnsiiToUnicodeString((PS8) tempstr, (PS8) str);
  841.         temp_len = len;
  842.         len = len + pfnUnicodeStrlen((PS8) tempstr);
  843.         if (len > MAX_SLIDES_CAPTION_LENGTH)
  844.         {
  845.             pfnUnicodeStrncat((S8*) slides_caption, (S8*) tempstr, MAX_SLIDES_CAPTION_LENGTH - temp_len);
  846.             goto END;
  847.         }
  848.         else
  849.         {
  850.             pfnUnicodeStrcat((S8*) slides_caption, (S8*) tempstr);
  851.         }
  852.         temp_len = len;
  853.         len = len + pfnUnicodeStrlen((PS8) GetString(STR_ID_JMMS_KB));
  854.         if (len > MAX_SLIDES_CAPTION_LENGTH)
  855.         {
  856.             pfnUnicodeStrncat(
  857.                 (S8*) slides_caption,
  858.                 (S8*) GetString(STR_ID_JMMS_WRITE_MMS_BYTES),
  859.                 MAX_SLIDES_CAPTION_LENGTH - temp_len);
  860.             goto END;
  861.         }
  862.         else
  863.         {
  864.             pfnUnicodeStrcat((S8*) slides_caption, (S8*) GetString(STR_ID_JMMS_WRITE_MMS_BYTES));
  865.         }
  866.     }
  867.     memset(tempstr, 0, 20 * ENCODING_LENGTH);
  868.     AnsiiToUnicodeString((PS8) tempstr, ")");
  869.     temp_len = len;
  870.     len = len + pfnUnicodeStrlen((PS8) tempstr);
  871.     if (len > MAX_SLIDES_CAPTION_LENGTH)
  872.     {
  873.         pfnUnicodeStrncat((S8*) slides_caption, (S8*) tempstr, MAX_SLIDES_CAPTION_LENGTH - temp_len);
  874.     }
  875.     else
  876.     {
  877.         pfnUnicodeStrcat((S8*) slides_caption, (S8*) tempstr);
  878.     }
  879.     /* PMT VIKAS END 20050325 */
  880.   END:
  881.     SetInlineItemDisplayOnly(&wgui_inline_items[E_WRITE_MMS_EDIT_CONTENT], (U8*) slides_caption);
  882. }
  883. /*****************************************************************************
  884.  * FUNCTION
  885.  *  mmi_jmms_write_mms_subject_custom_func
  886.  * DESCRIPTION
  887.  *  Custom fn for subject editor
  888.  * PARAMETERS
  889.  *  void
  890.  * RETURNS
  891.  *  void
  892.  *****************************************************************************/
  893. void mmi_jmms_write_mms_subject_custom_func(void)
  894. {
  895.     /*----------------------------------------------------------------*/
  896.     /* Local Variables                                                */
  897.     /*----------------------------------------------------------------*/
  898.     /*----------------------------------------------------------------*/
  899.     /* Code Body                                                      */
  900.     /*----------------------------------------------------------------*/
  901.     ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, IMG_GLOBAL_OPTIONS);
  902.     SetLeftSoftkeyFunction(EntryScrForInputMethodAndDone, KEY_EVENT_UP);
  903.     SetInputMethodAndDoneCaptionIcon(GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID));
  904. //    SetKeyHandler(mmi_jmms_free_addresses_list_on_end, KEY_END, KEY_EVENT_DOWN);
  905. }
  906. /*****************************************************************************
  907.  * FUNCTION
  908.  *  mmi_jmms_write_mms_highlight_hdlr
  909.  * DESCRIPTION
  910.  *  Highlight handler of write mms screen items
  911.  * PARAMETERS
  912.  *  index       [IN]        
  913.  * RETURNS
  914.  *  void
  915.  *****************************************************************************/
  916. void mmi_jmms_write_mms_highlight_hdlr(S32 index)
  917. {
  918.     /*----------------------------------------------------------------*/
  919.     /* Local Variables                                                */
  920.     /*----------------------------------------------------------------*/
  921.     /*----------------------------------------------------------------*/
  922.     /* Code Body                                                      */
  923.     /*----------------------------------------------------------------*/
  924.     is_add_media_as_drm = MMI_FALSE;
  925.     if (index == E_WRITE_MMS_ATTACHMENT)
  926.     {
  927.         if (mmi_jmms_is_message_to_fwd() == MMI_TRUE)
  928.         {
  929.             ChangeLeftSoftkey(NULL, NULL);
  930.         }
  931.         else
  932.         {
  933.             ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, IMG_GLOBAL_OPTIONS);
  934.             SetLeftSoftkeyFunction(mmi_jmms_entry_attachment_options, KEY_EVENT_UP);
  935.         }
  936.         ChangeTitleString((U8*) GetString(STR_ID_JMMS_ATTACHMENT));
  937.         draw_title();
  938.         if (g_jmms_context->g_write_mms_right_soft_key == STR_GLOBAL_DONE)
  939.         {
  940.             SetRightSoftkeyFunction(mmi_jmms_done_write_mms, KEY_EVENT_UP);
  941.             ChangeRightSoftkey(STR_GLOBAL_DONE, NULL);
  942.         }
  943.     }
  944.     else
  945.     {
  946.         if (mmi_jmms_is_message_to_fwd() == MMI_TRUE && index == E_WRITE_MMS_EDIT_CONTENT)
  947.         {
  948.             ChangeLeftSoftkey(NULL, NULL);
  949.         }
  950.         else
  951.             ChangeLeftSoftkey(STR_GLOBAL_EDIT, NULL);
  952.         if (index == E_WRITE_MMS_TO)
  953.         {
  954.             g_jmms_context->address_list_flag = E_TO_ADDRESSES;
  955.             SetLeftSoftkeyFunction(mmi_jmms_entry_address_option, KEY_EVENT_UP);
  956.             ChangeTitleString((U8*) GetString(STR_ID_WRITE_MMS_TO));
  957.             draw_title();
  958.         }
  959.         if (index == E_WRITE_MMS_CC)
  960.         {
  961.             g_jmms_context->address_list_flag = E_CC_ADDRESSES;
  962.             SetLeftSoftkeyFunction(mmi_jmms_entry_address_option, KEY_EVENT_UP);
  963.             ChangeTitleString((U8*) GetString(STR_ID_WRITE_MMS_CC));
  964.             draw_title();
  965.         }
  966.         if (index == E_WRITE_MMS_BCC)
  967.         {
  968.             g_jmms_context->address_list_flag = E_BCC_ADDRESSES;
  969.             SetLeftSoftkeyFunction(mmi_jmms_entry_address_option, KEY_EVENT_UP);
  970.             ChangeTitleString((U8*) GetString(STR_ID_WRITE_MMS_BCC));
  971.             draw_title();
  972.         }
  973.         if (index == E_WRITE_MMS_EDIT_CONTENT)
  974.         {
  975.             if (mmi_jmms_is_message_to_fwd() != MMI_TRUE)
  976.             {
  977.                 SetLeftSoftkeyFunction(mmi_jmms_pre_entry_edit_content_screen, KEY_EVENT_UP);
  978.             }
  979. else
  980. {
  981. ChangeLeftSoftkey(NULL, NULL);
  982. }
  983.             ChangeTitleString((U8*) GetString(STR_ID_WRITE_MMS_EDIT_CONTENT));
  984.             draw_title();
  985.         }
  986.         if (index == E_WRITE_MMS_SUBJECT)
  987.         {
  988.             ChangeTitleString((U8*) GetString(STR_ID_WRITE_MMS_SUBJECT));
  989.             draw_title();
  990.             if (g_jmms_context->g_write_mms_right_soft_key == STR_GLOBAL_DONE)
  991.             {
  992.                 SetRightSoftkeyFunction(mmi_jmms_done_write_mms, KEY_EVENT_UP);
  993.                 ChangeRightSoftkey(STR_GLOBAL_DONE, NULL);
  994.             }
  995.         }
  996.         if (index == E_WRITE_MMS_CC || index == E_WRITE_MMS_TO || index == E_WRITE_MMS_BCC ||
  997.             index == E_WRITE_MMS_EDIT_CONTENT)
  998.         {
  999.             if (g_jmms_context->g_write_mms_right_soft_key == STR_GLOBAL_DONE)
  1000.             {
  1001.                 SetRightSoftkeyFunction(mmi_jmms_done_write_mms, KEY_EVENT_UP);
  1002.                 ChangeRightSoftkey(STR_GLOBAL_DONE, NULL);
  1003.             }
  1004.         }
  1005.     }
  1006. }
  1007. /*****************************************************************************
  1008.  * FUNCTION
  1009.  *  mmi_jmms_exit_write_message
  1010.  * DESCRIPTION
  1011.  *  Exit fn of write mms
  1012.  * PARAMETERS
  1013.  *  void
  1014.  * RETURNS
  1015.  *  void
  1016.  *****************************************************************************/
  1017. void mmi_jmms_exit_write_message(void)
  1018. {
  1019.     /*----------------------------------------------------------------*/
  1020.     /* Local Variables                                                */
  1021.     /*----------------------------------------------------------------*/
  1022.     history history_buff;
  1023.     U16 inputBufferSize;    /* added for inline edit history */
  1024.     S16 nhistory = 0;
  1025.     /*----------------------------------------------------------------*/
  1026.     /* Code Body                                                      */
  1027.     /*----------------------------------------------------------------*/
  1028.     set_leading_zero(TRUE);
  1029.     CloseCategory57Screen();
  1030.     history_buff.scrnID = SCR_ID_JMMS_WRITE_MMS;
  1031.     history_buff.entryFuncPtr = mmi_jmms_entry_write_message_screen;
  1032.     pfnUnicodeStrcpy((S8*) history_buff.inputBuffer, (S8*) & nhistory);
  1033.     GetCategory57History(history_buff.guiBuffer);
  1034.     inputBufferSize = (U16) GetCategory57DataSize();    /* added for inline edit history */
  1035.     GetCategory57Data((U8*) history_buff.inputBuffer);  /* added for inline edit history */
  1036.     AddNHistory(history_buff, inputBufferSize);
  1037. }
  1038. /*****************************************************************************
  1039.  * FUNCTION
  1040.  *  mmi_jmms_entry_address_option
  1041.  * DESCRIPTION
  1042.  *  pre entry fn for addresses options
  1043.  * PARAMETERS
  1044.  *  void
  1045.  * RETURNS
  1046.  *  void
  1047.  *****************************************************************************/
  1048. void mmi_jmms_entry_address_option(void)
  1049. {
  1050.     /*----------------------------------------------------------------*/
  1051.     /* Local Variables                                                */
  1052.     /*----------------------------------------------------------------*/
  1053.     /*----------------------------------------------------------------*/
  1054.     /* Code Body                                                      */
  1055.     /*----------------------------------------------------------------*/
  1056.     if (g_jmms_context->address_list_flag == E_TO_ADDRESSES)
  1057.     {
  1058.         if (g_jmms_context->num_to_addresses == 0)
  1059.         {
  1060.             mmi_jmms_entry_addresses_option_screen();
  1061.         }
  1062.         else
  1063.         {
  1064.             g_hilite_address_item = 0;
  1065.             g_address_list_right_soft_key = STR_GLOBAL_BACK;
  1066.             mmi_jmms_entry_addresses_list_screen();
  1067.         }
  1068.     }
  1069.     else if (g_jmms_context->address_list_flag == E_CC_ADDRESSES)
  1070.     {
  1071.         if (g_jmms_context->num_cc_addresses == 0)
  1072.         {
  1073.             mmi_jmms_entry_addresses_option_screen();
  1074.         }
  1075.         else
  1076.         {
  1077.             g_hilite_address_item = 0;
  1078.             g_address_list_right_soft_key = STR_GLOBAL_BACK;
  1079.             mmi_jmms_entry_addresses_list_screen();
  1080.         }
  1081.     }
  1082.     else if (g_jmms_context->address_list_flag == E_BCC_ADDRESSES)
  1083.     {
  1084.         if (g_jmms_context->num_bcc_addresses == 0)
  1085.         {
  1086.             mmi_jmms_entry_addresses_option_screen();
  1087.         }
  1088.         else
  1089.         {
  1090.             g_hilite_address_item = 0;
  1091.             g_address_list_right_soft_key = STR_GLOBAL_BACK;
  1092.             mmi_jmms_entry_addresses_list_screen();
  1093.         }
  1094.     }
  1095. }
  1096. /*****************************************************************************
  1097.  * FUNCTION
  1098.  *  mmi_jmms_entry_addresses_option_screen
  1099.  * DESCRIPTION
  1100.  *  Entry fn for addresses option screeen
  1101.  * PARAMETERS
  1102.  *  void
  1103.  * RETURNS
  1104.  *  void
  1105.  *****************************************************************************/
  1106. void mmi_jmms_entry_addresses_option_screen(void)
  1107. {
  1108.     /*----------------------------------------------------------------*/
  1109.     /* Local Variables                                                */
  1110.     /*----------------------------------------------------------------*/
  1111.     PU8 guiBuffer;  /* Buffer holding history data */
  1112.     U16 nStrItemList[MAX_SUB_MENUS];
  1113.     U16 nNumofItem;
  1114.     U8 temp_num_items;
  1115.     U16 titleid;
  1116.     /*----------------------------------------------------------------*/
  1117.     /* Code Body                                                      */
  1118.     /*----------------------------------------------------------------*/
  1119.     if (g_jmms_context->address_list_flag == E_TO_ADDRESSES)
  1120.     {
  1121.         temp_num_items = g_jmms_context->num_to_addresses;
  1122.         titleid = STR_ID_WRITE_MMS_TO;
  1123.     }
  1124.     else if (g_jmms_context->address_list_flag == E_CC_ADDRESSES)
  1125.     {
  1126.         temp_num_items = g_jmms_context->num_cc_addresses;
  1127.         titleid = STR_ID_WRITE_MMS_CC;
  1128.     }
  1129.     else if (g_jmms_context->address_list_flag == E_BCC_ADDRESSES)
  1130.     {
  1131.         temp_num_items = g_jmms_context->num_bcc_addresses;
  1132.         titleid = STR_ID_WRITE_MMS_BCC;
  1133.     }
  1134.     else
  1135.     {
  1136.         return;
  1137.     }
  1138.     EntryNewScreen(SCR_ID_WRITE_MMS_ADDRESSES_OPTION, NULL, mmi_jmms_entry_addresses_option_screen, NULL);
  1139.     guiBuffer = GetCurrGuiBuffer(SCR_ID_WRITE_MMS_ADDRESSES_OPTION);
  1140.     SetParentHandler(MENU_ID_JMMS_WRITE_MMS_ADDRESSES_OPTIONS);
  1141.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1142.     if (temp_num_items == 0)
  1143.     {
  1144.         mmi_frm_hide_menu_item(MENU_ID_JMMS_WRITE_MMS_EDIT);
  1145.     }
  1146.     else
  1147.     {
  1148.         mmi_frm_unhide_menu_item(MENU_ID_JMMS_WRITE_MMS_EDIT);
  1149.     }
  1150.     if (temp_num_items == 0)
  1151.     {
  1152.         mmi_frm_hide_menu_item(MENU_ID_JMMS_WRITE_MMS_DELETE);
  1153.     }
  1154.     else
  1155.     {
  1156.         mmi_frm_unhide_menu_item(MENU_ID_JMMS_WRITE_MMS_DELETE);
  1157.     }
  1158.     if (temp_num_items <= 1)
  1159.     {
  1160.         mmi_frm_hide_menu_item(MENU_ID_JMMS_WRITE_MMS_DELETE_ALL);
  1161.     }
  1162.     else
  1163.     {
  1164.         mmi_frm_unhide_menu_item(MENU_ID_JMMS_WRITE_MMS_DELETE_ALL);
  1165.     }
  1166.     nNumofItem = GetNumOfChild_Ext(MENU_ID_JMMS_WRITE_MMS_ADDRESSES_OPTIONS);
  1167.     GetSequenceStringIds_Ext(MENU_ID_JMMS_WRITE_MMS_ADDRESSES_OPTIONS, nStrItemList);
  1168.     ShowCategory52Screen(
  1169.         titleid,
  1170.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  1171.         STR_GLOBAL_OK,
  1172.         IMG_GLOBAL_OK,
  1173.         STR_GLOBAL_BACK,
  1174.         IMG_GLOBAL_BACK,
  1175.         nNumofItem,
  1176.         nStrItemList,
  1177.         (U16*) gIndexIconsImageList,
  1178.         NULL,
  1179.         0,
  1180.         0,
  1181.         guiBuffer);
  1182.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1183.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1184. //    SetKeyHandler(mmi_jmms_free_addresses_list_on_end, KEY_END, KEY_EVENT_DOWN);
  1185. }
  1186. /*****************************************************************************
  1187.  * FUNCTION
  1188.  *  mmi_jmms_highlight_write_mms_add_number
  1189.  * DESCRIPTION
  1190.  *  highligh handler of Add Number menu item
  1191.  * PARAMETERS
  1192.  *  void
  1193.  * RETURNS
  1194.  *  void
  1195.  *****************************************************************************/
  1196. void mmi_jmms_highlight_write_mms_add_number(void)
  1197. {
  1198.     /*----------------------------------------------------------------*/
  1199.     /* Local Variables                                                */
  1200.     /*----------------------------------------------------------------*/
  1201.     /*----------------------------------------------------------------*/
  1202.     /* Code Body                                                      */
  1203.     /*----------------------------------------------------------------*/
  1204.     g_address_option_index = E_ADD_NUMBER;
  1205.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  1206.     SetLeftSoftkeyFunction(mmi_jmms_entry_write_message_add_number, KEY_EVENT_UP);
  1207.     SetKeyHandler(mmi_jmms_entry_write_message_add_number, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1208.     SetKeyHandler(mmi_jmms_entry_write_message_add_number, KEY_WAP, KEY_EVENT_DOWN);
  1209. }
  1210. /*****************************************************************************
  1211.  * FUNCTION
  1212.  *  mmi_jmms_entry_write_message_add_number
  1213.  * DESCRIPTION
  1214.  *  Pre Entry fn for add number option
  1215.  * PARAMETERS
  1216.  *  void
  1217.  * RETURNS
  1218.  *  void
  1219.  *****************************************************************************/
  1220. void mmi_jmms_entry_write_message_add_number(void)
  1221. {
  1222.     /*----------------------------------------------------------------*/
  1223.     /* Local Variables                                                */
  1224.     /*----------------------------------------------------------------*/
  1225.     /*----------------------------------------------------------------*/
  1226.     /* Code Body                                                      */
  1227.     /*----------------------------------------------------------------*/
  1228.     if (g_jmms_context->num_total_addresses >= 20)
  1229.     {
  1230.         DisplayPopup((U8*) GetString(STR_ID_MAX_ADDRESS_LIMIT), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
  1231.     }
  1232.     else
  1233.     {
  1234.         memset(g_jmms_context->g_jmms_add_number_buffer, 0x00, (MAX_POSSIBLE_NUMBER_LENGHT_SENT + 1) * ENCODING_LENGTH);
  1235.         mmi_jmms_entry_write_message_add_number_screen();
  1236.     }
  1237. }
  1238. /*****************************************************************************
  1239.  * FUNCTION
  1240.  *  mmi_jmms_entry_write_message_add_number_screen
  1241.  * DESCRIPTION
  1242.  *  Entry fn for add number editor screeen
  1243.  * PARAMETERS
  1244.  *  void
  1245.  * RETURNS
  1246.  *  void
  1247.  *****************************************************************************/
  1248. void mmi_jmms_entry_write_message_add_number_screen(void)
  1249. {
  1250.     /*----------------------------------------------------------------*/
  1251.     /* Local Variables                                                */
  1252.     /*----------------------------------------------------------------*/
  1253.     U8 *guiBuffer;
  1254.     U16 left_softkey;
  1255.     /*----------------------------------------------------------------*/
  1256.     /* Code Body                                                      */
  1257.     /*----------------------------------------------------------------*/    
  1258.     EntryNewScreen(SCR_ID_JMMS_WRITE_MMS_ADD_NUMBER_EDITOR, NULL, mmi_jmms_entry_write_message_add_number_screen, NULL);
  1259.     SetParentHandler(MENU_ID_JMMS_WRITE_MMS_ADD_NUMBER);
  1260.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1261.     guiBuffer = GetCurrGuiBuffer(SCR_ID_JMMS_WRITE_MMS_ADD_NUMBER_EDITOR);
  1262.     if (pfnUnicodeStrncmp
  1263.         ((S8*) (g_jmms_context->g_jmms_add_number_buffer), "",
  1264.          MAX_POSSIBLE_NUMBER_LENGHT_SENT * ENCODING_LENGTH) == 0)
  1265.     {
  1266.         left_softkey = STR_ID_JMMS_SEARCH;
  1267.     }
  1268.     else
  1269.     {
  1270.         left_softkey = STR_GLOBAL_OK;
  1271.     }
  1272.     ShowCategory5Screen(
  1273.         STR_ID_WRITE_MMS_ADD_NUMBER,
  1274.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  1275.         left_softkey,
  1276.         0,
  1277.         STR_GLOBAL_BACK,
  1278.         0,
  1279.         INPUT_TYPE_PHONE_NUMBER,
  1280.         (U8*) (g_jmms_context->g_jmms_add_number_buffer),
  1281.         MAX_POSSIBLE_NUMBER_LENGHT_SENT + 1,
  1282.         guiBuffer);
  1283.     RegisterInputBoxEmptyFunction(mmi_jmms_address_fullscreen_editor_on_empty);
  1284.     RegisterInputBoxNotEmptyFunction(mmi_jmms_address_fullscreen_editor_on_not_empty);
  1285.     SetKeyHandler(mmi_jmms_address_search_phonebook_or_ok, KEY_WAP, KEY_EVENT_DOWN);
  1286.     SetLeftSoftkeyFunction(mmi_jmms_address_search_phonebook_or_ok, KEY_EVENT_UP);
  1287.     SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1288.     SetKeyHandler((FuncPtr) mmi_jmms_address_editor_insert_character_plus, KEY_STAR, KEY_EVENT_DOWN);
  1289.  //   SetKeyHandler(mmi_jmms_free_addresses_list_on_end, KEY_END, KEY_EVENT_DOWN);
  1290. }
  1291. /*****************************************************************************
  1292.  * FUNCTION
  1293.  *  mmi_jmms_address_fullscreen_editor_on_empty
  1294.  * DESCRIPTION
  1295.  *  Fn called when editor screen is empty
  1296.  * PARAMETERS
  1297.  *  void
  1298.  * RETURNS
  1299.  *  void
  1300.  *****************************************************************************/
  1301. void mmi_jmms_address_fullscreen_editor_on_empty(void)
  1302. {
  1303.     /*----------------------------------------------------------------*/
  1304.     /* Local Variables                                                */
  1305.     /*----------------------------------------------------------------*/
  1306.     U16 currScrenID = 0;
  1307.     /*----------------------------------------------------------------*/
  1308.     /* Code Body                                                      */
  1309.     /*----------------------------------------------------------------*/
  1310.     currScrenID = GetActiveScreenId();
  1311.     if (currScrenID == SCR_ID_JMMS_WRITE_MMS_ADD_NUMBER_EDITOR)
  1312.     {
  1313.         ChangeLeftSoftkey(STR_ID_JMMS_SEARCH, 0);
  1314.     }
  1315.     else if(currScrenID == SCR_ID_JMMS_WRITE_MMS_ADD_EMAIL_EDITOR)
  1316.     {
  1317.         ChangeLeftSoftkey(STR_ID_JMMS_SEARCH, 0);
  1318.     }
  1319.     else
  1320.     {
  1321.         ChangeLeftSoftkey(NULL, 0);
  1322.     }
  1323. }
  1324. /*****************************************************************************
  1325.  * FUNCTION
  1326.  *  mmi_jmms_address_fullscreen_editor_on_not_empty
  1327.  * DESCRIPTION
  1328.  *  This Fn called when editor screen is not empty
  1329.  * PARAMETERS
  1330.  *  void
  1331.  * RETURNS
  1332.  *  void
  1333.  *****************************************************************************/
  1334. void mmi_jmms_address_fullscreen_editor_on_not_empty(void)
  1335. {
  1336.     /*----------------------------------------------------------------*/
  1337.     /* Local Variables                                                */
  1338.     /*----------------------------------------------------------------*/
  1339.     U16 currScrenID = 0;
  1340.     /*----------------------------------------------------------------*/
  1341.     /* Code Body                                                      */
  1342.     /*----------------------------------------------------------------*/
  1343.     currScrenID = GetActiveScreenId();
  1344.     ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
  1345.     if (currScrenID == SCR_ID_JMMS_WRITE_MMS_ADD_EMAIL_EDITOR)  /* /lefyt soft key set to NULL also so left key handler get cleared */
  1346.     {
  1347.         SetLeftSoftkeyFunction(mmi_jmms_address_search_phonebook_or_ok, KEY_EVENT_UP);
  1348.     }
  1349. }
  1350. /* PMT VUIKAS START 20060325 */
  1351. /*****************************************************************************
  1352.  * FUNCTION
  1353.  *  update_mms_number_from_phonebook
  1354.  * DESCRIPTION
  1355.  *  This fn copy the number selected from phonebook to adderess editor(number) screen
  1356.  * PARAMETERS
  1357.  *  number      [?]     [?]
  1358.  * RETURNS
  1359.  *  void
  1360.  *****************************************************************************/
  1361. void update_mms_number_from_phonebook(S8 *number)
  1362. {
  1363.     /*----------------------------------------------------------------*/
  1364.     /* Local Variables                                                */
  1365.     /*----------------------------------------------------------------*/
  1366.     
  1367.     MMI_BOOL number_allow = MMI_TRUE;
  1368. // U8 *temp_str;
  1369.     /*----------------------------------------------------------------*/
  1370.     /* Code Body                                                      */
  1371.     /*----------------------------------------------------------------*/
  1372.    // (U8*) temp_str = (U8*) number;
  1373.     number_allow = mmi_jmms_check_number_input_format((U8*)number);
  1374.     if(number_allow == MMI_FALSE)
  1375.     {
  1376.         DisplayPopup(
  1377.                 (U8*) GetString(STR_ID_JMMS_INPUT_FORMAT_ERROR),
  1378.                 IMG_GLOBAL_ERROR,
  1379.                 1,
  1380.                 JMMS_POPUP_TIME,
  1381.                 ERROR_TONE);
  1382.         if (IsScreenPresent(SCR_PBOOK_LIST))
  1383.         {
  1384.             DeleteUptoScrID(SCR_PBOOK_LIST);
  1385.         }
  1386.             memset(g_jmms_context->g_jmms_add_number_buffer, 0x00, (MAX_POSSIBLE_NUMBER_LENGHT_SENT + 1) * ENCODING_LENGTH);
  1387.             return;
  1388.     }
  1389.         
  1390.     if (number)
  1391.     {
  1392.         memset(g_jmms_context->g_jmms_add_number_buffer, 0x00, (MAX_POSSIBLE_NUMBER_LENGHT_SENT + 1) * ENCODING_LENGTH);
  1393.         pfnUnicodeStrcpy((S8*) (g_jmms_context->g_jmms_add_number_buffer), (PS8) number);
  1394.     }
  1395.     /*Dilip Start 14th Sept to display out of limit number from phonebook*/
  1396.     if(g_jmms_context->g_jmms_add_number_buffer[MAX_POSSIBLE_NUMBER_LENGHT_SENT*ENCODING_LENGTH] != '')
  1397.         {
  1398.             DisplayPopup(
  1399.                 (U8*) GetString(STR_ID_JMMS_PHB_LIMIT_EXCEEDED),
  1400.                 IMG_GLOBAL_ERROR,
  1401.                 1,
  1402.                 JMMS_POPUP_TIME,
  1403.                 ERROR_TONE);
  1404.             if (IsScreenPresent(SCR_PBOOK_LIST))
  1405.                 {
  1406.                     DeleteUptoScrID(SCR_PBOOK_LIST);
  1407.                 }
  1408.             memset(g_jmms_context->g_jmms_add_number_buffer, 0x00, (MAX_POSSIBLE_NUMBER_LENGHT_SENT + 1) * ENCODING_LENGTH);
  1409.             
  1410.         }
  1411.         /*Dilip END 14th Sept to display out of limit number from phonebook*/
  1412.     else
  1413.     {
  1414.     HistoryReplace(
  1415.         SCR_ID_JMMS_WRITE_MMS_ADD_NUMBER_EDITOR,
  1416.         SCR_ID_JMMS_WRITE_MMS_ADD_NUMBER_EDITOR,
  1417.         mmi_jmms_entry_write_message_add_number_screen);
  1418.     GoBackToHistory(SCR_ID_JMMS_WRITE_MMS_ADD_NUMBER_EDITOR);
  1419.     }
  1420. }
  1421. /*****************************************************************************
  1422.  * FUNCTION
  1423.  *  update_mms_email_from_phonebook
  1424.  * DESCRIPTION
  1425.  *  This fn copy the email selected from phonebook to adderess editor(email) screen
  1426.  * PARAMETERS
  1427.  *  email       [?]     [?]
  1428.  * RETURNS
  1429.  *  void
  1430.  *****************************************************************************/
  1431. void update_mms_email_from_phonebook(S8 *email)
  1432. {
  1433.     /*----------------------------------------------------------------*/
  1434.     /* Local Variables                                                */
  1435.     /*----------------------------------------------------------------*/
  1436.     /*----------------------------------------------------------------*/
  1437.     /* Code Body                                                      */
  1438.     /*----------------------------------------------------------------*/
  1439.     if (email)
  1440.     {
  1441.         pfnUnicodeStrcpy((S8*) (g_jmms_context->g_jmms_add_email_buffer), (PS8) email);
  1442.     }
  1443.     HistoryReplace(
  1444.         SCR_ID_JMMS_WRITE_MMS_ADD_EMAIL_EDITOR,
  1445.         SCR_ID_JMMS_WRITE_MMS_ADD_EMAIL_EDITOR,
  1446.         mmi_jmms_entry_write_message_add_email_screen);
  1447.     GoBackToHistory(SCR_ID_JMMS_WRITE_MMS_ADD_EMAIL_EDITOR);
  1448. }
  1449. /* PMT VUIKAS END 20060325 */
  1450. /*****************************************************************************
  1451.  * FUNCTION
  1452.  *  mmi_jmms_address_search_phonebook_or_ok
  1453.  * DESCRIPTION
  1454.  *  This fn henadled the LSK press in adderess editor(number or email) screen
  1455.  * PARAMETERS
  1456.  *  void
  1457.  * RETURNS
  1458.  *  void
  1459.  *****************************************************************************/
  1460. void mmi_jmms_address_search_phonebook_or_ok(void)
  1461. {
  1462.     /*----------------------------------------------------------------*/
  1463.     /* Local Variables                                                */
  1464.     /*----------------------------------------------------------------*/
  1465.     MMI_BOOL found = MMI_FALSE;
  1466.     U8 *temp_str;
  1467.     U8 length;
  1468.     MMI_BOOL format_allow = MMI_TRUE;
  1469.     U16 currScrenID;
  1470.     U8 num_addresses = 0;
  1471.     U8 ret = 0;
  1472.     MMI_BOOL number_allow_phb = MMI_TRUE;
  1473.     /*----------------------------------------------------------------*/
  1474.     /* Code Body                                                      */
  1475.     /*----------------------------------------------------------------*/
  1476.     currScrenID = GetActiveScreenId();
  1477.     if (currScrenID == SCR_ID_JMMS_WRITE_MMS_ADD_NUMBER_EDITOR)
  1478.     {
  1479.         temp_str = g_jmms_context->g_jmms_add_number_buffer;
  1480.         length = MAX_POSSIBLE_NUMBER_LENGHT_SENT;
  1481.     }
  1482.     else if (currScrenID == SCR_ID_JMMS_WRITE_MMS_ADD_EMAIL_EDITOR)
  1483.     {
  1484.         temp_str = g_jmms_context->g_jmms_add_email_buffer;
  1485.         length = MAX_POSSIBLE_EMAIL_LENGHT_SENT;
  1486.     }
  1487.     else
  1488.     {
  1489.         return;
  1490.     }
  1491.     if (pfnUnicodeStrncmp((S8*) temp_str, "", length * ENCODING_LENGTH) == 0)
  1492.     {
  1493.         /* PMT VIKAS START 20060325 */
  1494.         if (currScrenID == SCR_ID_JMMS_WRITE_MMS_ADD_NUMBER_EDITOR)
  1495.         {
  1496.             EntryPhbFromMMSNumber();
  1497.             temp_str = g_jmms_context->g_jmms_add_number_buffer;
  1498.         }
  1499.         else if (currScrenID == SCR_ID_JMMS_WRITE_MMS_ADD_EMAIL_EDITOR)
  1500.         {
  1501.             EntryPhbFromMMSEmail();
  1502.             temp_str = g_jmms_context->g_jmms_add_email_buffer;
  1503.         }
  1504.         /* PMT VIKAS END 20060325 */
  1505.     }
  1506.     else
  1507.     {
  1508.         if (currScrenID == SCR_ID_JMMS_WRITE_MMS_ADD_NUMBER_EDITOR)
  1509.         {
  1510.             number_allow_phb = mmi_jmms_check_number_input_format(temp_str);
  1511.             if(number_allow_phb == MMI_FALSE)
  1512.             {
  1513.             DisplayPopup(
  1514.                 (U8*) GetString(STR_ID_JMMS_INPUT_FORMAT_ERROR),
  1515.                 IMG_GLOBAL_ERROR,
  1516.                 1,
  1517.                 JMMS_POPUP_TIME,
  1518.                 ERROR_TONE);
  1519.                 return;
  1520.             }
  1521.         }
  1522.         if (currScrenID == SCR_ID_JMMS_WRITE_MMS_ADD_EMAIL_EDITOR)
  1523.         {
  1524.             format_allow = mmi_jmms_check_address_input_format(temp_str);
  1525.         }
  1526.         if (format_allow == MMI_FALSE)
  1527.         {
  1528.             DisplayPopup(
  1529.                 (U8*) GetString(STR_ID_JMMS_INPUT_FORMAT_ERROR),
  1530.                 IMG_GLOBAL_ERROR,
  1531.                 1,
  1532.                 JMMS_POPUP_TIME,
  1533.                 ERROR_TONE);
  1534.             return;
  1535.         }
  1536.         /*Dilip 1st Sept 06 */
  1537.         if (g_address_option_index == E_EDIT_ADDRESS)
  1538.         {
  1539.             U8 temp = 0;
  1540.             jmms_address_list *address_node = NULL;
  1541.             if (g_jmms_context->address_list_flag == E_TO_ADDRESSES)
  1542.             {
  1543.                 address_node = g_jmms_context->to_address_p;;
  1544.             }
  1545.             else if (g_jmms_context->address_list_flag == E_CC_ADDRESSES)
  1546.             {
  1547.                 address_node = g_jmms_context->cc_address_p;
  1548.             }
  1549.             else if (g_jmms_context->address_list_flag == E_BCC_ADDRESSES)
  1550.             {
  1551.                 address_node = g_jmms_context->bcc_address_p;
  1552.             }
  1553.             if(address_node != NULL)
  1554.             {
  1555.                 temp = g_hilite_address_item;
  1556.                 while(temp)
  1557.                 {
  1558.                     address_node = address_node->next;
  1559.                     temp--;
  1560.                 }
  1561.             }
  1562.             if(address_node != NULL)
  1563.             {
  1564.                 if (mmi_jmms_compair_string((S8*) temp_str,(S8*)address_node->address) != 0)
  1565.                 {
  1566.                     found = mmi_jmms_check_duplicate_address(temp_str, g_jmms_context->address_list_flag, g_hilite_address_item);
  1567.                 }
  1568.             }
  1569.                        
  1570.         }
  1571.         else
  1572.         {
  1573.             found = mmi_jmms_check_duplicate_address(temp_str, E_NONE_ADDRESSES, -1);   // COMPILER WARNING REMOVAL
  1574.         }
  1575.        /*Dilip 1st Sept 06 */
  1576.         if (found != MMI_TRUE)
  1577.         {
  1578.             if (g_address_option_index == E_EDIT_ADDRESS)
  1579.             {
  1580.                 ret = mmi_jmms_replace_address_in_addresse_list((S8*) temp_str);
  1581.                 if (ret != 0)
  1582.                 {
  1583.                     DisplayPopup(
  1584.                         (U8*) GetString(STR_ID_JMMS_MEMORY_FULL),
  1585.                         IMG_GLOBAL_ERROR,
  1586.                         1,
  1587.                         JMMS_POPUP_TIME,
  1588.                         (U8) ERROR_TONE);
  1589.                     return;
  1590.                 }
  1591.                 g_address_list_right_soft_key = STR_GLOBAL_DONE;
  1592.                 g_jmms_context->g_write_mms_right_soft_key = STR_GLOBAL_DONE;
  1593.                 GoBackToHistory(SCR_ID_JMMS_ADDRESS_LIST);
  1594.             }
  1595.             else    /* add number or email */
  1596.             {
  1597.                 ret = mmi_jmms_add_address_in_addresse_list((S8*) temp_str);
  1598.                 if (ret != 0)
  1599.                 {
  1600.                     DisplayPopup(
  1601.                         (U8*) GetString(STR_ID_JMMS_MEMORY_FULL),
  1602.                         IMG_GLOBAL_ERROR,
  1603.                         1,
  1604.                         JMMS_POPUP_TIME,
  1605.                         (U8) ERROR_TONE);
  1606.                     return;
  1607.                 }
  1608.                 /* /back to address list scren with newly added adress highlighted and rsk as DONE */
  1609.                 g_address_list_right_soft_key = STR_GLOBAL_DONE;
  1610.                 g_jmms_context->g_write_mms_right_soft_key = STR_GLOBAL_DONE;
  1611.                 if (g_jmms_context->address_list_flag == E_TO_ADDRESSES)
  1612.                 {
  1613.                     num_addresses = g_jmms_context->num_to_addresses;
  1614.                 }
  1615.                 else if (g_jmms_context->address_list_flag == E_CC_ADDRESSES)
  1616.                 {
  1617.                     num_addresses = g_jmms_context->num_cc_addresses;
  1618.                 }
  1619.                 else if (g_jmms_context->address_list_flag == E_BCC_ADDRESSES)
  1620.                 {
  1621.                     num_addresses = g_jmms_context->num_bcc_addresses;
  1622.                 }
  1623.                 g_hilite_address_item = num_addresses;
  1624.                 if (num_addresses <= 1)
  1625.                 {
  1626.                     /* We don't need to add the SCR_ID_JMMS_WRITE_MMS_ADD_NUMBER_EDITOR screen to history 
  1627.                        again. So, we have to use HistoryReplace() insteasd of invoking the entry function 
  1628.                        mmi_jmms_entry_addresses_list_screen()  */
  1629.                     HistoryReplace(SCR_ID_WRITE_MMS_ADDRESSES_OPTION, SCR_ID_JMMS_ADDRESS_LIST, mmi_jmms_entry_addresses_list_screen);
  1630.                     //mmi_jmms_entry_addresses_list_screen(); /* /new entry to address list screen */
  1631.                     GoBackHistory();
  1632.                 }
  1633.                 else
  1634.                 {
  1635.                     ///it means address list screen already exist
  1636.                     ///just go back to that screen
  1637.                     GoBackToHistory(SCR_ID_JMMS_ADDRESS_LIST);
  1638.                 }
  1639.             }
  1640.         }
  1641.         else
  1642.         {
  1643.              /* changes for adding different message for Email address and phone Number*/ 
  1644.             /*Dilip Start 21 Aug 2006*/
  1645.             if (currScrenID == SCR_ID_JMMS_WRITE_MMS_ADD_NUMBER_EDITOR)
  1646.             {
  1647.                 DisplayPopup(
  1648.                 (U8*) GetString(STR_ID_JMMS_ADDRESS_ALREADY_EXIST),
  1649.                 IMG_GLOBAL_ERROR,
  1650.                 1,
  1651.                 JMMS_POPUP_TIME,
  1652.                 ERROR_TONE);
  1653.             }
  1654.             else
  1655.             {
  1656.                 DisplayPopup(
  1657.                 (U8*) GetString(STR_ID_JMMS_EMAIL_ADDRESS_ALREADY_EXIST),
  1658.                 IMG_GLOBAL_ERROR,
  1659.                 1,
  1660.                 JMMS_POPUP_TIME,
  1661.                 ERROR_TONE);
  1662.             }
  1663.             /*Dilip End 21 Aug 2006*/
  1664.         }
  1665.     }
  1666. }
  1667. /*****************************************************************************
  1668.  * FUNCTION
  1669.  *  mmi_jmms_add_address_in_addresse_list
  1670.  * DESCRIPTION
  1671.  *  Add the input address in address list
  1672.  * PARAMETERS
  1673.  *  address     [?]     [?]
  1674.  * RETURNS
  1675.  *  void
  1676.  *****************************************************************************/
  1677. U8 mmi_jmms_add_address_in_addresse_list(S8 *address)
  1678. {
  1679.     /*----------------------------------------------------------------*/
  1680.     /* Local Variables                                                */
  1681.     /*----------------------------------------------------------------*/
  1682.     jmms_address_list *address_temp_p, *address_node;
  1683.     /*----------------------------------------------------------------*/
  1684.     /* Code Body                                                      */
  1685.     /*----------------------------------------------------------------*/
  1686.     address_node = (jmms_address_list*) jdd_MemAlloc(sizeof(jmms_address_list), 1);
  1687.     if (address_node == NULL)
  1688.     {
  1689.         return 1;
  1690.     }
  1691.     address_node->address = (S8*) jdd_MemAlloc((pfnUnicodeStrlen(address) + 1) * ENCODING_LENGTH, sizeof(S8));
  1692.     if (address_node->address == NULL)
  1693.     {
  1694.         return 1;
  1695.     }
  1696.     pfnUnicodeStrcpy(address_node->address, address);
  1697.     address_node->next = NULL;
  1698.     if (g_jmms_context->address_list_flag == E_TO_ADDRESSES)
  1699.     {
  1700.         if (g_jmms_context->num_to_addresses == 0)
  1701.         {
  1702.             g_jmms_context->to_address_p = address_node;
  1703.         }
  1704.         else
  1705.         {
  1706.             address_temp_p = g_jmms_context->to_address_p;
  1707.             while (address_temp_p->next != NULL)
  1708.             {
  1709.                 address_temp_p = address_temp_p->next;
  1710.             }
  1711.             address_temp_p->next = address_node;
  1712.         }
  1713.         g_jmms_context->num_to_addresses++;
  1714.     }
  1715.     else if (g_jmms_context->address_list_flag == E_CC_ADDRESSES)
  1716.     {
  1717.         if (g_jmms_context->num_cc_addresses == 0)
  1718.         {
  1719.             g_jmms_context->cc_address_p = address_node;
  1720.         }
  1721.         else
  1722.         {
  1723.             address_temp_p = g_jmms_context->cc_address_p;
  1724.             while (address_temp_p->next != NULL)
  1725.             {
  1726.                 address_temp_p = address_temp_p->next;
  1727.             }
  1728.             address_temp_p->next = address_node;
  1729.         }
  1730.         g_jmms_context->num_cc_addresses++;
  1731.     }
  1732.     else if (g_jmms_context->address_list_flag == E_BCC_ADDRESSES)
  1733.     {
  1734.         if (g_jmms_context->num_bcc_addresses == 0)
  1735.         {
  1736.             g_jmms_context->bcc_address_p = address_node;
  1737.         }
  1738.         else
  1739.         {
  1740.             address_temp_p = g_jmms_context->bcc_address_p;
  1741.             while (address_temp_p->next != NULL)
  1742.             {
  1743.                 address_temp_p = address_temp_p->next;
  1744.             }
  1745.             address_temp_p->next = address_node;
  1746.         }
  1747.         g_jmms_context->num_bcc_addresses++;
  1748.     }
  1749.     g_jmms_context->num_total_addresses++;
  1750.     return 0;
  1751. }
  1752. /*****************************************************************************
  1753.  * FUNCTION
  1754.  *  mmi_jmms_address_editor_insert_character_plus
  1755.  * DESCRIPTION
  1756.  *  Handler of plus Key in address editor screen
  1757.  * PARAMETERS
  1758.  *  void
  1759.  * RETURNS
  1760.  *  void
  1761.  *****************************************************************************/
  1762. void mmi_jmms_address_editor_insert_character_plus(void)
  1763. {
  1764.     /*----------------------------------------------------------------*/
  1765.     /* Local Variables                                                */
  1766.     /*----------------------------------------------------------------*/
  1767.     /*----------------------------------------------------------------*/
  1768.     /* Code Body                                                      */
  1769.     /*----------------------------------------------------------------*/    
  1770.   
  1771.         multiline_inputbox_direct_input((UI_character_type) '+');
  1772. }
  1773. /*****************************************************************************
  1774.  * FUNCTION
  1775.  *  mmi_jmms_highlight_write_mms_add_email
  1776.  * DESCRIPTION
  1777.  *  highlight hdlr of Add email option
  1778.  * PARAMETERS
  1779.  *  void
  1780.  * RETURNS
  1781.  *  void
  1782.  *****************************************************************************/
  1783. void mmi_jmms_highlight_write_mms_add_email(void)
  1784. {
  1785.     /*----------------------------------------------------------------*/
  1786.     /* Local Variables                                                */
  1787.     /*----------------------------------------------------------------*/
  1788.     /*----------------------------------------------------------------*/
  1789.     /* Code Body                                                      */
  1790.     /*----------------------------------------------------------------*/
  1791.     g_address_option_index = E_ADD_EMAIL;
  1792.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  1793.     SetLeftSoftkeyFunction(mmi_jmms_entry_write_message_add_email, KEY_EVENT_UP);
  1794.     SetKeyHandler(mmi_jmms_entry_write_message_add_email, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1795.     SetKeyHandler(mmi_jmms_entry_write_message_add_email, KEY_WAP, KEY_EVENT_DOWN);
  1796. }
  1797. /*****************************************************************************
  1798.  * FUNCTION
  1799.  *  mmi_jmms_entry_write_message_add_email
  1800.  * DESCRIPTION
  1801.  *  pre entry fn of add email option
  1802.  * PARAMETERS
  1803.  *  void
  1804.  * RETURNS
  1805.  *  void
  1806.  *****************************************************************************/
  1807. void mmi_jmms_entry_write_message_add_email(void)
  1808. {
  1809.     /*----------------------------------------------------------------*/
  1810.     /* Local Variables                                                */
  1811.     /*----------------------------------------------------------------*/
  1812.     /*----------------------------------------------------------------*/
  1813.     /* Code Body                                                      */
  1814.     /*----------------------------------------------------------------*/
  1815.     if (g_jmms_context->num_total_addresses >= 20)
  1816.     {
  1817.         DisplayPopup((U8*) GetString(STR_ID_MAX_ADDRESS_LIMIT), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
  1818.     }
  1819.     else
  1820.     {
  1821.         memset(g_jmms_context->g_jmms_add_email_buffer, 0x00, (MAX_POSSIBLE_EMAIL_LENGHT_SENT + 1) * ENCODING_LENGTH);
  1822.         mmi_jmms_entry_write_message_add_email_screen();
  1823.     }
  1824. }
  1825. /*****************************************************************************
  1826.  * FUNCTION
  1827.  *  mmi_jmms_entry_write_message_add_email_screen
  1828.  * DESCRIPTION
  1829.  *  entry fn of add email editor screen
  1830.  * PARAMETERS
  1831.  *  void
  1832.  * RETURNS
  1833.  *  void
  1834.  *****************************************************************************/
  1835. void mmi_jmms_entry_write_message_add_email_screen(void)
  1836. {
  1837.     /*----------------------------------------------------------------*/
  1838.     /* Local Variables                                                */
  1839.     /*----------------------------------------------------------------*/
  1840.     U8 *guiBuffer;
  1841.     U16 left_softkey;
  1842.     /*----------------------------------------------------------------*/
  1843.     /* Code Body                                                      */
  1844.     /*----------------------------------------------------------------*/    
  1845.     EntryNewScreen(SCR_ID_JMMS_WRITE_MMS_ADD_EMAIL_EDITOR, NULL, mmi_jmms_entry_write_message_add_email_screen, NULL);
  1846.     SetParentHandler(MENU_ID_JMMS_WRITE_MMS_ADD_EMAIL);
  1847.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1848.     guiBuffer = GetCurrGuiBuffer(SCR_ID_JMMS_WRITE_MMS_ADD_EMAIL_EDITOR);
  1849.     if (pfnUnicodeStrncmp
  1850.         ((S8*) (g_jmms_context->g_jmms_add_email_buffer), "", MAX_POSSIBLE_EMAIL_LENGHT_SENT * ENCODING_LENGTH) == 0)
  1851.         /* PMT VIKAS START 20060325 */
  1852.     {
  1853.         left_softkey = STR_ID_JMMS_SEARCH;
  1854.     }
  1855.     /* PMT VIKAS END 20060325 */
  1856.     else
  1857.     {
  1858.         left_softkey = STR_GLOBAL_OK;
  1859.     }
  1860.     /* PMT VIKAS START 20060325 */
  1861.     ShowCategory5Screen(
  1862.         STR_ID_WRITE_MMS_ADD_EMAIL,
  1863.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  1864.         left_softkey,
  1865.         0,
  1866.         STR_GLOBAL_BACK,
  1867.         0,
  1868.         INPUT_TYPE_USE_ONLY_ENGLISH_MODES | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE,
  1869.         (U8*) (g_jmms_context->g_jmms_add_email_buffer),
  1870.         MAX_POSSIBLE_EMAIL_LENGHT_SENT + 1,
  1871.         guiBuffer);
  1872.     /* PMT VIKAS END 20060325 */
  1873.     RegisterInputBoxEmptyFunction(mmi_jmms_address_fullscreen_editor_on_empty);
  1874.     RegisterInputBoxNotEmptyFunction(mmi_jmms_address_fullscreen_editor_on_not_empty);
  1875.     SetLeftSoftkeyFunction(mmi_jmms_address_search_phonebook_or_ok, KEY_EVENT_UP);
  1876.     SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1877. //    SetKeyHandler(mmi_jmms_free_addresses_list_on_end, KEY_END, KEY_EVENT_DOWN);
  1878. }
  1879. /*****************************************************************************
  1880.  * FUNCTION
  1881.  *  mmi_jmms_highlight_write_mms_delete
  1882.  * DESCRIPTION
  1883.  *  highlight hdlr of delete option
  1884.  * PARAMETERS
  1885.  *  void
  1886.  * RETURNS
  1887.  *  void
  1888.  *****************************************************************************/
  1889. void mmi_jmms_highlight_write_mms_delete(void)
  1890. {
  1891.     /*----------------------------------------------------------------*/
  1892.     /* Local Variables                                                */
  1893.     /*----------------------------------------------------------------*/
  1894.     /*----------------------------------------------------------------*/
  1895.     /* Code Body                                                      */
  1896.     /*----------------------------------------------------------------*/
  1897.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  1898.     SetLeftSoftkeyFunction(mmi_jmms_entry_write_message_delete, KEY_EVENT_UP);
  1899.     SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1900.     SetKeyHandler(mmi_jmms_entry_write_message_delete, KEY_WAP, KEY_EVENT_DOWN);
  1901. }
  1902. /*****************************************************************************
  1903.  * FUNCTION
  1904.  *  mmi_jmms_highlight_write_mms_delete_all
  1905.  * DESCRIPTION
  1906.  *  highlight hdlr of delete all option
  1907.  * PARAMETERS
  1908.  *  void
  1909.  * RETURNS
  1910.  *  void
  1911.  *****************************************************************************/
  1912. void mmi_jmms_highlight_write_mms_delete_all(void)
  1913. {
  1914.     /*----------------------------------------------------------------*/
  1915.     /* Local Variables                                                */
  1916.     /*----------------------------------------------------------------*/
  1917.     /*----------------------------------------------------------------*/
  1918.     /* Code Body                                                      */
  1919.     /*----------------------------------------------------------------*/
  1920.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  1921.     SetLeftSoftkeyFunction(mmi_jmms_entry_write_message_delete_all, KEY_EVENT_UP);
  1922.     SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1923.     SetKeyHandler(mmi_jmms_entry_write_message_delete_all, KEY_WAP, KEY_EVENT_DOWN);
  1924. }
  1925. /*****************************************************************************
  1926.  * FUNCTION
  1927.  *  mmi_jmms_check_duplicate_address
  1928.  * DESCRIPTION
  1929.  *  chekcs the duplicate address input
  1930.  * PARAMETERS
  1931.  *  address     [?]     [?]
  1932.  * RETURNS
  1933.  *  MMI_BOOL
  1934.  *****************************************************************************/
  1935. /* check duplicacy of input address */
  1936. MMI_BOOL mmi_jmms_check_duplicate_address(U8 *address, jmms_write_mms_addresses_options ignore_address_field, S32 ignore_address_id)
  1937. {
  1938.     /*----------------------------------------------------------------*/
  1939.     /* Local Variables                                                */
  1940.     /*----------------------------------------------------------------*/
  1941.     U16 i;
  1942.     U16 len_diff = 0, add_len_diff = 0;
  1943.     jmms_address_list *temp_p; 
  1944.     MMI_BOOL found = MMI_FALSE;
  1945.     S8 tmp_str[4],tmp_str1[4]={'0',0,0,0}; 
  1946.     /*----------------------------------------------------------------*/
  1947.     /* Code Body                                                      */
  1948.     /*----------------------------------------------------------------*/
  1949.     AnsiiToUnicodeString((S8*) tmp_str, (S8*) "+");
  1950.     temp_p = g_jmms_context->to_address_p;
  1951.     if(temp_p != NULL)
  1952.     {
  1953.         for (i = 0; i < g_jmms_context->num_to_addresses; i++)
  1954.         {
  1955.            if(ignore_address_field==E_TO_ADDRESSES)
  1956.                if(i==ignore_address_id)  /* Amit */
  1957.        {  /* Increase temp_p to point to next address feild */
  1958. temp_p = temp_p->next;
  1959. len_diff = 0;
  1960. add_len_diff = 0; /* End */
  1961. continue;
  1962.                 }
  1963.            if((jdi_UtilsStrStartsWith((S8*)address, (S8*)tmp_str) == MMI_TRUE) || (jdi_UtilsStrStartsWith((S8*)temp_p->address, (S8*)tmp_str) == MMI_TRUE))
  1964.             {
  1965.                 U16 num_len =  (pfnUnicodeStrlen((S8*) address)) * ENCODING_LENGTH;
  1966.                 U16 tmp_len = (pfnUnicodeStrlen((S8*) temp_p->address)) * ENCODING_LENGTH;
  1967.                 if((tmp_len > num_len) && (num_len >= (ENCODING_LENGTH * 7)))
  1968.                     len_diff = tmp_len - num_len;    
  1969.                 else if((num_len > tmp_len) && (tmp_len >= (ENCODING_LENGTH * 7)))
  1970.                     add_len_diff = num_len - tmp_len;    
  1971. else if((jdi_UtilsStrStartsWith((S8*)address, (S8*)tmp_str1) == MMI_TRUE) || (jdi_UtilsStrStartsWith((S8*)temp_p->address, (S8*)tmp_str1) == MMI_TRUE))
  1972. {
  1973. if((num_len >= (ENCODING_LENGTH * 7))&& (tmp_len >= (ENCODING_LENGTH * 7)))
  1974. {  
  1975.                 add_len_diff = ENCODING_LENGTH;
  1976.                 len_diff = ENCODING_LENGTH;
  1977. }
  1978. }
  1979.             }
  1980.            else if((jdi_UtilsStrStartsWith((S8*)address, (S8*)tmp_str1) == MMI_TRUE) || (jdi_UtilsStrStartsWith((S8*)temp_p->address, (S8*)tmp_str1) == MMI_TRUE))
  1981.             {
  1982.                 U16 num_len =  (pfnUnicodeStrlen((S8*) address)) * ENCODING_LENGTH;
  1983.                 U16 tmp_len = (pfnUnicodeStrlen((S8*) temp_p->address)) * ENCODING_LENGTH;
  1984.                 if((tmp_len > num_len) && (num_len >= (ENCODING_LENGTH * 7)))
  1985.                     len_diff = tmp_len - num_len;    
  1986.                 else if((num_len > tmp_len) && (tmp_len >= (ENCODING_LENGTH * 7)))
  1987.                     add_len_diff = num_len - tmp_len;    
  1988. else if((jdi_UtilsStrStartsWith((S8*)address, (S8*)tmp_str) == MMI_TRUE) || (jdi_UtilsStrStartsWith((S8*)temp_p->address, (S8*)tmp_str) == MMI_TRUE))
  1989. {
  1990. if((num_len >= (ENCODING_LENGTH * 7))&& (tmp_len >= (ENCODING_LENGTH * 7)))
  1991. {  
  1992. add_len_diff = ENCODING_LENGTH;
  1993. len_diff = ENCODING_LENGTH;
  1994. }
  1995. }
  1996.             }
  1997.    
  1998.             if (mmi_jmms_compair_string((S8*) address + add_len_diff, (S8*) temp_p->address + len_diff) == 0)
  1999.             /* if (pfnUnicodeStrcmp((S8*) address, temp_p->address) == 0) */
  2000.             {
  2001.                 found = MMI_TRUE;
  2002.                 break;
  2003.             }
  2004.             else
  2005.             {
  2006.                 temp_p = temp_p->next;
  2007. len_diff = 0;
  2008. add_len_diff = 0;
  2009.             }
  2010.         }
  2011.     }
  2012.     if (found != MMI_TRUE)
  2013.     {
  2014.         temp_p = g_jmms_context->cc_address_p;
  2015.         if(temp_p != NULL)
  2016.         {
  2017.             for (i = 0; i < g_jmms_context->num_cc_addresses; i++)
  2018.             {
  2019.                 if(ignore_address_field==E_CC_ADDRESSES)
  2020.                   if(i==ignore_address_id)  /* Amit */
  2021.   {  /* Increase temp_p to point to next address feild */
  2022. temp_p = temp_p->next;
  2023. len_diff = 0;
  2024. add_len_diff = 0; /* End */
  2025. continue;
  2026.   }
  2027.                 /*if((jdi_UtilsStrStartsWith((S8*)address, (S8*)tmp_str) == MMI_TRUE) || (jdi_UtilsStrStartsWith((S8*)temp_p->address, (S8*)tmp_str) == MMI_TRUE))            
  2028.                 {
  2029.                     U16 num_len =  (pfnUnicodeStrlen((S8*) address)) * ENCODING_LENGTH;
  2030.                     U16 tmp_len = (pfnUnicodeStrlen((S8*) temp_p->address)) * ENCODING_LENGTH;
  2031.                     if((tmp_len > num_len) && (num_len >= (ENCODING_LENGTH * 7)))
  2032.                         len_diff = tmp_len - num_len;    
  2033.                     else if((num_len > tmp_len) && (tmp_len >= (ENCODING_LENGTH * 7)))
  2034.                         add_len_diff = num_len - tmp_len;    
  2035.                 }*/
  2036.                 if((jdi_UtilsStrStartsWith((S8*)address, (S8*)tmp_str) == MMI_TRUE) || (jdi_UtilsStrStartsWith((S8*)temp_p->address, (S8*)tmp_str) == MMI_TRUE))            
  2037.                 {
  2038.                     U16 num_len =  (pfnUnicodeStrlen((S8*) address)) * ENCODING_LENGTH;
  2039.                     U16 tmp_len = (pfnUnicodeStrlen((S8*) temp_p->address)) * ENCODING_LENGTH;
  2040.                     if((tmp_len > num_len) && (num_len >= (ENCODING_LENGTH * 7)))
  2041.                         len_diff = tmp_len - num_len;    
  2042.                     else if((num_len > tmp_len) && (tmp_len >= (ENCODING_LENGTH * 7)))
  2043.                         add_len_diff = num_len - tmp_len;    
  2044.       else if((jdi_UtilsStrStartsWith((S8*)address, (S8*)tmp_str1) == MMI_TRUE) || (jdi_UtilsStrStartsWith((S8*)temp_p->address, (S8*)tmp_str1) == MMI_TRUE))
  2045.       {
  2046. if((num_len >= (ENCODING_LENGTH * 7))&& (tmp_len >= (ENCODING_LENGTH * 7)))
  2047. {  
  2048. add_len_diff = ENCODING_LENGTH;
  2049. len_diff = ENCODING_LENGTH;
  2050. }
  2051.        }
  2052.                  }
  2053. else if((jdi_UtilsStrStartsWith((S8*)address, (S8*)tmp_str1) == MMI_TRUE) || (jdi_UtilsStrStartsWith((S8*)temp_p->address, (S8*)tmp_str1) == MMI_TRUE))
  2054. {
  2055.                      U16 num_len =  (pfnUnicodeStrlen((S8*) address)) * ENCODING_LENGTH;
  2056.                      U16 tmp_len = (pfnUnicodeStrlen((S8*) temp_p->address)) * ENCODING_LENGTH;
  2057.                      if((tmp_len > num_len) && (num_len >= (ENCODING_LENGTH * 7)))
  2058.                           len_diff = tmp_len - num_len;    
  2059.                      else if((num_len > tmp_len) && (tmp_len >= (ENCODING_LENGTH * 7)))
  2060.                           add_len_diff = num_len - tmp_len;    
  2061.      else if((jdi_UtilsStrStartsWith((S8*)address, (S8*)tmp_str) == MMI_TRUE) || (jdi_UtilsStrStartsWith((S8*)temp_p->address, (S8*)tmp_str) == MMI_TRUE))
  2062.      {
  2063. if((num_len >= (ENCODING_LENGTH * 7))&& (tmp_len >= (ENCODING_LENGTH * 7)))
  2064. {  
  2065. add_len_diff = ENCODING_LENGTH;
  2066. len_diff = ENCODING_LENGTH;
  2067. }
  2068.      }
  2069.                 }
  2070.                 if (mmi_jmms_compair_string((S8*) address + add_len_diff, (S8*)temp_p->address + len_diff) == 0)
  2071.                 {
  2072.                     found = MMI_TRUE;
  2073.                     break;
  2074.                 }
  2075.                 else
  2076.                 {
  2077.                     temp_p = temp_p->next;
  2078. len_diff = 0;
  2079. add_len_diff = 0;
  2080.                 }
  2081.             }
  2082.         }
  2083.     }
  2084.     if (found != MMI_TRUE)
  2085.     {
  2086.         temp_p = g_jmms_context->bcc_address_p;
  2087.         if(temp_p != NULL)
  2088.         {
  2089.             for (i = 0; i < g_jmms_context->num_bcc_addresses; i++)
  2090.             {
  2091.                 if(ignore_address_field==E_BCC_ADDRESSES)
  2092.                   if(i==ignore_address_id)  /* Amit */
  2093.           {  /* Increase temp_p to point to next address feild */
  2094.         temp_p = temp_p->next;
  2095.         len_diff = 0;
  2096.         add_len_diff = 0; /* End */
  2097.         continue;
  2098.           }
  2099.                 /*if((jdi_UtilsStrStartsWith((S8*)address, (S8*)tmp_str) == MMI_TRUE) || (jdi_UtilsStrStartsWith((S8*)temp_p->address, (S8*)tmp_str) == MMI_TRUE))
  2100.                 {
  2101.                     U16 num_len =  (pfnUnicodeStrlen((S8*) address)) * ENCODING_LENGTH;
  2102.                     U16 tmp_len = (pfnUnicodeStrlen((S8*) temp_p->address)) * ENCODING_LENGTH;
  2103.                     if((tmp_len > num_len) && (num_len >= (ENCODING_LENGTH * 7)))
  2104.                         len_diff = tmp_len - num_len;    
  2105.                     else if((num_len > tmp_len) && (tmp_len >= (ENCODING_LENGTH * 7)))
  2106.                         add_len_diff = num_len - tmp_len;    
  2107.                 }*/
  2108.                 if((jdi_UtilsStrStartsWith((S8*)address, (S8*)tmp_str) == MMI_TRUE) || (jdi_UtilsStrStartsWith((S8*)temp_p->address, (S8*)tmp_str) == MMI_TRUE))
  2109.                 {
  2110.                     U16 num_len =  (pfnUnicodeStrlen((S8*) address)) * ENCODING_LENGTH;
  2111.                     U16 tmp_len = (pfnUnicodeStrlen((S8*) temp_p->address)) * ENCODING_LENGTH;
  2112.                     if((tmp_len > num_len) && (num_len >= (ENCODING_LENGTH * 7)))
  2113.                         len_diff = tmp_len - num_len;    
  2114.                     else if((num_len > tmp_len) && (tmp_len >= (ENCODING_LENGTH * 7)))
  2115.                         add_len_diff = num_len - tmp_len;    
  2116.         else if((jdi_UtilsStrStartsWith((S8*)address, (S8*)tmp_str1) == MMI_TRUE) || (jdi_UtilsStrStartsWith((S8*)temp_p->address, (S8*)tmp_str1) == MMI_TRUE))
  2117.         {
  2118.     if((num_len >= (ENCODING_LENGTH * 7))&& (tmp_len >= (ENCODING_LENGTH * 7)))
  2119.     {   
  2120.     add_len_diff = ENCODING_LENGTH;
  2121.     len_diff = ENCODING_LENGTH;
  2122.     }
  2123.         }
  2124.         }
  2125.         else if((jdi_UtilsStrStartsWith((S8*)address, (S8*)tmp_str1) == MMI_TRUE) || (jdi_UtilsStrStartsWith((S8*)temp_p->address, (S8*)tmp_str1) == MMI_TRUE))
  2126.         {
  2127.         U16 num_len =  (pfnUnicodeStrlen((S8*) address)) * ENCODING_LENGTH;
  2128.         U16 tmp_len = (pfnUnicodeStrlen((S8*) temp_p->address)) * ENCODING_LENGTH;
  2129.         if((tmp_len > num_len) && (num_len >= (ENCODING_LENGTH * 7)))
  2130.         len_diff = tmp_len - num_len;    
  2131.         else if((num_len > tmp_len) && (tmp_len >= (ENCODING_LENGTH * 7)))
  2132.         add_len_diff = num_len - tmp_len;    
  2133.         else if((jdi_UtilsStrStartsWith((S8*)address, (S8*)tmp_str) == MMI_TRUE) || (jdi_UtilsStrStartsWith((S8*)temp_p->address, (S8*)tmp_str) == MMI_TRUE))
  2134.         {
  2135.         if((num_len >= (ENCODING_LENGTH * 7))&& (tmp_len >= (ENCODING_LENGTH * 7)))
  2136.         {  
  2137.         add_len_diff = ENCODING_LENGTH;
  2138.         len_diff = ENCODING_LENGTH;
  2139.         }
  2140.         }
  2141.                 }
  2142.                 if (mmi_jmms_compair_string((S8*) address + add_len_diff, (S8*)temp_p->address + len_diff) == 0)
  2143.                 {
  2144.                     found = MMI_TRUE;
  2145.                     break;
  2146.                 }
  2147.                 else
  2148.                 {
  2149.                     temp_p = temp_p->next;
  2150. len_diff = 0;
  2151. add_len_diff = 0;
  2152.                 }
  2153.             }
  2154.         }
  2155.     }
  2156.     return found;
  2157. }
  2158. /*****************************************************************************
  2159.  * FUNCTION
  2160.  *  mmi_jmms_check_number_input_format
  2161.  * DESCRIPTION
  2162.  *  checks the format of input email addrees whether valid or not
  2163.  * PARAMETERS
  2164.  *  email_address       [?]     [?]
  2165.  * RETURNS
  2166.  *  MMI_BOOL
  2167.  *****************************************************************************/
  2168. MMI_BOOL mmi_jmms_check_number_input_format(U8 *number)
  2169. {
  2170.     /*----------------------------------------------------------------*/
  2171.     /* Local Variables                                                */
  2172.     /*----------------------------------------------------------------*/
  2173.     S32 len;
  2174.     S32 i;
  2175.     MMI_BOOL allow = MMI_TRUE;
  2176.     /*----------------------------------------------------------------*/
  2177.     /* Code Body                                                      */
  2178.     /*----------------------------------------------------------------*/
  2179.     len = STR_LEN(number);
  2180. if ((CHR_AT(number, 0) == (U16) ('+')) && (len == 1))
  2181. {
  2182. allow = MMI_FALSE;
  2183. return allow;
  2184. goto END;
  2185. }
  2186.     for (i = 0; i < len; i++)
  2187.     {        
  2188. if ((CHR_AT(number, i) !=(U16) ('+')) && (CHR_AT(number, i) < (U16) ('0') || CHR_AT(number, i) > (U16) ('9')))
  2189.         {
  2190. allow = MMI_FALSE;
  2191. return allow;
  2192. break;
  2193.         }
  2194. if((CHR_AT(number, i) == (U16) ('+')) && (i >0))
  2195. {
  2196. allow = MMI_FALSE;
  2197. return allow;
  2198. break;
  2199.         }
  2200.     }
  2201. END:
  2202.     return allow; 
  2203. }
  2204. /*****************************************************************************
  2205.  * FUNCTION
  2206.  *  mmi_jmms_check_address_input_format
  2207.  * DESCRIPTION
  2208.  *  checks the format of input email addrees whether valid or not
  2209.  * PARAMETERS
  2210.  *  email_address       [?]     [?]
  2211.  * RETURNS
  2212.  *  MMI_BOOL
  2213.  *****************************************************************************/
  2214. MMI_BOOL mmi_jmms_check_address_input_format(U8 *email_address)
  2215. {
  2216.     /*----------------------------------------------------------------*/
  2217.     /* Local Variables                                                */
  2218.     /*----------------------------------------------------------------*/
  2219.     S32 len;
  2220.     S32 i;
  2221.     /* PMT VIKAS START 20050325 */
  2222.     S32 pos_1 = 0, pos_2 = 0;
  2223.     /* PMT VIKAS END 20050325 */
  2224.     MMI_BOOL allow = MMI_TRUE;
  2225.     /*----------------------------------------------------------------*/
  2226.     /* Code Body                                                      */
  2227.     /*----------------------------------------------------------------*/
  2228.     len = STR_LEN(email_address);
  2229.     for (i = 0; i < len; i++)
  2230.     {
  2231.         if (CHR_AT(email_address, i) == (U16) ('@'))
  2232.             //PMT VIKAS START 20050325
  2233.             //now valid email is of form name@domain domain is in the form b.c
  2234.         {
  2235.             if (i == 0)
  2236.             {
  2237.                 allow = MMI_FALSE;
  2238.                 return allow;
  2239.             }
  2240.             pos_1 = i;
  2241.             break;
  2242.         }
  2243.     }
  2244.     if (i == len)
  2245.     {
  2246.         allow = MMI_FALSE;
  2247.         return allow;
  2248.     }
  2249.     for (; i < len; i++)
  2250.     {
  2251.         if (CHR_AT(email_address, i) == (U16) ('.'))
  2252.         {
  2253.             pos_2 = i;
  2254.             break;
  2255.         }
  2256.     }
  2257.     if (pos_2 + 1 == len || (pos_2 - pos_1) <= 1)
  2258.     {
  2259.         allow = MMI_FALSE;
  2260.         return allow;
  2261.     }
  2262.     for (; i < len; i++)
  2263.     {
  2264.         if (CHR_AT(email_address, i) == (U16) ('.'))
  2265.         {
  2266.             pos_2 = i;
  2267.         }
  2268.     }
  2269.     if (pos_2 + 1 == len)
  2270.     {
  2271.         allow = MMI_FALSE;
  2272.     }
  2273.     else
  2274.     {
  2275.         memset(g_jmms_context->email_buff, 0x00, MAX_POSSIBLE_EMAIL_LENGHT_SENT);
  2276.         pfnUnicodeStrcpy((S8*) g_jmms_context->email_buff, (S8*) STR_AT(email_address, pos_1 + 1));
  2277.         if (!mmi_jmms_addrss_is_domain_name(g_jmms_context->email_buff))
  2278.         {
  2279.             allow = MMI_FALSE;
  2280.         }
  2281.         else
  2282.         {
  2283.             memset(g_jmms_context->email_buff, 0x00, MAX_POSSIBLE_EMAIL_LENGHT_SENT);
  2284.             pfnUnicodeStrcpy((S8*) g_jmms_context->email_buff, (S8*) STR_AT(email_address, 0));
  2285.             if (!mmi_jmms_is_email_local_part(g_jmms_context->email_buff, pos_1))
  2286.                 /* PMT VIKAS END 20050325 */
  2287.             {
  2288.                 allow = MMI_FALSE;
  2289.             }
  2290.         }
  2291.     }
  2292.     return allow;
  2293. }
  2294. /*****************************************************************************
  2295.  * FUNCTION
  2296.  *  mmi_jmms_addrss_is_domain_name
  2297.  * DESCRIPTION
  2298.  *  check whether input email address is some domain name
  2299.  * PARAMETERS
  2300.  *  str     [?]     [?]
  2301.  * RETURNS
  2302.  *  MMI_BOOL
  2303.  *****************************************************************************/
  2304. MMI_BOOL mmi_jmms_addrss_is_domain_name(U16 *str)
  2305. {
  2306.     /*----------------------------------------------------------------*/
  2307.     /* Local Variables                                                */
  2308.     /*----------------------------------------------------------------*/
  2309.     /*----------------------------------------------------------------*/
  2310.     /* Code Body                                                      */
  2311.     /*----------------------------------------------------------------*/
  2312.     if (*str == (U16) (''))
  2313.     {
  2314.         return MMI_FALSE;
  2315.     }
  2316.     do
  2317.     {
  2318.         if (((*str >= (U16) ('a') && *str <= (U16) ('z')) ||
  2319.              (*str >= (U16) ('A') && *str <= (U16) ('Z')) ||
  2320.              (*str >= (U16) ('0') && *str <= (U16) ('9')) || (*str == (U16) ('-')) || (*str == (U16) ('.'))) == 0)
  2321.         {
  2322.             return MMI_FALSE;
  2323.         }
  2324.         str++;
  2325.     }
  2326.     while (*str != (U16) (''));
  2327.     return MMI_TRUE;
  2328. }
  2329. /*****************************************************************************
  2330.  * FUNCTION
  2331.  *  mmi_jmms_is_email_local_part
  2332.  * DESCRIPTION
  2333.  *  check whether input email address contains valid chars
  2334.  * PARAMETERS
  2335.  *  str     [?]         [?]
  2336.  *  cnt     [IN]        
  2337.  * RETURNS
  2338.  *  boolean
  2339.  *****************************************************************************/
  2340. MMI_BOOL mmi_jmms_is_email_local_part(U16 *str, S32 cnt)
  2341. {
  2342.     /*----------------------------------------------------------------*/
  2343.     /* Local Variables                                                */
  2344.     /*----------------------------------------------------------------*/
  2345.     S32 i;
  2346.     U16 ch;
  2347.     /*----------------------------------------------------------------*/
  2348.     /* Code Body                                                      */
  2349.     /*----------------------------------------------------------------*/
  2350.     if (cnt == 0)
  2351.     {
  2352.         return MMI_FALSE;
  2353.     }