2 * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include "MsgHandle.h"
21 #include "MsgException.h"
24 #include "msg_private.h"
25 #include "msg_storage.h"
28 static int msg_get_msg_type(int mainType, int subType);
29 /*==================================================================================================
30 FUNCTION IMPLEMENTATION
31 ==================================================================================================*/
32 EXPORT_API int msg_add_message(msg_handle_t handle, msg_struct_t opq_msg, const msg_struct_t send_opt)
34 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
37 if (handle == NULL || opq_msg == NULL || send_opt == NULL)
38 return MSG_ERR_INVALID_PARAMETER;
40 MsgHandle* pHandle = (MsgHandle*)handle;
42 msg_struct_s *pMsgStruct = (msg_struct_s *)opq_msg;
43 MSG_TYPE_CHECK(pMsgStruct->type, MSG_STRUCT_MESSAGE_INFO);
45 msg_struct_s *pStruct = (msg_struct_s *)send_opt;
46 MSG_TYPE_CHECK(pStruct->type, MSG_STRUCT_SENDOPT);
49 msg_id = pHandle->addMessage((MSG_MESSAGE_HIDDEN_S *)pMsgStruct->data, (MSG_SENDINGOPT_S *)pStruct->data);
50 } catch (MsgException& e) {
51 MSG_FATAL("%s", e.what());
52 return MSG_ERR_STORAGE_ERROR;
59 EXPORT_API int msg_add_syncml_message(msg_handle_t handle, const msg_struct_t syncml_msg)
61 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
62 msg_error_t err = MSG_SUCCESS;
64 if (handle == NULL || syncml_msg == NULL)
65 return MSG_ERR_INVALID_PARAMETER;
67 MsgHandle* pHandle = (MsgHandle*)handle;
68 msg_struct_s *pStruct = (msg_struct_s *)syncml_msg;
69 MSG_TYPE_CHECK(pStruct->type, MSG_STRUCT_SYNCML_INFO);
72 err = pHandle->addSyncMLMessage((MSG_SYNCML_MESSAGE_S *)pStruct->data);
73 } catch (MsgException& e) {
74 MSG_FATAL("%s", e.what());
75 return MSG_ERR_STORAGE_ERROR;
82 EXPORT_API int msg_update_message(msg_handle_t handle, const msg_struct_t opq_msg, const msg_struct_t send_opt)
84 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
85 msg_error_t err = MSG_SUCCESS;
87 if (handle == NULL || opq_msg == NULL || send_opt == NULL)
88 return MSG_ERR_INVALID_PARAMETER;
90 MsgHandle* pHandle = (MsgHandle*)handle;
92 msg_struct_s *pMsgStruct = (msg_struct_s *)opq_msg;
93 MSG_TYPE_CHECK(pMsgStruct->type, MSG_STRUCT_MESSAGE_INFO);
95 msg_struct_s* pStruct = (msg_struct_s *)send_opt;
96 MSG_TYPE_CHECK(pStruct->type, MSG_STRUCT_SENDOPT);
98 MSG_MESSAGE_HIDDEN_S *msg = (MSG_MESSAGE_HIDDEN_S *)pMsgStruct->data;
99 MSG_SENDINGOPT_S *sendingOpt = (MSG_SENDINGOPT_S *)pStruct->data;
102 err = pHandle->updateMessage(msg, sendingOpt);
103 } catch (MsgException& e) {
104 MSG_FATAL("%s", e.what());
105 return MSG_ERR_STORAGE_ERROR;
112 EXPORT_API int msg_update_read_status(msg_handle_t handle, msg_message_id_t msg_id, bool read)
114 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
115 msg_error_t err = MSG_SUCCESS;
118 return MSG_ERR_INVALID_PARAMETER;
120 MsgHandle* pHandle = (MsgHandle*)handle;
123 err = pHandle->updateReadStatus(msg_id, read);
124 } catch (MsgException& e) {
125 MSG_FATAL("%s", e.what());
126 return MSG_ERR_STORAGE_ERROR;
133 EXPORT_API int msg_set_conversation_to_read(msg_handle_t handle, msg_thread_id_t thread_id)
135 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
136 msg_error_t err = MSG_SUCCESS;
139 return MSG_ERR_INVALID_PARAMETER;
141 MsgHandle* pHandle = (MsgHandle*)handle;
144 err = pHandle->setConversationToRead(thread_id);
145 } catch (MsgException& e) {
146 MSG_FATAL("%s", e.what());
147 return MSG_ERR_STORAGE_ERROR;
154 EXPORT_API int msg_update_protected_status(msg_handle_t handle, msg_message_id_t msg_id, bool is_protected)
156 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
157 msg_error_t err = MSG_SUCCESS;
160 return MSG_ERR_INVALID_PARAMETER;
162 MsgHandle* pHandle = (MsgHandle*)handle;
165 err = pHandle->updateProtectedStatus(msg_id, is_protected);
166 } catch (MsgException& e) {
167 MSG_FATAL("%s", e.what());
168 return MSG_ERR_STORAGE_ERROR;
174 EXPORT_API int msg_delete_message(msg_handle_t handle, msg_message_id_t msg_id)
176 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
177 msg_error_t err = MSG_SUCCESS;
180 return MSG_ERR_INVALID_PARAMETER;
182 MsgHandle* pHandle = (MsgHandle*)handle;
185 err = pHandle->deleteMessage(msg_id);
186 } catch (MsgException& e) {
187 MSG_FATAL("%s", e.what());
188 return MSG_ERR_STORAGE_ERROR;
195 EXPORT_API int msg_delete_all_msgs_in_folder(msg_handle_t handle, msg_folder_id_t folder_id, bool bOnlyDB)
197 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
198 msg_error_t err = MSG_SUCCESS;
201 return MSG_ERR_INVALID_PARAMETER;
203 MsgHandle* pHandle = (MsgHandle*)handle;
206 err = pHandle->deleteAllMessagesInFolder(folder_id, bOnlyDB);
207 } catch (MsgException& e) {
208 MSG_FATAL("%s", e.what());
209 return MSG_ERR_STORAGE_ERROR;
216 EXPORT_API int msg_delete_msgs_by_list(msg_handle_t handle, msg_id_list_s *msg_id_list)
218 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
219 msg_error_t err = MSG_SUCCESS;
221 if (handle == NULL || msg_id_list == NULL)
222 return MSG_ERR_INVALID_PARAMETER;
224 MsgHandle* pHandle = (MsgHandle*)handle;
227 err = pHandle->deleteMessagesByList(msg_id_list);
228 } catch (MsgException& e) {
229 MSG_FATAL("%s", e.what());
230 return MSG_ERR_STORAGE_ERROR;
237 EXPORT_API int msg_move_msg_to_folder(msg_handle_t handle, msg_message_id_t msg_id, msg_folder_id_t dest_folder_id)
239 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
240 msg_error_t err = MSG_SUCCESS;
243 return MSG_ERR_INVALID_PARAMETER;
245 MsgHandle* pHandle = (MsgHandle*)handle;
248 err = pHandle->moveMessageToFolder(msg_id, dest_folder_id);
249 } catch (MsgException& e) {
250 MSG_FATAL("%s", e.what());
251 return MSG_ERR_STORAGE_ERROR;
258 EXPORT_API int msg_move_msg_to_storage(msg_handle_t handle, msg_message_id_t msg_id, msg_storage_id_t storage_id)
260 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
261 msg_error_t err = MSG_SUCCESS;
264 return MSG_ERR_INVALID_PARAMETER;
266 if (storage_id < MSG_STORAGE_PHONE || storage_id > MSG_STORAGE_SIM2) {
267 MSG_FATAL("unsupported storage [%d]", storage_id);
268 return MSG_ERR_INVALID_PARAMETER;
271 MsgHandle* pHandle = (MsgHandle*)handle;
274 err = pHandle->moveMessageToStorage(msg_id, storage_id);
275 } catch (MsgException& e) {
276 MSG_FATAL("%s", e.what());
277 return MSG_ERR_STORAGE_ERROR;
284 EXPORT_API int msg_count_message(msg_handle_t handle, msg_folder_id_t folder_id, msg_struct_t count_info)
286 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
287 msg_error_t err = MSG_SUCCESS;
289 if (handle == NULL || count_info == NULL)
290 return MSG_ERR_INVALID_PARAMETER;
292 MsgHandle* pHandle = (MsgHandle*)handle;
293 msg_struct_s *pStruct = (msg_struct_s *)count_info;
294 MSG_TYPE_CHECK(pStruct->type, MSG_STRUCT_COUNT_INFO);
297 err = pHandle->countMessage(folder_id, (MSG_COUNT_INFO_S *)pStruct->data);
298 } catch (MsgException& e) {
299 MSG_FATAL("%s", e.what());
300 return MSG_ERR_STORAGE_ERROR;
307 EXPORT_API int msg_count_msg_by_type(msg_handle_t handle, msg_message_type_t msg_type, int *msg_count)
309 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
310 msg_error_t err = MSG_SUCCESS;
312 if (handle == NULL || msg_count == NULL)
313 return MSG_ERR_INVALID_PARAMETER;
315 MsgHandle* pHandle = (MsgHandle*)handle;
317 MSG_MESSAGE_TYPE_S msgType = {0};
319 if (msg_type == MSG_TYPE_SMS) {
320 msgType.mainType = MSG_SMS_TYPE;
321 msgType.subType = MSG_NORMAL_SMS;
322 } else if (msg_type == MSG_TYPE_SMS_WAPPUSH) {
323 msgType.mainType = MSG_SMS_TYPE;
324 msgType.subType = MSG_WAP_SI_SMS;
325 } else if (msg_type == MSG_TYPE_MMS) {
326 msgType.mainType = MSG_MMS_TYPE;
327 msgType.subType = MSG_SENDREQ_MMS;
329 return MSG_ERR_INVALID_PARAMETER;
333 err = pHandle->countMsgByType(&msgType, msg_count);
334 } catch (MsgException& e) {
335 MSG_FATAL("%s", e.what());
336 return MSG_ERR_STORAGE_ERROR;
343 EXPORT_API int msg_count_msg_by_contact(msg_handle_t handle, const msg_struct_t addr_info, msg_struct_t msg_thread_count_list)
345 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
346 msg_error_t err = MSG_SUCCESS;
348 if (handle == NULL || addr_info == NULL || msg_thread_count_list == NULL)
349 return MSG_ERR_INVALID_PARAMETER;
351 MsgHandle* pHandle = (MsgHandle*)handle;
353 msg_struct_s *pAddr = (msg_struct_s *)addr_info;
354 MSG_TYPE_CHECK(pAddr->type, MSG_STRUCT_THREAD_LIST_INDEX);
356 msg_struct_s *pCount = (msg_struct_s *)msg_thread_count_list;
357 MSG_TYPE_CHECK(pCount->type, MSG_STRUCT_THREAD_COUNT_INFO);
360 err = pHandle->countMsgByContact((MSG_THREAD_LIST_INDEX_INFO_S *)pAddr->data, (MSG_THREAD_COUNT_INFO_S *)pCount->data);
361 } catch (MsgException& e) {
362 MSG_FATAL("%s", e.what());
363 return MSG_ERR_STORAGE_ERROR;
370 EXPORT_API int msg_get_message(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_t opq_msg, msg_struct_t send_opt)
372 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
373 msg_error_t err = MSG_SUCCESS;
375 if (handle == NULL || opq_msg == NULL || send_opt == NULL)
376 return MSG_ERR_INVALID_PARAMETER;
378 MsgHandle* pHandle = (MsgHandle*)handle;
380 msg_struct_s *pMsgStruct = (msg_struct_s *)opq_msg;
381 MSG_TYPE_CHECK(pMsgStruct->type, MSG_STRUCT_MESSAGE_INFO);
383 msg_struct_s *pStruct = (msg_struct_s *)send_opt;
384 MSG_TYPE_CHECK(pStruct->type, MSG_STRUCT_SENDOPT);
387 err = pHandle->getMessage(msg_id, (MSG_MESSAGE_HIDDEN_S *)pMsgStruct->data, (MSG_SENDINGOPT_S *)pStruct->data);
388 } catch (MsgException& e) {
389 MSG_FATAL("%s", e.what());
390 return MSG_ERR_STORAGE_ERROR;
396 EXPORT_API int msg_get_vobject_data(msg_handle_t handle, msg_message_id_t msg_id, void** result_data)
398 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
399 msg_error_t err = MSG_SUCCESS;
401 if (handle == NULL || result_data == NULL) {
402 MSG_FATAL("handle or result_data is NULL");
403 return MSG_ERR_INVALID_PARAMETER;
406 MsgHandle* pHandle = (MsgHandle*)handle;
409 err = pHandle->getVobject(msg_id, result_data);
410 } catch (MsgException& e) {
411 MSG_FATAL("%s", e.what());
412 return MSG_ERR_STORAGE_ERROR;
418 EXPORT_API int msg_get_conversation(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_t conv)
420 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
421 msg_error_t err = MSG_SUCCESS;
423 if (handle == NULL || conv == NULL) {
424 MSG_FATAL("handle or opq_msg is NULL");
425 return MSG_ERR_INVALID_PARAMETER;
428 MsgHandle* pHandle = (MsgHandle*)handle;
430 msg_struct_s *pMsgStruct = (msg_struct_s *)conv;
431 MSG_TYPE_CHECK(pMsgStruct->type, MSG_STRUCT_CONV_INFO);
434 err = pHandle->getConversationViewItem(msg_id, (MSG_CONVERSATION_VIEW_S *)pMsgStruct->data);
435 } catch (MsgException& e) {
436 MSG_FATAL("%s", e.what());
437 return MSG_ERR_STORAGE_ERROR;
443 EXPORT_API int msg_get_thread_view_list(msg_handle_t handle, const msg_struct_t sort_rule, msg_struct_list_s *msg_thread_view_list)
445 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
446 msg_error_t err = MSG_SUCCESS;
448 if (handle == NULL || msg_thread_view_list == NULL)
449 return MSG_ERR_INVALID_PARAMETER;
451 MsgHandle* pHandle = (MsgHandle*)handle;
452 msg_struct_s *pStruct =(msg_struct_s *)sort_rule;
454 MSG_TYPE_CHECK(pStruct->type, MSG_STRUCT_SORT_RULE);
457 if (pStruct == NULL) {
458 MSG_SORT_RULE_S sortRule = {0};
460 sortRule.sortType = MSG_SORT_BY_THREAD_DATE;
461 sortRule.bAscending = false;
463 err = pHandle->getThreadViewList(&sortRule, msg_thread_view_list);
465 err = pHandle->getThreadViewList((MSG_SORT_RULE_S *)pStruct->data, msg_thread_view_list);
467 } catch (MsgException& e) {
468 MSG_FATAL("%s", e.what());
469 return MSG_ERR_STORAGE_ERROR;
476 EXPORT_API int msg_get_conversation_view_list(msg_handle_t handle, msg_thread_id_t thread_id, msg_struct_list_s *msg_conv_view_list)
478 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
479 msg_error_t err = MSG_SUCCESS;
481 if (handle == NULL || msg_conv_view_list == NULL)
482 return MSG_ERR_INVALID_PARAMETER;
484 MsgHandle* pHandle = (MsgHandle*)handle;
487 err = pHandle->getConversationViewList(thread_id, msg_conv_view_list);
488 } catch (MsgException& e) {
489 MSG_FATAL("%s", e.what());
490 return MSG_ERR_STORAGE_ERROR;
497 EXPORT_API int msg_delete_thread_message_list(msg_handle_t handle, msg_thread_id_t thread_id, bool include_protected_msg)
499 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
500 msg_error_t err = MSG_SUCCESS;
503 return MSG_ERR_INVALID_PARAMETER;
505 MsgHandle* pHandle = (MsgHandle*)handle;
508 err = pHandle->deleteThreadMessageList(thread_id, include_protected_msg);
509 } catch (MsgException& e) {
510 MSG_FATAL("%s", e.what());
511 return MSG_ERR_STORAGE_ERROR;
518 EXPORT_API int msg_add_folder(msg_handle_t handle, const msg_struct_t folder_info)
520 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
521 msg_error_t err = MSG_SUCCESS;
523 if (handle == NULL || folder_info == NULL)
524 return MSG_ERR_INVALID_PARAMETER;
526 MsgHandle* pHandle = (MsgHandle*)handle;
527 msg_struct_s *pStruct = (msg_struct_s *)folder_info;
528 MSG_TYPE_CHECK(pStruct->type, MSG_STRUCT_FOLDER_INFO);
531 err = pHandle->addFolder((MSG_FOLDER_INFO_S *)pStruct->data);
532 } catch (MsgException& e) {
533 MSG_FATAL("%s", e.what());
534 return MSG_ERR_STORAGE_ERROR;
541 EXPORT_API int msg_update_folder(msg_handle_t handle, const msg_struct_t folder_info)
543 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
544 msg_error_t err = MSG_SUCCESS;
546 if (handle == NULL || folder_info == NULL)
547 return MSG_ERR_INVALID_PARAMETER;
549 MsgHandle* pHandle = (MsgHandle*)handle;
550 msg_struct_s *pStruct = (msg_struct_s *)folder_info;
551 MSG_TYPE_CHECK(pStruct->type, MSG_STRUCT_FOLDER_INFO);
554 err = pHandle->updateFolder((MSG_FOLDER_INFO_S *)pStruct->data);
555 } catch (MsgException& e) {
556 MSG_FATAL("%s", e.what());
557 return MSG_ERR_STORAGE_ERROR;
564 EXPORT_API int msg_delete_folder(msg_handle_t handle, msg_folder_id_t folder_id)
566 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
567 msg_error_t err = MSG_SUCCESS;
570 return MSG_ERR_INVALID_PARAMETER;
572 MsgHandle* pHandle = (MsgHandle*)handle;
575 err = pHandle->deleteFolder(folder_id);
576 } catch (MsgException& e) {
577 MSG_FATAL("%s", e.what());
578 return MSG_ERR_STORAGE_ERROR;
585 EXPORT_API int msg_get_folder_list(msg_handle_t handle, msg_struct_list_s *folder_list)
587 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
588 msg_error_t err = MSG_SUCCESS;
590 if (handle == NULL || folder_list == NULL)
591 return MSG_ERR_INVALID_PARAMETER;
593 MsgHandle* pHandle = (MsgHandle*)handle;
596 err = pHandle->getFolderList(folder_list);
597 } catch (MsgException& e) {
598 MSG_FATAL("%s", e.what());
599 return MSG_ERR_STORAGE_ERROR;
606 EXPORT_API int msg_generate_message(msg_handle_t handle, msg_message_type_t msg_type, msg_folder_id_t folder_id, unsigned int num_msg)
608 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
610 if (handle == NULL) {
611 MSG_DEBUG("Handle is NULL");
612 return MSG_ERR_INVALID_PARAMETER;
615 if (msg_type >= MSG_MESSAGE_TYPE_MAX) {
616 MSG_DEBUG("msg_type is invalid [%d]", msg_type);
617 return MSG_ERR_INVALID_PARAMETER;
620 signed char folderId = (signed char)folder_id;
621 if (folderId >= MSG_MAX_FOLDER_ID) {
622 MSG_DEBUG("folderId is invalid [%d]", folder_id);
623 return MSG_ERR_INVALID_PARAMETER;
626 MSG_DEBUG("type : %d, folder : %d, num_msg : %d", msg_type, folder_id, num_msg);
629 MSG_SENDINGOPT_S sendingOpt = {0};
630 sendingOpt.bSetting = false;
632 char strMsg[20] = {0};
633 char prefix[10] ="0103001";
634 /* int postfix = 8111; */
639 msg_struct_s *msg_s = NULL;
640 msg_struct_s *addr_s = NULL;
641 MSG_MESSAGE_HIDDEN_S *msgInfo = NULL;
642 MSG_ADDRESS_INFO_S *addrInfo = NULL;
644 for (unsigned int i = 0; i < num_msg; i++) {
645 msg_s = (msg_struct_s *)msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
647 return MSG_ERR_NOT_SUPPORTED;
649 msgInfo = (MSG_MESSAGE_HIDDEN_S *)msg_s->data;
651 msgInfo->folderId = folder_id;
653 if (msg_type == MSG_TYPE_MMS) {
654 msgInfo->mainType = MSG_MMS_TYPE;
655 msgInfo->subType = MSG_SENDREQ_MMS;
657 msgInfo->mainType = MSG_SMS_TYPE;
658 msgInfo->subType = MSG_NORMAL_SMS;
660 snprintf(strMsg, sizeof(strMsg), "test msg %d", i);
661 msgInfo->dataSize = strlen(strMsg);
662 msgInfo->pData = (void*)new char[msgInfo->dataSize+1];
663 memcpy((char *)msgInfo->pData, strMsg, msgInfo->dataSize);
664 ((char*) msgInfo->pData)[msgInfo->dataSize] = '\0';
667 msgInfo->storageId = MSG_STORAGE_PHONE;
669 msgInfo->addr_list->nCount = 1;
671 addr_s = (msg_struct_s *)msgInfo->addr_list->msg_struct_info[0];
673 addrInfo = (MSG_ADDRESS_INFO_S *)addr_s->data;
675 addrInfo->addressType = MSG_ADDRESS_TYPE_PLMN;
676 postfix = random()%10000;
677 snprintf(addrInfo->addressVal, MAX_ADDRESS_VAL_LEN+1, "%s%04d", prefix, postfix);
679 addrInfo->recipientType = MSG_RECIPIENTS_TYPE_TO;
681 time(&(msgInfo->displayTime));
683 msgInfo->networkStatus = MSG_NETWORK_NOT_SEND;
684 msgInfo->bRead = false;
685 msgInfo->bProtected = false;
686 msgInfo->priority = MSG_MESSAGE_PRIORITY_NORMAL;
688 if (folder_id == MSG_OUTBOX_ID || folder_id == MSG_SENTBOX_ID)
689 msgInfo->direction = MSG_DIRECTION_TYPE_MO;
691 msgInfo->direction = MSG_DIRECTION_TYPE_MT;
693 if (msg_type == MSG_TYPE_MMS) {
694 snprintf(msgInfo->subject, MAX_SUBJECT_LEN+1, "subject %d", i);
696 if (folder_id == MSG_INBOX_ID)
697 msgInfo->networkStatus = MSG_NETWORK_RETRIEVE_SUCCESS;
699 msg_struct_t mms_data = msg_create_struct(MSG_STRUCT_MMS);
701 msg_set_mms_struct((msg_struct_t)msg_s, mms_data);
703 msg_release_struct(&mms_data);
706 /*err = msg_add_message(handle, (msg_message_t)&msgInfo, &sendingOpt);*/
708 MsgHandle* pHandle = (MsgHandle*)handle;
709 err = pHandle->addMessage(msgInfo, &sendingOpt);
710 } catch (MsgException& e) {
711 MSG_FATAL("%s", e.what());
712 msg_release_struct((msg_struct_t *)&msg_s);
713 return MSG_ERR_STORAGE_ERROR;
716 msg_release_struct((msg_struct_t *)&msg_s);
719 MSG_DEBUG("err [%d]", err);
728 EXPORT_API int msg_get_quick_panel_data(msg_handle_t handle, msg_quickpanel_type_t type, msg_struct_t opq_msg)
730 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
731 msg_error_t err = MSG_SUCCESS;
733 if (handle == NULL || opq_msg == NULL) {
734 MSG_FATAL("handle or opq_msg is NULL");
735 return MSG_ERR_INVALID_PARAMETER;
738 if (type > MSG_QUICKPANEL_MMS_NOTI) {
739 MSG_FATAL("unsupported quickpanel type [%d]", type);
740 return MSG_ERR_INVALID_PARAMETER;
743 MsgHandle* pHandle = (MsgHandle*)handle;
744 msg_struct_s *pMsg = (msg_struct_s *)opq_msg;
745 MSG_TYPE_CHECK(pMsg->type, MSG_STRUCT_MESSAGE_INFO);
748 err = pHandle->getQuickPanelData(type, (MSG_MESSAGE_HIDDEN_S *)pMsg->data);
749 } catch (MsgException& e) {
750 MSG_FATAL("%s", e.what());
751 return MSG_ERR_STORAGE_ERROR;
758 EXPORT_API int msg_reset_database(msg_handle_t handle)
760 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
761 msg_error_t err = MSG_SUCCESS;
764 return MSG_ERR_INVALID_PARAMETER;
766 MsgHandle* pHandle = (MsgHandle*)handle;
769 err = pHandle->resetDatabase();
770 } catch (MsgException& e) {
771 MSG_FATAL("%s", e.what());
772 return MSG_ERR_STORAGE_ERROR;
779 EXPORT_API int msg_get_mem_size(msg_handle_t handle, unsigned int* memsize)
781 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
782 msg_error_t err = MSG_SUCCESS;
784 if (handle == NULL || memsize == NULL)
785 return MSG_ERR_INVALID_PARAMETER;
787 MsgHandle* pHandle = (MsgHandle*)handle;
790 err = pHandle->getMemSize(memsize);
791 } catch (MsgException& e) {
792 MSG_FATAL("%s", e.what());
793 return MSG_ERR_STORAGE_ERROR;
799 EXPORT_API int msg_backup_message(msg_handle_t handle, msg_message_backup_type_t type, const char *backup_filepath)
801 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
802 msg_error_t err = MSG_SUCCESS;
804 if (handle == NULL || backup_filepath == NULL)
805 return MSG_ERR_INVALID_PARAMETER;
807 MsgHandle* pHandle = (MsgHandle*)handle;
810 err = pHandle->backupMessage(type, backup_filepath);
811 } catch (MsgException& e) {
812 MSG_FATAL("%s", e.what());
813 return MSG_ERR_STORAGE_ERROR;
820 EXPORT_API int msg_restore_message(msg_handle_t handle, const char *backup_filepath)
822 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
823 msg_error_t err = MSG_SUCCESS;
825 if (handle == NULL || backup_filepath == NULL)
826 return MSG_ERR_INVALID_PARAMETER;
828 MsgHandle* pHandle = (MsgHandle*)handle;
831 err = pHandle->restoreMessage(backup_filepath);
832 } catch (MsgException& e) {
833 MSG_FATAL("%s", e.what());
834 return MSG_ERR_STORAGE_ERROR;
841 EXPORT_API int msg_search_message_for_thread_view(msg_handle_t handle, const char *search_string, msg_struct_list_s *msg_thread_view_list)
843 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
844 msg_error_t err = MSG_SUCCESS;
846 if (handle == NULL || search_string == NULL || msg_thread_view_list == NULL)
847 return MSG_ERR_INVALID_PARAMETER;
849 if (strlen(search_string) <= 0 || strlen(search_string) > MAX_MSG_TEXT_LEN)
850 return MSG_ERR_INVALID_PARAMETER;
852 MsgHandle* pHandle = (MsgHandle*)handle;
855 err = pHandle->searchMessage(search_string, msg_thread_view_list);
856 } catch (MsgException& e) {
857 MSG_FATAL("%s", e.what());
858 return MSG_ERR_STORAGE_ERROR;
865 EXPORT_API int msg_db_select_with_query(msg_handle_t handle, const char *query, char ***db_res, int *row_count, int *col_count)
867 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
868 msg_error_t err = MSG_SUCCESS;
870 if (handle == NULL || query == NULL || db_res == NULL || row_count == NULL || col_count == NULL)
871 return MSG_ERR_INVALID_PARAMETER;
873 MsgHandle* pHandle = (MsgHandle*)handle;
876 err = pHandle->dbSelectWithQuery(query, db_res, row_count, col_count);
877 } catch (MsgException& e) {
878 MSG_FATAL("%s", e.what());
879 return MSG_ERR_STORAGE_ERROR;
886 EXPORT_API int msg_db_free(msg_handle_t handle, char **db_res)
888 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
890 if (handle == NULL || db_res == NULL)
891 return MSG_ERR_INVALID_PARAMETER;
893 MsgHandle* pHandle = (MsgHandle*)handle;
896 pHandle->dbFree(db_res);
897 } catch (MsgException& e) {
898 MSG_FATAL("%s", e.what());
899 return MSG_ERR_STORAGE_ERROR;
907 EXPORT_API int msg_get_reject_msg_list(msg_handle_t handle, const char *phone_num, msg_struct_list_s *msg_reject_msg_list)
909 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
910 msg_error_t err = MSG_SUCCESS;
912 if (handle == NULL || msg_reject_msg_list == NULL)
913 return MSG_ERR_INVALID_PARAMETER;
915 MsgHandle* pHandle = (MsgHandle*)handle;
918 err = pHandle->getRejectMsgList(phone_num, msg_reject_msg_list);
919 } catch (MsgException& e) {
920 MSG_FATAL("%s", e.what());
921 return MSG_ERR_STORAGE_ERROR;
928 EXPORT_API int msg_reg_storage_change_callback(msg_handle_t handle, msg_storage_change_cb cb, void *user_param)
930 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
931 msg_error_t err = MSG_SUCCESS;
933 if (handle == NULL || cb == NULL)
934 return MSG_ERR_INVALID_PARAMETER;
936 MsgHandle* pHandle = (MsgHandle*)handle;
939 err = pHandle->regStorageChangeCallback(cb, user_param);
940 } catch (MsgException& e) {
941 MSG_FATAL("%s", e.what());
942 if (e.errorCode() == MsgException::SERVER_READY_ERROR)
943 return MSG_ERR_PERMISSION_DENIED;
945 return MSG_ERR_CALLBACK_ERROR;
951 EXPORT_API int msg_get_report_status(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_list_s *report_list)
953 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
954 msg_error_t err = MSG_SUCCESS;
956 if (handle == NULL || msg_id < 1 || report_list == NULL)
957 return MSG_ERR_INVALID_PARAMETER;
959 MsgHandle* pHandle = (MsgHandle*)handle;
962 err = pHandle->getReportStatus(msg_id, report_list);
963 } catch (MsgException& e) {
964 MSG_FATAL("%s", e.what());
965 return MSG_ERR_STORAGE_ERROR;
971 EXPORT_API int msg_get_address_list(msg_handle_t handle, msg_thread_id_t thread_id, msg_struct_list_s *msg_address_list)
973 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
974 msg_error_t err = MSG_SUCCESS;
976 if (handle == NULL || msg_address_list == NULL)
977 return MSG_ERR_INVALID_PARAMETER;
979 MsgHandle* pHandle = (MsgHandle*)handle;
982 err = pHandle->getAddressList(thread_id, msg_address_list);
983 } catch (MsgException& e) {
984 MSG_FATAL("%s", e.what());
985 return MSG_ERR_STORAGE_ERROR;
992 EXPORT_API int msg_get_thread_id_by_address(msg_handle_t handle, msg_struct_list_s *msg_address_list, msg_thread_id_t *thread_id)
994 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
995 msg_error_t err = MSG_SUCCESS;
997 if (handle == NULL || msg_address_list == NULL || thread_id == NULL) {
998 return MSG_ERR_INVALID_PARAMETER;
1001 if (msg_address_list->nCount < 1 )
1002 return MSG_ERR_INVALID_PARAMETER;
1004 MsgHandle* pHandle = (MsgHandle*)handle;
1007 err = pHandle->getThreadIdByAddress(msg_address_list, thread_id);
1008 } catch (MsgException& e) {
1009 MSG_FATAL("%s", e.what());
1010 return MSG_ERR_STORAGE_ERROR;
1017 EXPORT_API int msg_get_thread_id_by_address2(msg_handle_t handle, msg_list_handle_t msg_address_list, msg_thread_id_t *thread_id)
1019 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
1020 msg_error_t err = MSG_SUCCESS;
1022 if (handle == NULL || msg_address_list == NULL || thread_id == NULL)
1023 return MSG_ERR_INVALID_PARAMETER;
1025 MsgHandle* pHandle = (MsgHandle*)handle;
1028 err = pHandle->getThreadIdByAddress(msg_address_list, thread_id);
1029 } catch (MsgException& e) {
1030 MSG_FATAL("%s", e.what());
1031 return MSG_ERR_STORAGE_ERROR;
1038 EXPORT_API int msg_get_thread(msg_handle_t handle, msg_thread_id_t thread_id, msg_struct_t msg_thread)
1040 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
1041 msg_error_t err = MSG_SUCCESS;
1043 if (handle == NULL || msg_thread == NULL) {
1044 MSG_FATAL("handle or msg_thread is NULL");
1045 return MSG_ERR_INVALID_PARAMETER;
1048 MsgHandle* pHandle = (MsgHandle*)handle;
1049 msg_struct_s *msgThread = (msg_struct_s *)msg_thread;
1050 MSG_TYPE_CHECK(msgThread->type, MSG_STRUCT_THREAD_INFO);
1052 MSG_THREAD_VIEW_S* pThreadInfo = (MSG_THREAD_VIEW_S *)msgThread->data;
1055 err = pHandle->getThread(thread_id, pThreadInfo);
1056 } catch (MsgException& e) {
1057 MSG_FATAL("%s", e.what());
1058 return MSG_ERR_STORAGE_ERROR;
1064 EXPORT_API int msg_get_message_list2(msg_handle_t handle, const msg_struct_t msg_list_conditions, msg_struct_list_s *msg_list)
1066 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
1067 msg_error_t err = MSG_SUCCESS;
1069 if (handle == NULL || msg_list_conditions == NULL || msg_list == NULL)
1070 return MSG_ERR_INVALID_PARAMETER;
1072 MsgHandle* pHandle = (MsgHandle*)handle;
1073 msg_struct_s *pStruct = (msg_struct_s *)msg_list_conditions;
1074 MSG_TYPE_CHECK(pStruct->type, MSG_STRUCT_MSG_LIST_CONDITION);
1077 err = pHandle->getMessageList((MSG_LIST_CONDITION_S *)pStruct->data, msg_list);
1078 } catch (MsgException& e) {
1079 MSG_FATAL("%s", e.what());
1080 return MSG_ERR_STORAGE_ERROR;
1086 EXPORT_API int msg_get_media_list(msg_handle_t handle, msg_thread_id_t thread_id, msg_list_handle_t *msg_list)
1088 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_MMS_FEATURE);
1089 msg_error_t err = MSG_SUCCESS;
1091 if (handle == NULL || msg_list == NULL)
1092 return MSG_ERR_INVALID_PARAMETER;
1094 MsgHandle* pHandle = (MsgHandle*)handle;
1097 err = pHandle->getMediaList(thread_id, msg_list);
1098 } catch (MsgException& e) {
1099 MSG_FATAL("%s", e.what());
1100 return MSG_ERR_STORAGE_ERROR;
1107 static int msg_get_msg_type(int mainType, int subType)
1109 if (mainType == MSG_SMS_TYPE) {
1112 return MSG_TYPE_SMS_CB;
1113 case MSG_JAVACB_SMS:
1114 return MSG_TYPE_SMS_JAVACB;
1115 case MSG_WAP_SI_SMS:
1116 case MSG_WAP_SL_SMS:
1117 return MSG_TYPE_SMS_WAPPUSH;
1118 case MSG_MWI_VOICE_SMS:
1119 case MSG_MWI_FAX_SMS:
1120 case MSG_MWI_EMAIL_SMS:
1121 case MSG_MWI_OTHER_SMS:
1122 return MSG_TYPE_SMS_MWI;
1124 return MSG_TYPE_SMS_SYNCML;
1125 case MSG_REJECT_SMS:
1126 return MSG_TYPE_SMS_REJECT;
1128 return MSG_TYPE_SMS_ETWS_PRIMARY;
1129 case MSG_CMAS_PRESIDENTIAL:
1130 return MSG_TYPE_SMS_CMAS_PRESIDENTIAL;
1131 case MSG_CMAS_EXTREME:
1132 return MSG_TYPE_SMS_CMAS_EXTREME;
1133 case MSG_CMAS_SEVERE:
1134 return MSG_TYPE_SMS_CMAS_SEVERE;
1135 case MSG_CMAS_AMBER:
1136 return MSG_TYPE_SMS_CMAS_AMBER;
1138 return MSG_TYPE_SMS_CMAS_TEST;
1139 case MSG_CMAS_EXERCISE:
1140 return MSG_TYPE_SMS_CMAS_EXERCISE;
1141 case MSG_CMAS_OPERATOR_DEFINED:
1142 return MSG_TYPE_SMS_CMAS_OPERATOR_DEFINED;
1144 return MSG_TYPE_SMS;
1146 } else if (mainType == MSG_MMS_TYPE) {
1147 if (subType == MSG_NOTIFICATIONIND_MMS)
1148 return MSG_TYPE_MMS_NOTI;
1149 else if (subType == MSG_SENDREQ_JAVA_MMS)
1150 return MSG_TYPE_MMS_JAVA;
1152 return MSG_TYPE_MMS;
1154 return MSG_TYPE_INVALID;
1159 int msg_syncml_info_get_int(void *syncml_info, int field, int *value)
1162 return MSG_ERR_NULL_POINTER;
1164 int ret = MSG_SUCCESS;
1166 MSG_SYNCML_MESSAGE_S *pSync = (MSG_SYNCML_MESSAGE_S *)syncml_info;
1169 case MSG_SYNCML_INFO_EXTID_INT:
1170 *value = pSync->extId;
1172 case MSG_SYNCML_INFO_PINCODE_INT:
1173 *value = pSync->pinCode;
1176 ret = MSG_ERR_INVALID_PARAMETER;
1183 int msg_count_info_get_int(void *count_info, int field, int *value)
1186 return MSG_ERR_NULL_POINTER;
1188 int ret = MSG_SUCCESS;
1190 MSG_COUNT_INFO_S *pCount = (MSG_COUNT_INFO_S *)count_info;
1193 case MSG_COUNT_INFO_READ_INT:
1194 *value = pCount->nReadCnt;
1196 case MSG_COUNT_INFO_UNREAD_INT:
1197 *value = pCount->nUnreadCnt;
1199 case MSG_COUNT_INFO_SMS_INT:
1200 *value = pCount->nSms;
1202 case MSG_COUNT_INFO_MMS_INT:
1203 *value = pCount->nMms;
1206 ret = MSG_ERR_INVALID_PARAMETER;
1213 int msg_thread_count_get_int(void *count_info, int field, int *value)
1216 return MSG_ERR_NULL_POINTER;
1218 int ret = MSG_SUCCESS;
1220 MSG_THREAD_COUNT_INFO_S *pCount = (MSG_THREAD_COUNT_INFO_S *)count_info;
1223 case MSG_THREAD_COUNT_TOTAL_INT:
1224 *value = pCount->totalCount;
1226 case MSG_THREAD_COUNT_UNREAD_INT:
1227 *value = pCount->unReadCount;
1229 case MSG_THREAD_COUNT_SMS_INT:
1230 *value = pCount->smsMsgCount;
1232 case MSG_THREAD_COUNT_MMS_INT:
1233 *value = pCount->mmsMsgCount;
1236 ret = MSG_ERR_INVALID_PARAMETER;
1243 int msg_thread_index_get_int(void *index_info, int field, int *value)
1246 return MSG_ERR_NULL_POINTER;
1248 int ret = MSG_SUCCESS;
1250 MSG_THREAD_LIST_INDEX_S *pIndex = (MSG_THREAD_LIST_INDEX_S *)index_info;
1252 case MSG_THREAD_LIST_INDEX_CONTACTID_INT:
1253 *value = pIndex->contactId;
1256 ret = MSG_ERR_INVALID_PARAMETER;
1263 int msg_sortrule_get_int(void *sort_info, int field, int *value)
1266 return MSG_ERR_NULL_POINTER;
1268 int ret = MSG_SUCCESS;
1270 MSG_SORT_RULE_S *pSort = (MSG_SORT_RULE_S *)sort_info;
1273 case MSG_SORT_RULE_SORT_TYPE_INT:
1274 *value = pSort->sortType;
1277 ret = MSG_ERR_INVALID_PARAMETER;
1284 int msg_folder_info_get_int(void *folder_info, int field, int *value)
1287 return MSG_ERR_NULL_POINTER;
1289 int ret = MSG_SUCCESS;
1291 MSG_FOLDER_INFO_S *pFolder = (MSG_FOLDER_INFO_S *)folder_info;
1294 case MSG_FOLDER_INFO_ID_INT:
1295 *value = pFolder->folderId;
1297 case MSG_FOLDER_INFO_TYPE_INT:
1298 *value = pFolder->folderType;
1301 ret = MSG_ERR_INVALID_PARAMETER;
1308 int msg_thread_info_get_int(void *data, int field, int *value)
1311 return MSG_ERR_NULL_POINTER;
1313 int ret = MSG_SUCCESS;
1315 MSG_THREAD_VIEW_S *pThread = (MSG_THREAD_VIEW_S *)data;
1318 case MSG_THREAD_ID_INT:
1319 *value = pThread->threadId;
1321 case MSG_THREAD_MSG_TYPE_INT:
1322 *value = msg_get_msg_type(pThread->mainType, pThread->subType);
1324 case MSG_THREAD_MSG_TIME_INT:
1325 *value = pThread->threadTime;
1327 case MSG_THREAD_DIRECTION_INT:
1328 *value = pThread->direction;
1330 case MSG_THREAD_UNREAD_COUNT_INT:
1331 *value = pThread->unreadCnt;
1333 case MSG_THREAD_SMS_COUNT_INT:
1334 *value = pThread->smsCnt;
1336 case MSG_THREAD_MMS_COUNT_INT:
1337 *value = pThread->mmsCnt;
1340 ret = MSG_ERR_INVALID_PARAMETER;
1348 int msg_conv_info_get_int(void *data, int field, int *value)
1351 return MSG_ERR_NULL_POINTER;
1353 int ret = MSG_SUCCESS;
1355 MSG_CONVERSATION_VIEW_S *pConv = (MSG_CONVERSATION_VIEW_S *)data;
1358 case MSG_CONV_MSG_ID_INT:
1359 *value = pConv->msgId;
1361 case MSG_CONV_MSG_THREAD_ID_INT:
1362 *value = pConv->threadId;
1364 case MSG_CONV_MSG_FOLDER_ID_INT:
1365 *value = pConv->folderId;
1367 case MSG_CONV_MSG_TYPE_INT:
1368 *value = msg_get_msg_type(pConv->mainType, pConv->subType);
1370 case MSG_CONV_MSG_STORAGE_ID_INT:
1371 *value = pConv->storageId;
1373 case MSG_CONV_MSG_DISPLAY_TIME_INT:
1374 *value = pConv->displayTime;
1376 case MSG_CONV_MSG_SCHEDULED_TIME_INT:
1377 *value = pConv->scheduledTime;
1379 case MSG_CONV_MSG_NETWORK_STATUS_INT:
1380 *value = pConv->networkStatus;
1382 case MSG_CONV_MSG_DIRECTION_INT:
1383 *value = pConv->direction;
1385 case MSG_CONV_MSG_ATTACH_COUNT_INT:
1386 *value = pConv->attachCount;
1388 case MSG_CONV_MSG_TEXT_SIZE_INT:
1389 *value = pConv->textSize;
1391 case MSG_CONV_MSG_PAGE_COUNT_INT:
1392 *value = pConv->pageCount;
1394 case MSG_CONV_MSG_TCS_BC_LEVEL_INT:
1395 *value = pConv->tcs_bc_level;
1397 case MSG_CONV_MSG_SIM_INDEX_INT:
1398 *value = pConv->simIndex;
1401 ret = MSG_ERR_INVALID_PARAMETER;
1409 int msg_list_condition_get_int(void *condition_info, int field, int *value)
1411 if (!condition_info)
1412 return MSG_ERR_NULL_POINTER;
1414 int ret = MSG_SUCCESS;
1416 MSG_LIST_CONDITION_S *pCond = (MSG_LIST_CONDITION_S *)condition_info;
1419 case MSG_LIST_CONDITION_FOLDER_ID_INT:
1420 *value = pCond->folderId;
1422 case MSG_LIST_CONDITION_THREAD_ID_INT:
1423 *value = pCond->threadId;
1425 case MSG_LIST_CONDITION_STORAGE_ID_INT:
1426 *value = pCond->storageId;
1428 case MSG_LIST_CONDITION_MSGTYPE_INT:
1429 *value = pCond->msgType;
1431 case MSG_LIST_CONDITION_FROM_TIME_INT:
1432 *value = pCond->fromTime;
1434 case MSG_LIST_CONDITION_TO_TIME_INT:
1435 *value = pCond->toTime;
1437 case MSG_LIST_CONDITION_OFFSET_INT:
1438 *value = pCond->offset;
1440 case MSG_LIST_CONDITION_LIMIT_INT:
1441 *value = pCond->limit;
1443 case MSG_LIST_CONDITION_SIM_INDEX_INT:
1444 *value = pCond->simIndex;
1447 ret = MSG_ERR_INVALID_PARAMETER;
1455 int msg_report_status_get_int(void *report_info, int field, int *value)
1458 return MSG_ERR_NULL_POINTER;
1460 int ret = MSG_SUCCESS;
1462 MSG_REPORT_STATUS_INFO_S *pReport = (MSG_REPORT_STATUS_INFO_S *)report_info;
1464 case MSG_REPORT_TYPE_INT:
1465 *value = pReport->type;
1467 case MSG_REPORT_STATUS_INT:
1468 *value = pReport->status;
1470 case MSG_REPORT_TIME_INT:
1471 *value = pReport->statusTime;
1474 ret = MSG_ERR_INVALID_PARAMETER;
1481 int msg_report_status_get_str(void *report_info, int field, char *value, int size)
1484 return MSG_ERR_NULL_POINTER;
1486 MSG_REPORT_STATUS_INFO_S *pReport = (MSG_REPORT_STATUS_INFO_S *)report_info;
1489 case MSG_REPORT_ADDRESS_STR:
1490 strncpy(value, pReport->addressVal, size);
1493 return MSG_ERR_INVALID_PARAMETER;
1498 int msg_folder_info_get_str(void *folder_info, int field, char *value, int size)
1501 return MSG_ERR_NULL_POINTER;
1503 MSG_FOLDER_INFO_S *pFolder = (MSG_FOLDER_INFO_S *)folder_info;
1506 case MSG_FOLDER_INFO_NAME_STR:
1507 strncpy(value, pFolder->folderName, size);
1510 return MSG_ERR_INVALID_PARAMETER;
1516 int msg_thread_info_get_str(void *data, int field, char *value, int size)
1519 return MSG_ERR_NULL_POINTER;
1521 MSG_THREAD_VIEW_S *pThread = (MSG_THREAD_VIEW_S *)data;
1524 case MSG_THREAD_NAME_STR:
1525 strncpy(value, pThread->threadName, size);
1527 case MSG_THREAD_MSG_DATA_STR:
1528 strncpy(value, pThread->threadData, size);
1531 return MSG_ERR_INVALID_PARAMETER;
1538 int msg_conv_info_get_str(void *data, int field, char *value, int size)
1541 return MSG_ERR_NULL_POINTER;
1543 MSG_CONVERSATION_VIEW_S *pConv = (MSG_CONVERSATION_VIEW_S *)data;
1546 case MSG_CONV_MSG_SUBJECT_STR:
1547 strncpy(value, pConv->subject, size);
1549 case MSG_CONV_MSG_ATTACH_NAME_STR:
1550 strncpy(value, pConv->attachFileName, size);
1552 case MSG_CONV_MSG_AUDIO_NAME_STR:
1553 strncpy(value, pConv->audioFileName, size);
1555 case MSG_CONV_MSG_IMAGE_THUMB_PATH_STR:
1556 strncpy(value, pConv->imageThumbPath, size);
1558 case MSG_CONV_MSG_VIDEO_THUMB_PATH_STR:
1559 strncpy(value, pConv->videoThumbPath, size);
1561 case MSG_CONV_MSG_TEXT_STR:
1563 strncpy(value, pConv->pText, size);
1565 case MSG_CONV_MSG_1ST_MEDIA_PATH_STR:
1566 strncpy(value, pConv->firstMediaPath, size);
1569 return MSG_ERR_INVALID_PARAMETER;
1576 int msg_list_condition_get_str(void *condition_info, int field, char *value, int size)
1578 if (!condition_info)
1579 return MSG_ERR_NULL_POINTER;
1581 MSG_LIST_CONDITION_S *cond = (MSG_LIST_CONDITION_S *)condition_info;
1584 case MSG_LIST_CONDITION_ADDRESS_VALUE_STR:
1585 if (cond->pAddressVal)
1586 strncpy(value, cond->pAddressVal, size);
1588 case MSG_LIST_CONDITION_TEXT_VALUE_STR:
1590 strncpy(value, cond->pTextVal, size);
1593 return MSG_ERR_INVALID_PARAMETER;
1600 int msg_sendopt_get_bool(void *send_opt, int field, bool *value)
1603 return MSG_ERR_NULL_POINTER;
1605 int ret = MSG_SUCCESS;
1607 MSG_SENDINGOPT_S *sendopt = (MSG_SENDINGOPT_S *)send_opt;
1610 case MSG_SEND_OPT_SETTING_BOOL:
1611 *value = sendopt->bSetting;
1613 case MSG_SEND_OPT_KEEPCOPY_BOOL:
1614 *value = sendopt->bKeepCopy;
1616 case MSG_SEND_OPT_DELIVER_REQ_BOOL:
1617 *value = sendopt->bDeliverReq;
1620 ret = MSG_ERR_INVALID_PARAMETER;
1627 int msg_sortrule_get_bool(void *sort_rule, int field, bool *value)
1630 return MSG_ERR_NULL_POINTER;
1632 int ret = MSG_SUCCESS;
1634 MSG_SORT_RULE_S *pSort = (MSG_SORT_RULE_S *)sort_rule;
1637 case MSG_SORT_RULE_ACSCEND_BOOL:
1638 *value = pSort->bAscending;
1641 ret = MSG_ERR_INVALID_PARAMETER;
1648 int msg_conv_get_bool(void *data, int field, bool *value)
1651 return MSG_ERR_NULL_POINTER;
1653 int ret = MSG_SUCCESS;
1655 MSG_CONVERSATION_VIEW_S *pConv = (MSG_CONVERSATION_VIEW_S *)data;
1658 case MSG_CONV_MSG_READ_BOOL:
1659 *value = pConv->bRead;
1661 case MSG_CONV_MSG_PROTECTED_BOOL:
1662 *value = pConv->bProtected;
1664 case MSG_CONV_MSG_DPM_RESTRICTED_BOOL:
1665 *value = pConv->bRestricted;
1668 ret = MSG_ERR_INVALID_PARAMETER;
1675 int msg_thread_info_get_bool(void *data, int field, bool *value)
1678 return MSG_ERR_NULL_POINTER;
1680 int ret = MSG_SUCCESS;
1682 MSG_THREAD_VIEW_S *pthreadInfo = (MSG_THREAD_VIEW_S *)data;
1685 case MSG_THREAD_PROTECTED_BOOL:
1686 *value = pthreadInfo->bProtected;
1688 case MSG_THREAD_DRAFT_BOOL:
1689 *value = pthreadInfo->bDraft;
1691 case MSG_THREAD_SEND_FAILED_BOOL:
1692 *value = pthreadInfo->bSendFailed;
1694 case MSG_THREAD_SENDING_BOOL:
1695 *value = pthreadInfo->bSending;
1698 ret = MSG_ERR_INVALID_PARAMETER;
1706 int msg_list_condition_get_bool(void *data, int field, bool *value)
1709 return MSG_ERR_NULL_POINTER;
1711 int ret = MSG_SUCCESS;
1713 MSG_LIST_CONDITION_S *pCond = (MSG_LIST_CONDITION_S *)data;
1716 case MSG_LIST_CONDITION_PROTECTED_BOOL:
1717 *value = pCond->bProtected;
1719 case MSG_LIST_CONDITION_SCHEDULED_BOOL:
1720 *value = pCond->bScheduled;
1722 case MSG_LIST_CONDITION_AND_OPERATER_BOOL:
1723 *value = pCond->bAnd;
1726 ret = MSG_ERR_INVALID_PARAMETER;
1734 int msg_sendopt_get_struct_handle(msg_struct_s *msg_struct, int field, void **value)
1736 msg_error_t err = MSG_SUCCESS;
1738 if (!msg_struct || !value)
1739 return MSG_ERR_NULL_POINTER;
1741 MSG_SENDINGOPT_S *sendopt = (MSG_SENDINGOPT_S *)msg_struct->data;
1744 case MSG_SEND_OPT_MMS_OPT_HND:
1745 *value = (void *)sendopt->mmsSendOpt;
1747 case MSG_SEND_OPT_SMS_OPT_HND:
1748 *value = (void *)sendopt->smsSendOpt;
1751 err = MSG_ERR_INVALID_PARAMETER;
1758 int msg_syncml_get_struct_handle(msg_struct_s *msg_struct, int field, void **value)
1760 msg_error_t err = MSG_SUCCESS;
1762 if (!msg_struct || !value)
1763 return MSG_ERR_NULL_POINTER;
1765 MSG_SYNCML_MESSAGE_S *pSync = (MSG_SYNCML_MESSAGE_S *)msg_struct->data;
1768 case MSG_SYNCML_INFO_MESSAGE_HND:
1769 *value = (void *)pSync->msg;
1772 err = MSG_ERR_INVALID_PARAMETER;
1779 int msg_thread_index_get_struct_handle(msg_struct_s *msg_struct, int field, void **value)
1781 msg_error_t err = MSG_SUCCESS;
1783 if (!msg_struct || !value)
1784 return MSG_ERR_NULL_POINTER;
1786 MSG_THREAD_LIST_INDEX_INFO_S *pIndex = (MSG_THREAD_LIST_INDEX_INFO_S *)msg_struct->data;
1789 case MSG_THREAD_LIST_INDEX_ADDR_INFO_HND:
1790 *value = (void *)pIndex->msgAddrInfo;
1793 err = MSG_ERR_INVALID_PARAMETER;
1801 int msg_list_condition_get_struct_handle(msg_struct_s *msg_struct, int field, void **value)
1803 msg_error_t err = MSG_SUCCESS;
1805 if (!msg_struct || !value)
1806 return MSG_ERR_NULL_POINTER;
1808 MSG_LIST_CONDITION_S *pCond = (MSG_LIST_CONDITION_S *)msg_struct->data;
1811 case MSG_LIST_CONDITION_SORT_RULE_HND:
1812 *value = (void *)pCond->sortRule;
1815 err = MSG_ERR_INVALID_PARAMETER;
1823 int msg_address_info_get_int(void *addr_info, int field, int *value)
1826 return MSG_ERR_NULL_POINTER;
1828 int ret = MSG_SUCCESS;
1830 MSG_ADDRESS_INFO_S *pAddr = (MSG_ADDRESS_INFO_S *)addr_info;
1833 case MSG_ADDRESS_INFO_ADDRESS_TYPE_INT:
1834 *value = pAddr->addressType;
1836 case MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT:
1837 *value = pAddr->recipientType;
1839 case MSG_ADDRESS_INFO_CONTACT_ID_INT:
1840 *value = pAddr->contactId;
1843 ret = MSG_ERR_INVALID_PARAMETER;
1850 int msg_mms_sendopt_get_int(void *opt_info, int field, int *value)
1853 return MSG_ERR_NULL_POINTER;
1855 int ret = MSG_SUCCESS;
1857 MMS_SENDINGOPT_S *pOpt = (MMS_SENDINGOPT_S *)opt_info;
1860 case MSG_MMS_SENDOPTION_EXPIRY_TIME_INT:
1861 *value = pOpt->expiryTime;
1863 case MSG_MMS_SENDOPTION_DELIVERY_TIME_INT:
1864 *value = pOpt->deliveryTime;
1866 case MSG_MMS_SENDOPTION_PRIORITY_INT:
1867 *value = pOpt->priority;
1870 ret = MSG_ERR_INVALID_PARAMETER;
1877 int msg_reject_message_get_int(void *msg_info, int field, int *value)
1880 return MSG_ERR_NULL_POINTER;
1882 int ret = MSG_SUCCESS;
1884 MSG_REJECT_MSG_INFO_S *pMsg = (MSG_REJECT_MSG_INFO_S *)msg_info;
1887 case MSG_REJECT_MESSAGE_MSGID_INT:
1888 *value = pMsg->msgId;
1890 case MSG_REJECT_MESSAGE_DISPLAY_TIME_INT:
1891 *value = pMsg->displayTime;
1894 ret = MSG_ERR_INVALID_PARAMETER;
1901 int msg_address_info_get_str(void *addr_info, int field, char *value, int size)
1904 return MSG_ERR_NULL_POINTER;
1906 MSG_ADDRESS_INFO_S *pAddr = (MSG_ADDRESS_INFO_S *)addr_info;
1909 case MSG_ADDRESS_INFO_ADDRESS_VALUE_STR:
1910 strncpy(value, pAddr->addressVal, size);
1912 case MSG_ADDRESS_INFO_DISPLAYNAME_STR:
1913 strncpy(value, pAddr->displayName, size);
1916 return MSG_ERR_INVALID_PARAMETER;
1922 int msg_reject_message_get_str(void *msg_info, int field, char *value, int size)
1925 return MSG_ERR_NULL_POINTER;
1927 MSG_REJECT_MSG_INFO_S *pMsg = (MSG_REJECT_MSG_INFO_S *)msg_info;
1930 case MSG_REJECT_MESSAGE_MSGTEXT_STR:
1931 strncpy(value, pMsg->msgText, size);
1934 return MSG_ERR_INVALID_PARAMETER;
1940 int msg_mms_sendopt_get_bool(void *opt_info, int field, bool *value)
1943 return MSG_ERR_NULL_POINTER;
1945 int ret = MSG_SUCCESS;
1947 MMS_SENDINGOPT_S *pOpt = (MMS_SENDINGOPT_S *)opt_info;
1950 case MSG_MMS_SENDOPTION_READ_REQUEST_BOOL:
1951 *value = pOpt->bReadReq;
1953 case MSG_MMS_SENDOPTION_DELIVERY_CUSTOMTIME_BOOL:
1954 *value = pOpt->bUseDeliveryCustomTime;
1957 ret = MSG_ERR_INVALID_PARAMETER;
1964 int msg_sms_sendopt_get_bool(void *opt_info, int field, bool *value)
1967 return MSG_ERR_NULL_POINTER;
1969 int ret = MSG_SUCCESS;
1971 SMS_SENDINGOPT_S *pOpt = (SMS_SENDINGOPT_S *)opt_info;
1974 case MSG_SMS_SENDOPT_REPLYPATH_BOOL:
1975 *value = pOpt->bReplyPath;
1978 ret = MSG_ERR_INVALID_PARAMETER;
1985 int msg_syncml_info_set_int(void *syncml_info, int field, int value)
1987 msg_error_t err = MSG_SUCCESS;
1990 return MSG_ERR_NULL_POINTER;
1992 MSG_SYNCML_MESSAGE_S *pSync = (MSG_SYNCML_MESSAGE_S *)syncml_info;
1995 case MSG_SYNCML_INFO_EXTID_INT:
1996 pSync->extId = value;
1998 case MSG_SYNCML_INFO_PINCODE_INT:
1999 pSync->pinCode = value;
2002 err = MSG_ERR_INVALID_PARAMETER;
2009 int msg_count_info_set_int(void *count_info, int field, int value)
2011 msg_error_t err = MSG_SUCCESS;
2014 return MSG_ERR_NULL_POINTER;
2016 MSG_COUNT_INFO_S *pCount = (MSG_COUNT_INFO_S *)count_info;
2019 case MSG_COUNT_INFO_READ_INT:
2020 pCount->nReadCnt = value;
2022 case MSG_COUNT_INFO_UNREAD_INT:
2023 pCount->nUnreadCnt = value;
2025 case MSG_COUNT_INFO_SMS_INT:
2026 pCount->nSms = value;
2028 case MSG_COUNT_INFO_MMS_INT:
2029 pCount->nMms = value;
2032 err = MSG_ERR_INVALID_PARAMETER;
2039 int msg_thread_count_set_int(void *count_info, int field, int value)
2041 msg_error_t err = MSG_SUCCESS;
2044 return MSG_ERR_NULL_POINTER;
2046 MSG_THREAD_COUNT_INFO_S *pCount = (MSG_THREAD_COUNT_INFO_S *)count_info;
2049 case MSG_THREAD_COUNT_TOTAL_INT:
2050 pCount->totalCount = value;
2052 case MSG_THREAD_COUNT_UNREAD_INT:
2053 pCount->unReadCount = value;
2055 case MSG_THREAD_COUNT_SMS_INT:
2056 pCount->smsMsgCount = value;
2058 case MSG_THREAD_COUNT_MMS_INT:
2059 pCount->mmsMsgCount = value;
2062 err = MSG_ERR_INVALID_PARAMETER;
2069 int msg_thread_index_set_int(void *index_info, int field, int value)
2071 msg_error_t err = MSG_SUCCESS;
2074 return MSG_ERR_NULL_POINTER;
2076 MSG_THREAD_LIST_INDEX_S *pIndex = (MSG_THREAD_LIST_INDEX_S *)index_info;
2079 case MSG_THREAD_LIST_INDEX_CONTACTID_INT:
2080 pIndex->contactId = value;
2083 err = MSG_ERR_INVALID_PARAMETER;
2090 int msg_sortrule_set_int(void *sort_info, int field, int value)
2092 msg_error_t err = MSG_SUCCESS;
2095 return MSG_ERR_NULL_POINTER;
2097 MSG_SORT_RULE_S *pSort = (MSG_SORT_RULE_S *)sort_info;
2100 case MSG_SORT_RULE_SORT_TYPE_INT:
2101 pSort->sortType = value;
2104 err = MSG_ERR_INVALID_PARAMETER;
2111 int msg_folder_info_set_int(void *folder_info, int field, int value)
2113 msg_error_t err = MSG_SUCCESS;
2116 return MSG_ERR_NULL_POINTER;
2118 MSG_FOLDER_INFO_S *pFolder = (MSG_FOLDER_INFO_S *)folder_info;
2121 case MSG_FOLDER_INFO_ID_INT:
2122 pFolder->folderId = value;
2124 case MSG_FOLDER_INFO_TYPE_INT:
2125 pFolder->folderType = value;
2128 err = MSG_ERR_INVALID_PARAMETER;
2136 int msg_list_condition_set_int(void *condition_info, int field, int value)
2138 msg_error_t err = MSG_SUCCESS;
2140 if (!condition_info)
2141 return MSG_ERR_NULL_POINTER;
2143 MSG_LIST_CONDITION_S *pCond = (MSG_LIST_CONDITION_S *)condition_info;
2146 case MSG_LIST_CONDITION_FOLDER_ID_INT:
2147 pCond->folderId = value;
2149 case MSG_LIST_CONDITION_THREAD_ID_INT:
2150 pCond->threadId = value;
2152 case MSG_LIST_CONDITION_STORAGE_ID_INT:
2153 pCond->storageId = value;
2155 case MSG_LIST_CONDITION_MSGTYPE_INT:
2156 pCond->msgType = value;
2158 case MSG_LIST_CONDITION_FROM_TIME_INT:
2159 pCond->fromTime = value;
2161 case MSG_LIST_CONDITION_TO_TIME_INT:
2162 pCond->toTime = value;
2164 case MSG_LIST_CONDITION_OFFSET_INT:
2165 pCond->offset = value;
2167 case MSG_LIST_CONDITION_LIMIT_INT:
2168 pCond->limit = value;
2170 case MSG_LIST_CONDITION_SIM_INDEX_INT:
2171 pCond->simIndex = value;
2174 err = MSG_ERR_INVALID_PARAMETER;
2182 int msg_report_status_set_int(void *report_info, int field, int value)
2184 msg_error_t err = MSG_SUCCESS;
2187 return MSG_ERR_NULL_POINTER;
2189 MSG_REPORT_STATUS_INFO_S *pReport = (MSG_REPORT_STATUS_INFO_S *)report_info;
2192 case MSG_REPORT_TYPE_INT:
2193 pReport->type = value;
2195 case MSG_REPORT_STATUS_INT:
2196 pReport->status = value;
2198 case MSG_REPORT_TIME_INT:
2199 pReport->statusTime = value;
2202 err = MSG_ERR_INVALID_PARAMETER;
2209 int msg_folder_info_set_str(void *folder_info, int field, const char *value, int size)
2211 msg_error_t err = MSG_SUCCESS;
2213 if (!folder_info || !value)
2214 return MSG_ERR_NULL_POINTER;
2216 MSG_FOLDER_INFO_S *pFolder = (MSG_FOLDER_INFO_S *)folder_info;
2219 (size > MAX_FOLDER_NAME_SIZE)? _len = MAX_FOLDER_NAME_SIZE : _len = size;
2222 case MSG_FOLDER_INFO_NAME_STR:
2223 strncpy(pFolder->folderName, value, _len);
2226 err = MSG_ERR_INVALID_PARAMETER;
2234 int msg_list_condition_set_str(void *condition_info, int field, const char *value, int size)
2236 msg_error_t err = MSG_SUCCESS;
2238 if (!condition_info || !value)
2239 return MSG_ERR_NULL_POINTER;
2242 return MSG_ERR_INVALID_PARAMETER;
2245 MSG_LIST_CONDITION_S *cond = (MSG_LIST_CONDITION_S *)condition_info;
2248 case MSG_LIST_CONDITION_ADDRESS_VALUE_STR:
2250 if (cond->pAddressVal) {
2251 delete [] cond->pAddressVal;
2252 cond->pAddressVal = NULL;
2254 cond->pAddressVal = (char *)new char[size+1];
2255 memset(cond->pAddressVal, 0x00, sizeof(char)*(size+1));
2256 if (cond->pAddressVal)
2257 memcpy(cond->pAddressVal, value, sizeof(char)*size);
2259 return MSG_ERR_MEMORY_ERROR;
2262 case MSG_LIST_CONDITION_TEXT_VALUE_STR:
2264 if (cond->pTextVal) {
2265 delete [] cond->pTextVal;
2266 cond->pTextVal = NULL;
2268 cond->pTextVal = (char *)new char[size+1];
2269 memset(cond->pTextVal, 0x00, sizeof(char)*(size+1));
2271 memcpy(cond->pTextVal, value, sizeof(char)*size);
2273 return MSG_ERR_MEMORY_ERROR;
2277 err = MSG_ERR_INVALID_PARAMETER;
2285 int msg_sendopt_set_bool(void *send_opt, int field, bool value)
2287 msg_error_t err = MSG_SUCCESS;
2290 return MSG_ERR_NULL_POINTER;
2292 MSG_SENDINGOPT_S *sendopt = (MSG_SENDINGOPT_S *)send_opt;
2295 case MSG_SEND_OPT_SETTING_BOOL:
2296 sendopt->bSetting = value;
2298 case MSG_SEND_OPT_KEEPCOPY_BOOL:
2299 sendopt->bKeepCopy = value;
2301 case MSG_SEND_OPT_DELIVER_REQ_BOOL:
2302 sendopt->bDeliverReq = value;
2305 err = MSG_ERR_UNKNOWN;
2312 int msg_sortrule_set_bool(void *sort_rule, int field, bool value)
2314 msg_error_t err = MSG_SUCCESS;
2317 return MSG_ERR_NULL_POINTER;
2319 MSG_SORT_RULE_S *pSort = (MSG_SORT_RULE_S *)sort_rule;
2322 case MSG_SORT_RULE_ACSCEND_BOOL:
2323 pSort->bAscending = value;
2326 err = MSG_ERR_UNKNOWN;
2334 int msg_list_condition_set_bool(void *data, int field, bool value)
2336 msg_error_t err = MSG_SUCCESS;
2339 return MSG_ERR_NULL_POINTER;
2341 MSG_LIST_CONDITION_S *pCond = (MSG_LIST_CONDITION_S *)data;
2344 case MSG_LIST_CONDITION_PROTECTED_BOOL:
2345 pCond->bProtected = value;
2347 case MSG_LIST_CONDITION_SCHEDULED_BOOL:
2348 pCond->bScheduled = value;
2350 case MSG_LIST_CONDITION_AND_OPERATER_BOOL:
2351 pCond->bAnd = value;
2354 err = MSG_ERR_UNKNOWN;
2362 int msg_sendopt_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s *value)
2364 msg_error_t err = MSG_SUCCESS;
2366 if (!msg_struct || !value)
2367 return MSG_ERR_NULL_POINTER;
2369 MSG_SENDINGOPT_S *sendopt = (MSG_SENDINGOPT_S *)msg_struct->data;
2370 msg_struct_s *pTmp = NULL;
2373 case MSG_SEND_OPT_MMS_OPT_HND:
2374 pTmp = (msg_struct_s *)sendopt->mmsSendOpt;
2375 memcpy(pTmp->data, value->data, sizeof(MMS_SENDINGOPT_INFO_S));
2377 case MSG_SEND_OPT_SMS_OPT_HND:
2378 pTmp = (msg_struct_s *)sendopt->smsSendOpt;
2379 memcpy(pTmp->data, value->data, sizeof(SMS_SENDINGOPT_INFO_S));
2382 err = MSG_ERR_UNKNOWN;
2389 int msg_syncml_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s *value)
2391 msg_error_t err = MSG_SUCCESS;
2393 if (!msg_struct || !value)
2394 return MSG_ERR_NULL_POINTER;
2396 MSG_SYNCML_MESSAGE_S *pSync = (MSG_SYNCML_MESSAGE_S *)msg_struct->data;
2397 msg_struct_s *pTmp = NULL;
2400 case MSG_SYNCML_INFO_MESSAGE_HND: {
2401 pTmp = (msg_struct_s *)pSync->msg;
2402 MSG_MESSAGE_HIDDEN_S *pSrc = (MSG_MESSAGE_HIDDEN_S *)value->data;
2403 MSG_MESSAGE_HIDDEN_S *pDst = (MSG_MESSAGE_HIDDEN_S *)pTmp->data;
2404 msg_message_copy_message(pSrc, pDst);
2408 err = MSG_ERR_UNKNOWN;
2415 int msg_thread_index_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s *value)
2417 msg_error_t err = MSG_SUCCESS;
2419 if (!msg_struct || !value)
2420 return MSG_ERR_NULL_POINTER;
2422 MSG_THREAD_LIST_INDEX_INFO_S *pIndex = (MSG_THREAD_LIST_INDEX_INFO_S *)msg_struct->data;
2423 msg_struct_s *pTmp = NULL;
2426 case MSG_THREAD_LIST_INDEX_ADDR_INFO_HND:
2427 pTmp = (msg_struct_s *)pIndex->msgAddrInfo;
2428 memcpy(pTmp->data, value->data, sizeof(MSG_ADDRESS_INFO_S));
2431 err = MSG_ERR_UNKNOWN;
2439 int msg_list_condition_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s *value)
2441 msg_error_t err = MSG_SUCCESS;
2443 if (!msg_struct || !value)
2444 return MSG_ERR_NULL_POINTER;
2446 MSG_LIST_CONDITION_S *pCond = (MSG_LIST_CONDITION_S *)msg_struct->data;
2447 msg_struct_s *pTmp = NULL;
2450 case MSG_LIST_CONDITION_SORT_RULE_HND:
2451 pTmp = (msg_struct_s *)pCond->sortRule;
2452 memcpy(pTmp->data, value->data, sizeof(MSG_SORT_RULE_S));
2455 err = MSG_ERR_UNKNOWN;
2463 int msg_address_info_set_int(void *addrinfo, int field, int value)
2465 msg_error_t err = MSG_SUCCESS;
2468 return MSG_ERR_NULL_POINTER;
2470 MSG_ADDRESS_INFO_S *pAddr = (MSG_ADDRESS_INFO_S *)addrinfo;
2473 case MSG_ADDRESS_INFO_ADDRESS_TYPE_INT:
2474 pAddr->addressType = value;
2476 case MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT:
2477 pAddr->recipientType = value;
2479 case MSG_ADDRESS_INFO_CONTACT_ID_INT:
2480 pAddr->contactId = value;
2483 err = MSG_ERR_UNKNOWN;
2491 int msg_mms_sendopt_set_int(void *opt_info, int field, int value)
2493 msg_error_t err = MSG_SUCCESS;
2496 return MSG_ERR_NULL_POINTER;
2498 MMS_SENDINGOPT_S *pOpt = (MMS_SENDINGOPT_S *)opt_info;
2501 case MSG_MMS_SENDOPTION_EXPIRY_TIME_INT:
2502 pOpt->expiryTime = value;
2504 case MSG_MMS_SENDOPTION_DELIVERY_TIME_INT:
2505 pOpt->deliveryTime = value;
2507 case MSG_MMS_SENDOPTION_PRIORITY_INT:
2508 pOpt->priority = value;
2511 err = MSG_ERR_UNKNOWN;
2518 int msg_reject_message_set_int(void *msg_info, int field, int value)
2520 msg_error_t err = MSG_SUCCESS;
2523 return MSG_ERR_NULL_POINTER;
2525 MSG_REJECT_MSG_INFO_S *pMsg = (MSG_REJECT_MSG_INFO_S *)msg_info;
2528 case MSG_REJECT_MESSAGE_MSGID_INT:
2529 pMsg->msgId = value;
2531 case MSG_REJECT_MESSAGE_DISPLAY_TIME_INT:
2532 pMsg->displayTime = value;
2535 err = MSG_ERR_UNKNOWN;
2542 int msg_address_info_set_str(void *addr_info, int field, const char *value, int size)
2544 msg_error_t err = MSG_SUCCESS;
2546 if (!addr_info || !value)
2547 return MSG_ERR_NULL_POINTER;
2549 MSG_ADDRESS_INFO_S *pAddr = (MSG_ADDRESS_INFO_S *)addr_info;
2553 case MSG_ADDRESS_INFO_ADDRESS_VALUE_STR:
2554 (size > MAX_ADDRESS_VAL_LEN)? _len = MAX_ADDRESS_VAL_LEN : _len = size;
2555 memset(pAddr->addressVal, 0x00, sizeof(pAddr->addressVal));
2556 strncpy(pAddr->addressVal, value, _len);
2558 case MSG_ADDRESS_INFO_DISPLAYNAME_STR:
2559 (size > MAX_DISPLAY_NAME_LEN)? _len = MAX_DISPLAY_NAME_LEN : _len = size;
2560 memset(pAddr->displayName, 0x00, sizeof(pAddr->displayName));
2561 strncpy(pAddr->displayName, value, _len);
2564 err = MSG_ERR_UNKNOWN;
2571 int msg_media_info_set_str(void *media_info, int field, const char *value, int size)
2573 msg_error_t err = MSG_SUCCESS;
2575 if (!media_info || !value)
2576 return MSG_ERR_NULL_POINTER;
2578 MSG_MEDIA_INFO_S *pAddr = (MSG_MEDIA_INFO_S *)media_info;
2582 case MSG_MEDIA_ITEM_STR:
2583 (size > MSG_FILEPATH_LEN_MAX)? _len = MSG_FILEPATH_LEN_MAX : _len = size;
2584 memset(pAddr->media_item, 0x00, sizeof(pAddr->media_item));
2585 strncpy(pAddr->media_item, value, _len);
2587 case MSG_MEDIA_MIME_TYPE_STR:
2588 (size > MAX_MIME_TYPE_LEN)? _len = MAX_MIME_TYPE_LEN : _len = size;
2589 memset(pAddr->mime_type, 0x00, sizeof(pAddr->mime_type));
2590 strncpy(pAddr->mime_type, value, _len);
2592 case MSG_MEDIA_THUMB_PATH_STR:
2593 (size > MSG_FILEPATH_LEN_MAX)? _len = MSG_FILEPATH_LEN_MAX : _len = size;
2594 memset(pAddr->thumb_path, 0x00, sizeof(pAddr->thumb_path));
2595 strncpy(pAddr->thumb_path, value, _len);
2598 err = MSG_ERR_UNKNOWN;
2605 int msg_reject_message_set_str(void *msg_info, int field, const char *value, int size)
2607 msg_error_t err = MSG_SUCCESS;
2609 if (!msg_info || !value)
2610 return MSG_ERR_NULL_POINTER;
2612 MSG_REJECT_MSG_INFO_S *pMsg = (MSG_REJECT_MSG_INFO_S *)msg_info;
2615 (size > MAX_MSG_TEXT_LEN)? _len = MAX_MSG_TEXT_LEN : _len = size;
2618 case MSG_REJECT_MESSAGE_MSGTEXT_STR:
2619 strncpy(pMsg->msgText, value, _len);
2622 err = MSG_ERR_UNKNOWN;
2629 int msg_mms_sendopt_set_bool(void *option, int field, bool value)
2631 msg_error_t err = MSG_SUCCESS;
2634 return MSG_ERR_NULL_POINTER;
2636 MMS_SENDINGOPT_S *pOpt = (MMS_SENDINGOPT_S *)option;
2639 case MSG_MMS_SENDOPTION_READ_REQUEST_BOOL:
2640 pOpt->bReadReq = value;
2642 case MSG_MMS_SENDOPTION_DELIVERY_CUSTOMTIME_BOOL:
2643 pOpt->bUseDeliveryCustomTime = value;
2646 err = MSG_ERR_UNKNOWN;
2653 int msg_sms_sendopt_set_bool(void *option, int field, bool value)
2655 msg_error_t err = MSG_SUCCESS;
2658 return MSG_ERR_NULL_POINTER;
2660 SMS_SENDINGOPT_S *pOpt = (SMS_SENDINGOPT_S *)option;
2663 case MSG_SMS_SENDOPT_REPLYPATH_BOOL:
2664 pOpt->bReplyPath = value;
2667 err = MSG_ERR_UNKNOWN;
2674 EXPORT_API int msg_add_push_event(msg_handle_t handle, const msg_struct_t push_event)
2676 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
2677 msg_error_t err = MSG_SUCCESS;
2679 if (handle == NULL || push_event == NULL)
2680 return MSG_ERR_INVALID_PARAMETER;
2682 MsgHandle* pHandle = (MsgHandle*)handle;
2684 msg_struct_s *pPush = (msg_struct_s *)push_event;
2685 MSG_TYPE_CHECK(pPush->type, MSG_STRUCT_PUSH_CONFIG_INFO);
2688 err = pHandle->addPushEvent((MSG_PUSH_EVENT_INFO_S *)pPush->data);
2689 } catch (MsgException& e) {
2690 MSG_FATAL("%s", e.what());
2691 return MSG_ERR_STORAGE_ERROR;
2697 EXPORT_API int msg_delete_push_event(msg_handle_t handle, const msg_struct_t push_event)
2699 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
2700 msg_error_t err = MSG_SUCCESS;
2702 if (handle == NULL || push_event == NULL)
2703 return MSG_ERR_INVALID_PARAMETER;
2705 MsgHandle* pHandle = (MsgHandle*)handle;
2707 msg_struct_s *pPush = (msg_struct_s *)push_event;
2708 MSG_TYPE_CHECK(pPush->type, MSG_STRUCT_PUSH_CONFIG_INFO);
2711 err = pHandle->deletePushEvent((MSG_PUSH_EVENT_INFO_S *)pPush->data);
2712 } catch (MsgException& e) {
2713 MSG_FATAL("%s", e.what());
2714 return MSG_ERR_STORAGE_ERROR;
2720 EXPORT_API int msg_update_push_event(msg_handle_t handle, const msg_struct_t src_event, const msg_struct_t dst_event)
2722 CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
2723 msg_error_t err = MSG_SUCCESS;
2725 if (handle == NULL || src_event == NULL || dst_event == NULL)
2726 return MSG_ERR_INVALID_PARAMETER;
2728 MsgHandle* pHandle = (MsgHandle*)handle;
2730 msg_struct_s *pSrc = (msg_struct_s *)src_event;
2731 MSG_TYPE_CHECK(pSrc->type, MSG_STRUCT_PUSH_CONFIG_INFO);
2733 msg_struct_s *pDst = (msg_struct_s *)dst_event;
2734 MSG_TYPE_CHECK(pDst->type, MSG_STRUCT_PUSH_CONFIG_INFO);
2737 err = pHandle->updatePushEvent((MSG_PUSH_EVENT_INFO_S *)pSrc->data, (MSG_PUSH_EVENT_INFO_S *)pDst->data);
2738 } catch (MsgException& e) {
2739 MSG_FATAL("%s", e.what());
2740 return MSG_ERR_STORAGE_ERROR;
2746 int msg_push_config_get_str(void *event_info, int field, char *value, int size)
2749 return MSG_ERR_NULL_POINTER;
2751 MSG_PUSH_EVENT_INFO_S *pEvent = (MSG_PUSH_EVENT_INFO_S *)event_info;
2754 case MSG_PUSH_CONFIG_CONTENT_TYPE_STR:
2755 strncpy(value, pEvent->contentType, size);
2757 case MSG_PUSH_CONFIG_APPLICATON_ID_STR:
2758 strncpy(value, pEvent->appId, size);
2760 case MSG_PUSH_CONFIG_PACKAGE_NAME_STR:
2761 strncpy(value, pEvent->pkgName, size);
2764 return MSG_ERR_INVALID_PARAMETER;
2770 int msg_push_config_get_bool(void *event_info, int field, bool *value)
2773 return MSG_ERR_NULL_POINTER;
2775 int ret = MSG_SUCCESS;
2777 MSG_PUSH_EVENT_INFO_S *pEvent = (MSG_PUSH_EVENT_INFO_S *)event_info;
2780 case MSG_PUSH_CONFIG_LAUNCH_BOOL:
2781 *value = pEvent->bLaunch;
2784 ret = MSG_ERR_INVALID_PARAMETER;
2791 int msg_push_config_set_str(void *event_info, int field, const char *value, int size)
2793 msg_error_t err = MSG_SUCCESS;
2795 if (!event_info || !value)
2796 return MSG_ERR_NULL_POINTER;
2798 MSG_PUSH_EVENT_INFO_S *pEvent = (MSG_PUSH_EVENT_INFO_S *)event_info;
2802 case MSG_PUSH_CONFIG_CONTENT_TYPE_STR:
2803 (size > MAX_WAPPUSH_CONTENT_TYPE_LEN)? _len = MAX_WAPPUSH_CONTENT_TYPE_LEN : _len = size;
2804 strncpy(pEvent->contentType, value, _len);
2806 case MSG_PUSH_CONFIG_APPLICATON_ID_STR:
2807 (size > MAX_WAPPUSH_ID_LEN)? _len = MAX_WAPPUSH_ID_LEN : _len = size;
2808 strncpy(pEvent->appId, value, _len);
2810 case MSG_PUSH_CONFIG_PACKAGE_NAME_STR:
2811 (size > MSG_FILEPATH_LEN_MAX)? _len = MSG_FILEPATH_LEN_MAX : _len = size;
2812 strncpy(pEvent->pkgName, value, _len);
2815 err = MSG_ERR_UNKNOWN;
2822 int msg_push_config_set_bool(void *event, int field, bool value)
2824 msg_error_t err = MSG_SUCCESS;
2827 return MSG_ERR_NULL_POINTER;
2829 MSG_PUSH_EVENT_INFO_S *pEvent = (MSG_PUSH_EVENT_INFO_S *)event;
2832 case MSG_PUSH_CONFIG_LAUNCH_BOOL:
2833 pEvent->bLaunch = value;
2836 err = MSG_ERR_UNKNOWN;
2843 int msg_media_item_get_str(void *data, int field, char *value, int size)
2846 return MSG_ERR_NULL_POINTER;
2848 MSG_MEDIA_INFO_S *pMedia = (MSG_MEDIA_INFO_S *)data;
2851 case MSG_MEDIA_ITEM_STR:
2852 strncpy(value, pMedia->media_item, size);
2854 case MSG_MEDIA_MIME_TYPE_STR:
2855 strncpy(value, pMedia->mime_type, size);
2857 case MSG_MEDIA_THUMB_PATH_STR:
2858 strncpy(value, pMedia->thumb_path, size);
2861 return MSG_ERR_INVALID_PARAMETER;
2867 int msg_media_item_get_int(void *data, int field, int *value)
2869 if (!data || !value)
2870 return MSG_ERR_NULL_POINTER;
2872 int ret = MSG_SUCCESS;
2874 MSG_MEDIA_INFO_S *pMedia = (MSG_MEDIA_INFO_S *)data;
2877 case MSG_MEDIA_MESSAGE_ID_INT:
2878 *value = pMedia->msg_id;
2881 ret = MSG_ERR_INVALID_PARAMETER;