mmi_imps_ps.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:151k
源码类别:
MTK
开发平台:
C/C++
- }
- if (result == FS_NO_ERROR)
- {
- imps_pa_value_struct *pa_value = &pa_value_publisher->pa_value;
- mmi_imps_cont_struct *cont = &imps_p->cont_info.cont_list[imps_p->cont_info.curr_cont];
- if (pa_value->online_status_qualifier) /* if user is online, the availability depends on his setting */
- {
- if (pa_value->online_status == TRUE)
- {
- if (pa_value->user_availability_qualifier)
- {
- cont->availability = pa_value->user_availability;
- }
- else
- {
- cont->availability = IMPS_PA_USER_AVAILABLE;
- }
- }
- else
- {
- cont->availability = IMPS_PA_USER_NOT_AVAILABLE;
- }
- }
- else
- {
- if (pa_value->user_availability_qualifier)
- {
- cont->availability = pa_value->user_availability;
- }
- }
- if (pa_value->status_mood_qualifier)
- {
- cont->mood = pa_value->status_mood;
- }
- else
- {
- cont->mood = IMPS_PA_STATUS_MOOD_HAPPY;
- }
- if (pa_value->status_text_qualifier)
- {
- pfnUnicodeStrcpy((S8*) cont->prof_text, (S8*) pa_value->status_text);
- }
- else
- {
- cont->prof_text[0] = 0;
- }
- /* image context, temporary saved in common file buffer */
- if (pa_value->status_content_qualifier)
- {
- pfnUnicodeStrcpy((S8*) imps_p->friend_info.file_name, (S8*) pa_value->status_content_file_name);
- }
- else
- {
- imps_p->friend_info.file_name[0] = 0;
- }
- }
- FS_Close(fileHandle);
- FS_Delete((const WCHAR *) rsp->pa_val_list_info.entity_list_file_path);
- OslMfree(pa_value_publisher);
- /* update data */
- mmi_imps_about_friend_refresh_finish();
- }
- else
- {
- mmi_imps_util_disp_err_popup(mmi_imps_util_get_err_str(rsp->result));
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_ABOUT_FRIEND);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_abort_get_pa_req
- * DESCRIPTION
- * Send MSG_ID_MMI_IMPS_UPDATE_PA_REQ to PS.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_abort_get_pa_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_ps_send_msg(MSG_ID_MMI_IMPS_ABORT_GET_PA_REQ, NULL, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_abort_get_pa_rsp
- * DESCRIPTION
- * Handler for MSG_ID_MMI_IMPS_ABORT_GET_PA_RSP.
- * PARAMETERS
- * msg [IN] Result of response
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_abort_get_pa_rsp(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* restore current action */
- imps_p->gen_info.curr_action = 0;
- if (imps_p->gen_info.is_reentry)
- {
- mmi_imps_re_entry_app();
- }
- else
- {
- if (GetActiveScreenId() == SCR_ID_IMPS_PROGRESS)
- {
- GoBackToHistory(SCR_ID_IMPS_ABOUT_FRIEND);
- }
- else
- {
- DeleteScreenIfPresent(SCR_ID_IMPS_PROGRESS);
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_update_pa_req
- * DESCRIPTION
- * Send MSG_ID_MMI_IMPS_UPDATE_PA_REQ to PS.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_update_pa_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_update_pa_req_struct *req =
- (mmi_imps_update_pa_req_struct*) OslConstructDataPtr(sizeof(mmi_imps_update_pa_req_struct));
- imps_pa_value_struct *pa_value = &req->pa_update_list.pa_value;
- mmi_imps_about_me_struct *about_info = imps_p->about_info;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- IMPS_MEMSET(req, 0, mmi_imps_update_pa_req_struct);
- strcpy((S8*) req->pa_update_list.publisher_user_id, (S8*) imps_p->act_prof.username);
- pa_value->user_availability_qualifier = TRUE;
- pa_value->user_availability = (U8) about_info->status;
- pa_value->status_mood_qualifier = TRUE;
- pa_value->status_mood = (U8) about_info->mood;
- pa_value->status_text_qualifier = TRUE;
- pfnUnicodeStrcpy((S8*) pa_value->status_text, (S8*) about_info->my_prof);
- if (imps_p->about_info->is_pic_changed && pfnUnicodeStrlen((S8*) about_info->my_pic))
- {
- S8 *file_ext = NULL, *mine_type = NULL;
- /* shall fill contect type afterwards */
- pa_value->status_content_qualifier = TRUE;
- pfnUnicodeStrcpy((S8*) pa_value->status_content_file_name, (S8*) IMPS_ABOUT_PIC_PREFIX);
- file_ext = (S8*) mmi_fmgr_extract_ext_file_name((S8*) about_info->file_buff);
- pfnUnicodeStrcat((S8*) pa_value->status_content_file_name, (S8*) file_ext);
- UnicodeToAnsii((S8*) pa_value->status_content_type, (S8*) file_ext);
- mine_type = mmi_imps_get_mine_type((S8*) pa_value->status_content_type);
- if (mine_type)
- {
- strcpy((S8*) pa_value->status_content_type, mine_type);
- }
- }
- mmi_imps_ps_send_msg(MSG_ID_MMI_IMPS_UPDATE_PA_REQ, (void*)req, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_update_pa_rsp
- * DESCRIPTION
- * Handler for MSG_ID_MMI_IMPS_UPDATE_PA_RSP.
- * PARAMETERS
- * msg [IN] Result of response
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_update_pa_rsp(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_update_pa_rsp_struct *rsp = (mmi_imps_update_pa_rsp_struct*) msg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* restore current action */
- imps_p->gen_info.curr_action = 0;
- mmi_imps_about_me_save_done(rsp->result);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_pa_notify_ind
- * DESCRIPTION
- * Handler for MSG_ID_MMI_IMPS_PA_NOTIFY_IND.
- * PARAMETERS
- * msg [IN] Indication data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_pa_notify_ind(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_pa_notify_ind_struct *ind = (mmi_imps_pa_notify_ind_struct*) msg;
- mmi_imps_cont_struct *cont;
- S32 i, pa_count, entity_count, j;
- imps_pa_value_struct *pa_value;
- imps_pa_value_publisher_struct *pa_value_publisher = OslMalloc(sizeof(imps_pa_value_publisher_struct));
- FS_HANDLE fileHandle = 0;
- U32 len;
- S32 result;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- pa_count = (S32) ind->pa_val_list_info.entity_num;
- entity_count = (S32) imps_p->cont_info.no_cont;
- fileHandle = FS_Open((const WCHAR *) ind->pa_val_list_info.entity_list_file_path, FS_READ_ONLY);
- for (i = 0; i < pa_count; i++)
- {
- /* keneng : read pa value from file */
- if (fileHandle > 0)
- {
- result = FS_Read(fileHandle, (void *) pa_value_publisher, sizeof(imps_pa_value_publisher_struct), &len);
- }
- else
- {
- break;
- }
- for (j = 0; j < entity_count; j++)
- {
- if (result < FS_NO_ERROR)
- {
- break;
- }
- cont = &imps_p->cont_info.cont_list[j];
- /* find the user in contact list, update it's data */
- if (mmi_imps_util_is_id_same((S8*) cont->id, (S8*) pa_value_publisher->publisher_user_id))
- {
- pa_value = &pa_value_publisher->pa_value;
- if (pa_value->online_status_qualifier) /* if user is online, the availability depends on his setting */
- {
- if (pa_value->online_status == TRUE)
- {
- if (pa_value->user_availability_qualifier)
- {
- cont->availability = pa_value->user_availability;
- }
- else
- {
- cont->availability = IMPS_PA_USER_AVAILABLE;
- }
- }
- else
- {
- cont->availability = IMPS_PA_USER_NOT_AVAILABLE;
- }
- }
- else
- {
- if (pa_value->user_availability_qualifier)
- {
- cont->availability = pa_value->user_availability;
- }
- }
- if (pa_value->status_mood_qualifier)
- {
- cont->mood = pa_value->status_mood;
- }
- if (pa_value->status_text_qualifier)
- {
- pfnUnicodeStrcpy((S8*) cont->prof_text, (S8*) pa_value->status_text);
- }
- }
- }
- }
- FS_Close(fileHandle);
- FS_Delete((const WCHAR *) ind->pa_val_list_info.entity_list_file_path);
- OslMfree(pa_value_publisher);
- /* update information of the contact */
- /* force to redraw contact list */
- mmi_imps_cont_redraw_list();
- }
- #define BLOCK_PS_IMPS
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_block_entity_req
- * DESCRIPTION
- * Send request to block/grant a contact
- * PARAMETERS
- * type [IN] Type of request -- block user or grant user
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_block_entity_req(U8 type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_block_entity_req_struct *req =
- (mmi_imps_block_entity_req_struct*) OslConstructDataPtr(sizeof(mmi_imps_block_entity_req_struct));
- imps_entity_struct *entity;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- IMPS_MEMSET(req, 0, mmi_imps_block_entity_req_struct);
- req->block_in_use = TRUE;
- req->grant_in_use = FALSE;
- if (type == IMPS_BLOCK)
- {
- entity = &req->add_block_user;
- }
- else
- {
- entity = &req->remove_block_user;
- }
- strcpy((S8*) entity->id, (S8*) imps_p->cont_info.cont_list[imps_p->cont_info.curr_cont].id);
- mmi_imps_ps_send_msg(MSG_ID_MMI_IMPS_BLOCK_ENTITY_REQ, req, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_block_entity_rsp
- * DESCRIPTION
- * Handler for MSG_ID_MMI_IMPS_BLOCK_ENTITY_RSP
- * PARAMETERS
- * msg [IN] Indication data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_block_entity_rsp(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_block_entity_rsp_struct *rsp = (mmi_imps_block_entity_rsp_struct*) msg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* restore current action */
- imps_p->gen_info.curr_action = 0;
- mmi_imps_block_grant_done(rsp->result);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_get_block_list_req
- * DESCRIPTION
- * Send request to get block list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_get_block_list_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_ps_send_msg(MSG_ID_MMI_IMPS_GET_BLOCK_LIST_REQ, NULL, NULL);
- /* restore current action -- won't store state for background update */
- imps_p->gen_info.curr_action = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_get_block_list_rsp
- * DESCRIPTION
- * Response handler of MSG_ID_MMI_IMPS_GET_BLOCK_LIST_RSP
- * PARAMETERS
- * msg [IN] Indication data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_get_block_list_rsp(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_get_block_list_rsp_struct *rsp = (mmi_imps_get_block_list_rsp_struct*) msg;
- S32 i;
- S32 block_count;
- U32 len;
- S32 result;
- mmi_imps_cont_struct *cont;
- FS_HANDLE fileHandle;
- imps_entity_struct *entity;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (imps_p->gen_info.curr_action == MSG_ID_MMI_IMPS_LOGOUT_REQ || imps_p->gen_info.is_login == FALSE)
- {
- return;
- }
- block_count = (S32) rsp->block_list.block_num;
- /* block list exists */
- if ( /* rsp->block_in_use && */ block_count > 0)
- {
- fileHandle = FS_Open((U16*) rsp->block_list.block_list_file_path, FS_READ_ONLY);
- if (fileHandle > 0)
- {
- entity = (imps_entity_struct*) OslMalloc(sizeof(imps_entity_struct));
- for (i = 0; i < block_count; i++)
- {
- result = FS_Read(fileHandle, (void*)entity, sizeof(imps_entity_struct), &len);
- if (result == FS_NO_ERROR)
- {
- /* search if the user is in contact list */
- cont = mmi_imps_util_search_cont((S8*) entity->id);
- if (cont != NULL)
- {
- cont->comm_state |= IMPS_CONT_BLOCK;
- }
- }
- else
- {
- break;
- }
- }
- FS_Close(fileHandle);
- OslMfree(entity);
- }
- }
- /* redraw context list */
- if (imps_p->gen_info.auto_update_done == FALSE)
- {
- mmi_imps_sync_cont_list();
- imps_p->gen_info.auto_update_done = TRUE;
- }
- else
- {
- mmi_imps_cont_redraw_list();
- }
- }
- #define MSG_PS_IMPS
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_newmsg_ind
- * DESCRIPTION
- * Handler for MSG_ID_MMI_IMPS_NEWMSG_IND
- * PARAMETERS
- * msg [IN] Indication data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_newmsg_ind(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i, count;
- BOOL is_in_room = FALSE;
- imps_entity_struct *entity;
- mmi_imps_newmessage_ind_struct *ind = (mmi_imps_newmessage_ind_struct*) msg;
- S32 unused_room = IMPS_MAX_NO_ROOM;
- U16 active_scr = GetActiveScreenId();
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* logout or during logout period */
- if (imps_p->gen_info.curr_action == MSG_ID_MMI_IMPS_LOGOUT_REQ || imps_p->gen_info.is_login == FALSE)
- {
- return;
- }
- /* no message, to prevent abnormal cases */
- if (ind->msg_len == 0)
- {
- return;
- }
- /* check if there is a chat room for the recipient */
- for (i = 0; i < IMPS_MAX_NO_ROOM; i++)
- {
- mmi_imps_room_struct *room = &imps_p->room_info.room_list[i];
- if (room->is_used)
- {
- if (room->type == IMPS_ROOM_TYPE_SINGLE && ind->recipient.entity_type == IMPS_ENTITY_TYPE_USER)
- {
- /* single talk */
- entity = &ind->sender;
- }
- else
- {
- /* chat rooms */
- entity = &ind->recipient;
- /* if the sender is the receiver himself */
- if (ind->sender.entity_type == IMPS_ENTITY_TYPE_SCREEN_NAME) /* screen name only */
- {
- /* compare screen name */
- if (pfnUnicodeStrcmp((S8*) ind->sender.sname, (S8*) room->member[0].sname) == 0)
- {
- return;
- }
- }
- else
- {
- /* compare screen name */
- if (mmi_imps_util_is_id_same((S8*) ind->sender.id, (S8*) imps_p->cont_info.cont_list[0].id))
- {
- return;
- }
- }
- }
- if (mmi_imps_util_is_id_same((S8*) room->room_id, (S8*) entity->id)) /* chat room exists */
- {
- mmi_imps_chat_recv_msg((U16*) ind->message_content, (U8) i, (imps_entity_struct*) & ind->sender);
- mmi_imps_tab_update_event(room, entity);
- mmi_imps_util_play_tone(IMPS_MSG_TONE);
- /* stop searching */
- is_in_room = TRUE;
- break;
- }
- }
- else
- {
- unused_room = i; /* pre-record unused room */
- }
- }
- /* if no check room found, check if the receipient is in contact list */
- if (is_in_room == FALSE && unused_room != IMPS_MAX_NO_ROOM) /* there still some chat room to store message */
- {
- count = (S32) imps_p->cont_info.no_cont;
- entity = &ind->sender;
- if (entity->entity_type == IMPS_ENTITY_TYPE_USER)
- {
- mmi_imps_room_struct *room = &imps_p->room_info.room_list[unused_room];
- /* create a new tab */
- memset(room, 0, sizeof(mmi_imps_room_struct));
- room->is_used = TRUE;
- room->type = IMPS_ROOM_TYPE_SINGLE;
- room->no_member = 1;
- room->tab_index = imps_p->gen_info.no_tab;
- imps_p->gen_info.no_tab++;
- strcpy((S8*) room->member[0].id, (S8*) entity->id);
- strcpy((S8*) room->room_id, (S8*) entity->id);
- /* display be screen name if the user's alias is not empty */
- if (pfnUnicodeStrlen((S8*) entity->sname))
- {
- pfnUnicodeStrcpy((S8*) room->room_name, (S8*) entity->sname);
- pfnUnicodeStrcpy((S8*) room->member[0].sname, (S8*) entity->sname);
- }
- else
- {
- AnsiiToUnicodeString((S8*) room->room_name, (S8*) entity->id);
- room->member[0].sname[0] = 0;
- }
- imps_p->room_info.no_rooms++;
- /* update display buffer */
- mmi_imps_new_room_string((S8*) room->chat_buff, (S8*) room->room_name);
- mmi_imps_chat_recv_msg(
- (U16*) ind->message_content,
- (U8) unused_room,
- (imps_entity_struct*) & ind->sender);
- /* redraw tab becuase new tab created */
- mmi_imps_tab_redraw(active_scr);
- /* update tab when event comes event */
- mmi_imps_tab_update_event(room, entity);
- mmi_imps_util_play_tone(IMPS_MSG_TONE);
- }
- }
- /*
- * else
- * {
- * neglect the message because of buffer full
- * }
- */
- }
- #define WATCH_PS_IMPS
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_get_watch_list_req
- * DESCRIPTION
- * Send MSG_ID_MMI_IMPS_GET_WATCHER_LIST_REQ to PS
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_get_watch_list_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_get_watcher_list_req_struct *req =
- (mmi_imps_get_watcher_list_req_struct*) OslConstructDataPtr(sizeof(mmi_imps_get_watcher_list_req_struct));
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- IMPS_MEMSET(req, 0, mmi_imps_get_watcher_list_req_struct);
- req->max_watcher_list = IMPS_MAX_SEARCH_RESULT;
- req->max_watcher_list_p = TRUE;
- mmi_imps_ps_send_msg(MSG_ID_MMI_IMPS_GET_WATCHER_LIST_REQ, (void*)req, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_get_watch_list_rsp
- * DESCRIPTION
- * Handler for MSG_ID_MMI_IMPS_GET_WATCHER_LIST_RSP
- * PARAMETERS
- * msg [IN] Indication data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_get_watch_list_rsp(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_get_watcher_list_rsp_struct *rsp = (mmi_imps_get_watcher_list_rsp_struct*) msg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* restore current action */
- imps_p->gen_info.curr_action = 0;
- if (rsp->watcher_list_p == FALSE || rsp->watcher_list.watcher_num == 0)
- {
- mmi_imps_util_disp_empty_popup();
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_CONT_OPT);
- }
- else
- {
- S32 result;
- /* copy response to local structure */
- imps_p->search_result.count = rsp->watcher_list.watcher_num;
- /* display result screen */
- result = mmi_imps_pre_entry_watch_list((S16*) rsp->watcher_list.watcher_list_file_path);
- if (result > 0)
- {
- if (GetActiveScreenId() == SCR_ID_IMPS_PROGRESS)
- {
- mmi_imps_entry_search_result();
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_CONT_OPT);
- }
- else
- {
- HistoryReplace(SCR_ID_IMPS_PROGRESS, SCR_ID_IMPS_WATCHER_LIST, mmi_imps_entry_watch_list);
- }
- }
- else
- {
- mmi_imps_util_disp_err_popup(mmi_imps_util_get_err_str(result));
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_CONT_OPT);
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_abort_get_watch_list_req
- * DESCRIPTION
- * Send MSG_ID_MMI_IMPS_GET_WATCHER_LIST_REQ to PS
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_abort_get_watch_list_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_ps_send_msg(MSG_ID_MMI_IMPS_ABORT_GET_WATCHER_LIST_REQ, NULL, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_abort_get_watch_list_rsp
- * DESCRIPTION
- * Abort Get Watcher list process
- * PARAMETERS
- * msg [IN] Result of response
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_abort_get_watch_list_rsp(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_abort_search_finish();
- /* restore current action */
- imps_p->gen_info.curr_action = 0;
- }
- #define CHAT_IMPS
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_send_msg_req
- * DESCRIPTION
- * Send request to protocol
- * PARAMETERS
- * msg_id [IN] Index of session
- * msg [IN] String message to be sent
- * recv_id [IN] Id of recipient
- * recv_type [IN] Type of recipient
- * screen_name [IN] Screen name if exists
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_send_msg_req(S32 msg_id, S16 *msg, U8 *recv_id, U8 recv_type, S8 *screen_name)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_send_message_req_struct *req =
- (mmi_imps_send_message_req_struct*) OslConstructDataPtr(sizeof(mmi_imps_send_message_req_struct));
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- req->message_id = msg_id;
- pfnUnicodeStrcpy((S8*) req->message_content, (S8*) msg);
- req->recipients.entity_count = 1;
- req->recipients.entity[0].entity_type = recv_type;
- strcpy((S8*) req->recipients.entity[0].id, (S8*) recv_id);
- if (screen_name)
- {
- pfnUnicodeStrcpy((S8*) req->recipients.entity[0].sname, screen_name);
- }
- mmi_imps_ps_send_msg(MSG_ID_MMI_IMPS_SEND_MESSAGE_REQ, req, NULL);
- /* restore current action */
- imps_p->gen_info.curr_action = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_send_msg_rsp
- * DESCRIPTION
- * handler of MSG_ID_MMI_IMPS_SEND_MESSAGE_RSP
- * PARAMETERS
- * msg [IN] Indication data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_send_msg_rsp(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_send_message_rsp_struct *rsp = (mmi_imps_send_message_rsp_struct*) msg;
- S32 i;
- mmi_imps_chat_session_struct *session = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* logout or during logout period */
- if (imps_p->gen_info.curr_action == MSG_ID_MMI_IMPS_LOGOUT_REQ || imps_p->gen_info.is_login == FALSE)
- {
- return;
- }
- /* find session index of the message */
- for (i = 0; i < IMPS_MAX_CHAT_MSG_COUNT; i++)
- {
- if (imps_p->chat_info.chat_session[i].session_id == rsp->message_id)
- {
- session = &imps_p->chat_info.chat_session[i];
- break;
- }
- }
- if (session)
- {
- if (rsp->result != IMPS_OK)
- {
- S32 room_index;
- imps_entity_struct *entity = OslMalloc(sizeof(imps_entity_struct));
- mmi_imps_room_struct *room;
- room_index = mmi_imps_util_find_room((S8*) session->room_id);
- room = &imps_p->room_info.room_list[room_index];
- mmi_imps_chat_display_send_failed((U8) room_index, session->input_buff);
- if (room->type == IMPS_ROOM_TYPE_SINGLE) /* only single talk required */
- {
- strcpy((S8*) entity->id, (S8*) room->member[0].id);
- mmi_imps_tab_update_event(room, entity);
- }
- else
- {
- mmi_imps_tab_update_event(room, NULL);
- }
- OslMfree(entity);
- mmi_imps_util_play_tone(IMPS_ERR_TONE);
- }
- /* reset session */
- session->room_id[0] = 0;
- session->session_id = 0;
- session->input_buff[0] = 0;
- }
- }
- #define GROUP_IMPS
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_create_group_req
- * DESCRIPTION
- * Send MSG_ID_MMI_IMPS_CREATE_GROUP_REQ to PS
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_create_group_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_create_group_req_struct *req =
- (mmi_imps_create_group_req_struct*) OslConstructDataPtr(sizeof(mmi_imps_create_group_req_struct));
- mmi_imps_room_inline_struct *inline_open_room = imps_p->room_info.inline_open_room;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- IMPS_MEMSET(req, 0, mmi_imps_create_group_req_struct);
- req->join_grouop = TRUE;
- /* IMPS_ACCESS_TYPE_OPEN == 0 */
- /* req->group_access_type = IMPS_ACCESS_TYPE_OPEN; */
- UnicodeToAnsii((S8*) req->group_id, (S8*) inline_open_room->room_name);
- sprintf((S8*) inline_open_room->room_id, "%s/%s", (S8*) imps_p->act_prof.username, (S8*) req->group_id);
- memcpy(req->group_id, inline_open_room->room_id, IMPS_MAX_ID_LEN);
- pfnUnicodeStrcpy((S8*) req->group_name, (S8*) inline_open_room->room_name);
- if (pfnUnicodeStrlen((S8*) inline_open_room->topic))
- {
- pfnUnicodeStrcpy((S8*) req->group_topic, (S8*) inline_open_room->topic);
- }
- if (pfnUnicodeStrlen((S8*) inline_open_room->welcome))
- {
- pfnUnicodeStrcpy((S8*) req->welcome_note, (S8*) inline_open_room->welcome);
- }
- if (pfnUnicodeStrlen((S8*) inline_open_room->sname))
- {
- pfnUnicodeStrcpy((S8*) req->sname, (S8*) inline_open_room->sname);
- }
- req->subscribe_notif = TRUE;
- mmi_imps_ps_send_msg(MSG_ID_MMI_IMPS_CREATE_GROUP_REQ, (void*)req, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_create_group_rsp
- * DESCRIPTION
- * Handler for MSG_ID_MMI_IMPS_CREATE_GROUP_RSP
- * PARAMETERS
- * msg [IN] Indication data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_create_group_rsp(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_create_group_rsp_struct *rsp = (mmi_imps_create_group_rsp_struct*) msg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* restore current action */
- imps_p->gen_info.curr_action = 0;
- mmi_imps_room_create_finish(rsp->result);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_join_group_req
- * DESCRIPTION
- * Send MSG_ID_MMI_IMPS_JOIN_GROUP_REQ to PS
- * PARAMETERS
- * id [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_join_group_req(S8 *id)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_join_group_req_struct *req =
- (mmi_imps_join_group_req_struct*) OslConstructDataPtr(sizeof(mmi_imps_join_group_req_struct));
- mmi_imps_join_inline_struct *inline_join = imps_p->room_info.inline_join;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- req->user_auto_join_group = TRUE;
- pfnUnicodeStrcpy((S8*) req->sname, (S8*) inline_join->sname);
- strcpy((S8*) req->group_id, id);
- if (inline_join->disclose_id == 0)
- {
- req->user_show_id = TRUE;
- }
- else
- {
- req->user_show_id = FALSE;
- }
- mmi_imps_ps_send_msg(MSG_ID_MMI_IMPS_JOIN_GROUP_REQ, req, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_join_group_rsp
- * DESCRIPTION
- * Response handler for MSG_ID_MMI_IMPS_JOIN_GROUP_RSP
- * PARAMETERS
- * msg [IN] Indication data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_join_group_rsp(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* restore current action */
- imps_p->gen_info.curr_action = 0;
- mmi_imps_join_room_finished(msg);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_del_group_req
- * DESCRIPTION
- * Send request to delete a group
- * PARAMETERS
- * room_id [IN] Id of the room
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_del_group_req(U8 *room_id)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_delete_group_req_struct *req =
- (mmi_imps_delete_group_req_struct*) OslConstructDataPtr(sizeof(mmi_imps_delete_group_req_struct));
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- strcpy((S8*) req->group_id, (S8*) room_id);
- mmi_imps_ps_send_msg(MSG_ID_MMI_IMPS_DELETE_GROUP_REQ, req, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_del_group_rsp
- * DESCRIPTION
- * Handler of MSG_ID_MMI_IMPS_DELETE_GROUP_RSP
- * PARAMETERS
- * msg [IN] Indication data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_del_group_rsp(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_delete_group_rsp_struct *rsp = (mmi_imps_delete_group_rsp_struct*) msg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* restore current action */
- imps_p->gen_info.curr_action = 0;
- mmi_imps_close_chat_room_done(rsp->result);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_leave_group_req
- * DESCRIPTION
- * Send request to leave a group
- * PARAMETERS
- * room_id [IN] Id of the room
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_leave_group_req(U8 *room_id)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_leave_group_req_struct *req =
- (mmi_imps_leave_group_req_struct*) OslConstructDataPtr(sizeof(mmi_imps_leave_group_req_struct));
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- strcpy((S8*) req->group_id, (S8*) room_id);
- mmi_imps_ps_send_msg(MSG_ID_MMI_IMPS_LEAVE_GROUP_REQ, req, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_leave_group_rsp
- * DESCRIPTION
- * Response handler for MSG_ID_MMI_IMPS_LEAVE_GROUP_RSP
- * PARAMETERS
- * msg [IN] Indication data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_leave_group_rsp(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_leave_group_rsp_struct *rsp = (mmi_imps_leave_group_rsp_struct*) msg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* restore current action */
- imps_p->gen_info.curr_action = 0;
- mmi_imps_close_chat_room_done((S32) rsp->result);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_leave_group_ind
- * DESCRIPTION
- * Handler for MSG_ID_MMI_IMPS_LEAVE_GROUP_IND
- * PARAMETERS
- * msg [IN] Indication data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_leave_group_ind(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_leave_group_ind_struct *ind = (mmi_imps_leave_group_ind_struct*) msg;
- mmi_imps_room_struct *room;
- S32 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* find the chat room */
- for (i = 0; i < IMPS_MAX_NO_ROOM; i++)
- {
- room = &imps_p->room_info.room_list[i];
- if (room->is_used)
- {
- if (room->type == IMPS_ROOM_TYPE_GROUP_CREATE || room->type == IMPS_ROOM_TYPE_GROUP_JOIN)
- {
- if (mmi_imps_util_is_id_same((S8*) room->room_id, (S8*) ind->group_id)) /* chat room exists */
- {
- break;
- }
- }
- }
- }
- if (i < IMPS_MAX_NO_ROOM) /* room exists */
- {
- U16 scr_id = GetActiveScreenId();
- mmi_imps_util_disp_warning_popup(STR_ID_IMPS_CHAT_ROOM_CLOSE);
- if (scr_id == SCR_ID_IMPS_CHAT) /* in chatting screen */
- {
- /* if the room is current chatting room -- go to contact list screen */
- if (room->tab_index == imps_p->gen_info.curr_tab)
- {
- HistoryReplace(SCR_ID_IMPS_CHAT, SCR_ID_IMPS_CONT, mmi_imps_pre_entry_cont);
- }
- /* else do nothing */
- }
- else if (scr_id == SCR_ID_IMPS_CONT)
- {
- /* do nothing */
- }
- else if (IsScreenPresent(SCR_ID_IMPS_CHAT)) /* chat screen is in history */
- {
- /* if the room is current chatting room -- go to contact list screen */
- if (room->tab_index == imps_p->gen_info.curr_tab)
- {
- HistoryReplace(SCR_ID_IMPS_CHAT, SCR_ID_IMPS_CONT, mmi_imps_pre_entry_cont);
- mmi_imps_util_del_up_to_screen(SCR_ID_IMPS_CONT);
- }
- /* else do nothing */
- }
- /* remove the tab of the chat room */
- if (room->tab_index == imps_p->gen_info.curr_tab)
- {
- mmi_imps_tab_del(room->tab_index, 0);
- }
- else
- {
- mmi_imps_tab_del(room->tab_index, imps_p->gen_info.curr_tab);
- }
- /* clear chat room */
- mmi_imps_room_reset_cntx(room);
- imps_p->room_info.no_rooms--;
- mmi_imps_util_update_status_icon();
- mmi_imps_util_play_tone(IMPS_MSG_TONE);
- }
- else
- {
- /* do nothing */
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_group_change_ind
- * DESCRIPTION
- * Handler for MSG_ID_MMI_IMPS_GROUP_CHANGE_NOTIFY_IND
- * PARAMETERS
- * msg [IN] Indication data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_group_change_ind(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_group_change_notify_ind_struct *ind = (mmi_imps_group_change_notify_ind_struct*) msg;
- mmi_imps_room_struct *room;
- imps_entity_struct *entity;
- S32 i, j, k, room_id;
- S32 count;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* finding the chat room */
- for (room_id = 0; room_id < IMPS_MAX_NO_ROOM; room_id++)
- {
- room = &imps_p->room_info.room_list[room_id];
- /* if the room is an opened group chat room */
- if (room->is_used && (room->type == IMPS_ROOM_TYPE_GROUP_CREATE || room->type == IMPS_ROOM_TYPE_GROUP_JOIN))
- {
- if (mmi_imps_util_is_id_same((S8*) room->room_id, (S8*) ind->group_id)) /* chat room exists */
- {
- break;
- }
- }
- }
- /* the group is not in the list */
- if (room_id == IMPS_MAX_NO_ROOM)
- {
- return;
- }
- /* change of name */
- if (ind->changed_props & IMPS_GROUP_NAME_CHANGED)
- {
- pfnUnicodeStrcpy((S8*) room->room_name, (S8*) ind->group_name);
- }
- if (ind->changed_props & IMPS_GROUP_TOPIC_CHANGED)
- {
- pfnUnicodeStrcpy((S8*) room->room_topic, (S8*) ind->group_topic);
- }
- /* process left user first to make more empty slot for joined users */
- if (ind->left_user_list.entity_count != 0)
- {
- count = (S32) ind->left_user_list.entity_count;
- for (i = 0; i < IMPS_MAX_ENTITY_NUMBER; i++)
- {
- /* if the member exists */
- if (strlen((S8*) room->member[i].id) || pfnUnicodeStrlen((S8*) room->member[i].sname))
- {
- for (j = 0; j < (S32) ind->left_user_list.entity_count; j++)
- {
- /* found the left user */
- if (mmi_imps_util_is_id_same((S8*) room->member[i].id, (S8*) ind->left_user_list.entity[j].id)
- || pfnUnicodeStrcmp(
- (S8*) room->member[i].sname,
- (S8*) ind->left_user_list.entity[j].sname) == 0)
- {
- /* display left user */
- mmi_imps_chat_disp_user_change_msg(room_id, &room->member[i], IMPS_ROOM_MEMBER_LEFT);
- room->member[i].id[0] = 0;
- room->member[i].sname[0] = 0;
- room->no_member--;
- /* all left users found, leave whole loop */
- count--;
- if (count == 0)
- {
- i = IMPS_MAX_ENTITY_NUMBER;
- }
- break;
- }
- }
- }
- }
- }
- /* process joined users */
- if (ind->joined_user_list.entity_count != 0)
- {
- count = (S32) ind->joined_user_list.entity_count;
- j = 0;
- for (i = 0; i < count; i++)
- {
- entity = &ind->joined_user_list.entity[i];
- /* check if contact already exists */
- for (k = 0; k < (S32) room->no_member; k++)
- {
- if (entity->entity_type == IMPS_ENTITY_TYPE_USER)
- {
- if (mmi_imps_util_is_id_same((S8*) room->member[k].id, (S8*) entity->id) == TRUE)
- {
- break;
- }
- }
- else if (entity->entity_type == IMPS_ENTITY_TYPE_SCREEN_NAME)
- {
- if (pfnUnicodeStrcmp((S8*) room->member[k].sname, (S8*) entity->sname) == 0)
- {
- break;
- }
- }
- else
- {
- k = (S32) room->no_member;
- }
- }
- if (k < (S32) room->no_member) /* duplicated joined */
- {
- continue;
- }
- /* find empty slot */
- for (; j < IMPS_MAX_ENTITY_NUMBER; j++)
- {
- if (strlen((S8*) room->member[j].id) == 0) /* empty slot found */
- {
- strcpy((S8*) room->member[j].id, (S8*) entity->id);
- pfnUnicodeStrcpy((S8*) room->member[j].sname, (S8*) entity->sname);
- /* display joined user */
- mmi_imps_chat_disp_user_change_msg(room_id, &room->member[j], IMPS_ROOM_MEMBER_JOINED);
- room->no_member++;
- break;
- }
- }
- if (j == IMPS_MAX_ENTITY_NUMBER) /* no empty slot to store new-joined users */
- {
- break;
- }
- }
- }
- /* refresh screen */
- mmi_imps_tab_update_event(room, NULL);
- mmi_imps_util_play_tone(IMPS_MSG_TONE);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_invite_req
- * DESCRIPTION
- * Send MSG_ID_MMI_IMPS_INVITE_REQ to PS
- * PARAMETERS
- * id [IN] Index of session
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_invite_req(S32 id)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_invite_req_struct *req;
- mmi_imps_room_struct *room;
- mmi_imps_cont_struct *cont;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- req = (mmi_imps_invite_req_struct*) OslConstructDataPtr(sizeof(mmi_imps_invite_req_struct));
- IMPS_MEMSET(req, 0, mmi_imps_invite_req_struct);
- room = &imps_p->room_info.room_list[imps_p->chat_info.curr_room];
- cont = &imps_p->cont_info.cont_list[imps_p->invite_info.invite_cand_list[imps_p->invite_info.curr_sel_cont]];
- req->invite_type = IMPS_INVITE_TYPE_GROUP;
- strcpy((S8*) req->group_id, (S8*) room->room_id);
- strcpy((S8*) req->recipient_id, (S8*) cont->id);
- if (pfnUnicodeStrlen((S8*) imps_p->path_buff))
- {
- pfnUnicodeStrcpy((S8*) req->invite_note, (S8*) imps_p->path_buff);
- }
- if (pfnUnicodeStrlen((S8*) room->sname))
- {
- pfnUnicodeStrcpy((S8*) req->self_sname, (S8*) room->sname);
- }
- req->invite_id = id;
- /* use protocol default timeout */
- req->invite_timeout = 0;
- mmi_imps_ps_send_msg(MSG_ID_MMI_IMPS_INVITE_REQ, req, NULL);
- /* restore current action */
- imps_p->gen_info.curr_action = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_invite_rsp
- * DESCRIPTION
- * Response handler for MSG_ID_MMI_IMPS_INVITE_RSP
- * PARAMETERS
- * msg [IN] Indication data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_invite_rsp(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_invite_rsp_struct *rsp = (mmi_imps_invite_rsp_struct*) msg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_invite_start(rsp->result, rsp->invite_id);
- /* restore current action */
- imps_p->gen_info.curr_action = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_invite_reply_req
- * DESCRIPTION
- * Send MSG_ID_MMI_IMPS_INVITE_RES to remote server.
- * PARAMETERS
- * accept [IN] Accept or not
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_invite_reply_req(BOOL accept)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_invite_reply_req_struct *req = OslConstructDataPtr(sizeof(mmi_imps_invite_reply_req_struct));
- mmi_imps_invite_ind_struct *invitation =
- imps_p->invite_info.invite_pending_list[imps_p->invite_info.curr_pend_invite].node;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- IMPS_MEMSET(req, 0, mmi_imps_invite_reply_req_struct);
- req->invite_type = invitation->invite_type;
- strcpy((S8*) req->invite_id, (S8*) invitation->invite_id);
- req->acceptance = accept;
- req->self_sname[0] = 0; /* set to NULL first */
- req->response_note[0] = 0;
- strcpy((S8*) req->recipient.id, (S8*) invitation->sender.id);
- req->recipient.entity_type = invitation->sender.entity_type;
- pfnUnicodeStrcpy((S8*) req->recipient.sname, (S8*) invitation->sender.sname);
- strcpy((S8*) req->group_id, (S8*) invitation->group_id);
- if (accept)
- {
- mmi_imps_join_inline_struct *inline_join = imps_p->room_info.inline_join;
- pfnUnicodeStrcpy((S8*) req->self_sname, (S8*) inline_join->sname);
- req->user_auto_join_group = TRUE;
- req->user_show_id = (MMI_BOOL) inline_join->disclose_id;
- SetProtocolEventHandler(mmi_imps_ps_invite_reply_rsp, MSG_ID_MMI_IMPS_INVITE_REPLY_RSP);
- }
- else
- {
- SetProtocolEventHandler(mmi_imps_ps_reject_invite_reply_rsp, MSG_ID_MMI_IMPS_INVITE_REPLY_RSP);
- }
- mmi_imps_ps_send_msg(MSG_ID_MMI_IMPS_INVITE_REPLY_REQ, (void*)req, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_invite_reply_rsp
- * DESCRIPTION
- * Response handler for MSG_ID_MMI_IMPS_INVITE_REPLY_RSP
- * PARAMETERS
- * msg [IN] Indication data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_invite_reply_rsp(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* logout or during logout period */
- if (imps_p->gen_info.curr_action == MSG_ID_MMI_IMPS_LOGOUT_REQ || imps_p->gen_info.is_login == FALSE)
- {
- return;
- }
- /* restore current action */
- imps_p->gen_info.curr_action = 0;
- mmi_imps_join_room_finished(msg);
- /* release the holding local parameter */
- mmi_imps_invite_ind_release_node();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_reject_invite_reply_rsp
- * DESCRIPTION
- * Response handler for MSG_ID_MMI_IMPS_INVITE_REPLY_RSP
- * PARAMETERS
- * msg [IN] Indication data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_reject_invite_reply_rsp(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_util_disp_popup_done();
- /* restore current action */
- imps_p->gen_info.curr_action = 0;
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_CONT);
- /* release the holding local parameter */
- mmi_imps_invite_ind_release_node();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_invite_response_ind
- * DESCRIPTION
- * Response handler for MSG_ID_MMI_IMPS_INVITE_RESPONSE_IND
- * PARAMETERS
- * msg [IN] Indication data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_invite_response_ind(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_invite_response_ind_struct *rsp = (mmi_imps_invite_response_ind_struct*) msg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* logout or during logout period */
- if (imps_p->gen_info.curr_action == MSG_ID_MMI_IMPS_LOGOUT_REQ || imps_p->gen_info.is_login == FALSE)
- {
- return;
- }
- /* call response handler for the user */
- mmi_imps_invite_finish((BOOL) rsp->acceptance, (S32) rsp->invite_id, &rsp->sender, (U16*) rsp->response_note);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_invite_ind
- * DESCRIPTION
- * Handler for MSG_ID_MMI_IMPS_INVITE_IND
- * PARAMETERS
- * msg [IN] Indication data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_invite_ind(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_invite_info_struct *invite = &imps_p->invite_info;
- mmi_imps_invite_ind_struct *invite_ind = (mmi_imps_invite_ind_struct*) msg;
- S32 i, j;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* logout or during logout period */
- if (imps_p->gen_info.curr_action == MSG_ID_MMI_IMPS_LOGOUT_REQ || imps_p->gen_info.is_login == FALSE)
- {
- return;
- }
- /* check if the user has joined the room of invitation */
- for (i = 0; i < IMPS_MAX_NO_ROOM; i++)
- {
- /* if the user has already joined the chat room */
- if (mmi_imps_util_is_id_same((S8*) invite_ind->group_id, (S8*) imps_p->room_info.room_list[i].room_id))
- {
- return;
- }
- }
- i = (S32) invite->curr_pend_invite;
- /* store the invitation */
- for (j = 0; j < IMPS_MAX_PEND_INVITATION; j++, i++)
- {
- if (invite->invite_pending_list[i].node == NULL) /* empty slot */
- {
- invite->invite_pending_list[i].node = msg;
- hold_local_para((local_para_struct*) msg);
- DTGetRTCTime(&invite->invite_pending_list[i].time_stamp);
- break;
- }
- /* to maintain circular queue */
- if (i == IMPS_MAX_PEND_INVITATION)
- {
- i = 0;
- }
- }
- if (j < IMPS_MAX_PEND_INVITATION) /* some empty slot here */
- {
- U16 curr_scr = GetActiveScreenId();
- if (mmi_imps_util_is_in_imps() && curr_scr != SCR_ID_IMPS_INVITATION_IND)
- {
- mmi_imps_check_pending_invite();
- }
- else
- {
- invite->reminder_flag = TRUE;
- if (mmi_imps_util_is_on_idle())
- {
- mmi_imps_entry_invite_reminder();
- }
- else if (curr_scr != SCR_ID_IMPS_INVITATION_IND) /* to prevent unnecessary popup */
- {
- mmi_imps_util_disp_warning_popup(STR_ID_IMPS_NEW_INVITATION);
- }
- }
- }
- }
- #define MISC_IMPS
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_server_disconn_ind
- * DESCRIPTION
- * Handler for MSG_ID_MMI_IMPS_DISCONNECT_IND
- * PARAMETERS
- * msg [IN] Indication data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_server_disconn_ind(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- BOOL cont_scr;
- BOOL chat_scr;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* reset action_id */
- imps_p->gen_info.curr_action = 0;
- if (imps_p->gen_info.is_login == TRUE)
- {
- DisplayPopup(
- (U8*) GetString(STR_ID_IMPS_SERVER_DISCONNECT),
- IMG_GLOBAL_WARNING,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- (U8) WARNING_TONE);
- cont_scr = IsScreenPresent(SCR_ID_IMPS_CONT);
- chat_scr = IsScreenPresent(SCR_ID_IMPS_CHAT);
- if (cont_scr) /* contact list screen */
- {
- HistoryReplace(SCR_ID_IMPS_CONT, SCR_ID_IMPS_MAIN, mmi_imps_entry_main);
- mmi_imps_util_del_up_to_screen(SCR_ID_IMPS_MAIN);
- }
- else if (chat_scr) /* chat screen */
- {
- HistoryReplace(SCR_ID_IMPS_CHAT, SCR_ID_IMPS_MAIN, mmi_imps_entry_main);
- mmi_imps_util_del_up_to_screen(SCR_ID_IMPS_MAIN);
- }
- else
- {
- /* not in IMPS applpication, do nothing */
- }
- }
- mmi_imps_util_free_buff_when_logout();
- mmi_imps_reset_cntx();
- mmi_imps_util_update_login_icon();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_ready_ind
- * DESCRIPTION
- * Handler of IMPS task ready indication
- * PARAMETERS
- * msg [IN] Indication data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_ready_ind(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- imps_p->gen_info.ps_ready_state |= IMPS_LOGIN_PS_READY;
- /* because WiFi does not have and indication for now, we can not prevent
- the user to use IMPS without RAC ready, because WiFi can be used.
- A termporary solution would be add the RAC ready when PS ready.
- */
- /* #ifndef __MTK_TARGET__ */
- imps_p->gen_info.ps_ready_state |= IMPS_LOGIN_RAC_READY;
- /* #endif */
- mmi_imps_auto_login();
- }
- #ifdef IMPS_FOR_OMA_ONLY
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_broadcast_msg_req
- * DESCRIPTION
- * Braodcast message to a group
- * PARAMETERS
- * group_index [IN] Index of group
- * msg [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_broadcast_msg_req(S32 group_index, S8 *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_send_message_req_struct *req =
- (mmi_imps_send_message_req_struct*) OslConstructDataPtr(sizeof(mmi_imps_send_message_req_struct));
- S32 i, count;
- S32 no_cont = (S32) imps_p->cont_info.no_cont;
- U8 *group_id = &imps_p->group_info.group_list[group_index].group_id[0];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- req->message_id = 0;
- pfnUnicodeStrcpy((S8*) req->message_content, msg);
- for (i = 0, count = 0; i < no_cont; i++)
- {
- mmi_imps_cont_struct *cont = &imps_p->cont_info.cont_list[i];
- if (mmi_imps_util_is_id_same((S8*) cont->group_id, (S8*) group_id))
- {
- req->recipients.entity[count].entity_type = IMPS_ENTITY_TYPE_USER;
- strcpy((S8*) req->recipients.entity[count].id, (S8*) cont->id);
- count++;
- }
- }
- req->recipients.entity_count = (U8) count;
- SetProtocolEventHandler(mmi_imps_ps_broadcast_msg_rsp, MSG_ID_MMI_IMPS_SEND_MESSAGE_RSP);
- mmi_imps_ps_send_msg(MSG_ID_MMI_IMPS_SEND_MESSAGE_REQ, req, NULL);
- imps_p->gen_info.curr_action = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_broadcast_msg_rsp
- * DESCRIPTION
- * Response handler of braodcasting message to a group
- * PARAMETERS
- * msg [IN] Message of response
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_broadcast_msg_rsp(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetProtocolEventHandler(mmi_imps_ps_send_msg_rsp, MSG_ID_MMI_IMPS_SEND_MESSAGE_RSP);
- mmi_imps_group_broadcast_finished();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_subs_pa_rsp
- * DESCRIPTION
- * Handler for MSG_ID_MMI_IMPS_SUBS_PA_RSP
- * PARAMETERS
- * msg [IN] Result of response
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_subs_pa_rsp(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_subs_pa_rsp_struct *rsp = (mmi_imps_subs_pa_rsp_struct*) msg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_subscribe_pa_finished(rsp->result);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_subs_pa_req
- * DESCRIPTION
- * Send MSG_ID_MMI_IMPS_SUBS_PA_REQ to PS
- * PARAMETERS
- * id [IN] Id of contact to subscribe
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_subs_pa_req(S8 *id)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_subs_pa_req_struct *req =
- (mmi_imps_subs_pa_req_struct*) OslConstructDataPtr(sizeof(mmi_imps_subs_pa_req_struct));
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- imps_p->gen_info.curr_action = 0;
- IMPS_MEMSET(req, 0, mmi_imps_subs_pa_req_struct);
- req->subscribe_pa = IMPS_PA_ATTR_VALUE_NO_PIC;
- req->id_list.entity_count = 1;
- req->id_list.entity[0].entity_type = IMPS_ENTITY_TYPE_USER;
- strcpy((S8*) req->id_list.entity[0].id, (S8*) id);
- SetProtocolEventHandler(mmi_imps_ps_subs_pa_rsp, MSG_ID_MMI_IMPS_SUBS_PA_RSP);
- mmi_imps_ps_send_msg(MSG_ID_MMI_IMPS_SUBS_PA_REQ, req, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_unsubs_pa_req
- * DESCRIPTION
- * Send MSG_ID_MMI_IMPS_UNSUBS_PA_REQ to PS
- * PARAMETERS
- * id [IN] Id of contact to unsubscribe
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_unsubs_pa_req(S8 *id)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_unsubs_pa_req_struct *req =
- (mmi_imps_unsubs_pa_req_struct*) OslConstructDataPtr(sizeof(mmi_imps_unsubs_pa_req_struct));
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- imps_p->gen_info.curr_action = 0;
- IMPS_MEMSET(req, 0, mmi_imps_unsubs_pa_req_struct);
- req->user_id_list.entity_count = 1;
- req->user_id_list.entity[0].entity_type = IMPS_ENTITY_TYPE_USER;
- strcpy((S8*) req->user_id_list.entity[0].id, (S8*) id);
- SetProtocolEventHandler(mmi_imps_ps_subs_pa_rsp, MSG_ID_MMI_IMPS_UNSUBS_PA_RSP);
- mmi_imps_ps_send_msg(MSG_ID_MMI_IMPS_UNSUBS_PA_REQ, req, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_subs_group_pa_rsp
- * DESCRIPTION
- * Handler for mmi_imps_ps_subs_group_pa_rsp
- * PARAMETERS
- * msg [IN] Result of response
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_subs_group_pa_rsp(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_subs_pa_rsp_struct *rsp = (mmi_imps_subs_pa_rsp_struct*) msg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_util_disp_popup_done();
- DeleteScreenIfPresent(SCR_ID_IMPS_PROGRESS);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_ps_subs_group_pa_req
- * DESCRIPTION
- *
- * PARAMETERS
- * id [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_ps_subs_group_pa_req(U8 *id)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_subs_pa_req_struct *req =
- (mmi_imps_subs_pa_req_struct*) OslConstructDataPtr(sizeof(mmi_imps_subs_pa_req_struct));
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- imps_p->gen_info.curr_action = 0;
- IMPS_MEMSET(req, 0, mmi_imps_subs_pa_req_struct);
- req->subscribe_pa = IMPS_PA_ATTR_VALUE_NO_PIC;
- req->id_list.entity_count = 1;
- req->id_list.entity[0].entity_type = IMPS_ENTITY_TYPE_CONTACT_LIST;
- strcpy((S8*) req->id_list.entity[0].id, (S8*) id);
- SetProtocolEventHandler(mmi_imps_ps_subs_group_pa_rsp, MSG_ID_MMI_IMPS_SUBS_PA_RSP);
- mmi_imps_ps_send_msg(MSG_ID_MMI_IMPS_SUBS_PA_REQ, req, NULL);
- }
- #endif /* IMPS_FOR_OMA_ONLY */
- #endif /* MMI_ON_HARDWARE_P */
- #endif /* __MMI_IMPS__ */ /* #ifdef __MMI_IMPS__ */
- #endif /* _MMI_IMPS_PS_C */