From 632350f46b72ea22e9ab4c7ef082b019e26aea78 Mon Sep 17 00:00:00 2001 From: "jk7744.park" Date: Sun, 1 Feb 2015 13:42:54 +0900 Subject: [PATCH] tizen 2.3 release --- AUTHORS | 8 +- CMakeLists.txt | 33 +- LICENSE.APLv2 | 203 ++ LICENSE.Flora | 206 -- NOTICE | 7 +- SLP_MessagingFW_PG.h | 869 ----- config/alert_on_call.mp3 | Bin 50369 -> 0 bytes config/message_tone/Sherbet.wav | Bin 121140 -> 0 bytes config/msg-service-db.sql | 308 ++ sysinfo-message.xml => config/sysinfo-message.xml | 3 +- doc/msg_service_doc.h | 47 + externals/CMakeLists.txt | 54 + externals/MsgAlarm.cpp | 167 + externals/MsgDevicedWrapper.cpp | 94 + externals/MsgLbs.cpp | 49 + externals/MsgNotificationWrapper.cpp | 2804 ++++++++++++++++ {msg_helper => externals}/MsgSensorWrapper.cpp | 44 +- externals/MsgSoundPlayer.cpp | 792 +++++ {utils => externals}/MsgSpamFilter.cpp | 163 +- framework/CMakeLists.txt | 19 +- framework/deliver-handler/MsgDeliverHandler.cpp | 558 +++- framework/main.cpp | 368 +-- framework/plugin-manager/MsgPluginConfig.cpp | 26 +- framework/plugin-manager/MsgPluginManager.cpp | 501 ++- framework/setting-handler/MsgSettingHandler.cpp | 844 ++--- framework/storage-handler/MsgStorageFilter.cpp | 99 +- framework/storage-handler/MsgStorageFolder.cpp | 70 +- framework/storage-handler/MsgStorageManager.cpp | 925 +++--- framework/storage-handler/MsgStorageMessage.cpp | 2923 ++++++++--------- framework/storage-handler/MsgStorageMms.cpp | 462 ++- framework/storage-handler/MsgStorageSim.cpp | 93 +- framework/storage-handler/MsgStorageUtil.cpp | 803 ++++- framework/submit-handler/MsgSubmitHandler.cpp | 147 +- .../transaction-manager/MsgCmdHandlerFilter.cpp | 26 +- .../transaction-manager/MsgCmdHandlerSetting.cpp | 49 +- .../transaction-manager/MsgCmdHandlerStorage.cpp | 378 ++- .../transaction-manager/MsgCmdHandlerTransport.cpp | 374 ++- framework/transaction-manager/MsgTransManager.cpp | 476 ++- image/messaging_image001.png | Bin 70483 -> 0 bytes include/common/MsgCmdTypes.h | 45 +- include/common/MsgCppTypes.h | 26 +- include/common/MsgFilterTypes.h | 26 +- include/common/MsgInternalTypes.h | 150 +- include/common/MsgMmsTypes.h | 139 +- include/common/MsgPluginInterface.h | 67 +- include/common/MsgQueue.h | 73 +- include/common/MsgSettingTypes.h | 72 +- include/common/MsgSmil.h | 40 + include/common/MsgStorageTypes.h | 64 +- include/common/MsgThread.h | 26 +- include/common/MsgTransportTypes.h | 26 +- include/common/MsgTypes.h | 38 +- include/externals/MsgAlarm.h | 35 + include/externals/MsgDevicedWrapper.h | 25 + include/externals/MsgLbs.h | 37 + include/externals/MsgNotificationWrapper.h | 208 ++ include/externals/MsgSensorWrapper.h | 37 + include/externals/MsgSoundPlayer.h | 77 + include/{utils => externals}/MsgSpamFilter.h | 27 +- include/framework/MsgCmdHandler.h | 36 +- include/framework/MsgDeliverHandler.h | 26 +- include/framework/MsgPluginConfig.h | 26 +- include/framework/MsgPluginManager.h | 41 +- include/framework/MsgSettingHandler.h | 30 +- include/framework/MsgStorageHandler.h | 65 +- include/framework/MsgSubmitHandler.h | 26 +- include/framework/MsgTransManager.h | 45 +- include/mapi/msg.h | 1168 ++++++- include/mapi/msg_private.h | 54 +- include/mapi/msg_storage.h | 2471 ++++---------- include/mapi/msg_storage_types.h | 197 +- include/mapi/msg_transport.h | 1131 ++----- include/mapi/msg_transport_types.h | 225 +- include/mapi/msg_types.h | 2464 ++++++++------ include/msg_helper/MsgHelper.h | 58 - include/proxy/MsgHandle.h | 34 +- include/proxy/MsgProxyListener.h | 46 +- include/utils/MsgContact.h | 33 +- include/utils/MsgDebug.h | 220 +- include/utils/MsgDrmWrapper.h | 27 +- include/utils/MsgException.h | 26 +- include/utils/MsgGconfWrapper.h | 32 +- include/utils/MsgIpcSocket.h | 27 +- include/utils/MsgJsonParser.h | 132 + include/utils/MsgMemory.h | 26 +- include/utils/MsgMmsMessage.h | 69 +- include/utils/MsgMutex.h | 43 +- include/utils/MsgNotificationWrapper.h | 69 - include/utils/MsgSerialize.h | 29 + include/utils/MsgSoundPlayer.h | 45 - include/utils/MsgSqliteWrapper.h | 63 +- include/utils/MsgTextConvert.h | 43 +- include/utils/MsgUtilFile.h | 31 +- include/utils/MsgUtilFunction.h | 42 +- include/utils/MsgUtilStorage.h | 63 +- include/utils/MsgVMessage.h | 26 +- mapi/CMakeLists.txt | 5 +- mapi/msg_control.cpp | 55 +- mapi/msg_filter.cpp | 101 +- mapi/msg_message.cpp | 316 +- mapi/msg_mms.cpp | 699 +++- mapi/msg_setting.cpp | 367 ++- mapi/msg_storage.cpp | 1083 +++++-- mapi/msg_svc.cpp | 307 +- mapi/msg_transport.cpp | 339 +- msg-server | 7 + msg-service-tools.manifest | 2 - msg-service.manifest | 5 - msg-service.pc.in | 2 +- msg-service.rule | 83 +- msg_helper/CMakeLists.txt | 48 - msg_helper/MsgSoundPlayer.cpp | 419 --- msg_helper/main.cpp | 100 - packaging/msg-server.service | 13 + packaging/msg-service.service | 11 - packaging/msg-service.spec | 699 ++-- plugin/mms_plugin/CMakeLists.txt | 15 +- plugin/mms_plugin/MmsPluginAppBase.cpp | 251 ++ plugin/mms_plugin/MmsPluginAvCodec.cpp | 211 -- plugin/mms_plugin/MmsPluginCodecCommon.cpp | 834 +++-- plugin/mms_plugin/MmsPluginComposer.cpp | 223 ++ plugin/mms_plugin/MmsPluginConnManWrapper.cpp | 556 ++-- plugin/mms_plugin/MmsPluginDecode.cpp | 3412 +++++++------------- plugin/mms_plugin/MmsPluginDrm.cpp | 149 +- plugin/mms_plugin/MmsPluginEncode.cpp | 863 ++--- plugin/mms_plugin/MmsPluginEventHandler.cpp | 39 +- plugin/mms_plugin/MmsPluginHttp.cpp | 209 +- plugin/mms_plugin/MmsPluginInternal.cpp | 533 ++- plugin/mms_plugin/MmsPluginMIME.cpp | 799 +---- plugin/mms_plugin/MmsPluginMain.cpp | 51 +- plugin/mms_plugin/MmsPluginMessage.cpp | 1964 ++++++----- plugin/mms_plugin/MmsPluginSMILValidate.cpp | 36 +- plugin/mms_plugin/MmsPluginSmil.cpp | 2660 --------------- plugin/mms_plugin/MmsPluginStorage.cpp | 1422 +++++--- plugin/mms_plugin/MmsPluginTcs.cpp | 85 + plugin/mms_plugin/MmsPluginTextConvert.cpp | 74 +- plugin/mms_plugin/MmsPluginTransport.cpp | 31 +- plugin/mms_plugin/MmsPluginUserAgent.cpp | 273 +- plugin/mms_plugin/MmsPluginUtil.cpp | 423 +-- plugin/mms_plugin/include/MmsPluginAppBase.h | 39 + plugin/mms_plugin/include/MmsPluginAvCodec.h | 98 - plugin/mms_plugin/include/MmsPluginCodec.h | 26 +- plugin/mms_plugin/include/MmsPluginCodecCommon.h | 173 +- plugin/mms_plugin/include/MmsPluginCodecTypes.h | 131 +- plugin/mms_plugin/include/MmsPluginComposer.h | 46 + .../mms_plugin/include/MmsPluginConnManWrapper.h | 47 +- plugin/mms_plugin/include/MmsPluginDebug.h | 26 +- plugin/mms_plugin/include/MmsPluginDecode.h | 60 +- plugin/mms_plugin/include/MmsPluginDrm.h | 49 +- plugin/mms_plugin/include/MmsPluginEncode.h | 39 +- plugin/mms_plugin/include/MmsPluginEventHandler.h | 27 +- plugin/mms_plugin/include/MmsPluginHttp.h | 36 +- plugin/mms_plugin/include/MmsPluginInternal.h | 27 +- plugin/mms_plugin/include/MmsPluginMIME.h | 264 +- plugin/mms_plugin/include/MmsPluginMain.h | 28 +- plugin/mms_plugin/include/MmsPluginMessage.h | 52 +- plugin/mms_plugin/include/MmsPluginSMILValidate.h | 164 - plugin/mms_plugin/include/MmsPluginSmil.h | 265 -- plugin/mms_plugin/include/MmsPluginStorage.h | 81 +- plugin/mms_plugin/include/MmsPluginTcs.h | 23 + plugin/mms_plugin/include/MmsPluginTextConvert.h | 26 +- plugin/mms_plugin/include/MmsPluginTransport.h | 30 +- plugin/mms_plugin/include/MmsPluginTypes.h | 64 +- plugin/mms_plugin/include/MmsPluginUserAgent.h | 28 +- plugin/mms_plugin/include/MmsPluginUtil.h | 58 +- plugin/sms_plugin/CMakeLists.txt | 8 +- plugin/sms_plugin/SmsPluginCallback.cpp | 578 +++- plugin/sms_plugin/SmsPluginCbMsgHandler.cpp | 479 ++- plugin/sms_plugin/SmsPluginConcatHandler.cpp | 403 ++- plugin/sms_plugin/SmsPluginDSHandler.cpp | 173 + plugin/sms_plugin/SmsPluginEventHandler.cpp | 469 ++- plugin/sms_plugin/SmsPluginMain.cpp | 437 +-- plugin/sms_plugin/SmsPluginParamCodec.cpp | 57 +- plugin/sms_plugin/SmsPluginSatHandler.cpp | 206 +- plugin/sms_plugin/SmsPluginSetting.cpp | 1426 +++++--- plugin/sms_plugin/SmsPluginSimMsg.cpp | 614 ++-- plugin/sms_plugin/SmsPluginStorage.cpp | 1233 +++---- plugin/sms_plugin/SmsPluginTpduCodec.cpp | 106 +- plugin/sms_plugin/SmsPluginTransport.cpp | 540 ++-- plugin/sms_plugin/SmsPluginUAManager.cpp | 49 +- plugin/sms_plugin/SmsPluginUDCodec.cpp | 55 +- plugin/sms_plugin/SmsPluginWapPushHandler.cpp | 292 +- plugin/sms_plugin/include/SmsPluginCallback.h | 43 +- plugin/sms_plugin/include/SmsPluginCbMsgHandler.h | 44 +- plugin/sms_plugin/include/SmsPluginConcatHandler.h | 40 +- plugin/sms_plugin/include/SmsPluginDSHandler.h | 54 + plugin/sms_plugin/include/SmsPluginEventHandler.h | 47 +- plugin/sms_plugin/include/SmsPluginMain.h | 46 +- plugin/sms_plugin/include/SmsPluginParamCodec.h | 28 +- plugin/sms_plugin/include/SmsPluginSatHandler.h | 46 +- plugin/sms_plugin/include/SmsPluginSetting.h | 105 +- plugin/sms_plugin/include/SmsPluginSimMsg.h | 61 +- plugin/sms_plugin/include/SmsPluginStorage.h | 64 +- plugin/sms_plugin/include/SmsPluginTpduCodec.h | 26 +- plugin/sms_plugin/include/SmsPluginTransport.h | 55 +- plugin/sms_plugin/include/SmsPluginTypes.h | 206 +- plugin/sms_plugin/include/SmsPluginUAManager.h | 32 +- plugin/sms_plugin/include/SmsPluginUDCodec.h | 26 +- .../sms_plugin/include/SmsPluginWapPushHandler.h | 40 +- proxy/CMakeLists.txt | 7 +- proxy/MsgHandleControl.cpp | 225 +- proxy/MsgHandleFilter.cpp | 26 +- proxy/MsgHandleSetting.cpp | 60 +- proxy/MsgHandleStorage.cpp | 563 +++- proxy/MsgHandleTransport.cpp | 253 +- proxy/MsgProxyListener.cpp | 374 ++- sysinfo-message.emul.xml | 7 - utils/CMakeLists.txt | 14 +- utils/MsgContact.cpp | 1084 +++++-- utils/MsgDebug.cpp | 75 +- utils/MsgDrmWrapper.cpp | 216 +- utils/MsgException.cpp | 26 +- utils/MsgGconfWrapper.cpp | 192 +- utils/MsgIpcSocket.cpp | 80 +- utils/MsgJsonParser.cpp | 553 ++++ utils/MsgMemory.cpp | 26 +- utils/MsgMmsMessage.cpp | 921 +++++- utils/MsgMutex.cpp | 26 +- utils/MsgNotificationWrapper.cpp | 1315 -------- utils/MsgSerialize.cpp | 826 +++++ utils/MsgSmil.cpp | 2006 ++++++++++++ utils/MsgSoundPlayer.cpp | 312 -- utils/MsgSqliteWrapper.cpp | 327 +- utils/MsgTextConvert.cpp | 815 +++-- utils/MsgUtilFile.cpp | 214 +- utils/MsgUtilFunction.cpp | 383 ++- utils/MsgUtilStorage.cpp | 2963 +++++++++++++---- utils/MsgVMessage.cpp | 82 +- vobject-engine/CMakeLists.txt | 8 +- vobject-engine/VCard.c | 74 +- vobject-engine/VCardCalUtil.c | 28 +- vobject-engine/VMessage.c | 46 +- vobject-engine/include/VCard.h | 26 +- vobject-engine/include/VMessage.h | 26 +- vobject-engine/include/VTypes.h | 26 +- vobject-engine/include/vobject.h | 36 +- vobject-engine/test_code/CQ_VCARD.c | 80 - vobject-engine/test_code/uts_vdata_vcard_decode.c | 230 -- vobject-engine/test_code/uts_vdata_vcard_encode.c | 320 -- 239 files changed, 40939 insertions(+), 29120 deletions(-) create mode 100755 LICENSE.APLv2 delete mode 100755 LICENSE.Flora delete mode 100755 SLP_MessagingFW_PG.h delete mode 100755 config/alert_on_call.mp3 delete mode 100755 config/message_tone/Sherbet.wav create mode 100755 config/msg-service-db.sql rename sysinfo-message.xml => config/sysinfo-message.xml (57%) create mode 100644 doc/msg_service_doc.h create mode 100755 externals/CMakeLists.txt create mode 100755 externals/MsgAlarm.cpp create mode 100644 externals/MsgDevicedWrapper.cpp create mode 100755 externals/MsgLbs.cpp create mode 100755 externals/MsgNotificationWrapper.cpp rename {msg_helper => externals}/MsgSensorWrapper.cpp (69%) create mode 100755 externals/MsgSoundPlayer.cpp rename {utils => externals}/MsgSpamFilter.cpp (56%) delete mode 100755 image/messaging_image001.png create mode 100755 include/common/MsgSmil.h create mode 100755 include/externals/MsgAlarm.h create mode 100644 include/externals/MsgDevicedWrapper.h create mode 100755 include/externals/MsgLbs.h create mode 100755 include/externals/MsgNotificationWrapper.h create mode 100755 include/externals/MsgSensorWrapper.h create mode 100755 include/externals/MsgSoundPlayer.h rename include/{utils => externals}/MsgSpamFilter.h (56%) delete mode 100755 include/msg_helper/MsgHelper.h create mode 100755 include/utils/MsgJsonParser.h delete mode 100755 include/utils/MsgNotificationWrapper.h create mode 100755 include/utils/MsgSerialize.h delete mode 100755 include/utils/MsgSoundPlayer.h create mode 100755 msg-server mode change 100644 => 100755 msg-service.rule delete mode 100755 msg_helper/CMakeLists.txt delete mode 100755 msg_helper/MsgSoundPlayer.cpp delete mode 100755 msg_helper/main.cpp create mode 100755 packaging/msg-server.service delete mode 100755 packaging/msg-service.service mode change 100644 => 100755 packaging/msg-service.spec create mode 100755 plugin/mms_plugin/MmsPluginAppBase.cpp delete mode 100755 plugin/mms_plugin/MmsPluginAvCodec.cpp create mode 100755 plugin/mms_plugin/MmsPluginComposer.cpp delete mode 100755 plugin/mms_plugin/MmsPluginSmil.cpp create mode 100755 plugin/mms_plugin/MmsPluginTcs.cpp create mode 100755 plugin/mms_plugin/include/MmsPluginAppBase.h delete mode 100755 plugin/mms_plugin/include/MmsPluginAvCodec.h create mode 100755 plugin/mms_plugin/include/MmsPluginComposer.h delete mode 100755 plugin/mms_plugin/include/MmsPluginSMILValidate.h delete mode 100755 plugin/mms_plugin/include/MmsPluginSmil.h create mode 100755 plugin/mms_plugin/include/MmsPluginTcs.h create mode 100755 plugin/sms_plugin/SmsPluginDSHandler.cpp create mode 100755 plugin/sms_plugin/include/SmsPluginDSHandler.h delete mode 100755 sysinfo-message.emul.xml create mode 100755 utils/MsgJsonParser.cpp delete mode 100755 utils/MsgNotificationWrapper.cpp create mode 100755 utils/MsgSerialize.cpp create mode 100755 utils/MsgSmil.cpp delete mode 100755 utils/MsgSoundPlayer.cpp delete mode 100755 vobject-engine/test_code/CQ_VCARD.c delete mode 100755 vobject-engine/test_code/uts_vdata_vcard_decode.c delete mode 100755 vobject-engine/test_code/uts_vdata_vcard_encode.c diff --git a/AUTHORS b/AUTHORS index fd16fcc..2ebd567 100755 --- a/AUTHORS +++ b/AUTHORS @@ -1,4 +1,4 @@ -Chang-Seok Oh -Sangkoo Kim -Seunghwan Lee -KeeBum Kim \ No newline at end of file +Sanghun Chung +Sangkoo Kim + + diff --git a/CMakeLists.txt b/CMakeLists.txt index 774f421..3ee8af5 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,11 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) ########################################################## # Set Variables ########################################################## SET(VOBJECT-LIB msg_vobject) SET(UTILS-LIB msg_utils) +SET(EXTERNALS-LIB msg_externals) SET(PLUGIN-MANAGER-LIB msg_plugin_manager) SET(FW-HANDLER-LIB msg_framework_handler) SET(TRANS-MANAGER-LIB msg_transaction_manager) @@ -12,19 +14,20 @@ SET(MAPI-LIB msg_mapi) SET(SMS-PLUGIN-LIB msg_sms_plugin) SET(MMS-PLUGIN-LIB msg_mms_plugin) +ADD_DEFINITIONS("-D_FILE_OFFSET_BITS=64") +ADD_DEFINITIONS("-DMSG_PENDING_PUSH_MESSAGE") ########################################################## # Add Subdirectories ########################################################## ADD_SUBDIRECTORY(vobject-engine) ADD_SUBDIRECTORY(utils) +ADD_SUBDIRECTORY(externals) ADD_SUBDIRECTORY(framework) ADD_SUBDIRECTORY(proxy) ADD_SUBDIRECTORY(mapi) ADD_SUBDIRECTORY(plugin/sms_plugin) ADD_SUBDIRECTORY(plugin/mms_plugin) -ADD_SUBDIRECTORY(msg_helper) - ########################################################## # Install Header Files @@ -36,7 +39,7 @@ SET(MAPI-HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/mapi/msg_storage_types.h ${CMAKE_CURRENT_SOURCE_DIR}/include/mapi/msg_transport.h ${CMAKE_CURRENT_SOURCE_DIR}/include/mapi/msg_transport_types.h - ${CMAKE_CURRENT_SOURCE_DIR}/SLP_MessagingFW_PG.h ) + ) INSTALL(FILES ${MAPI-HEADERS} DESTINATION include/msg-service) @@ -46,23 +49,21 @@ INSTALL(FILES ${MAPI-HEADERS} DESTINATION include/msg-service) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config/plugin.cfg DESTINATION /usr/share/msg-service) -SET(RINGTONE-FILES - ${CMAKE_CURRENT_SOURCE_DIR}/config/message_tone/Sherbet.wav -) - -INSTALL(FILES ${RINGTONE-FILES} DESTINATION /usr/share/media/) +#INSTALL(FILES ${MMS-FILES} DESTINATION /opt/etc/msg-service) CONFIGURE_FILE(msg-service.pc.in msg-service.pc @ONLY) -INSTALL(FILES ${CMAKE_BINARY_DIR}/msg-service.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) +INSTALL(FILES ${CMAKE_BINARY_DIR}/msg-service.pc DESTINATION lib/pkgconfig) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/msg-service.service DESTINATION /usr/lib/systemd/system) +SET(RC_LOCAL_SCRIPT msg-server) +INSTALL(PROGRAMS ${RC_LOCAL_SCRIPT} DESTINATION /etc/rc.d/init.d) -# LICENSE file -#INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE.Flora DESTINATION /usr/share/license/msg-service) +# systemd +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/msg-server.service DESTINATION /usr/lib/systemd/system) -# SMACK rule file -INSTALL(FILES ${CMAKE_SOURCE_DIR}/msg-service.rule DESTINATION /opt/etc/smack/accesses.d/) +# LICENSE file +INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE.APLv2 DESTINATION /usr/share/license/msg-service) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/msg-service.rule DESTINATION /etc/smack/accesses.d/) #Install sysinfo file to provide which features are supported. -INSTALL(FILES ${CMAKE_SOURCE_DIR}/sysinfo-message.xml DESTINATION /etc/config) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/sysinfo-message.emul.xml DESTINATION /etc/config) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/config/msg-service-db.sql DESTINATION /usr/share/msg-service RENAME msg-service-db.sql) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/config/sysinfo-message.xml DESTINATION /etc/config) diff --git a/LICENSE.APLv2 b/LICENSE.APLv2 new file mode 100755 index 0000000..74f474e --- /dev/null +++ b/LICENSE.APLv2 @@ -0,0 +1,203 @@ +Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/LICENSE.Flora b/LICENSE.Flora deleted file mode 100755 index 03f0c77..0000000 --- a/LICENSE.Flora +++ /dev/null @@ -1,206 +0,0 @@ -Flora License - -Version 1.1, April, 2013 - -http://floralicense.org/license/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, -and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by -the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and -all other entities that control, are controlled by, or are -under common control with that entity. For the purposes of -this definition, "control" means (i) the power, direct or indirect, -to cause the direction or management of such entity, -whether by contract or otherwise, or (ii) ownership of fifty percent (50%) -or more of the outstanding shares, or (iii) beneficial ownership of -such entity. - -"You" (or "Your") shall mean an individual or Legal Entity -exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, -including but not limited to software source code, documentation source, -and configuration files. - -"Object" form shall mean any form resulting from mechanical -transformation or translation of a Source form, including but -not limited to compiled object code, generated documentation, -and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, -made available under the License, as indicated by a copyright notice -that is included in or attached to the work (an example is provided -in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, -that is based on (or derived from) the Work and for which the editorial -revisions, annotations, elaborations, or other modifications represent, -as a whole, an original work of authorship. For the purposes of this License, -Derivative Works shall not include works that remain separable from, -or merely link (or bind by name) to the interfaces of, the Work and -Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original -version of the Work and any modifications or additions to that Work or -Derivative Works thereof, that is intentionally submitted to Licensor -for inclusion in the Work by the copyright owner or by an individual or -Legal Entity authorized to submit on behalf of the copyright owner. -For the purposes of this definition, "submitted" means any form of -electronic, verbal, or written communication sent to the Licensor or -its representatives, including but not limited to communication on -electronic mailing lists, source code control systems, and issue -tracking systems that are managed by, or on behalf of, the Licensor -for the purpose of discussing and improving the Work, but excluding -communication that is conspicuously marked or otherwise designated -in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity -on behalf of whom a Contribution has been received by Licensor and -subsequently incorporated within the Work. - -"Tizen Certified Platform" shall mean a software platform that complies -with the standards set forth in the Tizen Compliance Specification -and passes the Tizen Compliance Tests as defined from time to time -by the Tizen Technical Steering Group and certified by the Tizen -Association or its designated agent. - -2. Grant of Copyright License. Subject to the terms and conditions of -this License, each Contributor hereby grants to You a perpetual, -worldwide, non-exclusive, no-charge, royalty-free, irrevocable -copyright license to reproduce, prepare Derivative Works of, -publicly display, publicly perform, sublicense, and distribute the -Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of -this License, each Contributor hereby grants to You a perpetual, -worldwide, non-exclusive, no-charge, royalty-free, irrevocable -(except as stated in this section) patent license to make, have made, -use, offer to sell, sell, import, and otherwise transfer the Work -solely as incorporated into a Tizen Certified Platform, where such -license applies only to those patent claims licensable by such -Contributor that are necessarily infringed by their Contribution(s) -alone or by combination of their Contribution(s) with the Work solely -as incorporated into a Tizen Certified Platform to which such -Contribution(s) was submitted. If You institute patent litigation -against any entity (including a cross-claim or counterclaim -in a lawsuit) alleging that the Work or a Contribution incorporated -within the Work constitutes direct or contributory patent infringement, -then any patent licenses granted to You under this License for that -Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the -Work or Derivative Works thereof pursuant to the copyright license -above, in any medium, with or without modifications, and in Source or -Object form, provided that You meet the following conditions: - - 1. You must give any other recipients of the Work or Derivative Works - a copy of this License; and - 2. You must cause any modified files to carry prominent notices stating - that You changed the files; and - 3. You must retain, in the Source form of any Derivative Works that - You distribute, all copyright, patent, trademark, and attribution - notices from the Source form of the Work, excluding those notices - that do not pertain to any part of the Derivative Works; and - 4. If the Work includes a "NOTICE" text file as part of its distribution, - then any Derivative Works that You distribute must include a readable - copy of the attribution notices contained within such NOTICE file, - excluding those notices that do not pertain to any part of - the Derivative Works, in at least one of the following places: - within a NOTICE text file distributed as part of the Derivative Works; - within the Source form or documentation, if provided along with the - Derivative Works; or, within a display generated by the Derivative Works, - if and wherever such third-party notices normally appear. - The contents of the NOTICE file are for informational purposes only - and do not modify the License. - -You may add Your own attribution notices within Derivative Works -that You distribute, alongside or as an addendum to the NOTICE text -from the Work, provided that such additional attribution notices -cannot be construed as modifying the License. You may add Your own -copyright statement to Your modifications and may provide additional or -different license terms and conditions for use, reproduction, or -distribution of Your modifications, or for any such Derivative Works -as a whole, provided Your use, reproduction, and distribution of -the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, -any Contribution intentionally submitted for inclusion in the Work -by You to the Licensor shall be under the terms and conditions of -this License, without any additional terms or conditions. -Notwithstanding the above, nothing herein shall supersede or modify -the terms of any separate license agreement you may have executed -with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade -names, trademarks, service marks, or product names of the Licensor, -except as required for reasonable and customary use in describing the -origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or -agreed to in writing, Licensor provides the Work (and each -Contributor provides its Contributions) on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -implied, including, without limitation, any warranties or conditions -of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A -PARTICULAR PURPOSE. You are solely responsible for determining the -appropriateness of using or redistributing the Work and assume any -risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, -whether in tort (including negligence), contract, or otherwise, -unless required by applicable law (such as deliberate and grossly -negligent acts) or agreed to in writing, shall any Contributor be -liable to You for damages, including any direct, indirect, special, -incidental, or consequential damages of any character arising as a -result of this License or out of the use or inability to use the -Work (including but not limited to damages for loss of goodwill, -work stoppage, computer failure or malfunction, or any and all -other commercial damages or losses), even if such Contributor -has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing -the Work or Derivative Works thereof, You may choose to offer, -and charge a fee for, acceptance of support, warranty, indemnity, -or other liability obligations and/or rights consistent with this -License. However, in accepting such obligations, You may act only -on Your own behalf and on Your sole responsibility, not on behalf -of any other Contributor, and only if You agree to indemnify, -defend, and hold each Contributor harmless for any liability -incurred by, or claims asserted against, such Contributor by reason -of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Flora License to your work - -To apply the Flora License to your work, attach the following -boilerplate notice, with the fields enclosed by brackets "[]" -replaced with your own identifying information. (Don't include -the brackets!) The text should be enclosed in the appropriate -comment syntax for the file format. We also recommend that a -file or class name and description of purpose be included on the -same "printed page" as the copyright notice for easier -identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Flora License, Version 1.1 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://floralicense.org/license/ - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/NOTICE b/NOTICE index 092bc04..a718085 100755 --- a/NOTICE +++ b/NOTICE @@ -1,4 +1,3 @@ -Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved. -Except as noted, this software is licensed under Flora License, Version 1.1 -Please, see the LICENSE.Flora file for Flora License, Version 1.1 terms and conditions. - +Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved +Except as noted, this software is licensed under Apache License, Version 2. +Please, see the LICENSE.APLv2 file for Apache License, Version 2 terms and conditions. diff --git a/SLP_MessagingFW_PG.h b/SLP_MessagingFW_PG.h deleted file mode 100755 index ecff3d7..0000000 --- a/SLP_MessagingFW_PG.h +++ /dev/null @@ -1,869 +0,0 @@ -/** - * - * @ingroup SLP_PG - * @defgroup MESSAGE MessagingFW -@{ -

Introduction

-

Purpose

-The purpose of this document is to describe how applications can use the Messaging Framework APIs to send and receive SMS and MMS messages. This document gives programming guidelines to application engineers. - -

Scope

-The scope of this document is limited to Messaging Framework APIs usage. - -

Abbreviations

- - -
APIApplication Programming Interface
-@} - -@defgroup Message_Architecture 1.Archtecture -@ingroup MESSAGE -@{ -

Messaging Framework Architecture

-The Messaging framework supports various messaging services such as SMS, MMS, Cell Broadcast, WAP Push, and Provisioning message. The Messaging framework architecture consists of a Messaging daemon and a library. The messaging library works on application process and provides various APIs to support transport, control, storage, filter and setting services for application. The messaging daemon has three components (transaction manager, transaction handler, and plug-in manager) to provide message services. The socket IPC is used to communicate (request & event) between Messaging daemon and library. -@image html messaging_image001.png - -- Transaction Manager - - Receive the IPC message (request) on socket. - - Manage list of pairs (request ID, transaction proxy) for synchronous return. - - Determine the transaction flow based on request/event information. (Mapping the request to one of the handlers) - - Store the transaction information for asynchronous events (Find which transaction proxy want to receive SMS) -- Transaction Handler - - Submit handler deals with submit requests. - - Deliver handler deals with the incoming message from plug-ins. - - Storage handler deals with the messages, accounts and folder requests - - Filter handler deals with the filter requests - - Setting handler deals with the service-specific attributes -- Plug-in Manager - - Initialize all plug-ins after loading plug-in configuration files - - Holding the list of plug-ins and the state of plug-ins - - Providing the interface between handlers and plug-ins -- Transaction Handlers - - Initialize all plug-ins after loading plug-in configuration files - - Receiving IPC messages from messaging daemon. - - Handling synchronous calls - - Condition variable is used for waiting the return from msg. server) - - Handling asynchronous calls or events - - Proxy listener is a component of transaction proxy - - Proxy listener is waiting for the event - - Invoking callback function in the msg. handle list - - i.e. calling incoming callback function of MSG APP handle, when incoming msg - - Holding list of message handles - - Message handle is created by MsgOpenMsgHandle(msgHandle) - - Message handle holds some info such as callback func -- Message API - - Transport & control API - - Storage API - - Filter API - - Setting API -@} - -@defgroup Message_Feature 2.Feature -@ingroup MESSAGE -@{ -

Messaging Framework Features

--# Message Control Features: - -# Open/Close message handle --# Message Transport Features: - -# Submit request to send, forward, reply, retrieve message. - -# Register callback functions to listen to invoked events from messaging daemon. (message status callback, incoming message callback) --# Message Storage Features: - -# Add / Update / Move / Delete / Count / Get message or message list. - -# Add / Update / Delete / Get folder or folder list. --# Message Filter Features: - -# Add / Update / Delete filter or filter list. --# Message Setting Features: - -# Set / Get various message setting (i.e. whether to send read/delivery report or not) -@} - -@defgroup MESSAGE_USECASES_1 Initialize/Finalization -@ingroup MESSAGE_USECASES -@{ -

Messaging Framework Functions

- -

Initialization / Finalization to use Messaging Service

-- int msg_open_msg_handle(MSG_HANDLE_T *handle); -@n msg_open_msg_handle() should be called before using the messaging service. This function opens a channel between the application and the messaging framework. -- int msg_close_msg_handle(MSG_HANDLE_T *handle); -@n msg_close_msg_handle() should be called after using the messaging service. This function closes a channel between the application and the messaging framework. -- int msg_reg_sent_status_callback(MSG_HANDLE_T handle, msg_sent_status_cb cb); -@n Application should implement a msg_sent_status_cb function and register it into message handle. If the application sends a message, this callback function will be called to report its sending status. msg_reg_set_status_callback function should be called after creation of message handle. -- int msg_reg_sms_message_callback(MSG_HANDLE_T handle, msg_sms_incoming_cb cb, unsigned short port); -@n Application should implement a msg_sms_incoming_cb function and register it into message handle. It’s used to listen to the SMS incoming event invoked by messaging daemon. The incoming message information structure (MSG_MESSAGE_S) can be delivered as a parameter of the callback function. -- int msg_reg_mms_conf_message_callback(MSG_HANDLE_T handle, msg_mms_conf_msg_incoming_cb cb, char *app_id); -@n Application should implement a msg_mms_conf_msg_incoming_cb function and register it into message handle. It’s used to listen to the MMS incoming event invoked by messaging daemon. The incoming message information structure (MSG_MESSAGE_S) can be delivered as a parameter of the callback function. -@code -#include -#include -#include -#include - -void sentStatusCB(MSG_HANDLE_T hMsgHandle, MSG_SENT_STATUS_S *pMsgStatus, void *user_param) -{ - // Application can handle message sent status event -} - -void incomingSmsMessageCB (MSG_HANDLE_T hMsgHandle, msg_message_t msg, void *user_param) -{ - // Application can handle SMS incoming message. -} - -void incomingMmsConfMessageCB(MSG_HANDLE_T hMsgHandle, msg_message_t msg, void *user_param) -{ - // Application can handle MMS incoming message. -} - -int main(void) -{ - MSG_HANDLE_T msgHandle = NULL; - - err = msg_open_msg_handle(&msgHandle); - - if (err != MSG_SUCCESS) - { - printf("msg_open_msg_handle() Fail [%d]", err); - return err; - } - - // Register sent status handler - err = msg_reg_sent_status_callback(msgHandle, &sentStatusCB, NULL); - - if (err != MSG_SUCCESS) - { - printf("msg_reg_sent_status_callback() Fail [%d]", err); - return err; - } - - // Register SMS incoming message handler - err = msg_reg_sms_message_callback(msgHandle, &incomingSmsMessageCB, 0, NULL); - - if (err != MSG_SUCCESS) - { - printf("msg_reg_sms_message_callback() Fail [%d]", err); - return err; - } - - // Register MMS incoming message handler - err = msg_reg_mms_conf_message_callback(msgHandle, &incomingMmsConfMessageCB, NULL, NULL); - - if (err != MSG_SUCCESS) - { - printf("msg_reg_mms_conf_message_callback() Fail [%d]", err); - return err; - } - - // g_main_loop should be used to listen CB event from messaging daemon - mainloop = g_main_loop_new(NULL, FALSE); - g_main_loop_run(mainloop); - - msg_close_msg_handle(&msgHandle); - - return err; -} -@endcode -@} - -@defgroup MESSAGE_USECASES_2 Adding a SMS Message -@ingroup MESSAGE_USECASES -@{ -

Adding a SMS Message

-- msg_message_t msg_new_message(); -@n msg_new_message() is a function to create a message object which can store the message information. You should call this function to set the message that you want to add or send. -- int msg_set_message_type(msg_message_t msg, MSG_MESSAGE_TYPE_T msg_type); -@n msg_set_message_type() is a function to set the message type such as SMS or MMS. The first parameter is the message object which is created by msg_new_message(). The second parameter is the message type you want to set. It should be one of enum type ( _MSG_MESSAGE_TYPE_E). If setting is successful, the function returns MSG_SUCCESS. Otherwise it returns an error in enum type (_MSG_ERROR_E). -- int msg_sms_set_message_body(msg_message_t msg, const char* mdata, int size); -@n msg_sms_set_message_body() is a function to set the SMS body data. The first parameter is the message object which is created by msg_new_message(). The second parameter is the SMS body data you want to set. The third parameter is the length of SMS body data. If setting is successful, the function returns MSG_SUCCESS. Otherwise it returns an error in enum type (_MSG_ERROR_E). -- int msg_add_address(msg_message_t msg, const char* phone_num_list, MSG_RECIPIENT_TYPE_T to_type); -@n msg_add_address() is a function to add the phone numbers for the message. The first parameter is the message object which is created by msg_new_message(). The second parameter is the list of phone number you want to set. You can add several phone numbers at once. The phone numbers should be separated by ','. The third parameter is the recipient type of phone number. It should be one of enum type (_MSG_RECIPIENT_TYPE_E). If setting is successful, the function returns MSG_SUCCESS. Otherwise it returns an error in enum type (_MSG_ERROR_E). -- int msg_add_message(MSG_HANDLE_T handle, const msg_message_t msg, const MSG_SENDINGOPT_S *send_opt); -@n msg_add_message() is a function to add a composed message into the database of messaging framework. Before calling this function, the application should set the message object and the sending option structure and then pass them as parameters. If you don't want to change the current sending option, set the variable 'bSetting' to false. If saving a message is successful, the function returns MSG_SUCCESS. Otherwise it returns an error in enum type (_MSG_ERROR_E). -- int msg_release_message(msg_message_t *msg); -@n msg_release_message() is a function to free the memory of a message object which is create by msg_new_message(). If freeing the memory is successful, the function returns MSG_SUCCESS. Otherwise it returns an error in enum type (_MSG_ERROR_E). -@code -#include -#include -#include - -void test_add_sms_message(MSG_HANDLE_T hMsgHandle) -{ - MSG_ERROR_T err = MSG_SUCCESS; - - MSG_SENDINGOPT_S sendOpt = {0, }; - sendOpt.bSetting = false; - - msg_message_t msgInfo = msg_new_message(); - - // Set Message Type - err = msg_set_message_type(msgInfo, MSG_TYPE_SMS); - - if (err != MSG_SUCCESS) goto free_memory; - - char msgText[1024]; - - memset(msgText, 0x00, 1024); - strncpy(msgText, "Test SMS Message", sizeof(msgText)-1); - int dataSize = strlen(msgText); - - // Set SMS text - err = msg_sms_set_message_body(msgInfo, msgText, dataSize); - - if (err != MSG_SUCCESS) goto free_memory; - - char number[MAX_ADDRESS_VAL_LEN]; - - memset(number, 0x00, MAX_ADDRESS_VAL_LEN); - strncpy(number, "+821030011234", sizeof(number)-1); - - // Set Recipient Address - err = msg_add_address(msgInfo, number, MSG_RECIPIENTS_TYPE_TO); - - if (err != MSG_SUCCESS) goto free_memory; - - err = msg_add_message(hMsgHandle, msgInfo, &sendOpt); - - if (err == MSG_SUCCESS) - printf("Saving Message is OK!"); - else - printf("Saving Message is failed!"); - -free_memory: - msg_release_message(&msgInfo); -} -@endcode -@} - -@defgroup MESSAGE_USECASES_3 Adding a MMS Message -@ingroup MESSAGE_USECASES -@{ -

Adding a MMS Message

-- int msg_set_subject(msg_message_t msg, const char* subject); -@n msg_set_subject() is a function to set the subject of MMS. The first parameter is the message object which is created by msg_new_message(). The second parameter is the subject you want to set. If setting is successful, the function returns MSG_SUCCESS. Otherwise it returns an error in enum type (_MSG_ERROR_E). - -- MMS_MESSAGE_DATA_S* msg_mms_create_message(void); -@n msg_mms_create_message() allocates a MMS_MESSAGE_DATA_S structure and returns it’s address. MMS_MESSAGE_DATA_S is needed to represent mms specific data and transfer it to the messaging daemon in the pData parameter of the MSG_MESSAGE_S structure. - -- MMS_SMIL_ROOTLAYOUT* msg_mms_set_rootlayout(MMS_MESSAGE_DATA_S* msg, const int width, const int height, const int bgcolor); -@n msg_mms_set_rootlayout() is a function to set smil root layout. The parameters representing the size and background color of smil root layout should be set. - -- MMS_SMIL_REGION* msg_mms_add_region(MMS_MESSAGE_DATA_S *msg_data, const char* szID, const int x, const int y, const int width, const int height, const int bgcolor); -@n msg_mms_add_region() is a function to add a smil region. Smil region is needed to display text message, image, and video data (Each content has its own region). This function is called to allocate a region for each contents. - -- MMS_PAGE_S* msg_mms_add_page(MMS_MESSAGE_DATA_S *msg_data, const int duration); -@n msg_mms_add_page() is a function to add a smil page. - -- MMS_MEDIA_S* msg_mms_add_media(MMS_PAGE_S *page, const MmsSmilMediaType mediatype, const char* regionid, char* filepath); -@n msg_mms_add_media() is a function to add multimedia content to a mms message. If some content should be played with smil player, this function can be used. - -- MMS_ATTACH_S* msg_mms_add_attachment(MMS_MESSAGE_DATA_S *msg_data, char *filepath); -@n msg_mms_add_attachment() is a function to add a content as an attached file. With this function a content might be attached as a multipart mixed type. - -- int msg_mms_set_message_body(msg_message_t msg, const MMS_MESSAGE_DATA_S *msg_data); -@n msg_mms_set_message_body() is a function to set the MMS body data. The first parameter is the message object which is created by msg_new_message(). The second parameter is the structure which is allocated by msg_mms_create_message() and is set by the APIs for MMS. - -- int msg_mms_destroy_message(MMS_MESSAGE_DATA_S* msg); -@n msg_mms_destroy_message() should be called to deallocate the MMS_MESSAGE_DATA_S structure and internal region, page, media, and attach list. -@code -#include -#include -#include - -void test_add_mms_message(MSG_HANDLE_T hMsgHandle) -{ - MSG_ERROR_T err = MSG_SUCCESS; - - MSG_SENDINGOPT_S sendOpt = {0, }; - sendOpt.bSetting = false; - - msg_message_t msgInfo = msg_new_message(); - - // Set Message Type - err = msg_set_message_type(msgInfo, MSG_TYPE_MMS); - - if (err != MSG_SUCCESS) goto free_memory; - - MMS_MESSAGE_DATA_S* data; - MMS_PAGE_S* page; - MMS_MEDIA_S* media[3]; - MMS_ATTACH_S* attach; - int nSize = 0; - - // Set MMS subject - char subject[MAX_SUBJECT_LEN]; - - memset(subject, 0x00, MAX_SUBJECT_LEN); - strncpy(subject, "hello mms", sizeof(subject)-1); - - err = msg_set_subject(msgInfo, subject); - - if (err != MSG_SUCCESS) goto free_memory; - - // Set MMS Body data - data = msg_mms_create_message(); - msg_mms_set_rootlayout(data, 100, 100, 0xffffff); - msg_mms_add_region(data, "Image", 0, 50, 100, 50, 0xffffff); - msg_mms_add_region(data, "Text", 0, 0, 100, 50, 0xffffff); - page = msg_mms_add_page(data, 5000); - media[0] = msg_mms_add_media(page, MMS_SMIL_MEDIA_IMG, "Image", "/tmp/image.jpg"); - media[1] = msg_mms_add_media(page, MMS_SMIL_MEDIA_AUDIO, NULL, "/tmp/audio.amr"); - media[2] = msg_mms_add_media(page, MMS_SMIL_MEDIA_TEXT, "Text", "/tmp/message.txt"); - attach = msg_mms_add_attachment(data, "attachment.3gp"); - - err = msg_mms_set_message_body(msgInfo, data); - - if (err != MSG_SUCCESS) - { - msg_mms_destroy_message(data); - goto free_memory; - } - - msg_mms_destroy_message(data); - - // Set Recipient Address - char number[MAX_ADDRESS_VAL_LEN]; - - memset(number, 0x00, MAX_ADDRESS_VAL_LEN); - strncpy(number, "+821030011234", sizeof(number)-1); - - err = msg_add_address(msgInfo, number, MSG_RECIPIENTS_TYPE_TO); - - if (err != MSG_SUCCESS) goto free_memory; - - err = msg_add_message(hMsgHandle, msgInfo, &sendOpt); - - if (err == MSG_SUCCESS) - printf("Saving Message is OK!"); - else - printf("Saving Message is failed!"); - -free_memory: - msg_release_message(&msgInfo); -} -@endcode -@} - -@defgroup MESSAGE_USECASES_4 Sending a SMS/MMS Message -@ingroup MESSAGE_USECASES -@{ -

Sending a SMS/MMS Message

- -- bool msg_is_sms(msg_message_t msg); -@n msg_is_sms() is a function to check whether the message type of message object is SMS or not. The first parameter is the message object which is created by msg_new_message(). The function returns true if the message object is a SMS message. Otherwise, it returns false. - -- bool msg_is_mms(msg_message_t msg); -@n msg_is_mms() is a function to check whether the message type of message object is MMS or not. The first parameter is the message object which is created by msg_new_message(). The function returns true if the message object is a MMS message. Otherwise, it returns false. - -- int msg_sms_send_message(MSG_HANDLE_T handle, MSG_REQUEST_S* req); -@n msg_sms_send_message() is a function to send SMS through messaging framework. The first parameter is the handle which is created by msg_open_msg_handle (). The second parameter is the structure that includes the message information to send. You can get the result of sending on sent status callback. - -- int msg_mms_send_message(MSG_HANDLE_T handle, MSG_REQUEST_S* req); -@n msg_sms_send_message() is a function to send SMS through messaging framework. The first parameter is the handle which is created by msg_open_msg_handle (). The second parameter is the structure that includes the message information to send. You can get the result of sending on sent status callback. -@code -#include -#include - -int MsgTestSendMsg(MSG_HANDLE_T hMsgHandle, msg_message_t pMsg) -{ - if (hMsgHandle == NULL) - { - printf("Handle is NULL\n"); - return MSG_ERR_NULL_MSGHANDLE; - } - - MSG_ERROR_T err = MSG_SUCCESS; - - MSG_REQUEST_S req = {0}; - - if (pMsg == NULL) - { - printf("Message is NULL\n"); - return MSG_ERR_NULL_MESSAGE; - } - - req.msg = pMsg; - - if (msg_is_sms(req.msg)) - err = msg_sms_send_message(hMsgHandle, &req); - else if (msg_is_mms(req.msg)) - err = msg_mms_send_message(hMsgHandle, &req); - - if (err == MSG_SUCCESS) - printf("Request to Send Message is successful!!!"); - else - printf("Request to Send Message is failed!!!"); - - return err; -} -@endcode -@} - -@defgroup MESSAGE_USECASES_5 Sending Simple SMS Message -@ingroup MESSAGE_USECASES -@{ -

Simple SMS Sending

-- int msg_sms_send(const char *phone_num_list, const char *sms_text, msg_simple_sent_status_cb cb, void *user_param); -@n msg_sms_send() is a simple function to send an SMS message. Without this API, in order to send a message the application should allocate a channel with messaging daemon for IPC, register sent-status callback function to monitor the sending result, and fulfill many member variables of MSG_MESSAGE_S. This function implicitly makes a connection with messaging daemon and registers the callback function. In addition, member variables of the MSG_MESSAGE_S structure are filled with default values except for the recipient phone_number and sms_text. -@code -#include -#include -#include -#include - -GMainLoop *mainloop; - -typedef struct { - char number[256]; - char text[256]; - char userdata[256]; -} send_data; - -void sent_status_cb(MSG_SENT_STATUS_S *pMsgStatus, void *userData) -{ - if (pMsgStatus->status == MSG_NETWORK_SEND_SUCCESS) - printf("reqId : %d MSG SENT SUCCESS !!!\n", pMsgStatus->reqId); - else - printf("reqId : %d MSG SENT FAIL !!! [%d]\n", pMsgStatus->reqId, pMsgStatus->status); -} - -// count from here -gboolean send_func(gpointer data) -{ - send_data* sms_input = (send_data*)data; - - printf("Begin to send [%s] to [%s]\n", sms_input->number, sms_input->text); - MSG_ERROR_T err = msg_sms_send(sms_input->number, sms_input->text, &sent_status_cb, (void*)sms_input->userdata); - - if (err != MSG_SUCCESS) - printf("Send failed [%d]\n", err); - - return FALSE; -} -// end - -int main(int argc, char* argv[]) -{ - if (argc != 3 && argc != 4) - { - printf("Usage: %s {phone_num_list} {sms_text} [user_data]\n", argv[0]); - printf("phone_num_list: phone_num1, phone_num2, ..., phone_numN\n"); - return 0; - } - - // Set sms input parameters : phone numbers and text - send_data sms_input = {}; - strncpy(sms_input.number, argv[1], sizeof(sms_input.number)-1); - strncpy(sms_input.text, argv[2], sizeof(sms_input.text)-1); - if (argc == 4) - strncpy(sms_input.userdata, argv[3], sizeof(sms_input.userdata)-1); - - // Add Sending Function to GMainLoop - g_idle_add(&send_func, (gpointer) &sms_input); - - // start GMainLoop - mainloop = g_main_loop_new(NULL, FALSE); - - printf("Entering GMain Loop to Receive Notifications in Thread...\n"); - - g_main_loop_run(mainloop); - - printf("==== End Test App. Bye...===\n"); - - return 0; -} -@endcode -@} - -@defgroup MESSAGE_USECASES_6 Retrieving a MMS Message -@ingroup MESSAGE_USECASES -@{ -

Retrieving a MMS Message

-- int msg_mms_retrieve_message(MSG_HANDLE_T handle, MSG_REQUEST_S* req); -@n msg_mms_retrieve_message() is a function to submit a retrieve MMS request. -@code -void MsgTestRetrieveMessage(MSG_HANDLE_T hMsgHandle, MSG_MESSAGE_ID_T nMsgId) -{ - if (hMsgHandle == NULL) - { - printf("Handle is NULL"); - return; - } - - MSG_ERROR_T err = MSG_SUCCESS; - - msg_message_t msg = msg_new_message(); - MSG_SENDINGOPT_S sendOpt = {0, }; - - err = msg_get_message(hMsgHandle, (MSG_MESSAGE_ID_T)nMsgId, msg, &sendOpt); - - if (err != MSG_SUCCESS) - printf("Get Message Failed!"); - - MSG_REQUEST_S req = {0, msg, sendOpt}; - - err = msg_mms_retrieve_message(hMsgHandle, &req); - - if (err != MSG_SUCCESS) - printf("Retrieve MMS Message Failed!"); - - msg_release_message(&msg); -} -@endcode -@} - -@defgroup MESSAGE_USECASES_7 Getting a SMS Message -@ingroup MESSAGE_USECASES -@{ -

Getting a SMS Message

-- int msg_get_message(MSG_HANDLE_T handle, MSG_MESSAGE_ID_T msg_id, msg_message_t msg, MSG_SENDINGOPT_S *send_opt); -@n msg_get_message() is a function to get a message. The first parameter is the handle which is created by msg_open_msg_handle (). The second parameter is the message ID you want to get. The third parameter is the message object to receive the message information. The last parameter is the structure to receive the message sending options. - -- int msg_get_message_id(msg_message_t msg); -@n msg_get_message_id() is a function to get the message ID. The parameter is the message object. If the function is successful, it returns the message ID. Otherwise it returns an error in enum type (_MSG_ERROR_E). - -- int msg_get_folder_id(msg_message_t msg); -@n msg_get_folder_id() is a function to get the ID of the folder that the message is saved within. The parameter is the message object. If the function is successful, it returns one of the enum type in (_MSG_FOLDER_ID_E) . Otherwise it returns an error in enum type (_MSG_ERROR_E). - -- int msg_get_message_type(msg_message_t msg); -@n msg_get_message_type() is a function to get the message type. The parameter is the message object. If the function is successful, it returns one of the enum type in (_MSG_MESSAGE_TYPE_E). Otherwise it returns an error in enum type (_MSG_ERROR_E). - -- int msg_get_address_count(msg_message_t msg); -@n msg_get_address_count() is a function to get the number of addresses. The parameter is the message object. If the function is successful, it returns the number of addresses. Otherwise it returns an error in enum type (_MSG_ERROR_E). - -- const char* msg_get_ith_address(msg_message_t msg, int ith); -@n msg_get_ith_address() is a function to get the ith address of message. The first parameter is the message object. The second parameter is the index of address you want to get. If the function is successful, it returns the address string. Otherwise it returns NULL. - -- time_t* msg_get_time(msg_message_t msg); -@n msg_get_time() is a function to get the time value of message. The parameter is the message object. If the function is successful, it returns the time value. Otherwise it returns NULL. - -- int msg_get_network_status(msg_message_t msg); -@n msg_get_network_status() is a function to get the network status of message. The parameter is the message object. If the function is successful, it returns one of the enum type in (_MSG_NETWORK_STATUS_E). Otherwise it returns an error in enum type (_MSG_ERROR_E). - -- bool msg_is_read(msg_message_t msg); -@n msg_is_read() is a function to check whether the message was read or not. The parameter is the message object. If the message was read, it returns true. Otherwise it returns false. - -- bool msg_is_protected(msg_message_t msg); -@n msg_is_protected() is a function to check whether the message is protected or not. The parameter is the message object. If the the message was protected, it returns true. Otherwise it returns false. - -- int msg_get_message_body_size(msg_message_t msg); -@n msg_get_message_body_size() is a function to get the byte size of message. The parameter is the message object. If the function is successful, it returns the byte size of message. Otherwise it returns an error in enum type (_MSG_ERROR_E). - -- const char* msg_sms_get_message_body(msg_message_t msg); -@n msg_sms_get_message_body() is a function to get the body data of message. The first parameter is the message object. If the function is successful, it returns the body data. Otherwise it returns NULL. -@code -void MsgTestGetSmsMessage(MSG_HANDLE_T hMsgHandle, int MsgId) -{ - if (hMsgHandle == NULL) - { - printf("Handle is NULL\n"); - return; - } - - MSG_ERROR_T err = MSG_SUCCESS; - - msg_message_t msg = msg_new_message(); - MSG_SENDINGOPT_S sendOpt = {0, }; - - // Get Message - err = msg_get_message(hMsgHandle, (MSG_MESSAGE_ID_T)MsgId, msg, &sendOpt); - - if (err != MSG_SUCCESS) goto free_memory; - - printf("msgId = %d\n", msg_get_message_id(msg)); - printf("folderId = %d\n", msg_get_folder_id(msg)); - printf("msgType = %d\n", msg_get_message_type(msg)); - printf("phone number = %s\n", msg_get_ith_address(msg, 0)); - printf("displayTime = %s\n", ctime(msg_get_time(msg))); - printf("networkStatus = %d\n", msg_get_network_status(msg)); - printf("bRead = %d\n", msg_is_read(msg)); - printf("bProtected = %d\n", msg_is_protected(msg)); - printf("dataSize = %d\n", msg_get_message_body_size(msg)); - printf("msgData = %s\n", msg_sms_get_message_body(msg)); - -free_memory: - msg_release_message(&msg); -} -@endcode -@} - -@defgroup MESSAGE_USECASES_8 Getting a MMS Message -@ingroup MESSAGE_USECASES -@{ -

Getting a MMS Message

-- int msg_mms_get_message_body(msg_message_t msg, MMS_MESSAGE_DATA_S *body); -@n msg_get_address_count. The parameter is the message object. The second parameter is the structure to receive MMS data as output. If the function is successful, it returns MSG_SUCCESS. Otherwise it returns an error in enum type (_MSG_ERROR_E). -- MMS_SMIL_REGION* msg_mms_get_smil_region(MMS_MESSAGE_DATA_S msgBody, int region_idx); -@n msg_mms_get_smil_region() is a function to get a SMIL region information. The first parameter is the structure of MMS data. The second parameter is the index of SMIL region you want to get. If the function is successful, it returns the structure which contains the SMIL region information. Otherwise it returns NULL. -- MMS_PAGE_S* msg_mms_get_page(MMS_MESSAGE_DATA_S msgBody, int page_idx); -@n msg_mms_get_page() is a function to get a SMIL page information. The first parameter is the structure of MMS data. The second parameter is the index of SMIL page you want to get. If the function is successful, it returns the structure which contains the SMIL page information. Otherwise it returns NULL. -- MMS_MEDIA_S* msg_mms_get_media(MMS_PAGE_S *page, int media_idx); -@n msg_mms_get_media() is a function to get a media information in a SMIL page. The first parameter is the structure of SMIL page you want to get the media from. The second parameter is the index of media you want to get. If the function is successful, it returns the structure which contains the media information. Otherwise it returns NULL. -- MMS_ATTACH_S* msg_mms_get_attachment(MMS_MESSAGE_DATA_S msgBody, int attach_idx); -@n msg_mms_get_attachment() is a function to get the file information of an attachment. The first parameter is the structure of MMS data. The second parameter is the index of attachment you want to get. If the function is successful, it returns the structure which contains the attachment file information. Otherwise it returns NULL. -- const char* msg_get_subject(msg_message_t msg); -@n msg_get_subject() is a function to get the subject of MMS. The parameter is the message object. If the function is successful, it returns the subject string. Otherwise it returns NULL. -@code -void MsgTestGetMmsMessage(MSG_HANDLE_T hMsgHandle, int MsgId) -{ - if (hMsgHandle == NULL) - { - printf("Handle is NULL\n"); - return; - } - - MSG_ERROR_T err = MSG_SUCCESS; - - msg_message_t msg = msg_new_message(); - MSG_SENDINGOPT_S sendOpt = {0, }; - - // Get Message - err = msg_get_message(hMsgHandle, (MSG_MESSAGE_ID_T)MsgId, msg, &sendOpt); - - if (err != MSG_SUCCESS) goto free_memory; - - if (msg_is_mms(msg) == false) - { - printf("It is not MMS Message!"); - goto free_memory; - } - - MMS_MESSAGE_DATA_S* msgBody = msg_mms_create_message(); - - // Get MMS Body Data - msg_mms_get_message_body(msg, msgBody); - - //Print root-layout info - printf("width: %d \n - height: %d \n - nbgColor:%x \n", - msgBody->rootlayout.width.value, - msgBody->rootlayout.height.value, - msgBody->rootlayout.bgColor); - - // Print Region Info - for (int i = 0; i < msgBody->regionCnt; ++i) - { - MMS_SMIL_REGION* pRegion = msg_mms_get_smil_region(msgBody, i); - - printf("region id: %s\n - region left : %d\n - region top : %d\n - region width : %d\n - region height : %d\n - region bgColor : %x\n - region fit : %d\n", - pRegion->szID,pRegion->nLeft.value, - pRegion->nTop.value,pRegion->width.value, - pRegion->height.value, pRegion->bgColor, - pRegion->fit); - } - - // Print Page info - for (int i = 0; i< msgBody->pageCnt; ++i) - { - MMS_PAGE_S* pPage = msg_mms_get_page(msgBody, i); - - printf("page's duration: %d msec\n - page's media count: %d\n", - pPage->nDur, pPage->mediaCnt); - - // Print Contents Info - for(int j = 0; j < pPage->mediaCnt; ++j) - { - MMS_MEDIA_S* pMedia = msg_mms_get_media(pPage, j); - printf("media's filename: %s\n - media's filepath: %s\n - media's regionId: %s\n - Bold: %d Italic: %d\n", - pMedia->szFileName, - pMedia->szFilePath, - pMedia->regionId, - pMedia->sMedia.sText.bBold, - pMedia->sMedia.sText.bItalic); - - if(pMedia->drmType != MSG_DRM_TYPE_NONE) - { - printf("media's drmtype: %d\n - media's drmpath: %s\n", - pMedia->drmType, pMedia->szDrm2FullPath); - } - } - } - - for (int i = 0; i < msgBody->attachCnt; ++i) - { - MMS_ATTACH_S* pAttach = msg_mms_get_attachment(msgBody, i); - - printf("Attachment file Name: %s\n - Attachment file Path: %s\n - Attached file size: %d\n", - pAttach->szFileName, - pAttach->szFilePath, - pAttach->fileSize); - - if(pAttach->drmType != MSG_DRM_TYPE_NONE) - printf("media's drmtype: %d\n - media's drmpath: %s\n", - pAttach->drmType, pAttach->szDrm2FullPath); - } - - printf("Subject: %s\n", msg_get_subject(pMsg)); - - printf("msgId = %d", msg_get_message_id(msg)); - printf("folderId = %d", msg_get_folder_id(msg)); - printf("phone number = %s", msg_get_ith_address(msg, 0)); - printf("displayTime = %s", ctime(msg_get_time(msg))); - printf("networkStatus = %d", msg_get_network_status(msg)); - printf("bRead = %d", msg_is_read(msg)); - printf("bProtected = %d", msg_is_protected(msg)); - -free_memory: - msg_mms_destroy_message(msgBody); - - msg_release_message(&msg); -} -@endcode -@} - -@defgroup MESSAGE_USECASES_9 Delete a Message -@ingroup MESSAGE_USECASES -@{ -

Delete a Message

-- int msg_delete_message(MSG_HANDLE_T handle, MSG_MESSAGE_ID_T msg_id); -@n msg_delete_message() is a function to delete a message from message box by msg_id. -@code -void MsgTestDeleteMessage(MSG_HANDLE_T hMsgHandle, MSG_MESSAGE_ID_T nMsgId) -{ - MSG_ERROR_T err; - - if (msg_delete_message(hMsgHandle, nMsgId) != MSG_SUCCESS) - printf("Failed to delete Message"); - -} -@endcode -@} - -@defgroup MESSAGE_USECASES_10 Set/Get Message Setting -@ingroup MESSAGE_USECASES -@{ -

Set / Get Message setting

-msg_set_config() and msg_get_cofig() is used to set or to get the message setting options. MSG_SETTING_S structure includes various setting information and is shared between message application and messaging daemon. - -- int msg_set_config(MSG_HANDLE_T handle, const MSG_SETTING_S *setting); -@n msg_set_config() sets a message option. -- int msg_get_config(MSG_HANDLE_T handle, MSG_SETTING_S *setting); -@n msg_get_config() gets a message option. -@code -void MsgTestSetGeneralOpt(MSG_HANDLE_T hMsgHandle) -{ - MSG_ERROR_T err = MSG_SUCCESS; - MSG_SETTING_S setting = {0, }; - - setting.type = MSG_GENERAL_OPT; - - setting.option.generalOpt.bKeepCopy = true; - setting.option.generalOpt.alertTone = MSG_ALERT_TONE_ONCE; - - err = msg_set_config(hMsgHandle, &setting); - - if (err == MSG_SUCCESS) - printf("Setting Config Data is OK!"); - else - printf("Setting Config Data is failed!"); -} - -void MsgTestGetGeneralOpt(MSG_HANDLE_T hMsgHandle) -{ - MSG_ERROR_T err = MSG_SUCCESS; - MSG_SETTING_S setting = {0, }; - - err = msg_get_config(hMsgHandle, &setting); - - if (err == MSG_SUCCESS) - { - printf("Setting Config Data is OK!\n"); - printf("bKeepCopy : [%d], AlertTone : [%d]\n", setting.option.generalOpt.bKeepCopy, setting.option.generalOpt.alertTone); - } - else - printf("Setting Config Data is failed!\n"); -} -@endcode -@} - -@defgroup MESSAGE_USECASES_11 Filtering a Message -@ingroup MESSAGE_USECASES -@{ -

Filtering a Message

-Messaging framework provides a filtering function for incoming message. New incoming message can be blocked (Move to spam-box or discard) by adding a filtering rule. A incoming message can be blocked by its originating address or by subject matching. If address matching filter rule is applied, only messages with exactly the same phone number can be blocked. Whereas, if a subject matching filter rule is applied, all messages that include the registered subject string might be blocked. An application can add or remove a filtering rule by calling msg_add_filter() or msg_delete_filter(). - -- int msg_add_filter(MSG_HANDLE_T handle, const MSG_FILTER_S *filter); -@n msg_add_filter() inserts a filtering rule to filter list and returns filter id. -- int msg_delete_filter(MSG_HANDLE_T handle, MSG_FILTER_ID_T filter_id); -@n msg_delete_filter()removes a filtering rule from filter list by filter id -@code -void MsgTestAddFilter(MSG_HANDLE_T hMsgHandle) -{ - if (hMsgHandle == NULL) - { - printf("Handle is NULL"); - return; - } - - MSG_ERROR_T err = MSG_SUCCESS; - MSG_FILTER_S filter[2]= {0, }; - - // Add filter by address - filter[0].filterType = MSG_FILTER_BY_ADDRESS; - strncpy(filter[0].filterValue, "+821234567890", MAX_FILTER_VALUE_LEN); - - err = msg_add_filter(hMsgHandle, &filter[0]); - - if (err == MSG_SUCCESS) - printf("msg_add_filter success"); - else - printf("msg_add_filter fail - err [%d]", err); - - // Add filter by subject - filter[1].filterType = MSG_FILTER_BY_SUBJECT; - strncpy(filter[1].filterValue, "test filter", MAX_FILTER_VALUE_LEN); - - err = msg_add_filter(hMsgHandle, &filter[1]); - - if (err == MSG_SUCCESS) - printf("msg_add_filter success"); - else - printf("msg_add_filter fail - err [%d]", err); - - return; -} - -void MsgTestDeleteFilter(MSG_HANDLE_T hMsgHandle, MSG_FILTER_ID_T filterId) -{ - if (hMsgHandle == NULL) - { - printf("Handle is NULL"); - return; - } - - MSG_ERROR_T err = MSG_SUCCESS; - err = msg_delete_filter(hMsgHandle, filterId); - - if (MSG_SUCCESS == err) - { - printf("msg_delete_filter success"); - } - else - { - printf("msg_delete_filter fail - err [%d]", err); - } - - return; -} -@endcode -@} -*/ - -/** -@addtogroup MESSAGE -@{ - @defgroup MESSAGE_USECASES Use Cases -@} -*/ diff --git a/config/alert_on_call.mp3 b/config/alert_on_call.mp3 deleted file mode 100755 index c7c77d13d4f04eb74c29d46be28d817c974d1e62..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 50369 zcmXV%1yCH%)36UXG(d0;4eoNdyB_ZD?(P=cA$V{-+}#Q85;Qo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zWgB1bd?)`QLb&Zr-0aW`(XK2^W9giQ8S9eFvMYC)jl_zT zl@wa(II#Pn#EoNeg}c4Po0|=kKVlh-{G%-lQ8^DDZ0|$|oTultsGh2|Pb-lB`RrbW z@3P(JRha&gyPoZidQ7~M#wPW5qtMG|Qyh=0Zr0xC7IQRW%c5$?=z==BkMF$o{r~%2 zqgT5^6Viiz+2{>_qi0-=twq1meIp-i%#M4qM#=ChNiC{A{mj@|5hot1MIBjUHJ{ob z6row!ps}V`D`aGnhd<*@y!~Lm6K$H^W{aLQa?lr7Q@KSE%B~=p@fv?(QO)kG7@b+} z&MS}xegQeOzP1cbt=zh4ylJF4UYt+TP9<~Xk2c&b)7Gf2(=6+Fqfw(%tg8Lj_q;!6 zub$3Yw5Q|M_Nl4aWY1%(z1q+E{%tXL4;g`Ls-CfU8l zkd+vQ8G?^J?olYoQfYd=;&o!mX9*VF2Kl28KA zeYf{}-e>O9x6V9c?~oFITYC1h`F+xi=|_Fx)oS4WB(6U`{^OuV>|_0y^L}=&=QFOK zp4O|0(`WT_ALkWM{p1_`KKs&4jdyA7p66cYyZi)uJ3akuK9lS|?{!vubf4$(it|k~ zPcwIWR5Q + - + diff --git a/doc/msg_service_doc.h b/doc/msg_service_doc.h new file mode 100644 index 0000000..6617947 --- /dev/null +++ b/doc/msg_service_doc.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + + +#ifndef __MSG_SERVICE_DOC_H__ +#define __MSG_SERVICE_DOC_H__ + + +/** + * @internal + * @ingroup CAPI_MESSAGING_FRAMEWORK + * @defgroup MSG_SERVICE_FRAMEWORK msg-service + * @brief The @ref MSG_SERVICE_FRAMEWORK API provides functions to create, set properties and send or receive a SMS/MMS message. + * + * @addtogroup MSG_SERVICE_FRAMEWORK + * + * @section MSG_SERVICE_FRAMEWORK_OVERVIEW Overview + * + * The Messages API provides the following functionalities: + * + * - Creating a message + * - Setting the message properties + * - Sending a message + * - Getting a message information(s) + * - Searching for messages + * - Registering/Unregistering a callback function to check whether a message is sent successfully or not + * - Registering/Unregistering a callback function to receive notifications when an incoming message is received + * + *
+ * + */ + + +#endif /* __MSG_SERVICE_DOC_H__ */ diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt new file mode 100755 index 0000000..aecc33a --- /dev/null +++ b/externals/CMakeLists.txt @@ -0,0 +1,54 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(msg-server CXX) + +SET(CMAKE_SKIP_BUILD_RPATH TRUE) + +IF("${CMAKE_BUILD_TYPE}" STREQUAL "") + SET(CMAKE_BUILD_TYPE "Debug") +ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") +MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") + +SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -O0 -g -Wall") + +########################################################## +# Define Framework Utils +########################################################## + +SET(EXTERNALS-SRCS + ${CMAKE_SOURCE_DIR}/externals/MsgSoundPlayer.cpp + ${CMAKE_SOURCE_DIR}/externals/MsgNotificationWrapper.cpp + ${CMAKE_SOURCE_DIR}/externals/MsgSpamFilter.cpp + ${CMAKE_SOURCE_DIR}/externals/MsgLbs.cpp + ${CMAKE_SOURCE_DIR}/externals/MsgSensorWrapper.cpp + ${CMAKE_SOURCE_DIR}/externals/MsgAlarm.cpp + ${CMAKE_SOURCE_DIR}/externals/MsgDevicedWrapper.cpp +) + +INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/include/mapi + ${CMAKE_SOURCE_DIR}/include/common + ${CMAKE_SOURCE_DIR}/include/utils + ${CMAKE_SOURCE_DIR}/include/externals +) + +INCLUDE(FindPkgConfig) +pkg_check_modules(externals_pkgs REQUIRED glib-2.0 deviced mm-session alarm-service notification secure-storage badge iniparser capi-appfw-application lbs-dbus mm-fileinfo mm-player mm-sound sensor feedback db-util) + +FOREACH(flag ${externals_pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") +ADD_DEFINITIONS("-DFEATURE_JAVA_MMS") +IF(_TIZEN_I586_ENABLED) +ADD_DEFINITIONS("-DTIZEN_I586_ENABLED") +ENDIF(_TIZEN_I586_ENABLED) +SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") + +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") + +ADD_LIBRARY(${EXTERNALS-LIB} SHARED ${EXTERNALS-SRCS}) +TARGET_LINK_LIBRARIES(${EXTERNALS-LIB} ${externals_pkgs_LDFLAGS} rt ${UTILS-LIB} ${VOBJECT-LIB}) + +INSTALL(TARGETS ${EXTERNALS-LIB} DESTINATION lib COMPONENT RuntimeLibraries) + diff --git a/externals/MsgAlarm.cpp b/externals/MsgAlarm.cpp new file mode 100755 index 0000000..a70aac3 --- /dev/null +++ b/externals/MsgAlarm.cpp @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + + +#include + +#include "MsgDebug.h" +#include "MsgAlarm.h" + +#include + + +/*================================================================================================== + DEFINES +==================================================================================================*/ +typedef std::map callBackMap; + +/*================================================================================================== + VARIABLES +==================================================================================================*/ +bool alarmInit = false; +callBackMap alarmCBMap; + +/*================================================================================================== + INTERNAL FUNCTION IMPLEMENTATION +==================================================================================================*/ +int MsgAlarmCB(int alarmId, void *pUserParam) +{ + MSG_DEBUG("MsgAlarmCB is called. alarmId [%d]", alarmId); + + callBackMap::iterator it = alarmCBMap.find(alarmId); + + if (it == alarmCBMap.end()) { + MSG_DEBUG("alarmId is not found."); + } else { + msg_alarm_cb alarmCBfunction = it->second; + if (alarmCBfunction) + alarmCBfunction(alarmId); + + alarmCBMap.erase(it); + } + + return 0; +} + + +msg_error_t MsgAlarmInit() +{ + MSG_BEGIN(); + + alarmCBMap.clear(); + + int retval = alarmmgr_init("msg-service-tools"); + if (retval != ALARMMGR_RESULT_SUCCESS) { + MSG_DEBUG("alarmmgr_init error [%d]", retval); + return MSG_ERR_UNKNOWN; + } + + retval = alarmmgr_set_cb(MsgAlarmCB, NULL); + if (retval != ALARMMGR_RESULT_SUCCESS) MSG_DEBUG("alarmmgr_set_cb() [%d]", retval); + + alarmInit = true; + + MSG_END(); + return MSG_SUCCESS; +} + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +msg_error_t MsgAlarmRegistration(struct tm *timeInfo, msg_alarm_cb userCB, int *alarmId) +{ + MSG_BEGIN(); + + if (!alarmInit) { + MSG_DEBUG("alarm manager is not initialized. Retry once."); + MsgAlarmInit(); + if (!alarmInit) { + MSG_DEBUG("alarm manager is still not initialized. So return error."); + return MSG_ERR_UNKNOWN; + } + } + + if (timeInfo == NULL || alarmId == NULL) { + MSG_DEBUG("(timeInfo == NULL || alarmId == NULL)"); + return MSG_ERR_INVALID_PARAMETER; + } + + *alarmId = 0; + alarm_info_t* alarm_info = NULL; + alarm_id_t alarm_id = -1; + alarm_date_t target_time; + + int retval = ALARMMGR_RESULT_SUCCESS; + + alarm_info = alarmmgr_create_alarm(); + if (alarm_info == NULL) { + MSG_DEBUG("alarmmgr_create_alarm error."); + return MSG_ERR_UNKNOWN; + } + + target_time.year = timeInfo->tm_year + 1900; + target_time.month = timeInfo->tm_mon + 1; + target_time.day = timeInfo->tm_mday; + target_time.hour = timeInfo->tm_hour; + target_time.min = timeInfo->tm_min; + target_time.sec = timeInfo->tm_sec; + + MSG_DEBUG( "Alarm Time : [%d-%d-%d %d:%d:%d] ", + target_time.year, target_time.month, target_time.day, + target_time.hour, target_time.min, target_time.sec); + + retval = alarmmgr_set_time(alarm_info, target_time); + if (retval != ALARMMGR_RESULT_SUCCESS) MSG_DEBUG("alarmmgr_set_time ret[%d]", retval); + retval = alarmmgr_set_repeat_mode(alarm_info, ALARM_REPEAT_MODE_ONCE, 0); + if (retval != ALARMMGR_RESULT_SUCCESS) MSG_DEBUG("alarmmgr_set_repeat_mode ret[%d]", retval); + retval = alarmmgr_set_type(alarm_info, ALARM_TYPE_DEFAULT); + if (retval != ALARMMGR_RESULT_SUCCESS) MSG_DEBUG("alarmmgr_set_type ret[%d]", retval); + retval = alarmmgr_add_alarm_with_localtime(alarm_info, NULL, &alarm_id); + MSG_DEBUG("alarmmgr_add_alarm_with_localtime ret[%d], alarm_id[%d]", retval, alarm_id); + + retval = alarmmgr_free_alarm(alarm_info); + if (retval != ALARMMGR_RESULT_SUCCESS) MSG_DEBUG("alarmmgr_free_alarm ret[%d]", retval); + + *alarmId = (int)alarm_id; + + alarmCBMap[*alarmId] = userCB; + + MSG_END(); + return MSG_SUCCESS; +} + + +msg_error_t MsgAlarmRemove(int alarmId) +{ + MSG_BEGIN(); + + if (!alarmInit) { + MSG_DEBUG("alarm manager is not initialized. Retry once."); + MsgAlarmInit(); + if (!alarmInit) { + MSG_DEBUG("alarm manager is still not initialized. So return error."); + return MSG_ERR_UNKNOWN; + } + } + + if (alarmmgr_remove_alarm(alarmId) != ALARMMGR_RESULT_SUCCESS) { + MSG_DEBUG("alarmmgr_remove_alarm faild."); + return MSG_ERR_UNKNOWN; + } + + MSG_END(); + return MSG_SUCCESS; +} diff --git a/externals/MsgDevicedWrapper.cpp b/externals/MsgDevicedWrapper.cpp new file mode 100644 index 0000000..005aa77 --- /dev/null +++ b/externals/MsgDevicedWrapper.cpp @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + + +#include + +#include "MsgDebug.h" +#include "MsgMutex.h" +#include "MsgGconfWrapper.h" +#include "MsgDevicedWrapper.h" + +int g_lock_cnt = 0; +Mutex mx; + +void MsgDisplayLock() +{ + MSG_BEGIN(); + + int ret = 0; + + mx.lock(); + + if (g_lock_cnt <= 0) { + ret = display_lock_state(LCD_OFF, STAY_CUR_STATE, 0); + if (ret < 0) { + MSG_DEBUG("display_lock_state() is failed [%d]", ret); + } + } + + g_lock_cnt++; + + mx.unlock(); + + MSG_DEBUG("Display lock count = [%d]", g_lock_cnt); + + MSG_END(); +} + + +void MsgDisplayUnlock() +{ + MSG_BEGIN(); + + int ret = 0; + + mx.lock(); + + g_lock_cnt--; + + MSG_DEBUG("Display lock count = [%d]", g_lock_cnt); + + if (g_lock_cnt <= 0) { + ret = display_unlock_state(LCD_OFF, PM_RESET_TIMER); + if (ret < 0) { + MSG_DEBUG("display_lock_state() is failed [%d]", ret); + } + } + + mx.unlock(); + + MSG_END(); +} + + +void MsgChangePmState() +{ + MSG_BEGIN(); + int callStatus = 0; + + callStatus = MsgSettingGetInt(VCONFKEY_CALL_STATE); + MSG_DEBUG("Call Status = %d", callStatus); + + if (callStatus > VCONFKEY_CALL_OFF && callStatus < VCONFKEY_CALL_STATE_MAX) { + MSG_DEBUG("Call is activated. Do not turn on the lcd."); + } else { + MSG_DEBUG("Call is not activated. Turn on the lcd."); + display_change_state(LCD_NORMAL); + } + + MSG_END(); +} diff --git a/externals/MsgLbs.cpp b/externals/MsgLbs.cpp new file mode 100755 index 0000000..7ffe63d --- /dev/null +++ b/externals/MsgLbs.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + + +#include "MsgDebug.h" + +extern "C" +{ + #include +} + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ + + +void MsgLbsSms(const char *msgBody, int msgSize) { + + int ret = LBS_AGPS_ERROR_NONE; + + ret = lbs_agps_sms(msgBody, msgSize); + + if (ret != LBS_AGPS_ERROR_NONE) + MSG_DEBUG("lbs_agps_sms failed. [%d]", ret); +} + + +void MsgLbsWapPush(const char *pushHeader, const char *pushBody, int pushBodySize) { + + int ret = LBS_AGPS_ERROR_NONE; + + ret = lbs_agps_wap_push(pushHeader, pushBody, pushBodySize); + + if (ret != LBS_AGPS_ERROR_NONE) + MSG_DEBUG("lbs_agps_wap_push failed. [%d]", ret); +} diff --git a/externals/MsgNotificationWrapper.cpp b/externals/MsgNotificationWrapper.cpp new file mode 100755 index 0000000..c01100b --- /dev/null +++ b/externals/MsgNotificationWrapper.cpp @@ -0,0 +1,2804 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + + +#include "MsgDebug.h" +#include "MsgCppTypes.h" +#include "MsgDrmWrapper.h" +#include "MsgContact.h" +#include "MsgStorageTypes.h" +#include "MsgUtilFile.h" +#include "MsgUtilFunction.h" +#include "MsgUtilStorage.h" +#include "MsgAlarm.h" +#include "MsgGconfWrapper.h" +#include "MsgNotificationWrapper.h" +#include "MsgSoundPlayer.h" +#include "MsgDevicedWrapper.h" +#include +#include +#include + +extern "C" +{ +#include +#include +#include +#include +#include +} + + +/*======================================================================================*/ +/* VARIABLES AND STRUCTURES */ +/*======================================================================================*/ + +int g_alarmId = 0; +bool bFeedbackInit; + +GList *msg_report_notification_list; + + +typedef struct _msg_noti_info_s +{ + msg_notification_type_t type; + int id; + int layout; + int count; + time_t time; + char sender[MSG_NOTI_TEXT_LEN_S]; + char text[MSG_NOTI_TEXT_LEN]; + char number[MSG_NOTI_TEXT_LEN_S]; + char imagePath[MAX_IMAGE_PATH_LEN + 1]; /**< Indicates the image path of contact. */ + int applist; + app_control_h svc_h; + msg_message_id_t msg_id; + unsigned char extra_data; + int sim_idx; +}MSG_NOTI_INFO_S; + +typedef struct _report_notification_s +{ + int priv_id; + char addressVal[MAX_ADDRESS_VAL_LEN+1]; +}report_notification_s; + +/*======================================================================================*/ +/* FUNCTION DEFINE */ +/*======================================================================================*/ + +notification_h getHandle(int *noti_id); + +int getPrivId(msg_notification_type_t noti_type, int sim_idx); +void updatePrivId(msg_notification_type_t noti_type, int noti_id, int sim_idx); + +void createInfoData(MSG_NOTI_INFO_S *noti_info, MSG_MESSAGE_INFO_S *msg_info); // For addNoti() +void createInfoData(MSG_NOTI_INFO_S *noti_info, bool bTicker); // For refreshNoti() +void clearInfoData(notification_h noti_h, MSG_NOTI_INFO_S *noti_info); + +msg_error_t getLatestMsgInfo(MSG_NOTI_INFO_S *noti_info, bool isForInstantMessage); + +void setProperty(notification_h noti_h, MSG_NOTI_INFO_S *noti_info); +void setTextDomain(notification_h noti_h, msg_notification_type_t noti_type); +void setText(notification_h noti_h, MSG_NOTI_INFO_S *noti_info); +void setIcon(notification_h noti_h, MSG_NOTI_INFO_S *noti_info); +void setPkgName(notification_h noti_h, msg_notification_type_t noti_type); +void setSoundAndVibration(notification_h noti_h, char *addressVal, bool bVoiceMail); + +void setNotification(notification_h noti_h, MSG_NOTI_INFO_S *noti_info, bool bFeedback); + +void MsgDeleteNotiCb(void *data); +void MsgRefreshNotiCb(void *data); + +bool isExistAddressInReportTable(const char *addr); + +// Wrapper +void createServiceHandle(app_control_h *svc_h); +void setServiceAppId(app_control_h svc_h, const char* app_id); +void setServiceOperation(app_control_h svc_h, const char* operation); +void addServiceExtraData(app_control_h svc_h, const char* bundle_key, const char* bundle_val); +void addServiceExtraData(app_control_h svc_h, const char* bundle_key, int bundle_val); +void setServicePackageName(app_control_h svc_h, const char* pkg_name); +void sendServicelaunchRequest(app_control_h svc_h, app_control_reply_cb callback, void *user_data); + +void setNotiTextDomain(notification_h noti_h, const char *pkg_name, const char *loc_dir); +void setNotiText(notification_h noti_h, notification_text_type_e type, const char *text, const char *key); +void setNotiTimeToText(notification_h noti_h, notification_text_type_e type, time_t time); +void setNotiTime(notification_h noti_h, time_t time); +void setNotiImage(notification_h noti_h, notification_image_type_e type, const char *image_path); +void setNotiSound(notification_h noti_h, notification_sound_type_e type, const char *path); +void setNotiVibration(notification_h noti_h, notification_vibration_type_e type, const char *path); +void setFlashNoti(void); + +char *getTranslateText(const char *pkg_name, const char *locale_dir, const char *text); + + +// Alarm +void MsgNotiSoundRepeatAlarmCB(int alarmId); +void MsgSoundCreateRepeatAlarm(int RepeatTime); +void MsgSoundSetRepeatAlarm(); + +void sendMsgReplyPopup(MSG_NOTI_INFO_S *noti_info); + +/*======================================================================================*/ +/* FUNCTION IMPLEMENTATION */ +/*======================================================================================*/ + + +msg_error_t MsgInsertNotification(MSG_MESSAGE_INFO_S *msg_info) +{ + MSG_BEGIN(); + + msg_error_t err = MSG_SUCCESS; + msg_notification_type_t noti_type; + + switch (msg_info->msgType.subType) + { +#ifdef MSG_NOTI_INTEGRATION + case MSG_NORMAL_SMS : + case MSG_CB_SMS : + { + if (msg_info->msgType.classType == MSG_CLASS_0) { + noti_type = MSG_NOTI_TYPE_CLASS0; + } else { + noti_type = MSG_NOTI_TYPE_NORMAL; + } + } + break; +#else + case MSG_NORMAL_SMS : + { + if (msg_info->msgType.classType == MSG_CLASS_0) { + noti_type = MSG_NOTI_TYPE_CLASS0; + } else if (msg_info->msgType.classType == MSG_CLASS_2) { + noti_type = MSG_NOTI_TYPE_SIM; + } else { + noti_type = MSG_NOTI_TYPE_NORMAL; + } + } + break; + case MSG_CB_SMS : + noti_type = MSG_NOTI_TYPE_CB; + break; +#endif + case MSG_MWI_FAX_SMS : + case MSG_MWI_EMAIL_SMS : + case MSG_MWI_OTHER_SMS : + noti_type = MSG_NOTI_TYPE_MWI; + break; + case MSG_MWI_VOICE_SMS : + noti_type = MSG_NOTI_TYPE_VOICE_1; + break; + case MSG_MWI_VOICE2_SMS : + noti_type = MSG_NOTI_TYPE_VOICE_2; + break; + case MSG_STATUS_REPORT_SMS : + noti_type = MSG_NOTI_TYPE_SMS_DELIVERY_REPORT; + break; + case MSG_DELIVERYIND_MMS : + noti_type = MSG_NOTI_TYPE_MMS_DELIVERY_REPORT; + break; + case MSG_READORGIND_MMS : + noti_type = MSG_NOTI_TYPE_MMS_READ_REPORT; + break; + default : + { +#ifdef MSG_NOTI_INTEGRATION + noti_type = MSG_NOTI_TYPE_NORMAL; +#else + if (msg_info->msgType.classType == MSG_CLASS_2) { + noti_type = MSG_NOTI_TYPE_SIM; + } else { + noti_type = MSG_NOTI_TYPE_NORMAL; + } +#endif + } + break; + } + + MSG_DEBUG("Notification type = [%d]", noti_type); + + switch (noti_type) + { + case MSG_NOTI_TYPE_NORMAL : + case MSG_NOTI_TYPE_SIM : + case MSG_NOTI_TYPE_CB : + err = MsgRefreshNotification(noti_type, true, true); + break; + case MSG_NOTI_TYPE_SMS_DELIVERY_REPORT : + case MSG_NOTI_TYPE_MMS_DELIVERY_REPORT : + case MSG_NOTI_TYPE_MMS_READ_REPORT : + err = MsgAddReportNotification(noti_type, msg_info); + break; + case MSG_NOTI_TYPE_VOICE_1 : + case MSG_NOTI_TYPE_VOICE_2 : + case MSG_NOTI_TYPE_MWI : + case MSG_NOTI_TYPE_CLASS0 : + err = MsgAddNotification(noti_type, msg_info); + break; + default : + MSG_DEBUG("No matching type [%d]"); + break; + } + + MSG_END(); + + return err; + +} + +msg_error_t MsgDeleteReportNotification(const char *addr) +{ + MSG_BEGIN(); + + msg_error_t msg_err = MSG_SUCCESS; + notification_h noti_h = NULL; + bool bNotification = true; + + MSG_NOTI_INFO_S noti_info; + memset(¬i_info, 0x00, sizeof(MSG_NOTI_INFO_S)); + + if (MsgSettingGetBool(MSG_SETTING_NOTIFICATION, &bNotification) != MSG_SUCCESS) { + MSG_DEBUG("MsgSettingGetBool is failed."); + } + + if (bNotification == false) { + MSG_DEBUG("Msg Alert notification is off."); + return msg_err; + } + + char normalAddr[MAX_ADDRESS_VAL_LEN+1]; + unsigned int list_length = g_list_length(msg_report_notification_list); + bool isDelete = false; + + MSG_DEBUG("list length [%d]", list_length); + + if (list_length > 0) { + GList *iter = g_list_first(msg_report_notification_list); + + while (iter != NULL) + { + isDelete = false; + report_notification_s *info = (report_notification_s*)(iter->data); + if (info == NULL) { + MSG_DEBUG("info is NULL!"); + return MSG_ERR_UNKNOWN; + } + + MSG_DEBUG("list data = [priv_id = %d address = %s]", info->priv_id, info->addressVal); + + noti_h = notification_load(NULL, info->priv_id); + if (noti_h == NULL) + { + MSG_DEBUG("notification with priv_id [%d] is NULL", info->priv_id); + isDelete = true; + } else { + memset(normalAddr, 0x00, sizeof(normalAddr)); + MsgConvertNumber(info->addressVal, normalAddr, sizeof(normalAddr)); + MSG_DEBUG("normalized number = %s", normalAddr); + + if (g_str_has_suffix(addr, normalAddr)) { + if (notification_delete(noti_h) == NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("delete report notification address [%s]", info->addressVal); + isDelete = true; + } + else { + MSG_DEBUG("delete notification failed"); + } + } + + notification_free(noti_h); + noti_h = NULL; + } + + iter = g_list_next(iter); + + if (isDelete) { + msg_report_notification_list = g_list_remove(msg_report_notification_list, (void *)info); + if(info) { + delete info; + info = NULL; + } + } + } + } + + MSG_END(); + + return msg_err; +} + +msg_error_t MsgAddReportNotification(msg_notification_type_t noti_type, MSG_MESSAGE_INFO_S *msg_info) +{ + msg_error_t msg_err = MSG_SUCCESS; + notification_h noti_h = NULL; + + MSG_NOTI_INFO_S noti_info; + memset(¬i_info, 0x00, sizeof(MSG_NOTI_INFO_S)); + + report_notification_s *info = new report_notification_s; + memset(info, 0x00, sizeof(report_notification_s)); + + noti_info.type = noti_type; + + createInfoData(¬i_info, msg_info); + + noti_h = getHandle(¬i_info.id); + + if (noti_h == NULL) { + MSG_DEBUG("Notification handle is NULL"); + msg_err = MSG_ERR_NULL_POINTER; + goto __END_OF_REFRESH_NOTI; + } + + setNotification(noti_h, ¬i_info, true); + + info->priv_id = noti_info.id; + snprintf(info->addressVal, sizeof(info->addressVal), "%s", msg_info->addressList->addressVal); + msg_report_notification_list = g_list_append(msg_report_notification_list, (void *)info); + MSG_DEBUG("appended list data = [priv_id = %d address = %s]", info->priv_id, info->addressVal); + +__END_OF_REFRESH_NOTI : + clearInfoData(noti_h, ¬i_info); + return msg_err; +} + +msg_error_t MsgRefreshNotification(msg_notification_type_t noti_type, bool bFeedback, bool bTicker) +{ + notification_h noti_h = NULL; + msg_error_t msg_err = MSG_SUCCESS; + bool bNotification = true; + bool bReplyPopup = false; + + MSG_NOTI_INFO_S noti_info; + memset(¬i_info, 0x00, sizeof(MSG_NOTI_INFO_S)); + + noti_info.type = noti_type; + + noti_info.id = getPrivId(noti_info.type, -1); + + msg_err = getLatestMsgInfo(¬i_info, false); + + if (msg_err != MSG_SUCCESS) { + MSG_DEBUG("getLatestMsgInfo() err = [%d]", msg_err); + goto __END_OF_REFRESH_NOTI; + } + + if (bTicker) { + msg_err = MsgInsertInstantMessage(noti_type); + + if (msg_err != MSG_SUCCESS) { + MSG_DEBUG(" MsgInsertInstantMessage() err = [%d]", msg_err); + goto __END_OF_REFRESH_NOTI; + } + } + + if (MsgSettingGetBool(MSG_SETTING_NOTIFICATION, &bNotification) != MSG_SUCCESS) { + MSG_DEBUG("MsgSettingGetBool is failed."); + } + + if (bNotification == false) { + MSG_DEBUG("Msg Alert notification is off."); + return msg_err; + } + + createInfoData(¬i_info, bTicker); + + noti_h = getHandle(¬i_info.id); + + if (noti_h == NULL) { + MSG_DEBUG("Notification handle is NULL"); + msg_err = MSG_ERR_NULL_POINTER; + goto __END_OF_REFRESH_NOTI; + } + + setNotification(noti_h, ¬i_info, bFeedback); + + if (MsgSettingGetBool(VCONFKEY_MESSAGE_POPUP_DISPLAY_ENABLE , &bReplyPopup) != MSG_SUCCESS) { + MSG_DEBUG("MsgSettingGetBool is failed."); + } + + if (bReplyPopup == true && bFeedback == true && noti_info.type == MSG_NOTI_TYPE_NORMAL) { + MSG_DEBUG("Msg reply popup is on."); + sendMsgReplyPopup(¬i_info); + } + +__END_OF_REFRESH_NOTI : + clearInfoData(noti_h, ¬i_info); + return msg_err; +} + + +msg_error_t MsgAddNotification(msg_notification_type_t noti_type, MSG_MESSAGE_INFO_S *msg_info) +{ + msg_error_t msg_err = MSG_SUCCESS; + notification_h noti_h = NULL; + + MSG_NOTI_INFO_S noti_info = {0,}; + + noti_info.type = noti_type; + + createInfoData(¬i_info, msg_info); + + noti_h = getHandle(¬i_info.id); + + if (noti_h == NULL) { + MSG_DEBUG("Notification handle is NULL"); + msg_err = MSG_ERR_NULL_POINTER; + goto __END_OF_ADD_NOTI; + } + + setNotification(noti_h, ¬i_info, true); + +__END_OF_ADD_NOTI : + clearInfoData(noti_h, ¬i_info); + return msg_err; +} + + +void MsgRefreshAllNotification(bool bWithSimNoti, bool bFeedback, bool bTickerNoti) +{ + MSG_BEGIN(); + + msg_error_t err = MSG_SUCCESS; + +// MsgDeleteNotification(MSG_NOTI_TYPE_SIM); + +#ifdef MSG_NOTI_INTEGRATION + err = MsgRefreshNotification(MSG_NOTI_TYPE_NORMAL, bFeedback, bTickerNoti); + if (err != MSG_SUCCESS) + MSG_DEBUG("refreshNoti is failed, [type=%d, err=%d]", MSG_NOTI_TYPE_NORMAL, err); +#else + err = MsgRefreshNotification(MSG_NOTI_TYPE_NORMAL, bFeedback, bTickerNoti); + if (err != MSG_SUCCESS) + MSG_DEBUG("refreshNoti is failed, [type=%d, err=%d]", MSG_NOTI_TYPE_NORMAL, err); + + err = MsgRefreshNotification(MSG_NOTI_TYPE_CB, bFeedback, bTickerNoti); + if (err != MSG_SUCCESS) + MSG_DEBUG("refreshNoti is failed, [type=%d, err=%d]", MSG_NOTI_TYPE_CB, err); + + if (bWithSimNoti) { + err = MsgRefreshNotification(MSG_NOTI_TYPE_SIM, bFeedback, bTickerNoti); + if (err != MSG_SUCCESS) + MSG_DEBUG("refreshNoti is failed, [type=%d, err=%d]", MSG_NOTI_TYPE_SIM, err); + } +#endif + + err = MsgRefreshNotification(MSG_NOTI_TYPE_FAILED, bFeedback, bTickerNoti); + if (err != MSG_SUCCESS) + MSG_DEBUG("refreshNoti is failed, [type=%d, err=%d]", MSG_NOTI_TYPE_FAILED, err); + + MSG_END(); +} + + +void MsgDeleteNotification(msg_notification_type_t noti_type) +{ + int noti_err = NOTIFICATION_ERROR_NONE; + + if (noti_type == MSG_NOTI_TYPE_ALL) { + + noti_err = notification_delete_all_by_type(MSG_DEFAULT_APP_ID, NOTIFICATION_TYPE_NOTI); + + } else if (noti_type == MSG_NOTI_TYPE_VOICE_1 || noti_type == MSG_NOTI_TYPE_VOICE_2 || noti_type == MSG_NOTI_TYPE_SIM) { + int notiId = 0; + + notiId = getPrivId(noti_type, -1); + MSG_DEBUG("deleted notification ID = [%d] Type = [%d]", notiId, noti_type); + + if (notiId > 0) + noti_err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, notiId); + + } else { + MSG_DEBUG("No matching type [%d]", noti_type); + } + + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_delete_all_by_type noti_err [%d]", noti_err); + } + + updatePrivId(noti_type, 0, -1); +} + + +bool isExistAddressInReportTable(const char *addr) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + char normalAddr[MAX_ADDRESS_VAL_LEN+1]; + MsgDbHandler *dbHandle = getDbHandle(); + int rowCnt = 0; + + memset(normalAddr, 0x00, sizeof(normalAddr)); + MsgConvertNumber(addr, normalAddr, sizeof(normalAddr)); + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT * FROM %s WHERE ADDRESS_VAL LIKE '%%%%%s'", MSGFW_SMS_REPORT_TABLE_NAME, normalAddr); + if (dbHandle->getTable(sqlQuery, &rowCnt) == MSG_SUCCESS) { + dbHandle->freeTable(); + return true; + } + + dbHandle->freeTable(); + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT * FROM %s WHERE ADDRESS_VAL LIKE '%%%%%s'", MSGFW_REPORT_TABLE_NAME, normalAddr); + if (dbHandle->getTable(sqlQuery, &rowCnt) == MSG_SUCCESS) { + dbHandle->freeTable(); + return true; + } + + dbHandle->freeTable(); + + return false; +} + + +void MsgInitReportNotiList() +{ + MSG_BEGIN(); + + msg_report_notification_list = NULL; + + notification_h noti = NULL; + notification_list_h noti_list = NULL; + notification_list_h head_noti_list = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + bundle *b = NULL; + + noti_err = notification_get_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list); + if(noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("notification_get_list() is failed!!"); + return; + } + + head_noti_list = noti_list; + + while (noti_list != NULL) { + noti = notification_list_get_data(noti_list); + + char tempAddr[MAX_ADDRESS_VAL_LEN+1]; + memset(tempAddr, 0x00, sizeof(tempAddr)); + + noti_err = notification_get_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, &b); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("notification_get_excute_option() failed!!"); + break; + } + + const char *bundle_addr = bundle_get_val(b, "address"); + + if (bundle_addr != NULL) { + if (isExistAddressInReportTable(bundle_addr)) { + report_notification_s *info = new report_notification_s; + memset(info, 0x00, sizeof(report_notification_s)); + + notification_get_id(noti, NULL, &(info->priv_id)); + snprintf(info->addressVal, sizeof(info->addressVal), "%s", bundle_addr); + + msg_report_notification_list = g_list_append(msg_report_notification_list, (void *)info); + MSG_DEBUG("appended list data = [priv_id = %d address = %s]", info->priv_id, info->addressVal); + } + } + + noti_list = notification_list_get_next(noti_list); + } + + if (head_noti_list) + notification_free_list(head_noti_list); + + MSG_END(); +} + + +msg_error_t MsgInitNoti() +{ + bool bNotiSvcReady = false; + + bNotiSvcReady = notification_is_service_ready(); + + if (bNotiSvcReady == true) { + MSG_DEBUG("Notification server is available"); +#ifndef MSG_NOTI_INTEGRATION + MsgDeleteNotification(MSG_NOTI_TYPE_SIM); +#endif + MsgRefreshAllNotification(false, true, true); // On Booting + MsgInitReportNotiList(); + } + else { + MSG_DEBUG("Notification server is not available. Init is defered"); +#ifndef MSG_NOTI_INTEGRATION + msg_notification_type_t *delNotiType = (msg_notification_type_t *)calloc(1, sizeof(msg_notification_type_t)); + *delNotiType = MSG_NOTI_TYPE_SIM; + notification_add_deferred_task(MsgDeleteNotiCb, (void *)delNotiType); +#endif + notification_add_deferred_task(MsgRefreshNotiCb, (void *)NULL); + } + + return MSG_SUCCESS; +} + + +msg_error_t MsgDeleteNoti(msg_notification_type_t noti_type) +{ + bool bNotiSvcReady = false; + + msg_notification_type_t *delNotiType = (msg_notification_type_t *)calloc(1, sizeof(msg_notification_type_t)); + *delNotiType = noti_type; + + bNotiSvcReady = notification_is_service_ready(); + + if (bNotiSvcReady == true) { + MSG_DEBUG("Notification server is available"); + MsgDeleteNotiCb((void *)delNotiType); + } else { + MSG_DEBUG("Notification server is not available. Delete is defered"); + notification_add_deferred_task(MsgDeleteNotiCb, (void *)delNotiType); + } + + return MSG_SUCCESS; +} + + +msg_error_t MsgInsertTicker(const char* pTickerMsg, const char* pLocaleTickerMsg, bool bPlayFeedback, int msgId) +{ + + MSG_DEBUG("pTickerMsg=[%s], pLocaleTickerMsg=[%s]", pTickerMsg, pLocaleTickerMsg); + MSG_DEBUG("play feedback=[%d], msgId=[%d]", bPlayFeedback, msgId); + + MsgChangePmState(); + + char *notiMsg = NULL; + bool bTicker = false; + + notiMsg = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, pLocaleTickerMsg); + MSG_DEBUG("notiMsg %s", notiMsg); + + if (g_strcmp0(pLocaleTickerMsg, SMS_MESSAGE_SENDING_FAIL) != 0 && + g_strcmp0(pLocaleTickerMsg, SENDING_MULTIMEDIA_MESSAGE_FAILED) != 0 && + g_strcmp0(pLocaleTickerMsg, MESSAGE_RETRIEVED) != 0) { + if (g_strcmp0(pLocaleTickerMsg, notiMsg) == 0) { + notification_status_message_post(pTickerMsg); + } else { + notification_status_message_post(notiMsg); + } + } else { + //Show ticker popup for sending failed msg. + bTicker = true; + } + + if (notiMsg) { + free(notiMsg); + notiMsg = NULL; + } + + if (bPlayFeedback) { + if (msgId > 0 && \ + (g_strcmp0(pLocaleTickerMsg, SMS_MESSAGE_SENDING_FAIL) == 0 || g_strcmp0(pLocaleTickerMsg, SENDING_MULTIMEDIA_MESSAGE_FAILED) == 0)) + { + msg_error_t err = MSG_SUCCESS; + err = MsgRefreshNotification(MSG_NOTI_TYPE_FAILED, true, bTicker); + if (err != MSG_SUCCESS) { + MSG_DEBUG("MsgRefreshFailedNoti err=[%d]", err); + } + } else if (g_strcmp0(pLocaleTickerMsg, SMS_MESSAGE_SIM_MESSAGE_FULL) == 0) { + msg_error_t err = MSG_SUCCESS; + err = MsgRefreshNotification(MSG_NOTI_TYPE_SIM_FULL, true, false); + if (err != MSG_SUCCESS) { + MSG_DEBUG("MsgRefreshSimFullNoti err=[%d]", err); + } + } + else { + MsgSoundPlayer::instance()->MsgSoundPlayStart(NULL, MSG_SOUND_PLAY_DEFAULT); + } + } + + return MSG_SUCCESS; +} + + +msg_error_t MsgInsertBadge(unsigned int unreadMsgCnt) +{ + MSG_DEBUG("Start to set badge to [%d].", unreadMsgCnt); + + int err = BADGE_ERROR_NONE; + bool exist = false; + + err = badge_is_existing(MSG_DEFAULT_APP_ID, &exist); + + if (err != BADGE_ERROR_NONE) { + MSG_DEBUG("Fail to badge_is_existing : %d", err); + return MSG_ERR_UNKNOWN; + } + + if (!exist) { + /* create badge */ + err = badge_new(MSG_DEFAULT_APP_ID); + if (err != BADGE_ERROR_NONE) { + MSG_DEBUG("Fail to badge_new : %d", err); + return MSG_ERR_UNKNOWN; + } + } + + err = badge_set_count(MSG_DEFAULT_APP_ID, unreadMsgCnt); + + if (err != BADGE_ERROR_NONE) { + MSG_DEBUG("Fail to badge_set_count : %d", err); + return MSG_ERR_UNKNOWN; + } + + return MSG_SUCCESS; +} + + +void MsgRefreshNotiCb(void *data) +{ + MsgRefreshAllNotification(false, true, true); + MsgInitReportNotiList(); + + if (data) { + free(data); + data = NULL; + } + + return; +} + + +void MsgDeleteNotiCb(void *data) +{ + //CID 47261: Moved null check to begining. + if (data) { + msg_notification_type_t delNotiType = *(msg_notification_type_t *)data; + + MsgDeleteNotification(delNotiType); + + free(data); + data = NULL; + } + + return; +} + + +notification_h getHandle(int *noti_id) +{ + notification_h noti_h = NULL; + + if (*noti_id > 0) { + MSG_DEBUG("Notification load"); + noti_h = notification_load(NULL, *noti_id); + if (noti_h == NULL) + MSG_DEBUG("notification_load is failed."); + } + + if (noti_h == NULL) { + MSG_DEBUG("Notification create"); + noti_h = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti_h == NULL) { + MSG_DEBUG("notification_create is failed."); + return NULL; + } + + *noti_id = 0; + } + + return noti_h; +} + + +int getPrivId(msg_notification_type_t noti_type, int sim_idx) +{ + MSG_BEGIN(); + + int noti_id = 0; + + switch (noti_type) + { +#ifdef MSG_NOTI_INTEGRATION + case MSG_NOTI_TYPE_NORMAL : + case MSG_NOTI_TYPE_SIM : + case MSG_NOTI_TYPE_CB : + noti_id = MsgSettingGetInt(NOTIFICATION_PRIV_ID); + break; +#else + case MSG_NOTI_TYPE_NORMAL : + noti_id = MsgSettingGetInt(NOTIFICATION_PRIV_ID); + break; + case MSG_NOTI_TYPE_SIM : + noti_id = MsgSettingGetInt(SIM_MSG_NOTI_PRIV_ID); + break; + case MSG_NOTI_TYPE_CB : + noti_id = MsgSettingGetInt(CB_NOTI_PRIV_ID); + break; +#endif + case MSG_NOTI_TYPE_FAILED : + noti_id = MsgSettingGetInt(MSG_SENTFAIL_NOTI_ID); + break; + case MSG_NOTI_TYPE_VOICE_1 : + { + char keyName[MAX_VCONFKEY_NAME_LEN] = {0,}; + snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_1, sim_idx); + noti_id = MsgSettingGetInt(keyName); + } + break; + case MSG_NOTI_TYPE_VOICE_2 : + { + char keyName[MAX_VCONFKEY_NAME_LEN] = {0,}; + snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_2, sim_idx); + noti_id = MsgSettingGetInt(keyName); + } + break; + case MSG_NOTI_TYPE_SIM_FULL : + noti_id = MsgSettingGetInt(SIM_FULL_NOTI_PRIV_ID); + break; + default : + MSG_DEBUG("No matching noti type [%d]", noti_type); + break; + } + + MSG_DEBUG("Get noti type = %d, id = %d, sim_idx:%d", noti_type, noti_id, sim_idx); + + MSG_END(); + + return noti_id; +} + + +void updatePrivId(msg_notification_type_t noti_type, int noti_id, int sim_idx) +{ + MSG_BEGIN(); + + msg_error_t err = MSG_SUCCESS; + + MSG_DEBUG("Update noti type = %d, id = %d, sim_idx = %d", noti_type, noti_id, sim_idx); + + switch (noti_type) + { +#ifdef MSG_NOTI_INTEGRATION + case MSG_NOTI_TYPE_NORMAL : + case MSG_NOTI_TYPE_SIM : + case MSG_NOTI_TYPE_CB : + err = MsgSettingSetInt(NOTIFICATION_PRIV_ID, noti_id); + break; +#else + case MSG_NOTI_TYPE_NORMAL : + err = MsgSettingSetInt(NOTIFICATION_PRIV_ID, noti_id); + break; + case MSG_NOTI_TYPE_SIM : + err = MsgSettingSetInt(SIM_MSG_NOTI_PRIV_ID, noti_id); + break; + case MSG_NOTI_TYPE_CB : + err = MsgSettingSetInt(CB_NOTI_PRIV_ID, noti_id); + break; +#endif + case MSG_NOTI_TYPE_FAILED : + err = MsgSettingSetInt(MSG_SENTFAIL_NOTI_ID, noti_id); + break; + case MSG_NOTI_TYPE_VOICE_1 : + { + char keyName[MAX_VCONFKEY_NAME_LEN] = {0,}; + snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_1, sim_idx); + err = MsgSettingSetInt(keyName, noti_id); + } + break; + case MSG_NOTI_TYPE_VOICE_2 : + { + char keyName[MAX_VCONFKEY_NAME_LEN] = {0,}; + snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_2, sim_idx); + err = MsgSettingSetInt(keyName, noti_id); + } + case MSG_NOTI_TYPE_SIM_FULL : + err = MsgSettingSetInt(SIM_FULL_NOTI_PRIV_ID, noti_id); + break; + default: + MSG_DEBUG("No matching type [%d]", noti_type); + break; + } + + if (err != MSG_SUCCESS) + MSG_INFO("MsgSettingSetInt fail : noti type = %d, id = %d, sim_idx = %d", noti_type, noti_id, sim_idx); + + MSG_END(); +} + + +void createInfoData(MSG_NOTI_INFO_S *noti_info, bool bTicker) +{ + MSG_BEGIN(); + + createServiceHandle(¬i_info->svc_h); + + switch (noti_info->type) + { + case MSG_NOTI_TYPE_NORMAL : + { + if (noti_info->count > 1) { + noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_MULTIPLE; + } else { + noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE; + } + + setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID); + addServiceExtraData(noti_info->svc_h, "type", "new_msg"); + addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id); + addServiceExtraData(noti_info->svc_h, "http://tizen.org/appcontrol/data/notification", "new_message"); + + bool bReplyPopup = false; + if (MsgSettingGetBool(VCONFKEY_MESSAGE_POPUP_DISPLAY_ENABLE , &bReplyPopup) != MSG_SUCCESS) { + MSG_DEBUG("MsgSettingGetBool is failed."); + } + + noti_info->applist = NOTIFICATION_DISPLAY_APP_ALL^NOTIFICATION_DISPLAY_APP_TICKER; + } + break; + + case MSG_NOTI_TYPE_CB : + { + if (noti_info->count > 1) { + noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_MULTIPLE; + } else { + noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE; + } + + setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID); + addServiceExtraData(noti_info->svc_h, "type", "new_msg"); + addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id); + + if (bTicker) + noti_info->applist = NOTIFICATION_DISPLAY_APP_ALL^NOTIFICATION_DISPLAY_APP_LOCK; + else + noti_info->applist = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY|NOTIFICATION_DISPLAY_APP_INDICATOR; + } + break; + + case MSG_NOTI_TYPE_SIM : + { + if (noti_info->count > 1) { + noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_MULTIPLE; + } else { + noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE; + } + + setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID); + addServiceExtraData(noti_info->svc_h, "type", "new_msg"); + addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id); + + if (bTicker) + noti_info->applist = NOTIFICATION_DISPLAY_APP_ALL^NOTIFICATION_DISPLAY_APP_LOCK; + else + noti_info->applist = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY|NOTIFICATION_DISPLAY_APP_INDICATOR; + } + break; + + case MSG_NOTI_TYPE_FAILED : + { + noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE; + + setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID); + addServiceExtraData(noti_info->svc_h, "type", "send_failed_msg"); + addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id); + + noti_info->applist = NOTIFICATION_DISPLAY_APP_ALL^NOTIFICATION_DISPLAY_APP_TICKER^NOTIFICATION_DISPLAY_APP_LOCK; + } + break; + + case MSG_NOTI_TYPE_SIM_FULL : + { + noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE; + + setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID); + addServiceExtraData(noti_info->svc_h, "sim_list_show", "sim_setting"); + + noti_info->applist = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY|NOTIFICATION_DISPLAY_APP_INDICATOR; + } + break; + + default : + break; + } + + MSG_END(); +} + + +void createInfoData(MSG_NOTI_INFO_S *noti_info, MSG_MESSAGE_INFO_S *msg_info) +{ + MSG_BEGIN(); + + if (msg_info) { + noti_info->id = getPrivId(noti_info->type, msg_info->sim_idx); + noti_info->msg_id = msg_info->msgId; + } else { + MSG_DEBUG("msg_info is NULL"); + return; + } + + noti_info->sim_idx = msg_info->sim_idx; + + createServiceHandle(¬i_info->svc_h); + char keyName[MAX_VCONFKEY_NAME_LEN]; + + switch (noti_info->type) + { + case MSG_NOTI_TYPE_VOICE_1 : + case MSG_NOTI_TYPE_VOICE_2 : + { + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_COUNT, msg_info->sim_idx); + noti_info->count = MsgSettingGetInt(keyName); + noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE; + noti_info->time = msg_info->displayTime; + + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, msg_info->sim_idx); + char *voiceNumber = MsgSettingGetString(keyName); + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_ALPHA_ID, msg_info->sim_idx); + char *voiceAlphaId = MsgSettingGetString(keyName); + char *dialNumber = NULL; + + MSG_SEC_DEBUG("Voice mail server - alpha id = [%s], default num = [%s]", voiceAlphaId, voiceNumber); + + if (voiceNumber && strlen(voiceNumber)) + dialNumber = voiceNumber; + + if (voiceAlphaId && strlen(voiceAlphaId) > 0) { + snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", voiceAlphaId); + } else if(dialNumber && strlen(dialNumber) > 0){ + snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", dialNumber); + } + + if(dialNumber && strlen(dialNumber) > 0) + snprintf(noti_info->number, sizeof(noti_info->number), "%s", dialNumber); + + setServiceAppId(noti_info->svc_h, "org.tizen.call"); + + addServiceExtraData(noti_info->svc_h, "launch-type", "MO"); + + addServiceExtraData(noti_info->svc_h, "number", "VOICEMAIL"); + + char slot_id[5] = {0,}; + snprintf(slot_id, sizeof(slot_id), "%d", msg_info->sim_idx - 1); + addServiceExtraData(noti_info->svc_h, "slot_id", slot_id); + + MSG_FREE(voiceNumber); + MSG_FREE(voiceAlphaId); + } + break; + + case MSG_NOTI_TYPE_MWI : + case MSG_NOTI_TYPE_CLASS0 : + { + noti_info->count = 1; + noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE; + noti_info->time = msg_info->displayTime; + + if (msg_info->addressList[0].displayName[0] == '\0') + snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", msg_info->addressList[0].addressVal); + else + snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", msg_info->addressList[0].displayName); + + snprintf(noti_info->number, sizeof(noti_info->number), "%s", msg_info->addressList[0].addressVal); + + snprintf(noti_info->text, sizeof(noti_info->text), "%s", msg_info->msgText); + + if (noti_info->type == MSG_NOTI_TYPE_MWI) { + setServiceAppId(noti_info->svc_h, "org.tizen.call"); + addServiceExtraData(noti_info->svc_h, "launch-type", "MO"); + addServiceExtraData(noti_info->svc_h, "number", "VOICEMAIL"); + + char slot_id[5] = {0,}; + snprintf(slot_id, sizeof(slot_id), "%d", msg_info->sim_idx - 1); + addServiceExtraData(noti_info->svc_h, "slot_id", slot_id); + + } else { + setServiceAppId(noti_info->svc_h, "org.tizen.msg-ui-class0"); + addServiceExtraData(noti_info->svc_h, "type", "new_msg"); + addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id); + } + } + break; + + case MSG_NOTI_TYPE_SMS_DELIVERY_REPORT : + { + noti_info->count = 1; + noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE; + noti_info->time = msg_info->displayTime; + noti_info->extra_data = msg_info->networkStatus; + + MSG_CONTACT_INFO_S contactInfo; + memset(&contactInfo, 0x00, sizeof(MSG_CONTACT_INFO_S)); + + if (MsgGetContactInfo(&(msg_info->addressList[0]), &contactInfo) != MSG_SUCCESS) { + MSG_DEBUG("MsgGetContactInfo() fail."); + } + + snprintf(msg_info->addressList[0].displayName, sizeof(msg_info->addressList[0].displayName), "%s", contactInfo.firstName); + + if (msg_info->addressList[0].displayName[0] == '\0') + snprintf(noti_info->sender, sizeof(noti_info->sender), "%s",msg_info->addressList[0].addressVal); + else + snprintf(noti_info->sender, sizeof(noti_info->sender), "%s",msg_info->addressList[0].displayName); + + snprintf(noti_info->number, sizeof(noti_info->number), "%s", msg_info->addressList[0].addressVal); + + if (noti_info->msg_id > 0) { + setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID); + addServiceExtraData(noti_info->svc_h, "type", "new_msg"); + addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id); + addServiceExtraData(noti_info->svc_h, "address", msg_info->addressList[0].addressVal); + } + } + break; + case MSG_NOTI_TYPE_MMS_READ_REPORT : + case MSG_NOTI_TYPE_MMS_DELIVERY_REPORT : + { + noti_info->count = 1; + noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE; + noti_info->time = msg_info->displayTime; + + MSG_CONTACT_INFO_S contactInfo; + memset(&contactInfo, 0x00, sizeof(MSG_CONTACT_INFO_S)); + + if (MsgGetContactInfo(&(msg_info->addressList[0]), &contactInfo) != MSG_SUCCESS) { + MSG_DEBUG("MsgGetContactInfo() fail."); + } + + snprintf(msg_info->addressList[0].displayName, sizeof(msg_info->addressList[0].displayName), "%s", contactInfo.firstName); + + if (msg_info->addressList[0].displayName[0] == '\0') + snprintf(noti_info->sender, sizeof(noti_info->sender), "%s",msg_info->addressList[0].addressVal); + else + snprintf(noti_info->sender, sizeof(noti_info->sender), "%s",msg_info->addressList[0].displayName); + + snprintf(noti_info->number, sizeof(noti_info->number), "%s",msg_info->addressList[0].addressVal); + + MsgDbHandler *dbhandler = getDbHandle(); + char sqlQuery[MAX_QUERY_LEN+1]; + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + int report_status_type; + int report_status_value; + + if (noti_info->type == MSG_NOTI_TYPE_MMS_READ_REPORT) { + report_status_type = MSG_REPORT_TYPE_READ; + } else { + report_status_type = MSG_REPORT_TYPE_DELIVERY; + } + + char *normalNum = NULL; + if (msg_info->addressList[0].addressVal[0] != '\0') { + normalNum = msg_normalize_number(msg_info->addressList[0].addressVal); + } + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT " + "STATUS " + "FROM %s " + "WHERE MSG_ID=%d AND STATUS_TYPE=%d AND ADDRESS_VAL LIKE '%%%s';", + MSGFW_REPORT_TABLE_NAME, msg_info->msgId, report_status_type, normalNum); + + MSG_DEBUG("sqlQuery = [%s]", sqlQuery); + + if (dbhandler->prepareQuery(sqlQuery) != MSG_SUCCESS) { + MSG_DEBUG("prepareQuery is failed"); + return; + } + + if (dbhandler->stepQuery() == MSG_ERR_DB_ROW) { + report_status_value = dbhandler->columnInt(0); + MSG_DEBUG("report status [type = %d, value = %d]", report_status_type, report_status_value); + } else { + MSG_DEBUG("DB Query Result Fail"); + dbhandler->finalizeQuery(); + return; + } + + dbhandler->finalizeQuery(); + + if (noti_info->msg_id > 0) { + setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID); + addServiceExtraData(noti_info->svc_h, "type", "new_msg"); + addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id); + addServiceExtraData(noti_info->svc_h, "address", msg_info->addressList[0].addressVal); + } + + noti_info->extra_data = (unsigned char)report_status_value; + } + break; + + default: + MSG_DEBUG("No matching type [%d]", noti_info->type); + break; + } + + noti_info->applist = NOTIFICATION_DISPLAY_APP_ALL^NOTIFICATION_DISPLAY_APP_LOCK; + + MSG_END(); +} + + +void clearInfoData(notification_h noti_h, MSG_NOTI_INFO_S *noti_info) +{ + MSG_BEGIN(); + + if (noti_h) { + notification_free(noti_h); + noti_h = NULL; + } + + if (noti_info->svc_h) { + app_control_destroy(noti_info->svc_h); + noti_info->svc_h = NULL; + } + + MSG_END(); +} + + +void setProperty(notification_h noti_h, MSG_NOTI_INFO_S *noti_info) +{ + MSG_BEGIN(); + + int noti_err = NOTIFICATION_ERROR_NONE; + + // set layout + noti_err = notification_set_layout(noti_h, (notification_ly_type_e)noti_info->layout); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_set_layout : %d", noti_err); + } + + // set led + noti_err = notification_set_led(noti_h, NOTIFICATION_LED_OP_ON, 0x00); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_set_led."); + } + + // set execute option + bundle *bundle_data = NULL; + bundle *reply_msg = NULL; + + app_control_to_bundle(noti_info->svc_h, &bundle_data); + + if (bundle_data == NULL) { + MSG_DEBUG("bundle is NULL"); + } + + // set execute option and property + switch (noti_info->type) + { + case MSG_NOTI_TYPE_NORMAL : + { + if (noti_info->count > 1) { + notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH, NULL, NULL, bundle_data); + notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_RESPONDING, NULL, NULL, NULL); + } else { + if (noti_info->svc_h){ // overwrite bundle key "type" + //addServiceExtraData(noti_info->svc_h, "type", "reply"); + addServiceExtraData(noti_info->svc_h, "show_list", "list_show"); + + app_control_to_bundle(noti_info->svc_h, &reply_msg); + } + notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, bundle_data); + notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_RESPONDING, NULL, NULL, reply_msg); + } + + notification_set_property(noti_h, NOTIFICATION_PROP_DISABLE_AUTO_DELETE); + } + break; + + case MSG_NOTI_TYPE_CB : + case MSG_NOTI_TYPE_SIM : + { + if (noti_info->count > 1) { + notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH, NULL, NULL, bundle_data); + } else { + notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, bundle_data); + } + + notification_set_property(noti_h, NOTIFICATION_PROP_DISABLE_AUTO_DELETE|NOTIFICATION_PROP_VOLATILE_DISPLAY); + } + break; + + case MSG_NOTI_TYPE_FAILED : + { + notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, bundle_data); + notification_set_property(noti_h, NOTIFICATION_PROP_DISABLE_AUTO_DELETE); + } + break; + + case MSG_NOTI_TYPE_SIM_FULL : + { + notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, bundle_data); + } + break; + + case MSG_NOTI_TYPE_VOICE_1 : + case MSG_NOTI_TYPE_VOICE_2 : + case MSG_NOTI_TYPE_MWI : + case MSG_NOTI_TYPE_CLASS0 : + case MSG_NOTI_TYPE_SMS_DELIVERY_REPORT : + case MSG_NOTI_TYPE_MMS_READ_REPORT : + case MSG_NOTI_TYPE_MMS_DELIVERY_REPORT : + { + notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, bundle_data); + } + break; + default: + MSG_DEBUG("No matching type for notification_set_execute_option() [%d]", noti_info->type); + break; + } + + // set applist + noti_err = notification_set_display_applist(noti_h, noti_info->applist); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_set_display_applist"); + } + + + MSG_END(); +} + + +void setTextDomain(notification_h noti_h, msg_notification_type_t noti_type) +{ + MSG_BEGIN(); + + setNotiTextDomain(noti_h, MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR); + MSG_END(); +} + + +void setText(notification_h noti_h, MSG_NOTI_INFO_S *noti_info) +{ + MSG_BEGIN(); + + char unreadMsgCntStr[10] = {0,}; + bool bPreview; + + if (MsgSettingGetBool(MSG_SETTING_PREVIEW, &bPreview) != MSG_SUCCESS) { + MSG_DEBUG("MsgSettingGetBool is failed."); + } + + // set title and content + switch (noti_info->type) + { +#ifdef MSG_NOTI_INTEGRATION + case MSG_NOTI_TYPE_NORMAL : + case MSG_NOTI_TYPE_CB : + case MSG_NOTI_TYPE_SIM : + { + if (noti_info->count > 1) { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "New Messages", NEW_MESSAGES); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL); + setNotiTime(noti_h, noti_info->time); + + snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL); + + } else { + if (bPreview) { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, noti_info->sender, NULL); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->text, NULL); + } else { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "New Message", NEW_MESSAGE); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL); + } + setNotiTime(noti_h, noti_info->time); + } + } + break; +#else + case MSG_NOTI_TYPE_NORMAL : + { + if (noti_info->count > 1) { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "New Messages", NEW_MESSAGES); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL); + setNotiTime(noti_h, noti_info->time); + + snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL); + + } else { + if (bPreview) { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, noti_info->sender, NULL); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->text, NULL); + } else { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "New Message", NEW_MESSAGE); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL); + } + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, "1", NULL); + setNotiTime(noti_h, noti_info->time); + } + } + break; + + case MSG_NOTI_TYPE_CB : + { + if (noti_info->count > 1) { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Broadcast message", CB_MESSAGE); + snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL); + setNotiTime(noti_h, noti_info->time); + + } else { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, "1", NULL); + setNotiTime(noti_h, noti_info->time); + + if (bPreview) { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, noti_info->sender, NULL); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->text, NULL); + } else { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Broadcast message", CB_MESSAGE); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL); + } + } + } + break; + + case MSG_NOTI_TYPE_SIM : + { + if (noti_info->count > 1) { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "SIM card Message", SIM_CARD_MESSAGE); + snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL); + + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL); + setNotiTime(noti_h, noti_info->time); + } else { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, "1", NULL); + setNotiTime(noti_h, noti_info->time); + + if (bPreview) { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, noti_info->sender, NULL); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->text, NULL); + } else { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "SIM card Message", SIM_CARD_MESSAGE); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL); + } + } + } + break; +#endif + case MSG_NOTI_TYPE_FAILED : + { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Message", MSG_MESSAGE); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, "Failed to send message.", FAILED_TO_SEND_MESSAGE); + snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL); + setNotiTime(noti_h, noti_info->time); + } + break; + + case MSG_NOTI_TYPE_VOICE_1 : + case MSG_NOTI_TYPE_VOICE_2 : + { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Voicemail", VOICE_MAIL); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL); + setNotiTime(noti_h, noti_info->time); + + if (noti_info->count == 1) { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, "1", NULL); + } else if (noti_info->count > 1) { + snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL); + } else { + MSG_DEBUG("Invalid notification count, [cnt = %d]", noti_info->count); + } + } + break; + + case MSG_NOTI_TYPE_MWI : + { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "MWI Message", NULL); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL); + setNotiTime(noti_h, noti_info->time); + } + break; + + case MSG_NOTI_TYPE_CLASS0 : + { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "CLASS 0 Message", NULL); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL); + setNotiTime(noti_h, noti_info->time); + } + break; + + case MSG_NOTI_TYPE_SMS_DELIVERY_REPORT : + { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Delivery report", DELIVERY_MESSAGE); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL); + + if(noti_info->extra_data == MSG_NETWORK_DELIVER_SUCCESS) { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message delivered", DELIVERED_MESSAGE); + } else if(noti_info->extra_data == MSG_NETWORK_DELIVER_EXPIRED) { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message expired", EXPIRED_MESSAGE); + } else { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message deferred", DEFERRED_MESSAGE); + } + + setNotiTime(noti_h, noti_info->time); + } + break; + + case MSG_NOTI_TYPE_MMS_READ_REPORT : + { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Read Report", READ_REPORT_MESSAGE); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL); + + if (noti_info->extra_data == MSG_READ_REPORT_IS_DELETED) { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message deleted", READ_REPORT_DELETE); + } + //CID 45672: noti_info->extra_data in unsigned char but MSG_READ_REPORT_NONE is -1. So the expression is always false +#if 0 + else if (noti_info->extra_data == MSG_READ_REPORT_NONE) { + //notification free + } +#endif + else { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message read", READ_REPORT_READ); + } + + setNotiTime(noti_h, noti_info->time); + } + break; + + case MSG_NOTI_TYPE_MMS_DELIVERY_REPORT : + { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Delivery Report", DELIVERY_MESSAGE); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL); + + if (noti_info->extra_data == MSG_DELIVERY_REPORT_EXPIRED) + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message expired", EXPIRED_MESSAGE); + else if (noti_info->extra_data == MSG_DELIVERY_REPORT_REJECTED) + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message rejected", REJECTED_MESSAGE); + else if (noti_info->extra_data == MSG_DELIVERY_REPORT_DEFERRED) + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message deferred", DEFERRED_MESSAGE); + else if (noti_info->extra_data == MSG_DELIVERY_REPORT_UNRECOGNISED) + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message unrecognised", UNRECOGNISED_MESSAGE); + else if (noti_info->extra_data == MSG_DELIVERY_REPORT_INDETERMINATE) + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message indeterminate", INDETEMINATE_MESSAGE); + else if (noti_info->extra_data == MSG_DELIVERY_REPORT_FORWARDED) + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message forwarded", NULL); + else if (noti_info->extra_data == MSG_DELIVERY_REPORT_UNREACHABLE) + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message unreachable", UNREACHABLE_MESSAGE); + else if (noti_info->extra_data == MSG_DELIVERY_REPORT_ERROR) + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message error", NULL); + + //CID 45672: noti_info->extra_data in unsigned char but MSG_READ_REPORT_NONE is -1. So the expression is always false +#if 0 + else if (noti_info->extra_data == MSG_DELIVERY_REPORT_NONE) { + //notification free + } +#endif + else + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message delivered", DELIVERED_MESSAGE); + + setNotiTime(noti_h, noti_info->time); + } + break; + + case MSG_NOTI_TYPE_SIM_FULL : + { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "SIM card full", SMS_SIM_CARD_FULL); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, "Not enough memory. Delete some items.", SMS_MESSAGE_MEMORY_FULL); + } + break; + default: + MSG_DEBUG("No matching type [%d]", noti_info->type); + break; + } + + MSG_END(); + +} + + +void setIcon(notification_h noti_h, MSG_NOTI_INFO_S *noti_info) +{ + MSG_BEGIN(); + + switch(noti_info->type) + { +#ifdef MSG_NOTI_INTEGRATION + case MSG_NOTI_TYPE_NORMAL : + case MSG_NOTI_TYPE_CB : + case MSG_NOTI_TYPE_SIM : + { + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON); + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_LOCK, MSG_NORMAL_ICON_PATH); + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH); + } + break; +#else + case MSG_NOTI_TYPE_NORMAL : + { + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON); + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_LOCK, MSG_NORMAL_ICON_PATH); + + if (noti_info->count > 1) { + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH); + } else { + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_REPLY_ICON_PATH); + } + } + break; + case MSG_NOTI_TYPE_CB : + { + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_CB_ICON_PATH); + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_CB_ICON_PATH); + } + break; + case MSG_NOTI_TYPE_SIM : + { + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_SIM_ICON_PATH); + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_SIM_ICON_PATH); + } + break; +#endif + case MSG_NOTI_TYPE_FAILED : + { + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH); + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON); + } + break; + case MSG_NOTI_TYPE_VOICE_1 : + case MSG_NOTI_TYPE_VOICE_2 : + case MSG_NOTI_TYPE_MWI : + { + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_VOICE_MSG_STATUS_ICON); + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_VOICE_ICON_PATH); + } + break; + case MSG_NOTI_TYPE_CLASS0 : + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH); + break; + case MSG_NOTI_TYPE_SMS_DELIVERY_REPORT : + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON); + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH); + break; + case MSG_NOTI_TYPE_MMS_READ_REPORT : + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON); + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH); + break; + case MSG_NOTI_TYPE_MMS_DELIVERY_REPORT : + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON); + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH); + break; + case MSG_NOTI_TYPE_SIM_FULL : + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH); + setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON); + break; + default: + MSG_DEBUG("No matching type for MsgNotiSetImage [%d]", noti_info->type); + break; + } + + MSG_END(); +} + +msg_error_t MsgInsertInstantMessage(msg_notification_type_t noti_type) +{ + MSG_BEGIN(); + + msg_error_t msg_err = MSG_SUCCESS; + char *notiMsg = NULL; + + notification_h noti = notification_create(NOTIFICATION_TYPE_NOTI); + + switch (noti_type) + { + case MSG_NOTI_TYPE_NORMAL : + case MSG_NOTI_TYPE_SIM : + case MSG_NOTI_TYPE_CB : + { + MSG_NOTI_INFO_S noti_info; + memset(¬i_info, 0x00, sizeof(MSG_NOTI_INFO_S)); + + noti_info.type = noti_type; + msg_err = getLatestMsgInfo(¬i_info, true); + + if (msg_err == MSG_SUCCESS) + { + MSG_DEBUG("Unread count [%d]", noti_info.count); + if (noti_info.count == 1) { + MSG_DEBUG("noti_info.sender [%s]",noti_info.sender); + setNotiText(noti, NOTIFICATION_TEXT_TYPE_TITLE, noti_info.sender, NULL); + setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info.text, NULL); + } + else if (noti_info.count > 1) { + gchar *cnt_string = g_strdup_printf("%i", noti_info.count); + + notiMsg = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, NEW_MESSAGES); + gchar *outString = g_strconcat(cnt_string, " ", notiMsg, NULL); + setNotiText(noti, NOTIFICATION_TEXT_TYPE_TITLE, outString, NULL); + setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info.sender, NULL); + g_free(outString); + g_free(cnt_string); + } + setNotiImage(noti, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH); + } + + } + break; + + case MSG_NOTI_TYPE_FAILED: + { + notiMsg = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, FAILED_TO_SEND_MESSAGE); + setNotiText(noti, NOTIFICATION_TEXT_TYPE_TITLE, notiMsg, NULL); + setNotiImage(noti, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH); + } + break; + + default: + MSG_DEBUG("No matching type for MsgNotiType%d]", noti_type); + goto _END_OF_INSTANT_NOTI; + break; + + } + + notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_TICKER); + notification_post(noti); + +_END_OF_INSTANT_NOTI: + + notification_delete(noti); + + if (notiMsg) { + free(notiMsg); + notiMsg = NULL; + } + + if (noti) { + notification_free(noti); + noti = NULL; + } + + MSG_END(); + return MSG_SUCCESS; +} + +void setPkgName(notification_h noti_h, msg_notification_type_t noti_type) +{ + MSG_BEGIN(); + + int noti_err = NOTIFICATION_ERROR_NONE; + + switch (noti_type) + { + case MSG_NOTI_TYPE_NORMAL : + case MSG_NOTI_TYPE_CB : + case MSG_NOTI_TYPE_SIM : + case MSG_NOTI_TYPE_FAILED : + case MSG_NOTI_TYPE_SMS_DELIVERY_REPORT : + case MSG_NOTI_TYPE_MMS_READ_REPORT : + case MSG_NOTI_TYPE_MMS_DELIVERY_REPORT : + case MSG_NOTI_TYPE_SIM_FULL : + { + noti_err = notification_set_pkgname(noti_h, MSG_DEFAULT_APP_ID); + if (noti_err != NOTIFICATION_ERROR_NONE) + MSG_DEBUG("notification_set_pkgname() is failed, [%d]", noti_err); + } + break; + default: + MSG_DEBUG("No matching type for notification_set_pkgname() [%d]", noti_type); + break; + } + + MSG_END(); +} + + +void setSoundAndVibration(notification_h noti_h, char *addressVal, bool bVoiceMail) +{ + MSG_BEGIN(); + + bool bBlockingMode = false; + + MSG_ADDRESS_INFO_S addrInfo; + memset(&addrInfo, 0x00, sizeof(MSG_ADDRESS_INFO_S)); + + MSG_CONTACT_INFO_S contactInfo; + memset(&contactInfo, 0x00, sizeof(MSG_CONTACT_INFO_S)); + + if (addressVal != NULL) { + snprintf(addrInfo.addressVal, sizeof(addrInfo.addressVal), "%s", addressVal); + // Get Contact Info + if (MsgGetContactInfo(&addrInfo, &contactInfo) != MSG_SUCCESS) { + MSG_DEBUG("MsgGetContactInfo() fail."); + } + bBlockingMode = checkBlockingMode(addressVal, NULL); + } else { + MSG_DEBUG("addressVal is NULL."); + } + + char *msg_tone_file_path = NULL; + AutoPtr buf(&msg_tone_file_path); + + MsgSoundPlayer::instance()->MsgGetRingtonePath(contactInfo.alerttonePath, &msg_tone_file_path); + + MSG_SEC_DEBUG("Sound File [%s]", msg_tone_file_path); + + bool bPlaySound = false; + bool bPlayVibration = false; + bool bOnCall = false; + + MsgSoundPlayer::instance()->MsgGetPlayStatus(bVoiceMail, &bPlaySound, &bPlayVibration, &bOnCall); + + if (!bBlockingMode) { // check blocking mode. + if (bPlaySound) { + if (msg_tone_file_path) + setNotiSound(noti_h, NOTIFICATION_SOUND_TYPE_USER_DATA, msg_tone_file_path); + else + setNotiSound(noti_h, NOTIFICATION_SOUND_TYPE_DEFAULT, NULL); + } else { + setNotiSound(noti_h, NOTIFICATION_SOUND_TYPE_NONE, NULL); + } + + if (bPlayVibration) { + if (contactInfo.vibrationPath[0] == '\0') + setNotiVibration(noti_h, NOTIFICATION_VIBRATION_TYPE_DEFAULT, NULL); + else + setNotiVibration(noti_h, NOTIFICATION_VIBRATION_TYPE_USER_DATA, contactInfo.vibrationPath); + } else { + setNotiVibration(noti_h, NOTIFICATION_VIBRATION_TYPE_NONE, NULL); + } + } else { + setNotiSound(noti_h, NOTIFICATION_SOUND_TYPE_NONE, NULL); + setNotiVibration(noti_h, NOTIFICATION_VIBRATION_TYPE_NONE, NULL); + } + MSG_END(); +} + + +void setNotification(notification_h noti_h, MSG_NOTI_INFO_S *noti_info, bool bFeedback) +{ + MSG_BEGIN(); + + int noti_err = NOTIFICATION_ERROR_NONE; + + setPkgName(noti_h, noti_info->type); + + setProperty(noti_h, noti_info); + + setTextDomain(noti_h, noti_info->type); + + setText(noti_h, noti_info); + + setIcon(noti_h, noti_info); + + if (bFeedback) { + setFlashNoti(); + + if (noti_info->type == MSG_NOTI_TYPE_VOICE_1 || noti_info->type == MSG_NOTI_TYPE_VOICE_2) + setSoundAndVibration(noti_h, noti_info->number, true); + else + setSoundAndVibration(noti_h, noti_info->number, false); + + } else { + setNotiSound(noti_h, NOTIFICATION_SOUND_TYPE_NONE, NULL); + setNotiVibration(noti_h, NOTIFICATION_VIBRATION_TYPE_NONE, NULL); + } + + if (noti_info->id > 0) { + MSG_DEBUG("Notification update"); + noti_err = notification_update(noti_h); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_update"); + } + } else { + MSG_DEBUG("Notification insert"); + noti_err = notification_insert(noti_h, ¬i_info->id); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_insert"); + } + + updatePrivId(noti_info->type, noti_info->id, noti_info->sim_idx); + } + + MSG_END(); +} + + +msg_error_t getLatestMsgInfo(MSG_NOTI_INFO_S *noti_info, bool isForInstantMessage) +{ + MSG_BEGIN(); + + MsgDbHandler *dbhandler = getDbHandle(); + int noti_err = NOTIFICATION_ERROR_NONE; + msg_error_t msg_err = MSG_SUCCESS; + + switch (noti_info->type) + { +#ifdef MSG_NOTI_INTEGRATION + case MSG_NOTI_TYPE_NORMAL : + case MSG_NOTI_TYPE_CB : + case MSG_NOTI_TYPE_SIM : +#else + case MSG_NOTI_TYPE_NORMAL : +#endif + { + int smsUnreadCnt = 0; + int mmsUnreadCnt = 0; + + char sqlQuery[MAX_QUERY_LEN+1]; + MSG_MAIN_TYPE_T mainType; + MSG_SUB_TYPE_T subType; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); +#ifdef MSG_NOTI_INTEGRATION + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DISTINCT " + "A.ADDRESS_VAL, " + "B.SUB_TYPE " + "FROM %s A, %s B " + "WHERE A.CONV_ID=B.CONV_ID " + "AND B.READ_STATUS=0 AND (B.FOLDER_ID=%d OR B.FOLDER_ID=%d) " + "AND B.STORAGE_ID = %d " + "GROUP BY A.ADDRESS_VAL " + "ORDER BY B.DISPLAY_TIME DESC LIMIT 5;", + MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, + MSG_INBOX_ID, MSG_CBMSGBOX_ID, + MSG_STORAGE_PHONE); +#else + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DISTINCT " + "A.ADDRESS_VAL, " + "B.SUB_TYPE " + "FROM %s A, %s B " + "WHERE A.CONV_ID=B.CONV_ID " + "AND B.READ_STATUS=0 AND B.FOLDER_ID=%d " + "AND B.STORAGE_ID = %d " + "GROUP BY A.ADDRESS_VAL " + "ORDER BY B.DISPLAY_TIME DESC LIMIT 5;", + MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, + MSG_INBOX_ID, + MSG_STORAGE_PHONE); +#endif + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + + int rowCnt = 0; + int index = 2; + + msg_err = dbhandler->getTable(sqlQuery, &rowCnt); + MSG_DEBUG("getTable() ret=[%d], rowCnt=[%d]", msg_err, rowCnt); + + MSG_ADDRESS_INFO_S tmpAddressInfo; + + for (int i = 1; i <= rowCnt; i++) { + memset(&tmpAddressInfo, 0x00, sizeof(MSG_ADDRESS_INFO_S)); + + char *address = dbhandler->getColumnToString(index++); + if (address) { + snprintf(tmpAddressInfo.addressVal, MAX_ADDRESS_VAL_LEN, "%s", address); + if (msg_is_valid_email(address)) { + tmpAddressInfo.addressType = MSG_ADDRESS_TYPE_EMAIL; + } + else { + tmpAddressInfo.addressType = MSG_ADDRESS_TYPE_UNKNOWN; + } + } + subType = dbhandler->getColumnToInt(index++); + + MSG_CONTACT_INFO_S tmpContact; + memset(&tmpContact, 0x00, sizeof(MSG_CONTACT_INFO_S)); + + MsgGetContactInfo(&tmpAddressInfo, &tmpContact); + + if (rowCnt == 1) { + snprintf(noti_info->imagePath, sizeof(noti_info->imagePath), "%s", tmpContact.imagePath); + } + + if (i > 1) { + g_strlcat(noti_info->sender, ", ", sizeof(noti_info->sender)-strlen(noti_info->sender)); + } + + if (tmpContact.firstName[0] != '\0') + g_strlcat(noti_info->sender, tmpContact.firstName, sizeof(noti_info->sender)-strlen(noti_info->sender)); + else if (tmpAddressInfo.addressVal[0] == '\0') { + char *senderStr = NULL; + senderStr = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, MSG_UNKNOWN_SENDER); + g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender)); + if (senderStr) { + free(senderStr); + senderStr = NULL; + } + } else { + char *senderStr = NULL; + if (subType == MSG_CB_SMS) + { + senderStr = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, CB_MESSAGE); + g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender)); + } + else if (subType == MSG_WAP_SI_SMS || subType == MSG_WAP_SL_SMS) { + senderStr = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, PUSH_MESSAGE); + g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender)); + } + else { + g_strlcat(noti_info->sender, tmpAddressInfo.addressVal, sizeof(noti_info->sender)-strlen(noti_info->sender)); + } + if (senderStr) { + free(senderStr); + senderStr = NULL; + } + } + } + + dbhandler->freeTable(); + + MSG_DEBUG("sender info = [%s]", noti_info->sender); + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + +#ifdef MSG_NOTI_INTEGRATION + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT " + "A.ADDRESS_VAL, " + "B.DISPLAY_TIME, " + "B.MSG_ID, " + "B.SUBJECT, " + "B.MSG_TEXT, " + "B.MAIN_TYPE, " + "(COUNT(CASE WHEN B.MAIN_TYPE = %d THEN 1 END)) AS SMS_UNREAD_CNT, " + "(COUNT(CASE WHEN B.MAIN_TYPE = %d THEN 1 END)) AS MMS_UNREAD_CNT " + "FROM %s A, %s B " + "WHERE A.CONV_ID=B.CONV_ID " + "AND B.READ_STATUS=0 AND (B.FOLDER_ID=%d OR B.FOLDER_ID=%d) " + "AND B.STORAGE_ID = %d " + "ORDER BY B.DISPLAY_TIME DESC;", + MSG_SMS_TYPE, + MSG_MMS_TYPE, + MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, + MSG_INBOX_ID, MSG_CBMSGBOX_ID, + MSG_STORAGE_PHONE); +#else + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT " + "A.ADDRESS_VAL, " + "B.DISPLAY_TIME, " + "B.MSG_ID, " + "B.SUBJECT, " + "B.MSG_TEXT, " + "B.MAIN_TYPE, " + "(COUNT(CASE WHEN B.MAIN_TYPE = %d THEN 1 END)) AS SMS_UNREAD_CNT, " + "(COUNT(CASE WHEN B.MAIN_TYPE = %d THEN 1 END)) AS MMS_UNREAD_CNT " + "FROM %s A, %s B " + "WHERE A.CONV_ID=B.CONV_ID " + "AND B.READ_STATUS=0 AND B.FOLDER_ID=%d " + "AND B.STORAGE_ID = %d " + "ORDER BY B.DISPLAY_TIME DESC;", + MSG_SMS_TYPE, + MSG_MMS_TYPE, + MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, + MSG_INBOX_ID, + MSG_STORAGE_PHONE); +#endif + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + + if (dbhandler->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbhandler->stepQuery() == MSG_ERR_DB_ROW) { + + smsUnreadCnt = dbhandler->columnInt(6); + mmsUnreadCnt = dbhandler->columnInt(7); + + noti_info->count = smsUnreadCnt + mmsUnreadCnt; + + if (noti_info->count > 0) { + snprintf(noti_info->number, sizeof(noti_info->number), "%s", (char*)dbhandler->columnText(0)); + + noti_info->time = (time_t)dbhandler->columnInt(1); + + noti_info->msg_id = (msg_message_id_t)dbhandler->columnInt(2); + + mainType = (MSG_MAIN_TYPE_T)dbhandler->columnInt(5); + + if (mainType == MSG_MMS_TYPE) { + snprintf(noti_info->text, sizeof(noti_info->text), "%s", (char*)dbhandler->columnText(3)); + if (noti_info->text[0] == '\0') { + char *noti_text = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, MSG_NO_SUBJECT); + snprintf(noti_info->text, sizeof(noti_info->text), "%s", noti_text); + g_free(noti_text); + } + } else { + snprintf(noti_info->text, sizeof(noti_info->text), "%s", (char*)dbhandler->columnText(4)); + } + + MSG_DEBUG("unread message ID [%d].", noti_info->msg_id); + + if (!isForInstantMessage) { + if (noti_info->id > 0 && noti_info->count == 1 ) { + noti_err = notification_delete_by_priv_id(MSG_DEFAULT_APP_ID, NOTIFICATION_TYPE_NOTI, noti_info->id); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_delete_by_priv_id : %d", noti_err); + } + noti_info->id = 0; + if(MsgSettingSetInt(NOTIFICATION_PRIV_ID, noti_info->id) != MSG_SUCCESS) + MSG_DEBUG("MsgSettingSetInt fail : NOTIFICATION_PRIV_ID"); + } + MsgSettingHandleNewMsg(smsUnreadCnt, mmsUnreadCnt); + MsgInsertBadge(noti_info->count); + MsgSoundSetRepeatAlarm(); + } + } else { + + MSG_DEBUG("No unread message."); + MSG_DEBUG("notiPrivId [%d]", noti_info->id); + + dbhandler->finalizeQuery(); + + if (!isForInstantMessage) { + // No unread message. + if (noti_info->id > 0) { + noti_err = notification_delete_by_priv_id(MSG_DEFAULT_APP_ID, NOTIFICATION_TYPE_NOTI, noti_info->id); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_delete_by_priv_id : %d", noti_err); + } + } + + noti_info->id = 0; + + if(MsgSettingSetInt(NOTIFICATION_PRIV_ID, noti_info->id) != MSG_SUCCESS) + MSG_DEBUG("MsgSettingSetInt fail : NOTIFICATION_PRIV_ID"); + + MsgSettingHandleNewMsg(0,0); + MsgInsertBadge(0); + MsgSoundSetRepeatAlarm(); + } + + return MSG_ERR_DB_STEP; + } + } else { + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + dbhandler->finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + dbhandler->finalizeQuery(); + } + break; + +#ifndef MSG_NOTI_INTEGRATION + case MSG_NOTI_TYPE_CB : + { + char sqlQuery[MAX_QUERY_LEN+1]; + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT " + "A.ADDRESS_VAL, " + "B.DISPLAY_TIME, " + "B.MSG_ID, " + "B.MSG_TEXT " + "FROM %s A, %s B " + "WHERE A.CONV_ID=B.CONV_ID " + "AND B.READ_STATUS=0 " + "AND B.FOLDER_ID=%d " + "AND B.STORAGE_ID = %d " + "ORDER BY B.DISPLAY_TIME DESC;", + MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, + MSG_CBMSGBOX_ID, + MSG_STORAGE_PHONE); + + if (dbhandler->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbhandler->stepQuery() == MSG_ERR_DB_ROW) { + MSG_ADDRESS_INFO_S addrInfo; + memset(&addrInfo, 0x00, sizeof(MSG_ADDRESS_INFO_S)); + + if (dbhandler->columnText(0) != NULL) + snprintf(addrInfo.addressVal, sizeof(addrInfo.addressVal), "%s", (char*)dbhandler->columnText(0)); + + MSG_CONTACT_INFO_S tmpContact; + memset(&tmpContact, 0x00, sizeof(MSG_CONTACT_INFO_S)); + + MsgGetContactInfo(&addrInfo, &tmpContact); + + if (tmpContact.firstName[0] != '\0') { + snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", tmpContact.firstName); + } else if (addrInfo.addressVal[0] == '\0') { + char *senderStr = NULL; + senderStr = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, MSG_UNKNOWN_SENDER); + g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender)); + if (senderStr) { + free(senderStr); + senderStr = NULL; + } + } else { + snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", addrInfo.addressVal); + } + + snprintf(noti_info->number, sizeof(noti_info->number), "%s", addrInfo.addressVal); + + noti_info->time = (time_t)dbhandler->columnInt(1); + + noti_info->msg_id = (msg_message_id_t)dbhandler->columnInt(2); + + snprintf(noti_info->text, sizeof(noti_info->text), "%s", (char*)dbhandler->columnText(3)); + + MSG_DEBUG("unread CB message [%d].", noti_info->msg_id); + } else { + + MSG_DEBUG("No unread CB message."); + MSG_DEBUG("notiCbId [%d]", noti_info->id); + + dbhandler->finalizeQuery(); + + if (!isForInstantMessage) { + // No unread message. + if (noti_info->id > 0) { + noti_err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, noti_info->id); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_delete_by_priv_id : %d", noti_err); + } + } + + noti_info->id = 0; + + if(MsgSettingSetInt(CB_NOTI_PRIV_ID, noti_info->id) != MSG_SUCCESS) + MSG_DEBUG("MsgSettingSetInt fail : CB_NOTI_PRIV_ID"); + } + + return MSG_ERR_DB_STEP; + } + + dbhandler->finalizeQuery(); + + if (dbhandler->getTable(sqlQuery, ¬i_info->count) != MSG_SUCCESS) { + MSG_DEBUG("getTable is failed"); + dbhandler->freeTable(); + return MSG_ERR_DB_GETTABLE; + } + + dbhandler->freeTable(); + MSG_DEBUG("notiCbId [%d], unreadCbMsgCnt [%d]", noti_info->id, noti_info->count); + } + break; + + case MSG_NOTI_TYPE_SIM : + { + char sqlQuery[MAX_QUERY_LEN+1]; + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT " + "A.ADDRESS_VAL, " + "B.DISPLAY_TIME, " + "B.MSG_ID, " + "B.MSG_TEXT, " + "(COUNT(CASE WHEN B.MAIN_TYPE = %d THEN 1 END)) AS SMS_UNREAD_CNT " + "FROM %s A, %s B " + "WHERE A.CONV_ID=B.CONV_ID " + "AND B.READ_STATUS=0 AND B.FOLDER_ID=%d " + "AND B.STORAGE_ID = %d " + "ORDER BY B.DISPLAY_TIME DESC;", + MSG_SMS_TYPE, + MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, + MSG_INBOX_ID, + MSG_STORAGE_SIM); + + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + + if (dbhandler->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbhandler->stepQuery() == MSG_ERR_DB_ROW) { + + noti_info->count = dbhandler->columnInt(4); + + if (noti_info->count > 0) { + MSG_ADDRESS_INFO_S addrInfo; + memset(&addrInfo, 0x00, sizeof(MSG_ADDRESS_INFO_S)); + + if (dbhandler->columnText(0) != NULL) + snprintf(addrInfo.addressVal, sizeof(addrInfo.addressVal), "%s", (char*)dbhandler->columnText(0)); + + MSG_CONTACT_INFO_S tmpContact; + memset(&tmpContact, 0x00, sizeof(MSG_CONTACT_INFO_S)); + + MsgGetContactInfo(&addrInfo, &tmpContact); + + if (tmpContact.firstName[0] != '\0') { + snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", tmpContact.firstName); + } else if (addrInfo.addressVal[0] == '\0') { + char *senderStr = NULL; + senderStr = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, MSG_UNKNOWN_SENDER); + g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender)); + if (senderStr) { + free(senderStr); + senderStr = NULL; + } + } else { + snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", addrInfo.addressVal); + } + + snprintf(noti_info->number, sizeof(noti_info->number), "%s", addrInfo.addressVal); + + noti_info->time = (time_t)dbhandler->columnInt(1); + + noti_info->msg_id = (msg_message_id_t)dbhandler->columnInt(2); + + snprintf(noti_info->text, sizeof(noti_info->text), "%s", (char*)dbhandler->columnText(3)); + + MSG_DEBUG("unread SIM message [%d].", noti_info->msg_id); + } else { + + MSG_DEBUG("No unread SIM message."); + MSG_DEBUG("notiPrivId [%d]", noti_info->id); + + dbhandler->finalizeQuery(); + + if (!isForInstantMessage) { + // No unread message. + if (noti_info->id > 0) { + noti_err = notification_delete_by_priv_id(MSG_DEFAULT_APP_ID, NOTIFICATION_TYPE_NOTI, noti_info->id); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_delete_by_priv_id : %d", noti_err); + } + } + + noti_info->id = 0; + + if(MsgSettingSetInt(SIM_MSG_NOTI_PRIV_ID, noti_info->id) != MSG_SUCCESS) + MSG_DEBUG("MsgSettingSetInt fail : SIM_MSG_NOTI_PRIV_ID"); + } + + return MSG_ERR_DB_STEP; + } + } else { + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + dbhandler->finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + dbhandler->finalizeQuery(); + } + break; +#endif + case MSG_NOTI_TYPE_FAILED : + { + MSG_MAIN_TYPE_T mainType; + char sqlQuery[MAX_QUERY_LEN+1]; + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT " + "A.ADDRESS_VAL, " + "B.DISPLAY_TIME, " + "B.MSG_ID, " + "B.MSG_TEXT, " + "B.SUBJECT, " + "B.MAIN_TYPE, " + "(COUNT(CASE WHEN B.NETWORK_STATUS = %d THEN 1 END)) AS SENT_FAILED_CNT " + "FROM %s A, %s B " + "WHERE A.CONV_ID=B.CONV_ID " + "AND B.READ_STATUS=0 AND B.FOLDER_ID=%d " + "AND B.STORAGE_ID = %d " + "ORDER BY B.DISPLAY_TIME DESC;", + MSG_NETWORK_SEND_FAIL, + MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, + MSG_OUTBOX_ID, + MSG_STORAGE_PHONE); + + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + + if (dbhandler->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbhandler->stepQuery() == MSG_ERR_DB_ROW) { + + noti_info->count = dbhandler->columnInt(6); + + if (noti_info->count > 0) { + MSG_ADDRESS_INFO_S addrInfo; + memset(&addrInfo, 0x00, sizeof(MSG_ADDRESS_INFO_S)); + + if (dbhandler->columnText(0) != NULL) + snprintf(addrInfo.addressVal, sizeof(addrInfo.addressVal), "%s", (char*)dbhandler->columnText(0)); + + MSG_CONTACT_INFO_S tmpContact; + memset(&tmpContact, 0x00, sizeof(MSG_CONTACT_INFO_S)); + + MsgGetContactInfo(&addrInfo, &tmpContact); + + if (tmpContact.firstName[0] != '\0') { + snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", tmpContact.firstName); + } else if (addrInfo.addressVal[0] == '\0') { + char *senderStr = NULL; + senderStr = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, MSG_UNKNOWN_SENDER); + g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender)); + if (senderStr) { + free(senderStr); + senderStr = NULL; + } + } else { + snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", addrInfo.addressVal); + } + + snprintf(noti_info->number, sizeof(noti_info->number), "%s", addrInfo.addressVal); + + noti_info->time = (time_t)dbhandler->columnInt(1); + + noti_info->msg_id = (msg_message_id_t)dbhandler->columnInt(2); + + mainType = (MSG_MAIN_TYPE_T)dbhandler->columnInt(5); + + if (mainType == MSG_TYPE_MMS) + snprintf(noti_info->text, sizeof(noti_info->text), "%s", (char*)dbhandler->columnText(4)); + else + snprintf(noti_info->text, sizeof(noti_info->text), "%s", (char*)dbhandler->columnText(3)); + + MSG_DEBUG("Sent failed message ID [%d].", noti_info->msg_id); + } else { + + MSG_DEBUG("No sent failed message."); + MSG_DEBUG("failedNotiId [%d]", noti_info->id); + + dbhandler->finalizeQuery(); + + if (!isForInstantMessage) { + // No unread message. + if (noti_info->id > 0) { + noti_err = notification_delete_by_priv_id(MSG_DEFAULT_APP_ID, NOTIFICATION_TYPE_NOTI, noti_info->id); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_delete_by_priv_id : %d", noti_err); + } + } + + noti_info->id = 0; + + if (MsgSettingSetInt(MSG_SENTFAIL_NOTI_ID, noti_info->id) != MSG_SUCCESS) + MSG_DEBUG("MsgSettingSetInt fail : MSG_SENTFAIL_NOTI_ID"); + } + + return MSG_ERR_DB_STEP; + } + } else { + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + dbhandler->finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + dbhandler->finalizeQuery(); + } + break; + + case MSG_NOTI_TYPE_SIM_FULL : + break; + + default: + { + MSG_DEBUG("No matching type [%d]", noti_info->type); + return MSG_ERR_UNKNOWN; + } + break; + } + + MSG_END(); + + return MSG_SUCCESS; +} + + +void setFlashNoti(void) +{ + MSG_BEGIN(); + + int ret = 0; + + if (!bFeedbackInit) { + int ret = feedback_initialize(); + + if (ret != FEEDBACK_ERROR_NONE) { + MSG_DEBUG("Fail to feedback_initialize : [%d]", ret); + bFeedbackInit = false; + return; + } else { + MSG_DEBUG("Success to feedback_initialize."); + bFeedbackInit = true; + } + } + + ret = feedback_play_type(FEEDBACK_TYPE_LED, FEEDBACK_PATTERN_MESSAGE); + if (ret != FEEDBACK_ERROR_NONE) + MSG_DEBUG("Fail to feedback_play_type"); + + MSG_END(); +} + + +void createServiceHandle(app_control_h *svc_h) +{ + int svc_err = APP_CONTROL_ERROR_NONE; + + svc_err = app_control_create(svc_h); + + if (svc_err != APP_CONTROL_ERROR_NONE) + MSG_DEBUG("app_control_create() is failed, [%d]", svc_err); +} + + +void setServiceAppId(app_control_h svc_h, const char* app_id) +{ + int svc_err = APP_CONTROL_ERROR_NONE; + + svc_err = app_control_set_app_id(svc_h, app_id); + + if (svc_err != APP_CONTROL_ERROR_NONE) + MSG_DEBUG("app_control_set_app_id() was failed, [%d]", svc_err); +} + + +void setServiceOperation(app_control_h svc_h, const char* operation) +{ + int svc_err = APP_CONTROL_ERROR_NONE; + + svc_err = app_control_set_operation(svc_h, operation); + + if (svc_err != APP_CONTROL_ERROR_NONE) + MSG_DEBUG("app_control_set_operation() was failed, [%d]", svc_err); +} + + +void addServiceExtraData(app_control_h svc_h, const char* bundle_key, const char* bundle_val) +{ + int svc_err = APP_CONTROL_ERROR_NONE; + + svc_err = app_control_add_extra_data(svc_h, bundle_key, bundle_val); + + if (svc_err != APP_CONTROL_ERROR_NONE) + MSG_DEBUG("app_control_add_extra_data() was failed, [%d]", svc_err); +} + + +void addServiceExtraData(app_control_h svc_h, const char* bundle_key, int bundle_val) +{ + int svc_err = APP_CONTROL_ERROR_NONE; + + char tempId[10]; + memset(&tempId, 0x00, sizeof(tempId)); + snprintf(tempId, sizeof(tempId), "%d", bundle_val); + + svc_err = app_control_add_extra_data(svc_h, bundle_key, (const char *)tempId); + + if (svc_err != APP_CONTROL_ERROR_NONE) + MSG_DEBUG("app_control_add_extra_data() was failed, [%d]", svc_err); +} + + +void setServicePackageName(app_control_h svc_h, const char* pkg_name) +{ + int svc_err = APP_CONTROL_ERROR_NONE; + + svc_err = app_control_set_app_id(svc_h, pkg_name); + + if (svc_err != APP_CONTROL_ERROR_NONE) + MSG_DEBUG("app_control_set_app_id() was failed, [%d]", svc_err); +} + + +void sendServicelaunchRequest(app_control_h svc_h, app_control_reply_cb callback, void *user_data) +{ + int svc_err = APP_CONTROL_ERROR_NONE; + + svc_err = app_control_send_launch_request(svc_h, callback, user_data); + + if (svc_err != APP_CONTROL_ERROR_NONE) + MSG_DEBUG("app_control_send_launch_request() is failed : %d", svc_err); +} + + +void setNotiTextDomain(notification_h noti_h, const char *pkg_name, const char *loc_dir) +{ + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_set_text_domain(noti_h, pkg_name, loc_dir); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("notification_set_text_domain() was failed. [%d]", noti_err); + } +} + + +void setNotiText(notification_h noti_h, notification_text_type_e type, const char *text, const char *key) +{ + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_set_text(noti_h, type, text, key, NOTIFICATION_VARIABLE_TYPE_NONE); + + if (noti_err != NOTIFICATION_ERROR_NONE) + MSG_DEBUG("notification_set_text() was failed. [%d]", noti_err); +} + + +void setNotiTimeToText(notification_h noti_h, notification_text_type_e type, time_t time) +{ + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_set_time_to_text(noti_h, type, time); + + if (noti_err != NOTIFICATION_ERROR_NONE) + MSG_DEBUG("notification_set_time_to_text() was failed. [%d]", noti_err); +} + + +void setNotiTime(notification_h noti_h, time_t time) +{ + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_set_time(noti_h, time); + + if (noti_err != NOTIFICATION_ERROR_NONE) + MSG_DEBUG("notification_set_time() was failed. [%d]", noti_err); +} + + + +void setNotiImage(notification_h noti_h, notification_image_type_e type, const char *image_path) +{ + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_set_image(noti_h, type, image_path); + + if (noti_err != NOTIFICATION_ERROR_NONE) + MSG_DEBUG("notification_set_image() was failed. [%d]", noti_err); +} + + +void setNotiSound(notification_h noti_h, notification_sound_type_e type, const char *path) +{ + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_set_sound(noti_h, type, path); + + if (noti_err != NOTIFICATION_ERROR_NONE) + MSG_DEBUG("notification_set_sound() was failed. [%d]", noti_err); +} + + +void setNotiVibration(notification_h noti_h, notification_vibration_type_e type, const char *path) +{ + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_set_vibration(noti_h, type, path); + + if (noti_err != NOTIFICATION_ERROR_NONE) + MSG_DEBUG("notification_set_vibration() was failed. [%d]", noti_err); +} + + +char *getTranslateText(const char *pkg_name, const char *locale_dir, const char *text) +{ + char *notiMsg = NULL; + char *lang = NULL; + + lang = vconf_get_str(VCONFKEY_LANGSET); + + setlocale(LC_MESSAGES, lang); + + bindtextdomain(pkg_name, locale_dir); + + notiMsg = dgettext(pkg_name, text); + + if (lang) { + free(lang); + lang = NULL; + } + + return g_strdup(notiMsg); +} + +void MsgNotiSoundRepeatAlarmCB(int alarmId) +{ + MSG_BEGIN(); + + MsgRefreshNotification(MSG_NOTI_TYPE_NORMAL, true, true); + +#ifndef MSG_NOTI_INTEGRATION + MsgRefreshNotification(MSG_NOTI_TYPE_SIM, true, true); + MsgRefreshNotification(MSG_NOTI_TYPE_CB, true, true); +#endif + + MSG_END(); + return; +} + + +void MsgSoundCreateRepeatAlarm(int RepeatTime) +{ + MSG_BEGIN(); + + int tmpAlarmId = 0; + time_t tmp_time; + struct tm repeat_tm; + + time(&tmp_time); + + tmp_time += (RepeatTime*60); + tzset(); + localtime_r(&tmp_time, &repeat_tm); + + if (MsgAlarmRegistration(&repeat_tm, MsgNotiSoundRepeatAlarmCB, &tmpAlarmId) != MSG_SUCCESS) { + MSG_DEBUG("MsgAlarmRegistration fail."); + return; + } + + g_alarmId = tmpAlarmId; + MSG_DEBUG("Set alarmId to [%d]", g_alarmId); + + MSG_END(); + + return; +} + + +void MsgSoundSetRepeatAlarm() +{ + int nRepeatValue = 0; + long nRepeatTime = 0; + + nRepeatValue = MsgSettingGetInt(MSG_ALERT_REP_TYPE); + + switch (nRepeatValue) + { + case MSG_ALERT_TONE_ONCE: + nRepeatTime = 0; + break; + + case MSG_ALERT_TONE_2MINS: + nRepeatTime = 2; + break; + + case MSG_ALERT_TONE_5MINS: + nRepeatTime = 5; + break; + + case MSG_ALERT_TONE_10MINS: + nRepeatTime = 10; + break; + + default: + MSG_DEBUG("Invalid Repetition time"); + break; + } + + MSG_DEBUG("nRepeatTime = %d", nRepeatTime); + + if (nRepeatTime > 0) { + if (g_alarmId > 0) { + if (MsgAlarmRemove(g_alarmId) != MSG_SUCCESS) { + MSG_FATAL("MsgAlarmRemove fail."); + } + g_alarmId = 0; + } + MsgSoundCreateRepeatAlarm(nRepeatTime); + } + + return; +} + + +void sendMsgReplyPopup(MSG_NOTI_INFO_S *noti_info) +{ + app_control_h svc_h = NULL; + + createServiceHandle(&svc_h); + + if (svc_h) { + setServicePackageName(svc_h, "org.tizen.msg-ui-reply"); + + MSG_DEBUG("Reply-popup display - Msg Id = [%d]", noti_info->msg_id); + addServiceExtraData(svc_h, "msgId", noti_info->msg_id); + + sendServicelaunchRequest(svc_h, NULL, NULL); + + app_control_destroy(svc_h); + } +} diff --git a/msg_helper/MsgSensorWrapper.cpp b/externals/MsgSensorWrapper.cpp similarity index 69% rename from msg_helper/MsgSensorWrapper.cpp rename to externals/MsgSensorWrapper.cpp index 5f24c92..1dc502d 100755 --- a/msg_helper/MsgSensorWrapper.cpp +++ b/externals/MsgSensorWrapper.cpp @@ -1,32 +1,33 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ + #include "MsgDebug.h" #include "MsgCppTypes.h" #include "MsgGconfWrapper.h" -#include "MsgHelper.h" +#include "MsgSensorWrapper.h" -#include +#include /*================================================================================================== VARIABLES ==================================================================================================*/ int sensorHandler = -1; -msg_sensor_cb cbFunction = NULL; +msg_sensor_cb SensorCBFunction = NULL; /*================================================================================================== FUNCTION IMPLEMENTATION @@ -42,8 +43,9 @@ void MsgSensorCB(unsigned int event_type, sensor_event_data_t *event_data , void if(*my_event_data == MOTION_ENGIEN_TOP_TO_BOTTOM_DETECTION) { MSG_DEBUG("top to bottom event detected."); if(MsgSettingGetInt(VCONFKEY_SETAPPL_MOTION_ACTIVATION)) - if(MsgSettingGetInt(VCONFKEY_SETAPPL_USE_TURN_OVER)) - cbFunction(); + if(MsgSettingGetInt(VCONFKEY_SETAPPL_USE_TURN_OVER)) { + if(SensorCBFunction) SensorCBFunction(); + } } } @@ -62,8 +64,8 @@ msg_error_t MsgSensorConnect() void MsgSensorDisconnect() { - if(cbFunction != NULL) - cbFunction = NULL; + if(SensorCBFunction != NULL) + SensorCBFunction = NULL; if (sensorHandler < 0) return; @@ -91,7 +93,7 @@ msg_error_t MsgRegSensorCB(msg_sensor_cb cb) if(cb != NULL) { // regist cb. - cbFunction = cb; + SensorCBFunction = cb; } else { MSG_DEBUG("cb is NULL."); return MSG_ERR_UNKNOWN; diff --git a/externals/MsgSoundPlayer.cpp b/externals/MsgSoundPlayer.cpp new file mode 100755 index 0000000..f91a1e5 --- /dev/null +++ b/externals/MsgSoundPlayer.cpp @@ -0,0 +1,792 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +#include + +#include "MsgDebug.h" +#include "MsgCppTypes.h" +#include "MsgGconfWrapper.h" +#include "MsgSettingTypes.h" +#include "MsgDrmWrapper.h" +#include "MsgSensorWrapper.h" +#include "MsgUtilFile.h" +#include "MsgStorageTypes.h" +#include "MsgContact.h" +#include "MsgAlarm.h" +#include "MsgNotificationWrapper.h" +#include "MsgSoundPlayer.h" + +#include +#include +#include +#include + +#include + +/*================================================================================================== + DEFINES +==================================================================================================*/ +#define MAX_SOUND_FILE_LEN 1024 + +#define DEFAULT_ALERT_FILE "/opt/usr/share/settings/Alerts/notification_sdk.wav" + +#define HAPTIC_TEST_ITERATION 1 +#define MSG_VIBRATION_INTERVAL 3000 +#define MSG_SOUND_TIMEOUT 5500 + + +/*================================================================================================== + VARIABLES +==================================================================================================*/ +MMHandleType hPlayerHandle = 0; + +pthread_mutex_t muMmPlay = PTHREAD_MUTEX_INITIALIZER; + +/*================================================================================================== + IMPLEMENTATION OF Functions +==================================================================================================*/ +void MsgSoundRepeatAlarmCB(int alarmId) +{ + MSG_BEGIN(); + + MsgSoundPlayer::instance()->MsgSoundInitRepeatAlarm(); + + MSG_END(); + return; +} + + +void MsgSensorCBStop() +{ + MSG_BEGIN(); + +#if 0 + MsgSoundPlayer::instance()->MsgSoundPlayStop(); +#else + MsgDeleteNotification(MSG_NOTI_TYPE_ALL); + + MsgRefreshNotification(MSG_NOTI_TYPE_ALL, false, false); + +#ifndef MSG_NOTI_INTEGRATION + MsgRefreshNotification(MSG_NOTI_TYPE_SIM, false, false); +#endif + +#endif + + MSG_END(); +} + + +//static gboolean MsgSoundMelodyTimeout(gpointer data) +//{ +// MSG_BEGIN(); +// +// MsgSoundPlayer::instance()->MsgSoundPlayStop(); +// +// MSG_END(); +// +// return FALSE; +//} + + +static int MsgSoundPlayCallback(int message, void *param, void *user_param) +{ + switch (message) + { + case MM_MESSAGE_BEGIN_OF_STREAM: + MSG_DEBUG("Play is started."); + break; + case MM_MESSAGE_END_OF_STREAM: + case MM_MESSAGE_STATE_INTERRUPTED: + MSG_DEBUG("EOS or Interrupted."); + MsgSoundPlayer::instance()->MsgSoundPlayStop(); + break; + case MM_MESSAGE_FILE_NOT_SUPPORTED: + case MM_MESSAGE_FILE_NOT_FOUND: + case MM_MESSAGE_DRM_NOT_AUTHORIZED: + case MM_MESSAGE_ERROR: + MSG_DEBUG("message [%d] & play with default", message); + MsgSoundPlayer::instance()->MsgSoundPlayStart(NULL, MSG_SOUND_PLAY_DEFAULT); + break; + default: + MSG_DEBUG("message [%d]", message); + break; + } + + return 1; +} + +/*================================================================================================== + IMPLEMENTATION OF MsgSoundPlayer - Member Functions +==================================================================================================*/ +MsgSoundPlayer* MsgSoundPlayer::pInstance = NULL; + + +MsgSoundPlayer::MsgSoundPlayer() +{ + bPlaying = false; + bVibrating = false; + bFeedbackInit = false; + g_alarmId = 0; + + defaultRingtonePath = NULL; + + defaultRingtonePath = MsgSettingGetString(VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR); + + if (defaultRingtonePath == NULL || MsgGetFileSize(defaultRingtonePath) < 1) { + defaultRingtonePath = (char *)DEFAULT_ALERT_FILE; + } + + MSG_DEBUG("defaultRingtonePath [%s]", defaultRingtonePath); + + if (MsgSensorConnect() == MSG_SUCCESS) { + if (MsgRegSensorCB(&MsgSensorCBStop) != MSG_SUCCESS) { + MSG_DEBUG("Fail to MsgRegSensorCB."); + MsgSensorDisconnect(); + } + } else { + MSG_DEBUG("Fail to MsgSensorConnect."); + } +} + + +MsgSoundPlayer::~MsgSoundPlayer() +{ + +} + + +MsgSoundPlayer* MsgSoundPlayer::instance() +{ + if (!pInstance) { + MSG_DEBUG("pInstance is NULL. Now creating instance."); + pInstance = new MsgSoundPlayer(); + } + + return pInstance; +} + + +void MsgSoundPlayer::MsgGetRingtonePath(char *userRingtonePath, char **msg_tone_file_path_p) +{ + char *tmpFilePath = NULL; + *msg_tone_file_path_p = new char[MSG_FILEPATH_LEN_MAX+1]; + + char *msg_tone_file_path = *msg_tone_file_path_p; + + MSG_RINGTONE_TYPE_T ringtoneType = (MSG_RINGTONE_TYPE_T)MsgSettingGetInt(MSG_SETTING_RINGTONE_TYPE); + + MSG_DEBUG("Ringtone type = [%d]", ringtoneType); + + if (ringtoneType == MSG_RINGTONE_TYPE_SILENT) { + *msg_tone_file_path_p = NULL; + return; + } + + if(userRingtonePath && userRingtonePath[0] != '\0') { + tmpFilePath = userRingtonePath; + } else { + if (ringtoneType == MSG_RINGTONE_TYPE_DEFAULT) { + tmpFilePath = MsgSettingGetString(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR); + } else { + tmpFilePath = MsgSettingGetString(MSG_SETTING_RINGTONE_PATH); + } + } + + memset(msg_tone_file_path, 0x00, sizeof(char)*(MSG_FILEPATH_LEN_MAX+1)); + + if ((tmpFilePath == NULL || MsgGetFileSize(tmpFilePath) < 1) || // wrong ringtone file path + (MsgDrmIsDrmFile(tmpFilePath) && !MsgDrmCheckRingtone(tmpFilePath))) { // check DRM + if (tmpFilePath && (strcmp(tmpFilePath, "silent") == 0)) { + MSG_DEBUG("Set ringtone to NONE(Silent)"); + msg_tone_file_path = NULL; + } else { + MSG_DEBUG("Set ringtone to defaultRingtonePath."); + strncpy(msg_tone_file_path, defaultRingtonePath, MSG_FILEPATH_LEN_MAX); + } + } else { + MSG_DEBUG("Set ringtone to tmpFilePath."); + strncpy(msg_tone_file_path, tmpFilePath, MSG_FILEPATH_LEN_MAX); + } + + if (tmpFilePath && userRingtonePath[0] == '\0') { + free(tmpFilePath); + tmpFilePath = NULL; + } +} + + +bool MsgIsSoundPlayOnCall(void) +{ + bool bPlayOnCall = false; + int err = MM_ERROR_NONE; + + mm_sound_device_in soundIn = MM_SOUND_DEVICE_IN_NONE; + mm_sound_device_out soundOut = MM_SOUND_DEVICE_OUT_NONE; + + err = mm_sound_get_active_device(&soundIn, &soundOut); + + if (err == MM_ERROR_NONE) { + if (soundOut & (MM_SOUND_DEVICE_OUT_RECEIVER|MM_SOUND_DEVICE_OUT_SPEAKER)) + bPlayOnCall = false; + else + bPlayOnCall = true; + + MSG_DEBUG("mm_sound_device_out=[%04x],bPlayOnCall=[%d]", soundOut, bPlayOnCall); + } else { + MSG_DEBUG("mm_sound_get_active_device() err=[%d]", err); + } + + return bPlayOnCall; +} + + +void MsgSoundPlayer::MsgGetPlayStatus(bool bVoiceMail, bool *bPlaySound, bool *bPlayVibration, bool *bOnCall) +{ + MSG_BEGIN(); + + if (!bPlaySound || !bPlayVibration || !bOnCall) { + MSG_DEBUG("IN parameter is NULL."); + return; + } + + *bPlaySound = false; + *bPlayVibration = false; + *bOnCall = false; + + /* Global setting */ + bool bSoundOn = false; // sound setting on notification panel + bool bVibrationOn = false; // vibration setting on notification panel + + /* Alert setting */ +#if 0 //not used value + bool bNotiVibrationOn = false; // alert vibration + MsgSettingGetBool(VCONFKEY_SETAPPL_VIBRATE_WHEN_NOTIFICATION_BOOL, &bNotiVibrationOn); +#endif + + bool bMsgSettingNoti = true; // Alert for message notification + bool bMsgSettingVibration = false; // vibration for message notification + + MsgSettingGetBool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &bSoundOn); + MsgSettingGetBool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &bVibrationOn); + + MsgSettingGetBool(MSG_SETTING_VIBRATION, &bMsgSettingVibration); + MsgSettingGetBool(MSG_SETTING_NOTIFICATION, &bMsgSettingNoti); + + MSG_SEC_DEBUG("Sound status : Sound mode=[%d], Manner mode=[%d]", bSoundOn, bVibrationOn); + MSG_SEC_DEBUG("Msg Setting : Noti Alert=[%d], With vibration=[%d]", bMsgSettingNoti, bMsgSettingVibration); + + int callStatus = 0; + int alertOnCall = 0; + + callStatus = MsgSettingGetInt(VCONFKEY_CALL_STATE); + MSG_DEBUG("Call Status [%d]", callStatus); + + /* Check call status */ + if (callStatus > VCONFKEY_CALL_OFF && callStatus < VCONFKEY_CALL_STATE_MAX) { + /* 1. On Call */ + + *bOnCall = true; // set call status; + + alertOnCall = MsgSettingGetInt(VCONFKEY_CISSAPPL_ALERT_ON_CALL_INT); + MSG_DEBUG("Alert On Call [%d]", alertOnCall); + + if (alertOnCall == 0) { + MSG_DEBUG("Call is active & Alert on Call - Off"); + } else if (alertOnCall == 1) { + /* set default value to true, while on Call alert sound to be played and vibration to be off. */ + bool bPlayOnCall = true; + + if (!bSoundOn) { + /* check whther sound should be on when sound setting on notification panel is off */ + bPlayOnCall = MsgIsSoundPlayOnCall(); + } + + if (bVoiceMail) { /* 1-1. Voice message */ + if (bPlayOnCall && bMsgSettingNoti) { + MSG_DEBUG("On call, Play sound - voice message"); + *bPlaySound = true; + } else { + MSG_DEBUG("On call, It doesn't play sound - voice message"); + } + + MSG_DEBUG("On call, It doesn't play vibration - voice message"); + } else { /* 1-2. Normal message */ + if (bMsgSettingNoti) { + if (bPlayOnCall) { + MSG_DEBUG("On call, Play sound"); + *bPlaySound = true; + } else { + MSG_DEBUG("On call, It doesn't play sound"); + } + + MSG_DEBUG("On call, It doesn't play vibration"); + } + } + } + } else { + /* 2. Call is not active */ + + MSG_DEBUG("Call is not active."); + int voiceRecording = MsgSettingGetInt(VCONFKEY_VOICERECORDER_STATE); + + if (bVoiceMail) { /* 2-1. Voice message */ + if (bMsgSettingNoti) { + if (bSoundOn || bVibrationOn) { + MSG_DEBUG("Play vibration - voice message."); + *bPlayVibration = true; + } else { + MSG_DEBUG("It doesn't play vibration - voice message."); + } + + MSG_DEBUG("Play sound - voice message."); + *bPlaySound = true; + + } else { + MSG_DEBUG("It doesn't play sound/vibration - voice message."); + } + } else { /* 2-1. Normal message */ + if (bMsgSettingNoti) { + if (voiceRecording != VCONFKEY_VOICERECORDER_RECORDING) { + if (bSoundOn) { + MSG_DEBUG("Play sound."); + *bPlaySound = true; + } else { + MSG_DEBUG("It doesn't play vibration."); + } + + if ((bSoundOn || bVibrationOn) && bMsgSettingVibration) { + MSG_DEBUG("Play vibration."); + *bPlayVibration = true; + } else { + MSG_DEBUG("It doesn't play vibration."); + } + } else { + MSG_DEBUG("It doesn't play sound/vibration."); + } + } else { + MSG_DEBUG("It doesn't play sound/vibration."); + } + } + } + + MSG_END(); +} + + +void MsgSoundPlayer::MsgSoundPlayStart(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_SOUND_TYPE_T soundType) +{ + MSG_BEGIN(); + MSG_DEBUG("soundType [%d]", soundType); + + /* check camera state */ + int cameraState = 0; // camera recording state + cameraState = MsgSettingGetInt(VCONFKEY_CAMERA_STATE); + MSG_SEC_DEBUG("Camera state [%d]", cameraState); + + if (cameraState == VCONFKEY_CAMERA_STATE_RECORDING) { + MSG_END(); + return; + } + + /* get contact information */ + MSG_CONTACT_INFO_S contactInfo; + memset(&contactInfo, 0x00, sizeof(MSG_CONTACT_INFO_S)); + + if(pAddrInfo) { + // Get Contact Info + if (MsgGetContactInfo(pAddrInfo, &contactInfo) != MSG_SUCCESS) { + MSG_DEBUG("MsgGetContactInfo() fail."); + } + } + + /* get ringtone file path */ + char *msg_tone_file_path = NULL; + AutoPtr buf(&msg_tone_file_path); + + if (soundType == MSG_SOUND_PLAY_EMERGENCY) { + msg_tone_file_path = new char[MAX_SOUND_FILE_LEN+1]; + memset(msg_tone_file_path, 0x00, sizeof(char)*(MAX_SOUND_FILE_LEN+1)); + } else if (soundType == MSG_SOUND_PLAY_DEFAULT) { + msg_tone_file_path = new char[MAX_SOUND_FILE_LEN+1]; + memset(msg_tone_file_path, 0x00, sizeof(char)*(MAX_SOUND_FILE_LEN+1)); + strncpy(msg_tone_file_path, DEFAULT_ALERT_FILE, MAX_SOUND_FILE_LEN); + } else { + MsgGetRingtonePath(contactInfo.alerttonePath, &msg_tone_file_path); + } + + MSG_SEC_DEBUG("soundType [%d], Sound File [%s]", soundType, msg_tone_file_path); + + /* get sound play status */ + bool bPlaySound = false; + bool bPlayVibration = false; + bool bVoiceMsg = (soundType == MSG_SOUND_PLAY_VOICEMAIL)?true:false; + bool bOnCall = false; + + MsgGetPlayStatus(bVoiceMsg, &bPlaySound, &bPlayVibration, &bOnCall); + + MSG_SEC_DEBUG("sound=[%d], vibration=[%d], voice_msg?[%d], on_call?[%d]", \ + bPlaySound, bPlayVibration, bVoiceMsg, bOnCall); + + /* play sound */ + if (bPlaySound) { + int err = MM_ERROR_NONE; + + if (soundType == MSG_SOUND_PLAY_EMERGENCY) + err = mm_session_init(MM_SESSION_TYPE_EMERGENCY); + else + err = mm_session_init(MM_SESSION_TYPE_NOTIFY); + + if (err != MM_ERROR_NONE) + MSG_DEBUG("MM Session Init Failed"); + else + MSG_DEBUG("MM Session Init Success : %d", err); + + + MsgSoundPlayMelody(msg_tone_file_path); + + err = mm_session_finish(); + + if (err != MM_ERROR_NONE) + MSG_DEBUG("MM Session Finish Failed."); + else + MSG_DEBUG("MM Session Finish Success : %d", err); + } + + /* play vibration */ + if (bPlayVibration) { + MsgSoundPlayVibration(contactInfo.vibrationPath, bOnCall); + } + + // For repeatition. +// MsgSoundSetRepeatAlarm(); + + MSG_END(); +} + + +void MsgSoundPlayer::MsgSoundPlayStop() +{ + MSG_BEGIN(); + + pthread_mutex_lock(&muMmPlay); + + if (bPlaying == true && hPlayerHandle != 0 ) { + MSG_DEBUG("stopping the player."); + /* Stop playing media contents */ + int err = mm_player_stop(hPlayerHandle); + + if (err != MM_ERROR_NONE) { + MSG_DEBUG("stopping the player handle failed"); + } + + } + + if (hPlayerHandle != 0) { + MSG_DEBUG("destroy the player."); + + /* Uninitializing the player module */ + mm_player_unrealize(hPlayerHandle); + + /* Destroying the player handle */ + mm_player_destroy(hPlayerHandle); + } + + hPlayerHandle = 0; + bPlaying = false; + + pthread_mutex_unlock(&muMmPlay); + + MSG_END(); +} + + +void MsgSoundPlayer::MsgSoundPlayMelody(char *pMsgToneFilePath) +{ + int err = MM_ERROR_NONE; + + if (!pMsgToneFilePath) { + MSG_DEBUG("Ringtone path is NULL"); + return; + } + + pthread_mutex_lock(&muMmPlay); + + if (hPlayerHandle != 0) { + mm_player_unrealize(hPlayerHandle); + mm_player_destroy(hPlayerHandle); + hPlayerHandle = 0; + } + + err = mm_player_create(&hPlayerHandle); + + pthread_mutex_unlock(&muMmPlay); + + if (err != MM_ERROR_NONE) { + MSG_DEBUG("creating the player handle failed"); + return; + } + + /* Setting the call back function msg_callback */ + mm_player_set_message_callback(hPlayerHandle, MsgSoundPlayCallback, NULL); + + do { + /* Setting fade in/out, Volume */ + err = mm_player_set_attribute(hPlayerHandle, NULL, + "sound_volume_type", MM_SOUND_VOLUME_TYPE_NOTIFICATION, + "profile_uri", pMsgToneFilePath, strlen(pMsgToneFilePath), + "sound_priority", 2, + NULL); + + if (err != MM_ERROR_NONE) { + MSG_DEBUG("error setting the profile attr [%d]", err); + } + + err = mm_player_realize(hPlayerHandle); + + if (err != MM_ERROR_NONE) { + MSG_DEBUG("mm_player_realize() error : [%d]", err); + if (pMsgToneFilePath != defaultRingtonePath) { + pMsgToneFilePath = defaultRingtonePath; + } else { + return; + } + } + } while(err != MM_ERROR_NONE); + + + pthread_mutex_lock(&muMmPlay); + MSG_DEBUG("mm_player_start with [%s]", pMsgToneFilePath); + err = mm_player_start(hPlayerHandle); + + if (err != MM_ERROR_NONE) { + MSG_DEBUG("mm_player_start, FAIL [%x]", err); + } else { + /* Add Timer to stop playing after 5 sec. */ +// int g_contact_timer = -1; +// g_contact_timer = g_timeout_add(MSG_SOUND_TIMEOUT, (GSourceFunc)MsgSoundMelodyTimeout, NULL); + + bPlaying = true; + } + pthread_mutex_unlock(&muMmPlay); + + return; +} + + +void MsgSoundPlayer::MsgSoundPlayVibration(char *vibrationPath, bool isOnCall) +{ + MSG_BEGIN(); + + int ret = 0; + + if (!bFeedbackInit) { + int ret = feedback_initialize(); + + if (ret != FEEDBACK_ERROR_NONE) { + MSG_DEBUG("Fail to feedback_initialize : [%d]", ret); + bFeedbackInit = false; + return; + } else { + MSG_DEBUG("Success to feedback_initialize."); + bFeedbackInit = true; + } + } + + if(vibrationPath && strlen(vibrationPath)) + { + MSG_DEBUG("vibrationPath: [%s]", vibrationPath); + ret = feedback_set_resource_path(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_MESSAGE, vibrationPath); + if (ret != FEEDBACK_ERROR_NONE) + MSG_DEBUG("Fail to feedback_set_resource_path"); + ret = feedback_play_type(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_MESSAGE); + + if (ret != FEEDBACK_ERROR_NONE) + MSG_DEBUG("Fail to feedback_play_type"); + } + else + { + if (isOnCall) + ret = feedback_play_type(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_MESSAGE_ON_CALL); + else + { + ret = feedback_set_resource_path(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_MESSAGE, NULL); + if (ret != FEEDBACK_ERROR_NONE) + MSG_DEBUG("Fail to feedback_set_resource_path"); + ret = feedback_play_type(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_MESSAGE); + } + + if (ret != FEEDBACK_ERROR_NONE) + MSG_DEBUG("Fail to feedback_play_type"); + } + + MSG_END(); +} + +void MsgSoundPlayer::MsgSoundPlayDtmf() +{ + MSG_BEGIN(); + + int ret = 0; + int hToneHandle = 0; + + ret = mm_sound_play_tone(MM_SOUND_TONE_PROP_BEEP2, VOLUME_TYPE_SYSTEM, 1.0, 300, &hToneHandle); + + if(ret < 0) { + MSG_DEBUG("play tone failed."); + } else { + MSG_DEBUG("play tone success."); + } + + MSG_END(); +} + + +void MsgSoundPlayer::MsgSoundSetRepeatAlarm() +{ + int nRepeatValue = 0; + long nRepeatTime = 0; + + nRepeatValue = MsgSettingGetInt(MSG_ALERT_REP_TYPE); + + switch (nRepeatValue) + { + case MSG_ALERT_TONE_ONCE: + nRepeatTime = 0; + break; + + case MSG_ALERT_TONE_2MINS: + nRepeatTime = 2; + break; + + case MSG_ALERT_TONE_5MINS: + nRepeatTime = 5; + break; + + case MSG_ALERT_TONE_10MINS: + nRepeatTime = 10; + break; + + default: + MSG_DEBUG("Invalid Repetition time"); + break; + } + + MSG_DEBUG("nRepeatTime = %d", nRepeatTime); + + if (nRepeatTime > 0) { + if (g_alarmId > 0) { + if (MsgAlarmRemove(g_alarmId) != MSG_SUCCESS) { + MSG_FATAL("MsgAlarmRemove fail."); + } + g_alarmId = 0; + } + MsgSoundCreateRepeatAlarm(nRepeatTime); + } + + return; +} + + +void MsgSoundPlayer::MsgSoundCreateRepeatAlarm(int RepeatTime) +{ + MSG_BEGIN(); + + int alarmId = 0; + time_t tmp_time; + struct tm repeat_tm; + + time(&tmp_time); + + tmp_time += (RepeatTime*60); + tzset(); + localtime_r(&tmp_time, &repeat_tm); + + if (MsgAlarmRegistration(&repeat_tm, MsgSoundRepeatAlarmCB, &alarmId) != MSG_SUCCESS) { + MSG_DEBUG("MsgAlarmRegistration fail."); + return; + } + + g_alarmId = alarmId; + MSG_DEBUG("Set g_alarmId to [%d]", alarmId); + + MSG_END(); + + return; +} + + +int MsgSoundPlayer::MsgSoundGetUnreadMsgCnt() +{ + int unreadCnt = 0; + + // Get SMS Count + unreadCnt = MsgSettingGetInt(VCONFKEY_MESSAGE_RECV_SMS_STATE); + + // Get MMS Count + unreadCnt += MsgSettingGetInt(VCONFKEY_MESSAGE_RECV_MMS_STATE); + + MSG_DEBUG("unread count : [%d]", unreadCnt); + + return unreadCnt; +} + +void MsgSoundPlayer::MsgSoundInitRepeatAlarm() +{ + MSG_BEGIN(); + + int nRepeatValue = 0; + long nRepeatTime = 0; + + g_alarmId = 0; + + if (MsgSoundGetUnreadMsgCnt() <= 0) { + MSG_DEBUG("no unread msg"); + return; + } + + nRepeatValue = MsgSettingGetInt(MSG_ALERT_REP_TYPE); + + switch (nRepeatValue) + { + case MSG_ALERT_TONE_ONCE: + nRepeatTime = 0; + break; + + case MSG_ALERT_TONE_2MINS: + nRepeatTime = 2; + break; + + case MSG_ALERT_TONE_5MINS: + nRepeatTime = 5; + break; + + case MSG_ALERT_TONE_10MINS: + nRepeatTime = 10; + break; + + default: + MSG_DEBUG("Invalid Repetition time"); + break; + } + + MSG_DEBUG("nRepeatTime = %d", nRepeatTime); + + if (nRepeatTime > 0) + MsgSoundPlayStart(NULL, MSG_SOUND_PLAY_USER); + + MSG_END(); +} diff --git a/utils/MsgSpamFilter.cpp b/externals/MsgSpamFilter.cpp similarity index 56% rename from utils/MsgSpamFilter.cpp rename to externals/MsgSpamFilter.cpp index 18c1ca1..6c2919c 100755 --- a/utils/MsgSpamFilter.cpp +++ b/externals/MsgSpamFilter.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include "MsgDebug.h" @@ -58,6 +58,18 @@ bool MsgCheckFilter(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo) msg_error_t err = MSG_SUCCESS; // ======================================================================= + // Check Unknown Sender + // ======================================================================= + bool bBlockUnknown = false; + + if (MsgSettingGetBool(MSG_BLOCK_UNKNOWN_MSG, &bBlockUnknown) == MSG_SUCCESS) { + if (bBlockUnknown == true && pMsgInfo->addressList[0].addressVal[0] == '\0') { + MSG_DEBUG("Unknown sender message!!"); + return true; + } + } + + // ======================================================================= // Check Filter Operation // ======================================================================= bool filterFlag = false; @@ -80,26 +92,24 @@ bool MsgCheckFilter(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo) memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE (CASE WHEN LENGTH(FILTER_VALUE)>%d-1 THEN '%%'||SUBSTR(FILTER_VALUE, LENGTH(FILTER_VALUE)-%d-1) ELSE FILTER_VALUE END) AND FILTER_ACTIVE = 1 \ + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE (CASE WHEN LENGTH(FILTER_VALUE)>%d-1 THEN '%%'||SUBSTR(FILTER_VALUE, LENGTH(FILTER_VALUE)-%d+1) ELSE FILTER_VALUE END) AND FILTER_ACTIVE = 1 \ UNION SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE SUBSTR(FILTER_VALUE,1)||'%%' AND FILTER_ACTIVE = 1 \ - UNION SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE '%%'||SUBSTR(FILTER_VALUE,1)||'%%' AND FILTER_ACTIVE = 1;", - MSGFW_FILTER_TABLE_NAME, MSG_FILTER_BY_ADDRESS_SAME, pMsgInfo->addressList[0].addressVal, MAX_PRECONFIG_NUM, MAX_PRECONFIG_NUM, + UNION SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE '%%'||SUBSTR(FILTER_VALUE,1)||'%%' AND FILTER_ACTIVE = 1 \ + UNION SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE '%%'||SUBSTR(FILTER_VALUE,1) AND FILTER_ACTIVE = 1;", + MSGFW_FILTER_TABLE_NAME, MSG_FILTER_BY_ADDRESS_SAME, pMsgInfo->addressList[0].addressVal, MsgContactGetMinMatchDigit(), MsgContactGetMinMatchDigit(), MSGFW_FILTER_TABLE_NAME, MSG_FILTER_BY_ADDRESS_START, pMsgInfo->addressList[0].addressVal, - MSGFW_FILTER_TABLE_NAME, MSG_FILTER_BY_ADDRESS_INCLUDE, pMsgInfo->addressList[0].addressVal); + MSGFW_FILTER_TABLE_NAME, MSG_FILTER_BY_ADDRESS_INCLUDE, pMsgInfo->addressList[0].addressVal, + MSGFW_FILTER_TABLE_NAME, MSG_FILTER_BY_ADDRESS_END, pMsgInfo->addressList[0].addressVal); err = pDbHandle->getTable(sqlQuery, &rowCnt); - if (err == MSG_ERR_DB_GETTABLE) { - MSG_DEBUG("sqlQuery [%s]", sqlQuery); - } - if (rowCnt > 0) { - MSG_DEBUG("Msg is Filtered by Address : [%s]", pMsgInfo->addressList[0].addressVal); + MSG_SEC_DEBUG("Msg is Filtered by Address : [%s]", pMsgInfo->addressList[0].addressVal); pDbHandle->freeTable(); pMsgInfo->folderId = MSG_SPAMBOX_ID; return true; } else { - MSG_DEBUG("Msg is NOT Filtered by Address : [%s]", pMsgInfo->addressList[0].addressVal); + MSG_SEC_DEBUG("Msg is NOT Filtered by Address : [%s]", pMsgInfo->addressList[0].addressVal); pDbHandle->freeTable(); } @@ -117,10 +127,8 @@ bool MsgCheckFilter(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo) err = pDbHandle->getTable(sqlQuery, &rowCnt); if (err != MSG_SUCCESS) { - MSG_DEBUG("MsgGetTable() Error [%d] : [%s]", err, sqlQuery); - + MSG_DEBUG("Fail to getTable()."); pDbHandle->freeTable(); - return false; } @@ -140,10 +148,16 @@ bool MsgCheckFilter(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo) MSG_DEBUG("filterValue [%s]", filterValue); - if (strlen(filterValue) <= 0) continue; + if (strlen(filterValue) <= 0) + continue; if (pMsgInfo->msgType.mainType == MSG_SMS_TYPE && pMsgInfo->msgType.subType == MSG_NORMAL_SMS) { if (pMsgInfo->bTextSms == false) { + if (pData) { + delete[] pData; + pData = NULL; + } + if (MsgOpenAndReadFile(pMsgInfo->msgData, &pData, &fileSize) == false) { pDbHandle->freeTable(); return false; @@ -151,6 +165,11 @@ bool MsgCheckFilter(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo) MSG_DEBUG("file data [%s]", pData); } else { if (pMsgInfo->dataSize > 0) { + if (pData) { + delete[] pData; + pData = NULL; + } + pData = new char[pMsgInfo->dataSize+1]; strncpy(pData, pMsgInfo->msgText, pMsgInfo->dataSize); @@ -159,6 +178,11 @@ bool MsgCheckFilter(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo) } } else if(pMsgInfo->msgType.mainType == MSG_MMS_TYPE) { if (strlen(pMsgInfo->subject) > 0) { + if (pData) { + delete[] pData; + pData = NULL; + } + pData = new char[strlen(pMsgInfo->subject)+1]; strncpy(pData, pMsgInfo->subject, strlen(pMsgInfo->subject)); @@ -177,14 +201,14 @@ bool MsgCheckFilter(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo) MSG_DEBUG("pData [%s]", pData); if (strcasestr(pData, filterValue) != NULL) { - +#if 0 MSG_CONTACT_INFO_S contactInfo; memset(&contactInfo, 0x00, sizeof(MSG_CONTACT_INFO_S)); // Get Contact Info if (MsgGetContactInfo(&(pMsgInfo->addressList[0]), &contactInfo) == MSG_SUCCESS) { if (contactInfo.contactId > 0) { - MSG_DEBUG("Msg is Filtered by Subject [%s] Data [%s], but address is in contact. Skip.", filterValue, pData); + MSG_SEC_DEBUG("Msg is Filtered by Subject [%s] Data [%s], but address is in contact. Skip.", filterValue, pData); } else { MSG_DEBUG("Msg is Filtered by Subject [%s] Data [%s]", filterValue, pData); bFiltered = true; @@ -193,6 +217,11 @@ bool MsgCheckFilter(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo) } else { MSG_DEBUG("MsgGetContactInfo() fail."); } +#else + MSG_DEBUG("Msg is Filtered by Subject [%s] Data [%s]", filterValue, pData); + bFiltered = true; + break; +#endif } } @@ -212,3 +241,79 @@ bool MsgCheckFilter(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo) return false; } + + +bool MsgCheckFilterByWord(MsgDbHandler *pDbHandle, const char *pMsgText) +{ + MSG_BEGIN(); + + if (!pMsgText) { + MSG_DEBUG("pMsgText is NULL"); + return false; + } + + msg_error_t err = MSG_SUCCESS; + + // ======================================================================= + // Check Filter Operation + // ======================================================================= + bool filterFlag = false; + + MsgGetFilterOperation(&filterFlag); + + if (filterFlag == false) { + MSG_DEBUG("filter operation is not working"); + return false; + } + + int rowCnt = 0; + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + + // ======================================================================= + // Check Filter by Word + // ======================================================================= + // Get Filter List + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILTER_VALUE FROM %s WHERE FILTER_TYPE = %d;", + MSGFW_FILTER_TABLE_NAME, MSG_FILTER_BY_WORD); + + err = pDbHandle->getTable(sqlQuery, &rowCnt); + + if (err != MSG_SUCCESS) { + MSG_DEBUG("Fail to getTable()."); + pDbHandle->freeTable(); + return false; + } + + char filterValue[MAX_FILTER_VALUE_LEN+1]; + bool bFiltered = false; + + for (int i = 1; i <= rowCnt; i++) + { + memset(filterValue, 0x00, sizeof(filterValue)); + + pDbHandle->getColumnToString(i, MAX_FILTER_VALUE_LEN, filterValue); + + MSG_DEBUG("filterValue [%s]", filterValue); + + if (strlen(filterValue) <= 0) continue; + + if (strcasestr(pMsgText, filterValue) != NULL) { + MSG_DEBUG("Msg is Filtered by Word [%s] ", filterValue); + bFiltered = true; + break; + } + } + + pDbHandle->freeTable(); + + MSG_END(); + + return bFiltered; +} + + diff --git a/framework/CMakeLists.txt b/framework/CMakeLists.txt index ef2ad7f..ed20a98 100755 --- a/framework/CMakeLists.txt +++ b/framework/CMakeLists.txt @@ -42,7 +42,7 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") ADD_LIBRARY(${PLUGIN-MANAGER-LIB} SHARED ${PLUGIN-MANAGER-SRCS}) TARGET_LINK_LIBRARIES(${PLUGIN-MANAGER-LIB} ${plugin_manager_pkgs_LDFLAGS} ${UTILS-LIB} dl) -INSTALL(TARGETS ${PLUGIN-MANAGER-LIB} LIBRARY DESTINATION ${LIB_INSTALL_DIR}) +INSTALL(TARGETS ${PLUGIN-MANAGER-LIB} LIBRARY DESTINATION lib) ########################################################## # Define Messaging Framework Handler @@ -66,6 +66,7 @@ INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/include/common ${CMAKE_SOURCE_DIR}/include/framework ${CMAKE_SOURCE_DIR}/include/utils + ${CMAKE_SOURCE_DIR}/include/externals ${CMAKE_SOURCE_DIR}/vobject-engine/include ) @@ -83,9 +84,9 @@ ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") ADD_LIBRARY(${FW-HANDLER-LIB} SHARED ${FW-HANDLER-SRCS}) -TARGET_LINK_LIBRARIES(${FW-HANDLER-LIB} ${fw_handler_pkgs_LDFLAGS} ${UTILS-LIB} ${PLUGIN-MANAGER-LIB}) +TARGET_LINK_LIBRARIES(${FW-HANDLER-LIB} ${fw_handler_pkgs_LDFLAGS} ${UTILS-LIB} ${EXTERNALS-LIB} ${PLUGIN-MANAGER-LIB}) -INSTALL(TARGETS ${FW-HANDLER-LIB} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) +INSTALL(TARGETS ${FW-HANDLER-LIB} DESTINATION lib COMPONENT RuntimeLibraries) ########################################################## # Define Transaction Manager @@ -103,6 +104,7 @@ INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/include/mapi ${CMAKE_SOURCE_DIR}/include/common ${CMAKE_SOURCE_DIR}/include/framework + ${CMAKE_SOURCE_DIR}/include/externals ${CMAKE_SOURCE_DIR}/include/utils ) @@ -120,9 +122,9 @@ ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") ADD_LIBRARY(${TRANS-MANAGER-LIB} SHARED ${TRANS-MANAGER-SRCS}) -TARGET_LINK_LIBRARIES(${TRANS-MANAGER-LIB} ${trans_manager_pkgs_LDFLAGS} ${UTILS-LIB} ${FW-HANDLER-LIB}) +TARGET_LINK_LIBRARIES(${TRANS-MANAGER-LIB} ${trans_manager_pkgs_LDFLAGS} ${UTILS-LIB} ${EXTERNALS-LIB} ${FW-HANDLER-LIB}) -INSTALL(TARGETS ${TRANS-MANAGER-LIB} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) +INSTALL(TARGETS ${TRANS-MANAGER-LIB} DESTINATION lib COMPONENT RuntimeLibraries) ########################################################## # Define Execute File @@ -133,14 +135,15 @@ SET(MAIN-SRCS ) INCLUDE_DIRECTORIES( - ${CMAKE_SOURCE_DIR}/include/mapi + ${CMAKE_SOURCE_DIR}/include/mapi ${CMAKE_SOURCE_DIR}/include/common ${CMAKE_SOURCE_DIR}/include/framework + ${CMAKE_SOURCE_DIR}/include/externals ${CMAKE_SOURCE_DIR}/include/utils ) INCLUDE(FindPkgConfig) -pkg_check_modules(main_pkgs REQUIRED glib-2.0 dbus-glib-1 dlog vconf) +pkg_check_modules(main_pkgs REQUIRED glib-2.0 dbus-glib-1 dlog vconf db-util) FOREACH(flag ${main_pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") @@ -153,7 +156,7 @@ ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") ADD_EXECUTABLE(${PROJECT_NAME} ${MAIN-SRCS}) -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${main_pkgs_LDFLAGS} ${UTILS-LIB} ${PLUGIN-MANAGER-LIB} ${TRANS-MANAGER-LIB} ${FW-HANDLER-LIB}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${main_pkgs_LDFLAGS} ${UTILS-LIB} ${EXTERNALS-LIB} ${PLUGIN-MANAGER-LIB} ${TRANS-MANAGER-LIB} ${FW-HANDLER-LIB}) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin) diff --git a/framework/deliver-handler/MsgDeliverHandler.cpp b/framework/deliver-handler/MsgDeliverHandler.cpp index 241803e..d8a06cd 100755 --- a/framework/deliver-handler/MsgDeliverHandler.cpp +++ b/framework/deliver-handler/MsgDeliverHandler.cpp @@ -1,21 +1,20 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ -// for sl message browser launch -#include +#include #include "MsgDebug.h" #include "MsgUtilFile.h" @@ -28,21 +27,166 @@ #include "MsgStorageHandler.h" #include "MsgDeliverHandler.h" #include "MsgNotificationWrapper.h" +#include "MsgDevicedWrapper.h" /*================================================================================================== VARIABLES ==================================================================================================*/ -extern MsgDbHandler dbHandle; - /*================================================================================================== FUNCTION IMPLEMENTATION ==================================================================================================*/ + +void MsgPlayTTSMode(MSG_SUB_TYPE_T msgSubType, msg_message_id_t msgId, bool isFavorites) +{ + MSG_BEGIN(); + + bool bNotification = true; + + if (MsgSettingGetBool(MSG_SETTING_NOTIFICATION, &bNotification) != MSG_SUCCESS) { + MSG_DEBUG("MsgSettingGetBool is failed."); + } + + if (bNotification == false) { + MSG_DEBUG("Msg Alert notification is off."); + return; + } + + bool isTTSOn = false; + MsgSettingGetBool(VCONFKEY_SETAPPL_DRIVINGMODE_DRIVINGMODE, &isTTSOn); + MSG_DEBUG("VCONFKEY_SETAPPL_DRIVINGMODE_DRIVINGMODE [%d]", isTTSOn); + + if(isTTSOn) { + + bool isVoiceMail = false; + + if (msgSubType == MSG_MWI_VOICE_SMS) { + bool isVoiceMailOn = false; + MsgSettingGetBool(VCONFKEY_SETAPPL_DRIVINGMODE_NEWVOICEMAILS, &isVoiceMailOn); + MSG_DEBUG("VCONFKEY_SETAPPL_DRIVINGMODE_NEWVOICEMAILS [%d]", isVoiceMailOn); + if (isVoiceMailOn) { + isVoiceMail = true; + } else { + return; + } + } else { + bool isTTSMsgOn = false; + MsgSettingGetBool(VCONFKEY_SETAPPL_DRIVINGMODE_MESSAGE, &isTTSMsgOn); + MSG_DEBUG("VCONFKEY_SETAPPL_DRIVINGMODE_MESSAGE [%d]", isTTSMsgOn); + if (!isTTSMsgOn || !isFavorites) { + return; + } + } + + app_control_h svc_h; + + int ret = APP_CONTROL_ERROR_NONE; + + ret = app_control_create(&svc_h); + if (ret != APP_CONTROL_ERROR_NONE) { + MSG_DEBUG("app_control_create() is failed : %d", ret); + app_control_destroy(svc_h); + return; + } + + ret = app_control_set_app_id(svc_h, "org.tizen.msg-ui-tts-play"); + if (ret != APP_CONTROL_ERROR_NONE) { + MSG_DEBUG("app_control_set_app_id() is failed : %d", ret); + app_control_destroy(svc_h); + return; + } + + if (isVoiceMail) { + ret = app_control_add_extra_data(svc_h, "type", "voicemail"); + } else { + char tmpStrMsgId[10]; + memset(&tmpStrMsgId, 0x00, sizeof(tmpStrMsgId)); + snprintf(tmpStrMsgId, sizeof(tmpStrMsgId), "%d", msgId); + MSG_DEBUG("tmpStrMsgId [%s]", tmpStrMsgId); + ret = app_control_add_extra_data(svc_h, "msgId", tmpStrMsgId); + } + + if (ret != APP_CONTROL_ERROR_NONE) { + MSG_DEBUG("app_control_add_extra_data() is failed : %d", ret); + app_control_destroy(svc_h); + return; + } + + ret = app_control_send_launch_request(svc_h, NULL, NULL); + if (ret != APP_CONTROL_ERROR_NONE) { + MSG_DEBUG("app_control_send_launch_request() is failed : %d", ret); + app_control_destroy(svc_h); + return; + } + + app_control_destroy(svc_h); + } + + MsgChangePmState(); + + MSG_END(); +} + + +void MsgLaunchClass0(msg_message_id_t msgId) +{ + MSG_BEGIN(); + + app_control_h svc_h; + + int ret = APP_CONTROL_ERROR_NONE; + + ret = app_control_create(&svc_h); + if (ret != APP_CONTROL_ERROR_NONE) { + MSG_DEBUG("app_control_create() is failed : %d", ret); + app_control_destroy(svc_h); + return; + } + + ret = app_control_set_app_id(svc_h, "org.tizen.msg-ui-class0"); + if (ret != APP_CONTROL_ERROR_NONE) { + MSG_DEBUG("app_control_set_app_id() is failed : %d", ret); + app_control_destroy(svc_h); + return; + } + + ret = app_control_add_extra_data(svc_h, "type", "msg_id"); + if (ret != APP_CONTROL_ERROR_NONE) { + MSG_DEBUG("app_control_add_extra_data() is failed : %d", ret); + app_control_destroy(svc_h); + return; + } + + char tmpStrMsgId[10]; + memset(&tmpStrMsgId, 0x00, sizeof(tmpStrMsgId)); + snprintf(tmpStrMsgId, sizeof(tmpStrMsgId), "%d", msgId); + MSG_DEBUG("tmpStrMsgId [%s]", tmpStrMsgId); + ret = app_control_add_extra_data(svc_h, "msgId", tmpStrMsgId); + if (ret != APP_CONTROL_ERROR_NONE) { + MSG_DEBUG("app_control_add_extra_data() is failed : %d", ret); + app_control_destroy(svc_h); + return; + } + + ret = app_control_send_launch_request(svc_h, NULL, NULL); + if (ret != APP_CONTROL_ERROR_NONE) { + MSG_DEBUG("app_control_send_launch_request() is failed : %d", ret); + app_control_destroy(svc_h); + return; + } + + app_control_destroy(svc_h); + + MSG_END(); +} + + msg_error_t MsgHandleMmsConfIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, msg_request_id_t reqID) { MSG_BEGIN(); msg_error_t err = MSG_SUCCESS; + MsgDbHandler *dbHandle = getDbHandle(); MSG_DEBUG(" msgtype subtype is [%d]", pMsgInfo->msgType.subType); @@ -51,13 +195,15 @@ msg_error_t MsgHandleMmsConfIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, msg_reques MSG_SUB_TYPE_T subType = pMsgInfo->msgType.subType; /* If Retrieve Failed, Msg SubType is remained as Notification Ind */ - if (pMsgInfo->networkStatus == MSG_NETWORK_RETRIEVE_FAIL) + if (pMsgInfo->networkStatus == MSG_NETWORK_RETRIEVE_FAIL) { + pMsgInfo->folderId = MSG_INBOX_ID; pMsgInfo->msgType.subType = MSG_NOTIFICATIONIND_MMS; + } - err = MsgStoUpdateMMSMessage(pMsgInfo); - - if (err == MSG_SUCCESS) - MSG_DEBUG("Command Handle Success : MsgStoUpdateMessage()"); +// err = MsgStoUpdateMMSMessage(pMsgInfo); +// +// if (err == MSG_SUCCESS) +// MSG_DEBUG("Command Handle Success : MsgStoUpdateMessage()"); if (pMsgInfo->networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS) { MSG_DEBUG("### MSG_NETWORK_RETRIEVE_SUCCESS ###"); @@ -73,6 +219,12 @@ msg_error_t MsgHandleMmsConfIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, msg_reques return MSG_ERR_STORAGE_ERROR; } + err = MsgStoUpdateMMSMessage(pMsgInfo);//For Text Update + + if (err == MSG_SUCCESS) + MSG_DEBUG("Command Handle Success : MsgStoUpdateMessage()"); + + MSG_DEBUG(" ######################### MESSAGE UPDATE COMPLETED!!! ######################"); bool readStatus = false; @@ -84,37 +236,33 @@ msg_error_t MsgHandleMmsConfIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, msg_reques if (subType == MSG_RETRIEVE_MANUALCONF_MMS && pMsgInfo->networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS) { MSG_DEBUG("###2. subType = %d ###", pMsgInfo->msgType.subType); - if (readStatus == true) - MsgStoSetReadStatus(&dbHandle, pMsgInfo->msgId, false); - } - - // update badge - if (subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsgInfo->networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS) { - int smsCnt = 0; - int mmsCnt = 0; - - smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE); - mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE); - - MsgSettingHandleNewMsg(smsCnt, mmsCnt); + if (readStatus == true) { + MsgStoSetReadStatus(dbHandle, pMsgInfo->msgId, false); + MsgRefreshNotification(MSG_NOTI_TYPE_NORMAL, false, false); + } } if (subType == MSG_RETRIEVE_AUTOCONF_MMS) { - // play message-tone when MMS retrieved - MsgSoundPlayStart(false); + bool isFavorites = false; + if (!checkBlockingMode(pMsgInfo->addressList[0].addressVal, &isFavorites)) { + MsgPlayTTSMode(subType, pMsgInfo->msgId, isFavorites); + } // add phone log MSG_DEBUG("Enter MsgAddPhoneLog() for mms message."); MsgAddPhoneLog(pMsgInfo); - MsgInsertNoti(pMsgInfo); + if (pMsgInfo->folderId == MSG_INBOX_ID) + MsgInsertNotification(pMsgInfo); + } else if (subType == MSG_RETRIEVE_MANUALCONF_MMS) { if (pMsgInfo->networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS) { MSG_DEBUG("Manual success"); - MsgInsertTicker("Message Retrieved", MESSAGE_RETRIEVED); + if (pMsgInfo->folderId == MSG_INBOX_ID) + MsgInsertTicker("Message Retrieved", MESSAGE_RETRIEVED, true, 0); } else if (pMsgInfo->networkStatus == MSG_NETWORK_RETRIEVE_FAIL) { MSG_DEBUG("Manual failed"); - MsgInsertTicker("Retrieving message failed", RETRIEVING_MESSAGE_FAILED); + MsgInsertTicker("Retrieving message failed", RETRIEVING_MESSAGE_FAILED, true, pMsgInfo->msgId); } } } @@ -133,7 +281,7 @@ msg_error_t MsgHandleMmsConfIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, msg_reques return MSG_ERR_STORAGE_ERROR; MSG_DEBUG("pMsg->networkStatus : %d", pMsgInfo->networkStatus); - err = MsgStoUpdateNetworkStatus(&dbHandle, pMsgInfo, pMsgInfo->networkStatus); + err = MsgStoUpdateNetworkStatus(dbHandle, pMsgInfo, pMsgInfo->networkStatus); if (err != MSG_SUCCESS) return MSG_ERR_STORAGE_ERROR; @@ -158,25 +306,20 @@ msg_error_t MsgHandleIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti) msg_error_t err = MSG_SUCCESS; + MsgDisplayLock(); + if (pMsgInfo->msgType.mainType == MSG_SMS_TYPE) { bool bOnlyNoti = false; err = MsgHandleSMS(pMsgInfo, pSendNoti, &bOnlyNoti); - if (err == MSG_SUCCESS&& ((*pSendNoti)||bOnlyNoti)) { - MsgSoundPlayStart(false); - if (*pSendNoti == true) { - int smsCnt = 0, mmsCnt = 0; - - smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE); - mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE); - - MsgSettingHandleNewMsg(smsCnt, mmsCnt); - MsgInsertNoti(pMsgInfo); - } else if (bOnlyNoti == true) { - MsgInsertNoti(pMsgInfo); + if (err == MSG_SUCCESS && ((*pSendNoti)||bOnlyNoti)) { + bool isFavorites = false; + if (!checkBlockingMode(pMsgInfo->addressList[0].addressVal, &isFavorites)) { + MsgPlayTTSMode(pMsgInfo->msgType.subType, pMsgInfo->msgId, isFavorites); } + MsgInsertNotification(pMsgInfo); } } else if (pMsgInfo->msgType.mainType == MSG_MMS_TYPE) @@ -184,6 +327,8 @@ msg_error_t MsgHandleIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti) err = MsgHandleMMS(pMsgInfo, pSendNoti); } + MsgDisplayUnlock(); + //Add Phone Log Data if ((err == MSG_SUCCESS) && (pMsgInfo->folderId == MSG_INBOX_ID || pMsgInfo->folderId == MSG_SPAMBOX_ID) && @@ -195,6 +340,9 @@ msg_error_t MsgHandleIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti) MsgAddPhoneLog(pMsgInfo); } + // Auto delete + //MsgStoAutoDeleteConversation(pMsgInfo->threadId); + MSG_END(); return err; @@ -204,14 +352,112 @@ msg_error_t MsgHandleIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti) msg_error_t MsgHandleSMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti, bool *bOnlyNoti) { msg_error_t err = MSG_SUCCESS; + MsgDbHandler *dbHandle = getDbHandle(); if (pMsgInfo->msgPort.valid == true) { - *pSendNoti = false; - *bOnlyNoti = false; - return MSG_SUCCESS; + *pSendNoti = false; + *bOnlyNoti = false; + return MSG_SUCCESS; } + + // Add SMS message + MSG_SENDINGOPT_INFO_S send_opt; + memset(&send_opt, 0x00, sizeof(MSG_SENDINGOPT_INFO_S)); + + if (pMsgInfo->msgType.classType == MSG_CLASS_2) { +#ifdef MSG_NOTI_INTEGRATION + MSG_DEBUG("Copy Class2 message to phone storage."); + pMsgInfo->msgType.classType = MSG_CLASS_NONE; + pMsgInfo->storageId = MSG_STORAGE_PHONE; + pMsgInfo->msgId = 0; +#else + MSG_DEBUG("Class2 message is already added."); + return MSG_SUCCESS; +#endif + } + if (pMsgInfo->msgType.subType == MSG_NORMAL_SMS) { - if (MsgCheckFilter(&dbHandle, pMsgInfo) == true) { + MSG_DEBUG("Add Normal Message"); + err = MsgStoAddMessage(pMsgInfo, &send_opt); + } else if ((pMsgInfo->msgType.subType >= MSG_REPLACE_TYPE1_SMS) && (pMsgInfo->msgType.subType <= MSG_REPLACE_TYPE7_SMS)) { + MSG_DEBUG("Add Replace Message"); + + pMsgInfo->msgId = 0; + MsgStoGetReplaceMsgId(pMsgInfo); + + if (pMsgInfo->msgId > 0) { + err = MsgStoUpdateMessage(pMsgInfo, &send_opt); + } else { + err = MsgStoAddMessage(pMsgInfo, &send_opt); + pMsgInfo->msgType.subType = MSG_NORMAL_SMS; // To make 'insert' type for storage change callback. + } + } else if ((pMsgInfo->msgType.subType == MSG_WAP_SI_SMS) || (pMsgInfo->msgType.subType == MSG_WAP_CO_SMS) || (pMsgInfo->msgType.subType == MSG_WAP_SL_SMS)) { + MSG_DEBUG("Add WAP Push Message"); + switch (pMsgInfo->msgType.subType) + { + case MSG_WAP_SI_SMS: + case MSG_WAP_SL_SMS: + err = MsgStoAddWAPMsg(pMsgInfo); + break; + case MSG_WAP_CO_SMS: + err = MsgStoAddCOWAPMsg(pMsgInfo); + break; + default : + break; + } + } else if ((pMsgInfo->msgType.subType == MSG_CB_SMS) || (pMsgInfo->msgType.subType == MSG_JAVACB_SMS)) { + /** check add message option */ + } + else if (pMsgInfo->msgType.subType == MSG_STATUS_REPORT_SMS) { + MSG_DEBUG("Add Report Message"); + } + else if (pMsgInfo->msgType.subType >= MSG_MWI_VOICE_SMS && pMsgInfo->msgType.subType <= MSG_MWI_OTHER_SMS) { + char keyName[MAX_VCONFKEY_NAME_LEN]; + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, pMsgInfo->sim_idx); + char *number = MsgSettingGetString(keyName); + int addrSize = strlen(pMsgInfo->addressList[0].addressVal); + char newPhoneNum[addrSize+1]; + memset(newPhoneNum, 0x00, sizeof(newPhoneNum)); + MsgConvertNumber(pMsgInfo->addressList[0].addressVal, newPhoneNum, addrSize); + + if (g_str_has_suffix(number, newPhoneNum)) { + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_ALPHA_ID, pMsgInfo->sim_idx); + char *alphaid = MsgSettingGetString(keyName); + if(alphaid) + { + memset(pMsgInfo->addressList->displayName, 0x00, sizeof(pMsgInfo->addressList->displayName)); + memcpy(pMsgInfo->addressList->displayName, alphaid, sizeof(pMsgInfo->addressList->displayName)); + g_free(alphaid); + alphaid = NULL; + } + } + + if(number) + { + g_free(number); + number = NULL; + } + + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_COUNT, pMsgInfo->sim_idx); + int voicecnt = MsgSettingGetInt(keyName); + memset(pMsgInfo->msgText, 0x00, sizeof(pMsgInfo->msgText)); + snprintf(pMsgInfo->msgText, sizeof(pMsgInfo->msgText), "%d", voicecnt); + pMsgInfo->dataSize = strlen(pMsgInfo->msgText); + MSG_DEBUG("Add Voice or other Message"); + } + else { + MSG_DEBUG("No matching type [%d]", pMsgInfo->msgType.subType); + return err; + } + + if (err != MSG_SUCCESS) + MSG_DEBUG("Add message - Error : [%d]", err); + + if (pMsgInfo->msgType.subType == MSG_NORMAL_SMS) { + if (MsgCheckFilter(dbHandle, pMsgInfo) == true) { // Move to SpamBox err = MsgStoMoveMessageToFolder(pMsgInfo->msgId, MSG_SPAMBOX_ID); @@ -221,12 +467,15 @@ msg_error_t MsgHandleSMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti, bool *bO pMsgInfo->folderId = MSG_SPAMBOX_ID; } - // Update Conversation table - err = MsgStoUpdateConversation(&dbHandle, pMsgInfo->threadId); - - if (err != MSG_SUCCESS) - MSG_DEBUG("MsgStoUpdateConversation() Error : [%d]", err); - + *pSendNoti = false; + *bOnlyNoti = false; + } else if (pMsgInfo->msgType.classType == MSG_CLASS_0) { + MsgLaunchClass0(pMsgInfo->msgId); + bool isFavorites = false; + if (!checkBlockingMode(pMsgInfo->addressList[0].addressVal, &isFavorites)) { + MsgPlayTTSMode(pMsgInfo->msgType.subType, pMsgInfo->msgId, isFavorites); + MsgSoundPlayer::instance()->MsgSoundPlayStart(&(pMsgInfo->addressList[0]), MSG_SOUND_PLAY_USER); + } *pSendNoti = false; *bOnlyNoti = false; } @@ -234,15 +483,15 @@ msg_error_t MsgHandleSMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti, bool *bO MSG_DEBUG("Starting WAP Message Incoming."); MSG_PUSH_SERVICE_TYPE_T serviceType = (MSG_PUSH_SERVICE_TYPE_T)MsgSettingGetInt(PUSH_SERVICE_TYPE); - service_h svc_handle = NULL; + app_control_h svc_handle = NULL; switch (pMsgInfo->msgType.subType) { case MSG_WAP_SL_SMS: { - *pSendNoti = false; + *pSendNoti = true; if (serviceType == MSG_PUSH_SERVICE_ALWAYS) { - if (service_create(&svc_handle) < 0) { + if (app_control_create(&svc_handle) < 0) { MSG_DEBUG("Fail to create service handle"); break; } @@ -250,38 +499,78 @@ msg_error_t MsgHandleSMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti, bool *bO MSG_DEBUG("Service handle is NULL"); break; } - if (service_set_operation(svc_handle, SERVICE_OPERATION_VIEW) < 0) { + if (app_control_set_operation(svc_handle, APP_CONTROL_OPERATION_VIEW) < 0) { MSG_DEBUG("Fail to create service handle"); - service_destroy(svc_handle); + app_control_destroy(svc_handle); break; } - if (service_set_uri(svc_handle, pMsgInfo->msgText) < 0) { + if (app_control_set_uri(svc_handle, pMsgInfo->msgText) < 0) { MSG_DEBUG("Fail to set uri"); - service_destroy(svc_handle); + app_control_destroy(svc_handle); break; } - if (service_set_package(svc_handle, MSG_SVC_PKG_NAME_BROWSER) < 0) { + if (app_control_set_app_id(svc_handle, MSG_SVC_PKG_NAME_BROWSER) < 0) { MSG_DEBUG("Fail to set package"); - service_destroy(svc_handle); + app_control_destroy(svc_handle); break; } - if (service_send_launch_request(svc_handle, NULL, NULL) < 0) { + if (app_control_send_launch_request(svc_handle, NULL, NULL) < 0) { MSG_DEBUG("Fail to launch browser"); - service_destroy(svc_handle); + app_control_destroy(svc_handle); break; } - service_destroy(svc_handle); + app_control_destroy(svc_handle); } else if (serviceType == MSG_PUSH_SERVICE_PROMPT) { - char urlString[MAX_COMMAND_LEN+1]; - memset(urlString, 0x00, sizeof(urlString)); - snprintf(urlString, MAX_COMMAND_LEN, "/usr/apps/org.tizen.message/bin/message-dialog -m PUSH_MSG_ALWAYS_ASK -u %s &", pMsgInfo->msgText); + MSG_DEBUG("WAP Message SL(Always Ask) start."); - system(urlString); - } + app_control_h svc_h; + int ret = APP_CONTROL_ERROR_NONE; + + ret = app_control_create(&svc_h); + if (ret != APP_CONTROL_ERROR_NONE) { + MSG_DEBUG("app_control_create() is failed : %d", ret); + break; + } + + ret = app_control_set_app_id(svc_h, "org.tizen.message-dialog"); + if (ret != APP_CONTROL_ERROR_NONE) { + MSG_DEBUG("app_control_set_app_id() is failed : %d", ret); + app_control_destroy(svc_h); + break; + } + + ret = app_control_add_extra_data(svc_h, "mode", "WAP_PUSH_SL"); + if (ret != APP_CONTROL_ERROR_NONE) { + MSG_DEBUG("app_control_add_extra_data() is failed : %d", ret); + app_control_destroy(svc_h); + break; + } + + ret = app_control_add_extra_data(svc_h, "url", pMsgInfo->msgText); + if (ret != APP_CONTROL_ERROR_NONE) { + MSG_DEBUG("app_control_add_extra_data() is failed : %d", ret); + app_control_destroy(svc_h); + break; + } + ret = app_control_add_extra_data(svc_h, "address", pMsgInfo->addressList[0].addressVal); + if (ret != APP_CONTROL_ERROR_NONE) { + MSG_DEBUG("app_control_add_extra_data() is failed : %d", ret); + app_control_destroy(svc_h); + break; + } + + ret = app_control_send_launch_request(svc_h, NULL, NULL); + if (ret != APP_CONTROL_ERROR_NONE) { + MSG_DEBUG("app_control_send_launch_request() is failed : %d", ret); + } + + app_control_destroy(svc_h); + MSG_DEBUG("app_control_destroy() returns : %d", ret); + } } break; @@ -300,8 +589,13 @@ msg_error_t MsgHandleSMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti, bool *bO *pSendNoti = false; *bOnlyNoti = true; } - } + } + + // Update Conversation table + err = MsgStoUpdateConversation(dbHandle, pMsgInfo->threadId); + if (err != MSG_SUCCESS) + MSG_DEBUG("MsgStoUpdateConversation() Error : [%d]", err); return err; } @@ -310,7 +604,7 @@ msg_error_t MsgHandleSMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti, bool *bO msg_error_t MsgHandleMMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti) { msg_error_t err = MSG_SUCCESS; - + MsgDbHandler *dbHandle = getDbHandle(); MSG_REQUEST_INFO_S request = {0}; bool bReject = false; bool bFiltered = false; @@ -319,6 +613,28 @@ msg_error_t MsgHandleMMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti) MSG_MAIN_TYPE_T msgMainType = pMsgInfo->msgType.mainType; MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(msgMainType); + //Read the default network SIM + MsgPlugin *sms_plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE); + + if (sms_plg == NULL) + return MSG_ERR_NULL_POINTER; + + int defaultNetworkSimId = 0; + + err = sms_plg->getDefaultNetworkSimId(&defaultNetworkSimId); + + MSG_DEBUG("######defaultNetworkSimId = %d, err = %d", defaultNetworkSimId, err); + + if (err != MSG_SUCCESS) { + MSG_ERR("getDefaultNetworkSimId is failed=[%d]", err); + return err; + } + + err = MsgSettingSetInt(MSG_NETWORK_SIM, (int)defaultNetworkSimId); + if (err != MSG_SUCCESS) { + MSG_ERR("Error to set config data [%s], err = %d", MSG_NETWORK_SIM, err); + return err; + } // Need to process m-delivery-ind, m-notification-ind, m-read-orig-ind err = plg->processReceivedInd(pMsgInfo, &request, &bReject); @@ -326,16 +642,35 @@ msg_error_t MsgHandleMMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti) MSG_DEBUG("Process Message Success : processReceivedInd(), btextsms %d", pMsgInfo->bTextSms); } else { MSG_DEBUG("Process Message Fail : processReceivedInd()"); + *pSendNoti = false; return err; } // Add into DB if ((pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS) && bReject == false) { - bFiltered = MsgCheckFilter(&dbHandle, pMsgInfo); + //bFiltered = MsgCheckFilter(dbHandle, pMsgInfo); + if (pMsgInfo->folderId == MSG_SPAMBOX_ID) { + bFiltered = true; + } if (bFiltered == true) { + err = MsgStoMoveMessageToFolder(pMsgInfo->msgId, MSG_SPAMBOX_ID); + + if (err != MSG_SUCCESS) { + MSG_DEBUG("MsgStoMoveMessageToFolder() Error : [%d]", err); + } else { + pMsgInfo->folderId = MSG_SPAMBOX_ID; + } + pMsgInfo->networkStatus = MSG_NETWORK_RETRIEVE_FAIL; *pSendNoti = false; + } else {/* If it is not SPAM message, it should be check whether filter option is enable or not. */ + bool filterFlag = false; + MsgGetFilterOperation(&filterFlag); + if (filterFlag == true && request.msgInfo.msgType.subType == MSG_GET_MMS) { + /* Not to show MMS notification msg until it retrieves. */ + pMsgInfo->folderId = MSG_IOSBOX_ID; + } } err = MsgStoAddMessage(pMsgInfo, NULL); @@ -345,37 +680,56 @@ msg_error_t MsgHandleMMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti) return err; } } else if (pMsgInfo->msgType.subType == MSG_READORGIND_MMS || pMsgInfo->msgType.subType == MSG_DELIVERYIND_MMS) { - if (MsgInsertMmsReportToNoti(&dbHandle, pMsgInfo) == MSG_SUCCESS) { - MsgSoundPlayStart(false); + if (MsgInsertNotification(pMsgInfo) == MSG_SUCCESS) { + bool isFavorites = false; + if (!checkBlockingMode(pMsgInfo->addressList[0].addressVal, &isFavorites)) { + MsgPlayTTSMode(pMsgInfo->msgType.subType, pMsgInfo->msgId, isFavorites); + } *pSendNoti = false; } } +#if 0 + if (pMsgInfo->bTextSms == false) { + MsgDeleteFile(pMsgInfo->msgData); //ipc + memset(pMsgInfo->msgData, 0x00, sizeof(pMsgInfo->msgData)); + } +#endif //In the case of m-notification-ind, we should decide whether to send m-notify-response-ind or http 'Get' //submit request - if (pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS && bFiltered == false) { - if (request.msgInfo.msgType.subType == MSG_NOTIFYRESPIND_MMS && bReject == false) { - MsgSoundPlayStart(false); - - int smsCnt = 0; - int mmsCnt = 0; - smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE); - mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE); + if (pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS) { + if (request.msgInfo.msgType.subType == MSG_NOTIFYRESPIND_MMS && bReject == false && bFiltered == false) { + bool isFavorites = false; + if (!checkBlockingMode(pMsgInfo->addressList[0].addressVal, &isFavorites)) { + MsgPlayTTSMode(pMsgInfo->msgType.subType, pMsgInfo->msgId, isFavorites); + } - MsgSettingHandleNewMsg(smsCnt, mmsCnt); - MsgInsertNoti(pMsgInfo); + MsgInsertNotification(pMsgInfo); + } else { + *pSendNoti = false; } - request.msgInfo.msgId = pMsgInfo->msgId; + MSG_DEBUG("default_sim = %d, pMsgInfo->sim_idx = %d", defaultNetworkSimId, pMsgInfo->sim_idx); - MSG_DEBUG("-=====================[[[ %s ]]]] =========================", pMsgInfo->msgData); - err = plg->submitReq(&request); + if (defaultNetworkSimId == pMsgInfo->sim_idx) { + request.msgInfo.msgId = pMsgInfo->msgId; + + MSG_DEBUG("-=====================[[[ %s ]]]] =========================", request.msgInfo.msgData); + err = plg->submitReq(&request); + + if (err == MSG_SUCCESS) { + MSG_DEBUG("Process Message Success : processReceivedInd()"); + + if (request.msgInfo.msgType.subType == MSG_GET_MMS) { + MSG_DEBUG("Auto Retrieve Mode : update network status retrieving"); + MsgStoUpdateNetworkStatus(dbHandle, &(request.msgInfo), MSG_NETWORK_RETRIEVING); + } + + } else { + MSG_DEBUG("Process Message Fail : processReceivedInd()"); + } - if (err == MSG_SUCCESS) { - MSG_DEBUG("Process Message Success : processReceivedInd()"); - } else { - MSG_DEBUG("Process Message Fail : processReceivedInd()"); } } diff --git a/framework/main.cpp b/framework/main.cpp index 9f182c1..b431e8c 100755 --- a/framework/main.cpp +++ b/framework/main.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ /*================================================================================================== @@ -31,6 +31,7 @@ #include "MsgStorageTypes.h" #include "MsgSoundPlayer.h" #include "MsgCmdHandler.h" +#include "MsgUtilFile.h" #include "MsgUtilStorage.h" #include "MsgNotificationWrapper.h" @@ -42,13 +43,6 @@ static GMainLoop* mainloop = NULL; - -/*================================================================================================== - DEFINES -==================================================================================================*/ -#define MSG_MOBILE_TRACKER_MSG "Mobile Tracker Alert" - - /*================================================================================================== FUNCTION IMPLEMENTATION ==================================================================================================*/ @@ -71,11 +65,11 @@ msg_error_t InitMmsDir() { if (errno == EEXIST) { - MSG_DEBUG("The %s already exists", MSG_SMIL_FILE_PATH); + MSG_SEC_DEBUG("The %s already exists", MSG_SMIL_FILE_PATH); } else { - MSG_DEBUG("Error while mkdir %s", MSG_SMIL_FILE_PATH); + MSG_SEC_DEBUG("Error while mkdir %s", MSG_SMIL_FILE_PATH); return MSG_ERR_DB_MAKE_DIR; } } @@ -107,11 +101,8 @@ msg_error_t InitMmsDir() if (errno == EEXIST) { MSG_DEBUG("The %s already exists", MSG_IPC_DATA_PATH); - // if IPC data path is already exist, clear all files in folder. - char exeStr[1024]; - snprintf(exeStr, 1024, "rm %s*.DATA", MSG_IPC_DATA_PATH); - system(exeStr); + MsgRmRf((char *)MSG_IPC_DATA_PATH); } else { @@ -120,164 +111,49 @@ msg_error_t InitMmsDir() } } - if(chmod( MSG_IPC_DATA_PATH, S_IRWXU | S_IRWXG ) !=0) { //public shared file: pass data by file + if(MsgChmod( MSG_IPC_DATA_PATH, S_IRWXU | S_IRWXG ) == 0) { //public shared file: pass data by file MSG_DEBUG("Fail to chmod [%s].", MSG_IPC_DATA_PATH); } - chown( MSG_IPC_DATA_PATH, 0, 6502 ); - - return MSG_SUCCESS; -} - - -void SendMobileTrackerMsg() -{ - MSG_BEGIN(); - - bool bEnabled = false; - - if (MsgSettingGetBool(VCONFKEY_SETAPPL_FIND_MY_MOBILE_SIM_CHANGE_ALERT_BOOL, &bEnabled) < 0) - { - MSG_DEBUG("Can't read VCONFKEY_SETAPPL_FIND_MY_MOBILE_SIM_CHANGE_ALERT_BOOL"); - return; - } - - if (bEnabled == false) - { - MSG_DEBUG("Mobile Tracker Option [%d]", bEnabled); - return; - } - // to wait modem init - // temporary code. - else - { - MSG_DEBUG("Waiting for modem ready, 22 sec."); - sleep(22); + if(MsgChown( MSG_DATA_ROOT_PATH, 0, 5000 ) == 0) { + MSG_DEBUG("Fail to chown [%s].", MSG_DATA_ROOT_PATH); } - - MSG_REQUEST_INFO_S req = {0}; - - req.sendOptInfo.bSetting = false; - - req.msgInfo.msgId = 0; - req.msgInfo.threadId = 0; - req.msgInfo.folderId = MSG_DRAFT_ID; - req.msgInfo.msgType.mainType = MSG_SMS_TYPE; - req.msgInfo.msgType.subType = MSG_NORMAL_SMS; - req.msgInfo.msgType.classType = MSG_CLASS_NONE; - req.msgInfo.storageId = MSG_STORAGE_PHONE; - req.msgInfo.displayTime = 0; - req.msgInfo.networkStatus = MSG_NETWORK_NOT_SEND; - req.msgInfo.encodeType = MSG_ENCODE_AUTO; - req.msgInfo.bRead = false; - req.msgInfo.bProtected = false; - req.msgInfo.priority = MSG_MESSAGE_PRIORITY_NORMAL; - req.msgInfo.direction = MSG_DIRECTION_TYPE_MO; - req.msgInfo.msgPort.valid = false; - req.msgInfo.bTextSms = true; - - // Get Message Text - char* msgText = NULL; - - msgText = MsgSettingGetString(VCONFKEY_SETAPPL_FIND_MY_MOBILE_MESSAGE_STR); - - if (msgText == NULL) - { - MSG_DEBUG("Assign Default Msg"); - msgText = strdup(MSG_MOBILE_TRACKER_MSG); - if (msgText == NULL) { - MSG_DEBUG("msgText is NULL."); - return; - } + if(MsgChown( MSG_DATA_PATH, 0, 5000 ) == 0) { + MSG_DEBUG("Fail to chown [%s].", MSG_DATA_PATH); } - - MSG_DEBUG("mobile tracker msg : [%s]", msgText); - - req.msgInfo.dataSize = strlen(msgText); - strncpy(req.msgInfo.msgText, msgText, req.msgInfo.dataSize); - - // Get Address List - char *orgRecipientList = NULL; - - orgRecipientList = MsgSettingGetString(VCONFKEY_SETAPPL_FIND_MY_MOBILE_RECIPIENTS_STR); - - if (orgRecipientList == NULL) - { - MSG_DEBUG("recipient list is NULL"); - free(msgText); - msgText = NULL; - return; - } - - int len = strlen(orgRecipientList); - char recipientList[len + 1]; - - memset(recipientList, 0, len + 1); - memcpy(recipientList, orgRecipientList, len); - - MSG_DEBUG("recipient list : [%s]", recipientList); - - req.msgInfo.nAddressCnt = 1; - - char *token; - - token = strtok(recipientList, "|"); - - MSG_MAIN_TYPE_T mainType = MSG_SMS_TYPE; - MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(mainType); - - msg_error_t err = MSG_SUCCESS; - - while (token) - { - req.msgInfo.addressList[0].addressType = MSG_ADDRESS_TYPE_PLMN; - req.msgInfo.addressList[0].recipientType = MSG_RECIPIENTS_TYPE_TO; - - memset(req.msgInfo.addressList[0].addressVal, 0x00, MAX_ADDRESS_VAL_LEN); - strncpy(req.msgInfo.addressList[0].addressVal, token, MAX_ADDRESS_VAL_LEN); - - MSG_DEBUG("address : [%s]", req.msgInfo.addressList[0].addressVal); - - if (plg != NULL) - { - MSG_DEBUG("mobile tracker msg : [%s]", msgText); - - err = plg->submitReq(&req); - - if (err != MSG_SUCCESS) - { - MSG_DEBUG("fail to send mobile tracker msg : [%d]", err); - break; - } - } - - token = strtok(NULL, "|"); + if(MsgChown( MSG_SMIL_FILE_PATH, 0, 5000 ) == 0) { + MSG_DEBUG("Fail to chown [%s].", MSG_SMIL_FILE_PATH); } - - if (msgText) { - free(msgText); - msgText = NULL; + if(MsgChown( MSG_IPC_DATA_PATH, 0, 5000 ) == 0) { + MSG_DEBUG("Fail to chown [%s].", MSG_IPC_DATA_PATH); } - - if (orgRecipientList) { - free(orgRecipientList); - orgRecipientList = NULL; + if(MsgChown( MSG_THUMBNAIL_PATH, 0, 5000 ) == 0) { + MSG_DEBUG("Fail to chown [%s].", MSG_THUMBNAIL_PATH); } - - - MSG_END(); - - return; + return MSG_SUCCESS; } -void* StartMsgServer(void*) +void* InitMsgServer(void*) { + msg_error_t err = MSG_SUCCESS; + MSG_DEBUG("Start InitMsgServer."); - MsgOpenContactSvc(); + // Register Callback to get the change of contact + MsgInitContactSvc(&MsgContactChangedCallback); + //CID 356902: Moving try block up to include MsgStoInitDB which also throws MsgException try { - MsgTransactionManager::instance()->run(); + // storage handler initialize + err = MsgStoInitDB(false); + if (err != MSG_SUCCESS) { + MSG_ERR("FAIL TO INITIALIZE STORAGE HANDLER [%d]", err); + } + + MsgInitNoti(); + + // plugin manager initialize + MsgPluginManager::instance()->initialize(); } catch (MsgException& e) { @@ -288,25 +164,44 @@ void* StartMsgServer(void*) MSG_FATAL("%s", e.what()); } - if (g_main_loop_is_running(mainloop)) - g_main_loop_quit(mainloop); - MsgCloseContactSvc(); +// MsgSoundPlayer::instance()->MsgSoundInitRepeatAlarm(); + + MsgStoDisconnectDB(); + + MsgReleaseMemory(); + MSG_DEBUG("End InitMsgServer."); return (void*)0; } -void* InitMsgServer(void*) -{ - msg_error_t err = MSG_SUCCESS; +//static gboolean InitThreadFunc(void* pData) +//{ +// MSG_BEGIN(); +// +// pthread_t initThreadId; +// +// // initialize msg fw +// if (pthread_create(&initThreadId, NULL, InitMsgServer, NULL) != 0) +// { +// MSG_DEBUG("InitMsgFw not invoked: %s", strerror(errno)); +// return -1; +// } +// +// pthread_detach(initThreadId); +// +// MSG_END(); +// +// return FALSE; +//} - MsgOpenContactSvc(); +void* StartMsgServer(void*) +{ try { - // plugin manager initialize - MsgPluginManager::instance()->initialize(); + MsgTransactionManager::instance()->run(); } catch (MsgException& e) { @@ -317,104 +212,13 @@ void* InitMsgServer(void*) MSG_FATAL("%s", e.what()); } - MSG_MAIN_TYPE_T mainType = MSG_SMS_TYPE; - MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(mainType); - - // storage handler initialize - err = MsgStoInitDB(false); - - if (err != MSG_SUCCESS) { - MSG_DEBUG("FAIL TO INITIALIZE STORAGE HANDLER [%d]", err); - } - - // Set Msg FW Ready Flag - if(MsgSettingSetBool(VCONFKEY_MSG_SERVER_READY, true) != MSG_SUCCESS) - MSG_DEBUG("MsgSettingSetBool FAIL : VCONFKEY_MSG_SERVER_READY"); - MSG_DEBUG("### VCONFKEY_MSG_SERVER_READY ###"); - - if (plg == NULL) { - MSG_DEBUG("No plugin for %d type", mainType); - - MsgReleaseMemory(); - return (void*)0; - } - - // Clear and reset notification - MsgCleanAndResetNoti(); - - MSG_SIM_STATUS_T simStatus = MSG_SIM_STATUS_NORMAL; - - // Check Sim Status - if (plg->checkSimStatus(&simStatus) == MSG_SUCCESS) { - - // Add the change of SIM to vconf - if (MsgSettingSetInt(MSG_SIM_CHANGED, (int)simStatus) != MSG_SUCCESS) { - MSG_DEBUG("Error to set config data [%s]", MSG_SIM_CHANGED); - } - - if (simStatus != MSG_SIM_STATUS_NOT_FOUND) { - // Check Device Status - if (plg->checkDeviceStatus() != MSG_SUCCESS) { - MSG_DEBUG("checkDeviceStatus() error"); - - MsgReleaseMemory(); - - return (void*)0; - } - } - - // Init SIM Message - if (MsgInitSimMessage(simStatus) != MSG_SUCCESS) { - MSG_DEBUG("Fail to Initialize SIM Message"); - } - - // Init SIM Configuration - if (MsgInitSimConfig(simStatus) != MSG_SUCCESS) { - MSG_DEBUG("Fail to Initialize SIM Configuration"); - } - - // Add SendMobileTrackerMsg() to GMainLoop - if (simStatus == MSG_SIM_STATUS_CHANGED) { - MSG_DEBUG("Send Mobile Tracker Message"); - - SendMobileTrackerMsg(); - } - } else { - MSG_DEBUG("checkSimStatus() error"); - } - - MsgReleaseMemory(); - - // Register Callback to get the change of contact - MsgInitContactSvc(&MsgContactChangedCallback); - - MsgSoundInitRepeatAlarm(); + if (g_main_loop_is_running(mainloop)) + g_main_loop_quit(mainloop); return (void*)0; } -static gboolean InitThreadFunc(void* pData) -{ - MSG_BEGIN(); - - pthread_t initThreadId; - - // initialize msg fw - if (pthread_create(&initThreadId, NULL, InitMsgServer, NULL) != 0) - { - MSG_DEBUG("InitMsgFw not invoked: %s", strerror(errno)); - return -1; - } - - pthread_detach(initThreadId); - - MSG_END(); - - return FALSE; -} - - int main(void) { #if !GLIB_CHECK_VERSION(2, 31, 0) @@ -430,7 +234,7 @@ signal( SIGCHLD, SIG_IGN ); //////////////////////////////////// - MSG_DEBUG("===========START MESSAGING FRAMEWORK=========="); + MSG_INFO("===========START MESSAGING FRAMEWORK=========="); // Reset message server ready flag if(MsgSettingSetBool(VCONFKEY_MSG_SERVER_READY, false) != MSG_SUCCESS) @@ -439,14 +243,13 @@ signal( SIGCHLD, SIG_IGN ); // Connect to DB // MsgStoConnectDB(); - // Open Contact Service - MsgOpenContactSvc(); - // Clean up mms dir InitMmsDir(); - // Regist vconf CB. - MsgSettingRegVconfCB(); + g_type_init(); + + // init server + InitMsgServer(NULL); pthread_t startThreadId; @@ -457,15 +260,14 @@ signal( SIGCHLD, SIG_IGN ); return -1; } - MsgTransactionManager::instance()->getTMStatus(); + // Regist vconf CB. + MsgSettingRegVconfCB(); + +// MsgTransactionManager::instance()->getTMStatus(); mainloop = g_main_loop_new(NULL, FALSE); -#if !GLIB_CHECK_VERSION(2,35,0) - g_type_init (); -#endif - - g_idle_add(InitThreadFunc, NULL); +// g_idle_add(InitThreadFunc, NULL); if (mainloop != NULL) { diff --git a/framework/plugin-manager/MsgPluginConfig.cpp b/framework/plugin-manager/MsgPluginConfig.cpp index bd0820f..5f30bbe 100755 --- a/framework/plugin-manager/MsgPluginConfig.cpp +++ b/framework/plugin-manager/MsgPluginConfig.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include "MsgPluginConfig.h" diff --git a/framework/plugin-manager/MsgPluginManager.cpp b/framework/plugin-manager/MsgPluginManager.cpp index b3d1fe0..02ac3fb 100755 --- a/framework/plugin-manager/MsgPluginManager.cpp +++ b/framework/plugin-manager/MsgPluginManager.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include @@ -21,6 +21,7 @@ #include "MsgUtilFile.h" #include "MsgException.h" #include "MsgIpcSocket.h" +#include "MsgUtilFunction.h" #include "MsgCmdTypes.h" #include "MsgGconfWrapper.h" #include "MsgPluginManager.h" @@ -38,7 +39,17 @@ void MsgSentStatusListener(MSG_SENT_STATUS_S *pSentStatus) // establish connection to msgfw daemon MsgIpcClientSocket client; - client.connect(MSG_SOCKET_PATH); + try + { + client.connect(MSG_SOCKET_PATH); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return; + } + + // composing command int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_SENT_STATUS_S); // cmd type, MSG_SENT_STATUS @@ -81,7 +92,15 @@ void MsgStorageChangeListener(msg_storage_change_type_t storageChangeType, MSG_M // establish connection to msgfw daemon MsgIpcClientSocket client; + try + { client.connect(MSG_SOCKET_PATH); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return; + } // composing command int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_MESSAGE_INFO_S) + sizeof(msg_storage_change_type_t); @@ -123,7 +142,15 @@ msg_error_t MsgIncomingMessageListener(MSG_MESSAGE_INFO_S *pMsg) // establish connection to msgfw daemon MsgIpcClientSocket client; - client.connect(MSG_SOCKET_PATH); + try + { + client.connect(MSG_SOCKET_PATH); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_UNKNOWN; + } // Check Invalid Message Structure if (pMsg == NULL) @@ -133,8 +160,13 @@ msg_error_t MsgIncomingMessageListener(MSG_MESSAGE_INFO_S *pMsg) return MSG_ERR_NULL_MESSAGE; } + // Allocate Memory to Command Data + char* encodedData = NULL; + AutoPtr buf(&encodedData); + int dataSize = MsgEncodeMsgInfo(pMsg, &encodedData); + // composing command - int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_MESSAGE_INFO_S); // cmd type, MSG_MESSAGE_INFO_S + int cmdSize = sizeof(MSG_CMD_S) + dataSize; // cmd type, MSG_MESSAGE_INFO_S MSG_DEBUG("cmdSize: %d", cmdSize); @@ -148,7 +180,7 @@ msg_error_t MsgIncomingMessageListener(MSG_MESSAGE_INFO_S *pMsg) memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN); - memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pMsg, sizeof(MSG_MESSAGE_INFO_S)); + memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), encodedData, dataSize); // Send Command to Messaging FW client.write(cmdBuf, cmdSize); @@ -167,7 +199,8 @@ msg_error_t MsgIncomingMessageListener(MSG_MESSAGE_INFO_S *pMsg) MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; if (pEvent->eventType != MSG_EVENT_PLG_INCOMING_MSG_IND) - THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + MSG_FATAL("Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + //THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); MSG_END(); @@ -181,7 +214,15 @@ msg_error_t MsgIncomingSyncMLMessageListener(MSG_SYNCML_MESSAGE_DATA_S *pSyncMLD // establish connection to msgfw daemon MsgIpcClientSocket client; - client.connect(MSG_SOCKET_PATH); + try + { + client.connect(MSG_SOCKET_PATH); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_UNKNOWN; + } // composing command int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_SYNCML_MESSAGE_DATA_S); // cmd type, MSG_SYNCML_MESSAGE_DATA_S @@ -216,7 +257,8 @@ msg_error_t MsgIncomingSyncMLMessageListener(MSG_SYNCML_MESSAGE_DATA_S *pSyncMLD MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; if (pEvent->eventType != MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND) - THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + MSG_FATAL("Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + //THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); MSG_END(); @@ -229,7 +271,15 @@ msg_error_t MsgIncomingPushMessageListener(MSG_PUSH_MESSAGE_DATA_S *pPushData) // establish connection to msgfw daemon MsgIpcClientSocket client; - client.connect(MSG_SOCKET_PATH); + try + { + client.connect(MSG_SOCKET_PATH); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_UNKNOWN; + } // composing command int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_PUSH_MESSAGE_DATA_S); // cmd type, MSG_SYNCML_MESSAGE_DATA_S @@ -264,7 +314,8 @@ msg_error_t MsgIncomingPushMessageListener(MSG_PUSH_MESSAGE_DATA_S *pPushData) MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; if (pEvent->eventType != MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND) - THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + MSG_FATAL("Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + //THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); MSG_END(); @@ -272,13 +323,21 @@ msg_error_t MsgIncomingPushMessageListener(MSG_PUSH_MESSAGE_DATA_S *pPushData) } -msg_error_t MsgIncomingCBMessageListener(MSG_CB_MSG_S *pCbMsg) +msg_error_t MsgIncomingCBMessageListener(MSG_CB_MSG_S *pCbMsg, MSG_MESSAGE_INFO_S *pMsgInfo) { MSG_BEGIN(); // establish connection to msgfw daemon MsgIpcClientSocket client; - client.connect(MSG_SOCKET_PATH); + try + { + client.connect(MSG_SOCKET_PATH); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_UNKNOWN; + } // Check Invalid Message Structure if (pCbMsg == NULL) @@ -287,9 +346,18 @@ msg_error_t MsgIncomingCBMessageListener(MSG_CB_MSG_S *pCbMsg) return MSG_ERR_NULL_MESSAGE; } + int cmdSize = 0; + + // Allocate Memory to Command Data + char* encodedData = NULL; + AutoPtr buf(&encodedData); + int dataSize = MsgEncodeMsgInfo(pMsgInfo, &encodedData); // composing command - int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_CB_MSG_S); // cmd type, MSG_CB_MSG_S + if(pCbMsg->type == MSG_ETWS_SMS) + cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_CB_MSG_S); // cmd type, MSG_CB_MSG_S + else + cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_CB_MSG_S) + dataSize; // cmd type, MSG_CB_MSG_S MSG_DEBUG("cmdSize: %d", cmdSize); @@ -305,6 +373,9 @@ msg_error_t MsgIncomingCBMessageListener(MSG_CB_MSG_S *pCbMsg) memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pCbMsg, sizeof(MSG_CB_MSG_S)); + if(pCbMsg->type != MSG_ETWS_SMS) + memcpy((void*)((char*)pCmd + sizeof(MSG_CMD_TYPE_T)+ MAX_COOKIE_LEN + sizeof(MSG_CB_MSG_S)), encodedData, dataSize); + // Send Command to Messaging FW client.write(cmdBuf, cmdSize); @@ -322,7 +393,8 @@ msg_error_t MsgIncomingCBMessageListener(MSG_CB_MSG_S *pCbMsg) MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; if (pEvent->eventType != MSG_EVENT_PLG_INCOMING_CB_MSG_IND) - THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + MSG_FATAL("Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + //THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); MSG_END(); @@ -336,7 +408,15 @@ msg_error_t MsgIncomingLBSMessageListener(MSG_LBS_MESSAGE_DATA_S *pLBSData) // establish connection to msgfw daemon MsgIpcClientSocket client; - client.connect(MSG_SOCKET_PATH); + try + { + client.connect(MSG_SOCKET_PATH); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_UNKNOWN; + } // composing command int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_LBS_MESSAGE_DATA_S); // cmd type, MSG_LBS_MESSAGE_DATA_S @@ -371,7 +451,8 @@ msg_error_t MsgIncomingLBSMessageListener(MSG_LBS_MESSAGE_DATA_S *pLBSData) MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; if (pEvent->eventType != MSG_EVENT_PLG_INCOMING_LBS_MSG_IND) - THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + MSG_FATAL("Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + //THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); MSG_END(); @@ -385,7 +466,15 @@ msg_error_t MsgInitSimBySatListener() // establish connection to msgfw daemon MsgIpcClientSocket client; - client.connect(MSG_SOCKET_PATH); + try + { + client.connect(MSG_SOCKET_PATH); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_UNKNOWN; + } // composing command int cmdSize = sizeof(MSG_CMD_S); @@ -414,7 +503,8 @@ msg_error_t MsgInitSimBySatListener() MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; if (pEvent->eventType != MSG_EVENT_PLG_INIT_SIM_BY_SAT) - THROW(MsgException::INVALID_RESULT, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + MSG_FATAL("Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + //THROW(MsgException::INVALID_RESULT, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); MSG_END(); @@ -429,10 +519,23 @@ msg_error_t MsgMmsConfIncomingListener(MSG_MESSAGE_INFO_S *pMsg, msg_request_id_ // establish connection to msgfw daemon MsgIpcClientSocket client; - client.connect(MSG_SOCKET_PATH); + try + { + client.connect(MSG_SOCKET_PATH); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_UNKNOWN; + } + + // Allocate Memory to Command Data + char* encodedData = NULL; + AutoPtr buf(&encodedData); + int dataSize = MsgEncodeMsgInfo(pMsg, &encodedData); // composing command - int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_MESSAGE_INFO_S) + sizeof(msg_request_id_t); // cmd type, MSG_MESSAGE_INFO_S, msg_request_id_t + int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_request_id_t) + dataSize; // cmd type, MSG_MESSAGE_INFO_S, msg_request_id_t MSG_DEBUG("cmdSize : %d", cmdSize); char cmdBuf[cmdSize]; @@ -446,8 +549,8 @@ msg_error_t MsgMmsConfIncomingListener(MSG_MESSAGE_INFO_S *pMsg, msg_request_id_ memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN); // cmd cookie // cmd data - memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pMsg, sizeof(MSG_MESSAGE_INFO_S)); - memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_MESSAGE_INFO_S)), pReqId, sizeof(msg_request_id_t)); + memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pReqId, sizeof(msg_request_id_t)); + memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN + sizeof(msg_request_id_t)), encodedData, dataSize); // Send Command to Messaging FW client.write(cmdBuf, cmdSize); @@ -461,12 +564,212 @@ msg_error_t MsgMmsConfIncomingListener(MSG_MESSAGE_INFO_S *pMsg, msg_request_id_ // close connection to msgfw daemon client.close(); - //Decoding the result from FW and Returning it to plugin - // the result is used for making delivery report + // Decoding the result from FW and Returning it to plugin MSG_EVENT_S *pEvent = (MSG_EVENT_S *)retBuf; - if(pEvent->eventType != MSG_EVENT_PLG_INCOMING_MMS_CONF && pEvent->eventType != MSG_EVENT_PLG_SENT_STATUS_CNF) - THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + if(pEvent->eventType != MSG_EVENT_PLG_INCOMING_MMS_CONF) + MSG_FATAL("Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + //THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + + MSG_END(); + + return (pEvent->result); +} + + +msg_error_t MsgSimMessageListener(MSG_MESSAGE_INFO_S *pMsg, int *simIdList, msg_message_id_t *retMsgId, int size) +{ + MSG_BEGIN(); + + // establish connection to msgfw daemon + MsgIpcClientSocket client; + try + { + client.connect(MSG_SOCKET_PATH); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_UNKNOWN; + } + + // Check Invalid Message Structure + if (pMsg == NULL) + { + MSG_DEBUG("pMsg is NULL !!"); + + return MSG_ERR_NULL_MESSAGE; + } + + // Allocate Memory to Command Data + char* encodedData = NULL; + AutoPtr buf(&encodedData); + int dataSize = MsgEncodeMsgInfo(pMsg, &encodedData); + + char* encodedData2 = NULL; + AutoPtr buf2(&encodedData2); + encodedData2 = (char*)new char[dataSize + sizeof(int) + (sizeof(int)*size) + 1]; + + char *offset = NULL; + memcpy(encodedData2, encodedData, dataSize); + offset = encodedData2+dataSize; + + memcpy(offset, &size, sizeof(int)); + offset += sizeof(int); + MSG_DEBUG("size [%d]", size); + + memcpy(offset, simIdList, (sizeof(int)*size)); + + MSG_DEBUG("simIdList[0] [%d]", simIdList[0]); + + dataSize += ((sizeof(int)*size) + 1); + + // composing command + int cmdSize = sizeof(MSG_CMD_S) + dataSize; // cmd type, MSG_MESSAGE_INFO_S + + MSG_DEBUG("cmdSize: %d", cmdSize); + + char cmdBuf[cmdSize]; + bzero(cmdBuf, cmdSize); + + MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf; + + // Set Command Parameters + pCmd->cmdType = MSG_CMD_ADD_SIM_MSG; + + memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN); + + memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), encodedData2, dataSize); + + // Send Command to Messaging FW + client.write(cmdBuf, cmdSize); + + char* retBuf = NULL; + AutoPtr wrap(&retBuf); + unsigned int retSize; + + client.read(&retBuf, &retSize); + + // close connection to msgfw daemon + client.close(); + + // Decoding the result from FW and Returning it to plugin + // the result is used for making delivery report + MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; + + if (pEvent->eventType != MSG_EVENT_ADD_SIM_MSG) + MSG_FATAL("Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + //THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + + //CID 48645: pEvent->data is an array hence null check is not required on it. + if (retMsgId) { + memcpy(retMsgId, pEvent->data, sizeof(msg_message_id_t));; + MSG_DEBUG("Saved SIM message ID = [%d]", *retMsgId); + } + + MSG_END(); + + return (pEvent->result); +} + +msg_error_t MsgResendMessageListener(void) +{ + // establish connection to msgfw daemon + MsgIpcClientSocket client; + try + { + client.connect(MSG_SOCKET_PATH); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_UNKNOWN; + } + + // composing command + int cmdSize = sizeof(MSG_CMD_S); + + char cmdBuf[cmdSize]; + bzero(cmdBuf, cmdSize); + + MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf; + + // Set Command Parameters + pCmd->cmdType = MSG_CMD_PLG_RESEND_MESSAGE; + + // Send Command to Transaction Manager + client.write(cmdBuf, cmdSize); + + // Receive result from Transaction Manager + char* retBuf = NULL; + AutoPtr wrap(&retBuf); + unsigned int retSize; + client.read(&retBuf, &retSize); + + // close connection to msgfw daemon + client.close(); + + // Decoding the result from FW and Returning it to plugin + MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; + + if (pEvent->eventType != MSG_EVENT_PLG_RESEND_MESSAGE) + MSG_FATAL("Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + //THROW(MsgException::INVALID_RESULT, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + + MSG_END(); + + return (pEvent->result); +} + + +msg_error_t MsgSimImsiListener(int sim_idx) +{ + MSG_BEGIN(); + + // establish connection to msgfw daemon + MsgIpcClientSocket client; + try + { + client.connect(MSG_SOCKET_PATH); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_UNKNOWN; + } + + // composing command + int cmdSize = sizeof(MSG_CMD_S) + sizeof(int); + + char cmdBuf[cmdSize]; + bzero(cmdBuf, cmdSize); + + MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf; + + // Set Command Parameters + pCmd->cmdType = MSG_CMD_UPDATE_IMSI; + + memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN); + memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), (const void *)&sim_idx, sizeof(int)); + + // Send Command to Transaction Manager + client.write(cmdBuf, cmdSize); + + // Receive result from Transaction Manager + char* retBuf = NULL; + AutoPtr wrap(&retBuf); + unsigned int retSize; + client.read(&retBuf, &retSize); + + // close connection to msgfw daemon + client.close(); + + // Decoding the result from FW and Returning it to plugin + MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; + + if (pEvent->eventType != MSG_EVENT_UPDATE_IMSI) + MSG_FATAL("Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + //THROW(MsgException::INVALID_RESULT, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); MSG_END(); @@ -508,24 +811,26 @@ MsgPlugin::MsgPlugin(MSG_MAIN_TYPE_T mainType, const char *libPath): mSupportedM if ((*pFunc)(&mPlgHandler) != MSG_SUCCESS) THROW(MsgException::PLUGIN_ERROR, "ERROR to create plugin handle"); - // Initialize Plug-in - if (initialize() != MSG_SUCCESS) - THROW(MsgException::PLUGIN_ERROR, "ERROR to initialize plugin"); - MSG_PLUGIN_LISTENER_S fwListener = {0}; - fwListener.pfSentStatusCb = &MsgSentStatusListener; - fwListener.pfStorageChangeCb = &MsgStorageChangeListener; - fwListener.pfMsgIncomingCb = &MsgIncomingMessageListener; - fwListener.pfInitSimBySatCb = &MsgInitSimBySatListener; + fwListener.pfSentStatusCb = &MsgSentStatusListener; + fwListener.pfStorageChangeCb = &MsgStorageChangeListener; + fwListener.pfMsgIncomingCb = &MsgIncomingMessageListener; + fwListener.pfInitSimBySatCb = &MsgInitSimBySatListener; fwListener.pfSyncMLMsgIncomingCb = &MsgIncomingSyncMLMessageListener; fwListener.pfLBSMsgIncomingCb = &MsgIncomingLBSMessageListener; - fwListener.pfMmsConfIncomingCb = &MsgMmsConfIncomingListener; + fwListener.pfMmsConfIncomingCb = &MsgMmsConfIncomingListener; fwListener.pfPushMsgIncomingCb = &MsgIncomingPushMessageListener; - fwListener.pfCBMsgIncomingCb = &MsgIncomingCBMessageListener; + fwListener.pfCBMsgIncomingCb = &MsgIncomingCBMessageListener; + fwListener.pfSimMsgIncomingCb = &MsgSimMessageListener; + fwListener.pfResendMessageCb = &MsgResendMessageListener; + fwListener.pfSimInitImsiCb = &MsgSimImsiListener; if (registerListener(&fwListener) != MSG_SUCCESS) THROW(MsgException::PLUGIN_ERROR, "ERROR to register listener"); + // Initialize Plug-in + if (initialize() != MSG_SUCCESS) + THROW(MsgException::PLUGIN_ERROR, "ERROR to initialize plugin"); } @@ -572,33 +877,6 @@ msg_error_t MsgPlugin::registerListener(MSG_PLUGIN_LISTENER_S *pListener) } -msg_error_t MsgPlugin::checkSimStatus(MSG_SIM_STATUS_T *pStatus) -{ - if (mPlgHandler.pfRegisterListener != NULL) - return mPlgHandler.pfCheckSimStatus(pStatus); - else - return MSG_ERR_INVALID_PLUGIN_HANDLE; -} - - -msg_error_t MsgPlugin::checkDeviceStatus() -{ - if (mPlgHandler.pfRegisterListener != NULL) - return mPlgHandler.pfCheckDeviceStatus(); - else - return MSG_ERR_INVALID_PLUGIN_HANDLE; -} - - -msg_error_t MsgPlugin::initSimMessage() -{ - if (mPlgHandler.pfInitSimMessage != NULL) - return mPlgHandler.pfInitSimMessage(); - else - return MSG_ERR_INVALID_PLUGIN_HANDLE; -} - - msg_error_t MsgPlugin::saveSimMessage(MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_LIST_S *pSimIdList) { if (mPlgHandler.pfSaveSimMessage != NULL) @@ -608,37 +886,28 @@ msg_error_t MsgPlugin::saveSimMessage(MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_L } -msg_error_t MsgPlugin::deleteSimMessage(msg_sim_id_t SimMsgId) +msg_error_t MsgPlugin::deleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId) { if (mPlgHandler.pfDeleteSimMessage != NULL) - return mPlgHandler.pfDeleteSimMessage(SimMsgId); + return mPlgHandler.pfDeleteSimMessage(sim_idx, SimMsgId); else return MSG_ERR_INVALID_PLUGIN_HANDLE; } -msg_error_t MsgPlugin::setReadStatus(msg_sim_id_t SimMsgId) +msg_error_t MsgPlugin::setReadStatus(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId) { if (mPlgHandler.pfSetReadStatus != NULL) - return mPlgHandler.pfSetReadStatus(SimMsgId); + return mPlgHandler.pfSetReadStatus(sim_idx, SimMsgId); else return MSG_ERR_INVALID_PLUGIN_HANDLE; } -msg_error_t MsgPlugin::setMemoryStatus(msg_error_t Error) +msg_error_t MsgPlugin::setMemoryStatus(msg_sim_slot_id_t sim_idx, msg_error_t Error) { if (mPlgHandler.pfSetMemoryStatus != NULL) - return mPlgHandler.pfSetMemoryStatus(Error); - else - return MSG_ERR_INVALID_PLUGIN_HANDLE; -} - - -msg_error_t MsgPlugin::initConfigData(MSG_SIM_STATUS_T SimStatus) -{ - if (mPlgHandler.pfInitConfigData != NULL) - return mPlgHandler.pfInitConfigData(SimStatus); + return mPlgHandler.pfSetMemoryStatus(sim_idx, Error); else return MSG_ERR_INVALID_PLUGIN_HANDLE; } @@ -690,10 +959,10 @@ msg_error_t MsgPlugin::processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQU } -msg_error_t MsgPlugin::getMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg) +msg_error_t MsgPlugin::getMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char **pDestMsg) { if (mPlgHandler.pfGetMmsMessage != NULL) { - return mPlgHandler.pfGetMmsMessage(pMsg, pSendOptInfo, pMmsMsg, pDestMsg); + return mPlgHandler.pfGetMmsMessage(pMsg, pSendOptInfo, pDestMsg); } else { return MSG_ERR_INVALID_PLUGIN_HANDLE; } @@ -728,6 +997,14 @@ msg_error_t MsgPlugin::restoreMsg(MSG_MESSAGE_INFO_S *pMsgInfo, char* pRecvBody, return MSG_ERR_INVALID_PLUGIN_HANDLE; } +msg_error_t MsgPlugin::getDefaultNetworkSimId(int *SimId) +{ + if (mPlgHandler.pfGetDefaultNetworkSimId != NULL) + return mPlgHandler.pfGetDefaultNetworkSimId(SimId); + else + return MSG_ERR_INVALID_PLUGIN_HANDLE; +} + /*================================================================================================== IMPLEMENTATION OF MsgPluginManager - Member Functions @@ -795,21 +1072,34 @@ void MsgPluginManager::loadPlugins(const char* path) plgConf.token(i, 1, tok); const char* libPath = tok.getVal(); - MsgPlugin* pDupPlgCheck = getPlugin(mainType); + MsgPlugin* pDupPlgCheck = checkPlugin(mainType); - if (pDupPlgCheck) - THROW(MsgException::PLUGIN_ERROR, "Plugin for type %d is duplicated", mainType); + if (pDupPlgCheck) { + MSG_DEBUG("Plugin for type %d is duplicated", mainType); + continue; + } - MsgPlugin *newPlg = new MsgPlugin(mainType, libPath); + MsgPlugin *newPlg = NULL; - plgMap.insert(make_pair(mainType, newPlg)); + try + { + newPlg = new MsgPlugin(mainType, libPath); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + continue; + } + + if (newPlg) + plgMap.insert(make_pair(mainType, newPlg)); } MsgCloseFile(fp); } -MsgPlugin* MsgPluginManager::getPlugin(MSG_MAIN_TYPE_T mainType) +MsgPlugin* MsgPluginManager::checkPlugin(MSG_MAIN_TYPE_T mainType) { /* Implementing the content */ MsgPluginMap::iterator it = plgMap.find(mainType); @@ -820,3 +1110,18 @@ MsgPlugin* MsgPluginManager::getPlugin(MSG_MAIN_TYPE_T mainType) return it->second; } + +MsgPlugin* MsgPluginManager::getPlugin(MSG_MAIN_TYPE_T mainType) +{ + MsgPlugin *plugin = NULL; + + if (plgMap.size() == 0) { + MSG_INFO("Msg plugin is initializing again"); + initialize(); + } + + plugin = checkPlugin(mainType); + + return plugin; +} + diff --git a/framework/setting-handler/MsgSettingHandler.cpp b/framework/setting-handler/MsgSettingHandler.cpp index 88cf11c..a6d590d 100755 --- a/framework/setting-handler/MsgSettingHandler.cpp +++ b/framework/setting-handler/MsgSettingHandler.cpp @@ -1,23 +1,26 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include "MsgDebug.h" #include "MsgPluginManager.h" #include "MsgSettingHandler.h" #include "MsgGconfWrapper.h" +#include "MsgUtilFunction.h" +#include "MsgSqliteWrapper.h" +#include "MsgUtilStorage.h" #define DEF_BUF_LEN 128 @@ -29,36 +32,12 @@ /*================================================================================================== FUNCTION IMPLEMENTATION ==================================================================================================*/ -msg_error_t MsgInitSimConfig(MSG_SIM_STATUS_T SimStatus) -{ - MSG_DEBUG("Start to initialize SIM Configuration"); - - msg_error_t err = MSG_SUCCESS; - - if (SimStatus != MSG_SIM_STATUS_NOT_FOUND) - { - MSG_MAIN_TYPE_T mainType = MSG_SMS_TYPE; - MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(mainType); - - if (plg == NULL) - { - MSG_DEBUG("No plugin for %d type", mainType); - return MSG_ERR_INVALID_PLUGIN_HANDLE; - } - - // Check SIM Status - MSG_DEBUG(" ** SIM is available - status : [%d] ** ", SimStatus); - - err = plg->initConfigData(SimStatus); - } - - return err; -} - - msg_error_t MsgSetConfigData(const MSG_SETTING_S *pSetting) { msg_error_t err = MSG_SUCCESS; + char keyName[MAX_VCONFKEY_NAME_LEN]; + memset(keyName, 0x00, sizeof(keyName)); + MSG_SIM_STATUS_T simStatus = MSG_SIM_STATUS_NOT_FOUND; #ifdef USE_GCONF err = MsgGconfGetClient(); @@ -81,6 +60,14 @@ msg_error_t MsgSetConfigData(const MSG_SETTING_S *pSetting) err = MsgSetSMSSendOpt(pSetting); break; case MSG_SMSC_LIST : + // Check SIM is present or not + sprintf(keyName, "%s/%d", MSG_SIM_CHANGED, pSetting->option.smscList.simIndex); + simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName); + + if (simStatus == MSG_SIM_STATUS_NOT_FOUND) { + MSG_DEBUG("SIM is not present.."); + return MSG_ERR_NO_SIM; + } err = MsgSetSMSCList(pSetting, true); break; case MSG_MMS_SENDOPT : @@ -96,9 +83,28 @@ msg_error_t MsgSetConfigData(const MSG_SETTING_S *pSetting) err = MsgSetPushMsgOpt(pSetting); break; case MSG_CBMSG_OPT : + if(pSetting->option.cbMsgOpt.simIndex != 0) + { + // Check SIM is present or not + sprintf(keyName, "%s/%d", MSG_SIM_CHANGED, pSetting->option.cbMsgOpt.simIndex); + simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName); + + if (simStatus == MSG_SIM_STATUS_NOT_FOUND) { + MSG_DEBUG("SIM is not present.."); + return MSG_ERR_NO_SIM; + } + } err = MsgSetCBMsgOpt(pSetting, true); break; case MSG_VOICEMAIL_OPT : + // Check SIM is present or not + sprintf(keyName, "%s/%d", MSG_SIM_CHANGED, pSetting->option.voiceMailOpt.simIndex); + simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName); + + if (simStatus == MSG_SIM_STATUS_NOT_FOUND) { + MSG_DEBUG("SIM is not present.."); + return MSG_ERR_NO_SIM; + } err = MsgSetVoiceMailOpt(pSetting, true); break; case MSG_MSGSIZE_OPT: @@ -127,9 +133,8 @@ msg_error_t MsgGetConfigData(MSG_SETTING_S *pSetting) return MSG_ERR_NULL_POINTER; } #endif - - // Check SIM is present or not - MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(MSG_SIM_CHANGED); + char keyName[MAX_VCONFKEY_NAME_LEN] = {0,}; + MSG_SIM_STATUS_T simStatus = MSG_SIM_STATUS_NOT_FOUND; switch (pSetting->type) { @@ -141,6 +146,10 @@ msg_error_t MsgGetConfigData(MSG_SETTING_S *pSetting) break; case MSG_SMSC_LIST : { + // Check SIM is present or not + sprintf(keyName, "%s/%d", MSG_SIM_CHANGED, pSetting->option.smscList.simIndex); + simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName); + if (simStatus == MSG_SIM_STATUS_NOT_FOUND) { MSG_DEBUG("SIM is not present.."); return MSG_ERR_NO_SIM; @@ -162,6 +171,10 @@ msg_error_t MsgGetConfigData(MSG_SETTING_S *pSetting) break; case MSG_CBMSG_OPT : { + // Check SIM is present or not + sprintf(keyName, "%s/%d", MSG_SIM_CHANGED, pSetting->option.cbMsgOpt.simIndex); + simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName); + if (simStatus == MSG_SIM_STATUS_NOT_FOUND) { MSG_DEBUG("SIM is not present.."); return MSG_ERR_NO_SIM; @@ -170,6 +183,19 @@ msg_error_t MsgGetConfigData(MSG_SETTING_S *pSetting) } break; case MSG_VOICEMAIL_OPT : + // Check SIM is present or not + if (pSetting->option.voiceMailOpt.simIndex == 0) { + MSG_DEBUG("Invalid SIM Index [%d]", pSetting->option.voiceMailOpt.simIndex); + return MSG_ERR_INVALID_PARAMETER; + } + + sprintf(keyName, "%s/%d", MSG_SIM_CHANGED, pSetting->option.voiceMailOpt.simIndex); + simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName); + + if (simStatus == MSG_SIM_STATUS_NOT_FOUND) { + MSG_DEBUG("SIM is not present.."); + return MSG_ERR_NO_SIM; + } MsgGetVoiceMailOpt(pSetting); break; case MSG_MSGSIZE_OPT : @@ -192,6 +218,8 @@ msg_error_t MsgSetGeneralOpt(const MSG_SETTING_S *pSetting) { MSG_GENERAL_OPT_S generalOpt; bool bValue = false; + int iValue = 0; + char *strValue = NULL; memcpy(&generalOpt, &(pSetting->option.generalOpt), sizeof(MSG_GENERAL_OPT_S)); @@ -211,15 +239,99 @@ msg_error_t MsgSetGeneralOpt(const MSG_SETTING_S *pSetting) } } -#ifdef __NOT_USED_BY_DESIGN_CHANGE__ - iValue = MsgSettingGetInt(MSG_ALERT_TONE); + MsgSettingGetBool(MSG_BLOCK_UNKNOWN_MSG, &bValue); + if (bValue != generalOpt.bBlockUnknownMsg) { + if (MsgSettingSetBool(MSG_BLOCK_UNKNOWN_MSG, generalOpt.bBlockUnknownMsg) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MSG_BLOCK_UNKNOWN_MSG); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MSG_SMS_LIMIT); + if (iValue != (int)generalOpt.smsLimitCnt) { + if (MsgSettingSetInt(MSG_SMS_LIMIT, (int)generalOpt.smsLimitCnt) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MSG_SMS_LIMIT); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MSG_MMS_LIMIT); + if (iValue != (int)generalOpt.mmsLimitCnt) { + if (MsgSettingSetInt(MSG_MMS_LIMIT, (int)generalOpt.mmsLimitCnt) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MSG_MMS_LIMIT); + return MSG_ERR_SET_SETTING; + } + } + + MsgSettingGetBool(MSG_SETTING_NOTIFICATION, &bValue); + if (bValue != generalOpt.bNotification) { + if (MsgSettingSetBool(MSG_SETTING_NOTIFICATION, generalOpt.bNotification) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MSG_SETTING_NOTIFICATION); + return MSG_ERR_SET_SETTING; + } + } + + MsgSettingGetBool(MSG_SETTING_VIBRATION, &bValue); + if (bValue != generalOpt.bVibration) { + if (MsgSettingSetBool(MSG_SETTING_VIBRATION, generalOpt.bVibration) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MSG_SETTING_VIBRATION); + return MSG_ERR_SET_SETTING; + } + } + + MsgSettingGetBool(MSG_SETTING_PREVIEW, &bValue); + if (bValue != generalOpt.bPreview) { + if (MsgSettingSetBool(MSG_SETTING_PREVIEW, generalOpt.bPreview) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MSG_SETTING_PREVIEW); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MSG_SETTING_RINGTONE_TYPE); + if (iValue != generalOpt.ringtoneType) { + if (MsgSettingSetInt(MSG_SETTING_RINGTONE_TYPE, generalOpt.ringtoneType) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MSG_SETTING_RINGTONE_TYPE); + return MSG_ERR_SET_SETTING; + } + } + + if (generalOpt.ringtoneType == MSG_RINGTONE_TYPE_SILENT) { + if (MsgSettingSetString(MSG_SETTING_RINGTONE_PATH, "") != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MSG_SETTING_RINGTONE_PATH); + return MSG_ERR_SET_SETTING; + } + } else { + strValue = MsgSettingGetString(MSG_SETTING_RINGTONE_PATH); + MSG_DEBUG("strValue=[%s], ringtone=[%s]", strValue, generalOpt.ringtonePath); + + if (g_strcmp0(strValue, generalOpt.ringtonePath) != 0) { + if (MsgSettingSetString(MSG_SETTING_RINGTONE_PATH, generalOpt.ringtonePath) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MSG_SETTING_RINGTONE_PATH); + return MSG_ERR_SET_SETTING; + } + } + } + + if (strValue) { + free(strValue); + strValue = NULL; + } + + iValue = MsgSettingGetInt(MSG_ALERT_REP_TYPE); if (iValue != (int)generalOpt.alertTone) { - if (MsgSettingSetInt(MSG_ALERT_TONE, (int)generalOpt.alertTone) != MSG_SUCCESS) { - MSG_DEBUG("Error to set config data [%s]", MSG_ALERT_TONE); + if (MsgSettingSetInt(MSG_ALERT_REP_TYPE, (int)generalOpt.alertTone) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MSG_ALERT_REP_TYPE); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MSG_SEARCH_TAGS); + if (iValue != (int)generalOpt.searchTags) { + if (MsgSettingSetInt(MSG_SEARCH_TAGS, (int)generalOpt.searchTags) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MSG_SEARCH_TAGS); return MSG_ERR_SET_SETTING; } } -#endif /* __NOT_USED_BY_DESIGN_CHANGE__ */ return MSG_SUCCESS; } @@ -281,96 +393,46 @@ msg_error_t MsgSetSMSCList(const MSG_SETTING_S *pSetting, bool bSetSim) { msg_error_t err = MSG_SUCCESS; - for (int index = 0; index < pSetting->option.smscList.totalCnt; index++) - { - if(strlen(pSetting->option.smscList.smscData[index].smscAddr.address) > SMSC_ADDR_MAX) - { - MSG_DEBUG("SMSC address is too long [%d]", strlen(pSetting->option.smscList.smscData[index].smscAddr.address)); - return MSG_ERR_SET_SIM_SET; - } - } - - if (bSetSim == true) - { - err = MsgSetConfigInSim(pSetting); - - if (err != MSG_SUCCESS) - { - MSG_DEBUG("Error to set config data in sim [%d]", err); - return err; - } - } - - MSG_SMSC_LIST_S smscList; + int addrLen = 0; + int index = 0; + MSG_SMSC_LIST_S smscList = {0,}; memcpy(&smscList, &(pSetting->option.smscList), sizeof(MSG_SMSC_LIST_S)); - char keyName[DEF_BUF_LEN] = {0, }; +// int sel_id = smscList.selected; - // No selected SMSC Info. in SIM. - if (bSetSim == true) - { - if (MsgSettingSetInt(SMSC_SELECTED, smscList.selected) != MSG_SUCCESS) - { - MSG_DEBUG("Error to set config data [%s]", SMSC_SELECTED); - return MSG_ERR_SET_SETTING; - } - } + index = smscList.index; - if (MsgSettingSetInt(SMSC_TOTAL_COUNT, smscList.totalCnt) != MSG_SUCCESS) - { - MSG_DEBUG("Error to set config data [%s]", SMSC_TOTAL_COUNT); - return MSG_ERR_SET_SETTING; + if (index < 0 || index >= smscList.totalCnt) { + MSG_DEBUG("Update SMSC index is invalid [id=%d]", index); + return MSG_ERR_INVALID_PARAMETER; } - for (int i = 0; i < smscList.totalCnt; i++) - { - snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_PID, i); - - if ((err = MsgSettingSetInt(keyName, (int)smscList.smscData[i].pid)) != MSG_SUCCESS) - break; - - memset(keyName, 0x00, sizeof(keyName)); - snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_VAL_PERIOD, i); - - if ((err = MsgSettingSetInt(keyName, (int)smscList.smscData[i].valPeriod)) != MSG_SUCCESS) - break; - - memset(keyName, 0x00, sizeof(keyName)); - snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_NAME, i); - - if ((err = MsgSettingSetString(keyName, smscList.smscData[i].name)) != MSG_SUCCESS) - break; - - memset(keyName, 0x00, sizeof(keyName)); - snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_TON, i); - - if (smscList.smscData[i].smscAddr.address[0] == '+') - smscList.smscData[i].smscAddr.ton = MSG_TON_INTERNATIONAL; - else - smscList.smscData[i].smscAddr.ton = MSG_TON_NATIONAL; - - if ((err = MsgSettingSetInt(keyName, (int)smscList.smscData[i].smscAddr.ton)) != MSG_SUCCESS) - break; - - memset(keyName, 0x00, sizeof(keyName)); - snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_NPI, i); - - smscList.smscData[i].smscAddr.npi = MSG_NPI_ISDN; // app cannot set this value - - if ((err = MsgSettingSetInt(keyName, (int)smscList.smscData[i].smscAddr.npi)) != MSG_SUCCESS) - break; + if (pSetting->option.smscList.smscData[index].smscAddr.address[0] == '+') + addrLen = strlen(pSetting->option.smscList.smscData[index].smscAddr.address) - 1; + else + addrLen = strlen(pSetting->option.smscList.smscData[index].smscAddr.address); - memset(keyName, 0x00, sizeof(keyName)); - snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_ADDRESS, i); + if(addrLen > SMSC_ADDR_MAX) { + MSG_DEBUG("SMSC address is too long [%d]", strlen(pSetting->option.smscList.smscData[index].smscAddr.address)); + return MSG_ERR_SET_SIM_SET; + } else if(addrLen < 2) { + MSG_DEBUG("SMSC address is too short [%d]", addrLen); + return MSG_ERR_SET_SIM_SET; + } - if ((err = MsgSettingSetString(keyName, smscList.smscData[i].smscAddr.address)) != MSG_SUCCESS) - break; + if (pSetting->option.smscList.simIndex == 0) { + MSG_DEBUG("SIM Index for Setting SMSC List = 0"); + return MSG_ERR_INVALID_PARAMETER; } - if (err != MSG_SUCCESS) - { - MSG_DEBUG("Error to set config data [%s]", keyName); + if (bSetSim == true) { + err = MsgSetConfigInSim(pSetting); + + if (err != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data in sim [%d]", err); + return err; + } } return err; @@ -735,17 +797,26 @@ msg_error_t MsgSetCBMsgOpt(const MSG_SETTING_S *pSetting, bool bSetSim) MSG_CBMSG_OPT_S cbOpt; int iValue = 0; bool bValue = false; + char keyName[DEF_BUF_LEN]; + msg_sim_slot_id_t simIndex; memcpy(&cbOpt, &(pSetting->option.cbMsgOpt), sizeof(MSG_CBMSG_OPT_S)); - if (bSetSim == true) { - cbOpt.maxSimCnt = MsgSettingGetInt(CB_MAX_SIM_COUNT); + simIndex = cbOpt.simIndex; - if (cbOpt.channelData.channelCnt > cbOpt.maxSimCnt) { - MSG_DEBUG("Channel Count is over Max SIM Count [%d]", cbOpt.channelData.channelCnt); - return MSG_ERR_SET_SIM_SET; - } + MSG_DEBUG("SIM Index = [%d]", simIndex); + if (bSetSim == true ) {//if (bSetSim == true && simIndex != 0) { + if(simIndex != 0) { + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, sizeof(keyName), "%s/%d", CB_MAX_SIM_COUNT, simIndex); + cbOpt.maxSimCnt = MsgSettingGetInt(keyName); + + if (cbOpt.channelData.channelCnt > cbOpt.maxSimCnt) { + MSG_DEBUG("Channel Count is over Max SIM Count [%d]", cbOpt.channelData.channelCnt); + return MSG_ERR_SET_SIM_SET; + } + } err = MsgSetConfigInSim(pSetting); if (err != MSG_SUCCESS) { MSG_DEBUG("Error to set config data in sim [%d]", err); @@ -753,6 +824,8 @@ msg_error_t MsgSetCBMsgOpt(const MSG_SETTING_S *pSetting, bool bSetSim) } } +// memset(keyName, 0x00, sizeof(keyName)); +// snprintf(keyName, sizeof(keyName), "%s/%d", CB_RECEIVE, simIndex); MsgSettingGetBool(CB_RECEIVE, &bValue); if (bValue != cbOpt.bReceive) { if (MsgSettingSetBool(CB_RECEIVE, cbOpt.bReceive) != MSG_SUCCESS) { @@ -761,49 +834,25 @@ msg_error_t MsgSetCBMsgOpt(const MSG_SETTING_S *pSetting, bool bSetSim) } } - iValue = MsgSettingGetInt(CB_MAX_SIM_COUNT); - if (iValue != cbOpt.maxSimCnt) { - if (MsgSettingSetInt(CB_MAX_SIM_COUNT, cbOpt.maxSimCnt) != MSG_SUCCESS) { - MSG_DEBUG("Error to set config data [%s]", CB_MAX_SIM_COUNT); - return MSG_ERR_SET_SETTING; - } + if (simIndex == 0) { + MSG_DEBUG("SIM Index for Setting CB Option = 0, Setting for CB_RECEIVE success"); + return MSG_SUCCESS; } - iValue = MsgSettingGetInt(CB_CHANNEL_COUNT); - if (iValue != cbOpt.channelData.channelCnt) { - if (MsgSettingSetInt(CB_CHANNEL_COUNT, cbOpt.channelData.channelCnt) != MSG_SUCCESS) { - MSG_DEBUG("Error to set config data [%s]", CB_CHANNEL_COUNT); + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, sizeof(keyName), "%s/%d", CB_MAX_SIM_COUNT, simIndex); + iValue = MsgSettingGetInt(keyName); + if (iValue != cbOpt.maxSimCnt) { + if (MsgSettingSetInt(CB_MAX_SIM_COUNT, cbOpt.maxSimCnt) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", keyName); return MSG_ERR_SET_SETTING; } } - char keyName[DEF_BUF_LEN] = {0, }; + MsgDbHandler *dbHandle = getDbHandle();; - for (int i = 0; i < cbOpt.channelData.channelCnt; i++) - { - snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_ACTIVATE, i); - - if ((err = MsgSettingSetBool(keyName, cbOpt.channelData.channelInfo[i].bActivate)) != MSG_SUCCESS) - break; - - memset(keyName, 0x00, sizeof(keyName)); - snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_ID_FROM, i); - - if ((err = MsgSettingSetInt(keyName, cbOpt.channelData.channelInfo[i].from)) != MSG_SUCCESS) - break; - - memset(keyName, 0x00, sizeof(keyName)); - snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_ID_TO, i); - - if ((err = MsgSettingSetInt(keyName, cbOpt.channelData.channelInfo[i].to)) != MSG_SUCCESS) - break; - - memset(keyName, 0x00, sizeof(keyName)); - snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_NAME, i); - - if ((err = MsgSettingSetString(keyName, cbOpt.channelData.channelInfo[i].name)) != MSG_SUCCESS) - break; - } + err = MsgStoAddCBChannelInfo(dbHandle, &cbOpt.channelData, simIndex); + MSG_DEBUG("MsgStoAddCBChannelInfo : err=[%d]", err); if (bSetSim == true) { @@ -828,31 +877,43 @@ msg_error_t MsgSetVoiceMailOpt(const MSG_SETTING_S *pSetting, bool bSetSim) { MSG_VOICEMAIL_OPT_S voiceMailOpt; char *pValue = NULL; + char keyName[DEF_BUF_LEN]; + msg_sim_slot_id_t simIndex = 0; msg_error_t err = MSG_SUCCESS; memcpy(&voiceMailOpt, &(pSetting->option.voiceMailOpt), sizeof(MSG_VOICEMAIL_OPT_S)); - pValue = MsgSettingGetString(VOICEMAIL_NUMBER); + simIndex = pSetting->option.voiceMailOpt.simIndex; + + if (simIndex == 0) { + MSG_DEBUG("SIM Index for Setting Voicemail Option = 0"); + return MSG_ERR_INVALID_PARAMETER; + } + + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, simIndex); + + pValue = MsgSettingGetString(keyName); + if (pValue != NULL && strcmp(pValue, voiceMailOpt.mailNumber) == 0) { /* Value is same with previous one. Therefore, we don't need to save it. */ } else { if (bSetSim == true) { err = MsgSetConfigInSim(pSetting); + /* Even if err is not Success, no need to return error. */ + MSG_DEBUG("MsgSetConfigInSim return [%d]", err); + } - if (err == MSG_SUCCESS) { - err = MsgSettingSetString(VOICEMAIL_NUMBER, voiceMailOpt.mailNumber); - if (err != MSG_SUCCESS) - MSG_DEBUG("Error to set config data [%s]", VOICEMAIL_NUMBER); - } else { - MSG_DEBUG("Error to set config data in sim [%d]", err); - } - } else { - err = MsgSettingSetString(VOICEMAIL_NUMBER, voiceMailOpt.mailNumber); - if (err != MSG_SUCCESS) - MSG_DEBUG("Error to set config data [%s]", VOICEMAIL_NUMBER); + if (err != MSG_SUCCESS) { + goto _END_OF_SET_VOICE_OPT; } + + err = MsgSettingSetString(keyName, voiceMailOpt.mailNumber); + if (err != MSG_SUCCESS) + MSG_DEBUG("Error to set config data [%s]", keyName); } +_END_OF_SET_VOICE_OPT: if (pValue != NULL) { free(pValue); pValue = NULL; @@ -883,15 +944,39 @@ msg_error_t MsgSetMsgSizeOpt(const MSG_SETTING_S *pSetting) void MsgGetGeneralOpt(MSG_SETTING_S *pSetting) { + char *tmpValue = NULL; + memset(&(pSetting->option.generalOpt), 0x00, sizeof(MSG_GENERAL_OPT_S)); MsgSettingGetBool(MSG_KEEP_COPY, &pSetting->option.generalOpt.bKeepCopy); -#ifdef __NOT_USED_BY_DESIGN_CHANGE__ - pSetting->option.generalOpt.alertTone = (MSG_ALERT_TONE_T)MsgSettingGetInt(MSG_ALERT_TONE); + MsgSettingGetBool(MSG_BLOCK_UNKNOWN_MSG, &pSetting->option.generalOpt.bBlockUnknownMsg); + + pSetting->option.generalOpt.smsLimitCnt = MsgSettingGetInt(MSG_SMS_LIMIT); + + pSetting->option.generalOpt.mmsLimitCnt = MsgSettingGetInt(MSG_MMS_LIMIT); + + MsgSettingGetBool(MSG_SETTING_NOTIFICATION, &pSetting->option.generalOpt.bNotification); + + MsgSettingGetBool(MSG_SETTING_VIBRATION, &pSetting->option.generalOpt.bVibration); + + MsgSettingGetBool(MSG_SETTING_PREVIEW, &pSetting->option.generalOpt.bPreview); MsgSettingGetBool(MSG_AUTO_ERASE, &pSetting->option.generalOpt.bAutoErase); -#endif /* __NOT_USED_BY_DESIGN_CHANGE__ */ + + pSetting->option.generalOpt.ringtoneType = MsgSettingGetInt(MSG_SETTING_RINGTONE_TYPE); + + tmpValue = MsgSettingGetString(MSG_SETTING_RINGTONE_PATH); + if (tmpValue != NULL) { + strncpy(pSetting->option.generalOpt.ringtonePath, tmpValue, MSG_FILEPATH_LEN_MAX); + free(tmpValue); + tmpValue = NULL; + } + + pSetting->option.generalOpt.alertTone = (MSG_ALERT_TONE_T)MsgSettingGetInt(MSG_ALERT_REP_TYPE); + + pSetting->option.generalOpt.searchTags = MsgSettingGetInt(MSG_SEARCH_TAGS); + } @@ -913,68 +998,11 @@ void MsgGetSMSSendOpt(MSG_SETTING_S *pSetting) void MsgGetSMSCList(MSG_SETTING_S *pSetting) { - char keyName[DEF_BUF_LEN] = {0, }; - char *tmpValue = NULL; + MSG_BEGIN(); - memset(&(pSetting->option.smscList), 0x00, sizeof(MSG_SMSC_LIST_S)); + MsgGetConfigInSim(pSetting); - pSetting->option.smscList.selected = MsgSettingGetInt(SMSC_SELECTED); - - pSetting->option.smscList.totalCnt = MsgSettingGetInt(SMSC_TOTAL_COUNT); - - for (int i = 0; i < pSetting->option.smscList.totalCnt; i++) - { - memset(keyName, 0x00, sizeof(keyName)); - snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_PID, i); - - pSetting->option.smscList.smscData[i].pid = (MSG_SMS_PID_T)MsgSettingGetInt(keyName); - -#ifdef __NOT_USED_BY_DESIGN_CHANGE__ - memset(keyName, 0x00, sizeof(keyName)); - snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_DCS, i); - - pSetting->option.smscList.smscData[i].dcs = (msg_encode_type_t)MsgSettingGetInt(keyName); -#endif /* __NOT_USED_BY_DESIGN_CHANGE__ */ - - memset(keyName, 0x00, sizeof(keyName)); - snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_VAL_PERIOD, i); - - pSetting->option.smscList.smscData[i].valPeriod = (MSG_VAL_PERIOD_T)MsgSettingGetInt(keyName); - - memset(keyName, 0x00, sizeof(keyName)); - snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_NAME, i); - - memset(pSetting->option.smscList.smscData[i].name, 0x00, SMSC_NAME_MAX+1); - - tmpValue = MsgSettingGetString(keyName); - if (tmpValue != NULL) { - strncpy(pSetting->option.smscList.smscData[i].name, tmpValue, SMSC_NAME_MAX); - free(tmpValue); - tmpValue = NULL; - } - - memset(keyName, 0x00, sizeof(keyName)); - snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_TON, i); - - pSetting->option.smscList.smscData[i].smscAddr.ton = (MSG_SMS_TON_T)MsgSettingGetInt(keyName); - - memset(keyName, 0x00, sizeof(keyName)); - snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_NPI, i); - - pSetting->option.smscList.smscData[i].smscAddr.npi = (MSG_SMS_NPI_T)MsgSettingGetInt(keyName); - - memset(keyName, 0x00, sizeof(keyName)); - snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_ADDRESS, i); - - memset(pSetting->option.smscList.smscData[i].smscAddr.address, 0x00, sizeof(pSetting->option.smscList.smscData[i].smscAddr.address)); - - tmpValue = MsgSettingGetString(keyName); - if (tmpValue != NULL) { - strncpy(pSetting->option.smscList.smscData[i].smscAddr.address, tmpValue, SMSC_ADDR_MAX); - free(tmpValue); - tmpValue = NULL; - } - } + MSG_END(); } @@ -1082,45 +1110,35 @@ void MsgGetPushMsgOpt(MSG_SETTING_S *pSetting) void MsgGetCBMsgOpt(MSG_SETTING_S *pSetting) { + msg_error_t err = MSG_SUCCESS; + char keyName[DEF_BUF_LEN] = {0, }; - char *tmpValue = NULL; + MsgDbHandler *dbHandle = getDbHandle(); + msg_sim_slot_id_t simIndex = pSetting->option.cbMsgOpt.simIndex; memset(&(pSetting->option.cbMsgOpt), 0x00, sizeof(MSG_CBMSG_OPT_S)); - MsgSettingGetBool(CB_RECEIVE, &pSetting->option.cbMsgOpt.bReceive); - - pSetting->option.cbMsgOpt.maxSimCnt = MsgSettingGetInt(CB_MAX_SIM_COUNT); + MSG_DEBUG("Sim index = [%d]", simIndex); - pSetting->option.cbMsgOpt.channelData.channelCnt = MsgSettingGetInt(CB_CHANNEL_COUNT); + /* Keep simIndex */ + pSetting->option.cbMsgOpt.simIndex = simIndex; - for (int i = 0; i < pSetting->option.cbMsgOpt.channelData.channelCnt; i++) - { - memset(keyName, 0x00, sizeof(keyName)); - snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_ACTIVATE, i); - - MsgSettingGetBool(keyName, &pSetting->option.cbMsgOpt.channelData.channelInfo[i].bActivate); - - memset(keyName, 0x00, sizeof(keyName)); - snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_ID_FROM, i); - pSetting->option.cbMsgOpt.channelData.channelInfo[i].from = MsgSettingGetInt(keyName); - MSG_DEBUG("channel[%d]: from: %d", i, pSetting->option.cbMsgOpt.channelData.channelInfo[i].from); +// memset(keyName, 0x00, sizeof(keyName)); +// snprintf(keyName, sizeof(keyName), "%s/%d", CB_RECEIVE, simIndex); + MsgSettingGetBool(CB_RECEIVE, &pSetting->option.cbMsgOpt.bReceive); - memset(keyName, 0x00, sizeof(keyName)); - snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_ID_TO, i); - pSetting->option.cbMsgOpt.channelData.channelInfo[i].to = MsgSettingGetInt(keyName); - MSG_DEBUG("channel[%d]: to: %d", i, pSetting->option.cbMsgOpt.channelData.channelInfo[i].to); + if (simIndex == 0) { + MSG_DEBUG("SIM Index = 0, bReceive is gotten"); + return; + } - memset(keyName, 0x00, sizeof(keyName)); - snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_NAME, i); + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, sizeof(keyName), "%s/%d", CB_MAX_SIM_COUNT, simIndex); + pSetting->option.cbMsgOpt.maxSimCnt = MsgSettingGetInt(keyName); - tmpValue = MsgSettingGetString(keyName); - if (tmpValue != NULL) { - strncpy(pSetting->option.cbMsgOpt.channelData.channelInfo[i].name, tmpValue, CB_CHANNEL_NAME_MAX); - MSG_DEBUG("channel[%d]: channel_name: %s", i, pSetting->option.cbMsgOpt.channelData.channelInfo[i].name); - free(tmpValue); - tmpValue = NULL; - } - } + err = MsgStoGetCBChannelInfo(dbHandle, &pSetting->option.cbMsgOpt.channelData, simIndex); + if (err != MSG_SUCCESS) + MSG_ERR("MsgStoGetCBChannelInfo : err=[%d]", err); for (int i = MSG_CBLANG_TYPE_ALL; i < MSG_CBLANG_TYPE_MAX; i++) { @@ -1131,15 +1149,34 @@ void MsgGetCBMsgOpt(MSG_SETTING_S *pSetting) } } + void MsgGetVoiceMailOpt(MSG_SETTING_S *pSetting) { char *tmpValue = NULL; + char keyName[DEF_BUF_LEN]; + msg_sim_slot_id_t simIndex; - memset(&(pSetting->option.voiceMailOpt), 0x00, sizeof(MSG_VOICEMAIL_OPT_S)); + simIndex = pSetting->option.voiceMailOpt.simIndex; + MSG_DEBUG("sim index = [%d]", simIndex); - tmpValue = MsgSettingGetString(VOICEMAIL_NUMBER); + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, simIndex); + tmpValue = MsgSettingGetString(keyName); + memset(pSetting->option.voiceMailOpt.mailNumber, 0x00, sizeof(pSetting->option.voiceMailOpt.mailNumber)); if (tmpValue != NULL) { strncpy(pSetting->option.voiceMailOpt.mailNumber, tmpValue, MAX_PHONE_NUMBER_LEN); + MSG_DEBUG("Voicemail number = [%s]", pSetting->option.voiceMailOpt.mailNumber); + free(tmpValue); + tmpValue = NULL; + } + + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_ALPHA_ID, simIndex); + tmpValue = MsgSettingGetString(keyName); + memset(pSetting->option.voiceMailOpt.alpahId, 0x00, sizeof(pSetting->option.voiceMailOpt.alpahId)); + if (tmpValue != NULL) { + strncpy(pSetting->option.voiceMailOpt.alpahId, tmpValue, MAX_SIM_XDN_ALPHA_ID_LEN); + MSG_DEBUG("Voicemail alpha ID = [%s]", pSetting->option.voiceMailOpt.alpahId); free(tmpValue); tmpValue = NULL; } @@ -1175,253 +1212,24 @@ msg_error_t MsgSetConfigInSim(const MSG_SETTING_S *pSetting) return err; } -#ifdef __NOT_USED_BY_ENV_CHANGE__ -void MsgSetDefaultConfig() -{ - bool bTmp = false; - char keyName[128]; - - // Set Default General SendOpt - if (MsgSettingGetBool(MSG_KEEP_COPY, &bTmp) < 0) - MsgSettingSetBool(MSG_KEEP_COPY, true); - - if (MsgSettingGetInt(MSG_ALERT_TONE) < 0) - MsgSettingSetInt(MSG_ALERT_TONE, (int)MSG_ALERT_TONE_ONCE); - - if (MsgSettingGetBool(MSG_AUTO_ERASE, &bTmp) < 0) - MsgSettingGetBool(MSG_AUTO_ERASE, false); - - // Set Default SMS SendOpt - if (MsgSettingGetInt(SMS_SEND_DCS) < 0) - MsgSettingSetInt(SMS_SEND_DCS, (int)MSG_ENCODE_AUTO); - - if (MsgSettingGetInt(SMS_SEND_NETWORK_MODE) < 0) - MsgSettingSetInt(SMS_SEND_NETWORK_MODE, (int)MSG_SMS_NETWORK_CS_ONLY); - - if (MsgSettingGetBool(SMS_SEND_REPLY_PATH, &bTmp) < 0) - MsgSettingSetBool(SMS_SEND_REPLY_PATH, false); - - if (MsgSettingGetBool(SMS_SEND_DELIVERY_REPORT, &bTmp) < 0) - MsgSettingSetBool(SMS_SEND_DELIVERY_REPORT, false); - - if (MsgSettingGetInt(SMS_SEND_SAVE_STORAGE) < 0) - MsgSettingSetInt(SMS_SEND_SAVE_STORAGE, (int)MSG_SMS_SAVE_STORAGE_PHONE); - - // Set Default SMSC List - if (MsgSettingGetInt(SMSC_SELECTED) < 0) - MsgSettingSetInt(SMSC_SELECTED, 0); - if (MsgSettingGetInt(SMSC_TOTAL_COUNT) < 0) - MsgSettingSetInt(SMSC_TOTAL_COUNT, 1); - - memset(keyName, 0x00, sizeof(keyName)); - sprintf(keyName, "%s/%d", SMSC_PID, 0); - - if (MsgSettingGetInt(keyName) < 0) - MsgSettingSetInt(keyName, (int)MSG_PID_TEXT); - - memset(keyName, 0x00, sizeof(keyName)); - sprintf(keyName, "%s/%d", SMSC_VAL_PERIOD, MSG_VAL_MAXIMUM); - - if (MsgSettingGetInt(keyName) < 0) - MsgSettingSetInt(keyName, 0); - - memset(keyName, 0x00, sizeof(keyName)); - sprintf(keyName, "%s/%d", SMSC_NAME, 0); - - char *smscName = NULL; - - smscName = MsgSettingGetString(keyName); - - if (smscName == NULL) { - MsgSettingSetString(keyName, (char*)"SMS Centre 1"); - } else { - free(smscName); - smscName = NULL; - } - - memset(keyName, 0x00, sizeof(keyName)); - sprintf(keyName, "%s/%d", SMSC_TON, 0); - - if (MsgSettingGetInt(keyName) < 0) - MsgSettingSetInt(keyName, (int)MSG_TON_INTERNATIONAL); - - memset(keyName, 0x00, sizeof(keyName)); - sprintf(keyName, "%s/%d", SMSC_NPI, 0); - - if (MsgSettingGetInt(keyName) < 0) - MsgSettingSetInt(keyName, (int)MSG_NPI_ISDN); - - memset(keyName, 0x00, sizeof(keyName)); - sprintf(keyName, "%s/%d", SMSC_ADDRESS, 0); - - char *smscAddress = NULL; - - smscAddress = MsgSettingGetString(keyName); - - if (smscAddress == NULL) { - MsgSettingSetString(keyName, (char*)"8210911111"); - } else { - free(smscAddress); - smscAddress = NULL; - } - - // Set Default MMS Send Opt - if (MsgSettingGetInt(MMS_SEND_MSG_CLASS) < 0) - MsgSettingSetInt(MMS_SEND_MSG_CLASS, (int)MSG_CLASS_AUTO); - - if (MsgSettingGetInt(MMS_SEND_PRIORITY) < 0) - MsgSettingSetInt(MMS_SEND_PRIORITY, (int)MSG_MESSAGE_PRIORITY_NORMAL); - - if (MsgSettingGetInt(MMS_SEND_EXPIRY_TIME) < 0) - MsgSettingSetInt(MMS_SEND_EXPIRY_TIME, 86400); - - if (MsgSettingGetInt(MMS_SEND_DELIVERY_TIME) < 0) - MsgSettingSetInt(MMS_SEND_DELIVERY_TIME, 0); - - if (MsgSettingGetInt(MMS_SEND_CUSTOM_DELIVERY) < 0) - MsgSettingSetInt(MMS_SEND_CUSTOM_DELIVERY, 0); - - if (MsgSettingGetBool(MMS_SEND_SENDER_VISIBILITY, &bTmp) < 0) - MsgSettingSetBool(MMS_SEND_SENDER_VISIBILITY, false); - - if (MsgSettingGetBool(MMS_SEND_DELIVERY_REPORT, &bTmp) < 0) - MsgSettingSetBool(MMS_SEND_DELIVERY_REPORT, true); - - if (MsgSettingGetBool(MMS_SEND_READ_REPLY, &bTmp) < 0) - MsgSettingSetBool(MMS_SEND_READ_REPLY, false); - - if (MsgSettingGetBool(MMS_SEND_KEEP_COPY, &bTmp) < 0) - MsgSettingSetBool(MMS_SEND_KEEP_COPY, false); - - if (MsgSettingGetBool(MMS_SEND_BODY_REPLYING, &bTmp) < 0) - MsgSettingSetBool(MMS_SEND_BODY_REPLYING, false); - - if (MsgSettingGetBool(MMS_SEND_HIDE_RECIPIENTS, &bTmp) < 0) - MsgSettingSetBool(MMS_SEND_HIDE_RECIPIENTS, false); - - if (MsgSettingGetInt(MMS_SEND_REPLY_CHARGING) < 0) - MsgSettingSetInt(MMS_SEND_REPLY_CHARGING, (int)MSG_REPLY_CHARGING_NONE); - - if (MsgSettingGetInt(MMS_SEND_REPLY_CHARGING_DEADLINE) < 0) - MsgSettingSetInt(MMS_SEND_REPLY_CHARGING_DEADLINE, 0); - - if (MsgSettingGetInt(MMS_SEND_REPLY_CHARGING_SIZE) < 0) - MsgSettingSetInt(MMS_SEND_REPLY_CHARGING_SIZE, 0); - - // Set Default MMS Recv Opt - if (MsgSettingGetInt(MMS_RECV_HOME_NETWORK) < 0) - MsgSettingSetInt(MMS_RECV_HOME_NETWORK, (int)MSG_HOME_AUTO_DOWNLOAD); - - if (MsgSettingGetInt(MMS_RECV_ABROAD_NETWORK) < 0) - MsgSettingSetInt(MMS_RECV_ABROAD_NETWORK, (int)MSG_ABROAD_RESTRICTED); - - if (MsgSettingGetInt(MMS_RECV_READ_RECEIPT) < 0) - MsgSettingSetInt(MMS_RECV_READ_RECEIPT, (int)MSG_SEND_READ_REPORT_NEVER); - - if (MsgSettingGetBool(MMS_RECV_DELIVERY_RECEIPT, &bTmp) < 0) - MsgSettingSetBool(MMS_RECV_DELIVERY_RECEIPT, true); - - if (MsgSettingGetBool(MMS_RECV_REJECT_UNKNOWN, &bTmp) < 0) - MsgSettingSetBool(MMS_RECV_REJECT_UNKNOWN, false); - - if (MsgSettingGetBool(MMS_RECV_REJECT_ADVERTISE, &bTmp) < 0) - MsgSettingSetBool(MMS_RECV_REJECT_ADVERTISE, false); - - // Set Default MMS Style Opt - if (MsgSettingGetInt(MMS_STYLE_FONT_SIZE) < 0) - MsgSettingSetInt(MMS_STYLE_FONT_SIZE, 30); - - if (MsgSettingGetInt(MMS_STYLE_FONT_STYLE) < 0) - MsgSettingSetInt(MMS_STYLE_FONT_STYLE, 0); - - if (MsgSettingGetInt(MMS_STYLE_FONT_COLOR_RED) < 0) - MsgSettingSetInt(MMS_STYLE_FONT_COLOR_RED, 0); - - if (MsgSettingGetInt(MMS_STYLE_FONT_COLOR_GREEN) < 0) - MsgSettingSetInt(MMS_STYLE_FONT_COLOR_GREEN, 0); - - if (MsgSettingGetInt(MMS_STYLE_FONT_COLOR_BLUE) < 0) - MsgSettingSetInt(MMS_STYLE_FONT_COLOR_BLUE, 0); - - if (MsgSettingGetInt(MMS_STYLE_FONT_COLOR_HUE) < 0) - MsgSettingSetInt(MMS_STYLE_FONT_COLOR_HUE, 255); - - if (MsgSettingGetInt(MMS_STYLE_BG_COLOR_RED) < 0) - MsgSettingSetInt(MMS_STYLE_BG_COLOR_RED, 255); - - if (MsgSettingGetInt(MMS_STYLE_BG_COLOR_GREEN) < 0) - MsgSettingSetInt(MMS_STYLE_BG_COLOR_GREEN, 255); - - if (MsgSettingGetInt(MMS_STYLE_BG_COLOR_BLUE) < 0) - MsgSettingSetInt(MMS_STYLE_BG_COLOR_BLUE, 255); - - if (MsgSettingGetInt(MMS_STYLE_BG_COLOR_HUE) < 0) - MsgSettingSetInt(MMS_STYLE_FONT_COLOR_HUE, 255); - - if (MsgSettingGetInt(MMS_STYLE_PAGE_DUR) < 0) - MsgSettingSetInt(MMS_STYLE_PAGE_DUR, 2); - - if (MsgSettingGetInt(MMS_STYLE_PAGE_CUSTOM_DUR) < 0) - MsgSettingSetInt(MMS_STYLE_PAGE_CUSTOM_DUR, 0); - - if (MsgSettingGetInt(MMS_STYLE_PAGE_DUR_MANUAL) < 0) - MsgSettingSetInt(MMS_STYLE_PAGE_DUR_MANUAL, 0); - - // Set Default Push Msg Opt - if (MsgSettingGetBool(PUSH_RECV_OPTION, &bTmp) < 0) - MsgSettingSetBool(PUSH_RECV_OPTION, false); - - if (MsgSettingGetInt(PUSH_SERVICE_TYPE) < 0) - MsgSettingSetInt(PUSH_SERVICE_TYPE, (int)MSG_PUSH_SERVICE_PROMPT); - - // Set Default Cb Msg Opt - if (MsgSettingGetBool(CB_RECEIVE, &bTmp) < 0) - MsgSettingSetBool(CB_RECEIVE, false); - - if (MsgSettingGetBool(CB_ALL_CHANNEL, &bTmp) < 0) - MsgSettingSetBool(CB_ALL_CHANNEL, false); +msg_error_t MsgGetConfigInSim(MSG_SETTING_S *pSetting) +{ + msg_error_t err = MSG_SUCCESS; - if (MsgSettingGetInt(CB_MAX_SIM_COUNT) < 0) - MsgSettingSetInt(CB_MAX_SIM_COUNT, 0); + MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE); - if (MsgSettingGetInt(CB_CHANNEL_COUNT) < 0) - MsgSettingSetInt(CB_CHANNEL_COUNT, 0); + // Get Setting Data from SIM + if (plg != NULL) + err = plg->getConfigData(pSetting); + else + err = MSG_ERR_NULL_POINTER; - for (int i = MSG_CBLANG_TYPE_ALL; i < MSG_CBLANG_TYPE_MAX; i++) + if (err != MSG_SUCCESS) { - memset(keyName, 0x00, sizeof(keyName)); - sprintf(keyName, "%s/%d", CB_LANGUAGE, i); - - if (MsgSettingGetBool(keyName, &bTmp) < 0) - MsgSettingSetBool(keyName, false); - } - - // Set Default SOS Msg Opt - if (MsgSettingGetBool(SOS_SEND_OPTION, &bTmp) < 0) - MsgSettingSetBool(SOS_SEND_OPTION, false); - - if (MsgSettingGetInt(SOS_RECIPIENT_COUNT) < 0) - MsgSettingSetInt(SOS_RECIPIENT_COUNT, 0); - - if (MsgSettingGetInt(SOS_REPEAT_COUNT) < 0) - MsgSettingSetInt(SOS_REPEAT_COUNT, (int)MSG_SOS_REPEAT_ONCE); - - char *tmpValue = NULL; - - tmpValue = MsgSettingGetString(keyName); - - if (tmpValue == NULL) { - MsgSettingSetString(keyName, NULL); - } else { - free(tmpValue); - tmpValue = NULL; + MSG_DEBUG("Error. Error code is %d.", err); + return err; } - if (MsgSettingGetInt(SOS_ALERT_TYPE) < 0) - MsgSettingSetInt(SOS_ALERT_TYPE, (int)MSG_SOS_ALERT_TYPE_SOS); - - if (MsgSettingGetInt(MSGSIZE_OPTION) < 0) - MsgSettingSetInt(MSGSIZE_OPTION, 300); + return err; } -#endif /* __NOT_USED_BY_ENV_CHANGE__ */ \ No newline at end of file diff --git a/framework/storage-handler/MsgStorageFilter.cpp b/framework/storage-handler/MsgStorageFilter.cpp index e38676a..eb72217 100755 --- a/framework/storage-handler/MsgStorageFilter.cpp +++ b/framework/storage-handler/MsgStorageFilter.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include "MsgDebug.h" @@ -22,7 +22,6 @@ /*================================================================================================== VARIABLES ==================================================================================================*/ -extern MsgDbHandler dbHandle; /*================================================================================================== @@ -31,7 +30,7 @@ extern MsgDbHandler dbHandle; msg_error_t MsgStoCheckDuplicatedFilter(const MSG_FILTER_S *pFilter) { MSG_BEGIN(); - + MsgDbHandler *dbHandle = getDbHandle(); msg_error_t err = MSG_SUCCESS; char *filterStr = NULL; @@ -45,16 +44,16 @@ msg_error_t MsgStoCheckDuplicatedFilter(const MSG_FILTER_S *pFilter) MSG_DEBUG("sql : %s", sqlQuery); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { - if (filterStr) - free(filterStr); + if (filterStr) + free(filterStr); return MSG_ERR_DB_EXEC; } - dbHandle.bindText(filterStr, 1); + dbHandle->bindText(filterStr, 1); - err = dbHandle.stepQuery(); + err = dbHandle->stepQuery(); if (err == MSG_ERR_DB_ROW) { err = MSG_ERR_FILTER_DUPLICATED; @@ -62,7 +61,7 @@ msg_error_t MsgStoCheckDuplicatedFilter(const MSG_FILTER_S *pFilter) err = MSG_SUCCESS; } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); if (filterStr) free(filterStr); @@ -76,7 +75,7 @@ msg_error_t MsgStoCheckDuplicatedFilter(const MSG_FILTER_S *pFilter) msg_error_t MsgStoAddFilter(const MSG_FILTER_S *pFilter) { MSG_BEGIN(); - + MsgDbHandler *dbHandle = getDbHandle(); msg_error_t err = MSG_SUCCESS; //check duplication @@ -91,7 +90,7 @@ msg_error_t MsgStoAddFilter(const MSG_FILTER_S *pFilter) char sqlQuery[MAX_QUERY_LEN+1]; - err = dbHandle.getRowId(MSGFW_FILTER_TABLE_NAME, &rowId); + err = dbHandle->getRowId(MSGFW_FILTER_TABLE_NAME, &rowId); if (err != MSG_SUCCESS) return err; @@ -104,17 +103,17 @@ msg_error_t MsgStoAddFilter(const MSG_FILTER_S *pFilter) MSG_DEBUG("sql : %s", sqlQuery); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_EXEC; - dbHandle.bindText(pFilter->filterValue, 1); + dbHandle->bindText(pFilter->filterValue, 1); - if (dbHandle.stepQuery() != MSG_ERR_DB_DONE) { - dbHandle.finalizeQuery(); + if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) { + dbHandle->finalizeQuery(); return MSG_ERR_DB_EXEC; } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); MSG_END(); @@ -125,7 +124,7 @@ msg_error_t MsgStoAddFilter(const MSG_FILTER_S *pFilter) msg_error_t MsgStoUpdateFilter(const MSG_FILTER_S *pFilter) { MSG_BEGIN(); - + MsgDbHandler *dbHandle = getDbHandle(); msg_error_t err = MSG_SUCCESS; //check duplication @@ -144,17 +143,17 @@ msg_error_t MsgStoUpdateFilter(const MSG_FILTER_S *pFilter) snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET FILTER_TYPE = %d, FILTER_VALUE = ? WHERE FILTER_ID = %d;", MSGFW_FILTER_TABLE_NAME, pFilter->filterType, pFilter->filterId); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_PREPARE; - dbHandle.bindText(pFilter->filterValue, 1); + dbHandle->bindText(pFilter->filterValue, 1); - if (dbHandle.stepQuery() != MSG_ERR_DB_DONE) { - dbHandle.finalizeQuery(); + if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) { + dbHandle->finalizeQuery(); return MSG_ERR_DB_EXEC; } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); MSG_END(); @@ -167,20 +166,20 @@ msg_error_t MsgStoDeleteFilter(msg_filter_id_t filterId) MSG_BEGIN(); char sqlQuery[MAX_QUERY_LEN+1]; - - dbHandle.beginTrans(); + MsgDbHandler *dbHandle = getDbHandle(); + dbHandle->beginTrans(); memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE FILTER_ID = %d;", MSGFW_FILTER_TABLE_NAME, filterId); // Delete Filter - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } - dbHandle.endTrans(true); + dbHandle->endTrans(true); MSG_END(); @@ -196,7 +195,7 @@ msg_error_t MsgStoGetFilterList(msg_struct_list_s *pFilterList) MSG_DEBUG("pFilterList is NULL"); return MSG_ERR_NULL_POINTER; } - + MsgDbHandler *dbHandle = getDbHandle(); int rowCnt = 0, index = 4; char sqlQuery[MAX_QUERY_LEN+1]; @@ -208,17 +207,17 @@ msg_error_t MsgStoGetFilterList(msg_struct_list_s *pFilterList) msg_error_t err = MSG_SUCCESS; - err = dbHandle.getTable(sqlQuery, &rowCnt); + err = dbHandle->getTable(sqlQuery, &rowCnt); if (err == MSG_ERR_DB_NORECORD) { pFilterList->nCount = 0; pFilterList->msg_struct_info = NULL; - dbHandle.freeTable(); + dbHandle->freeTable(); return MSG_SUCCESS; } else if (err != MSG_SUCCESS) { - dbHandle.freeTable(); + dbHandle->freeTable(); return err; } @@ -239,15 +238,15 @@ msg_error_t MsgStoGetFilterList(msg_struct_list_s *pFilterList) pTmp->data = new char [sizeof(MSG_FILTER_S)]; MSG_FILTER_S *pFilter = (MSG_FILTER_S *)pTmp->data; memset(pFilter, 0x00, sizeof(MSG_FILTER_S)); - pFilter->filterId = dbHandle.getColumnToInt(index++); - pFilter->filterType = dbHandle.getColumnToInt(index++); + pFilter->filterId = dbHandle->getColumnToInt(index++); + pFilter->filterType = dbHandle->getColumnToInt(index++); memset(pFilter->filterValue, 0x00, sizeof(pFilter->filterValue)); - dbHandle.getColumnToString(index++, MAX_FILTER_VALUE_LEN, pFilter->filterValue); - pFilter->bActive = dbHandle.getColumnToInt(index++); + dbHandle->getColumnToString(index++, MAX_FILTER_VALUE_LEN, pFilter->filterValue); + pFilter->bActive = dbHandle->getColumnToInt(index++); } - dbHandle.freeTable(); + dbHandle->freeTable(); MSG_END(); @@ -258,7 +257,7 @@ msg_error_t MsgStoGetFilterList(msg_struct_list_s *pFilterList) msg_error_t MsgStoSetFilterActivation(msg_filter_id_t filterId, bool bActive) { MSG_BEGIN(); - + MsgDbHandler *dbHandle = getDbHandle(); char sqlQuery[MAX_QUERY_LEN+1]; // Set Filter Activation @@ -269,7 +268,7 @@ msg_error_t MsgStoSetFilterActivation(msg_filter_id_t filterId, bool bActive) MSG_DEBUG("sqlQuery [%s]", sqlQuery); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { return MSG_ERR_DB_EXEC; } diff --git a/framework/storage-handler/MsgStorageFolder.cpp b/framework/storage-handler/MsgStorageFolder.cpp index 3cd2368..3013f4a 100755 --- a/framework/storage-handler/MsgStorageFolder.cpp +++ b/framework/storage-handler/MsgStorageFolder.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include "MsgDebug.h" @@ -23,8 +23,6 @@ /*================================================================================================== VARIABLES ==================================================================================================*/ -extern MsgDbHandler dbHandle; - /*================================================================================================== FUNCTION IMPLEMENTATION @@ -32,12 +30,12 @@ extern MsgDbHandler dbHandle; msg_error_t MsgStoAddFolder(const MSG_FOLDER_INFO_S *pFolderInfo) { msg_error_t err = MSG_SUCCESS; - + MsgDbHandler *dbHandle = getDbHandle(); unsigned int rowId = 0; char sqlQuery[MAX_QUERY_LEN+1]; - err = dbHandle.getRowId(MSGFW_FOLDER_TABLE_NAME, &rowId); + err = dbHandle->getRowId(MSGFW_FOLDER_TABLE_NAME, &rowId); if (err != MSG_SUCCESS) return err; @@ -47,7 +45,7 @@ msg_error_t MsgStoAddFolder(const MSG_FOLDER_INFO_S *pFolderInfo) snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, '%s', %d);", MSGFW_FOLDER_TABLE_NAME, rowId, pFolderInfo->folderName, pFolderInfo->folderType); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_EXEC; return MSG_SUCCESS; @@ -57,13 +55,13 @@ msg_error_t MsgStoAddFolder(const MSG_FOLDER_INFO_S *pFolderInfo) msg_error_t MsgStoUpdateFolder(const MSG_FOLDER_INFO_S *pFolderInfo) { char sqlQuery[MAX_QUERY_LEN+1]; - + MsgDbHandler *dbHandle = getDbHandle(); // Update Folder memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET FOLDER_NAME = '%s', FOLDER_TYPE = %d WHERE FOLDER_ID = %d;", MSGFW_FOLDER_TABLE_NAME, pFolderInfo->folderName, pFolderInfo->folderType, pFolderInfo->folderId); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_EXEC; return MSG_SUCCESS; @@ -73,16 +71,16 @@ msg_error_t MsgStoUpdateFolder(const MSG_FOLDER_INFO_S *pFolderInfo) msg_error_t MsgStoDeleteFolder(const msg_folder_id_t folderId) { char sqlQuery[MAX_QUERY_LEN+1]; - - dbHandle.beginTrans(); + MsgDbHandler *dbHandle = getDbHandle(); + dbHandle->beginTrans(); memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE FOLDER_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, folderId); // Delete Message in the folder from msg table - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } @@ -91,18 +89,18 @@ msg_error_t MsgStoDeleteFolder(const msg_folder_id_t folderId) MSGFW_FOLDER_TABLE_NAME, folderId); // Delete Message in the folder from msg table - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } // Clear Conversation table - if (MsgStoClearConversationTable(&dbHandle) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (MsgStoClearConversationTable(dbHandle) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } - dbHandle.endTrans(true); + dbHandle->endTrans(true); return MSG_SUCCESS; } @@ -114,7 +112,7 @@ msg_error_t MsgStoGetFolderList(msg_struct_list_s *pFolderList) MSG_DEBUG("pFolderList is NULL"); return MSG_ERR_NULL_POINTER; } - + MsgDbHandler *dbHandle = getDbHandle(); int rowCnt = 0; int index = 3; @@ -124,8 +122,8 @@ msg_error_t MsgStoGetFolderList(msg_struct_list_s *pFolderList) snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FOLDER_ID, FOLDER_TYPE, FOLDER_NAME FROM %s;", MSGFW_FOLDER_TABLE_NAME); - if (dbHandle.getTable(sqlQuery, &rowCnt) != MSG_SUCCESS) { - dbHandle.freeTable(); + if (dbHandle->getTable(sqlQuery, &rowCnt) != MSG_SUCCESS) { + dbHandle->freeTable(); return MSG_ERR_DB_GETTABLE; } @@ -146,16 +144,16 @@ msg_error_t MsgStoGetFolderList(msg_struct_list_s *pFolderList) MSG_FOLDER_INFO_S * pFolder = (MSG_FOLDER_INFO_S *)pTmp->data; memset(pFolder, 0x00, sizeof(MSG_FOLDER_INFO_S)); - pFolder->folderId = dbHandle.getColumnToInt(index++); + pFolder->folderId = dbHandle->getColumnToInt(index++); - pFolder->folderType = dbHandle.getColumnToInt(index++); + pFolder->folderType = dbHandle->getColumnToInt(index++); memset(pFolder->folderName, 0x00, sizeof(pFolder->folderName)); - dbHandle.getColumnToString(index++, MAX_FOLDER_NAME_SIZE, pFolder->folderName); + dbHandle->getColumnToString(index++, MAX_FOLDER_NAME_SIZE, pFolder->folderName); } - dbHandle.freeTable(); + dbHandle->freeTable(); return MSG_SUCCESS; } diff --git a/framework/storage-handler/MsgStorageManager.cpp b/framework/storage-handler/MsgStorageManager.cpp index 72d4c83..462724d 100755 --- a/framework/storage-handler/MsgStorageManager.cpp +++ b/framework/storage-handler/MsgStorageManager.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include @@ -19,6 +19,8 @@ #include #include #include +#include +#include #include #include @@ -33,11 +35,11 @@ #include "MsgStorageHandler.h" +#define MSG_DB_VERSION 1 + /*================================================================================================== VARIABLES ==================================================================================================*/ -MsgDbHandler dbHandle; - /*================================================================================================== FUNCTION IMPLEMENTATION @@ -50,7 +52,8 @@ msg_error_t MsgStoConnectDB() msg_error_t MsgStoDisconnectDB() { - if (dbHandle.disconnect() != MSG_SUCCESS) { + MsgDbHandler *dbHandle = getDbHandle(); + if (dbHandle->disconnect() != MSG_SUCCESS) { MSG_DEBUG("DB Disconnect Fail"); return MSG_ERR_DB_DISCONNECT; } @@ -61,444 +64,174 @@ msg_error_t MsgStoDisconnectDB() } -msg_error_t MsgStoInitDB(bool bSimChanged) +void MsgUpdateDBtoVer1() { - MSG_BEGIN(); - + MsgDbHandler *dbHandle = getDbHandle(); msg_error_t err = MSG_SUCCESS; - -#ifdef MSG_DB_CREATE - if (MsgCreateConversationTable() != MSG_SUCCESS) - return MSG_ERR_DB_STORAGE_INIT; - if (MsgCreateAddressTable() != MSG_SUCCESS) - return MSG_ERR_DB_STORAGE_INIT; - if (MsgCreateFolderTable() != MSG_SUCCESS) - return MSG_ERR_DB_STORAGE_INIT; - if (MsgCreateMsgTable() != MSG_SUCCESS) - return MSG_ERR_DB_STORAGE_INIT; - if (MsgCreateSimMessageTable() != MSG_SUCCESS) - return MSG_ERR_DB_STORAGE_INIT; - if (MsgCreateWAPMessageTable() != MSG_SUCCESS) - return MSG_ERR_DB_STORAGE_INIT; - if (MsgCreateCBMessageTable() != MSG_SUCCESS) - return MSG_ERR_DB_STORAGE_INIT; - if (MsgCreateSyncMLMessageTable() != MSG_SUCCESS) - return MSG_ERR_DB_STORAGE_INIT; - if (MsgCreateSmsSendOptTable() != MSG_SUCCESS) - return MSG_ERR_DB_STORAGE_INIT; - if (MsgCreateFilterTable() != MSG_SUCCESS) - return MSG_ERR_DB_STORAGE_INIT; - if (MsgCreateMmsTable() != MSG_SUCCESS) - return MSG_ERR_DB_STORAGE_INIT; - - // Add Default Folders - if (MsgAddDefaultFolders() != MSG_SUCCESS) { - MSG_DEBUG("Add Default Folders Fail"); - return MSG_ERR_DB_STORAGE_INIT; - } - - // Add Default Address - if (MsgAddDefaultAddress() != MSG_SUCCESS) { - MSG_DEBUG("Add Default Address Fail"); - return MSG_ERR_DB_STORAGE_INIT; - } -#endif - - // Delete Msgs in Hidden Folder - MsgStoDeleteAllMessageInFolder(0, true, NULL); - - // Reset network status - MsgStoResetNetworkStatus(); - - //clear abnormal mms message - MsgStoCleanAbnormalMmsData(); - - // Clear all old Sim data - MsgStoClearSimMessageInDB(); - - int smsCnt = 0, mmsCnt = 0; - - smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE); - mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE); - - // Set Indicator - MsgSettingSetIndicator(smsCnt, mmsCnt); - - MSG_END(); - - return err; -} - - -msg_error_t MsgCreateConversationTable() -{ - msg_error_t err = MSG_SUCCESS; - char sqlQuery[MAX_QUERY_LEN+1]; - if (!dbHandle.checkTableExist(MSGFW_ADDRESS_TABLE_NAME)) { + if (!dbHandle->checkTableExist(MSGFW_MMS_MULTIPART_TABLE_NAME)) { memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), - "CREATE TABLE %s ( \ - CONV_ID INTEGER NOT NULL , \ - UNREAD_CNT INTEGER DEFAULT 0 , \ - SMS_CNT INTEGER DEFAULT 0 , \ - MMS_CNT INTEGER DEFAULT 0 , \ - MAIN_TYPE INTEGER NOT NULL , \ - SUB_TYPE INTEGER NOT NULL , \ - MSG_DIRECTION INTEGER NOT NULL , \ - DISPLAY_TIME INTEGER , \ - DISPLAY_NAME TEXT , \ - MSG_TEXT TEXT );", - MSGFW_CONVERSATION_TABLE_NAME); - - err = dbHandle.execQuery(sqlQuery); + "CREATE TABLE %s ( " + "_ID INTEGER PRIMARY KEY AUTOINCREMENT, " + "MSG_ID INTEGER NOT NULL , " + "SEQ INTEGER DEFAULT 0, " + "CONTENT_TYPE TEXT, " + "NAME TEXT, " + "CHARSET INTEGER, " + "CONTENT_ID TEXT, " + "CONTENT_LOCATION TEXT, " + "FILE_PATH TEXT, " + "TEXT TEXT, " + "TCS_LEVEL INTEGER DEFAULT -1, " + "MALWARE_ALLOW INTEGER DEFAULT 0, " + "THUMB_FILE_PATH TEXT, " + "FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID));", + MSGFW_MMS_MULTIPART_TABLE_NAME); + + err = dbHandle->execQuery(sqlQuery); if (err == MSG_SUCCESS) - MSG_DEBUG("SUCCESS : create %s.", MSGFW_CONVERSATION_TABLE_NAME); + MSG_SEC_DEBUG("SUCCESS : create %s.", MSGFW_MMS_MULTIPART_TABLE_NAME); else - MSG_DEBUG("FAIL : create %s [%d].", MSGFW_CONVERSATION_TABLE_NAME, err); + MSG_SEC_DEBUG("FAIL : create %s [%d].", MSGFW_MMS_MULTIPART_TABLE_NAME, err); } - - return err; } -msg_error_t MsgCreateAddressTable() +void MsgStoUpdateDBVersion() { - msg_error_t err = MSG_SUCCESS; - + MsgDbHandler *dbHandle = getDbHandle(); char sqlQuery[MAX_QUERY_LEN+1]; - if (!dbHandle.checkTableExist(MSGFW_ADDRESS_TABLE_NAME)) { - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - - snprintf(sqlQuery, sizeof(sqlQuery), - "CREATE TABLE %s ( \ - ADDRESS_ID INTEGER PRIMARY KEY , \ - CONV_ID INTEGER NOT NULL , \ - ADDRESS_TYPE INTEGER , \ - RECIPIENT_TYPE INTEGER , \ - ADDRESS_VAL TEXT , \ - CONTACT_ID INTEGER , \ - DISPLAY_NAME TEXT , \ - FIRST_NAME TEXT , \ - LAST_NAME TEXT , \ - IMAGE_PATH TEXT , \ - SYNC_TIME DATETIME , \ - FOREIGN KEY(CONV_ID) REFERENCES %s (CONV_ID) );", - MSGFW_ADDRESS_TABLE_NAME, MSGFW_CONVERSATION_TABLE_NAME); - - err = dbHandle.execQuery(sqlQuery); + snprintf(sqlQuery, sizeof(sqlQuery), "PRAGMA user_version=%d;", MSG_DB_VERSION); - if (err == MSG_SUCCESS) - MSG_DEBUG("SUCCESS : create %s.", MSGFW_ADDRESS_TABLE_NAME); - else - MSG_DEBUG("FAIL : create %s [%d].", MSGFW_ADDRESS_TABLE_NAME, err); + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + MSG_DEBUG("Fail to prepareQuery."); + return; } - return err; -} - - -msg_error_t MsgCreateFolderTable() -{ - msg_error_t err = MSG_SUCCESS; - - char sqlQuery[MAX_QUERY_LEN+1]; - - if (!dbHandle.checkTableExist(MSGFW_FOLDER_TABLE_NAME)) { - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - - snprintf(sqlQuery, sizeof(sqlQuery), - "CREATE TABLE %s ( \ - FOLDER_ID INTEGER PRIMARY KEY, \ - FOLDER_NAME TEXT NOT NULL, \ - FOLDER_TYPE INTEGER DEFAULT 0 );", - MSGFW_FOLDER_TABLE_NAME); - - err = dbHandle.execQuery(sqlQuery); - - if (err == MSG_SUCCESS) - MSG_DEBUG("SUCCESS : create %s.", MSGFW_FOLDER_TABLE_NAME); - else - MSG_DEBUG("FAIL : create %s [%d].", MSGFW_FOLDER_TABLE_NAME, err); + if (dbHandle->stepQuery() == MSG_ERR_DB_STEP) { + MSG_DEBUG("Fail to stepQuery."); + return; } - return err; + dbHandle->finalizeQuery(); } - -msg_error_t MsgCreateMsgTable() +msg_error_t MsgStoDBVerCheck() { - msg_error_t err = MSG_SUCCESS; + MsgDbHandler *dbHandle = getDbHandle(); + int dbVersion = 0; char sqlQuery[MAX_QUERY_LEN+1]; - if (!dbHandle.checkTableExist(MSGFW_MESSAGE_TABLE_NAME)) { - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - - snprintf(sqlQuery, sizeof(sqlQuery), - "CREATE TABLE %s ( \ - MSG_ID INTEGER PRIMARY KEY , \ - CONV_ID INTEGER NOT NULL , \ - FOLDER_ID INTEGER NOT NULL , \ - STORAGE_ID INTEGER NOT NULL , \ - MAIN_TYPE INTEGER NOT NULL , \ - SUB_TYPE INTEGER NOT NULL , \ - DISPLAY_TIME DATETIME , \ - DATA_SIZE INTEGER DEFAULT 0 , \ - NETWORK_STATUS INTEGER DEFAULT 0 , \ - READ_STATUS INTEGER DEFAULT 0 , \ - PROTECTED INTEGER DEFAULT 0 , \ - PRIORITY INTEGER DEFAULT 0 , \ - MSG_DIRECTION INTEGER NOT NULL , \ - SCHEDULED_TIME DATETIME , \ - BACKUP INTEGER DEFAULT 0 , \ - SUBJECT TEXT , \ - MSG_DATA TEXT , \ - THUMB_PATH TEXT , \ - MSG_TEXT TEXT , \ - ATTACHMENT_COUNT INTEGER DEFAULT 0 , \ - FOREIGN KEY(CONV_ID) REFERENCES %s (CONV_ID) , \ - FOREIGN KEY(FOLDER_ID) REFERENCES %s (FOLDER_ID) );", - MSGFW_MESSAGE_TABLE_NAME, MSGFW_CONVERSATION_TABLE_NAME, MSGFW_FOLDER_TABLE_NAME); - - err = dbHandle.execQuery(sqlQuery); + snprintf(sqlQuery, sizeof(sqlQuery), "PRAGMA user_version;"); - if (err == MSG_SUCCESS) - MSG_DEBUG("SUCCESS : create %s.", MSGFW_MESSAGE_TABLE_NAME); - else - MSG_DEBUG("FAIL : create %s [%d].", MSGFW_MESSAGE_TABLE_NAME, err); + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + MSG_DEBUG("Fail to prepareQuery."); + return MSG_ERR_DB_EXEC; } - return err; -} - - -msg_error_t MsgCreateSimMessageTable() -{ - msg_error_t err = MSG_SUCCESS; - - char sqlQuery[MAX_QUERY_LEN+1]; - - if (!dbHandle.checkTableExist(MSGFW_SIM_MSG_TABLE_NAME)) { - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - - snprintf(sqlQuery, sizeof(sqlQuery), - "CREATE TABLE %s ( \ - MSG_ID INTEGER , \ - SIM_ID INTEGER NOT NULL , \ - FOREIGN KEY(MSG_ID) REFERENCES %s (MSG_ID) );", - MSGFW_SIM_MSG_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME); - - err = dbHandle.execQuery(sqlQuery); - - if (err == MSG_SUCCESS) - MSG_DEBUG("SUCCESS : create %s.", MSGFW_SIM_MSG_TABLE_NAME); - else - MSG_DEBUG("FAIL : create %s [%d].", MSGFW_SIM_MSG_TABLE_NAME, err); + if (dbHandle->stepQuery() == MSG_ERR_DB_STEP) { + MSG_DEBUG("Fail to stepQuery."); + return MSG_ERR_DB_EXEC; } - return err; -} - + dbVersion = dbHandle->columnInt(0); -msg_error_t MsgCreateWAPMessageTable() -{ - msg_error_t err = MSG_SUCCESS; + dbHandle->finalizeQuery(); - char sqlQuery[MAX_QUERY_LEN+1]; + MSG_DEBUG("dbVersion [%d]", dbVersion); - if (!dbHandle.checkTableExist(MSGFW_PUSH_MSG_TABLE_NAME)) { - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - - snprintf(sqlQuery, sizeof(sqlQuery), - "CREATE TABLE %s ( \ - MSG_ID INTEGER , \ - ACTION INTEGER , \ - CREATED INTEGER , \ - EXPIRES INTEGER , \ - ID TEXT , \ - HREF TEXT , \ - CONTENT TEXT , \ - FOREIGN KEY(MSG_ID) REFERENCES %s(MSG_ID) );", - MSGFW_PUSH_MSG_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME); - - err = dbHandle.execQuery(sqlQuery); - - if (err == MSG_SUCCESS) - MSG_DEBUG("SUCCESS : create %s.", MSGFW_PUSH_MSG_TABLE_NAME); - else - MSG_DEBUG("FAIL : create %s [%d].", MSGFW_PUSH_MSG_TABLE_NAME, err); + switch (dbVersion) + { + case 0 : + MsgUpdateDBtoVer1(); + /* no break */ + default : + MsgStoUpdateDBVersion(); + /* no break */ } - return err; + return MSG_SUCCESS; } - -msg_error_t MsgCreateCBMessageTable() +void MsgInitMmapMutex(const char *shm_file_name) { - msg_error_t err = MSG_SUCCESS; - - char sqlQuery[MAX_QUERY_LEN+1]; - - if (!dbHandle.checkTableExist(MSGFW_CB_MSG_TABLE_NAME)) { - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - - snprintf(sqlQuery, sizeof(sqlQuery), - "CREATE TABLE %s ( \ - MSG_ID INTEGER , \ - CB_MSG_ID INTEGER NOT NULL , \ - FOREIGN KEY(MSG_ID) REFERENCES %s (MSG_ID) );", - MSGFW_CB_MSG_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME); - - err = dbHandle.execQuery(sqlQuery); + MSG_BEGIN(); - if (err == MSG_SUCCESS) - MSG_DEBUG("SUCCESS : create %s.", MSGFW_CB_MSG_TABLE_NAME); - else - MSG_DEBUG("FAIL : create %s [%d].", MSGFW_CB_MSG_TABLE_NAME, err); + if(!shm_file_name) { + MSG_FATAL("EMAIL_ERROR_INVALID_PARAM"); + return; } - return err; -} - + int fd = shm_open (shm_file_name, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); /* note: permission is not working */ -msg_error_t MsgCreateSyncMLMessageTable() -{ - msg_error_t err = MSG_SUCCESS; - - char sqlQuery[MAX_QUERY_LEN+1]; - - if (!dbHandle.checkTableExist(MSGFW_SYNCML_MSG_TABLE_NAME)) { - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - - snprintf(sqlQuery, sizeof(sqlQuery), - "CREATE TABLE %s ( \ - MSG_ID INTEGER , \ - EXT_ID INTEGER NOT NULL , \ - PINCODE INTEGER NOT NULL , \ - FOREIGN KEY(MSG_ID) REFERENCES %s(MSG_ID) );", - MSGFW_SYNCML_MSG_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME); - - err = dbHandle.execQuery(sqlQuery); - - if (err == MSG_SUCCESS) - MSG_DEBUG("SUCCESS : create %s.", MSGFW_SYNCML_MSG_TABLE_NAME); - else - MSG_DEBUG("FAIL : create %s [%d].", MSGFW_SYNCML_MSG_TABLE_NAME, err); + if (fd < 0) { + MSG_FATAL("shm_open errno [%d]", errno); + return; } - return err; -} - -msg_error_t MsgCreateSmsSendOptTable() -{ - msg_error_t err = MSG_SUCCESS; - - char sqlQuery[MAX_QUERY_LEN+1]; - - if (!dbHandle.checkTableExist(MSGFW_SMS_SENDOPT_TABLE_NAME)) { - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - - snprintf(sqlQuery, sizeof(sqlQuery), - "CREATE TABLE %s ( \ - MSG_ID INTEGER , \ - DELREP_REQ INTEGER NOT NULL , \ - KEEP_COPY INTEGER NOT NULL , \ - REPLY_PATH INTEGER NOT NULL , \ - FOREIGN KEY(MSG_ID) REFERENCES %s (MSG_ID) );", - MSGFW_SMS_SENDOPT_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME); - - err = dbHandle.execQuery(sqlQuery); + fchmod(fd, 0666); + MSG_DEBUG("** Create SHM FILE **"); + if (ftruncate(fd, sizeof(pthread_mutex_t)) != 0) { + MSG_FATAL("ftruncate errno [%d]", errno); + return; + } - if (err == MSG_SUCCESS) - MSG_DEBUG("SUCCESS : create %s.", MSGFW_SMS_SENDOPT_TABLE_NAME); - else - MSG_DEBUG("FAIL : create %s [%d].", MSGFW_SMS_SENDOPT_TABLE_NAME, err); + pthread_mutex_t *mx = (pthread_mutex_t *)mmap(NULL, sizeof(pthread_mutex_t), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if (mx == MAP_FAILED) { + MSG_FATAL("mmap errno [%d]", errno); + return ; } - return err; -} + // initialize the data on mmap + pthread_mutexattr_t mattr; + pthread_mutexattr_init(&mattr); + pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED); + pthread_mutexattr_setrobust(&mattr, PTHREAD_MUTEX_ROBUST_NP); + pthread_mutex_init(mx, &mattr); + pthread_mutexattr_destroy(&mattr); + close (fd); + MSG_END(); +} -msg_error_t MsgCreateFilterTable() +msg_error_t MsgStoInitDB(bool bSimChanged) { + MSG_BEGIN(); +// MsgDbHandler *dbHandle = getDbHandle(); msg_error_t err = MSG_SUCCESS; - char sqlQuery[MAX_QUERY_LEN+1]; - - if (!dbHandle.checkTableExist(MSGFW_FILTER_TABLE_NAME)) { - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - - snprintf(sqlQuery, sizeof(sqlQuery), - "CREATE TABLE %s ( \ - FILTER_ID INTEGER PRIMARY KEY , \ - FILTER_TYPE INTEGER NOT NULL , \ - FILTER_VALUE TEXT NOT NULL , \ - FILTER_ACTIVE INTEGER DEFAULT 0);", - MSGFW_FILTER_TABLE_NAME); + // Init mmap mutex for DB access + MsgInitMmapMutex(SHM_FILE_FOR_DB_LOCK); - err = dbHandle.execQuery(sqlQuery); + // Check DB version. + MsgStoDBVerCheck(); - if (err == MSG_SUCCESS) - MSG_DEBUG("SUCCESS : create %s.", MSGFW_FILTER_TABLE_NAME); - else - MSG_DEBUG("FAIL : create %s [%d].", MSGFW_FILTER_TABLE_NAME, err); - } - - return err; -} + // Delete Msgs in Hidden Folder + MsgStoDeleteAllMessageInFolder(0, true, NULL); + // Reset network status + MsgStoResetNetworkStatus(); -msg_error_t MsgCreateMmsTable() -{ - msg_error_t err = MSG_SUCCESS; +#if 0 + // Reset Cb Message + MsgStoResetCBMessage(); +#endif - char sqlQuery[MAX_QUERY_LEN+1]; + //clear abnormal mms message + MsgStoCleanAbnormalMmsData(); - if (!dbHandle.checkTableExist(MMS_PLUGIN_MESSAGE_TABLE_NAME)) { - memset(sqlQuery, 0x00, sizeof(sqlQuery)); + // Clear all old Sim data + MsgStoClearSimMessageInDB(); - snprintf(sqlQuery, sizeof(sqlQuery), - "CREATE TABLE %s ( \ - MSG_ID INTEGER , \ - TRANSACTION_ID TEXT , \ - MESSAGE_ID TEXT , \ - FWD_MESSAGE_ID TEXT , \ - CONTENTS_LOCATION TEXT , \ - FILE_PATH TEXT , \ - VERSION INTEGER NOT NULL , \ - DATA_TYPE INTEGER DEFAULT -1 , \ - DATE DATETIME , \ - HIDE_ADDRESS INTEGER DEFAULT 0 , \ - ASK_DELIVERY_REPORT INTEGER DEFAULT 0 , \ - REPORT_ALLOWED INTEGER DEFAULT 0 , \ - READ_REPORT_ALLOWED_TYPE INTEGER DEFAULT 0 , \ - ASK_READ_REPLY INTEGER DEFAULT 0 , \ - READ INTEGER DEFAULT 0 , \ - READ_REPORT_SEND_STATUS INTEGER DEFAULT 0 , \ - READ_REPORT_SENT INTEGER DEFAULT 0 , \ - PRIORITY INTEGER DEFAULT 0 , \ - KEEP_COPY INTEGER DEFAULT 0 , \ - MSG_SIZE INTEGER NOT NULL , \ - MSG_CLASS INTEGER DEFAULT -1 , \ - EXPIRY_TIME DATETIME , \ - CUSTOM_DELIVERY_TIME INTEGER DEFAULT 0 , \ - DELIVERY_TIME DATETIME , \ - MSG_STATUS INTEGER DEFAULT -1 , \ - FOREIGN KEY(MSG_ID) REFERENCES %s (MSG_ID) );", - MMS_PLUGIN_MESSAGE_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME); - - err = dbHandle.execQuery(sqlQuery); + //update sim index to 0 for all messages + MsgStoUpdateIMSI(0); - if (err == MSG_SUCCESS) - MSG_DEBUG("SUCCESS : create %s.", MMS_PLUGIN_MESSAGE_TABLE_NAME); - else - MSG_DEBUG("FAIL : create %s [%d].", MMS_PLUGIN_MESSAGE_TABLE_NAME, err); - } + MSG_END(); return err; } @@ -510,27 +243,27 @@ msg_error_t MsgAddDefaultFolders() int nResult = 0; char sqlQuery[MAX_QUERY_LEN+1]; - + MsgDbHandler *dbHandle = getDbHandle(); // INBOX memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) FROM %s WHERE FOLDER_ID = %d;", MSGFW_FOLDER_TABLE_NAME, MSG_INBOX_ID); - if (dbHandle.getTable(sqlQuery, &nRowCnt) != MSG_SUCCESS) { - dbHandle.freeTable(); + if (dbHandle->getTable(sqlQuery, &nRowCnt) != MSG_SUCCESS) { + dbHandle->freeTable(); return MSG_ERR_DB_GETTABLE; } - nResult = dbHandle.getColumnToInt(1); + nResult = dbHandle->getColumnToInt(1); - dbHandle.freeTable(); + dbHandle->freeTable(); if (nResult == 0) { memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, 'INBOX', %d);", MSGFW_FOLDER_TABLE_NAME, MSG_INBOX_ID, MSG_FOLDER_TYPE_INBOX); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_EXEC; } @@ -539,21 +272,21 @@ msg_error_t MsgAddDefaultFolders() snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) FROM %s WHERE FOLDER_ID = %d;", MSGFW_FOLDER_TABLE_NAME, MSG_OUTBOX_ID); - if (dbHandle.getTable(sqlQuery, &nRowCnt) != MSG_SUCCESS) { - dbHandle.freeTable(); + if (dbHandle->getTable(sqlQuery, &nRowCnt) != MSG_SUCCESS) { + dbHandle->freeTable(); return MSG_ERR_DB_GETTABLE; } - nResult = dbHandle.getColumnToInt(1); + nResult = dbHandle->getColumnToInt(1); - dbHandle.freeTable(); + dbHandle->freeTable(); if (nResult == 0) { memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, 'OUTBOX', %d);", MSGFW_FOLDER_TABLE_NAME, MSG_OUTBOX_ID, MSG_FOLDER_TYPE_OUTBOX); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_EXEC; } @@ -562,21 +295,21 @@ msg_error_t MsgAddDefaultFolders() snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) FROM %s WHERE FOLDER_ID = %d;", MSGFW_FOLDER_TABLE_NAME, MSG_SENTBOX_ID); - if (dbHandle.getTable(sqlQuery, &nRowCnt) != MSG_SUCCESS) { - dbHandle.freeTable(); + if (dbHandle->getTable(sqlQuery, &nRowCnt) != MSG_SUCCESS) { + dbHandle->freeTable(); return MSG_ERR_DB_GETTABLE; } - nResult = dbHandle.getColumnToInt(1); + nResult = dbHandle->getColumnToInt(1); - dbHandle.freeTable(); + dbHandle->freeTable(); if (nResult == 0) { memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, 'SENTBOX', %d);", MSGFW_FOLDER_TABLE_NAME, MSG_SENTBOX_ID, MSG_FOLDER_TYPE_OUTBOX); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_EXEC; } @@ -585,21 +318,21 @@ msg_error_t MsgAddDefaultFolders() snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) FROM %s WHERE FOLDER_ID = %d;", MSGFW_FOLDER_TABLE_NAME, MSG_DRAFT_ID); - if (dbHandle.getTable(sqlQuery, &nRowCnt) != MSG_SUCCESS) { - dbHandle.freeTable(); + if (dbHandle->getTable(sqlQuery, &nRowCnt) != MSG_SUCCESS) { + dbHandle->freeTable(); return MSG_ERR_DB_GETTABLE; } - nResult = dbHandle.getColumnToInt(1); + nResult = dbHandle->getColumnToInt(1); - dbHandle.freeTable(); + dbHandle->freeTable(); if (nResult == 0) { memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, 'DRAFT', %d);", MSGFW_FOLDER_TABLE_NAME, MSG_DRAFT_ID, MSG_FOLDER_TYPE_DRAFT); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_EXEC; } @@ -608,21 +341,21 @@ msg_error_t MsgAddDefaultFolders() snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) FROM %s WHERE FOLDER_ID = %d;", MSGFW_FOLDER_TABLE_NAME, MSG_CBMSGBOX_ID); - if (dbHandle.getTable(sqlQuery, &nRowCnt) != MSG_SUCCESS) { - dbHandle.freeTable(); + if (dbHandle->getTable(sqlQuery, &nRowCnt) != MSG_SUCCESS) { + dbHandle->freeTable(); return MSG_ERR_DB_GETTABLE; } - nResult = dbHandle.getColumnToInt(1); + nResult = dbHandle->getColumnToInt(1); - dbHandle.freeTable(); + dbHandle->freeTable(); if (nResult == 0) { memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, 'CBMSGBOX', %d);", MSGFW_FOLDER_TABLE_NAME, MSG_CBMSGBOX_ID, MSG_FOLDER_TYPE_INBOX); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_EXEC; } @@ -631,67 +364,21 @@ msg_error_t MsgAddDefaultFolders() snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) FROM %s WHERE FOLDER_ID = %d;", MSGFW_FOLDER_TABLE_NAME, MSG_SPAMBOX_ID); - if (dbHandle.getTable(sqlQuery, &nRowCnt) != MSG_SUCCESS) { - dbHandle.freeTable(); + if (dbHandle->getTable(sqlQuery, &nRowCnt) != MSG_SUCCESS) { + dbHandle->freeTable(); return MSG_ERR_DB_GETTABLE; } - nResult = dbHandle.getColumnToInt(1); + nResult = dbHandle->getColumnToInt(1); - dbHandle.freeTable(); + dbHandle->freeTable(); if (nResult == 0) { memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, 'SPAMBOX', %d);", MSGFW_FOLDER_TABLE_NAME, MSG_SPAMBOX_ID, MSG_FOLDER_TYPE_SPAMBOX); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) - return MSG_ERR_DB_EXEC; - } - - // SMS TEMPLATE - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) FROM %s WHERE FOLDER_ID = %d;", - MSGFW_FOLDER_TABLE_NAME, MSG_SMS_TEMPLATE_ID); - - if (dbHandle.getTable(sqlQuery, &nRowCnt) != MSG_SUCCESS) { - dbHandle.freeTable(); - return MSG_ERR_DB_GETTABLE; - } - - nResult = dbHandle.getColumnToInt(1); - - dbHandle.freeTable(); - - if (nResult == 0) { - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, 'SMS TEMPLATE', %d);", - MSGFW_FOLDER_TABLE_NAME, MSG_SMS_TEMPLATE_ID, MSG_FOLDER_TYPE_TEMPLATE); - - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) - return MSG_ERR_DB_EXEC; - } - - // MMS TEMPLATE - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) FROM %s WHERE FOLDER_ID = %d;", - MSGFW_FOLDER_TABLE_NAME, MSG_MMS_TEMPLATE_ID); - - if (dbHandle.getTable(sqlQuery, &nRowCnt) != MSG_SUCCESS) { - dbHandle.freeTable(); - return MSG_ERR_DB_GETTABLE; - } - - nResult = dbHandle.getColumnToInt(1); - - dbHandle.freeTable(); - - if (nResult == 0) { - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, 'MMS TEMPLATE', %d);", - MSGFW_FOLDER_TABLE_NAME, MSG_MMS_TEMPLATE_ID, MSG_FOLDER_TYPE_TEMPLATE); - - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_EXEC; } @@ -702,7 +389,7 @@ msg_error_t MsgAddDefaultFolders() msg_error_t MsgAddDefaultAddress() { MSG_BEGIN(); - + MsgDbHandler *dbHandle = getDbHandle(); int nRowCnt = 0, nResult = 0; char sqlQuery[MAX_QUERY_LEN+1]; @@ -711,23 +398,23 @@ msg_error_t MsgAddDefaultAddress() snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) FROM %s WHERE ADDRESS_ID = 0;", MSGFW_ADDRESS_TABLE_NAME); - if (dbHandle.getTable(sqlQuery, &nRowCnt) != MSG_SUCCESS) { - dbHandle.freeTable(); + if (dbHandle->getTable(sqlQuery, &nRowCnt) != MSG_SUCCESS) { + dbHandle->freeTable(); return MSG_ERR_DB_GETTABLE; } - nResult = dbHandle.getColumnToInt(1); + nResult = dbHandle->getColumnToInt(1); - dbHandle.freeTable(); + dbHandle->freeTable(); if (nResult == 0) { memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (0, 0, 0, '', 0, '', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '');", + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (0, 0, 0, 0, '', 0, 0, '', '', '', '', '', '', 0);", MSGFW_ADDRESS_TABLE_NAME); MSG_DEBUG("%s", sqlQuery); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_EXEC; } @@ -739,6 +426,7 @@ msg_error_t MsgAddDefaultAddress() msg_error_t MsgStoResetDatabase() { + MsgDbHandler *dbHandle = getDbHandle(); msg_error_t err = MSG_SUCCESS; char sqlQuery[MAX_QUERY_LEN+1]; @@ -750,7 +438,7 @@ msg_error_t MsgStoResetDatabase() int listCnt = sizeof(tableList)/sizeof(char*); - dbHandle.beginTrans(); + dbHandle->beginTrans(); // Delete Database for (int i = 0; i < listCnt; i++) @@ -758,8 +446,8 @@ msg_error_t MsgStoResetDatabase() memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s;", tableList[i]); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } } @@ -769,34 +457,34 @@ msg_error_t MsgStoResetDatabase() snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE STORAGE_ID <> %d;", MSGFW_MESSAGE_TABLE_NAME, MSG_STORAGE_SIM); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } // Delete Conversation Table - err = MsgStoClearConversationTable(&dbHandle); + err = MsgStoClearConversationTable(dbHandle); if (err != MSG_SUCCESS) { - dbHandle.endTrans(false); + dbHandle->endTrans(false); return err; } // Add Default Folders if (MsgAddDefaultFolders() != MSG_SUCCESS) { MSG_DEBUG("Add Default Folders Fail"); - dbHandle.endTrans(false); + dbHandle->endTrans(false); return MSG_ERR_DB_STORAGE_INIT; } // Add Default Address if (MsgAddDefaultAddress() != MSG_SUCCESS) { MSG_DEBUG("Add Default Address Fail"); - dbHandle.endTrans(false); + dbHandle->endTrans(false); return MSG_ERR_DB_STORAGE_INIT; } - dbHandle.endTrans(true); + dbHandle->endTrans(true); // Delete MMS Files MsgRmRf((char*)MSG_DATA_PATH); @@ -820,6 +508,7 @@ msg_error_t MsgStoResetDatabase() msg_error_t MsgStoBackupMessage(msg_message_backup_type_t type, const char *filepath) { + MsgDbHandler *dbHandle = getDbHandle(); msg_error_t err = MSG_SUCCESS; char sqlQuery[MAX_QUERY_LEN+1]; @@ -832,12 +521,12 @@ msg_error_t MsgStoBackupMessage(msg_message_backup_type_t type, const char *file memset(fileName, 0x00, sizeof(fileName)); strncpy(fileName, filepath, MSG_FILENAME_LEN_MAX); if (remove(fileName) != 0) { - MSG_DEBUG("Fail to delete [%s].", fileName); + MSG_SEC_DEBUG("Fail to delete [%s].", fileName); } memset(sqlQuery, 0x00, sizeof(sqlQuery)); - MSG_DEBUG("backup type = %d, path = %s", type, filepath); + MSG_SEC_DEBUG("backup type = %d, path = %s", type, filepath); if (type == MSG_BACKUP_TYPE_SMS) { snprintf(sqlQuery, sizeof(sqlQuery), @@ -857,26 +546,35 @@ msg_error_t MsgStoBackupMessage(msg_message_backup_type_t type, const char *file } - err = dbHandle.getTable(sqlQuery, &rowCnt); + err = dbHandle->getTable(sqlQuery, &rowCnt); if (err != MSG_SUCCESS) { - dbHandle.freeTable(); + dbHandle->freeTable(); return err; } MSG_DEBUG("backup number = %d", rowCnt); for (int i = 0; i < rowCnt; i++) { - err = MsgStoGetMessage(dbHandle.getColumnToInt(++index), &msgInfo, NULL); + int msgid = dbHandle->getColumnToInt(++index); + + msgInfo.addressList = NULL; + AutoPtr addressListBuf(&msgInfo.addressList); + + err = MsgStoGetMessage(msgid, &msgInfo, NULL); if(err != MSG_SUCCESS) { - dbHandle.freeTable(); + dbHandle->freeTable(); return err; } - encoded_data = MsgVMessageAddRecord(&dbHandle, &msgInfo); + encoded_data = MsgVMessageAddRecord(dbHandle, &msgInfo); + if (msgInfo.bTextSms == false) + { + MsgDeleteFile(msgInfo.msgData); //ipc + } if (encoded_data != NULL) { if (MsgAppendFile(fileName, encoded_data, strlen(encoded_data)) == false) { - dbHandle.freeTable(); + dbHandle->freeTable(); free(encoded_data); return MSG_ERR_STORAGE_ERROR; } @@ -887,7 +585,7 @@ msg_error_t MsgStoBackupMessage(msg_message_backup_type_t type, const char *file memset(&msgInfo, 0, sizeof(MSG_MESSAGE_INFO_S)); } - dbHandle.freeTable(); + dbHandle->freeTable(); MSG_END(); return MSG_SUCCESS; @@ -895,49 +593,77 @@ msg_error_t MsgStoBackupMessage(msg_message_backup_type_t type, const char *file msg_error_t MsgStoUpdateMms(MSG_MESSAGE_INFO_S *pMsg) { + MsgDbHandler *dbHandle = getDbHandle(); + msg_error_t err = MSG_SUCCESS; char sqlQuery[MAX_QUERY_LEN+1]; + unsigned int fileSize = 0; + char *pFileData = NULL; if (pMsg->msgType.subType == MSG_SENDCONF_MMS) { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); - dbHandle.beginTrans(); + dbHandle->beginTrans(); snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET THUMB_PATH = ?, MSG_TEXT = ? WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, pMsg->msgId); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } - dbHandle.bindText(pMsg->thumbPath, 1); - dbHandle.bindText(pMsg->msgText, 2); - MSG_DEBUG("thumbPath = %s , msgText = %s" , pMsg->thumbPath, pMsg->msgText); + dbHandle->bindText(pMsg->thumbPath, 1); + + if (pMsg->msgText[0] != '\0' && g_file_get_contents(pMsg->msgText, &pFileData, &fileSize, NULL) == true) { + dbHandle->bindText(pFileData, 2); + } + + MSG_DEBUG("thumbPath = %s , msgText = %s" , pMsg->thumbPath, pFileData); + MSG_DEBUG("%s", sqlQuery); - if (dbHandle.stepQuery() != MSG_ERR_DB_DONE) { - dbHandle.finalizeQuery(); - dbHandle.endTrans(false); + if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) { + dbHandle->finalizeQuery(); + dbHandle->endTrans(false); + if (pFileData) { + free(pFileData); + pFileData = NULL; + } + return MSG_ERR_DB_EXEC; } - dbHandle.finalizeQuery(); - dbHandle.endTrans(true); + dbHandle->finalizeQuery(); + dbHandle->endTrans(true); + + if (pFileData) { + free(pFileData); + pFileData = NULL; + } } else { - if (MsgStoUpdateMMSMessage(pMsg) != MSG_SUCCESS) - MSG_DEBUG("MsgStoUpdateMMSMessage is failed"); + + err = MsgStoUpdateMMSMessage(pMsg); + if (err != MSG_SUCCESS) { + MSG_DEBUG("MsgStoUpdateMMSMessage() error : %d", err); + } + } - return MSG_SUCCESS; + return err; } -msg_error_t MsgStoRestoreMessage(const char *filepath) +msg_error_t MsgStoRestoreMessage(const char *filepath, msg_id_list_s**result_id_list) { msg_error_t err = MSG_SUCCESS; MSG_MESSAGE_INFO_S msgInfo = {0,}; + AutoPtr addressListBuf(&msgInfo.addressList); VTree* vMsg = NULL; VObject* pObject = NULL; + msg_id_list_s *msgIdList = NULL; + msgIdList = (msg_id_list_s *)calloc(1, sizeof(msg_id_list_s)); + int dataSize = 0; char fileName[MSG_FILENAME_LEN_MAX+1]; @@ -967,6 +693,10 @@ msg_error_t MsgStoRestoreMessage(const char *filepath) MSG_DEBUG("Start Position2: %s", pCurrent); vMsg = vmsg_decode(pCurrent); + if (vMsg == NULL) { + err = MSG_ERR_STORAGE_ERROR; + goto __RETURN; + } #endif pObject = vMsg->pTop; @@ -997,7 +727,8 @@ msg_error_t MsgStoRestoreMessage(const char *filepath) msgInfo.msgType.subType = MSG_NOTIFICATIONIND_MMS; } else { vmsg_free_vtree_memory(vMsg); - return MSG_ERR_STORAGE_ERROR; + err = MSG_ERR_STORAGE_ERROR; + goto __RETURN; } } break; @@ -1008,7 +739,13 @@ msg_error_t MsgStoRestoreMessage(const char *filepath) msgInfo.folderId= MSG_INBOX_ID; msgInfo.direction=MSG_DIRECTION_TYPE_MT; - msgInfo.networkStatus=MSG_NETWORK_RECEIVED; + if (msgInfo.msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS) + msgInfo.networkStatus=MSG_NETWORK_RETRIEVE_SUCCESS; + else if (msgInfo.msgType.subType == MSG_SENDCONF_MMS) + msgInfo.networkStatus=MSG_NETWORK_SEND_SUCCESS; + else + msgInfo.networkStatus=MSG_NETWORK_RECEIVED; + } else if(!strncmp(pObject->pszValue[0], "OUTBOX", strlen("OUTBOX"))) { msgInfo.folderId= MSG_OUTBOX_ID; msgInfo.direction=MSG_DIRECTION_TYPE_MO; @@ -1026,7 +763,8 @@ msg_error_t MsgStoRestoreMessage(const char *filepath) msgInfo.networkStatus=MSG_NETWORK_NOT_SEND; } else { vmsg_free_vtree_memory(vMsg); - return MSG_ERR_STORAGE_ERROR; + err = MSG_ERR_STORAGE_ERROR; + goto __RETURN; } } break; @@ -1039,7 +777,8 @@ msg_error_t MsgStoRestoreMessage(const char *filepath) msgInfo.bRead = false; } else { vmsg_free_vtree_memory(vMsg); - return MSG_ERR_STORAGE_ERROR; + err = MSG_ERR_STORAGE_ERROR; + goto __RETURN; } } break; @@ -1050,7 +789,8 @@ msg_error_t MsgStoRestoreMessage(const char *filepath) if (!_convert_vdata_str_to_tm(pObject->pszValue[0], &displayTime)) { vmsg_free_vtree_memory( vMsg ); - return MSG_ERR_STORAGE_ERROR; + err = MSG_ERR_STORAGE_ERROR; + goto __RETURN; } msgInfo.displayTime = mktime(&displayTime); @@ -1079,12 +819,14 @@ msg_error_t MsgStoRestoreMessage(const char *filepath) if (MsgCreateFileName(fileName) == false) { vmsg_free_vtree_memory(vMsg); - return MSG_ERR_STORAGE_ERROR; + err = MSG_ERR_STORAGE_ERROR; + goto __RETURN; } if (MsgWriteIpcFile(fileName, pObject->pszValue[0], pObject->numOfBiData) == false) { vmsg_free_vtree_memory(vMsg); - return MSG_ERR_STORAGE_ERROR; + err = MSG_ERR_STORAGE_ERROR; + goto __RETURN; } strncpy(msgInfo.msgData, fileName, MAX_MSG_DATA_LEN); @@ -1101,6 +843,7 @@ msg_error_t MsgStoRestoreMessage(const char *filepath) } } else { msgInfo.bTextSms = true; +#if 0 if(msgInfo.msgType.subType == MSG_NOTIFICATIONIND_MMS) { msgInfo.bTextSms = true; @@ -1138,7 +881,7 @@ msg_error_t MsgStoRestoreMessage(const char *filepath) vmsg_free_vtree_memory(vMsg); return MSG_ERR_STORAGE_ERROR; } - MSG_DEBUG("fileName: %s, retrievedFilePath: %s (%d)", fileName, retrievedFilePath, strlen(retrievedFilePath)); + MSG_SEC_DEBUG("fileName: %s, retrievedFilePath: %s (%d)", fileName, retrievedFilePath, strlen(retrievedFilePath)); if (MsgWriteIpcFile(fileName, retrievedFilePath, strlen(retrievedFilePath)+ 1) == false) { vmsg_free_vtree_memory(vMsg); @@ -1151,18 +894,57 @@ msg_error_t MsgStoRestoreMessage(const char *filepath) return vmsg_free_vtree_memory(vMsg); /////////////////////////// } +#else + + msgInfo.bTextSms = false; + + char fileName[MAX_COMMON_INFO_SIZE+1]; + memset(fileName, 0x00, sizeof(fileName)); + + if (MsgCreateFileName(fileName) == false) { + vmsg_free_vtree_memory(vMsg); + err = MSG_ERR_STORAGE_ERROR; + goto __RETURN; + } + + if (MsgWriteIpcFile(fileName, pObject->pszValue[0], pObject->numOfBiData) == false) { + vmsg_free_vtree_memory(vMsg); + err = MSG_ERR_STORAGE_ERROR; + goto __RETURN; + } + + //set serialized mms data ipcfilename + strncpy(msgInfo.msgData, fileName, MAX_MSG_DATA_LEN); +#endif } } break; case VCARD_TYPE_TEL : { + MSG_ADDRESS_INFO_S * addrInfo = NULL; + msgInfo.nAddressCnt++; + if (msgInfo.addressList == NULL) { + addrInfo = (MSG_ADDRESS_INFO_S *)calloc(1, sizeof(MSG_ADDRESS_INFO_S)); + } else { + addrInfo = (MSG_ADDRESS_INFO_S *)realloc(msgInfo.addressList, msgInfo.nAddressCnt * sizeof(MSG_ADDRESS_INFO_S)); + } + + if (addrInfo == NULL) { + vmsg_free_vtree_memory(vMsg); + err = MSG_ERR_STORAGE_ERROR; + goto __RETURN; + + } + + msgInfo.addressList = addrInfo; + msgInfo.addressList[msgInfo.nAddressCnt-1].addressType = MSG_ADDRESS_TYPE_PLMN; msgInfo.addressList[msgInfo.nAddressCnt-1].recipientType = MSG_RECIPIENTS_TYPE_TO; - strncpy(msgInfo.addressList[msgInfo.nAddressCnt-1].addressVal, pObject->pszValue[0], MAX_ADDRESS_VAL_LEN); + } break; } @@ -1193,40 +975,77 @@ msg_error_t MsgStoRestoreMessage(const char *filepath) if (msgInfo.msgType.mainType == MSG_MMS_TYPE) MsgStoUpdateMms(&msgInfo); + if (msgIdList->nCount == 0) { + msgIdList->msgIdList = (msg_message_id_t*)calloc(1, sizeof(msg_message_id_t)); + } else { + msg_message_id_t * msg_id_list; + msg_id_list = (msg_message_id_t*)realloc(msgIdList->msgIdList, sizeof(msg_message_id_t)*(msgIdList->nCount+1)); + + if (msg_id_list) + msgIdList->msgIdList = msg_id_list; + else { + MSG_DEBUG("realloc failed"); + err = MSG_ERR_UNKNOWN; + goto __RETURN; + } + } + + msgIdList->msgIdList[msgIdList->nCount] = msgInfo.msgId; + msgIdList->nCount++; + vmsg_free_vtree_memory(vMsg); vMsg = NULL; pCurrent = pTemp + strlen("END:VMSG"); } - return MSG_SUCCESS; + if (result_id_list) + *result_id_list = msgIdList; +__RETURN: + if(pData) + { + free( pData ); + pData = NULL; + pCurrent = NULL; + } + + return err; } msg_error_t MsgStoAddPushEvent(MSG_PUSH_EVENT_INFO_S* pPushEvent) { - msg_error_t err = MSG_SUCCESS; + MsgDbHandler *dbHandle = getDbHandle(); char sqlQuery[MAX_QUERY_LEN+1]; unsigned int rowId = 0; memset(sqlQuery, 0x00, sizeof(sqlQuery)); // Check whether Same record exists or not. +#if 0 snprintf(sqlQuery, sizeof(sqlQuery), "SELECT * FROM %s WHERE CONTENT_TYPE LIKE '%s' AND APP_ID LIKE '%s' AND (PKG_NAME LIKE '%s' OR SECURE = 1);", MSGFW_PUSH_CONFIG_TABLE_NAME, pPushEvent->contentType, pPushEvent->appId, pPushEvent->pkgName); +#else + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT * FROM %s WHERE CONTENT_TYPE LIKE '%s' AND APP_ID LIKE '%s';", + MSGFW_PUSH_CONFIG_TABLE_NAME, pPushEvent->contentType, pPushEvent->appId); +#endif - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { MSG_DEBUG("Query Failed [%s]", sqlQuery); return MSG_ERR_DB_PREPARE; } - if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { - dbHandle.finalizeQuery(); + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + dbHandle->finalizeQuery(); return MSG_ERR_DB_ROW; } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); + + dbHandle->beginTrans(); + + if (dbHandle->getRowId(MSGFW_PUSH_CONFIG_TABLE_NAME, &rowId) != MSG_SUCCESS) { + MSG_DEBUG("getRowId is failed!!!"); + } - dbHandle.beginTrans(); - err = dbHandle.getRowId(MSGFW_PUSH_CONFIG_TABLE_NAME, &rowId); memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, ?, ?, ?, %d, 0, 0);", @@ -1235,23 +1054,23 @@ msg_error_t MsgStoAddPushEvent(MSG_PUSH_EVENT_INFO_S* pPushEvent) MSG_DEBUG("QUERY : %s", sqlQuery); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } - dbHandle.bindText(pPushEvent->contentType, 1); - dbHandle.bindText(pPushEvent->appId, 2); - dbHandle.bindText(pPushEvent->pkgName, 3); + dbHandle->bindText(pPushEvent->contentType, 1); + dbHandle->bindText(pPushEvent->appId, 2); + dbHandle->bindText(pPushEvent->pkgName, 3); - if (dbHandle.stepQuery() != MSG_ERR_DB_DONE) { - dbHandle.finalizeQuery(); - dbHandle.endTrans(false); + if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) { + dbHandle->finalizeQuery(); + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } - dbHandle.finalizeQuery(); - dbHandle.endTrans(true); + dbHandle->finalizeQuery(); + dbHandle->endTrans(true); return MSG_SUCCESS; } @@ -1259,45 +1078,47 @@ msg_error_t MsgStoAddPushEvent(MSG_PUSH_EVENT_INFO_S* pPushEvent) msg_error_t MsgStoDeletePushEvent(MSG_PUSH_EVENT_INFO_S* pPushEvent) { + MsgDbHandler *dbHandle = getDbHandle(); char sqlQuery[MAX_QUERY_LEN+1]; - dbHandle.beginTrans(); + dbHandle->beginTrans(); memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE CONTENT_TYPE LIKE '%s' AND APP_ID LIKE '%s' AND PKG_NAME LIKE '%s';", MSGFW_PUSH_CONFIG_TABLE_NAME, pPushEvent->contentType, pPushEvent->appId, pPushEvent->pkgName); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } - dbHandle.endTrans(true); + dbHandle->endTrans(true); return MSG_SUCCESS; } msg_error_t MsgStoUpdatePushEvent(MSG_PUSH_EVENT_INFO_S* pSrc, MSG_PUSH_EVENT_INFO_S* pDst) { + MsgDbHandler *dbHandle = getDbHandle(); char sqlQuery[MAX_QUERY_LEN+1]; - dbHandle.beginTrans(); + dbHandle->beginTrans(); memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET CONTENT_TYPE = ?, APP_ID = ?, PKG_NAME = ?, LAUNCH = %d WHERE CONTENT_TYPE LIKE '%s' AND APP_ID LIKE '%s' AND PKG_NAME LIKE '%s';", MSGFW_PUSH_CONFIG_TABLE_NAME, pDst->bLaunch, pSrc->contentType, pSrc->appId, pSrc->pkgName); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } - dbHandle.bindText(pDst->contentType, 1); - dbHandle.bindText(pDst->appId, 2); - dbHandle.bindText(pDst->pkgName, 3); + dbHandle->bindText(pDst->contentType, 1); + dbHandle->bindText(pDst->appId, 2); + dbHandle->bindText(pDst->pkgName, 3); - if (dbHandle.stepQuery() != MSG_ERR_DB_DONE) { - dbHandle.finalizeQuery(); - dbHandle.endTrans(false); + if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) { + dbHandle->finalizeQuery(); + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } - dbHandle.finalizeQuery(); - dbHandle.endTrans(true); + dbHandle->finalizeQuery(); + dbHandle->endTrans(true); return MSG_SUCCESS; } diff --git a/framework/storage-handler/MsgStorageMessage.cpp b/framework/storage-handler/MsgStorageMessage.cpp index 834ce08..bb10251 100755 --- a/framework/storage-handler/MsgStorageMessage.cpp +++ b/framework/storage-handler/MsgStorageMessage.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include @@ -35,6 +35,8 @@ #include "MsgStorageHandler.h" #include "MsgNotificationWrapper.h" #include "MsgMmsMessage.h" +#include "MsgDevicedWrapper.h" + using namespace std; @@ -42,7 +44,6 @@ using namespace std; /*================================================================================================== VARIABLES ==================================================================================================*/ -extern MsgDbHandler dbHandle; Mutex delNotiMx; CndVar delNoticv; @@ -56,17 +57,11 @@ bool delLogRunning = false; /*================================================================================================== FUNCTION FOR THREAD ==================================================================================================*/ -static gboolean updateUnreadMsgCount(void *pVoid) +static gboolean resetNotification(void *pVoid) { MSG_BEGIN(); - int smsCnt = 0; - int mmsCnt = 0; - - smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE); - mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE); - - MsgSettingSetIndicator(smsCnt, mmsCnt); + MsgRefreshAllNotification(true, false, false); MSG_END(); @@ -77,6 +72,7 @@ static gboolean updateUnreadMsgCount(void *pVoid) /*================================================================================================== FUNCTION IMPLEMENTATION ==================================================================================================*/ + msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo) { MSG_BEGIN(); @@ -88,114 +84,217 @@ msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pS char sqlQuery[MAX_QUERY_LEN+1]; - dbHandle.beginTrans(); + MsgDbHandler *dbHandle = getDbHandle(); + + dbHandle->beginTrans(); if (pMsg->nAddressCnt > 0) { - err = MsgStoAddAddress(&dbHandle, pMsg, &convId); + err = MsgStoAddAddress(dbHandle, pMsg, &convId); if (err != MSG_SUCCESS) { - dbHandle.endTrans(false); + dbHandle->endTrans(false); return err; } pMsg->threadId = convId; } - err = dbHandle.getRowId(MSGFW_MESSAGE_TABLE_NAME, &rowId); - - if (err != MSG_SUCCESS) { - dbHandle.endTrans(false); - return err; + if (pMsg->msgId > 0) { + rowId = pMsg->msgId; + } else { + // get rowId + err = dbHandle->getRowId(MSGFW_MESSAGE_TABLE_NAME, &rowId); + if (err != MSG_SUCCESS) { + dbHandle->endTrans(false); + return err; + } + pMsg->msgId = (msg_message_id_t)rowId; } - pMsg->msgId = (msg_message_id_t)rowId; - int fileSize = 0; + gchar *contents = NULL; char *pFileData = NULL; AutoPtr buf(&pFileData); - // Get File Data - if (pMsg->bTextSms == false) { - if (MsgOpenAndReadFile(pMsg->msgData, &pFileData, &fileSize) == false) { - dbHandle.endTrans(false); - return MSG_ERR_STORAGE_ERROR; - } - MSG_DEBUG("file size [%d]", fileSize); - } + char keyName[MAX_VCONFKEY_NAME_LEN]; + memset(keyName, 0x00, sizeof(keyName)); + sprintf(keyName, "%s/%d", MSG_SIM_IMSI, pMsg->sim_idx); + + char *imsi = MsgSettingGetString(keyName); // Add Message memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %ld, %d, %d, %d, %d, %d, %d, %ld, %d, ?, ?, ?, ?, 0);", + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %u, %d, %d, %d, %d, %d, %d, %d, %d, ?, '', '', ?, 0, %d, '%s');", MSGFW_MESSAGE_TABLE_NAME, rowId, convId, pMsg->folderId, pMsg->storageId, pMsg->msgType.mainType, pMsg->msgType.subType, - pMsg->displayTime, pMsg->dataSize, pMsg->networkStatus, pMsg->bRead, pMsg->bProtected, pMsg->priority, pMsg->direction, - 0, pMsg->bBackup); + (unsigned int)pMsg->displayTime, pMsg->dataSize, pMsg->networkStatus, pMsg->bRead, pMsg->bProtected, pMsg->priority, pMsg->direction, + 0, pMsg->bBackup, pMsg->sim_idx, imsi); MSG_DEBUG("QUERY : %s", sqlQuery); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + g_free(imsi); + imsi = NULL; + + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } - dbHandle.bindText(pMsg->subject, 1); + dbHandle->bindText(pMsg->subject, 1); - dbHandle.bindText(pMsg->msgData, 2); + if (pMsg->msgType.subType == MSG_NOTIFICATIONIND_MMS) { + dbHandle->bindText("", 2); + } else { + if (pMsg->bTextSms == false) { + //CID 47860: pMsg->msgData is an array, hence null check is not required + char fn[MSG_FILEPATH_LEN_MAX]; + memset(fn,0x00,MSG_FILEPATH_LEN_MAX); + snprintf(fn, MSG_FILEPATH_LEN_MAX, "%s%s", MSG_IPC_DATA_PATH, pMsg->msgData); + + if (g_file_get_contents(fn, &contents, NULL, NULL)) { + MSG_DEBUG("g_file_get_contents() Success!!"); + dbHandle->bindText(contents, 2); + } else { + MSG_DEBUG("g_file_get_contents() Failed!!"); + dbHandle->bindText("", 2); + } - dbHandle.bindText(pMsg->thumbPath, 3); + } else + dbHandle->bindText(pMsg->msgText, 2); + } - if (pMsg->bTextSms == false) - dbHandle.bindText(pFileData, 4); - else - dbHandle.bindText(pMsg->msgText, 4); + if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) { + dbHandle->finalizeQuery(); + dbHandle->endTrans(false); + //free contents + if (contents) { + g_free(contents); + contents = NULL; + } - if (dbHandle.stepQuery() != MSG_ERR_DB_DONE) { - dbHandle.finalizeQuery(); - dbHandle.endTrans(false); return MSG_ERR_DB_EXEC; } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); + + //free contents + if (contents) { + g_free(contents); + contents = NULL; + } if (pMsg->msgType.subType != MSG_SENDREQ_MMS) { - err = MsgStoUpdateConversation(&dbHandle, convId); + err = MsgStoUpdateConversation(dbHandle, convId); if (err != MSG_SUCCESS) { - dbHandle.endTrans(false); + dbHandle->endTrans(false); return err; } } +#if 0 /* In the case of MMS Message, load the MMS plugin to save MMS PDU */ if (pMsg->msgType.mainType == MSG_MMS_TYPE) { - MMS_MESSAGE_DATA_S mmsMsg; - memset(&mmsMsg, 0x00, sizeof(MMS_MESSAGE_DATA_S)); if (pMsg->msgType.subType != MSG_DELIVERYIND_MMS && pMsg->msgType.subType != MSG_READORGIND_MMS) { + MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_MMS_TYPE); + if (pFileData == NULL) { + if (MsgOpenAndReadFile(pMsg->msgData, &pFileData, &fileSize) == false) { + dbHandle->endTrans(false); + return MSG_ERR_STORAGE_ERROR; + } + + MSG_DEBUG("file size [%d]", fileSize); + } + err = plg->addMessage(pMsg, pSendOptInfo, pFileData); if (err != MSG_SUCCESS) { - dbHandle.endTrans(false); + dbHandle->endTrans(false); return MSG_ERR_STORAGE_ERROR; } - if (pMsg->msgType.subType == MSG_SENDREQ_MMS) { + if (pMsg->msgType.subType == MSG_SENDREQ_MMS + || pMsg->msgType.subType == MSG_RETRIEVE_MMS + || pMsg->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS + || pMsg->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) { + MSG_DEBUG("pMsg->msgText: %s, pMsg->thumbPath: %s ", pMsg->msgText, pMsg->thumbPath); err = MsgStoUpdateMMSMessage(pMsg); if (err != MSG_SUCCESS) { - dbHandle.endTrans(false); + dbHandle->endTrans(false); return MSG_ERR_STORAGE_ERROR; } + } } + } else if (pMsg->msgType.mainType == MSG_SMS_TYPE && pSendOptInfo != NULL) { + MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE); + if (plg) err = plg->addMessage(pMsg, pSendOptInfo, NULL); + if (err != MSG_SUCCESS) { + dbHandle->endTrans(false); + return MSG_ERR_STORAGE_ERROR; + } } +#else + if (pMsg->msgType.mainType == MSG_MMS_TYPE) { + char *pMmsSerializedData = NULL; + AutoPtr buf_mms(&pMmsSerializedData); + + if (pMsg->msgType.subType != MSG_DELIVERYIND_MMS && pMsg->msgType.subType != MSG_READORGIND_MMS) { + + MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_MMS_TYPE); + + if (pMmsSerializedData == NULL) { + if (MsgOpenAndReadFile(pMsg->msgData, &pMmsSerializedData, &fileSize) == false) { + dbHandle->endTrans(false); + return MSG_ERR_STORAGE_ERROR; + } + + MSG_DEBUG("file size [%d]", fileSize); + } + + err = plg->addMessage(pMsg, pSendOptInfo, pMmsSerializedData); + + if (err != MSG_SUCCESS) { + dbHandle->endTrans(false); + return MSG_ERR_STORAGE_ERROR; + } + +// if (pMsg->msgText[0] != '\0') { +// g_file_get_contents(pMsg->msgText, &pFileData, (gsize *)&fileSize, NULL); +// MSG_DEBUG("file size [%d]", fileSize); +// } + + if (pMsg->msgType.subType == MSG_SENDREQ_MMS + || pMsg->msgType.subType == MSG_RETRIEVE_MMS + || pMsg->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS + || pMsg->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) + { + MSG_DEBUG("pMsg->msgText: %s, pMsg->thumbPath: %s ", pMsg->msgText, pMsg->thumbPath); + + err = MsgStoUpdateMMSMessage(pMsg); + } + + } + } else { - dbHandle.endTrans(true); + // Get File Data + if (pMsg->bTextSms == false) { + if (MsgOpenAndReadFile(pMsg->msgData, &pFileData, &fileSize) == false) { + dbHandle->endTrans(false); + return MSG_ERR_STORAGE_ERROR; + } + MSG_DEBUG("file size [%d]", fileSize); + } + } +#endif + dbHandle->endTrans(true); MSG_END(); @@ -210,8 +309,8 @@ msg_error_t MsgStoUpdateMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S char sqlQuery[MAX_QUERY_LEN+1]; msg_thread_id_t convId = 0; - - dbHandle.beginTrans(); + MsgDbHandler *dbHandle = getDbHandle(); + dbHandle->beginTrans(); MSG_MAIN_TYPE_T prevType; memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -220,19 +319,19 @@ msg_error_t MsgStoUpdateMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S MSG_DEBUG("QUERY : %s", sqlQuery); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_PREPARE; } - if (dbHandle.stepQuery() != MSG_ERR_DB_ROW) { - dbHandle.finalizeQuery(); - dbHandle.endTrans(false); + if (dbHandle->stepQuery() != MSG_ERR_DB_ROW) { + dbHandle->finalizeQuery(); + dbHandle->endTrans(false); return MSG_ERR_STORAGE_ERROR; } - prevType = dbHandle.columnInt(0); - dbHandle.finalizeQuery(); + prevType = dbHandle->columnInt(0); + dbHandle->finalizeQuery(); //check msg type with previous type if (prevType != pMsg->msgType.mainType) { @@ -240,25 +339,26 @@ msg_error_t MsgStoUpdateMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S err = MsgStoDeleteMessage(pMsg->msgId, false); if (err != MSG_SUCCESS) { - dbHandle.endTrans(false); + dbHandle->endTrans(false); return err; } err = MsgStoAddMessage(pMsg, pSendOptInfo); if (err != MSG_SUCCESS) { - dbHandle.endTrans(false); + dbHandle->endTrans(false); return err; } - dbHandle.endTrans(false); + dbHandle->endTrans(false); return err; } if (pMsg->nAddressCnt > 0) { - err = MsgStoAddAddress(&dbHandle, pMsg, &convId); + pMsg->threadId = 0; + err = MsgStoAddAddress(dbHandle, pMsg, &convId); if (err != MSG_SUCCESS) { - dbHandle.endTrans(false); + dbHandle->endTrans(false); return err; } } @@ -271,7 +371,7 @@ msg_error_t MsgStoUpdateMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S // Get File Data if (pMsg->bTextSms == false) { if (MsgOpenAndReadFile(pMsg->msgData, &pFileData, &fileSize) == false) { - dbHandle.endTrans(false); + dbHandle->endTrans(false); return MSG_ERR_STORAGE_ERROR; } } @@ -309,48 +409,51 @@ msg_error_t MsgStoUpdateMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET CONV_ID = %d, FOLDER_ID = %d, STORAGE_ID = %d, MAIN_TYPE = %d, SUB_TYPE = %d, \ DISPLAY_TIME = %lu, DATA_SIZE = %d, NETWORK_STATUS = %d, READ_STATUS = %d, PROTECTED = %d, PRIORITY = %d, MSG_DIRECTION = %d, \ - BACKUP = %d, SUBJECT = ?, MSG_DATA = ?, THUMB_PATH = ?, MSG_TEXT = ? \ + BACKUP = %d, SUBJECT = ?, MSG_TEXT = ? \ WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, convId, pMsg->folderId, pMsg->storageId, pMsg->msgType.mainType, pMsg->msgType.subType, pMsg->displayTime, pMsg->dataSize, pMsg->networkStatus, pMsg->bRead, pMsg->bProtected, pMsg->priority, pMsg->direction, pMsg->bBackup, pMsg->msgId); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } - dbHandle.bindText(pMsg->subject, 1); - - dbHandle.bindText(pMsg->msgData, 2); - - dbHandle.bindText(pMsg->thumbPath, 3); + dbHandle->bindText(pMsg->subject, 1); if (pMsg->msgType.mainType == MSG_SMS_TYPE && pMsg->bTextSms == false) - dbHandle.bindText(pFileData, 4); + dbHandle->bindText(pFileData, 2); else - dbHandle.bindText(pMsg->msgText, 4); + dbHandle->bindText(pMsg->msgText, 2); MSG_DEBUG("%s", sqlQuery); - if (dbHandle.stepQuery() != MSG_ERR_DB_DONE) { - dbHandle.finalizeQuery(); - dbHandle.endTrans(false); + if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) { + dbHandle->finalizeQuery(); + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); if (pMsg->msgType.mainType == MSG_SMS_TYPE && pSendOptInfo != NULL) { if (pSendOptInfo->bSetting == true) { memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET \ - DELREP_REQ = %d, KEEP_COPY = %d, REPLY_PATH = %d \ - WHERE MSG_ID = %d;", - MSGFW_SMS_SENDOPT_TABLE_NAME, pSendOptInfo->bDeliverReq, - pSendOptInfo->bKeepCopy, pSendOptInfo->option.smsSendOptInfo.bReplyPath, pMsg->msgId); - - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET " + "DELREP_REQ = %d, " + "KEEP_COPY = %d, " + "REPLY_PATH = %d, " + "ENCODE_TYPE = %d " + "WHERE MSG_ID = %d;", + MSGFW_SMS_SENDOPT_TABLE_NAME, + pSendOptInfo->bDeliverReq, + pSendOptInfo->bKeepCopy, + pSendOptInfo->option.smsSendOptInfo.bReplyPath, + pMsg->encodeType, + pMsg->msgId); + + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } } @@ -360,7 +463,7 @@ msg_error_t MsgStoUpdateMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S err = plg->updateMessage(pMsg, pSendOptInfo, pFileData); if (err != MSG_SUCCESS) { - dbHandle.endTrans(false); + dbHandle->endTrans(false); return MSG_ERR_STORAGE_ERROR; } @@ -375,21 +478,21 @@ msg_error_t MsgStoUpdateMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S } } - err = MsgStoUpdateConversation(&dbHandle, convId); + err = MsgStoUpdateConversation(dbHandle, convId); if (err != MSG_SUCCESS) { - dbHandle.endTrans(false); + dbHandle->endTrans(false); return MSG_ERR_STORAGE_ERROR; } - err = MsgStoClearConversationTable(&dbHandle); + err = MsgStoClearConversationTable(dbHandle); if (err != MSG_SUCCESS) { - dbHandle.endTrans(false); + dbHandle->endTrans(false); return MSG_ERR_STORAGE_ERROR; } - dbHandle.endTrans(true); + dbHandle->endTrans(true); return MSG_SUCCESS; } @@ -401,30 +504,34 @@ msg_error_t MsgStoUpdateReadStatus(msg_message_id_t msgId, bool bRead) msg_storage_id_t storageId; - if (MsgStoSetReadStatus(&dbHandle, msgId, bRead) != MSG_SUCCESS) { + MsgDbHandler *dbHandle = getDbHandle(); + if (MsgStoSetReadStatus(dbHandle, msgId, bRead) != MSG_SUCCESS) { MSG_DEBUG("MsgStoSetReadStatus() Error"); return MSG_ERR_STORAGE_ERROR; } + MsgRefreshAllNotification(true, false, false); + // Get STORAGE_ID memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT STORAGE_ID FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgId); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_PREPARE; - if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { - storageId = dbHandle.columnInt(0); + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + storageId = dbHandle->columnInt(0); } else { - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_ERR_DB_STEP; } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); MSG_DEBUG("StorageId:[%d]", storageId); + // Update Read Status for SIM Msg if (storageId == MSG_STORAGE_SIM) { MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE); @@ -436,80 +543,100 @@ msg_error_t MsgStoUpdateReadStatus(msg_message_id_t msgId, bool bRead) // Get SIM Msg ID memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT SIM_ID FROM %s WHERE MSG_ID = %d;", + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT SIM_SLOT_ID, SIM_ID FROM %s WHERE MSG_ID = %d;", MSGFW_SIM_MSG_TABLE_NAME, msgId); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_PREPARE; msg_sim_id_t simId; + msg_sim_slot_id_t sim_idx; - while (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { - simId = dbHandle.columnInt(0); + while (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + sim_idx = dbHandle->columnInt(0); + simId = dbHandle->columnInt(1); - if (plg->setReadStatus(simId) != MSG_SUCCESS) { + if (plg->setReadStatus(sim_idx, simId) != MSG_SUCCESS) { MSG_DEBUG("Fail to Set Read Status for SIM SMS"); continue; } } - - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); } return MSG_SUCCESS; } -msg_error_t MsgStoUpdateThreadReadStatus(msg_thread_id_t threadId) +msg_error_t MsgStoUpdateThreadReadStatus(msg_thread_id_t threadId, msg_id_list_s *pMsgIdList) { MSG_BEGIN(); msg_error_t err = MSG_SUCCESS; - int rowCnt = 0; char sqlQuery[MAX_QUERY_LEN+1]; - // Get sim MSG_ID + /*** Get msg id list **/ + int rowCnt = 0; + int index = 1; + pMsgIdList->nCount = 0; + MsgDbHandler *dbHandle = getDbHandle(); + memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s A \ - WHERE CONV_ID = %d AND READ_STATUS = 0 AND STORAGE_ID = %d;", - MSGFW_MESSAGE_TABLE_NAME, threadId, MSG_STORAGE_SIM); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s " + "WHERE CONV_ID = %d AND READ_STATUS = 0 AND STORAGE_ID = %d AND FOLDER_ID < %d;", + MSGFW_MESSAGE_TABLE_NAME, + threadId, MSG_STORAGE_PHONE, MSG_SPAMBOX_ID); - rowCnt = 0; - err = dbHandle.getTable(sqlQuery, &rowCnt); + err = dbHandle->getTable(sqlQuery, &rowCnt); if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { - dbHandle.freeTable(); + MSG_DEBUG("Fail to getTable()."); + dbHandle->freeTable(); return err; } - for (int i = 1; i <= rowCnt; i++) { - MsgStoUpdateReadStatus(dbHandle.getColumnToInt(i), true); + if (rowCnt <= 0) { + dbHandle->freeTable(); + return MSG_SUCCESS; } - dbHandle.freeTable(); + pMsgIdList->nCount = rowCnt; + MSG_DEBUG("pMsgIdList->nCount [%d]", pMsgIdList->nCount); + + pMsgIdList->msgIdList = (msg_message_id_t *)new char[sizeof(msg_message_id_t) * rowCnt]; + + for (int i = 0; i < rowCnt; i++) + pMsgIdList->msgIdList[i] = dbHandle->getColumnToInt(index++); + + dbHandle->freeTable(); + /*** **/ // set read status + dbHandle->beginTrans(); memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET READ_STATUS = %d \ - WHERE CONV_ID = %d AND READ_STATUS = 0;", - MSGFW_MESSAGE_TABLE_NAME, 1, threadId); + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET READ_STATUS = %d " + "WHERE CONV_ID = %d AND READ_STATUS = 0 AND STORAGE_ID = %d AND FOLDER_ID < %d;", + MSGFW_MESSAGE_TABLE_NAME, 1, + threadId, MSG_STORAGE_PHONE, MSG_SPAMBOX_ID); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; + } - if (MsgStoUpdateConversation(&dbHandle, threadId) != MSG_SUCCESS) { + if (MsgStoUpdateConversation(dbHandle, threadId) != MSG_SUCCESS) { MSG_DEBUG("MsgStoUpdateConversation() Error"); + dbHandle->endTrans(false); return MSG_ERR_STORAGE_ERROR; } - if (g_idle_add(updateUnreadMsgCount, NULL) == 0) { - MSG_DEBUG("updateUnreadMsgCount() Error"); + dbHandle->endTrans(true); + if (g_idle_add(resetNotification, NULL) == 0) { + MSG_DEBUG("resetNotification() Error"); } - MsgRefreshNoti(false); - MSG_END(); return MSG_SUCCESS; @@ -519,12 +646,29 @@ msg_error_t MsgStoUpdateThreadReadStatus(msg_thread_id_t threadId) msg_error_t MsgStoUpdateProtectedStatus(msg_message_id_t msgId, bool bProtected) { char sqlQuery[MAX_QUERY_LEN+1]; + MsgDbHandler *dbHandle = getDbHandle(); memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET PROTECTED = %d WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, (int)bProtected, msgId); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_EXEC; + + return MSG_SUCCESS; +} + +msg_error_t MsgStoUpdateConversationTagType(msg_thread_id_t threadId, int tagType) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + MsgDbHandler *dbHandle = getDbHandle(); + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET TAG_TYPE = %d WHERE CONV_ID = %d;", + MSGFW_CONVERSATION_TABLE_NAME, (int)tagType, threadId); + MSG_DEBUG("Updated tag = %d and conv_id = %d", tagType,threadId); + + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_EXEC; return MSG_SUCCESS; @@ -540,13 +684,37 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) msg_error_t err = MSG_SUCCESS; char sqlQuery[MAX_QUERY_LEN+1]; + MsgDbHandler *dbHandle = getDbHandle(); + + // delete report notification + char tempAddr[MAX_ADDRESS_VAL_LEN+1]; + memset(tempAddr, 0x00, sizeof(tempAddr)); + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT B.ADDRESS_VAL FROM %s A, %s B WHERE A.CONV_ID = B.CONV_ID AND A.MSG_ID = %d;" + , MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, msgId); + + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle->stepQuery() != MSG_ERR_DB_ROW) { + dbHandle->finalizeQuery(); + return MSG_ERR_DB_DONE; + } + + snprintf(tempAddr, sizeof(tempAddr), "%s", dbHandle->columnText(0)); + + MSG_DEBUG("Updated address = %s", tempAddr); + + MsgDeleteReportNotification(tempAddr); + + dbHandle->finalizeQuery(); // Get SUB_TYPE, STORAGE_ID memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MAIN_TYPE, SUB_TYPE, FOLDER_ID, STORAGE_ID, READ_STATUS, CONV_ID \ + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MAIN_TYPE, SUB_TYPE, FOLDER_ID, STORAGE_ID, READ_STATUS, CONV_ID, SIM_INDEX \ FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgId); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { MSG_DEBUG("Query Failed [%s]", sqlQuery); return MSG_ERR_DB_PREPARE; } @@ -555,26 +723,28 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) msg_folder_id_t folderId; msg_storage_id_t storageId; msg_thread_id_t convId; + msg_sim_slot_id_t simIndex; bool bRead; - if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { - msgType.mainType = dbHandle.columnInt(0); - msgType.subType = dbHandle.columnInt(1); - folderId = dbHandle.columnInt(2); - storageId = dbHandle.columnInt(3); - bRead = dbHandle.columnInt(4); - convId = dbHandle.columnInt(5); + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + msgType.mainType = dbHandle->columnInt(0); + msgType.subType = dbHandle->columnInt(1); + folderId = dbHandle->columnInt(2); + storageId = dbHandle->columnInt(3); + bRead = dbHandle->columnInt(4); + convId = dbHandle->columnInt(5); + simIndex = dbHandle->columnInt(6); - MSG_DEBUG("Main Type:[%d] SubType:[%d] FolderId:[%d] StorageId:[%d] ConversationId:[%d]", msgType.mainType, msgType.subType, folderId, storageId, convId); + MSG_DEBUG("Main Type:[%d] SubType:[%d] FolderId:[%d] StorageId:[%d] ReadStatus:[%d] ConversationId:[%d], simIndex=[%d]", msgType.mainType, msgType.subType, folderId, storageId, bRead, convId, simIndex); } else { MSG_DEBUG("MsgStepQuery() Error [%s]", sqlQuery); - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_ERR_DB_STEP; } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE); @@ -584,49 +754,57 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) return MSG_ERR_NULL_POINTER; } - dbHandle.beginTrans(); + dbHandle->beginTrans(); // Check sim message if (storageId == MSG_STORAGE_SIM) { - // get sim message id - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT SIM_ID FROM %s WHERE MSG_ID = %d;", - MSGFW_SIM_MSG_TABLE_NAME, msgId); + msg_sim_id_t simMsgId; + msg_sim_slot_id_t sim_idx; + + while (true) { + // get sim message id + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT SIM_SLOT_ID, SIM_ID FROM %s WHERE MSG_ID = %d;", + MSGFW_SIM_MSG_TABLE_NAME, msgId); - MSG_DEBUG("sqlQuery is [%s]", sqlQuery); + MSG_DEBUG("sqlQuery is [%s]", sqlQuery); - msg_sim_id_t simMsgId; + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); + return MSG_ERR_DB_PREPARE; + } - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); - return MSG_ERR_DB_PREPARE; - } + if (dbHandle->stepQuery() != MSG_ERR_DB_ROW) { + break; + } - while (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { - simMsgId = dbHandle.columnInt(0); + sim_idx = dbHandle->columnInt(0); + simMsgId = dbHandle->columnInt(1); MSG_DEBUG("SIM Msg Id : [%d]", simMsgId); - err = plg->deleteSimMessage(simMsgId); + err = plg->deleteSimMessage(sim_idx, simMsgId); if (err != MSG_SUCCESS) { - dbHandle.finalizeQuery(); - dbHandle.endTrans(false); + dbHandle->finalizeQuery(); + dbHandle->endTrans(false); return err; } + dbHandle->finalizeQuery(); + //Sim message delete in db table memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE SIM_ID = %d;", MSGFW_SIM_MSG_TABLE_NAME, simMsgId); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE SIM_ID = %d AND SIM_SLOT_ID =%d;", MSGFW_SIM_MSG_TABLE_NAME, simMsgId, sim_idx); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.finalizeQuery(); - dbHandle.endTrans(false); + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->finalizeQuery(); + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); } /* each type has to be handled in plug in ? */ @@ -636,8 +814,18 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) MSGFW_SMS_SENDOPT_TABLE_NAME, msgId); // Delete SMS Send Option - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); + return MSG_ERR_DB_EXEC; + } + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", + MSGFW_SMS_REPORT_TABLE_NAME, msgId); + + // Delete Data from SMS_REPORT table + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } @@ -647,8 +835,8 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) MSGFW_CB_MSG_TABLE_NAME, msgId); // Delete Push Message from push table - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } } else if (msgType.subType >= MSG_WAP_SI_SMS && msgType.subType <= MSG_WAP_CO_SMS) { @@ -657,8 +845,8 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) MSGFW_PUSH_MSG_TABLE_NAME, msgId); // Delete Push Message from push table - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } } else if (msgType.subType == MSG_SYNCML_CP) { @@ -667,34 +855,66 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) MSGFW_SYNCML_MSG_TABLE_NAME, msgId); // Delete SyncML Message from syncML table - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } } } else if (msgType.mainType == MSG_MMS_TYPE) { - char filePath[MSG_FILEPATH_LEN_MAX+1] = {0,}; - char dirPath[MSG_FILEPATH_LEN_MAX+1]= {0,}; + char filePath[MSG_FILEPATH_LEN_MAX + 1] = {0,}; + char dirPath[MSG_FILEPATH_LEN_MAX + 1]= {0,}; + + {//remove multipart + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILE_PATH FROM %s WHERE MSG_ID = %d;", + MSGFW_MMS_MULTIPART_TABLE_NAME, msgId); + + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); + return MSG_ERR_DB_PREPARE; + } + + while (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + memset(filePath, 0x00, sizeof(filePath)); + strncpy(filePath, (char *)dbHandle->columnText(0), MSG_FILEPATH_LEN_MAX); + if (remove(filePath) == -1) + MSG_SEC_DEBUG("Fail to delete file [%s]", filePath); + else + MSG_SEC_DEBUG("Success to delete file [%s]", filePath); + } + dbHandle->finalizeQuery(); + + // Delete Data from Multipart table + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", + MSGFW_MMS_MULTIPART_TABLE_NAME, msgId); + + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); + return MSG_ERR_DB_EXEC; + } + } + memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILE_PATH FROM %s WHERE MSG_ID = %d;", MMS_PLUGIN_MESSAGE_TABLE_NAME, msgId); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_PREPARE; } - if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { - strncpy(filePath, (char *)dbHandle.columnText(0), MSG_FILEPATH_LEN_MAX); + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + strncpy(filePath, (char *)dbHandle->columnText(0), MSG_FILEPATH_LEN_MAX); snprintf(dirPath, MSG_FILEPATH_LEN_MAX, "%s.dir", filePath); if (remove(filePath) == -1) - MSG_DEBUG("Fail to delete file [%s]", filePath); + MSG_SEC_DEBUG("Fail to delete file [%s]", filePath); else - MSG_DEBUG("Success to delete file [%s]", filePath); + MSG_SEC_DEBUG("Success to delete file [%s]", filePath); MsgRmRf(dirPath); @@ -702,12 +922,12 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) } else { MSG_DEBUG("MsgStepQuery() Error [%s]", sqlQuery); - dbHandle.finalizeQuery(); - dbHandle.endTrans(false); + dbHandle->finalizeQuery(); + dbHandle->endTrans(false); return MSG_ERR_DB_STEP; } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); // remove thumbnail file memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -716,28 +936,28 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) "WHERE MSG_ID = %d AND (TYPE=%d OR TYPE=%d);", MSGFW_MMS_PREVIEW_TABLE_NAME, msgId, MSG_MMS_ITEM_TYPE_IMG, MSG_MMS_ITEM_TYPE_VIDEO); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_PREPARE; } - while (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + while (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { memset(filePath, 0x00, sizeof(filePath)); - strncpy(filePath, (char *)dbHandle.columnText(0), MSG_FILEPATH_LEN_MAX); + strncpy(filePath, (char *)dbHandle->columnText(0), MSG_FILEPATH_LEN_MAX); if (remove(filePath) == -1) - MSG_DEBUG("Fail to delete file [%s]", filePath); + MSG_SEC_DEBUG("Fail to delete file [%s]", filePath); else - MSG_DEBUG("Success to delete file [%s]", filePath); + MSG_SEC_DEBUG("Success to delete file [%s]", filePath); } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_MMS_PREVIEW_TABLE_NAME, msgId); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } @@ -746,8 +966,8 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) MMS_PLUGIN_MESSAGE_TABLE_NAME, msgId); // Delete Data from MMS table - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } @@ -756,8 +976,8 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) MSGFW_REPORT_TABLE_NAME, msgId); // Delete Data from MMS STATUS table - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } } @@ -766,49 +986,40 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgId); // Delete Message from msg table - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } if (convId > 0) { // Clear Conversation table - if (MsgStoClearConversationTable(&dbHandle) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (MsgStoClearConversationTable(dbHandle) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } // Update conversation table. - if (MsgStoUpdateConversation(&dbHandle, convId) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (MsgStoUpdateConversation(dbHandle, convId) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_STORAGE_ERROR; } } - dbHandle.endTrans(true); + dbHandle->endTrans(true); if (msgType.mainType == MSG_SMS_TYPE && folderId == MSG_INBOX_ID) { msgType.classType = MSG_CLASS_NONE; // Set memory status in SIM - if (MsgStoCheckMsgCntFull(&dbHandle, &msgType, folderId) == MSG_SUCCESS) { + if (MsgStoCheckMsgCntFull(dbHandle, &msgType, folderId, simIndex) == MSG_SUCCESS) { MSG_DEBUG("Set Memory Status"); - plg->setMemoryStatus(MSG_SUCCESS); + plg->setMemoryStatus(simIndex, MSG_SUCCESS); } } if (bCheckIndication == true) { MSG_DEBUG("bCheckIndication is true."); - - int smsCnt = 0; - int mmsCnt = 0; - - smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE); - mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE); - - MsgSettingSetIndicator(smsCnt, mmsCnt); - - MsgRefreshNoti(false); + MsgRefreshAllNotification(true, false, false); } return MSG_SUCCESS; @@ -830,6 +1041,7 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD int listCnt = sizeof(tableList)/sizeof(char *); int rowCnt = 0; + MsgDbHandler *dbHandle = getDbHandle(); // Get conversation ID from Folder memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -837,27 +1049,25 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DISTINCT(CONV_ID) FROM %s WHERE FOLDER_ID = %d", MSGFW_MESSAGE_TABLE_NAME, folderId); - err = dbHandle.getTable(sqlQuery, &rowCnt); + err = dbHandle->getTable(sqlQuery, &rowCnt); if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { - MSG_DEBUG("sql query is %s.", sqlQuery); - - dbHandle.freeTable(); + MSG_DEBUG("Fail to getTable()."); + dbHandle->freeTable(); return err; } if (rowCnt <= 0) { - dbHandle.freeTable(); - + dbHandle->freeTable(); return MSG_SUCCESS; } for (int i = 1; i <= rowCnt; i++) { - MSG_DEBUG("thread ID : %d", dbHandle.getColumnToInt(i)); - threadList.push((msg_thread_id_t)dbHandle.getColumnToInt(i)); + MSG_DEBUG("thread ID : %d", dbHandle->getColumnToInt(i)); + threadList.push((msg_thread_id_t)dbHandle->getColumnToInt(i)); } - dbHandle.freeTable(); + dbHandle->freeTable(); /*** Get msg id list **/ msg_id_list_s *pToDeleteMsgIdList = NULL; @@ -875,18 +1085,16 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD rowCnt = 0; int index = 1; - err = dbHandle.getTable(sqlQuery, &rowCnt); + err = dbHandle->getTable(sqlQuery, &rowCnt); if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { - MSG_DEBUG("sqlQuery [%s]", sqlQuery); - - dbHandle.freeTable(); - + MSG_DEBUG("Fail to getTable()."); + dbHandle->freeTable(); goto FREE_MEMORY; } if (rowCnt <= 0) { - dbHandle.freeTable(); + dbHandle->freeTable(); err = MSG_SUCCESS; goto FREE_MEMORY; @@ -899,9 +1107,9 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD pToDeleteMsgIdList->msgIdList = (msg_message_id_t *)new char[sizeof(msg_message_id_t) * rowCnt]; for (int i = 0; i < rowCnt; i++) - pToDeleteMsgIdList->msgIdList[i] = dbHandle.getColumnToInt(index++); + pToDeleteMsgIdList->msgIdList[i] = dbHandle->getColumnToInt(index++); - dbHandle.freeTable(); + dbHandle->freeTable(); /*** **/ /*** Delete Sim Message In Folder **/ @@ -911,37 +1119,33 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE FOLDER_ID = %d AND STORAGE_ID = %d", MSGFW_MESSAGE_TABLE_NAME, folderId, MSG_STORAGE_SIM); - MSG_DEBUG("sql query is %s.", sqlQuery); - rowCnt = 0; - err = dbHandle.getTable(sqlQuery, &rowCnt); - + err = dbHandle->getTable(sqlQuery, &rowCnt); if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { - dbHandle.freeTable(); - + dbHandle->freeTable(); goto FREE_MEMORY; } for (int i = 1; i <= rowCnt; i++) { - err = MsgStoDeleteMessage(dbHandle.getColumnToInt(i), false); + err = MsgStoDeleteMessage(dbHandle->getColumnToInt(i), false); if (err != MSG_SUCCESS) { MSG_DEBUG("MsgStoDeleteMessage() Error!!!"); - dbHandle.freeTable(); + dbHandle->freeTable(); goto FREE_MEMORY; } //Delete phone log -// MsgDeletePhoneLog(dbHandle.getColumnToInt(i)); +// MsgDeletePhoneLog(dbHandle->getColumnToInt(i)); } - dbHandle.freeTable(); + dbHandle->freeTable(); } - dbHandle.beginTrans(); + dbHandle->beginTrans(); for (int i = 0; i < listCnt; i++) { if (!strcmp(tableList[i], MMS_PLUGIN_MESSAGE_TABLE_NAME)) { @@ -951,22 +1155,51 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD char filePath[MSG_FILEPATH_LEN_MAX] = {0,}; char dirPath[MSG_FILEPATH_LEN_MAX] = {0,}; + {//remove multipart + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILE_PATH FROM %s;", + MSGFW_MMS_MULTIPART_TABLE_NAME); + + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); + return MSG_ERR_DB_PREPARE; + } + + while (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + memset(filePath, 0x00, sizeof(filePath)); + strncpy(filePath, (char *)dbHandle->columnText(0), MSG_FILEPATH_LEN_MAX); + if (remove(filePath) == -1) + MSG_SEC_DEBUG("Fail to delete file [%s]", filePath); + else + MSG_SEC_DEBUG("Success to delete file [%s]", filePath); + } + dbHandle->finalizeQuery(); + + // Delete Data from Multipart table + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s;", + MSGFW_MMS_MULTIPART_TABLE_NAME); + + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + err = MSG_ERR_DB_EXEC; + goto FREE_MEMORY; + } + } + //get mms msg id list memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT B.FILE_PATH FROM %s A, %s B \ WHERE A.FOLDER_ID = %d AND A.MAIN_TYPE = %d AND A.MSG_ID = B.MSG_ID", MSGFW_MESSAGE_TABLE_NAME, MMS_PLUGIN_MESSAGE_TABLE_NAME, folderId, MSG_MMS_TYPE); - MSG_DEBUG("sqlQuery [%s]", sqlQuery); - - err = dbHandle.getTable(sqlQuery, &rowCnt); + err = dbHandle->getTable(sqlQuery, &rowCnt); MSG_DEBUG("rowCnt %d", rowCnt); if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { - MSG_DEBUG("sqlQuery [%s]", sqlQuery); + MSG_DEBUG("Fail to getTable()."); - dbHandle.freeTable(); - dbHandle.endTrans(false); + dbHandle->freeTable(); + dbHandle->endTrans(false); goto FREE_MEMORY; } @@ -974,17 +1207,17 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD for (int i = 1; i <= rowCnt; i++) { memset(filePath, 0x00, sizeof(filePath)); - dbHandle.getColumnToString(i, MSG_FILEPATH_LEN_MAX, filePath); + dbHandle->getColumnToString(i, MSG_FILEPATH_LEN_MAX, filePath); - MSG_DEBUG("filePath [%s]", filePath); + MSG_SEC_DEBUG("filePath [%s]", filePath); //delete raw file snprintf(dirPath, sizeof(dirPath), "%s.dir", filePath); if (remove(filePath) == -1) - MSG_DEBUG("Fail to delete file [%s]", filePath); + MSG_SEC_DEBUG("Fail to delete file [%s]", filePath); else - MSG_DEBUG("Success to delete file [%s]", filePath); + MSG_SEC_DEBUG("Success to delete file [%s]", filePath); MsgRmRf(dirPath); @@ -992,7 +1225,7 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD } - dbHandle.freeTable(); + dbHandle->freeTable(); } // delete thumbnail @@ -1004,21 +1237,21 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD "AND (MSG_ID IN (SELECT MSG_ID FROM %s WHERE FOLDER_ID = %d));", MSGFW_MMS_PREVIEW_TABLE_NAME, MSG_MMS_ITEM_TYPE_IMG, MSG_MMS_ITEM_TYPE_VIDEO, MSGFW_MESSAGE_TABLE_NAME, folderId); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_PREPARE; } - while (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + while (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { memset(filePath, 0x00, sizeof(filePath)); - strncpy(filePath, (char *)dbHandle.columnText(0), MSG_FILEPATH_LEN_MAX); + strncpy(filePath, (char *)dbHandle->columnText(0), MSG_FILEPATH_LEN_MAX); if (remove(filePath) == -1) - MSG_DEBUG("Fail to delete file [%s]", filePath); + MSG_SEC_DEBUG("Fail to delete file [%s]", filePath); else - MSG_DEBUG("Success to delete file [%s]", filePath); + MSG_SEC_DEBUG("Success to delete file [%s]", filePath); } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -1027,9 +1260,9 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD tableList[i], MSGFW_MESSAGE_TABLE_NAME, folderId); // Delete Message in specific folder from table - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { MSG_DEBUG("sqlQuery [%s]", sqlQuery); - dbHandle.endTrans(false); + dbHandle->endTrans(false); err = MSG_ERR_DB_EXEC; goto FREE_MEMORY; @@ -1037,8 +1270,8 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD } // Clear Conversation table - if (MsgStoClearConversationTable(&dbHandle) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (MsgStoClearConversationTable(dbHandle) != MSG_SUCCESS) { + dbHandle->endTrans(false); err = MSG_ERR_DB_EXEC; goto FREE_MEMORY; @@ -1046,28 +1279,18 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD // Update Address while (!threadList.empty()) { - err = MsgStoUpdateConversation(&dbHandle, threadList.front()); + err = MsgStoUpdateConversation(dbHandle, threadList.front()); threadList.pop(); if (err != MSG_SUCCESS) { - dbHandle.endTrans(false); + dbHandle->endTrans(false); goto FREE_MEMORY; } } - dbHandle.endTrans(true); - - if (folderId == MSG_INBOX_ID) { - int smsCnt = 0; - int mmsCnt = 0; - - smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE); - mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE); - - MsgSettingSetIndicator(smsCnt, mmsCnt); - } + dbHandle->endTrans(true); /*** Set pMsgIdList **/ if (pMsgIdList != NULL && pToDeleteMsgIdList->nCount > 0) { @@ -1094,7 +1317,7 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD // err = MSG_ERR_UNKNOWN; // } - MsgRefreshNoti(false); + MsgRefreshAllNotification(true, false, false); } } /*** **/ @@ -1125,6 +1348,8 @@ FREE_MEMORY: msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList) { + std::string q; + MSG_BEGIN(); msg_error_t err = MSG_SUCCESS; @@ -1133,110 +1358,145 @@ msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList) return err; } - MSG_DEBUG("pMsgIdList->nCount [%d]", pMsgIdList->nCount); - char sqlQuery[MAX_QUERY_LEN+1]; - queue threadList; + queue threadList1, threadList2; - const char *tableList[] = {MSGFW_PUSH_MSG_TABLE_NAME, MSGFW_CB_MSG_TABLE_NAME, + const char *tableList[] = {MMS_PLUGIN_MESSAGE_TABLE_NAME, MSGFW_MMS_PREVIEW_TABLE_NAME, + MSGFW_PUSH_MSG_TABLE_NAME, MSGFW_CB_MSG_TABLE_NAME, MSGFW_SYNCML_MSG_TABLE_NAME, MSGFW_SMS_SENDOPT_TABLE_NAME, - MSGFW_MMS_PREVIEW_TABLE_NAME, MSGFW_REPORT_TABLE_NAME, - MMS_PLUGIN_MESSAGE_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME}; + MSGFW_REPORT_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, + MSGFW_SMS_REPORT_TABLE_NAME, MSGFW_MMS_MULTIPART_TABLE_NAME}; int listCnt = sizeof(tableList)/sizeof(char *); int rowCnt = 0; + MsgDbHandler *dbHandle = getDbHandle(); - // Clear tmp table + dbHandle->beginTrans(); + // reset msgid temp table memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s;", MSGFW_TMP_MSGID_TABLE_NAME); - err = dbHandle.execQuery(sqlQuery); - if (err != MSG_SUCCESS) { - MSG_DEBUG("Fail to execQuery()."); - return err; + MSG_DEBUG("[%s]", sqlQuery); + + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_EXEC; + + if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) { + dbHandle->finalizeQuery(); + return MSG_ERR_DB_EXEC; } - // Insert tmp msg ids to delete. - dbHandle.beginTrans(); - for (int i = 0; i < pMsgIdList->nCount; i++) - { - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d);", - MSGFW_TMP_MSGID_TABLE_NAME, pMsgIdList->msgIdList[i]); - err = dbHandle.execQuery(sqlQuery); - if (err != MSG_SUCCESS) MSG_DEBUG("Fail to execQuery()."); + + dbHandle->finalizeQuery(); + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (?)", MSGFW_TMP_MSGID_TABLE_NAME); + MSG_DEBUG("[%s]", sqlQuery); + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); + return MSG_ERR_DB_PREPARE; } - err = dbHandle.endTrans(true); - if (err != MSG_SUCCESS) { - MSG_DEBUG("Fail to endTrans(true)."); - dbHandle.endTrans(false); - return err; + + for (int i = 0; i < pMsgIdList->nCount; i++) { + dbHandle->resetQuery(); + dbHandle->bindInt(pMsgIdList->msgIdList[i], 1); + if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) { + dbHandle->finalizeQuery(); + dbHandle->endTrans(false); + return MSG_ERR_DB_EXEC; + } } - // Get conversation ID from Folder + dbHandle->finalizeQuery(); + dbHandle->endTrans(true); + memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DISTINCT(CONV_ID) FROM %s WHERE MSG_ID IN (SELECT MSG_ID FROM %s);", - MSGFW_MESSAGE_TABLE_NAME, MSGFW_TMP_MSGID_TABLE_NAME); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DISTINCT(CONV_ID) FROM %s WHERE MSG_ID IN %s;", MSGFW_MESSAGE_TABLE_NAME, MSGFW_TMP_MSGID_TABLE_NAME); - err = dbHandle.getTable(sqlQuery, &rowCnt); + err = dbHandle->getTable(sqlQuery, &rowCnt); if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { MSG_DEBUG("Fail to getTable()."); - dbHandle.freeTable(); + dbHandle->freeTable(); return err; } MSG_DEBUG("rowCnt [%d]", rowCnt); if (rowCnt < 1) { - dbHandle.freeTable(); + dbHandle->freeTable(); return MSG_SUCCESS; } for (int i = 1; i <= rowCnt; i++) { - MSG_DEBUG("thread ID : %d", dbHandle.getColumnToInt(i)); - threadList.push((msg_thread_id_t)dbHandle.getColumnToInt(i)); + MSG_DEBUG("thread ID : %d", dbHandle->getColumnToInt(i)); + threadList1.push((msg_thread_id_t)dbHandle->getColumnToInt(i)); + threadList2.push((msg_thread_id_t)dbHandle->getColumnToInt(i)); } - dbHandle.freeTable(); + dbHandle->freeTable(); + + // delete report notification + char tempAddr[MAX_ADDRESS_VAL_LEN+1]; + while (!threadList1.empty()) { + memset(tempAddr, 0x00, sizeof(tempAddr)); + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT B.ADDRESS_VAL FROM %s A, %s B WHERE A.CONV_ID = B.CONV_ID AND A.CONV_ID = %d;" + , MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, threadList1.front()); + + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle->stepQuery() != MSG_ERR_DB_ROW) { + dbHandle->finalizeQuery(); + return MSG_ERR_DB_DONE; + } + + snprintf(tempAddr, sizeof(tempAddr), "%s", dbHandle->columnText(0)); + + MSG_DEBUG("Updated address = %s", tempAddr); + + MsgDeleteReportNotification(tempAddr); + + dbHandle->finalizeQuery(); + + threadList1.pop(); + } + - /*** Delete Sim Message In Folder **/ memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE STORAGE_ID = %d AND MSG_ID IN (SELECT MSG_ID FROM %s);", + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE STORAGE_ID = %d AND MSG_ID IN %s;", MSGFW_MESSAGE_TABLE_NAME, MSG_STORAGE_SIM, MSGFW_TMP_MSGID_TABLE_NAME); rowCnt = 0; - - err = dbHandle.getTable(sqlQuery, &rowCnt); + err = dbHandle->getTable(sqlQuery, &rowCnt); if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { MSG_DEBUG("Fail to getTable()."); - dbHandle.freeTable(); + dbHandle->freeTable(); rowCnt = 0; } for (int i = 1; i <= rowCnt; i++) { - err = MsgStoDeleteMessage(dbHandle.getColumnToInt(i), false); + err = MsgStoDeleteMessage(dbHandle->getColumnToInt(i), false); if (err != MSG_SUCCESS) { MSG_DEBUG("MsgStoDeleteMessage() Error!!!"); } } - dbHandle.freeTable(); + dbHandle->freeTable(); /*** **/ - dbHandle.beginTrans(); + dbHandle->beginTrans(); for (int i = 0; i < listCnt; i++) { - if (!strcmp(tableList[i], MMS_PLUGIN_MESSAGE_TABLE_NAME)) { + if ( !i ) { char filePath[MSG_FILEPATH_LEN_MAX]; char dirPath[MSG_FILEPATH_LEN_MAX]; rowCnt = 0; - // MMS file path to delete. memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILE_PATH FROM %s WHERE MSG_ID IN (SELECT MSG_ID FROM %s);", - MMS_PLUGIN_MESSAGE_TABLE_NAME, MSGFW_TMP_MSGID_TABLE_NAME); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILE_PATH FROM %s WHERE MSG_ID IN %s;", MMS_PLUGIN_MESSAGE_TABLE_NAME, MSGFW_TMP_MSGID_TABLE_NAME); - err = dbHandle.getTable(sqlQuery, &rowCnt); + err = dbHandle->getTable(sqlQuery, &rowCnt); if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { MSG_DEBUG("Fail to getTable()."); @@ -1246,42 +1506,35 @@ msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList) MSG_DEBUG("rowCnt %d", rowCnt); for (int i = 1; i <= rowCnt; i++) { - memset(filePath, 0x00, sizeof(filePath)); - memset(dirPath, 0x00, sizeof(dirPath)); - dbHandle.getColumnToString(i, MSG_FILEPATH_LEN_MAX, filePath); + dbHandle->getColumnToString(i, MSG_FILEPATH_LEN_MAX, filePath); - MSG_DEBUG("filePath [%s]", filePath); + MSG_SEC_DEBUG("filePath [%s]", filePath); // Delete raw file. snprintf(dirPath, sizeof(dirPath), "%s.dir", filePath); if (remove(filePath) == -1) - MSG_DEBUG("Fail to delete file [%s]", filePath); + MSG_SEC_DEBUG("Fail to delete file [%s]", filePath); else - MSG_DEBUG("Success to delete file [%s]", filePath); + MSG_SEC_DEBUG("Success to delete file [%s]", filePath); MsgRmRf(dirPath); rmdir(dirPath); } - dbHandle.freeTable(); + dbHandle->freeTable(); - } else if (!strcmp(tableList[i], MSGFW_MMS_PREVIEW_TABLE_NAME)) { + } else if (i == 1) { char filePath[MSG_FILEPATH_LEN_MAX] = {0,}; rowCnt = 0; memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), - "SELECT VALUE FROM %s " - "WHERE (TYPE=%d OR TYPE=%d) " - "AND MSG_ID IN (SELECT MSG_ID FROM %s);", - MSGFW_MMS_PREVIEW_TABLE_NAME, - MSG_MMS_ITEM_TYPE_IMG, MSG_MMS_ITEM_TYPE_VIDEO, - MSGFW_TMP_MSGID_TABLE_NAME); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT VALUE FROM %s WHERE (TYPE = %d OR TYPE = %d) AND MSG_ID IN %s;", + MSGFW_MMS_PREVIEW_TABLE_NAME, MSG_MMS_ITEM_TYPE_IMG, MSG_MMS_ITEM_TYPE_VIDEO, MSGFW_TMP_MSGID_TABLE_NAME); - err = dbHandle.getTable(sqlQuery, &rowCnt); + err = dbHandle->getTable(sqlQuery, &rowCnt); if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { MSG_DEBUG("Fail to getTable()."); @@ -1292,58 +1545,100 @@ msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList) for (int i = 1; i <= rowCnt; i++) { memset(filePath, 0x00, sizeof(filePath)); - dbHandle.getColumnToString(i, MSG_FILEPATH_LEN_MAX, filePath); + dbHandle->getColumnToString(i, MSG_FILEPATH_LEN_MAX, filePath); if (remove(filePath) == -1) - MSG_DEBUG("Fail to delete file [%s]", filePath); + MSG_SEC_DEBUG("Fail to delete file [%s]", filePath); else - MSG_DEBUG("Success to delete file [%s]", filePath); + MSG_SEC_DEBUG("Success to delete file [%s]", filePath); } - dbHandle.freeTable(); + dbHandle->freeTable(); + } else if (!strcmp(tableList[i], MSGFW_MMS_MULTIPART_TABLE_NAME)) { + // MMS file path to delete. + char filePath[MSG_FILEPATH_LEN_MAX] = {0,}; + + rowCnt = 0; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILE_PATH FROM %s WHERE MSG_ID IN %s;", MSGFW_MMS_MULTIPART_TABLE_NAME, MSGFW_TMP_MSGID_TABLE_NAME); + + err = dbHandle->getTable(sqlQuery, &rowCnt); + + if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { + MSG_DEBUG("Fail to getTable()."); + rowCnt = 0; + } + + MSG_DEBUG("rowCnt %d", rowCnt); + + for (int i = 1; i <= rowCnt; i++) { + memset(filePath, 0x00, sizeof(filePath)); + dbHandle->getColumnToString(i, MSG_FILEPATH_LEN_MAX, filePath); + if (filePath[0] != '\0') { + if (remove(filePath) == -1) + MSG_SEC_DEBUG("Fail to delete file [%s]", filePath); + else + MSG_SEC_DEBUG("Success to delete file [%s]", filePath); + } + } + dbHandle->freeTable(); + + // MMS thumbnail path to delete + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT THUMB_FILE_PATH FROM %s WHERE MSG_ID IN %s;", MSGFW_MMS_MULTIPART_TABLE_NAME, MSGFW_TMP_MSGID_TABLE_NAME); + + err = dbHandle->getTable(sqlQuery, &rowCnt); + + if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { + MSG_DEBUG("Fail to getTable()."); + rowCnt = 0; + } + + MSG_DEBUG("rowCnt %d", rowCnt); + + for (int i = 1; i <= rowCnt; i++) { + memset(filePath, 0x00, sizeof(filePath)); + dbHandle->getColumnToString(i, MSG_FILEPATH_LEN_MAX, filePath); + if (filePath[0] != '\0') { + if (remove(filePath) == -1) + MSG_SEC_DEBUG("Fail to delete file [%s]", filePath); + else + MSG_SEC_DEBUG("Success to delete file [%s]", filePath); + } + } + + dbHandle->freeTable(); } memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID IN (SELECT MSG_ID FROM %s);", - tableList[i], MSGFW_TMP_MSGID_TABLE_NAME); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID IN %s;", tableList[i], MSGFW_TMP_MSGID_TABLE_NAME); // Delete Message in specific folder from table - err = dbHandle.execQuery(sqlQuery); + err = dbHandle->execQuery(sqlQuery); if (err != MSG_SUCCESS) { MSG_DEBUG("Fail to execQuery()."); } } // Clear Conversation table - err = MsgStoClearConversationTable(&dbHandle); + err = MsgStoClearConversationTable(dbHandle); if (err != MSG_SUCCESS) MSG_DEBUG("Fail to MsgStoClearConversationTable()."); // Update Address - while (!threadList.empty()) { - err = MsgStoUpdateConversation(&dbHandle, threadList.front()); + while (!threadList2.empty()) { + err = MsgStoUpdateConversation(dbHandle, threadList2.front()); if (err != MSG_SUCCESS) MSG_DEBUG("Fail to MsgStoUpdateConversation()."); - threadList.pop(); + threadList2.pop(); } - err = dbHandle.endTrans(true); + err = dbHandle->endTrans(true); if (err != MSG_SUCCESS) { MSG_DEBUG("Fail to endTrans(true)."); - dbHandle.endTrans(false); + dbHandle->endTrans(false); return err; } - int smsCnt = 0; - int mmsCnt = 0; - - smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE); - mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE); - - MsgSettingSetIndicator(smsCnt, mmsCnt); - - MsgRefreshNoti(false); - - // Clear tmp table - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s;", MSGFW_TMP_MSGID_TABLE_NAME); - err = dbHandle.execQuery(sqlQuery); - if (err != MSG_SUCCESS) MSG_DEBUG("Fail to execQuery()."); + if (g_idle_add(resetNotification, NULL) == 0) { + MSG_DEBUG("resetNotification() Error"); + } MSG_END(); return MSG_SUCCESS; @@ -1359,6 +1654,7 @@ msg_error_t MsgStoMoveMessageToFolder(msg_message_id_t msgId, msg_folder_id_t de MsgStoGetMsgType(msgId, &msgType); char sqlQuery[MAX_QUERY_LEN+1]; + MsgDbHandler *dbHandle = getDbHandle(); memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -1367,7 +1663,7 @@ msg_error_t MsgStoMoveMessageToFolder(msg_message_id_t msgId, msg_folder_id_t de else snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET FOLDER_ID = %d WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, destFolderId, msgId); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_EXEC; /* get conversation id */ @@ -1376,31 +1672,21 @@ msg_error_t MsgStoMoveMessageToFolder(msg_message_id_t msgId, msg_folder_id_t de snprintf(sqlQuery, sizeof(sqlQuery), "SELECT CONV_ID FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgId); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_PREPARE; - if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) - convId = dbHandle.columnInt(0); + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) + convId = dbHandle->columnInt(0); MSG_DEBUG("convId : %d", convId); - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); /* update conversation table */ - err = MsgStoUpdateConversation(&dbHandle, convId); + err = MsgStoUpdateConversation(dbHandle, convId); - - if (destFolderId == MSG_INBOX_ID) { - int smsCnt = 0; - int mmsCnt = 0; - - smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE); - mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE); - - MsgSettingSetIndicator(smsCnt, mmsCnt); - - MsgRefreshNoti(false); - } + /* update notification */ + MsgRefreshAllNotification(true, false, false); return err; } @@ -1413,11 +1699,13 @@ msg_error_t MsgStoMoveMessageToStorage(msg_message_id_t msgId, msg_storage_id_t msg_error_t err = MSG_SUCCESS; char sqlQuery[MAX_QUERY_LEN+1]; + MsgDbHandler *dbHandle = getDbHandle(); MSG_DEBUG("msgId : %d, destStorageId : %d", msgId, destStorageId); switch (destStorageId) { case MSG_STORAGE_SIM : // Move message to sim card + case MSG_STORAGE_SIM2 : { MSG_MESSAGE_INFO_S msgInfo; SMS_SIM_ID_LIST_S simIdList; @@ -1430,32 +1718,39 @@ msg_error_t MsgStoMoveMessageToStorage(msg_message_id_t msgId, msg_storage_id_t MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE); + if (destStorageId == MSG_STORAGE_SIM) + msgInfo.sim_idx = 1; + else if (destStorageId == MSG_STORAGE_SIM2) + msgInfo.sim_idx = 2; + if ((err = plg->saveSimMessage(&msgInfo, &simIdList)) != MSG_SUCCESS) return err; - dbHandle.beginTrans(); + dbHandle->beginTrans(); memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET STORAGE_ID = %d WHERE MSG_ID = %d;", - MSGFW_MESSAGE_TABLE_NAME, destStorageId, msgId); + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET STORAGE_ID = %d, SIM_INDEX = %d WHERE MSG_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, MSG_STORAGE_SIM, msgInfo.sim_idx, msgId); + MSG_DEBUG("SQL query=[%s]", sqlQuery); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } for (unsigned int i = 0; i < simIdList.count; i++) { memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d);", - MSGFW_SIM_MSG_TABLE_NAME, msgId, simIdList.simId[i]); + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d);", + MSGFW_SIM_MSG_TABLE_NAME, msgInfo.sim_idx, simIdList.simId[i], msgId); + MSG_DEBUG("SQL query=[%s]", sqlQuery); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } } - dbHandle.endTrans(true); + dbHandle->endTrans(true); } break; @@ -1468,65 +1763,67 @@ msg_error_t MsgStoMoveMessageToStorage(msg_message_id_t msgId, msg_storage_id_t snprintf(sqlQuery, sizeof(sqlQuery), "SELECT STORAGE_ID FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgId); - err = dbHandle.getTable(sqlQuery, &rowCnt); + err = dbHandle->getTable(sqlQuery, &rowCnt); if (err != MSG_SUCCESS) { - dbHandle.freeTable(); + MSG_DEBUG("Fail to getTable()."); + dbHandle->freeTable(); return err; } - if (dbHandle.getColumnToInt(1) == MSG_STORAGE_SIM) { + if (dbHandle->getColumnToInt(1) == MSG_STORAGE_SIM) { MSG_DEBUG("It is SIM Message"); bSimMsg = true; } - dbHandle.freeTable(); + dbHandle->freeTable(); if (bSimMsg == true) { msg_sim_id_t simMsgId; + msg_sim_slot_id_t sim_idx; // get sim message id memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT SIM_ID FROM %s WHERE MSG_ID = %d;", + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT SIM_SLOT_ID, SIM_ID FROM %s WHERE MSG_ID = %d;", MSGFW_SIM_MSG_TABLE_NAME, msgId); - MSG_DEBUG("sqlQuery is %s.", sqlQuery); - - err = dbHandle.getTable(sqlQuery, &rowCnt); + err = dbHandle->getTable(sqlQuery, &rowCnt); if (err != MSG_SUCCESS) { - dbHandle.freeTable(); + MSG_DEBUG("Fail to getTable()."); + dbHandle->freeTable(); return err; } //Delete messages in sim card MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE); + int index = 2; for (int i = 0; i < rowCnt; i++) { - simMsgId = dbHandle.getColumnToInt(i+1); + sim_idx = dbHandle->getColumnToInt(index++); + simMsgId = dbHandle->getColumnToInt(index++); MSG_DEBUG("simMsgId is %d.", simMsgId); - if ((err = plg->deleteSimMessage(simMsgId)) != MSG_SUCCESS) { - dbHandle.freeTable(); + if ((err = plg->deleteSimMessage(sim_idx, simMsgId)) != MSG_SUCCESS) { + dbHandle->freeTable(); return err; } } - dbHandle.freeTable(); + dbHandle->freeTable(); - dbHandle.beginTrans(); + dbHandle->beginTrans(); //Delete Messages in SIM Msg table memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_SIM_MSG_TABLE_NAME, msgId); + MSG_DEBUG("SQL query=[%s]", sqlQuery); - MSG_DEBUG("sqlQuery is %s.", sqlQuery); - - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } @@ -1534,15 +1831,17 @@ msg_error_t MsgStoMoveMessageToStorage(msg_message_id_t msgId, msg_storage_id_t memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET STORAGE_ID = %d WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, destStorageId, msgId); + MSG_DEBUG("SQL query=[%s]", sqlQuery); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } - dbHandle.endTrans(true); + dbHandle->endTrans(true); } } + break; } return MSG_SUCCESS; @@ -1557,49 +1856,50 @@ msg_error_t MsgStoCountMessage(msg_folder_id_t folderId, MSG_COUNT_INFO_S *pCoun } char sqlQuery[MAX_QUERY_LEN+1]; + MsgDbHandler *dbHandle = getDbHandle(); memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE FOLDER_ID = %d AND READ_STATUS = 1 \ - UNION ALL SELECT COUNT(MSG_ID) FROM %s WHERE FOLDER_ID = %d AND READ_STATUS = 0 \ - UNION ALL SELECT COUNT(MSG_ID) FROM %s WHERE FOLDER_ID = %d AND MAIN_TYPE = %d \ - UNION ALL SELECT COUNT(MSG_ID) FROM %s WHERE FOLDER_ID = %d AND MAIN_TYPE = %d;", - MSGFW_MESSAGE_TABLE_NAME, folderId, - MSGFW_MESSAGE_TABLE_NAME, folderId, - MSGFW_MESSAGE_TABLE_NAME, folderId, MSG_SMS_TYPE, - MSGFW_MESSAGE_TABLE_NAME, folderId, MSG_MMS_TYPE); - - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE FOLDER_ID = %d AND READ_STATUS = 1 AND STORAGE_ID = %d " + "UNION ALL SELECT COUNT(MSG_ID) FROM %s WHERE FOLDER_ID = %d AND READ_STATUS = 0 AND STORAGE_ID = %d " + "UNION ALL SELECT COUNT(MSG_ID) FROM %s WHERE FOLDER_ID = %d AND MAIN_TYPE = %d AND STORAGE_ID = %d " + "UNION ALL SELECT COUNT(MSG_ID) FROM %s WHERE FOLDER_ID = %d AND MAIN_TYPE = %d AND STORAGE_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, folderId, MSG_STORAGE_PHONE, + MSGFW_MESSAGE_TABLE_NAME, folderId, MSG_STORAGE_PHONE, + MSGFW_MESSAGE_TABLE_NAME, folderId, MSG_SMS_TYPE, MSG_STORAGE_PHONE, + MSGFW_MESSAGE_TABLE_NAME, folderId, MSG_MMS_TYPE, MSG_STORAGE_PHONE); + + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_PREPARE; - if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { - pCountInfo->nReadCnt = dbHandle.columnInt(0); + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + pCountInfo->nReadCnt = dbHandle->columnInt(0); } else { - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_ERR_DB_STEP; } - if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { - pCountInfo->nUnreadCnt = dbHandle.columnInt(0); + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + pCountInfo->nUnreadCnt = dbHandle->columnInt(0); } else { - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_ERR_DB_STEP; } - if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { - pCountInfo->nSms = dbHandle.columnInt(0); + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + pCountInfo->nSms = dbHandle->columnInt(0); } else { - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_ERR_DB_STEP; } - if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { - pCountInfo->nMms = dbHandle.columnInt(0); + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + pCountInfo->nMms = dbHandle->columnInt(0); } else { - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_ERR_DB_STEP; } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_SUCCESS; } @@ -1617,6 +1917,7 @@ msg_error_t MsgStoCountMsgByType(const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCo char sqlQuery[MAX_QUERY_LEN+1]; memset(sqlQuery, 0x00, sizeof(sqlQuery)); + MsgDbHandler *dbHandle = getDbHandle(); // SMS if ((pMsgType->mainType == MSG_SMS_TYPE) && (pMsgType->subType == MSG_NORMAL_SMS || pMsgType->subType == MSG_STATUS_REPORT_SMS || pMsgType->subType == MSG_CONCAT_SIM_SMS)) { @@ -1636,17 +1937,17 @@ msg_error_t MsgStoCountMsgByType(const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCo return MSG_ERR_INVALID_PARAMETER; } - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_PREPARE; - if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { - *pMsgCount = dbHandle.columnInt(0); + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + *pMsgCount = dbHandle->columnInt(0); } else { - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_ERR_DB_STEP; } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_SUCCESS; } @@ -1655,36 +1956,35 @@ msg_error_t MsgStoCountMsgByType(const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCo msg_error_t MsgStoGetMessage(msg_message_id_t msgId, MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo) { char sqlQuery[MAX_QUERY_LEN+1]; - - int order = MsgGetContactNameOrder(); - memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, CONV_ID, FOLDER_ID, STORAGE_ID, MAIN_TYPE, \ SUB_TYPE, DISPLAY_TIME, DATA_SIZE, NETWORK_STATUS, READ_STATUS, PROTECTED, \ - BACKUP, PRIORITY, MSG_DIRECTION, SCHEDULED_TIME, SUBJECT, MSG_TEXT, THUMB_PATH \ + BACKUP, PRIORITY, MSG_DIRECTION, SCHEDULED_TIME, SUBJECT, MSG_TEXT, THUMB_PATH, SIM_INDEX \ FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgId); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + MsgDbHandler *dbHandle = getDbHandle(); + + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_PREPARE; - if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { - pMsg->msgId = dbHandle.columnInt(0); - pMsg->threadId = dbHandle.columnInt(1); - pMsg->folderId = dbHandle.columnInt(2); - pMsg->storageId = dbHandle.columnInt(3); - pMsg->msgType.mainType = dbHandle.columnInt(4); - pMsg->msgType.subType = dbHandle.columnInt(5); - pMsg->displayTime = (time_t)dbHandle.columnInt(6); - pMsg->dataSize = dbHandle.columnInt(7); - pMsg->networkStatus = dbHandle.columnInt(8); - pMsg->bRead = dbHandle.columnInt(9); - pMsg->bProtected = dbHandle.columnInt(10); - pMsg->bBackup = dbHandle.columnInt(11); - pMsg->priority = dbHandle.columnInt(12); - pMsg->direction= dbHandle.columnInt(13); - - strncpy(pMsg->subject, (char *)dbHandle.columnText(15), MAX_SUBJECT_LEN); + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + pMsg->msgId = dbHandle->columnInt(0); + pMsg->threadId = dbHandle->columnInt(1); + pMsg->folderId = dbHandle->columnInt(2); + pMsg->storageId = dbHandle->columnInt(3); + pMsg->msgType.mainType = dbHandle->columnInt(4); + pMsg->msgType.subType = dbHandle->columnInt(5); + pMsg->displayTime = (time_t)dbHandle->columnInt(6); + pMsg->dataSize = dbHandle->columnInt(7); + pMsg->networkStatus = dbHandle->columnInt(8); + pMsg->bRead = dbHandle->columnInt(9); + pMsg->bProtected = dbHandle->columnInt(10); + pMsg->bBackup = dbHandle->columnInt(11); + pMsg->priority = dbHandle->columnInt(12); + pMsg->direction= dbHandle->columnInt(13); + + strncpy(pMsg->subject, (char *)dbHandle->columnText(15), MAX_SUBJECT_LEN); /* Temp_File_Handling */ if (pMsg->msgType.mainType == MSG_SMS_TYPE || pMsg->msgType.subType == MSG_NOTIFICATIONIND_MMS) { @@ -1692,21 +1992,21 @@ msg_error_t MsgStoGetMessage(msg_message_id_t msgId, MSG_MESSAGE_INFO_S *pMsg, M char msgData[pMsg->dataSize+1]; memset(msgData, 0x00, sizeof(msgData)); - strncpy(msgData, (char *)dbHandle.columnText(16), pMsg->dataSize); + strncpy(msgData, (char *)dbHandle->columnText(16), pMsg->dataSize); // Save Message Data into File char fileName[MSG_FILENAME_LEN_MAX+1]; memset(fileName, 0x00, sizeof(fileName)); if (MsgCreateFileName(fileName) == false) { - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_ERR_STORAGE_ERROR; } - MSG_DEBUG("Save Message Data into file : size[%d] name[%s]\n", pMsg->dataSize, fileName); + MSG_SEC_DEBUG("Save Message Data into file : size[%d] name[%s]\n", pMsg->dataSize, fileName); if (MsgWriteIpcFile(fileName, msgData, pMsg->dataSize) == false) { - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_ERR_STORAGE_ERROR; } @@ -1715,7 +2015,7 @@ msg_error_t MsgStoGetMessage(msg_message_id_t msgId, MSG_MESSAGE_INFO_S *pMsg, M pMsg->bTextSms = false; } else { memset(pMsg->msgText, 0x00, sizeof(pMsg->msgText)); - strncpy(pMsg->msgText, (char *)dbHandle.columnText(16), pMsg->dataSize); + strncpy(pMsg->msgText, (char *)dbHandle->columnText(16), pMsg->dataSize); // For WAP PUSH SI Message if (pMsg->msgType.subType == MSG_WAP_SI_SMS) { @@ -1728,40 +2028,40 @@ msg_error_t MsgStoGetMessage(msg_message_id_t msgId, MSG_MESSAGE_INFO_S *pMsg, M pMsg->bTextSms = true; } } else { - if (dbHandle.columnText(16) != NULL) - strncpy(pMsg->msgText, (char *)dbHandle.columnText(16), MAX_MSG_TEXT_LEN); + if (dbHandle->columnText(16) != NULL) + strncpy(pMsg->msgText, (char *)dbHandle->columnText(16), MAX_MSG_TEXT_LEN); } // thumbnail path - if (dbHandle.columnText(17)!=NULL && ((char *)dbHandle.columnText(17))[0] != '\0') { - strncpy(pMsg->thumbPath, (char *)dbHandle.columnText(17), MSG_FILEPATH_LEN_MAX); + if (dbHandle->columnText(17)!=NULL && ((char *)dbHandle->columnText(17))[0] != '\0') { + strncpy(pMsg->thumbPath, (char *)dbHandle->columnText(17), MSG_FILEPATH_LEN_MAX); MSG_DEBUG("pMsg->thumbPath : [%s]", pMsg->thumbPath); } + pMsg->sim_idx= dbHandle->columnInt(18); } else { - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); MSG_DEBUG("%s", sqlQuery); return MSG_ERR_DB_STEP; } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); // get address information. - MsgStoGetAddressByMsgId(&dbHandle, pMsg->msgId, order, &pMsg->nAddressCnt, pMsg->addressList); + MsgStoGetAddressByMsgId(dbHandle, pMsg->msgId, MsgGetContactNameOrder(), &pMsg->nAddressCnt, &pMsg->addressList); // Get MMS body if it is MMS. if ((pMsg->networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS && - (pMsg->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsg->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS)) || - pMsg->msgType.subType == MSG_SENDREQ_MMS || pMsg->msgType.subType == MSG_SENDCONF_MMS) { + (pMsg->msgType.subType == MSG_RETRIEVE_MMS || pMsg->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsg->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS)) || + pMsg->msgType.subType == MSG_SENDREQ_MMS || pMsg->msgType.subType == MSG_SENDCONF_MMS || pMsg->msgType.subType == MSG_NOTIFICATIONIND_MMS) { msg_error_t err = MSG_SUCCESS; - MMS_MESSAGE_DATA_S mmsMsg; char *pDestMsg = NULL; int temp_size = pMsg->dataSize;//save raw file size; + // call mms plugin to get mms specific message data MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(pMsg->msgType.mainType); - memset(&mmsMsg, 0, sizeof(MMS_MESSAGE_DATA_S)); - err = plg->getMmsMessage(pMsg, pSendOptInfo, &mmsMsg, &pDestMsg); + err = plg->getMmsMessage(pMsg, pSendOptInfo, &pDestMsg); if (err != MSG_SUCCESS) { if (pDestMsg) { free(pDestMsg); @@ -1785,7 +2085,7 @@ msg_error_t MsgStoGetMessage(msg_message_id_t msgId, MSG_MESSAGE_INFO_S *pMsg, M } return MSG_ERR_STORAGE_ERROR; } - MSG_DEBUG("Save Message Data into file : size[%d] name[%s]\n", pMsg->dataSize, tempFileName); + MSG_SEC_DEBUG("Save Message Data into file : size[%d] name[%s]\n", pMsg->dataSize, tempFileName); if (MsgWriteIpcFile(tempFileName, pDestMsg, pMsg->dataSize) == false) { if(pDestMsg) { @@ -1811,134 +2111,44 @@ msg_error_t MsgStoGetMessage(msg_message_id_t msgId, MSG_MESSAGE_INFO_S *pMsg, M // Get SMS Sending Options if (pMsg->msgType.mainType == MSG_SMS_TYPE && pSendOptInfo != NULL) - MsgStoGetSmsSendOpt(pMsg->msgId, pSendOptInfo); + MsgStoGetSmsSendOpt(pMsg, pSendOptInfo); return MSG_SUCCESS; } - -msg_error_t MsgStoGetFolderViewList(msg_folder_id_t folderId, const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pMsgFolderViewList) +msg_error_t MsgStoGetFailedMessage(int **failed_msg_list, int *count) { - if (pMsgFolderViewList == NULL) { - MSG_DEBUG("pMsgFolderViewList is NULL"); - return MSG_ERR_NULL_POINTER; - } - - int rowCnt = 0; - int index = 19; // numbers of index - + MSG_BEGIN(); + msg_error_t err = MSG_SUCCESS; char sqlQuery[MAX_QUERY_LEN+1]; - char sqlSort[64]; - - // Get Name Order - int order = MsgGetContactNameOrder(); + int rowCnt = 0; + int index = 1; + MsgDbHandler *dbHandle = getDbHandle(); - // Get Message In Folder memset(sqlQuery, 0x00, sizeof(sqlQuery)); - if (folderId == MSG_ALLBOX_ID) { - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, CONV_ID, FOLDER_ID, STORAGE_ID, MAIN_TYPE, SUB_TYPE, \ - DISPLAY_TIME, DATA_SIZE, NETWORK_STATUS, READ_STATUS, PROTECTED, BACKUP, PRIORITY, \ - MSG_DIRECTION, SCHEDULED_TIME, SUBJECT, MSG_TEXT, ATTACHMENT_COUNT, THUMB_PATH \ - FROM %s WHERE FOLDER_ID < %d ", - MSGFW_MESSAGE_TABLE_NAME, MSG_SPAMBOX_ID); - } else { - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, CONV_ID, FOLDER_ID, STORAGE_ID, MAIN_TYPE, SUB_TYPE, \ - DISPLAY_TIME, DATA_SIZE, NETWORK_STATUS, READ_STATUS, PROTECTED, BACKUP, PRIORITY, \ - MSG_DIRECTION, SCHEDULED_TIME, SUBJECT, MSG_TEXT, ATTACHMENT_COUNT, THUMB_PATH \ - FROM %s WHERE FOLDER_ID = %d ", - MSGFW_MESSAGE_TABLE_NAME, folderId); - } - - memset(sqlSort, 0x00, sizeof(sqlSort)); - MsgMakeSortRule(pSortRule, sqlSort); - strncat(sqlQuery, sqlSort, strlen(sqlSort)); - - msg_error_t err = dbHandle.getTable(sqlQuery, &rowCnt); - - if (err == MSG_ERR_DB_NORECORD) { - pMsgFolderViewList->nCount = 0; - pMsgFolderViewList->msg_struct_info = NULL; - - dbHandle.freeTable(); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE NETWORK_STATUS = %d AND FOLDER_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, MSG_NETWORK_SEND_PENDING, MSG_OUTBOX_ID); + err = dbHandle->getTable(sqlQuery, &rowCnt); + if(err == MSG_ERR_DB_NORECORD){ + dbHandle->freeTable(); return MSG_SUCCESS; - } else if (err != MSG_SUCCESS) { - MSG_DEBUG("sqlQuery is - %s", sqlQuery); - dbHandle.freeTable(); - return err; } + *count = rowCnt; + int *list = new int[rowCnt]; - pMsgFolderViewList->nCount = rowCnt; - - MSG_DEBUG("pMsgCommInfoList->nCount [%d]", pMsgFolderViewList->nCount); - - pMsgFolderViewList->msg_struct_info = (msg_struct_t *)new char[sizeof(msg_struct_t) * rowCnt]; - - msg_struct_s *msg = NULL; - MSG_MESSAGE_HIDDEN_S *pTmp = NULL; - - for (int i = 0; i < rowCnt; i++) { - pMsgFolderViewList->msg_struct_info[i] = (msg_struct_t)new char[sizeof(msg_struct_s)];; - - msg = (msg_struct_s *)pMsgFolderViewList->msg_struct_info[i]; - - msg->type = MSG_STRUCT_MESSAGE_INFO; - msg->data = new char[sizeof(MSG_MESSAGE_HIDDEN_S)]; - - pTmp = (MSG_MESSAGE_HIDDEN_S *)msg->data; - - pTmp->pData = NULL; - pTmp->pMmsData = NULL; - - pTmp->msgId = dbHandle.getColumnToInt(index++); - pTmp->threadId = dbHandle.getColumnToInt(index++); - pTmp->folderId = dbHandle.getColumnToInt(index++); - pTmp->storageId = dbHandle.getColumnToInt(index++); - pTmp->mainType = dbHandle.getColumnToInt(index++); - pTmp->subType = dbHandle.getColumnToInt(index++); - pTmp->displayTime = (time_t)dbHandle.getColumnToInt(index++); - pTmp->dataSize = dbHandle.getColumnToInt(index++); - pTmp->networkStatus = dbHandle.getColumnToInt(index++); - pTmp->bRead = dbHandle.getColumnToInt(index++); - pTmp->bProtected = dbHandle.getColumnToInt(index++); - pTmp->bBackup = dbHandle.getColumnToInt(index++); - pTmp->priority = dbHandle.getColumnToInt(index++); - pTmp->direction= dbHandle.getColumnToInt(index++); - index++; // This field is reserved. - - dbHandle.getColumnToString(index++, MAX_SUBJECT_LEN, pTmp->subject); - - if (pTmp->mainType == MSG_MMS_TYPE && - (pTmp->networkStatus == MSG_NETWORK_RETRIEVING || pTmp->networkStatus == MSG_NETWORK_RETRIEVE_FAIL || pTmp->subType == MSG_NOTIFICATIONIND_MMS)) { - pTmp->pData = NULL; - index++; - } else { - pTmp->pData = (void *)new char[pTmp->dataSize + 2]; - memset(pTmp->pData, 0x00, pTmp->dataSize + 2); - - dbHandle.getColumnToString(index++, pTmp->dataSize+1, (char *)pTmp->pData); - } - - // get address information from db. - msg_struct_list_s *addr_list = (msg_struct_list_s *)new msg_struct_list_s; - - MsgStoGetAddressByMsgId(&dbHandle, pTmp->msgId, order, addr_list); - - pTmp->addr_list = addr_list; - - pTmp->attachCount = dbHandle.getColumnToInt(index++); - - dbHandle.getColumnToString(index++, MSG_FILEPATH_LEN_MAX, pTmp->thumbPath); + for(int i=0; igetColumnToInt(index++); } + *failed_msg_list = list; + dbHandle->freeTable(); - dbHandle.freeTable(); - - return MSG_SUCCESS; + MSG_END(); + return err; } - msg_error_t MsgStoAddSyncMLMessage(MSG_MESSAGE_INFO_S *pMsgInfo, int extId, int pinCode) { MSG_BEGIN(); @@ -1949,24 +2159,25 @@ msg_error_t MsgStoAddSyncMLMessage(MSG_MESSAGE_INFO_S *pMsgInfo, int extId, int unsigned int rowId = 0; msg_thread_id_t convId = 0; + MsgDbHandler *dbHandle = getDbHandle(); - dbHandle.beginTrans(); + dbHandle->beginTrans(); if (pMsgInfo->nAddressCnt > 0) { - err = MsgStoAddAddress(&dbHandle, pMsgInfo, &convId); + err = MsgStoAddAddress(dbHandle, pMsgInfo, &convId); if (err != MSG_SUCCESS) { - dbHandle.endTrans(false); + dbHandle->endTrans(false); return err; } } // Add Message Table pMsgInfo->threadId = convId; - rowId = MsgStoAddMessageTable(&dbHandle, pMsgInfo); + rowId = MsgStoAddMessageTable(dbHandle, pMsgInfo); if (rowId <= 0) { - dbHandle.endTrans(false); + dbHandle->endTrans(false); return MSG_ERR_DB_ROW; } @@ -1974,31 +2185,22 @@ msg_error_t MsgStoAddSyncMLMessage(MSG_MESSAGE_INFO_S *pMsgInfo, int extId, int snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d);", MSGFW_SYNCML_MSG_TABLE_NAME, rowId, extId, pinCode); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } - if (MsgStoUpdateConversation(&dbHandle, convId) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (MsgStoUpdateConversation(dbHandle, convId) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_STORAGE_ERROR; } - dbHandle.endTrans(true); + dbHandle->endTrans(true); pMsgInfo->msgId = (msg_message_id_t)rowId; - MsgSoundPlayStart(false); - - int smsCnt = 0; - int mmsCnt = 0; - - smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE); - mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE); - - MsgSettingHandleNewMsg(smsCnt, mmsCnt); - - MsgInsertNoti(pMsgInfo); + MsgInsertNotification(pMsgInfo); + MsgChangePmState(); MSG_END(); @@ -2008,6 +2210,7 @@ msg_error_t MsgStoAddSyncMLMessage(MSG_MESSAGE_INFO_S *pMsgInfo, int extId, int msg_error_t MsgStoGetMsgType(msg_message_id_t msgId, MSG_MESSAGE_TYPE_S *pMsgType) { + MsgDbHandler *dbHandle = getDbHandle(); char sqlQuery[MAX_QUERY_LEN+1]; memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -2015,15 +2218,15 @@ msg_error_t MsgStoGetMsgType(msg_message_id_t msgId, MSG_MESSAGE_TYPE_S *pMsgTyp snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MAIN_TYPE, SUB_TYPE FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgId); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_PREPARE; - if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { - pMsgType->mainType = dbHandle.columnInt(0); - pMsgType->subType = dbHandle.columnInt(1); + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + pMsgType->mainType = dbHandle->columnInt(0); + pMsgType->subType = dbHandle->columnInt(1); } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_SUCCESS; } @@ -2033,6 +2236,7 @@ msg_error_t MsgStoGetQuickPanelData(msg_quickpanel_type_t QPtype, MSG_MESSAGE_IN { msg_error_t err = MSG_SUCCESS; + MsgDbHandler *dbHandle = getDbHandle(); char sqlQuery[MAX_QUERY_LEN+1]; memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -2060,17 +2264,17 @@ msg_error_t MsgStoGetQuickPanelData(msg_quickpanel_type_t QPtype, MSG_MESSAGE_IN // Get Message ID msg_message_id_t msgId; - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_PREPARE; - if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { - msgId = dbHandle.columnInt(0); + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + msgId = dbHandle->columnInt(0); } else { - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_ERR_DB_STEP; } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); // Get Message Info err = MsgStoGetMessage(msgId, pMsg, NULL); @@ -2079,326 +2283,11 @@ msg_error_t MsgStoGetQuickPanelData(msg_quickpanel_type_t QPtype, MSG_MESSAGE_IN } -msg_error_t MsgStoGetThreadViewList(const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pThreadViewList) -{ - pThreadViewList->nCount = 0; - pThreadViewList->msg_struct_info = NULL; - - int rowCnt = 0; - int index = 11; // numbers of index - - char sqlQuery[MAX_QUERY_LEN+1]; - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.CONV_ID, A.UNREAD_CNT, A.SMS_CNT, A.MMS_CNT, \ - A.MAIN_TYPE, A.SUB_TYPE, A.MSG_DIRECTION, A.DISPLAY_TIME, A.DISPLAY_NAME, A.MSG_TEXT, \ - (SELECT COUNT(*) FROM %s B WHERE B.CONV_ID = A.CONV_ID AND B.PROTECTED = 1) AS PROTECTED \ - FROM %s A WHERE A.SMS_CNT > 0 OR A.MMS_CNT > 0 ORDER BY A.DISPLAY_TIME DESC;", - MSGFW_MESSAGE_TABLE_NAME, MSGFW_CONVERSATION_TABLE_NAME); - - msg_error_t err = dbHandle.getTable(sqlQuery, &rowCnt); - - if (err == MSG_ERR_DB_NORECORD) { - dbHandle.freeTable(); - return MSG_SUCCESS; - } else if (err != MSG_SUCCESS) { - MSG_DEBUG("%s", sqlQuery); - dbHandle.freeTable(); - return err; - } - - if (rowCnt < 1) { - MSG_DEBUG("rowCnt is %d", rowCnt); - dbHandle.freeTable(); - return err; - } - - pThreadViewList->nCount = rowCnt; - - MSG_DEBUG("pThreadViewList->nCount [%d]", pThreadViewList->nCount); - - pThreadViewList->msg_struct_info = (msg_struct_t *)new char[sizeof(msg_struct_t)*rowCnt]; - - MSG_THREAD_VIEW_S *pTmp = NULL; - msg_struct_s *thread_t = NULL; - - for (int i = 0; i < rowCnt; i++) { - thread_t = (msg_struct_s *)new msg_struct_s; - pThreadViewList->msg_struct_info[i] = (msg_struct_t)thread_t; - - thread_t->type = MSG_STRUCT_THREAD_INFO; - thread_t->data = new MSG_THREAD_VIEW_S; - - pTmp = (MSG_THREAD_VIEW_S *)thread_t->data; - memset(pTmp, 0x00, sizeof(MSG_THREAD_VIEW_S)); - - pTmp->threadId = dbHandle.getColumnToInt(index++); - - pTmp->unreadCnt = dbHandle.getColumnToInt(index++); - pTmp->smsCnt = dbHandle.getColumnToInt(index++); - pTmp->mmsCnt = dbHandle.getColumnToInt(index++); - - pTmp->mainType = dbHandle.getColumnToInt(index++); - pTmp->subType = dbHandle.getColumnToInt(index++); - - pTmp->direction = dbHandle.getColumnToInt(index++); - pTmp->threadTime = (time_t)dbHandle.getColumnToInt(index++); - - memset(pTmp->threadName, 0x00, sizeof(pTmp->threadName)); - dbHandle.getColumnToString(index++, MAX_THREAD_NAME_LEN, pTmp->threadName); - - memset(pTmp->threadData, 0x00, sizeof(pTmp->threadData)); - dbHandle.getColumnToString(index++, MAX_THREAD_DATA_LEN, pTmp->threadData); - - int protectedCnt = dbHandle.getColumnToInt(index++); - if (protectedCnt > 0) - pTmp->bProtected = true; - } - - dbHandle.freeTable(); - - return MSG_SUCCESS; -} - -msg_error_t MsgStoGetConversationPreview(MSG_CONVERSATION_VIEW_S *pConv) -{ - MsgDbHandler dbHandleForInner; - char sqlQuery[MAX_QUERY_LEN + 1]; - int rowCnt; - int index = 3; - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - - if (pConv == NULL) - return MSG_ERR_NULL_POINTER; - - //(MSG_ID INTEGER, TYPE INTEGER, VALUE TEXT, COUNT INTEGER) - snprintf(sqlQuery, sizeof(sqlQuery), - "SELECT TYPE, VALUE, COUNT " - "FROM %s WHERE MSG_ID=%d;", - MSGFW_MMS_PREVIEW_TABLE_NAME, pConv->msgId); - - MSG_DEBUG("QUERY : [%s]", sqlQuery); - - msg_error_t err = dbHandleForInner.getTable(sqlQuery, &rowCnt); - if (err == MSG_SUCCESS) { - for (int i = 0; i < rowCnt; i++) { - int type = dbHandleForInner.getColumnToInt(index++); - if (type == MSG_MMS_ITEM_TYPE_IMG) { - dbHandleForInner.getColumnToString(index++, MSG_FILEPATH_LEN_MAX, pConv->imageThumbPath); - dbHandleForInner.getColumnToInt(index++); - } else if (type == MSG_MMS_ITEM_TYPE_VIDEO) { - dbHandleForInner.getColumnToString(index++, MSG_FILEPATH_LEN_MAX, pConv->videoThumbPath); - dbHandleForInner.getColumnToInt(index++); - } else if (type == MSG_MMS_ITEM_TYPE_AUDIO) { - dbHandleForInner.getColumnToString(index++, MSG_FILENAME_LEN_MAX, pConv->audioFileName); - dbHandleForInner.getColumnToInt(index++); - } else if (type == MSG_MMS_ITEM_TYPE_ATTACH) { - dbHandleForInner.getColumnToString(index++, MSG_FILENAME_LEN_MAX, pConv->attachFileName); - dbHandleForInner.getColumnToInt(index++); - } else if (type == MSG_MMS_ITEM_TYPE_PAGE) { - index++; - pConv->pageCount = dbHandleForInner.getColumnToInt(index++); - } else { - MSG_DEBUG("Unknown item type [%d]", type); - index+=2; - } - } - } - - dbHandleForInner.freeTable(); - return MSG_SUCCESS; -} - -msg_error_t MsgStoGetConversationViewItem(msg_message_id_t msgId, MSG_CONVERSATION_VIEW_S *pConv) -{ - int rowCnt = 0; - int index = 16; /** numbers of index */ - char sqlQuery[MAX_QUERY_LEN+1]; - - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, CONV_ID, FOLDER_ID, STORAGE_ID, MAIN_TYPE, SUB_TYPE, \ - DISPLAY_TIME, DATA_SIZE, NETWORK_STATUS, READ_STATUS, PROTECTED, \ - MSG_DIRECTION, SCHEDULED_TIME, SUBJECT, MSG_TEXT, ATTACHMENT_COUNT \ - FROM %s WHERE MSG_ID=%d;", - MSGFW_MESSAGE_TABLE_NAME, msgId); - - msg_error_t err = dbHandle.getTable(sqlQuery, &rowCnt); - - if (err == MSG_ERR_DB_NORECORD) { - dbHandle.freeTable(); - return MSG_SUCCESS; - } else if (err != MSG_SUCCESS) { - MSG_DEBUG("%s", sqlQuery); - dbHandle.freeTable(); - return err; - } - - memset(pConv, 0x00, sizeof(MSG_CONVERSATION_VIEW_S)); - pConv->pText = NULL; - - pConv->msgId = dbHandle.getColumnToInt(index++); - pConv->threadId = dbHandle.getColumnToInt(index++); - pConv->folderId = dbHandle.getColumnToInt(index++); - pConv->storageId = dbHandle.getColumnToInt(index++); - pConv->mainType = dbHandle.getColumnToInt(index++); - pConv->subType = dbHandle.getColumnToInt(index++); - pConv->displayTime = (time_t)dbHandle.getColumnToInt(index++); - pConv->textSize = dbHandle.getColumnToInt(index++); - pConv->networkStatus = dbHandle.getColumnToInt(index++); - pConv->bRead = dbHandle.getColumnToInt(index++); - pConv->bProtected = dbHandle.getColumnToInt(index++); - pConv->direction = dbHandle.getColumnToInt(index++); - pConv->scheduledTime = (time_t)dbHandle.getColumnToInt(index++); - - dbHandle.getColumnToString(index++, MAX_SUBJECT_LEN, pConv->subject); - - if (pConv->mainType == MSG_MMS_TYPE && - (pConv->networkStatus == MSG_NETWORK_RETRIEVING || pConv->networkStatus == MSG_NETWORK_RETRIEVE_FAIL || pConv->subType == MSG_NOTIFICATIONIND_MMS)) { - pConv->pText = NULL; - pConv->textSize = 0; - index++; - } else { - if (pConv->mainType == MSG_SMS_TYPE) { - pConv->pText = new char[pConv->textSize+2]; - memset(pConv->pText, 0x00, pConv->textSize+2); - dbHandle.getColumnToString(index++, pConv->textSize+1, pConv->pText); - } else { - char tmpMmsText[MAX_MMS_TEXT_LEN+1]; - memset(tmpMmsText, 0x00, MAX_MMS_TEXT_LEN+1); - - dbHandle.getColumnToString(index++, MAX_MMS_TEXT_LEN, tmpMmsText); - - pConv->textSize = strlen(tmpMmsText); - - pConv->pText = new char[pConv->textSize+2]; - memset(pConv->pText, 0x00, pConv->textSize+2); - - strncpy(pConv->pText, tmpMmsText, pConv->textSize+1); - - MsgStoGetConversationPreview(pConv); - } - } - - pConv->attachCount = dbHandle.getColumnToInt(index++); - - MSG_END(); - - return MSG_SUCCESS; -} - -msg_error_t MsgStoGetConversationViewList(msg_thread_id_t threadId, msg_struct_list_s *pConvViewList) -{ - MSG_BEGIN(); - - pConvViewList->nCount = 0; - pConvViewList->msg_struct_info = NULL; - - int rowCnt = 0; - int index = 16; /** numbers of index */ - char sqlQuery[MAX_QUERY_LEN+1]; - - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, CONV_ID, FOLDER_ID, STORAGE_ID, MAIN_TYPE, SUB_TYPE, \ - DISPLAY_TIME, DATA_SIZE, NETWORK_STATUS, READ_STATUS, PROTECTED, \ - MSG_DIRECTION, SCHEDULED_TIME, SUBJECT, MSG_TEXT, ATTACHMENT_COUNT \ - FROM %s WHERE CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d ORDER BY DISPLAY_TIME, MSG_ID ASC;", - MSGFW_MESSAGE_TABLE_NAME, threadId, MSG_ALLBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE); - - msg_error_t err = dbHandle.getTable(sqlQuery, &rowCnt); - - if (err == MSG_ERR_DB_NORECORD) { - dbHandle.freeTable(); - return MSG_SUCCESS; - } else if (err != MSG_SUCCESS) { - MSG_DEBUG("%s", sqlQuery); - dbHandle.freeTable(); - return err; - } - - pConvViewList->nCount = rowCnt; - - MSG_DEBUG("pConvViewList->nCount [%d]", pConvViewList->nCount); - - pConvViewList->msg_struct_info = (msg_struct_t *)new char[sizeof(msg_struct_t) * rowCnt]; - memset(pConvViewList->msg_struct_info, 0x00, sizeof(msg_struct_t) * rowCnt); - - msg_struct_s *conv = NULL; - MSG_CONVERSATION_VIEW_S *pTmp = NULL; - - for (int i = 0; i < rowCnt; i++) { - pConvViewList->msg_struct_info[i] = (msg_struct_t)new char[sizeof(msg_struct_s)];; - memset(pConvViewList->msg_struct_info[i], 0x00, sizeof(msg_struct_s)); - - conv = (msg_struct_s *)pConvViewList->msg_struct_info[i]; - - conv->type = MSG_STRUCT_CONV_INFO; - conv->data = new char[sizeof(MSG_CONVERSATION_VIEW_S)]; - memset(conv->data, 0x00, sizeof(MSG_CONVERSATION_VIEW_S)); - - pTmp = (MSG_CONVERSATION_VIEW_S *)conv->data; - - pTmp->pText = NULL; - - pTmp->msgId = dbHandle.getColumnToInt(index++); - pTmp->threadId = dbHandle.getColumnToInt(index++); - pTmp->folderId = dbHandle.getColumnToInt(index++); - pTmp->storageId = dbHandle.getColumnToInt(index++); - pTmp->mainType = dbHandle.getColumnToInt(index++); - pTmp->subType = dbHandle.getColumnToInt(index++); - pTmp->displayTime = (time_t)dbHandle.getColumnToInt(index++); - pTmp->textSize = dbHandle.getColumnToInt(index++); - pTmp->networkStatus = dbHandle.getColumnToInt(index++); - pTmp->bRead = dbHandle.getColumnToInt(index++); - pTmp->bProtected = dbHandle.getColumnToInt(index++); - pTmp->direction = dbHandle.getColumnToInt(index++); - index++; // This field is reserved. - - dbHandle.getColumnToString(index++, MAX_SUBJECT_LEN, pTmp->subject); - - if (pTmp->mainType == MSG_MMS_TYPE && - (pTmp->networkStatus == MSG_NETWORK_RETRIEVING || pTmp->networkStatus == MSG_NETWORK_RETRIEVE_FAIL || pTmp->subType == MSG_NOTIFICATIONIND_MMS)) { - pTmp->pText = NULL; - pTmp->textSize = 0; - index++; - } else { - if (pTmp->mainType == MSG_SMS_TYPE) { - pTmp->pText = new char[pTmp->textSize+2]; - memset(pTmp->pText, 0x00, pTmp->textSize+2); - dbHandle.getColumnToString(index++, pTmp->textSize+1, pTmp->pText); - } else { - char tmpMmsText[MAX_MMS_TEXT_LEN+1]; - memset(tmpMmsText, 0x00, MAX_MMS_TEXT_LEN+1); - - dbHandle.getColumnToString(index++, MAX_MMS_TEXT_LEN, tmpMmsText); - - pTmp->textSize = strlen(tmpMmsText); - - pTmp->pText = new char[pTmp->textSize+2]; - memset(pTmp->pText, 0x00, pTmp->textSize+2); - - strncpy(pTmp->pText, tmpMmsText, pTmp->textSize+1); - } - } - - pTmp->attachCount = dbHandle.getColumnToInt(index++); - - MsgStoGetConversationPreview(pTmp); - } - - dbHandle.freeTable(); - - MSG_END(); - - return MSG_SUCCESS; -} - - msg_error_t MsgStoDeleteThreadMessageList(msg_thread_id_t threadId, bool bIncludeProtect, msg_id_list_s *pMsgIdList) { msg_error_t err = MSG_SUCCESS; + MsgDbHandler *dbHandle = getDbHandle(); char sqlQuery[MAX_QUERY_LEN+1]; /*** Get msg id list **/ @@ -2407,6 +2296,17 @@ msg_error_t MsgStoDeleteThreadMessageList(msg_thread_id_t threadId, bool bInclud memset(sqlQuery, 0x00, sizeof(sqlQuery)); +#ifdef MSG_NOTI_INTEGRATION + if (bIncludeProtect) { + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE \ + CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, threadId, MSG_ALLBOX_ID, MSG_SPAMBOX_ID, MSG_STORAGE_PHONE); + } else { + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE \ + CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d AND PROTECTED = 0;", + MSGFW_MESSAGE_TABLE_NAME, threadId, MSG_ALLBOX_ID, MSG_SPAMBOX_ID, MSG_STORAGE_PHONE); + } +#else if (bIncludeProtect) { snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE \ CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d;", @@ -2416,16 +2316,17 @@ msg_error_t MsgStoDeleteThreadMessageList(msg_thread_id_t threadId, bool bInclud CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d AND PROTECTED = 0;", MSGFW_MESSAGE_TABLE_NAME, threadId, MSG_ALLBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE); } +#endif - err = dbHandle.getTable(sqlQuery, &rowCnt); + err = dbHandle->getTable(sqlQuery, &rowCnt); if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { - MSG_DEBUG("sqlQuery [%s]", sqlQuery); - dbHandle.freeTable(); + MSG_DEBUG("Fail to getTable()."); + dbHandle->freeTable(); } if (rowCnt <= 0) { - dbHandle.freeTable(); + dbHandle->freeTable(); err = MSG_SUCCESS; } @@ -2436,9 +2337,9 @@ msg_error_t MsgStoDeleteThreadMessageList(msg_thread_id_t threadId, bool bInclud pMsgIdList->msgIdList = (msg_message_id_t *)new char[sizeof(msg_message_id_t) * rowCnt]; for (int i = 0; i < rowCnt; i++) - pMsgIdList->msgIdList[i] = dbHandle.getColumnToInt(index++); + pMsgIdList->msgIdList[i] = dbHandle->getColumnToInt(index++); - dbHandle.freeTable(); + dbHandle->freeTable(); /*** **/ err = MsgStoDeleteMessageByList(pMsgIdList); @@ -2449,6 +2350,7 @@ msg_error_t MsgStoDeleteThreadMessageList(msg_thread_id_t threadId, bool bInclud msg_error_t MsgStoCountMsgByContact(const MSG_THREAD_LIST_INDEX_S *pAddrInfo, MSG_THREAD_COUNT_INFO_S *pThreadCountInfo) { + MsgDbHandler *dbHandle = getDbHandle(); char sqlQuery[MAX_QUERY_LEN+1]; memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -2458,860 +2360,661 @@ msg_error_t MsgStoCountMsgByContact(const MSG_THREAD_LIST_INDEX_S *pAddrInfo, MS SUM(CASE WHEN READ_STATUS=0 AND FOLDER_ID=%d THEN 1 ELSE 0 END), \ SUM(CASE WHEN MAIN_TYPE=%d THEN 1 ELSE 0 END), \ SUM(CASE WHEN MAIN_TYPE=%d THEN 1 ELSE 0 END) \ - FROM (SELECT * FROM %s A JOIN %s B ON A.ADDRESS_ID = B.ADDRESS_ID WHERE B.CONTACT_ID = %d)", + FROM (SELECT * FROM %s A JOIN %s B ON A.CONV_ID = B.CONV_ID WHERE B.CONTACT_ID = %d)", MSG_INBOX_ID, MSG_SMS_TYPE, MSG_MMS_TYPE, MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, pAddrInfo->contactId); } else { snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) AS TOTAL, \ SUM(CASE WHEN READ_STATUS=0 AND FOLDER_ID=%d THEN 1 ELSE 0 END), \ SUM(CASE WHEN MAIN_TYPE=%d THEN 1 ELSE 0 END), \ SUM(CASE WHEN MAIN_TYPE=%d THEN 1 ELSE 0 END) \ - FROM (SELECT * FROM %s A JOIN %s B ON A.ADDRESS_ID = B.ADDRESS_ID WHERE B.ADDRESS_VAL = '%s')", + FROM (SELECT * FROM %s A JOIN %s B ON A.CONV_ID = B.CONV_ID WHERE B.ADDRESS_VAL = '%s')", MSG_INBOX_ID, MSG_SMS_TYPE, MSG_MMS_TYPE, MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, pAddrInfo->msgAddrInfo.addressVal); } - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_PREPARE; - if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { - pThreadCountInfo->totalCount = dbHandle.columnInt(0); - pThreadCountInfo->unReadCount = dbHandle.columnInt(1); - pThreadCountInfo->smsMsgCount = dbHandle.columnInt(2); - pThreadCountInfo->mmsMsgCount = dbHandle.columnInt(3); + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + pThreadCountInfo->totalCount = dbHandle->columnInt(0); + pThreadCountInfo->unReadCount = dbHandle->columnInt(1); + pThreadCountInfo->smsMsgCount = dbHandle->columnInt(2); + pThreadCountInfo->mmsMsgCount = dbHandle->columnInt(3); } else { - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_ERR_DB_STEP; } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_SUCCESS; } -msg_error_t MsgStoSearchMessage(const char *pSearchString, msg_struct_list_s *pThreadViewList) +msg_error_t MsgStoGetSyncMLExtId(msg_message_id_t msgId, int *extId) { - if (!pSearchString) - return MSG_ERR_NULL_POINTER; + MsgDbHandler *dbHandle = getDbHandle(); + char sqlQuery[MAX_QUERY_LEN+1]; - // Clear Out Parameter - pThreadViewList->nCount = 0; - pThreadViewList->msg_struct_info = NULL; + memset(sqlQuery, 0x00, sizeof(sqlQuery)); - tr1::unordered_set IdList; - queue searchList; + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT EXT_ID FROM %s WHERE MSG_ID = %d;", + MSGFW_SYNCML_MSG_TABLE_NAME, msgId); - MSG_THREAD_VIEW_S threadView; + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; - char sqlQuery[MAX_QUERY_LEN+1]; + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + *extId = dbHandle->columnInt(0); + } else { + dbHandle->finalizeQuery(); + return MSG_ERR_DB_STEP; + } - // Replace string for '%' and '_' character - char *ext1_str = NULL; - char *ext2_str = NULL; - char *ext3_str = NULL; + dbHandle->finalizeQuery(); - ext1_str = MsgStoReplaceString(pSearchString, "_", "\\_"); - ext2_str = MsgStoReplaceString(ext1_str, "%", "\\%"); - ext3_str = MsgStoReplaceString(ext2_str, "'", "''"); + return MSG_SUCCESS; +} - // Search - Address, Name - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT CONV_ID, UNREAD_CNT, SMS_CNT, MMS_CNT, DISPLAY_NAME, \ - MAIN_TYPE, SUB_TYPE, MSG_DIRECTION, DISPLAY_TIME, MSG_TEXT \ - FROM %s WHERE DISPLAY_NAME LIKE '%%%s%%' ESCAPE '\\' ORDER BY DISPLAY_TIME DESC;", - MSGFW_CONVERSATION_TABLE_NAME, ext3_str); +msg_error_t MsgStoGetSmsReportStatus(msg_message_id_t msgId, int *count, MSG_REPORT_STATUS_INFO_S **pReportStatus) +{ + MsgDbHandler *dbHandle = getDbHandle(); + char sqlQuery[MAX_QUERY_LEN+1]; + msg_error_t err = MSG_SUCCESS; - if (ext1_str) { - free(ext1_str); - ext1_str = NULL; - } + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), + "SELECT ADDRESS_VAL, STATUS_TYPE, STATUS, TIME " + "FROM %s " + "WHERE MSG_ID = %d " + "order by TIME ASC;" + , MSGFW_SMS_REPORT_TABLE_NAME, msgId); - if (ext2_str) { - free(ext2_str); - ext2_str = NULL; - } + int rowCnt; + err = dbHandle->getTable(sqlQuery, &rowCnt); - if (ext3_str) { - free(ext3_str); - ext3_str = NULL; + if (err != MSG_SUCCESS) { + MSG_DEBUG("Fail to getTable()."); + dbHandle->freeTable(); + return err; } - MSG_DEBUG("[%s]", sqlQuery); + int index = 4; - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { - MSG_DEBUG("Prepare query fail. [%s]", sqlQuery); - return MSG_ERR_DB_PREPARE; - } + *count = rowCnt; + MSG_REPORT_STATUS_INFO_S *report_status = (MSG_REPORT_STATUS_INFO_S*)new char[sizeof(MSG_REPORT_STATUS_INFO_S)*rowCnt]; + memset(report_status, 0x00, sizeof(MSG_REPORT_STATUS_INFO_S)*rowCnt); - while (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { - memset(&threadView, 0x00, sizeof(threadView)); + for (int i = 0; i < rowCnt; i++) { + dbHandle->getColumnToString(index++, MAX_ADDRESS_VAL_LEN, report_status[i].addressVal); + report_status[i].type = dbHandle->getColumnToInt(index++); + report_status[i].status = dbHandle->getColumnToInt(index++); + report_status[i].statusTime = (time_t)dbHandle->getColumnToInt(index++); - threadView.threadId = dbHandle.columnInt(0); - threadView.unreadCnt = dbHandle.columnInt(1); - threadView.smsCnt = dbHandle.columnInt(2); - threadView.mmsCnt = dbHandle.columnInt(3); + MSG_SEC_DEBUG("(%d/%d) address = %s, report_type = %d, report_status = %d, report_time = %d", i+1, rowCnt, report_status[i].addressVal, report_status[i].type, report_status[i].status, report_status[i].statusTime); + } - strncpy(threadView.threadName, (char *)dbHandle.columnText(4), MAX_THREAD_NAME_LEN); + *pReportStatus = report_status; - threadView.mainType = dbHandle.columnInt(5); - threadView.subType = dbHandle.columnInt(6); + dbHandle->freeTable(); - threadView.direction = dbHandle.columnInt(7); - threadView.threadTime = (time_t)dbHandle.columnInt(8); + return MSG_SUCCESS; +} - strncpy(threadView.threadData, (char *)dbHandle.columnText(9), MAX_THREAD_DATA_LEN); +msg_error_t MsgStoGetMmsReportStatus(msg_message_id_t msgId, int *count, MSG_REPORT_STATUS_INFO_S **pReportStatus) +{ + MsgDbHandler *dbHandle = getDbHandle(); + char sqlQuery[MAX_QUERY_LEN+1]; - tr1::unordered_set::iterator it; + msg_direction_type_t direction = MSG_DIRECTION_TYPE_MO; - it = IdList.find(threadView.threadId); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_DIRECTION FROM %s WHERE MSG_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, msgId); - if (it == IdList.end()) { - IdList.insert(threadView.threadId); - searchList.push(threadView); - } + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + direction = dbHandle->columnInt(0); } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); - // Add data to Out Parameter - pThreadViewList->nCount = searchList.size(); - pThreadViewList->msg_struct_info = (msg_struct_t *)new char[sizeof(msg_struct_t) * searchList.size()]; + if (direction == MSG_DIRECTION_TYPE_MO) {//get received report list of MO message - MSG_THREAD_VIEW_S *pTmp = NULL; - msg_struct_s *thread_t = NULL; + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + //MSG_ID INTEGER , ADDRESS_VAL TEXT , STATUS_TYPE INTEGER , STATUS INTEGER DEFAULT 0 , TIME DATETIME) + //select * from MSG_REPORT_TABLE where MSG_ID=38 order by ADDRESS_VAL DESC, STATUS_TYPE ASC; + snprintf(sqlQuery, sizeof(sqlQuery), + "SELECT ADDRESS_VAL, STATUS_TYPE, STATUS, TIME " + "FROM %s " + "WHERE MSG_ID = %d " + "order by ADDRESS_VAL DESC, STATUS_TYPE ASC;" + , MSGFW_REPORT_TABLE_NAME, msgId); + + int rowCnt; + msg_error_t err = dbHandle->getTable(sqlQuery, &rowCnt); + if (err != MSG_SUCCESS) { + MSG_DEBUG("Fail to getTable()."); + dbHandle->freeTable(); + return err; + } - int index = 0; + int index = 4; - while (!searchList.empty()) { - thread_t = (msg_struct_s *)new msg_struct_s; - pThreadViewList->msg_struct_info[index] = (msg_struct_t)thread_t; + *count = rowCnt; + MSG_REPORT_STATUS_INFO_S *report_status = (MSG_REPORT_STATUS_INFO_S*)new char[sizeof(MSG_REPORT_STATUS_INFO_S)*rowCnt]; + memset(report_status, 0x00, sizeof(MSG_REPORT_STATUS_INFO_S)*rowCnt); - thread_t->type = MSG_STRUCT_THREAD_INFO; - thread_t->data = new MSG_THREAD_VIEW_S; + for (int i = 0; i < rowCnt; i++) { + dbHandle->getColumnToString(index++, MAX_ADDRESS_VAL_LEN, report_status[i].addressVal); + report_status[i].type = dbHandle->getColumnToInt(index++); + report_status[i].status = dbHandle->getColumnToInt(index++); + report_status[i].statusTime = (time_t)dbHandle->getColumnToInt(index++); - pTmp = (MSG_THREAD_VIEW_S *)thread_t->data; - memset(pTmp, 0x00, sizeof(MSG_THREAD_VIEW_S)); + MSG_DEBUG("(%d/%d) addr = %s, report_type = %d, report_status = %d, report_time = %d", i+1, rowCnt, report_status[i].addressVal, report_status[i].type, report_status[i].status, report_status[i].statusTime ); + } - memcpy(pTmp, &(searchList.front()), sizeof(MSG_THREAD_VIEW_S)); + *pReportStatus = report_status; - searchList.pop(); + dbHandle->freeTable(); - index++; - } + } else if (direction == MSG_DIRECTION_TYPE_MT) {//read report sent status of MT message - return MSG_SUCCESS; -} + int readReportSentStatus; + if (MsgStoCheckReadReportRequested(dbHandle, msgId) == false) { + *count = 0; + *pReportStatus = NULL; + return MSG_ERR_READREPORT_NOT_REQUESTED; + } -msg_error_t MsgStoSearchMessage(const MSG_SEARCH_CONDITION_S *pSearchCon, int offset, int limit, msg_struct_list_s *pMsgList) -{ - // Clear Out Parameter - pMsgList->nCount = 0; - pMsgList->msg_struct_info = NULL; + MsgStoGetReadReportSendStatus(msgId, &readReportSentStatus); - int rowCnt = 0; - int index = 19; // numbers of index + *count = 1; - unsigned int tmpSize = 0; + MSG_REPORT_STATUS_INFO_S *report_status = (MSG_REPORT_STATUS_INFO_S*)new char[sizeof(MSG_REPORT_STATUS_INFO_S)]; + memset(report_status, 0x00, sizeof(MSG_REPORT_STATUS_INFO_S)); - unsigned int searchValSize = 0; - unsigned int addrValSize = 0; + report_status->addressVal[0] = '\0'; + report_status->type = MSG_REPORT_TYPE_READ_REPORT_SENT; + report_status->status = readReportSentStatus; + report_status->statusTime = 0; - if (pSearchCon->pSearchVal) - searchValSize = strlen(pSearchCon->pSearchVal); + MSG_DEBUG("report_type = %d, report_status = %d", report_status->type, report_status->status); - if (pSearchCon->pAddressVal) - addrValSize = strlen(pSearchCon->pAddressVal); + *pReportStatus = report_status; - MSG_DEBUG("searchValSize [%d]", searchValSize); - MSG_DEBUG("addrValSize [%d]", addrValSize); - unsigned int maxQuerySize = MAX_QUERY_LEN+(searchValSize*6)+addrValSize+1; + } - MSG_DEBUG("MAX_QUERY_LEN+(searchValSize*6)+addrValSize+1 [%d]", maxQuerySize); - - char sqlQuery[maxQuerySize]; - - char *ext1_str = NULL; - char *ext2_str = NULL; - char *ext3_str = NULL; - - // Get Name Order - int order = MsgGetContactNameOrder(); - - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT " - "A.MSG_ID, " - "A.CONV_ID, " - "A.FOLDER_ID, " - "A.STORAGE_ID, " - "A.MAIN_TYPE, " - "A.SUB_TYPE, " - "A.DISPLAY_TIME, " - "A.DATA_SIZE, " - "A.NETWORK_STATUS, " - "A.READ_STATUS, " - "A.PROTECTED, " - "A.BACKUP, " - "A.PRIORITY, " - "A.MSG_DIRECTION, " - "A.SCHEDULED_TIME, " - "A.SUBJECT, " - "A.MSG_TEXT, " - "A.ATTACHMENT_COUNT, " - "A.THUMB_PATH " - "FROM %s A, %s B WHERE A.CONV_ID = B.CONV_ID AND B.ADDRESS_ID <> 0 ", - MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME); - - tmpSize = strlen(sqlQuery); - if (pSearchCon->folderId == MSG_ALLBOX_ID) - snprintf(sqlQuery+tmpSize, maxQuerySize-tmpSize, "AND A.FOLDER_ID > 0 AND A.FOLDER_ID < %d ", MSG_CBMSGBOX_ID); - else if (pSearchCon->folderId == MSG_IOSBOX_ID) - snprintf(sqlQuery+tmpSize, maxQuerySize-tmpSize, "AND A.FOLDER_ID > 0 AND A.FOLDER_ID < %d ", MSG_DRAFT_ID); - else - snprintf(sqlQuery+tmpSize, maxQuerySize-tmpSize, "AND A.FOLDER_ID = %d ", pSearchCon->folderId); - - - //// msg type - tmpSize = strlen(sqlQuery); - switch (pSearchCon->msgType) { - case MSG_TYPE_SMS: - snprintf(sqlQuery+tmpSize, maxQuerySize-tmpSize, "AND A.MAIN_TYPE = %d AND A.SUB_TYPE = %d ", MSG_SMS_TYPE, MSG_NORMAL_SMS); - break; - - case MSG_TYPE_MMS: - snprintf(sqlQuery+tmpSize, maxQuerySize-tmpSize, "AND A.MAIN_TYPE = %d ", MSG_MMS_TYPE); - break; - - case MSG_TYPE_MMS_JAVA: - snprintf(sqlQuery+tmpSize, maxQuerySize-tmpSize, "AND A.MAIN_TYPE = %d AND A.SUB_TYPE = %d ", MSG_MMS_TYPE, MSG_SENDREQ_JAVA_MMS); - break; + return MSG_SUCCESS; +} - case MSG_TYPE_SMS_SYNCML: - snprintf(sqlQuery+tmpSize, maxQuerySize-tmpSize, "AND A.MAIN_TYPE = %d AND A.SUB_TYPE = %d ", MSG_SMS_TYPE, MSG_SYNCML_CP); - break; - case MSG_TYPE_SMS_REJECT: - snprintf(sqlQuery+tmpSize, maxQuerySize-tmpSize, "AND A.MAIN_TYPE = %d AND A.SUB_TYPE = %d ", MSG_SMS_TYPE, MSG_REJECT_SMS); - break; +msg_error_t MsgStoGetThreadIdByAddress(const MSG_MESSAGE_INFO_S *pMsg, msg_thread_id_t *pThreadId) +{ + MsgDbHandler *dbHandle = getDbHandle(); + if(pMsg->nAddressCnt > 0) { + if (MsgExistAddress(dbHandle, pMsg, pThreadId) == true) { + MSG_DEBUG("Conversation ID : [%d]", *pThreadId); - default: - MSG_DEBUG("msg type is not set."); - break; + // check thread count + MSG_THREAD_VIEW_S threadInfo; + memset(&threadInfo, 0x00, sizeof(MSG_THREAD_VIEW_S)); + MsgStoGetThreadInfo(*pThreadId, &threadInfo); + MSG_DEBUG("threadInfo.smsCnt [%d], threadInfo.mmsCnt [%d]", threadInfo.smsCnt, threadInfo.mmsCnt); + if ((threadInfo.smsCnt + threadInfo.mmsCnt) > 0) { + return MSG_SUCCESS; + } + } } + *pThreadId = 0; + return MSG_SUCCESS; +} - /// string - if (pSearchCon->pSearchVal != NULL) { - tmpSize = strlen(sqlQuery); +msg_error_t MsgStoGetThreadUnreadCnt(msg_thread_id_t threadId, int *cnt) +{ + MSG_BEGIN(); - // Replace string for '%' and '_' character - ext1_str = MsgStoReplaceString(pSearchCon->pSearchVal, "_", "\\_"); - ext2_str = MsgStoReplaceString(ext1_str, "%", "\\%"); - ext3_str = MsgStoReplaceString(ext2_str, "'", "''"); + MsgDbHandler *dbHandle = getDbHandle(); + int msgCnt = 0; + *cnt = 0; - snprintf(sqlQuery+tmpSize, maxQuerySize-tmpSize, - "AND ( A.MSG_TEXT LIKE '%%%s%%' ESCAPE '\\' " - "OR A.SUBJECT LIKE '%%%s%%' ESCAPE '\\' " - "OR B.ADDRESS_VAL LIKE '%%%s%%' ESCAPE '\\' " - "OR B.DISPLAY_NAME LIKE '%%%s%%' ESCAPE '\\' " - "OR B.FIRST_NAME LIKE '%%%s%%' ESCAPE '\\' " - "OR B.LAST_NAME LIKE '%%%s%%' ESCAPE '\\') ", - ext3_str, ext3_str, ext3_str, ext3_str, ext3_str, ext3_str); + char sqlQuery[MAX_QUERY_LEN+1]; - if (ext1_str) { - free(ext1_str); - ext1_str = NULL; - } + // Get MSG_ID + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s A \ + WHERE CONV_ID = %d AND READ_STATUS = 0;", MSGFW_MESSAGE_TABLE_NAME, threadId); - if (ext2_str) { - free(ext2_str); - ext2_str = NULL; - } + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; - if (ext3_str) { - free(ext3_str); - ext3_str = NULL; - } + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + msgCnt = dbHandle->columnInt(0); } - /// address - if (pSearchCon->pAddressVal != NULL) { + dbHandle->finalizeQuery(); - tmpSize = strlen(sqlQuery); + *cnt = msgCnt; - // Replace string for '%' and '_' character - ext1_str = MsgStoReplaceString(pSearchCon->pAddressVal, "_", "\\_"); - ext2_str = MsgStoReplaceString(ext1_str, "%", "\\%"); - ext3_str = MsgStoReplaceString(ext2_str, "'", "''"); + MSG_END(); - snprintf(sqlQuery+tmpSize, maxQuerySize-tmpSize, "AND B.ADDRESS_VAL LIKE '%%%s%%' ESCAPE '\\' ", ext3_str); + return MSG_SUCCESS; +} - if (ext1_str) { - free(ext1_str); - ext1_str = NULL; - } - if (ext2_str) { - free(ext2_str); - ext2_str = NULL; - } +msg_error_t MsgStoGetThreadInfo(msg_thread_id_t threadId, MSG_THREAD_VIEW_S *pThreadInfo) +{ + MSG_BEGIN(); - if (ext3_str) { - free(ext3_str); - ext3_str = NULL; - } - } + MsgDbHandler *dbHandle = getDbHandle(); + int rowCnt; + int index = 22; // numbers of index - /// limit, offset - tmpSize = strlen(sqlQuery); - if (offset >= 0 && limit > 0) - snprintf(sqlQuery+tmpSize, maxQuerySize-tmpSize, "GROUP BY A.MSG_ID ORDER BY A.DISPLAY_TIME DESC LIMIT %d OFFSET %d;", limit, offset); - else - snprintf(sqlQuery+tmpSize, maxQuerySize-tmpSize, "GROUP BY A.MSG_ID ORDER BY A.DISPLAY_TIME DESC;"); + char sqlQuery[MAX_QUERY_LEN+1]; + memset(sqlQuery, 0x00, sizeof(sqlQuery)); - msg_error_t err = dbHandle.getTable(sqlQuery, &rowCnt); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.CONV_ID, A.UNREAD_CNT, A.SMS_CNT, A.MMS_CNT, " + "A.MAIN_TYPE, A.SUB_TYPE, A.MSG_DIRECTION, A.DISPLAY_TIME, A.DISPLAY_NAME, A.MSG_TEXT, " + "(SELECT COUNT(*) FROM %s B WHERE B.CONV_ID = A.CONV_ID AND B.PROTECTED = 1) AS PROTECTED, " + "(SELECT COUNT(*) FROM %s B WHERE B.CONV_ID = A.CONV_ID AND B.FOLDER_ID = %d) AS DRAFT, " + "(SELECT COUNT(*) FROM %s B WHERE B.CONV_ID = A.CONV_ID AND B.NETWORK_STATUS = %d) AS FAILED, " + "(SELECT COUNT(*) FROM %s B WHERE B.CONV_ID = A.CONV_ID AND B.NETWORK_STATUS = %d) AS SENDING, " + "A.TRANSLATION, A.SENDER_LANG, A.RECEIVER_LANG, A.ONLY_RECEIVE, A.INCLUDE_ORGMSG, A.LAST_MSG_ID, " + "(SELECT SIM_INDEX FROM %s B WHERE B.CONV_ID = A.CONV_ID), A.TAG_TYPE " + "FROM %s A WHERE A.CONV_ID = %d AND A.SMS_CNT + A.MMS_CNT > 0;", + MSGFW_MESSAGE_TABLE_NAME, + MSGFW_MESSAGE_TABLE_NAME, MSG_DRAFT_ID, + MSGFW_MESSAGE_TABLE_NAME, MSG_NETWORK_SEND_FAIL, + MSGFW_MESSAGE_TABLE_NAME, MSG_NETWORK_SENDING, + MSGFW_MESSAGE_TABLE_NAME, + MSGFW_CONVERSATION_TABLE_NAME, threadId); + + msg_error_t err = dbHandle->getTable(sqlQuery, &rowCnt); if (err == MSG_ERR_DB_NORECORD) { - dbHandle.freeTable(); - + dbHandle->freeTable(); return MSG_SUCCESS; } else if (err != MSG_SUCCESS) { - MSG_DEBUG("Get table fail. [%s]", sqlQuery); - - dbHandle.freeTable(); - + MSG_DEBUG("Fail to getTable()."); + dbHandle->freeTable(); return err; } - pMsgList->nCount = rowCnt; + if (rowCnt < 1) { + MSG_DEBUG("rowCnt is %d", rowCnt); + dbHandle->freeTable(); + return err; + } else { + pThreadInfo->threadId = dbHandle->getColumnToInt(index++); - MSG_DEBUG("pMsgList->nCount [%d]", pMsgList->nCount); + pThreadInfo->unreadCnt = dbHandle->getColumnToInt(index++); + pThreadInfo->smsCnt = dbHandle->getColumnToInt(index++); + pThreadInfo->mmsCnt = dbHandle->getColumnToInt(index++); - pMsgList->msg_struct_info = (msg_struct_t *)new char[sizeof(msg_struct_t) * rowCnt]; + pThreadInfo->mainType = dbHandle->getColumnToInt(index++); + pThreadInfo->subType = dbHandle->getColumnToInt(index++); - MSG_MESSAGE_HIDDEN_S *pTmp = NULL; - msg_struct_s *msg = NULL; + pThreadInfo->direction = dbHandle->getColumnToInt(index++); + pThreadInfo->threadTime = (time_t)dbHandle->getColumnToInt(index++); - for (int i = 0; i < rowCnt; i++) { - pMsgList->msg_struct_info[i] = (msg_struct_t)new msg_struct_s; - - msg = (msg_struct_s *)pMsgList->msg_struct_info[i]; - - msg->type = MSG_STRUCT_MESSAGE_INFO; - msg->data = (int *)new char[sizeof(MSG_MESSAGE_HIDDEN_S)]; - - pTmp = (MSG_MESSAGE_HIDDEN_S *)msg->data; - - memset(pTmp, 0x00, sizeof(MSG_MESSAGE_HIDDEN_S)); - - pTmp->pData = NULL; - pTmp->pMmsData = NULL; - - pTmp->msgId = dbHandle.getColumnToInt(index++); - pTmp->threadId = dbHandle.getColumnToInt(index++); - pTmp->folderId = dbHandle.getColumnToInt(index++); - pTmp->storageId = dbHandle.getColumnToInt(index++); - pTmp->mainType = dbHandle.getColumnToInt(index++); - pTmp->subType = dbHandle.getColumnToInt(index++); - pTmp->displayTime = (time_t)dbHandle.getColumnToInt(index++); - pTmp->dataSize = dbHandle.getColumnToInt(index++); - pTmp->networkStatus = dbHandle.getColumnToInt(index++); - pTmp->bRead = dbHandle.getColumnToInt(index++); - pTmp->bProtected = dbHandle.getColumnToInt(index++); - pTmp->bBackup = dbHandle.getColumnToInt(index++); - pTmp->priority = dbHandle.getColumnToInt(index++); - pTmp->direction= dbHandle.getColumnToInt(index++); - index++; // This field is reserved. - - dbHandle.getColumnToString(index++, MAX_SUBJECT_LEN, pTmp->subject); - - if (pTmp->mainType == MSG_MMS_TYPE && - (pTmp->networkStatus == MSG_NETWORK_RETRIEVING || pTmp->networkStatus == MSG_NETWORK_RETRIEVE_FAIL || pTmp->subType == MSG_NOTIFICATIONIND_MMS)) { - pTmp->pData = NULL; - index++; - } else { - MSG_DEBUG("pTmp->dataSize [%d]", pTmp->dataSize); - pTmp->pData = (void *)new char[pTmp->dataSize + 2]; - memset(pTmp->pData, 0x00, pTmp->dataSize + 2); + memset(pThreadInfo->threadName, 0x00, sizeof(pThreadInfo->threadName)); + dbHandle->getColumnToString(index++, MAX_THREAD_NAME_LEN, pThreadInfo->threadName); - dbHandle.getColumnToString(index++, pTmp->dataSize+1, (char *)pTmp->pData); - } + memset(pThreadInfo->threadData, 0x00, sizeof(pThreadInfo->threadData)); + dbHandle->getColumnToString(index++, MAX_THREAD_DATA_LEN, pThreadInfo->threadData); - msg_struct_list_s *addr_list = (msg_struct_list_s *)new msg_struct_list_s; + int protectedCnt = dbHandle->getColumnToInt(index++); + if (protectedCnt > 0) + pThreadInfo->bProtected = true; - MsgStoGetAddressByMsgId(&dbHandle, pTmp->msgId, order, addr_list); + int draftCnt = dbHandle->getColumnToInt(index++); + if (draftCnt > 0) + pThreadInfo->bDraft = true; - pTmp->addr_list = addr_list; + int failedCnt = dbHandle->getColumnToInt(index++); + if (failedCnt > 0) + pThreadInfo->bSendFailed = true; - pTmp->attachCount = dbHandle.getColumnToInt(index++); + int sendingCnt = dbHandle->getColumnToInt(index++); + if (sendingCnt > 0) + pThreadInfo->bSending = true; - dbHandle.getColumnToString(index++, MSG_FILEPATH_LEN_MAX, pTmp->thumbPath); + pThreadInfo->msgTranslation.bTranslation = dbHandle->getColumnToInt(index++); + pThreadInfo->msgTranslation.senderLang = dbHandle->getColumnToInt(index++); + pThreadInfo->msgTranslation.receiverLang = dbHandle->getColumnToInt(index++); + pThreadInfo->msgTranslation.bOnlyReceive = dbHandle->getColumnToInt(index++); + pThreadInfo->msgTranslation.bIncludeOrgMsg = dbHandle->getColumnToInt(index++); + pThreadInfo->lastMsgId = dbHandle->getColumnToInt(index++); + pThreadInfo->simIndex = dbHandle->getColumnToInt(index++); + pThreadInfo->tagType = dbHandle->getColumnToInt(index++); } - dbHandle.freeTable(); - - return MSG_SUCCESS; -} - - -void MsgConvertNumber(const char *pSrcNum, char *pDestNum) -{ - int overLen = 0; - int i = 0; - overLen = strlen(pSrcNum) - MAX_PRECONFIG_NUM; + dbHandle->freeTable(); - for (i = 0; i < MAX_PRECONFIG_NUM; i++) - pDestNum[i] = pSrcNum[i+overLen]; + MSG_END(); - pDestNum[i] = '\0'; + return MSG_SUCCESS; } -msg_error_t MsgStoGetRejectMsgList(const char *pNumber, msg_struct_list_s *pRejectMsgList) +msg_error_t MsgStoRestoreMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo) { - // Clear Out Parameter - pRejectMsgList->nCount = 0; - pRejectMsgList->msg_struct_info = NULL; - - int rowCnt = 0; - int index = 3; // numbers of index + MSG_BEGIN(); + MsgDbHandler *dbHandle = getDbHandle(); + msg_error_t err = MSG_SUCCESS; char sqlQuery[MAX_QUERY_LEN+1]; - // Search Reject Msg - memset(sqlQuery, 0x00, sizeof(sqlQuery)); + if(MsgExistConversation(dbHandle, pMsg->threadId)) + { + // add message to address table which having same thread_id and datetime; + for (int i=0; inAddressCnt; i++) { + if(MsgExistAddress(dbHandle, pMsg, pMsg->threadId, i) == false) + { + unsigned int addrId; + MSG_CONTACT_INFO_S contactInfo; + memset(&contactInfo, 0x00, sizeof(MSG_CONTACT_INFO_S)); + + // Get Contact Info +// if (MsgGetContactInfo(&(pMsg->addressList[i]), &contactInfo) != MSG_SUCCESS) { +// MSG_DEBUG("MsgGetContactInfo() fail."); +// } + err = dbHandle->getRowId(MSGFW_ADDRESS_TABLE_NAME, &addrId); + if (err != MSG_SUCCESS) { + MSG_DEBUG("pDbHandle->getRowId fail. [%d]", err); + return err; + } - if (pNumber != NULL) { - char phoneNumber[MAX_PRECONFIG_NUM+1]; - memset(phoneNumber, 0x00, sizeof(phoneNumber)); - - if (strlen(pNumber) > MAX_PRECONFIG_NUM) - MsgConvertNumber(pNumber, phoneNumber); - else - strncpy(phoneNumber, pNumber, MAX_PRECONFIG_NUM); - - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT B.MSG_ID, B.MSG_TEXT, B.DISPLAY_TIME \ - FROM %s A, %s B \ - WHERE A.CONV_ID = B.CONV_ID AND B.MAIN_TYPE = %d \ - AND B.SUB_TYPE = %d AND A.ADDRESS_VAL LIKE '%%%s' \ - ORDER BY B.DISPLAY_TIME DESC;", - MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, - MSG_SMS_TYPE, MSG_REJECT_SMS, phoneNumber); - } else { - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT B.MSG_ID, B.MSG_TEXT, B.DISPLAY_TIME \ - FROM %s A, %s B \ - WHERE A.CONV_ID = B.CONV_ID AND B.MAIN_TYPE = %d AND B.SUB_TYPE = %d \ - ORDER BY B.DISPLAY_TIME DESC;", - MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, - MSG_SMS_TYPE, MSG_REJECT_SMS); - } + // Add Address + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, '%s', %d, %d, ?, ?, ?, ?, ?, '%s', 0);", + MSGFW_ADDRESS_TABLE_NAME, addrId, pMsg->threadId, pMsg->addressList[i].addressType, pMsg->addressList[i].recipientType, pMsg->addressList[i].addressVal, + contactInfo.contactId, contactInfo.addrbookId, contactInfo.imagePath); - msg_error_t err = dbHandle.getTable(sqlQuery, &rowCnt); + MSG_SEC_DEBUG("Add Address Info. [%s]", sqlQuery); - if (err != MSG_SUCCESS) { - MSG_DEBUG("%s", sqlQuery); + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; - dbHandle.freeTable(); + dbHandle->bindText(contactInfo.firstName, 1); + dbHandle->bindText(contactInfo.lastName, 2); + dbHandle->bindText(contactInfo.middleName, 3); + dbHandle->bindText(contactInfo.prefix, 4); + dbHandle->bindText(contactInfo.suffix, 5); - return err; - } + if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) { + dbHandle->finalizeQuery(); + return MSG_ERR_DB_STEP; + } - pRejectMsgList->nCount = rowCnt; + dbHandle->finalizeQuery(); - MSG_DEBUG("pRejectMsgList->nCount [%d]", pRejectMsgList->nCount); + // set conversation display name by conv id + MsgStoSetConversationDisplayName(dbHandle, pMsg->threadId); + } + } - pRejectMsgList->msg_struct_info = (msg_struct_t *)new char[sizeof(MSG_REJECT_MSG_INFO_S *)*rowCnt]; - msg_struct_s* pTmp = NULL; + if(!MsgExistMessage(dbHandle, pMsg)) + { + unsigned int rowId = 0; - for (int i = 0; i < rowCnt; i++) { - pRejectMsgList->msg_struct_info[i] = (msg_struct_t)new char[sizeof(msg_struct_s)]; + if(pMsg->threadId > 0 && pMsg->folderId == MSG_DRAFT_ID) { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); - pTmp = (msg_struct_s *)pRejectMsgList->msg_struct_info[i]; - pTmp->type = MSG_STRUCT_REJECT_MSG_INFO; - pTmp->data = new char[sizeof(MSG_FOLDER_INFO_S)]; - MSG_REJECT_MSG_INFO_S * pMsg = (MSG_REJECT_MSG_INFO_S *)pTmp->data; - memset(pMsg, 0x00, sizeof(MSG_REJECT_MSG_INFO_S)); + snprintf(sqlQuery, sizeof(sqlQuery), + "DELETE FROM %s WHERE CONV_ID = %d AND FOLDER_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, pMsg->threadId, MSG_DRAFT_ID); - pMsg->msgId = dbHandle.getColumnToInt(index++); - memset(pMsg->msgText, 0x00, sizeof(pMsg->msgText)); - dbHandle.getColumnToString(index++, MAX_MSG_TEXT_LEN, pMsg->msgText); + MSG_DEBUG("sqlQuery [%s]", sqlQuery); - pMsg->displayTime = (time_t)dbHandle.getColumnToInt(index++); - } + err = dbHandle->execQuery(sqlQuery); - dbHandle.freeTable(); + if (err != MSG_SUCCESS) { + MSG_DEBUG("fail to delete draft messages."); + } + } - return MSG_SUCCESS; -} + err = dbHandle->getRowId(MSGFW_MESSAGE_TABLE_NAME, &rowId); + pMsg->msgId = (msg_message_id_t)rowId; -msg_error_t MsgStoGetSyncMLExtId(msg_message_id_t msgId, int *extId) -{ - char sqlQuery[MAX_QUERY_LEN+1]; + int fileSize = 0; - memset(sqlQuery, 0x00, sizeof(sqlQuery)); + char *pFileData = NULL; + AutoPtr buf(&pFileData); - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT EXT_ID FROM %s WHERE MSG_ID = %d;", - MSGFW_SYNCML_MSG_TABLE_NAME, msgId); + // Get File Data + if (pMsg->bTextSms == false) { + if (MsgOpenAndReadFile(pMsg->msgData, &pFileData, &fileSize) == false) { + return MSG_ERR_STORAGE_ERROR; + } + MSG_DEBUG("file size [%d]", fileSize); + } - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) - return MSG_ERR_DB_PREPARE; + char keyName[MAX_VCONFKEY_NAME_LEN]; + memset(keyName, 0x00, sizeof(keyName)); + sprintf(keyName, "%s/%d", MSG_SIM_IMSI, pMsg->sim_idx); - if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { - *extId = dbHandle.columnInt(0); - } else { - dbHandle.finalizeQuery(); - return MSG_ERR_DB_STEP; - } + char *imsi = MsgSettingGetString(keyName); - dbHandle.finalizeQuery(); + // Add Message + memset(sqlQuery, 0x00, sizeof(sqlQuery)); - return MSG_SUCCESS; -} + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %ld, %d, %d, %d, %d, %d, %d, 0, %d, ?, '', '', ?, 0, %d, '%s');", + MSGFW_MESSAGE_TABLE_NAME, rowId, pMsg->threadId, pMsg->folderId, pMsg->storageId, pMsg->msgType.mainType, pMsg->msgType.subType, + pMsg->displayTime, pMsg->dataSize, pMsg->networkStatus, pMsg->bRead, pMsg->bProtected, pMsg->priority, pMsg->direction, + pMsg->bBackup, pMsg->sim_idx, imsi); -msg_error_t MsgStoGetReportStatus(msg_message_id_t msgId, int *count, MSG_REPORT_STATUS_INFO_S **pReportStatus) -{ - char sqlQuery[MAX_QUERY_LEN+1]; - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - //MSG_ID INTEGER , ADDRESS_VAL TEXT , STATUS_TYPE INTEGER , STATUS INTEGER DEFAULT 0 , TIME DATETIME) - //select * from MSG_REPORT_TABLE where MSG_ID=38 order by ADDRESS_VAL DESC, STATUS_TYPE ASC; - snprintf(sqlQuery, sizeof(sqlQuery), - "SELECT ADDRESS_VAL, STATUS_TYPE, STATUS, TIME " - "FROM %s " - "WHERE MSG_ID = %d " - "order by ADDRESS_VAL DESC, STATUS_TYPE ASC;" - , MSGFW_REPORT_TABLE_NAME, msgId); + MSG_DEBUG("QUERY : %s", sqlQuery); - int rowCnt; - msg_error_t err = dbHandle.getTable(sqlQuery, &rowCnt); - if (err != MSG_SUCCESS) { - MSG_DEBUG("%s", sqlQuery); - dbHandle.freeTable(); - return err; - } + if (imsi) { + free(imsi); + imsi = NULL; + } - int index = 4; + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + return MSG_ERR_DB_EXEC; + } - *count = rowCnt; - MSG_REPORT_STATUS_INFO_S *report_status = (MSG_REPORT_STATUS_INFO_S*)new char[sizeof(MSG_REPORT_STATUS_INFO_S)*rowCnt]; - memset(report_status, 0x00, sizeof(MSG_REPORT_STATUS_INFO_S)*rowCnt); + dbHandle->bindText(pMsg->subject, 1); - for (int i = 0; i < rowCnt; i++) { - dbHandle.getColumnToString(index++, MAX_ADDRESS_VAL_LEN, report_status[i].addressVal); - report_status[i].type = dbHandle.getColumnToInt(index++); - report_status[i].status = dbHandle.getColumnToInt(index++); - report_status[i].statusTime = (time_t)dbHandle.getColumnToInt(index++); + if (pMsg->bTextSms == false) + dbHandle->bindText(pFileData, 2); + else + dbHandle->bindText(pMsg->msgText, 2); - MSG_DEBUG("(%d/%d) addr = %s, report_type = %d, report_status = %d, report_time = %d", i, rowCnt, report_status[i].addressVal, report_status[i].type, report_status[i].status, report_status[i].statusTime ); - } + if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) { + dbHandle->finalizeQuery(); + return MSG_ERR_DB_EXEC; + } - *pReportStatus = report_status; + dbHandle->finalizeQuery(); - return MSG_SUCCESS; -} + if (pMsg->msgType.subType != MSG_SENDREQ_MMS) { + err = MsgStoUpdateConversation(dbHandle, pMsg->threadId); + if (err != MSG_SUCCESS) { + return err; + } + } -msg_error_t MsgStoGetThreadIdByAddress(const MSG_MESSAGE_INFO_S *pMsg, msg_thread_id_t *pThreadId) -{ - if(pMsg->nAddressCnt > 0) { - if (MsgExistAddress(&dbHandle, pMsg, pThreadId) == true) { - MSG_DEBUG("Conversation ID : [%d]", *pThreadId); - } else { - *pThreadId = 0; - return MSG_ERR_STORAGE_ERROR; - } - } else { - *pThreadId = 0; - } - return MSG_SUCCESS; -} + /* In the case of MMS Message, load the MMS plugin to save MMS PDU */ + if (pMsg->msgType.mainType == MSG_MMS_TYPE) { + MMS_MESSAGE_DATA_S mmsMsg; + memset(&mmsMsg, 0x00, sizeof(MMS_MESSAGE_DATA_S)); + if (pMsg->msgType.subType != MSG_DELIVERYIND_MMS && pMsg->msgType.subType != MSG_READORGIND_MMS) { + MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_MMS_TYPE); -msg_error_t MsgStoGetThreadUnreadCnt(msg_thread_id_t threadId, int *cnt) -{ - MSG_BEGIN(); + err = plg->addMessage(pMsg, pSendOptInfo, pFileData); - int msgCnt = 0; - *cnt = 0; + if (err != MSG_SUCCESS) + return MSG_ERR_STORAGE_ERROR; - char sqlQuery[MAX_QUERY_LEN+1]; + if (pMsg->msgType.subType == MSG_SENDREQ_MMS) { + MSG_DEBUG("pMsg->msgText: %s, pMsg->thumbPath: %s ", pMsg->msgText, pMsg->thumbPath); - memset(sqlQuery, 0x00, sizeof(sqlQuery)); + err = MsgStoUpdateMMSMessage(pMsg); - // Get MSG_ID - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s A \ - WHERE CONV_ID = %d AND READ_STATUS = 0;", MSGFW_MESSAGE_TABLE_NAME, threadId); + if (err != MSG_SUCCESS) + return MSG_ERR_STORAGE_ERROR; - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) - return MSG_ERR_DB_PREPARE; + } + } + } - if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { - msgCnt = dbHandle.columnInt(0); + } + } + else + { + // add message to conversation, message, address table; + pMsg->msgId = 0; + err = MsgStoAddMessage(pMsg, pSendOptInfo); } - - dbHandle.finalizeQuery(); - - *cnt = msgCnt; MSG_END(); - return MSG_SUCCESS; -} - - -msg_error_t MsgStoGetAddressList(const msg_thread_id_t threadId, msg_struct_list_s *pAddrList) -{ - msg_error_t err = MSG_SUCCESS; - - int order = MsgGetContactNameOrder(); - - err = MsgStoGetAddressByConvId(&dbHandle, threadId, order, pAddrList); - return err; } -msg_error_t MsgStoGetThreadInfo(msg_thread_id_t threadId, MSG_THREAD_VIEW_S *pThreadInfo) +msg_message_id_t MsgStoAddSimMessage(MSG_MESSAGE_INFO_S *pMsg, int *simIdList, int listSize) { MSG_BEGIN(); - - int rowCnt; - int index = 11; // numbers of index - - char sqlQuery[MAX_QUERY_LEN+1]; - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.CONV_ID, A.UNREAD_CNT, A.SMS_CNT, A.MMS_CNT, \ - A.MAIN_TYPE, A.SUB_TYPE, A.MSG_DIRECTION, A.DISPLAY_TIME, A.DISPLAY_NAME, A.MSG_TEXT, \ - (SELECT COUNT(*) FROM %s B WHERE B.CONV_ID = A.CONV_ID AND B.PROTECTED = 1) AS PROTECTED \ - FROM %s A WHERE A.CONV_ID = %d;", - MSGFW_MESSAGE_TABLE_NAME, MSGFW_CONVERSATION_TABLE_NAME, threadId); - - msg_error_t err = dbHandle.getTable(sqlQuery, &rowCnt); - - if (err == MSG_ERR_DB_NORECORD) { - dbHandle.freeTable(); - return MSG_SUCCESS; - } else if (err != MSG_SUCCESS) { - MSG_DEBUG("%s", sqlQuery); - dbHandle.freeTable(); - return err; + MsgDbHandler *dbHandle = getDbHandle(); + if (pMsg == NULL || pMsg->msgType.mainType == MSG_MMS_TYPE) { + MSG_DEBUG("pMsg == NULL || pMsg->msgType.mainType == MSG_MMS_TYPE"); + return 0; } - if (rowCnt < 1) { - MSG_DEBUG("rowCnt is %d", rowCnt); - dbHandle.freeTable(); - return err; + if ((pMsg->msgType.subType >= MSG_REPLACE_TYPE1_SMS) && (pMsg->msgType.subType <= MSG_REPLACE_TYPE7_SMS)) { + if (pMsg->msgId > 0) { + pMsg->bRead = false; + if (MsgStoUpdateMessage(pMsg, NULL) != MSG_SUCCESS) { + MSG_DEBUG("MsgStoUpdateMessage is failed!!!"); + } + } else { + if (MsgStoAddMessage(pMsg, NULL) != MSG_SUCCESS) { + MSG_DEBUG("MsgStoAddMessage is failed!!!"); + } + } } else { - pThreadInfo->threadId = dbHandle.getColumnToInt(index++); - - pThreadInfo->unreadCnt = dbHandle.getColumnToInt(index++); - pThreadInfo->smsCnt = dbHandle.getColumnToInt(index++); - pThreadInfo->mmsCnt = dbHandle.getColumnToInt(index++); + pMsg->msgId = 0; + if (MsgStoAddMessage(pMsg, NULL) != MSG_SUCCESS) { + MSG_DEBUG("MsgStoAddMessage is failed!!!"); + } + } - pThreadInfo->mainType = dbHandle.getColumnToInt(index++); - pThreadInfo->subType = dbHandle.getColumnToInt(index++); + if(simIdList) { + dbHandle->beginTrans(); - pThreadInfo->direction = dbHandle.getColumnToInt(index++); - pThreadInfo->threadTime = (time_t)dbHandle.getColumnToInt(index++); + MSG_DEBUG("simIdList exist."); + int simId = 0; + for(int i=0; i < listSize; ++i) + { + if(simIdList[i]) { + simId = simIdList[i] - 1; + char sqlQuery[MAX_QUERY_LEN+1]; + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d);", + MSGFW_SIM_MSG_TABLE_NAME, pMsg->sim_idx, simId, pMsg->msgId); - memset(pThreadInfo->threadName, 0x00, sizeof(pThreadInfo->threadName)); - dbHandle.getColumnToString(index++, MAX_THREAD_NAME_LEN, pThreadInfo->threadName); + MSG_DEBUG("QUERY : %s", sqlQuery); - memset(pThreadInfo->threadData, 0x00, sizeof(pThreadInfo->threadData)); - dbHandle.getColumnToString(index++, MAX_THREAD_DATA_LEN, pThreadInfo->threadData); + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); + return 0; + } + } else { + break; + } + } - int protectedCnt = dbHandle.getColumnToInt(index++); - if (protectedCnt > 0) - pThreadInfo->bProtected = true; + dbHandle->endTrans(true); } - dbHandle.freeTable(); - MSG_END(); - return MSG_SUCCESS; + return pMsg->msgId; } - -msg_error_t MsgStoGetMessageList(msg_folder_id_t folderId, msg_thread_id_t threadId, msg_message_type_t msgType, msg_storage_id_t storageId, msg_struct_list_s *pMsgList) +msg_error_t MsgStoUpdateIMSI(int sim_idx) { - // Clear Out Parameter - pMsgList->nCount = 0; - pMsgList->msg_struct_info = NULL; + MSG_BEGIN(); + MSG_DEBUG("sim_idx = %d", sim_idx); - int rowCnt = 0; - int index = 19; // numbers of index +// msg_error_t err = MSG_SUCCESS; + MsgDbHandler *dbHandle = getDbHandle(); char sqlQuery[MAX_QUERY_LEN+1]; - char sqlQuerySubset[(MAX_QUERY_LEN/5)+1]; - - // Get Name Order - int order = MsgGetContactNameOrder(); - - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, CONV_ID, FOLDER_ID, STORAGE_ID, MAIN_TYPE, SUB_TYPE, \ - DISPLAY_TIME, DATA_SIZE, NETWORK_STATUS, READ_STATUS, PROTECTED, BACKUP, PRIORITY, \ - MSG_DIRECTION, SCHEDULED_TIME, SUBJECT, MSG_TEXT, ATTACHMENT_COUNT, THUMB_PATH \ - FROM %s WHERE ", MSGFW_MESSAGE_TABLE_NAME); - - - //// folder - memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); - - if (folderId == MSG_ALLBOX_ID) - snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "FOLDER_ID > 0 AND FOLDER_ID < %d ", MSG_CBMSGBOX_ID); - else if (folderId == MSG_IOSBOX_ID) - snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "FOLDER_ID > 0 AND FOLDER_ID < %d ", MSG_DRAFT_ID); - else - snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "FOLDER_ID = %d ", folderId); - - strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery)); - - - //// thread - memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); - - if (threadId > 0) - snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND CONV_ID = %d ", threadId); - - strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery)); - - - //// msg type - memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); - - switch (msgType) { - case MSG_TYPE_SMS: - snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND MAIN_TYPE = %d AND SUB_TYPE = %d ", MSG_SMS_TYPE, MSG_NORMAL_SMS); - break; + char keyName[MAX_VCONFKEY_NAME_LEN]; - case MSG_TYPE_MMS: - snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND MAIN_TYPE = %d ", MSG_MMS_TYPE); - break; + dbHandle->beginTrans(); - case MSG_TYPE_MMS_JAVA: - snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND MAIN_TYPE = %d AND SUB_TYPE = %d ", MSG_MMS_TYPE, MSG_SENDREQ_JAVA_MMS); - break; - - case MSG_TYPE_SMS_SYNCML: - snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND MAIN_TYPE = %d AND SUB_TYPE = %d ", MSG_SMS_TYPE, MSG_SYNCML_CP); - break; - - case MSG_TYPE_SMS_REJECT: - snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND MAIN_TYPE = %d AND SUB_TYPE = %d ", MSG_SMS_TYPE, MSG_REJECT_SMS); - break; - - default: - MSG_DEBUG("msg type is not set."); - } - - strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery)); - - //// storage - memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); - - if (storageId > MSG_STORAGE_UNKNOWN) - snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND STORAGE_ID = %d ", storageId); - - strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery)); - - - /// order - memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); - snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "ORDER BY DISPLAY_TIME DESC;"); - - strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery)); - - msg_error_t err = dbHandle.getTable(sqlQuery, &rowCnt); - - if (err == MSG_ERR_DB_NORECORD) { - dbHandle.freeTable(); + if(sim_idx == 0){ + MSG_DEBUG("sim index is 0"); + memset(sqlQuery, 0x00, sizeof(sqlQuery)); - return MSG_SUCCESS; - } else if (err != MSG_SUCCESS) { - MSG_DEBUG("Get table fail. [%s]", sqlQuery); + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET SIM_INDEX = 0;", + MSGFW_MESSAGE_TABLE_NAME); - dbHandle.freeTable(); + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); + return MSG_ERR_DB_EXEC; + } - return err; + if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) { + dbHandle->finalizeQuery(); + dbHandle->endTrans(false); + return MSG_ERR_DB_EXEC; + } } + else + { + MSG_DEBUG("sim index is %d", sim_idx); - pMsgList->nCount = rowCnt; + memset(keyName, 0x00, sizeof(keyName)); + sprintf(keyName, "%s/%d", MSG_SIM_IMSI, sim_idx); - MSG_DEBUG("pMsgList->nCount [%d]", pMsgList->nCount); + char *imsi = MsgSettingGetString(keyName); - pMsgList->msg_struct_info = (msg_struct_t *)new char[sizeof(msg_struct_t) * rowCnt]; + MSG_DEBUG("imsi value exist -> %s", imsi); - MSG_MESSAGE_HIDDEN_S *pTmp = NULL; - msg_struct_s *msg = NULL; + memset(sqlQuery, 0x00, sizeof(sqlQuery)); - for (int i = 0; i < rowCnt; i++) { - pMsgList->msg_struct_info[i] = (msg_struct_t)new msg_struct_s; - - msg = (msg_struct_s *)pMsgList->msg_struct_info[i]; - - msg->type = MSG_STRUCT_MESSAGE_INFO; - msg->data = (int *)new char[sizeof(MSG_MESSAGE_HIDDEN_S)]; - - pTmp = (MSG_MESSAGE_HIDDEN_S *)msg->data; - - memset(pTmp, 0x00, sizeof(MSG_MESSAGE_HIDDEN_S)); - - pTmp->pData = NULL; - pTmp->pMmsData = NULL; - - pTmp->msgId = dbHandle.getColumnToInt(index++); - pTmp->threadId = dbHandle.getColumnToInt(index++); - pTmp->folderId = dbHandle.getColumnToInt(index++); - pTmp->storageId = dbHandle.getColumnToInt(index++); - pTmp->mainType = dbHandle.getColumnToInt(index++); - pTmp->subType = dbHandle.getColumnToInt(index++); - pTmp->displayTime = (time_t)dbHandle.getColumnToInt(index++); - pTmp->dataSize = dbHandle.getColumnToInt(index++); - pTmp->networkStatus = dbHandle.getColumnToInt(index++); - pTmp->bRead = dbHandle.getColumnToInt(index++); - pTmp->bProtected = dbHandle.getColumnToInt(index++); - pTmp->bBackup = dbHandle.getColumnToInt(index++); - pTmp->priority = dbHandle.getColumnToInt(index++); - pTmp->direction = dbHandle.getColumnToInt(index++); - index++; // This field is reserved. - - dbHandle.getColumnToString(index++, MAX_SUBJECT_LEN, pTmp->subject); - - if (pTmp->mainType == MSG_MMS_TYPE && - (pTmp->networkStatus == MSG_NETWORK_RETRIEVING || pTmp->networkStatus == MSG_NETWORK_RETRIEVE_FAIL || pTmp->subType == MSG_NOTIFICATIONIND_MMS)) { - pTmp->pData = NULL; - index++; - } else { - pTmp->pData = (void *)new char[pTmp->dataSize+2]; - memset(pTmp->pData, 0x00, pTmp->dataSize+2); + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET SIM_INDEX = %d \ + WHERE SIM_IMSI LIKE '%s';", + MSGFW_MESSAGE_TABLE_NAME, sim_idx, imsi); - dbHandle.getColumnToString(index++, pTmp->dataSize+1, (char *)pTmp->pData); + if (imsi) { + free(imsi); + imsi = NULL; } - pTmp->attachCount = dbHandle.getColumnToInt(index++); - - dbHandle.getColumnToString(index++, MSG_FILEPATH_LEN_MAX, pTmp->thumbPath); + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); + return MSG_ERR_DB_EXEC; + } - // add address information. - order = MsgGetContactNameOrder(); + if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) { + dbHandle->finalizeQuery(); + dbHandle->endTrans(false); + return MSG_ERR_DB_EXEC; + } + } - msg_struct_list_s *addr_list = (msg_struct_list_s *)new msg_struct_list_s; - MsgStoGetAddressByMsgId(&dbHandle, pTmp->msgId, order, addr_list); + dbHandle->finalizeQuery(); + dbHandle->endTrans(true); - pTmp->addr_list = addr_list; - } - dbHandle.freeTable(); + MSG_END(); return MSG_SUCCESS; } diff --git a/framework/storage-handler/MsgStorageMms.cpp b/framework/storage-handler/MsgStorageMms.cpp index 2b19b07..1b69cbd 100755 --- a/framework/storage-handler/MsgStorageMms.cpp +++ b/framework/storage-handler/MsgStorageMms.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include "MsgDebug.h" @@ -26,7 +26,6 @@ /*================================================================================================== VARIABLES ==================================================================================================*/ -extern MsgDbHandler dbHandle; /*================================================================================================== @@ -34,6 +33,7 @@ extern MsgDbHandler dbHandle; ==================================================================================================*/ msg_error_t MsgStoGetText(msg_message_id_t msgId, char *pSubject, char *pMsgText) { + MsgDbHandler *dbHandle = getDbHandle(); char sqlQuery[MAX_QUERY_LEN+1]; memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -41,24 +41,24 @@ msg_error_t MsgStoGetText(msg_message_id_t msgId, char *pSubject, char *pMsgText snprintf(sqlQuery, sizeof(sqlQuery), "SELECT SUBJECT, MSG_TEXT FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgId); - if(dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + if(dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_PREPARE; - if(dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + if(dbHandle->stepQuery() == MSG_ERR_DB_ROW) { - char *subject = (char*)dbHandle.columnText(0); - char *text = (char*)dbHandle.columnText(1); + char *subject = (char*)dbHandle->columnText(0); + char *text = (char*)dbHandle->columnText(1); if(subject) strncpy(pSubject, subject, MAX_SUBJECT_LEN); if(text) strncpy(pMsgText, text, MAX_MSG_TEXT_LEN); } else { - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_ERR_DB_STEP; } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_SUCCESS; @@ -70,6 +70,13 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg) { MSG_BEGIN(); + MSG_DEBUG("pMsg->msgText [%s]", pMsg->msgText); + MsgDbHandler *dbHandle = getDbHandle(); + msg_error_t err = MSG_SUCCESS; + + unsigned int fileSize = 0; + char *pFileData = NULL; + char sqlQuery[MAX_QUERY_LEN+1]; memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -77,54 +84,212 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg) if(pMsg->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsg->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) { if( pMsg->networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS ) { snprintf(sqlQuery, sizeof(sqlQuery), - "UPDATE %s SET MAIN_TYPE = %d, SUB_TYPE = %d, DISPLAY_TIME = %lu, SUBJECT = ?, NETWORK_STATUS = %d, MSG_TEXT = ?, THUMB_PATH = '%s', DATA_SIZE = %d WHERE MSG_ID = %d;", - MSGFW_MESSAGE_TABLE_NAME, pMsg->msgType.mainType, pMsg->msgType.subType, pMsg->displayTime, pMsg->networkStatus, pMsg->thumbPath, pMsg->dataSize, pMsg->msgId); + "UPDATE %s SET MAIN_TYPE = %d, SUB_TYPE = %d, FOLDER_ID = %d, DISPLAY_TIME = %lu, SUBJECT = ?, NETWORK_STATUS = %d, MSG_TEXT = ?, THUMB_PATH = '%s', DATA_SIZE = %d WHERE MSG_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, pMsg->msgType.mainType, pMsg->msgType.subType, pMsg->folderId, pMsg->displayTime, pMsg->networkStatus, pMsg->thumbPath, pMsg->dataSize, pMsg->msgId); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { return MSG_ERR_DB_PREPARE; } - dbHandle.bindText(pMsg->subject, 1); - dbHandle.bindText(pMsg->msgText, 2); + dbHandle->bindText(pMsg->subject, 1); + + if (pMsg->msgText[0] != '\0' && g_file_get_contents(pMsg->msgText, &pFileData, &fileSize, NULL) == true) { + dbHandle->bindText(pFileData, 2); + } else { + dbHandle->bindText("", 2); + } + } else if( pMsg->networkStatus == MSG_NETWORK_RETRIEVE_FAIL) { snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MAIN_TYPE = %d, SUB_TYPE = %d, SUBJECT = ?, NETWORK_STATUS = %d, MSG_TEXT = ?, THUMB_PATH = '%s' WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, pMsg->msgType.mainType, pMsg->msgType.subType, pMsg->networkStatus, pMsg->thumbPath, pMsg->msgId); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { return MSG_ERR_DB_PREPARE; } - dbHandle.bindText(pMsg->subject, 1); - dbHandle.bindText(pMsg->msgText, 2); +// if (MsgOpenAndReadFile(pMsg->msgText, &pFileData, &fileSize) == false) { + if (g_file_get_contents(pMsg->msgText, &pFileData, &fileSize, NULL) == false) { + return MSG_ERR_STORAGE_ERROR; + } + + dbHandle->bindText(pMsg->subject, 1); + + if (pMsg->msgText[0] != '\0' && g_file_get_contents(pMsg->msgText, &pFileData, &fileSize, NULL) == true) { + dbHandle->bindText(pFileData, 2); + } else { + dbHandle->bindText("", 2); + } } - } else if (pMsg->msgType.subType == MSG_SENDREQ_MMS) { + } else if (pMsg->msgType.subType == MSG_SENDREQ_MMS || pMsg->msgType.subType == MSG_RETRIEVE_MMS) { snprintf(sqlQuery, sizeof(sqlQuery), - "UPDATE %s SET MSG_DATA = '%s', MSG_TEXT = ?, THUMB_PATH = '%s', DATA_SIZE = %d WHERE MSG_ID = %d;", - MSGFW_MESSAGE_TABLE_NAME, pMsg->msgData, pMsg->thumbPath, pMsg->dataSize, pMsg->msgId); + "UPDATE %s SET MSG_TEXT = ?, THUMB_PATH = '%s', DATA_SIZE = %d WHERE MSG_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, pMsg->thumbPath, pMsg->dataSize, pMsg->msgId); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { return MSG_ERR_DB_PREPARE; } - dbHandle.bindText(pMsg->msgText, 1); + if (pMsg->msgText[0] != '\0' && g_file_get_contents(pMsg->msgText, &pFileData, &fileSize, NULL) == true) { + dbHandle->bindText(pFileData, 1); + } else { + dbHandle->bindText("", 1); + } } else { - snprintf(sqlQuery, sizeof(sqlQuery), - "UPDATE %s SET MAIN_TYPE = %d, SUB_TYPE = %d, FOLDER_ID = %d, NETWORK_STATUS = %d WHERE MSG_ID = %d;", - MSGFW_MESSAGE_TABLE_NAME, pMsg->msgType.mainType, pMsg->msgType.subType, pMsg->folderId, pMsg->networkStatus, pMsg->msgId); + if (pMsg->msgType.subType == MSG_SENDCONF_MMS && pMsg->networkStatus == MSG_NETWORK_SEND_FAIL) { + snprintf(sqlQuery, sizeof(sqlQuery), + "UPDATE %s SET MAIN_TYPE = %d, SUB_TYPE = %d, FOLDER_ID = %d, NETWORK_STATUS = %d, DISPLAY_TIME = %lu, READ_STATUS = 0 WHERE MSG_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, pMsg->msgType.mainType, pMsg->msgType.subType, pMsg->folderId, pMsg->networkStatus, pMsg->displayTime, pMsg->msgId); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { + } else { + snprintf(sqlQuery, sizeof(sqlQuery), + "UPDATE %s SET MAIN_TYPE = %d, SUB_TYPE = %d, FOLDER_ID = %d, NETWORK_STATUS = %d, DISPLAY_TIME = %lu WHERE MSG_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, pMsg->msgType.mainType, pMsg->msgType.subType, pMsg->folderId, pMsg->networkStatus, pMsg->displayTime, pMsg->msgId); + } + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { return MSG_ERR_DB_PREPARE; } } - if (dbHandle.stepQuery() != MSG_ERR_DB_DONE) { - dbHandle.finalizeQuery(); - MSG_DEBUG("Update MMS Message. Fail [%s]", sqlQuery); + MSG_DEBUG("[%s]", sqlQuery); + + err = dbHandle->stepQuery(); + + if (pFileData != NULL) { + g_free(pFileData); + } + + if (err != MSG_ERR_DB_DONE) { + dbHandle->finalizeQuery(); + MSG_DEBUG("Update MMS Message. Fail."); return MSG_ERR_DB_STEP; } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); + + /* PLM P141008-05143 : Notification.Ind address is 1, but MMS retreived Conf address is correct. + * So adding code for comparing exist address and new address and replace with new address(MMSconf) address */ + + if(pMsg->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsg->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) { + if (pMsg->nAddressCnt == 1 && pMsg->addressList) { + char tmpAddressVal[MAX_ADDRESS_VAL_LEN+1] = {0,}; + msg_address_type_t tmpAddressType; + msg_recipient_type_t tmpRecipientType; + int tmpConvId; + + //compare stored address and currnt address + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT " + "A.CONV_ID, " + "A.ADDRESS_TYPE, " + "A.RECIPIENT_TYPE, " + "A.ADDRESS_VAL " + "FROM %s A, %s B " + "WHERE A.CONV_ID = B.CONV_ID " + "AND B.MSG_ID = %d;", + MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, + pMsg->msgId); + + MSG_DEBUG("[%s]", sqlQuery); + + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + return MSG_ERR_DB_PREPARE; + } + + err = dbHandle->stepQuery(); + + if (err == MSG_ERR_DB_ROW) { + tmpConvId = dbHandle->columnInt(0); + tmpAddressType = dbHandle->columnInt(1); + tmpRecipientType = dbHandle->columnInt(2); + strncpy(tmpAddressVal, (char*)dbHandle->columnText(3), MAX_ADDRESS_VAL_LEN); + + dbHandle->finalizeQuery(); + + //compare stored addressList and current addressList + if (tmpAddressType != pMsg->addressList->addressType || + tmpRecipientType != pMsg->addressList->recipientType || + (strncmp(tmpAddressVal, pMsg->addressList->addressVal, MAX_ADDRESS_VAL_LEN) != 0)) { + + MSG_WARN("AddressList of NotiInd and MMSConf are different!!, Replace AddressList to MMSConf data"); + MSG_WARN("AddType [NotiInd : %d], [MMSConf : %d]", tmpAddressType, pMsg->addressList->addressType); + MSG_WARN("RcptType [NotiInd : %d], [MMSConf : %d]", tmpRecipientType, pMsg->addressList->recipientType); + MSG_WARN("AddressVal [NotiInd : %s], [MMSConf : %s]", tmpAddressVal, pMsg->addressList->addressVal); + + // If MMSConf AddressList is already exist, Replace exist ConvId with matching msgId + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), + "SELECT CONV_ID FROM %s WHERE ADDRESS_VAL = '%s'", + MSGFW_ADDRESS_TABLE_NAME, pMsg->addressList->addressVal); + + MSG_DEBUG("[%s]", sqlQuery); + + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + return MSG_ERR_DB_PREPARE; + } + + err = dbHandle->stepQuery(); + + if (err == MSG_ERR_DB_ROW) { + tmpConvId = dbHandle->columnInt(0); + + dbHandle->finalizeQuery(); + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), + "UPDATE %s SET CONV_ID = %d WHERE MSG_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, tmpConvId, pMsg->msgId); + + MSG_DEBUG("[%s]", sqlQuery); + + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + return MSG_ERR_DB_PREPARE; + } + + err = dbHandle->stepQuery(); + + if (err != MSG_ERR_DB_DONE) { + dbHandle->finalizeQuery(); + MSG_ERR("Replacing CONV_ID with exist one. Fail."); + return MSG_ERR_DB_STEP; + } + + dbHandle->finalizeQuery(); + } else { + dbHandle->finalizeQuery(); + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), + "UPDATE %s SET ADDRESS_TYPE = %d, RECIPIENT_TYPE = %d, ADDRESS_VAL = '%s' WHERE CONV_ID = %d;", + MSGFW_ADDRESS_TABLE_NAME, pMsg->addressList->addressType, pMsg->addressList->recipientType, pMsg->addressList->addressVal, tmpConvId); + + MSG_DEBUG("[%s]", sqlQuery); + + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + return MSG_ERR_DB_PREPARE; + } + + err = dbHandle->stepQuery(); + + if (err != MSG_ERR_DB_DONE) { + dbHandle->finalizeQuery(); + MSG_ERR("Replacing Address with MMSConf Address. Fail."); + return MSG_ERR_DB_STEP; + } + + dbHandle->finalizeQuery(); + } + } + } else { + dbHandle->finalizeQuery(); + return MSG_ERR_DB_STEP; + } + } + } msg_thread_id_t convId = 0; int row = 0; @@ -134,29 +299,33 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg) snprintf(sqlQuery, sizeof(sqlQuery), "SELECT CONV_ID FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, pMsg->msgId); - if (dbHandle.getTable(sqlQuery, &row) != MSG_SUCCESS) { - dbHandle.freeTable(); + if (dbHandle->getTable(sqlQuery, &row) != MSG_SUCCESS) { + dbHandle->freeTable(); return MSG_ERR_DB_PREPARE; } if (row > 0) { - convId = dbHandle.getColumnToInt(1); + convId = dbHandle->getColumnToInt(1); MSG_DEBUG("Conversation id:[%d]", convId); - if (MsgStoUpdateConversation(&dbHandle, convId) != MSG_SUCCESS) { + if (MsgStoUpdateConversation(dbHandle, convId) != MSG_SUCCESS) { MSG_DEBUG("MsgStoUpdateConversation() Error"); - dbHandle.freeTable(); + dbHandle->freeTable(); + return MSG_ERR_STORAGE_ERROR; } + if (MsgStoClearConversationTable(dbHandle) != MSG_SUCCESS) { + MSG_DEBUG("MsgStoClearConversationTable() Error"); + } + } else { - MSG_DEBUG("MsgStepQuery() Error [%s]", sqlQuery); - dbHandle.freeTable(); + dbHandle->freeTable(); return MSG_ERR_DB_STEP; } - dbHandle.freeTable(); + dbHandle->freeTable(); MSG_END(); @@ -166,6 +335,7 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg) msg_error_t MsgStoGetContentLocation(MSG_MESSAGE_INFO_S* pMsgInfo) { + MsgDbHandler *dbHandle = getDbHandle(); char sqlQuery[MAX_QUERY_LEN+1]; memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -173,23 +343,23 @@ msg_error_t MsgStoGetContentLocation(MSG_MESSAGE_INFO_S* pMsgInfo) snprintf(sqlQuery, sizeof(sqlQuery), "SELECT CONTENTS_LOCATION FROM %s WHERE MSG_ID = %d;", MMS_PLUGIN_MESSAGE_TABLE_NAME, pMsgInfo->msgId); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_PREPARE; - if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { - if (dbHandle.columnText(0) != NULL) { - strncpy(pMsgInfo->msgData, (char*)dbHandle.columnText(0), MAX_MSG_DATA_LEN); + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + if (dbHandle->columnText(0) != NULL) { + strncpy(pMsgInfo->msgData, (char*)dbHandle->columnText(0), MAX_MSG_DATA_LEN); pMsgInfo->dataSize = strlen(pMsgInfo->msgData); } else { - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_ERR_DB_NORECORD; } } else { - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_ERR_DB_STEP; } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_SUCCESS; } @@ -197,6 +367,7 @@ msg_error_t MsgStoGetContentLocation(MSG_MESSAGE_INFO_S* pMsgInfo) msg_error_t MsgStoSetReadReportSendStatus(msg_message_id_t msgId, int readReportSendStatus) { + MsgDbHandler *dbHandle = getDbHandle(); bool bReadReportSent = false; if((MmsRecvReadReportSendStatus)readReportSendStatus == MMS_RECEIVE_READ_REPORT_SENT) @@ -211,7 +382,7 @@ msg_error_t MsgStoSetReadReportSendStatus(msg_message_id_t msgId, int readReport snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET READ_REPORT_SEND_STATUS = %d, READ_REPORT_SENT = %d WHERE MSG_ID = %d;", MMS_PLUGIN_MESSAGE_TABLE_NAME, (MmsRecvReadReportSendStatus)readReportSendStatus, (int)bReadReportSent, msgId); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_EXEC; return MSG_SUCCESS; @@ -220,33 +391,39 @@ msg_error_t MsgStoSetReadReportSendStatus(msg_message_id_t msgId, int readReport msg_error_t MsgStoGetOrgAddressList(MSG_MESSAGE_INFO_S *pMsg) { + MsgDbHandler *dbHandle = getDbHandle(); msg_error_t err = MSG_SUCCESS; char sqlQuery[MAX_QUERY_LEN+1]; int rowCnt = 0; int index = 3; memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.ADDRESS_TYPE, A.RECIPIENT_TYPE, A.ADDRESS_VAL FROM %s A, %s B \ - WHERE A.CONV_ID = B.CONV_ID AND B.MSG_ID = %d;", + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT " + "A.ADDRESS_TYPE, " + "A.RECIPIENT_TYPE, " + "A.ADDRESS_VAL " + "FROM %s A, %s B " + "WHERE A.CONV_ID = B.CONV_ID " + "AND B.MSG_ID = %d;", MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, pMsg->msgId); - err = dbHandle.getTable(sqlQuery, &rowCnt); + err = dbHandle->getTable(sqlQuery, &rowCnt); if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { - dbHandle.freeTable(); + dbHandle->freeTable(); return err; } for(int i = 0; i < rowCnt; i++) { - pMsg->addressList[i].addressType = dbHandle.getColumnToInt(index++); - pMsg->addressList[i].recipientType = dbHandle.getColumnToInt(index++); - dbHandle.getColumnToString(index++, MAX_ADDRESS_VAL_LEN, pMsg->addressList[i].addressVal); + pMsg->addressList[i].addressType = dbHandle->getColumnToInt(index++); + pMsg->addressList[i].recipientType = dbHandle->getColumnToInt(index++); + dbHandle->getColumnToString(index++, MAX_ADDRESS_VAL_LEN, pMsg->addressList[i].addressVal); } pMsg->nAddressCnt = rowCnt; - dbHandle.freeTable(); + dbHandle->freeTable(); return MSG_SUCCESS; } @@ -254,6 +431,7 @@ msg_error_t MsgStoGetOrgAddressList(MSG_MESSAGE_INFO_S *pMsg) msg_error_t MsgStoGetSubject(msg_message_id_t msgId, char *pSubject) { + MsgDbHandler *dbHandle = getDbHandle(); char sqlQuery[MAX_QUERY_LEN+1]; memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -261,17 +439,17 @@ msg_error_t MsgStoGetSubject(msg_message_id_t msgId, char *pSubject) snprintf(sqlQuery, sizeof(sqlQuery), "SELECT SUBJECT FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgId); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_PREPARE; - if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { - strncpy(pSubject, (char*)dbHandle.columnText(0), MAX_SUBJECT_LEN); + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + strncpy(pSubject, (char*)dbHandle->columnText(0), MAX_SUBJECT_LEN); } else { - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_ERR_DB_STEP; } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_SUCCESS; } @@ -282,20 +460,23 @@ msg_error_t MsgStoGetRecipientList(msg_message_id_t msgId, MSG_RECIPIENTS_LIST_S MSG_DEBUG("pRecipientList is NULL"); return MSG_ERR_NULL_POINTER; } - - int rowCnt = 0, index = 7; - + MsgDbHandler *dbHandle = getDbHandle(); + int rowCnt = 0, index = 3; char sqlQuery[MAX_QUERY_LEN+1]; memset(sqlQuery, 0x00, sizeof(sqlQuery)); - - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT B.ADDRESS_TYPE, B.RECIPIENT_TYPE, \ - B.ADDRESS_VAL, B.CONTACT_ID, B.DISPLAY_NAME, B.FIRST_NAME, B.LAST_NAME \ - FROM %s A, %s B WHERE A.MSG_ID = %d AND A.CONV_ID = B.CONV_ID;", - MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, msgId); - - if (dbHandle.getTable(sqlQuery, &rowCnt) != MSG_SUCCESS) { - dbHandle.freeTable(); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT " + "B.ADDRESS_TYPE, " + "B.RECIPIENT_TYPE, " + "B.ADDRESS_VAL " + "FROM %s A, %s B " + "WHERE A.MSG_ID = %d " + "AND A.CONV_ID = B.CONV_ID;", + MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, + msgId); + + if (dbHandle->getTable(sqlQuery, &rowCnt) != MSG_SUCCESS) { + dbHandle->freeTable(); return MSG_ERR_DB_GETTABLE; } @@ -307,57 +488,20 @@ msg_error_t MsgStoGetRecipientList(msg_message_id_t msgId, MSG_RECIPIENTS_LIST_S MSG_ADDRESS_INFO_S* pTmp = pRecipientList->recipientAddr; - char firstName[MAX_THREAD_NAME_LEN+1], lastName[MAX_THREAD_NAME_LEN+1]; - char displayName[MAX_DISPLAY_NAME_LEN+1]; - - int order = MsgGetContactNameOrder(); - for (int i = 0; i < rowCnt; i++) { - pTmp->addressType = dbHandle.getColumnToInt(index++); - pTmp->recipientType= dbHandle.getColumnToInt(index++); + pTmp->addressType = dbHandle->getColumnToInt(index++); + pTmp->recipientType= dbHandle->getColumnToInt(index++); memset(pTmp->addressVal, 0x00, sizeof(pTmp->addressVal)); - dbHandle.getColumnToString(index++, MAX_ADDRESS_VAL_LEN, pTmp->addressVal); - - pTmp->contactId= dbHandle.getColumnToInt(index++); - - memset(displayName, 0x00, sizeof(displayName)); - dbHandle.getColumnToString(index++, MAX_THREAD_NAME_LEN, displayName); - - memset(firstName, 0x00, sizeof(firstName)); - dbHandle.getColumnToString(index++, MAX_THREAD_NAME_LEN, firstName); - - memset(lastName, 0x00, sizeof(lastName)); - dbHandle.getColumnToString(index++, MAX_THREAD_NAME_LEN, lastName); - - if (strlen(displayName) <= 0) { - if (order == 0) { - if (firstName[0] != '\0') - strncpy(displayName, firstName, MAX_DISPLAY_NAME_LEN); + dbHandle->getColumnToString(index++, MAX_ADDRESS_VAL_LEN, pTmp->addressVal); - if (lastName[0] != '\0') { - strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName)); - strncat(displayName, lastName, MAX_DISPLAY_NAME_LEN-strlen(displayName)); - } - } else if (order == 1) { - if (lastName[0] != '\0') { - strncpy(displayName, lastName, MAX_DISPLAY_NAME_LEN); - strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName)); - } - - if (firstName[0] != '\0') - strncat(displayName, firstName, MAX_DISPLAY_NAME_LEN-strlen(displayName)); - } - } - - memset(pTmp->displayName, 0x00, sizeof(pTmp->displayName)); - strncpy(pTmp->displayName, displayName, MAX_DISPLAY_NAME_LEN); + strncpy(pTmp->displayName, pTmp->addressVal, MAX_DISPLAY_NAME_LEN); pTmp++; } - dbHandle.freeTable(); + dbHandle->freeTable(); return MSG_SUCCESS; } @@ -365,6 +509,7 @@ msg_error_t MsgStoGetRecipientList(msg_message_id_t msgId, MSG_RECIPIENTS_LIST_S msg_error_t MsgStoGetReadStatus(msg_message_id_t msgId, bool *pReadStatus) { + MsgDbHandler *dbHandle = getDbHandle(); char sqlQuery[MAX_QUERY_LEN+1]; memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -372,17 +517,17 @@ msg_error_t MsgStoGetReadStatus(msg_message_id_t msgId, bool *pReadStatus) snprintf(sqlQuery, sizeof(sqlQuery), "SELECT READ_STATUS FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgId); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_PREPARE; - if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { - *pReadStatus = (bool)dbHandle.columnInt(0); + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + *pReadStatus = (bool)dbHandle->columnInt(0); } else { - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_ERR_DB_STEP; } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_SUCCESS; } @@ -390,30 +535,69 @@ msg_error_t MsgStoGetReadStatus(msg_message_id_t msgId, bool *pReadStatus) msg_error_t MsgStoGetAddrInfo(msg_message_id_t msgId, MSG_ADDRESS_INFO_S *pAddrInfo) { + MsgDbHandler *dbHandle = getDbHandle(); char sqlQuery[MAX_QUERY_LEN+1]; // Add Address memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.ADDRESS_TYPE, A.RECIPIENT_TYPE, A.CONTACT_ID, A.ADDRESS_VAL \ - FROM %s A, %s B WHERE A.CONV_ID = B.CONV_ID AND B.MSG_ID = %d;", - MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, msgId); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT " + "A.ADDRESS_TYPE, " + "A.RECIPIENT_TYPE, " + "A.CONTACT_ID, " + "A.ADDRESS_VAL " + "FROM %s A, %s B " + "WHERE A.CONV_ID = B.CONV_ID " + "AND B.MSG_ID = %d;", + MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, + msgId); + + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + pAddrInfo->addressType = dbHandle->columnInt(0); + pAddrInfo->recipientType = dbHandle->columnInt(1); + pAddrInfo->contactId = dbHandle->columnInt(2); + + strncpy(pAddrInfo->addressVal, (char*)dbHandle->columnText(3), MAX_ADDRESS_VAL_LEN); + } else { + dbHandle->finalizeQuery(); + return MSG_ERR_DB_STEP; + } - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + dbHandle->finalizeQuery(); + + return MSG_SUCCESS; +} + +msg_error_t MsgStoGetReadReportSendStatus(msg_message_id_t msgId, int *pReadReportSendStatus) +{ + MmsRecvReadReportSendStatus readReportSendStatus = MMS_RECEIVE_READ_REPORT_NO_SEND; + MsgDbHandler *dbHandle = getDbHandle(); + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT " + "READ_REPORT_SEND_STATUS " + "FROM %s WHERE MSG_ID = %d;", + MMS_PLUGIN_MESSAGE_TABLE_NAME, msgId); + + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_PREPARE; - if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { - pAddrInfo->addressType = dbHandle.columnInt(0); - pAddrInfo->recipientType = dbHandle.columnInt(1); - pAddrInfo->contactId = dbHandle.columnInt(2); + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + readReportSendStatus = (MmsRecvReadReportSendStatus)dbHandle->columnInt(0); + + *pReadReportSendStatus = readReportSendStatus; - strncpy(pAddrInfo->addressVal, (char*)dbHandle.columnText(3), MAX_ADDRESS_VAL_LEN); } else { - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_ERR_DB_STEP; } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_SUCCESS; } diff --git a/framework/storage-handler/MsgStorageSim.cpp b/framework/storage-handler/MsgStorageSim.cpp index fbe4662..80f9c2b 100755 --- a/framework/storage-handler/MsgStorageSim.cpp +++ b/framework/storage-handler/MsgStorageSim.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include @@ -31,48 +31,14 @@ using namespace std; /*================================================================================================== VARIABLES ==================================================================================================*/ -extern MsgDbHandler dbHandle; /*================================================================================================== FUNCTION IMPLEMENTATION ==================================================================================================*/ -msg_error_t MsgInitSimMessage(MSG_SIM_STATUS_T SimStatus) -{ - MSG_DEBUG("Start SIM Message Initialization"); - - msg_error_t err = MSG_SUCCESS; - - // Set SIM count of vconf to 0 - if (MsgSettingSetInt(SIM_USED_COUNT, 0) != MSG_SUCCESS) { - MSG_DEBUG("Error to set config data [%s]", SIM_USED_COUNT); - } - - if (MsgSettingSetInt(SIM_TOTAL_COUNT, 0) != MSG_SUCCESS) { - MSG_DEBUG("Error to set config data [%s]", SIM_TOTAL_COUNT); - } - - if (SimStatus != MSG_SIM_STATUS_NOT_FOUND) { - MSG_MAIN_TYPE_T mainType = MSG_SMS_TYPE; - MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(mainType); - - if (plg == NULL) { - MSG_DEBUG("No plugin for %d type", mainType); - return MSG_ERR_INVALID_PLUGIN_HANDLE; - } - - // Check SIM Status - MSG_DEBUG(" ** SIM is available - status : [%d] ** ", SimStatus); - - err = plg->initSimMessage(); - } - - return err; -} - - msg_error_t MsgStoClearSimMessageInDB() { + MsgDbHandler *dbHandle = getDbHandle(); msg_error_t err = MSG_SUCCESS; char sqlQuery[MAX_QUERY_LEN+1]; @@ -87,33 +53,32 @@ msg_error_t MsgStoClearSimMessageInDB() int rowCnt = 0; - err = dbHandle.getTable(sqlQuery, &rowCnt); + err = dbHandle->getTable(sqlQuery, &rowCnt); if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { - MSG_DEBUG("sql query is %s.", sqlQuery); - - dbHandle.freeTable(); + MSG_DEBUG("Fail to getTable()."); + dbHandle->freeTable(); return err; } if (rowCnt <= 0) { - dbHandle.freeTable(); + dbHandle->freeTable(); return MSG_SUCCESS; } for (int i = 1; i <= rowCnt; i++) { - MSG_DEBUG("thread ID : %d", dbHandle.getColumnToInt(i)); - threadList.push((msg_thread_id_t)dbHandle.getColumnToInt(i)); + MSG_DEBUG("thread ID : %d", dbHandle->getColumnToInt(i)); + threadList.push((msg_thread_id_t)dbHandle->getColumnToInt(i)); } - dbHandle.freeTable(); + dbHandle->freeTable(); const char* tableList[] = {MSGFW_SMS_SENDOPT_TABLE_NAME, MSGFW_SIM_MSG_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME}; int listCnt = sizeof(tableList)/sizeof(char*); - dbHandle.beginTrans(); + dbHandle->beginTrans(); for (int i = 0; i < listCnt; i++) { @@ -124,32 +89,32 @@ msg_error_t MsgStoClearSimMessageInDB() tableList[i], MSGFW_MESSAGE_TABLE_NAME, MSG_STORAGE_SIM); // Delete SIM Message in tables - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } } // Clear Conversation table - if (MsgStoClearConversationTable(&dbHandle) != MSG_SUCCESS) { - dbHandle.endTrans(false); + if (MsgStoClearConversationTable(dbHandle) != MSG_SUCCESS) { + dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } // Update Address while (!threadList.empty()) { - err = MsgStoUpdateConversation(&dbHandle, threadList.front()); + err = MsgStoUpdateConversation(dbHandle, threadList.front()); threadList.pop(); if (err != MSG_SUCCESS) { - dbHandle.endTrans(false); + dbHandle->endTrans(false); return err; } } - dbHandle.endTrans(true); + dbHandle->endTrans(true); return MSG_SUCCESS; } diff --git a/framework/storage-handler/MsgStorageUtil.cpp b/framework/storage-handler/MsgStorageUtil.cpp index a0bb9f0..d0d39d3 100755 --- a/framework/storage-handler/MsgStorageUtil.cpp +++ b/framework/storage-handler/MsgStorageUtil.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include @@ -32,99 +32,36 @@ /*================================================================================================== VARIABLES ==================================================================================================*/ -extern MsgDbHandler dbHandle; /*================================================================================================== FUNCTION IMPLEMENTATION ==================================================================================================*/ -msg_error_t MsgMakeSortRule(const MSG_SORT_RULE_S *pSortRule, char *pSqlSort) -{ - char sql[128]; - char order[6]; - - memset(sql, 0x00, sizeof(sql)); - memset(order, 0x00, sizeof(order)); - - if (pSortRule->bAscending == true) - strncpy(order, "ASC", 5); - else - strncpy(order, "DESC", 5); - - int nameOrder = MsgGetContactNameOrder(); - - switch (pSortRule->sortType) - { - case MSG_SORT_BY_DISPLAY_FROM : - if (nameOrder == 0) - snprintf(sql, sizeof(sql), "ORDER BY B.FIRST_NAME %s, B.LAST_NAME %s, B.ADDRESS_VAL, A.DISPLAY_TIME DESC;", order, order); - else - snprintf(sql, sizeof(sql), "ORDER BY B.LAST_NAME %s, B.FIRST_NAME %s, B.ADDRESS_VAL, A.DISPLAY_TIME DESC;", order, order); - break; - case MSG_SORT_BY_DISPLAY_TO : - if (nameOrder == 0) - snprintf(sql, sizeof(sql), "ORDER BY B.FIRST_NAME %s, B.LAST_NAME %s, B.ADDRESS_VAL, A.DISPLAY_TIME DESC;", order, order); - else - snprintf(sql, sizeof(sql), "ORDER BY B.LAST_NAME %s, B.FIRST_NAME %s, B.ADDRESS_VAL, A.DISPLAY_TIME DESC;", order, order); - break; - case MSG_SORT_BY_DISPLAY_TIME : - snprintf(sql, sizeof(sql), "ORDER BY DISPLAY_TIME %s;", order); - break; - case MSG_SORT_BY_MSG_TYPE : - snprintf(sql, sizeof(sql), "ORDER BY MAIN_TYPE %s, DISPLAY_TIME DESC;", order); - break; - case MSG_SORT_BY_READ_STATUS : - snprintf(sql, sizeof(sql), "ORDER BY READ_STATUS %s, DISPLAY_TIME DESC;", order); - break; - case MSG_SORT_BY_STORAGE_TYPE : - snprintf(sql, sizeof(sql), "ORDER BY A.STORAGE_ID %s, A.DISPLAY_TIME DESC;", order); - break; - case MSG_SORT_BY_THREAD_NAME : - if (nameOrder == 0) - snprintf(sql, sizeof(sql), "ORDER BY FIRST_NAME %s, LAST_NAME %s;", order, order); - else - snprintf(sql, sizeof(sql), "ORDER BY LAST_NAME %s, FIRST_NAME %s;", order, order); - break; - case MSG_SORT_BY_THREAD_DATE : - snprintf(sql, sizeof(sql), "ORDER BY MSG_TIME %s;", order); - break; - case MSG_SORT_BY_THREAD_COUNT : - snprintf(sql, sizeof(sql), "ORDER BY UNREAD_CNT %s;", order); - break; - default : - snprintf(sql, sizeof(sql), "ORDER BY A.DISPLAY_TIME %s;", order); - break; - } - - memcpy(pSqlSort, sql, strlen(sql)); - - return MSG_SUCCESS; -} - - -msg_error_t MsgStoGetSmsSendOpt(msg_message_id_t msgId, MSG_SENDINGOPT_INFO_S* pSendOpt) +msg_error_t MsgStoGetSmsSendOpt(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S* pSendOpt) { + MsgDbHandler *dbHandle = getDbHandle(); char sqlQuery[MAX_QUERY_LEN+1]; memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DELREP_REQ, KEEP_COPY, REPLY_PATH FROM %s WHERE MSG_ID = %d;", - MSGFW_SMS_SENDOPT_TABLE_NAME, msgId); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DELREP_REQ, KEEP_COPY, REPLY_PATH, ENCODE_TYPE FROM %s WHERE MSG_ID = %d;", + MSGFW_SMS_SENDOPT_TABLE_NAME, pMsg->msgId); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_PREPARE; - if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { pSendOpt->bSetting = true; - pSendOpt->bDeliverReq = (bool)dbHandle.columnInt(0); - pSendOpt->bKeepCopy = (bool)dbHandle.columnInt(1); - pSendOpt->option.smsSendOptInfo.bReplyPath = (bool)dbHandle.columnInt(2); + pSendOpt->bDeliverReq = (bool)dbHandle->columnInt(0); + pSendOpt->bKeepCopy = (bool)dbHandle->columnInt(1); + pSendOpt->option.smsSendOptInfo.bReplyPath = (bool)dbHandle->columnInt(2); + pMsg->encodeType = dbHandle->columnInt(3); } else { - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_ERR_DB_STEP; } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_SUCCESS; } @@ -132,6 +69,7 @@ msg_error_t MsgStoGetSmsSendOpt(msg_message_id_t msgId, MSG_SENDINGOPT_INFO_S* p msg_error_t MsgStoGetMmsSendOpt(msg_message_id_t msgId, MSG_SENDINGOPT_INFO_S* pSendOpt) { + MsgDbHandler *dbHandle = getDbHandle(); char sqlQuery[MAX_QUERY_LEN+1]; memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -139,32 +77,32 @@ msg_error_t MsgStoGetMmsSendOpt(msg_message_id_t msgId, MSG_SENDINGOPT_INFO_S* p snprintf(sqlQuery, sizeof(sqlQuery), "SELECT ASK_DELIVERY_REPORT, KEEP_COPY, ASK_READ_REPLY, EXPIRY_TIME, PRIORITY FROM %s WHERE MSG_ID = %d;", MMS_PLUGIN_MESSAGE_TABLE_NAME, msgId); - if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_PREPARE; - if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { pSendOpt->bSetting = true; - pSendOpt->bDeliverReq = (bool)dbHandle.columnInt(0); - pSendOpt->bKeepCopy = (bool)dbHandle.columnInt(1); - pSendOpt->option.mmsSendOptInfo.bReadReq = (bool)dbHandle.columnInt(2); - pSendOpt->option.mmsSendOptInfo.expiryTime.time = (unsigned int)dbHandle.columnInt(3); - pSendOpt->option.mmsSendOptInfo.priority = (msg_priority_type_t)dbHandle.columnInt(4); + pSendOpt->bDeliverReq = (bool)dbHandle->columnInt(0); + pSendOpt->bKeepCopy = (bool)dbHandle->columnInt(1); + pSendOpt->option.mmsSendOptInfo.bReadReq = (bool)dbHandle->columnInt(2); + pSendOpt->option.mmsSendOptInfo.expiryTime.time = (unsigned int)dbHandle->columnInt(3); + pSendOpt->option.mmsSendOptInfo.priority = (msg_priority_type_t)dbHandle->columnInt(4); } else { - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_ERR_DB_STEP; } - dbHandle.finalizeQuery(); + dbHandle->finalizeQuery(); return MSG_SUCCESS; } + bool MsgStoCheckSyncMLMsgInThread(msg_thread_id_t threadId) { - msg_error_t err = MSG_SUCCESS; int rowCnt = 0; bool isSyncMLMsg = false; - + MsgDbHandler *dbHandle = getDbHandle(); char sqlQuery[MAX_QUERY_LEN+1]; memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -172,15 +110,15 @@ bool MsgStoCheckSyncMLMsgInThread(msg_thread_id_t threadId) snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE SUB_TYPE = %d AND CONV_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, MSG_SYNCML_CP, threadId); - MSG_DEBUG("sqlQuery [%s]", sqlQuery); - - err = dbHandle.getTable(sqlQuery, &rowCnt); + if (dbHandle->getTable(sqlQuery, &rowCnt) != MSG_SUCCESS) { + MSG_DEBUG("getTable is failed!!!"); + } if (rowCnt > 0) isSyncMLMsg = true; MSG_DEBUG("rowCnt [%d]", rowCnt); - dbHandle.freeTable(); + dbHandle->freeTable(); return isSyncMLMsg; } @@ -189,7 +127,7 @@ bool MsgStoCheckSyncMLMsgInThread(msg_thread_id_t threadId) msg_error_t MsgStoResetNetworkStatus() { MSG_BEGIN(); - + MsgDbHandler *dbHandle = getDbHandle(); char sqlQuery[MAX_QUERY_LEN+1]; memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -199,7 +137,7 @@ msg_error_t MsgStoResetNetworkStatus() MSGFW_MESSAGE_TABLE_NAME, MSG_NETWORK_SEND_FAIL, MSG_NETWORK_SENDING, MSGFW_MESSAGE_TABLE_NAME, MSG_NETWORK_RETRIEVE_FAIL, MSG_NETWORK_RETRIEVING); - if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_EXEC; MSG_END(); @@ -207,13 +145,34 @@ msg_error_t MsgStoResetNetworkStatus() return MSG_SUCCESS; } +#if 0 +msg_error_t MsgStoResetCBMessage() +{ + MSG_BEGIN(); + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s", + MSGFW_RECEIVED_CB_MSG_TABLE_NAME); + + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + MSG_DEBUG("Delete Received CB Msg Fail!!"); + return MSG_ERR_DB_EXEC; + } + + MSG_END(); + return MSG_SUCCESS; +} +#endif + msg_error_t MsgStoCleanAbnormalMmsData() { MSG_BEGIN(); int rowCnt = 0, index = 2; // numbers of index - + MsgDbHandler *dbHandle = getDbHandle(); msg_message_id_t msgId; char sqlQuery[MAX_QUERY_LEN+1]; @@ -224,14 +183,14 @@ msg_error_t MsgStoCleanAbnormalMmsData() snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.MSG_ID, A.FILE_PATH FROM %s A, %s B WHERE A.MSG_ID = B.MSG_ID AND (B.SUB_TYPE = %d OR B.SUB_TYPE = %d OR B.SUB_TYPE = %d);", MMS_PLUGIN_MESSAGE_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, MSG_SENDCONF_MMS, MSG_RETRIEVE_AUTOCONF_MMS, MSG_RETRIEVE_MANUALCONF_MMS); - msg_error_t err = dbHandle.getTable(sqlQuery, &rowCnt); + msg_error_t err = dbHandle->getTable(sqlQuery, &rowCnt); if (err == MSG_ERR_DB_NORECORD) { - dbHandle.freeTable(); + dbHandle->freeTable(); return MSG_SUCCESS; } else if (err != MSG_SUCCESS) { - MSG_DEBUG("%s", sqlQuery); - dbHandle.freeTable(); + MSG_DEBUG("Fail to getTable()."); + dbHandle->freeTable(); return err; } @@ -240,13 +199,13 @@ msg_error_t MsgStoCleanAbnormalMmsData() { memset(filePath, 0x00, sizeof(filePath)); - msgId = dbHandle.getColumnToInt(index++); + msgId = dbHandle->getColumnToInt(index++); - dbHandle.getColumnToString(index++, MSG_FILEPATH_LEN_MAX, filePath); + dbHandle->getColumnToString(index++, MSG_FILEPATH_LEN_MAX, filePath); if(strlen(filePath) > 1) { MSG_DEBUG("strlen(filePath) [%d]", strlen(filePath)); - MSG_DEBUG("filePath [%s]", filePath); + MSG_SEC_DEBUG("filePath [%s]", filePath); if(MsgGetFileSize(filePath) < 0) { // abnormal mms message @@ -258,7 +217,7 @@ msg_error_t MsgStoCleanAbnormalMmsData() } } - dbHandle.freeTable(); + dbHandle->freeTable(); MSG_END(); @@ -271,12 +230,12 @@ msg_error_t MsgStoCheckReadReportStatus(msg_message_id_t msgId) bool bReadReportRequested; bool bReadReportIsSent; - - bReadReportRequested = MsgStoCheckReadReportRequested(&dbHandle, msgId); + MsgDbHandler *dbHandle = getDbHandle(); + bReadReportRequested = MsgStoCheckReadReportRequested(dbHandle, msgId); if(bReadReportRequested == false) return MSG_ERR_READREPORT_NOT_REQUESTED; - bReadReportIsSent = MsgStoCheckReadReportIsSent(&dbHandle, msgId); + bReadReportIsSent = MsgStoCheckReadReportIsSent(dbHandle, msgId); if(bReadReportIsSent == true) return MSG_ERR_READREPORT_ALEADY_SENT; @@ -285,3 +244,613 @@ msg_error_t MsgStoCheckReadReportStatus(msg_message_id_t msgId) return MSG_SUCCESS; } + +msg_error_t MsgStoAutoDeleteConversation(msg_thread_id_t threadId, msg_id_list_s *msgIdList) +{ + MSG_BEGIN(); + MsgDbHandler *dbHandle = getDbHandle(); + msg_error_t err = MSG_SUCCESS; + + bool bAutoErase = false; + MsgSettingGetBool(MSG_AUTO_ERASE, &bAutoErase); + + if (bAutoErase) { + + MSG_DEBUG("threadId [%d]", threadId); + + //msg_id_list_s msgIdList; + int currentSmsCnt = 0; + int currentMmsCnt = 0; + int limitSmsCnt = 0; + int limitMmsCnt = 0; + + char sqlQuery[MAX_QUERY_LEN+1]; + + int rowCnt = 0; + unsigned int index = 1; + + //memset(msgIdList, 0x00, sizeof(msg_id_list_s)); + + // Get current count of messages + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + +#ifdef MSG_NOTI_INTEGRATION + snprintf(sqlQuery, sizeof(sqlQuery), + "SELECT COUNT(MSG_ID) FROM %s " + "WHERE CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d AND MAIN_TYPE = %d " + "UNION ALL " + "SELECT COUNT(MSG_ID) FROM %s " + "WHERE CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d AND MAIN_TYPE = %d AND SUB_TYPE NOT IN (%d, %d, %d);", + MSGFW_MESSAGE_TABLE_NAME, + threadId, MSG_ALLBOX_ID, MSG_SPAMBOX_ID, MSG_STORAGE_PHONE, MSG_SMS_TYPE, + MSGFW_MESSAGE_TABLE_NAME, + threadId, MSG_ALLBOX_ID, MSG_SPAMBOX_ID, MSG_STORAGE_PHONE, MSG_MMS_TYPE, MSG_DELIVERYIND_MMS, MSG_READRECIND_MMS, MSG_READORGIND_MMS); +#else + snprintf(sqlQuery, sizeof(sqlQuery), + "SELECT COUNT(MSG_ID) FROM %s " + "WHERE CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d AND MAIN_TYPE = %d " + "UNION ALL " + "SELECT COUNT(MSG_ID) FROM %s " + "WHERE CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d AND MAIN_TYPE = %d AND SUB_TYPE NOT IN (%d, %d, %d);", + MSGFW_MESSAGE_TABLE_NAME, + threadId, MSG_ALLBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE, MSG_SMS_TYPE, + MSGFW_MESSAGE_TABLE_NAME, + threadId, MSG_ALLBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE, MSG_MMS_TYPE, MSG_DELIVERYIND_MMS, MSG_READRECIND_MMS, MSG_READORGIND_MMS); +#endif + + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + return MSG_ERR_DB_PREPARE; + } + + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + currentSmsCnt = dbHandle->columnInt(0); + } else { + dbHandle->finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + currentMmsCnt = dbHandle->columnInt(0); + } else { + dbHandle->finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + dbHandle->finalizeQuery(); + + MSG_DEBUG("currentSmsCnt [%d], currentMmsCnt [%d]", currentSmsCnt, currentMmsCnt); + + if (currentSmsCnt > 0 || currentMmsCnt > 0) { + limitSmsCnt = MsgSettingGetInt(MSG_SMS_LIMIT); + limitMmsCnt = MsgSettingGetInt(MSG_MMS_LIMIT); + + if (limitSmsCnt < 0 || limitMmsCnt < 0) { + MSG_DEBUG("limitSmsCnt [%d], limitMmsCnt [%d]", limitSmsCnt, limitMmsCnt); + return MSG_SUCCESS; + } + } else { // !(currentSmsCnt > 0 || currentMmsCnt > 0) + return MSG_SUCCESS; + } + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + +#ifdef MSG_NOTI_INTEGRATION + snprintf(sqlQuery, sizeof(sqlQuery), + "SELECT DISTINCT(MSG_ID) FROM %s " + "WHERE MSG_ID IN " + "(SELECT MSG_ID FROM %s " + "WHERE CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d AND PROTECTED = 0 " + "AND MAIN_TYPE = %d ORDER BY MSG_ID ASC LIMIT %d) " + "OR MSG_ID IN " + "(SELECT MSG_ID FROM %s " + "WHERE CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d AND PROTECTED = 0 " + "AND MAIN_TYPE = %d AND SUB_TYPE NOT IN (%d, %d, %d) ORDER BY MSG_ID ASC LIMIT %d);", + MSGFW_MESSAGE_TABLE_NAME, + MSGFW_MESSAGE_TABLE_NAME, + threadId, MSG_ALLBOX_ID, MSG_SPAMBOX_ID, MSG_STORAGE_PHONE, + MSG_SMS_TYPE, ((currentSmsCnt-limitSmsCnt)>0)?(currentSmsCnt-limitSmsCnt):0, + MSGFW_MESSAGE_TABLE_NAME, + threadId, MSG_ALLBOX_ID, MSG_SPAMBOX_ID, MSG_STORAGE_PHONE, + MSG_MMS_TYPE, MSG_DELIVERYIND_MMS, MSG_READRECIND_MMS, MSG_READORGIND_MMS, ((currentMmsCnt-limitMmsCnt)>0)?(currentMmsCnt-limitMmsCnt):0); +#else + snprintf(sqlQuery, sizeof(sqlQuery), + "SELECT DISTINCT(MSG_ID) FROM %s " + "WHERE MSG_ID IN " + "(SELECT MSG_ID FROM %s " + "WHERE CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d AND PROTECTED = 0 " + "AND MAIN_TYPE = %d ORDER BY MSG_ID ASC LIMIT %d) " + "OR MSG_ID IN " + "(SELECT MSG_ID FROM %s " + "WHERE CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d AND PROTECTED = 0 " + "AND MAIN_TYPE = %d AND SUB_TYPE NOT IN (%d, %d, %d) ORDER BY MSG_ID ASC LIMIT %d);", + MSGFW_MESSAGE_TABLE_NAME, + MSGFW_MESSAGE_TABLE_NAME, + threadId, MSG_ALLBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE, + MSG_SMS_TYPE, ((currentSmsCnt-limitSmsCnt)>0)?(currentSmsCnt-limitSmsCnt):0, + MSGFW_MESSAGE_TABLE_NAME, + threadId, MSG_ALLBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE, + MSG_MMS_TYPE, MSG_DELIVERYIND_MMS, MSG_READRECIND_MMS, MSG_READORGIND_MMS, ((currentMmsCnt-limitMmsCnt)>0)?(currentMmsCnt-limitMmsCnt):0); +#endif + err = dbHandle->getTable(sqlQuery, &rowCnt); + + if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { + MSG_DEBUG("Fail to getTable()."); + dbHandle->freeTable(); + return err; + } + + if (rowCnt <= 0) { + MSG_DEBUG("rowCnt <= 0"); + dbHandle->freeTable(); + return MSG_SUCCESS; + } + + msgIdList->nCount = rowCnt; + + MSG_DEBUG("msgIdList.nCount [%d]", msgIdList->nCount); + + msgIdList->msgIdList = (msg_message_id_t *)new char[sizeof(msg_message_id_t) * rowCnt]; + + for (int i = 0; i < rowCnt; i++) { + msgIdList->msgIdList[i] = dbHandle->getColumnToInt(index++); + } + + dbHandle->freeTable(); + + // delete message + err = MsgStoDeleteMessageByList(msgIdList); + + //delete [] (char*)msgIdList.msgIdList; + + } else { + MSG_DEBUG("bAutoErase [%d]", bAutoErase); + } + + MSG_END(); + + return err; +} + + +msg_error_t MsgStoGetReplaceMsgId(MSG_MESSAGE_INFO_S *pMsgInfo) +{ + msg_error_t err = MSG_SUCCESS; + MsgDbHandler *dbHandle = getDbHandle(); + char sqlQuery[MAX_QUERY_LEN+1]; + + msg_thread_id_t convId = 0; + + /** Check if new address or not */ + if (MsgExistAddress(dbHandle, pMsgInfo, &convId) == true) { + MSG_DEBUG("Address Info. exists [%d]", convId); + + /** Find Replace Type Msg : Same Replace Type, Same Origin Address, Same Storage ID */ + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE SUB_TYPE = %d AND CONV_ID = %d AND STORAGE_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, pMsgInfo->msgType.subType, convId, pMsgInfo->storageId); + + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + pMsgInfo->msgId = dbHandle->columnInt(0); + } else { + dbHandle->finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + dbHandle->finalizeQuery(); + } + + return err; +} + + +msg_error_t MsgStoAddWAPMsg(MSG_MESSAGE_INFO_S *pMsgInfo) +{ + msg_error_t err = MSG_SUCCESS; + MsgDbHandler *dbHandle = getDbHandle(); + MSG_PUSH_MESSAGE_S pushMsg = {}; + + char sqlQuery[MAX_QUERY_LEN+1]; + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + int fileSize = 0; + + char* pFileData = NULL; + AutoPtr buf(&pFileData); + + if (MsgOpenAndReadFile(pMsgInfo->msgData, &pFileData, &fileSize) == false) + return MSG_ERR_STORAGE_ERROR; + + MSG_DEBUG("fileSize : %d", fileSize); + + memcpy(&pushMsg, pFileData, fileSize); + + /** Delete temporary file */ + MsgDeleteFile(pMsgInfo->msgData); + + /** check pPushMsg data */ + + MSG_DEBUG("check pushMsg data"); + MSG_DEBUG("pushMsg.action : [%d]", pushMsg.action); + MSG_DEBUG("pushMsg.received : [%d]", pushMsg.received); + MSG_DEBUG("pushMsg.created : [%d]", pushMsg.created); + MSG_DEBUG("pushMsg.expires : [%d]", pushMsg.expires); + MSG_SEC_DEBUG("pushMsg.id : [%s]", pushMsg.id); + MSG_DEBUG("pushMsg.href : [%s]", pushMsg.href); + MSG_DEBUG("pushMsg.contents : [%s]", pushMsg.contents); + + bool bProceed = true; + + /** check validation of contents */ + if (MsgStoCheckPushMsgValidation(&pushMsg, &bProceed) != MSG_SUCCESS) { + MSG_DEBUG("Fail to check Push Message validation."); + } + + /** if validation check value is false */ + /** return and drop message. */ + if (bProceed == false) + return MSG_ERR_INVALID_MESSAGE; + + + /** Update Msg Text - remove */ + strncpy(pMsgInfo->msgText, pushMsg.href, MAX_MSG_TEXT_LEN); + + if (pushMsg.contents[0] != '\0') { + strncat(pMsgInfo->msgText, " ", MAX_MSG_TEXT_LEN - strlen(pMsgInfo->msgText)); + strncat(pMsgInfo->msgText, pushMsg.contents, MAX_MSG_TEXT_LEN - strlen(pMsgInfo->msgText)); + } + + pMsgInfo->dataSize = strlen(pMsgInfo->msgText); + + pMsgInfo->bTextSms = true; + pMsgInfo->folderId = MSG_INBOX_ID; + pMsgInfo->storageId = MSG_STORAGE_PHONE; + + msg_thread_id_t convId = 0; + + dbHandle->beginTrans(); + + if (pMsgInfo->nAddressCnt > 0) { + + err = MsgStoAddAddress(dbHandle, pMsgInfo, &convId); + + if (err != MSG_SUCCESS) { + dbHandle->endTrans(false); + return err; + } + + pMsgInfo->threadId = convId; + } + + /** get last row count for Message id */ + unsigned int rowId = 0; + + /** Add Message Table */ + rowId = MsgStoAddMessageTable(dbHandle, pMsgInfo); + + if (rowId <= 0) { + dbHandle->endTrans(false); + return MSG_ERR_DB_ROW; + } + + pMsgInfo->msgId = (msg_message_id_t)rowId; + + /** add msg_push_table */ + snprintf (sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %lu, %lu, ?, ?, ?)", + MSGFW_PUSH_MSG_TABLE_NAME, pMsgInfo->msgId, pushMsg.action, pushMsg.created, pushMsg.expires); + + if ((err = dbHandle->prepareQuery(sqlQuery)) != MSG_SUCCESS) { + dbHandle->endTrans(false); + return err; + } + + dbHandle->bindText(pushMsg.id, 1); + + dbHandle->bindText(pushMsg.href, 2); + + dbHandle->bindText(pushMsg.contents, 3); + + if ((err = dbHandle->stepQuery()) != MSG_ERR_DB_DONE) { + dbHandle->finalizeQuery(); + dbHandle->endTrans(false); + return err; + } + + dbHandle->finalizeQuery(); + + /** Update conversation table. */ + if (MsgStoUpdateConversation(dbHandle, convId) != MSG_SUCCESS) { + dbHandle->endTrans(false); + return MSG_ERR_STORAGE_ERROR; + } + + dbHandle->endTrans(true); + + return MSG_SUCCESS; +} + + +msg_error_t MsgStoAddCOWAPMsg(MSG_MESSAGE_INFO_S *pMsgInfo) +{ + msg_error_t err = MSG_SUCCESS; + MsgDbHandler *dbHandle = getDbHandle(); + char href[MAX_PUSH_CACHEOP_MAX_URL_LEN+1]; + char sqlQuery[MAX_QUERY_LEN+1]; + + int fileSize = 0; + + char* pFileData = NULL; + AutoPtr buf(&pFileData); + + if (MsgOpenAndReadFile(pMsgInfo->msgData, &pFileData, &fileSize) == false) + return MSG_ERR_STORAGE_ERROR; + + MSG_PUSH_CACHEOP_S *pPushMsg; + + pPushMsg = (MSG_PUSH_CACHEOP_S*)pFileData; + + for (int i = 0; i < pPushMsg->invalObjectCnt; i++) { + + int msgid = -1; + + memset(href, 0x00, sizeof(href)); + strncpy(href, &(pPushMsg->invalObjectUrl[i][0]), MAX_PUSH_CACHEOP_MAX_URL_LEN); + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf (sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE HREF LIKE '%%%s%%';", MSGFW_PUSH_MSG_TABLE_NAME, href); + + dbHandle->beginTrans(); + + err = dbHandle->prepareQuery(sqlQuery); + + if ((dbHandle->stepQuery() == MSG_ERR_DB_ROW) && err == MSG_SUCCESS) { + + msgid = dbHandle->getColumnToInt(1); + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID= %d;", MSGFW_PUSH_MSG_TABLE_NAME, msgid); + + /** Delete Message from Push table */ + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->finalizeQuery(); + dbHandle->endTrans(false); + continue; + } + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgid); + + /** Delete Message from msg table */ + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->finalizeQuery(); + dbHandle->endTrans(false); + continue; + } + + /** Update all Address */ + if (MsgStoUpdateAllAddress() != MSG_SUCCESS) { + dbHandle->finalizeQuery(); + dbHandle->endTrans(false); + continue; + } + + /** Clear Conversation table */ + if (MsgStoClearConversationTable(dbHandle) != MSG_SUCCESS) { + dbHandle->finalizeQuery(); + dbHandle->endTrans(false); + continue; + } + } + + dbHandle->finalizeQuery(); + + dbHandle->endTrans(true); + } + + for (int i = 0; i < pPushMsg->invalServiceCnt; i++) { + + int msgid = -1; + + memset(href, 0x00, sizeof(href)); + strncpy(href, &(pPushMsg->invalObjectUrl[i][0]), MAX_PUSH_CACHEOP_MAX_URL_LEN); + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE HREF LIKE '%%%s%%'", MSGFW_PUSH_MSG_TABLE_NAME, href); + + dbHandle->beginTrans(); + + err = dbHandle->prepareQuery(sqlQuery); + + if ((dbHandle->stepQuery() == MSG_ERR_DB_ROW) && err == MSG_SUCCESS) { + + msgid = dbHandle->getColumnToInt(1); + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID='%d'", MSGFW_PUSH_MSG_TABLE_NAME, msgid); + + /** Delete Message from Push table */ + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->finalizeQuery(); + dbHandle->endTrans(false); + continue; + } + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgid); + + /** Delete Message from msg table */ + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->finalizeQuery(); + dbHandle->endTrans(false); + continue; + } + + /** Update all Address */ + if (MsgStoUpdateAllAddress() != MSG_SUCCESS) { + dbHandle->finalizeQuery(); + dbHandle->endTrans(false); + continue; + } + + /** Clear Address table */ + if (MsgStoClearConversationTable(dbHandle) != MSG_SUCCESS) { + dbHandle->finalizeQuery(); + dbHandle->endTrans(false); + continue; + } + } + + dbHandle->finalizeQuery(); + + dbHandle->endTrans(true); + } + + /** delete temporary file */ + MsgDeleteFile(pMsgInfo->msgData); + + return MSG_SUCCESS; +} + + +msg_error_t MsgStoAddCBMsg(MSG_MESSAGE_INFO_S *pMsgInfo) +{ + msg_error_t err = MSG_SUCCESS; + MsgDbHandler *dbHandle = getDbHandle(); + unsigned int rowId = 0; + msg_thread_id_t convId = 0; + + char sqlQuery[MAX_QUERY_LEN+1]; + + dbHandle->beginTrans(); + + if (pMsgInfo->nAddressCnt > 0) { + err = MsgStoAddAddress(dbHandle, pMsgInfo, &convId); + + if (err != MSG_SUCCESS) { + dbHandle->endTrans(false); + return err; + } + + pMsgInfo->threadId = convId; + } + + /** Add Message Table */ + rowId = MsgStoAddMessageTable(dbHandle, pMsgInfo); + + if (rowId <= 0) { + dbHandle->endTrans(false); + return MSG_ERR_DB_ROW; + } + + /** Get CB Msg ID */ + unsigned short cbMsgId = (unsigned short)pMsgInfo->msgId; + + /** Add CB Msg in MSG_CBMSG_TABLE */ + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d);", + MSGFW_CB_MSG_TABLE_NAME, rowId, cbMsgId); + + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); + return MSG_ERR_DB_EXEC; + } + + /** Update conversation table. */ + if (MsgStoUpdateConversation(dbHandle, convId) != MSG_SUCCESS) { + dbHandle->endTrans(false); + return MSG_ERR_STORAGE_ERROR; + } + + dbHandle->endTrans(true); + + /** Assign Msg ID */ + pMsgInfo->msgId = (msg_message_id_t)rowId; + + return err; +} + + +msg_error_t MsgStoCheckPushMsgValidation(MSG_PUSH_MESSAGE_S *pPushMsg, bool *pbProceed) +{ + msg_error_t err = MSG_SUCCESS; + MsgDbHandler *dbHandle = getDbHandle(); + unsigned long oldExpireTime = 0; + int rowCnt = 0; + + char sqlQuery[MAX_QUERY_LEN+1]; + + /** is push message is expired?? */ + if (pPushMsg->received > pPushMsg->expires) { + MSG_DEBUG("Push Message is expired."); + pbProceed = false; + return err; + } + + if (pPushMsg->action == MSG_PUSH_SL_ACTION_EXECUTE_LOW) { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT EXPIRES FROM %s WHERE ID = '%s' AND ACTION = %d", + MSGFW_PUSH_MSG_TABLE_NAME, pPushMsg->id, pPushMsg->action); + } else { + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT EXPIRES FROM %s WHERE ID = '%s'", + MSGFW_PUSH_MSG_TABLE_NAME, pPushMsg->id); + } + + err = dbHandle->getTable(sqlQuery, &rowCnt); + + if (rowCnt < 1) { + dbHandle->freeTable(); + return MSG_SUCCESS; + } + + oldExpireTime = dbHandle->getColumnToInt(1); + + dbHandle->freeTable(); + + if (pPushMsg->created < oldExpireTime) { + MSG_DEBUG("Push Message is expired."); + pbProceed = false; + return err; + } + + return err; +} + + +msg_error_t MsgStoUpdateAllAddress() +{ + msg_error_t err = MSG_SUCCESS; + MsgDbHandler *dbHandle = getDbHandle(); + int rowCnt = 0, index = 1; + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT ADDRESS_ID FROM %s", MSGFW_ADDRESS_TABLE_NAME); + + err = dbHandle->getTable(sqlQuery, &rowCnt); + + if (err == MSG_ERR_DB_NORECORD) { + dbHandle->freeTable(); + return MSG_SUCCESS; + } else if ( err != MSG_SUCCESS) { + dbHandle->freeTable(); + return err; + } + + for (int i = 0; i < rowCnt; i++) { + + err = MsgStoUpdateConversation(dbHandle, index++); + + if (err != MSG_SUCCESS) + break; + } + + dbHandle->freeTable(); + + return err; +} + diff --git a/framework/submit-handler/MsgSubmitHandler.cpp b/framework/submit-handler/MsgSubmitHandler.cpp index 7cf32bc..ce7e5b9 100755 --- a/framework/submit-handler/MsgSubmitHandler.cpp +++ b/framework/submit-handler/MsgSubmitHandler.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include @@ -27,7 +27,6 @@ #include "MsgSubmitHandler.h" -extern MsgDbHandler dbHandle; /*================================================================================================== FUNCTION IMPLEMENTATION @@ -35,7 +34,6 @@ extern MsgDbHandler dbHandle; msg_error_t MsgSubmitReq(MSG_REQUEST_INFO_S *pReqInfo, bool bScheduled) { msg_error_t err = MSG_SUCCESS; - static int reqId = 1; pReqInfo->reqId = reqId; @@ -43,11 +41,12 @@ msg_error_t MsgSubmitReq(MSG_REQUEST_INFO_S *pReqInfo, bool bScheduled) MSG_DEBUG("==== Msg ID = [%d] ====", pReqInfo->msgInfo.msgId); MSG_DEBUG("==== Folder ID = [%d] ====", pReqInfo->msgInfo.folderId); - MSG_DEBUG("==== Main Type = [%d] ====", pReqInfo->msgInfo.msgType.mainType); - MSG_DEBUG("==== Sub Type = [%d] ====", pReqInfo->msgInfo.msgType.subType); + MSG_INFO("==== Main Type = [%d] ====", pReqInfo->msgInfo.msgType.mainType); + MSG_INFO("==== Sub Type = [%d] ====", pReqInfo->msgInfo.msgType.subType); MSG_DEBUG("==== Class Type = [%d] ====", pReqInfo->msgInfo.msgType.classType); MSG_DEBUG("==== Message Data = [%s] ====", pReqInfo->msgInfo.msgData); MSG_DEBUG("==== Message Text = [%s] ====", pReqInfo->msgInfo.msgText); + MSG_INFO("==== SIM Index = [%d] ====", pReqInfo->msgInfo.sim_idx); MSG_DEBUG("==== bSetting = [%d] ====", pReqInfo->sendOptInfo.bSetting); @@ -82,10 +81,8 @@ msg_error_t MsgSubmitReqSMS(MSG_REQUEST_INFO_S *pReqInfo) MSG_MAIN_TYPE_T mainType = pReqInfo->msgInfo.msgType.mainType; MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(mainType); - if (plg == NULL) { - MSG_DEBUG("No Plugin for %d type", mainType); - return MSG_ERR_UNKNOWN; - } + if (plg == NULL) + THROW(MsgException::PLUGIN_ERROR, "No plugin for %d type", mainType); // If MSG ID > 0 -> MSG in DRAFT // Move Folder to OUTBOX @@ -101,19 +98,32 @@ msg_error_t MsgSubmitReqSMS(MSG_REQUEST_INFO_S *pReqInfo) return err; } - msg_error_t MsgSubmitReqMMS(MSG_REQUEST_INFO_S *pReqInfo) { msg_error_t err = MSG_SUCCESS; - + MsgDbHandler *dbHandle = getDbHandle(); MSG_RECIPIENTS_LIST_S pRecipientList; + MsgPlugin *sms_plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE); + + int defaultNetworkSimId = 0; + + err = sms_plg->getDefaultNetworkSimId(&defaultNetworkSimId); + if (err != MSG_SUCCESS) { + MSG_ERR("getDefaultNetworkSimId is failed=[%d]", err); + return err; + } else if (pReqInfo->msgInfo.sim_idx != defaultNetworkSimId) { + MSG_ERR("It is not default network SIM ID, request SIM=[%d], activated SIM=[%d]", pReqInfo->msgInfo.sim_idx, defaultNetworkSimId); + return MSG_ERR_INVALID_PARAMETER; + + } + MSG_MAIN_TYPE_T msgMainType = pReqInfo->msgInfo.msgType.mainType; MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(msgMainType); if(!plg) { - MsgStoUpdateNetworkStatus(&dbHandle, &(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL); + MsgStoUpdateNetworkStatus(dbHandle, &(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL); MSG_DEBUG("No Plugin for %d type", msgMainType); return MSG_ERR_INVALID_PLUGIN_HANDLE; @@ -131,9 +141,9 @@ msg_error_t MsgSubmitReqMMS(MSG_REQUEST_INFO_S *pReqInfo) // copy whole of MMS PDU filepath to msgData strncpy(fileName, pReqInfo->msgInfo.msgData, MAX_COMMON_INFO_SIZE); memset(pReqInfo->msgInfo.msgData, 0x00, MAX_MSG_DATA_LEN+1); - snprintf(pReqInfo->msgInfo.msgData, MAX_MSG_DATA_LEN+1, MSG_IPC_DATA_PATH"%s", fileName); + snprintf(pReqInfo->msgInfo.msgData, MAX_MSG_DATA_LEN+1, "%s%s", MSG_IPC_DATA_PATH, fileName); - MSG_DEBUG("JAVA MMS PDU filepath:%s", pReqInfo->msgInfo.msgData); + MSG_SEC_DEBUG("JAVA MMS PDU filepath:%s", pReqInfo->msgInfo.msgData); // submit request err = plg->submitReq(pReqInfo); @@ -141,72 +151,59 @@ msg_error_t MsgSubmitReqMMS(MSG_REQUEST_INFO_S *pReqInfo) if(err != MSG_SUCCESS) { MSG_DEBUG("Update Network Status : [%d]", err); - MsgStoUpdateNetworkStatus(&dbHandle, &(pReqInfo->msgInfo),MSG_NETWORK_SEND_FAIL); + MsgStoUpdateNetworkStatus(dbHandle, &(pReqInfo->msgInfo),MSG_NETWORK_SEND_FAIL); } return err; } else if((pReqInfo->msgInfo.msgType.subType == MSG_SENDREQ_MMS) || (pReqInfo->msgInfo.msgType.subType == MSG_FORWARD_MMS)) { - // update address list in the ase of existing message - if(pReqInfo->msgInfo.msgId > 0) - { - err = MsgStoGetOrgAddressList(&(pReqInfo->msgInfo)); - - if(err != MSG_SUCCESS) - MSG_DEBUG("[WARNING]MsgStoGetOrgAddressList returned not a MSG_SUCCESS"); - } - if(pReqInfo->msgInfo.msgId > 0 && (pReqInfo->msgInfo.folderId == MSG_DRAFT_ID || pReqInfo->msgInfo.folderId == MSG_OUTBOX_ID)) { - MSG_ADDRESS_INFO_S addrInfo = {0,}; - int addrIdx = 0; - - err = MsgStoGetAddrInfo(pReqInfo->msgInfo.msgId, &addrInfo); - - if (err == MSG_SUCCESS) { - for (int i = 0; i < pReqInfo->msgInfo.nAddressCnt; i++) { - //if (pReqInfo->msgInfo.addressList[i].threadId == addrInfo.threadId) { - if (!strcmp(pReqInfo->msgInfo.addressList[i].addressVal, addrInfo.addressVal)) { - addrIdx = i; - MSG_DEBUG("addrIdx = %d, address = [%s]", addrIdx, pReqInfo->msgInfo.addressList[i].addressVal); - break; - } - } - } else { - MSG_DEBUG("[Error]MsgStoGetAddrInfo is failed"); - } - + MSG_DEBUG("Not New Message."); pReqInfo->msgInfo.folderId = MSG_OUTBOX_ID; err = MsgStoUpdateMessage(&(pReqInfo->msgInfo), &(pReqInfo->sendOptInfo)); - - MsgStoUpdateNetworkStatus(&dbHandle, &(pReqInfo->msgInfo), pReqInfo->msgInfo.networkStatus); } else { - //new message case - MSG_DEBUG("New Message"); + MSG_DEBUG("New Message."); + pReqInfo->msgInfo.msgId = 0; pReqInfo->msgInfo.folderId = MSG_OUTBOX_ID; err = MsgStoAddMessage(&(pReqInfo->msgInfo), &(pReqInfo->sendOptInfo)); - //pReqInfo->msgInfo.msgId = 0; } } else if(pReqInfo->msgInfo.msgType.subType == MSG_READREPLY_MMS) { + msg_read_report_status_t readStatus; + err = MsgStoCheckReadReportStatus(pReqInfo->msgInfo.msgId); - if(err != MSG_SUCCESS) + if(err != MSG_SUCCESS) { + + MSG_INFO("msg id [%d], read report could NOT send [%d]", pReqInfo->msgInfo.msgId, err); + return err; + } + + memcpy(&readStatus, pReqInfo->msgInfo.msgData, sizeof(msg_read_report_status_t)); + if (readStatus == MSG_READ_REPORT_REJECT_BY_USER) { + + MSG_INFO("msg id [%d], read report reject by user", pReqInfo->msgInfo.msgId); + + err = MsgStoSetReadReportSendStatus(pReqInfo->msgInfo.msgId, MMS_RECEIVE_READ_REPORT_NO_SENT); + return err; + } err = MsgStoGetRecipientList(pReqInfo->msgInfo.msgId, &pRecipientList); if(err != MSG_SUCCESS) return MSG_ERR_PLUGIN_STORAGE; pReqInfo->msgInfo.nAddressCnt = pRecipientList.recipientCnt; + pReqInfo->msgInfo.addressList = pRecipientList.recipientAddr; - for(int i = 0; i < pRecipientList.recipientCnt; i++) - { - pReqInfo->msgInfo.addressList[i].addressType = pRecipientList.recipientAddr[i].addressType; - pReqInfo->msgInfo.addressList[i].recipientType = MSG_RECIPIENTS_TYPE_TO; - pReqInfo->msgInfo.addressList[i].contactId = pRecipientList.recipientAddr[i].contactId; - strncpy(pReqInfo->msgInfo.addressList[i].addressVal, pRecipientList.recipientAddr[i].addressVal, MAX_ADDRESS_VAL_LEN); - } +// for(int i = 0; i < pRecipientList.recipientCnt; i++) +// { +// pReqInfo->msgInfo.addressList[i].addressType = pRecipientList.recipientAddr[i].addressType; +// pReqInfo->msgInfo.addressList[i].recipientType = MSG_RECIPIENTS_TYPE_TO; +// pReqInfo->msgInfo.addressList[i].contactId = pRecipientList.recipientAddr[i].contactId; +// strncpy(pReqInfo->msgInfo.addressList[i].addressVal, pRecipientList.recipientAddr[i].addressVal, MAX_ADDRESS_VAL_LEN); +// } char subject[MAX_SUBJECT_LEN+1]; @@ -220,7 +217,7 @@ msg_error_t MsgSubmitReqMMS(MSG_REQUEST_INFO_S *pReqInfo) } else if(pReqInfo->msgInfo.msgType.subType == MSG_RETRIEVE_MMS) { - MsgStoUpdateNetworkStatus(&dbHandle, &(pReqInfo->msgInfo), pReqInfo->msgInfo.networkStatus); + MsgStoUpdateNetworkStatus(dbHandle, &(pReqInfo->msgInfo), pReqInfo->msgInfo.networkStatus); } /* reject_msg_support */ @@ -237,7 +234,7 @@ msg_error_t MsgSubmitReqMMS(MSG_REQUEST_INFO_S *pReqInfo) case MSG_FORWARD_MMS: MsgDeleteFile(pReqInfo->msgInfo.msgData); memset(pReqInfo->msgInfo.msgData, 0x00, MAX_MSG_DATA_LEN+1); - snprintf(pReqInfo->msgInfo.msgData, MAX_MSG_DATA_LEN+1, MSG_DATA_PATH"%d.mms", pReqInfo->msgInfo.msgId); + snprintf(pReqInfo->msgInfo.msgData, MAX_MSG_DATA_LEN+1, "%s%d.mms", MSG_DATA_PATH, pReqInfo->msgInfo.msgId); break; case MSG_READREPLY_MMS: @@ -256,12 +253,15 @@ msg_error_t MsgSubmitReqMMS(MSG_REQUEST_INFO_S *pReqInfo) /* reject_msg_support */ // Check SIM is present or not - MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(MSG_SIM_CHANGED); + char keyName[MAX_VCONFKEY_NAME_LEN]; + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, pReqInfo->msgInfo.sim_idx); + MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName); if(simStatus == MSG_SIM_STATUS_NOT_FOUND) { MSG_DEBUG("SIM is not present..."); - MsgStoUpdateNetworkStatus(&dbHandle, &(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL); + MsgStoUpdateNetworkStatus(dbHandle, &(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL); return MSG_ERR_NO_SIM; } @@ -275,16 +275,15 @@ msg_error_t MsgSubmitReqMMS(MSG_REQUEST_INFO_S *pReqInfo) if (err != MSG_SUCCESS) { if(pReqInfo->msgInfo.msgType.subType == MSG_RETRIEVE_MMS ) - MsgStoUpdateNetworkStatus(&dbHandle, &(pReqInfo->msgInfo), MSG_NETWORK_RETRIEVE_FAIL); + MsgStoUpdateNetworkStatus(dbHandle, &(pReqInfo->msgInfo), MSG_NETWORK_RETRIEVE_FAIL); else - MsgStoUpdateNetworkStatus(&dbHandle, &(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL); + MsgStoUpdateNetworkStatus(dbHandle, &(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL); } return err; } - msg_error_t MsgCancelReq(msg_request_id_t reqId) { msg_error_t err = MSG_SUCCESS; diff --git a/framework/transaction-manager/MsgCmdHandlerFilter.cpp b/framework/transaction-manager/MsgCmdHandlerFilter.cpp index 1313a57..d1a6730 100755 --- a/framework/transaction-manager/MsgCmdHandlerFilter.cpp +++ b/framework/transaction-manager/MsgCmdHandlerFilter.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include "MsgDebug.h" diff --git a/framework/transaction-manager/MsgCmdHandlerSetting.cpp b/framework/transaction-manager/MsgCmdHandlerSetting.cpp index 3c039b8..00c4229 100755 --- a/framework/transaction-manager/MsgCmdHandlerSetting.cpp +++ b/framework/transaction-manager/MsgCmdHandlerSetting.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include "MsgDebug.h" @@ -97,11 +97,30 @@ int MsgGetConfigHandler(const MSG_CMD_S *pCmd, char **ppEvent) int eventType = -1; // Get Option Type - MSG_OPTION_TYPE_T* type = (MSG_OPTION_TYPE_T*)pCmd->cmdData; + MSG_OPTION_TYPE_T type = 0; + memcpy((void *)&type, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_OPTION_TYPE_T)); // Get Config Data MSG_SETTING_S setting; - setting.type = *type; + setting.type = type; + + msg_sim_slot_id_t simIndex = 0; + switch(setting.type) { + case MSG_CBMSG_OPT : + memcpy(&simIndex, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_OPTION_TYPE_T)), sizeof(msg_sim_slot_id_t)); + setting.option.cbMsgOpt.simIndex = simIndex; + break; + case MSG_VOICEMAIL_OPT : + memcpy(&simIndex, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_OPTION_TYPE_T)), sizeof(msg_sim_slot_id_t)); + setting.option.voiceMailOpt.simIndex = simIndex; + break; + case MSG_SMSC_LIST : + memcpy(&simIndex, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_OPTION_TYPE_T)), sizeof(msg_sim_slot_id_t)); + setting.option.smscList.simIndex = simIndex; + break; + default : + break; + } err = MsgGetConfigData(&setting); diff --git a/framework/transaction-manager/MsgCmdHandlerStorage.cpp b/framework/transaction-manager/MsgCmdHandlerStorage.cpp index 5ba9191..e8b5f56 100755 --- a/framework/transaction-manager/MsgCmdHandlerStorage.cpp +++ b/framework/transaction-manager/MsgCmdHandlerStorage.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include @@ -25,13 +25,38 @@ #include "MsgStorageHandler.h" #include "MsgPluginManager.h" #include "MsgTransManager.h" -#include "MsgContact.h" #include "MsgCmdHandler.h" - +#include "MsgNotificationWrapper.h" +#include "MsgMutex.h" +#include /*================================================================================================== FUNCTION IMPLEMENTATION ==================================================================================================*/ + +Mutex mx; +int g_job_cnt = 0; + +static gboolean __refresh_noti(void *data) +{ + mx.lock(); + + g_job_cnt--; + + if (g_job_cnt <= 0) { + MSG_DEBUG("## Refresh notification ##"); + if (MsgRefreshNotification(MSG_NOTI_TYPE_NORMAL, false, false) != MSG_SUCCESS) { + MSG_DEBUG("MsgRefreshNoti is failed"); + } + g_job_cnt = 0; + } + + mx.unlock(); + + return FALSE; + +} + int MsgAddMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) { msg_error_t err = MSG_SUCCESS; @@ -41,27 +66,43 @@ int MsgAddMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) int dataSize = 0, eventSize = 0; - // Get Message Info - MSG_MESSAGE_INFO_S* pMsgInfo = (MSG_MESSAGE_INFO_S*)pCmd->cmdData; + MSG_MESSAGE_INFO_S msgInfo; + MSG_SENDINGOPT_INFO_S sendOptInfo; + memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S)); + memset(&sendOptInfo, 0x00, sizeof(MSG_SENDINGOPT_INFO_S)); - // Get Sending Option - MSG_SENDINGOPT_INFO_S* pSendOptInfo = (MSG_SENDINGOPT_INFO_S*)(pCmd->cmdData + sizeof(MSG_MESSAGE_INFO_S)); + msgInfo.addressList = NULL; + AutoPtr addressListBuf(&msgInfo.addressList); - // Add Message - err = MsgStoAddMessage(pMsgInfo, pSendOptInfo); + MsgDecodeMsgInfo((char *)pCmd->cmdData, &msgInfo, &sendOptInfo); - if (err == MSG_SUCCESS) { - MSG_DEBUG("Command Handle Success : MsgStoAddMessage()"); + if(msgInfo.threadId) // threadId is not 0 : message restore from S-Cloud + { + err = MsgStoRestoreMessage(&msgInfo, &sendOptInfo); + + if (err == MSG_SUCCESS) { + MSG_DEBUG("Command Handle Success : MsgStoRestoreMessage()"); + // Encoding Message ID + dataSize = MsgEncodeMsgId(&(msgInfo.msgId), &encodedData); + } else { + MSG_DEBUG("Command Handle Fail : MsgStoRestoreMessage()"); + } + } + else + { + // Add Message + msgInfo.msgId = 0; + err = MsgStoAddMessage(&msgInfo, &sendOptInfo); + + if (err == MSG_SUCCESS) { + MSG_DEBUG("Command Handle Success : MsgStoAddMessage()"); // Encoding Message ID - dataSize = MsgEncodeMsgId(&(pMsgInfo->msgId), &encodedData); + dataSize = MsgEncodeMsgId(&(msgInfo.msgId), &encodedData); } else { MSG_DEBUG("Command Handle Fail : MsgStoAddMessage()"); } - - // Delete Temp File for Message Data - if (pMsgInfo->bTextSms == false) - MsgDeleteFile(pMsgInfo->msgData); //ipc + } //storage change CB msg_id_list_s msgIdList; @@ -69,11 +110,23 @@ int MsgAddMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) memset(&msgIdList, 0x00, sizeof(msg_id_list_s)); msgIdList.nCount = 1; - msgIds[0] = pMsgInfo->msgId; + msgIds[0] = msgInfo.msgId; msgIdList.msgIdList = msgIds; MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_INSERT, &msgIdList); + // Update unread message status + if (msgInfo.folderId == MSG_INBOX_ID && msgInfo.bRead == false) { + mx.lock(); + g_job_cnt++; + g_timeout_add(300, __refresh_noti, NULL); + mx.unlock(); + } + + // Delete Temp File for Message Data + if (msgInfo.bTextSms == false) + MsgDeleteFile(msgInfo.msgData); //ipc + // Make Event Data eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_ADD_MSG, err, (void**)ppEvent); @@ -85,16 +138,25 @@ int MsgAddSyncMLMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) { msg_error_t err = MSG_SUCCESS; - int eventSize = 0; + char* encodedData = NULL; + AutoPtr buf(&encodedData); + + int dataSize = 0, eventSize = 0; int extId = 0, pinCode = 0; - MSG_MESSAGE_INFO_S msgInfo = {}; + MSG_MESSAGE_INFO_S msgInfo; + memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S)); + + msgInfo.addressList = NULL; + AutoPtr addressListBuf(&msgInfo.addressList); memcpy(&extId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(int)); memcpy(&pinCode, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(int)), sizeof(int)); - memcpy(&msgInfo, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(int)+sizeof(int)), sizeof(MSG_MESSAGE_INFO_S)); + MsgDecodeMsgInfo((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(int)+sizeof(int), &msgInfo); + + msgInfo.msgId = 0; // Add Message err = MsgStoAddSyncMLMessage(&msgInfo, extId, pinCode); @@ -102,6 +164,9 @@ int MsgAddSyncMLMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) { MSG_DEBUG("Command Handle Success : MsgStoAddSyncMLMessage()"); + // Encoding Message ID + dataSize = MsgEncodeMsgId(&(msgInfo.msgId), &encodedData); + // broadcast to listener threads, here MsgTransactionManager::instance()->broadcastIncomingMsgCB(err, &msgInfo); //storage change CB @@ -121,7 +186,7 @@ int MsgAddSyncMLMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) } // Make Event Data - eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_ADD_SYNCML_MSG, err, (void**)ppEvent); + eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_ADD_SYNCML_MSG, err, (void**)ppEvent); return eventSize; } @@ -133,14 +198,18 @@ int MsgUpdateMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) int eventSize = 0; - // Get Message Info - MSG_MESSAGE_INFO_S* pMsgInfo = (MSG_MESSAGE_INFO_S*)pCmd->cmdData; + MSG_MESSAGE_INFO_S msgInfo; + MSG_SENDINGOPT_INFO_S sendOptInfo; + memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S)); + memset(&sendOptInfo, 0x00, sizeof(MSG_SENDINGOPT_INFO_S)); + + msgInfo.addressList = NULL; + AutoPtr addressListBuf(&msgInfo.addressList); - // Get Sending Option - MSG_SENDINGOPT_INFO_S* pSendOptInfo = (MSG_SENDINGOPT_INFO_S*)(pCmd->cmdData + sizeof(MSG_MESSAGE_INFO_S)); + MsgDecodeMsgInfo((char *)pCmd->cmdData, &msgInfo, &sendOptInfo); // Update Message - err = MsgStoUpdateMessage(pMsgInfo, pSendOptInfo); + err = MsgStoUpdateMessage(&msgInfo, &sendOptInfo); if (err == MSG_SUCCESS) MSG_DEBUG("Command Handle Success : MsgStoUpdateMessage()"); @@ -148,8 +217,8 @@ int MsgUpdateMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_DEBUG("Command Handle Fail : MsgStoUpdateMessage()"); // Delete Temp File for Message Data - if (pMsgInfo->bTextSms == false) - MsgDeleteFile(pMsgInfo->msgData); //ipc + if (msgInfo.bTextSms == false) + MsgDeleteFile(msgInfo.msgData); //ipc //storage change CB msg_id_list_s msgIdList; @@ -157,7 +226,7 @@ int MsgUpdateMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) memset(&msgIdList, 0x00, sizeof(msg_id_list_s)); msgIdList.nCount = 1; - msgIds[0] = pMsgInfo->msgId; + msgIds[0] = msgInfo.msgId; msgIdList.msgIdList = msgIds; MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_UPDATE, &msgIdList); @@ -184,6 +253,8 @@ int MsgUpdateReadStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) // Update Read Status err = MsgStoUpdateReadStatus(msgId, readStatus); + MSG_DEBUG("message id = [%d], readStatus = [%d]", msgId, readStatus); + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoUpdateReadStatus()"); @@ -193,6 +264,17 @@ int MsgUpdateReadStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_DEBUG("Command Handle Fail : MsgStoUpdateReadStatus()"); } + //storage change CB + msg_id_list_s msgIdList; + msg_message_id_t msgIds[1]; + memset(&msgIdList, 0x00, sizeof(msg_id_list_s)); + + msgIdList.nCount = 1; + msgIds[0] = msgId; + msgIdList.msgIdList = msgIds; + + MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList); + // Make Event Data eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_UPDATE_READ, err, (void**)ppEvent); @@ -217,12 +299,47 @@ int MsgUpdateThreadReadStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) if (unReadCnt > 0) { - err = MsgStoUpdateThreadReadStatus(threadId); + msg_id_list_s msgIdList; + memset(&msgIdList, 0x00, sizeof(msg_id_list_s)); + + err = MsgStoUpdateThreadReadStatus(threadId, &msgIdList); - if (err == MSG_SUCCESS) + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoUpdateThreadReadStatus()"); - else + MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList); + } else { MSG_DEBUG("Command Handle Fail : MsgStoUpdateThreadReadStatus()"); + } + + if(msgIdList.msgIdList != NULL) + delete [] (char*)msgIdList.msgIdList; + } + + // delete report notification + if (err == MSG_SUCCESS) { + MsgDbHandler *dbHandle = getDbHandle(); + char tempAddr[MAX_ADDRESS_VAL_LEN+1]; + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(tempAddr, 0x00 ,sizeof(tempAddr)); + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT B.ADDRESS_VAL FROM %s A, %s B WHERE A.CONV_ID = B.CONV_ID AND A.CONV_ID = %d;" + , MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, threadId); + + err = dbHandle->prepareQuery(sqlQuery); + + if (err == MSG_SUCCESS) { + err = dbHandle->stepQuery(); + + if (err == MSG_ERR_DB_ROW) { + snprintf(tempAddr, sizeof(tempAddr), "%s", dbHandle->columnText(0)); + MSG_DEBUG("Updated address = %s", tempAddr); + MsgDeleteReportNotification(tempAddr); + err = MSG_SUCCESS; + } + } + + dbHandle->finalizeQuery(); } // Make Event Data @@ -257,6 +374,17 @@ int MsgUpdateProtectedStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_DEBUG("Command Handle Fail : MsgStoUpdateProtectedStatus()"); } + //storage change CB + msg_id_list_s msgIdList; + msg_message_id_t msgIds[1]; + memset(&msgIdList, 0x00, sizeof(msg_id_list_s)); + + msgIdList.nCount = 1; + msgIds[0] = msgId; + msgIdList.msgIdList = msgIds; + + MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList); + // Make Event Data eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_UPDATE_PROTECTED, err, (void**)ppEvent); @@ -541,6 +669,9 @@ int MsgGetMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S)); memset(&sendOptInfo, 0x00, sizeof(MSG_SENDINGOPT_INFO_S)); + msgInfo.addressList = NULL; + AutoPtr addressListBuf(&msgInfo.addressList); + err = MsgStoGetMessage(*msgId, &msgInfo, &sendOptInfo); if (err == MSG_SUCCESS) @@ -566,8 +697,6 @@ int MsgGetMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) int MsgGetFolderViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent) { - msg_error_t err = MSG_SUCCESS; - // Get Folder ID msg_folder_id_t folderId; MSG_SORT_RULE_S sortRule; @@ -580,10 +709,11 @@ int MsgGetFolderViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent) int dataSize = 0, eventSize = 0; +#if 0 // Get Message Common Info msg_struct_list_s folderViewList; - err = MsgStoGetFolderViewList(folderId, &sortRule, &folderViewList); +// err = MsgStoGetFolderViewList(folderId, &sortRule, &folderViewList); if (err == MSG_SUCCESS) { @@ -605,7 +735,7 @@ int MsgGetFolderViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_DEBUG("Command Handle Fail : MsgStoGetFolderViewList()"); return err; } - +#endif // Make Event Data eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_FOLDERVIEWLIST, MSG_SUCCESS, (void**)ppEvent); @@ -790,6 +920,7 @@ int MsgGetMsgTypeHandler(const MSG_CMD_S *pCmd, char **ppEvent) int MsgGetThreadViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent) { + msg_error_t err = MSG_SUCCESS; MSG_SORT_RULE_S sortRule = {0}; @@ -800,11 +931,11 @@ int MsgGetThreadViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent) AutoPtr buf(&encodedData); int dataSize = 0, eventSize = 0; - +#if 0 // Get Thread View List msg_struct_list_s msgThreadViewList; - err = MsgStoGetThreadViewList(&sortRule, &msgThreadViewList); + //err = MsgStoGetThreadViewList(&sortRule, &msgThreadViewList); if (err == MSG_SUCCESS) { @@ -826,7 +957,7 @@ int MsgGetThreadViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_DEBUG("Command Handle Fail : MsgStoGetThreadViewList()"); return err; } - +#endif // Make Event Data eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_THREADVIEWLIST, err, (void**)ppEvent); @@ -846,10 +977,10 @@ int MsgGetConversationViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent) AutoPtr buf(&encodedData); int dataSize = 0, eventSize = 0; - +#if 0 msg_struct_list_s convViewList; - err = MsgStoGetConversationViewList(threadId, &convViewList); + //err = MsgStoGetConversationViewList(threadId, &convViewList); if (err == MSG_SUCCESS) { @@ -870,7 +1001,7 @@ int MsgGetConversationViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent) { MSG_DEBUG("Command Handle Fail : MsgStoGetConversationViewList()"); } - +#endif // Make Event Data eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_CONVERSATIONVIEWLIST, err, (void**)ppEvent); @@ -978,9 +1109,11 @@ int MsgGetQuickPanelDataHandler(const MSG_CMD_S *pCmd, char **ppEvent) // Get Message MSG_MESSAGE_INFO_S msgInfo; - memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S)); + msgInfo.addressList = NULL; + AutoPtr addressListBuf(&msgInfo.addressList); + err = MsgStoGetQuickPanelData(*type, &msgInfo); if (err == MSG_SUCCESS) @@ -1077,15 +1210,30 @@ int MsgRestoreMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) msg_error_t err = MSG_SUCCESS; int eventSize = 0; + msg_id_list_s *msgIdList = NULL; char path[MSG_FILEPATH_LEN_MAX+1] = {0,}; memcpy(&path, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(path)); MSG_DEBUG("path = %s", path); + // Reset DB - err = MsgStoRestoreMessage(path); + err = MsgStoRestoreMessage(path, &msgIdList); - if (err == MSG_SUCCESS) + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoRestoreMessage()"); - else + + if (msgIdList) { + MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_INSERT, msgIdList); + + if (msgIdList->msgIdList) + free(msgIdList->msgIdList); + + free(msgIdList); + msgIdList = NULL; + } else { + MSG_DEBUG("Not Exist msg id list to restore"); + } + + } else MSG_DEBUG("Command Handle Fail : MsgStoRestoreMessage()"); // Make Event Data @@ -1101,6 +1249,7 @@ int MsgGetReportStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) // Get Message ID msg_message_id_t* msgId = (msg_message_id_t*)pCmd->cmdData; + MSG_MESSAGE_TYPE_S msgType = {0,}; char* encodedData = NULL; AutoPtr buf(&encodedData); @@ -1110,7 +1259,17 @@ int MsgGetReportStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_REPORT_STATUS_INFO_S *reportStatus = NULL; int report_count = 0; - err = MsgStoGetReportStatus(*msgId, &report_count, &reportStatus); + if (MsgStoGetMsgType(*msgId, &msgType) != MSG_SUCCESS) + MSG_DEBUG("MsgStoGetMsgType is failed"); + + if (msgType.mainType == MSG_SMS_TYPE) { + err = MsgStoGetSmsReportStatus(*msgId, &report_count, &reportStatus); + } else if (msgType.mainType == MSG_MMS_TYPE) { + err = MsgStoGetMmsReportStatus(*msgId, &report_count, &reportStatus); + } else { + MSG_DEBUG("Message Type is unknown!"); + err = MSG_ERR_INVALID_MSG_TYPE; + } if (err == MSG_SUCCESS) { @@ -1138,10 +1297,16 @@ int MsgGetThreadIdByAddressHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_MESSAGE_INFO_S msgInfo; memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S)); + msgInfo.addressList = NULL; + AutoPtr addressListBuf(&msgInfo.addressList); + int *addrCnt = (int *)pCmd->cmdData; MSG_DEBUG("*addrCnt [%d]", *addrCnt); msgInfo.nAddressCnt = *addrCnt; + + msgInfo.addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S) * msgInfo.nAddressCnt]; + for(int i=0; icmdData+sizeof(int)+(sizeof(MSG_ADDRESS_INFO_S)*i)), sizeof(MSG_ADDRESS_INFO_S)); @@ -1413,7 +1578,7 @@ int MsgAddPushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent) if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoAddPushEvent()"); } else { - MSG_DEBUG("Command Handle Fail : MsgStoAddMessage()"); + MSG_DEBUG("Command Handle Fail : MsgStoAddPushEvent()"); } // Make Event Data @@ -1472,18 +1637,105 @@ int MsgUpdatePushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent) return eventSize; } +int MsgAddSimMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + msg_error_t err = MSG_SUCCESS; + + int eventSize = 0; + + MSG_MESSAGE_INFO_S msgInfo; + MSG_SENDINGOPT_INFO_S sendOptInfo; + memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S)); + memset(&sendOptInfo, 0x00, sizeof(MSG_SENDINGOPT_INFO_S)); + + msgInfo.addressList = NULL; + AutoPtr addressListBuf(&msgInfo.addressList); + + MsgDecodeMsgInfo((char *)pCmd->cmdData, &msgInfo); + + int *simIdList = NULL; + int listSize = 0; + char *offset = NULL; + offset = ((char *)pCmd->cmdData) + sizeof(MSG_MESSAGE_INFO_S) + (sizeof(MSG_ADDRESS_INFO_S) * msgInfo.nAddressCnt); + + listSize = *(int*)offset; + offset += sizeof(int); + MSG_DEBUG("listSize [%d]", listSize); + + simIdList = (int *)offset; + + MSG_DEBUG("simIdList[0] [%d]", simIdList[0]); + + // Add Message +#if 0 // Not to broadcast callback here. + bool isReplaceMsg = false; + + if (msgInfo.msgId <= 0) + msgInfo.msgId = 0; + else + isReplaceMsg = true; +#else + if (msgInfo.msgId <= 0) + msgInfo.msgId = 0; +#endif + + msg_message_id_t msg_id = MsgStoAddSimMessage(&msgInfo, simIdList, listSize); + + if (msg_id > 0) { + MSG_DEBUG("Command Handle Success : MsgStoAddSimMessage()"); + +#if 0 // Not to broadcast callback here. + //storage change CB + msg_id_list_s msgIdList; + msg_message_id_t msgIds[1]; + memset(&msgIdList, 0x00, sizeof(msg_id_list_s)); + + msgIdList.nCount = 1; + msgIds[0] = msgInfo.msgId; + msgIdList.msgIdList = msgIds; + + if (isReplaceMsg) + MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList); + else + MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_INSERT, &msgIdList); +#endif + } else { + MSG_DEBUG("Command Handle Fail : MsgStoAddSimMessage()"); + err = MSG_ERR_INVALID_MESSAGE; + } + + // Delete Temp File for Message Data + if (msgInfo.bTextSms == false) + MsgDeleteFile(msgInfo.msgData); //ipc + + // Make Event Data + eventSize = MsgMakeEvent((const void *)&msg_id, sizeof(msg_message_id_t), MSG_EVENT_ADD_SIM_MSG, err, (void**)ppEvent); + + return eventSize; +} + -int MsgContactSyncEventHandler(const MSG_CMD_S *pCmd, char **ppEvent) +int MsgUpdateIMSIHandler(const MSG_CMD_S *pCmd, char **ppEvent) { msg_error_t err = MSG_SUCCESS; int eventSize = 0; - MsgSyncContact(); + int sim_idx = 0; + memcpy(&sim_idx, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(int)); + + // Add Message + err = MsgStoUpdateIMSI(sim_idx); + + if (err == MSG_SUCCESS) { + MSG_DEBUG("Command Handle Success : MsgStoUpdatePushEvent()"); + } else { + MSG_DEBUG("Command Handle Fail : MsgStoUpdatePushEvent()"); + } // Make Event Data - eventSize = MsgMakeEvent(NULL, 0, MSG_EVNET_CONTACT_SYNC, err, (void**)ppEvent); + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_UPDATE_IMSI, err, (void**)ppEvent); return eventSize; } diff --git a/framework/transaction-manager/MsgCmdHandlerTransport.cpp b/framework/transaction-manager/MsgCmdHandlerTransport.cpp index 694cbff..6fc4008 100755 --- a/framework/transaction-manager/MsgCmdHandlerTransport.cpp +++ b/framework/transaction-manager/MsgCmdHandlerTransport.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include @@ -29,10 +29,11 @@ #include "MsgStorageHandler.h" #include "MsgTransManager.h" #include "MsgPluginManager.h" -#include "MsgCmdHandler.h" #include "MsgUtilStorage.h" +#include "MsgAlarm.h" +#include "MsgCmdHandler.h" +#include "MsgDevicedWrapper.h" -#include /*================================================================================================== FUNCTION IMPLEMENTATION @@ -47,11 +48,16 @@ int MsgSubmitReqHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_REQUEST_INFO_S reqInfo = {0,}; MSG_PROXY_INFO_S proxyInfo = {0,}; + reqInfo.msgInfo.addressList = NULL; + AutoPtr addressListBuf(&reqInfo.msgInfo.addressList); + // Get Message Request - memcpy(&reqInfo, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_REQUEST_INFO_S)); + memcpy(&reqInfo.reqId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_request_id_t)); // Storing Request ID, Proxy Info for Sent Status CNF - memcpy(&proxyInfo, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_REQUEST_INFO_S)), sizeof(MSG_PROXY_INFO_S)); + memcpy(&proxyInfo, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_request_id_t)), sizeof(MSG_PROXY_INFO_S)); + + MsgDecodeMsgInfo((char *)(pCmd->cmdData+sizeof(msg_request_id_t)+sizeof(MSG_PROXY_INFO_S)), &reqInfo.msgInfo, &reqInfo.sendOptInfo); if (reqInfo.msgInfo.msgId > 0) bNewMsg = false; @@ -90,7 +96,7 @@ int MsgSubmitReqHandler(const MSG_CMD_S *pCmd, char **ppEvent) pFileName = strstr(reqInfo.msgInfo.msgData, "MSG_"); strncpy(trId.pduFileName, pFileName, MAX_COMMON_INFO_SIZE); - MSG_DEBUG("java MMS msg trId:%s filepath:%s ",trId.id, reqInfo.msgInfo.msgData); + MSG_SEC_DEBUG("java MMS msg trId:%s filepath:%s ",trId.id, reqInfo.msgInfo.msgData); MsgTransactionManager* tm = MsgTransactionManager::instance(); tm->setJavaMMSList(&trId); @@ -119,12 +125,19 @@ int MsgSubmitReqHandler(const MSG_CMD_S *pCmd, char **ppEvent) } else { MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList); } - } else if (err == MSG_ERR_SECURITY_ERROR) { // Case of MDM enabled, it returns MSG_ERR_SECURITY_ERROR. - MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList); } else { MSG_DEBUG("No need to broadcast storage change CB"); } + memset(&msgIdList, 0x00, sizeof(msg_id_list_s)); + + MsgStoAutoDeleteConversation(reqInfo.msgInfo.threadId, &msgIdList); + if(msgIdList.msgIdList) + { + MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_DELETE, &msgIdList); + delete [] (char*)msgIdList.msgIdList; + } + return eventSize; } @@ -228,6 +241,8 @@ int MsgRegIncomingPushMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) // storing dst fd in list MsgTransactionManager::instance()->setPushMsgCB(pCmdData); + //MsgTransactionManager::instance()->sendPendigPushMsg(pCmdData); + // Make Event Data int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_PUSH_MSG_CB, MSG_SUCCESS, (void**)ppEvent); @@ -235,6 +250,8 @@ int MsgRegIncomingPushMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) return eventSize; } + + int MsgRegIncomingCBMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) { // input check @@ -243,7 +260,7 @@ int MsgRegIncomingCBMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) // Get Message Request MSG_CMD_REG_INCOMING_CB_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_CB_MSG_CB_S*) pCmd->cmdData; - MSG_DEBUG("Registering incoming Push Msg CB for fd:%d mType:%d", pCmdData->listenerFd, pCmdData->msgType); + MSG_DEBUG("Registering incoming CB Msg CB for fd:%d mType:%d: bSave: %d", pCmdData->listenerFd, pCmdData->msgType, pCmdData->bsave); // storing dst fd in list MsgTransactionManager::instance()->setCBMsgCB(pCmdData); @@ -335,6 +352,26 @@ int MsgRegStorageChangeCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) } +int MsgRegIncomingReportMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + // input check + if( !pCmd || !ppEvent) + THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null"); + + // Get Message Request + int listenerFd = *((int*) pCmd->cmdData); + MSG_DEBUG("Registering report msg incoming CB for %d", listenerFd); + + // storing dst fd in list + MsgTransactionManager::instance()->setReportMsgCB(listenerFd); + + // Make Event Data + int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_REPORT_MSG_INCOMING_CB, MsgException::SUCCESS, (void**)ppEvent); + + return eventSize; +} + + int MsgSentStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) { // input check @@ -349,9 +386,8 @@ int MsgSentStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) // storing dst fd in list MSG_PROXY_INFO_S* prxInfo = MsgTransactionManager::instance()->getProxyInfo(pStatus->reqId); - // when no sent status cb is found (in case of mobile tracker) - if (!prxInfo) - { + // when no sent status cb is found + if (!prxInfo) { return MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent); } @@ -366,11 +402,7 @@ int MsgSentStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) return MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent); } -#ifdef __x86_64__ - uint64_t ret[3] = {0}; //3// reqid, status, object -#else unsigned int ret[3] = {0}; //3// reqid, status, object -#endif ret[0] = pStatus->reqId; ret[1] = pStatus->status; @@ -404,7 +436,10 @@ int MsgIncomingMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_MESSAGE_INFO_S msgInfo; memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S)); - memcpy(&msgInfo, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_MESSAGE_INFO_S)); + msgInfo.addressList = NULL; + AutoPtr addressListBuf(&msgInfo.addressList); + + MsgDecodeMsgInfo((char *)pCmd->cmdData, &msgInfo); // normal process err = MsgHandleIncomingMsg(&msgInfo, &sendNoti); @@ -420,17 +455,36 @@ int MsgIncomingMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) if (sendNoti == true) { MsgTransactionManager::instance()->broadcastIncomingMsgCB(err, &msgInfo); - MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_INSERT, &msgIdList); - } else if(msgInfo.msgPort.valid) - { + if (msgInfo.msgType.subType > MSG_TYPE0_SMS && msgInfo.msgType.subType < MSG_WAP_SI_SMS) { // if it is replacement message. + MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_UPDATE, &msgIdList); + } else { + MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_INSERT, &msgIdList); + } + } else if(msgInfo.msgPort.valid || (msgInfo.msgType.subType >= MSG_MWI_VOICE_SMS && msgInfo.msgType.subType <= MSG_MWI_OTHER_SMS)) { MsgTransactionManager::instance()->broadcastIncomingMsgCB(err, &msgInfo); - } - else if (msgInfo.folderId == MSG_SPAMBOX_ID) { + } else if (msgInfo.folderId == MSG_SPAMBOX_ID) { MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_INSERT, &msgIdList); + } else if (msgInfo.msgType.subType == MSG_STATUS_REPORT_SMS || msgInfo.msgType.subType == MSG_DELIVERYIND_MMS) { + MsgTransactionManager::instance()->broadcastReportMsgCB(err, MSG_REPORT_TYPE_DELIVERY, &msgInfo); + } else if (msgInfo.msgType.subType == MSG_READORGIND_MMS) { + MsgTransactionManager::instance()->broadcastReportMsgCB(err, MSG_REPORT_TYPE_READ, &msgInfo); + } + + memset(&msgIdList, 0x00, sizeof(msg_id_list_s)); + MsgStoAutoDeleteConversation(msgInfo.threadId, &msgIdList); + if(msgIdList.msgIdList) + { + MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_DELETE, &msgIdList); + delete [] (char*)msgIdList.msgIdList; } eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_MSG_IND, err, (void**)ppEvent); + if (msgInfo.bTextSms == false) { + MsgDeleteFile(msgInfo.msgData); //ipc + memset(msgInfo.msgData, 0x00, sizeof(msgInfo.msgData)); + } + MSG_END(); return eventSize; @@ -442,11 +496,16 @@ int MsgIncomingMMSConfMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) msg_error_t err = MSG_SUCCESS; int eventsize = 0; - MSG_MESSAGE_INFO_S msgInfo = {0}; + MSG_MESSAGE_INFO_S msgInfo; msg_request_id_t reqID; - memcpy(&msgInfo, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_MESSAGE_INFO_S)); - memcpy(&reqID, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_MESSAGE_INFO_S)), sizeof(msg_request_id_t)); + memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S)); + + msgInfo.addressList = NULL; + AutoPtr addressListBuf(&msgInfo.addressList); + + memcpy(&reqID, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_request_id_t)); + MsgDecodeMsgInfo((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_request_id_t), &msgInfo); MSG_DEBUG(" pMsg = %s, pReqId = %d ", msgInfo.msgData, reqID); MSG_DEBUG(" msgtype subtype is [%d]", msgInfo.msgType.subType); @@ -460,22 +519,44 @@ int MsgIncomingMMSConfMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) msgIds[0] = msgInfo.msgId; msgIdList.msgIdList = msgIds; - //err = MsgStoGetAddrInfo(msgInfo.msgId, &(msgInfo.addressList[0])); - err = MsgStoGetOrgAddressList(&msgInfo); + MSG_ADDRESS_INFO_S *tmpAddr = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S)]; + memset(tmpAddr, 0x00, sizeof(MSG_ADDRESS_INFO_S)); + + err = MsgStoGetAddrInfo(msgInfo.msgId, tmpAddr); if (err == MSG_SUCCESS) { - MSG_DEBUG("MsgStoGetOrgAddressList() success."); -// msgInfo.nAddressCnt = 1; + MSG_DEBUG("MmsStoGetAddrInfo() success."); + msgInfo.nAddressCnt = 1; } else { - MSG_DEBUG("MsgStoGetOrgAddressList() fail."); + msgInfo.nAddressCnt = 0; + MSG_DEBUG("MmsStoGetAddrInfo() fail."); } - if(msgInfo.msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || msgInfo.msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) { + if (msgInfo.msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || msgInfo.msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) { + + /* PLM P141008-05143 : Notification.Ind address is 1, but MMS retreived Conf address is correct. + So adding code for comparing exist address and new address and replace with new address(MMSconf) address */ + if (msgInfo.nAddressCnt == 1 && msgInfo.networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS && (g_strcmp0(tmpAddr->addressVal, msgInfo.addressList[0].addressVal) != 0)) { + MSG_WARN("Address of NotiInd and MMSConf are different!!, Replace [NotiInd : %s] from [MMSConf : %s]", tmpAddr->addressVal, msgInfo.addressList[0].addressVal); + memset(tmpAddr->addressVal, 0x00, MAX_ADDRESS_VAL_LEN); + strncpy(tmpAddr->addressVal, msgInfo.addressList[0].addressVal, MAX_ADDRESS_VAL_LEN); + } + + if (msgInfo.addressList) { + delete[] msgInfo.addressList; + msgInfo.addressList = NULL; + } + + msgInfo.addressList = tmpAddr; + + MSG_SUB_TYPE_T recv_sub_type = msgInfo.msgType.subType; // Check retrieve mode to determine broadcast type err = MsgHandleMmsConfIncomingMsg(&msgInfo, reqID); - if(err != MSG_SUCCESS) - return err; + if(err != MSG_SUCCESS) { + MSG_DEBUG("MsgHandleMmsConfIncomingMsg failed."); + return MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_MMS_CONF, err, (void**)ppEvent); + } MMS_RECV_DATA_S* pMmsRecvData = (MMS_RECV_DATA_S*)msgInfo.msgData; @@ -487,19 +568,30 @@ int MsgIncomingMMSConfMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) memset(msgInfo.msgData, 0x00, sizeof(MMS_RECV_DATA_S)); } - eventsize = MsgMakeEvent(&msgInfo, sizeof(MSG_MESSAGE_INFO_S), MSG_EVENT_PLG_INCOMING_MMS_CONF, msgInfo.networkStatus, (void**)ppEvent); - // broadcast to listener threads, here MsgTransactionManager::instance()->broadcastMMSConfCB(msgInfo.networkStatus, &msgInfo, pMmsRecvData); - MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList); + + // determine broadcast type with retrieve mode + if (recv_sub_type == MSG_RETRIEVE_AUTOCONF_MMS) + MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_INSERT, &msgIdList); + else + MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList); + + // make return event + eventsize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_MMS_CONF, MSG_SUCCESS, (void**)ppEvent); + } else if (msgInfo.msgType.subType == MSG_SENDREQ_MMS || msgInfo.msgType.subType == MSG_SENDCONF_MMS) { + if (msgInfo.addressList) { + delete[] msgInfo.addressList; + msgInfo.addressList = NULL; + } + + msgInfo.addressList = tmpAddr; + MSG_PROXY_INFO_S* prxInfo = MsgTransactionManager::instance()->getProxyInfo(reqID); - // when no sent status cb is found (in case of mobile tracker) - if (!prxInfo) { - MSG_DEBUG("prxInfo is NULL"); - eventsize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent); - } else { + // when no sent status cb is found + if (prxInfo) { // No need to update javaMMS sent messages javamms_list& listenerList = MsgTransactionManager::instance()->getJavaMMSList(); javamms_list::iterator it = listenerList.begin(); @@ -509,7 +601,7 @@ int MsgIncomingMMSConfMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) if (msgInfo.networkStatus == MSG_NETWORK_SEND_FAIL && msgInfo.msgType.subType == MSG_SENDREQ_MMS) { for ( ; it != listenerList.end() ; it++) { if (strstr(it->pduFileName, "JAVA")) { - MSG_DEBUG("JAVA MMS fileName:%s", it->pduFileName); + MSG_SEC_DEBUG("JAVA MMS fileName:%s", it->pduFileName); MsgDeleteFile(it->pduFileName); // ipc listenerList.erase(it); goto __BYPASS_UPDATE; @@ -521,27 +613,40 @@ int MsgIncomingMMSConfMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) for ( ; it != listenerList.end() ; it++) { if(!strcmp(it->id, pMmsRecvData->szTrID)) { - MSG_DEBUG("find sent JAVA MMS message trId:%s from listener list trId:%s",pMmsRecvData->szTrID, it->id); + MSG_SEC_DEBUG("find sent JAVA MMS message trId:%s from listener list trId:%s",pMmsRecvData->szTrID, it->id); MsgDeleteFile(it->pduFileName); // ipc listenerList.erase(it); goto __BYPASS_UPDATE; } } } + } else { + MSG_DEBUG("prxInfo is NULL"); } err = MsgHandleMmsConfIncomingMsg(&msgInfo, reqID); - if(err != MSG_SUCCESS) - return err; + if(err != MSG_SUCCESS) { + return MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_MMS_CONF, err, (void**)ppEvent); + } __BYPASS_UPDATE: if (msgInfo.networkStatus == MSG_NETWORK_SEND_FAIL) { MSG_DEBUG("message-dialog: send fail"); - MsgInsertTicker("Sending multimedia message failed.", SENDING_MULTIMEDIA_MESSAGE_FAILED); + MsgInsertTicker("Sending multimedia message failed.", SENDING_MULTIMEDIA_MESSAGE_FAILED, true, msgInfo.msgId); +// MsgSoundPlayer::instance()->MsgSoundPlayStart(NULL, MSG_NORMAL_SOUND_PLAY); } else { MSG_DEBUG("message-dialog: send success"); - MsgInsertTicker("Multimedia message sent.", MULTIMEDIA_MESSAGE_SENT); + + bool bTTS = false; + + if (MsgSettingGetBool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &bTTS) != MSG_SUCCESS) { + MSG_DEBUG("MsgSettingGetBool is failed."); + } + + if (bTTS) { + MsgInsertTicker("Multimedia message sent.", MULTIMEDIA_MESSAGE_SENT, false, 0); + } MSG_DEBUG("Enter MsgAddPhoneLog() : msgInfo.addressList[0].addressVal [%s]", msgInfo.addressList[0].addressVal); MsgAddPhoneLog(&msgInfo); @@ -551,31 +656,32 @@ __BYPASS_UPDATE: if (prxInfo->handleAddr == 0) { // just making data which will be passed to plugin. it indicates "handling evt success" MsgTransactionManager::instance()->delProxyInfo(reqID); + } else { - return MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent); - } - -#ifdef __x86_64__ - uint64_t ret[3] = {0}; //3// reqid, status, object -#else - unsigned int ret[3] = {0}; //3// reqid, status, object -#endif + unsigned int ret[3] = {0}; //3// reqid, status, object - ret[0] = reqID; - ret[1] = msgInfo.networkStatus; - ret[2] = prxInfo->handleAddr; + ret[0] = reqID; + ret[1] = msgInfo.networkStatus; + ret[2] = prxInfo->handleAddr; - // Make Event Data for APP - eventsize = MsgMakeEvent(ret, sizeof(ret), MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent); + // Make Event Data for APP + eventsize = MsgMakeEvent(ret, sizeof(ret), MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent); - // Send to listener thread, here - MsgTransactionManager::instance()->write(prxInfo->listenerFd, *ppEvent, eventsize); + // Send to listener thread, here + MsgTransactionManager::instance()->write(prxInfo->listenerFd, *ppEvent, eventsize); - MsgTransactionManager::instance()->delProxyInfo(reqID); + MsgTransactionManager::instance()->delProxyInfo(reqID); + } } - msgInfo.bTextSms = true; + eventsize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_MMS_CONF, MSG_SUCCESS, (void**)ppEvent); MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList); + } else { + //To avoid prevent memory leak.. this case will not occur. eventsize will be return as 0. + if (tmpAddr) { + delete[] tmpAddr; + tmpAddr = NULL; + } } MSG_END(); @@ -627,21 +733,33 @@ int MsgIncomingCBMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) memcpy(&cbMsg, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_CB_MSG_S)); + MSG_MESSAGE_INFO_S msgInfo; + memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S)); + + msgInfo.addressList = NULL; + AutoPtr addressListBuf(&msgInfo.addressList); + + MsgDecodeMsgInfo((char *)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_CB_MSG_S), &msgInfo); + + MSG_DEBUG("CB MSG ADDRESS COUNT=%d", msgInfo.nAddressCnt); + + if (MsgStoAddCBMsg(&msgInfo) != MSG_SUCCESS) { + MSG_DEBUG("MsgStoAddCBMsg is fail"); + } + + MsgInsertNotification(&msgInfo); + MsgChangePmState(); + msg_id_list_s msgIdList; msg_message_id_t msgIds[1]; memset(&msgIdList, 0x00, sizeof(msg_id_list_s)); + msgIdList.nCount = 1; + msgIds[0] = (msg_message_id_t)msgInfo.msgId; + msgIdList.msgIdList = msgIds; + MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_INSERT, &msgIdList); MsgTransactionManager::instance()->broadcastCBMsgCB(err, &cbMsg); - bool bSave = false; - MsgSettingGetBool(CB_SAVE, &bSave); - - if(bSave && cbMsg.type!= MSG_ETWS_SMS) { - msgIdList.nCount = 1; - msgIds[0] = (msg_message_id_t)cbMsg.messageId; - msgIdList.msgIdList = msgIds; - MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_INSERT, &msgIdList); - } eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_CB_MSG_IND, err, (void**)ppEvent); MSG_END(); @@ -759,6 +877,13 @@ int MsgStorageChangeHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_DEBUG("storageChangeType : [%d], msg Id : [%d]", storageChangeType, msgInfo.msgId); + if (msgInfo.msgType.mainType == MSG_TYPE_SMS) { + if (storageChangeType == MSG_STORAGE_CHANGE_UPDATE) + MsgStoUpdateMessage(&msgInfo, NULL); + else if (storageChangeType == MSG_STORAGE_CHANGE_DELETE) + MsgStoDeleteMessage(msgInfo.msgId, true); + } + // broadcast to listener threads, here msg_id_list_s msgIdList; msg_message_id_t msgIds[1]; @@ -775,3 +900,82 @@ int MsgStorageChangeHandler(const MSG_CMD_S *pCmd, char **ppEvent) return eventSize; } + +int MsgResendMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + msg_error_t err = MSG_SUCCESS; + int eventSize = 0; + + + // Get the msgIdList of sending failed message. + int *failed_msg_list = NULL; + int count = 0; + AutoPtr failed_list(&failed_msg_list); + + + err = MsgStoGetFailedMessage(&failed_msg_list, &count); + if (err != MSG_SUCCESS) { + MSG_DEBUG("MsgStoGetFailedMessage() Error!! [%d]", err); + } + + for(int i=0; i < count ; ++i) + { + MSG_REQUEST_INFO_S reqInfo = {0}; + reqInfo.msgInfo.addressList = NULL; + AutoPtr addressListBuf(&reqInfo.msgInfo.addressList); + reqInfo.msgInfo.msgId = failed_msg_list[i]; + err = MsgStoGetMessage(reqInfo.msgInfo.msgId, &(reqInfo.msgInfo), &(reqInfo.sendOptInfo)); + + if (err != MSG_SUCCESS) { + MSG_DEBUG("MsgStoGetMessage() Error!! [%d]", err); + } + + reqInfo.msgInfo.networkStatus = MSG_NETWORK_SENDING; + + msg_id_list_s msgIdList; + msg_message_id_t msgIds[1]; + memset(&msgIdList, 0x00, sizeof(msg_id_list_s)); + + msgIdList.nCount = 1; + msgIds[0] = reqInfo.msgInfo.msgId; + msgIdList.msgIdList = msgIds; + + err = MsgSubmitReq(&reqInfo, false); + + if (err == MSG_SUCCESS) { + MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList); + if (err == MSG_SUCCESS) + MSG_DEBUG("MsgSubmitReq() Success"); + else + MSG_DEBUG("MsgSubmitReq() Fail, [%d]", err); + } else { + MSG_DEBUG("MsgSubmitReq() Fail, [%d]", err); + } + } + + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_RESEND_MESSAGE, err, (void**)ppEvent); + + MSG_END(); + return eventSize; +} + +#ifdef MSG_PENDING_PUSH_MESSAGE +int MsgSendPendingPushMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_BEGIN(); + + int eventSize = 0; + + // input check + if (!pCmd || !ppEvent) + THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null"); + + MsgTransactionManager::instance()->sendPendingPushMsg(); + + // Make Event Data + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_SEND_PENDING_PUSH_MESSAGE, MSG_SUCCESS, (void**)ppEvent); + + MSG_END(); + return eventSize; +} +#endif diff --git a/framework/transaction-manager/MsgTransManager.cpp b/framework/transaction-manager/MsgTransManager.cpp index 59e9e5d..190c6f9 100755 --- a/framework/transaction-manager/MsgTransManager.cpp +++ b/framework/transaction-manager/MsgTransManager.cpp @@ -1,23 +1,24 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include #include #include #include +#include #include @@ -29,12 +30,16 @@ #include "MsgIpcSocket.h" #include "MsgGconfWrapper.h" #include "MsgUtilFunction.h" +#include "MsgUtilFile.h" +#include "MsgLbs.h" #include "MsgCmdHandler.h" #include "MsgSettingHandler.h" #include "MsgStorageHandler.h" #include "MsgPluginManager.h" #include "MsgTransManager.h" +#define MSG_CHECK_PRIVILEGE + /*================================================================================================== FUNCTION IMPLEMENTATION ==================================================================================================*/ @@ -53,10 +58,12 @@ MsgTransactionManager* MsgTransactionManager::pInstance = NULL; MsgIpcServerSocket MsgTransactionManager::servSock; -MsgTransactionManager::MsgTransactionManager() : running(false), mx(), cv() +MsgTransactionManager::MsgTransactionManager() : running(false), mx(), cv(), eventQueue() { sentMsgMap.clear(); - +#ifdef MSG_PENDING_PUSH_MESSAGE + pushMsgList.clear(); +#endif statusCBFdMap.clear(); newMsgCBList.clear(); newMMSConfMsgCBList.clear(); @@ -109,6 +116,7 @@ MsgTransactionManager::MsgTransactionManager() : running(false), mx(), cv() handlerMap[MSG_CMD_REG_INCOMING_CB_MSG_CB] = &MsgRegIncomingCBMsgCallbackHandler; handlerMap[MSG_CMD_REG_INCOMING_LBS_MSG_CB] = &MsgRegIncomingLBSMsgCallbackHandler; handlerMap[MSG_CMD_REG_SYNCML_MSG_OPERATION_CB] = &MsgRegSyncMLMsgOperationCallbackHandler; + handlerMap[MSG_CMD_REG_REPORT_MSG_INCOMING_CB] = &MsgRegIncomingReportMsgCallbackHandler; handlerMap[MSG_CMD_PLG_SENT_STATUS_CNF] = &MsgSentStatusHandler; handlerMap[MSG_CMD_PLG_STORAGE_CHANGE_IND] = &MsgStorageChangeHandler; @@ -141,7 +149,6 @@ MsgTransactionManager::MsgTransactionManager() : running(false), mx(), cv() handlerMap[MSG_CMD_GET_THREAD_ID_BY_ADDRESS] = &MsgGetThreadIdByAddressHandler; handlerMap[MSG_CMD_GET_THREAD_INFO] = &MsgGetThreadInfoHandler; - handlerMap[MSG_CMD_GET_SMSC_OPT] = &MsgGetConfigHandler; handlerMap[MSG_CMD_GET_CB_OPT] = &MsgGetConfigHandler; handlerMap[MSG_CMD_GET_SMS_SEND_OPT] = &MsgGetConfigHandler; @@ -166,8 +173,12 @@ MsgTransactionManager::MsgTransactionManager() : running(false), mx(), cv() handlerMap[MSG_CMD_DELETE_PUSH_EVENT] = &MsgDeletePushEventHandler; handlerMap[MSG_CMD_UPDATE_PUSH_EVENT] = &MsgUpdatePushEventHandler; handlerMap[MSG_CMD_DELETE_MESSAGE_BY_LIST] = &MsgDeleteMessageByListHandler; - - handlerMap[MSG_CMD_CONTACT_SYNC] = &MsgContactSyncEventHandler; + handlerMap[MSG_CMD_ADD_SIM_MSG] = &MsgAddSimMessageHandler; + handlerMap[MSG_CMD_PLG_RESEND_MESSAGE] = &MsgResendMessageHandler; +#ifdef MSG_PENDING_PUSH_MESSAGE + handlerMap[MSG_CMD_SEND_PENDING_PUSH_MESSAGE] = &MsgSendPendingPushMsgHandler; +#endif + handlerMap[MSG_CMD_UPDATE_IMSI] = &MsgUpdateIMSIHandler; } @@ -186,6 +197,11 @@ MsgTransactionManager* MsgTransactionManager::instance() return pInstance; } +static void* worker_event_queue(void* arg) +{ + MsgTransactionManager::instance()->workerEventQueue(); + return NULL; +} void MsgTransactionManager::run() { @@ -196,6 +212,17 @@ void MsgTransactionManager::run() MSG_DEBUG("Start Transaction Manager"); + // Set Msg FW Ready Flag + if(MsgSettingSetBool(VCONFKEY_MSG_SERVER_READY, true) != MSG_SUCCESS) + MSG_DEBUG("MsgSettingSetBool FAIL : VCONFKEY_MSG_SERVER_READY"); + MSG_INFO("### VCONFKEY_MSG_SERVER_READY ###"); + + /* running worker for plg task */ + pthread_t tv; + if (pthread_create (&tv, NULL, &worker_event_queue, NULL) != 0) { + THROW(MsgException::SERVER_READY_ERROR, "cannot create thread [%d]", errno); + } + while(1) { readfds = servSock.fdSet(); @@ -204,7 +231,7 @@ void MsgTransactionManager::run() MSG_DEBUG("Wait For Select() : nfds %d", nfds); // set Status; - setTMStatus(); +// setTMStatus(); if(select(nfds, &readfds, NULL, NULL, NULL) == -1) { THROW(MsgException::SELECT_ERROR, "select error : %s", strerror(errno)); @@ -233,7 +260,7 @@ void MsgTransactionManager::run() } // Release Memory - //MsgReleaseMemory(); + MsgReleaseMemory(); } } @@ -267,8 +294,7 @@ MSG_PROXY_INFO_S* MsgTransactionManager::getProxyInfo(int reqId) if (it == sentMsgMap.end()) { - //THROW(MsgException::SENT_STATUS_ERROR, "No submit request for %d", reqId); - MSG_DEBUG("No sent status cb found (exception: mobile tracker)"); + MSG_DEBUG("No sent status cb found"); return NULL; } @@ -288,6 +314,56 @@ void MsgTransactionManager::delProxyInfo(int reqId) sentMsgMap.erase(it); } +void MsgTransactionManager::workerEventQueue() +{ + MSG_CMD_S* pCmd = NULL; + int (*pfHandler)(const MSG_CMD_S*, char**) = NULL; + char* pEventData = NULL; + int fd = -1; + + while (1) { + mx.lock(); + while (!eventQueue.front(&pCmd)) { /* if no item, wait */ + MSG_DEBUG ("waiting for task"); + cv.wait(mx.pMutex()); + } + eventQueue.pop_front(); /* pop it from queue*/ + mx.unlock(); + + if (!pCmd) { + MSG_FATAL("pCmd NULL"); + continue; + } + + memcpy (&fd, pCmd->cmdCookie, sizeof(int)); + if (fd < 0 ) { + MSG_FATAL("fd [%d] < 0", fd); + g_free (pCmd); pCmd = NULL; + continue; + } + pfHandler = handlerMap[pCmd->cmdType]; + if (!pfHandler) { + MSG_FATAL("No handler for %d", pCmd->cmdType); + g_free (pCmd); pCmd = NULL; + continue; + } + + // run handler function + int eventSize = pfHandler(pCmd, &pEventData); + + if (eventSize == 0 || pEventData == NULL) { + MSG_FATAL("event size[%d] = 0 or event data = NULL", eventSize); + g_free (pCmd); pCmd = NULL; + g_free (pEventData); pEventData = NULL; + continue; + } + + MSG_DEBUG("Replying to fd [%d], size [%d]", fd, eventSize); + servSock.write(fd, pEventData, eventSize); + g_free (pCmd); pCmd = NULL; + g_free (pEventData); pEventData = NULL; + } +} void MsgTransactionManager::handleRequest(int fd) { @@ -323,6 +399,7 @@ void MsgTransactionManager::handleRequest(int fd) THROW(MsgException::OUT_OF_RANGE, "request CMD is not defined"); // check privilege +// if (checkPrivilege(pCmd->cmdType, pCmd->cmdCookie) == false) { if (checkPrivilege(fd, pCmd->cmdType) == false) { MSG_DEBUG("No Privilege rule. Not allowed."); #ifdef MSG_CHECK_PRIVILEGE @@ -333,7 +410,7 @@ void MsgTransactionManager::handleRequest(int fd) MSG_EVENT_S* pMsgEvent = (MSG_EVENT_S*)pEventData; pMsgEvent->eventType = pCmd->cmdType; - pMsgEvent->result = MSG_ERR_SECURITY_ERROR; + pMsgEvent->result = MSG_ERR_PERMISSION_DENIED; MSG_DEBUG("Replying to fd [%d], size [%d]", fd, eventSize); servSock.write(fd, pEventData, eventSize); @@ -345,20 +422,42 @@ void MsgTransactionManager::handleRequest(int fd) // determine the handler based on pCmd->cmdType int (*pfHandler)(const MSG_CMD_S*, char**) = NULL; - pfHandler = handlerMap[pCmd->cmdType]; - - if (!pfHandler) - THROW(MsgException::INVALID_PARAM, "No handler for %d", pCmd->cmdType); + switch (pCmd->cmdType) { + case MSG_CMD_PLG_SENT_STATUS_CNF: + case MSG_CMD_PLG_STORAGE_CHANGE_IND: + case MSG_CMD_PLG_INCOMING_MSG_IND: + case MSG_CMD_PLG_INCOMING_MMS_CONF: + case MSG_CMD_PLG_INCOMING_SYNCML_IND: + case MSG_CMD_PLG_INCOMING_LBS_IND: + case MSG_CMD_PLG_INIT_SIM_BY_SAT: + case MSG_CMD_PLG_INCOMING_PUSH_IND: + case MSG_CMD_PLG_INCOMING_CB_IND: { + + MSG_CMD_S* pCmdDup = (MSG_CMD_S*) calloc (1, len); /* pCmdDup should be freed afterward */ + memcpy (pCmdDup, pCmd, len); + memcpy (pCmdDup->cmdCookie, &fd, sizeof(int)); /* Now, cmdCookie keeps fd for return */ + + mx.lock(); /* aquire lock before adding cmd */ + eventQueue.push_back(pCmdDup); + cv.signal(); /* wake up worker */ + mx.unlock(); + break; + } + default: + pfHandler = handlerMap[pCmd->cmdType]; + if (!pfHandler) + THROW(MsgException::INVALID_PARAM, "No handler for %d", pCmd->cmdType); - // run handler function - eventSize = pfHandler(pCmd, &pEventData); + // run handler function + eventSize = pfHandler(pCmd, &pEventData); - if (eventSize == 0 || pEventData == NULL) - THROW(MsgException::INVALID_RESULT, "event size = 0 or event data = NULL"); + if (eventSize == 0 || pEventData == NULL) + THROW(MsgException::INVALID_RESULT, "event size = 0 or event data = NULL"); - MSG_DEBUG("Replying to fd [%d], size [%d]", fd, eventSize); + MSG_DEBUG("Replying to fd [%d], size [%d]", fd, eventSize); - servSock.write(fd, pEventData, eventSize); + servSock.write(fd, pEventData, eventSize); + } MSG_END(); } @@ -388,6 +487,11 @@ void MsgTransactionManager::cleanup(int fd) // remove sent status callback for fd statusCBFdMap.erase(fd); + MSG_DEBUG("After erase fd [%d], statusCBFdMap has below.", fd); + fd_map::iterator it = statusCBFdMap.begin(); + for (; it!=statusCBFdMap.end(); ++it) + MSG_DEBUG("[%d]", it->first); + // remove all newMsgCBs for fd newmsg_list::iterator newmsg_it = newMsgCBList.begin(); @@ -465,7 +569,7 @@ void MsgTransactionManager::cleanup(int fd) // remove all newCBMsgCBs for fd cbmsg_list::iterator cbmsg_it = newCBMsgCBList.begin(); - bool bSave = false; + //bool bSave = false; while (cbmsg_it != newCBMsgCBList.end()) { @@ -475,8 +579,8 @@ void MsgTransactionManager::cleanup(int fd) } else { - if(cbmsg_it->bsave == true) - bSave = true; + //if (cbmsg_it->bsave == true) + // bSave = true; ++cbmsg_it; } } @@ -499,10 +603,24 @@ void MsgTransactionManager::cleanup(int fd) // remove storage change callback for fd storageChangeFdMap.erase(fd); + MSG_DEBUG("After erase fd [%d], storageChangeFdMap has below.", fd); + it = storageChangeFdMap.begin(); + for (; it!=storageChangeFdMap.end(); ++it) + MSG_DEBUG("[%d]", it->first); + + // remove report msg incoming callback for fd + reportMsgCBFdMap.erase(fd); + + MSG_DEBUG("After erase fd [%d], reportMsgCBFdMap has below.", fd); + it = reportMsgCBFdMap.begin(); + for (; it!=reportMsgCBFdMap.end(); ++it) + MSG_DEBUG("[%d]", it->first); + MSG_END(); } +#if 1 bool MsgTransactionManager::checkPrivilege(int fd, MSG_CMD_TYPE_T CmdType) { bool bAllowed = true; @@ -511,6 +629,36 @@ bool MsgTransactionManager::checkPrivilege(int fd, MSG_CMD_TYPE_T CmdType) case MSG_CMD_GET_MSG: case MSG_CMD_COUNT_MSG: case MSG_CMD_COUNT_BY_MSGTYPE: + case MSG_CMD_REG_INCOMING_MSG_CB: + case MSG_CMD_REG_INCOMING_CB_MSG_CB: + case MSG_CMD_REG_INCOMING_PUSH_MSG_CB: + case MSG_CMD_REG_SENT_STATUS_CB: + case MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB: + case MSG_CMD_REG_INCOMING_SYNCML_MSG_CB: + case MSG_CMD_REG_INCOMING_LBS_MSG_CB: + case MSG_CMD_REG_SYNCML_MSG_OPERATION_CB: + case MSG_CMD_REG_REPORT_MSG_INCOMING_CB: + case MSG_CMD_GET_CONTACT_COUNT: + case MSG_CMD_GET_FOLDERLIST: + case MSG_CMD_GET_QUICKPANEL_DATA: + case MSG_CMD_GET_MEMSIZE: + case MSG_CMD_BACKUP_MESSAGE: + case MSG_CMD_REG_STORAGE_CHANGE_CB: + case MSG_CMD_GET_REPORT_STATUS: + case MSG_CMD_GET_THREAD_ID_BY_ADDRESS: + case MSG_CMD_GET_THREAD_INFO: + case MSG_CMD_SYNCML_OPERATION: + case MSG_CMD_GET_FILTERLIST: + case MSG_CMD_GET_FILTER_OPERATION: + case MSG_CMD_GET_SMSC_OPT: + case MSG_CMD_GET_CB_OPT: + case MSG_CMD_GET_SMS_SEND_OPT: + case MSG_CMD_GET_MMS_SEND_OPT: + case MSG_CMD_GET_MMS_RECV_OPT: + case MSG_CMD_GET_PUSH_MSG_OPT: + case MSG_CMD_GET_VOICE_MSG_OPT: + case MSG_CMD_GET_GENERAL_MSG_OPT: + case MSG_CMD_GET_MSG_SIZE_OPT: { int ret = security_server_check_privilege_by_sockfd(fd, "msg-service::read", "rw"); if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) { @@ -519,11 +667,41 @@ bool MsgTransactionManager::checkPrivilege(int fd, MSG_CMD_TYPE_T CmdType) } } break; - case MSG_CMD_OPEN_HANDLE: case MSG_CMD_SUBMIT_REQ: case MSG_CMD_SET_CB_OPT: case MSG_CMD_ADD_PUSH_EVENT: case MSG_CMD_DELETE_PUSH_EVENT: + case MSG_CMD_UPDATE_PUSH_EVENT: + case MSG_CMD_ADD_MSG: + case MSG_CMD_ADD_SYNCML_MSG: + case MSG_CMD_UPDATE_MSG: + case MSG_CMD_UPDATE_READ: + case MSG_CMD_UPDATE_PROTECTED: + case MSG_CMD_DELETE_MSG: + case MSG_CMD_DELALL_MSGINFOLDER: + case MSG_CMD_MOVE_MSGTOFOLDER: + case MSG_CMD_MOVE_MSGTOSTORAGE: + case MSG_CMD_DELETE_THREADMESSAGELIST: + case MSG_CMD_ADD_FOLDER: + case MSG_CMD_UPDATE_FOLDER: + case MSG_CMD_DELETE_FOLDER: + case MSG_CMD_RESET_DB: + case MSG_CMD_RESTORE_MESSAGE: + case MSG_CMD_DELETE_MESSAGE_BY_LIST: + case MSG_CMD_UPDATE_THREAD_READ: + case MSG_CMD_ADD_FILTER: + case MSG_CMD_UPDATE_FILTER: + case MSG_CMD_DELETE_FILTER: + case MSG_CMD_SET_FILTER_OPERATION: + case MSG_CMD_SET_FILTER_ACTIVATION: + case MSG_CMD_SET_SMSC_OPT: + case MSG_CMD_SET_SMS_SEND_OPT: + case MSG_CMD_SET_MMS_SEND_OPT: + case MSG_CMD_SET_MMS_RECV_OPT: + case MSG_CMD_SET_PUSH_MSG_OPT: + case MSG_CMD_SET_VOICE_MSG_OPT: + case MSG_CMD_SET_GENERAL_MSG_OPT: + case MSG_CMD_SET_MSG_SIZE_OPT: { int ret = security_server_check_privilege_by_sockfd(fd, "msg-service::write", "rw"); if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) { @@ -532,38 +710,85 @@ bool MsgTransactionManager::checkPrivilege(int fd, MSG_CMD_TYPE_T CmdType) } } break; - case MSG_CMD_REG_INCOMING_MSG_CB: + } + + return bAllowed; +} +#else +bool MsgTransactionManager::checkPrivilege(MSG_CMD_TYPE_T CmdType, const char *pCookie) +{ + if (CmdType >= MSG_CMD_PLG_SENT_STATUS_CNF && CmdType <= MSG_CMD_PLG_INIT_SIM_BY_SAT) { - int ret = security_server_check_privilege_by_sockfd(fd, "msg-service::smstrigger", "rw"); - if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) { - MSG_DEBUG("No msg-service::smstrigger rw rule."); - bAllowed = false; - } + MSG_DEBUG("Request from Plug-in"); + return true; } - break; - case MSG_CMD_REG_INCOMING_CB_MSG_CB: + + // Get Cookie from APP + if (pCookie == NULL) { - int ret = security_server_check_privilege_by_sockfd(fd, "msg-service::cellbroadcast", "rw"); - if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) { - MSG_DEBUG("No msg-service::cellbroadcast rw rule."); - bAllowed = false; - } + MSG_DEBUG("Cookie is NULL"); + return false; } - break; - case MSG_CMD_REG_INCOMING_PUSH_MSG_CB: + +#ifdef MSG_FOR_DEBUG + for (int i = 0; i < MAX_COOKIE_LEN; i++) { - int ret = security_server_check_privilege_by_sockfd(fd, "msg-service::wappush", "rw"); - if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) { - MSG_DEBUG("No msg-service::wappush rw rule."); - bAllowed = false; - } + MSG_DEBUG("cookie : [%02x]", pCookie[i]); } - break; +#endif + + // Check Cookie + size_t cookieSize; + gid_t gid; + + cookieSize = security_server_get_cookie_size(); + + MSG_DEBUG("cookie size : [%d]", cookieSize); + +// char cookie[MAX_COOKIE_LEN]; + + // Get GID + if (CmdType == MSG_CMD_REG_INCOMING_SYNCML_MSG_CB) + { + MSG_DEBUG("get GID for message_sync"); + gid = security_server_get_gid("message_sync"); + } + else if (CmdType == MSG_CMD_REG_INCOMING_LBS_MSG_CB) + { + MSG_DEBUG("get GID for message_lbs"); + gid = security_server_get_gid("message_lbs"); + } + else + { + MSG_DEBUG("get GID for message"); + gid = security_server_get_gid("message"); } - return bAllowed; -} + MSG_DEBUG("gid [%d]", gid); + int retVal = 0; + + retVal = security_server_check_privilege(pCookie, gid); + + if (retVal < 0) + { + if (retVal == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) + { + MSG_DEBUG("access denied !! [%d]", retVal); + } + else + { + MSG_DEBUG("fail to check privilege [%d]", retVal); + } + + return false; + } + + MSG_DEBUG("privilege check success !!"); + + return true; +} +#endif void MsgTransactionManager::setSentStatusCB(int listenerFd) { @@ -632,7 +857,7 @@ void MsgTransactionManager::setPushMsgCB(MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S *pCb for (; it != newPushMsgCBList.end(); it++) { - if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType)) + if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType) && !strncmp(it->appId, pCbInfo->appId, MAX_WAPPUSH_ID_LEN)) { MSG_DEBUG("Duplicated messageCB info fd %d, mType %d", it->listenerFd, it->msgType); return; @@ -644,6 +869,7 @@ void MsgTransactionManager::setPushMsgCB(MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S *pCb void MsgTransactionManager::setCBMsgCB(MSG_CMD_REG_INCOMING_CB_MSG_CB_S *pCbInfo) { + MSG_BEGIN(); if (!pCbInfo) { MSG_FATAL("cbinfo NULL"); @@ -660,6 +886,7 @@ void MsgTransactionManager::setCBMsgCB(MSG_CMD_REG_INCOMING_CB_MSG_CB_S *pCbInfo return; } } + MSG_DEBUG("bSave : [%d]", pCbInfo->bsave); if(pCbInfo->bsave) if(MsgSettingSetBool(CB_SAVE, pCbInfo->bsave) != MSG_SUCCESS) @@ -667,8 +894,11 @@ void MsgTransactionManager::setCBMsgCB(MSG_CMD_REG_INCOMING_CB_MSG_CB_S *pCbInfo newCBMsgCBList.push_back(*pCbInfo); + + MSG_END(); } + void MsgTransactionManager::setSyncMLMsgCB(MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S *pCbInfo) { if (!pCbInfo) @@ -729,7 +959,7 @@ void MsgTransactionManager::setJavaMMSList(MSG_CMD_REG_INCOMING_JAVAMMS_TRID_S * { if (!strcmp(it->id, pTrId->id)) { - MSG_DEBUG("Duplicated javaMMS transaction Id:%s", it->id); + MSG_SEC_DEBUG("Duplicated javaMMS transaction Id:%s", it->id); return; } } @@ -770,6 +1000,15 @@ void MsgTransactionManager::setStorageChangeCB(int listenerFd) } +void MsgTransactionManager::setReportMsgCB(int listenerFd) +{ + if (listenerFd <= 0) + THROW(MsgException::INVALID_PARAM,"InParam Error: listenerFd %d", listenerFd); + + reportMsgCBFdMap[listenerFd] = true; +} + + javamms_list& MsgTransactionManager::getJavaMMSList() { return javaMMSList; @@ -780,10 +1019,35 @@ void MsgTransactionManager::broadcastIncomingMsgCB(const msg_error_t err, const { MSG_BEGIN(); + if ((msgInfo->msgPort.valid == true) && (msgInfo->msgPort.dstPort == MSG_LBS_PORT)) { + MSG_DEBUG("Message for LBS."); + + if (msgInfo->bTextSms == false) { + MSG_DEBUG("msgInfo->bTextSms == false"); + + int fileSize = 0; + + char* pFileData = NULL; + AutoPtr buf(&pFileData); + + if (MsgOpenAndReadFile(msgInfo->msgData, &pFileData, &fileSize) == true) + MsgLbsSms(pFileData, fileSize); + else + MSG_DEBUG("MsgOpenAndReadFile failed."); + } else { + MsgLbsSms(msgInfo->msgText, (int)msgInfo->dataSize); + } + return; + } + char* pEventData = NULL; AutoPtr eventBuf(&pEventData); - int eventSize = MsgMakeEvent(msgInfo, sizeof(MSG_MESSAGE_INFO_S), MSG_EVENT_PLG_INCOMING_MSG_IND, err, (void**)(&pEventData)); + char* encodedData = NULL; + AutoPtr buf(&encodedData); + int dataSize = MsgEncodeMsgInfo(msgInfo, &encodedData); + + int eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_PLG_INCOMING_MSG_IND, err, (void**)(&pEventData)); MSG_DEBUG("valid %d dstport %d", msgInfo->msgPort.valid, msgInfo->msgPort.dstPort); @@ -793,13 +1057,10 @@ void MsgTransactionManager::broadcastIncomingMsgCB(const msg_error_t err, const { MSG_DEBUG("fd %d dstport %d",it->listenerFd, it->port); - if ((msgInfo->msgPort.valid == false) && (it->port == 0)) - { + if ((msgInfo->msgPort.valid == false) && (it->port == 0)) { MSG_DEBUG("Send incoming normal msg to listener %d", it->listenerFd); write(it->listenerFd, pEventData, eventSize); - } - else if ((msgInfo->msgPort.valid == true) && (it->port == msgInfo->msgPort.dstPort)) - { + } else if ((msgInfo->msgPort.valid == true) && (it->port == msgInfo->msgPort.dstPort)) { MSG_DEBUG("Send incoming port msg to listener %d", it->listenerFd); write(it->listenerFd, pEventData, eventSize); } @@ -816,7 +1077,11 @@ void MsgTransactionManager::broadcastMMSConfCB(const msg_error_t err, const MSG_ char* pEventData = NULL; AutoPtr eventBuf(&pEventData); - int eventSize = MsgMakeEvent(msgInfo, sizeof(MSG_MESSAGE_INFO_S), MSG_EVENT_PLG_INCOMING_MMS_CONF, err, (void**)(&pEventData)); + char* encodedData = NULL; + AutoPtr buf(&encodedData); + int dataSize = MsgEncodeMsgInfo(msgInfo, &encodedData); + + int eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_PLG_INCOMING_MMS_CONF, err, (void**)(&pEventData)); mmsconf_list::iterator it = newMMSConfMsgCBList.begin(); @@ -853,12 +1118,24 @@ void MsgTransactionManager::broadcastPushMsgCB(const msg_error_t err, const MSG_ char* pEventData = NULL; AutoPtr eventBuf(&pEventData); +#ifdef MSG_PENDING_PUSH_MESSAGE + int bReady = MsgSettingGetInt(VCONFKEY_USER_SERVICE_READY); + if(!bReady) + { + MSG_PUSH_MESSAGE_DATA_S push_msg; + memcpy(&push_msg, pushData, sizeof(MSG_PUSH_MESSAGE_DATA_S)); + pushMsgList.push_back(push_msg); + return; + } +#endif + int eventSize = MsgMakeEvent(pushData, sizeof(MSG_PUSH_MESSAGE_DATA_S), MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND, err, (void**)(&pEventData)); pushmsg_list::iterator it = newPushMsgCBList.begin(); for (; it != newPushMsgCBList.end(); it++) { + MSG_DEBUG("registered_appid : %s, incoming_appid: %s", it->appId, pushData->pushAppId); if (!strcmp(it->appId, pushData->pushAppId)) { MSG_DEBUG("Send incoming Push information to listener %d", it->listenerFd); @@ -914,6 +1191,7 @@ void MsgTransactionManager::broadcastLBSMsgCB(const msg_error_t err, const MSG_L { MSG_BEGIN(); +#if 0 char* pEventData = NULL; AutoPtr eventBuf(&pEventData); @@ -926,7 +1204,9 @@ void MsgTransactionManager::broadcastLBSMsgCB(const msg_error_t err, const MSG_L MSG_DEBUG("Send incoming LBS msg to listener %d", it->listenerFd); write(it->listenerFd, pEventData, eventSize); } - +#else + MsgLbsWapPush(lbsData->pushHeader, lbsData->pushBody, lbsData->pushBodyLen); +#endif MSG_END(); } @@ -994,6 +1274,42 @@ void MsgTransactionManager::broadcastStorageChangeCB(const msg_error_t err, cons } +void MsgTransactionManager::broadcastReportMsgCB(const msg_error_t err, const msg_report_type_t reportMsgType, const MSG_MESSAGE_INFO_S *pMsgInfo) +{ + MSG_BEGIN(); + + if(pMsgInfo == NULL) { + MSG_DEBUG("pMsgInfo is NULL."); + return; + } + + MSG_DEBUG("reportMsgType [%d]", reportMsgType); + + int dataSize = 0; + + char* pEventData = NULL; + AutoPtr eventBuf(&pEventData); + + char* encodedData = NULL; + AutoPtr buf(&encodedData); + + // Encoding Storage Change Data + dataSize = MsgEncodeReportMsgData(reportMsgType, pMsgInfo, &encodedData); + + int eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_PLG_REPORT_MSG_INCOMING_IND, err, (void**)(&pEventData)); + + fd_map::iterator it = reportMsgCBFdMap.begin(); + + for (; it != reportMsgCBFdMap.end(); it++) + { + MSG_DEBUG("Send Report Message Incoming Callback to listener %d", it->first); + write(it->first, pEventData, eventSize); + } + + MSG_END(); +} + + void MsgTransactionManager::setTMStatus() { MSG_BEGIN(); @@ -1021,3 +1337,23 @@ void MsgTransactionManager::getTMStatus() } MSG_END(); } + +#ifdef MSG_PENDING_PUSH_MESSAGE +void MsgTransactionManager::sendPendingPushMsg(void) +{ + + pushpending_list::iterator pushmsg_it = pushMsgList.begin(); + while(pushmsg_it != pushMsgList.end()) + { + MSG_PUSH_MESSAGE_DATA_S msg; + memset(&msg, 0x00, sizeof(MSG_PUSH_MESSAGE_DATA_S)); + memcpy(msg.pushAppId, pushmsg_it->pushAppId, sizeof(msg.pushAppId)); + memcpy(msg.pushBody, pushmsg_it->pushBody, sizeof(msg.pushBody)); + memcpy(msg.pushContentType, pushmsg_it->pushContentType, sizeof(msg.pushContentType)); + memcpy(msg.pushHeader, pushmsg_it->pushHeader, sizeof(msg.pushHeader)); + msg.pushBodyLen = pushmsg_it->pushBodyLen; + MsgTransactionManager::instance()->broadcastPushMsgCB(MSG_SUCCESS, (const MSG_PUSH_MESSAGE_DATA_S *)&msg); + pushmsg_it = pushMsgList.erase(pushmsg_it); + } +} +#endif diff --git a/image/messaging_image001.png b/image/messaging_image001.png deleted file mode 100755 index 0c575c4e8c3dacf60dad2043a43c32722a827ab3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 70483 zcmd@5XH*nH_b-f+nGpmA6eQ;$abUf5hTfw;cee@&RUPp|J=3ir~BouZn3AUx@uR|PPO;1;tch*Zr)(Hfrp28Q~RF! zLp(e}6doRd6^I0QW4oXD7Wfa}=b@G=UezemPv8fUlZu`S9$sw<*@Z1J@SDy4-a|b+ zyq7$9cwtd^cxS+?uuVL?7f?LBEgL*MSp*&)-P4?w2l7Ax_~|_}AK*9S??3!6Jcmkn zc-H~i>MD=?t+sQC5lsCv(R6+wA_5gcB5e@YN&k}2y{BOCZ;QpqR6O>kRv&Lazni~* zQ_y96xH`nGd~TdX{T|(ZKK5uV=tzEp{#R95NO^H%L`wixgEM50ub1=BKmR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Xn4Py=?AyGO{o8AyUz`k7 zzvtxOTkYF2bTh_QQ;~*)^-Q<5xOSlV zRmi68KJx*K`Ru1s_KKa&&iyv;)#EZDzbbRY)7rkd353-WW~(pr%Nyz~q9)4dtu;>z zaR0tc?FBvBKqu z-{sn2Sod7UKpwo}xSD+iLD%BeFAp}POifQKWU&&XhL8`+-{f$H3jq7Yb&x%Oz+Th> zKXHj=V*pgBv8|?^Xu_E=AE_YY<_<(tH45#QCJkSxDubJx>Xej2A7SSC52KM!`11qAzcUjzG< z0^}Zc1DIoRzN&Yc=|-Hmi>@ zLbz015SQ!CE_<#3v=0_Iz{%fcxD7Zrm64Y2;7{*gigVy_+@Fm>s9rmeH74T?fhv*G zpOSS!7y8Oz&63Zm5FT+F;Dgmaria$NgkCKtuIt<*T3`k?AKx!&^1~B+lcNAGafk&o zj?T4KH@-3$CDnc(=XHTFY!n3dDq=ta%$iip348QCn12bPiJ&i9D3}`j;>%Bc_j2-wjP@}L13@GpW@TIXKgkgm-0qj>E1gZVbAhPi{ zi6Gq4FPsoJAWs-HpY7I*BP}RCzANX(I!spQc{C_r;3)M3C22|B{6u~n4ySk~k0qK8 znG{9i3QS4^1XP0_6w@lH%6Hs}HO_9&3og=6p9D3UdBtihUOvMUk+!!7X(;G4zpN5L= K-OAh0i2nmq1^YAr diff --git a/include/common/MsgCmdTypes.h b/include/common/MsgCmdTypes.h index a05eed1..63d1fd0 100755 --- a/include/common/MsgCmdTypes.h +++ b/include/common/MsgCmdTypes.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_CMD_TYPES_H @@ -170,13 +170,18 @@ enum _MSG_CMD_TYPE_E MSG_CMD_UPDATE_PUSH_EVENT, MSG_CMD_DELETE_MESSAGE_BY_LIST, MSG_CMD_SET_FILTER_ACTIVATION, - MSG_CMD_CONTACT_SYNC, + MSG_CMD_ADD_SIM_MSG, + +// 85 + MSG_CMD_PLG_RESEND_MESSAGE, + MSG_CMD_SEND_PENDING_PUSH_MESSAGE, + MSG_CMD_REG_REPORT_MSG_INCOMING_CB, + MSG_CMD_UPDATE_IMSI, // end of MSG_CMD; new CMD should be defined before MSG_CMD_NUM MSG_CMD_NUM }; - enum _MSG_EVENT_TYPE_E { MSG_EVENT_OPEN_HANDLE = 0, @@ -287,11 +292,19 @@ enum _MSG_EVENT_TYPE_E MSG_EVENT_UPDATE_PUSH_EVENT, MSG_EVENT_DELETE_MESSAGE_BY_LIST, MSG_EVENT_SET_FILTER_ACTIVATION, - MSG_EVNET_CONTACT_SYNC, + MSG_EVENT_ADD_SIM_MSG, + +// 85 + MSG_EVENT_PLG_RESEND_MESSAGE, + MSG_EVENT_SEND_PENDING_PUSH_MESSAGE, + MSG_EVENT_REG_REPORT_MSG_INCOMING_CB, + MSG_EVENT_PLG_REPORT_MSG_INCOMING_IND, + MSG_EVENT_UPDATE_IMSI, // end of MSG_EVENT; new EVENT should be defined before MSG_EVENT_NUM MSG_EVENT_NUM }; + #endif // MSG_CMD_TYPES_H diff --git a/include/common/MsgCppTypes.h b/include/common/MsgCppTypes.h index f731a4d..d4d63a1 100755 --- a/include/common/MsgCppTypes.h +++ b/include/common/MsgCppTypes.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef __MSG_CPP_TYPES_H__ diff --git a/include/common/MsgFilterTypes.h b/include/common/MsgFilterTypes.h index 4999ca5..cb453eb 100755 --- a/include/common/MsgFilterTypes.h +++ b/include/common/MsgFilterTypes.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_FILTER_TYPES_H diff --git a/include/common/MsgInternalTypes.h b/include/common/MsgInternalTypes.h index 9ba43e3..b313e35 100755 --- a/include/common/MsgInternalTypes.h +++ b/include/common/MsgInternalTypes.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_INTERNAL_TYPES_H @@ -27,7 +27,7 @@ INCLUDE FILES ==================================================================================================*/ #include "MsgMmsTypes.h" -#include + /*================================================================================================== DEFINES @@ -37,27 +37,39 @@ #define MSG_SMIL_FILE_PATH MSG_DATA_ROOT_PATH"smildata/" #define MSG_IPC_DATA_PATH MSG_DATA_ROOT_PATH"ipcdata/" #define MSG_THUMBNAIL_PATH MSG_DATA_PATH"thumbnails/" + + // temporary -#define TPDU_LOG_FILE MSG_DATA_ROOT_PATH"tpduLog.txt" #define MSG_NATIONAL_SIM "memory/private/msg-service/national_sim" #define MSG_SIM_MSISDN "memory/private/msg-service/msisdn" +#define MSG_SIM_ICCID "memory/private/msg-service/iccid" +#define MSG_FMM_SIM_CHANGE_NUM "db/SyncML/oma-dm-service/fmmSimChangeNum" + #define MAX_FULL_PATH_SIZE 320 // max length for internal file path -#define MAX_PRECONFIG_NUM 8 #define MAX_THREAD_ADDR_LEN 40 #define MAX_THREAD_NAME_LEN 195 #define MAX_THREAD_DATA_LEN 128 #define MAX_CB_MSG_TEXT_LEN 4200 // 1page max char(93)*max page(15)*max bytes of UTF8 1 char(3) #define MAX_CB_MSG_LANGUAGE_TYPE_LEN 3 #define MAX_ETWS_WARNING_SECURITY_INFO_LEN 50 +#define MAX_ME_IMEI_LEN 20 +#define MAX_SIM_MSISDN_LEN 26 +#define MAX_COMMON_INFO_SIZE 20 +#define MAX_VCONFKEY_NAME_LEN 128 -#define SMS_MINIMUM_SPACE (3 * 1024) -#define MMS_MINIMUM_SPACE (600 * 1024) +#define SMS_MINIMUM_SPACE (1 * 1024 * 1024) +#define MMS_MINIMUM_SPACE (1 * 1024 * 1024) /*vconf keys*/ -#define MSG_SIM_IMSI "memory/private/msg-service/sim_imsi" -#define MSG_SIM_CHANGED "memory/private/msg-service/sim_changed" - #define DEFAULT_SETTING_PATH "db/private/msg-service" +#define DEFAULT_MSG_MEMORY_PATH "memory/private/msg-service" + +#define MSG_SIM_IMSI DEFAULT_MSG_MEMORY_PATH"/sim_imsi" +#define MSG_SIM_CHANGED DEFAULT_MSG_MEMORY_PATH"/sim_changed" + +#define MSG_SIM_SERVICE_TABLE DEFAULT_MSG_MEMORY_PATH"/sim_st" +#define MSG_SIM_MO_CONTROL DEFAULT_MSG_MEMORY_PATH"/sim_mo_ctrl" +#define MSG_NETWORK_SIM DEFAULT_MSG_MEMORY_PATH"/default_network_sim" #define DEFAULT_GENERAL_OPT_PATH DEFAULT_SETTING_PATH"/general" #define DEFAULT_SMS_SEND_OPT_PATH DEFAULT_SETTING_PATH"/sms_send" @@ -72,10 +84,22 @@ #define DEFAULT_SIM_COUNT_PATH DEFAULT_SETTING_PATH"/sim_count" #define MSG_KEEP_COPY DEFAULT_GENERAL_OPT_PATH"/keep_copy" -#define MSG_ALERT_TONE VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT +#define MSG_ALERT_REP_TYPE DEFAULT_GENERAL_OPT_PATH"/alert_rep_type" #define MSG_AUTO_ERASE DEFAULT_GENERAL_OPT_PATH"/auto_erase" #define MSG_BLOCK_MESSAGE DEFAULT_GENERAL_OPT_PATH"/block_msg" #define CONTACT_SYNC_TIME DEFAULT_GENERAL_OPT_PATH"/contact_sync_time" +#define MSG_SEARCH_TAGS DEFAULT_GENERAL_OPT_PATH"/search_tags" + +#define MSG_BLOCK_UNKNOWN_MSG DEFAULT_GENERAL_OPT_PATH"/block_unknown_msg" +#define MSG_SMS_LIMIT DEFAULT_GENERAL_OPT_PATH"/sms_limit" +#define MSG_MMS_LIMIT DEFAULT_GENERAL_OPT_PATH"/mms_limit" +#define MSG_SETTING_NOTIFICATION DEFAULT_GENERAL_OPT_PATH"/notification" +#define MSG_SETTING_VIBRATION DEFAULT_GENERAL_OPT_PATH"/vibration" +#define MSG_SETTING_PREVIEW DEFAULT_GENERAL_OPT_PATH"/preview" +#define MSG_SETTING_RINGTONE_PATH DEFAULT_GENERAL_OPT_PATH"/ringtone_path" +#define MSG_SETTING_RINGTONE_TYPE DEFAULT_GENERAL_OPT_PATH"/ringtone_type" +#define MSG_MMS_UA_PROFILE DEFAULT_GENERAL_OPT_PATH"/ua_profile" +#define MSG_MMS_UA_AGENT DEFAULT_GENERAL_OPT_PATH"/ua_agent" #define SMS_SEND_DCS DEFAULT_SMS_SEND_OPT_PATH"/dcs" #define SMS_SEND_NETWORK_MODE VCONFKEY_MESSAGE_NETWORK_MODE @@ -138,7 +162,6 @@ #define CB_RECEIVE DEFAULT_CB_MSG_OPT_PATH"/receive" #define CB_SAVE DEFAULT_CB_MSG_OPT_PATH"/save" #define CB_MAX_SIM_COUNT DEFAULT_CB_MSG_OPT_PATH"/max_sim_count" -#define CB_CHANNEL_COUNT DEFAULT_CB_MSG_OPT_PATH"/channel_count" #define CB_CHANNEL_ACTIVATE DEFAULT_CB_MSG_OPT_PATH"/channel_activate" #define CB_CHANNEL_ID_FROM DEFAULT_CB_MSG_OPT_PATH"/channel_id_from" #define CB_CHANNEL_ID_TO DEFAULT_CB_MSG_OPT_PATH"/channel_id_to" @@ -147,12 +170,17 @@ #define VOICEMAIL_NUMBER DEFAULT_VOICE_MAIL_OPT_PATH"/voice_mail_number" #define VOICEMAIL_COUNT DEFAULT_VOICE_MAIL_OPT_PATH"/voice_mail_count" +#define VOICEMAIL_ALPHA_ID DEFAULT_VOICE_MAIL_OPT_PATH"/voice_mail_alphaid" +#define VOICEMAIL_DEFAULT_NUMBER "" +#define VOICEMAIL_DEFAULT_ALPHA_ID "" #define MSGSIZE_OPTION DEFAULT_MSGSIZE_OPT_PATH"/msg_size" #define SIM_USED_COUNT DEFAULT_SIM_COUNT_PATH"/used_cnt" #define SIM_TOTAL_COUNT DEFAULT_SIM_COUNT_PATH"/total_cnt" +#define MSG_DEFAULT_APP_ID "org.tizen.message" +#define MSG_QUICKPANEL_APP_ID "org.tizen.quickpanel" /*================================================================================================== TYPES @@ -175,6 +203,15 @@ typedef unsigned char MSG_SUB_TYPE_T; /** + * @brief Represents a message tag type. \n + * Each main type of a message can be divided into some tag types. \n + * For instance of SMS, the message sub type can be one of the Priority, Finance, and so on. \n + * The values for this type SHOULD be in _MSG_SUB_TYPE_E. + */ +typedef unsigned int MSG_TAG_TYPE_T; + + +/** * @brief Represents a message class. \n * The values for this type SHOULD be in _MSG_CLASS_TYPE_E. */ @@ -214,7 +251,8 @@ typedef struct MSG_MESSAGE_TYPE_S msgType; /**< Indicates the message type such as SMS and MMS */ msg_storage_id_t storageId; /**< Indicates where the message is saved. */ int nAddressCnt; /**< Indicates the count of addresses. */ - MSG_ADDRESS_INFO_S addressList[MAX_TO_ADDRESS_CNT]; /**< Indicates the address information list. */ +// MSG_ADDRESS_INFO_S addressList[MAX_TO_ADDRESS_CNT]; /**< Indicates the address information list. */ + MSG_ADDRESS_INFO_S *addressList; /**< Indicates the address information list. */ char replyAddress[MAX_PHONE_NUMBER_LEN+1]; /**< Indicates the reply address. */ char subject[MAX_SUBJECT_LEN+1]; /**< Indicates the message subject. */ time_t displayTime; /**< Indicates the display time related to the specific operation. */ @@ -232,8 +270,10 @@ typedef struct char msgText[MAX_MSG_TEXT_LEN+1]; char thumbPath[MSG_FILEPATH_LEN_MAX+1]; bool bStore; /**< Indicates whether the message is stored or not if it is MWI message. */ + int sim_idx; } MSG_MESSAGE_INFO_S; + typedef struct { msg_message_id_t msgId; /**< Indicates the message ID of this message. */ @@ -244,6 +284,7 @@ typedef struct MSG_CLASS_TYPE_T classType; /**< Message class type. See enum _MSG_CLASS_TYPE_E */ msg_storage_id_t storageId; /**< Indicates where the message is saved. see enum _MSG_FOLDER_TYPE_E*/ msg_struct_list_s *addr_list; + GList *addressList; char replyAddress[MAX_PHONE_NUMBER_LEN+1]; /**< Indicates the reply address. */ char subject[MAX_SUBJECT_LEN+1]; /**< Indicates the message subject. */ time_t displayTime; /**< Indicates the display time related to the specific operation. */ @@ -263,9 +304,22 @@ typedef struct void *pData; /**< Indicates the message payload information as a body. default character encoding is UTF-8*/ void *pMmsData; /**< Indicates the message payload information as a body. default character encoding is UTF-8*/ size_t mmsDataSize; + int simIndex; } MSG_MESSAGE_HIDDEN_S; /** + * @brief Represents translation information for thread view. + */ +typedef struct +{ + int bTranslation; + int senderLang; + int receiverLang; + int bOnlyReceive; + int bIncludeOrgMsg; +} MSG_TRANSLATION_INFO_S; + +/** * @brief Represents message information for thread view. */ typedef struct @@ -280,7 +334,15 @@ typedef struct int unreadCnt; /**< Indicates the unread messages from the Peer. */ int smsCnt; /**< Indicates the SMS messages from the Peer. */ int mmsCnt; /**< Indicates the MMS messages from the Peer. */ - bool bProtected; /**< Indicates whether the thread includes protected messages. */ + bool bProtected; /**< Indicates whether the thread includes protected messages. */ + bool bDraft; + bool bSendFailed; + bool bSending; + msg_message_id_t lastMsgId; /**< Indicates the last message ID of this thread. */ + MSG_TRANSLATION_INFO_S msgTranslation; + int simIndex; + MSG_TAG_TYPE_T tagType; /**< Message tag type. See enum _MSG_TAG_TYPE_E */ + } MSG_THREAD_VIEW_S; @@ -310,8 +372,24 @@ typedef struct char subject[MAX_SUBJECT_LEN+1]; /**< Indicates the message subject. */ size_t textSize; /**< Indicates the data size. The unit is byte. */ char *pText; /**< Indicates the message payload information as a body. default character encoding is UTF-8*/ + int tcs_bc_level; + char firstMediaPath[MSG_FILEPATH_LEN_MAX+1]; // First Media Path in mms; + msg_list_handle_t multipart_list; + int simIndex; } MSG_CONVERSATION_VIEW_S; +typedef struct +{ + MimeType type; /**< Indicates the multipart mime type. see enum MimeType */ + char szContentType[MSG_MSG_ID_LEN + 1]; /**< Indicates the content type */ + char szFileName[MSG_FILENAME_LEN_MAX + 1]; /**< Indicates the file name */ + char szFilePath[MSG_FILEPATH_LEN_MAX + 1]; /**< Indicates the file path */ + char szContentID[MSG_MSG_ID_LEN + 1]; /**< Indicates the content id */ + char szContentLocation[MSG_MSG_ID_LEN + 1]; /**< Indicates the content Location */ + + int tcs_bc_level; /** detect malware type **/ + char szThumbFilePath[MSG_FILEPATH_LEN_MAX + 1]; /**< Indicates the thumbnail file path */ +} MSG_MMS_MULTIPART_S; /** * @brief Represents sim message informatioin list. @@ -345,15 +423,11 @@ typedef struct typedef struct { int listenerFd; /**< Rx fd for status cnf */ -#ifdef __x86_64__ - uint64_t handleAddr; /**< Handle address for status cnf */ -#else unsigned int handleAddr; /**< Handle address for status cnf */ -#endif msg_message_id_t sentMsgId; /**< The ID of a sent message for updating message status */ - } MSG_PROXY_INFO_S; + /** * @brief Aux data structure for MSG_CMD_REG_INCOMING_MSG_CB. \n * This stucture contains the information about the receiver for msgType and port. @@ -470,7 +544,6 @@ typedef struct unsigned char language_type[MAX_CB_MSG_LANGUAGE_TYPE_LEN]; } MSG_CB_MSG_S; - /*================================================================================================== ENUMS ==================================================================================================*/ @@ -540,8 +613,19 @@ enum _MSG_SUB_TYPE_E MSG_SENDREQ_JAVA_MMS, /**< MMS Send Request message for JAVA MMS */ MSG_ETWS_SMS, + MSG_MWI_VOICE2_SMS, /**< MWI Message Voice for line 2(CPHS)*/ + MSG_UNSAVED_SMS, /**< Unsaved message, e.g, SIM change alert message*/ + + MSG_CMAS_PRESIDENTIAL, /**< CMAS CLASS */ + MSG_CMAS_EXTREME, + MSG_CMAS_SEVERE, + MSG_CMAS_AMBER, + MSG_CMAS_TEST, + MSG_CMAS_EXERCISE, + MSG_CMAS_OPERATOR_DEFINED, }; + /** * @brief Represents the values of a message transaction type. \n * This enum is used as the value of MSG_MMS_TRANSACTION_TYPE_T. @@ -564,6 +648,10 @@ enum _MSG_MMS_ITEM_TYPE_E MSG_MMS_ITEM_TYPE_VIDEO, /**< Indicates the video media */ MSG_MMS_ITEM_TYPE_ATTACH, /**< Indicates the attach file */ MSG_MMS_ITEM_TYPE_PAGE, /**< Indicates the page count */ + MSG_MMS_ITEM_TYPE_MALWARE, /**< Indicates the tcs bc level*/ + MSG_MMS_ITEM_TYPE_1ST_MEDIA, /**< Indicates the 1st media path*/ }; + + #endif diff --git a/include/common/MsgMmsTypes.h b/include/common/MsgMmsTypes.h index 6aceaac..2ce1da6 100755 --- a/include/common/MsgMmsTypes.h +++ b/include/common/MsgMmsTypes.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_MMS_TYPES_H @@ -45,6 +45,7 @@ * @{ */ +typedef GList MMSList; /*================================================================================================== STRUCTURES @@ -105,8 +106,7 @@ typedef struct char szContentType[MSG_MSG_ID_LEN + 1]; char szContentLocation[MSG_MSG_ID_LEN + 1]; - -}MMS_MEDIA_S; +} MMS_MEDIA_S; /** * @brief Represents attachment information. @@ -121,7 +121,7 @@ typedef struct char szDrm2FullPath[MSG_FILEPATH_LEN_MAX + 1]; /**< Indicates the fullpath of the DRM */ char szContentType[MSG_MSG_ID_LEN + 1]; -}MMS_ATTACH_S; +} MMS_ATTACH_S; /** * @brief Represents SMIL page information. @@ -146,7 +146,7 @@ typedef struct { bool bUnitPercent; /**< Indicates the length is in percentage(%) or not */ int value; /**< Indicates the value for length */ -}MMS_LENGTH; +} MMS_LENGTH; /** * @brief Represents SMIL region information. @@ -162,7 +162,7 @@ typedef struct int bgColor; /**< Indicates the background color of the region */ REGION_FIT_TYPE_T fit; /**< Indicates the fit type. see enum REGION_FIT_TYPE_T */ -}MMS_SMIL_REGION; +} MMS_SMIL_REGION; /** * @brief Represents SMIL root layout information. @@ -221,28 +221,102 @@ typedef struct MMS_APPID_INFO_S msgAppId; }MMS_RECV_DATA_S; +typedef struct _MMS_ADDRESS_DATA_S { + int address_type; + char *address_val; +} MMS_ADDRESS_DATA_S; + +/** + * @brief Represents MMS header data. + */ typedef struct _MMS_HEADER_DATA_S { - char messageID[MSG_MSG_ID_LEN + 1]; - char trID[MSG_MSG_ID_LEN + 1]; - char contentLocation[MSG_MSG_ID_LEN + 1]; + MMSList *bcc;// Bcc + MMSList *cc;// Cc + char contentLocation[MMS_LOCATION_LEN + 1]; char szContentType[MSG_MSG_ID_LEN + 1];//string : ex) application/vnd.wap.multipart.related - int contentType;//MimeType : ex) application/vnd.wap.multipart.related + unsigned long int date; + bool bDeliveryReport; // X-Mms-Delivery-Report + MmsTimeStruct delivery; // X-Mms-Delivery-Time + MmsTimeStruct expiry; + char szFrom[254 * 3 + 11]; //"/TYPE=PLMN", /"TYPE=IPv4", "/TYPE=IPv6" // From + int messageClass;//Personal | Advertisement | Informational | Auto + char messageID[MSG_MSG_ID_LEN + 1]; int messageType;//MmsMsgType : ex) sendreq int mmsVersion;//1.0 1.3 - int messageClass;//Personal | Advertisement | Informational | Auto - int contentClass;//text | image-basic| image-rich | video-basic | video-rich | megapixel | content-basic | content-rich + int messageSize; //X-Mms-Message-Size int mmsPriority;//_MSG_PRIORITY_TYPE_E : Low | Normal | High + bool bReadReport;// X-Mms-Read-Report +// X-Mms-Report-Allowed +// X-Mms-Response-Status +// X-Mms-Response-Text + bool bHideAddress;// X-Mms-Sender-Visibility + msg_delivery_report_status_t mmsStatus;// X-Mms-Status + char szSubject[MAX_SUBJECT_LEN + 1];// Subject + MMSList *to;// Cc// To + char trID[MSG_MSG_ID_LEN + 1]; +// X-Mms-Retrieve-Status +// X-Mms-Retrieve-Text +// X-Mms-Read-Status +// X-Mms-Reply-Charging +// X-Mms-Reply-Charging-Deadline +// X-Mms-Reply-Charging-ID +// X-Mms-Reply-Charging-Size +// X-Mms-Previously-Sent-By +// X-Mms-Previously-Sent-Date +// X-Mms-Store +// X-Mms-MM-State +// X-Mms-MM-Flags +// X-Mms-Store-Status +// X-Mms-Store-Status-Text +// X-Mms-Stored +// X-Mms-Attributes +// X-Mms-Totals +// X-Mms-Mbox-Totals +// X-Mms-Quotas +// X-Mms-Mbox-Quotas +// X-Mms-Message-Count +// Content +// X-Mms-Start +// Additional-headers +// X-Mms-Distribution-Indicator +// X-Mms-Element-Descriptor +// X-Mms-Limit +// X-Mms-Recommended-Retrieval-Mode +// X-Mms-Recommended-Retrieval-Mode-Text +// X-Mms-Status-Text +// X-Mms-Applic-ID +// X-Mms-Reply-Applic-ID +// X-Mms-Aux-Applic-Info + int contentClass;//text | image-basic| image-rich | video-basic | video-rich | megapixel | content-basic | content-rich +// X-Mms-DRM-Content +// X-Mms-Adaptation-Allowed +// X-Mms-Replace-ID +// X-Mms-Cancel-ID +// X-Mms-Cancel-Status +//------------------------------------------------------------------ + int contentType;//MimeType : ex) application/vnd.wap.multipart.related + } MMS_HEADER_DATA_S; +/** + * @brief Represents MMS multipart data. + */ typedef struct { MimeType type; /**< Indicates the multipart mime type. see enum MimeType */ char szContentType[MSG_MSG_ID_LEN + 1]; /**< Indicates the content type */ char szFileName[MSG_FILENAME_LEN_MAX + 1]; /**< Indicates the file name */ - char szFilePath[MSG_FILEPATH_LEN_MAX + 1]; /**< Indicates the file path */ char szContentID[MSG_MSG_ID_LEN + 1]; /**< Indicates the content id */ char szContentLocation[MSG_MSG_ID_LEN + 1]; /**< Indicates the content Location */ + MsgDrmType drmType; /**< Indicates the drm type. see enum MsgDrmType */ + + char szFilePath[MSG_FILEPATH_LEN_MAX + 1]; /**< Indicates the file path */ + char *pMultipartData; + size_t nMultipartDataLen; + int tcs_bc_level; /** detect malware type **/ + int malware_allow; + char szThumbFilePath[MSG_FILEPATH_LEN_MAX + 1]; /**< Indicates the thubnail file path */ } MMS_MULTIPART_DATA_S; /** @@ -264,8 +338,19 @@ typedef struct _MMS_MESSAGE_DATA_S GList *metalist; /**< The pointer to SMIL meta list */ MMS_SMIL_ROOTLAYOUT rootlayout; /**< Indicates the root layout information */ MMS_APPID_INFO_S msgAppId; - MMS_HEADER_DATA_S header; - MMS_MULTIPART_DATA_S smil; + MMS_HEADER_DATA_S header;//use for scloud + MMS_MULTIPART_DATA_S smil;//use for scloud } MMS_MESSAGE_DATA_S; +/** + * @brief Represents MMS message data. + */ +typedef struct +{ + int backup_type; //none = 0 || scloud backup = 1 || kies backup = 2; + MMS_HEADER_DATA_S *header; /**< The header struct of MMS*/ + MMS_MULTIPART_DATA_S *smil; + MMSList *multipartlist; /**< list of MMS_MULTIPART_DATA_S*/ +} MMS_DATA_S; + #endif diff --git a/include/common/MsgPluginInterface.h b/include/common/MsgPluginInterface.h index 2eb4c04..667ae81 100755 --- a/include/common/MsgPluginInterface.h +++ b/include/common/MsgPluginInterface.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ /** @@ -524,7 +524,7 @@ typedef msg_error_t (*MsgPlgSaveSimMessage)(const MSG_MESSAGE_INFO_S *pMsgInfo, * */ /*================================================================================================*/ -typedef msg_error_t (*MsgPlgDeleteSimMessage)(msg_sim_id_t SimMsgId); +typedef msg_error_t (*MsgPlgDeleteSimMessage)(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId); /** @@ -565,7 +565,7 @@ typedef msg_error_t (*MsgPlgDeleteSimMessage)(msg_sim_id_t SimMsgId); * */ /*================================================================================================*/ -typedef msg_error_t (*MsgPlgSetReadStatus)(msg_sim_id_t SimMsgId); +typedef msg_error_t (*MsgPlgSetReadStatus)(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId); /** @@ -606,7 +606,7 @@ typedef msg_error_t (*MsgPlgSetReadStatus)(msg_sim_id_t SimMsgId); * */ /*================================================================================================*/ -typedef msg_error_t (*MsgPlgSetMemoryStatus)(msg_error_t Error); +typedef msg_error_t (*MsgPlgSetMemoryStatus)(msg_sim_slot_id_t sim_idx, msg_error_t Error); // Setting API @@ -891,7 +891,6 @@ typedef msg_error_t (*MsgPlgUpdateMessage)(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SEN * * \param output - pMsg is information of MMS message. * \param output - pSendOptInfo is information of sending options. -* \param output - pMmsMsg is information of MMS messages detail data. * \param output - pDestMsg is file path of MMS message. * * \return Return Type (int(msg_error_t)) \n @@ -909,7 +908,7 @@ typedef msg_error_t (*MsgPlgUpdateMessage)(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SEN * */ /*================================================================================================*/ -typedef msg_error_t (*MsgPlgGetMmsMessage)(MSG_MESSAGE_INFO_S* pMsg, MSG_SENDINGOPT_INFO_S* pSendOptInfo, MMS_MESSAGE_DATA_S* pMmsMsg, char** pDestMsg); +typedef msg_error_t (*MsgPlgGetMmsMessage)(MSG_MESSAGE_INFO_S* pMsg, MSG_SENDINGOPT_INFO_S* pSendOptInfo, char** pDestMsg); /** @@ -1035,6 +1034,10 @@ typedef msg_error_t (*MsgPlgComposeReadReport)(MSG_MESSAGE_INFO_S *pMsgInfo); /*================================================================================================*/ typedef msg_error_t (*MsgPlgRestoreMsg)(MSG_MESSAGE_INFO_S *pMsg, char* pRcvdBody, int rcvdBodyLen, char* filePath); +typedef msg_error_t (*MsgPlgGetMeImei) (char *pImei); + +typedef msg_error_t (*MsgPlgGetDefaultNetworkSimId) (int *simId); + // framework defined callbacks. typedef void (*MsgPlgOnSentStatus)(MSG_SENT_STATUS_S *pSentStatus); @@ -1044,24 +1047,29 @@ typedef msg_error_t (*MsgPlgOnInitSimBySat)(void); typedef msg_error_t (*MsgPlgOnSyncMLMsgIncoming)(MSG_SYNCML_MESSAGE_DATA_S *pSyncMLData); typedef msg_error_t (*MsgPlgOnLBSMsgIncoming)(MSG_LBS_MESSAGE_DATA_S *pLBSData); typedef msg_error_t (*MsgPlgOnPushMsgIncoming)(MSG_PUSH_MESSAGE_DATA_S *pPushData); -typedef msg_error_t (*MsgPlgOnCBMsgIncoming)(MSG_CB_MSG_S *pCbMsg); +typedef msg_error_t (*MsgPlgOnCBMsgIncoming)(MSG_CB_MSG_S *pCbMsg, MSG_MESSAGE_INFO_S *pMsgInfo); typedef msg_error_t (*MsgPlgOnMmsConfIncoming)(MSG_MESSAGE_INFO_S *pMsgInfo, msg_request_id_t *pRequest); - +typedef msg_error_t (*MsgPlgOnSimMessageIncoming)(MSG_MESSAGE_INFO_S *pMsgInfo, int *simIdList, msg_message_id_t *retMsgId, int listSize); +typedef msg_error_t (*MsgPlgOnResendMessage)(void); +typedef msg_error_t (*MsgPlgOnInitImsi)(int sim_idx); /*================================================================================================== STRUCTURES ==================================================================================================*/ struct _MSG_PLUGIN_LISTENER_S { - MsgPlgOnSentStatus pfSentStatusCb; /** The function pointer of sent status callback. */ - MsgPlgOnStorageChange pfStorageChangeCb; /** The function pointer of storage change callback. */ - MsgPlgOnMsgIncoming pfMsgIncomingCb; /** The function pointer of receive message callback. */ - MsgPlgOnInitSimBySat pfInitSimBySatCb; /** The function pointer of init SIM callback. */ + MsgPlgOnSentStatus pfSentStatusCb; /** The function pointer of sent status callback. */ + MsgPlgOnStorageChange pfStorageChangeCb; /** The function pointer of storage change callback. */ + MsgPlgOnMsgIncoming pfMsgIncomingCb; /** The function pointer of receive message callback. */ + MsgPlgOnInitSimBySat pfInitSimBySatCb; /** The function pointer of init SIM callback. */ MsgPlgOnSyncMLMsgIncoming pfSyncMLMsgIncomingCb; /** The function pointer of receive syncML message callback. */ - MsgPlgOnLBSMsgIncoming pfLBSMsgIncomingCb; /** The function pointer of receive LBS message callback. */ + MsgPlgOnLBSMsgIncoming pfLBSMsgIncomingCb; /** The function pointer of receive LBS message callback. */ MsgPlgOnPushMsgIncoming pfPushMsgIncomingCb; /** The function pointer of receive Push message callback. */ - MsgPlgOnCBMsgIncoming pfCBMsgIncomingCb; /** The function pointer of receive cb message callback. */ - MsgPlgOnMmsConfIncoming pfMmsConfIncomingCb; /** The function pointer of receive MMS conf */ + MsgPlgOnCBMsgIncoming pfCBMsgIncomingCb; /** The function pointer of receive cb message callback. */ + MsgPlgOnMmsConfIncoming pfMmsConfIncomingCb; /** The function pointer of receive MMS conf */ + MsgPlgOnSimMessageIncoming pfSimMsgIncomingCb; /** The function pointer of sim message callback */ + MsgPlgOnResendMessage pfResendMessageCb; + MsgPlgOnInitImsi pfSimInitImsiCb; }; @@ -1070,15 +1078,11 @@ struct _MSG_PLUGIN_HANDLER_S MsgPlgInitialize pfInitialize; /**< The function pointer of initialize. */ MsgPlgFinalize pfFinalize; /**< The function pointer of finalize. */ MsgPlgRegisterListener pfRegisterListener; /**< The function pointer of register listener. */ - MsgPlgCheckSimStatus pfCheckSimStatus; /**< The function pointer of check SIM status. */ - MsgPlgCheckDeviceStatus pfCheckDeviceStatus; /**< The function pointer of check device status. */ MsgPlgSubmitRequest pfSubmitRequest; /**< The function pointer of submit request. */ - MsgPlgInitSimMessage pfInitSimMessage; /**< The function pointer of initialize SIM msg. */ MsgPlgSaveSimMessage pfSaveSimMessage; /**< The function pointer of save SIM msg. */ MsgPlgDeleteSimMessage pfDeleteSimMessage; /**< The function pointer of delete SIM msg. */ MsgPlgSetReadStatus pfSetReadStatus; /**< The function pointer of set read status. */ MsgPlgSetMemoryStatus pfSetMemoryStatus; /**< The function pointer of set memory status. */ - MsgPlgInitConfigData pfInitConfigData; /**< The function pointer of initialize of setting. */ MsgPlgSetConfigData pfSetConfigData; /**< The function pointer of save setting. */ MsgPlgGetConfigData pfGetConfigData; /**< The function pointer of get setting. */ MsgPlgRestoreMsg pfRestoreMsg; @@ -1088,6 +1092,7 @@ struct _MSG_PLUGIN_HANDLER_S MsgPlgGetMmsMessage pfGetMmsMessage; MsgPlgUpdateRejectStatus pfUpdateRejectStatus; MsgPlgComposeReadReport pfComposeReadReport; + MsgPlgGetDefaultNetworkSimId pfGetDefaultNetworkSimId; }; #ifdef __cplusplus diff --git a/include/common/MsgQueue.h b/include/common/MsgQueue.h index 82ccfed..886f71f 100755 --- a/include/common/MsgQueue.h +++ b/include/common/MsgQueue.h @@ -1,30 +1,31 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef __MsgThdSafeQ_H__ #define __MsgThdSafeQ_H__ -#include #include "MsgMutex.h" #include -template class MsgThdSafeQ + +template +class MsgSimpleQ { public: - MsgThdSafeQ(){}; + MsgSimpleQ(){}; void pop_front (); bool front(T* qItem); void push_front(T const & input); @@ -34,27 +35,20 @@ public: void clear(); bool checkExist(T const & qItem, bool(cmp)(T const &, T const &)); private: - Mutex mx; std::list q; }; -/* - mx variable guarantees atomic operation in multi-threaded environment. - For example, when a thread is executing Pop(), other threads - trying to execute one of Pop, Push, Size, Empty are locked. -*/ - -template void MsgThdSafeQ::pop_front() +template +void MsgSimpleQ::pop_front() { - MutexLocker lock(mx); if( q.empty() ) return; q.pop_front(); } -template bool MsgThdSafeQ::front(T* qItem) +template +bool MsgSimpleQ::front(T* qItem) { - MutexLocker lock(mx); if( qItem == NULL || q.empty() ) return false; // Fail @@ -64,41 +58,40 @@ template bool MsgThdSafeQ::front(T* qItem) } -template void MsgThdSafeQ::push_back(T const & qItem) +template +void MsgSimpleQ::push_back(T const & qItem) { - MutexLocker lock(mx); q.push_back(qItem); } -template void MsgThdSafeQ::push_front(T const & qItem) +template void +MsgSimpleQ::push_front(T const & qItem) { - MutexLocker lock(mx); q.push_front(qItem); } -template int MsgThdSafeQ::size() +template +int MsgSimpleQ::size() { - MutexLocker lock(mx); return q.size(); } -template bool MsgThdSafeQ::empty() +template +bool MsgSimpleQ::empty() { - MutexLocker lock(mx); return q.empty(); } -template void MsgThdSafeQ::clear() +template +void MsgSimpleQ::clear() { - MutexLocker lock(mx); q.clear(); } -template bool MsgThdSafeQ::checkExist(T const & qItem, bool(cmp)(T const &, T const &)) +template +bool MsgSimpleQ::checkExist(T const & qItem, bool(cmp)(T const &, T const &)) { - MutexLocker lock(mx); - for(typename list::iterator iterPos = q.begin(); iterPos != q.end(); ++iterPos) { if (cmp(qItem, *iterPos) == true) diff --git a/include/common/MsgSettingTypes.h b/include/common/MsgSettingTypes.h index 0c39313..3c52ff1 100755 --- a/include/common/MsgSettingTypes.h +++ b/include/common/MsgSettingTypes.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_SETTING_TYPES_H @@ -34,6 +34,7 @@ INCLUDE FILES ==================================================================================================*/ #include "MsgTypes.h" +#include "MsgStorageTypes.h" /** * @ingroup MESSAGING_FRAMEWORK @@ -179,11 +180,18 @@ typedef unsigned char MSG_CB_LANGUAGE_TYPE_T; /** * @brief Represents the SIM status from telephony. \n - * The values for this type SHOULD be in \ref _MSG_SIM_STATUS_E. + * The values for this type SHOULD be in _MSG_SIM_STATUS_E. */ typedef unsigned char MSG_SIM_STATUS_T; +/** + * @brief Represents the ringtone type of message. \n + * The values for this type SHOULD be in _MSG_RINGTONE_TYPE_E. + */ +typedef int MSG_RINGTONE_TYPE_T; + + /*================================================================================================== STRUCTURES ==================================================================================================*/ @@ -210,25 +218,32 @@ typedef struct MSG_SMSC_ADDRESS_S smscAddr; /**< SMSC address structure */ } MSG_SMSC_DATA_S; + /** * @brief Represents an SMSC list. */ typedef struct { - int selected; /**< Selected SMSC index */ + int index; /**< SMSC index for Updating information */ + int selected; /**< Selected SMSC index */ int totalCnt; /**< The count of total SMSC addresses */ - MSG_SMSC_DATA_S smscData[SMSC_LIST_MAX]; /**< SMSC data information list*/ + MSG_SMSC_DATA_S smscData[SMSC_LIST_MAX]; /**< SMSC data information list*/ + msg_sim_slot_id_t simIndex; }MSG_SMSC_LIST_S; + /** * @brief Represents an SMSC list. */ typedef struct { + int index; /**< SMSC index for Updating information */ int selected; /**< Selected SMSC index */ - msg_struct_list_s *smsc_list; /**< SMSC data information list*/ + msg_struct_list_s *smsc_list; /**< SMSC data information list*/ + msg_sim_slot_id_t simIndex; }MSG_SMSC_LIST_HIDDEN_S; + /** * @brief Represents the information of a cell broadcasting channel. */ @@ -237,6 +252,8 @@ typedef struct bool bActivate; /**< Indicates whether the CB channel is activate or passive. */ unsigned int from; /**< Indicates the start ID of a CB channel range. */ unsigned int to; /**< Indicates the end ID of a CB channel range. */ + unsigned short ctg; /**< Indicates the category of a CB. (for 3gpp2)*/ + unsigned short lang; /**< Indicates the language of a CB. (for 3gpp2)*/ char name[CB_CHANNEL_NAME_MAX+1]; /**< Indicates the name of a CB channel. */ } MSG_CB_CHANNEL_INFO_S; @@ -250,14 +267,24 @@ typedef struct MSG_CB_CHANNEL_INFO_S channelInfo[CB_CHANNEL_MAX]; /**< The structure of CB channel information */ } MSG_CB_CHANNEL_S; + /** * @brief Represents an general option. */ typedef struct { - bool bKeepCopy; /**< Indicates whether the SMS message copy is kept or not. */ - MSG_ALERT_TONE_T alertTone; /**< Indicates the period of playing alert tone. */ - bool bAutoErase; /**< Indicates whether the auto-erase option is enabled or not. */ + bool bKeepCopy; /**< Indicates whether the SMS message copy is kept or not. */ + MSG_ALERT_TONE_T alertTone; /**< Indicates the period of playing alert tone. */ + bool bAutoErase; /**< Indicates whether the auto-erase option is enabled or not. */ + bool bBlockUnknownMsg; /**< Indicates whether unknown sender message is blocked or not. */ + int smsLimitCnt; /**< Indicates the count limitation of sms messages in one conversation */ + int mmsLimitCnt; /**< Indicates the count limitation of sms messages in one conversation */ + bool bNotification; /**< Indicates whether notification for incoming message is shown or not. */ + bool bVibration; /**< Indicates whether vibration for incoming message is run or not. */ + bool bPreview; /**< Indicates whether preview for incoming message is shown or not. */ + char ringtonePath[MSG_FILEPATH_LEN_MAX+1]; /**< Indicates the message ringtone path */ + int ringtoneType; /**< Indicates the message ringtone type. */ + int searchTags; /**< Indicates the tags to be enabled for search ex) MSG_MESSAGE_TAG_PRIMARY | MSG_MESSAGE_TAG_PROMOTION. See enum _MSG_TAG_TYPE_E */ }MSG_GENERAL_OPT_S; @@ -356,6 +383,7 @@ typedef struct int maxSimCnt; /**< Indicates the number of channels which can be stored in SIM. */ MSG_CB_CHANNEL_S channelData; /**< Indicates the cell broadcasting channel information. */ bool bLanguage[CB_LANG_TYPE_MAX]; /**< Indicates whether the language name of a cell broadcasting message is set or not. */ + msg_sim_slot_id_t simIndex; } MSG_CBMSG_OPT_S; typedef struct @@ -364,14 +392,18 @@ typedef struct int maxSimCnt; /**< Indicates the number of channels which can be stored in SIM. */ msg_struct_list_s *channelData; /**< Indicates the cell broadcasting channel information. */ bool bLanguage[CB_LANG_TYPE_MAX]; /**< Indicates whether the language name of a cell broadcasting message is set or not. */ + msg_sim_slot_id_t simIndex; } MSG_CBMSG_OPT_HIDDEN_S; + /** * @brief Represents a voice mail number option. */ typedef struct { char mailNumber[MAX_PHONE_NUMBER_LEN+1]; + char alpahId[MAX_SIM_XDN_ALPHA_ID_LEN+1]; + msg_sim_slot_id_t simIndex; } MSG_VOICEMAIL_OPT_S; diff --git a/include/common/MsgSmil.h b/include/common/MsgSmil.h new file mode 100755 index 0000000..6537e0e --- /dev/null +++ b/include/common/MsgSmil.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +#ifndef MSG_SMIL_H +#define MSG_SMIL_H + +#include "MsgMmsTypes.h" + +/** @fn bool MsgSmilParseSmilDoc(MMS_MESSAGE_DATA_S *pstMsgMmsBody, const char *pSmilDoc) + * @brief Parse Smil Document using MMS_MESSAGE_DATA_S struct. + * @param[in] pstMsgMmsBody + * @param[in] pSmilDoc + * @retval TRUE In case of Success. + * @retval FALSE In case of failure. + */ +bool MsgSmilParseSmilDoc(MMS_MESSAGE_DATA_S *pstMsgMmsBody, const char *pSmilDoc); + +/** @fn bool MsgSmilGenerateSmilDoc(MMS_MESSAGE_DATA_S *pstMsgMmsBody, char **ppSmilDoc) + * @brief Generate Smil Document using MMS_MESSAGE_DATA_S struct. + * @param[in] pstMsgMmsBody + * @param[out] ppSmilDoc + * @retval TRUE In case of Success. + * @retval FALSE In case of failure. + */ +bool MsgSmilGenerateSmilDoc(MMS_MESSAGE_DATA_S *pstMsgMmsBody, char **ppSmilDoc); + +#endif//MSG_SMIL_H diff --git a/include/common/MsgStorageTypes.h b/include/common/MsgStorageTypes.h index bc0cd25..ca6c3d0 100755 --- a/include/common/MsgStorageTypes.h +++ b/include/common/MsgStorageTypes.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_STORAGE_TYPES_H @@ -91,10 +91,15 @@ typedef struct typedef struct { msg_contact_id_t contactId; /**< Indicates the unique contact ID. */ - char firstName[MAX_DISPLAY_NAME_LEN+1]; /**< Indicates the first name of contact. */ - char lastName[MAX_DISPLAY_NAME_LEN+1]; /**< Indicates the last name of contact. */ - char displayName[MAX_DISPLAY_NAME_LEN+1]; /**< Indicates the display name of contact. */ - char imagePath[MAX_IMAGE_PATH_LEN+1]; /**< Indicates the image path of contact. */ + int addrbookId; /**< Indicates the address book ID. */ + char firstName[MAX_DISPLAY_NAME_LEN+1]; /**< Indicates the first name of contact. */ + char lastName[MAX_DISPLAY_NAME_LEN+1]; /**< Indicates the last name of contact. */ + char middleName[MAX_DISPLAY_NAME_LEN+1]; /**< Indicates the middle name of contact. */ + char prefix[MAX_DISPLAY_NAME_LEN+1]; /**< Indicates the prefix of contact. */ + char suffix[MAX_DISPLAY_NAME_LEN+1]; /**< Indicates the suffix of contact. */ + char imagePath[MAX_IMAGE_PATH_LEN+1]; /**< Indicates the image path of contact. */ + char alerttonePath[MSG_FILEPATH_LEN_MAX+1]; /**< Indicates the message alert tone path of contact. */ + char vibrationPath[MSG_FILEPATH_LEN_MAX+1]; /**< Indicates the vibration path of contact. */ } MSG_CONTACT_INFO_S; @@ -105,7 +110,7 @@ typedef struct */ typedef struct { - msg_sort_type_t sortType; /**< Indicates the sort type */ + msg_sort_type_t sortType; /**< Indicates the sort type, See enum _MSG_SORT_TYPE_E */ bool bAscending; /**< Indicates the sort order which is ascending or descending */ }MSG_SORT_RULE_S; @@ -143,6 +148,29 @@ typedef struct } MSG_SEARCH_CONDITION_S; +/** + * @brief Represents Message list condition values. + */ +typedef struct +{ + msg_folder_id_t folderId; + msg_thread_id_t threadId; + msg_storage_id_t storageId; + msg_message_type_t msgType; + bool bProtected; + bool bScheduled; + char *pAddressVal; + char *pTextVal; + bool bAnd; + time_t fromTime; + time_t toTime; + int offset; + int limit; + msg_struct_t sortRule; + int simIndex; +} MSG_LIST_CONDITION_S; + + typedef struct { int appcode; diff --git a/include/common/MsgThread.h b/include/common/MsgThread.h index 08e8e21..c3c5ed6 100755 --- a/include/common/MsgThread.h +++ b/include/common/MsgThread.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef __MSG_THREAD_H__ diff --git a/include/common/MsgTransportTypes.h b/include/common/MsgTransportTypes.h index 0849f39..e4cf048 100755 --- a/include/common/MsgTransportTypes.h +++ b/include/common/MsgTransportTypes.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_TRANSPORT_TYPES_H diff --git a/include/common/MsgTypes.h b/include/common/MsgTypes.h index aa9b5d2..2cf4fd4 100755 --- a/include/common/MsgTypes.h +++ b/include/common/MsgTypes.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_TYPES_H @@ -55,6 +55,17 @@ */ #define MMS_V1_2 // MMS Version : MMS_V1_0 / MMS_V1_1 / MMS_V1_2 + +/** + * @brief Defines the notification method + */ +#define MSG_NOTI_INTEGRATION + +/** + * @brief Defines the enabled drm + */ +#define MSG_DRM_SUPPORT (0) + /** * @brief Defines message struct handle. */ @@ -275,6 +286,7 @@ typedef struct char pushBody[MAX_WAPPUSH_CONTENTS_LEN + 1]; int wspHeaderLen; char wspHeader[MAX_WAPPUSH_CONTENTS_LEN + 1]; + int simIndex; }MSG_SYNCML_MESSAGE_DATA_S; diff --git a/include/externals/MsgAlarm.h b/include/externals/MsgAlarm.h new file mode 100755 index 0000000..954b147 --- /dev/null +++ b/include/externals/MsgAlarm.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +#ifndef MSG_ALARM_H +#define MSG_ALARM_H + +#include +#include "MsgTypes.h" + +/*================================================================================================== + DEFINES +==================================================================================================*/ + +typedef void (*msg_alarm_cb)(int alarmId); + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ +msg_error_t MsgAlarmRegistration(struct tm *timeInfo, msg_alarm_cb userCB, int *alarmId); +msg_error_t MsgAlarmRemove(int alarmId); + +#endif // MSG_ALARM_H diff --git a/include/externals/MsgDevicedWrapper.h b/include/externals/MsgDevicedWrapper.h new file mode 100644 index 0000000..e405e3d --- /dev/null +++ b/include/externals/MsgDevicedWrapper.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +#ifndef MSG_DEVICED_WRAPPER_H +#define MSG_DEVICED_WRAPPER_H + + +void MsgDisplayLock(); +void MsgDisplayUnlock(); +void MsgChangePmState(); + +#endif /* MSG_DEVICED_WRAPPER_H */ diff --git a/include/externals/MsgLbs.h b/include/externals/MsgLbs.h new file mode 100755 index 0000000..ff24ebf --- /dev/null +++ b/include/externals/MsgLbs.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +#ifndef MSGLBS_H_ +#define MSGLBS_H_ + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ + +/*================================================================================================== + DEFINES +==================================================================================================*/ +#define MSG_LBS_PORT 7275 + + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ +void MsgLbsSms(const char *msgBody, int msgSize); +void MsgLbsWapPush(const char *pushHeader, const char *pushBody, int pushBodySize); + + +#endif /* MSGLBS_H_ */ diff --git a/include/externals/MsgNotificationWrapper.h b/include/externals/MsgNotificationWrapper.h new file mode 100755 index 0000000..9f53662 --- /dev/null +++ b/include/externals/MsgNotificationWrapper.h @@ -0,0 +1,208 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +#ifndef MSG_NOTIFICATION_WRAPPER_H +#define MSG_NOTIFICATION_WRAPPER_H + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include "MsgInternalTypes.h" +#include "MsgSqliteWrapper.h" + +/*================================================================================================== + DEFINES +==================================================================================================*/ +#define MSG_APP_PACKAGE_NAME "message" + +#define MSG_APP_LOCALEDIR "/usr/apps/"MSG_DEFAULT_APP_ID"/res/locale" + +#define MSG_NOTIFICATION_ICON_DIR MSG_QUICKPANEL_APP_ID"/shared/res/noti_icons/Message" + +// notification icon +#define MSG_NORMAL_ICON_PATH "/usr/apps/"MSG_NOTIFICATION_ICON_DIR"/noti_message.png" +#define MSG_SIM_ICON_PATH "/usr/apps/"MSG_NOTIFICATION_ICON_DIR"/noti_message_sim-card.png" +#define MSG_VOICE_ICON_PATH "/usr/apps/"MSG_NOTIFICATION_ICON_DIR"/noti_voice_mail.png" +#define MSG_CB_ICON_PATH "/usr/apps/"MSG_NOTIFICATION_ICON_DIR"/noti_message_cb-msg.png" +#define MSG_READ_ICON_PATH "/usr/apps/"MSG_NOTIFICATION_ICON_DIR"/noti_message_read_report.png" +#define MSG_DELIVERY_ICON_PATH "/usr/apps/"MSG_NOTIFICATION_ICON_DIR"/noti_message_delivery_report.png" +#define MSG_REPLY_ICON_PATH "/usr/apps/"MSG_NOTIFICATION_ICON_DIR"/noti_message_reply.png" +#define MSG_SMS_SENDING_FAILED_ICON_PATH "/usr/apps/"MSG_NOTIFICATION_ICON_DIR"/noti_message_failed.png" +#define MSG_MMS_SENDING_FAILED_ICON_PATH "/usr/apps/"MSG_NOTIFICATION_ICON_DIR"/noti_message_mms_failed.png" +#define MSG_MMS_RETRIVE_FAILED_ICON_PATH "/usr/apps/"MSG_NOTIFICATION_ICON_DIR"/noti_message_mms_problem.png" +#define MSG_EMERGENCY_ICON_PATH "/usr/apps/"MSG_DEFAULT_APP_ID"/res/icons/default/small/noti_emergency_mode.png" +#define MSG_NORMAL_MSG_INDICATOR_ICON_PATH "/usr/apps/"MSG_DEFAULT_APP_ID"/res/images/M01_tab_icon_sms_mms.png" + +// status bar icon +#define MSG_NORMAL_STATUS_ICON "/usr/apps/"MSG_DEFAULT_APP_ID"/res/icons/default/small/status_bar_message.png" +#define MSG_FAILED_STATUS_ICON "/usr/apps/"MSG_DEFAULT_APP_ID"/res/icons/default/small/status_bar_cancel_message.png" +#define MSG_DELIVER_REPORT_STATUS_ICON "/usr/apps/"MSG_DEFAULT_APP_ID"/res/icons/default/small/status_bar_delivery_report_message.png" +#define MSG_READ_REPORT_STATUS_ICON "/usr/apps/"MSG_DEFAULT_APP_ID"/res/icons/default/small/status_bar_read_report_message.png" +#define MSG_VOICE_MSG_STATUS_ICON "/usr/apps/"MSG_DEFAULT_APP_ID"/res/icons/default/small/status_bar_voicemail.png" +#define MSG_SIM_FULL_STATUS_ICON "/usr/apps/"MSG_DEFAULT_APP_ID"/res/icons/default/small/status_bar_sim_card_full.png" + +#ifndef TIZEN_I586_ENABLED +// system string +#define NEW_MESSAGE "IDS_MSGF_POP_NEW_MESSAGE" +#define NEW_MESSAGES "IDS_MSGF_POP_NEW_MESSAGES" +#define MSG_UNKNOWN_SENDER "IDS_MSGF_BODY_UNKNOWN" +#define MSG_NO_SUBJECT "IDS_MSGF_BODY_NO_SUBJECT" + + +// message app string for ticker noti +#define SENDING_MULTIMEDIA_MESSAGE_FAILED "IDS_MSGF_POP_SENDING_MULTIMEDIA_MESSAGE_FAILED" +#define MULTIMEDIA_MESSAGE_SENT "IDS_MSGF_POP_MULTIMEDIA_MESSAGE_SENT" +#define RETRIEVING_MESSAGE_FAILED "IDS_MSGF_POP_RETRIEVING_MESSAGE_FAILED" +#define MESSAGE_RETRIEVED "IDS_MSGF_BODY_MESSAGE_RETRIEVED" +#define SMS_MESSAGE_SENT "IDS_MSGC_POP_MESSAGESENT" +#define SMS_MESSAGE_SENDING_FAIL "IDS_MSGF_POP_SENDING_MESSAGE_FAILED" +#define SMS_MESSAGE_SENDING_PENDING "IDS_MSG_POP_UNABLE_TO_SEND_MESSAGE_IT_WILL_BE_SENT_WHEN_SERVICE_AVAILABLE" +#define SMS_MESSAGE_SIM_MESSAGE_FULL "IDS_MSGF_BODY_SIM_MEMORY_FULL_DELETE_SOME_ITEMS" +#define SMS_MESSAGE_MEMORY_FULL "IDS_MSGF_POP_NOT_ENOUGH_MEMORY_DELETE_SOME_ITEMS" +#define SMS_FDN_RESTRICTED "IDS_MSGF_POP_FDN_ENABLED_CANT_SEND_MSG" +#define SMS_SIM_CARD_FULL "IDS_MSG_HEADER_SIM_CARD_FULL" +#define SMS_MESSAGE_SIZE_OVER_SIM_SLOT_SIZE "IDS_MSGF_BODY_MESSAGE_IS_TOO_LARGE_TO_STORE_AS_A_SINGLE_MESSAGE_TO_SIM_CARD" + +// message app string for quickpanel noti +#define MSG_MESSAGE "IDS_MSGF_BODY_MESSAGE" +#define VOICE_MAIL "IDS_MSGF_BODY_VOICEMAIL" +#define NEW_VOICE_MAIL "IDS_MSGF_BODY_NEW_VOICEMAIL" +#define APP_NEW_MESSAGE "IDS_MSGF_POP_NEW_MESSAGE" +#define APP_NEW_MESSAGES "IDS_MSGF_POP_NEW_MESSAGES" +#define CB_MESSAGE "IDS_MSGF_BODY_CB_MESSAGES" +#define PUSH_MESSAGE "IDS_MSGF_BODY_PUSH_MESSAGES" +#define DELIVERY_MESSAGE "IDS_MSGF_BODY_DELIVERY_REPORT" +#define READ_REPORT_MESSAGE "IDS_MSGF_POP_READ_REPORT" +#define EXPIRED_MESSAGE "IDS_MSGF_BODY_MESSAGE_HAS_EXPIRED" +#define REJECTED_MESSAGE "IDS_MSGF_BODY_MMSDELIVERYMSGREJECTED" +#define DEFERRED_MESSAGE "IDS_MSGF_POP_MESSAGE_DEFERRED" +#define UNRECOGNISED_MESSAGE "IDS_MSGF_POP_MESSAGE_UNRECOGNISED" +#define INDETEMINATE_MESSAGE "IDS_MSGF_POP_INDETERMINATE" +#define UNREACHABLE_MESSAGE "IDS_MSGF_POP_UNREACHABLE" +#define DELIVERED_MESSAGE "IDS_MSGF_BODY_MESSAGE_DELIVERED" +#define VOICE_1_MESSAGE "IDS_MSGF_BODY_1_MESSAGE" +#define VOICE_N_MESSAGE "IDS_MSGF_BODY_PD_MESSAGES" +#define SIM_CARD_MESSAGE "IDS_MSGF_BODY_SIM_CARD_MESSAGES" +#define READ_REPORT_READ "IDS_COM_BODY_READ" +#define READ_REPORT_DELETE "IDS_COM_POP_DELETED" +#define FAILED_MSG_EXIST "IDS_MSG_BODY_FAILED_MESSAGES_EXIST" +#define ENABLE_EMERGENCY_MODE "IDS_MSG_BODY_ENABLE_EMERGENCY_MODE_JPN_DCM" +#define EMERGENCY_MODE_DESCRIPTION "IDS_MSG_SBODY_TAP_HERE_TO_ENABLE_EMERGENCY_MODE_TO_SAVE_BATTERY_POWER_JPN_DCM" +#define FAILED_TO_SEND_MESSAGE "IDS_MSG_TPOP_FAILED_TO_SEND_MESSAGE_ABB" +#else +// system string +#define NEW_MESSAGE "New message" +#define NEW_MESSAGES "New messages" +#define MSG_UNKNOWN_SENDER "New message from Unknown." +#define MSG_NO_SUBJECT "No subject" + + +// message app string for ticker noti +#define SENDING_MULTIMEDIA_MESSAGE_FAILED "Sending multimedia message failed" +#define MULTIMEDIA_MESSAGE_SENT "Multimedia message sent." +#define RETRIEVING_MESSAGE_FAILED "Retrieving message failed" +#define MESSAGE_RETRIEVED "Message retrieved" +#define SMS_MESSAGE_SENT "Message sent." +#define SMS_MESSAGE_SENDING_FAIL "Sending message failed." +#define SMS_MESSAGE_SENDING_PENDING "Unable to send message. It will be sent when service available." +#define SMS_MESSAGE_SIM_MESSAGE_FULL "SIM memory full. Delete some items." +#define SMS_MESSAGE_MEMORY_FULL "Not enough memory. Delete some items." +#define SMS_FDN_RESTRICTED "Unable to send the message while Fixed dialling mode is enabled." +#define SMS_SIM_CARD_FULL "SIM card full" +#define SMS_MESSAGE_SIZE_OVER_SIM_SLOT_SIZE "Message is too large to store as a single message to SIM card." // + +// message app string for quickpanel noti +#define MSG_MESSAGE "Message" +#define VOICE_MAIL "Voicemail" +#define NEW_VOICE_MAIL "New voicemail" +#define APP_NEW_MESSAGE "New message" +#define APP_NEW_MESSAGES "New messages" +#define CB_MESSAGE "CB messages" +#define PUSH_MESSAGE "Push messages" +#define DELIVERY_MESSAGE "Delivery report" +#define READ_REPORT_MESSAGE "Read report" +#define EXPIRED_MESSAGE "Message expired." +#define REJECTED_MESSAGE "Message rejected." +#define DEFERRED_MESSAGE "Message deferred" +#define UNRECOGNISED_MESSAGE "Message unrecognised" +#define INDETEMINATE_MESSAGE "Indeterminate." +#define UNREACHABLE_MESSAGE "Unreachable" +#define DELIVERED_MESSAGE "Message delivered" +#define VOICE_1_MESSAGE "1 message" +#define VOICE_N_MESSAGE "%d messages" +#define SIM_CARD_MESSAGE "SIM card messages" +#define READ_REPORT_READ "Read" +#define READ_REPORT_DELETE "Deleted." +#define FAILED_MSG_EXIST "Failed messages exist." +#define ENABLE_EMERGENCY_MODE "Enable Emergency mode" +#define EMERGENCY_MODE_DESCRIPTION "Tap here to enable Emergency mode to save battery power." +#define FAILED_TO_SEND_MESSAGE "Failed to send message." // +#endif + +#define NOTIFICATION_PRIV_ID DEFAULT_SETTING_PATH"/notification_priv_id" +#define VOICE_NOTI_ID_1 DEFAULT_SETTING_PATH"/voice_noti_id1" +#define VOICE_NOTI_ID_2 DEFAULT_SETTING_PATH"/voice_noti_id2" +#define CB_NOTI_PRIV_ID DEFAULT_SETTING_PATH"/cb_noti_priv_id" +#define SIM_MSG_NOTI_PRIV_ID DEFAULT_SETTING_PATH"/sim_msg_noti_priv_id" +#define EMERGENCY_MODE_NOTI_ID DEFAULT_SETTING_PATH"/emergency_noti_id" +#define MSG_SENTFAIL_NOTI_ID DEFAULT_SETTING_PATH"/sentfail_noti_id" +#define SIM_FULL_NOTI_PRIV_ID DEFAULT_SETTING_PATH"/sim_full_noti_id" + +#define MSG_NOTI_TEXT_LEN (512) +#define MSG_NOTI_TEXT_LEN_S (256) + +enum _msg_notification_type_e +{ + MSG_NOTI_TYPE_ALL = 0x00, + + // Refresh single/multiple notification + MSG_NOTI_TYPE_NORMAL, + MSG_NOTI_TYPE_CB, + MSG_NOTI_TYPE_SIM, + MSG_NOTI_TYPE_FAILED, + + // Add only single notification + MSG_NOTI_TYPE_VOICE_1, + MSG_NOTI_TYPE_VOICE_2, + MSG_NOTI_TYPE_MWI, + MSG_NOTI_TYPE_CLASS0, + MSG_NOTI_TYPE_SMS_DELIVERY_REPORT, + MSG_NOTI_TYPE_MMS_READ_REPORT, + MSG_NOTI_TYPE_MMS_DELIVERY_REPORT, + + MSG_NOTI_TYPE_SIM_FULL, +}; + +typedef unsigned char msg_notification_type_t; //_msg_notification_type_e + +msg_error_t MsgInsertNotification(MSG_MESSAGE_INFO_S *msg_info); + +msg_error_t MsgAddNotification(msg_notification_type_t noti_type, MSG_MESSAGE_INFO_S *msg_info); +msg_error_t MsgRefreshNotification(msg_notification_type_t noti_type, bool bFeedback, bool bTicker); +msg_error_t MsgAddReportNotification(msg_notification_type_t noti_type, MSG_MESSAGE_INFO_S *msg_info); +msg_error_t MsgDeleteReportNotification(const char *addr); + +msg_error_t MsgInsertTicker(const char* pTickerMsg, const char* pLocaleTickerMsg, bool bPlayFeedback, int msgId); +msg_error_t MsgInsertInstantMessage(msg_notification_type_t noti_type); +msg_error_t MsgInitNoti(); +msg_error_t MsgInsertBadge(unsigned int unreadMsgCnt); +msg_error_t MsgDeleteNoti(msg_notification_type_t noti_type); + +void MsgRefreshAllNotification(bool bWithSimNoti, bool bFeedback, bool bTickerNoti); +void MsgDeleteNotification(msg_notification_type_t noti_type); +void MsgInitReportNotiList(); + +#endif diff --git a/include/externals/MsgSensorWrapper.h b/include/externals/MsgSensorWrapper.h new file mode 100755 index 0000000..ab1e279 --- /dev/null +++ b/include/externals/MsgSensorWrapper.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +#ifndef MSG_SENSOR_H +#define MSG_SENSOR_H + + +#include "MsgTypes.h" + +/*================================================================================================== + DEFINES +==================================================================================================*/ + +typedef void (*msg_sensor_cb)(); + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ + +msg_error_t MsgSensorConnect(); +void MsgSensorDisconnect(); +msg_error_t MsgRegSensorCB(msg_sensor_cb cb); + +#endif // MSG_SENSOR_H diff --git a/include/externals/MsgSoundPlayer.h b/include/externals/MsgSoundPlayer.h new file mode 100755 index 0000000..0aec565 --- /dev/null +++ b/include/externals/MsgSoundPlayer.h @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +#ifndef MSG_SOUND_PLAYER_H +#define MSG_SOUND_PLAYER_H + + +/*================================================================================================== + TYPES +==================================================================================================*/ +typedef unsigned char MSG_SOUND_TYPE_T; + +/*================================================================================================== + ENUMS +==================================================================================================*/ +enum _MSG_SOUND_TYPE_E +{ + MSG_SOUND_PLAY_DEFAULT = 0, + MSG_SOUND_PLAY_USER, + MSG_SOUND_PLAY_EMERGENCY, + MSG_SOUND_PLAY_VOICEMAIL, +}; + +/*================================================================================================== + CLASS DEFINITIONS +==================================================================================================*/ +class MsgSoundPlayer +{ +public: + static MsgSoundPlayer* instance(); + + void MsgSoundPlayStart(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_SOUND_TYPE_T soundType); + void MsgSoundPlayStop(); + + void MsgSoundInitRepeatAlarm(); + void MsgSoundPlayDtmf(); + + void MsgGetRingtonePath(char *userRingtonePath, char **msg_tone_file_path_p); + void MsgGetPlayStatus(bool bVoiceMail, bool *bPlaySound, bool *bPlayVibration, bool *bOnCall); + +private: + MsgSoundPlayer(); + ~MsgSoundPlayer(); + + void MsgSoundPlayMelody(char *pMsgToneFilePath); + void MsgSoundPlayVibration(char *vibrationPath, bool isOnCall); + + void MsgSoundSetRepeatAlarm(); + void MsgSoundCreateRepeatAlarm(int RepeatTime); + int MsgSoundGetUnreadMsgCnt(); + + static MsgSoundPlayer* pInstance; + + bool bPlaying; + bool bVibrating; + bool bFeedbackInit; + + int g_alarmId; + + char *defaultRingtonePath; +}; + +#endif // MSG_SOUND_PLAYER_H + diff --git a/include/utils/MsgSpamFilter.h b/include/externals/MsgSpamFilter.h similarity index 56% rename from include/utils/MsgSpamFilter.h rename to include/externals/MsgSpamFilter.h index cbe765d..ea67d8e 100755 --- a/include/utils/MsgSpamFilter.h +++ b/include/externals/MsgSpamFilter.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_SPAM_FILTER_H @@ -33,5 +33,6 @@ msg_error_t MsgSetFilterOperation(bool bSetFlag); msg_error_t MsgGetFilterOperation(bool *pSetFlag); bool MsgCheckFilter(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo); +bool MsgCheckFilterByWord(MsgDbHandler *pDbHandle, const char *pMsgText); #endif // MSG_SPAM_FILTER_H diff --git a/include/framework/MsgCmdHandler.h b/include/framework/MsgCmdHandler.h index 3525ecc..d9974ea 100755 --- a/include/framework/MsgCmdHandler.h +++ b/include/framework/MsgCmdHandler.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_CMD_HANDLER_H @@ -82,6 +82,7 @@ int MsgRegIncomingLBSMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent); int MsgRegSyncMLMsgOperationCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent); int MsgRegStorageChangeCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent); int MsgStorageChangeHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgRegIncomingReportMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent); int MsgSentStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent); int MsgIncomingMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent); @@ -104,7 +105,10 @@ int MsgAddPushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent); int MsgDeletePushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent); int MsgUpdatePushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent); -int MsgContactSyncEventHandler(const MSG_CMD_S *pCmd, char **ppEvent); - - +int MsgAddSimMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgResendMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgUpdateIMSIHandler(const MSG_CMD_S *pCmd, char **ppEvent); +#ifdef MSG_PENDING_PUSH_MESSAGE +int MsgSendPendingPushMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent); +#endif #endif // MSG_CMD_HANDLER_H diff --git a/include/framework/MsgDeliverHandler.h b/include/framework/MsgDeliverHandler.h index 51e4e17..c8f3cb8 100755 --- a/include/framework/MsgDeliverHandler.h +++ b/include/framework/MsgDeliverHandler.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_DELIVER_HANDLER_H diff --git a/include/framework/MsgPluginConfig.h b/include/framework/MsgPluginConfig.h index fac0a1b..3c66b88 100755 --- a/include/framework/MsgPluginConfig.h +++ b/include/framework/MsgPluginConfig.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_PLUGIN_CONFIG_H diff --git a/include/framework/MsgPluginManager.h b/include/framework/MsgPluginManager.h index 58ea662..14a1fc0 100755 --- a/include/framework/MsgPluginManager.h +++ b/include/framework/MsgPluginManager.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_PLUGIN_MANAGER_H @@ -48,24 +48,22 @@ public: msg_error_t submitReq(MSG_REQUEST_INFO_S *pReqInfo); msg_error_t registerListener(MSG_PLUGIN_LISTENER_S *pListener); - msg_error_t checkSimStatus(MSG_SIM_STATUS_T *pStatus); - msg_error_t checkDeviceStatus(); - msg_error_t initSimMessage(); msg_error_t saveSimMessage(MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_LIST_S *pSimIdList); - msg_error_t deleteSimMessage(msg_sim_id_t SimMsgId); - msg_error_t setReadStatus(msg_sim_id_t SimMsgId); - msg_error_t setMemoryStatus(msg_error_t Error); + msg_error_t deleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId); + msg_error_t setReadStatus(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId); + msg_error_t setMemoryStatus(msg_sim_slot_id_t sim_idx, msg_error_t Error); - msg_error_t initConfigData(MSG_SIM_STATUS_T SimStatus); msg_error_t setConfigData(const MSG_SETTING_S *pSetting); msg_error_t getConfigData(MSG_SETTING_S *pSetting); + msg_error_t getDefaultNetworkSimId(int *simId); + // MMS handlers msg_error_t addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData); msg_error_t updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData); msg_error_t processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST_INFO_S *pRequest, bool *bReject); - msg_error_t getMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg); + msg_error_t getMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char **pDestMsg); msg_error_t updateRejectStatus(MSG_MESSAGE_INFO_S *pMsgInfo); msg_error_t composeReadReport(MSG_MESSAGE_INFO_S *pMsgInfo); @@ -99,6 +97,7 @@ public: void initialize(); void finalize(); + MsgPlugin* checkPlugin(MSG_MAIN_TYPE_T mainType); MsgPlugin* getPlugin(MSG_MAIN_TYPE_T mainType); void loadPlugins(const char* path); diff --git a/include/framework/MsgSettingHandler.h b/include/framework/MsgSettingHandler.h index f971636..54ba7ba 100755 --- a/include/framework/MsgSettingHandler.h +++ b/include/framework/MsgSettingHandler.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_SETTING_HANDLER_H @@ -27,8 +27,6 @@ /*================================================================================================== FUNCTION PROTOTYPES ==================================================================================================*/ -msg_error_t MsgInitSimConfig(MSG_SIM_STATUS_T SimStatus); - msg_error_t MsgSetConfigData(const MSG_SETTING_S *pSetting); msg_error_t MsgGetConfigData(MSG_SETTING_S *pSetting); @@ -52,10 +50,12 @@ void MsgGetMMSRecvOpt(MSG_SETTING_S *pSetting); void MsgGetMMSStyleOpt(MSG_SETTING_S *pSetting); void MsgGetPushMsgOpt(MSG_SETTING_S *pSetting); void MsgGetCBMsgOpt(MSG_SETTING_S *pSetting); + void MsgGetVoiceMailOpt(MSG_SETTING_S *pSetting); void MsgGetMsgSizeOpt(MSG_SETTING_S *pSetting); msg_error_t MsgSetConfigInSim(const MSG_SETTING_S *pSetting); +msg_error_t MsgGetConfigInSim(MSG_SETTING_S *pSetting); //void MsgSetDefaultConfig(); diff --git a/include/framework/MsgStorageHandler.h b/include/framework/MsgStorageHandler.h index f4513e1..175ca42 100755 --- a/include/framework/MsgStorageHandler.h +++ b/include/framework/MsgStorageHandler.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_STORAGE_HANDLER_H @@ -51,13 +51,15 @@ msg_error_t MsgAddDefaultAddress(); msg_error_t MsgStoResetDatabase(); msg_error_t MsgStoBackupMessage(msg_message_backup_type_t type, const char *filepath); -msg_error_t MsgStoRestoreMessage(const char *filepath); +msg_error_t MsgStoRestoreMessage(const char *filepath, msg_id_list_s**result_id_list); msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S* pSendOptInfo); +msg_error_t MsgStoRestoreMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo); msg_error_t MsgStoUpdateMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S* pSendOptInfo); msg_error_t MsgStoUpdateReadStatus(msg_message_id_t MsgId, bool bRead); -msg_error_t MsgStoUpdateThreadReadStatus(msg_thread_id_t ThreadId); +msg_error_t MsgStoUpdateThreadReadStatus(msg_thread_id_t ThreadId, msg_id_list_s *pMsgIdList); msg_error_t MsgStoUpdateProtectedStatus(msg_message_id_t MsgId, bool bProtected); +msg_error_t MsgStoUpdateConversationTagType(msg_thread_id_t threadId, int tagType); msg_error_t MsgStoDeleteMessage(msg_message_id_t MsgId, bool bCheckIndication); msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t FolderId, bool bOnlyDB, msg_id_list_s *pMsgIdList); msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList); @@ -66,26 +68,18 @@ msg_error_t MsgStoMoveMessageToStorage(const msg_message_id_t MsgId, const msg_s msg_error_t MsgStoCountMessage(msg_folder_id_t FolderId, MSG_COUNT_INFO_S *pCountInfo); msg_error_t MsgStoCountMsgByType(const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCount); msg_error_t MsgStoGetMessage(msg_message_id_t MsgId, MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S* pSendOptInfo); -msg_error_t MsgStoGetConversationViewItem(msg_message_id_t msgId, MSG_CONVERSATION_VIEW_S *pConv); -msg_error_t MsgStoGetFolderViewList(msg_folder_id_t FolderId, const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pMsgFolderViewList); msg_error_t MsgStoAddSyncMLMessage(MSG_MESSAGE_INFO_S *pMsgInfo, int ExtId, int PinCode); msg_error_t MsgStoGetMsgType(msg_message_id_t msgId, MSG_MESSAGE_TYPE_S* pMsgType); msg_error_t MsgStoGetText(msg_message_id_t MsgId, char *pSubject, char *pMsgText); msg_error_t MsgStoGetQuickPanelData(msg_quickpanel_type_t Type, MSG_MESSAGE_INFO_S *pMsg); -msg_error_t MsgStoGetThreadViewList(const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pThreadViewList); -msg_error_t MsgStoGetConversationViewList(msg_thread_id_t ThreadId, msg_struct_list_s *pConvViewList); msg_error_t MsgStoDeleteThreadMessageList(msg_thread_id_t ThreadId, bool bIncludeProtect, msg_id_list_s *pMsgIdList); msg_error_t MsgStoCountMsgByContact(const MSG_THREAD_LIST_INDEX_S *pAddrInfo, MSG_THREAD_COUNT_INFO_S *pThreadCountInfo); -msg_error_t MsgStoSearchMessage(const char *pSearchString, msg_struct_list_s *pThreadViewList); -msg_error_t MsgStoSearchMessage(const MSG_SEARCH_CONDITION_S *pSearchCon, int offset, int limit, msg_struct_list_s *pMsgList); -msg_error_t MsgStoGetRejectMsgList(const char *pNumber, msg_struct_list_s *pRejectMsgList); -msg_error_t MsgStoGetReportStatus(msg_message_id_t msgId, int *count, MSG_REPORT_STATUS_INFO_S **pReportStatus); +msg_error_t MsgStoGetSmsReportStatus(msg_message_id_t msgId, int *count, MSG_REPORT_STATUS_INFO_S **pReportStatus); +msg_error_t MsgStoGetMmsReportStatus(msg_message_id_t msgId, int *count, MSG_REPORT_STATUS_INFO_S **pReportStatus); msg_error_t MsgStoGetThreadIdByAddress(const MSG_MESSAGE_INFO_S *pMsg, msg_thread_id_t *pThreadId); msg_error_t MsgStoGetThreadUnreadCnt(msg_thread_id_t ThreadId, int *cnt); -msg_error_t MsgStoGetAddressList(const msg_thread_id_t threadId, msg_struct_list_s *pAddrList); msg_error_t MsgStoGetThreadInfo(msg_thread_id_t threadId, MSG_THREAD_VIEW_S *pThreadInfo); -msg_error_t MsgStoGetMessageList(msg_folder_id_t folderId, msg_thread_id_t threadId, msg_message_type_t msgType, msg_storage_id_t storageId, msg_struct_list_s *pMsgList); // Folder msg_error_t MsgStoAddFolder(const MSG_FOLDER_INFO_S *pFolderInfo); @@ -101,12 +95,10 @@ msg_error_t MsgStoGetFilterList(msg_struct_list_s *pFilterList); msg_error_t MsgStoSetFilterActivation(msg_filter_id_t filterId, bool bActive); // Sim Operation related Functions -msg_error_t MsgInitSimMessage(MSG_SIM_STATUS_T SimStatus); msg_error_t MsgStoClearSimMessageInDB(); // Internal Function -msg_error_t MsgMakeSortRule(const MSG_SORT_RULE_S *pSortRule, char *pSqlSort); -msg_error_t MsgStoGetSmsSendOpt(msg_message_id_t MsgId, MSG_SENDINGOPT_INFO_S* pSendOpt); +msg_error_t MsgStoGetSmsSendOpt(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S* pSendOpt); msg_error_t MsgStoGetMmsSendOpt(msg_message_id_t MsgId, MSG_SENDINGOPT_INFO_S* pSendOpt); // SyncML Msg @@ -116,7 +108,7 @@ bool MsgStoCheckSyncMLMsgInThread(msg_thread_id_t threadId); msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg); msg_error_t MsgStoGetContentLocation(MSG_MESSAGE_INFO_S* pMsgInfo); msg_error_t MsgStoSetReadReportSendStatus(msg_message_id_t msgId, int readReportSendStatus); - +msg_error_t MsgStoGetReadReportSendStatus(msg_message_id_t msgId, int *pReadReportSendStatus); /////////////////////////////////////////////////////////////////////////////////// // For MMS - will be removed @@ -129,12 +121,27 @@ msg_error_t MsgStoGetAddrInfo(msg_message_id_t MsgId, MSG_ADDRESS_INFO_S *pAddrI /////////////////////////////////////////////////////////////////////////////////// msg_error_t MsgStoResetNetworkStatus(); +#if 0 +msg_error_t MsgStoResetCBMessage(); +#endif msg_error_t MsgStoCleanAbnormalMmsData(); msg_error_t MsgStoCheckReadReportStatus(msg_message_id_t msgId); +msg_error_t MsgStoAutoDeleteConversation(msg_thread_id_t threadId, msg_id_list_s *msgIdList); msg_error_t MsgStoAddPushEvent(MSG_PUSH_EVENT_INFO_S* pPushEvent); msg_error_t MsgStoDeletePushEvent(MSG_PUSH_EVENT_INFO_S* pPushEvent); msg_error_t MsgStoUpdatePushEvent(MSG_PUSH_EVENT_INFO_S* pSrc, MSG_PUSH_EVENT_INFO_S* pDst); +msg_message_id_t MsgStoAddSimMessage(MSG_MESSAGE_INFO_S *pMsg, int *simIdList, int listSize); +msg_error_t MsgStoGetFailedMessage(int **failed_msg_list, int *count); + +msg_error_t MsgStoGetReplaceMsgId(MSG_MESSAGE_INFO_S *pMsgInfo); +msg_error_t MsgStoAddWAPMsg(MSG_MESSAGE_INFO_S *pMsgInfo); +msg_error_t MsgStoAddCOWAPMsg(MSG_MESSAGE_INFO_S *pMsgInfo); +msg_error_t MsgStoAddCBMsg(MSG_MESSAGE_INFO_S *pMsgInfo); +msg_error_t MsgStoCheckPushMsgValidation(MSG_PUSH_MESSAGE_S *pPushMsg, bool *pbProceed); +msg_error_t MsgStoUpdateAllAddress(); +msg_error_t MsgStoUpdateIMSI(int sim_idx); + #endif // MSG_STORAGE_HANDLER_H diff --git a/include/framework/MsgSubmitHandler.h b/include/framework/MsgSubmitHandler.h index 29e708d..d3d9591 100755 --- a/include/framework/MsgSubmitHandler.h +++ b/include/framework/MsgSubmitHandler.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_SUBMIT_HANDLER_H diff --git a/include/framework/MsgTransManager.h b/include/framework/MsgTransManager.h index 129a411..6b52862 100755 --- a/include/framework/MsgTransManager.h +++ b/include/framework/MsgTransManager.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_TRANSACTION_MANAGER_H @@ -25,6 +25,7 @@ #include #include "MsgMutex.h" +#include "MsgQueue.h" #include "MsgIpcSocket.h" #include "MsgCmdTypes.h" #include "MsgInternalTypes.h" @@ -32,11 +33,15 @@ + /*================================================================================================== DEFINITION ==================================================================================================*/ typedef std::map handler_map; typedef std::map sentmsg_map; +#ifdef MSG_PENDING_PUSH_MESSAGE +typedef std::list pushpending_list; +#endif typedef std::map fd_map; typedef std::list newmsg_list; typedef std::list mmsconf_list; @@ -62,6 +67,7 @@ public: static MsgTransactionManager* instance(); void run(); + void workerEventQueue(); void write(int fd, const char* buf, int len); // methods for sent status event @@ -79,6 +85,10 @@ public: void setJavaMMSList(MSG_CMD_REG_INCOMING_JAVAMMS_TRID_S *pTrId); void setSyncMLMsgOperationCB(MSG_CMD_REG_SYNCML_MSG_OPERATION_CB_S *pCbinfo); void setStorageChangeCB(int listenerFd); + void setReportMsgCB(int listenerFd); +#ifdef MSG_PENDING_PUSH_MESSAGE + void sendPendingPushMsg(void); +#endif javamms_list& getJavaMMSList(); @@ -90,7 +100,7 @@ public: void broadcastLBSMsgCB(const msg_error_t err, const MSG_LBS_MESSAGE_DATA_S *lbsData); void broadcastSyncMLMsgOperationCB(const msg_error_t err, const int msgId, const int extId); void broadcastStorageChangeCB(const msg_error_t err, const msg_storage_change_type_t storageChangeType, const msg_id_list_s *pMsgIdList); - + void broadcastReportMsgCB(const msg_error_t err, const msg_report_type_t reportMsgType, const MSG_MESSAGE_INFO_S *pMsgInfo); void setTMStatus(); void getTMStatus(); @@ -100,6 +110,7 @@ private: void handleRequest(int fd); void cleanup(int fd); +// bool checkPrivilege(MSG_CMD_TYPE_T CmdType, const char *pCookie); bool checkPrivilege(int fd, MSG_CMD_TYPE_T CmdType); static MsgTransactionManager* pInstance; @@ -108,7 +119,9 @@ private: bool running; handler_map handlerMap; - +#ifdef MSG_PENDING_PUSH_MESSAGE + pushpending_list pushMsgList; +#endif sentmsg_map sentMsgMap; // req_id, listener_fd, msghandle_addr fd_map statusCBFdMap; // src_fd, true if registered @@ -122,9 +135,11 @@ private: syncmlop_list operationSyncMLMsgCBList; // src_fd, msgType, port if registered fd_map storageChangeFdMap; // src_fd, true if registered + fd_map reportMsgCBFdMap; // src_fd, true if registered Mutex mx; CndVar cv; + MsgSimpleQ eventQueue; }; #endif //MSG_TRANSACTION_MANAGER_H diff --git a/include/mapi/msg.h b/include/mapi/msg.h index b2866c6..beef18f 100755 --- a/include/mapi/msg.h +++ b/include/mapi/msg.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_H_ @@ -24,218 +24,1154 @@ #include "msg_types.h" +/*================================================================================================== + DEFINES +==================================================================================================*/ + +/** + * @brief Defines macro for privilege name http://tizen.org/privilege/message.read + */ +#define MSG_SERVICE_READ_PRIV_NAME "http://tizen.org/privilege/message.read" + +/** + * @brief Defines macro for privilege name http://tizen.org/privilege/message.write + */ +#define MSG_SERVICE_WRITE_PRIV_NAME "http://tizen.org/privilege/message.write" + #ifdef __cplusplus extern "C" { #endif -/** - * @ingroup MESSAGING_FRAMEWORK - * @defgroup MESSAGING_CONTROL_API Messaging Control API - * @{ - */ - /*================================================================================================== FUNCTION PROTOTYPES ==================================================================================================*/ /** - - * \par Description: - * Opens a channel between an application and messaging framework. - * - * \par Purpose: - * For application to utilize the services of Messaging Framework, this API should be called to establish connection between the application and Messaging Framework. + * @internal + * @ingroup MSG_SERVICE_FRAMEWORK + * @defgroup MSG_SERVICE_FRAMEWORK_CONTROL_MODULE Control API + * @brief The Control API provides functions to manage message handle and set or get each structure. * - * \par Typical use case: - * Any application which utilizes the services of Messaging Framework needs to call this API. + * @internal + * @addtogroup MSG_SERVICE_FRAMEWORK_CONTROL_MODULE + * @{ * - * \par Method of function operation: - * Check for Message Server ready status. If ready connect to the Messaging Server socket and pass the handle application. + * @section MSG_SERVICE_FRAMEWORK_CONTROL_MODULE_HEADER Required Header + * \#include * - * \par Sync (or) Async: - * This is a Synchronous API. + * @section MSG_SERVICE_FRAMEWORK_CONTROL_MODULE_OVERVIEW Overview * - * \par Important notes: - * - The handle parameter returned must be used by application for further API calls to Messaging Service \n - * - memory for the handle need not be allocated by the application \n - * - An error will be returned in case Messaging Service is not running. + * The CONTROL API provides the following functionalities: + * - Handles message handle + * - Get/Set message and setting values * - * \param msg_handle_t input - handle to be passed for all Messaging Services . + * @section MSG_SERVICE_FRAMEWORK_CONTROL_MODULE_FEATURE Related Features + * This API is related with the following features:\n + * - http://tizen.org/feature/network.telephony\n * - * \return Return Type (int) \n - * - MSG_SUCCESS - Successfully connected to Messaging Service \n - * - MSG_ERR_NULL_POINTER - Input parameter is NULL. - * - MSG_ERR_MEMORY_ERROR - Memory error. - * - MSG_ERR_COMMUNICATION_ERROR - Communication error between client and server \n + * It is recommended to design feature related codes in your application for reliability.\n * - * \par Prospective clients: - * External/Native Apps using Messaging Services. + * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n * - * \par Related functions: - * None + * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * \par Known issues/bugs: - * None + * More details on featuring your application can be found from
Feature Element. * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * msg_error_t err = MSG_SUCCESS; + */ + +/** + * @brief Opens a channel between an application and messaging framework. + * @details For application to utilize the services of Messaging Framework, this API should be called to establish + * connection between the application and Messaging Framework. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * err = msg_open_msg_handle(&msgHandle); + * @remarks The handle parameter returned must be used by application for further API calls to Messaging Service. + * @remarks The memory for the handle need not be allocated by the application. + * @remarks An error will be returned in case Messaging Service is not running. * - * if (err != MSG_SUCCESS) - * { - * sprintf(str, "msg_open_msg_handle() Fail [%d]", err); - * print(str); + * @param[in] handle The Message handle to be passed for all messaging services * - * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. - * } + * @return @c 0 on success, + * otherwise a negative error value * - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_MEMORY_ERROR Memory error + * @retval MSG_ERR_COMMUNICATION_ERROR Communication error between client and server + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_open_msg_handle(msg_handle_t *handle); /** - - * \par Description: - * Closes the channel between application and messaging framework. + * @brief Closes the channel between application and messaging framework. + * @details Once application utilizes services of Messaging Service, this API needs to be invoked + * to close the channel between application and Messaging Service. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read + * + * @remarks The handle parameter returned must be used by application for further API calls to Messaging Service. + * @remarks The memory for the handle need not be allocated by the application \n + * @remarks An error will be returned in case Messaging Service is not running. + * + * @param[in] handle The Message handle to be passed for all messaging services * - * \par Purpose: - * Once application utilizes services of Messaging Service, this API needs to be invoked the close the channel between application and Messaging Service. + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_COMMUNICATION_ERROR Communication error between client and server + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + +int msg_close_msg_handle(msg_handle_t *handle); + + +/** + * @brief Create structure pointer to get/set message framework data. + * @details Get/set message framework data with this structure pointer. * - * \par Typical use case: - * Any application which has completed using services of Messaging Framework needs to call this API. + * @since_tizen 2.3 * - * \par Method of function operation: - * Closes the connection to Messaging Service and deleted the reference to the handle object + * @remarks It should use defined enumerations. + * @remarks You must release handle after operations. * - * \par Sync (or) Async: - * This is a Synchronous API. + * @param[in] field The enumerations to create the structure pointer * - * \par Important notes: - * - The handle parameter returned must be used by application for further API calls to Messaging Service \n - * - memory for the handle need not be allocated by the application \n - * - An error will be returned in case Messaging Service is not running. + * @return The created structure pointer on success, + * otherwise null value * - * \param msg_handle_t input - handle to be passed for all Messaging Services . + * @retval #msg_struct_t Successfully created structure pointer + * @retval NULL Invalid parameter * - * \return Return Type (int) \n - * - MSG_SUCCESS - Successfully connected to Messaging Service \n - * - MSG_ERR_NULL_POINTER - Input parameter is NULL. - * - MSG_ERR_COMMUNICATION_ERROR - Communication error between client and server \n + */ + +msg_struct_t msg_create_struct(int field); + + +/** + * @brief Release memory for message data structure. + * @details You must release memory of message data structure that is allocated by msg_create_struct(). * - * \par Prospective clients: - * External/Native Apps using Messaging Services. + * @since_tizen 2.3 * - * \par Related functions: - * None + * @remarks It should not be used after this API. * - * \par Known issues/bugs: - * None + * @param[in] msg_struct_handle The structure pointer to release * - * \par Sample code: - * \code - * ... + * @return @c 0 on success, + * otherwise a negative error value * - * msg_handle_t msgHandle = NULL; - * msg_error_t err = MSG_SUCCESS; + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_NULL_POINTER Input parameter is NULL * - * ... + */ + +int msg_release_struct(msg_struct_t *msg_struct_handle); + + +/** + * @brief Release memory for list structure. + * @details You must release memory of list structure that is allocated by getting list API. * - * err = msg_open_msg_handle(&msgHandle); + * @since_tizen 2.3 * - * ... + * @remarks It should not be used after this API * - * err = msg_close_msg_handle(&msgHandle); + * @param[in] msg_struct_list The list structure pointer to release * - * if (err != MSG_SUCCESS) - * { - * sprintf(str, "msg_close_msg_handle() Fail [%d]", err); - * print(str); + * @return @c 0 on success, + * otherwise a negative error value * - * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. - * } + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_NULL_POINTER Input parameter is NULL * - * ... - * \endcode */ -/*================================================================================================*/ -int msg_close_msg_handle(msg_handle_t *handle); +int msg_release_list_struct(msg_struct_list_s *msg_struct_list); -msg_struct_t msg_create_struct(int field); -int msg_release_struct(msg_struct_t *msg_struct_handle); -int msg_release_list_struct(msg_struct_list_s *msg_struct_list); +/** + * @brief Get a specific integer value from message structure data. + * + * @since_tizen 2.3 + * + * @remarks Use valid enumerations. + * + * @param[in] msg_struct_handle A pointer of message structure type + * @param[in] field The enumeration to get a value of specific field + * @param[out] value The requested integer value + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_NULL_POINTER Input parameter (msg_struct_handle/value) is NULL + * @retval MSG_ERR_INVALID_PARAMETER Input parameter (field) is not valid + * + */ int msg_get_int_value(msg_struct_t msg_struct_handle, int field, int *value); + + +/** + * @brief Gets a specific string value from message structure data. + * + * @since_tizen 2.3 + * + * @remarks Use valid enumerations. + * + * @param[in] msg_struct_handle A pointer of message structure type + * @param[in] field The enumeration to get a value of specific field + * @param[out] value The requested string value + * @param[in] size The allocated buffer size of application side + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_NULL_POINTER Input parameter (msg_struct_handle/value) is NULL + * @retval MSG_ERR_INVALID_PARAMETER Input parameter (field) is not valid + * + */ + int msg_get_str_value(msg_struct_t msg_struct_handle, int field, char *value, int size); + + +/** + * @brief Gets a specific boolean value from message structure data. + * + * @since_tizen 2.3 + * + * @remarks Use valid enumerations. + * + * @param[in] msg_struct_handle A pointer of message structure type + * @param[in] field The enumeration to get a value of specific field + * @param[out] value The requested boolean value + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_NULL_POINTER Input parameter (msg_struct_handle/value) is NULL + * @retval MSG_ERR_INVALID_PARAMETER Input parameter (field) is not valid + * + */ + int msg_get_bool_value(msg_struct_t msg_struct_handle, int field, bool *value); + + +/** + * @brief Gets an inner structure handle from message structure data. + * + * @since_tizen 2.3 + * + * @remarks Use valid enumerations. + * + * @param[in] msg_struct_handle A pointer of message structure type + * @param[in] field The enumeration to get a value of specific field + * @param[out] value The requested structure handle + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_NULL_POINTER Input parameter (msg_struct_handle/value) is NULL + * @retval MSG_ERR_INVALID_PARAMETER Input parameter (field) is not valid + * + */ + int msg_get_struct_handle(msg_struct_t msg_struct_handle, int field, msg_struct_t *value); + + +/** + * @brief Gets a list handle from message structure data. + * + * @since_tizen 2.3 + * + * @remarks Use valid enumerations. + * + * @param[in] msg_struct_handle A pointer of message structure type + * @param[in] field The enumeration to get a value of specific field + * @param[out] value The requested list handle + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_NULL_POINTER Input parameter (msg_struct_handle/value) is NULL + * @retval MSG_ERR_INVALID_PARAMETER Input parameter (field) is not valid + * + */ +/*================================================================================================*/ int msg_get_list_handle(msg_struct_t msg_struct_handle, int field, void **value); + +/** + * @brief Sets a specific integer value to message structure data. + * + * @since_tizen 2.3 + * + * @remarks Use valid enumerations. + * + * @param[in] msg_struct_handle A pointer of message structure type + * @param[in] field The enumeration to get a value of specific field + * @param[out] value The requested integer value + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_NULL_POINTER Input parameter (msg_struct_handle/value) is NULL + * @retval MSG_ERR_INVALID_PARAMETER Input parameter (field) is not valid + * + */ + int msg_set_int_value(msg_struct_t msg_struct_handle, int field, int value); + + +/** + * @brief Sets a specific string to message structure data. + * + * @since_tizen 2.3 + * + * @remarks Use valid enumerations. + * + * @param[in] msg_struct_handle A pointer of message structure type + * @param[in] field The enumeration to get a value of specific field + * @param[out] value The requested string + * @param[in] size The requested size of string to set + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_NULL_POINTER Input parameter (msg_struct_handle/value) is NULL + * @retval MSG_ERR_INVALID_PARAMETER Input parameter (field) is not valid + * + */ + int msg_set_str_value(msg_struct_t msg_struct_handle, int field, char *value, int size); + + +/** + * @brief Sets a specific boolean value to message structure data. + * + * @since_tizen 2.3 + * + * @details Set a specific boolean value to message structure data. + * + * @remarks Use valid enumerations. + * + * @param[in] msg_struct_handle A pointer of message structure type + * @param[in] field The enumeration to get a value of specific field + * @param[out] value The requested boolean value + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_NULL_POINTER Input parameter (msg_struct_handle/value) is NULL + * @retval MSG_ERR_INVALID_PARAMETER Input parameter (field) is not valid + * + */ + int msg_set_bool_value(msg_struct_t msg_struct_handle, int field, bool value); + + +/** + * @brief Sets a inner structure handle to message structure data. + * + * @since_tizen 2.3 + * + * @remarks Use valid enumerations. + * + * @param[in] msg_struct_handle A pointer of message structure type + * @param[in] field The enumeration to get a value of specific field + * @param[out] value The requested structure handle to set + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_NULL_POINTER Input parameter (msg_struct_handle/value) is NULL + * @retval MSG_ERR_INVALID_PARAMETER Input parameter (field) is not valid + * + */ + int msg_set_struct_handle(msg_struct_t msg_struct_handle, int field, msg_struct_t value); + + +/** + * @brief Set a list handle to message structure data. + * + * @since_tizen 2.3 + * + * @remarks Use valid enumerations. + * + * @param[in] msg_struct_handle A pointer of message structure type + * @param[in] field The enumeration to get a value of specific field + * @param[out] value The requested list handle to set + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_NULL_POINTER Input parameter (msg_struct_handle/value) is NULL + * @retval MSG_ERR_INVALID_PARAMETER Input parameter (field) is not valid + * + */ + int msg_set_list_handle(msg_struct_t msg_struct_handle, int field, void *value); -int msg_mms_add_item(msg_struct_t msg_struct_handle, int field, msg_struct_t *item); + +/** + * @brief Gets a MMS structure handle from message structure. + * + * @since_tizen 2.3 + * + * @remarks Use valid structure handle. + * + * @param[in] msg_struct_handle A pointer of message structure type + * @param[out] mms_struct_handle The MMS structure handle to get + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is not valid + * + */ int msg_get_mms_struct(msg_struct_t msg_struct_handle, msg_struct_t mms_struct_handle); + + +/** + * @brief Sets a MMS structure handle to message structure. + * + * @since_tizen 2.3 + * + * @remarks Use valid structure handle. + * + * @param[in] msg_struct_handle A pointer of message structure type + * @param[out] mms_struct_handle The MMS structure handle to set + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is not valid + * + */ + int msg_set_mms_struct(msg_struct_t msg_struct_handle, msg_struct_t mms_struct_handle); -//list + +/** + * @brief Adds an item to list handle of message structure type. + * + * @since_tizen 2.3 + * + * @remarks Use valid list_handle. + * + * @param[in] msg_struct_handle A pointer of message structure type + * @param[in] field The field to set item + * @param[in] item The #msg_struct_t structure to be added to list handle + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is not valid + * + */ + +int msg_list_add_item(msg_struct_t msg_struct_handle, int field, msg_struct_t *item); + + +/** + * @brief Gets n-th data from list handle. + * + * @since_tizen 2.3 + * + * @remarks Use valid list_handle. + * + * @param[in] list_handle A pointer of message structure type + * @param[in] index The index of list structure + * + * @return #msg_struct_t value on success, + * otherwise @c NULL value + * + * @retval #msg_struct_t Successfully done + * @retval NULL Input parameter (list_handle) is not valid + * + */ + msg_struct_t msg_list_nth_data(msg_list_handle_t list_handle, int index); + + +/** + * @brief Gets the length(count) of list handle. + * + * @since_tizen 2.3 + * + * @remarks Use valid list_handle. + * + * @param[in] list_handle A pointer of message structure type + * + * @return The length of message list (int) + * + */ + int msg_list_length(msg_list_handle_t list_handle); -// filter + +/** + * @brief Releases entire data of list handle in message structure. + * + * @since_tizen 2.3 + * + * @remarks Use valid msg_struct_handle and enumeration. + * + * @param[in] msg_struct_handle A pointer of message structure type + * @param[in] field The enumeration to release (list handle) + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_NULL_POINTER Input parameter is NULL + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * + */ + +int msg_list_clear(msg_struct_t msg_struct_handle, int field); + + +/** + * @brief Adds a filter to block messages by address or word. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write + * + * @remarks #msg_struct_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[in] filter A pointer to message filter structure + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_FILTER_ERROR Filter operation error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_add_filter(msg_handle_t handle, const msg_struct_t filter); + + +/** + * @brief Updates filter to block messages by address or word. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * @remarks #msg_struct_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[in] filter A pointer to message filter structure + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_FILTER_ERROR Filter operation error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_update_filter(msg_handle_t handle, const msg_struct_t filter); + + +/** + * @brief Deletes tthe filter to block messages by address or word. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write + * + * @param[in] handle The message handle + * @param[in] filter_id The filter index to delete from filter DB + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_FILTER_ERROR Filter operation error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_delete_filter(msg_handle_t handle, msg_filter_id_t filter_id); + + +/** + * @brief Gets all filter list. + * @details This API is used to get a filter list that is already added filter set. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[out] filter_list A pointer to list of message filter structure + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_FILTER_ERROR Filter operation error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_get_filter_list(msg_handle_t handle, msg_struct_list_s *filter_list); + + +/** + * @brief Sets the flag of message blocking. + * @details This API is used to set a flag of block operation. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[in] set_flag Set @c true to enable block operation, + * otherwise set @c false to disable block operation + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_FILTER_ERROR Filter operation error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_set_filter_operation(msg_handle_t handle, bool set_flag); + + +/** + * @brief Gets the flag value of message blocking. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[out] set_flag @c true if message blocking is enabled, + * otherwise @c false if message blocking is not enabled + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_FILTER_ERROR Filter operation error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_get_filter_operation(msg_handle_t handle, bool *set_flag); + + +/** + * @brief Sets the flag of message blocking for specific filter. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[in] filter_id The specific index to set flag + * @param[in] active Set @c true to enable the block operation, + * otherwise @c false to not enable the block operation + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_FILTER_ERROR Filter operation error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_set_filter_active(msg_handle_t handle, msg_filter_id_t filter_id, bool active); -//setting + +/** + * @brief Gets SMSC list and informations. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[in] msg_struct A structure pointer of SMSC data + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_get_smsc_opt(msg_handle_t handle, msg_struct_t msg_struct); + + +/** + * @brief Sets SMSC list and informations. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[in] msg_struct A structure pointer of SMSC data + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_set_smsc_opt(msg_handle_t handle, msg_struct_t msg_struct); + + +/** + * @brief Gets CB channel list and informations. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[in] msg_struct A structure pointer of CB data + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_get_cb_opt(msg_handle_t handle, msg_struct_t msg_struct); + + +/** + * @brief Sets CB channel list and informations. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[in] msg_struct A structure pointer of CB data + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_set_cb_opt(msg_handle_t handle, msg_struct_t msg_struct); + +/** + * @brief Gets SMS sending options. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[in] msg_struct A structure pointer of sending option data + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_get_sms_send_opt(msg_handle_t handle, msg_struct_t msg_struct); + + +/** + * @brief Sets SMS sending options. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[in] msg_struct A structure pointer of sending option data + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_set_sms_send_opt(msg_handle_t handle, msg_struct_t msg_struct); + +/** + * @brief Gets MMS sending options. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[in] msg_struct A structure pointer of sending option data + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_get_mms_send_opt(msg_handle_t handle, msg_struct_t msg_struct); + + +/** + * @brief Sets MMS sending options. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[in] msg_struct A structure pointer of sending option data + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_set_mms_send_opt(msg_handle_t handle, msg_struct_t msg_struct); + +/** + * @brief Gets MMS receiving options. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[in] msg_struct A structure pointer of receiving option data + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_get_mms_recv_opt(msg_handle_t handle, msg_struct_t msg_struct); + + +/** + * @brief Sets MMS receiving options. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[in] msg_struct A structure pointer of receiving option data + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_set_mms_recv_opt(msg_handle_t handle, msg_struct_t msg_struct); + +/** + * @brief Gets push message options. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[in] msg_struct A structure pointer of push message option data + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_get_push_msg_opt(msg_handle_t handle, msg_struct_t msg_struct); + + +/** + * @brief Sets push message options. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[in] msg_struct A structure pointer of push message option data + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_set_push_msg_opt(msg_handle_t handle, msg_struct_t msg_struct); + +/** + * @brief Gets voice message options. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[in] msg_struct A structure pointer of voice message option data + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_get_voice_msg_opt(msg_handle_t handle, msg_struct_t msg_struct); + + +/** + * @brief Sets voice message options. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[in] msg_struct A structure pointer of voice message option data + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_set_voice_msg_opt(msg_handle_t handle, msg_struct_t msg_struct); + +/** + * @brief Gets message general options. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[in] msg_struct A structure pointer of message general option data + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_get_general_opt(msg_handle_t handle, msg_struct_t msg_struct); + + +/** + * @brief Sets message general options. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[in] msg_struct A structure pointer of message general option data + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_set_general_opt(msg_handle_t handle, msg_struct_t msg_struct); + +/** + * @brief Gets message size. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[in] msg_struct A structure pointer of message size data + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_get_msgsize_opt(msg_handle_t handle, msg_struct_t msg_struct); + + +/** + * @brief Sets message size. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] handle The message handle + * @param[in] msg_struct A structure pointer of message size data + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + int msg_set_msgsize_opt(msg_handle_t handle, msg_struct_t msg_struct); -// text length calculate + +/** + * @brief Calculates input text length by encode type. + * + * @since_tizen 2.3 + * + * @remarks #msg_handle_t MUST be valid, otherwise the function will fail. + * + * @param[in] msg_text The string to calculate length + * @param[in] msg_encode_type_to The current encode type + * @param[out] text_size The calculated text size + * @param[out] segment_size The message segment size + * @param[out] msg_encode_type_in The encode type it should be changed to + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Successfully done + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is not valid. + * + */ + int msg_util_calculate_text_length(const char* msg_text, msg_encode_type_t msg_encode_type_to, unsigned int *text_size, unsigned int *segment_size, msg_encode_type_t *msg_encode_type_in); + +/** + * @} +*/ + + #ifdef __cplusplus } #endif diff --git a/include/mapi/msg_private.h b/include/mapi/msg_private.h index f905af3..56ef540 100755 --- a/include/mapi/msg_private.h +++ b/include/mapi/msg_private.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_PRIVATE_H_ @@ -53,6 +53,9 @@ void msg_message_copy_message(MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_HIDDEN_S * int msg_cb_message_get_int_value(void *data, int field, int *value); int msg_cb_message_get_str_value(void *data, int field, char *value, int size); +int msg_message_list_append(msg_struct_t msg_struct_handle, int field, msg_struct_t *item); +int msg_message_list_clear(msg_struct_t msg_struct_handle, int field); + @@ -82,9 +85,12 @@ int msg_mms_set_bool_value(msg_struct_s *msg_struct, int field, bool value); int msg_mms_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s *value); int msg_mms_set_list_handle(msg_struct_s *msg_struct, int field, msg_list_handle_t value); +int msg_mms_list_append(msg_struct_t msg_struct_handle, int field, msg_struct_t *item); + void convert_to_mmsdata(const msg_struct_s *pSrc, MMS_MESSAGE_DATA_S *pDest); void convert_from_mmsdata(const MMS_MESSAGE_DATA_S *pSrc, msg_struct_s *pDest); - +void convert_to_hidden_mmsdata(MMS_DATA_S *pSrc, msg_struct_s *pDest); +void convert_from_hidden_mmsdata(msg_struct_s *pSrc, MMS_DATA_S *pDest); // setting int msg_setting_get_int_value(msg_struct_s *msg_struct, int field, int *value); int msg_setting_get_str_value(msg_struct_s *msg_struct, int field, char *src, int size); @@ -137,6 +143,8 @@ int msg_set_push_msg_opt_int(void *push_msg_opt, int field, int value); bool msg_get_push_msg_opt_bool(void *push_msg_opt, int field); int msg_set_push_msg_opt_bool(void *push_msg_opt, int field, bool value); +int msg_get_voice_msg_opt_int(void *voice_msg_opt, int field); +int msg_set_voice_msg_opt_int(void *voice_msg_opt, int field, int value); char *msg_get_voice_msg_opt_str(void *voice_msg_opt, int field); int msg_set_voice_msg_opt_str(void *voice_msg_opt, int field, char *val, int size); @@ -144,7 +152,8 @@ int msg_get_general_opt_int(void *general_opt, int field); int msg_set_general_opt_int(void *general_opt, int field, int value); bool msg_get_general_opt_bool(void *general_opt, int field); int msg_set_general_opt_bool(void *general_opt, int field, bool value); - +char *msg_get_general_opt_str(void *general_opt, int field); +int msg_set_general_opt_str(void *general_opt, int field, char *val, int size); int msg_get_msgsize_opt_int(void *size_opt, int field); int msg_set_msgsize_opt_int(void *size_opt, int field, int value); @@ -165,19 +174,23 @@ int msg_folder_info_get_int(void *folder_info, int field); int msg_thread_info_get_int(void *data, int field); int msg_conv_info_get_int(void *data, int field); int msg_search_condition_get_int(void *condition_info, int field); +int msg_list_condition_get_int(void *condition_info, int field); int msg_report_status_get_int(void *report_info, int field); char* msg_report_status_get_str(void *report_info, int field); char* msg_folder_info_get_str(void *folder_info, int field); char *msg_thread_info_get_str(void *data, int field); char *msg_conv_info_get_str(void *data, int field); char* msg_search_condition_get_str(void *condition_info, int field, int size); +char* msg_list_condition_get_str(void *condition_info, int field, int size); bool msg_sendopt_get_bool(void *send_opt, int field); bool msg_sortrule_get_bool(void *sort_rule, int field); bool msg_conv_get_bool(void *data, int field); bool msg_thread_info_get_bool(void *data, int field); +bool msg_list_condition_get_bool(void *data, int field); int msg_sendopt_get_struct_handle(msg_struct_s *msg_struct, int field, void **value); int msg_syncml_get_struct_handle(msg_struct_s *msg_struct, int field, void **value); int msg_thread_index_get_struct_handle(msg_struct_s *msg_struct, int field, void **value); +int msg_list_condition_get_struct_handle(msg_struct_s *msg_struct, int field, void **value); int msg_address_info_get_int(void *addr_info, int field); int msg_mms_sendopt_get_int(void *opt_info, int field); int msg_reject_message_get_int(void *msg_info, int field); @@ -192,15 +205,21 @@ int msg_thread_count_set_int(void *count_info, int field, int value); int msg_thread_index_set_int(void *index_info, int field, int value); int msg_sortrule_set_int(void *sort_info, int field, int value); int msg_folder_info_set_int(void *folder_info, int field, int value); +int msg_translation_set_bool(void *thread_info, int field, bool value); +int msg_translation_set_int(void *thread_info, int field, int value); int msg_search_condition_set_int(void *condition_info, int field, int value); +int msg_list_condition_set_int(void *condition_info, int field, int value); int msg_report_status_set_int(void *report_info, int field, int value); int msg_folder_info_set_str(void *folder_info, int field, char *value, int size); int msg_search_condition_set_str(void *condition_info, int field, char *value, int size); +int msg_list_condition_set_str(void *condition_info, int field, char *value, int size); int msg_sendopt_set_bool(void *send_opt, int field, bool value); int msg_sortrule_set_bool(void *sort_rule, int field, bool value); +int msg_list_condition_set_bool(void *data, int field, bool value); int msg_sendopt_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s *value); int msg_syncml_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s *value); int msg_thread_index_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s *value); +int msg_list_condition_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s *value); int msg_address_info_set_int(void *addrinfo, int field, int value); int msg_mms_sendopt_set_int(void *opt_info, int field, int value); int msg_reject_message_set_int(void *msg_info, int field, int value); @@ -216,5 +235,8 @@ int msg_request_set_int(void *request_info, int field, int value); int msg_request_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s *value); int msg_sent_status_get_int(MSG_SENT_STATUS_S *sent_status_info, int field); - +int msg_conversation_get_list_hnd(void *data, int field, void **value); +int msg_multipart_get_str_value(void *data, int field, char *value, int size); +int msg_multipart_get_int_value(void *data, int field, int *value); +int msg_multipart_set_str_value(void *data, int field, char *value, int size); #endif /* MSG_PRIVATE_H_ */ diff --git a/include/mapi/msg_storage.h b/include/mapi/msg_storage.h index b28ac17..45441bf 100755 --- a/include/mapi/msg_storage.h +++ b/include/mapi/msg_storage.h @@ -1,35 +1,22 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ -/** - * @file MapiStorage.h - * @brief Defines storage API of messaging framework - * @version 1.0 - */ - #ifndef MAPI_STORAGE_H #define MAPI_STORAGE_H -/** - * @section Introduction - * - Introduction : Overview on Messaging Storage API - * @section Program - * - Program : Messaging Storage API Reference - */ - /*================================================================================================== INCLUDE FILES ==================================================================================================*/ @@ -41,2073 +28,1035 @@ extern "C" { #endif -/** - * @ingroup MESSAGING_FRAMEWORK - * @defgroup MESSAGING_STORAGE_API Messaging Storage API - * @{ - */ - -/*================================================================================================== - FUNCTION PROTOTYPES -==================================================================================================*/ /** - - * \par Description: - * Saves a message to the database. - * - * \par Purpose: - * This API is used to save Message object to the database. + * @internal + * @ingroup MSG_SERVICE_FRAMEWORK + * @defgroup MSG_SERVICE_FRAMEWORK_STORAGE_MODULE Storage API + * @brief The Storage API provides functions to get message information with multiple types. * - * \par Typical use case: - * Save Message feature is used when the message is to be stored to persistent memory for later reference. + * @internal + * @addtogroup MSG_SERVICE_FRAMEWORK_STORAGE_MODULE + * @{ * - * \par Method of function operation: - * Sets up the database connection and inserts the message to message table. + * @section MSG_SERVICE_FRAMEWORK_STORAGE_MODULE_HEADER Required Header + * \#include * - * \par Sync (or) Async: - * This is a Synchronous API. + * @section MSG_SERVICE_FRAMEWORK_STORAGE_MODULE_OVERVIEW Overview * - * \par Important notes: - * - Mandatory fields of a message structure MUST be valid, otherwise the function will be failed. + * The Storage API provides the following functionalities: * - * \param input - msg_handle_t handle is Message handle. - * \param input - msg_message_t msg is a pointer to an msg_message_t structure. - * \param input - send_opt is a pointer to an MSG_SENDINGOPT_S structure. + * - Get message information * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS - Successfully connected to Messaging Service \n - * - MSG_ERR_NULL_POINTER - Input parameter is NULL. - * - MSG_ERR_STORAGE_ERROR - Storage is error. + * @section MSG_SERVICE_FRAMEWORK_STORAGE_MODULE_FEATURE Related Features + * This API is related with the following features:\n + * - http://tizen.org/feature/network.telephony\n * - * \par Prospective clients: - * External/Native Apps using Messaging Services. + * It is recommended to design feature related codes in your application for reliability.\n * - * \par Related functions: - * None + * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n * - * \par Known issues/bugs: - * None + * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * \par Sample code: - * \code - * ... + * More details on featuring your application can be found from Feature Element. * - * msg_handle_t msgHandle = NULL; - * msg_message_t msg; - * MSG_SENDINGOPT_S sendingOpt = {0}; + */ + + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ + +/** + * @brief Saves a message to the database. * - * ... + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * err = msg_open_msg_handle(&msgHandle); + * @remarks Mandatory fields of a message structure MUST be valid, otherwise the function will fail. * - * ... + * @param[in] handle The Message handle + * @param[in] msg A pointer to a message structure + * @param[in] send_opt A pointer to a message structure for sending option * - * err = msg_add_message(handle, (msg_message_t) &msg, &sendingOpt); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } + * @return The message ID on success, + * otherwise a negative error value * - * ... - * \endcode + * @retval MESSAGE_ID Success in operation + * @retval MSG_ERR_INVALID_PARAMETER(-9) Invalid parameter + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_add_message(msg_handle_t handle, const msg_struct_t msg, const msg_struct_t send_opt); /** - - * \par Description: - * Adds a SyncML message to the database. - * - * \par Purpose: - * This API is used to save a SyncML message to the database. - * - * \par Typical use case: - * Save Message feature is used when the message is to be stored to persistent memory for later reference. - * - * \par Method of function operation: - * Sets up the database connection and inserts the syncml message to message table. + * @brief Adds a SyncML message to the database. * - * \par Sync (or) Async: - * This is a Synchronous API. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \par Important notes: - * - Mandatory fields of a message structure MUST be valid, otherwise the function will be failed. + * @remarks Mandatory fields of a message structure MUST be valid, otherwise the function will fail. * - * \param input - msg_handle_t handle is Message handle. - * \param input - MSG_SYNCML_MESSAGE_S syncml_msg is a pointer to an MSG_SYNCML_MESSAGE_S structure. + * @param[in] handle The Message handle + * @param[in] syncml_msg A pointer to a syncml message structure * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS - Success in operation. - * - MSG_ERR_NULL_POINTER - pMsg is NULL. - * - MSG_ERR_INVALID_MSGHANDLE - Message handle is invalid. - * - MSG_ERR_MSGHANDLE_NOT_CONNECTED - Message handle is not connected. - * - MSG_ERR_STORAGE_FULL - Storage is FULL. - * - MSG_ERR_COMMUNICATION_ERROR - Communication between client and server is error. - * - MSG_ERR_MEMORY_ERROR - Memory is error. - * - MSG_ERR_MAX_NUMBER_REACHED - Max number is reached. - * - MSG_ERR_PLUGIN - Generic error code for plugin. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * MSG_SYNCML_MESSAGE_S syncMLMsg; - * - * ... - * - * err = msg_open_msg_handle(&msgHandle); - * - * ... - * - * int err = msg_add_syncml_message(msgHandle, &syncMLMsg); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_add_syncml_message(msg_handle_t handle, const msg_struct_t syncml_msg); /** - - * \par Description: - * Updates a message in the database. - * - * \par Purpose: - * This API is used to update a message in the database. - * - * \par Typical use case: - * Update message feature is used when a previously saved message is to be updated. - * - * \par Method of function operation: - * Sets up the database connection and set the message's new values to message table. - * - * \par Sync (or) Async: - * This is a Synchronous API. + * @brief Updates a message in the database. * - * \par Important notes: - * - The function is to update message data for the message indentified by the given msgId as long as the given values are valid. - * - msg->msgId MUST NOT be updated because msg->msgId is a unique Id on platform. - * - If applications want to move a message between folders, applications SHOULD call msg_move_to_folder. - * - msg->storageId MUST NOT be updated. - * - The function will return MSG_ERR_INVALID_MESSAGE, if inputting a new msg->storageId. - * - If applications want to move the message between storages, applications SHOULD call msg_move_to_storage. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \param input - handle is Message handle. - * \param input - msg is a pointer to an msg_message_t structure. - * \param input - send_opt is a pointer to an MSG_SENDINGOPT_S structure. + * @remarks The function is to update message data for the message identified by the given msgId as long as the given values are valid. + * @remarks Message ID MUST NOT be updated because that is a unique ID on platform. + * @remarks If applications want to move a message between folders, applications SHOULD call msg_move_to_folder(). + * @remarks Storage ID MUST NOT be updated. + * @remarks If applications want to move the message between storages, applications SHOULD call msg_move_to_storage(). * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS - Success in operation. - * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR - Storage is error. + * @param[in] handle The Message handle + * @param[in] msg A pointer to a message structure + * @param[in] send_opt A pointer to a message sending option structure * - * \par Prospective clients: - * External/Native Apps using Messaging Services. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * MSG_SYNCML_MESSAGE_S syncMLMsg; - * MSG_SENDINGOPT_S sendingOpt = {0}; - * - * ... - * - * err = msg_open_msg_handle(&msgHandle); - * - * ... - * - * err = msg_update_message(hMsgHandle, pMsg, &sendOpt); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_update_message(msg_handle_t handle, const msg_struct_t msg, const msg_struct_t send_opt); /** - - * \par Description: - * Updates a message's read status in the database. - * - * \par Purpose: - * This API is used to Updates a message's read status in the database. - * - * \par Typical use case: - * Update message's read status for a previously saved message. - * - * \par Method of function operation: - * Sets up the database connection and updates the message's read status to message table. - * - * \par Sync (or) Async: - * This is a Synchronous API. + * @brief Updates a message's read status in the database. * - * \par Important notes: - * - None + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \param input - handle is Message handle. - * \param input - msg_id is Message ID. - * \parem input - read is boolean for indicating whether a message is read or not. + * @param[in] handle The message handle + * @param[in] msg_id The message ID + * @param[in] read Set @c true if the message is read, + * otherwise set @c false if the message is not read * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS - Success in operation. - * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR - Storage is error. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * MSG_SYNCML_MESSAGE_S syncMLMsg; - * MSG_SENDINGOPT_S sendingOpt = {0}; - * - * ... - * - * err = msg_open_msg_handle(&msgHandle); - * - * ... - * - * err = msg_update_message(hMsgHandle, pMsg, &sendOpt); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_update_read_status(msg_handle_t handle, msg_message_id_t msg_id, bool read); /** - - * \par Description: - * Updates a message's protected status in the database. - * - * \par Purpose: - * This API is used to Updates a message's protected status in the database. - * - * \par Typical use case: - * Update message's protected status for a previously saved message. - * - * \par Method of function operation: - * Sets up the database connection and updates the message's protected status to message table. - * - * \par Sync (or) Async: - * This is a Synchronous API. + * @brief Updates a message's protected status in the database. * - * \par Important notes: - * - None + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \param input - handle is Message handle. - * \param input - msg_id is Message ID. - * \parem input - is_protected is boolean for indicating whether a message is protected or not. + * @param[in] handle The message handle + * @param[in] msg_id The message ID + * @parem[in] is_protected Set @c true if a message is protected, + * otherwise set @c false if message is not protected * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS - Success in operation. - * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR - Storage is error. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * MSG_SYNCML_MESSAGE_S syncMLMsg; - * MSG_SENDINGOPT_S sendingOpt = {0}; - * - * ... - * - * err = msg_open_msg_handle(&msgHandle); - * - * ... - * - * err = msg_update_protected_status(hMsgHandle, 0, true); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_update_protected_status(msg_handle_t handle, msg_message_id_t msg_id, bool is_protected); /** - - * \par Description: - * Deletes a message by Message ID from the database. - * - * \par Purpose: - * This API is used to delete a message by Message ID from the database. - * - * \par Typical use case: - * Deletes a previously saved message from the database. - * - * \par Method of function operation: - * Sets up the database connection and deletes a message by Message ID from the message table. + * @brief Deletes a message by Message ID from the database. * - * \par Sync (or) Async: - * This is a Synchronous API. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \par Important notes: - * - None + * @param[in] handle The message handle + * @param[in] msg_id The message ID of the message to be deleted * - * \param input - handle is Message handle. - * \param input - msg_id is the ID of the Message to be deleted. + * @return @c 0 on success, + * otherwise a negative error value * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS - Success in operation. - * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR - Storage is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * MSG_SYNCML_MESSAGE_S syncMLMsg; - * MSG_SENDINGOPT_S sendingOpt = {0}; - * - * ... - * - * err = msg_open_msg_handle(&msgHandle); - * - * ... - * - * err = msg_delete_message(msgHandle, 0); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_delete_message(msg_handle_t handle, msg_message_id_t msg_id); /** - - * \par Description: - * Deletes all messages in the specified folder from the database. - * - * \par Purpose: - * This API is used to delete all messages in the specified folder from the database. - * - * \par Typical use case: - * Deletes all messages in the specified folder from the database. - * - * \par Method of function operation: - * Sets up the database connection and Deletes all messages in the specified folder from the message table. + * @brief Deletes all messages in the specified folder from the database. * - * \par Sync (or) Async: - * This is a Synchronous API. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \par Important notes: - * - None + * @param[in] handle Message handle + * @param[in] msg_id Message ID of the message to be deleted + * @param[in] bOnlyDB Set @c true to not delete messages in SIM, + * otherwise set @c false to delete messages in SIM * - * \param input - handle is Message handle. - * \param input - folder_id is the ID of the folder to be deleted. + * @return @c 0 on success, + * otherwise a negative error value * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS - Success in operation. - * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR - Storage is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * MSG_SYNCML_MESSAGE_S syncMLMsg; - * MSG_SENDINGOPT_S sendingOpt = {0}; - * - * ... - * - * err = msg_open_msg_handle(&msgHandle); - * - * ... - * - * err = msg_delete_all_msgs_in_folder(msgHandle, MSG_DRAFT_ID); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_delete_all_msgs_in_folder(msg_handle_t handle, msg_folder_id_t folder_id, bool bOnlyDB); /** - - * \par Description: - * Moves a message to the specified folder in the database. - * - * \par Purpose: - * This API is used to move a message to the specified folder the database. - * - * \par Typical use case: - * Deletes all messages in the specified folder from the database. + * @brief Moves a message to the specified folder in the database. * - * \par Method of function operation: - * Sets up the database connection and Deletes all messages in the specified folder from the message table. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \par Sync (or) Async: - * This is a Synchronous API. + * @param[in] handle The message handle + * @param[in] msg_id The message ID of the message to be moved + * @param[in] dest_folder_id The ID of the destination folder * - * \par Important notes: - * - None + * @return @c 0 on success, + * otherwise a negative error value * - * \param input - handle is Message handle. - * \param input - msg_id is the ID of the message to be moved. - * \param input - dest_folder_id is the ID of the destination folder. - * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS - Success in operation. - * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR - Storage is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * MSG_SYNCML_MESSAGE_S syncMLMsg; - * MSG_SENDINGOPT_S sendingOpt = {0}; - * - * ... - * - * err = msg_open_msg_handle(&msgHandle); - * - * ... - * - * err = msg_move_msg_to_folder(hMsgHandle, 0, MSG_OUTBOX_ID); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_move_msg_to_folder(msg_handle_t handle, msg_message_id_t msg_id, msg_folder_id_t dest_folder_id); /** - - * \par Description: - * Moves a message to the other storage. - * - * \par Purpose: - * This API is usd to move a message to the other storage. - * - * \par Typical use case: - * Moves a message to the other storage type. + * @brief Moves a message to the other storage. * - * \par Method of function operation: - * Sets up the database connection and moves a messages to specified storage type. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \par Sync (or) Async: - * This is a Synchronous API. + * @param[in] handle The message handle + * @param[in] msg_id The message ID of the message to be moved + * @param[in] storage_id The ID of the destination storage * - * \par Important notes: - * - None + * @return @c 0 on success, + * otherwise a negative error value * - * \param input - handle is Message handle. - * \param input - msg_id is the ID of the message to be moved. - * \param input - storage_id is the ID of the destination storage. - * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS - Success in operation. - * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR - Storage is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * MSG_SYNCML_MESSAGE_S syncMLMsg; - * MSG_SENDINGOPT_S sendingOpt = {0}; - * - * ... - * - * err = msg_open_msg_handle(&msgHandle); - * - * ... - * - * err = msg_move_msg_to_storage( msgHandle, 0, MSG_STORAGE_PHONE); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_move_msg_to_storage(msg_handle_t handle, msg_message_id_t msg_id, msg_storage_id_t storage_id); /** - - * \par Description: - * Gets the number of messages in the specified folder from the database. - * - * \par Purpose: - * This API is used to get the number of messages in the specified folder from the database. + * @brief Gets the number of messages in the specified folder from the database. * - * \par Typical use case: - * Gets the number of messages in the specified folder from the database. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Method of function operation: - * Sets up the database connection and Gets the number of messages in the specified folder from the message table. + * @param[in] handle The message handle + * @param[in] msg_id The message ID of the message to be counted + * @param[out] count_info A pointer to an #MSG_COUNT_INFO_S structure * - * \par Sync (or) Async: - * This is a Synchronous API. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Important notes: - * - None - * - * \param input - handle is Message handle. - * \param input - folder_id is the ID of the folder to be counted. - * \param output - count_info is a pointer to an MSG_COUNT_INFO_S structure. - * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS - Success in operation. - * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR - Storage is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * MSG_COUNT_INFO_S countInfo; - * - * ... - * - * err = msg_open_msg_handle(&msgHandle); - * - * ... - * - * err = msg_count_message(msgHandle, MSG_OUTBOX_ID, &countInfo) -* if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_count_message(msg_handle_t handle, msg_folder_id_t folder_id, msg_struct_t count_info); /** - - * \par Description: - * Gets the number of messages of specific message type. - * - * \par Purpose: - * This API is used to get the number of messages of specific type. + * @brief Gets the number of messages of specific message type. * - * \par Typical use case: - * Gets the count of message of specific types such as SMS, MMS. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Method of function operation: - * Sets up the database connection and queries the number of messages in the specified folder from the message table based on required message type. + * @param[in] handle The message handle + * @param[in] msg_type The message type to be counted + * @param[out] msg_count A pointer to the number of message * - * \par Sync (or) Async: - * This is a Synchronous API. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Important notes: - * - None - * - * \param input - handle is Message handle. - * \param input - msg_type is the message type to be counted. - * \param output - msg_count is a pointer to the number of message. - * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS - Success in operation. - * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR - Storage is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * MSG_COUNT_INFO_S countInfo; - * - * ... - * - * err = msg_open_msg_handle(&msgHandle); - * - * ... - * - * err = msg_count_msg_by_type(msgHandle, MSG_TYPE_SMS, &countInfo); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_count_msg_by_type(msg_handle_t handle, msg_message_type_t msg_type, int *msg_count); /** - - * \par Description: - * Gets the number of messages of specific address. + * @brief Gets the number of messages of specific address. * - * \par Purpose: - * This API is used to get the number of messages from a specific address. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Typical use case: - * Get the count of messages from the specified address + * @remarks If @a addr_info is @c NULL, nothing happens. * - * \par Method of function operation: - * Sets up the database connection and queries the number of messages based on address from the message table. + * @param[in] handle The message handle + * @param[in] addr_info A pointer to an address list information structure + * @param[in] msg_thread_count_list A pointer to an thread count information structure * - * \par Sync (or) Async: - * This is a Synchronous API. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Important notes: - * - If addr_info is NULL, nothing happens. - * - * \param input - handle is Message handle. - * \param input - addr_info is a pointer to an MSG_ADDRESS_INFO_LIST_S structure. - * \param input - msg_thread_count_list is a pointer to an MSG_THREAD_COUNT_INFO_S structure. - * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS - Success in operation. - * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR - Storage is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * MSG_COUNT_INFO_S countInfo; - * - * ... - * - * err = msg_open_msg_handle(&msgHandle); - * - * ... - * - * err = msg_count_msg_by_type(msgHandle, MSG_TYPE_SMS, &countInfo); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_count_msg_by_contact(msg_handle_t handle, const msg_struct_t addr_info, msg_struct_t msg_thread_count_list); /** - - * \par Description: - * Gets the detail information of a message from the database. - * - * \par Purpose: - * This API is used to get the number of messages from a specific address. + * @brief Gets the detail information of a message from the database. + * @details This API is used to get the detail information of message by message ID. * - * \par Typical use case: - * Get the count of messages from the specified address + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Method of function operation: - * Sets up the database connection and queries the number of messages based on address from the message table. + * @remarks Applications need to call msg_release_struct() to free the memory. + * @remarks However, if this function fails, the memory for the message is NOT allocated in this function. * - * \par Sync (or) Async: - * This is a Synchronous API. + * @param[in] handle The Message handle + * @param[in] msg_id The ID of the Message to be returned + * @param[out] msg A pointer to a #msg_struct_t message structure + * @param[in] send_opt A pointer to a #msg_struct_t sending option structure * - * \par Important notes: - * - If addr_info is NULL, nothing happens. - * - Applications need to call msg_release_message to free the memory. - * - However, if this function is failed, the memory for the message is NOT allocated in this function. + * @return @c 0 on success, + * otherwise a negative error value * -handle is Message handle. - * \param input - handle is Message handle. - * \param input - msg_id is the ID of the Message to be returned. - * \param output - msg is a pointer to an msg_message_t structure. - * \param input - send_opt is a pointer to an MSG_SENDINGOPT_S structure. - * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS - Success in operation. - * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR - Storage is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * - None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * - * ... - * msg_message_t msg = msg_new_message(); - * MSG_SENDINGOPT_S sendOpt = {0, }; - * ... - * err = msg_get_message(msgHandle, 0, msg, &sendOpt); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_get_message(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_t msg, msg_struct_t send_opt); -int msg_get_conversation(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_t conv); -int msg_get_vobject_data(msg_handle_t handle, msg_message_id_t msg_id, void** encoded_data); /** - - * \par Description: - * Returns the common information list of messages with selected folder id. - * - * \par Purpose: - * This API is used to get the common information list of messages with selected folder id from database. - * - * \par Typical use case: - * Get the common information from the specified folder from database. + * @brief Gets the detail information of a message on conversation list. + * @details This API is used to get the conversation informations of message by message ID. * - * \par Method of function operation: - * Sets up the database connection and queries the common information based on selected folder id from the message and folder tables. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Sync (or) Async: - * This is a Synchronous API. + * @param[in] handle The Message handle + * @param[in] msg_id The ID of the Message to be returned + * @param[out] conv A pointer to a #msg_struct_t of message structure * - * \par Important notes: - * - The memory for a message will be allocated in this function. - * - Applications need to call msg_release_folder_view_list to free the memory. - * - However, if this function is failed, the memory for the message is NOT allocated in this function. + * @return @c 0 on success, + * otherwise a negative error value * - * \param input - handle is Message handle. - * \param input - folder_id is the ID of the folder to be returned. - * \param input - sort_rule indicates a sort type and sort order for querying messages. - * \param output - msg_folder_view_list is a pointer to an MSG_FOLDER_VIEW_LIST_S structure. - * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS - Success in operation. - * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR - Storage is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * - None - * - * \par Known issues/bugs: - * None + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + +int msg_get_conversation(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_t conv); + + +/** + * @brief Gets the v-object data of message. + * @details This API is used to get the v-object data of message by message ID. * - * \par Sample code: - * \code - * ... + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * msg_handle_t msgHandle = NULL; + * @param[in] handle The Message handle + * @param[in] msg_id The ID of the Message to be returned + * @param[out] encoded_data A pointer to a encoded v-object data of message * - * ... - * MSG_FOLDER_VIEW_LIST_S folderViewList; - * ... - * err = msg_get_folder_view_list(hMsgHandle, 0, NULL, &folderViewList); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } + * @return @c 0 on success, + * otherwise a negative error value * - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ -int msg_get_folder_view_list(msg_handle_t handle, msg_folder_id_t folder_id, const msg_struct_t sort_rule, msg_struct_list_s *msg_folder_view_list); +int msg_get_vobject_data(msg_handle_t handle, msg_message_id_t msg_id, void** encoded_data); -/** - * \par Description: - * Returns the information of all peers to whom messages have been sent or recieved. - * - * \par Purpose: - * This API is used to get the information of all peers to whom messages have been sent or recieved. - * - * \par Typical use case: - * Get the common information from the specified folder from database. - * - * \par Method of function operation: - * Frees the memory occupied by MSG_FOLDER_VIEW_LIST_S object and its members. +/** + * @brief Gets the information of all peers to whom messages have been sent or received. * - * \par Sync (or) Async: - * This is a Synchronous API. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Important notes: - * - The memory for a list will be allocated in this function. - * - Applications need to call msg_release_thread_view_list to free the memory. - * - However, if this function is failed, the memory for a list is NOT allocated in this function. + * @remarks The memory for a list will be allocated in this function. + * @remarks Applications need to call msg_release_thread_view_list() to free the memory. + * @remarks However, if this function fails, the memory for a list is NOT allocated in this function. * - * \param input - handle is Message handle. - * \param input - sort_rule indicates a sort type and sort order for querying messages. - * \param output - msg_thread_view_list is a pointer to an msg_struct_list_s structure. + * @param[in] handle The Message handle + * @param[in] sourt_rule This indicates a sort type and sort order for querying messages + * @param[out] msg_thread_view_list A pointer to an #msg_struct_list_s structure * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS - Success in operation. - * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR - Storage is error. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Prospective clients: - * External/Native Apps using Messaging Services. + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + +int msg_get_thread_view_list(msg_handle_t handle, const msg_struct_t sort_rule, msg_struct_list_s *msg_thread_view_list); + + +/** + * @briefs Gets the common information list of messages with the selected thread ID. * - * \par Related functions: - * None + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Known issues/bugs: - * None + * @remarks The memory for a list will be allocated in this function. + * @remarks Applications need to call msg_release_conversation_view_list() to free the memory. + * @remarks However, if this function is failed, the memory for a list is NOT allocated in this function. * - * \par Sample code: - * \code - * ... + * @param[in] hMsgHandle The Message handle + * @param[in] thread_id The ID of the thread to be returned + * @param[out] msg_conv_view_list A pointer to a structure of conversational message list * - * msg_handle_t msgHandle = NULL; + * @return @c 0 on success, + * otherwise a negative error value * - * ... - * msg_struct_list_s threadViewList; - * ... - * err = msg_get_thread_view_list(hMsgHandle, NULL, &threadViewList); - * ... - * msg_release_thread_view_list(&threadViewList); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ -int msg_get_thread_view_list(msg_handle_t handle, const msg_struct_t sort_rule, msg_struct_list_s *msg_thread_view_list); - - -/** - * \par Description: - * Returns the common information list of messages with selected thread_id. - * - * \par Purpose: - * This API is used to get the common information list of messages with selected thread_id. - * - * \par Typical use case: - * Gets the common information list of messages with the selected thread id from the database. - * - * \par Method of function operation: - * Connects to the database and queries the common infomation of list messages with the provided thread id. - * - * \par Sync (or) Async: - * This is a Synchronous API. - * - * \par Important notes: - * - The memory for a list will be allocated in this function. - * - Applications need to call msg_release_conversation_view_list to free the memory. - * - However, if this function is failed, the memory for a list is NOT allocated in this function. - * - * \param input - hMsgHandle is Message handle. - * \param input - thread_id is the ID of the thread to be returned. - * \param output - msg_conv_view_list is a pointer to an MSG_CONV_VIEW_LIST_S structure. - * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS - Success in operation. - * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR - Storage is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * - None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * msg_error_t err = MSG_SUCCESS; - * ... - * MSG_CONV_VIEW_LIST_S convViewList; - * ... - * err = msg_get_conversation_view_list(hMsgHandle, ThreadId, &convViewList); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * msg_release_conversation_view_list(&convViewList); - * ... - * \endcode - */ -/*================================================================================================*/ int msg_get_conversation_view_list(msg_handle_t handle, msg_thread_id_t thread_id, msg_struct_list_s *msg_conv_view_list); /** - - * \par Description: - * Deletes all the Messages Sent/Received from the selected list. - * - * \par Purpose: - * This API is used to delete all the Messages Sent/Received from the selected list. + * @brief Deletes all the Messages Sent/Received from the selected list. * - * \par Typical use case: - * Deletes all messages sent/received from the selected list. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \par Method of function operation: - * Sets up the database connection and deletes all messages sent/received from a selected list. + * @param[in] handle The Message handle + * @param[in] thread_id The ID of the thread to be deleted + * @param[in] include_protected_msg Set @c true to delete protected messages, + * otherwise @c false to not delete protected messages * - * \par Sync (or) Async: - * This is a Synchronous API. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Important notes: - * - If addr_info is NULL, nothing happens. - * - * \param input - handle is Message handle. - * \param input - thread_id is the ID of the thread to be deleted. - * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS - Success in operation. - * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR - Storage is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * MSG_SYNCML_MESSAGE_S syncMLMsg; - * MSG_SENDINGOPT_S sendingOpt = {0}; - * - * ... - * - * err = msg_open_msg_handle(&msgHandle); - * - * ... - * - * err = msg_delete_thread_message_list(hMsgHandle, 0); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_delete_thread_message_list(msg_handle_t handle, msg_thread_id_t thread_id, bool include_protected_msg); /** - - * \par Description: - * Adds a new folder. - * - * \par Purpose: - * This API is used to add a new folder. - * - * \par Typical use case: - * Adds a new folder with the specified folder info + * @brief Adds a new folder. * - * \par Method of function operation: - * Sets up the database connection and add a new folder to the folder table. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \par Sync (or) Async: - * This is a Synchronous API. + * @param[in] handle The Message handle + * @param[in] folder_info A pointer to an #MSG_FOLDER_INFO_S structure * - * \par Important notes: - * - None. + * @return @c 0 on success, + * otherwise a negative error value * - * \param - handle is Message handle. - * \param - folder_info is a pointer to an MSG_FOLDER_INFO_S structure. - * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS - Success in operation. - * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR - Storage is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * Make Folder - * MSG_FOLDER_INFO_S folderInfo; - * ... - * err = msg_open_msg_handle(&msgHandle); - * - * folderInfo.folderId = 1; - * folderInfo.folderType = MSG_FOLDER_TYPE_USER_DEF; - * ... - * - * err = msg_add_folder(hMsgHandle, &folderInfo); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_add_folder(msg_handle_t handle, const msg_struct_t folder_info); /** - - * \par Description: - * Updates the folder info. - * - * \par Purpose: - * This API is used to add a new folder. - * - * \par Typical use case: - * Adds a new folder with the specified folder info - * - * \par Method of function operation: - * Sets up the database connection and add a new folder to the folder table. - * - * \par Sync (or) Async: - * This is a Synchronous API. - * - * \par Important notes: - * - None. + * @brief Updates the folder info. * - * \param - handle is Message handle. - * \param - folder_info is a pointer to an MSG_FOLDER_INFO_S structure. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS - Success in operation. - * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR - Storage is error. + * @param[in] handle The Message handle + * @param[in] folder_info A pointer to an #MSG_FOLDER_INFO_S structure * - * \par Prospective clients: - * External/Native Apps using Messaging Services. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * Make Folder - * MSG_FOLDER_INFO_S folderInfo; - * ... - * err = msg_open_msg_handle(&msgHandle); - * - * folderInfo.folderId = 2; - * folderInfo.folderType = MSG_FOLDER_TYPE_USER_DEF; - * ... - * err = msg_update_folder(msgHandle, &folderInfo); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_update_folder(msg_handle_t handle, const msg_struct_t folder_info); /** - - * \par Description: - * Deletes an exisiting folder. - * - * \par Purpose: - * This API is used to delete an existing folder. - * - * \par Typical use case: - * Deletes an existing folder. - * - * \par Method of function operation: - * Sets up the database connection and deletes an existing folder to the folder table. - * - * \par Sync (or) Async: - * This is a Synchronous API. - * - * \par Important notes: - * - None. - * - * \param input - handle is Message handle. - * \param input - folder_id is the ID of the folder to be deleted. - * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS - Success in operation. - * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR - Storage is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None + * @brief Deletes an existing folder. * - * \par Known issues/bugs: - * None + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \par Sample code: - * \code - * ... + * @param[in] handle The Message handle + * @param[in] folder_id The ID of the folder to be deleted * - * msg_handle_t msgHandle = NULL; - * err = msg_open_msg_handle(&msgHandle); + * @return @c 0 on success, + * otherwise a negative error value * - * ... - * err = msg_delete_folder(hMsgHandle, MSG_INBOX_ID); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_delete_folder(msg_handle_t handle, msg_folder_id_t folder_id); /** - - * \par Description: - * Returns the information list of folders. - * - * \par Purpose: - * This API is used to get the information list of folders. - * - * \par Typical use case: - * Gets the folder list information. - * - * \par Method of function operation: - * Sets up the database connection and queries for the folder list information. - * - * \par Sync (or) Async: - * This is a Synchronous API. - * - * \par Important notes: - * - None. + * @brief Gets the information list of folders. * - * \param input - handle is Message handle. - * \param output - folder_list is a pointer to an msg_struct_list_s structure. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS - Success in operation. - * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR - Storage is error. + * @param[in] handle The Message handle + * @param[out] folder_list A pointer to a #msg_struct_list_s structure * - * \par Prospective clients: - * External/Native Apps using Messaging Services. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * msg_struct_list_s folderList; - - * err = msg_open_msg_handle(&msgHandle); - * - * ... - * err = msg_get_folder_list(msgHandle, &folderList); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * ... - * msg_release_folder_list(&folderList); - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_get_folder_list(msg_handle_t handle, msg_struct_list_s *folder_list); /** - - * \par Description: - * Creates the specified number of messages in database. - * - * \par Purpose: - * This API is used to generate specified number of messages in the database - * - * \par Typical use case: - * Generate large number of messages in the database. - * - * \par Method of function operation: - * Creates the specified number of messages in database for specified message type in the specified folder - * - * \par Sync (or) Async: - * This is a Synchronous API. - * - * \par Important notes: - * - None - * - * \param input - handle is Message handle. - * \param input - msg_type is one of enum _MSG_MESSAGE_TYPE_E. - * \param input - folder_id is the folder for the test messages. - * \param input - num_msg is the number of messages. - * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_INVALID_MSGHANDLE Parameter is invalid. - * - MSG_ERR_INVALID_FOLDER_ID Storage is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * msg_struct_list_s folderList; - - * err = msg_open_msg_handle(&msgHandle); - * - * ... - * err = msg_generate_message(msgHandle, MSG_TYPE_SMS, MSG_INBOX_ID, 100); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * ... - * \endcode + * @brief Creates the specified number of messages in database. + * @details This API is used to generate specified number of messages in the database + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write + * + * @param[in] handle The Message handle + * @param[in] msg_type The message type \n + * One of enum _MSG_MESSAGE_TYPE_E. + * @param[in] folder_id The folder for the test messages + * @param[in] num_msg The number of messages + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_MSGHANDLE Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_generate_message(msg_handle_t handle, msg_message_type_t msg_type, msg_folder_id_t folder_id, unsigned int num_msg); -int msg_generate_sms(msg_handle_t handle, msg_folder_id_t folder_id, unsigned int num_msg) DEPRECATED; /** - - * \par Description: - * Returns the Message Data to be used by the Quick Panel. - * - * \par Purpose: - * This API is used to get the Message Datato be used by the Quick Panel. - * - * \par Typical use case: - * Quick panel needs the message information to show new message notification. - * - * \par Method of function operation: - * Connects to database and queries for information needed by the quick panel. - * - * \par Sync (or) Async: - * This is a Synchronous API. - * - * \par Important notes: - * - None - * - * \param input - handle is Message handle. - * \param input - type is the type of message that Quick Panel need. - * \param output - msg is a pointer to an msg_message_t structure. + * @brief Returns the Message Data to be used by the Quick Panel. * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_INVALID_MSGHANDLE Parameter is invalid. - * - MSG_ERR_INVALID_FOLDER_ID Storage is error. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Prospective clients: - * External/Native Apps using Messaging Services. + * @param[in] handle The Message handle + * @param[in] type The type of message that Quick Panel needs + * @param[out] msg A pointer to a #msg_struct_t structure * - * \par Related functions: - * None + * @return @c 0 on success, + * otherwise a negative error value * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * msg_message_t msgInfo; - - * err = msg_open_msg_handle(&msgHandle); - * - * ... - * err = msg_get_quick_panel_data(msgHandle, MSG_QUICKPANEL_SMS, msgInfo); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_DB_STEP There is no Quick Panel message + * @retval MSG_ERR_INVALID_PARAMETER(-9) Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_get_quick_panel_data(msg_handle_t handle, msg_quickpanel_type_t type, msg_struct_t msg); /** - - * \par Description: - * Resets the Messaging database. - * - * \par Purpose: - * This API is used to reset the messaging database. + * @brief Resets the Messaging database. * - * \par Typical use case: - * Completely delete the messaging database. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \par Method of function operation: - * Connects to database and deletes all the messaging tables. + * @param[in] handle The Message handle * - * \par Sync (or) Async: - * This is a Synchronous API. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Important notes: - * - None - * - * \param input - handle is Message handle. - * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_INVALID_PARAMETER Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR Storage is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * msg_error_t err = MSG_SUCCESS; - * err = msg_open_msg_handle(&msgHandle); - * - * ... - * err = msg_reset_database(msgHandle); - * if (err != MSG_SUCCESS) - *{ - * printf("err [%d]", err); - * return err; - * } - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_reset_database(msg_handle_t handle); /** - - * \par Description: - * Returns the total size used for message contents. - * - * \par Purpose: - * This API is used to get the total size used for message contents. - * - * \par Typical use case: - * To get the total space used by message contents. - * - * \par Method of function operation: - * Uses linux system calls to query the space used by message contents. - * - * \par Sync (or) Async: - * This is a Synchronous API. - * - * \par Important notes: - * - None + * @brief Gets the total size used for message contents. * - * \param input - handle is Message handle. - * \param output - memsize is a pointer to the size. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_INVALID_PARAMETER Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR Storage is error. + * @param[in] handle The Message handle + * @param[out] memsize A pointer to the size * - * \par Prospective clients: - * External/Native Apps using Messaging Services. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * int memsize = 0; - * err = msg_open_msg_handle(&msgHandle); - * - * ... - * err = msg_get_mem_size(msgHandle, &memsize); - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_get_mem_size(msg_handle_t handle, unsigned int* memsize); /** - - * \par Description: - * Backup messages to storage. - * - * \par Purpose: - * This API is used to backup messages to storage. - * - * \par Typical use case: - * Backup messages to storage. - * - * \par Method of function operation: - * Reads all the messages from Messaging database and writes to storage in V-Message format - * - * \par Sync (or) Async: - * This is a Synchronous API. - * - * \par Important notes: - * None - * - * \param input - msg_handle_t handle is Message handle. - * \param input - msg_message_backup_type_t type is backup_type. - * \param input - backup_filepath is path to backup message. - * - * \return Return Type int (msg_error_t) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_INVALID_PARAMETER Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR Storage is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. + * @brief Backs up messages to storage. * - * \par Related functions: - * None + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Known issues/bugs: - * None + * @param[in] handle The Message handle + * @param[in] type The backup type + * @param[in] backup_filepath The path to backup message * - * \par Sample code: - * \code - * ... + * @return @c 0 on success, + * otherwise a negative error value * - * msg_handle_t msgHandle = NULL; - * msg_error_t err; - * msg_message_backup_type_t type = MSG_BACKUP_TYPE_MMS; - * const char *filepath = "/backup_mms" - * - * ... - * err = msg_backup_message(&msgHandle, type, filepath); - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_backup_message(msg_handle_t handle, msg_message_backup_type_t type, const char *backup_filepath); /** - - * \par Description: - * Restore messages from backed up messages. - * - * \par Purpose: - * This API is used to restore messages from backed up messages. - * - * \par Typical use case: - * Restore messages from previously backed up messages. - * - * \par Method of function operation: - * Reads the previously backup up messages and restores the database. - * - * \par Sync (or) Async: - * This is a Synchronous API. - * - * \par Important notes: - * None + * @brief Restores messages from backed up messages. * - * \param input - msg_handle_t handle is Message handle. - * \param input - backup_filepath is path of backup file for restore. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * + * @param[in] handle The Message handle + * @param[in] backup_filepath The path to backup message * - * \return Return Type int (msg_error_t) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_INVALID_PARAMETER Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR Storage is error. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * msg_error_t err; - * const char *filepath = "/backup_mms" - * ... - * err = msg_restore_message(&msgHandle, filepath); - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_restore_message(msg_handle_t handle, const char *backup_filepath); /** - - * \par Description: - * Search messages or addresses which including a string that applcation want to find. - * - * \par Purpose: - * This API is used to search messages or addresses from storage. + * @brief Searches messages or addresses for the specified string. + * @details This API is used to search messages or addresses from storage. * - * \par Typical use case: - * Search messages or addresses from storage. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Method of function operation: - * search messages or addresses from storage. + * @param[in] handle The Message handle + * @param[in] search_string The string to search + * @param[out] msg_thread_view_list A pointer to an #msg_struct_list_s structure * - * \par Sync (or) Async: - * This is a Synchronous API. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Important notes: - * None - * - * \param input - msg_handle_t handle is Message handle. - * \param input - search_string is the string to search. - * \param output - msg_thread_view_list is a pointer to an msg_struct_list_s structure. - * - * \return Return Type int (msg_error_t) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_INVALID_PARAMETER Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR Storage is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * msg_handle_t msgHandle = NULL; - * msg_error_t err = MSG_SUCCESS; - * ... - * char* search_string = "hello"; - * msg_struct_list_s threadViewList; - * ... - * err = msg_search_message_for_thread_view(&msgHandle, search_string, &threadViewList); - * - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_search_message_for_thread_view(msg_handle_t handle, const char *search_string, msg_struct_list_s *msg_thread_view_list); /** - - * \par Description: - * Search messages or addresses which including a string that applcation want to find. - * - * \par Purpose: - * This API is used to search messages or addresses from storage. + * @brief Gets reject message list by phone number. + * @details This API is used to get reject message list from storage. * - * \par Typical use case: - * Search messages or addresses from storage. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Method of function operation: - * search messages or addresses from storage. + * @param[in] handle The Message handle + * @param[in] phone_num The string of phone number to find + * @param[out] msg_reject_msg_list A pointer to a #msg_struct_list_s structure * - * \par Sync (or) Async: - * This is a Synchronous API. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Important notes: - * None - * - * \param input - msg_handle_t handle is Message handle. - * \param input - search_string is the string to search. - * \param input - offset is the offset of the search result. - * \param input - limit is the limit of the search result. - * \param output - msg_list is a pointer to an msg_struct_list_s structure. - * - * \return Return Type int (msg_error_t) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_INVALID_PARAMETER Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR Storage is error. + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + +int msg_get_reject_msg_list(msg_handle_t handle, const char* phone_num, msg_struct_list_s *msg_reject_msg_list); + + +/** + * @brief Registers a callback function about the change of storage status to Message handle. + * @details This API is used to register a callback function about the change of storage status "msg_storage_change_cb" to Message handle. * - * \par Prospective clients: - * External/Native Apps using Messaging Services. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Related functions: - * None + * @remarks This function MUST be called after Message handle is opened. * - * \par Known issues/bugs: - * None + * @param[in] handle The Message handle + * @param[in] cb The function to be called + * @param[in] user_param A pointer to user data * - * \par Sample code: - * \code - * ... + * @return @c 0 on success, + * otherwise a negative error value * - * msg_handle_t msgHandle = NULL; - * msg_error_t err = MSG_SUCCESS; - * ... - * msg_struct_list_s msg_list; - * int offset = 0; - * int limit = 10; + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_MSGHANDLE_NOT_CONNECTED Message handle is not connected + * @retval MSG_ERR_MEMORY_ERROR Memory is error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + +int msg_reg_storage_change_callback(msg_handle_t handle, msg_storage_change_cb cb, void *user_param); + + +/** + * @brief Gets the report status information of message. * - * MSG_SEARCH_CONDITION_S searchCon; + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * searchCon.msgType = MSG_TYPE_SMS; - * searchCon.folderId = MSG_INBOX_ID; - * searchCon.pSearchVal = "keyString"; - * searchCon.pAddressVal = "01000000000"; + * @param[in] handle The Message handle + * @param[in] msg_id The ID of the message + * @param[out] report_status A pointer to a #msg_struct_list_s structure * - * ... - * err = msg_search_message(hMsgHandle, &searchCon, offset, limit, &msgList); + * @return @c 0 on success, + * otherwise a negative error value * - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ -int msg_search_message(msg_handle_t handle, const msg_struct_t msg_search_conditions, int offset, int limit, msg_struct_list_s *msg_list); -/** +int msg_get_report_status(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_list_s *report_list); - * \par Description: - * Get reject message list that application wants to find by phone number. - * - * \par Purpose: - * This API is used to get reject message list from storage. - * - * \par Typical use case: - * Get reject message list from storage. + +/** + * @brief Gets the address list for specific thread ID. * - * \par Method of function operation: - * Get reject message list from storage. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Sync (or) Async: - * This is a Synchronous API. + * @param[in] handle The Message handle + * @param[in] msg_id The ID of the message + * @param[out] msg_address_list A pointer to a #msg_struct_list_s structure * - * \par Important notes: - * None + * @return @c 0 on success, + * otherwise a negative error value * - * \param input - msg_handle_t handle is Message handle. - * \param input - phone_num is the string of phone number to find. - * \param output - msg_reject_msg_list is a pointer to an msg_struct_list_s structure. + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ - * \return Return Type int (msg_error_t) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_INVALID_PARAMETER Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR Storage is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None +int msg_get_address_list(msg_handle_t handle, msg_thread_id_t thread_id, msg_struct_list_s *msg_address_list); + + +/** + * @brief Gets the thread ID by address. * - * \par Known issues/bugs: - * None + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Sample code: - * \code - * ... + * @param[in] handle The Message handle + * @param[in] msg_address_list A pointer to a #msg_struct_list_s structure + * @param[out] thread_id The thread ID of the message * - * msg_handle_t msgHandle = NULL; - * msg_error_t err = MSG_SUCCESS; - * ... - * char* phone_num = "01030016057"; - * msg_struct_list_s rejectMsgList; - * ... - * err = msg_get_reject_msg_list(hMsgHandle, phone_num, &rejectMsgList); + * @return @c 0 on success, + * otherwise a negative error value * - * if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ -int msg_get_reject_msg_list(msg_handle_t handle, const char* phone_num, msg_struct_list_s *msg_reject_msg_list); +int msg_get_thread_id_by_address(msg_handle_t handle, msg_struct_list_s *msg_address_list, msg_thread_id_t *thread_id); /** - - * \par Description: - * Registers a callback function about the change of storage status to Message handle. - * - * \par Purpose: - * This API is used to register a callback function about the change of storage status "msg_storage_change_cb" to Message handle. - * - * \par Typical use case: - * Register a callback function about the change of storage status. + * @brief Gets the thread ID by address. * - * \par Method of function operation: - * Adds the msg_storage_change_cb API to a callback function list. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Sync (or) Async: - * This is a Synchronous API. + * @param[in] handle The Message handle + * @param[in] msg_address_list A pointer to a #msg_list_handle structure + * @param[out] thread_id The thread ID of the message * - * \par Important notes: - * This function MUST be called after Message handle is opened. + * @return @c 0 on success, + * otherwise a negative error value * - * \param input - handle is Message handle. - * \param input - cb is a function to be called. - * \param input - user_param is a pointer to user data. + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + +int msg_get_thread_id_by_address2(msg_handle_t handle, msg_list_handle_t msg_address_list, msg_thread_id_t *thread_id); + + + +/** + * @brief Gets the thread information. * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_MSGHANDLE_NOT_CONNECTED Message handle is not connected. - * - MSG_ERR_MEMORY_ERROR Memory is error. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Prospective clients: - * External/Native Apps using Messaging Services. + * @param[in] handle The Message handle + * @param[in] thread_id The ID of the thread + * @param[out] msg_thread A pointer to a #msg_struct_t structure * - * \par Related functions: - * None + * @return @c 0 on success, + * otherwise a negative error value * - * \par Known issues/bugs: - * None + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + +int msg_get_thread(msg_handle_t handle, msg_thread_id_t thread_id, msg_struct_t msg_thread); + + +/** + * @brief Gets the information list of messages. * - * \par Sample code: - * \code - * ... + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * int err = MSG_SUCCESS; + * @param[in] handle The Message handle + * @param[in] msg_list_conditions A pointer to a #msg_struct_t structure for getting conditions + * @param[out] msg_list A pointer to a #msg_struct_list_s structure * - * err = msg_reg_storage_change_callback(msgHandle, &storageCB, NULL); - * if (err != MSG_SUCCESS) - * { - * ... - * } - * return; - * } + * @return @c 0 on success, + * otherwise a negative error value * - * void storageCB(msg_handle_t handle, msg_thread_id_t threadId, msg_message_id_t msgId, void *user_param) - * { - * ... - * } - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ -int msg_reg_storage_change_callback(msg_handle_t handle, msg_storage_change_cb cb, void *user_param); +int msg_get_message_list2(msg_handle_t handle, const msg_struct_t msg_list_conditions, msg_struct_list_s *msg_list); -/** - * \par Description: - * Gets the report status information of message. - * - * \par Purpose: - * This API is used to get the report status information of specified message. +/** + * @brief Adds a new push event. * - * \par Typical use case: - * Gets the report status information of specified message from the database. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \par Method of function operation: - * Sets up the database connection and Gets the report status information of specified message from the report table. + * @param[in] handle The Message handle + * @param[in] push_event A pointer to a #msg_struct_t structure for push event * - * \par Sync (or) Async: - * This is a Synchronous API. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Important notes: - * - None + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + +int msg_add_push_event(msg_handle_t handle, const msg_struct_t push_event); + + +/** + * @brief Deletes a push event. * - * \param input - handle is Message handle. - * \param input - msg_id is the ID of the message. - * \param output - report_status is a pointer to a MSG_REPORT_STATUS_INFO_S structure. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS - Success in operation. - * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. - * - MSG_ERR_STORAGE_ERROR - Storage is error. + * @param[in] handle The Message handle + * @param[in] push_event A pointer to a #msg_struct_t structure for push event * - * \par Prospective clients: - * External/Native Apps using Messaging Services. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Related functions: - * None + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + +int msg_delete_push_event(msg_handle_t handle, const msg_struct_t push_event); + + +/** + * @brief Updates a push event. * - * \par Known issues/bugs: - * None + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \par Sample code: - * \code - * ... + * @param[in] handle The Message handle + * @param[in] src_event A pointer to a #msg_struct_t structure for source push event + * @param[in] dst_event A pointer to a #msg_struct_t structure for destination push event * - * msg_handle_t msgHandle = NULL; - * MSG_REPORT_STATUS_INFO_S reportStatus; + * @return @c 0 on success, + * otherwise a negative error value * - * ... + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + +int msg_update_push_event(msg_handle_t handle, const msg_struct_t src_event, const msg_struct_t dst_event); + + +/** + * @brief Deletes messages by Message ID list from the database. * - * err = msg_open_msg_handle(&msgHandle); + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * ... + * @param[in] handle sThe Message handle + * @param[in] msg_id_list The message ID list to be deleted * - * err = msg_get_report_status(msgHandle, msgID, &reportStatus) -* if( err != MSG_SUCCESS ) - * { - * printf("err [%d]", err); - * return err; - * } + * @return @c 0 on success, + * otherwise a negative error value * - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ -int msg_get_report_status(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_list_s *report_list); - -int msg_get_address_list(msg_handle_t handle, msg_thread_id_t thread_id, msg_struct_list_s *msg_address_list); - - -int msg_get_thread_id_by_address(msg_handle_t handle, msg_struct_list_s *msg_address_list, msg_thread_id_t *thread_id); - - -int msg_get_thread(msg_handle_t handle, msg_thread_id_t thread_id, msg_struct_t msg_thread); - -int msg_get_message_list(msg_handle_t handle, msg_folder_id_t folder_id, msg_thread_id_t thread_id, msg_message_type_t msg_type, msg_storage_id_t storage_id, msg_struct_list_s *msg_list); - - -int msg_add_push_event(msg_handle_t handle, const msg_struct_t push_event); - -int msg_delete_push_event(msg_handle_t handle, const msg_struct_t push_event); +int msg_delete_msgs_by_list(msg_handle_t handle, msg_id_list_s *msg_id_list); -int msg_update_push_event(msg_handle_t handle, const msg_struct_t src_event, const msg_struct_t dst_event); -int msg_delete_msgs_by_list(msg_handle_t handle, msg_id_list_s *msg_id_list); +/** + * @brief Marks a conversation given by thread ID as read. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write + * + * @param[in] handle The Message handle + * @param[in] thread_id The thread ID to be updated + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid + * @retval MSG_ERR_STORAGE_ERROR Storage error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ +int msg_set_conversation_to_read(msg_handle_t handle, msg_thread_id_t thread_id); /** * @} */ diff --git a/include/mapi/msg_storage_types.h b/include/mapi/msg_storage_types.h index 2fc922d..792d6ef 100755 --- a/include/mapi/msg_storage_types.h +++ b/include/mapi/msg_storage_types.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_STORAGE_TYPES_H_ @@ -28,12 +28,19 @@ ==================================================================================================*/ /** - * @brief Represents message id list. + * @internal + * @addtogroup MSG_SERVICE_FRAMEWORK_STORAGE_MODULE + * @{ + */ + + +/** + * @brief The structure type that represents message ID list. */ typedef struct { - int nCount; /**< The count of message id informatioin */ - msg_message_id_t *msgIdList; /**< The pointer to message id informatioin */ + int nCount; /**< The count of message ID informatioin */ + msg_message_id_t *msgIdList; /**< The pointer to message ID informatioin */ }msg_id_list_s; @@ -42,46 +49,50 @@ typedef struct ==================================================================================================*/ /** - * @brief Represents a folder type. \n - * The values for this type SHOULD be in _MSG_FOLDER_TYPE_E. + * @brief The structure type that represents a folder type. \n + * The values for this type SHOULD be in @ref _MSG_FOLDER_TYPE_E. */ typedef unsigned char msg_folder_type_t; /** - * @brief Represents a sort type. \n - * The values for this type SHOULD be in \ref _MSG_SORT_TYPE_E. + * @brief The structure type that represents a sort type. \n + * The values for this type SHOULD be in @ref _MSG_SORT_TYPE_E. */ typedef unsigned char msg_sort_type_t; /** - * @brief Represents a Saved SIM message ID. + * @brief The structure type that represents a saved SIM message ID. */ typedef signed short msg_sim_id_t; +/** + * @brief The structure type that represents a Saved SIM slot ID. + */ +typedef int msg_sim_slot_id_t; + /** - * @brief Represents a message type for quick panel. \n - * The values for this type SHOULD be in \ref _MSG_QUICKPANEL_TYPE_E. + * @brief The structure type that represents a message type for quick panel. \n + * The values for this type SHOULD be in @ref _MSG_QUICKPANEL_TYPE_E. */ typedef unsigned char msg_quickpanel_type_t; /** - * @brief Represents a storage change CB type. \n - * The values for this type SHOULD be in \ref _MSG_STORAGE_CHANGE_TYPE_E. + * @brief The structure type that represents a storage change CB type. \n + * The values for this type SHOULD be in @ref _MSG_STORAGE_CHANGE_TYPE_E. */ typedef unsigned char msg_storage_change_type_t; -/** @brief Prototype of the function that will be called when the database of message framework is changed. - * Applications SHOULD implement this callback function and register it into Message handle. - * For how to register this callback function, please refer to msg_reg_storage_change_callback. - * The callback function runs in the application process, not in the framework process. - * @param[in] handle is Message handle. - * @param[in] user_param is a pointer to user data. - * @return void +/** @brief Called when the database of message framework is changed. + * Applications SHOULD implement this callback function and register it into Message handle. + * For how to register this callback function, please refer to msg_reg_storage_change_callback(). + * The callback function runs in the application process, not in the framework process. + * @param[in] handle The Message handle. + * @param[in] user_param A pointer to user data */ typedef void (*msg_storage_change_cb)(msg_handle_t handle, msg_storage_change_type_t storageChangeType, msg_id_list_s *pMsgIdList, void *user_param); @@ -91,121 +102,129 @@ typedef void (*msg_storage_change_cb)(msg_handle_t handle, msg_storage_change_ty ==================================================================================================*/ /** - * @brief Represents the values of a storage type. \n - * This enum is used as the value of msg_storage_id_t. + * @brief Enumeration for the values of a storage type. \n + * This enum is used as the value of msg_storage_id_t. */ enum _MSG_STORAGE_ID_E { - MSG_STORAGE_UNKNOWN = 0, /**< Storage Id is unknown. */ - MSG_STORAGE_PHONE, /**< Storage Id is Phone. */ - MSG_STORAGE_SIM, /**< Storage Id is SIM card. */ + MSG_STORAGE_UNKNOWN = 0, /**< Storage ID is unknown. */ + MSG_STORAGE_PHONE, /**< Storage ID is Phone. */ + MSG_STORAGE_SIM, /**< Storage ID is SIM card in slot 1. */ + MSG_STORAGE_SIM2, /**< Storage ID is SIM card in slot 2. */ }; /** - * @brief Represents the values of a storage type. \n - * This enum is used as the value of msg_folder_id_t. + * @brief Enumeration for the values of a storage type. \n + * This enum is used as the value of msg_folder_id_t. */ enum _MSG_FOLDER_ID_E { - MSG_IOSBOX_ID = -1, /**< Indicates INBOX, OUTBOX and SENTBOX group folder id. (Only for search option.) */ - MSG_ALLBOX_ID = 0, /**< Indicates INBOX, OUTBOX, SENTBOX and DRAFTBOX group folder id. (Only for search option.) */ - MSG_INBOX_ID = 1, - MSG_OUTBOX_ID = 2, - MSG_SENTBOX_ID = 3, - MSG_DRAFT_ID = 4, - MSG_CBMSGBOX_ID = 5, - MSG_SPAMBOX_ID = 6, - MSG_SMS_TEMPLATE_ID = 7, - MSG_MMS_TEMPLATE_ID = 8, - - // new folder should be placed here - - MSG_MAX_FOLDER_ID + MSG_IOSBOX_ID = -1, /**< Indicates INBOX, OUTBOX and SENTBOX group folder ID. (Only for search option.) */ + MSG_ALLBOX_ID = 0, /**< Indicates INBOX, OUTBOX, SENTBOX and DRAFTBOX group folder ID. (Only for search option.) */ + MSG_INBOX_ID = 1, /**< Indicates INBOX folder ID */ + MSG_OUTBOX_ID = 2, /**< Indicates OUTBOX folder ID */ + MSG_SENTBOX_ID = 3, /**< Indicates SENTBOX folder ID */ + MSG_DRAFT_ID = 4, /**< Indicates DRAFT folder ID */ + MSG_CBMSGBOX_ID = 5, /**< Indicates CALLBACK message folder ID */ + MSG_SPAMBOX_ID = 6, /**< Indicates SPAM message folder ID */ + MSG_MAX_FOLDER_ID /**< Indicates MAX folder ID. Folder ID to be accessed should be smaller than this */ }; /** - * @brief Represents the values of a folder type. \n - * This enum is used as the value of msg_folder_type_t. + * @brief Enumeration for the values of a folder type. \n + * This enum is used as the value of msg_folder_type_t. */ enum _MSG_FOLDER_TYPE_E { MSG_FOLDER_TYPE_INBOX = 1, /**< Inbox folder */ - MSG_FOLDER_TYPE_OUTBOX, /**< Outbox folder */ - MSG_FOLDER_TYPE_DRAFT, /**< Draft folder */ + MSG_FOLDER_TYPE_OUTBOX, /**< Outbox folder */ + MSG_FOLDER_TYPE_DRAFT, /**< Draft folder */ MSG_FOLDER_TYPE_SPAMBOX, /**< Spambox folder */ - MSG_FOLDER_TYPE_TEMPLATE, /**< Template folder */ MSG_FOLDER_TYPE_USER_DEF /**< Folder which is created by a user */ }; /** - * @brief Represents the values of a sort type. \n - * This enum is used as the value of msg_sort_type_t. + * @brief Enumeration for the values of a sort type. \n + * This enum is used as the value of msg_sort_type_t. */ enum _MSG_SORT_TYPE_E { MSG_SORT_BY_UNKNOWN = 0, /**< Unknown sort type */ - MSG_SORT_BY_DISPLAY_FROM, /**< Sort by display from */ - MSG_SORT_BY_DISPLAY_TO, /**< Sort by display to */ + MSG_SORT_BY_DISPLAY_FROM, /**< Sort by display from */ + MSG_SORT_BY_DISPLAY_TO, /**< Sort by display to */ MSG_SORT_BY_DISPLAY_TIME, /**< Sort by display time */ MSG_SORT_BY_MSG_TYPE, /**< Sort by msg type */ MSG_SORT_BY_READ_STATUS, /**< Sort by read status */ - MSG_SORT_BY_STORAGE_TYPE, /**< Sort by storage type */ + MSG_SORT_BY_STORAGE_TYPE, /**< Sort by storage type */ MSG_SORT_BY_THREAD_NAME, /**< Sort by name for thread view*/ MSG_SORT_BY_THREAD_DATE, /**< Sort by date for thread view*/ - MSG_SORT_BY_THREAD_COUNT, /**< Sort by count for thread view*/ + MSG_SORT_BY_THREAD_COUNT, /**< Sort by count for thread view*/ }; /** - * @brief Represents the values of a message type for quick panel. \n - * This enum is used as the value of msg_quickpanel_type_t. + * @brief Enumeration for the values of a message type for quick panel. \n + * This enum is used as the value of msg_quickpanel_type_t. */ enum _MSG_QUICKPANEL_TYPE_E { - MSG_QUICKPANEL_SMS = 0, - MSG_QUICKPANEL_MMS, - MSG_QUICKPANEL_DELIVER_REP, - MSG_QUICKPANEL_READ_REP, - MSG_QUICKPANEL_VOICEMAIL, - MSG_QUICKPANEL_MMS_NOTI, + MSG_QUICKPANEL_SMS = 0, /**< Quickpanel SMS */ + MSG_QUICKPANEL_MMS, /**< Quickpanel MMS */ + MSG_QUICKPANEL_DELIVER_REP, /**< Quickpanel delivery report */ + MSG_QUICKPANEL_READ_REP, /**< Quickpanel message read report */ + MSG_QUICKPANEL_VOICEMAIL, /**< Quickpanel voicemail */ + MSG_QUICKPANEL_MMS_NOTI, /**< Quickpanel MMS notification */ }; + /** - * @} + * @brief Enumeration for the values of a count limit for each mailbox. */ enum _MSG_COUNT_LIMIT_MAILBOX_TYPE_E { - MSG_COUNT_LIMIT_INBOX_TYPE, - MSG_COUNT_LIMIT_OUTBOX_TYPE, - MSG_COUNT_LIMIT_SENTBOX_TYPE, - MSG_COUNT_LIMIT_DRAFTBOX_TYPE, - MSG_COUNT_LIMIT_CBMSGBOX_TYPE, - MSG_COUNT_LIMIT_MAILBOX_TYPE_MAX, + MSG_COUNT_LIMIT_INBOX_TYPE, /**< Message count limit of inbox folder*/ + MSG_COUNT_LIMIT_OUTBOX_TYPE, /**< Message count limit of outbox folder*/ + MSG_COUNT_LIMIT_SENTBOX_TYPE, /**< Message count limit of sentbox folder*/ + MSG_COUNT_LIMIT_DRAFTBOX_TYPE, /**< Message count limit of draftbox folder*/ + MSG_COUNT_LIMIT_CBMSGBOX_TYPE, /**< Message count limit of call-back-message-box folder */ + MSG_COUNT_LIMIT_MAILBOX_TYPE_MAX, /**< Indicates the maximum number of types of folder message count limits */ }; + +/** + * @brief Enumeration for the values of a count limit for each message type. + */ enum _MSG_COUNT_LIMIT_MSG_TYPE_E { - MSG_COUNT_LIMIT_SMS_TYPE, - MSG_COUNT_LIMIT_MMS_TYPE, - MSG_COUNT_LIMIT_CB_TYPE, - MSG_COUNT_LIMIT_WAPPUSH_TYPE, - MSG_COUNT_LIMIT_PROVISION_TYPE, - MSG_COUNT_LIMIT_MSG_TYPE_MAX, + MSG_COUNT_LIMIT_SMS_TYPE, /**< Message count limit for SMS */ + MSG_COUNT_LIMIT_MMS_TYPE, /**< Message count limit for MMS */ + MSG_COUNT_LIMIT_CB_TYPE, /**< Message count limit for callback messages */ + MSG_COUNT_LIMIT_WAPPUSH_TYPE, /**< Message count limit for wappush messages */ + MSG_COUNT_LIMIT_PROVISION_TYPE, /**< Message count limit for provision messages */ + MSG_COUNT_LIMIT_MSG_TYPE_MAX, /**< Indicates maximum number of types of message count limits */ }; + +/** + * @brief Enumeration for the values of a storage change type. \n + * This enum is used with storage change callback functions. + */ enum _MSG_STORAGE_CHANGE_TYPE_E { // msg data - MSG_STORAGE_CHANGE_INSERT = 1, - MSG_STORAGE_CHANGE_UPDATE, - MSG_STORAGE_CHANGE_DELETE, + MSG_STORAGE_CHANGE_INSERT = 1, /**< Indicates storage change by an INSERT operation*/ + MSG_STORAGE_CHANGE_UPDATE, /**< Indicates storage change by an UPDATE operation*/ + MSG_STORAGE_CHANGE_DELETE, /**< Indicates storage change by a DELETE operation*/ // thread data - MSG_STORAGE_CHANGE_CONTACT, + MSG_STORAGE_CHANGE_CONTACT, /**< Indicates storage change by a CHANGE CONTACT operation*/ }; +/** + * @} + */ #endif /* MSG_STORAGE_TYPES_H_ */ diff --git a/include/mapi/msg_transport.h b/include/mapi/msg_transport.h index 5861c8f..623457a 100755 --- a/include/mapi/msg_transport.h +++ b/include/mapi/msg_transport.h @@ -1,35 +1,22 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ -/** - * @file MapiTransport.h - * @brief Defines transport API of messaging framework - * @version 1.0 - */ - #ifndef MAPI_TRANSPORT_H #define MAPI_TRANSPORT_H -/** - * @section Introduction - * - Introduction : Overview on Messaging Transport API - * @section Program - * - Program : Messaging Transport API Reference - */ - /*================================================================================================== INCLUDE FILES ==================================================================================================*/ @@ -42,937 +29,503 @@ extern "C" #endif /** - * @ingroup MESSAGING_FRAMEWORK - * @defgroup MESSAGING_TRANSPORT_API Messaging Transport API - * @{ - */ - -/*================================================================================================== - FUNCTION PROTOTYPES -==================================================================================================*/ - -/** - - * \par Description: - * Submits a request to the Messaging Framework. - * - * \par Purpose: - * This API is used to submit a request to the Messaging Framework. - * - * \par Typical use case: - * Submit a request to Messaging Service such as Send Message, Forward etc. + * @internal + * @ingroup MSG_SERVICE_FRAMEWORK + * @defgroup MSG_SERVICE_FRAMEWORK_TRANSPORT_MODULE Transport API + * @brief The Transport API provides functions to send SMS/MMS and register incoming/sending/syncML/report callback. * - * \par Method of function operation: - * Sets up the database connection and inserts the message to message table. + * @internal + * @addtogroup MSG_SERVICE_FRAMEWORK_TRANSPORT_MODULE + * @{ * - * \par Sync (or) Async: - * This is a Synchronous API. + * @section MSG_SERVICE_FRAMEWORK_TRANSPORT_MODULE_HEADER Required Header + * \#include * - * \par Important notes: - * - The result information will be sent back by using the callback function, msg_sent_status_cb. - * - Applications MUST fill in the valid message type. - * - reqId will be filled in the framework. + * @section MSG_SERVICE_FRAMEWORK_TRANSPORT_MODULE_OVERVIEW Overview * - * \param input - handle is Message handle. - * \param input - req is a pointer to an MSG_REQUEST_S structure. + * The Transport API provides the following functionalities: * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_INVALID_MSGHANDLE Message handle is invalid. - * - MSG_ERR_NULL_POINTER Pointer is NULL. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. + * - Sending SMS/MMS messages + * - Register incoming message callback + * - Register sent status callback + * - Register push message application + * - Register syncML message callback + * - Managing the registration * - * \par Related functions: - * None + * @section MSG_SERVICE_FRAMEWORK_TRANSPORT_MODULE_FEATURE Related Features + * This API is related with the following features:\n + * - http://tizen.org/feature/network.telephony\n + * - http://tizen.org/feature/network.telephony.mms\n * - * \par Known issues/bugs: - * None + * It is recommended to design feature related codes in your application for reliability.\n * - * \par Sample code: - * \code - * ... + * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n * - * int err = MSG_SUCCESS; - * MSG_REQUEST_S req; + * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * req.msg = msg; - * req.sendOpt = sendOpt; - - * err = msg_submit_req(msgHandle, &req); - * if (err != MSG_SUCCESS) - * { - * ... - * } + * More details on featuring your application can be found from Feature Element. * - * ... - * \endcode */ -/*================================================================================================*/ -int msg_submit_req(msg_handle_t handle, msg_struct_t req); +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ /** - - * \par Description: - * Registers sent status callback function to Message handle. - * - * \par Purpose: - * This API is used to register sent status callback function "msg_sent_status_cb" to Message handle. + * @brief Submits a request to the Messaging Framework. * - * \par Typical use case: - * Register for sent status callback. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \par Method of function operation: - * Adds the msg_sent_status_cb API to sent status callback list. + * @remarks The result information will be sent back by using the callback function, msg_sent_status_cb(). + * @remarks Applications MUST fill in the valid message type. + * @remarks reqId will be filled in the framework. * - * \par Sync (or) Async: - * This is a Synchronous API. + * @param[in] handle The message handle + * @param[in] req The pointer to an #MSG_REQUEST_S structure * - * \par Important notes: - * This function MUST be called after Message handle is opened. + * @return @c 0 on success, + * otherwise a negative error value * - * \param input - handle is Message handle. - * \param input - cb is a function to be called. - * \param input - user_param is a pointer to user data. - * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_INVALID_MSGHANDLE Message handle is invalid. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_TRANSPORT_ERROR Transport error + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + +int msg_submit_req(msg_handle_t handle, msg_struct_t req); + + +/** + * @brief Registers sent status callback function to Message handle. + * @details This API is used to register sent status callback function msg_sent_status_cb() to Message handle. * - * \par Related functions: - * None + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Known issues/bugs: - * None + * @remarks This function MUST be called after Message handle is opened. * - * \par Sample code: - * \code - * ... + * @param[in] handle The message handle + * @param[in] cb The function to be called + * @param[in] user_param A pointer to user data * - * int err = MSG_SUCCESS; - * MSG_REQUEST_S req; + * @return @c 0 on success, + * otherwise a negative error value * - * req.msg = msg; - * req.sendOpt = sendOpt; - - * err = msg_reg_sent_status_callback(msgHandle, &sentStatusCB, (void*)"sent status callback"); - * if (err != MSG_SUCCESS) - * { - * ... - * } - * return; - * } - - * void sentStatusCB(msg_handle_t Handle, MSG_SENT_STATUS_S *pStatus, void *pUserParam) - * { - * ... - * } - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_CALLBACK_ERROR Callback registration error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_reg_sent_status_callback(msg_handle_t handle, msg_sent_status_cb cb, void *user_param); /** - - * \par Description: - * Registers incoming SMS callback to Message handle. + * @brief Registers incoming SMS callback to Message handle. + * @details This API is used to Registers incoming SMS callback function msg_sms_incoming_cb() to Message handle. * - * \par Purpose: - * This API is used to Registers incoming SMS callback function "msg_sms_incoming_cb" to Message handle. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Typical use case: - * Register incoming SMS message callback. + * @remarks This function MUST be called after Message handle is opened. * - * \par Method of function operation: - * Adds the msg_sms_incoming_cb API to incoming SMS callback list. + * @param[in] handle The message handle + * @param[in] cb The function to be called + * @param[in] port The port used for listening \n + * If port is not used, set to @c 0. + * @param[in] user_param A pointer to user data * - * \par Sync (or) Async: - * This is a Synchronous API. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Important notes: - * This function MUST be called after Message handle is opened. - * - * \param input - handle is Message handle. - * \param input - cb is a function to be called. - * \param input - port is used for listening. If port is not used, please assign 0 to it. - * \param input - user_param is a pointer to user data. - * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_INVALID_MSGHANDLE Message handle is invalid. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * int err = MSG_SUCCESS; - * MSG_REQUEST_S req; - * - * req.msg = msg; - * req.sendOpt = sendOpt; - - * err = msg_reg_sms_message_callback(msgHandle, &incomingSmsCB, 0, (void*)"sms message callback"); - * if (err != MSG_SUCCESS) - * { - * ... - * } - * return; - * } - * - * void incomingSmsCB(msg_handle_t Handle, msg_message_t msg, void *pUserParam) - * { - * ... - * } - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_CALLBACK_ERROR Callback registration error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_reg_sms_message_callback(msg_handle_t handle, msg_sms_incoming_cb cb, unsigned short port, void *user_param); /** - - * \par Description: - * Registers incoming MMS callback to Message handle. + * @brief Registers incoming MMS conf callback to Message handle. + * @details This API is used to Registers incoming MMS conf callback function msg_mms_conf_msg_incoming_cb() to Message handle. * - * \par Purpose: - * This API is used to Registers incoming MMS callback function "msg_mms_conf_msg_incoming_cb" to Message handle. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Typical use case: - * Register incoming SMS message callback. + * @remarks This function MUST be called after Message handle is opened. * - * \par Method of function operation: - * Adds the msg_mms_conf_msg_incoming_cb API to incoming MMS callback list. + * @param[in] handle The message handle + * @param[in] cb The function to be called + * @param[in] app_id The app ID used for listening \n + * If appId is not used, set to @c NULL. + * @param[in] user_param A pointer to user data * - * \par Sync (or) Async: - * This is a Synchronous API. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Important notes: - * This function MUST be called after Message handle is opened. - * - * \param input - handle is Message handle. - * \param input - handle is Message handle. - * \param input - cb is a function to be called. - * \param input - app_id is used for listening. If appId is not used, please assign NULL to it. - * \param input - user_param is a pointer to user data. - * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_INVALID_MSGHANDLE Message handle is invalid. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * int err = MSG_SUCCESS; - * MSG_REQUEST_S req; - * - * req.msg = msg; - * req.sendOpt = sendOpt; - - * err = msg_reg_mms_conf_message_callback(msgHandle, &incomingMmsConfCB, NULL, NULL); - * if (err != MSG_SUCCESS) - * { - * ... - * } - * return; - * } - * - * void incomingMmsConfCB(msg_handle_t Handle, msg_message_t msg, void *pUserParam) - * { - * ... - * } - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_CALLBACK_ERROR Callback registration error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_reg_mms_conf_message_callback(msg_handle_t handle, msg_mms_conf_msg_incoming_cb cb, const char *app_id, void *user_param); /** - - * \par Description: - * Registers incoming SyncML Message callback to Message handle. + * @brief Registers incoming SyncML Message callback to Message handle. + * @details This API is used to register incoming SyncML Message callback function msg_syncml_msg_incoming_cb() to Message handle. * - * \par Purpose: - * This API is used to Registers incoming SyncML Message callback function "msg_syncml_msg_incoming_cb" to Message handle. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Typical use case: - * Register incoming SMS message callback. + * @remarks This function MUST be called after Message handle is opened. * - * \par Method of function operation: - * Adds the msg_syncml_msg_incoming_cb API to incoming SyncML callback list. + * @param[in] handle The message handle + * @param[in] cb The function to be called + * @param[in] user_param A pointer to user data * - * \par Sync (or) Async: - * This is a Synchronous API. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Important notes: - * This function MUST be called after Message handle is opened. - * - * \param input - handle is Message handle. - * \param input - cb is a function to be called. - * \param input - user_param is a pointer to user data. - * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_MSGHANDLE_NOT_CONNECTED Message handle is not connected. - * - MSG_ERR_MEMORY_ERROR Memory is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * int err = MSG_SUCCESS; - * - * err = err = msg_reg_syncml_message_callback(msgHandle, &syncMLCB, NULL); - * if (err != MSG_SUCCESS) - * { - * ... - * } - * return; - * } - * - * void syncMLCB(msg_handle_t hMsgHandle, msg_syncml_message_type_t msgType, const char* pPushHeader, int PushHeaderLen, const char* pPushBody, int PushBodyLen, void *pUserParam) - * { - * ... - * } - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_CALLBACK_ERROR Callback registration error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_reg_syncml_message_callback(msg_handle_t handle, msg_syncml_msg_incoming_cb cb, void *user_param); /** - - * \par Description: - * Registers incoming LBS Message callback to Message handle. - * - * \par Purpose: - * This API is used to Registers incoming LBS Message callback function "msg_lbs_msg_incoming_cb" to Message handle. + * @brief Registers incoming LBS Message callback to Message handle. + * @details This API is used to register incoming LBS Message callback function msg_lbs_msg_incoming_cb() to Message handle. * - * \par Typical use case: - * Register incoming SMS message callback. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Method of function operation: - * Adds the msg_lbs_msg_incoming_cb API to incoming LBS Message callback list. + * @remarks This function MUST be called after Message handle is opened. * - * \par Sync (or) Async: - * This is a Synchronous API. + * @param[in] handle The message handle + * @param[in] cb The function to be called + * @param[in] user_param A pointer to user data * - * \par Important notes: - * This function MUST be called after Message handle is opened. + * @return @c 0 on success, + * otherwise a negative error value * - * \param input - handle is Message handle. - * \param input - cb is a function to be called. - * \param input - user_param is a pointer to user data. - * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_MSGHANDLE_NOT_CONNECTED Message handle is not connected. - * - MSG_ERR_MEMORY_ERROR Memory is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * int err = MSG_SUCCESS; - * - * err = msg_reg_lbs_message_callback(msgHandle, &lbsCB, NULL); - * if (err != MSG_SUCCESS) - * { - * ... - * } - * return; - * } - * - * void lbsCB(msg_handle_t hMsgHandle, const char* pPushHeader, const char* pPushBody, int pushBodyLen, void *pUserParam) - * { - * ... - * } - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_CALLBACK_ERROR Callback registration error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_reg_lbs_message_callback(msg_handle_t handle, msg_lbs_msg_incoming_cb cb, void *user_param); /** - - * \par Description: - * Registers incoming LBS Message callback to Message handle. - * - * \par Purpose: - * This API is used to Registers incoming LBS Message callback function "msg_lbs_msg_incoming_cb" to Message handle. - * - * \par Typical use case: - * Register incoming SMS message callback. + * @brief Registers SyncML operation callback to Message handle. + * @details This API is used to register SyncML operation callback function msg_syncml_msg_operation_cb() to Message handle. * - * \par Method of function operation: - * Adds the msg_lbs_msg_incoming_cb API to incoming LBS Message callback list. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Sync (or) Async: - * This is a Synchronous API. + * @remarks This function MUST be called after Message handle is opened. * - * \par Important notes: - * This function MUST be called after Message handle is opened. + * @param[in] handle The message handle + * @param[in] cb The function to be called + * @param[in] user_param A pointer to user data * - * \param input - handle is Message handle. - * \param input - cb is a function to be called. - * \param input - user_param is a pointer to user data. + * @return @c 0 on success, + * otherwise a negative error value * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_MSGHANDLE_NOT_CONNECTED Message handle is not connected. - * - MSG_ERR_MEMORY_ERROR Memory is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_CALLBACK_ERROR Callback registration error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + +int msg_reg_syncml_message_operation_callback(msg_handle_t handle, msg_syncml_msg_operation_cb cb, void *user_param); + + +/** + * @brief Registers incoming push Message callback to Message handle. + * @details This API is used to register incoming push Message callback function msg_push_msg_incoming_cb() to Message handle. * - * \par Known issues/bugs: - * None + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Sample code: - * \code - * ... + * @remarks This function MUST be called after Message handle is opened. * - * int err = MSG_SUCCESS; + * @param[in] handle The message handle + * @param[in] cb The function to be called + * @param[in] app_id The app ID for listening \n + * If appId is not used, set to @c NULL. + * @param[in] user_param A pointer to user data * - * err = msg_reg_lbs_message_callback(msgHandle, &lbsCB, NULL); - * if (err != MSG_SUCCESS) - * { - * ... - * } - * return; - * } + * @return @c 0 on success, + * otherwise a negative error value * - * void lbsCB(msg_handle_t hMsgHandle, const char* pPushHeader, const char* pPushBody, int pushBodyLen, void *pUserParam) - * { - * ... - * } - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_CALLBACK_ERROR Callback registration error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ -int msg_reg_syncml_message_operation_callback(msg_handle_t handle, msg_syncml_msg_operation_cb cb, void *user_param); - int msg_reg_push_message_callback(msg_handle_t handle, msg_push_msg_incoming_cb cb, const char *app_id, void *user_param); -int msg_reg_cb_message_callback(msg_handle_t handle, msg_cb_incoming_cb cb, bool bsave, void *user_param); /** - - * \par Description: - * Registers incoming LBS Message callback to Message handle. + * @brief Registers incoming CB Message callback to Message handle. + * @details This API is used to register incoming CB Message callback function msg_cb_incoming_cb() to Message handle. * - * \par Purpose: - * This API is used to Registers incoming LBS Message callback function "msg_lbs_msg_incoming_cb" to Message handle. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Typical use case: - * Register incoming SMS message callback. + * @remarks This function MUST be called after Message handle is opened. * - * \par Method of function operation: - * Adds the msg_lbs_msg_incoming_cb API to incoming LBS Message callback list. + * @param[in] handle The message handle + * @param[in] cb The function to be called + * @param[in] bsave A bool flag to indicate whether CB message is to be saved or not \n + * CB message will be saved if this flag is true + * @param[in] user_param A pointer to user data * - * \par Sync (or) Async: - * This is a Synchronous API. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Important notes: - * This function MUST be called after Message handle is opened. + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_CALLBACK_ERROR Callback registration error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + +int msg_reg_cb_message_callback(msg_handle_t handle, msg_cb_incoming_cb cb, bool bsave, void *user_param); + + + +/** + * @brief Registers incoming Report Message callback to Message handle. + * @details This API is used to register incoming Report Message callback function msg_report_msg_incoming_cb() to Message handle. * - * \param input - handle is Message handle. - * \param input - cb is a function to be called. - * \param input - user_param is a pointer to user data. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_MSGHANDLE_NOT_CONNECTED Message handle is not connected. - * - MSG_ERR_MEMORY_ERROR Memory is error. + * @remarks This function MUST be called after Message handle is opened. * - * \par Prospective clients: - * External/Native Apps using Messaging Services. + * @param[in] handle The message handle + * @param[in] cb The function to be called + * @param[in] user_param A pointer to user data * - * \par Related functions: - * None + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_CALLBACK_ERROR Callback registration error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method + */ + +int msg_reg_report_message_callback(msg_handle_t handle, msg_report_msg_incoming_cb cb, void *user_param); + + +/** + * @brief Operates SyncML message. + * @details This API is used to run SyncML operation. * - * \par Known issues/bugs: - * None + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.read * - * \par Sample code: - * \code - * ... + * @remarks This function MUST be called after Message handle is opened. * - * int err = MSG_SUCCESS; + * @param[in] handle The message handle + * @param[in] msgId The message ID to run SycnML operation * - * err = msg_reg_lbs_message_callback(msgHandle, &lbsCB, NULL); - * if (err != MSG_SUCCESS) - * { - * ... - * } - * return; - * } + * @return @c 0 on success, + * otherwise a negative error value * - * void lbsCB(msg_handle_t hMsgHandle, const char* pPushHeader, const char* pPushBody, int pushBodyLen, void *pUserParam) - * { - * ... - * } - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_TRANSPORT_ERROR Transport error + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_syncml_message_operation(msg_handle_t handle, msg_message_id_t msgId); /** - - * \par Description: - * Sends SMS. It is a synchronous API which has been blocked until sent status arrives. - * - * \par Purpose: - * This API is used to sends SMS. + * @brief Sends SMS. + * @details This API is used to send SMS. It is a synchronous API which has been blocked until sent status arrives. * - * \par Typical use case: - * Sends a SMS Message + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \par Method of function operation: - * It is a synchronous API which has been blocked until sent status arrives. + * @param[in] phone_num The list of phone numbers \n + * It is separated by ",". + * @param[in] sms_text The SMS text + * @param[in] cb The function to be called + * @param[in] user_param The user data * - * \par Sync (or) Async: - * This is a Synchronous API. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Important notes: - * - None - * - * \param input - phone_num is the list of phone numbers. It is separated by ",". - * \param input - sms_text is a SMS text. - * \param input - cb is a function to be called. - * \param input - user_param is for user data. - * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_NULL_POINTER Invalid parameter. - * - MSG_ERR_MEMORY_ERROR Memory is error. + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method * * \par Prospective clients: * External/Native Apps using Messaging Services. * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * int err = MSG_SUCCESS; - * - * err = msg_sms_send("01000000000,01000000000", "1234567890", sentStatusCB, NULL); - * if (err != MSG_SUCCESS) - * { - * ... - * } - * - * ... - * \endcode */ -/*================================================================================================*/ + int msg_sms_send(const char *phone_num, const char *sms_text, msg_simple_sent_status_cb cb, void *user_param); /** - - * \par Description: - * Submits request to send SMS message. - * - * \par Purpose: - * This API is used to submit request to send SMS message. + * @brief Submits request to send SMS message. + * @details This API is used to submit request to send SMS message. * - * \par Typical use case: - * Submits request to send SMS message. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \par Method of function operation: - * Submits a request to send SMS. + * @param[in] handle The message handle + * @param[in] req A pointer to #msg_struct_t structure for SMS request information * - * \par Sync (or) Async: - * This is a Synchronous API. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Important notes: - * - None - * - * \param input - phone_num is the list of phone numbers. It is separated by ",". - * \param input - sms_text is a SMS text. - * \param input - cb is a function to be called. - * \param input - user_param is for user data. - * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_NULL_POINTER Invalid parameter. - * - MSG_ERR_MEMORY_ERROR Memory is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * int err = MSG_SUCCESS; - * MSG_REQUEST_S req; - * - * req.msg = msg; - * req.sendOpt = sendOpt; - * - * err = msg_sms_send_message(msgHandle, &req); - * if (err != MSG_SUCCESS) - * { - * ... - * } - * - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_NULL_POINTER Null parameter + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_sms_send_message(msg_handle_t handle, msg_struct_t req); /** - - * \par Description: - * Submits request to send MMS message. + * @brief Submits request to send MMS message. + * @details This API is used to submit request to send MMS message. * - * \par Purpose: - * This API is used to submit request to send MMS message. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \par Typical use case: - * Submits request to send MMS message. + * @param[in] handle The message handle + * @param[in] req A pointer to #msg_struct_t structure for MMS request information * - * \par Method of function operation: - * Submits a request to send MMS. + * @return @c 0 on success, + * otherwise a negative error value * - * \par Sync (or) Async: - * This is a Synchronous API. - * - * \par Important notes: - * - None - * - * \param input - handle is Message handle. - * \param input - req is a pointer to an MSG_REQUEST_S structure. - * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_NULL_POINTER Invalid parameter. - * - MSG_ERR_MEMORY_ERROR Memory is error. - * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None - * - * \par Sample code: - * \code - * ... - * - * int err = MSG_SUCCESS; - * MSG_REQUEST_S req; - * - * req.msg = msg; - * req.sendOpt = sendOpt; - * - * err = msg_mms_send_message(msgHandle, &req); - * if (err != MSG_SUCCESS) - * { - * ... - * } - * - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_mms_send_message(msg_handle_t handle, msg_struct_t req); /** - - * \par Description: - * Submits request to send MMS read report request. - * - * \par Purpose: - * This API is used to submit request to send MMS read report request. - * - * \par Typical use case: - * Submits request to send MMS read report request. - * - * \par Method of function operation: - * Submits a request to send MMS read report request. - * - * \par Sync (or) Async: - * This is a Synchronous API. - * - * \par Important notes: - * - None - * - * \param input - handle is Message handle. - * \param input - msg_id is a message id, which is a positive integer. - * \param input - mms_read_status is status whether message was read or not. + * @brief Submits request to send MMS read report request. + * @details This API is used to submit request to send MMS read report request. * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_NULL_POINTER Invalid parameter. - * - MSG_ERR_MEMORY_ERROR Memory is error. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None + * @param[in] handle The message handle + * @param[in] msg_id The message ID \n + * This is a positive integer. + * @param[in] mms_read_status This is status whether message was read or not * - * \par Sample code: - * \code - * ... + * @return @c 0 on success, + * otherwise a negative error value * - * int err = MSG_SUCCESS; - * - * err = err = msg_mms_send_read_report(NULL, 0, MSG_READ_REPORT_IS_READ); - * if (err != MSG_SUCCESS) - * { - * ... - * } - * - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_mms_send_read_report(msg_handle_t handle, msg_message_id_t msgId, msg_read_report_status_t mms_read_status); /** - - * \par Description: - * Submits request to send forward MMS request. - * - * \par Purpose: - * This API is used to submit request to send forward MMS request. - * - * \par Typical use case: - * Submits request to send forward MMS request. - * - * \par Method of function operation: - * Submits a request to send forward MMS request. - * - * \par Sync (or) Async: - * This is a Synchronous API. - * - * \par Important notes: - * - None - * - * \param input - handle is Message handle. - * \param input - req is a pointer to an MSG_REQUEST_S structure. + * @brief Submits request to send forward MMS request. + * @details This API is used to submit request to send forward MMS request. * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_INVALID_MSGHANDLE Message handle is invalid. - * - MSG_ERR_NULL_POINTER Pointer is NULL. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None + * @param[in] handle The message handle + * @param[in] req A pointer to #msg_struct_t structure for MMS * - * \par Sample code: - * \code - * ... + * @return @c 0 on success, + * otherwise a negative error value * - * int err = MSG_SUCCESS; - * - * err = err = msg_mms_send_read_report(NULL, 0, MSG_READ_REPORT_IS_READ); - * if (err != MSG_SUCCESS) - * { - * ... - * } - * - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_mms_forward_message(msg_handle_t handle, msg_struct_t req); /** - - * \par Description: - * Submits request to retrieve MMS request. - * - * \par Purpose: - * This API is used to submit request to retrieve MMS request. - * - * \par Typical use case: - * Submits request to retrieve MMS request. - * - * \par Method of function operation: - * Submits a request to send forward MMS request. - * - * \par Sync (or) Async: - * This is a Synchronous API. - * - * \par Important notes: - * - None - * - * \param input - handle is Message handle. - * \param input - req is a pointer to an MSG_REQUEST_S structure. + * @brief Submits request to retrieve MMS request. + * @details This API is used to submit request to retrieve MMS request. * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_INVALID_MSGHANDLE Message handle is invalid. - * - MSG_ERR_NULL_POINTER Pointer is NULL. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None + * @param[in] handle The message handle + * @param[in] req A pointer to #msg_struct_t structure for MMS * - * \par Sample code: - * \code - * ... + * @return @c 0 on success, + * otherwise a negative error value * - * int err = MSG_SUCCESS; - * - * err = msg_mms_retrieve_message(handle, &req); - * if (err != MSG_SUCCESS) - * { - * ... - * } - * - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_mms_retrieve_message(msg_handle_t handle, msg_struct_t req); -/* reject_msg_support */ /** - - * \par Description: - * Submits request to reject MMS message. - * - * \par Purpose: - * This API is used to submit request to reject MMS message. - * - * \par Typical use case: - * Submits request to reject MMS message. - * - * \par Method of function operation: - * Submits a request to send forward reject MMS message. - * - * \par Sync (or) Async: - * This is a Synchronous API. - * - * \par Important notes: - * - None - * - * \param input - handle is Message handle. - * \param input - req is a pointer to an MSG_REQUEST_S structure. + * @brief Submits request to reject MMS message. + * @details This API is used to submit request to reject MMS message. * - * \return Return Type (int(msg_error_t)) \n - * - MSG_SUCCESS Success in operation. - * - MSG_ERR_INVALID_MSGHANDLE Message handle is invalid. - * - MSG_ERR_NULL_POINTER Pointer is NULL. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/message.write * - * \par Prospective clients: - * External/Native Apps using Messaging Services. - * - * \par Related functions: - * None - * - * \par Known issues/bugs: - * None + * @param[in] handle The message handle + * @param[in] req A pointer to #msg_struct_t structure for MMS * - * \par Sample code: - * \code - * ... + * @return @c 0 on success, + * otherwise a negative error value * - * int err = MSG_SUCCESS; - * - * err = msg_mms_reject_message(handle, &req); - * if (err != MSG_SUCCESS) - * { - * ... - * } - * - * ... - * \endcode + * @retval MSG_SUCCESS Success in operation + * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid + * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method */ -/*================================================================================================*/ + int msg_mms_reject_message(msg_handle_t handle, msg_struct_t req); /** diff --git a/include/mapi/msg_transport_types.h b/include/mapi/msg_transport_types.h index 6fd5759..d27811f 100755 --- a/include/mapi/msg_transport_types.h +++ b/include/mapi/msg_transport_types.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_TRANSPORT_TYPES_H_ @@ -24,113 +24,164 @@ #include "msg_types.h" #include "msg_storage_types.h" +/** + * @internal + * @addtogroup MSG_SERVICE_FRAMEWORK_TRANSPORT_MODULE + * @{ + */ + /*================================================================================================== DEFINES ==================================================================================================*/ -/** @brief Prototype of the function that will be called when the status of the message which is already sent is changed. - * Applications SHOULD implement this callback function and register it into Message handle. - * For how to register this callback function, please refer to msg_reg_sent_status_callback. - * If the application sends a message, this callback function will be called to report its sending status. - * The application can get the request ID from sent_status to know which request is bound. - * The callback function runs in the application process, not in the framework process. - * The memory of sent_status is managed by MAPI, when the callback function is finished. - * @param[in] handle is Message handle. - * @param[in] sent_status is a pointer to an MSG_SENT_STATUS_S structure. - * @param[in] user_param is a pointer to user data. - * @return void +/** @brief Called when the status of the message which is already sent is changed. + * Applications SHOULD implement this callback function and register it into Message handle. + * For how to register this callback function, please refer to msg_reg_sent_status_callback(). + * If the application sends a message, this callback function will be called to report its sending status. + * The application can get the request ID from sent_status to know which request is bound. + * The callback function runs in the application process, not in the framework process. + * The memory of @a sent_status is managed by MAPI, when the callback function is finished. + * + * @param[in] handle The Message handle + * @param[in] sent_status A pointer to #msg_struct_t structure for sent status + * @param[in] user_param The user data */ typedef void (*msg_sent_status_cb)(msg_handle_t handle, msg_struct_t sent_status, void *user_param); -/** @brief Prototype of the function that will be called when the status of the message which is already sent is changed. - * Applications SHOULD implement this callback function and register it into Message handle. - * For how to register this callback function, please refer to msg_reg_sent_status_callback. - * If the application sends a message, this callback function will be called to report its sending status. - * The application can get the request ID from sent_status to know which request is bound. - * The callback function runs in the application process, not in the framework process. - * The memory of sent_status is managed by MAPI, when the callback function is finished. - * @param[in] sent_status is a pointer to an MSG_SENT_STATUS_S structure. - * @param[in] user_param is a pointer to user data. - * @return void +/** @brief Called when the status of the message which is already sent is changed. + * Applications SHOULD implement this callback function and register it into Message handle. + * For how to register this callback function, please refer to msg_reg_sent_status_callback(). + * If the application sends a message, this callback function will be called to report its sending status. + * The application can get the request ID from sent_status to know which request is bound. + * The callback function runs in the application process, not in the framework process. + * The memory of @a sent_status is managed by MAPI, when the callback function is finished. + * + * @param[in] sent_status A pointer to #msg_struct_t structure for sent status + * @param[in] user_param The pointer to user data */ typedef void (*msg_simple_sent_status_cb)(msg_struct_t sent_status, void *user_param); -/** @brief Prototype of the function that will be called when a new message is received. - * Applications SHOULD implement this callback function and register it into Message handle. - * For how to register this callback function, please refer to msg_reg_sms_message_callback. - * This callback function will be called when a new message is received and the message satisfies the filter list. - * The callback function runs in the application process, not in the framework process. - * The memory for msg is managed by MAPI, when the callback function is finished. - * @param[in] handle is Message handle. - * @param[in] msg is a pointer to an msg_message_t structure. - * @param[in] user_param is a pointer to user data. - * @return void +/** @brief Called when a new message is received. + * Applications SHOULD implement this callback function and register it into Message handle. + * For how to register this callback function, please refer to msg_reg_sms_message_callback(). + * This callback function will be called when a new message is received and the message satisfies the filter list. + * The callback function runs in the application process, not in the framework process. + * The memory for msg is managed by MAPI, when the callback function is finished. + * + * @param[in] handle The Message handle + * @param[in] msg A pointer to #msg_struct_t structure for message details + * @param[in] user_param The user data */ typedef void (*msg_sms_incoming_cb)(msg_handle_t handle, msg_struct_t msg, void *user_param); -/** @brief Prototype of the function that will be called when a new MMS message is received. - * Applications SHOULD implement this callback function and register it into Message handle. - * For how to register this callback function, please refer to msg_reg_mms_conf_message_callback. - * This callback function will be called when a new MMS message is received and the message satisfies the filter list. - * The callback function runs in the application process, not in the framework process. - * The memory for msg is managed by MAPI, when the callback function is finished. - * @param[in] handle is Message handle. - * @param[in] msg is a pointer to an msg_message_t structure. - * @param[in] user_param is a pointer to user data. - * @return void +/** @brief Called when a new MMS message is received. + * Applications SHOULD implement this callback function and register it into Message handle. + * For how to register this callback function, please refer to msg_reg_mms_conf_message_callback(). + * This callback function will be called when a new MMS message is received and the message satisfies the filter list. + * The callback function runs in the application process, not in the framework process. + * The memory for @a msg is managed by MAPI, when the callback function is finished. + * + * @param[in] handle The Message handle + * @param[in] msg A pointer to #msg_struct_t structure for message details + * @param[in] user_param The user data */ typedef void (*msg_mms_conf_msg_incoming_cb)(msg_handle_t handle, msg_struct_t msg, void *user_param); -/** @brief Prototype of the function that will be called when a new SyncML message is received. - * Applications SHOULD implement this callback function and register it into Message handle. - * For how to register this callback function, please refer to msg_reg_syncml_message_callback. - * This callback function will be called when a new message is received and the message satisfies the filter list. - * The callback function runs in the application process, not in the framework process. - * @param[in] handle is Message handle. - * @param[in] msg_type is msg_syncml_message_type_t structure. - * @param[in] push_body is WAP Push body data. - * @param[in] push_body_len is the length of WAP Push body data. - * @param[in] user_param is a pointer to user data. - * @return void +/** @brief Called when a new SyncML message is received. + * Applications SHOULD implement this callback function and register it into Message handle. + * For how to register this callback function, please refer to msg_reg_syncml_message_callback(). + * This callback function will be called when a new message is received and the message satisfies the filter list. + * The callback function runs in the application process, not in the framework process. + * + * @param[in] handle The Message handle + * @param[in] msg_type The #msg_syncml_message_type_t structure + * @param[in] push_body The WAP Push body data + * @param[in] push_body_len The length of WAP Push body data + * @param[in] sim_index The index of the sim on which message is received. + * @param[in] user_param The user data */ -typedef void (*msg_syncml_msg_incoming_cb)(msg_handle_t handle, msg_syncml_message_type_t msg_type, const char *push_body, int push_body_len, const char* wsp_header, int wsp_header_len, void *user_param); - - -/** @brief Prototype of the function that will be called when a new LBS message is received. - * Applications SHOULD implement this callback function and register it into Message handle. - * For how to register this callback function, please refer to msg_reg_lbs_message_callback. - * This callback function will be called when a new message is received and the message satisfies the filter list. - * The callback function runs in the application process, not in the framework process. - * @param[in] hMsgHandle is Message handle. - * @param[in] push_header is push message header data. - * @param[in] push_body is push message body data. - * @param[in] push_body_len is push message body length. - * @param[in] user_param is a pointer to user data. - * @return void +typedef void (*msg_syncml_msg_incoming_cb)(msg_handle_t handle, msg_syncml_message_type_t msg_type, const char *push_body, int push_body_len, const char* wsp_header, int wsp_header_len, int sim_index, void *user_param); + + +/** @brief Called when a new LBS message is received. + * Applications SHOULD implement this callback function and register it into Message handle. + * For how to register this callback function, please refer to msg_reg_lbs_message_callback(). + * This callback function will be called when a new message is received and the message satisfies the filter list. + * The callback function runs in the application process, not in the framework process. + * + * @param[in] hMsgHandle The Message handle + * @param[in] push_header The push message header data + * @param[in] push_body The push message body data + * @param[in] push_body_len The push message body length + * @param[in] user_param The user data */ typedef void (*msg_lbs_msg_incoming_cb)(msg_handle_t handle, const char *push_header, const char *push_body, int push_body_len, void *user_param); -/** @brief Prototype of the function that will be called when a new SyncML message is received. - * Applications SHOULD implement this callback function and register it into Message handle. - * For how to register this callback function, please refer to msg_reg_syncml_message_callback. - * This callback function will be called when a new message is received and the message satisfies the filter list. - * The callback function runs in the application process, not in the framework process. - * @param[in] handle is Message handle. - * @param[in] user_param is a pointer to user data. - * @return void +/** @brief Called when a new SyncML message is received. + * Applications SHOULD implement this callback function and register it into Message handle. + * For how to register this callback function, please refer to msg_reg_syncml_message_callback(). + * This callback function will be called when a new message is received and the message satisfies the filter list. + * The callback function runs in the application process, not in the framework process. + * + * @param[in] handle The Message handle + * @param[in] msgId The message ID + * @param[in] extId The external ID + * @param[in] user_param The user data */ typedef void (*msg_syncml_msg_operation_cb)(msg_handle_t handle, int msgId, int extId, void *user_param); +/** @brief Called when a new push message is received. + * Applications SHOULD implement this callback function and register it into Message handle. + * For how to register this callback function, please refer to msg_reg_push_message_callback(). + * This callback function will be called when a new message is received and the message satisfies the filter list. + * The callback function runs in the application process, not in the framework process. + * + * @param[in] handle The Message handle + * @param[in] push_header The push message header data + * @param[in] push_body The push message body data + * @param[in] push_body_len The push message body length + * @param[in] user_param The user data + */ typedef void (*msg_push_msg_incoming_cb)(msg_handle_t handle, const char *push_header, const char *push_body, int push_body_len, void *user_param); +/** @brief Called when a new CB message is received. + * Applications SHOULD implement this callback function and register it into Message handle. + * For how to register this callback function, please refer to msg_reg_cb_message_callback(). + * This callback function will be called when a new message is received and the message satisfies the filter list. + * The callback function runs in the application process, not in the framework process. + * + * @param[in] handle The Message handle + * @param[in] msg A pointer to #msg_struct_t structure for message details + * @param[in] user_param The user data + */ typedef void (*msg_cb_incoming_cb)(msg_handle_t handle, msg_struct_t msg, void *user_param); + +/** @brief Called when a report message is received. + * Applications SHOULD implement this callback function and register it into Message handle. + * For how to register this callback function, please refer to msg_reg_report_message_callback(). + * This callback function will be called when a new message is received and the message satisfies the filter list. + * The callback function runs in the application process, not in the framework process. + * + * @param[in] handle The Message handle + * @param[in] reportMsgType The message type of incoming report message + * @param[in] MsgId The message ID of reported message + * @param[in] addr_len The incoming report message's address length + * @param[in] addr_val The incoming report message's address value + * @param[in] user_param The user data + */ +typedef void (*msg_report_msg_incoming_cb)(msg_handle_t handle, msg_report_type_t reportMsgType, msg_message_id_t MsgId, int addr_len, const char *addr_val, void *user_param); + +/** + * @} + */ + #endif /* MSG_TRANSPORT_TYPES_H_ */ diff --git a/include/mapi/msg_types.h b/include/mapi/msg_types.h index e29fe95..4e11333 100755 --- a/include/mapi/msg_types.h +++ b/include/mapi/msg_types.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_TYPES_H_ @@ -27,301 +27,419 @@ #define EXPORT_API __attribute__ ((visibility("default"))) #endif -#define MAX_TO_ADDRESS_CNT 10 -#define MAX_PHONE_NUMBER_LEN 20 +/** + * @internal + * @addtogroup MSG_SERVICE_FRAMEWORK + * @{ + */ + +/** + * @brief Definition for maximum address count + */ +#define MAX_TO_ADDRESS_CNT 10 + +/** + * @brief Definition for maximum phone number length + */ +#define MAX_PHONE_NUMBER_LEN 20 + +/** + * @brief Definition for maximum XDN alpha ID length + */ +#define MAX_SIM_XDN_ALPHA_ID_LEN 30 +/** + * @brief Definition for maximum address value length + */ #define MAX_ADDRESS_VAL_LEN 254 -#define MAX_SIGN_VAL_LEN 128 -#define MAX_SUBJECT_LEN 120 -#define MAX_DISPLAY_NAME_LEN 195 -#define MAX_IMAGE_PATH_LEN 1024 -#define MAX_MSG_DATA_LEN 320 -#define MAX_MSG_TEXT_LEN 1530 -#define MAX_FILTER_VALUE_LEN 40 -#define MAX_COMMAND_LEN 1024 -#define MAX_FOLDER_NAME_SIZE 20 - -#define MAX_WAPPUSH_ID_LEN 100 -#define MAX_WAPPUSH_CONTENT_TYPE_LEN 100 -#define MAX_WAPPUSH_HREF_LEN 300 -#define MAX_WAPPUSH_CONTENTS_LEN 2048 +/** + * @brief Definition for maximum subject length + */ +#define MAX_SUBJECT_LEN 120 + +/** + * @brief Definition for maximum display length length + */ +#define MAX_DISPLAY_NAME_LEN 195 + +/** + * @brief Definition for maximum image path length + */ +#define MAX_IMAGE_PATH_LEN 1024 + +/** + * @brief Definition for maximum message data length + */ +#define MAX_MSG_DATA_LEN 320 + +/** + * @brief Definition for maximum message text length + */ +#define MAX_MSG_TEXT_LEN 1530 + +/** + * @brief Definition for maximum filter value length + */ +#define MAX_FILTER_VALUE_LEN 128 + +/** + * @brief Definition for maximum command length + */ +#define MAX_COMMAND_LEN 1024 + +/** + * @brief Definition for maximum folder name size + */ +#define MAX_FOLDER_NAME_SIZE 20 + +/** + * @brief Definition for maximum ID length of push message + */ +#define MAX_WAPPUSH_ID_LEN 100 + +/** + * @brief Definition for maximum content type length of push message + */ +#define MAX_WAPPUSH_CONTENT_TYPE_LEN 100 + +/** + * @brief Definition for maximum href length of push message + */ +#define MAX_WAPPUSH_HREF_LEN 300 + +/** + * @brief Definition for maximum contents length of push message + */ +#define MAX_WAPPUSH_CONTENTS_LEN 2048 + +/** + * @brief Definition for maximum invalid object count of push message(CO) + */ #define MAX_PUSH_CACHEOP_INVALID_OBJECT_MAX 5 -#define MAX_PUSH_CACHEOP_INVALID_SERVICE_MAX 5 -#define MAX_PUSH_CACHEOP_MAX_URL_LEN 200 -#define MAX_COMMON_INFO_SIZE 20 +/** + * @brief Definition for maximum invalid service count of push message(CO) + */ +#define MAX_PUSH_CACHEOP_INVALID_SERVICE_MAX 5 + +/** + * @brief Definition for maximum URL length of push message(CO) + */ +#define MAX_PUSH_CACHEOP_MAX_URL_LEN 200 -#define MAX_SEGMENT_NUM 15 +/** + * @brief Definition for maximum segment count + */ +#define MAX_SEGMENT_NUM 15 /** - * @brief Defines the maximum file path length + * @brief Definition for maximum file path length */ -#define MSG_FILEPATH_LEN_MAX 1024 +#define MSG_FILEPATH_LEN_MAX 1024 // setting -#define SMSC_NAME_MAX 127 /* Max SMSC Name Length */ -#define SMSC_ADDR_MAX 20 /* Max SMSC Adress Length */ -#define SMSC_LIST_MAX 5 /* Max List Count of SMSC */ -#define CB_CHANNEL_NAME_MAX 32 /* cb channel name max size */ -#define CB_CHANNEL_MAX 30 /* cb channel max count */ -#define CB_LANG_TYPE_MAX 10 +/** + * @brief Definition for maximum SMSC name length + */ +#define SMSC_NAME_MAX 127 /** - * @brief Defines the maximum file name length + * @brief Definition for maximum SMSC address length */ -#define MSG_FILENAME_LEN_MAX 1024 +#define SMSC_ADDR_MAX 21 /** - * @brief Defines the maximum message id length + * @brief Definition for maximum SMSC list count */ -#define MSG_MSG_ID_LEN 100 +#define SMSC_LIST_MAX 5 /** - * @brief Defines the maximum in transition id length + * @brief Definition for maximum CB channel name length */ -#define MAX_SMIL_TRANSIN_ID 100 +#define CB_CHANNEL_NAME_MAX 32 /** - * @brief Defines the maximum out transition id length + * @brief Definition for maximum CB channel count */ -#define MAX_SMIL_TRANSOUT_ID 100 +#define CB_CHANNEL_MAX 30 /** - * @brief Defines the maximum region id length + * @brief Definition for maximum CB language type count */ -#define MAX_SMIL_REGION_ID 151 +#define CB_LANG_TYPE_MAX 10 /** - * @brief Defines the maximum transition id length + * @brief Definition for maximum file name length */ -#define MAX_SMIL_TRANSITION_ID 151 +#define MSG_FILENAME_LEN_MAX 1024 /** - * @brief Defines the maximum meta id length + * @brief Definition for maximum message id length */ -#define MAX_SMIL_META_ID 151 +#define MSG_MSG_ID_LEN 1024 /** - * @brief Defines the maximum meta name length + * @brief Definition for maximum in transition id length */ -#define MAX_SMIL_META_NAME 100 +#define MAX_SMIL_TRANSIN_ID 100 /** - * @brief Defines the maximum meta content length + * @brief Definition for maximum out transition id length */ -#define MAX_SMIL_META_CONTENT 255 +#define MAX_SMIL_TRANSOUT_ID 100 /** - * @brief Defines the maximum fit size + * @brief Definition for maximum region id length */ -#define MAX_SMIL_FIT_SIZE 31 +#define MAX_SMIL_REGION_ID 151 /** - * @brief Defines the maximum pages in a MMS + * @brief Definition for maximum transition id length */ -#define MMS_PAGE_MAX 20 +#define MAX_SMIL_TRANSITION_ID 151 /** - * @brief Defines the maximum media in a MMS + * @brief Definition for maximum meta id length */ -#define MMS_MEDIA_MAX 60 +#define MAX_SMIL_META_ID 151 /** - * @brief Defines the maximum alternate text length + * @brief Definition for maximum meta name length */ -#define MAX_SMIL_ALT_LEN 255 +#define MAX_SMIL_META_NAME 100 +/** + * @brief Definition for maximum meta content length + */ +#define MAX_SMIL_META_CONTENT 255 + +/** + * @brief Definition for maximum fit size + */ +#define MAX_SMIL_FIT_SIZE 31 + +/** + * @brief Definition for maximum pages in a MMS + */ +#define MMS_PAGE_MAX 20 + +/** + * @brief Definition for maximum media in a MMS + */ +#define MMS_MEDIA_MAX 60 -//font size /** - * @brief Defines the small font size + * @brief Definition for maximum alternate text length */ -#define MMS_SMIL_FONT_SIZE_SMALL 24 +#define MAX_SMIL_ALT_LEN 255 + +//font size /** - * @brief Defines the normal font size + * @brief Definition for small font size */ -#define MMS_SMIL_FONT_SIZE_NORMAL 30 +#define MMS_SMIL_FONT_SIZE_SMALL 24 /** - * @brief Defines the large font size + * @brief Definition for normal font size */ -#define MMS_SMIL_FONT_SIZE_LARGE 36 +#define MMS_SMIL_FONT_SIZE_NORMAL 30 -#define MAX_SMIL_ANIMATE_ATTRIBUTE_NAME 100 -#define MAX_SMIL_ANIMATE_ATTRIBUTE_TYPE 100 -#define MAX_SMIL_ANIMATE_TARGET_ELEMENT 100 -#define MAX_SMIL_ANIMATE_CALC_MODE 100 +/** + * @brief Definition for large font size + */ +#define MMS_SMIL_FONT_SIZE_LARGE 36 +/** + * @brief Definition for maximum length of java app ID + */ #define MAX_MMS_JAVA_APPID_LEN 32 -#define CONV_THUMB_WIDTH 250 -#define CONV_THUMB_HEIGHT 170 +/** + * @brief Definition for maximum length of MMS transaction ID + */ +#define MMS_TR_ID_LEN 40 -#define MMS_TR_ID_LEN 40 -#define MMS_MSG_ID_LEN 40 -#define MMS_LOCATION_LEN 100 +/** + * @brief Definition for maximum length of MMS message ID + */ +#define MMS_MSG_ID_LEN 40 + +/** + * @brief Definition for maximum length of MMS contents location + */ +#define MMS_LOCATION_LEN 100 -#define MAX_MMS_TEXT_LEN 2000 /*================================================================================================== TYPES ==================================================================================================*/ -typedef struct opq_msg_svc_s * msg_handle_t; -typedef struct opq_struct_s * msg_struct_t; +/** + * @brief The structure type representing an opaque pointer to message handle. + */ +typedef struct opq_msg_svc_s *msg_handle_t; +/** + * @brief The structure type representing an opaque pointer to message structure type. + */ +typedef struct opq_struct_s *msg_struct_t; +/** + * @brief The structure type representing a pointer to message list handle. + */ typedef struct msg_list_handle *msg_list_handle_t; - +/** + * @brief The structure type representing a message structure list. + */ typedef struct { - int nCount; /**< Indicates the count of msg_struct_t. */ - msg_struct_t *msg_struct_info; /**< Indicates the msg_struct_t information list. */ + int nCount; /**< The count of #msg_struct_t */ + msg_struct_t *msg_struct_info; /**< The #msg_struct_t information list */ }msg_struct_list_s; /** - * @brief Represents a messsage ID. + * @brief The message ID. */ typedef unsigned int msg_message_id_t; /** - * @brief Represents a storage type. - See enum _MSG_STORAGE_ID_E + * @brief The storage type. + * See enum _MSG_STORAGE_ID_E. */ typedef unsigned char msg_storage_id_t; /** - * @brief Represents a folder ID. - See enum _MSG_FOLDER_ID_E + * @brief The folder ID. + * See enum _MSG_FOLDER_ID_E. */ typedef char msg_folder_id_t; /** - * @brief Represents a request ID, which is unique for each request. + * @brief The request ID, which is unique for each request. */ typedef unsigned int msg_request_id_t; /** - * @brief Represents a message priority. \n - * The values for this type SHOULD be in _MSG_PRIORITY_TYPE_E. + * @brief The message priority. \n + * The values for this type SHOULD be in _MSG_PRIORITY_TYPE_E. */ typedef unsigned char msg_priority_type_t; /** - * @brief Represents the network status of a message. \n - * The values for this type SHOULD be in _MSG_NETWORK_STATUS_E. + * @brief The network status of a message. \n + * The values for this type SHOULD be in _MSG_NETWORK_STATUS_E. */ typedef unsigned char msg_network_status_t; /** - * @brief Represents an address type. \n - * The values for this type SHOULD be in _MSG_ADDRESS_TYPE_E. + * @brief The address type. \n + * The values for this type SHOULD be in _MSG_ADDRESS_TYPE_E. */ typedef unsigned char msg_address_type_t; /** - * @brief Represents an recipient type. \n - * The values for this type SHOULD be in _MSG_RECIPIENT_TYPE_E. + * @brief The recipient type. \n + * The values for this type SHOULD be in _MSG_RECIPIENT_TYPE_E. */ typedef unsigned char msg_recipient_type_t; /** - * @brief Represents the type of a message direction. \n - * The values for this type SHOULD be in _MSG_DIRECTION_TYPE_E. + * @brief The type of a message direction. \n + * The values for this type SHOULD be in _MSG_DIRECTION_TYPE_E. */ typedef unsigned char msg_direction_type_t; /** - * @brief Represents an encoding type. \n - * The values for this type SHOULD be in _MSG_ENCODE_TYPE_E. + * @brief The encoding type. \n + * The values for this type SHOULD be in _MSG_ENCODE_TYPE_E. */ typedef unsigned char msg_encode_type_t; /** - * @brief Represents an error code. \n - * The values for this type SHOULD be in _MSG_ERROR_E + * @brief The error code. \n + * The values for this type SHOULD be in _MSG_ERROR_E. */ typedef int msg_error_t; /** -\brief Represents WAP Push App Code. +* @brief The WAP Push App Code. */ typedef unsigned char msg_push_action_t; /** -\brief Represents SyncML Message Type. +* @brief The SyncML Message Type. */ typedef unsigned short msg_syncml_message_type_t; /** - * @brief Represents a Contact ID. + * @brief The Contact ID. */ typedef unsigned int msg_contact_id_t; /** - * @brief Represents a Report Type. - * The values for this type SHOULD be in _MSG_REPORT_TYPE_E - */ + * @brief The Report Type. \n + * The values for this type SHOULD be in _MSG_REPORT_TYPE_E. + */ typedef int msg_report_type_t; /** - * @brief Represents a Delivery Report Status. - * The values for this type SHOULD be in _MSG_DELIVERY_REPORT_STATUS_E - */ + * @brief The Delivery Report Status. \n + * The values for this type SHOULD be in _MSG_DELIVERY_REPORT_STATUS_E. + */ typedef int msg_delivery_report_status_t; /** - * @brief Represents a Read Report Status. - * The values for this type SHOULD be in _MSG_READ_REPORT_STATUS_E + * @brief The Read Report Status.\n + * The values for this type SHOULD be in _MSG_READ_REPORT_STATUS_E */ typedef int msg_read_report_status_t; /** - * @brief Represents a Message Type. - * The values for this type SHOULD be in _MSG_MESSAGE_TYPE_E + * @brief The Message Type. \n + * The values for this type SHOULD be in _MSG_MESSAGE_TYPE_E. */ typedef unsigned short msg_message_type_t; /** - * @brief Represents a Message Backup Type. - * The values for this type SHOULD be in _MSG_MESSAGE_BACKUP_TYPE_E + * @brief The Message Backup Type. \n + * The values for this type SHOULD be in _MSG_MESSAGE_BACKUP_TYPE_E. */ typedef unsigned int msg_message_backup_type_t; /** - * @brief Represents a thread ID. \n + * @brief The thread ID. */ typedef unsigned int msg_thread_id_t; // filter /** - * @brief Represents a filter ID. + * @brief The filter ID. */ typedef unsigned char msg_filter_id_t; /** - * @brief Represents a filter Type. \n - * The filter Type represents a unique filter type. \n - * The values for this type SHOULD be in _MSG_FILTER_TYPE_E. + * @brief The filter Type. \n + * The filter type represents a unique filter type. \n + * The values for this type SHOULD be in _MSG_FILTER_TYPE_E. */ typedef unsigned char msg_filter_type_t; @@ -331,441 +449,727 @@ typedef unsigned char msg_filter_type_t; ENUMS ==================================================================================================*/ +/** + * @brief Enumeration for the values of a structure type for #msg_sturuct_t. \n + */ enum _MSG_STRUCT_E { - MSG_STRUCT_FILTER = 0X0000, /**< Indicates the MSG_STRUCT_FILTER */ - - MSG_STRUCT_MESSAGE_INFO = 0x0200, /**< Indicates the MSG_STRUCT_MESSAGE_INFO */ - MSG_STRUCT_THREAD_INFO = 0x0300, - MSG_STRUCT_CONV_INFO = 0x0400, - MSG_STRUCT_MMS = 0x0500, /**< Indicates the MSG_STRUCT_MMS */ - MSG_STRUCT_MMS_PAGE = 0x0600, /**< Indicates the MSG_STRUCT_MMS_PAGE */ - MSG_STRUCT_MMS_MEDIA = 0x0700, /**< Indicates the MSG_STRUCT_MMS_MEDIA */ - MSG_STRUCT_MMS_ATTACH = 0x0800, /**< Indicates the MSG_STRUCT_MMS_ATTACH */ - MSG_STRUCT_MMS_REGION = 0x0900, /**< Indicates the MSG_STRUCT_MMS_REGION */ - MSG_STRUCT_MMS_TRANSITION = 0x0a00, /**< Indicates the MSG_STRUCT_MMS_TRANSITION */ - MSG_STRUCT_MMS_META = 0x0b00, /**< Indicates the MSG_STRUCT_MMS_META */ - MSG_STRUCT_MMS_SMIL_TEXT = 0x0c00, /**< Indicates the MSG_STRUCT_MMS_SMIL_TEXT */ - MSG_STRUCT_MMS_SMIL_AVI = 0x0d00, /**< Indicates the MSG_STRUCT_MMS_SMIL_AVI */ - - MSG_STRUCT_SETTING_SMSC_OPT = 0x2000, - MSG_STRUCT_SETTING_SMSC_INFO = 0x2100, /**< Indicates the MSG_STRUCT_SETTING_SMSC_INFO */ - MSG_STRUCT_SETTING_CB_OPT = 0x2200, /**< Indicates the MSG_STRUCT_SETTING_CB_OPT */ - MSG_STRUCT_SETTING_CB_CHANNEL_INFO = 0x2300, /**< Indicates the MSG_STRUCT_CB_CHANNEL_INFO */ - MSG_STRUCT_SETTING_SMS_SEND_OPT = 0x2400, /**< Indicates the MSG_STRUCT_SETTING_SMS_SEND_OPT */ - MSG_STRUCT_SETTING_MMS_SEND_OPT = 0x2500, /**< Indicates the MSG_STRUCT_SETTING_MMS_SEND_OPT */ - MSG_STRUCT_SETTING_MMS_RECV_OPT = 0x2600, /**< Indicates the MSG_STRUCT_SETTING_MMS_RECV_OPT */ - MSG_STRUCT_SETTING_PUSH_MSG_OPT = 0x2700, /**< Indicates the MSG_STRUCT_SETTING_PUSH_MSG_OPT */ - MSG_STRUCT_SETTING_VOICE_MSG_OPT = 0x2800, /**< Indicates the MSG_STRUCT_SETTING_VOICE_MSG_OPT */ - MSG_STRUCT_SETTING_GENERAL_OPT = 0x2900, /**< Indicates the MSG_STRUCT_SETTING_GENERAL_OPT */ - MSG_STRUCT_SETTING_MSGSIZE_OPT = 0x2c00, /**< Indicates the MSG_STRUCT_SETTING_MSGSIZE_OPT */ - - - MSG_STRUCT_SYNCML_INFO = 0x3100, /**< Indicates the MSG_STRUCT_SYNCML_INFO */ - MSG_STRUCT_COUNT_INFO = 0x3200, /**< Indicates the MSG_STRUCT_COUNT_INFO */ - MSG_STRUCT_THREAD_COUNT_INFO = 0x3300, /**< Indicates the MSG_STRUCT_THREAD_COUNT_INFO */ - MSG_STRUCT_THREAD_LIST_INDEX = 0x3400, /**< Indicates the MSG_STRUCT_THREAD_LIST_INDEX */ - MSG_STRUCT_SORT_RULE = 0x3500, /**< Indicates the MSG_STRUCT_SORT_RULE */ - MSG_STRUCT_FOLDER_INFO = 0x3600, /**< Indicates the MSG_STRUCT_FOLDER_INFO */ - MSG_STRUCT_SEARCH_CONDITION = 0x3700, /**< Indicates the MSG_STRUCT_SEARCH_CONDITION */ - MSG_STRUCT_REPORT_STATUS_INFO = 0x3800, /**< Indicates the MSG_STRUCT_REPORT_STATUS_INFO */ - - MSG_STRUCT_ADDRESS_INFO = 0x4000, /**< Indicates the MSG_STRUCT_ADDRESS_INFO */ - MSG_STRUCT_SENDOPT = 0x4100, /**< Indicates the MSG_STRUCT_SENDOPT */ - MSG_STRUCT_MMS_SENDOPT = 0x4200, /**< Indicates the MSG_STRUCT_MMS_SENDOPT */ - MSG_STRUCT_SMS_SENDOPT = 0x4300, /**< Indicates the MSG_STRUCT_SMS_SENDOPT */ - MSG_STRUCT_REJECT_MSG_INFO = 0x4400, /**< Indicates the MSG_STRUCT_REJECT_MSG_INFO */ - MSG_STRUCT_REQUEST_INFO = 0x4500, /**< Indicates the MSG_STRUCT_REQUEST_INFO */ - MSG_STRUCT_SENT_STATUS_INFO = 0x4600, /**< Indicates the MSG_STRUCT_SENT_STATUS_INFO */ - MSG_STRUCT_PUSH_CONFIG_INFO = 0x4700, /**< Indicates the MSG_STRUCT_PUSH_CONFIG_INFO */ - MSG_STRUCT_CB_MSG = 0x4800, /**< Indicates the MSG_STRUCT_CB_MSG */ -}; - + MSG_STRUCT_FILTER = 0X0000, /**< Indicates the MSG_STRUCT_FILTER */ + + MSG_STRUCT_MESSAGE_INFO = 0x0200, /**< Indicates the MSG_STRUCT_MESSAGE_INFO */ + MSG_STRUCT_THREAD_INFO = 0x0300, /**< Indicates the MSG_STRUCT_THREAD_INFO*/ + MSG_STRUCT_CONV_INFO = 0x0400, /**< Indicates the MSG_STRUCT_CONV_INFO*/ + MSG_STRUCT_MMS = 0x0500, /**< Indicates the MSG_STRUCT_MMS */ + MSG_STRUCT_MMS_PAGE = 0x0600, /**< Indicates the MSG_STRUCT_MMS_PAGE */ + MSG_STRUCT_MMS_MEDIA = 0x0700, /**< Indicates the MSG_STRUCT_MMS_MEDIA */ + MSG_STRUCT_MMS_ATTACH = 0x0800, /**< Indicates the MSG_STRUCT_MMS_ATTACH */ + MSG_STRUCT_MMS_REGION = 0x0900, /**< Indicates the MSG_STRUCT_MMS_REGION */ + MSG_STRUCT_MMS_TRANSITION = 0x0a00, /**< Indicates the MSG_STRUCT_MMS_TRANSITION */ + MSG_STRUCT_MMS_META = 0x0b00, /**< Indicates the MSG_STRUCT_MMS_META */ + MSG_STRUCT_MMS_SMIL_TEXT = 0x0c00, /**< Indicates the MSG_STRUCT_MMS_SMIL_TEXT */ + MSG_STRUCT_MMS_SMIL_AVI = 0x0d00, /**< Indicates the MSG_STRUCT_MMS_SMIL_AVI */ + + MSG_STRUCT_SETTING_SMSC_OPT = 0x2000, /**< Indicates the MSG_STRUCT_SETTING_SMSC_OPT */ + MSG_STRUCT_SETTING_SMSC_INFO = 0x2100, /**< Indicates the MSG_STRUCT_SETTING_SMSC_INFO */ + MSG_STRUCT_SETTING_CB_OPT = 0x2200, /**< Indicates the MSG_STRUCT_SETTING_CB_OPT */ + MSG_STRUCT_SETTING_CB_CHANNEL_INFO = 0x2300, /**< Indicates the MSG_STRUCT_CB_CHANNEL_INFO */ + MSG_STRUCT_SETTING_SMS_SEND_OPT = 0x2400, /**< Indicates the MSG_STRUCT_SETTING_SMS_SEND_OPT */ + MSG_STRUCT_SETTING_MMS_SEND_OPT = 0x2500, /**< Indicates the MSG_STRUCT_SETTING_MMS_SEND_OPT */ + MSG_STRUCT_SETTING_MMS_RECV_OPT = 0x2600, /**< Indicates the MSG_STRUCT_SETTING_MMS_RECV_OPT */ + MSG_STRUCT_SETTING_PUSH_MSG_OPT = 0x2700, /**< Indicates the MSG_STRUCT_SETTING_PUSH_MSG_OPT */ + MSG_STRUCT_SETTING_VOICE_MSG_OPT = 0x2800, /**< Indicates the MSG_STRUCT_SETTING_VOICE_MSG_OPT */ + MSG_STRUCT_SETTING_GENERAL_OPT = 0x2900, /**< Indicates the MSG_STRUCT_SETTING_GENERAL_OPT */ + + MSG_STRUCT_SETTING_MSGSIZE_OPT = 0x2c00, /**< Indicates the MSG_STRUCT_SETTING_MSGSIZE_OPT */ + + + MSG_STRUCT_SYNCML_INFO = 0x3100, /**< Indicates the MSG_STRUCT_SYNCML_INFO */ + MSG_STRUCT_COUNT_INFO = 0x3200, /**< Indicates the MSG_STRUCT_COUNT_INFO */ + MSG_STRUCT_THREAD_COUNT_INFO = 0x3300, /**< Indicates the MSG_STRUCT_THREAD_COUNT_INFO */ + MSG_STRUCT_THREAD_LIST_INDEX = 0x3400, /**< Indicates the MSG_STRUCT_THREAD_LIST_INDEX */ + MSG_STRUCT_SORT_RULE = 0x3500, /**< Indicates the MSG_STRUCT_SORT_RULE */ + MSG_STRUCT_FOLDER_INFO = 0x3600, /**< Indicates the MSG_STRUCT_FOLDER_INFO */ + MSG_STRUCT_SEARCH_CONDITION = 0x3700, /**< Indicates the MSG_STRUCT_SEARCH_CONDITION */ + MSG_STRUCT_REPORT_STATUS_INFO = 0x3800, /**< Indicates the MSG_STRUCT_REPORT_STATUS_INFO */ + MSG_STRUCT_MSG_LIST_CONDITION = 0x3900, /**< Indicates the MSG_LIST_CONDITION */ + + MSG_STRUCT_ADDRESS_INFO = 0x4000, /**< Indicates the MSG_STRUCT_ADDRESS_INFO */ + MSG_STRUCT_SENDOPT = 0x4100, /**< Indicates the MSG_STRUCT_SENDOPT */ + MSG_STRUCT_MMS_SENDOPT = 0x4200, /**< Indicates the MSG_STRUCT_MMS_SENDOPT */ + MSG_STRUCT_SMS_SENDOPT = 0x4300, /**< Indicates the MSG_STRUCT_SMS_SENDOPT */ + MSG_STRUCT_REJECT_MSG_INFO = 0x4400, /**< Indicates the MSG_STRUCT_REJECT_MSG_INFO */ + MSG_STRUCT_REQUEST_INFO = 0x4500, /**< Indicates the MSG_STRUCT_REQUEST_INFO */ + MSG_STRUCT_SENT_STATUS_INFO = 0x4600, /**< Indicates the MSG_STRUCT_SENT_STATUS_INFO */ + MSG_STRUCT_PUSH_CONFIG_INFO = 0x4700, /**< Indicates the MSG_STRUCT_PUSH_CONFIG_INFO */ + MSG_STRUCT_CB_MSG = 0x4800, /**< Indicates the MSG_STRUCT_CB_MSG */ + + MSG_STRUCT_TRANSLATION_INFO = 0x4900, /**< Indicates the MSG_STRUCT_TRANSLATION_SETTING */ + + MSG_STRUCT_MULTIPART_INFO = 0x4a00, /**< Indicates the MSG_STRUCT_MULTIPART_INFO */ +}; + +/** + * @brief Enumeration for the values of message detail information. \n + * This enum is used as member of #msg_struct_t for MSG_STRUCT_MESSAGE_INFO. + */ enum _MSG_MESSAGE_INFO_E_ { - MSG_MESSAGE_ID_INT = MSG_STRUCT_MESSAGE_INFO+1, /**< Indicates the message ID of this message. */ - MSG_MESSAGE_THREAD_ID_INT, /**< Indicates the thread ID. */ - MSG_MESSAGE_FOLDER_ID_INT, /**< Indicates the folder ID. see enum _MSG_FOLDER_TYPE_E */ - MSG_MESSAGE_TYPE_INT, /**< Indicates the message type. See enum _MSG_MESSAGE_TYPE_E */ - MSG_MESSAGE_CLASS_TYPE_INT, /**< Message class type. See enum _MSG_CLASS_TYPE_E */ - MSG_MESSAGE_STORAGE_ID_INT, /**< Indicates where the message is saved. see enum _MSG_STORAGE_ID_E*/ - MSG_MESSAGE_ADDR_LIST_STRUCT, /**< Indicates the address information list. */ - MSG_MESSAGE_REPLY_ADDR_STR, /**< Indicates the reply address. */ - MSG_MESSAGE_SUBJECT_STR, /**< Indicates the message subject. */ - MSG_MESSAGE_DISPLAY_TIME_INT, /**< Indicates the display time related to the specific operation. */ - MSG_MESSAGE_NETWORK_STATUS_INT, /**< Indicates the network status of the message. See enum _MSG_NETWORK_STATUS_E */ - MSG_MESSAGE_ENCODE_TYPE_INT, /**< Indicates the string encoding type. See enum _MSG_ENCODE_TYPE_E */ - MSG_MESSAGE_READ_BOOL, /**< Indicates whether the message is read or not. */ - MSG_MESSAGE_PROTECTED_BOOL, /**< Indicates whether the message is protected or not. */ - MSG_MESSAGE_BACKUP_BOOL, /**< Indicates whether the message was restored from PC. */ - MSG_MESSAGE_PRIORITY_INT, /**< Indicates the priority of the message. See enum _MSG_PRIORITY_TYPE_E */ - MSG_MESSAGE_DIRECTION_INT, /**< Indicates whether the message is MO or MT, affecting address. See enum _MSG_DIRECTION_TYPE_E */ - MSG_MESSAGE_PORT_VALID_BOOL, /**< Indicates whether port information is used or not. */ - MSG_MESSAGE_DEST_PORT_INT, /**< Recipient port number, not greater than 16 bit */ - MSG_MESSAGE_SRC_PORT_INT, /**< Sender port number, not greater than 16 bit */ - MSG_MESSAGE_ATTACH_COUNT_INT, /**< Indicates the count of attached files in mms. */ - MSG_MESSAGE_THUMBNAIL_PATH_STR, /**< Indicates the thumbnail path of message. */ - MSG_MESSAGE_DATA_SIZE_INT, /**< Indicates the data size. The unit is byte. */ - MSG_MESSAGE_SMS_DATA_STR, /**< Indicates the message payload information as a body. default character encoding is UTF-8*/ - MSG_MESSAGE_MMS_TEXT_STR, -}; - + MSG_MESSAGE_ID_INT = MSG_STRUCT_MESSAGE_INFO+1, /**< Indicates the message ID of this message. */ + MSG_MESSAGE_THREAD_ID_INT, /**< Indicates the thread ID. */ + MSG_MESSAGE_FOLDER_ID_INT, /**< Indicates the folder ID. See enum _MSG_FOLDER_ID_E */ + MSG_MESSAGE_TYPE_INT, /**< Indicates the message type. See enum _MSG_MESSAGE_TYPE_E */ + MSG_MESSAGE_CLASS_TYPE_INT, /**< Indicates the message class type. See enum _MSG_CLASS_TYPE_E */ + MSG_MESSAGE_STORAGE_ID_INT, /**< Indicates where the message is saved. See enum _MSG_STORAGE_ID_E*/ + MSG_MESSAGE_ADDR_LIST_STRUCT, /**< Indicates the address information list. **DEPRECATED** */ + MSG_MESSAGE_REPLY_ADDR_STR, /**< Indicates the reply address. */ + MSG_MESSAGE_SUBJECT_STR, /**< Indicates the message subject. */ + MSG_MESSAGE_DISPLAY_TIME_INT, /**< Indicates the display time related to the specific operation. */ + MSG_MESSAGE_NETWORK_STATUS_INT, /**< Indicates the network status of the message. See enum _MSG_NETWORK_STATUS_E */ + MSG_MESSAGE_ENCODE_TYPE_INT, /**< Indicates the string encoding type. See enum _MSG_ENCODE_TYPE_E */ + MSG_MESSAGE_READ_BOOL, /**< Indicates whether the message is read or not. */ + MSG_MESSAGE_PROTECTED_BOOL, /**< Indicates whether the message is protected or not. */ + MSG_MESSAGE_BACKUP_BOOL, /**< Indicates whether the message was restored from PC. */ + MSG_MESSAGE_PRIORITY_INT, /**< Indicates the priority of the message. See enum _MSG_PRIORITY_TYPE_E */ + MSG_MESSAGE_DIRECTION_INT, /**< Indicates whether the message is MO or MT, affecting address. See enum _MSG_DIRECTION_TYPE_E */ + MSG_MESSAGE_PORT_VALID_BOOL, /**< Indicates whether port information is used or not. */ + MSG_MESSAGE_DEST_PORT_INT, /**< Indicates the recipient port number, not greater than 16 bit */ + MSG_MESSAGE_SRC_PORT_INT, /**< Indicates the sender port number, not greater than 16 bit */ + MSG_MESSAGE_ATTACH_COUNT_INT, /**< Indicates the count of attached files in MMS. */ + MSG_MESSAGE_THUMBNAIL_PATH_STR, /**< Indicates the thumbnail path of message. */ + MSG_MESSAGE_DATA_SIZE_INT, /**< Indicates the data size. The unit is byte. */ + MSG_MESSAGE_SMS_DATA_STR, /**< Indicates the message payload information as a body. default character encoding is UTF-8*/ + MSG_MESSAGE_MMS_TEXT_STR, /**< Indicates the text part of MMS message payload. default character encoding is UTF-8 */ + MSG_MESSAGE_ADDR_LIST_HND, /**< Indicates the address information list. */ + MSG_MESSAGE_REPLACE_BOOL, /**< Indicates whether the message is replace or not */ + MSG_MESSAGE_SIM_INDEX_INT, /**< Indicates the sim index */ + MSG_MESSAGE_INFO_MAX, /**< Placeholder for max value of this enum*/ +}; + +/** + * @brief Enumeration for the values of message filter information. \n + * This enum is used as member of #msg_struct_t for MSG_STRUCT_FILTER. + */ enum MSG_FILTER_INFO_E { - MSG_FILTER_ID_INT = MSG_STRUCT_FILTER+1, /**< Indicates the filter ID. */ - MSG_FILTER_TYPE_INT, /**< Indicates the filter type. See enum _MSG_FILTER_TYPE_E */ - MSG_FILTER_VALUE_STR, /**< The value of the filter. */ - MSG_FILTER_ACTIVE_BOOL, /**< Indicates the activation of the filter. */ + MSG_FILTER_ID_INT = MSG_STRUCT_FILTER+1, /**< Indicates the filter ID. */ + MSG_FILTER_TYPE_INT, /**< Indicates the filter type. See enum _MSG_FILTER_TYPE_E */ + MSG_FILTER_VALUE_STR, /**< Indicates the value of the filter. */ + MSG_FILTER_ACTIVE_BOOL, /**< Indicates the activation of the filter. */ }; +/** + * @brief Enumeration for the values of thread information. \n + * This enum is used as member of #msg_struct_t for MSG_STRUCT_THREAD_INFO. + */ enum MSG_STRUCT_THREAD_INFO_E { - MSG_THREAD_ID_INT = MSG_STRUCT_THREAD_INFO+1, /**< Indicates the message thread ID. */ - MSG_THREAD_NAME_STR, /**< Indicates the message thread name */ - MSG_THREAD_MSG_TYPE_INT, /**< Indicates the message type. See enum _MSG_MESSAGE_TYPE_E */ - MSG_THREAD_MSG_DATA_STR, /**< The latest message text. */ - MSG_THREAD_MSG_TIME_INT, /**< The latest message time */ - MSG_THREAD_DIRECTION_INT, /**< The latest message direction See enum _MSG_DIRECTION_TYPE_E */ - MSG_THREAD_UNREAD_COUNT_INT, /**< Indicates unread count of thread */ - MSG_THREAD_SMS_COUNT_INT, /**< Indicates sms message count of thread */ - MSG_THREAD_MMS_COUNT_INT, /**< Indicates mms message count of thread */ - MSG_THREAD_PROTECTED_BOOL /**< Indicates whether thread includes protected messages. */ -}; - + MSG_THREAD_ID_INT = MSG_STRUCT_THREAD_INFO+1, /**< Indicates the message thread ID. */ + MSG_THREAD_NAME_STR, /**< Indicates the message thread name */ + MSG_THREAD_MSG_TYPE_INT, /**< Indicates the message type. See enum _MSG_MESSAGE_TYPE_E */ + MSG_THREAD_MSG_DATA_STR, /**< The latest message text. */ + MSG_THREAD_MSG_TIME_INT, /**< The latest message time */ + MSG_THREAD_DIRECTION_INT, /**< The latest message direction See enum _MSG_DIRECTION_TYPE_E */ + MSG_THREAD_UNREAD_COUNT_INT, /**< Indicates unread count of thread */ + MSG_THREAD_SMS_COUNT_INT, /**< Indicates SMS message count of thread */ + MSG_THREAD_MMS_COUNT_INT, /**< Indicates MMS message count of thread */ + MSG_THREAD_PROTECTED_BOOL, /**< Indicates whether thread includes protected message. */ + MSG_THREAD_DRAFT_BOOL, /**< Indicates whether thread includes draft message. */ + MSG_THREAD_SEND_FAILED_BOOL, /**< Indicates whether thread includes send failed message. */ + MSG_THREAD_SENDING_BOOL, /**< Indicates whether thread includes sending message. */ + MSG_THREAD_TRANSLATION_BOOL, /**< Indicates whether s-translation is used or not. */ + MSG_THREAD_TRANSLATION_SENDER_LANG_INT, /**< Indicates sender language. */ + MSG_THREAD_TRANSLATION_RECEIVER_LANG_INT, /**< Indicates receiver language. */ + MSG_THREAD_TRANSLATION_RECEIVE_ONLY_BOOL, /**< Indicates whether only the receiving message applies the s-translation. */ + MSG_THREAD_TRANSLATION_INCLUDE_ORGMSG_BOOL, /**< Indicates whether the original message is included. */ + MSG_THREAD_LAST_MSG_ID_INT, /**< Indicates the last message ID of this thread. */ + MSG_THREAD_MSG_TAG_TYPE_INT /**< Indicates the conversation tag type. */ +}; + +/** + * @brief Enumeration for the values of translation information. \n + * This enum is used as member of #msg_struct_t for MSG_STRUCT_TRANSLATION_INFO. + */ +enum MSG_STRUCT_TRANSLATION_INFO_E { + MSG_TRANSLATION_BOOL = MSG_STRUCT_TRANSLATION_INFO + 1, /**< Indicates whether s-translation is used or not. */ + MSG_TRANSLATION_SENDER_LANG_INT, /**< Indicates sender language. */ + MSG_TRANSLATION_RECEIVER_LANG_INT, /**< Indicates receiver language. */ + MSG_TRANSLATION_RECEIVE_ONLY_BOOL, /**< Indicates whether only the receiving message applies the s-translation. */ + MSG_TRANSLATION_INCLUDE_ORGMSG_BOOL, /**< Indicates whether the original message is included. */ +}; + +/** + * @brief Enumeration for the values of conversation information. \n + * This enum is used as member of #msg_struct_t for MSG_STRUCT_CONV_INFO. + */ enum MSG_STRUCT_CONV_INFO_E { - MSG_CONV_MSG_ID_INT = MSG_STRUCT_CONV_INFO+1, /**< Indicates the message ID of this message. */ - MSG_CONV_MSG_THREAD_ID_INT, /**< Indicates the thread ID. */ - MSG_CONV_MSG_TYPE_INT, /**< Indicates the message type. See enum _MSG_MESSAGE_TYPE_E */ - MSG_CONV_MSG_FOLDER_ID_INT, /**< Indicates the folder ID. see enum _MSG_FOLDER_TYPE_E */ - MSG_CONV_MSG_STORAGE_ID_INT, /**< Indicates where the message is saved. see enum _MSG_STORAGE_ID_E*/ - MSG_CONV_MSG_SUBJECT_STR, /**< Indicates the message subject. */ - MSG_CONV_MSG_DISPLAY_TIME_INT, /**< Indicates the display time related to the specific operation. */ - MSG_CONV_MSG_SCHEDULED_TIME_INT, /**< Indicates the time to send scheduled message. */ - MSG_CONV_MSG_NETWORK_STATUS_INT, /**< Indicates the network status of the message. See enum _MSG_NETWORK_STATUS_E */ - MSG_CONV_MSG_READ_BOOL, /**< Indicates whether the message is read or not. */ - MSG_CONV_MSG_PROTECTED_BOOL, /**< Indicates whether the message is protected or not. */ - MSG_CONV_MSG_DIRECTION_INT, /**< Indicates whether the message is MO or MT, affecting address. See enum _MSG_DIRECTION_TYPE_E */ - MSG_CONV_MSG_PAGE_COUNT_INT, /**< Indicates the count of pages in mms. */ - MSG_CONV_MSG_ATTACH_COUNT_INT, /**< Indicates the count of attached files in mms. */ - MSG_CONV_MSG_ATTACH_NAME_STR, /**< Indicates the attached file name of message. */ - MSG_CONV_MSG_AUDIO_NAME_STR, /**< Indicates the audio file name of message. */ - MSG_CONV_MSG_IMAGE_THUMB_PATH_STR, /**< Indicates the image thumbnail path of message. */ - MSG_CONV_MSG_VIDEO_THUMB_PATH_STR, /**< Indicates the video thumbnail path of message. */ - MSG_CONV_MSG_TEXT_SIZE_INT, /**< Indicates the data size. The unit is byte. */ - MSG_CONV_MSG_TEXT_STR /**< Indicates the message payload information as a body. default character encoding is UTF-8*/ -}; - + MSG_CONV_MSG_ID_INT = MSG_STRUCT_CONV_INFO+1, /**< Indicates the message ID of this message. */ + MSG_CONV_MSG_THREAD_ID_INT, /**< Indicates the thread ID. */ + MSG_CONV_MSG_TYPE_INT, /**< Indicates the message type. See enum _MSG_MESSAGE_TYPE_E */ + MSG_CONV_MSG_FOLDER_ID_INT, /**< Indicates the folder ID. See enum _MSG_FOLDER_TYPE_E */ + MSG_CONV_MSG_STORAGE_ID_INT, /**< Indicates where the message is saved. See enum _MSG_STORAGE_ID_E*/ + MSG_CONV_MSG_SUBJECT_STR, /**< Indicates the message subject. */ + MSG_CONV_MSG_DISPLAY_TIME_INT, /**< Indicates the display time related to the specific operation. */ + MSG_CONV_MSG_SCHEDULED_TIME_INT, /**< Indicates the time to send scheduled message. */ + MSG_CONV_MSG_NETWORK_STATUS_INT, /**< Indicates the network status of the message. See enum _MSG_NETWORK_STATUS_E */ + MSG_CONV_MSG_READ_BOOL, /**< Indicates whether the message is read or not. */ + MSG_CONV_MSG_PROTECTED_BOOL, /**< Indicates whether the message is protected or not. */ + MSG_CONV_MSG_DIRECTION_INT, /**< Indicates whether the message is MO or MT, affecting address. See enum _MSG_DIRECTION_TYPE_E */ + MSG_CONV_MSG_PAGE_COUNT_INT, /**< Indicates the count of pages in MMS. */ + MSG_CONV_MSG_ATTACH_COUNT_INT, /**< Indicates the count of attached files in MMS. */ + MSG_CONV_MSG_ATTACH_NAME_STR, /**< Indicates the attached file name of message. */ + MSG_CONV_MSG_AUDIO_NAME_STR, /**< Indicates the audio file name of message. */ + MSG_CONV_MSG_IMAGE_THUMB_PATH_STR, /**< Indicates the image thumbnail path of message. */ + MSG_CONV_MSG_VIDEO_THUMB_PATH_STR, /**< Indicates the video thumbnail path of message. */ + MSG_CONV_MSG_TEXT_SIZE_INT, /**< Indicates the data size. The unit is byte. */ + MSG_CONV_MSG_TEXT_STR, /**< Indicates the message payload information as a body. default character encoding is UTF-8*/ + MSG_CONV_MSG_TCS_BC_LEVEL_INT, /**< Indicates the Behavior Level of malware. @c -1 is None*/ + MSG_CONV_MSG_1ST_MEDIA_PATH_STR, /**< Indicates the First Media path of MMS */ + MSG_CONV_MSG_MULTIPART_HND, + MSG_CONV_MSG_SIM_INDEX_INT, /**< Indicates the sim index */ + +}; + +/** + * @brief Enumeration for the values of setting for SMSC options. \n + * This enum is used as member of #msg_struct_t for MSG_STRUCT_SETTING_SMSC_OPT. + */ enum _MSG_STRUCT_SETTING_SMSC_OPT_E { - MSG_SMSC_SELECTED_ID_INT = MSG_STRUCT_SETTING_SMSC_OPT+1, - MSG_SMSC_LIST_STRUCT + MSG_SMSC_SELECTED_ID_INT = MSG_STRUCT_SETTING_SMSC_OPT+1, /**< Indicates Selected SMSC index option */ + MSG_SMSC_LIST_STRUCT, /**< Indicates SMSC data information list option*/ + MSG_SMSC_LIST_INDEX_INT, /**< Indicates SMSC index option for Updating information */ + MSG_SMSC_LIST_SIM_INDEX_INT /**< Indicates the sim index */ }; +/** + * @brief Enumeration for the values of setting for SMSC informations. \n + * This enum is used as member of #msg_struct_t for MSG_STRUCT_SETTING_SMSC_INFO. + */ enum _MSG_STRUCT_SETTING_SMSC_INFO_E { - MSG_SMSC_ADDR_TON_INT = MSG_STRUCT_SETTING_SMSC_INFO+1, /**< Type of number. See enum _MSG_SMS_TON_E */ - MSG_SMSC_ADDR_NPI_INT, /**< Numbering plan ID. See enum _MSG_SMS_NPI_E */ - MSG_SMSC_ADDR_STR, /**< SMSC address */ - MSG_SMSC_NAME_STR, /**< SMSC name */ - MSG_SMSC_PID_INT, /**< Protocol idendifier See enum _MSG_SMS_PID_E */ - MSG_SMSC_VAL_PERIOD_INT /**< Validity period value. See enum _MSG_VAL_PERIOD_E*/ + MSG_SMSC_ADDR_TON_INT = MSG_STRUCT_SETTING_SMSC_INFO+1, /**< Type of number. See enum _MSG_SMS_TON_E */ + MSG_SMSC_ADDR_NPI_INT, /**< Numbering plan ID. See enum _MSG_SMS_NPI_E */ + MSG_SMSC_ADDR_STR, /**< SMSC address */ + MSG_SMSC_NAME_STR, /**< SMSC name */ + MSG_SMSC_PID_INT, /**< Protocol idendifier See enum _MSG_SMS_PID_E */ + MSG_SMSC_VAL_PERIOD_INT /**< Validity period value. See enum _MSG_VAL_PERIOD_E*/ }; +/** + * @brief Enumeration for the values of setting for CB channel options. \n + * This enum is used as member of #msg_struct_t for MSG_STRUCT_SETTING_CB_OPT. + */ enum _MSG_STRUCT_CB_OPT_E { - MSG_CB_RECEIVE_BOOL = MSG_STRUCT_SETTING_CB_OPT+1, /**< Indicates whether the CB message is received or not. */ - MSG_CB_MAX_SIM_COUNT_INT, /**< Indicates the number of channels which can be stored in SIM. */ - MSG_CB_CHANNEL_LIST_STRUCT, /**< Indicates the cell broadcasting channel information. */ - MSG_CB_LANGUAGE_TYPE_ALL_BOOL, - MSG_CB_LANGUAGE_TYPE_ENG_BOOL, /**< CB message English */ - MSG_CB_LANGUAGE_TYPE_GER_BOOL, /**< CB message Germany */ - MSG_CB_LANGUAGE_TYPE_FRE_BOOL, /**< CB message France */ - MSG_CB_LANGUAGE_TYPE_ITA_BOOL, /**< CB message Italy */ - MSG_CB_LANGUAGE_TYPE_NED_BOOL, /**< CB message Netherland */ - MSG_CB_LANGUAGE_TYPE_SPA_BOOL, /**< CB message Spain */ - MSG_CB_LANGUAGE_TYPE_POR_BOOL, /**< CB message Portugal */ - MSG_CB_LANGUAGE_TYPE_SWE_BOOL, /**< CB message Sweden */ - MSG_CB_LANGUAGE_TYPE_TUR_BOOL, /**< CB message Turkey */ -}; - + MSG_CB_RECEIVE_BOOL = MSG_STRUCT_SETTING_CB_OPT+1, /**< Indicates whether the CB message is received or not. */ + MSG_CB_MAX_SIM_COUNT_INT, /**< Indicates the number of channels which can be stored in SIM. */ + MSG_CB_CHANNEL_LIST_STRUCT, /**< Indicates the cell broadcasting channel information. */ + MSG_CB_LANGUAGE_TYPE_ALL_BOOL, /**< CB message all languages */ + MSG_CB_LANGUAGE_TYPE_ENG_BOOL, /**< CB message English */ + MSG_CB_LANGUAGE_TYPE_GER_BOOL, /**< CB message Germany */ + MSG_CB_LANGUAGE_TYPE_FRE_BOOL, /**< CB message France */ + MSG_CB_LANGUAGE_TYPE_ITA_BOOL, /**< CB message Italy */ + MSG_CB_LANGUAGE_TYPE_NED_BOOL, /**< CB message Netherland */ + MSG_CB_LANGUAGE_TYPE_SPA_BOOL, /**< CB message Spain */ + MSG_CB_LANGUAGE_TYPE_POR_BOOL, /**< CB message Portugal */ + MSG_CB_LANGUAGE_TYPE_SWE_BOOL, /**< CB message Sweden */ + MSG_CB_LANGUAGE_TYPE_TUR_BOOL, /**< CB message Turkey */ + MSG_CB_SIM_INDEX_INT, /**< Indicates the sim index */ +}; + +/** + * @brief Enumeration for the values of setting for CB channel informations. \n + * This enum is used as member of #msg_struct_t for MSG_STRUCT_SETTING_CB_CHANNEL_INFO. + */ enum _MSG_STRUCT_CB_CHANNEL_INFO_E { - MSG_CB_CHANNEL_ACTIVATE_BOOL = MSG_STRUCT_SETTING_CB_CHANNEL_INFO+1, /**< Indicates whether the CB channel is activate or passive. */ - MSG_CB_CHANNEL_ID_FROM_INT, /**< Indicates the ID of a CB channel. */ - MSG_CB_CHANNEL_ID_TO_INT, /**< Indicates the ID of a CB channel. */ - MSG_CB_CHANNEL_NAME_STR /**< Indicates the name of a CB channel. */ + MSG_CB_CHANNEL_ACTIVATE_BOOL = MSG_STRUCT_SETTING_CB_CHANNEL_INFO+1, /**< Indicates whether the CB channel is activate or passive. */ + MSG_CB_CHANNEL_ID_FROM_INT, /**< Indicates the From ID of a CB channel. */ + MSG_CB_CHANNEL_ID_TO_INT, /**< Indicates the To ID of a CB channel. */ + MSG_CB_CHANNEL_NAME_STR /**< Indicates the name of a CB channel. */ }; +/** + * @brief Enumeration for the values of setting for SMS sending options. \n + * This enum is used as member of #msg_struct_t for MSG_STRUCT_SETTING_SMS_SEND_OPT. + */ enum _MSG_STRUCT_SMS_SEND_OPT_E { - MSG_SMS_SENDOPT_ENCODE_TYPE_INT = MSG_STRUCT_SETTING_SMS_SEND_OPT+1, /**< Indicates the string encoding type. See enum _MSG_ENCODE_TYPE_E*/ - MSG_SMS_SENDOPT_NETWORK_MODE_INT, /**< Indicates the network mode (CS/PS) to send SMS. See enum _MSG_SMS_NETWORK_MODE_E*/ - MSG_SMS_SENDOPT_REPLY_PATH_BOOL, /**< Indicates whether the SMS reply path is set or not. */ - MSG_SMS_SENDOPT_DELIVERY_REPORT_BOOL, /**< Indicates whether the SMS delivery report will be sent or not. */ - MSG_SMS_SENDOPT_SAVE_STORAGE_INT /**< Indicates the default storage to save SMS. See enum _MSG_SMS_SAVE_STORAGE_E */ + MSG_SMS_SENDOPT_ENCODE_TYPE_INT = MSG_STRUCT_SETTING_SMS_SEND_OPT+1, /**< Indicates the string encoding type. See enum _MSG_ENCODE_TYPE_E*/ + MSG_SMS_SENDOPT_NETWORK_MODE_INT, /**< Indicates the network mode (CS/PS) to send SMS. See enum _MSG_SMS_NETWORK_MODE_E*/ + MSG_SMS_SENDOPT_REPLY_PATH_BOOL, /**< Indicates whether the SMS reply path is set or not. */ + MSG_SMS_SENDOPT_DELIVERY_REPORT_BOOL, /**< Indicates whether the SMS delivery report will be sent or not. */ + MSG_SMS_SENDOPT_SAVE_STORAGE_INT /**< Indicates the default storage to save SMS. See enum _MSG_SMS_SAVE_STORAGE_E */ }; +/** + * @brief Enumeration for the values of setting for MMS sending options. \n + * This enum is used as member of #msg_struct_t for MSG_STRUCT_SETTING_MMS_SEND_OPT. + */ enum _MSG_STRUCT_MMS_SEND_OPT_E { - MSG_MMS_SENDOPT_CLASS_TYPE_INT = MSG_STRUCT_SETTING_MMS_SEND_OPT+1, /**< Indicates the class type of message. See enum _MSG_MMS_MSG_CLASS_TYPE_E */ - MSG_MMS_SENDOPT_PRIORITY_TYPE_INT, /**< Indicates the priority of the message. See enum _MSG_PRIORITY_TYPE_E */ - MSG_MMS_SENDOPT_EXPIRY_TIME_INT, /**< Indicates the time when the message is to be removed from the MMSC. See enum _MSG_MMS_EXPIRY_TIME_E */ - MSG_MMS_SENDOPT_DELIVERY_TIME_INT, /**< Indicates the message transmission time which is set in the MMSC. See enum _MSG_MMS_DELIVERY_TIME_E */ - MSG_MMS_SENDOPT_CUSTOM_DELIVERY_TIME_INT, /**< Indicates the message transmission time which is set in the MMSC. */ - MSG_MMS_SENDOPT_SENDER_VISIBILITY_BOOL, /**< Indicates whether the address is hidden or not. */ - MSG_MMS_SENDOPT_DELIVERY_REPORT_BOOL, /**< Indicates whether the delivery report will be sent or not. */ - MSG_MMS_SENDOPT_READ_REPLY_BOOL, /**< Indicates whether the read report will be sent or not. */ - MSG_MMS_SENDOPT_KEEP_COPY_BOOL, /**< Indicates whether the message copy is kept or not. */ - MSG_MMS_SENDOPT_BODY_REPLYING_BOOL, /**< Indicates whether the body is included when replying or not. */ - MSG_MMS_SENDOPT_HIDE_RECIPIENTS_BOOL, /**< Indicates whether the recipients are hidden or not. */ - MSG_MMS_SENDOPT_REPLY_CHARGING_INT, /**< Indicates the reply charging type of message. See enum _MSG_MMS_REPLY_CHARGING_TYPE_E */ - MSG_MMS_SENDOPT_REPLY_CHARGING_DEADLINE_INT, /**< Indicates the deadline for replying charging. is set in the MMSC. */ - MSG_MMS_SENDOPT_REPLY_CHARGING_SIZE_INT, /**< Indicates the reply charging size. */ - MSG_MMS_SENDOPT_CREATION_MODE_INT /**< Indicates the creation mode of MMS. See enum _MSG_MMS_CREATION_MODE_E */ -}; - + MSG_MMS_SENDOPT_CLASS_TYPE_INT = MSG_STRUCT_SETTING_MMS_SEND_OPT+1, /**< Indicates the class type of message. See enum _MSG_MMS_MSG_CLASS_TYPE_E */ + MSG_MMS_SENDOPT_PRIORITY_TYPE_INT, /**< Indicates the priority of the message. See enum _MSG_PRIORITY_TYPE_E */ + MSG_MMS_SENDOPT_EXPIRY_TIME_INT, /**< Indicates the time when the message is to be removed from the MMSC. See enum _MSG_MMS_EXPIRY_TIME_E */ + MSG_MMS_SENDOPT_DELIVERY_TIME_INT, /**< Indicates the message transmission time which is set in the MMSC. See enum _MSG_MMS_DELIVERY_TIME_E */ + MSG_MMS_SENDOPT_CUSTOM_DELIVERY_TIME_INT, /**< Indicates the message transmission time which is set in the MMSC. */ + MSG_MMS_SENDOPT_SENDER_VISIBILITY_BOOL, /**< Indicates whether the address is hidden or not. */ + MSG_MMS_SENDOPT_DELIVERY_REPORT_BOOL, /**< Indicates whether the delivery report will be sent or not. */ + MSG_MMS_SENDOPT_READ_REPLY_BOOL, /**< Indicates whether the read report will be sent or not. */ + MSG_MMS_SENDOPT_KEEP_COPY_BOOL, /**< Indicates whether the message copy is kept or not. */ + MSG_MMS_SENDOPT_BODY_REPLYING_BOOL, /**< Indicates whether the body is included when replying or not. */ + MSG_MMS_SENDOPT_HIDE_RECIPIENTS_BOOL, /**< Indicates whether the recipients are hidden or not. */ + MSG_MMS_SENDOPT_REPLY_CHARGING_INT, /**< Indicates the reply charging type of message. See enum _MSG_MMS_REPLY_CHARGING_TYPE_E */ + MSG_MMS_SENDOPT_REPLY_CHARGING_DEADLINE_INT, /**< Indicates the deadline for replying charging. is set in the MMSC. */ + MSG_MMS_SENDOPT_REPLY_CHARGING_SIZE_INT, /**< Indicates the reply charging size. */ + MSG_MMS_SENDOPT_CREATION_MODE_INT /**< Indicates the creation mode of MMS. See enum _MSG_MMS_CREATION_MODE_E */ +}; + +/** + * @brief Enumeration for the values of setting for MMS receiving options. \n + * This enum is used as member of #msg_struct_t for MSG_STRUCT_SETTING_MMS_RECV_OPT. + */ enum _MSG_STRUCT_MMS_RECV_OPT_E { - MSG_MMS_RECVOPT_HOME_RETRIEVE_TYPE_INT = MSG_STRUCT_SETTING_MMS_RECV_OPT+1, /**< Indicates the retrieve type for MMS home network. See enum _MSG_MMS_HOME_RETRIEVE_TYPE_E */ - MSG_MMS_RECVOPT_ABROAD_RETRIEVE_TYPE_INT, /**< Indicates the retrieve type for MMS abroad network. See enum _MSG_MMS_ABROAD_RETRIEVE_TYPE_E */ - MSG_MMS_RECVOPT_READ_REPORT_BOOL, /**< Indicates whether the read report will be sent or not. */ - MSG_MMS_RECVOPT_DELIVERY_REPORT_BOOL, /**< Indicates whether the delivery report will be sent or not. */ - MSG_MMS_RECVOPT_REJECT_UNKNOWN_BOOL, /**< Indicates whether unknown addresses are rejected or not. */ - MSG_MMS_RECVOPT_REJECT_ADVERTISEMENT_BOOL /**< Indicates whether advertisement is rejected or not. */ + MSG_MMS_RECVOPT_HOME_RETRIEVE_TYPE_INT = MSG_STRUCT_SETTING_MMS_RECV_OPT+1, /**< Indicates the retrieve type for MMS home network. See enum _MSG_MMS_HOME_RETRIEVE_TYPE_E */ + MSG_MMS_RECVOPT_ABROAD_RETRIEVE_TYPE_INT, /**< Indicates the retrieve type for MMS abroad network. See enum _MSG_MMS_ABROAD_RETRIEVE_TYPE_E */ + MSG_MMS_RECVOPT_READ_REPORT_BOOL, /**< Indicates whether the read report will be sent or not. */ + MSG_MMS_RECVOPT_DELIVERY_REPORT_BOOL, /**< Indicates whether the delivery report will be sent or not. */ + MSG_MMS_RECVOPT_REJECT_UNKNOWN_BOOL, /**< Indicates whether unknown addresses are rejected or not. */ + MSG_MMS_RECVOPT_REJECT_ADVERTISEMENT_BOOL /**< Indicates whether advertisement is rejected or not. */ }; +/** + * @brief Enumeration for the values of setting for general options. \n + * This enum is used as member of #msg_struct_t for MSG_STRUCT_SETTING_GENERAL_OPT. + */ enum _MSG_STRUCT_GENERAL_OPT_E { - MSG_GENERAL_KEEP_COPY_BOOL = MSG_STRUCT_SETTING_GENERAL_OPT+1, /**< Indicates whether the SMS message copy is kept or not. */ - MSG_GENERAL_ALERT_TONE_INT, /**< Indicates the period of playing alert tone. See enum _MSG_ALERT_TONE_E */ - MSG_GENERAL_AUTO_ERASE_BOOL /**< Indicates whether the auto-erase option is enabled or not. */ + MSG_GENERAL_KEEP_COPY_BOOL = MSG_STRUCT_SETTING_GENERAL_OPT+1, /**< Indicates whether the SMS message copy is kept or not. */ + MSG_GENERAL_ALERT_TONE_INT, /**< Indicates the period of playing alert tone. See enum _MSG_ALERT_TONE_E */ + MSG_GENERAL_AUTO_ERASE_BOOL, /**< Indicates whether the auto-erase option is enabled or not. */ + MSG_GENERAL_BLOCK_UNKNOWN_NUMBER_BOOL, /**< Indicates whether unknown sender message is blocked or not. */ + MSG_GENERAL_SMS_LIMIT_CNT_INT, /**< Indicates the count limitation of SMS messages in one conversation */ + MSG_GENERAL_MMS_LIMIT_CNT_INT, /**< Indicates the count limitation of MMS messages in one conversation */ + MSG_GENERAL_MSG_NOTIFICATION_BOOL, /**< Indicates whether notification for incoming message is shown or not. */ + MSG_GENERAL_MSG_VIBRATION_BOOL, /**< Indicates whether vibration for incoming message is run or not. */ + MSG_GENERAL_MSG_PREVIEW_BOOL, /**< Indicates whether preview for incoming message is shown or not. */ + MSG_GENERAL_RINGTONE_TYPE_INT, /**< Indicates the message ringtone type. */ + MSG_GENERAL_RINGTONE_PATH_STR, /**< Indicates the message ringtone path */ + MSG_GENERAL_MSG_SEARCH_TAGS_INT /**< Indicates the tags to be enabled for search ex) MSG_MESSAGE_TAG_PRIMARY | MSG_MESSAGE_TAG_PROMOTION. See enum _MSG_TAG_TYPE_E */ }; +/** + * @brief Enumeration for the values of setting for push message options. \n + * This enum is used as member of #msg_struct_t for MSG_STRUCT_SETTING_PUSH_MSG_OPT. + */ enum _MSG_STRUCT_PUSH_MSG_OPT_E { - MSG_PUSHMSG_RECEIVE_BOOL = MSG_STRUCT_SETTING_PUSH_MSG_OPT+1, /**< Indicates whether the push message is received or not. */ - MSG_PUSHMSG_SERVICE_TYPE_INT /**< Indicates the service type of a push message. See enum _MSG_PUSH_SERVICE_TYPE_E */ + MSG_PUSHMSG_RECEIVE_BOOL = MSG_STRUCT_SETTING_PUSH_MSG_OPT+1, /**< Indicates whether the push message is received or not. */ + MSG_PUSHMSG_SERVICE_TYPE_INT /**< Indicates the service type of a push message. See enum _MSG_PUSH_SERVICE_TYPE_E */ }; +/** + * @brief Enumeration for the values of setting for voice message options. \n + * This enum is used as member of #msg_struct_t for MSG_STRUCT_SETTING_VOICE_MSG_OPT. + */ enum _MSG_STRUCT_VOICE_MSG_OPT_E { - MSG_VOICEMSG_ADDRESS_STR = MSG_STRUCT_SETTING_VOICE_MSG_OPT+1, /**< Indicates the address for voice message. */ + MSG_VOICEMSG_ADDRESS_STR = MSG_STRUCT_SETTING_VOICE_MSG_OPT+1, /**< Indicates the address for voice message. */ + MSG_VOICEMSG_ALPHA_ID_STR, /**< Indicates the alpha id for voice message address. */ + MSG_VOICEMSG_SIM_INDEX_INT /**< Indicates the SIM index for voice message. */ }; + +/** + * @brief Enumeration for the values of setting for message size option. \n + * This enum is used as member of #msg_struct_t for MSG_STRUCT_SETTING_MSGSIZE_OPT. + */ enum _MSG_STRUCT_MSGSISE_OPT_E { - MSG_MESSAGE_SIZE_INT = MSG_STRUCT_SETTING_MSGSIZE_OPT+1, /**< Indicates the message size */ + MSG_MESSAGE_SIZE_INT = MSG_STRUCT_SETTING_MSGSIZE_OPT+1, /**< Indicates the message size */ }; -//MSG_MMS_DATA +/** + * @brief Enumeration for the values of MMS detail informations. \n + * This enum is used as member of #msg_struct_t for MSG_STRUCT_MMS. + */ enum MSG_MMS_INFO_E { - MSG_MMS_PAGE_LIST_HND = MSG_STRUCT_MMS+1, /**< The pointer to SMIL pages list */ - MSG_MMS_REGION_LIST_HND, /**< The pointer to SMIL regions list */ - MSG_MMS_ATTACH_LIST_HND, /**< The pointer to attachment list */ - MSG_MMS_TRANSITION_LIST_HND, /**< The pointer to SMIL transitions list */ - MSG_MMS_META_LIST_HND, /**< The pointer to SMIL meta list */ - MSG_MMS_ROOTLAYOUT_WIDTH_INT, /**< Indicates the width of the root layout */ - MSG_MMS_ROOTLAYOUT_WIDTH_PERCENT_BOOL, /**< Indicates the length is in percentage(%) or not */ - MSG_MMS_ROOTLAYOUT_HEIGHT_INT, /**< Indicates the height of the root layout */ - MSG_MMS_ROOTLAYOUT_HEIGHT_PERCENT_BOOL, /**< Indicates the length is in percentage(%) or not */ - MSG_MMS_ROOTLAYOUT_BGCOLOR_INT, /**< Indicates the background color of the root layout */ - MSG_MMS_ROOTLAYOUT_BGCOLOR_BOOL, /**< Indicates the background color is set in the root layout */ -}; - -//MSG_MMS_PAGE + MSG_MMS_PAGE_LIST_HND = MSG_STRUCT_MMS+1, /**< The pointer to SMIL pages list */ + MSG_MMS_REGION_LIST_HND, /**< The pointer to SMIL regions list */ + MSG_MMS_ATTACH_LIST_HND, /**< The pointer to attachment list */ + MSG_MMS_TRANSITION_LIST_HND, /**< The pointer to SMIL transitions list */ + MSG_MMS_META_LIST_HND, /**< The pointer to SMIL meta list */ + MSG_MMS_ROOTLAYOUT_WIDTH_INT, /**< Indicates the width of the root layout */ + MSG_MMS_ROOTLAYOUT_WIDTH_PERCENT_BOOL, /**< Indicates the length is in percentage(%) or not */ + MSG_MMS_ROOTLAYOUT_HEIGHT_INT, /**< Indicates the height of the root layout */ + MSG_MMS_ROOTLAYOUT_HEIGHT_PERCENT_BOOL, /**< Indicates the length is in percentage(%) or not */ + MSG_MMS_ROOTLAYOUT_BGCOLOR_INT, /**< Indicates the background color of the root layout */ + MSG_MMS_ROOTLAYOUT_BGCOLOR_BOOL, /**< Indicates the background color is set in the root layout */ + MSG_MMS_HEADER_BCC_ADDRESS_LIST_HND, /**< The pointer to BCC address list */ + MSG_MMS_HEADER_CC_ADDRESS_LIST_HND, /**< The pointer to CC address list */ + MSG_MMS_HEADER_CONTENT_LOCATION_STR, /**< Indicates contentLocation in MMS header */ + MSG_MMS_HEADER_CONTENT_TYPE_STR, /**< Indicates szContentType in MMS header. ex) application/vnd.wap.multipart.related */ + MSG_MMS_HEADER_DATE_INT, /**< Indicates date in MMS header */ + MSG_MMS_HEADER_DELIVERY_REPORT_INT, /**< Indicates X-Mms-Delivery-Report */ + MSG_MMS_HEADER_DELIVERY_TIME_INT, /**< Indicates X-Mms-Delivery-Time */ + MSG_MMS_HEADER_EXPIRY_TIME_INT, /**< Indicates X-Mms-Expiry-Time */ + MSG_MMS_HEADER_FROM_STR, /**< Indicates FROM address in header */ + MSG_MMS_HEADER_MESSAGE_CLASS_INT, /**< Indicates messageClassin in header. ex) Personal | Advertisement | Informational | Auto */ + MSG_MMS_HEADER_MESSAGE_ID_STR, /**< Indicates messageID in header*/ + MSG_MMS_HEADER_MESSAGE_TYPE_INT, /**< Indicates MmsMsgTypein header. ex) sendreq */ + MSG_MMS_HEADER_VERSION_INT, /**< Indicates mmsVersion in header. ex) 1.0 1.3 etc */ + MSG_MMS_HEADER_SIZE_INT, /**< Indicates X-Mms-Message-Size */ + MSG_MMS_HEADER_PRIORITY_INT, /**< Indicates _MSG_PRIORITY_TYPE_E in header: Low | Normal | High */ + MSG_MMS_HEADER_READ_REPORT_INT, /**< Indicates X-Mms-Read-Report */ + MSG_MMS_HEADER_HIDE_ADDRESS_INT, /**< Indicates X-Mms-Sender-Visibility */ + MSG_MMS_HEADER_MMS_STATUS_INT, /**< Indicates X-Mms-Status */ + MSG_MMS_HEADER_TO_ADDRESS_LIST_HND, /**< The pointer to 'TO' address list in header*/ + MSG_MMS_HEADER_TR_ID_STR, /**< Indicates thread ID in header */ + MSG_MMS_HEADER_CONTENT_CLASS_INT, /**< Indicates contentClass in header. ex) text | image-basic| image-rich | video-basic | video-rich | megapixel | content-basic | content-rich */ + MSG_MMS_SMIL_MULTIPART_CONTENT_TYPE_STR, /**< Indicates multipart content type in header*/ + MSG_MMS_SMIL_MULTIPART_NAME_STR, /** +#include #include #include @@ -102,6 +102,14 @@ typedef struct } MSG_STORAGE_CHANGE_CB_ITEM_S; +typedef struct +{ + MsgHandle* hAddr; + msg_report_msg_incoming_cb pfReportMsgIncomingCB; + void* userParam; +} MSG_REPORT_INCOMING_CB_ITEM_S; + + typedef std::list MsgSentStatusCBList; typedef std::list MsgNewMessageCBList; typedef std::list MsgNewMMSConfMessageCBList; @@ -111,7 +119,8 @@ typedef std::list MsgNewSyncMLMessageCBList; typedef std::list MsgNewLBSMessageCBList; typedef std::list MsgOperationSyncMLMessageCBList; typedef std::list MsgStorageChangeCBList; - +typedef std::list MsgReportMessageCBList; +typedef std::set handle_set; /*================================================================================================== CLASS DEFINITIONS @@ -121,7 +130,7 @@ class MsgProxyListener public: static MsgProxyListener* instance(); - void start(); + void start(MsgHandle* pMsgHandle); void stop(); bool regSentStatusEventCB(MsgHandle* pMsgHandle, msg_sent_status_cb pfSentStatus, void *pUserParam); @@ -133,6 +142,7 @@ public: bool regLBSMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_lbs_msg_incoming_cb pfNewLBSMsgIncoming, void *pUserParam); bool regSyncMLMessageOperationEventCB(MsgHandle* pMsgHandle, msg_syncml_msg_operation_cb pfSyncMLMessageOperation, void *pUserParam); bool regStorageChangeEventCB(MsgHandle* pMsgHandle, msg_storage_change_cb pfStorageChangeOperation, void *pUserParam); + bool regReportMsgIncomingCB(MsgHandle* pMsgHandle, msg_report_msg_incoming_cb pfReportMessage, void *pUserParam); void clearListOfClosedHandle(MsgHandle* pMsgHandle); @@ -140,6 +150,7 @@ public: int getRemoteFd(); int readFromSocket(char** buf, unsigned int* len); + void resetProxyListener(); #ifdef CHECK_SENT_STATUS_CALLBACK int getSentStatusCbCnt(); #endif @@ -152,6 +163,8 @@ private: unsigned int running; + handle_set openHandleSet; + MsgIpcClientSocket cliSock; Mutex mx; @@ -166,6 +179,7 @@ private: MsgNewLBSMessageCBList newLBSMessageCBList; MsgOperationSyncMLMessageCBList operationSyncMLMessageCBList; MsgStorageChangeCBList storageChangeCBList; + MsgReportMessageCBList reportMessageCBList; GIOChannel *channel; guint eventSourceId; diff --git a/include/utils/MsgContact.h b/include/utils/MsgContact.h index 4f1bf66..e12e1fb 100755 --- a/include/utils/MsgContact.h +++ b/include/utils/MsgContact.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_CONTACT_H @@ -35,7 +35,9 @@ msg_error_t MsgCloseContactSvc(); msg_error_t MsgInitContactSvc(MsgContactChangeCB cb); msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_INFO_S *pContactInfo); +msg_error_t MsgGetContactSearchList(const char *pSearchVal, MSG_ADDRESS_INFO_S **pAddrInfo, int *count); +void MsgSyncAddressbook(); void MsgSyncContact(); bool MsgInsertContact(MSG_CONTACT_INFO_S *pContactInfo, const char *pNumber); @@ -43,6 +45,7 @@ bool MsgUpdateContact(int index, int type); bool MsgDeleteContact(int index); int MsgGetContactNameOrder(); +msg_error_t MsgGetContactStyleDisplayName(const char *first, const char *last, const char *middle, const char *prefix, const char *suffix, int contactNameOrder, char *displayName, unsigned int size); void MsgAddPhoneLog(const MSG_MESSAGE_INFO_S *pMsgInfo); void MsgDeletePhoneLog(msg_message_id_t msgId); @@ -50,6 +53,10 @@ void MsgDeletePhoneLog(msg_message_id_t msgId); int MsgContactSVCBeginTrans(); int MsgContactSVCEndTrans(bool bSuccess); +bool checkBlockingMode(char *address, bool *pisFavorites); +int MsgContactGetMinMatchDigit(); +void MsgConvertNumber(const char* pSrcNum, char* pDestNum, int destSize); +bool MsgIsNumber(const char* pSrc); #endif //MSG_CONTACT_H diff --git a/include/utils/MsgDebug.h b/include/utils/MsgDebug.h index 98d44e7..8cb07d5 100755 --- a/include/utils/MsgDebug.h +++ b/include/utils/MsgDebug.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef __MSG_DEBUG_H__ @@ -25,15 +25,9 @@ #include #include #include +#include -#include "MsgTypes.h" #include "MsgCmdTypes.h" -#include "MsgFilterTypes.h" - -extern "C"{ - #include -}; - /*================================================================================================== DEFINES @@ -45,107 +39,66 @@ extern "C"{ #define MSG_MMS_VALID_TAG "VLD_MMS" #define DLOG_ENABLE -//#define LOG_ENABLE - - -/*================================================================================================== - FUNCTION PROTOTYPES -==================================================================================================*/ -int get_tid(); - #if defined(DLOG_ENABLE) -#define MSG_FATAL(fmt, ...) \ - do \ +/*log macros*/ +#define MSG_BEGIN()\ + do\ {\ - SLOGD(" ERROR << " fmt " >>\n\n", ##__VA_ARGS__);\ - } while (0) + SLOGD(" BEGIN >>>> \n");\ + } while(0) -#define MSG_DEBUG(fmt, ...)\ +#define MSG_END()\ do\ {\ - SLOGD(fmt"\n\n", ##__VA_ARGS__);\ - } while (0) + SLOGD(" END <<<< \n");\ + } while(0) -#define MSG_BEGIN() \ +#define MSG_DEBUG(fmt, ...)\ do\ - {\ - SLOGD(" BEGIN >>>> \n\n");\ - } while( 0 ) + {\ + SLOGD(fmt"\n", ##__VA_ARGS__);\ + } while(0) -#define MSG_END() \ +#define MSG_INFO(fmt, ...)\ do\ - {\ - SLOGD(" END <<<< \n\n");\ - } while( 0 ) + {\ + SLOGI("* Info * " fmt "\n", ##__VA_ARGS__);\ + } while(0) -#define MSG_INFO(fmt, args...)\ +#define MSG_WARN(fmt, ...)\ do\ {\ - SLOGI("* Info * " fmt "\n\n", ##args);\ - } while( 0 ) - -#define MSG_WARN(fmt, args...)\ - do {\ - SLOGW("* Warning * " fmt "\n\n", ##args)\ - } while( 0 ) - -#define MSG_ERR(fmt, args...)\ - do {\ - SLOGE("* Error * " fmt "\n\n", ##args);\ - } while( 0 ) - + SLOGW("* Warning * " fmt "\n", ##__VA_ARGS__);\ + } while(0) -#define MSG_ERR_RET_VM(expr, val, fmt, arg...)\ - do {\ - if (expr) {\ - MSG_ERR(fmt, ##arg);\ - return (val);\ - }\ - } while (0) - -#define MSG_ERR_RET_M(expr, fmt, arg...)\ - do {\ - if (expr) {\ - MSG_ERR(fmt, ##arg);\ - return;\ - }\ - } while (0) +#define MSG_ERR(fmt, ...)\ + do\ + {\ + SLOGE("* Error * " fmt "\n", ##__VA_ARGS__);\ + } while(0) -#define MSG_WARN_M(expr, fmt, arg...)\ - do {\ - if (expr) {\ - MSG_WARN(fmt, ##arg);\ - }\ - } while (0) +#define MSG_FATAL(fmt, ...)\ + do\ + {\ + SLOGE(" ERROR << " fmt " >>\n", ##__VA_ARGS__);\ + } while(0) -#define MSG_PROFILE_BEGIN(pfid) \ - unsigned int __prf_l1_##pfid = __LINE__; \ - struct timeval __prf_1_##pfid; \ - struct timeval __prf_2_##pfid; \ - do { \ - gettimeofday(&__prf_1_##pfid, 0); \ +/*secure log macros*/ +#define MSG_SEC_DEBUG(fmt, ...)\ + do\ + {\ + SECURE_SLOGD(fmt"\n", ##__VA_ARGS__);\ } while (0) -#define MSG_PROFILE_END(pfid) \ - unsigned int __prf_l2_##pfid = __LINE__;\ - do { \ - gettimeofday(&__prf_2_##pfid, 0);\ - long __ds = __prf_2_##pfid.tv_sec - __prf_1_##pfid.tv_sec;\ - long __dm = __prf_2_##pfid.tv_usec - __prf_1_##pfid.tv_usec;\ - if ( __dm < 0 ) { __ds--; __dm = 1000000 + __dm; } \ - SLOG(LOG_DEBUG, USER_TAG, "**PROFILE** [MSGFW: %s: %s() %u ~ %u] " #pfid \ - " -> Elapsed Time: %u.%06u seconds\n", \ - rindex(__FILE__, '/')+1, \ - __FUNCTION__, \ - __prf_l1_##pfid, \ - __prf_l2_##pfid, \ - (unsigned int)(__ds), \ - (unsigned int)(__dm)); \ +#define MSG_SEC_INFO(fmt, ...)\ + do\ + {\ + SECURE_SLOGI("* Info * " fmt"\n", ##__VA_ARGS__);\ } while (0) - +/*valid data log macros*/ #define MSG_SMS_VLD_INFO(fmt, ...)\ do\ {\ @@ -176,8 +129,62 @@ int get_tid(); SLOG(LOG_DEBUG, MSG_MMS_VALID_TAG, "[MMS FILE]%s, "fmt"\n", __TIMESTAMP__, ##__VA_ARGS__);\ } while (0) +/*err & warn return message log macros*/ +#define MSG_ERR_RET_VM(expr, val, fmt, ...)\ + do\ + {\ + if (expr) {\ + MSG_ERR(fmt, ##__VA_ARGS__);\ + return (val);\ + }\ + } while(0) + +#define MSG_ERR_RET_M(expr, fmt, ...)\ + do\ + {\ + if (expr) {\ + MSG_ERR(fmt, ##__VA_ARGS__);\ + return;\ + }\ + } while(0) + +#define MSG_WARN_M(expr, fmt, ...)\ + do\ + {\ + if (expr) {\ + MSG_WARN(fmt, ##__VA_ARGS__);\ + }\ + } while(0) + +/*profile log macros*/ +#define MSG_PROFILE_BEGIN(pfid) \ + unsigned int __prf_l1_##pfid = __LINE__;\ + struct timeval __prf_1_##pfid;\ + struct timeval __prf_2_##pfid;\ + do {\ + gettimeofday(&__prf_1_##pfid, 0);\ + } while (0) + +#define MSG_PROFILE_END(pfid) \ + unsigned int __prf_l2_##pfid = __LINE__;\ + do { \ + gettimeofday(&__prf_2_##pfid, 0);\ + long __ds = __prf_2_##pfid.tv_sec - __prf_1_##pfid.tv_sec;\ + long __dm = __prf_2_##pfid.tv_usec - __prf_1_##pfid.tv_usec;\ + if ( __dm < 0 ) { __ds--; __dm = 1000000 + __dm; } \ + SLOGD("**PROFILE** [MSGFW: %s: %s() %u ~ %u] " #pfid " -> Elapsed Time: %u.%06u seconds\n",\ + rindex(__FILE__, '/')+1,\ + __FUNCTION__, \ + __prf_l1_##pfid,\ + __prf_l2_##pfid,\ + (unsigned int)(__ds),\ + (unsigned int)(__dm));\ + } while (0) + #elif defined(LOG_ENABLE) +int get_tid(); + #define MSG_FATAL(fmt, ...) \ do \ {\ @@ -262,6 +269,19 @@ int get_tid(); #endif + +#define MSG_FREE(x) \ + ({\ + if (x != NULL){\ + free(x);\ + x = NULL;}\ + }) + + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ + const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType); const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType); diff --git a/include/utils/MsgDrmWrapper.h b/include/utils/MsgDrmWrapper.h index 7ff4d7d..b1a8779 100755 --- a/include/utils/MsgDrmWrapper.h +++ b/include/utils/MsgDrmWrapper.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef __MSG_DRM_WRAPPER_H_ @@ -41,6 +41,7 @@ bool MsgDrmGetMimeTypeEx(const char *szFileName, char *szMimeType, int nMimeType bool MsgDrmGetContentID(const char *szFileName, char *szContentID, int nContentIDLen); bool MsgDrmGetDrmType(const char *szFileName, MSG_DRM_TYPE *eDRMType); bool MsgDrmConvertDmtoDcfType(char *inputFile, char *outputFile); +bool MsgDrmCheckRingtone(const char *ringtonePath); #ifdef __cplusplus } diff --git a/include/utils/MsgException.h b/include/utils/MsgException.h index 23ef2c7..5d4c73f 100755 --- a/include/utils/MsgException.h +++ b/include/utils/MsgException.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_EXCEPTION_H diff --git a/include/utils/MsgGconfWrapper.h b/include/utils/MsgGconfWrapper.h index c8b8b90..0c9793a 100755 --- a/include/utils/MsgGconfWrapper.h +++ b/include/utils/MsgGconfWrapper.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_GCONF_WRAPPER_H @@ -54,11 +54,10 @@ char* MsgSettingGetString(const char *pKey); int MsgSettingGetInt(const char *pKey); int MsgSettingGetBool(const char *pKey, bool *pVal); -void MsgChangePmState(); msg_error_t MsgSettingHandleNewMsg(int SmsCnt, int MmsCnt); msg_error_t MsgSettingSetIndicator(int SmsCnt, int MmsCnt); -bool MsgSettingGetAutoReject(); +int MsgSettingGetAutoReject(); bool MsgSettingGetUnknownAutoReject(); void MsgSettingRegVconfCB(); @@ -67,4 +66,7 @@ void MsgSettingRemoveVconfCB(); void MsgSettingRegVconfCBCommon(const char *pKey, _vconf_change_cb pCb); void MsgSettingRemoveVconfCBCommon(const char *pKey, _vconf_change_cb pCb); +#ifdef MSG_PENDING_PUSH_MESSAGE +msg_error_t MsgSendPendingPushMsg(void); +#endif #endif // MSG_GCONF_WRAPPER_H diff --git a/include/utils/MsgIpcSocket.h b/include/utils/MsgIpcSocket.h index 2cafe03..8795d48 100755 --- a/include/utils/MsgIpcSocket.h +++ b/include/utils/MsgIpcSocket.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef __IPCSocket_H__ @@ -73,6 +73,7 @@ public: private: int readn(char *buf, unsigned int len ); int writen (const char *buf, unsigned int len); + bool wait_for_reply(); int sockfd, remotefd, maxfd; fd_set fds; diff --git a/include/utils/MsgJsonParser.h b/include/utils/MsgJsonParser.h new file mode 100755 index 0000000..9cebec0 --- /dev/null +++ b/include/utils/MsgJsonParser.h @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +#ifndef __MSG_JSON_PARSER_H__ +#define __MSG_JSON_PARSER_H__ + +#include +#include "MsgDebug.h" + +#define MSG_JSON_OBJ_SET_STR(json_obj, key, val)\ + if(json_obj && key && val){\ + json_object_set_string_member(json_obj, key, val);\ + } else {\ + MSG_DEBUG("Error : json_obj = %p, key = %s, val = %s", json_obj, key, val);\ + } + +#define MSG_JSON_OBJ_SET_INT(json_obj, key, val)\ + if(json_obj && key){\ + json_object_set_int_member(json_obj, key, val);\ + } else {\ + MSG_DEBUG("Error : json_obj = %p, key = %s, val = %d", json_obj, key, val);\ + } + +#define MSG_JSON_OBJ_SET_OBJ(json_obj, key, val)\ + if(json_obj && key){\ + json_object_set_object_member(json_obj, key, val);\ + } else {\ + MSG_DEBUG("Error : json_obj = %p, key = %s, val = %p", json_obj, key, val);\ + } + +#define MSG_JSON_OBJ_SET_ARRAY(json_obj, key, json_array)\ + if(json_obj && key && json_array){\ + json_object_set_array_member(json_obj, key, json_array);\ + } else {\ + MSG_DEBUG("Error : json_obj = %p, key = %s, json_array = %p", json_obj, key, json_array);\ + } + +#define MSG_JSON_ARRAY_ADD_OBJECT(json_array, json_obj)\ + if(json_array && json_obj){\ + json_array_add_object_element(json_array, json_obj);\ + } else {\ + MSG_DEBUG("Error : json_array = %p, json_obj = %p", json_array, json_obj);\ + } + +#define MSG_PRINT_PARSER_OBJECT(index, obj) {\ + switch(obj.type) {\ + case MSG_JSON_PARSER_NULL:\ + MSG_DEBUG("parse obj : idx = %d, key =[%s], type = [%d], value = [%p], value num = [%f]", index, obj.key, obj.type, obj.value, obj.number_value);\ + break;\ + case MSG_JSON_PARSER_INT:\ + MSG_DEBUG("parse obj : idx = [%d], key = [%s], type = [%s], value = [%d]", index, obj.key, "MSG_JSON_PARSER_INT", (int)obj.number_value);\ + break;\ + case MSG_JSON_PARSER_UINT:\ + MSG_DEBUG("parse obj : idx = [%d], key = [%s], type = [%s], value = [%u]", index, obj.key, "MSG_JSON_PARSER_UINT", (unsigned int)obj.number_value);\ + break;\ + case MSG_JSON_PARSER_REAL:\ + MSG_DEBUG("parse obj : idx = [%d], key = [%s], type = [%s], value = [%f]", index, obj.key, "MSG_JSON_PARSER_REAL", obj.number_value);\ + break;\ + case MSG_JSON_PARSER_STRING:\ + MSG_DEBUG("parse obj : idx = [%d], key = [%s], type = [%s], value = [%s]", index, obj.key, "MSG_JSON_PARSER_STRING", (char *)obj.value);\ + break;\ + case MSG_JSON_PARSER_BOOLEAN:\ + MSG_DEBUG("parse obj : idx = [%d], key = [%s], type = [%s], value = [%s]", index, obj.key, "MSG_JSON_PARSER_BOOLEAN", obj.number_value == 0 ? "TRUE" : "FALSE");\ + break;\ + case MSG_JSON_PARSER_ARRAY:\ + MSG_DEBUG("parse obj : idx = [%d], key = [%s], type = [%s]", index, obj.key, "MSG_JSON_PARSER_ARRAY");\ + break;\ + case MSG_JSON_PARSER_OBJECT:\ + MSG_DEBUG("parse obj : idx = [%d], key = [%s], type = [%s]", index, obj.key, "MSG_JSON_PARSER_OBJECT");\ + break;\ + default:\ + MSG_DEBUG("parse obj : idx = %d, key =[%s], type = [%d], value = [%p], value num = [%f]", index, obj.key, obj.type, obj.value, obj.number_value);\ + break;\ + }\ +} +/** +*@enum msg_json_parser_value_type +* This enumerates json-node types. +*/ +typedef enum { + MSG_JSON_PARSER_NULL = 0, /** 0 /*================================================================================================== DEFINES @@ -38,25 +38,39 @@ #define MSGFW_CB_MSG_TABLE_NAME "MSG_CBMSG_TABLE" #define MMS_PLUGIN_MESSAGE_TABLE_NAME "MSG_MMS_MESSAGE_TABLE" #define MSGFW_SYNCML_MSG_TABLE_NAME "MSG_SYNCML_TABLE" + +#if 0 +#define MSGFW_RECEIVED_CB_MSG_TABLE_NAME "MSG_CB_MESSAGE_TABLE" +#endif + +#define MSGFW_CB_CHANNEL_INFO_TABLE_NAME "MSG_CB_CHANNEL_INFO_TABLE" + #define MSGFW_SMS_SENDOPT_TABLE_NAME "MSG_SMS_SENDOPT_TABLE" -#define MSGFW_REPORT_TABLE_NAME "MSG_REPORT_TABLE" -#define MSGFW_PUSH_CONFIG_TABLE_NAME "MSG_PUSHCFG_TABLE" -#define MSGFW_MMS_PREVIEW_TABLE_NAME "MSG_MMS_PREVIEW_INFO_TABLE" +#define MSGFW_SMS_REPORT_TABLE_NAME "MSG_SMS_REPORT_TABLE" +#define MSGFW_REPORT_TABLE_NAME "MSG_REPORT_TABLE" +#define MSGFW_PUSH_CONFIG_TABLE_NAME "MSG_PUSHCFG_TABLE" +#define MSGFW_MMS_PREVIEW_TABLE_NAME "MSG_MMS_PREVIEW_INFO_TABLE" +#define MSGFW_MMS_MULTIPART_TABLE_NAME "MSG_MULTIPART_TABLE" #define MSGFW_TMP_MSGID_TABLE_NAME "MSG_TMP_MSGID_TABLE" +#define MSGFW_ADDRESS_TEMP_TABLE_NAME "MSG_ADDRESS_TEMP_TABLE" + #define MAX_QUERY_LEN 3072 #define MAX_FOLDER_NAME_LEN 20 #define MAX_ACCOUNT_NAME_LEN 51 #define MSGFW_DB_ESCAPE_CHAR '\\' +#define SHM_FILE_FOR_DB_LOCK "/.msg_shm_db_lock" + /*================================================================================================== FUNCTION PROTOTYPES ==================================================================================================*/ void MsgReleaseMemoryDB(); msg_error_t MsgConvertStrWithEscape(const char *input, char **output); + /*================================================================================================== CLASS DEFINITIONS ==================================================================================================*/ @@ -74,9 +88,11 @@ public: msg_error_t getTable(const char *pQuery, int *pRowCnt); void freeTable(); msg_error_t bindText(const char *pBindStr, int index); + msg_error_t bindInt(const int pBindint, int index); msg_error_t bindBlob(const void * pBindBlob, int size, int index); msg_error_t prepareQuery(const char *pQuery); msg_error_t stepQuery(); + void resetQuery(); void finalizeQuery(); int columnInt(int ColumnIndex); const unsigned char* columnText(int ColumnIndex); @@ -85,14 +101,23 @@ public: msg_error_t endTrans(bool Success); int getColumnToInt(int RowIndex); char getColumnToChar(int RowIndex); + char* getColumnToString(int RowIndex); void getColumnToString(int RowIndex, int Length, char *pString); msg_error_t getRowId(const char *pTableName, unsigned int *pRowId); + void getMmapMutex(const char *shm_file_name); + void shm_mutex_timedlock (int sec); + void shm_mutex_unlock(); private: - char **result; - + sqlite3 *handle; + sqlite3_stmt *stmt; + pthread_mutex_t *mmapMx; + int shm_fd; }; + +MsgDbHandler *getDbHandle(); +void removeDbHandle(); #endif // MSG_SQLITE_WRAPPER_H diff --git a/include/utils/MsgTextConvert.h b/include/utils/MsgTextConvert.h index 2098a68..7e00298 100755 --- a/include/utils/MsgTextConvert.h +++ b/include/utils/MsgTextConvert.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_TEXT_CONVERT_H @@ -35,7 +35,7 @@ #define MAX_DUMP_COLUMN 16 -typedef unsigned short WCHAR; +typedef unsigned long WCHAR; typedef unsigned char MSG_CHAR_TYPE_T; @@ -254,31 +254,38 @@ static const WCHAR g_PortuLockingToUCS2[] = class MsgTextConvert { public: - MsgTextConvert(); - ~MsgTextConvert(); + static MsgTextConvert* instance(); int convertUTF8ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT MSG_LANGUAGE_ID_T *pLangId, OUT bool *bIncludeAbnormalChar); int convertUTF8ToUCS2(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen); - int convertUTF8ToAuto(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT msg_encode_type_t *pCharType); + int convertUTF8ToAuto(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT MSG_LANGUAGE_ID_T *pLangId, OUT msg_encode_type_t *pCharType); int convertGSM7bitToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, IN MSG_LANG_INFO_S *pLangInfo); int convertUCS2ToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen); int convertEUCKRToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen); + int convertSHIFTJISToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen); private: + MsgTextConvert(); + ~MsgTextConvert(); + int convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT MSG_LANGUAGE_ID_T *pLangId, OUT bool *bIncludeAbnormalChar); - int convertUCS2ToGSM7bitAuto(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT bool *pUnknown); int convertGSM7bitToUCS2(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, IN MSG_LANG_INFO_S *pLangInfo); void convertDumpTextToHex(const unsigned char *pText, int length); + static MsgTextConvert* pInstance; + std::map extCharList; std::map ucs2toGSM7DefList; std::map ucs2toGSM7ExtList; std::map ucs2toTurkishList; std::map ucs2toSpanishList; std::map ucs2toPortuList; + + std::map replaceCharList; + }; #endif //MSG_TEXT_CONVERT_H diff --git a/include/utils/MsgUtilFile.h b/include/utils/MsgUtilFile.h index e1373f5..8600b2a 100755 --- a/include/utils/MsgUtilFile.h +++ b/include/utils/MsgUtilFile.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_UTIL_FILE_H @@ -55,6 +55,11 @@ unsigned int MsgDu(const char *pDirPath); bool MsgAppendFile(const char *pFilePath, const char *pData, int DataSize); void MsgMmsInitDir(); bool MsgAccessFile(const char *filepath, int mode); +bool MsgChmod(const char *filepath, int mode); +bool MsgChown(const char *filepath, int uid, int gid); +bool MsgCreateFile(const char *pFilePath,char *pData, int DataSize); +char *MsgGetDirName(char *file_path); +char *MsgGetFileName(char *file_path); #endif // MSG_UTIL_FILE_H diff --git a/include/utils/MsgUtilFunction.h b/include/utils/MsgUtilFunction.h index be93986..c0c0f41 100755 --- a/include/utils/MsgUtilFunction.h +++ b/include/utils/MsgUtilFunction.h @@ -1,22 +1,22 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_UTIL_FUNCTION_H #define MSG_UTIL_FUNCTION_H - +#define MSG_UTIL_CH_EMAIL_AT '@' /*================================================================================================== INCLUDE FILES @@ -40,7 +40,7 @@ int MsgEncodeRecipientList(MSG_RECIPIENTS_LIST_S *pRecipientList, char **ppDest) int MsgEncodeMsgId(msg_message_id_t *pMsgId, char **ppDest); -int MsgEncodeMsgInfo(MSG_MESSAGE_INFO_S *pMsgInfo, char **ppDest); +int MsgEncodeMsgInfo(const MSG_MESSAGE_INFO_S *pMsgInfo, char **ppDest); int MsgEncodeMsgInfo(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S* pSendOptInfo, char **ppDest); @@ -68,6 +68,8 @@ int MsgEncodeSyncMLOperationData(int msgId, int extId, char **ppDest); int MsgEncodeStorageChangeData(const msg_storage_change_type_t storageChangeType, const msg_id_list_s *pMsgIdList, char **ppDest); +int MsgEncodeReportMsgData(const msg_report_type_t msgReportType, const MSG_MESSAGE_INFO_S *pMsgInfo, char **ppDest); + int MsgEncodeReportStatus(MSG_REPORT_STATUS_INFO_S* pReportStatus, int count, char **ppDest); int MsgEncodeThreadId(msg_thread_id_t *pThreadId, char **ppDest); @@ -80,6 +82,8 @@ void MsgDecodeMsgId(char *pSrc, msg_message_id_t *pMsgId); void MsgDecodeCountInfo(char *pSrc, MSG_COUNT_INFO_S *pCountInfo); +void MsgDecodeMsgInfo(char *pSrc, MSG_MESSAGE_INFO_S *pMsgInfo); + void MsgDecodeMsgInfo(char *pSrc, MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S* pSendOptInfo); void MsgDecodeFolderViewList(char *pSrc, msg_struct_list_s *pFolderViewList); @@ -111,8 +115,16 @@ void MsgDecodeThreadInfo(char *pSrc, MSG_THREAD_VIEW_S *pThreadInfo); int MsgMakeEvent(const void *pData, int DataSize, MSG_EVENT_TYPE_T MsgEvent, msg_error_t MsgError, void **ppEvent); +// Utin functions int msg_verify_number(const char *raw, char *trimmed); int msg_verify_email(const char *raw); +char* msg_clean_country_code(char *src); + +char* msg_normalize_number(char *src); + +msg_error_t MsgMakeSortRule(const MSG_SORT_RULE_S *pSortRule, char *pSqlSort); + +bool msg_is_valid_email(char *pAddress); #endif // MSG_UTIL_FUNCTION_H diff --git a/include/utils/MsgUtilStorage.h b/include/utils/MsgUtilStorage.h index de2b9d8..a189811 100755 --- a/include/utils/MsgUtilStorage.h +++ b/include/utils/MsgUtilStorage.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_UTIL_STORAGE_H @@ -24,40 +24,61 @@ #include "MsgInternalTypes.h" #include "MsgStorageTypes.h" #include "MsgSqliteWrapper.h" - +#include "MsgSettingTypes.h" /*================================================================================================== FUNCTION PROTOTYPES ==================================================================================================*/ // Common Function + unsigned int MsgStoAddMessageTable(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S *pMsgInfo); msg_error_t MsgStoSetReadStatus(MsgDbHandler *pDbHandle, msg_message_id_t MsgId, bool bRead); msg_error_t MsgStoGetOldestMessage(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S *pMsgInfo, msg_message_id_t *pMsgId); -msg_error_t MsgStoCheckMsgCntFull(MsgDbHandler *pDbHandle, const MSG_MESSAGE_TYPE_S* pMsgType, msg_folder_id_t FolderId); +msg_error_t MsgStoCheckMsgCntFull(MsgDbHandler *pDbHandle, const MSG_MESSAGE_TYPE_S* pMsgType, msg_folder_id_t FolderId, int simIndex); msg_error_t MsgStoCountMsgByLimitCategory(MsgDbHandler *pDbHandle, const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCount, msg_folder_id_t folderId ); +msg_error_t MsgStocheckMemoryStatus(); int MsgStoCheckMsgCntLimit(const MSG_MESSAGE_TYPE_S* pMsgType, msg_folder_id_t FolderId); msg_error_t MsgStoAddAddress(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S *pMsg, msg_thread_id_t *pConvId); -msg_error_t MsgStoGetAddressByMsgId(MsgDbHandler *pDbHandle, msg_message_id_t msgId, int contactNameOrder, int *nAddressCnt, MSG_ADDRESS_INFO_S *pAddress); +msg_error_t MsgStoGetAddressByMsgId(MsgDbHandler *pDbHandle, msg_message_id_t msgId, int contactNameOrder, int *nAddressCnt, MSG_ADDRESS_INFO_S **pAddress); msg_error_t MsgStoGetAddressByMsgId(MsgDbHandler *pDbHandle, msg_message_id_t msgId, int contactNameOrder, msg_struct_list_s *pAddress); msg_error_t MsgStoGetAddressByConvId(MsgDbHandler *pDbHandle, msg_thread_id_t convId, int contactNameOrder, msg_struct_list_s *pAddrlist); +void MsgStoUpdateAddress(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S *pMsg, msg_thread_id_t convId); msg_error_t MsgStoAddConversation(MsgDbHandler *pDbHandle, msg_thread_id_t *pConvId); msg_error_t MsgStoUpdateConversation(MsgDbHandler *pDbHandle, msg_thread_id_t convId); msg_error_t MsgStoSetConversationDisplayName(MsgDbHandler *pDbHandle, int contactId); msg_error_t MsgStoSetConversationDisplayName(MsgDbHandler *pDbHandle, msg_thread_id_t convId); msg_error_t MsgStoClearConversationTable(MsgDbHandler *pDbHandle); + +msg_error_t MsgStoAddCBChannelInfo(MsgDbHandler *pDbHandle, MSG_CB_CHANNEL_S *pCBChannel, msg_sim_slot_id_t simIndex); +msg_error_t MsgStoGetCBChannelInfo(MsgDbHandler *pDbHandle, MSG_CB_CHANNEL_S *pCBChannel, msg_sim_slot_id_t simIndex); + bool MsgExistAddress(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S *pMsg, msg_thread_id_t *pConvId); +bool MsgExistAddress(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsg, msg_thread_id_t convId, int index); +bool MsgExistConversation(MsgDbHandler *pDbHandle, msg_thread_id_t convId); +bool MsgExistMessage(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsg); int MsgStoGetUnreadCnt(MsgDbHandler *pDbHandle, MSG_MAIN_TYPE_T MsgType); msg_error_t MsgStoAddContactInfo(MsgDbHandler *pDbHandle, MSG_CONTACT_INFO_S *pContactInfo, const char *pNumber); -msg_error_t MsgStoResetContactInfo(MsgDbHandler *pDbHandle, int ContactId); -msg_error_t MsgStoClearContactInfo(MsgDbHandler *pDbHandle, int ContactId, const char *pNumber); +msg_error_t MsgStoClearContactInfoByAddrbookIdList(MsgDbHandler *pDbHandle, int* addrbookList, int addrbookCnt); +msg_error_t MsgStoClearContactInfo(MsgDbHandler *pDbHandle, int ContactId); +msg_error_t MsgStoResetContactInfo(MsgDbHandler *pDbHandle, int contactId); msg_error_t MsgStoGetMmsRawFilePath(MsgDbHandler *pDbHandle, msg_message_id_t msgId, char *pFilePath); bool MsgStoCheckReadReportRequested(MsgDbHandler *pDbHandle, msg_message_id_t MsgId); bool MsgStoCheckReadReportIsSent(MsgDbHandler *pDbHandle, msg_message_id_t MsgId); msg_error_t MsgStoUpdateNetworkStatus(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo, msg_network_status_t status); -char *MsgStoReplaceString(const char *org_str, const char *old_str, const char *new_str); -void MsgConvertNumber(const char* pSrcNum, char* pDestNum); -msg_error_t MsgStoRefreshConversationDisplayName(); + +// Lists +msg_error_t MsgStoGetFolderViewList(msg_folder_id_t FolderId, const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pMsgFolderViewList); +msg_error_t MsgStoGetThreadViewList(const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pThreadViewList); +msg_error_t MsgStoGetConversationViewItem(msg_message_id_t msgId, MSG_CONVERSATION_VIEW_S *pConv); +msg_error_t MsgStoGetConversationViewList(msg_thread_id_t ThreadId, msg_struct_list_s *pConvViewList); +msg_error_t MsgStoSearchMessage(const char *pSearchString, msg_struct_list_s *pThreadViewList); +msg_error_t MsgStoSearchByTag(const int tagType, msg_struct_list_s *pThreadViewList); + +msg_error_t MsgStoGetRejectMsgList(const char *pNumber, msg_struct_list_s *pRejectMsgList); +msg_error_t MsgStoGetAddressList(const msg_thread_id_t threadId, msg_struct_list_s *pAddrList); +msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_struct_list_s *pMsgList); + #endif // MSG_UTIL_STORAGE_H diff --git a/include/utils/MsgVMessage.h b/include/utils/MsgVMessage.h index 829fb06..ad9f3e3 100755 --- a/include/utils/MsgVMessage.h +++ b/include/utils/MsgVMessage.h @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef MSG_VMESSAGE_H diff --git a/mapi/CMakeLists.txt b/mapi/CMakeLists.txt index f43dfb5..29f50af 100755 --- a/mapi/CMakeLists.txt +++ b/mapi/CMakeLists.txt @@ -29,14 +29,13 @@ SET(MAPI-SRCS INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/include/common - ${CMAKE_SOURCE_DIR}/include/framework ${CMAKE_SOURCE_DIR}/include/proxy ${CMAKE_SOURCE_DIR}/include/utils ${CMAKE_SOURCE_DIR}/include/mapi ) INCLUDE(FindPkgConfig) -pkg_check_modules(mapi_pkgs REQUIRED glib-2.0 dlog) +pkg_check_modules(mapi_pkgs REQUIRED glib-2.0 dlog privacy-manager-client) FOREACH(flag ${mapi_pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") @@ -53,5 +52,5 @@ TARGET_LINK_LIBRARIES(${MAPI-LIB} ${mapi_pkgs_LDFLAGS} ${UTILS-LIB} ${TRANS-PROX SET_TARGET_PROPERTIES(${MAPI-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR}) SET_TARGET_PROPERTIES(${MAPI-LIB} PROPERTIES VERSION ${VERSION}) -INSTALL(TARGETS ${MAPI-LIB} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) +INSTALL(TARGETS ${MAPI-LIB} DESTINATION lib COMPONENT RuntimeLibraries) diff --git a/mapi/msg_control.cpp b/mapi/msg_control.cpp index 04dbc4c..0ac5917 100755 --- a/mapi/msg_control.cpp +++ b/mapi/msg_control.cpp @@ -1,20 +1,21 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include +#include #include "MsgHandle.h" #include "MsgDebug.h" @@ -28,10 +29,18 @@ ==================================================================================================*/ EXPORT_API int msg_open_msg_handle(msg_handle_t *handle) { + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { MSG_FATAL("Input Paramter is NULL"); - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = new MsgHandle(); @@ -39,7 +48,7 @@ EXPORT_API int msg_open_msg_handle(msg_handle_t *handle) *handle = (msg_handle_t)pHandle; if (*handle == NULL) - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; try { @@ -50,8 +59,14 @@ EXPORT_API int msg_open_msg_handle(msg_handle_t *handle) { MSG_FATAL("%s", e.what()); + // Destroy MsgHandle + delete (MsgHandle*)(*handle); + (*handle) = NULL; + if (e.errorCode() == MsgException::SERVER_READY_ERROR) return MSG_ERR_SERVER_NOT_READY; + else if(e.errorCode() == MsgException::SECURITY_ERROR) + return MSG_ERR_PERMISSION_DENIED; else return MSG_ERR_COMMUNICATION_ERROR; } @@ -62,10 +77,18 @@ EXPORT_API int msg_open_msg_handle(msg_handle_t *handle) EXPORT_API int msg_close_msg_handle(msg_handle_t *handle) { + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || *handle == NULL) { MSG_FATAL("Input Paramter is NULL"); - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)(*handle); diff --git a/mapi/msg_filter.cpp b/mapi/msg_filter.cpp index 9778fee..2998193 100755 --- a/mapi/msg_filter.cpp +++ b/mapi/msg_filter.cpp @@ -1,20 +1,21 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include +#include #include "MsgException.h" #include "MsgDebug.h" @@ -28,17 +29,25 @@ EXPORT_API int msg_add_filter(msg_handle_t handle, const msg_struct_t msg_struct { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + // TODO : check NULL in msg_struct_handle msg_struct_s *msg_struct = (msg_struct_s *) msg_struct_handle; if (handle == NULL || msg_struct == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } if(msg_struct->type != MSG_STRUCT_FILTER) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -61,18 +70,26 @@ EXPORT_API int msg_update_filter(msg_handle_t handle, const msg_struct_t msg_str { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + // TODO : check NULL in msg_struct_handle msg_struct_s *msg_struct = (msg_struct_s *) msg_struct_handle; if (handle == NULL || msg_struct == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } if(msg_struct->type != MSG_STRUCT_FILTER) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -95,9 +112,17 @@ EXPORT_API int msg_delete_filter(msg_handle_t handle, msg_filter_id_t filter_id) { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -120,9 +145,17 @@ EXPORT_API int msg_get_filter_list(msg_handle_t handle, msg_struct_list_s *filte { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || filter_list == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -145,9 +178,17 @@ EXPORT_API int msg_set_filter_operation(msg_handle_t handle, bool set_flag) { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -170,9 +211,17 @@ EXPORT_API int msg_get_filter_operation(msg_handle_t handle, bool *set_flag) { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -195,9 +244,17 @@ EXPORT_API int msg_set_filter_active(msg_handle_t handle, msg_filter_id_t filter { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; diff --git a/mapi/msg_message.cpp b/mapi/msg_message.cpp index 9c43b9b..6cd600c 100755 --- a/mapi/msg_message.cpp +++ b/mapi/msg_message.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include @@ -20,10 +20,38 @@ #include "MsgStorageTypes.h" #include "MsgInternalTypes.h" #include "MsgMmsMessage.h" - +#include "MsgSerialize.h" #include "msg.h" #include "msg_private.h" +msg_struct_s *__msg_message_create_address_struct() +{ + msg_struct_s *msg_struct = new msg_struct_s; + bzero(msg_struct, sizeof(msg_struct_s)); + + msg_struct->type = MSG_STRUCT_ADDRESS_INFO; + msg_struct->data = new MSG_ADDRESS_INFO_S; + memset(msg_struct->data, 0x00, sizeof(MSG_ADDRESS_INFO_S)); + + return msg_struct; +} + +void __msg_message_release_address_struct(gpointer data) +{ + if (data == NULL) + return; + + msg_struct_s *addr_struct = (msg_struct_s *)data; + MSG_ADDRESS_INFO_S *addrInfo = (MSG_ADDRESS_INFO_S *)addr_struct->data; + + delete (MSG_ADDRESS_INFO_S *)addrInfo; + + addr_struct->data = NULL; + + delete addr_struct; +} + + void msg_message_create_struct(msg_struct_s *msg_struct) { MSG_MESSAGE_HIDDEN_S *msg = (MSG_MESSAGE_HIDDEN_S *)new MSG_MESSAGE_HIDDEN_S; @@ -51,6 +79,8 @@ void msg_message_create_struct(msg_struct_s *msg_struct) msg->pData = NULL; msg->pMmsData = NULL; msg->mmsDataSize = 0; + msg->simIndex = MSG_SIM_SLOT_ID_1; + /* Allocate memory for address list of message */ msg_struct_list_s *addr_list = (msg_struct_list_s *)new msg_struct_list_s; @@ -60,17 +90,17 @@ void msg_message_create_struct(msg_struct_s *msg_struct) msg_struct_s *pTmp = NULL; for (int i = 0; i < MAX_TO_ADDRESS_CNT; i++) { - addr_list->msg_struct_info[i] = (msg_struct_t)new char[sizeof(msg_struct_s)]; + addr_list->msg_struct_info[i] = (msg_struct_t)new msg_struct_s; pTmp = (msg_struct_s *)addr_list->msg_struct_info[i]; pTmp->type = MSG_STRUCT_ADDRESS_INFO; pTmp->data = new MSG_ADDRESS_INFO_S; memset(pTmp->data, 0x00, sizeof(MSG_ADDRESS_INFO_S)); - - addr_list->msg_struct_info[i] = (msg_struct_t)pTmp; } msg->addr_list = addr_list; + msg->addressList = NULL; + msg_struct->data = (int *)msg; } @@ -106,6 +136,12 @@ int msg_message_release(msg_struct_s **msg_struct) msg->addr_list = NULL; } + // Free GList *addressList + if (msg->addressList) { + g_list_free_full(msg->addressList, __msg_message_release_address_struct); + msg->addressList = NULL; + } + delete msg; (*msg_struct)->data = NULL; @@ -139,37 +175,67 @@ int msg_message_get_int_value(void *data, int field, int *value) { if (msg_data->mainType == MSG_SMS_TYPE) { - if (msg_data->subType == MSG_CB_SMS) - *value = MSG_TYPE_SMS_CB; - else if (msg_data->subType == MSG_JAVACB_SMS) - *value = MSG_TYPE_SMS_JAVACB; - else if (msg_data->subType == MSG_WAP_SI_SMS || msg_data->subType == MSG_WAP_SL_SMS) - *value = MSG_TYPE_SMS_WAPPUSH; - else if (msg_data->subType == MSG_MWI_VOICE_SMS || msg_data->subType == MSG_MWI_FAX_SMS - || msg_data->subType == MSG_MWI_EMAIL_SMS || msg_data->subType == MSG_MWI_OTHER_SMS) - *value = MSG_TYPE_SMS_MWI; - else if (msg_data->subType == MSG_SYNCML_CP) - *value = MSG_TYPE_SMS_SYNCML; - else if (msg_data->subType == MSG_REJECT_SMS) - *value = MSG_TYPE_SMS_REJECT; - else if (msg_data->subType == MSG_ETWS_SMS) - *value = MSG_TYPE_SMS_ETWS_PRIMARY; - else - *value = MSG_TYPE_SMS; - } - else if (msg_data->mainType == MSG_MMS_TYPE) - { + switch (msg_data->subType) { + case MSG_CB_SMS : + *value = MSG_TYPE_SMS_CB; + break; + case MSG_JAVACB_SMS : + *value = MSG_TYPE_SMS_JAVACB; + break; + case MSG_WAP_SI_SMS : + case MSG_WAP_SL_SMS : + *value = MSG_TYPE_SMS_WAPPUSH; + break; + case MSG_MWI_VOICE_SMS : + case MSG_MWI_FAX_SMS : + case MSG_MWI_EMAIL_SMS : + case MSG_MWI_OTHER_SMS : + *value = MSG_TYPE_SMS_MWI; + break; + case MSG_SYNCML_CP : + *value = MSG_TYPE_SMS_SYNCML; + break; + case MSG_REJECT_SMS : + *value = MSG_TYPE_SMS_REJECT; + break; + case MSG_ETWS_SMS : + *value = MSG_TYPE_SMS_ETWS_PRIMARY; + break; + case MSG_CMAS_PRESIDENTIAL : + *value = MSG_TYPE_SMS_CMAS_PRESIDENTIAL; + break; + case MSG_CMAS_EXTREME : + *value = MSG_TYPE_SMS_CMAS_EXTREME; + break; + case MSG_CMAS_SEVERE : + *value = MSG_TYPE_SMS_CMAS_SEVERE; + break; + case MSG_CMAS_AMBER : + *value = MSG_TYPE_SMS_CMAS_AMBER; + break; + case MSG_CMAS_TEST : + *value = MSG_TYPE_SMS_CMAS_TEST; + break; + case MSG_CMAS_OPERATOR_DEFINED : + *value = MSG_TYPE_SMS_CMAS_OPERATOR_DEFINED; + break; + default : + *value = MSG_TYPE_SMS; + } + } + else if (msg_data->mainType == MSG_MMS_TYPE) + { if (msg_data->subType == MSG_NOTIFICATIONIND_MMS) *value = MSG_TYPE_MMS_NOTI; else if (msg_data->subType == MSG_SENDREQ_JAVA_MMS) *value = MSG_TYPE_MMS_JAVA; else *value = MSG_TYPE_MMS; - } - else - *value = MSG_TYPE_INVALID; + } + else + *value = MSG_TYPE_INVALID; - break; + break; } case MSG_MESSAGE_CLASS_TYPE_INT : *value = msg_data->classType; @@ -204,6 +270,9 @@ int msg_message_get_int_value(void *data, int field, int *value) case MSG_MESSAGE_DATA_SIZE_INT : *value = msg_data->dataSize; break; + case MSG_MESSAGE_SIM_INDEX_INT : + *value = msg_data->simIndex; + break; default : ret = MSG_ERR_INVALID_PARAMETER; break; @@ -234,6 +303,14 @@ int msg_message_get_bool_value(void *data, int field, bool *value) case MSG_MESSAGE_PORT_VALID_BOOL : *value = msg_data->bPortValid; break; + case MSG_MESSAGE_REPLACE_BOOL : + { + if (msg_data->subType >= MSG_REPLACE_TYPE1_SMS && msg_data->subType <= MSG_REPLACE_TYPE7_SMS) + *value = true; + else + *value = false; + break; + } default : ret = MSG_ERR_INVALID_PARAMETER; break; @@ -314,6 +391,9 @@ int msg_message_get_list_hnd(void *data, int field, void **value) case MSG_MESSAGE_ADDR_LIST_STRUCT : *value = (void *)msg_data->addr_list; break; + case MSG_MESSAGE_ADDR_LIST_HND : + *value = (msg_list_handle_t)msg_data->addressList; + break; default : ret = MSG_ERR_INVALID_PARAMETER; break; @@ -403,6 +483,9 @@ int msg_message_set_int_value(void *data, int field, int value) case MSG_MESSAGE_DATA_SIZE_INT : msg_data->dataSize = value; break; + case MSG_MESSAGE_SIM_INDEX_INT : + msg_data->simIndex = value; + break; default : ret = MSG_ERR_INVALID_PARAMETER; break; @@ -516,6 +599,7 @@ void msg_message_copy_message(MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_HIDDEN_S * pDst->bPortValid = pSrc->bPortValid; pDst->dataSize = pSrc->dataSize; pDst->mmsDataSize = pSrc->mmsDataSize; + pDst->simIndex = pSrc->simIndex; memcpy(pDst->subject, pSrc->subject, sizeof(pDst->subject)); if(pSrc->pMmsData && pSrc->mmsDataSize) @@ -548,6 +632,22 @@ void msg_message_copy_message(MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_HIDDEN_S * memcpy(pDst->thumbPath, pSrc->thumbPath, sizeof(pDst->thumbPath)); } + for (unsigned int i=0; i < g_list_length(pSrc->addressList); i++) { + msg_struct_s *addr_struct = __msg_message_create_address_struct(); + MSG_ADDRESS_INFO_S *addrInfo = (MSG_ADDRESS_INFO_S *)addr_struct->data; + + msg_struct_s *addr_info = (msg_struct_s *)g_list_nth_data(pSrc->addressList,(guint)i); + MSG_ADDRESS_INFO_S *address = (MSG_ADDRESS_INFO_S *)addr_info->data; + + addrInfo->addressType = address->addressType; + addrInfo->recipientType = address->recipientType; + addrInfo->contactId = address->contactId; + strncpy(addrInfo->addressVal, address->addressVal, MAX_ADDRESS_VAL_LEN); + strncpy(addrInfo->displayName, address->displayName, MAX_DISPLAY_NAME_LEN); + addrInfo->displayName[MAX_DISPLAY_NAME_LEN] = '\0'; + + pDst->addressList = g_list_append(pDst->addressList, addr_struct); + } } int msg_cb_message_get_int_value(void *data, int field, int *value) @@ -565,12 +665,34 @@ int msg_cb_message_get_int_value(void *data, int field, int *value) { case MSG_CB_MSG_TYPE_INT : { - if ( cb_msg->type == MSG_ETWS_SMS ) - *value = MSG_TYPE_SMS_ETWS_PRIMARY; - else if ( cb_msg->type == MSG_CB_SMS ) - *value = ((cb_msg->messageId & 0xFFF8) == 0x1100 ) ? MSG_TYPE_SMS_ETWS_SECONDARY : MSG_TYPE_SMS_CB; - else - ret = MSG_ERR_UNKNOWN; + switch (cb_msg->type) { + case MSG_ETWS_SMS : + *value = MSG_TYPE_SMS_ETWS_PRIMARY; + break; + case MSG_CB_SMS: + *value = ((cb_msg->messageId & 0xFFF8) == 0x1100 ) ? MSG_TYPE_SMS_ETWS_SECONDARY : MSG_TYPE_SMS_CB; + break; + case MSG_CMAS_PRESIDENTIAL : + *value = MSG_TYPE_SMS_CMAS_PRESIDENTIAL; + break; + case MSG_CMAS_EXTREME : + *value = MSG_TYPE_SMS_CMAS_EXTREME; + break; + case MSG_CMAS_SEVERE : + *value = MSG_TYPE_SMS_CMAS_SEVERE; + break; + case MSG_CMAS_AMBER : + *value = MSG_TYPE_SMS_CMAS_AMBER; + break; + case MSG_CMAS_TEST : + *value = MSG_TYPE_SMS_CMAS_TEST; + break; + case MSG_CMAS_OPERATOR_DEFINED : + *value = MSG_TYPE_SMS_CMAS_OPERATOR_DEFINED; + break; + default : + ret = MSG_ERR_UNKNOWN; + } } break; case MSG_CB_MSG_RECV_TIME_INT : @@ -665,15 +787,21 @@ EXPORT_API int msg_get_mms_struct(msg_struct_t msg_struct_handle, msg_struct_t m MSG_MESSAGE_HIDDEN_S *msg_data = (MSG_MESSAGE_HIDDEN_S *)msg_struct->data; - MMS_MESSAGE_DATA_S *tmp_mms_data = (MMS_MESSAGE_DATA_S *)calloc(1, sizeof(MMS_MESSAGE_DATA_S)); + if (msg_data->pMmsData == NULL) { + return MSG_ERR_INVALID_PARAMETER; + } - _MsgMmsDeserializeMessageData(tmp_mms_data, (char*)msg_data->pMmsData); + MMS_DATA_S *mms_data = NULL; - convert_from_mmsdata(tmp_mms_data, mms_struct); + MsgDeserializeMmsData((char*)msg_data->pMmsData, msg_data->mmsDataSize, &mms_data); - MsgMmsReleaseMmsLists(tmp_mms_data); + if (mms_data) { + convert_to_hidden_mmsdata(mms_data, mms_struct); - free(tmp_mms_data); + MsgMmsRelease(&mms_data); + } else { + return MSG_ERR_INVALID_PARAMETER; + } return ret; } @@ -699,15 +827,89 @@ EXPORT_API int msg_set_mms_struct(msg_struct_t msg_struct_handle, msg_struct_t m MSG_MESSAGE_HIDDEN_S *msg_data = (MSG_MESSAGE_HIDDEN_S *)msg_struct->data; - MMS_MESSAGE_DATA_S *tmp_mms_data = (MMS_MESSAGE_DATA_S *)calloc(1,sizeof(MMS_MESSAGE_DATA_S)); + MMS_DATA_S *mms_data = MsgMmsCreate(); + + convert_from_hidden_mmsdata(mms_struct, mms_data); + + int mmsDataSize = MsgSerializeMms(mms_data, (char **)&msg_data->pMmsData); - convert_to_mmsdata(mms_struct, tmp_mms_data); + if (mmsDataSize > 0) + msg_data->mmsDataSize = mmsDataSize; - msg_data->pMmsData = _MsgMmsSerializeMessageData(tmp_mms_data, &(msg_data->mmsDataSize)); + //TODO:: set subtype - MsgMmsReleaseMmsLists(tmp_mms_data); + MsgMmsRelease(&mms_data); + + return ret; +} + + +int msg_message_list_append(msg_struct_t msg_struct_handle, int field, msg_struct_t *item) +{ + msg_error_t err = MSG_SUCCESS; + msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle; + MSG_MESSAGE_HIDDEN_S *msg_data = (MSG_MESSAGE_HIDDEN_S *)msg_struct->data; + + msg_struct_s *msg_struct_item = NULL; + switch(field) { + case MSG_MESSAGE_ADDR_LIST_HND: + { + msg_struct_item = __msg_message_create_address_struct(); + msg_data->addressList = g_list_append(msg_data->addressList, msg_struct_item); + *item = (msg_struct_t)msg_struct_item; + } + break; + default : + err = MSG_ERR_INVALID_PARAMETER; + break; + } + + return err; +} + + +int msg_message_list_clear(msg_struct_t msg_struct_handle, int field) +{ + msg_error_t err = MSG_SUCCESS; + msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle; + MSG_MESSAGE_HIDDEN_S *msg_data = (MSG_MESSAGE_HIDDEN_S *)msg_struct->data; + + switch(field) { + case MSG_MESSAGE_ADDR_LIST_HND: + { + // Free GList *addressList + if (msg_data->addressList) { + g_list_free_full(msg_data->addressList, __msg_message_release_address_struct); + msg_data->addressList = NULL; + } + } + break; + default : + err = MSG_ERR_INVALID_PARAMETER; + break; + } + + return err; +} + +int msg_conversation_get_list_hnd(void *data, int field, void **value) +{ + if (!data) + return MSG_ERR_NULL_POINTER; + + int ret = MSG_SUCCESS; + + MSG_CONVERSATION_VIEW_S *msg_data = (MSG_CONVERSATION_VIEW_S *)data; + + switch (field) { + case MSG_CONV_MSG_MULTIPART_HND : + *value = (void *)msg_data->multipart_list; + break; + default : + ret = MSG_ERR_INVALID_PARAMETER; + break; + } - free(tmp_mms_data); return ret; } diff --git a/mapi/msg_mms.cpp b/mapi/msg_mms.cpp index 71d9fba..43b0758 100755 --- a/mapi/msg_mms.cpp +++ b/mapi/msg_mms.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include @@ -28,7 +28,7 @@ #include "msg_private.h" //Internel Struct -typedef struct _MMS_DATA_S +typedef struct { GList *pagelist; GList *regionlist; @@ -37,6 +37,9 @@ typedef struct _MMS_DATA_S GList *metalist; MMS_SMIL_ROOTLAYOUT rootlayout; MMS_APPID_INFO_S msgAppId; + MMS_HEADER_DATA_S header; + MMS_MULTIPART_DATA_S smil; + GList *multipartlist;//MMS_MULTIPART_DATA_S } MMS_DATA_HIDDEN_S; typedef struct @@ -53,8 +56,12 @@ typedef struct char szDrm2FullPath[MSG_FILEPATH_LEN_MAX + 1]; /**< Indicates the fullpath of the DRM */ msg_struct_s *pText; msg_struct_s *pAVI; + char szContentType[MSG_MSG_ID_LEN + 1]; + char szContentLocation[MSG_MSG_ID_LEN + 1]; + } MMS_MEDIA_HIDDEN_S; +static void __msg_mms_data_struct_init(MMS_DATA_HIDDEN_S *pMmsDataHidden); static void __msg_mms_release_mms(msg_struct_s *mms_struct); static void __msg_mms_release_page(msg_struct_s *page_struct); static void __msg_mms_release_media(msg_struct_s *media_struct); @@ -62,7 +69,7 @@ static void __msg_mms_release_region(msg_struct_s *region_struct); static void __msg_mms_release_attach(msg_struct_s *attach_struct); static void __msg_mms_release_transition(msg_struct_s *transition_struct); static void __msg_mms_release_meta(msg_struct_s *meta_struct); - +static void __msg_mms_release_multipart(msg_struct_s *multipart_struct); /*================================================================================================== FUNCTION IMPLEMENTATION ==================================================================================================*/ @@ -116,6 +123,7 @@ void *msg_mms_create_struct_data(int field) case MSG_STRUCT_MMS: data = (void *)new MMS_DATA_HIDDEN_S; bzero(data, sizeof(MMS_DATA_HIDDEN_S)); + __msg_mms_data_struct_init((MMS_DATA_HIDDEN_S *)data); break; case MSG_STRUCT_MMS_PAGE: data = (void *)new MMS_PAGE_S; @@ -156,6 +164,11 @@ void *msg_mms_create_struct_data(int field) data = (void *)new MmsSmilAVI; bzero(data, sizeof(MmsSmilAVI)); break; + case MSG_STRUCT_MULTIPART_INFO: + data = new MMS_MULTIPART_DATA_S; + bzero(data, sizeof(MMS_MULTIPART_DATA_S)); + MsgMmsInitMultipart((MMS_MULTIPART_DATA_S *)data); + break; } return data; @@ -176,81 +189,120 @@ void msg_mms_list_item_free_func(gpointer data) __msg_mms_release_transition(msg_struct); } else if (msg_struct->type == MSG_STRUCT_MMS_META) { __msg_mms_release_meta(msg_struct); + } else if (msg_struct->type == MSG_STRUCT_MULTIPART_INFO) { + __msg_mms_release_multipart(msg_struct); } } void __msg_mms_release_page(msg_struct_s *page_struct) { - MMS_PAGE_S *page = (MMS_PAGE_S *)page_struct->data; - if (page->medialist) { - g_list_free_full(page->medialist, msg_mms_list_item_free_func); - } + if (page_struct) { + MMS_PAGE_S *page = (MMS_PAGE_S *)page_struct->data; - delete (MMS_PAGE_S *)page; - page_struct->data = NULL; + if (page) { + if (page->medialist) { + g_list_free_full(page->medialist, msg_mms_list_item_free_func); + } - delete page_struct; + delete (MMS_PAGE_S *)page; + page_struct->data = NULL; + } + + delete page_struct; + } } void __msg_mms_release_media(msg_struct_s *media_struct) { - MMS_MEDIA_HIDDEN_S *media = (MMS_MEDIA_HIDDEN_S *)media_struct->data; + if (media_struct) { + MMS_MEDIA_HIDDEN_S *media = (MMS_MEDIA_HIDDEN_S *)media_struct->data; - if (media->pText) - msg_mms_release_struct(&media->pText); + if (media) { + if (media->pText) + msg_mms_release_struct(&media->pText); - if (media->pAVI) - msg_mms_release_struct(&media->pAVI); + if (media->pAVI) + msg_mms_release_struct(&media->pAVI); - delete (MMS_MEDIA_HIDDEN_S *)media; + delete (MMS_MEDIA_HIDDEN_S *)media; - media_struct->data = NULL; + media_struct->data = NULL; + } - delete media_struct; + delete media_struct; + } } void __msg_mms_release_attach(msg_struct_s *attach_struct) { - MMS_ATTACH_S *attach = (MMS_ATTACH_S *)attach_struct->data; + if (attach_struct) { + MMS_ATTACH_S *attach = (MMS_ATTACH_S *)attach_struct->data; - delete (MMS_ATTACH_S *)attach; + if (attach) + delete (MMS_ATTACH_S *)attach; - attach_struct->data = NULL; + attach_struct->data = NULL; - delete attach_struct; + delete attach_struct; + } } void __msg_mms_release_region(msg_struct_s *region_struct) { - MMS_SMIL_REGION *region = (MMS_SMIL_REGION *)region_struct->data; + if (region_struct) { + MMS_SMIL_REGION *region = (MMS_SMIL_REGION *)region_struct->data; - delete (MMS_SMIL_REGION *)region; + if (region) + delete (MMS_SMIL_REGION *)region; - region_struct->data = NULL; + region_struct->data = NULL; - delete region_struct; + delete region_struct; + } } void __msg_mms_release_transition(msg_struct_s *transition_struct) { - MMS_SMIL_TRANSITION *transition = (MMS_SMIL_TRANSITION *)transition_struct->data; + if (transition_struct) { + MMS_SMIL_TRANSITION *transition = (MMS_SMIL_TRANSITION *)transition_struct->data; - delete (MMS_SMIL_TRANSITION *)transition; + if (transition) + delete (MMS_SMIL_TRANSITION *)transition; - transition_struct->data = NULL; + transition_struct->data = NULL; - delete transition_struct; + delete transition_struct; + } } void __msg_mms_release_meta(msg_struct_s *meta_struct) { - MMS_SMIL_META *meta = (MMS_SMIL_META *)meta_struct->data; + if (meta_struct) { + MMS_SMIL_META *meta = (MMS_SMIL_META *)meta_struct->data; - delete (MMS_SMIL_META *)meta; + if (meta) + delete (MMS_SMIL_META *)meta; - meta_struct->data = NULL; + meta_struct->data = NULL; - delete meta_struct; + delete meta_struct; + } +} + +void __msg_mms_release_multipart(msg_struct_s *multipart_struct) +{ + if (multipart_struct) { + MMS_MULTIPART_DATA_S *multipart = (MMS_MULTIPART_DATA_S *)multipart_struct->data; + + if (multipart) { + g_free(multipart->pMultipartData); multipart->pMultipartData = NULL; + delete (MMS_MULTIPART_DATA_S *)multipart; + } + + multipart_struct->data = NULL; + + delete multipart_struct; + } } void __msg_mms_release_mms(msg_struct_s *mms_struct) @@ -282,6 +334,11 @@ void __msg_mms_release_mms(msg_struct_s *mms_struct) mms->metalist = NULL; } + if (mms->multipartlist) { + g_list_free_full(mms->multipartlist, msg_mms_list_item_free_func); + mms->multipartlist = NULL; + } + delete (MMS_DATA_HIDDEN_S *)mms; mms_struct->data = NULL; @@ -325,16 +382,33 @@ int msg_mms_release_struct(msg_struct_s **msg_struct_data) *msg_struct_data = NULL; break; case MSG_STRUCT_MMS_SMIL_TEXT: - delete (MmsSmilText*)msg_struct->data; + if (msg_struct->data) { + delete (MmsSmilText*)msg_struct->data; + msg_struct->data = NULL; + } delete msg_struct; *msg_struct_data = NULL; break; case MSG_STRUCT_MMS_SMIL_AVI: - delete (MmsSmilAVI*)msg_struct->data; + if (msg_struct->data) { + delete (MmsSmilAVI*)msg_struct->data; + msg_struct->data = NULL; + } + delete msg_struct; + *msg_struct_data = NULL; + break; + case MSG_STRUCT_MULTIPART_INFO: + { + if (msg_struct->data) { + delete (MMS_MULTIPART_DATA_S *)(msg_struct->data); + msg_struct->data = NULL; + } + delete msg_struct; *msg_struct_data = NULL; break; } + } return 0; } @@ -347,12 +421,39 @@ int msg_mms_get_int_value(msg_struct_s *msg_struct, int field, int *value) case MSG_STRUCT_MMS: { MMS_DATA_HIDDEN_S *mms_data = (MMS_DATA_HIDDEN_S *)msg_struct->data; - if (field == MSG_MMS_ROOTLAYOUT_WIDTH_INT) + if (field == MSG_MMS_ROOTLAYOUT_WIDTH_INT) { *value = mms_data->rootlayout.width.value; - else if (field == MSG_MMS_ROOTLAYOUT_HEIGHT_INT) + } else if (field == MSG_MMS_ROOTLAYOUT_HEIGHT_INT) { *value = mms_data->rootlayout.height.value; - else if (field == MSG_MMS_ROOTLAYOUT_BGCOLOR_INT) + } else if (field == MSG_MMS_ROOTLAYOUT_BGCOLOR_INT) { *value = mms_data->rootlayout.bgColor; + } else if (field == MSG_MMS_HEADER_DATE_INT) { + *value = mms_data->header.date; + } else if (field == MSG_MMS_HEADER_DELIVERY_REPORT_INT) { + *value = mms_data->header.bDeliveryReport; + } else if (field == MSG_MMS_HEADER_DELIVERY_TIME_INT) { + *value = mms_data->header.delivery.time; + } else if (field == MSG_MMS_HEADER_EXPIRY_TIME_INT) { + *value = mms_data->header.expiry.time; + } else if (field == MSG_MMS_HEADER_MESSAGE_CLASS_INT) { + *value = mms_data->header.messageClass; + } else if (field == MSG_MMS_HEADER_MESSAGE_TYPE_INT) { + *value = mms_data->header.messageType; + } else if (field == MSG_MMS_HEADER_VERSION_INT) { + *value = mms_data->header.mmsVersion; + } else if (field == MSG_MMS_HEADER_SIZE_INT) { + *value = mms_data->header.messageSize; + } else if (field == MSG_MMS_HEADER_PRIORITY_INT) { + *value = mms_data->header.mmsPriority; + } else if (field == MSG_MMS_HEADER_READ_REPORT_INT) { + *value = mms_data->header.bReadReport; + } else if (field == MSG_MMS_HEADER_HIDE_ADDRESS_INT) { + *value = mms_data->header.bHideAddress; + } else if (field == MSG_MMS_HEADER_MMS_STATUS_INT) { + *value = mms_data->header.mmsStatus; + } else if (field == MSG_MMS_HEADER_CONTENT_CLASS_INT) { + *value = mms_data->header.contentClass; + } else err = MSG_ERR_INVALID_PARAMETER; } @@ -472,11 +573,15 @@ int msg_mms_get_int_value(msg_struct_s *msg_struct, int field, int *value) err = MSG_ERR_INVALID_PARAMETER; } break; + case MSG_STRUCT_MULTIPART_INFO: + err = msg_multipart_get_int_value(msg_struct->data, field, value); + break; + default : err = MSG_ERR_INVALID_PARAMETER; break; } - return MSG_SUCCESS; + return err; } int msg_mms_get_str_value(msg_struct_s *msg_struct, int field, char *value, int size) @@ -484,6 +589,35 @@ int msg_mms_get_str_value(msg_struct_s *msg_struct, int field, char *value, int msg_error_t err = MSG_SUCCESS; switch(msg_struct->type) { + case MSG_STRUCT_MMS: + { + MMS_DATA_HIDDEN_S *mms_data = (MMS_DATA_HIDDEN_S *)msg_struct->data; + if (field == MSG_MMS_HEADER_CONTENT_LOCATION_STR) {// mms header + strncpy(value, mms_data->header.contentLocation, size); + } else if (field == MSG_MMS_HEADER_CONTENT_TYPE_STR) { + strncpy(value, mms_data->header.szContentType, size); + } else if (field == MSG_MMS_HEADER_FROM_STR) { + strncpy(value, mms_data->header.szFrom, size); + } else if (field == MSG_MMS_HEADER_MESSAGE_ID_STR) { + strncpy(value, mms_data->header.messageID, size); + } else if (field == MSG_MMS_HEADER_TR_ID_STR) { + strncpy(value, mms_data->header.trID, size); + + } else if (field == MSG_MMS_SMIL_MULTIPART_CONTENT_TYPE_STR) { // smil + strncpy(value, mms_data->smil.szContentType, size); + } else if (field == MSG_MMS_SMIL_MULTIPART_NAME_STR) { + strncpy(value, mms_data->smil.szFileName, size); + } else if (field == MSG_MMS_SMIL_MULTIPART_FILEPATH_STR) { + strncpy(value, mms_data->smil.szFilePath, size); + } else if (field == MSG_MMS_SMIL_MULTIPART_CONTENT_ID_STR) { + strncpy(value, mms_data->smil.szContentID, size); + } else if (field == MSG_MMS_SMIL_MULTIPART_CONTENT_LOCATION_STR) { + strncpy(value, mms_data->smil.szContentLocation, size); + } + else + err = MSG_ERR_INVALID_PARAMETER; + } + break; case MSG_STRUCT_MMS_MEDIA: { MMS_MEDIA_HIDDEN_S *mms_media_data = (MMS_MEDIA_HIDDEN_S *)msg_struct->data; @@ -502,6 +636,10 @@ int msg_mms_get_str_value(msg_struct_s *msg_struct, int field, char *value, int strncpy(value, mms_media_data->szAlt, size); else if (field == MSG_MMS_MEDIA_DRM_FULLPATH_STR) strncpy(value, mms_media_data->szDrm2FullPath, size); + else if (field == MSG_MMS_MEDIA_CONTENT_LOCATION_STR) + strncpy(value, mms_media_data->szContentLocation, size); + else if (field == MSG_MMS_MEDIA_CONTENT_TYPE_STR) + strncpy(value, mms_media_data->szContentType, size); else err = MSG_ERR_INVALID_PARAMETER; } @@ -515,6 +653,8 @@ int msg_mms_get_str_value(msg_struct_s *msg_struct, int field, char *value, int strncpy(value, mms_attach_data->szFilePath, size); else if (field == MSG_MMS_ATTACH_DRM_FULLPATH_STR) strncpy(value, mms_attach_data->szDrm2FullPath, size); + else if (field == MSG_MMS_ATTACH_CONTENT_TYPE_STR) + strncpy(value, mms_attach_data->szContentType, size); else err = MSG_ERR_INVALID_PARAMETER; } @@ -572,11 +712,15 @@ int msg_mms_get_str_value(msg_struct_s *msg_struct, int field, char *value, int err = MSG_ERR_INVALID_PARAMETER; } break; + case MSG_STRUCT_MULTIPART_INFO: + err = msg_multipart_get_str_value(msg_struct->data, field, value, size); + break; + default : err = MSG_ERR_INVALID_PARAMETER; break; } - return MSG_SUCCESS; + return err; } int msg_mms_get_bool_value(msg_struct_s *msg_struct, int field, bool *value) @@ -633,7 +777,7 @@ int msg_mms_get_bool_value(msg_struct_s *msg_struct, int field, bool *value) err = MSG_ERR_INVALID_PARAMETER; break; } - return MSG_SUCCESS; + return err; } int msg_mms_get_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s **value) @@ -656,7 +800,7 @@ int msg_mms_get_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s err = MSG_ERR_INVALID_PARAMETER; break; } - return MSG_SUCCESS; + return err; } int msg_mms_get_list_handle(msg_struct_s *msg_struct, int field, msg_list_handle_t *value) @@ -677,6 +821,8 @@ int msg_mms_get_list_handle(msg_struct_s *msg_struct, int field, msg_list_handle *value = (msg_list_handle_t)mms_data->transitionlist; else if (field == MSG_MMS_META_LIST_HND) *value = (msg_list_handle_t)mms_data->metalist; + else if (field == MSG_MMS_MULTIPART_LIST_HND) + *value = (msg_list_handle_t)mms_data->multipartlist; else err = MSG_ERR_INVALID_PARAMETER; } @@ -694,7 +840,7 @@ int msg_mms_get_list_handle(msg_struct_s *msg_struct, int field, msg_list_handle err = MSG_ERR_INVALID_PARAMETER; break; } - return MSG_SUCCESS; + return err; } /*SET*/ int msg_mms_set_int_value(msg_struct_s *msg_struct, int field, int value) @@ -713,6 +859,35 @@ int msg_mms_set_int_value(msg_struct_s *msg_struct, int field, int value) mms_data->rootlayout.bBgColor = true; mms_data->rootlayout.bgColor = value; } + + else if (field == MSG_MMS_HEADER_DATE_INT) { + mms_data->header.date = value; + } else if (field == MSG_MMS_HEADER_DELIVERY_REPORT_INT) { + mms_data->header.bDeliveryReport = (bool)value; + } else if (field == MSG_MMS_HEADER_DELIVERY_TIME_INT) { + mms_data->header.delivery.time = value; + } else if (field == MSG_MMS_HEADER_EXPIRY_TIME_INT) { + mms_data->header.expiry.time = value; + } else if (field == MSG_MMS_HEADER_MESSAGE_CLASS_INT) { + mms_data->header.messageClass = value; + } else if (field == MSG_MMS_HEADER_MESSAGE_TYPE_INT) { + mms_data->header.messageType = value; + } else if (field == MSG_MMS_HEADER_VERSION_INT) { + mms_data->header.mmsVersion = value; + } else if (field == MSG_MMS_HEADER_SIZE_INT) { + mms_data->header.messageSize = value; + } else if (field == MSG_MMS_HEADER_PRIORITY_INT) { + mms_data->header.mmsPriority = value; + } else if (field == MSG_MMS_HEADER_READ_REPORT_INT) { + mms_data->header.bReadReport = (bool)value; + } else if (field == MSG_MMS_HEADER_HIDE_ADDRESS_INT) { + mms_data->header.bHideAddress = value; + } else if (field == MSG_MMS_HEADER_MMS_STATUS_INT) { + mms_data->header.mmsStatus = value; + } else if (field == MSG_MMS_HEADER_CONTENT_CLASS_INT) { + mms_data->header.contentClass = value; + } + else err = MSG_ERR_INVALID_PARAMETER; } @@ -837,7 +1012,7 @@ int msg_mms_set_int_value(msg_struct_s *msg_struct, int field, int value) err = MSG_ERR_INVALID_PARAMETER; break; } - return MSG_SUCCESS; + return err; } int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int size) @@ -855,7 +1030,7 @@ int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int } else if (field == MSG_MMS_MEDIA_FILEPATH_STR) { char *filename = NULL; if (value != NULL) { - MSG_DEBUG("media file path = %s", value); + MSG_SEC_DEBUG("media file path = %s", value); strncpy(mms_media_data->szFilePath, value, MSG_FILEPATH_LEN_MAX); filename = strrchr(value, '/'); if (filename != NULL) { @@ -877,6 +1052,10 @@ int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int strncpy(mms_media_data->szAlt, value, MAX_SMIL_ALT_LEN); else if (field == MSG_MMS_MEDIA_DRM_FULLPATH_STR) strncpy(mms_media_data->szDrm2FullPath, value, MSG_FILEPATH_LEN_MAX); + else if (field == MSG_MMS_MEDIA_CONTENT_LOCATION_STR) + strncpy(mms_media_data->szContentLocation, value, MSG_FILEPATH_LEN_MAX); + else if (field == MSG_MMS_MEDIA_CONTENT_TYPE_STR) + strncpy(mms_media_data->szContentType, value, MSG_FILEPATH_LEN_MAX); else err = MSG_ERR_INVALID_PARAMETER; } @@ -884,14 +1063,14 @@ int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int case MSG_STRUCT_MMS_ATTACH: { MMS_ATTACH_S *mms_attach_data = (MMS_ATTACH_S *)msg_struct->data; - if (field == MSG_MMS_ATTACH_FILENAME_STR) + if (field == MSG_MMS_ATTACH_FILENAME_STR) { strncpy(mms_attach_data->szFileName, value, MSG_FILENAME_LEN_MAX); - else if (field == MSG_MMS_ATTACH_FILEPATH_STR) { + } else if (field == MSG_MMS_ATTACH_FILEPATH_STR) { char *filename = NULL; char *filepath = value; if (filepath != NULL) { - MSG_DEBUG("attach file path = %s", filepath); + MSG_SEC_DEBUG("attach file path = %s", filepath); mms_attach_data->mediatype = MIME_UNKNOWN; mms_attach_data->fileSize = -1; @@ -908,10 +1087,13 @@ int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int MSG_DEBUG("attach file path is NULL"); err = MSG_ERR_INVALID_PARAMETER; } - } else if (field == MSG_MMS_ATTACH_DRM_FULLPATH_STR) + } else if (field == MSG_MMS_ATTACH_DRM_FULLPATH_STR) { strncpy(mms_attach_data->szDrm2FullPath, value, MSG_FILEPATH_LEN_MAX); - else + } else if (field == MSG_MMS_ATTACH_CONTENT_TYPE_STR) { + strncpy(mms_attach_data->szContentType, value, MSG_FILEPATH_LEN_MAX); + } else { err = MSG_ERR_INVALID_PARAMETER; + } } break; case MSG_STRUCT_MMS_REGION: @@ -967,11 +1149,44 @@ int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int err = MSG_ERR_INVALID_PARAMETER; } break; + case MSG_STRUCT_MMS: + { + MMS_DATA_HIDDEN_S *mms_data = (MMS_DATA_HIDDEN_S *)msg_struct->data; + if (field == MSG_MMS_HEADER_CONTENT_LOCATION_STR) {// mms header + strncpy(mms_data->header.contentLocation, value, sizeof(mms_data->header.contentLocation) - 1 ); + } else if (field == MSG_MMS_HEADER_CONTENT_TYPE_STR) { + strncpy(mms_data->header.szContentType, value, sizeof(mms_data->header.szContentType) - 1 ); + } else if (field == MSG_MMS_HEADER_FROM_STR) { + strncpy(mms_data->header.szFrom, value, sizeof(mms_data->header.szFrom) - 1 ); + } else if (field == MSG_MMS_HEADER_MESSAGE_ID_STR) { + strncpy(mms_data->header.messageID, value, sizeof(mms_data->header.messageID) - 1 ); + } else if (field == MSG_MMS_HEADER_TR_ID_STR) { + strncpy(mms_data->header.trID, value, sizeof(mms_data->header.trID) - 1 ); + + } else if (field == MSG_MMS_SMIL_MULTIPART_CONTENT_TYPE_STR) { // smil + strncpy(mms_data->smil.szContentType, value, sizeof(mms_data->smil.szContentType) - 1 ); + } else if (field == MSG_MMS_SMIL_MULTIPART_NAME_STR) { + strncpy(mms_data->smil.szFileName, value, sizeof(mms_data->smil.szFileName) - 1 ); + } else if (field == MSG_MMS_SMIL_MULTIPART_FILEPATH_STR) { + strncpy(mms_data->smil.szFilePath, value, sizeof(mms_data->smil.szFilePath) - 1 ); + } else if (field == MSG_MMS_SMIL_MULTIPART_CONTENT_ID_STR) { + strncpy(mms_data->smil.szContentID, value, sizeof(mms_data->smil.szContentID) - 1 ); + } else if (field == MSG_MMS_SMIL_MULTIPART_CONTENT_LOCATION_STR) { + strncpy(mms_data->smil.szContentLocation, value, sizeof(mms_data->smil.szContentLocation) - 1 ); + } + else + err = MSG_ERR_INVALID_PARAMETER; + } + break; + case MSG_STRUCT_MULTIPART_INFO: + err = msg_multipart_set_str_value(msg_struct->data, field, value, size); + break; + default : err = MSG_ERR_INVALID_PARAMETER; break; } - return MSG_SUCCESS; + return err; } int msg_mms_set_bool_value(msg_struct_s *msg_struct, int field, bool value) @@ -1024,7 +1239,7 @@ int msg_mms_set_bool_value(msg_struct_s *msg_struct, int field, bool value) err = MSG_ERR_INVALID_PARAMETER; break; } - return MSG_SUCCESS; + return err; } int msg_mms_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s *value) @@ -1048,7 +1263,7 @@ int msg_mms_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s err = MSG_ERR_INVALID_PARAMETER; break; } - return MSG_SUCCESS; + return err; } int msg_mms_set_list_handle(msg_struct_s *msg_struct, int field, msg_list_handle_t value) @@ -1086,10 +1301,10 @@ int msg_mms_set_list_handle(msg_struct_s *msg_struct, int field, msg_list_handle err = MSG_ERR_INVALID_PARAMETER; break; } - return MSG_SUCCESS; + return err; } -EXPORT_API int msg_mms_add_item(msg_struct_t msg_struct_handle, int field, msg_struct_t *item) +int msg_mms_list_append(msg_struct_t msg_struct_handle, int field, msg_struct_t *item) { msg_error_t err = MSG_SUCCESS; msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle; @@ -1102,25 +1317,29 @@ EXPORT_API int msg_mms_add_item(msg_struct_t msg_struct_handle, int field, msg_s MMS_DATA_HIDDEN_S *mms_data = (MMS_DATA_HIDDEN_S *)msg_struct->data; if (field == MSG_STRUCT_MMS_PAGE) { - msg_struct_item = msg_mms_create_struct(field); + msg_struct_item = msg_mms_create_struct(MSG_STRUCT_MMS_PAGE); mms_data->pagelist = g_list_append(mms_data->pagelist, msg_struct_item); *item = (msg_struct_t)msg_struct_item; } else if (field == MSG_STRUCT_MMS_REGION) { - msg_struct_item = msg_mms_create_struct(field); + msg_struct_item = msg_mms_create_struct(MSG_STRUCT_MMS_REGION); mms_data->regionlist = g_list_append(mms_data->regionlist, msg_struct_item); *item = (msg_struct_t)msg_struct_item; } else if (field == MSG_STRUCT_MMS_ATTACH) { - msg_struct_item = msg_mms_create_struct(field); + msg_struct_item = msg_mms_create_struct(MSG_STRUCT_MMS_ATTACH); mms_data->attachlist = g_list_append(mms_data->attachlist, msg_struct_item); *item = (msg_struct_t)msg_struct_item; } else if (field == MSG_STRUCT_MMS_TRANSITION) { - msg_struct_item = msg_mms_create_struct(field); + msg_struct_item = msg_mms_create_struct(MSG_STRUCT_MMS_TRANSITION); mms_data->transitionlist = g_list_append(mms_data->transitionlist, msg_struct_item); *item = (msg_struct_t)msg_struct_item; } else if (field == MSG_STRUCT_MMS_META) { - msg_struct_item = msg_mms_create_struct(field); + msg_struct_item = msg_mms_create_struct(MSG_STRUCT_MMS_META); mms_data->metalist = g_list_append(mms_data->metalist, msg_struct_item); *item = (msg_struct_t)msg_struct_item; + } else if (field == MSG_MMS_MULTIPART_LIST_HND) { + msg_struct_item = (msg_struct_s *)msg_create_struct(MSG_STRUCT_MULTIPART_INFO); + mms_data->multipartlist = g_list_append(mms_data->multipartlist, msg_struct_item); + *item = (msg_struct_t)msg_struct_item; } else { err = MSG_ERR_INVALID_PARAMETER; } @@ -1160,8 +1379,9 @@ void convert_to_media_data(const msg_struct_s *pSrc, MMS_MEDIA_S *pDest) memcpy(dst_media->szContentID, src_media->szContentID, MSG_MSG_ID_LEN); memcpy(dst_media->regionId, src_media->regionId, MAX_SMIL_REGION_ID); memcpy(dst_media->szAlt, src_media->szAlt, MAX_SMIL_ALT_LEN); - memcpy(dst_media->szDrm2FullPath, src_media->szDrm2FullPath, MSG_FILEPATH_LEN_MAX); + memcpy(dst_media->szContentType, src_media->szContentType, MSG_MSG_ID_LEN); + memcpy(dst_media->szContentLocation, src_media->szContentLocation, MSG_MSG_ID_LEN); dst_media->drmType = src_media->drmType; if (src_media->mediatype == MMS_SMIL_MEDIA_TEXT) { @@ -1187,8 +1407,9 @@ void convert_from_media_data(const MMS_MEDIA_S *pSrc, msg_struct_s *pDest) memcpy(dst_media->szContentID, src_media->szContentID, MSG_MSG_ID_LEN); memcpy(dst_media->regionId, src_media->regionId, MAX_SMIL_REGION_ID); memcpy(dst_media->szAlt, src_media->szAlt, MAX_SMIL_ALT_LEN); - memcpy(dst_media->szDrm2FullPath, src_media->szDrm2FullPath, MSG_FILEPATH_LEN_MAX); + memcpy(dst_media->szContentType, src_media->szContentType, MSG_MSG_ID_LEN); + memcpy(dst_media->szContentLocation, src_media->szContentLocation, MSG_MSG_ID_LEN); dst_media->drmType = src_media->drmType; if (src_media->mediatype == MMS_SMIL_MEDIA_TEXT) { @@ -1273,6 +1494,8 @@ void convert_to_mmsdata(const msg_struct_s *pSrc, MMS_MESSAGE_DATA_S *pDest) memcpy(&pDest->rootlayout, &pSrcMms->rootlayout, sizeof(MMS_SMIL_ROOTLAYOUT)); memcpy(&pDest->msgAppId, &pSrcMms->msgAppId, sizeof(MMS_APPID_INFO_S)); + memcpy(&pDest->header, &pSrcMms->header, sizeof(MMS_HEADER_DATA_S)); + memcpy(&pDest->smil, &pSrcMms->smil, sizeof(MMS_MULTIPART_DATA_S)); } void convert_from_mmsdata(const MMS_MESSAGE_DATA_S *pSrc, msg_struct_s *pDest) @@ -1344,4 +1567,330 @@ void convert_from_mmsdata(const MMS_MESSAGE_DATA_S *pSrc, msg_struct_s *pDest) memcpy(&pDestMms->rootlayout, &pSrc->rootlayout, sizeof(MMS_SMIL_ROOTLAYOUT)); memcpy(&pDestMms->msgAppId, &pSrc->msgAppId, sizeof(MMS_APPID_INFO_S)); + + memcpy(&pDestMms->header, &pSrc->header, sizeof(MMS_HEADER_DATA_S)); + memcpy(&pDestMms->smil, &pSrc->smil, sizeof(MMS_MULTIPART_DATA_S)); + +} + +void convert_to_mmsdata2(MMS_DATA_HIDDEN_S *pSrcMms, MMS_MESSAGE_DATA_S *pDest) +{ + int i, j; + //MMS_DATA_HIDDEN_S *pSrcMms = (MMS_DATA_HIDDEN_S *)pSrc->data; + + pDest->pageCnt = g_list_length(pSrcMms->pagelist); + + for (i = 0; i < pDest->pageCnt; i++) { + MMS_PAGE_S *page = (MMS_PAGE_S *)calloc(1, sizeof(MMS_PAGE_S)); + MMS_PAGE_S *src_page = (MMS_PAGE_S *)get_msg_struct_data((msg_struct_s *)g_list_nth_data(pSrcMms->pagelist, i)); + page->mediaCnt = g_list_length(src_page->medialist); + + for (j = 0; j < page->mediaCnt; j++) + { + MMS_MEDIA_S *dst_media = (MMS_MEDIA_S *)calloc(1, sizeof(MMS_MEDIA_S)); + msg_struct_s *src_media_s = (msg_struct_s *)g_list_nth_data(src_page->medialist, j); + + convert_to_media_data(src_media_s, dst_media); + + page->medialist = g_list_append(page->medialist, dst_media); + } + + page->nDur = src_page->nDur; + page->nBegin = src_page->nBegin; + page->nEnd = src_page->nEnd; + page->nMin = src_page->nMin; + page->nMax = src_page->nMax; + page->nRepeat = src_page->nRepeat; + + pDest->pagelist = g_list_append(pDest->pagelist, page); + } + + pDest->regionCnt = g_list_length(pSrcMms->regionlist); + + for (i = 0; i < pDest->regionCnt; i++) { + MMS_SMIL_REGION *region = (MMS_SMIL_REGION *)calloc(1, sizeof(MMS_SMIL_REGION)); + MMS_SMIL_REGION *src_region = (MMS_SMIL_REGION *)get_msg_struct_data((msg_struct_s *)g_list_nth_data(pSrcMms->regionlist, i)); + memcpy(region, src_region, sizeof(MMS_SMIL_REGION)); + pDest->regionlist = g_list_append(pDest->regionlist, region); + } + + pDest->attachCnt = g_list_length(pSrcMms->attachlist); + + for (i = 0; i < pDest->attachCnt; i++) { + MMS_ATTACH_S *attach = (MMS_ATTACH_S *)calloc(1, sizeof(MMS_ATTACH_S)); + MMS_ATTACH_S *src_attach = (MMS_ATTACH_S *)get_msg_struct_data((msg_struct_s *)g_list_nth_data(pSrcMms->attachlist, i)); + memcpy(attach, src_attach, sizeof(MMS_ATTACH_S)); + pDest->attachlist = g_list_append(pDest->attachlist, attach); + } + + pDest->transitionCnt = g_list_length(pSrcMms->transitionlist); + + for (i = 0; i < pDest->transitionCnt; i++) { + MMS_SMIL_TRANSITION *transition = (MMS_SMIL_TRANSITION *)calloc(1, sizeof(MMS_SMIL_TRANSITION)); + MMS_SMIL_TRANSITION *src_transition = (MMS_SMIL_TRANSITION *)get_msg_struct_data((msg_struct_s *)g_list_nth_data(pSrcMms->transitionlist, i)); + memcpy(transition, src_transition, sizeof(MMS_SMIL_TRANSITION)); + pDest->transitionlist = g_list_append(pDest->transitionlist, transition); + } + + pDest->metaCnt = g_list_length(pSrcMms->metalist); + + for (i = 0; i < pDest->metaCnt; i++) { + MMS_SMIL_META *meta = (MMS_SMIL_META *)calloc(1, sizeof(MMS_SMIL_META)); + MMS_SMIL_META *src_meta = (MMS_SMIL_META *)get_msg_struct_data((msg_struct_s *)g_list_nth_data(pSrcMms->metalist, i)); + memcpy(meta, src_meta, sizeof(MMS_SMIL_META)); + pDest->metalist = g_list_append(pDest->metalist, meta); + } + + memcpy(&pDest->rootlayout, &pSrcMms->rootlayout, sizeof(MMS_SMIL_ROOTLAYOUT)); + + memcpy(&pDest->msgAppId, &pSrcMms->msgAppId, sizeof(MMS_APPID_INFO_S)); + memcpy(&pDest->header, &pSrcMms->header, sizeof(MMS_HEADER_DATA_S)); + memcpy(&pDest->smil, &pSrcMms->smil, sizeof(MMS_MULTIPART_DATA_S)); +} + +void convert_from_mmsdata2(const MMS_MESSAGE_DATA_S *pSrc, MMS_DATA_HIDDEN_S *pDestMms) +{ + int i, j; + //MMS_DATA_HIDDEN_S *pDestMms = (MMS_DATA_HIDDEN_S *)pDest->data; + + for (i = 0; i < pSrc->pageCnt; i++) { + msg_struct_s *page_struct = msg_mms_create_struct(MSG_STRUCT_MMS_PAGE); + MMS_PAGE_S *page = (MMS_PAGE_S *)page_struct->data; + + MMS_PAGE_S *src_page = (MMS_PAGE_S *)g_list_nth_data(pSrc->pagelist, i); + page->mediaCnt = g_list_length(src_page->medialist); + + for (j = 0; j < page->mediaCnt; j++) + { + msg_struct_s *dst_media_s = msg_mms_create_struct(MSG_STRUCT_MMS_MEDIA); + + MMS_MEDIA_S *src_media = (MMS_MEDIA_S *)g_list_nth_data(src_page->medialist, j); + + convert_from_media_data(src_media, dst_media_s); + + page->medialist = g_list_append(page->medialist, dst_media_s); + } + + page->nDur = src_page->nDur; + page->nBegin = src_page->nBegin; + page->nEnd = src_page->nEnd; + page->nMin = src_page->nMin; + page->nMax = src_page->nMax; + page->nRepeat = src_page->nRepeat; + + pDestMms->pagelist = g_list_append(pDestMms->pagelist, page_struct); + } + + for (i = 0; i < pSrc->regionCnt; i++) { + msg_struct_s *region_struct = msg_mms_create_struct(MSG_STRUCT_MMS_REGION); + MMS_SMIL_REGION *region = (MMS_SMIL_REGION *)region_struct->data; + MMS_SMIL_REGION *src_region = (MMS_SMIL_REGION *)g_list_nth_data(pSrc->regionlist, i); + memcpy(region, src_region, sizeof(MMS_SMIL_REGION)); + pDestMms->regionlist = g_list_append(pDestMms->regionlist, region_struct); + } + + for (i = 0; i < pSrc->attachCnt; i++) { + msg_struct_s *attach_struct = msg_mms_create_struct(MSG_STRUCT_MMS_ATTACH); + MMS_ATTACH_S *attach = (MMS_ATTACH_S *)attach_struct->data; + MMS_ATTACH_S *src_attach = (MMS_ATTACH_S *)g_list_nth_data(pSrc->attachlist, i); + memcpy(attach, src_attach, sizeof(MMS_ATTACH_S)); + pDestMms->attachlist = g_list_append(pDestMms->attachlist, attach_struct); + } + + for (i = 0; i < pSrc->transitionCnt; i++) { + msg_struct_s *transition_struct = msg_mms_create_struct(MSG_STRUCT_MMS_TRANSITION); + MMS_SMIL_TRANSITION *transition = (MMS_SMIL_TRANSITION *)transition_struct->data; + MMS_SMIL_TRANSITION *src_transition = (MMS_SMIL_TRANSITION *)g_list_nth_data(pSrc->transitionlist, i); + memcpy(transition, src_transition, sizeof(MMS_SMIL_TRANSITION)); + pDestMms->transitionlist = g_list_append(pDestMms->transitionlist, transition_struct); + } + + for (i = 0; i < pSrc->metaCnt; i++) { + msg_struct_s *meta_struct = msg_mms_create_struct(MSG_STRUCT_MMS_META); + MMS_SMIL_META *meta = (MMS_SMIL_META *)meta_struct->data; + MMS_SMIL_META *src_meta = (MMS_SMIL_META *)g_list_nth_data(pSrc->metalist, i); + + memcpy(meta, src_meta, sizeof(MMS_SMIL_META)); + pDestMms->metalist = g_list_append(pDestMms->metalist, meta_struct); + } + + memcpy(&pDestMms->rootlayout, &pSrc->rootlayout, sizeof(MMS_SMIL_ROOTLAYOUT)); + + memcpy(&pDestMms->msgAppId, &pSrc->msgAppId, sizeof(MMS_APPID_INFO_S)); + + memcpy(&pDestMms->header, &pSrc->header, sizeof(MMS_HEADER_DATA_S)); + memcpy(&pDestMms->smil, &pSrc->smil, sizeof(MMS_MULTIPART_DATA_S)); + +} + + +int msg_multipart_get_str_value(void *data, int field, char *value, int size) +{ + if (!data || !value) + return MSG_ERR_NULL_POINTER; + + int ret = MSG_SUCCESS; + + MMS_MULTIPART_DATA_S *msg_data = (MMS_MULTIPART_DATA_S *)data; + + switch (field) { + case MSG_MMS_MULTIPART_CONTENT_TYPE_STR: + strncpy(value, msg_data->szContentType, size); + break; + case MSG_MMS_MULTIPART_NAME_STR: + strncpy(value, msg_data->szFileName, size); + break; + case MSG_MMS_MULTIPART_FILEPATH_STR: + strncpy(value, msg_data->szFilePath, size); + break; + case MSG_MMS_MULTIPART_THUMBNAIL_FILEPATH_STR: + strncpy(value, msg_data->szThumbFilePath, size); + break; + case MSG_MMS_MULTIPART_CONTENT_ID_STR: + strncpy(value, msg_data->szContentID, size); + break; + case MSG_MMS_MULTIPART_CONTENT_LOCATION_STR: + strncpy(value, msg_data->szContentLocation, size); + break; + + default : + ret = MSG_ERR_INVALID_PARAMETER; + break; + } + + return ret; +} + +int msg_multipart_get_int_value(void *data, int field, int *value) +{ + if (!data || !value) + return MSG_ERR_NULL_POINTER; + + int ret = MSG_SUCCESS; + + MMS_MULTIPART_DATA_S *msg_data = (MMS_MULTIPART_DATA_S *)data; + + switch (field) { + case MSG_MMS_MULTIPART_TCS_LEVEL_INT: + *value = msg_data->tcs_bc_level; + break; + case MSG_MMS_MULTIPART_MALWARE_ALLOW_INT: + *value = msg_data->malware_allow; + break; + default : + ret = MSG_ERR_INVALID_PARAMETER; + break; + } + + return ret; +} + +int msg_multipart_set_str_value(void *data, int field, char *value, int size) +{ + if (!data || !value) + return MSG_ERR_NULL_POINTER; + + int ret = MSG_SUCCESS; + + MMS_MULTIPART_DATA_S *msg_data = (MMS_MULTIPART_DATA_S *)data; + + //CID 41980: Reducing the size argument to strncpy calls to accomodate string termination '\0' in case source string is larger than size + switch (field) { + case MSG_MMS_MULTIPART_CONTENT_TYPE_STR: + strncpy(msg_data->szContentType, value, MSG_MSG_ID_LEN); + break; + case MSG_MMS_MULTIPART_NAME_STR: + strncpy(msg_data->szFileName, value, MSG_FILENAME_LEN_MAX); + break; + case MSG_MMS_MULTIPART_FILEPATH_STR: + strncpy(msg_data->szFilePath, value, MSG_FILEPATH_LEN_MAX); + break; + case MSG_MMS_MULTIPART_THUMBNAIL_FILEPATH_STR: + break; + case MSG_MMS_MULTIPART_CONTENT_ID_STR: + strncpy(msg_data->szContentID, value, MSG_MSG_ID_LEN); + break; + case MSG_MMS_MULTIPART_CONTENT_LOCATION_STR: + strncpy(msg_data->szContentLocation, value, MSG_MSG_ID_LEN); + break; + default : + ret = MSG_ERR_INVALID_PARAMETER; + break; + } + + return ret; +} +void convert_to_hidden_mmsdata(MMS_DATA_S *pSrc, msg_struct_s *pDest) +{ + MMS_DATA_HIDDEN_S *pDestMms = (MMS_DATA_HIDDEN_S *)pDest->data; + + MMS_MESSAGE_DATA_S MmsMessageData = {0}; + + MsgMmsConvertMmsDataToMmsMessageData(pSrc, &MmsMessageData); + + convert_from_mmsdata2(&MmsMessageData, pDestMms); + + MsgMmsReleaseMmsLists(&MmsMessageData); + + if (pSrc->header) { + memcpy(&pDestMms->header, pSrc->header, sizeof(MMS_HEADER_DATA_S)); + } + + if (pSrc->smil) { + memcpy(&pDestMms->smil, pSrc->smil, sizeof(MMS_MULTIPART_DATA_S)); + pDestMms->smil.type = MIME_APPLICATION_SMIL; + pDestMms->smil.pMultipartData = (char *)calloc(1, pDestMms->smil.nMultipartDataLen+1); + if (pDestMms->smil.pMultipartData) + memcpy(pDestMms->smil.pMultipartData, pSrc->smil->pMultipartData,pDestMms->smil.nMultipartDataLen); + } + + if (pSrc->multipartlist) { + + int list_cnt = g_list_length(pSrc->multipartlist); + + for (int i = 0; i < list_cnt; i++) { + MMS_MULTIPART_DATA_S *src_multipart = (MMS_MULTIPART_DATA_S *)g_list_nth_data(pSrc->multipartlist, i); + + if (src_multipart) { + msg_struct_s *multipart_struct = (msg_struct_s *)msg_create_struct(MSG_STRUCT_MULTIPART_INFO); + + MMS_MULTIPART_DATA_S *dst_multipart = (MMS_MULTIPART_DATA_S*)multipart_struct->data; + + memcpy(dst_multipart, src_multipart, sizeof(MMS_MULTIPART_DATA_S)); + + pDestMms->multipartlist = g_list_append(pDestMms->multipartlist, multipart_struct); + } + } + } + +} + +void convert_from_hidden_mmsdata(msg_struct_s *pSrc, MMS_DATA_S *pDest) +{ + + MMS_DATA_HIDDEN_S *pSrcMms = (MMS_DATA_HIDDEN_S *)pSrc->data; + + MMS_MESSAGE_DATA_S MmsMessageData = {0}; + + convert_to_mmsdata2(pSrcMms, &MmsMessageData); + + MsgMmsConvertMmsMessageDataToMmsData(&MmsMessageData, pDest); + + MsgMmsReleaseMmsLists(&MmsMessageData); +} + +void __msg_mms_data_struct_init(MMS_DATA_HIDDEN_S *pMmsDataHidden) +{ + if (pMmsDataHidden) { + pMmsDataHidden->pagelist = NULL; + pMmsDataHidden->regionlist = NULL; + pMmsDataHidden->attachlist = NULL; + pMmsDataHidden->transitionlist = NULL; + pMmsDataHidden->metalist = NULL; + + MsgMmsInitHeader(&pMmsDataHidden->header); + MsgMmsInitMultipart(&pMmsDataHidden->smil); + pMmsDataHidden->smil.type = MIME_APPLICATION_SMIL; + snprintf(pMmsDataHidden->smil.szContentType, sizeof(pMmsDataHidden->smil.szContentType), "%s", "application/smil"); + } } diff --git a/mapi/msg_setting.cpp b/mapi/msg_setting.cpp index 865590a..fe0123e 100755 --- a/mapi/msg_setting.cpp +++ b/mapi/msg_setting.cpp @@ -1,20 +1,21 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include +#include #include #include "MsgHandle.h" #include "MsgDebug.h" @@ -61,6 +62,9 @@ int msg_setting_get_int_value(msg_struct_s *msg_struct, int field, int *value) case MSG_STRUCT_SETTING_MSGSIZE_OPT : *value = msg_get_msgsize_opt_int(msg_struct->data, field); break; + case MSG_STRUCT_SETTING_VOICE_MSG_OPT : + *value = msg_get_voice_msg_opt_int(msg_struct->data, field); + break; default : err = MSG_ERR_INVALID_PARAMETER; break; @@ -192,6 +196,9 @@ int msg_setting_set_int_value(msg_struct_s *msg_struct, int field, int value) case MSG_STRUCT_SETTING_MSGSIZE_OPT : err = msg_set_msgsize_opt_int(msg_struct->data, field, value); break; + case MSG_STRUCT_SETTING_VOICE_MSG_OPT : + err = msg_set_voice_msg_opt_int(msg_struct->data, field, value); + break; default : err = MSG_ERR_INVALID_PARAMETER; break; @@ -263,9 +270,17 @@ EXPORT_API int msg_get_smsc_opt(msg_handle_t handle, msg_struct_t msg_struct) msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -288,9 +303,17 @@ EXPORT_API int msg_set_smsc_opt(msg_handle_t handle, msg_struct_t msg_struct) msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || msg_struct == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -343,6 +366,9 @@ int msg_get_smsc_opt_int(void *smsc_opt, int field) case MSG_SMSC_SELECTED_ID_INT : ret = smsc_opt_data->selected; break; + case MSG_SMSC_LIST_SIM_INDEX_INT : + ret = smsc_opt_data->simIndex; + break; default : return MSG_ERR_INVALID_PARAMETER; } @@ -364,6 +390,12 @@ int msg_set_smsc_opt_int(void *smsc_opt, int field, int value) case MSG_SMSC_SELECTED_ID_INT : smsc_opt_data->selected = value; break; + case MSG_SMSC_LIST_INDEX_INT : + smsc_opt_data->index = value; + break; + case MSG_SMSC_LIST_SIM_INDEX_INT : + smsc_opt_data->simIndex = value; + break; default : ret = MSG_ERR_INVALID_PARAMETER; break; @@ -489,9 +521,17 @@ EXPORT_API int msg_get_cb_opt(msg_handle_t handle, msg_struct_t msg_struct) msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -514,9 +554,17 @@ EXPORT_API int msg_set_cb_opt(msg_handle_t handle, msg_struct_t msg_struct) msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || msg_struct == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -548,6 +596,9 @@ int msg_get_cb_option_int(void *cb_opt, int field) case MSG_CB_MAX_SIM_COUNT_INT : ret = cb_opt_data->maxSimCnt; break; + case MSG_CB_SIM_INDEX_INT : + ret = cb_opt_data->simIndex; + break; default : ret = MSG_ERR_INVALID_PARAMETER; break; @@ -570,6 +621,9 @@ int msg_set_cb_option_int(void *cb_opt, int field, int value) case MSG_CB_MAX_SIM_COUNT_INT : cb_opt_data->maxSimCnt = value; break; + case MSG_CB_SIM_INDEX_INT : + cb_opt_data->simIndex = value; + break; default : ret = MSG_ERR_INVALID_PARAMETER; break; @@ -844,9 +898,17 @@ EXPORT_API int msg_get_sms_send_opt(msg_handle_t handle, msg_struct_t msg_struct msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -869,9 +931,17 @@ EXPORT_API int msg_set_sms_send_opt(msg_handle_t handle, msg_struct_t msg_struct msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || msg_struct == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -998,9 +1068,17 @@ EXPORT_API int msg_get_mms_send_opt(msg_handle_t handle, msg_struct_t msg_struct msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -1023,9 +1101,17 @@ EXPORT_API int msg_set_mms_send_opt(msg_handle_t handle, msg_struct_t msg_struct msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || msg_struct == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -1213,9 +1299,17 @@ EXPORT_API int msg_get_mms_recv_opt(msg_handle_t handle, msg_struct_t msg_struct msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -1238,9 +1332,17 @@ EXPORT_API int msg_set_mms_recv_opt(msg_handle_t handle, msg_struct_t msg_struct msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || msg_struct == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -1372,9 +1474,17 @@ EXPORT_API int msg_get_push_msg_opt(msg_handle_t handle, msg_struct_t msg_struct { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -1396,9 +1506,17 @@ EXPORT_API int msg_set_push_msg_opt(msg_handle_t handle, msg_struct_t msg_struct { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || msg_struct == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -1506,9 +1624,17 @@ EXPORT_API int msg_get_voice_msg_opt(msg_handle_t handle, msg_struct_t msg_struc { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -1530,9 +1656,17 @@ EXPORT_API int msg_set_voice_msg_opt(msg_handle_t handle, msg_struct_t msg_struc { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || msg_struct == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -1550,6 +1684,49 @@ EXPORT_API int msg_set_voice_msg_opt(msg_handle_t handle, msg_struct_t msg_struc return err; } +int msg_get_voice_msg_opt_int(void *voice_msg_opt, int field) +{ + if (!voice_msg_opt) + return MSG_ERR_NULL_POINTER; + + int ret = MSG_ERR_INVALID_PARAMETER; + + MSG_VOICEMAIL_OPT_S *voice_opt = (MSG_VOICEMAIL_OPT_S *)voice_msg_opt; + + switch (field) + { + case MSG_VOICEMSG_SIM_INDEX_INT : + ret = voice_opt->simIndex; + break; + default : + break; + } + + return ret; +} + +int msg_set_voice_msg_opt_int(void *voice_msg_opt, int field, int value) +{ + if (!voice_msg_opt) + return MSG_ERR_NULL_POINTER; + + int ret = MSG_SUCCESS; + + MSG_VOICEMAIL_OPT_S *voice_opt = (MSG_VOICEMAIL_OPT_S *)voice_msg_opt; + + switch (field) + { + case MSG_VOICEMSG_SIM_INDEX_INT : + voice_opt->simIndex = value; + break; + default : + ret = MSG_ERR_INVALID_PARAMETER; + break; + } + + return ret; +} + char *msg_get_voice_msg_opt_str(void *voice_msg_opt, int field) { if (!voice_msg_opt) @@ -1564,6 +1741,9 @@ char *msg_get_voice_msg_opt_str(void *voice_msg_opt, int field) case MSG_VOICEMSG_ADDRESS_STR : ret_str = voice_opt->mailNumber; break; + case MSG_VOICEMSG_ALPHA_ID_STR : + ret_str = voice_opt->alpahId; + break; default : break; } @@ -1598,9 +1778,17 @@ EXPORT_API int msg_get_general_opt(msg_handle_t handle, msg_struct_t msg_struct) { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -1622,9 +1810,17 @@ EXPORT_API int msg_set_general_opt(msg_handle_t handle, msg_struct_t msg_struct) { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || msg_struct == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -1656,6 +1852,18 @@ int msg_get_general_opt_int(void *general_opt, int field) case MSG_GENERAL_ALERT_TONE_INT : ret = opt->alertTone; break; + case MSG_GENERAL_SMS_LIMIT_CNT_INT : + ret = opt->smsLimitCnt; + break; + case MSG_GENERAL_MMS_LIMIT_CNT_INT : + ret = opt->mmsLimitCnt; + break; + case MSG_GENERAL_RINGTONE_TYPE_INT : + ret = opt->ringtoneType; + break; + case MSG_GENERAL_MSG_SEARCH_TAGS_INT : + ret = opt->searchTags; + break; default : break; } @@ -1677,6 +1885,18 @@ int msg_set_general_opt_int(void *general_opt, int field, int value) case MSG_GENERAL_ALERT_TONE_INT : opt->alertTone = value; break; + case MSG_GENERAL_SMS_LIMIT_CNT_INT : + opt->smsLimitCnt = value; + break; + case MSG_GENERAL_MMS_LIMIT_CNT_INT : + opt->mmsLimitCnt = value; + break; + case MSG_GENERAL_RINGTONE_TYPE_INT : + opt->ringtoneType = value; + break; + case MSG_GENERAL_MSG_SEARCH_TAGS_INT : + opt->searchTags = value; + break; default : ret = MSG_ERR_INVALID_PARAMETER; break; @@ -1702,6 +1922,18 @@ bool msg_get_general_opt_bool(void *general_opt, int field) case MSG_GENERAL_AUTO_ERASE_BOOL : ret = opt->bAutoErase; break; + case MSG_GENERAL_BLOCK_UNKNOWN_NUMBER_BOOL : + ret = opt->bBlockUnknownMsg; + break; + case MSG_GENERAL_MSG_NOTIFICATION_BOOL : + ret = opt->bNotification; + break; + case MSG_GENERAL_MSG_VIBRATION_BOOL : + ret = opt->bVibration; + break; + case MSG_GENERAL_MSG_PREVIEW_BOOL : + ret = opt->bPreview; + break; default : break; } @@ -1726,6 +1958,62 @@ int msg_set_general_opt_bool(void *general_opt, int field, bool value) case MSG_GENERAL_AUTO_ERASE_BOOL : opt->bAutoErase = value; break; + case MSG_GENERAL_BLOCK_UNKNOWN_NUMBER_BOOL : + opt->bBlockUnknownMsg = value; + break; + case MSG_GENERAL_MSG_NOTIFICATION_BOOL : + opt->bNotification = value; + break; + case MSG_GENERAL_MSG_VIBRATION_BOOL : + opt->bVibration = value; + break; + case MSG_GENERAL_MSG_PREVIEW_BOOL : + opt->bPreview = value; + break; + default : + ret = MSG_ERR_INVALID_PARAMETER; + break; + } + + return ret; +} + +char *msg_get_general_opt_str(void *general_opt, int field) +{ + if (!general_opt) + return NULL; + + char *ret_str = NULL; + + MSG_GENERAL_OPT_S *opt = (MSG_GENERAL_OPT_S *)general_opt; + + switch (field) + { + case MSG_GENERAL_RINGTONE_PATH_STR : + ret_str = opt->ringtonePath; + break; + default : + break; + } + + return ret_str; +} + +int msg_set_general_opt_str(void *general_opt, int field, char *val, int size) +{ + if (!general_opt) + return MSG_ERR_NULL_POINTER; + + int ret = MSG_SUCCESS; + + MSG_GENERAL_OPT_S *opt = (MSG_GENERAL_OPT_S *)general_opt; + + switch (field) + { + case MSG_GENERAL_RINGTONE_PATH_STR : + bzero(opt->ringtonePath, sizeof(opt->ringtonePath)); + snprintf(opt->ringtonePath, sizeof(opt->ringtonePath), "%s", val); + break; default : ret = MSG_ERR_INVALID_PARAMETER; break; @@ -1734,13 +2022,22 @@ int msg_set_general_opt_bool(void *general_opt, int field, bool value) return ret; } + EXPORT_API int msg_get_msgsize_opt(msg_handle_t handle, msg_struct_t msg_struct) { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -1762,9 +2059,17 @@ EXPORT_API int msg_set_msgsize_opt(msg_handle_t handle, msg_struct_t msg_struct) { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || msg_struct == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; diff --git a/mapi/msg_storage.cpp b/mapi/msg_storage.cpp index 0816d0a..ae51bfc 100755 --- a/mapi/msg_storage.cpp +++ b/mapi/msg_storage.cpp @@ -1,20 +1,21 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include +#include #include "MsgHandle.h" #include "MsgDebug.h" @@ -33,9 +34,17 @@ EXPORT_API int msg_add_message(msg_handle_t handle, msg_struct_t opq_msg, const { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || opq_msg == NULL || send_opt == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -61,9 +70,17 @@ EXPORT_API int msg_add_syncml_message(msg_handle_t handle, const msg_struct_t sy { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || syncml_msg == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -87,9 +104,17 @@ EXPORT_API int msg_update_message(msg_handle_t handle, const msg_struct_t opq_ms { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || opq_msg == NULL || send_opt == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -98,12 +123,6 @@ EXPORT_API int msg_update_message(msg_handle_t handle, const msg_struct_t opq_ms MSG_MESSAGE_HIDDEN_S *msg = (MSG_MESSAGE_HIDDEN_S *)pMsgStruct->data; - if (msg->addr_list->nCount > 1) - { - MSG_DEBUG("Multiple Address cannot be updated [%d]", msg->addr_list->nCount); - return -EINVAL; - } - try { err = pHandle->updateMessage(msg, (MSG_SENDINGOPT_S *)pStruct->data); @@ -122,9 +141,17 @@ EXPORT_API int msg_update_read_status(msg_handle_t handle, msg_message_id_t msg_ { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -143,13 +170,54 @@ EXPORT_API int msg_update_read_status(msg_handle_t handle, msg_message_id_t msg_ } +EXPORT_API int msg_set_conversation_to_read(msg_handle_t handle, msg_thread_id_t thread_id) +{ + msg_error_t err = MSG_SUCCESS; + + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + + if (handle == NULL) + { + return MSG_ERR_INVALID_PARAMETER; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->setConversationToRead(thread_id); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + EXPORT_API int msg_update_protected_status(msg_handle_t handle, msg_message_id_t msg_id, bool is_protected) { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -167,14 +235,21 @@ EXPORT_API int msg_update_protected_status(msg_handle_t handle, msg_message_id_t return err; } - EXPORT_API int msg_delete_message(msg_handle_t handle, msg_message_id_t msg_id) { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -197,9 +272,17 @@ EXPORT_API int msg_delete_all_msgs_in_folder(msg_handle_t handle, msg_folder_id_ { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -222,9 +305,17 @@ EXPORT_API int msg_delete_msgs_by_list(msg_handle_t handle, msg_id_list_s *msg_i { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -247,9 +338,17 @@ EXPORT_API int msg_move_msg_to_folder(msg_handle_t handle, msg_message_id_t msg_ { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -272,12 +371,20 @@ EXPORT_API int msg_move_msg_to_storage(msg_handle_t handle, msg_message_id_t msg { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } - if (storage_id != MSG_STORAGE_PHONE && storage_id != MSG_STORAGE_SIM) + if (storage_id < MSG_STORAGE_PHONE || storage_id > MSG_STORAGE_SIM2) { MSG_FATAL("unsupported storage [%d]", storage_id); return MSG_ERR_INVALID_PARAMETER; @@ -303,9 +410,17 @@ EXPORT_API int msg_count_message(msg_handle_t handle, msg_folder_id_t folder_id, { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -328,9 +443,17 @@ EXPORT_API int msg_count_msg_by_type(msg_handle_t handle, msg_message_type_t msg { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -371,9 +494,17 @@ EXPORT_API int msg_count_msg_by_contact(msg_handle_t handle, const msg_struct_t { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || addr_info == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -398,10 +529,18 @@ EXPORT_API int msg_get_message(msg_handle_t handle, msg_message_id_t msg_id, msg { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || !opq_msg) { MSG_FATAL("handle or opq_msg is NULL"); - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -426,10 +565,18 @@ EXPORT_API int msg_get_vobject_data(msg_handle_t handle, msg_message_id_t msg_id { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || result_data == NULL) { MSG_FATAL("handle or result_data is NULL"); - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -446,14 +593,23 @@ EXPORT_API int msg_get_vobject_data(msg_handle_t handle, msg_message_id_t msg_id return err; } + EXPORT_API int msg_get_conversation(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_t conv) { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || !conv) { MSG_FATAL("handle or opq_msg is NULL"); - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -472,51 +628,22 @@ EXPORT_API int msg_get_conversation(msg_handle_t handle, msg_message_id_t msg_id return err; } -EXPORT_API int msg_get_folder_view_list(msg_handle_t handle, msg_folder_id_t folder_id, const msg_struct_t sort_rule, msg_struct_list_s *msg_folder_view_list) + +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) { msg_error_t err = MSG_SUCCESS; - if (handle == NULL) + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) { - return -EINVAL; - } - - MsgHandle* pHandle = (MsgHandle*)handle; - msg_struct_s *pStruct = (msg_struct_s *)sort_rule; - - try - { - if (sort_rule == NULL) - { - MSG_SORT_RULE_S sortRule = {0}; - - sortRule.sortType = MSG_SORT_BY_READ_STATUS; - sortRule.bAscending = true; - - err = pHandle->getFolderViewList(folder_id, &sortRule, msg_folder_view_list); - } - else - { - err = pHandle->getFolderViewList(folder_id, (MSG_SORT_RULE_S *)pStruct->data, msg_folder_view_list); - } - } - catch (MsgException& e) - { - MSG_FATAL("%s", e.what()); - return MSG_ERR_STORAGE_ERROR; + return MSG_ERR_PERMISSION_DENIED; } - return err; -} - - -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) -{ - msg_error_t err = MSG_SUCCESS; - if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -552,9 +679,17 @@ EXPORT_API int msg_get_conversation_view_list(msg_handle_t handle, msg_thread_id { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -577,9 +712,17 @@ EXPORT_API int msg_delete_thread_message_list(msg_handle_t handle, msg_thread_id { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -602,9 +745,17 @@ EXPORT_API int msg_add_folder(msg_handle_t handle, const msg_struct_t folder_inf { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || folder_info == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -628,9 +779,17 @@ EXPORT_API int msg_update_folder(msg_handle_t handle, const msg_struct_t folder_ { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || folder_info == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -654,9 +813,17 @@ EXPORT_API int msg_delete_folder(msg_handle_t handle, msg_folder_id_t folder_id) { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -679,9 +846,17 @@ EXPORT_API int msg_get_folder_list(msg_handle_t handle, msg_struct_list_s *folde { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -702,16 +877,24 @@ EXPORT_API int msg_get_folder_list(msg_handle_t handle, msg_struct_list_s *folde 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) { + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { MSG_DEBUG("Handle is NULL"); - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } if (folder_id >= MSG_MAX_FOLDER_ID) { MSG_DEBUG("folderId is invalid [%d]", folder_id); - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MSG_DEBUG("type : %d, folder : %d, num_msg : %d", msg_type, folder_id, num_msg); @@ -852,108 +1035,22 @@ EXPORT_API int msg_generate_message(msg_handle_t handle, msg_message_type_t msg_ } -EXPORT_API int msg_generate_sms(msg_handle_t handle, msg_folder_id_t folder_id, unsigned int num_msg) +EXPORT_API int msg_get_quick_panel_data(msg_handle_t handle, msg_quickpanel_type_t type, msg_struct_t opq_msg) { - MSG_DEBUG("folder %d, num_msg %d", folder_id, num_msg); - - if (handle == NULL) - { - MSG_DEBUG("Handle is NULL"); - return -EINVAL; - } - - if (folder_id >= MSG_MAX_FOLDER_ID) - { - MSG_DEBUG("folderId is invalid"); - return -EINVAL; - } - - int err = 0; - char strMsg[20] = {0}; - char prefix[10] ="0103001"; - int postfix = 0; - - MSG_SENDINGOPT_S sendingOpt = {0}; - sendingOpt.bSetting = false; - - srand(getpid()); - - msg_struct_s *msg_s = NULL; - msg_struct_s *addr_s = NULL; - MSG_MESSAGE_HIDDEN_S *msgInfo = NULL; - MSG_ADDRESS_INFO_S *addrInfo = NULL; + msg_error_t err = MSG_SUCCESS; - for (unsigned int i = 0; i < num_msg; i++) + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) { - msg_s = (msg_struct_s *)msg_create_struct(MSG_STRUCT_MESSAGE_INFO); - msgInfo = (MSG_MESSAGE_HIDDEN_S *)msg_s->data; - - msgInfo->msgId = 0; // It should be set 0 - msgInfo->folderId = folder_id; - - msgInfo->mainType = MSG_SMS_TYPE; - msgInfo->subType = 0; - - msgInfo->storageId = MSG_STORAGE_PHONE; - - snprintf(strMsg, sizeof(strMsg), "test %d", i); - msgInfo->dataSize = strlen(strMsg); - msgInfo->pData = strMsg; - - msgInfo->addr_list->nCount = 1; - - addr_s = (msg_struct_s *)msgInfo->addr_list->msg_struct_info[0]; - - addrInfo = (MSG_ADDRESS_INFO_S *)addr_s->data; - - addrInfo->addressType = MSG_ADDRESS_TYPE_PLMN; - postfix = rand()%10000; - snprintf(addrInfo->addressVal, MAX_ADDRESS_VAL_LEN+1, "%s%04d", prefix, postfix); - - addrInfo->recipientType = MSG_RECIPIENTS_TYPE_TO; - - time(&(msgInfo->displayTime)); - - msgInfo->networkStatus = MSG_NETWORK_NOT_SEND; - msgInfo->bRead = false; - msgInfo->bProtected = false; - msgInfo->priority = MSG_MESSAGE_PRIORITY_NORMAL; - msgInfo->direction = MSG_DIRECTION_TYPE_MO; - -// err = msg_add_message(handle, (msg_message_t) &msgInfo, &sendingOpt); - try - { - MsgHandle* pHandle = (MsgHandle*)handle; - err = pHandle->addMessage(msgInfo, &sendingOpt); - } - catch (MsgException& e) - { - MSG_FATAL("%s", e.what()); - msg_release_struct((msg_struct_t *)&msg_s); - return MSG_ERR_STORAGE_ERROR; - } - - msg_release_struct((msg_struct_t *)&msg_s); - - if (err < 0) - { - MSG_DEBUG("err [%d]", err); - return err; - } + return MSG_ERR_PERMISSION_DENIED; } - return MSG_SUCCESS; -} - - -EXPORT_API int msg_get_quick_panel_data(msg_handle_t handle, msg_quickpanel_type_t type, msg_struct_t opq_msg) -{ - msg_error_t err = MSG_SUCCESS; - if (handle == NULL || !opq_msg ) { MSG_FATAL("handle or opq_msg is NULL"); - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -977,9 +1074,17 @@ EXPORT_API int msg_reset_database(msg_handle_t handle) { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -1002,9 +1107,17 @@ EXPORT_API int msg_get_mem_size(msg_handle_t handle, unsigned int* memsize) { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -1027,9 +1140,17 @@ EXPORT_API int msg_backup_message(msg_handle_t handle, msg_message_backup_type_t { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || backup_filepath == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -1052,9 +1173,17 @@ EXPORT_API int msg_restore_message(msg_handle_t handle, const char *backup_filep { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || backup_filepath == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -1077,14 +1206,22 @@ EXPORT_API int msg_search_message_for_thread_view(msg_handle_t handle, const cha { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || search_string == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } if (strlen(search_string) <= 0 || strlen(search_string) > MAX_MSG_TEXT_LEN) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -1102,22 +1239,28 @@ EXPORT_API int msg_search_message_for_thread_view(msg_handle_t handle, const cha return err; } - -EXPORT_API int msg_search_message(msg_handle_t handle, const msg_struct_t msg_search_conditions, int offset, int limit, msg_struct_list_s *msg_list) +EXPORT_API int msg_get_reject_msg_list(msg_handle_t handle, const char *phone_num, msg_struct_list_s *msg_reject_msg_list) { msg_error_t err = MSG_SUCCESS; - if (handle == NULL || msg_search_conditions == NULL) + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) { - return -EINVAL; + return MSG_ERR_PERMISSION_DENIED; + } + + if (handle == NULL) + { + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; - msg_struct_s *pStruct = (msg_struct_s *)msg_search_conditions; try { - err = pHandle->searchMessage((MSG_SEARCH_CONDITION_S *)pStruct->data, offset, limit, msg_list); + err = pHandle->getRejectMsgList(phone_num, msg_reject_msg_list); } catch (MsgException& e) { @@ -1128,69 +1271,96 @@ EXPORT_API int msg_search_message(msg_handle_t handle, const msg_struct_t msg_se return err; } -EXPORT_API int msg_get_reject_msg_list(msg_handle_t handle, const char *phone_num, msg_struct_list_s *msg_reject_msg_list) + +EXPORT_API int msg_reg_storage_change_callback(msg_handle_t handle, msg_storage_change_cb cb, void *user_param) { msg_error_t err = MSG_SUCCESS; - if (handle == NULL) + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + + if (handle == NULL || cb == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; try { - err = pHandle->getRejectMsgList(phone_num, msg_reject_msg_list); + err = pHandle->regStorageChangeCallback(cb, user_param); } catch (MsgException& e) { MSG_FATAL("%s", e.what()); - return MSG_ERR_STORAGE_ERROR; + if (e.errorCode() == MsgException::SERVER_READY_ERROR) + return MSG_ERR_PERMISSION_DENIED; + else + return MSG_ERR_CALLBACK_ERROR; } return err; } - -EXPORT_API int msg_reg_storage_change_callback(msg_handle_t handle, msg_storage_change_cb cb, void *user_param) +EXPORT_API int msg_get_report_status(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_list_s *report_list) { msg_error_t err = MSG_SUCCESS; - if (handle == NULL || cb == NULL) + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + + if (handle == NULL || msg_id < 1 || report_list == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; try { - err = pHandle->regStorageChangeCallback(cb, user_param); + err = pHandle->getReportStatus(msg_id, report_list); } catch (MsgException& e) { MSG_FATAL("%s", e.what()); - return MSG_ERR_CALLBACK_ERROR; + return MSG_ERR_STORAGE_ERROR; } return err; } -EXPORT_API int msg_get_report_status(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_list_s *report_list) +EXPORT_API int msg_get_address_list(msg_handle_t handle, msg_thread_id_t thread_id, msg_struct_list_s *msg_address_list) { msg_error_t err = MSG_SUCCESS; - if (handle == NULL || msg_id < 1 || report_list == NULL) + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; try { - err = pHandle->getReportStatus(msg_id, report_list); + err = pHandle->getAddressList(thread_id, msg_address_list); } catch (MsgException& e) { @@ -1201,20 +1371,32 @@ EXPORT_API int msg_get_report_status(msg_handle_t handle, msg_message_id_t msg_i return err; } -EXPORT_API int msg_get_address_list(msg_handle_t handle, msg_thread_id_t thread_id, msg_struct_list_s *msg_address_list) + +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) { msg_error_t err = MSG_SUCCESS; - if (handle == NULL) + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) { - return -EINVAL; + return MSG_ERR_PERMISSION_DENIED; + } + + if (handle == NULL || msg_address_list == NULL || thread_id == NULL) { + return MSG_ERR_INVALID_PARAMETER; + } + + if (msg_address_list->nCount < 1 ) { + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; try { - err = pHandle->getAddressList(thread_id, msg_address_list); + err = pHandle->getThreadIdByAddress(msg_address_list, thread_id); } catch (MsgException& e) { @@ -1226,13 +1408,21 @@ EXPORT_API int msg_get_address_list(msg_handle_t handle, msg_thread_id_t thread_ } -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) +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) { msg_error_t err = MSG_SUCCESS; - if (handle == NULL || msg_address_list->nCount < 1) + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + + if (handle == NULL || msg_address_list == NULL || thread_id == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -1255,9 +1445,17 @@ EXPORT_API int msg_get_thread(msg_handle_t handle, msg_thread_id_t thread_id, ms { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || msg_thread == NULL ) { MSG_FATAL("handle or msg_thread is NULL"); - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -1282,20 +1480,28 @@ EXPORT_API int msg_get_thread(msg_handle_t handle, msg_thread_id_t thread_id, ms return err; } - -EXPORT_API int msg_get_message_list(msg_handle_t handle, msg_folder_id_t folder_id, msg_thread_id_t thread_id, msg_message_type_t msg_type, msg_storage_id_t storage_id, msg_struct_list_s *msg_list) +EXPORT_API int msg_get_message_list2(msg_handle_t handle, const msg_struct_t msg_list_conditions, msg_struct_list_s *msg_list) { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; + msg_struct_s *pStruct = (msg_struct_s *)msg_list_conditions; try { - err = pHandle->getMessageList(folder_id, thread_id, msg_type, storage_id, msg_list); + err = pHandle->getMessageList((MSG_LIST_CONDITION_S *)pStruct->data, msg_list); } catch (MsgException& e) { @@ -1310,21 +1516,40 @@ static int msg_get_msg_type(int mainType, int subType) { if (mainType == MSG_SMS_TYPE) { - if (subType == MSG_CB_SMS) - return MSG_TYPE_SMS_CB; - else if (subType == MSG_JAVACB_SMS) - return MSG_TYPE_SMS_JAVACB; - else if (subType == MSG_WAP_SI_SMS || subType == MSG_WAP_SL_SMS) - return MSG_TYPE_SMS_WAPPUSH; - else if (subType == MSG_MWI_VOICE_SMS || subType == MSG_MWI_FAX_SMS - || subType == MSG_MWI_EMAIL_SMS || subType == MSG_MWI_OTHER_SMS) - return MSG_TYPE_SMS_MWI; - else if (subType == MSG_SYNCML_CP) - return MSG_TYPE_SMS_SYNCML; - else if (subType == MSG_REJECT_SMS) - return MSG_TYPE_SMS_REJECT; - else - return MSG_TYPE_SMS; + switch (subType) { + case MSG_CB_SMS : + return MSG_TYPE_SMS_CB; + case MSG_JAVACB_SMS : + return MSG_TYPE_SMS_JAVACB; + case MSG_WAP_SI_SMS : + case MSG_WAP_SL_SMS : + return MSG_TYPE_SMS_WAPPUSH; + case MSG_MWI_VOICE_SMS : + case MSG_MWI_FAX_SMS : + case MSG_MWI_EMAIL_SMS : + case MSG_MWI_OTHER_SMS : + return MSG_TYPE_SMS_MWI; + case MSG_SYNCML_CP : + return MSG_TYPE_SMS_SYNCML; + case MSG_REJECT_SMS : + return MSG_TYPE_SMS_REJECT; + case MSG_ETWS_SMS : + return MSG_TYPE_SMS_ETWS_PRIMARY; + case MSG_CMAS_PRESIDENTIAL : + return MSG_TYPE_SMS_CMAS_PRESIDENTIAL; + case MSG_CMAS_EXTREME : + return MSG_TYPE_SMS_CMAS_EXTREME; + case MSG_CMAS_SEVERE : + return MSG_TYPE_SMS_CMAS_SEVERE; + case MSG_CMAS_AMBER : + return MSG_TYPE_SMS_CMAS_AMBER; + case MSG_CMAS_TEST : + return MSG_TYPE_SMS_CMAS_TEST; + case MSG_CMAS_OPERATOR_DEFINED : + return MSG_TYPE_SMS_CMAS_OPERATOR_DEFINED; + default : + return MSG_TYPE_SMS; + } } else if (mainType == MSG_MMS_TYPE) { @@ -1488,6 +1713,18 @@ int msg_thread_info_get_int(void *data, int field) case MSG_THREAD_MMS_COUNT_INT : result = pThread->mmsCnt; break; + case MSG_THREAD_TRANSLATION_SENDER_LANG_INT : + result = pThread->msgTranslation.senderLang; + break; + case MSG_THREAD_TRANSLATION_RECEIVER_LANG_INT : + result = pThread->msgTranslation.receiverLang; + break; + case MSG_THREAD_LAST_MSG_ID_INT : + result = pThread->lastMsgId; + break; + case MSG_THREAD_MSG_TAG_TYPE_INT: + result = pThread->tagType; + break; default: result = MSG_ERR_INVALID_PARAMETER; break; @@ -1539,6 +1776,12 @@ int msg_conv_info_get_int(void *data, int field) case MSG_CONV_MSG_PAGE_COUNT_INT : result = pConv->pageCount; break; + case MSG_CONV_MSG_TCS_BC_LEVEL_INT : + result = pConv->tcs_bc_level; + break; + case MSG_CONV_MSG_SIM_INDEX_INT : + result = pConv->simIndex; + break; default: result = MSG_ERR_INVALID_PARAMETER; break; @@ -1569,6 +1812,48 @@ int msg_search_condition_get_int(void *condition_info, int field) return result; } + +int msg_list_condition_get_int(void *condition_info, int field) +{ + int result = MSG_ERR_INVALID_PARAMETER; + MSG_LIST_CONDITION_S *pCond = (MSG_LIST_CONDITION_S *)condition_info; + switch(field) + { + case MSG_LIST_CONDITION_FOLDER_ID_INT: + result = pCond->folderId; + break; + case MSG_LIST_CONDITION_THREAD_ID_INT: + result = pCond->threadId; + break; + case MSG_LIST_CONDITION_STORAGE_ID_INT: + result = pCond->storageId; + break; + case MSG_LIST_CONDITION_MSGTYPE_INT: + result = pCond->msgType; + break; + case MSG_LIST_CONDITION_FROM_TIME_INT: + result = pCond->fromTime; + break; + case MSG_LIST_CONDITION_TO_TIME_INT: + result = pCond->toTime; + break; + case MSG_LIST_CONDITION_OFFSET_INT: + result = pCond->offset; + break; + case MSG_LIST_CONDITION_LIMIT_INT: + result = pCond->limit; + break; + case MSG_LIST_CONDITION_SIM_INDEX_INT: + result = pCond->simIndex; + break; + default: + result = MSG_ERR_INVALID_PARAMETER; + break; + } + return result; +} + + int msg_report_status_get_int(void *report_info, int field) { int result = MSG_ERR_INVALID_PARAMETER; @@ -1671,6 +1956,9 @@ char *msg_conv_info_get_str(void *data, int field) case MSG_CONV_MSG_TEXT_STR : ret_str = pConv->pText; break; + case MSG_CONV_MSG_1ST_MEDIA_PATH_STR : + ret_str = pConv->firstMediaPath; + break; default: break; } @@ -1691,7 +1979,26 @@ char* msg_search_condition_get_str(void *condition_info, int field, int size) case MSG_SEARCH_CONDITION_SEARCH_VALUE_STR: result = search_cond->pSearchVal; break; + default: + result = NULL; + break; + } + return result; +} + +char* msg_list_condition_get_str(void *condition_info, int field, int size) +{ + char *result = NULL; + MSG_LIST_CONDITION_S *cond = (MSG_LIST_CONDITION_S *)condition_info; + switch(field) + { + case MSG_LIST_CONDITION_ADDRESS_VALUE_STR: + result = cond->pAddressVal; + break; + case MSG_LIST_CONDITION_TEXT_VALUE_STR: + result = cond->pTextVal; + break; default: result = NULL; break; @@ -1699,6 +2006,7 @@ char* msg_search_condition_get_str(void *condition_info, int field, int size) return result; } + bool msg_sendopt_get_bool(void *send_opt, int field) { bool result = false; @@ -1762,12 +2070,53 @@ bool msg_thread_info_get_bool(void *data, int field) case MSG_THREAD_PROTECTED_BOOL: result = pthreadInfo->bProtected; break; + case MSG_THREAD_DRAFT_BOOL : + result = pthreadInfo->bDraft; + break; + case MSG_THREAD_SEND_FAILED_BOOL : + result = pthreadInfo->bSendFailed; + break; + case MSG_THREAD_SENDING_BOOL : + result = pthreadInfo->bSending; + break; + case MSG_THREAD_TRANSLATION_BOOL : + result = pthreadInfo->msgTranslation.bTranslation; + break; + case MSG_THREAD_TRANSLATION_INCLUDE_ORGMSG_BOOL : + result = pthreadInfo->msgTranslation.bIncludeOrgMsg; + break; + case MSG_THREAD_TRANSLATION_RECEIVE_ONLY_BOOL : + result = pthreadInfo->msgTranslation.bOnlyReceive; + break; + default: + break; + } + return result; +} + + +bool msg_list_condition_get_bool(void *data, int field) +{ + bool result = false; + MSG_LIST_CONDITION_S *pCond = (MSG_LIST_CONDITION_S *)data; + switch(field) + { + case MSG_LIST_CONDITION_PROTECTED_BOOL: + result = pCond->bProtected; + break; + case MSG_LIST_CONDITION_SCHEDULED_BOOL : + result = pCond->bScheduled; + break; + case MSG_LIST_CONDITION_AND_OPERATER_BOOL : + result = pCond->bAnd; + break; default: break; } return result; } + int msg_sendopt_get_struct_handle(msg_struct_s *msg_struct, int field, void **value) { msg_error_t err = MSG_SUCCESS; @@ -1822,7 +2171,7 @@ int msg_thread_index_get_struct_handle(msg_struct_s *msg_struct, int field, void MSG_THREAD_LIST_INDEX_INFO_S *pIndex = (MSG_THREAD_LIST_INDEX_INFO_S *)msg_struct->data; switch(field) { - case MSG_SYNCML_INFO_MESSAGE_HND: + case MSG_THREAD_LIST_INDEX_ADDR_INFO_HND: *value = (void *)pIndex->msgAddrInfo; break; default: @@ -1833,6 +2182,29 @@ int msg_thread_index_get_struct_handle(msg_struct_s *msg_struct, int field, void return err; } + +int msg_list_condition_get_struct_handle(msg_struct_s *msg_struct, int field, void **value) +{ + msg_error_t err = MSG_SUCCESS; + + if(!msg_struct || !value) + return MSG_ERR_NULL_POINTER; + + MSG_LIST_CONDITION_S *pCond = (MSG_LIST_CONDITION_S *)msg_struct->data; + switch(field) + { + case MSG_LIST_CONDITION_SORT_RULE_HND: + *value = (void *)pCond->sortRule; + break; + default: + err = MSG_ERR_UNKNOWN; + break; + + } + return err; +} + + int msg_address_info_get_int(void *addr_info, int field) { int result = MSG_ERR_INVALID_PARAMETER; @@ -2105,32 +2477,124 @@ int msg_folder_info_set_int(void *folder_info, int field, int value) return err; } -int msg_search_condition_set_int(void *condition_info, int field, int value) +int msg_translation_set_bool(void *translation_info, int field, bool value) { msg_error_t err = MSG_SUCCESS; - if(!condition_info) + if(!translation_info) + return MSG_ERR_NULL_POINTER; + MSG_TRANSLATION_INFO_S *pTrnaslation = (MSG_TRANSLATION_INFO_S *)translation_info; + switch(field) + { + case MSG_TRANSLATION_BOOL: + pTrnaslation->bTranslation = value; + break; + case MSG_TRANSLATION_RECEIVE_ONLY_BOOL: + pTrnaslation->bOnlyReceive = value; + break; + case MSG_TRANSLATION_INCLUDE_ORGMSG_BOOL: + pTrnaslation->bIncludeOrgMsg = value; + break; + default: + err = MSG_ERR_UNKNOWN; + break; + } + return err; +} + +int msg_translation_set_int(void *translation_info, int field, int value) +{ + msg_error_t err = MSG_SUCCESS; + if(!translation_info) return MSG_ERR_NULL_POINTER; + MSG_TRANSLATION_INFO_S *pTrnaslation = (MSG_TRANSLATION_INFO_S *)translation_info; - MSG_SEARCH_CONDITION_S *pCond = (MSG_SEARCH_CONDITION_S *)condition_info; switch(field) { - case MSG_SEARCH_CONDITION_FOLDERID_INT: + case MSG_TRANSLATION_SENDER_LANG_INT: + pTrnaslation->senderLang = value; + break; + case MSG_TRANSLATION_RECEIVER_LANG_INT: + pTrnaslation->receiverLang = value; + break; + default: + err = MSG_ERR_UNKNOWN; + break; + } + return err; +} + +int msg_search_condition_set_int(void *condition_info, int field, int value) +{ + msg_error_t err = MSG_SUCCESS; + if(!condition_info) + return MSG_ERR_NULL_POINTER; + + MSG_SEARCH_CONDITION_S *pCond = (MSG_SEARCH_CONDITION_S *)condition_info; + switch(field) + { + case MSG_SEARCH_CONDITION_FOLDERID_INT: pCond->folderId = value; break; - case MSG_SEARCH_CONDITION_MSGTYPE_INT: + case MSG_SEARCH_CONDITION_MSGTYPE_INT: pCond->msgType = value; break; - case MSG_SEARCH_CONDITION_RESERVED_INT: + case MSG_SEARCH_CONDITION_RESERVED_INT: pCond->reserved = value; break; - default: + default: err = MSG_ERR_UNKNOWN; break; - } + } + + return err; +} + + +int msg_list_condition_set_int(void *condition_info, int field, int value) +{ + msg_error_t err = MSG_SUCCESS; + if(!condition_info) + return MSG_ERR_NULL_POINTER; + + MSG_LIST_CONDITION_S *pCond = (MSG_LIST_CONDITION_S *)condition_info; + switch(field) + { + case MSG_LIST_CONDITION_FOLDER_ID_INT: + pCond->folderId = value; + break; + case MSG_LIST_CONDITION_THREAD_ID_INT: + pCond->threadId = value; + break; + case MSG_LIST_CONDITION_STORAGE_ID_INT: + pCond->storageId = value; + break; + case MSG_LIST_CONDITION_MSGTYPE_INT: + pCond->msgType = value; + break; + case MSG_LIST_CONDITION_FROM_TIME_INT: + pCond->fromTime = value; + break; + case MSG_LIST_CONDITION_TO_TIME_INT: + pCond->toTime = value; + break; + case MSG_LIST_CONDITION_OFFSET_INT: + pCond->offset = value; + break; + case MSG_LIST_CONDITION_LIMIT_INT: + pCond->limit = value; + break; + case MSG_LIST_CONDITION_SIM_INDEX_INT: + pCond->simIndex = value; + break; + default: + err = MSG_ERR_UNKNOWN; + break; + } return err; } + int msg_report_status_set_int(void *report_info, int field, int value) { msg_error_t err = MSG_SUCCESS; @@ -2185,24 +2649,52 @@ int msg_search_condition_set_str(void *condition_info, int field, char *value, i if(!condition_info || !value) return MSG_ERR_NULL_POINTER; - MSG_SEARCH_CONDITION_S *search_cond = (MSG_SEARCH_CONDITION_S *)condition_info; + MSG_SEARCH_CONDITION_S *search_cond = (MSG_SEARCH_CONDITION_S *)condition_info; - switch(field) - { - case MSG_SEARCH_CONDITION_ADDRESS_VALUE_STR: - search_cond->pAddressVal = value; + switch(field) + { + case MSG_SEARCH_CONDITION_ADDRESS_VALUE_STR: + if(size) + search_cond->pAddressVal = value; break; - case MSG_SEARCH_CONDITION_SEARCH_VALUE_STR: - search_cond->pSearchVal = value; + case MSG_SEARCH_CONDITION_SEARCH_VALUE_STR: + if(size) + search_cond->pSearchVal = value; + break; + default: + err = MSG_ERR_UNKNOWN; break; + } + return err; +} - default: + +int msg_list_condition_set_str(void *condition_info, int field, char *value, int size) +{ + msg_error_t err = MSG_SUCCESS; + if(!condition_info || !value) + return MSG_ERR_NULL_POINTER; + + MSG_LIST_CONDITION_S *cond = (MSG_LIST_CONDITION_S *)condition_info; + + switch(field) + { + case MSG_LIST_CONDITION_ADDRESS_VALUE_STR: + if(size) + cond->pAddressVal = value; + break; + case MSG_LIST_CONDITION_TEXT_VALUE_STR: + if(size) + cond->pTextVal = value; + break; + default: err = MSG_ERR_UNKNOWN; break; - } + } return err; } + int msg_sendopt_set_bool(void *send_opt, int field, bool value) { msg_error_t err = MSG_SUCCESS; @@ -2234,19 +2726,46 @@ int msg_sortrule_set_bool(void *sort_rule, int field, bool value) if(!sort_rule) return MSG_ERR_NULL_POINTER; - MSG_SORT_RULE_S *pSort = (MSG_SORT_RULE_S *)sort_rule; - switch(field) - { - case MSG_SORT_RULE_ACSCEND_BOOL: + MSG_SORT_RULE_S *pSort = (MSG_SORT_RULE_S *)sort_rule; + switch(field) + { + case MSG_SORT_RULE_ACSCEND_BOOL: pSort->bAscending = value; break; - default: + default: err = MSG_ERR_UNKNOWN; break; - } + } + return err; +} + + +int msg_list_condition_set_bool(void *data, int field, bool value) +{ + msg_error_t err = MSG_SUCCESS; + if(!data) + return MSG_ERR_NULL_POINTER; + + MSG_LIST_CONDITION_S *pCond = (MSG_LIST_CONDITION_S *)data; + switch(field) + { + case MSG_LIST_CONDITION_PROTECTED_BOOL: + pCond->bProtected = value; + break; + case MSG_LIST_CONDITION_SCHEDULED_BOOL: + pCond->bScheduled = value; + break; + case MSG_LIST_CONDITION_AND_OPERATER_BOOL: + pCond->bAnd = value; + break; + default: + err = MSG_ERR_UNKNOWN; + break; + } return err; } + int msg_sendopt_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s *value) { msg_error_t err = MSG_SUCCESS; @@ -2325,6 +2844,32 @@ int msg_thread_index_set_struct_handle(msg_struct_s *msg_struct, int field, msg_ return err; } + +int msg_list_condition_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s *value) +{ + msg_error_t err = MSG_SUCCESS; + + if(!msg_struct || !value) + return MSG_ERR_NULL_POINTER; + + MSG_LIST_CONDITION_S *pCond = (MSG_LIST_CONDITION_S *)msg_struct->data; + msg_struct_s *pTmp = NULL; + + switch(field) + { + case MSG_LIST_CONDITION_SORT_RULE_HND: + pTmp = (msg_struct_s *)pCond->sortRule; + memcpy(pTmp->data, value->data, sizeof(MSG_SORT_RULE_S)); + break; + default: + err = MSG_ERR_UNKNOWN; + break; + + } + return err; +} + + int msg_address_info_set_int(void *addrinfo, int field, int value) { msg_error_t err = MSG_SUCCESS; @@ -2494,9 +3039,17 @@ EXPORT_API int msg_add_push_event(msg_handle_t handle, const msg_struct_t push_e { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || push_event == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -2520,9 +3073,17 @@ EXPORT_API int msg_delete_push_event(msg_handle_t handle, const msg_struct_t pus { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || push_event == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -2546,9 +3107,17 @@ EXPORT_API int msg_update_push_event(msg_handle_t handle, const msg_struct_t src { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || src_event == NULL || dst_event == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; diff --git a/mapi/msg_svc.cpp b/mapi/msg_svc.cpp index 9cfd830..81fa914 100755 --- a/mapi/msg_svc.cpp +++ b/mapi/msg_svc.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include @@ -21,6 +21,7 @@ #include "MsgHandle.h" #include "MsgTextConvert.h" #include "MsgException.h" +#include "MsgMemory.h" #include "msg_private.h" #include "msg.h" @@ -31,6 +32,14 @@ })\ +void __msg_release_list_item(gpointer data) +{ + if (data == NULL) + return; + + msg_release_struct((msg_struct_t*)(&data)); +} + EXPORT_API msg_struct_t msg_create_struct(int field) { @@ -38,6 +47,7 @@ EXPORT_API msg_struct_t msg_create_struct(int field) memset(msg_struct, 0x00, sizeof(msg_struct_s)); msg_struct->type = field; + msg_struct->data = NULL; switch(field) { @@ -142,6 +152,20 @@ EXPORT_API msg_struct_t msg_create_struct(int field) memset(msg_struct->data, 0x00, sizeof(MSG_SEARCH_CONDITION_S)); break; } + case MSG_STRUCT_MSG_LIST_CONDITION: + { + msg_struct->data = new MSG_LIST_CONDITION_S; + memset(msg_struct->data, 0x00, sizeof(MSG_LIST_CONDITION_S)); + + msg_struct_s *pStruct = new msg_struct_s; + ((MSG_LIST_CONDITION_S *)msg_struct->data)->sortRule = (msg_struct_t)pStruct; + + pStruct->type = MSG_STRUCT_SORT_RULE; + pStruct->data = new MSG_SORT_RULE_S; + memset(pStruct->data, 0x00, sizeof(MSG_SORT_RULE_S)); + + break; + } case MSG_STRUCT_REPORT_STATUS_INFO: { msg_struct->data = new MSG_REPORT_STATUS_INFO_S; @@ -154,6 +178,8 @@ EXPORT_API msg_struct_t msg_create_struct(int field) memset(msg_struct->data, 0x00, sizeof(MSG_SMSC_LIST_HIDDEN_S)); MSG_SMSC_LIST_HIDDEN_S *pTmp = (MSG_SMSC_LIST_HIDDEN_S *)msg_struct->data; + memset(pTmp, 0x00, sizeof(MSG_SMSC_LIST_HIDDEN_S)); + pTmp->simIndex = MSG_SIM_SLOT_ID_1; // default sim index msg_struct_list_s *smsc_list = (msg_struct_list_s *)new msg_struct_list_s; memset(smsc_list, 0x00, sizeof(msg_struct_list_s)); @@ -185,6 +211,7 @@ EXPORT_API msg_struct_t msg_create_struct(int field) memset(msg_struct->data, 0x00, sizeof(MSG_CBMSG_OPT_HIDDEN_S)); MSG_CBMSG_OPT_HIDDEN_S *pTmp = (MSG_CBMSG_OPT_HIDDEN_S *)msg_struct->data; + pTmp->simIndex = MSG_SIM_SLOT_ID_1; // default sim index pTmp->channelData = (msg_struct_list_s *)new msg_struct_list_s; memset(pTmp->channelData, 0x00, sizeof(msg_struct_list_s)); @@ -238,6 +265,8 @@ EXPORT_API msg_struct_t msg_create_struct(int field) { msg_struct->data = new MSG_VOICEMAIL_OPT_S; memset(msg_struct->data, 0x00, sizeof(MSG_VOICEMAIL_OPT_S)); + MSG_VOICEMAIL_OPT_S *pTmp = (MSG_VOICEMAIL_OPT_S *)msg_struct->data; + pTmp->simIndex = MSG_SIM_SLOT_ID_1; // default sim index break; } case MSG_STRUCT_SETTING_GENERAL_OPT : @@ -308,19 +337,29 @@ EXPORT_API msg_struct_t msg_create_struct(int field) case MSG_STRUCT_MMS_META: case MSG_STRUCT_MMS_SMIL_TEXT: case MSG_STRUCT_MMS_SMIL_AVI: + case MSG_STRUCT_MULTIPART_INFO: msg_struct->data = msg_mms_create_struct_data(field); break; case MSG_STRUCT_PUSH_CONFIG_INFO: msg_struct->data = new MSG_PUSH_EVENT_INFO_S; memset(msg_struct->data, 0x00, sizeof(MSG_PUSH_EVENT_INFO_S)); break; + case MSG_STRUCT_TRANSLATION_INFO: + msg_struct->data = new MSG_TRANSLATION_INFO_S; + memset(msg_struct->data, 0x00, sizeof(MSG_TRANSLATION_INFO_S)); + break; + + default : + delete msg_struct; + return NULL; + break; } return (msg_struct_t) msg_struct; } -EXPORT_API int msg_release_struct(msg_struct_t *msg_struct_handle) +static int _release_msg_struct(msg_struct_t *msg_struct_handle) { msg_error_t err = MSG_SUCCESS; @@ -351,6 +390,11 @@ EXPORT_API int msg_release_struct(msg_struct_t *msg_struct_handle) { MSG_CONVERSATION_VIEW_S *pConv = (MSG_CONVERSATION_VIEW_S*)(msg_struct->data); + if (pConv->multipart_list) { + g_list_free_full((GList *)pConv->multipart_list, __msg_release_list_item); + pConv->multipart_list = NULL; + } + if (pConv->pText) { delete [] pConv->pText; pConv->pText = NULL; @@ -470,6 +514,24 @@ EXPORT_API int msg_release_struct(msg_struct_t *msg_struct_handle) break; } + case MSG_STRUCT_MSG_LIST_CONDITION: + { + MSG_LIST_CONDITION_S *pCond = (MSG_LIST_CONDITION_S*)(msg_struct->data); + MSG_SORT_RULE_S *pSortRule = (MSG_SORT_RULE_S *)(((msg_struct_s *)pCond->sortRule)->data); + + delete (MSG_SORT_RULE_S *)pSortRule; + ((msg_struct_s *)pCond->sortRule)->data = NULL; + delete (msg_struct_s *)pCond->sortRule; + pCond->sortRule = NULL; + + delete (MSG_LIST_CONDITION_S*)(msg_struct->data); + msg_struct->data = NULL; + + delete msg_struct; + *msg_struct_handle = NULL; + + break; + } case MSG_STRUCT_REPORT_STATUS_INFO: { delete (MSG_REPORT_STATUS_INFO_S*)(msg_struct->data); @@ -542,6 +604,7 @@ EXPORT_API int msg_release_struct(msg_struct_t *msg_struct_handle) case MSG_STRUCT_MMS_META: case MSG_STRUCT_MMS_SMIL_TEXT: case MSG_STRUCT_MMS_SMIL_AVI: + case MSG_STRUCT_MULTIPART_INFO: { msg_mms_release_struct(&msg_struct); *msg_struct_handle = NULL; @@ -558,13 +621,15 @@ EXPORT_API int msg_release_struct(msg_struct_t *msg_struct_handle) for (int i = 0; i < SMSC_LIST_MAX; i++) { smsc_info = (msg_struct_s *)smsc_list->msg_struct_info[i]; - delete [] (MSG_SMSC_DATA_S*)(smsc_info->data); - delete [] smsc_info; + delete (MSG_SMSC_DATA_S*)(smsc_info->data); + delete smsc_info; } delete [] smsc_list->msg_struct_info; - delete [] (MSG_SMSC_LIST_HIDDEN_S*)pTmp; + delete smsc_list; + + delete pTmp; msg_struct->data = NULL; delete msg_struct; @@ -591,13 +656,15 @@ EXPORT_API int msg_release_struct(msg_struct_t *msg_struct_handle) for (int i = 0; i < CB_CHANNEL_MAX; i++) { cb_info = (msg_struct_s *)cb_list->msg_struct_info[i]; - delete [] (MSG_CB_CHANNEL_INFO_S*)(cb_info->data); - delete [] cb_info; + delete (MSG_CB_CHANNEL_INFO_S*)(cb_info->data); + delete cb_info; } delete [] cb_list->msg_struct_info; - delete [] (MSG_CBMSG_OPT_HIDDEN_S*)pTmp; + delete cb_list; + + delete pTmp; msg_struct->data = NULL; delete msg_struct; @@ -685,6 +752,16 @@ EXPORT_API int msg_release_struct(msg_struct_t *msg_struct_handle) *msg_struct_handle = NULL; break; } + case MSG_STRUCT_TRANSLATION_INFO: + { + delete (MSG_TRANSLATION_INFO_S*)(msg_struct->data); + msg_struct->data = NULL; + + delete msg_struct; + *msg_struct_handle = NULL; + break; + } + default : err = MSG_ERR_INVALID_PARAMETER; break; @@ -693,7 +770,18 @@ EXPORT_API int msg_release_struct(msg_struct_t *msg_struct_handle) return err; } -int msg_release_list_struct(msg_struct_list_s *msg_struct_list) +EXPORT_API int msg_release_struct(msg_struct_t *msg_struct_handle) +{ + + int ret = _release_msg_struct(msg_struct_handle); + + // Release Memory + MsgReleaseMemory(); + + return ret; +} + +EXPORT_API int msg_release_list_struct(msg_struct_list_s *msg_struct_list) { msg_error_t err = MSG_SUCCESS; @@ -712,17 +800,17 @@ int msg_release_list_struct(msg_struct_list_s *msg_struct_list) switch (structType) { - case MSG_STRUCT_ADDRESS_INFO : - { - listCnt = MAX_TO_ADDRESS_CNT; - break; - } +// case MSG_STRUCT_ADDRESS_INFO : +// { +// listCnt = MAX_TO_ADDRESS_CNT; +// break; +// } default : break; } for(int i = 0; i < listCnt; i++) { - msg_release_struct(&(msg_struct_list->msg_struct_info[i])); + _release_msg_struct(&(msg_struct_list->msg_struct_info[i])); } } @@ -730,6 +818,11 @@ int msg_release_list_struct(msg_struct_list_s *msg_struct_list) delete [] msg_struct_list->msg_struct_info; msg_struct_list->msg_struct_info = NULL; + msg_struct_list->nCount = 0; + + // Release Memory + MsgReleaseMemory(); + return err; } @@ -782,6 +875,9 @@ EXPORT_API int msg_get_int_value(msg_struct_t msg_struct_handle, int field, int case MSG_STRUCT_SEARCH_CONDITION : *value = msg_search_condition_get_int(msg_struct->data, field); break; + case MSG_STRUCT_MSG_LIST_CONDITION : + *value = msg_list_condition_get_int(msg_struct->data, field); + break; case MSG_STRUCT_REPORT_STATUS_INFO : *value = msg_report_status_get_int(msg_struct->data, field); break; @@ -812,6 +908,7 @@ EXPORT_API int msg_get_int_value(msg_struct_t msg_struct_handle, int field, int case MSG_STRUCT_MMS_META: case MSG_STRUCT_MMS_SMIL_TEXT: case MSG_STRUCT_MMS_SMIL_AVI: + case MSG_STRUCT_MULTIPART_INFO: err = msg_mms_get_int_value(msg_struct, field, value); break; case MSG_STRUCT_SETTING_SMSC_OPT : @@ -824,6 +921,7 @@ EXPORT_API int msg_get_int_value(msg_struct_t msg_struct_handle, int field, int case MSG_STRUCT_SETTING_PUSH_MSG_OPT : case MSG_STRUCT_SETTING_GENERAL_OPT : case MSG_STRUCT_SETTING_MSGSIZE_OPT : + case MSG_STRUCT_SETTING_VOICE_MSG_OPT : err = msg_setting_get_int_value(msg_struct, field, value); break; default : @@ -888,6 +986,13 @@ EXPORT_API int msg_get_str_value(msg_struct_t msg_struct_handle, int field, char else strncpy(src, ret_str, size); break; + case MSG_STRUCT_MSG_LIST_CONDITION : + ret_str = msg_list_condition_get_str(msg_struct->data, field, size); + if (ret_str == NULL) + err = MSG_ERR_UNKNOWN; + else + strncpy(src, ret_str, size); + break; case MSG_STRUCT_ADDRESS_INFO : ret_str = msg_address_info_get_str(msg_struct->data, field, size); @@ -913,8 +1018,10 @@ EXPORT_API int msg_get_str_value(msg_struct_t msg_struct_handle, int field, char case MSG_STRUCT_MMS_META: case MSG_STRUCT_MMS_SMIL_TEXT: case MSG_STRUCT_MMS_SMIL_AVI: + case MSG_STRUCT_MULTIPART_INFO: err = msg_mms_get_str_value(msg_struct, field, src, size); break; + case MSG_STRUCT_SETTING_GENERAL_OPT : case MSG_STRUCT_SETTING_SMSC_INFO : case MSG_STRUCT_SETTING_CB_CHANNEL_INFO : case MSG_STRUCT_SETTING_VOICE_MSG_OPT : @@ -977,6 +1084,9 @@ EXPORT_API int msg_get_bool_value(msg_struct_t msg_struct_handle, int field, boo case MSG_STRUCT_SORT_RULE: *value = msg_sortrule_get_bool(msg_struct->data, field); break; + case MSG_STRUCT_MSG_LIST_CONDITION: + *value = msg_list_condition_get_bool(msg_struct->data, field); + break; case MSG_STRUCT_MMS_SENDOPT: *value = msg_mms_sendopt_get_bool(msg_struct->data, field); break; @@ -1037,6 +1147,9 @@ EXPORT_API int msg_get_struct_handle(msg_struct_t msg_struct_handle, int field, case MSG_STRUCT_THREAD_LIST_INDEX: err = msg_thread_index_get_struct_handle(msg_struct, field, (void **)value); break; + case MSG_STRUCT_MSG_LIST_CONDITION: + err = msg_list_condition_get_struct_handle(msg_struct, field, (void **)value); + break; case MSG_STRUCT_MMS_MEDIA: err = msg_mms_get_struct_handle(msg_struct, field, (msg_struct_s**)value); break; @@ -1068,6 +1181,9 @@ EXPORT_API int msg_get_list_handle(msg_struct_t msg_struct_handle, int field, vo case MSG_STRUCT_MESSAGE_INFO : err = msg_message_get_list_hnd(msg_struct->data, field, value); break; + case MSG_STRUCT_CONV_INFO: + err = msg_conversation_get_list_hnd(msg_struct->data, field, value); + break; case MSG_STRUCT_MMS: case MSG_STRUCT_MMS_PAGE: err = msg_mms_get_list_handle(msg_struct, field, (msg_list_handle_t *)value); @@ -1125,6 +1241,9 @@ EXPORT_API int msg_set_int_value(msg_struct_t msg_struct_handle, int field, int case MSG_STRUCT_SEARCH_CONDITION : err = msg_search_condition_set_int(msg_struct->data, field, value); break; + case MSG_STRUCT_MSG_LIST_CONDITION : + err = msg_list_condition_set_int(msg_struct->data, field, value); + break; case MSG_STRUCT_REPORT_STATUS_INFO : err = msg_report_status_set_int(msg_struct->data, field, value); break; @@ -1161,8 +1280,12 @@ EXPORT_API int msg_set_int_value(msg_struct_t msg_struct_handle, int field, int case MSG_STRUCT_SETTING_PUSH_MSG_OPT : case MSG_STRUCT_SETTING_GENERAL_OPT : case MSG_STRUCT_SETTING_MSGSIZE_OPT : + case MSG_STRUCT_SETTING_VOICE_MSG_OPT : err = msg_setting_set_int_value(msg_struct, field, value); break; + case MSG_STRUCT_TRANSLATION_INFO : + err = msg_translation_set_int(msg_struct->data, field, value); + break; default : err = MSG_ERR_INVALID_PARAMETER; break; @@ -1197,6 +1320,9 @@ EXPORT_API int msg_set_str_value(msg_struct_t msg_struct_handle, int field, char case MSG_STRUCT_SEARCH_CONDITION : err = msg_search_condition_set_str(msg_struct->data, field, value, size); break; + case MSG_STRUCT_MSG_LIST_CONDITION : + err = msg_list_condition_set_str(msg_struct->data, field, value, size); + break; case MSG_STRUCT_ADDRESS_INFO : err = msg_address_info_set_str(msg_struct->data, field, value, size); break; @@ -1212,8 +1338,10 @@ EXPORT_API int msg_set_str_value(msg_struct_t msg_struct_handle, int field, char case MSG_STRUCT_MMS_META: case MSG_STRUCT_MMS_SMIL_TEXT: case MSG_STRUCT_MMS_SMIL_AVI: + case MSG_STRUCT_MULTIPART_INFO: err = msg_mms_set_str_value(msg_struct, field, value, size); break; + case MSG_STRUCT_SETTING_GENERAL_OPT : case MSG_STRUCT_SETTING_SMSC_INFO : case MSG_STRUCT_SETTING_CB_CHANNEL_INFO : case MSG_STRUCT_SETTING_VOICE_MSG_OPT : @@ -1256,6 +1384,9 @@ EXPORT_API int msg_set_bool_value(msg_struct_t msg_struct_handle, int field, boo case MSG_STRUCT_SORT_RULE: err = msg_sortrule_set_bool(msg_struct->data, field, value); break; + case MSG_STRUCT_MSG_LIST_CONDITION: + err = msg_list_condition_set_bool(msg_struct->data, field, value); + break; case MSG_STRUCT_MMS_SENDOPT: err = msg_mms_sendopt_set_bool(msg_struct->data, field, value); break; @@ -1285,6 +1416,9 @@ EXPORT_API int msg_set_bool_value(msg_struct_t msg_struct_handle, int field, boo case MSG_STRUCT_PUSH_CONFIG_INFO: err = msg_push_config_set_bool(msg_struct->data, field, value); break; + case MSG_STRUCT_TRANSLATION_INFO : + err = msg_translation_set_bool(msg_struct->data, field, value); + break; default : err = MSG_ERR_INVALID_PARAMETER; break; @@ -1319,6 +1453,9 @@ EXPORT_API int msg_set_struct_handle(msg_struct_t msg_struct_handle, int field, case MSG_STRUCT_THREAD_LIST_INDEX: err = msg_thread_index_set_struct_handle(msg_struct, field, (msg_struct_s *)value); break; + case MSG_STRUCT_MSG_LIST_CONDITION: + err = msg_list_condition_set_struct_handle(msg_struct, field, (msg_struct_s *)value); + break; case MSG_STRUCT_MMS_MEDIA: err = msg_mms_set_struct_handle(msg_struct, field, (msg_struct_s *)value); break; @@ -1345,25 +1482,96 @@ EXPORT_API int msg_set_list_handle(msg_struct_t msg_struct_handle, int field, vo if (msg_struct->data == NULL) return MSG_ERR_NULL_POINTER; +#if 0 // No operations + switch (msg_struct->type) { default : err = MSG_ERR_INVALID_PARAMETER; break; } +#endif + + return err; +} + +EXPORT_API int msg_list_add_item(msg_struct_t msg_struct_handle, int field, msg_struct_t *item) +{ + if (msg_struct_handle == NULL || item == NULL) { + return MSG_ERR_NULL_POINTER; + } + + msg_error_t err = MSG_SUCCESS; + msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle; + + switch(msg_struct->type) { + case MSG_STRUCT_MESSAGE_INFO: + { + err = msg_message_list_append(msg_struct_handle, field, item); + } + break; + case MSG_STRUCT_MMS: + case MSG_STRUCT_MMS_PAGE: + { + err = msg_mms_list_append(msg_struct_handle, field, item); + } + break; + default : + err = MSG_ERR_INVALID_PARAMETER; + break; + } + return err; } EXPORT_API msg_struct_t msg_list_nth_data(msg_list_handle_t list_handle, int index) { + if (list_handle == NULL) { + return NULL; + } + return (msg_struct_t)g_list_nth_data((GList *)list_handle,(guint)index); } EXPORT_API int msg_list_length(msg_list_handle_t list_handle) { + if (list_handle == NULL) { + return 0; + } + return (int)g_list_length((GList *)list_handle); } +EXPORT_API int msg_list_clear(msg_struct_t msg_struct_handle, int field) +{ + if (msg_struct_handle == NULL) { + return MSG_ERR_NULL_POINTER; + } + + msg_error_t err = MSG_SUCCESS; + msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle; + + switch(msg_struct->type) { + case MSG_STRUCT_MESSAGE_INFO: + { + err = msg_message_list_clear(msg_struct_handle, field); + } + break; +// case MSG_STRUCT_MMS: +// case MSG_STRUCT_MMS_PAGE: +// { +// err = msg_mms_list_append(msg_struct_handle, field, item); +// } +// break; + default : + err = MSG_ERR_INVALID_PARAMETER; + break; + } + + return err; +} + + EXPORT_API int msg_util_calculate_text_length(const char* msg_text, msg_encode_type_t msg_encode_type_to, unsigned int *text_size, unsigned int *segment_size, msg_encode_type_t *msg_encode_type_in) { msg_error_t err = MSG_SUCCESS; @@ -1377,17 +1585,19 @@ EXPORT_API int msg_util_calculate_text_length(const char* msg_text, msg_encode_t MSG_LANGUAGE_ID_T langId = MSG_LANG_ID_RESERVED; int decodeLen = 0; - int bufSize = (160*MAX_SEGMENT_NUM) + 1; + int bufSize = 0; int textSize = 0; bool bAbnormal = false; textSize = strlen(msg_text); - unsigned char decodeData[bufSize]; + bufSize = textSize * 4; + + unsigned char decodeData[bufSize+1]; memset(decodeData, 0x00, sizeof(decodeData)); - MsgTextConvert textCvt; + MsgTextConvert *textCvt = MsgTextConvert::instance(); *text_size = 0; *segment_size = 0; @@ -1395,13 +1605,13 @@ EXPORT_API int msg_util_calculate_text_length(const char* msg_text, msg_encode_t switch (msg_encode_type_to) { case MSG_ENCODE_GSM7BIT : - decodeLen = textCvt.convertUTF8ToGSM7bit(decodeData, bufSize, (const unsigned char*)msg_text, textSize, &langId, &bAbnormal); + decodeLen = textCvt->convertUTF8ToGSM7bit(decodeData, bufSize, (const unsigned char*)msg_text, textSize, &langId, &bAbnormal); break; case MSG_ENCODE_UCS2 : - decodeLen = textCvt.convertUTF8ToUCS2(decodeData, bufSize, (const unsigned char*)msg_text, textSize); + decodeLen = textCvt->convertUTF8ToUCS2(decodeData, bufSize, (const unsigned char*)msg_text, textSize); break; case MSG_ENCODE_AUTO : - decodeLen = textCvt.convertUTF8ToAuto(decodeData, bufSize, (const unsigned char*)msg_text, textSize, &encodeType); + decodeLen = textCvt->convertUTF8ToAuto(decodeData, bufSize, (const unsigned char*)msg_text, textSize, &langId, &encodeType); break; default : err = MSG_ERR_INVALID_PARAMETER; @@ -1410,27 +1620,28 @@ EXPORT_API int msg_util_calculate_text_length(const char* msg_text, msg_encode_t } // calculate segment size. - int headerLen = 1; + int headerLen = 0; int concat = 5; -// int lang = 3; + int lang = 3; -// int headerSize = 0; + int headerSize = 0; int segSize = 0; -// if (langId != MSG_LANG_ID_RESERVED) { -// MSG_DEBUG("National Language Exists"); -// headerSize += lang; -// } + if (langId != MSG_LANG_ID_RESERVED) { + MSG_DEBUG("National Language Exists"); + headerSize += lang; + headerLen = 1; + } if (msg_encode_type_to == MSG_ENCODE_GSM7BIT || encodeType == MSG_ENCODE_GSM7BIT) { MSG_DEBUG("MSG_ENCODE_GSM7BIT"); -// if (((decodeLen+headerSize)/160) > 1) -// segSize = ((140*8) - ((headerLen + concat + headerSize)*8)) / 7; - if(decodeLen > 160) - segSize = ((140*8) - ((headerLen + concat)*8)) / 7; + if ((decodeLen + headerSize) > 160) { + headerLen = 1; + segSize = ((140 - (headerLen + concat + headerSize)) * 8)/7; + } else - segSize = 160; + segSize = ((140 - headerLen - headerSize) * 8) / 7; if (bAbnormal) *msg_encode_type_in = MSG_ENCODE_GSM7BIT_ABNORMAL; @@ -1442,8 +1653,10 @@ EXPORT_API int msg_util_calculate_text_length(const char* msg_text, msg_encode_t // if (((decodeLen+headerSize)/140) > 1) // segSize = 140 - (headerLen + concat + headerSize); - if(decodeLen > 140) + if(decodeLen > 140) { + headerLen = 1; segSize = 140 - (headerLen + concat); + } else segSize = 140; @@ -1455,6 +1668,8 @@ EXPORT_API int msg_util_calculate_text_length(const char* msg_text, msg_encode_t return err; } + MSG_DEBUG("decodeLen [%d] segSize [%d]", decodeLen, segSize); + *text_size = decodeLen; *segment_size = segSize; diff --git a/mapi/msg_transport.cpp b/mapi/msg_transport.cpp index 8b27132..861c69d 100755 --- a/mapi/msg_transport.cpp +++ b/mapi/msg_transport.cpp @@ -1,20 +1,21 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include +#include #include "MsgHandle.h" #include "MsgDebug.h" @@ -33,9 +34,17 @@ EXPORT_API int msg_submit_req(msg_handle_t handle, msg_struct_t req) { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL ||req == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -49,11 +58,7 @@ EXPORT_API int msg_submit_req(msg_handle_t handle, msg_struct_t req) catch (MsgException& e) { MSG_FATAL("%s", e.what()); - - if ((e.errorCode() == MsgException::IPC_ERROR) || (e.errorCode() == MsgException::FILE_ERROR)) - return MSG_ERR_STORAGE_ERROR; - else - return MSG_ERR_TRANSPORT_ERROR; + return MSG_ERR_TRANSPORT_ERROR; } return err; @@ -64,9 +69,17 @@ EXPORT_API int msg_reg_sent_status_callback(msg_handle_t handle, msg_sent_status { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || cb == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -78,7 +91,10 @@ EXPORT_API int msg_reg_sent_status_callback(msg_handle_t handle, msg_sent_status catch (MsgException& e) { MSG_FATAL("%s", e.what()); - return MSG_ERR_CALLBACK_ERROR; + if (e.errorCode() == MsgException::SERVER_READY_ERROR) + return MSG_ERR_PERMISSION_DENIED; + else + return MSG_ERR_CALLBACK_ERROR; } return err; @@ -89,9 +105,17 @@ EXPORT_API int msg_reg_sms_message_callback(msg_handle_t handle, msg_sms_incomin { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || cb == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -103,7 +127,10 @@ EXPORT_API int msg_reg_sms_message_callback(msg_handle_t handle, msg_sms_incomin catch (MsgException& e) { MSG_FATAL("%s", e.what()); - return MSG_ERR_CALLBACK_ERROR; + if (e.errorCode() == MsgException::SERVER_READY_ERROR) + return MSG_ERR_PERMISSION_DENIED; + else + return MSG_ERR_CALLBACK_ERROR; } return err; @@ -114,14 +141,22 @@ EXPORT_API int msg_reg_mms_conf_message_callback(msg_handle_t handle, msg_mms_co { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || cb == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } if (app_id && strlen(app_id) > MAX_MMS_JAVA_APPID_LEN) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -133,7 +168,10 @@ EXPORT_API int msg_reg_mms_conf_message_callback(msg_handle_t handle, msg_mms_co catch (MsgException& e) { MSG_FATAL("%s", e.what()); - return MSG_ERR_CALLBACK_ERROR; + if (e.errorCode() == MsgException::SERVER_READY_ERROR) + return MSG_ERR_PERMISSION_DENIED; + else + return MSG_ERR_CALLBACK_ERROR; } return err; @@ -144,9 +182,17 @@ EXPORT_API int msg_reg_syncml_message_callback(msg_handle_t handle, msg_syncml_ { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || cb == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -158,7 +204,10 @@ EXPORT_API int msg_reg_syncml_message_callback(msg_handle_t handle, msg_syncml_ catch (MsgException& e) { MSG_FATAL("%s", e.what()); - return MSG_ERR_CALLBACK_ERROR; + if (e.errorCode() == MsgException::SERVER_READY_ERROR) + return MSG_ERR_PERMISSION_DENIED; + else + return MSG_ERR_CALLBACK_ERROR; } return err; @@ -169,9 +218,17 @@ EXPORT_API int msg_reg_lbs_message_callback(msg_handle_t handle, msg_lbs_msg_inc { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || cb == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -183,7 +240,10 @@ EXPORT_API int msg_reg_lbs_message_callback(msg_handle_t handle, msg_lbs_msg_inc catch (MsgException& e) { MSG_FATAL("%s", e.what()); - return MSG_ERR_CALLBACK_ERROR; + if (e.errorCode() == MsgException::SERVER_READY_ERROR) + return MSG_ERR_PERMISSION_DENIED; + else + return MSG_ERR_CALLBACK_ERROR; } return err; @@ -194,9 +254,17 @@ EXPORT_API int msg_reg_syncml_message_operation_callback(msg_handle_t handle, m { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || cb == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -208,7 +276,10 @@ EXPORT_API int msg_reg_syncml_message_operation_callback(msg_handle_t handle, m catch (MsgException& e) { MSG_FATAL("%s", e.what()); - return MSG_ERR_CALLBACK_ERROR; + if (e.errorCode() == MsgException::SERVER_READY_ERROR) + return MSG_ERR_PERMISSION_DENIED; + else + return MSG_ERR_CALLBACK_ERROR; } return err; @@ -219,14 +290,22 @@ EXPORT_API int msg_reg_push_message_callback(msg_handle_t handle, msg_push_msg_ { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || cb == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } if (app_id && strlen(app_id) > MAX_WAPPUSH_ID_LEN) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -238,7 +317,10 @@ EXPORT_API int msg_reg_push_message_callback(msg_handle_t handle, msg_push_msg_ catch (MsgException& e) { MSG_FATAL("%s", e.what()); - return MSG_ERR_CALLBACK_ERROR; + if (e.errorCode() == MsgException::SERVER_READY_ERROR) + return MSG_ERR_PERMISSION_DENIED; + else + return MSG_ERR_CALLBACK_ERROR; } return err; @@ -248,9 +330,17 @@ EXPORT_API int msg_reg_cb_message_callback(msg_handle_t handle, msg_cb_incoming_ { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || cb == NULL) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -262,19 +352,67 @@ EXPORT_API int msg_reg_cb_message_callback(msg_handle_t handle, msg_cb_incoming_ catch (MsgException& e) { MSG_FATAL("%s", e.what()); - return MSG_ERR_CALLBACK_ERROR; + if (e.errorCode() == MsgException::SERVER_READY_ERROR) + return MSG_ERR_PERMISSION_DENIED; + else + return MSG_ERR_CALLBACK_ERROR; } return err; } + +EXPORT_API int msg_reg_report_message_callback(msg_handle_t handle, msg_report_msg_incoming_cb cb, void *user_param) +{ + msg_error_t err = MSG_SUCCESS; + + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + + if (handle == NULL || cb == NULL) + { + return MSG_ERR_INVALID_PARAMETER; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->regReportMessageCallback(cb, user_param); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + if (e.errorCode() == MsgException::SERVER_READY_ERROR) + return MSG_ERR_PERMISSION_DENIED; + else + return MSG_ERR_CALLBACK_ERROR; + } + + return err; +} + + EXPORT_API int msg_syncml_message_operation(msg_handle_t handle, msg_message_id_t msgId) { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || msgId < 1) { - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } MsgHandle* pHandle = (MsgHandle*)handle; @@ -319,13 +457,13 @@ static int msg_send_single_sms(const char *phone_num, const char *sms_text, msg_ if (phone_num == NULL || sms_text == NULL || cb == NULL) { MSG_DEBUG("Invalid parameter [%s] [%s] [%s]", phone_num, sms_text, cb); - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } if (strlen(phone_num) > MAX_PHONE_NUMBER_LEN) { MSG_DEBUG("Phone Number is too long [%s]", phone_num); - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } msg_struct_s req = {0,}; @@ -355,37 +493,51 @@ static int msg_send_single_sms(const char *phone_num, const char *sms_text, msg_ msg_info.subType = MSG_NORMAL_SMS; msg_info.msgId = 0; msg_info.folderId = MSG_OUTBOX_ID; + msg_info.simIndex = MSG_SIM_SLOT_ID_1; /* fill the destination number in msgReq */ + MSG_ADDRESS_INFO_S address = {0,}; + memset(&address, 0x00, sizeof(MSG_ADDRESS_INFO_S)); + + address.addressType = MSG_ADDRESS_TYPE_PLMN; + address.recipientType = MSG_RECIPIENTS_TYPE_TO; + snprintf(address.addressVal, MAX_ADDRESS_VAL_LEN, "%s", phone_num); + msg_struct_list_s addr_list = {0,}; addr_list.nCount = 1; + addr_list.msg_struct_info = (msg_struct_t *)new char[sizeof(msg_struct_t)*1]; + addr_list.msg_struct_info[0] = (msg_struct_t)new msg_struct_s; - msg_struct_s addr_info[addr_list.nCount]; - memset(addr_info, 0, sizeof(msg_struct_s) * addr_list.nCount); - addr_list.msg_struct_info = (msg_struct_t *)&addr_info; + msg_struct_s *pTmp; + pTmp = (msg_struct_s *)addr_list.msg_struct_info[0]; + pTmp->type = MSG_STRUCT_ADDRESS_INFO; + pTmp->data = &address; - MSG_ADDRESS_INFO_S address[addr_list.nCount]; - memset(address, 0, sizeof(MSG_ADDRESS_INFO_S) * addr_list.nCount); + msg_info.addr_list = (msg_struct_list_s *)&addr_list; - for (int i = 0; i < addr_list.nCount; i++) { - addr_info[i].type = MSG_STRUCT_ADDRESS_INFO; - addr_info[i].data = (void *)&address[i]; + msg_info.bPortValid = false; - address[i].addressType = MSG_ADDRESS_TYPE_PLMN; - snprintf(address[i].addressVal, MAX_ADDRESS_VAL_LEN+1, "%s", phone_num); + /* fill the msg text in msgReq */ + msg_info.dataSize = strlen(sms_text); + msg_info.pData = (void*)sms_text; - address[i].recipientType = MSG_RECIPIENTS_TYPE_TO; - } + /* Send option */ + msg_struct_s sendOpt = {0,}; + MSG_SENDINGOPT_S send_info; + memset(&send_info, 0x00, sizeof(MSG_SENDINGOPT_S)); - msg_info.addr_list = &addr_list; + sendOpt.type = MSG_STRUCT_SENDOPT; + sendOpt.data = (void *)&send_info; - msg_info.bPortValid = false; + msg_struct_s smsSendOpt = {0,}; + SMS_SENDINGOPT_INFO_S sms_send_opt = {0,}; + memset(&sms_send_opt, 0x00, sizeof(SMS_SENDINGOPT_INFO_S)); - /* fill the msg text in msgReq */ - msg_info.dataSize = strlen(sms_text); - msg_info.pData = (void*)malloc(msg_info.dataSize+1); - strncpy((char *)msg_info.pData, sms_text, msg_info.dataSize); + smsSendOpt.type = MSG_STRUCT_SMS_SENDOPT; + smsSendOpt.data = (void *)&sms_send_opt; + + send_info.smsSendOpt = (msg_struct_t)&smsSendOpt; sentStatusCallback = cb; @@ -401,9 +553,15 @@ static int msg_send_single_sms(const char *phone_num, const char *sms_text, msg_ // sending message request msgReq.msg = (msg_struct_t)&msg; + msgReq.sendOpt = (msg_struct_t)&sendOpt; retVal = msg_submit_req(msgHandle, (msg_struct_t)&req); + if (addr_list.msg_struct_info) { + delete [] addr_list.msg_struct_info; + addr_list.msg_struct_info = NULL; + } + if (retVal != MSG_SUCCESS) { MSG_DEBUG("msg_submit_req() is failed. Error Code = %d", retVal); @@ -416,10 +574,18 @@ static int msg_send_single_sms(const char *phone_num, const char *sms_text, msg_ EXPORT_API int msg_sms_send(const char *phone_num_list, const char *sms_text, msg_simple_sent_status_cb cb, void *user_param) { + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (phone_num_list == NULL || sms_text == NULL || cb == NULL) { MSG_DEBUG("Invalid parameter [%s] [%s] [%s]", phone_num_list, sms_text, cb); - return -EINVAL; + return MSG_ERR_INVALID_PARAMETER; } char trimmed_num[strlen(phone_num_list)+1]; @@ -454,6 +620,14 @@ EXPORT_API int msg_sms_send_message(msg_handle_t handle, msg_struct_t req) { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || !req) { MSG_FATAL("handle or req is NULL"); return MSG_ERR_NULL_POINTER; @@ -478,7 +652,7 @@ EXPORT_API int msg_sms_send_message(msg_handle_t handle, msg_struct_t req) reqmsg->mainType = MSG_SMS_TYPE; } - if (reqmsg->subType > MSG_CONCAT_SIM_SMS) { + if (reqmsg->subType > MSG_CONCAT_SIM_SMS && reqmsg->subType != MSG_UNSAVED_SMS) { MSG_DEBUG("subType is not SMS [%d]", reqmsg->subType); reqmsg->subType = MSG_NORMAL_SMS; } @@ -486,6 +660,8 @@ EXPORT_API int msg_sms_send_message(msg_handle_t handle, msg_struct_t req) reqmsg->folderId = MSG_OUTBOX_ID; // outbox fixed reqmsg->networkStatus = MSG_NETWORK_SENDING; + MSG_DEBUG("Coding Scheme From App. = [%d]", reqmsg->encodeType); + err = msg_submit_req(handle, req); if (err == MSG_SUCCESS) @@ -501,6 +677,14 @@ EXPORT_API int msg_mms_send_message(msg_handle_t handle, msg_struct_t req) { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || !req) { MSG_FATAL("handle or req is NULL"); @@ -518,7 +702,7 @@ EXPORT_API int msg_mms_send_message(msg_handle_t handle, msg_struct_t req) if (reqmsg->mmsDataSize <= 0) { - MSG_FATAL("MMS data size is invalid [%d]", reqmsg->mmsDataSize); + MSG_FATAL("MMS data size is invalid"); return MSG_ERR_INVALID_PARAMETER; } @@ -542,6 +726,14 @@ EXPORT_API int msg_mms_send_read_report(msg_handle_t handle, msg_message_id_t ms { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL) { return MSG_ERR_INVALID_PARAMETER; @@ -574,7 +766,6 @@ EXPORT_API int msg_mms_send_read_report(msg_handle_t handle, msg_message_id_t ms reqmsg->mainType = MSG_MMS_TYPE; reqmsg->subType = MSG_READREPLY_MMS; - reqmsg->dataSize = read_report_datasize; reqmsg->mmsDataSize = read_report_datasize; reqmsg->pMmsData = read_report_data; @@ -598,6 +789,14 @@ EXPORT_API int msg_mms_forward_message(msg_handle_t handle, msg_struct_t req) { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || !req ) { MSG_FATAL("handle or req is NULL"); @@ -633,6 +832,14 @@ EXPORT_API int msg_mms_retrieve_message(msg_handle_t handle, msg_struct_t req) { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if ( handle == NULL|| !req) { MSG_FATAL("handle or req is NULL"); @@ -666,6 +873,14 @@ EXPORT_API int msg_mms_reject_message(msg_handle_t handle, msg_struct_t req) { msg_error_t err = MSG_SUCCESS; + //Privilege check + int ret = PRIV_MGR_ERROR_SUCCESS; + ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME); + if(ret != PRIV_MGR_ERROR_SUCCESS) + { + return MSG_ERR_PERMISSION_DENIED; + } + if (handle == NULL || !req ) { MSG_FATAL("handle or req is NULL"); diff --git a/msg-server b/msg-server new file mode 100755 index 0000000..d8f67c9 --- /dev/null +++ b/msg-server @@ -0,0 +1,7 @@ +#!/bin/sh +## A script for running msg-server in booting time. +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin +#For log +# Launch msg-server +/usr/bin/msg-server & + diff --git a/msg-service-tools.manifest b/msg-service-tools.manifest index f56f694..c987f54 100755 --- a/msg-service-tools.manifest +++ b/msg-service-tools.manifest @@ -5,8 +5,6 @@ - - diff --git a/msg-service.manifest b/msg-service.manifest index 1a886d6..138d9d6 100755 --- a/msg-service.manifest +++ b/msg-service.manifest @@ -4,9 +4,6 @@ @@ -23,7 +20,5 @@ - - diff --git a/msg-service.pc.in b/msg-service.pc.in index 4e0c758..5d04123 100755 --- a/msg-service.pc.in +++ b/msg-service.pc.in @@ -1,5 +1,5 @@ prefix=/usr -libdir=@LIB_INSTALL_DIR@ +libdir=${prefix}/lib includedir=${prefix}/include Name: MESSAGE-FRAMEWORK diff --git a/msg-service.rule b/msg-service.rule old mode 100644 new mode 100755 index 6f5203a..b9f5c30 --- a/msg-service.rule +++ b/msg-service.rule @@ -1,42 +1,41 @@ -msg-service msg-service::db rw - -msg-service system::use_internet rw -msg-service media-server rw -msg-service system::vconf arwxt -msg-service system::vconf_inhouse rw -msg-service system::vconf_setting r - -msg-service telephony_framework::api_sms rwx -msg-service telephony_framework::api_sim rw -msg-service telephony_framework::api_sat x - -msg-service contacts-service::svc r -msg-service contacts-service::phonelog rw - -msg-service ug-setting-call-efl::vconf r - -msg-service com.samsung.browser::vconf_public r - -msg-service testmode::vconf r - -msg-service data-provider-master::notification rw -msg-service data-provider-master::notification.client w - -msg-service data-provider-master::badge rw -msg-service data-provider-master::badge.client w - -msg-service oma-dm-agent::vconf_external r - -msg-service deviced::display rw - -org.tizen.quickpanel msg-service rx -org.tizen.indicator msg-service rwx -org.tizen.lockscreen msg-service rx - -msg-service net-config rw -msg-service connman rw - -net-config msg-service rw -connman msg-service rw - -system::use_internet msg-service rw \ No newline at end of file +msg-service msg-service::db rw---- ------ +msg-service system::use_internet rw---- ------ +msg-service media-server rw---- ------ +msg-service system::vconf rwxat- ------ +msg-service system::vconf_inhouse rw---- ------ +msg-service system::vconf_setting r----- ------ +msg-service telephony_framework::api_sms rwx--- ------ +msg-service telephony_framework::api_sim rw---- ------ +msg-service telephony_framework::api_sat --x--- ------ +msg-service telephony_framework::api_ps_public rw---- ------ +msg-service telephony_framework::api_ps_private rw---- ------ +msg-service telephony_framework::api_ps_profile rw---- ------ +msg-service telephony_framework::properties rw---- ------ +msg-service contacts-service::svc r----- ------ +msg-service contacts-service::phonelog rw---- ------ +msg-service ug-setting-call-efl::vconf r----- ------ +msg-service org.tizen.browser::vconf_public r----- ------ +msg-service testmode::vconf r----- ------ +msg-service data-provider-master::notification rw---- ------ +msg-service data-provider-master::notification.client -w---- ------ +msg-service data-provider-master::badge rw---- ------ +msg-service data-provider-master::badge.client -w---- ------ +msg-service oma-dm-agent::vconf_external r----- ------ +msg-service secure-storage rw---- ------ +msg-service deviced::display rw---- ------ +msg-service net-config rw---- ------ +msg-service connman rw---- ------ +msg-service connman::get rw---- ------ +msg-service connman::set rw---- ------ +msg-service connman::profile rw---- ------ +msg-service aul::launch --x--- ------ +msg-service alarm-server::alarm rw---- ------ +msg-service security-server::api-get-gid -w---- ------ +msg-service security-server::api-cookie-check -w---- ------ +msg-service security-server::api-privilege-by-pid -w---- ------ +net-config msg-service rw---- ------ +connman msg-service rw---- ------ +system::use_internet msg-service rw---- ------ +org.tizen.quickpanel msg-service r-x--- ------ +org.tizen.indicator msg-service rwx--- ------ +org.tizen.lockscreen msg-service r-x--- ------ diff --git a/msg_helper/CMakeLists.txt b/msg_helper/CMakeLists.txt deleted file mode 100755 index ad060c3..0000000 --- a/msg_helper/CMakeLists.txt +++ /dev/null @@ -1,48 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(msg-server CXX) - -SET(CMAKE_SKIP_BUILD_RPATH TRUE) - -IF("${CMAKE_BUILD_TYPE}" STREQUAL "") - SET(CMAKE_BUILD_TYPE "Debug") -ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") -MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") - -SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -O0 -g -Wall") - -########################################################## -# Define Test App -########################################################## - -SET(MSG-HELPER-SRCS - ${CMAKE_SOURCE_DIR}/msg_helper/MsgSensorWrapper.cpp - ${CMAKE_SOURCE_DIR}/msg_helper/MsgSoundPlayer.cpp - ${CMAKE_SOURCE_DIR}/msg_helper/main.cpp -) - -INCLUDE_DIRECTORIES( - ${CMAKE_SOURCE_DIR}/include/mapi - ${CMAKE_SOURCE_DIR}/include/common - ${CMAKE_SOURCE_DIR}/include/framework - ${CMAKE_SOURCE_DIR}/include/msg_helper - ${CMAKE_SOURCE_DIR}/include/utils -) - -INCLUDE(FindPkgConfig) -pkg_check_modules(msg_helper_pkgs REQUIRED glib-2.0 dlog vconf mm-fileinfo mm-player mm-sound sensor feedback) - -FOREACH(flag ${msg_helper_pkgs_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") - -ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") - -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") - -ADD_EXECUTABLE(msg-helper ${MSG-HELPER-SRCS}) -TARGET_LINK_LIBRARIES(msg-helper ${msg_helper_pkgs_LDFLAGS} ${UTILS-LIB}) - -INSTALL(TARGETS msg-helper DESTINATION bin) - diff --git a/msg_helper/MsgSoundPlayer.cpp b/msg_helper/MsgSoundPlayer.cpp deleted file mode 100755 index ebfaf71..0000000 --- a/msg_helper/MsgSoundPlayer.cpp +++ /dev/null @@ -1,419 +0,0 @@ -/* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include - -#include "MsgDebug.h" -#include "MsgCppTypes.h" -#include "MsgSettingTypes.h" -#include "MsgGconfWrapper.h" -#include "MsgUtilFile.h" -#include "MsgHelper.h" - -#include -#include -#include -#include -#include - -extern void worker_done(); - -/*================================================================================================== - VARIABLES -==================================================================================================*/ -static MMHandleType hPlayerHandle = 0; -static bool bPlaying = false; -static bool bVibrating = false; - -pthread_mutex_t muMmPlay = PTHREAD_MUTEX_INITIALIZER; -pthread_cond_t cvMmPlay = PTHREAD_COND_INITIALIZER; - -/*================================================================================================== - FUNCTION IMPLEMENTATION -==================================================================================================*/ - -static gboolean MsgStopAndExit(void* data) -{ - MsgSoundPlayStop(); - if(!bPlaying && !bVibrating) - worker_done(); - - return FALSE; -} - -static gboolean MsgUninitAndExit(void* data) -{ - MsgSoundPlayUninit(); - if(!bPlaying && !bVibrating) - worker_done(); - - return FALSE; -} - -static gboolean MsgSoundMelodyTimeout(gpointer data) -{ - MSG_BEGIN(); - - MsgSoundPlayStop(); - if(!bPlaying && !bVibrating) - worker_done(); - - MSG_END(); - - return FALSE; -} - -static int MsgSoundPlayCallback(int message, void *param, void *user_param) -{ - switch (message) - { - case MM_MESSAGE_ERROR: - MSG_DEBUG("ERROR is happened."); - g_idle_add (MsgUninitAndExit, NULL); - break; - case MM_MESSAGE_BEGIN_OF_STREAM: - MSG_DEBUG("Play is started."); - break; - case MM_MESSAGE_END_OF_STREAM: - case MM_MESSAGE_STATE_INTERRUPTED: - MSG_DEBUG("EOS or Interrupted."); - g_idle_add (MsgStopAndExit, NULL); - break; - default: - MSG_DEBUG("message = %d", message); - break; - } - - return 1; -} - - -void* MsgPlayThread(void *data) -{ - MSG_BEGIN(); - - bool bSoundOn = false; - bool bVibrationOn = false; - int callStatus = 0; - /* 0 - off, 1 - sound, 2 - vibration */ - int alertOnCall = 0; - - bool isEmergency = false; - - if (data) - isEmergency = (bool)data; - - char *msg_tone_file_path = NULL; - AutoPtr buf(&msg_tone_file_path); - - msg_tone_file_path = new char[MAX_SOUND_FILE_LEN]; - - if (isEmergency) { - } else { - char *tmpFileFath = NULL; - - tmpFileFath = MsgSettingGetString(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR); - - if (tmpFileFath == NULL || MsgGetFileSize(tmpFileFath) < 1) { - strncpy(msg_tone_file_path, DEFAULT_FILE, MAX_SOUND_FILE_LEN-1); - } else { - strncpy(msg_tone_file_path, tmpFileFath, MAX_SOUND_FILE_LEN-1); - free(tmpFileFath); - tmpFileFath = NULL; - } - } - - MSG_DEBUG("Emergency=[%d], Sound File [%s]", isEmergency, msg_tone_file_path); - - MsgSettingGetBool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &bSoundOn); - MsgSettingGetBool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &bVibrationOn); - - int err = MM_ERROR_NONE; - - if (isEmergency) - err = mm_session_init(MM_SESSION_TYPE_EMERGENCY); - else - err = mm_session_init(MM_SESSION_TYPE_NOTIFY); - - if(err != MM_ERROR_NONE) - MSG_DEBUG("MM Session Init Failed"); - else - MSG_DEBUG("MM Session Init Success : %d", err); - - hPlayerHandle = 0; - - err = mm_player_create(&hPlayerHandle); - - if (err != MM_ERROR_NONE) { - MSG_DEBUG("creating the player handle failed"); - return NULL; - } - - /* Setting the call back function msg_callback */ - mm_player_set_message_callback(hPlayerHandle, MsgSoundPlayCallback, (void *)hPlayerHandle); - - callStatus = MsgSettingGetInt(VCONFKEY_CALL_STATE); - MSG_DEBUG("Call Status = %d", callStatus); - - if (callStatus > VCONFKEY_CALL_OFF && callStatus < VCONFKEY_CALL_STATE_MAX) { - alertOnCall = MsgSettingGetInt(VCONFKEY_CISSAPPL_ALERT_ON_CALL_INT); - MSG_DEBUG("Alert On Call = %d", alertOnCall); - - if (alertOnCall == 0) { - MSG_DEBUG("Call is active & Alert on Call - Off"); - } else if (alertOnCall == 1) { - MSG_DEBUG("Call is active & Alert on Call - Sound"); - - if (bSoundOn) - MsgSoundPlayDtmf(); - } else if (alertOnCall == 2) { - MSG_DEBUG("Call is active & Alert on Call - Vibration"); - - if (bVibrationOn) - MsgSoundPlayVibration(true); - } - } else{ - MSG_DEBUG("Call is not active"); - - if (bVibrationOn) { - MSG_DEBUG("Play vibration."); - MsgSoundPlayVibration(false); - } - - if (bSoundOn) { - MSG_DEBUG("Play sound."); - MsgSoundPlayMelody(msg_tone_file_path, false); - } - } - - err = mm_session_finish(); - - if (err != MM_ERROR_NONE) - MSG_DEBUG("MM Session Finish Failed"); - else - MSG_DEBUG("MM Session Finish Success : %d", err); - - if(!bPlaying && !bVibrating) - worker_done(); - - MSG_END(); - - return NULL; -} - - -msg_error_t MsgSoundPlayUninit() -{ - MSG_BEGIN(); - - int err = MM_ERROR_NONE; - - /* Uninitializing the player module */ - err = mm_player_unrealize(hPlayerHandle); - - /* Destroying the player handle */ - err = mm_player_destroy(hPlayerHandle); - - pthread_mutex_lock(&muMmPlay); - - bPlaying = false; - - pthread_mutex_unlock(&muMmPlay); - - pthread_cond_signal(&cvMmPlay); - - hPlayerHandle = 0; - - MSG_END(); - - return MSG_SUCCESS; -} - - -void MsgSoundPlayStart(bool isEmergency) -{ - MSG_BEGIN(); - - pthread_mutex_lock(&muMmPlay); - - if (bPlaying == true) { - MSG_DEBUG("Ringtone is Playing..."); - pthread_mutex_unlock(&muMmPlay); - return; - } - - pthread_mutex_unlock(&muMmPlay); - - pthread_t tid; - - if (pthread_create(&tid, NULL, &MsgPlayThread, (void*)isEmergency) == 0) { - MSG_DEBUG("Ring alert thread created = %d", tid); - } else { - MSG_DEBUG("Creating Thread was failed"); - return; - } - - MSG_END(); -} - - -void MsgSoundPlayStop() -{ - MSG_BEGIN(); - - pthread_mutex_lock(&muMmPlay); - - if (bPlaying == false) { - MSG_DEBUG("Ringtone is Not Playing..."); - pthread_mutex_unlock(&muMmPlay); - return; - } - - pthread_mutex_unlock(&muMmPlay); - - /* Stop playing media contents */ - MSG_DEBUG("Before mm_player_stop, %p", hPlayerHandle); - - int err = mm_player_stop(hPlayerHandle); - - MSG_DEBUG("After mm_player_stop"); - - if (err != MM_ERROR_NONE) { - MSG_DEBUG("stopping the player handle failed"); - } - - MsgSoundPlayUninit(); - - MSG_END(); -} - - -int MsgSoundPlayMelody(char *pMsgToneFilePath, bool bIncreasing) -{ - int err = MM_ERROR_NONE; - - /* Setting fade in/out, Volume */ - err = mm_player_set_attribute(hPlayerHandle, NULL, "sound_volume_type", MM_SOUND_VOLUME_TYPE_NOTIFICATION, - "profile_uri", pMsgToneFilePath, strlen(pMsgToneFilePath), - "sound_priority", 2, NULL); - - if (err != MM_ERROR_NONE) { - MSG_DEBUG("error setting the profile attr"); - return err; - } - - err = mm_player_realize(hPlayerHandle); - - if (err != MM_ERROR_NONE) { - MSG_DEBUG("mm_player_realize() error : [%d]", err); - return err; - } - - /* Add Timer to stop playing after 5 sec. */ - int g_contact_timer = -1; - g_contact_timer = g_timeout_add(5500, (GSourceFunc)MsgSoundMelodyTimeout, NULL); - - err = mm_player_start(hPlayerHandle); - - if (err != MM_ERROR_NONE) { - MSG_DEBUG("mm_player_start, FAIL [%x]", err); - bPlaying = false; - - return err; - } - - bPlaying = true; - - pthread_mutex_lock(&muMmPlay); - - while (bPlaying) - { - MSG_DEBUG("Ring Alert Playing"); - pthread_cond_wait(&cvMmPlay, &muMmPlay); - } - - pthread_mutex_unlock(&muMmPlay); - - MSG_DEBUG("Ring Alert Idle"); - - return err; -} - - -void MsgSoundPlayVibration(bool isOnCall) -{ - MSG_BEGIN(); - - int ret = 0; - - ret = feedback_initialize(); - - if (ret != FEEDBACK_ERROR_NONE) { - MSG_DEBUG("Fail to feedback_initialize : [%d]", ret); - return; - } - - if (isOnCall) - ret = feedback_play_type(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_MESSAGE_ON_CALL); - else - ret = feedback_play_type(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_MESSAGE); - - if (ret != FEEDBACK_ERROR_NONE) - MSG_DEBUG("Fail to feedback_play_type"); - - ret = feedback_deinitialize(); - - if (ret != FEEDBACK_ERROR_NONE) { - MSG_DEBUG("Fail to feedback_deinitialize : [%d]", ret); - return; - } - - MSG_END(); -} - -void MsgSoundPlayDtmf() -{ - MSG_BEGIN(); - - int ret = 0; - int hToneHandle = 0; - - ret = mm_sound_play_tone(MM_SOUND_TONE_PROP_BEEP2, VOLUME_TYPE_SYSTEM, 1.0, 300, &hToneHandle); - - if(ret < 0) { - MSG_DEBUG("play tone failed\n"); - } else { - MSG_DEBUG("play tone success\n"); - } - - MSG_END(); -} - - -int MsgSoundGetUnreadMsgCnt() -{ - int unreadCnt = 0; - - /* Get SMS Count */ - unreadCnt = MsgSettingGetInt(VCONFKEY_MESSAGE_RECV_SMS_STATE); - - /* Get MMS Count */ - unreadCnt += MsgSettingGetInt(VCONFKEY_MESSAGE_RECV_MMS_STATE); - - MSG_DEBUG("unread count : [%d]", unreadCnt); - - return unreadCnt; -} diff --git a/msg_helper/main.cpp b/msg_helper/main.cpp deleted file mode 100755 index 304ee0a..0000000 --- a/msg_helper/main.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include - -#include "MsgHelper.h" -#include "MsgUtilFile.h" -#include "MsgCppTypes.h" -#include "MsgDebug.h" - -static GMainLoop *loop; - -static gboolean _worker_done(void* data) -{ - if (g_main_loop_is_running(loop)) - g_main_loop_quit(loop); - - return 0; -} - -// may called by threads -void worker_done() -{ - g_idle_add(_worker_done,NULL); -} - -int main(int argc, char** argv) -{ - - MSG_DEBUG("############### Start msg_helper ###############"); - -#if !GLIB_CHECK_VERSION(2, 31, 0) - g_thread_init(NULL); -#endif - - bool notEnd = false; - - if(argc < 1) - { - MSG_DEBUG("No arguments to run msg_helper."); - return 0; - } - - MSG_DEBUG("argv[0] [%s] ", argv[0]); - - if(g_strcmp0(argv[0], MSG_NORMAL_SOUND_START) == 0) - { - MsgSoundPlayStart(false); - notEnd = true; - } - if(g_strcmp0(argv[0], MSG_EMERGENCY_SOUND_START) == 0) - { - MsgSoundPlayStart(true); - notEnd = true; - } - else if(g_strcmp0(argv[0],MSG_SOUND_STOP) == 0) - { - MsgSoundPlayStop(); - } - - if(notEnd) - { - loop = g_main_loop_new(NULL, FALSE); - - if (MsgSensorConnect() == MSG_SUCCESS) - if (MsgRegSensorCB(&worker_done) != MSG_SUCCESS) - MsgSensorDisconnect(); - - if (loop != NULL) - { - MSG_DEBUG("Waiting for working jobs to be finished!!!"); - - // Run GMainLoop - g_main_loop_run(loop); - } - else - { - MSG_DEBUG("Fail to create g_main_loop!!!"); - MsgSensorDisconnect(); - } - } - - return 0; -} diff --git a/packaging/msg-server.service b/packaging/msg-server.service new file mode 100755 index 0000000..458cbf6 --- /dev/null +++ b/packaging/msg-server.service @@ -0,0 +1,13 @@ +[Unit] +Description=Message server +After=tizen-runtime.target contacts-service.service +Requires=tizen-runtime.target contacts-service.service + +[Service] +Type=forking +ExecStart=/etc/rc.d/init.d/msg-server +Restart=always +MemoryLimit=10M + +[Install] +WantedBy=multi-user.target diff --git a/packaging/msg-service.service b/packaging/msg-service.service deleted file mode 100755 index 0c41b56..0000000 --- a/packaging/msg-service.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Messaging Framework - -[Service] -ExecStart=/usr/bin/msg-server -Nice=5 -OOMScoreAdjust=-100 -Restart=always - -[Install] -WantedBy=multi-user.target diff --git a/packaging/msg-service.spec b/packaging/msg-service.spec old mode 100644 new mode 100755 index d00bed0..9829ee1 --- a/packaging/msg-service.spec +++ b/packaging/msg-service.spec @@ -1,11 +1,10 @@ Name: msg-service -Version: 0.9.11 +Version: 1.0.0 Release: 1 -License: Flora-1.1 +License: Apache-2.0 Summary: Messaging Framework Library Group: System/Libraries Source0: %{name}-%{version}.tar.gz -Source101: msg-service.service Requires(post): /usr/bin/sqlite3 Requires(post): /usr/bin/vconftool @@ -15,14 +14,22 @@ Requires(post): systemd Requires(postun): systemd BuildRequires: cmake BuildRequires: pkgconfig(alarm-service) -BuildRequires: pkgconfig(appsvc) BuildRequires: pkgconfig(aul) +BuildRequires: pkgconfig(badge) BuildRequires: pkgconfig(capi-appfw-application) +BuildRequires: pkgconfig(capi-network-connection) +BuildRequires: pkgconfig(csr-framework) BuildRequires: pkgconfig(contacts-service2) BuildRequires: pkgconfig(db-util) +BuildRequires: pkgconfig(dbus-glib-1) +BuildRequires: pkgconfig(deviced) BuildRequires: pkgconfig(dlog) -BuildRequires: pkgconfig(drm-client) +BuildRequires: pkgconfig(feedback) BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(gobject-2.0) +BuildRequires: pkgconfig(iniparser) +BuildRequires: pkgconfig(json-glib-1.0) +BuildRequires: pkgconfig(lbs-dbus) BuildRequires: pkgconfig(libcurl) BuildRequires: pkgconfig(libsystemd-daemon) BuildRequires: pkgconfig(libxml-2.0) @@ -32,25 +39,23 @@ BuildRequires: pkgconfig(mm-fileinfo) BuildRequires: pkgconfig(mm-player) BuildRequires: pkgconfig(mm-session) BuildRequires: pkgconfig(mm-sound) -BuildRequires: pkgconfig(network) -BuildRequires: pkgconfig(notification) -BuildRequires: pkgconfig(pmapi) BuildRequires: pkgconfig(mmutil-imgp) BuildRequires: pkgconfig(mmutil-jpeg) +BuildRequires: pkgconfig(notification) +BuildRequires: pkgconfig(privacy-manager-client) +BuildRequires: pkgconfig(secure-storage) BuildRequires: pkgconfig(security-server) BuildRequires: pkgconfig(sensor) -BuildRequires: pkgconfig(svi) +BuildRequires: pkgconfig(storage) BuildRequires: pkgconfig(tapi) BuildRequires: pkgconfig(vconf) -BuildRequires: pkgconfig(feedback) -BuildRequires: pkgconfig(capi-network-connection) %description Description: Messaging Framework Library %package devel -License: Flora License v1.1 +License: Apache-2.0 Summary: Messaging Framework Library (development) Requires: %{name} = %{version}-%{release} Group: Development/Libraries @@ -60,7 +65,7 @@ Description: Messaging Framework Library (development) %package tools -License: Flora License v1.1 +License: Apache-2.0 Summary: Messaging server application Requires: %{name} = %{version}-%{release} Group: TO_BU / FILL_IN @@ -74,7 +79,7 @@ Description: Messaging server application %package -n sms-plugin -License: Flora License v1.1 +License: Apache-2.0 Summary: SMS plugin library Requires: %{name} = %{version}-%{release} Group: System/Libraries @@ -85,7 +90,7 @@ Requires(postun): /sbin/ldconfig Description: SMS plugin library %package -n mms-plugin -License: Flora License v1.1 +License: Apache-2.0 Summary: MMS plugin library Requires: %{name} = %{version}-%{release} Group: System/Libraries @@ -98,409 +103,232 @@ Description: MMS plugin library %prep %setup -q - %build -%cmake . + +cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \ +%ifarch i586 +-D_TIZEN_I586_ENABLED:BOOL=ON +%else +-D_TIZEN_I586_ENABLED:BOOL=OFF +%endif + make %{?jobs:-j%jobs} %install rm -rf %{buildroot} -mkdir -p %{buildroot}/etc/config -mkdir -p %{buildroot}/var/log/msgfw mkdir -p %{buildroot}/usr/share/license -cp LICENSE.Flora %{buildroot}/usr/share/license/%{name} -cp LICENSE.Flora %{buildroot}/usr/share/license/%{name}-devel -cp LICENSE.Flora %{buildroot}/usr/share/license/%{name}-tools -cp LICENSE.Flora %{buildroot}/usr/share/license/sms-plugin -cp LICENSE.Flora %{buildroot}/usr/share/license/mms-plugin +mkdir -p %{buildroot}/etc/config %make_install -mkdir -p %{buildroot}/usr/lib/systemd/system/multi-user.target.wants -ln -s ../msg-service.service %{buildroot}/usr/lib/systemd/system/multi-user.target.wants/msg-service.service +mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants +ln -s ../msg-server.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/msg-server.service -mkdir -p %{buildroot}/opt/usr/data/msg-service +mkdir -p %{buildroot}/opt/usr/dbspace +sqlite3 %{buildroot}/opt/usr/dbspace/.msg_service.db "PRAGMA journal_mode = PERSIST;" +sqlite3 %{buildroot}/opt/usr/dbspace/.msg_service.db < %{buildroot}/usr/share/msg-service/msg-service-db.sql -%if 0%{?simulator} -rm %{buildroot}/etc/config/sysinfo-message.xml -mv %{buildroot}/etc/config/sysinfo-message.emul.xml %{buildroot}/etc/config/sysinfo-message.xml -%else -rm %{buildroot}/etc/config/sysinfo-message.emul.xml -%endif +rm %{buildroot}/usr/share/msg-service/msg-service-db.sql +%post tools +/sbin/ldconfig + +chown :5000 /opt/usr/dbspace/.msg_service.db +chown :5000 /opt/usr/dbspace/.msg_service.db-journal +chmod 660 /opt/usr/dbspace/.msg_service.db +chmod 660 /opt/usr/dbspace/.msg_service.db-journal + +if [ -f /usr/lib/rpm-plugins/msm.so ] +then + chsmack -a 'msg-service::db' /opt/usr/dbspace/.msg_service.db* +fi -%post tools -p /sbin/ldconfig %post -n sms-plugin -p /sbin/ldconfig %post -n mms-plugin -p /sbin/ldconfig %post /sbin/ldconfig -if [ ! -f /opt/usr/dbspace/.msg_service.db ] -then - mkdir -p /opt/usr/dbspace/ - sqlite3 /opt/usr/dbspace/.msg_service.db "PRAGMA journal_mode = PERSIST; - - CREATE TABLE MSG_CONVERSATION_TABLE ( - CONV_ID INTEGER PRIMARY KEY , - UNREAD_CNT INTEGER DEFAULT 0 , - SMS_CNT INTEGER DEFAULT 0 , - MMS_CNT INTEGER DEFAULT 0 , - MAIN_TYPE INTEGER DEFAULT 0 , - SUB_TYPE INTEGER DEFAULT 0 , - MSG_DIRECTION INTEGER DEFAULT 0 , - DISPLAY_TIME DATETIME , - DISPLAY_NAME TEXT , - MSG_TEXT TEXT ); - - CREATE TABLE MSG_ADDRESS_TABLE ( - ADDRESS_ID INTEGER PRIMARY KEY , - CONV_ID INTEGER NOT NULL , - ADDRESS_TYPE INTEGER , - RECIPIENT_TYPE INTEGER , - ADDRESS_VAL TEXT , - CONTACT_ID INTEGER , - DISPLAY_NAME TEXT , - FIRST_NAME TEXT , - LAST_NAME TEXT , - IMAGE_PATH TEXT , - SYNC_TIME DATETIME , - FOREIGN KEY (CONV_ID) REFERENCES MSG_CONVERSATION_TABLE (CONV_ID) ); - - CREATE TABLE MSG_FOLDER_TABLE ( - FOLDER_ID INTEGER PRIMARY KEY , - FOLDER_NAME TEXT NOT NULL , - FOLDER_TYPE INTEGER DEFAULT 0 ); - - CREATE TABLE MSG_MESSAGE_TABLE ( - MSG_ID INTEGER PRIMARY KEY , - CONV_ID INTEGER NOT NULL , - FOLDER_ID INTEGER NOT NULL , - STORAGE_ID INTEGER NOT NULL , - MAIN_TYPE INTEGER NOT NULL , - SUB_TYPE INTEGER NOT NULL , - DISPLAY_TIME DATETIME , - DATA_SIZE INTEGER DEFAULT 0 , - NETWORK_STATUS INTEGER DEFAULT 0 , - READ_STATUS INTEGER DEFAULT 0 , - PROTECTED INTEGER DEFAULT 0 , - PRIORITY INTEGER DEFAULT 0 , - MSG_DIRECTION INTEGER NOT NULL , - SCHEDULED_TIME DATETIME , - BACKUP INTEGER DEFAULT 0 , - SUBJECT TEXT , - MSG_DATA TEXT , - THUMB_PATH TEXT , - MSG_TEXT TEXT , - ATTACHMENT_COUNT INTEGER DEFAULT 0 , - FOREIGN KEY (CONV_ID) REFERENCES MSG_CONVERSATION_TABLE (CONV_ID) , - FOREIGN KEY (FOLDER_ID) REFERENCES MSG_FOLDER_TABLE (FOLDER_ID) ); - - CREATE TABLE MSG_SIM_TABLE ( - MSG_ID INTEGER PRIMARY KEY , - SIM_ID INTEGER NOT NULL , - FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID) ); - - CREATE TABLE MSG_PUSH_TABLE ( - MSG_ID INTEGER PRIMARY KEY , - ACTION INTEGER , - CREATED INTEGER , - EXPIRES INTEGER , - ID TEXT , - HREF TEXT , - CONTENT TEXT , - FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID) ); - - CREATE TABLE MSG_CBMSG_TABLE ( - MSG_ID INTEGER PRIMARY KEY , - CB_MSG_ID INTEGER NOT NULL , - FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID) ); - - CREATE TABLE MSG_SYNCML_TABLE ( - MSG_ID INTEGER PRIMARY KEY , - EXT_ID INTEGER NOT NULL , - PINCODE INTEGER NOT NULL , - FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID) ); - - CREATE TABLE MSG_SCHEDULED_TABLE ( - MSG_ID INTEGER PRIMARY KEY , - ALARM_ID INTEGER NOT NULL , - FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID) ); - - CREATE TABLE MSG_SMS_SENDOPT_TABLE ( - MSG_ID INTEGER PRIMARY KEY , - DELREP_REQ INTEGER NOT NULL , - KEEP_COPY INTEGER NOT NULL , - REPLY_PATH INTEGER NOT NULL , - FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID) ); - - CREATE TABLE MSG_FILTER_TABLE ( - FILTER_ID INTEGER PRIMARY KEY , - FILTER_TYPE INTEGER NOT NULL , - FILTER_VALUE TEXT NOT NULL , - FILTER_ACTIVE INTEGER DEFAULT 0 ); - - CREATE TABLE MSG_MMS_MESSAGE_TABLE ( - MSG_ID INTEGER PRIMARY KEY , - TRANSACTION_ID TEXT , - MESSAGE_ID TEXT , - FWD_MESSAGE_ID TEXT , - CONTENTS_LOCATION TEXT , - FILE_PATH TEXT , - VERSION INTEGER NOT NULL , - DATA_TYPE INTEGER DEFAULT -1 , - DATE DATETIME , - HIDE_ADDRESS INTEGER DEFAULT 0 , - ASK_DELIVERY_REPORT INTEGER DEFAULT 0 , - REPORT_ALLOWED INTEGER DEFAULT 0 , - READ_REPORT_ALLOWED_TYPE INTEGER DEFAULT 0 , - ASK_READ_REPLY INTEGER DEFAULT 0 , - READ INTEGER DEFAULT 0 , - READ_REPORT_SEND_STATUS INTEGER DEFAULT 0 , - READ_REPORT_SENT INTEGER DEFAULT 0 , - PRIORITY INTEGER DEFAULT 0 , - KEEP_COPY INTEGER DEFAULT 0 , - MSG_SIZE INTEGER NOT NULL , - MSG_CLASS INTEGER DEFAULT -1 , - EXPIRY_TIME DATETIME , - CUSTOM_DELIVERY_TIME INTEGER DEFAULT 0 , - DELIVERY_TIME DATETIME , - MSG_STATUS INTEGER DEFAULT -1 , - FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID) ); - - CREATE TABLE MSG_MMS_PREVIEW_INFO_TABLE ( - MSG_ID INTEGER NOT NULL , - TYPE INTEGER, - VALUE TEXT, - COUNT INTEGER, - FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID) ); - - CREATE TABLE MSG_REPORT_TABLE ( - MSG_ID INTEGER NOT NULL , - ADDRESS_VAL TEXT , - STATUS_TYPE INTEGER , - STATUS INTEGER DEFAULT 0 , - TIME DATETIME ); - - CREATE TABLE MSG_PUSHCFG_TABLE ( - PUSH_ID INTEGER PRIMARY KEY , - CONTENT_TYPE TEXT, - APP_ID TEXT, - PKG_NAME TEXT, - LAUNCH INTEGER, - APPCODE INTEGER, - SECURE INTEGER ); - - CREATE TABLE MSG_TMP_MSGID_TABLE ( - MSG_ID INTEGER ); - - CREATE INDEX MSG_CONVERSATION_INDEX ON MSG_CONVERSATION_TABLE(CONV_ID); - CREATE INDEX MSG_FOLDER_INDEX ON MSG_FOLDER_TABLE(FOLDER_ID); - CREATE INDEX MSG_MESSAGE_INDEX ON MSG_MESSAGE_TABLE(MSG_ID, CONV_ID, FOLDER_ID); - - INSERT INTO MSG_FOLDER_TABLE VALUES (1, 'INBOX', 1); - INSERT INTO MSG_FOLDER_TABLE VALUES (2, 'OUTBOX', 2); - INSERT INTO MSG_FOLDER_TABLE VALUES (3, 'SENTBOX', 2); - INSERT INTO MSG_FOLDER_TABLE VALUES (4, 'DRAFT', 3); - INSERT INTO MSG_FOLDER_TABLE VALUES (5, 'CBMSGBOX', 1); - INSERT INTO MSG_FOLDER_TABLE VALUES (6, 'SPAMBOX', 4); - INSERT INTO MSG_FOLDER_TABLE VALUES (7, 'SMS TEMPLATE', 5); - INSERT INTO MSG_FOLDER_TABLE VALUES (8, 'MMS TEMPLATE', 5); - - INSERT INTO MSG_PUSHCFG_TABLE VALUES (1, 'text/vnd.wap.si', 'X-Wap-Application-Id: x-wap-application:wml.ua', '', 0, 1, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (2, 'application/vnd.wap.sic', 'X-Wap-Application-Id: x-wap-application:wml.ua', '', 0, 2, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (3, 'text/vnd.wap.sl', 'X-Wap-Application-Id: x-wap-application:wml.ua', '', 0, 3, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (4, 'application/vnd.wap.slc', 'X-Wap-Application-Id: x-wap-application:wml.ua', '', 0, 4, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (5, 'text/vnd.wap.co', 'X-Wap-Application-Id: x-wap-application:wml.ua', '', 0, 5, 0); - - INSERT INTO MSG_PUSHCFG_TABLE VALUES (6, 'application/vnd.wap.coc', 'X-Wap-Application-Id: x-wap-application:wml.ua', '', 0, 6, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (7, 'application/vnd.wap.mms-message', 'X-Wap-Application-Id: x-wap-application:mms.ua', '', 0, 7, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (8, 'application/vnd.wap.sia', 'X-Wap-Application-Id: x-wap-application:push.sia', '', 0, 8, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (9, 'application/vnd.syncml.dm+wbxml', 'X-Wap-Application-Id: x-wap-application:push.syncml.dm', '', 0, 9, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (10, 'application/vnd.syncml.dm+xml', 'X-Wap-Application-Id: x-wap-application:push.syncml.dm', '', 0, 10, 0); - - INSERT INTO MSG_PUSHCFG_TABLE VALUES (11, 'application/vnd.syncml.notification', 'X-Wap-Application-Id: x-wap-application:push.syncml.dm', '', 0, 11, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (12, 'application/vnd.syncml.ds.notification', 'X-Wap-Application-Id: x-wap-application:push.syncml.ds', '', 0, 12, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (13, 'application/vnd.syncml+wbxml', 'X-Wap-Application-Id:x-wap-application:push.syncml', '', 0, 13, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (14, 'application/vnd.wap.locc+wbxml', 'X-Wap-Application-Id: x-wap-application:loc.ua', '', 0, 14, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (15, 'application/vnd.wap.loc+xml', 'X-Wap-Application-Id: x-wap-application:loc.ua', '', 0, 15, 0); - - INSERT INTO MSG_PUSHCFG_TABLE VALUES (16, 'application/vnd.oma.dd+xml', 'X-Wap-Application-Id: x-wap-application:loc.ua', '', 0, 16, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (17, 'application/vnd.oma.drm.message', 'X-Wap-Application-Id: x-wap-application:drm.ua', '', 0, 17, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (18, 'application/vnd.oma.drm.content', 'X-Wap-Application-Id: x-wap-application:drm.ua', '', 0, 18, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (19, 'application/vnd.oma.drm.rights+xml', 'X-Wap-Application-Id: x-wap-application:drm.ua', '', 0, 19, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (20, 'application/vnd.oma.drm.rights+wbxml', 'X-Wap-Application-Id: x-wap-application:drm.ua', '', 0, 20, 0); - - INSERT INTO MSG_PUSHCFG_TABLE VALUES (21, 'application/vnd.oma.drm.ro+xml', 'X-Wap-Application-Id: x-wap-application:drm.ua', '', 0, 21, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (22, 'application/vnd.oma.drm.roap-pdu+xml', 'X-Wap-Application-Id: x-wap-application:drm.ua', '', 0, 22, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (23, 'application/vnd.oma.drm.roap-trigger+xml', 'X-Wap-Application-Id: x-wap-application:drm.ua', '', 0, 23, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (24, 'application/vnd.oma.drm.roap-trigger+wbxml', 'X-Wap-Application-Id: x-wap-application:drm.ua', '', 0, 24, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (25, 'text/vnd.wap.connectivity-xml', 'X-Wap-Application-Id: x-wap-application:drm.ua', '', 0, 26, 0); - - INSERT INTO MSG_PUSHCFG_TABLE VALUES (26, 'application/vnd.wap.connectivity-wbxml', 'X-Wap-Application-Id: x-wap-samsung:provisioning.ua', '', 0, 27, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (27, 'application/x-wap-prov.browser-settings', 'X-Wap-Application-Id: x-wap-samsung:provisioning.ua', '', 0, 28, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (28, 'application/x-wap-prov.browser-bookmarks', 'X-Wap-Application-Id: x-wap-samsung:provisioning.ua', '', 0, 29, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (29, 'application/x-wap-prov.syncset+xml', 'X-Wap-Application-Id: x-wap-samsung:provisioning.ua', '', 0, 30, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (30, 'application/x-wap-prov.syncset+wbxml', 'X-Wap-Application-Id: x-wap-samsung:provisioning.ua', '', 0, 31, 0); - - INSERT INTO MSG_PUSHCFG_TABLE VALUES (31, 'text/vnd.wap.emn+xml', 'X-Wap-Application-Id: x-wap-application:emn.ua', '', 0, 32, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (32, 'application/vnd.wap.emn+wbxml', 'X-Wap-Application-Id: x-wap-application:emn.ua', '', 0, 33, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (33, 'application/vnd.wv.csp.cir', 'X-Wap-Application-Id: x-wap-application:wv.ua', '', 0, 34, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (34, 'application/vnd.omaloc-supl-init', 'X-Wap-Application-Id: x-oma-application:ulp.ua', '', 0, 44, 0); - INSERT INTO MSG_PUSHCFG_TABLE VALUES (35, 'application/vnd.wap.emn+wbxml', 'X-oma-docomo:xmd.mail.ua', '', 0, 45, 1);" -fi - -chown :6011 /opt/usr/dbspace/.msg_service.db -chown :6011 /opt/usr/dbspace/.msg_service.db-journal -chmod 660 /opt/usr/dbspace/.msg_service.db -chmod 660 /opt/usr/dbspace/.msg_service.db-journal mkdir -p /opt/usr/data/msg-service chgrp db_msg_service /opt/usr/data/msg-service if [ -f /usr/lib/rpm-plugins/msm.so ] then - chsmack -a 'msg-service::db' /opt/usr/dbspace/.msg_service.db* + chsmack -a "_" -e "_" /etc/rc.d/init.d/msg-server fi ########## Setting Config Value (Internal keys) ########## -vcuid=5000 # Message Server Status -vconftool set -t bool memory/msg/ready 0 -i -g 5000 -u $vcuid +vconftool set -t bool memory/msg/ready 0 -i -g 5000 -s system::vconf_inhouse # SMS Send Options -vconftool set -t int db/msg/network_mode 2 -u $vcuid +vconftool set -t int db/msg/network_mode 2 -g 5000 -s system::vconf_inhouse # New Message Count -vconftool set -t int db/msg/recv_sms 0 -u $vcuid -vconftool set -t int db/msg/recv_mms 0 -u $vcuid +vconftool set -t int db/msg/recv_sms 0 -g 5000 -s system::vconf_inhouse +vconftool set -t int db/msg/recv_mms 0 -g 5000 -s system::vconf_inhouse ########## Setting Config Value (Private keys) ########## # General Options -vconftool set -t bool db/private/msg-service/general/keep_copy 1 -u $vcuid -vconftool set -t bool db/private/msg-service/general/auto_erase 0 -u $vcuid -vconftool set -t bool db/private/msg-service/general/block_msg 0 -u $vcuid -vconftool set -t int db/private/msg-service/general/contact_sync_time 0 -u $vcuid +vconftool set -t bool db/private/msg-service/general/keep_copy 1 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/general/auto_erase 0 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/general/block_msg 1 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/general/contact_sync_time 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/general/alert_rep_type 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/general/search_tags 31 -s msg-service::vconf -g 5000 + +vconftool set -t int db/private/msg-service/general/page_limit 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/general/sms_mms_threshold 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/general/max_recipient 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/general/sms_storage 0 -s msg-service::vconf -g 5000 + +vconftool set -t bool db/private/msg-service/general/block_unknown_msg 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/general/sms_limit 1000 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/general/mms_limit 100 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/general/notification 1 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/general/vibration 1 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/general/preview 1 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/general/ringtone_type 0 -s msg-service::vconf -g 5000 +vconftool set -t string db/private/msg-service/general/ringtone_path "" -s msg-service::vconf -g 5000 + +vconftool set -t string db/private/msg-service/general/ua_profile "" -s msg-service::vconf -g 5000 + +vconftool set -t int db/private/msg-service/general/msg_id_counter 0 -s msg-service::vconf -g 5000 # SMS Send Options -vconftool set -t int db/private/msg-service/sms_send/dcs 3 -u $vcuid -vconftool set -t bool db/private/msg-service/sms_send/reply_path 0 -u $vcuid -vconftool set -t bool db/private/msg-service/sms_send/delivery_report 0 -u $vcuid -vconftool set -t int db/private/msg-service/sms_send/save_storage 1 -u $vcuid - -# SMSC -vconftool set -t int db/private/msg-service/smsc/total_count 1 -u $vcuid -vconftool set -t int db/private/msg-service/smsc/selected 0 -u $vcuid - -vconftool set -t int db/private/msg-service/smsc/pid/0 1 -u $vcuid -vconftool set -t int db/private/msg-service/smsc/val_period/0 255 -u $vcuid -vconftool set -t string db/private/msg-service/smsc/name/0 "" -u $vcuid -vconftool set -t int db/private/msg-service/smsc/ton/0 1 -u $vcuid -vconftool set -t int db/private/msg-service/smsc/npi/0 1 -u $vcuid -vconftool set -t string db/private/msg-service/smsc/address/0 "" -u $vcuid - -vconftool set -t int db/private/msg-service/smsc/pid/1 0 -u $vcuid -vconftool set -t int db/private/msg-service/smsc/val_period/1 0 -u $vcuid -vconftool set -t string db/private/msg-service/smsc/name/1 "" -u $vcuid -vconftool set -t int db/private/msg-service/smsc/ton/1 0 -u $vcuid -vconftool set -t int db/private/msg-service/smsc/npi/1 0 -u $vcuid -vconftool set -t string db/private/msg-service/smsc/address/1 "" -u $vcuid - -vconftool set -t int db/private/msg-service/smsc/pid/2 0 -u $vcuid -vconftool set -t int db/private/msg-service/smsc/val_period/2 0 -u $vcuid -vconftool set -t string db/private/msg-service/smsc/name/2 "" -u $vcuid -vconftool set -t int db/private/msg-service/smsc/ton/2 0 -u $vcuid -vconftool set -t int db/private/msg-service/smsc/npi/2 0 -u $vcuid -vconftool set -t string db/private/msg-service/smsc/address/2 "" -u $vcuid +vconftool set -t int db/private/msg-service/sms_send/dcs 3 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/sms_send/reply_path 0 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/sms_send/delivery_report 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/sms_send/save_storage 1 -s msg-service::vconf -g 5000 # MMS Send Options -vconftool set -t int db/private/msg-service/mms_send/msg_class 0 -u $vcuid -vconftool set -t int db/private/msg-service/mms_send/priority 1 -u $vcuid -vconftool set -t int db/private/msg-service/mms_send/expiry_time 0 -u $vcuid -vconftool set -t int db/private/msg-service/mms_send/custom_delivery 0 -u $vcuid -vconftool set -t bool db/private/msg-service/mms_send/sender_visibility 0 -u $vcuid -vconftool set -t bool db/private/msg-service/mms_send/delivery_report 1 -u $vcuid -vconftool set -t bool db/private/msg-service/mms_send/read_reply 1 -u $vcuid -vconftool set -t bool db/private/msg-service/mms_send/keep_copy 0 -u $vcuid -vconftool set -t bool db/private/msg-service/mms_send/body_replying 0 -u $vcuid -vconftool set -t bool db/private/msg-service/mms_send/hide_recipients 0 -u $vcuid -vconftool set -t bool db/private/msg-service/mms_send/report_allowed 1 -u $vcuid -vconftool set -t int db/private/msg-service/mms_send/reply_charging 0 -u $vcuid -vconftool set -t int db/private/msg-service/mms_send/reply_charging_deadline 0 -u $vcuid -vconftool set -t int db/private/msg-service/mms_send/reply_charging_size 0 -u $vcuid -vconftool set -t int db/private/msg-service/mms_send/delivery_time 0 -u $vcuid -vconftool set -t int db/private/msg-service/mms_send/creation_mode 2 -u $vcuid +vconftool set -t int db/private/msg-service/mms_send/msg_class 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/mms_send/priority 1 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/mms_send/expiry_time 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/mms_send/custom_delivery 0 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/mms_send/sender_visibility 0 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/mms_send/delivery_report 0 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/mms_send/read_reply 0 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/mms_send/keep_copy 0 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/mms_send/body_replying 0 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/mms_send/hide_recipients 0 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/mms_send/report_allowed 1 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/mms_send/reply_charging 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/mms_send/reply_charging_deadline 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/mms_send/reply_charging_size 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/mms_send/delivery_time 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/mms_send/creation_mode 2 -s msg-service::vconf -g 5000 # MMS Receive Options -vconftool set -t int db/private/msg-service/mms_recv/home_network 0 -u $vcuid -vconftool set -t int db/private/msg-service/mms_recv/abroad_network 0 -u $vcuid -vconftool set -t bool db/private/msg-service/mms_recv/read_receipt 1 -u $vcuid -vconftool set -t bool db/private/msg-service/mms_recv/delivery_receipt 1 -u $vcuid -vconftool set -t bool db/private/msg-service/mms_recv/reject_unknown 0 -u $vcuid -vconftool set -t bool db/private/msg-service/mms_recv/reject_advertisement 0 -u $vcuid - -# MMS Receive Options -vconftool set -t int db/private/msg-service/mms_style/font_size 30 -u $vcuid -vconftool set -t bool db/private/msg-service/mms_style/font_style/bold 0 -u $vcuid -vconftool set -t bool db/private/msg-service/mms_style/font_style/italic 0 -u $vcuid -vconftool set -t bool db/private/msg-service/mms_style/font_style/underline 0 -u $vcuid -vconftool set -t int db/private/msg-service/mms_style/font_color/red 255 -u $vcuid -vconftool set -t int db/private/msg-service/mms_style/font_color/green 255 -u $vcuid -vconftool set -t int db/private/msg-service/mms_style/font_color/blue 255 -u $vcuid -vconftool set -t int db/private/msg-service/mms_style/font_color/hue 255 -u $vcuid -vconftool set -t int db/private/msg-service/mms_style/bg_color/red 0 -u $vcuid -vconftool set -t int db/private/msg-service/mms_style/bg_color/green 0 -u $vcuid -vconftool set -t int db/private/msg-service/mms_style/bg_color/blue 0 -u $vcuid -vconftool set -t int db/private/msg-service/mms_style/bg_color/hue 255 -u $vcuid -vconftool set -t int db/private/msg-service/mms_style/page_dur 2 -u $vcuid -vconftool set -t int db/private/msg-service/mms_style/page_custom_dur 0 -u $vcuid -vconftool set -t int db/private/msg-service/mms_style/page_dur_manual 0 -u $vcuid +vconftool set -t int db/private/msg-service/mms_recv/home_network 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/mms_recv/abroad_network 1 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/mms_recv/read_receipt 1 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/mms_recv/delivery_receipt 1 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/mms_recv/reject_unknown 0 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/mms_recv/reject_advertisement 0 -s msg-service::vconf -g 5000 + +# MMS Style Options +vconftool set -t int db/private/msg-service/mms_style/font_size 30 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/mms_style/font_style/bold 0 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/mms_style/font_style/italic 0 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/mms_style/font_style/underline 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/mms_style/font_color/red 255 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/mms_style/font_color/green 255 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/mms_style/font_color/blue 255 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/mms_style/font_color/hue 255 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/mms_style/bg_color/red 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/mms_style/bg_color/green 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/mms_style/bg_color/blue 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/mms_style/bg_color/hue 255 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/mms_style/page_dur 2 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/mms_style/page_custom_dur 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/mms_style/page_dur_manual 0 -s msg-service::vconf -g 5000 # Push Msg Options -vconftool set -t bool db/private/msg-service/push_msg/recv_option 1 -u $vcuid -vconftool set -t int db/private/msg-service/push_msg/service_load 1 -u $vcuid +vconftool set -t bool db/private/msg-service/push_msg/recv_option 1 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/push_msg/service_load 1 -s msg-service::vconf -g 5000 # CB Msg Options -vconftool set -t bool db/private/msg-service/cb_msg/receive 1 -f -u $vcuid -vconftool set -t bool db/private/msg-service/cb_msg/save 1 -f -u $vcuid -vconftool set -t int db/private/msg-service/cb_msg/max_sim_count 0 -u $vcuid -vconftool set -t int db/private/msg-service/cb_msg/channel_count 0 -u $vcuid -vconftool set -t bool db/private/msg-service/cb_msg/language/0 1 -f -u $vcuid -vconftool set -t bool db/private/msg-service/cb_msg/language/1 0 -u $vcuid -vconftool set -t bool db/private/msg-service/cb_msg/language/2 0 -u $vcuid -vconftool set -t bool db/private/msg-service/cb_msg/language/3 0 -u $vcuid -vconftool set -t bool db/private/msg-service/cb_msg/language/4 0 -u $vcuid -vconftool set -t bool db/private/msg-service/cb_msg/language/5 0 -u $vcuid -vconftool set -t bool db/private/msg-service/cb_msg/language/6 0 -u $vcuid -vconftool set -t bool db/private/msg-service/cb_msg/language/7 0 -u $vcuid -vconftool set -t bool db/private/msg-service/cb_msg/language/8 0 -u $vcuid -vconftool set -t bool db/private/msg-service/cb_msg/language/9 0 -u $vcuid +vconftool set -t bool db/private/msg-service/cb_msg/receive 0 -f -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/cb_msg/save 0 -f -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/cb_msg/max_sim_count/1 0 -f -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/cb_msg/max_sim_count/2 0 -f -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/cb_msg/max_sim_count/3 0 -f -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/cb_msg/language/0 1 -f -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/cb_msg/language/1 0 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/cb_msg/language/2 0 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/cb_msg/language/3 0 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/cb_msg/language/4 0 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/cb_msg/language/5 0 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/cb_msg/language/6 0 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/cb_msg/language/7 0 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/cb_msg/language/8 0 -s msg-service::vconf -g 5000 +vconftool set -t bool db/private/msg-service/cb_msg/language/9 0 -s msg-service::vconf -g 5000 # Voice Mail Options -vconftool set -t string db/private/msg-service/voice_mail/voice_mail_number "5500" -f -u $vcuid -vconftool set -t int db/private/msg-service/voice_mail/voice_mail_count 0 -u $vcuid +vconftool set -t string db/private/msg-service/voice_mail/voice_mail_number/1 "" -f -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/voice_mail/voice_mail_count/1 0 -f -s msg-service::vconf -g 5000 +vconftool set -t string db/private/msg-service/voice_mail/voice_mail_alphaid/1 "" -f -s msg-service::vconf -g 5000 + +vconftool set -t string db/private/msg-service/voice_mail/voice_mail_number/2 "" -f -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/voice_mail/voice_mail_count/2 0 -f -s msg-service::vconf -g 5000 +vconftool set -t string db/private/msg-service/voice_mail/voice_mail_alphaid/2 "" -f -s msg-service::vconf -g 5000 + +vconftool set -t string db/private/msg-service/voice_mail/voice_mail_number/3 "" -f -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/voice_mail/voice_mail_count/3 0 -f -s msg-service::vconf -g 5000 +vconftool set -t string db/private/msg-service/voice_mail/voice_mail_alphaid/3 "" -f -s msg-service::vconf -g 5000 # MMS Size Options -vconftool set -t int db/private/msg-service/size_opt/msg_size 300 -u $vcuid +vconftool set -t int db/private/msg-service/size_opt/msg_size 300 -s msg-service::vconf -g 5000 # SIM message count -vconftool set -t int db/private/msg-service/sim_count/used_cnt 0 -u $vcuid -vconftool set -t int db/private/msg-service/sim_count/total_cnt 0 -u $vcuid +vconftool set -t int db/private/msg-service/sim_count/used_cnt/1 0 -f -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/sim_count/total_cnt/1 0 -f -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/sim_count/used_cnt/2 0 -f -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/sim_count/total_cnt/2 0 -f -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/sim_count/used_cnt/3 0 -f -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/sim_count/total_cnt/3 0 -f -s msg-service::vconf -g 5000 # SIM information -vconftool set -t int memory/private/msg-service/sim_changed 0 -i -u $vcuid -vconftool set -t string memory/private/msg-service/sim_imsi "" -i -u $vcuid -vconftool set -t bool memory/private/msg-service/national_sim 0 -i -u $vcuid -vconftool set -t string memory/private/msg-service/msisdn "" -i -u $vcuid +vconftool set -t int memory/private/msg-service/sim_changed/1 0 -i -f -s msg-service::vconf -g 5000 +vconftool set -t string memory/private/msg-service/sim_imsi/1 "" -i -f -s msg-service::vconf -g 5000 +vconftool set -t bool memory/private/msg-service/national_sim/1 0 -i -f -s msg-service::vconf -g 5000 +vconftool set -t string memory/private/msg-service/msisdn/1 "" -i -f -s msg-service::vconf -g 5000 +vconftool set -t string memory/private/msg-service/iccid/1 "" -i -f -s msg-service::vconf -g 5000 + +vconftool set -t int memory/private/msg-service/sim_changed/2 0 -i -f -s msg-service::vconf -g 5000 +vconftool set -t string memory/private/msg-service/sim_imsi/2 "" -i -f -s msg-service::vconf -g 5000 +vconftool set -t bool memory/private/msg-service/national_sim/2 0 -i -f -s msg-service::vconf -g 5000 +vconftool set -t string memory/private/msg-service/msisdn/2 "" -i -f -s msg-service::vconf -g 5000 +vconftool set -t string memory/private/msg-service/iccid/2 "" -i -f -s msg-service::vconf -g 5000 + +vconftool set -t int memory/private/msg-service/sim_changed/3 0 -i -f -s msg-service::vconf -g 5000 +vconftool set -t string memory/private/msg-service/sim_imsi/3 "" -i -f -s msg-service::vconf -g 5000 +vconftool set -t bool memory/private/msg-service/national_sim/3 0 -i -f -s msg-service::vconf -g 5000 +vconftool set -t string memory/private/msg-service/msisdn/3 "" -i -f -s msg-service::vconf -g 5000 +vconftool set -t string memory/private/msg-service/iccid/3 "" -i -f -s msg-service::vconf -g 5000 +vconftool set -t int memory/private/msg-service/default_network_sim 0 -i -f -s msg-service::vconf -g 5000 + +# SST information +vconftool set -t bool memory/private/msg-service/sim_st/1 1 -i -f -s msg-service::vconf -g 5000 +vconftool set -t bool memory/private/msg-service/sim_mo_ctrl/1 0 -i -f -s msg-service::vconf -g 5000 + +vconftool set -t bool memory/private/msg-service/sim_st/2 1 -i -f -s msg-service::vconf -g 5000 +vconftool set -t bool memory/private/msg-service/sim_mo_ctrl/2 0 -i -f -s msg-service::vconf -g 5000 + +vconftool set -t bool memory/private/msg-service/sim_st/3 1 -i -f -s msg-service::vconf -g 5000 +vconftool set -t bool memory/private/msg-service/sim_mo_ctrl/3 0 -i -f -s msg-service::vconf -g 5000 + +# Notification +vconftool set -t int db/private/msg-service/notification_priv_id 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/voice_noti_id1 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/voice_noti_id2 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/cb_noti_priv_id 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/sim_msg_noti_priv_id 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/emergency_noti_id 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/sentfail_noti_id 0 -s msg-service::vconf -g 5000 +vconftool set -t int db/private/msg-service/sim_full_noti_id 0 -s msg-service::vconf -g 5000 -vconftool set -t int db/private/msg-service/notification_priv_id 0 -u $vcuid -vconftool set -t int db/private/msg-service/voice_noti_id1 0 -u $vcuid -vconftool set -t int db/private/msg-service/cb_noti_priv_id 0 -u $vcuid - -/sbin/ldconfig -/bin/systemctl daemon-reload -if [ "$1" = "1" ]; then - systemctl stop msg-service.service -fi %postun -p /sbin/ldconfig @@ -511,166 +339,45 @@ fi %files %manifest msg-service.manifest %defattr(-,root,root,-) -%dir %attr(775,root,db_msg_service) /opt/usr/data/msg-service %{_libdir}/libmsg_plugin_manager.so %{_libdir}/libmsg_mapi.so.* %{_libdir}/libmsg_framework_handler.so %{_libdir}/libmsg_transaction_manager.so %{_libdir}/libmsg_utils.so +%{_libdir}/libmsg_externals.so %{_libdir}/libmsg_transaction_proxy.so %{_libdir}/libmsg_vobject.so -/usr/share/license/%{name} +/usr/share/license/msg-service/LICENSE.APLv2 %files devel %defattr(-,root,root,-) %{_libdir}/libmsg_mapi.so %{_libdir}/pkgconfig/msg-service.pc %{_includedir}/msg-service/* -/usr/share/license/%{name}-devel %files tools %manifest msg-service-tools.manifest %defattr(-,root,root,-) -%{_bindir}/msg-helper %{_bindir}/msg-server -%{_datadir}/media/Sherbet.wav +%config(noreplace) /opt/usr/dbspace/.msg_service.db* %attr(0644,root,root)/usr/share/msg-service/plugin.cfg -/usr/lib/systemd/system/msg-service.service -/usr/lib/systemd/system/multi-user.target.wants/msg-service.service -/usr/share/license/%{name}-tools -/opt/etc/smack/accesses.d/msg-service.rule -/etc/config/sysinfo-message.xml - -%attr(0755,app,app)/var/log/msgfw - +%{_sysconfdir}/rc.d/init.d/msg-server +%{_libdir}/systemd/system/msg-server.service +%{_libdir}/systemd/system/multi-user.target.wants/msg-server.service +/usr/share/license/msg-service/LICENSE.APLv2 +/etc/smack/accesses.d/msg-service.rule +/etc/config/* %files -n sms-plugin %manifest sms-plugin.manifest %defattr(-,root,root,-) %{_libdir}/libmsg_sms_plugin.so -/usr/share/license/sms-plugin +/usr/share/license/msg-service/LICENSE.APLv2 %files -n mms-plugin %manifest mms-plugin.manifest %defattr(-,root,root,-) %{_libdir}/libmsg_mms_plugin.so -/usr/share/license/mms-plugin +/usr/share/license/msg-service/LICENSE.APLv2 %changelog -* Wed Oct 25 2012 Sangkoo Kim -- New release version - -* Wed Aug 8 2012 KeeBum Kim -- Apply New TAPI. -- Modify transaction data size of sos recipient list. - -* Tue Aug 7 2012 KeeBum Kim -- Fix contact sync defect. -- New MessageFW API. - -* Fri Jul 27 2012 KeeBum Kim -- Change devman_haptic.h to devman_managed.h. -- Modify to set MSG_SERVER_READY before sim status check. -- Fix bug in sim message save related operations. -- Limit sim related APIs not to work on sim not available status. -- Modify indicator icon image path & related. - -* Tue Jul 17 2012 KeeBum Kim -- Modify MAX_SEGMENT_NUM to 15. -- Modify MMplayer related to support interrupted event. -- Fix bug in storage change callback which could cause on submit request. - -* Fri Jun 29 2012 Sangkoo Kim -- Modify vconf key path for sos sending option. - -* Mon Jun 18 2012 Seunghwan Lee -- Storage change callback for scheduled message -- code chage to support glib2-2.32 -- Apply Backup && Restore of Mms Type - -* Fri Jun 15 2012 Sangkoo Kim -- Update display time for scheduled message when it is sent. - -* Thu Jun 14 2012 Seunghwan Lee -- Comment the test app in CMakefile. -- Modify MMS BG color of vconf value. -- Bug fixed wrong query in MsgStoCheckReadReportIsSent -- Add '-i' option for vconf keys of memory type -- Add smsc vconf keys(default value). -- To avoid msg incoming sound and notification on SOS - -* Fri Jun 8 2012 Sangkoo Kim -- Add '-i' option for vconf keys of memory type. -- Add smsc vconf keys(default value). -- To avoid msg incoming sound and notification on SOS state. -- Change BGcolor to black && font colore to white. - -* Wed May 31 2012 Keebum Kim -- Apply Mdm policy. -- SOS message. -- Fix horizontality development problem. -- Remove vconf key for new message count. (db/badge/com.samsung.message) -- Change vconf key path of "mms_send/msg_class" to private. - -* Thu May 24 2012 Keebum Kim -- Add new MAPI. - -* Fri May 18 2012 Sangkoo Kim -- Modify to support new DRM service. -- Rename private vconf keys. -- Modify .postinst and .spec file to pre-install used vconf keys. -- Remove compile warnings. -- Fix bug in manual retrieve operation. - -* Fri May 11 2012 Jaeyun Jeong -- Fix DB conflict which cause db lock. -- Fix bug in Find My Mobile function. -- Add '*' and '#' symbol as valid number. - -* Wed May 9 2012 Keebum Kim -- Change mobile tracker related vconf key define values. -- Apply MDM policy for allowing text messaging. -- Fix bug for getting thumbnail path. -- Enable functionality of scheduled message. -- Change alarm setting of scheduled message from volatile type to non-volatile. -- Fix error in search query. - -* Thu May 3 2012 Keebum Kim -- Change some thread list related APIs to support DB change. -- DB change to support multiple recipient. - -* Thu Apr 19 2012 Keebum Kim -- Modify to manage contact sync time by vconf. -- Use g_idle_add() routine for updating unread message count(vconf values). -- apply try{}catch{} code for handling unexpected exception to avoid thread terminating. -- Fix bug for allocated size of replacing string. -- Resolve search problem for special characters. -- add xmlFree. - -* Tue Apr 10 2012 Keebum Kim -- Remove unused vconf keys. -- Initialize SMSC selected_index. -- Remove systemd related. - -* Thu Apr 05 2012 Jaeyun Jeong -- Add notification property(NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE) -- Fix S1-2397/2417/2418/2419. -- Remove sent status callback check during submit request. -- Modify offset and limit operation on search. -- Remove invalid folder and file. -- Change browser launching API from aul to service-capi. -- Remove unused file. -- Invalid type checking is fixed. - -* Fri Mar 16 2012 Jaeyun Jeong -- Add #include to support chmod related defines. -- Fix DRM content issue(unregistered mo content) - -* Wed Mar 14 2012 Jaeyun Jeong -- Modify plugin configuration file location for FOTA. -- Remove the db query which create sample data. - -* Wed Feb 29 2012 Jaeyun Jeong -- Update msg-service.spec for OBS. -- Fix TC execute failure. -- Fix S1-1419(Removed mms raw file issue after rebooting) diff --git a/plugin/mms_plugin/CMakeLists.txt b/plugin/mms_plugin/CMakeLists.txt index a0f874a..b0e1341 100755 --- a/plugin/mms_plugin/CMakeLists.txt +++ b/plugin/mms_plugin/CMakeLists.txt @@ -24,28 +24,28 @@ SET(MMS-PLUGIN-SRCS MmsPluginStorage.cpp MmsPluginMessage.cpp MmsPluginMIME.cpp - MmsPluginAvCodec.cpp MmsPluginConnManWrapper.cpp MmsPluginUserAgent.cpp MmsPluginHttp.cpp MmsPluginInternal.cpp - MmsPluginSmil.cpp - MmsPluginSMILValidate.cpp MmsPluginDrm.cpp MmsPluginUtil.cpp + MmsPluginTcs.cpp + MmsPluginComposer.cpp + MmsPluginAppBase.cpp ) INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/include/common ${CMAKE_SOURCE_DIR}/include/framework - #${CMAKE_SOURCE_DIR}/include/msg_helper ${CMAKE_SOURCE_DIR}/include/utils + ${CMAKE_SOURCE_DIR}/include/externals ${CMAKE_SOURCE_DIR}/include/mapi ${CMAKE_CURRENT_SOURCE_DIR}/include ) INCLUDE(FindPkgConfig) -pkg_check_modules(mms_plugin_pkgs REQUIRED glib-2.0 network libxml-2.0 drm-client libcurl mm-fileinfo mmutil-jpeg vconf dlog media-thumbnail capi-network-connection) +pkg_check_modules(mms_plugin_pkgs REQUIRED glib-2.0 libcurl mm-fileinfo mmutil-imgp mmutil-jpeg vconf dlog media-thumbnail csr-framework capi-network-connection db-util) FOREACH(flag ${mms_plugin_pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") @@ -56,13 +56,12 @@ SET(CMAKE_CXX_FLAGS_DEBUG "-O2 -g") ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") ADD_DEFINITIONS("-DFEATURE_JAVA_MMS") -ADD_DEFINITIONS("-D__SUPPORT_DRM__") SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined") ADD_LIBRARY(${MMS-PLUGIN-LIB} SHARED ${MMS-PLUGIN-SRCS}) -TARGET_LINK_LIBRARIES(${MMS-PLUGIN-LIB} ${mms_plugin_pkgs_LDFLAGS} ${UTILS-LIB}) +TARGET_LINK_LIBRARIES(${MMS-PLUGIN-LIB} ${mms_plugin_pkgs_LDFLAGS} ${UTILS-LIB} ${EXTERNALS-LIB}) -INSTALL(TARGETS ${MMS-PLUGIN-LIB} LIBRARY DESTINATION ${LIB_INSTALL_DIR}) +INSTALL(TARGETS ${MMS-PLUGIN-LIB} LIBRARY DESTINATION lib) diff --git a/plugin/mms_plugin/MmsPluginAppBase.cpp b/plugin/mms_plugin/MmsPluginAppBase.cpp new file mode 100755 index 0000000..14a02d0 --- /dev/null +++ b/plugin/mms_plugin/MmsPluginAppBase.cpp @@ -0,0 +1,251 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +#include "MsgMmsMessage.h" +#include "MmsPluginDebug.h" +#include "MmsPluginStorage.h" +#include "MmsPluginMessage.h" +#include "MmsPluginMIME.h" +#include "MmsPluginAppBase.h" +#include "MmsPluginUtil.h" +#include "MmsPluginTcs.h" +#include "MsgUtilFile.h" + +msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allow_malware, const char *raw_filepath); + +MmsPluginAppBase::MmsPluginAppBase(){} + +MmsPluginAppBase::MmsPluginAppBase(MMS_DATA_S *pMmsData) +{ + setMmsData(pMmsData); +} + +MmsPluginAppBase::MmsPluginAppBase(MmsMsg *pMmsMsg) +{ + setMmsData(pMmsMsg); +} + +MmsPluginAppBase::~MmsPluginAppBase() +{ + MsgMmsReleaseMmsLists(&mmsMsgData); +} + +void MmsPluginAppBase::setMmsData(MmsMsg *pMmsMsg) +{ + MmsConvertMsgData(pMmsMsg, &mmsMsgData); +} + +void MmsPluginAppBase::setMmsData(MMS_DATA_S *pMmsData) +{ + MsgMmsConvertMmsDataToMmsMessageData(pMmsData, &mmsMsgData); +} + +void MmsPluginAppBase::makePreviewInfo(msg_message_id_t msgId, bool allow_malware, const char *raw_filepath) +{ + MmsMakePreviewInfo(msgId, &mmsMsgData, allow_malware, raw_filepath); +} + +void MmsPluginAppBase::getFirstPageTextFilePath(char *textBuf, int textBufSize) +{ + + MMS_PAGE_S *pPage = NULL; + MMS_MEDIA_S *pMedia = NULL; + + MMS_MESSAGE_DATA_S *pMmsMsgData = &mmsMsgData; + + if (pMmsMsgData == NULL) + return; + + // Get the text data from the 1st slide. + if (pMmsMsgData->pageCnt > 0) { + + pPage = _MsgMmsGetPage(pMmsMsgData, 0); + + if (pPage) { + + for (int j = 0; j < pPage->mediaCnt; ++j) { + + pMedia = _MsgMmsGetMedia(pPage, j); + + if (pMedia->mediatype == MMS_SMIL_MEDIA_TEXT) { + + MimeType mimeType = MIME_UNKNOWN; + + MmsGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, pMedia->szFilePath, &mimeType, NULL); + + if (mimeType == MIME_TEXT_X_VCALENDAR || mimeType == MIME_TEXT_X_VCARD || mimeType == MIME_TEXT_X_VTODO || mimeType == MIME_TEXT_X_VNOTE) { + MSG_DEBUG("Media Type is Text, but Vobject file [%s]", pMedia->szFilePath); + } else { + MSG_DEBUG("Text path : [%s]", pMedia->szFilePath); + snprintf(textBuf, textBufSize, "%s", pMedia->szFilePath);//Set Text Filepath of First Pages + } + break; + } + } + } + } + + return; +} + + +//FIXME::need to move AppBase +msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allow_malware, const char *raw_filepath) +{ + MMS_PAGE_S *pPage = NULL; + MMS_MEDIA_S *pMedia = NULL; + int bc_level = -1; + + int ref_attach_count = 0; + const char * attachment_name = NULL; + + if (pMmsMsg == NULL) + return MSG_ERR_NULL_POINTER; + + MmsPluginStorage::instance()->removePreviewInfo(msgId); //remove exist previnfo + + //scan malware in raw file + if (raw_filepath && strlen(raw_filepath) > 0 && MsgAccessFile(raw_filepath, F_OK) == true) { + int tcs_ret = MmsPluginTcsScanFile(raw_filepath, &bc_level); + if (tcs_ret == 0) { + if (bc_level > -1) { + MSG_DEBUG("malware exist, level = %d", bc_level); + MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_MALWARE, "malware", bc_level); + } + } + } + + //check ref type and increase attach count + if (pMmsMsg->pageCnt > 0) { + for (int i = 0; i < pMmsMsg->pageCnt; i++) { + pPage = _MsgMmsGetPage(pMmsMsg, i); + if (pPage) { + for (int j = 0; j < pPage->mediaCnt; j++) { + pMedia = _MsgMmsGetMedia(pPage, j); + if (pMedia) { //IF Vobject type add to Attach in Preview data + + MimeType mimeType = MIME_UNKNOWN; + MmsGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, pMedia->szFilePath, &mimeType, NULL); + if (mimeType == MIME_TEXT_X_VCALENDAR || mimeType == MIME_TEXT_X_VCARD) { + + MSG_DEBUG("Unsupported File [%s] It will be add to attach list", pMedia->szFilePath); + + ref_attach_count++; + + if (attachment_name == NULL) { + attachment_name = pMedia->szFileName; + } + } + + } + } + } + } + } + + + if (pMmsMsg->pageCnt > 0) { + + MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_PAGE, (char *)"pagecount", pMmsMsg->pageCnt); + + pPage = _MsgMmsGetPage(pMmsMsg, 0); + + if (pPage) { + for (int j = 0; j < pPage->mediaCnt; j++) { + + pMedia = _MsgMmsGetMedia(pPage, j); + + if (pMedia == NULL) { + MSG_ERR("[%d]th pMedia is NULL", j); + continue; + } + + MSG_SEC_DEBUG("pMedia's Name: %s", pMedia->szFilePath); + + if (allow_malware == false && bc_level > -1) { + if (pMedia->mediatype == MMS_SMIL_MEDIA_AUDIO) { + MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_AUDIO, pMedia->szFileName); + } + } else { + + if (j == 0) { //First Page, First Media + MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_1ST_MEDIA, pMedia->szFilePath); + } + + if (pMedia->mediatype == MMS_SMIL_MEDIA_IMG || pMedia->mediatype == MMS_SMIL_MEDIA_VIDEO) { + char szFileName[MSG_FILENAME_LEN_MAX+1] = {0, }; + char thumbPath[MSG_FILEPATH_LEN_MAX+1] = {0, }; + char *pszExt = NULL; + + memset(szFileName, 0x00, MSG_FILENAME_LEN_MAX+1); + memset(thumbPath, 0x00, MSG_FILEPATH_LEN_MAX); + + MSG_DEBUG("drm type = %d, %s", pMedia->drmType, pMedia->szFilePath); + + if (pMedia->drmType == MSG_DRM_TYPE_NONE) { + + snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%d.mms",msgId); + + if ((pszExt = strrchr(pMedia->szFilePath, '.')) != NULL && !strcasecmp(pszExt, ".png")) { + snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, "%s%s.png", MSG_THUMBNAIL_PATH, szFileName); + } else { + snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, "%s%s.jpg", MSG_THUMBNAIL_PATH, szFileName); + } + + if (MmsMakeImageThumbnail(pMedia->szFilePath, thumbPath) == true) { + if (pMedia->mediatype == MMS_SMIL_MEDIA_IMG) { + MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_IMG, thumbPath); + } else { + MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_VIDEO, thumbPath); + } + } else { + MSG_DEBUG("Fail of generating thumbnail: %s to %s", pMedia->szFilePath, thumbPath); + } + } + } else if (pMedia->mediatype == MMS_SMIL_MEDIA_AUDIO) { + MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_AUDIO, pMedia->szFileName); + } + } + } + } // end for + } else { + MSG_DEBUG("There is no page"); + } + + int attachCnt = _MsgMmsGetAttachCount(pMmsMsg); + if (attachCnt > 0) { + + MMS_ATTACH_S *pAttach = _MsgMmsGetAttachment(pMmsMsg, 0); + + MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_ATTACH, pAttach->szFileName, attachCnt); + MmsPluginStorage::instance()->updateMmsAttachCount(msgId, attachCnt); // for Get Message + + if (attachment_name == NULL) { + attachment_name = pAttach->szFileName; + } + + } else { + MSG_DEBUG("There is no attachment"); + } + + if (attachCnt + ref_attach_count > 0 && attachment_name) { + + MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_ATTACH, attachment_name, attachCnt + ref_attach_count); + MmsPluginStorage::instance()->updateMmsAttachCount(msgId, attachCnt + ref_attach_count); + } + + return MSG_SUCCESS; +} diff --git a/plugin/mms_plugin/MmsPluginAvCodec.cpp b/plugin/mms_plugin/MmsPluginAvCodec.cpp deleted file mode 100755 index 4c3cb00..0000000 --- a/plugin/mms_plugin/MmsPluginAvCodec.cpp +++ /dev/null @@ -1,211 +0,0 @@ -/* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include "MmsPluginAvCodec.h" - -AvCodecType AvGetFileCodecType(const char *szFileName) -{ - char szFileExt[FILEEXT_MAX] = {0, }; - int iPos = 0; - int iStrLen = 0; - bool bMIME = false; - - iStrLen = strlen(szFileName); - - iPos = iStrLen; - - while (iPos > 0) { - iPos--; - - if (szFileName[iPos] == '.') - break; - if (szFileName[iPos] == '/') { - bMIME = true; - break; - } - } - - if (iPos == 0) { - return AV_CODEC_NONE; - } - - if (FILEEXT_MAX > (iStrLen - iPos - 1)) { - strncpy(szFileExt, szFileName + iPos + 1, (iStrLen - iPos - 1)); - szFileExt[iStrLen - iPos - 1] = '\0'; - } else - return AV_CODEC_NONE; - - if (strcasecmp(szFileExt, "mp3") == 0 || strcasecmp(szFileExt, "MP3") == 0) - return AV_DEC_AUDIO_MP3; - - if (strcasecmp(szFileExt, "pvx") == 0 || strcasecmp(szFileExt, "PVX") == 0) - return AV_DEC_VIDEO_PVX; - else if (strcasecmp(szFileExt, "wav") == 0 || strcasecmp(szFileExt, "WAV") == 0) { -#ifdef AV_DEBUG_MODE - if (!bMIME) { - if (__AvValidWAVE(szFileName) == true) - return AV_DEC_AUDIO_WAVE; - else - return AV_CODEC_NONE; - } else -#endif - return AV_DEC_AUDIO_WAVE; - } else if (strcasecmp(szFileExt, "aac") == 0 || strcasecmp(szFileExt, "AAC") == 0) - return AV_DEC_AUDIO_AAC; -#ifdef AV_DEBUG_MODE - else if (strcasecmp(szFileExt, "wma") == 0 || strcasecmp(szFileExt, "WMA") == 0) - return AvWMFFGetFileType(szFileName); - else if (strcasecmp(szFileExt, "wmv") == 0 || strcasecmp(szFileExt, "WMV") == 0) - return AvWMFFGetFileType(szFileName); - else if (strcasecmp(szFileExt, "asf") == 0 || strcasecmp(szFileExt, "ASF") == 0) - return AvWMFFGetFileType(szFileName); -#endif - else if (strcasecmp(szFileExt, "amr") == 0 || strcasecmp(szFileExt, "AMR") == 0 || - strcasecmp(szFileExt, "x-amr") == 0 || strcasecmp(szFileExt, "X-AMR") == 0) { -#ifdef AV_DEBUG_MODE - if (!bMIME) { - if (__AvValidAMR(szFileName) == true) - return AV_DEC_AUDIO_AMR; - else - return AV_CODEC_NONE; - } else -#endif - return AV_DEC_AUDIO_AMR; - } else if (strcasecmp(szFileExt, "g7231") == 0 || strcasecmp(szFileExt, "G7231") == 0) - return AV_DEC_AUDIO_G723_1; - else if ((strcasecmp(szFileExt, "mid") == 0 || strcasecmp(szFileExt, "MID") == 0) || - (strcasecmp(szFileExt, "midi") == 0 || strcasecmp(szFileExt, "MIDI") == 0)) { -#ifdef AV_DEBUG_MODE - if (!bMIME) { - if (__AvValidMIDI(szFileName) == true) - return AV_DEC_AUDIO_MIDI; - else - return AV_CODEC_NONE; - } else -#endif - return AV_DEC_AUDIO_MIDI; - } else if (strcasecmp(szFileExt, "mmf") == 0 || strcasecmp(szFileExt, "MMF") == 0 || strcasecmp(szFileExt, "x-mmf") == 0) { -#ifdef AV_DEBUG_MODE - if (!bMIME) { - if (__AvValidMMF(szFileName) == true) - return AV_DEC_AUDIO_MMF; - else - return AV_CODEC_NONE; - } else -#endif - return AV_DEC_AUDIO_MMF; - } else if (strcasecmp(szFileExt, "pmd") == 0 || strcasecmp(szFileExt, "PMD") == 0) { - return AV_DEC_AUDIO_MIDI; - } else if (strcasecmp(szFileExt, "xmf") == 0 || strcasecmp(szFileExt, "XMF") == 0 || - strcasecmp(szFileExt, "mxmf") == 0 || strcasecmp(szFileExt, "MXMF") == 0) { - return AV_DEC_AUDIO_XMF; - } else if (strcasecmp(szFileExt, "smp") == 0 || strcasecmp(szFileExt, "SMP") == 0) { -#ifdef AV_DEBUG_MODE - if (!bMIME) { - if (__AvValidSMP(szFileName) == true) - return AV_DEC_AUDIO_ADPCM; - else - return AV_CODEC_NONE; - } else -#endif - return AV_DEC_AUDIO_ADPCM; - } else if (strcasecmp(szFileExt, "spm") == 0 || strcasecmp(szFileExt, "SPM") == 0) { -#ifdef AV_DEBUG_MODE - if (!bMIME) { - if (__AvValidMIDI(szFileName) == true) - return AV_DEC_AUDIO_SPM; - else - return AV_CODEC_NONE; - } else -#endif - return AV_DEC_AUDIO_SPM; - } else if (strcasecmp(szFileExt, "spf") == 0 || strcasecmp(szFileExt, "SPF") == 0) { -#ifdef AV_DEBUG_MODE - if (!bMIME) { - if (__AvValidMMF(szFileName) == true) - return AV_DEC_AUDIO_MMF_PHRASE_L1; - else - return AV_CODEC_NONE; - } else -#endif - return AV_DEC_AUDIO_MMF_PHRASE_L1; - } else if (strcasecmp(szFileExt, "imy") == 0 || strcasecmp(szFileExt, "IMY") == 0 || - strcasecmp(szFileExt, "iMelody") == 0 || strcasecmp(szFileExt, "x-iMelody") == 0 || - strcasecmp(szFileExt, "Melody") == 0) { -#ifdef AV_DEBUG_MODE - if (!bMIME) { - if (__AvValidIMELODY(szFileName) == true) - return AV_DEC_AUDIO_IMELODY; - else - return AV_CODEC_NONE; - } else -#endif - return AV_DEC_AUDIO_IMELODY; - } else if (strcasecmp(szFileExt, "dtmf") == 0) - return AV_DEC_AUDIO_DTMF_TONE; - else if (strcasecmp(szFileExt, "h263") == 0 || strcasecmp(szFileExt, "H263") == 0) - return AV_DEC_VIDEO_H263; - else if (strcasecmp(szFileExt, "mp4") == 0 || strcasecmp(szFileExt, "MP4") == 0 || - strcasecmp(szFileExt, "mpeg4") == 0 || strcasecmp(szFileExt, "MPEG4") == 0 || - strcasecmp(szFileExt, "m4a") == 0 || strcasecmp(szFileExt, "M4A") == 0) { -#ifdef AV_DEBUG_MODE - if (!bMIME) { - AvCodecType avCodecType = AV_CODEC_NONE; - FmFileAttribute fileAttrib; - size_t strLen; - UINT32 dateTime = 0; - - if (!DrmGetFileAttributes(szFileName, &fileAttrib)) { - return AV_CODEC_NONE; - } else { - dateTime = TmDateTimeToSeconds(&fileAttrib.dt); - strLen = strlen(szFileName); - if ((strnicmp(lastAccessFileInfo.szFileName, szFileName, strLen) == 0) && - (lastAccessFileInfo.fileSize == fileAttrib.fileSize) && - (lastAccessFileInfo.dateTime == dateTime)) { - return lastAccessFileInfo.codecType; - } else { - avCodecType = AvMP4FFGetFileType(szFileName); - - if (strcasecmp(szFileExt, "3ga") == 0 || strcasecmp(szFileExt, "3GA") == 0 || - strcasecmp(szFileExt, "m4a") == 0 || strcasecmp(szFileExt, "M4A") == 0) { - if (avCodecType | AV_DEC_AUDIO_MPEG4) - avCodecType = AV_DEC_AUDIO_MPEG4; - } - - if (avCodecType != AV_CODEC_NONE) { - strncpy(lastAccessFileInfo.szFileName, szFileName, strLen); - lastAccessFileInfo.szFileName[strLen] = '\0'; - lastAccessFileInfo.fileSize = fileAttrib.fileSize; - lastAccessFileInfo.dateTime = dateTime; - lastAccessFileInfo.codecType = avCodecType; - } - return avCodecType; - } - } - } -#endif - return AV_DEC_VIDEO_MPEG4; - } else if (strcasecmp(szFileExt, "3gp") == 0 || strcasecmp(szFileExt, "3GP") == 0 || - strcasecmp(szFileExt, "3ga") == 0 || strcasecmp(szFileExt, "3GA") == 0 || - strcasecmp(szFileExt, "3gpp") == 0 || strcasecmp(szFileExt, "3GPP") == 0) { - return AV_CODEC_NONE; - } else if (strcasecmp(szFileExt, "sdp") == 0 || strcasecmp(szFileExt, "SDP") == 0) - return AV_DEC_VIDEO_MPEG4; - else - return AV_CODEC_NONE; -} diff --git a/plugin/mms_plugin/MmsPluginCodecCommon.cpp b/plugin/mms_plugin/MmsPluginCodecCommon.cpp index a6538f0..a307588 100755 --- a/plugin/mms_plugin/MmsPluginCodecCommon.cpp +++ b/plugin/mms_plugin/MmsPluginCodecCommon.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include @@ -21,6 +21,9 @@ #include "MmsPluginUtil.h" #include "MmsPluginTextConvert.h" +#include +using namespace std; + #define MMS_MAX_FIELD_VALUE_COUNT 74 #define MMS_MAX_FIELD_TYPE_COUNT 21 @@ -155,35 +158,6 @@ const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] = {"Error-transient-message-not-found", 0x42}, {"Error-transient-network-problem", 0x43}, - {"Error-transient-failure", 0x44}, //reserved for future - {"Error-transient-failure", 0x45}, - {"Error-transient-failure", 0x46}, - {"Error-transient-failure", 0x47}, - {"Error-transient-failure", 0x48}, - {"Error-transient-failure", 0x49}, - {"Error-transient-failure", 0x4A}, - {"Error-transient-failure", 0x4B}, - {"Error-transient-failure", 0x4C}, - {"Error-transient-failure", 0x4D}, - {"Error-transient-failure", 0x4E}, - {"Error-transient-failure", 0x4F}, - {"Error-transient-failure", 0x50}, - {"Error-transient-failure", 0x51}, - {"Error-transient-failure", 0x52}, - {"Error-transient-failure", 0x53}, - {"Error-transient-failure", 0x54}, - {"Error-transient-failure", 0x55}, - {"Error-transient-failure", 0x56}, - {"Error-transient-failure", 0x57}, - {"Error-transient-failure", 0x58}, - {"Error-transient-failure", 0x59}, - {"Error-transient-failure", 0x5A}, - {"Error-transient-failure", 0x5B}, - {"Error-transient-failure", 0x5C}, - {"Error-transient-failure", 0x5D}, - {"Error-transient-failure", 0x5E}, - {"Error-transient-failure", 0x5F}, - {"Error-permanent-failure", 0x60}, {"Error-permanent-service-denied", 0x61}, {"Error-permanent-message-format-corrupt", 0x62}, @@ -194,31 +168,6 @@ const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] = {"Error-permanent-reply-charging-request-not-accepted", 0x67}, {"Error-permanent-reply-charging-forwarding-denied", 0x68}, {"Error-permanent-reply-charging-not-supported", 0x69}, - - {"Error-permanent-failure", 0x6A}, //reserved for future - {"Error-permanent-failure", 0x6B}, - {"Error-permanent-failure", 0x6C}, - {"Error-permanent-failure", 0x6D}, - {"Error-permanent-failure", 0x6E}, - {"Error-permanent-failure", 0x6F}, - {"Error-permanent-failure", 0x70}, - {"Error-permanent-failure", 0x71}, - {"Error-permanent-failure", 0x72}, - {"Error-permanent-failure", 0x73}, - {"Error-permanent-failure", 0x74}, - {"Error-permanent-failure", 0x75}, - {"Error-permanent-failure", 0x76}, - {"Error-permanent-failure", 0x77}, - {"Error-permanent-failure", 0x78}, - {"Error-permanent-failure", 0x79}, - {"Error-permanent-failure", 0x7A}, - {"Error-permanent-failure", 0x7B}, - {"Error-permanent-failure", 0x7C}, - {"Error-permanent-failure", 0x7D}, - {"Error-permanent-failure", 0x7E}, - {"Error-permanent-failure", 0x7F} - - }, /* MmsCodeRetrieveStatus */ @@ -228,70 +177,10 @@ const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] = {"Error-transient-message-not-found", 0x41}, {"Error-transient-network-problem", 0x42}, - {"Error-transient-failure", 0x43}, //reserved for future - {"Error-transient-failure", 0x44}, - {"Error-transient-failure", 0x45}, - {"Error-transient-failure", 0x46}, - {"Error-transient-failure", 0x47}, - {"Error-transient-failure", 0x48}, - {"Error-transient-failure", 0x49}, - {"Error-transient-failure", 0x4A}, - {"Error-transient-failure", 0x4B}, - {"Error-transient-failure", 0x4C}, - {"Error-transient-failure", 0x4D}, - {"Error-transient-failure", 0x4E}, - {"Error-transient-failure", 0x4F}, - {"Error-transient-failure", 0x50}, - {"Error-transient-failure", 0x51}, - {"Error-transient-failure", 0x52}, - {"Error-transient-failure", 0x53}, - {"Error-transient-failure", 0x54}, - {"Error-transient-failure", 0x55}, - {"Error-transient-failure", 0x56}, - {"Error-transient-failure", 0x57}, - {"Error-transient-failure", 0x58}, - {"Error-transient-failure", 0x59}, - {"Error-transient-failure", 0x5A}, - {"Error-transient-failure", 0x5B}, - {"Error-transient-failure", 0x5C}, - {"Error-transient-failure", 0x5D}, - {"Error-transient-failure", 0x5E}, - {"Error-transient-failure", 0x5F}, - {"Error-permanent-failure", 0x60}, {"Error-permanent-service-denied", 0x61}, {"Error-permanent-message-not-found", 0x62}, {"Error-permanent-content-unsupported", 0x63}, - - {"Error-permanent-failure", 0x64}, //reserved for future - {"Error-permanent-failure", 0x65}, - {"Error-permanent-failure", 0x66}, - {"Error-permanent-failure", 0x67}, - {"Error-permanent-failure", 0x68}, - {"Error-permanent-failure", 0x69}, - {"Error-permanent-failure", 0x6A}, - {"Error-permanent-failure", 0x6B}, - {"Error-permanent-failure", 0x6C}, - {"Error-permanent-failure", 0x6D}, - {"Error-permanent-failure", 0x6E}, - {"Error-permanent-failure", 0x6F}, - {"Error-permanent-failure", 0x70}, - {"Error-permanent-failure", 0x71}, - {"Error-permanent-failure", 0x72}, - {"Error-permanent-failure", 0x73}, - {"Error-permanent-failure", 0x74}, - {"Error-permanent-failure", 0x75}, - {"Error-permanent-failure", 0x76}, - {"Error-permanent-failure", 0x77}, - {"Error-permanent-failure", 0x78}, - {"Error-permanent-failure", 0x79}, - {"Error-permanent-failure", 0x7A}, - {"Error-permanent-failure", 0x7B}, - {"Error-permanent-failure", 0x7C}, - {"Error-permanent-failure", 0x7D}, - {"Error-permanent-failure", 0x7E}, - {"Error-permanent-failure", 0x7F} - }, /* MmsCodeReadReply */ @@ -341,39 +230,31 @@ const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] = /* MmsCodeCharSet */ { - {"us-ascii", 0x03}, + {"US-ASCII", 0x03}, {"UTF-16", 0x03F7}, - {"ISO-10646-UCS-2", 0x03E8}, + {"CSUNICODE", 0x03E8}, {"UTF-8", 0x6A}, - {"ISO-2022-KR", 0x25}, {"KS_C_5601-1987", 0x24}, {"EUC-KR", 0x26}, {"ISO-2022-JP", 0x27}, {"ISO-2022-JP-2", 0x28}, - {"ISO_8859-1", 0x04}, {"ISO_8859-2", 0x05}, {"ISO-8859-3", 0x06}, {"ISO-8859-4", 0x07}, {"ISO-8859-5", 0x08}, {"ISO-8859-6", 0x09}, - {"ISO-8859-6-E", 0x51}, - {"ISO-8859-6-I", 0x52}, {"ISO-8859-7", 0x0a}, {"ISO-8859-8", 0x0b}, - {"ISO-8859-8-I", 0x85}, {"ISO-8859-9", 0x0c}, {"ISO-8859-10", 0x0d}, {"ISO-8859-15", 0x6F}, - - {"Shift_JIS", 0x11}, + {"SHIFT_JIS", 0x11}, {"EUC-JP", 0x13}, {"GB2312", 0x07E9}, {"BIG5", 0x0d}, - {"WIN1251", 0xFF}, - {"WINDOW-1251", 0xFF}, - {"WINDOWS-1251", 0xFF}, + {"WINDOWS-1251", 0x08CB}, {"KOI8-R", 0x0824}, {"KOI8-U", 0x0828}, }, @@ -387,100 +268,10 @@ const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] = }, - /* MSG Specific (MsgMIMEExtern.h) -----------------------*/ - - /* Content-Type (http://www.wapforum.org/wina/wsp-content-type.htm) */ - /* this group(Content-Type) will be replaced by utyMime */ +// OMNA WSP Content Type Numbers +// http://technical.openmobilealliance.org/tech/omna/omna-wsp-content-type.aspx { - // {"Text/txt", 0x01}, - {"Text/html", 0x02}, - {"Text/plain", 0x03}, - {"Text/vnd.wap.wml", 0x08}, - {"Text/x-vCalendar", 0x06}, - {"Text/x-vCard", 0x07}, - - {"Application/vnd.wap.multipart.*", 0x22}, - {"Application/vnd.wap.multipart.mixed", 0x23}, - {"Application/vnd.wap.multipart.related", 0x33}, - {"Application/vnd.wap.multipart.alternative", 0x26}, - - {"application/vnd.oma.drm.message", 0x48}, // 10 - {"application/vnd.oma.drm.content", 0x49}, - {"application/vnd.oma.drm.rights+xml", 0x4A}, - {"application/vnd.oma.drm.rights+wbxml", 0x4B}, - - {"application/smil", 0xFFFF}, - {"Multipart/mixed", 0x0c}, - {"Multipart/related", 0x0B}, - {"Multipart/alternative", 0x0F}, - - {"multipart/report", 0xffff}, - {"Message/rfc822", 0xffff}, - - // T E X T - {"Image/gif", 0x1D}, // 20 - {"Image/jpeg", 0x1E}, - {"Image/jpg", 0xFFFF}, - {"image/tiff", 0x1f}, - {"Image/png", 0x20}, - - - {"Image/vnd.wap.wbmp", 0x21}, - - {"Image/wbmp", 0xFFFF}, - {"Image/pjpeg", 0xFFFF}, - - {"Image/bmp", 0xFFFF}, - - // A U D I O - {"Audio/basic", 0xFFFF}, - {"Audio/mpeg", 0xFFFF}, // 30 - {"Audio/x-mpeg", 0xFFFF}, - {"Audio/mp3", 0xFFFF}, - {"audio/x-mp3", 0xFFFF}, - {"audio/mpeg3", 0xFFFF}, - {"audio/x-mpeg3", 0xFFFF}, - {"audio/mpg", 0xFFFF}, - {"audio/x-mpg", 0xFFFF}, - {"audio/x-mpegaudio", 0xFFFF}, - {"Audio/aac", 0xFFFF}, // 39 - {"Audio/g72", 0xFFFF}, - {"Audio/amr", 0xFFFF}, - {"audio/x-amr", 0xFFFF}, - {"audio/x-mmf", 0xFFFF}, - {"application/vnd.smaf", 0xffff}, - {"application/x-smaf", 0xFFFF}, - {"audio/mmf", 0xFFFF}, - - {"text/x-iMelody", 0xffff}, - {"audio/x-iMelody", 0xffff}, - {"audio/iMelody", 0xffff}, // 49 - {"audio/mid",0xffff}, - {"audio/midi", 0xffff}, - {"audio/x-midi", 0xffff}, - {"audio/sp-midi", 0xffff}, - {"audio/wave", 0xffff}, - {"audio/3gpp", 0xffff}, - {"audio/vnd.rn-realaudio", 0xffff}, - {"audio/x-pn-realaudio", 0xffff}, - {"audio/mp4", 0xffff}, - - // V I D E O - {"video/mpeg4", 0xFFFF}, - {"video/mp4", 0xffff}, - {"video/x-mp4", 0xFFFF}, - {"video/x-vp-mp4", 0xffff}, - {"Video/h263", 0xFFFF}, - - {"video/3gpp", 0xffff}, - {"video/3gp", 0xffff}, - {"Video/avi", 0xFFFF}, - - {"video/sdp", 0xffff}, // 70 - {"application/vnd.rn-realmedia", 0xffff}, - {"video/vnd.rn-realvideo", 0xffff}, - - {"application/octet-stream", 0xFFFF } + //NOT USED THIS TABLE }, /* MmsCodeMsgDisposition : Wsp Header (By Wsp 8.4.2.53) */ @@ -573,25 +364,18 @@ UINT16 MmsGetBinaryValue(MmsCode i, int j) return gMmsField[i][j].binary; } -// getting mime type (int) by binary type int MmsGetBinaryType(MmsCode i, UINT16 value) { - MSG_BEGIN(); - - if (i == MmsCodeContentType) { - //apply UtyMime - return MimeGetMimeIntFromBi(value); - } for (int j = 0; j < MMS_MAX_FIELD_VALUE_COUNT; j++) { if (gMmsField[i][j].binary == value) { + MSG_DEBUG("code [%d], value [0x%02x], ret type [%d]", i, value, j); return j; } } - MSG_END(); - - return MIME_UNKNOWN; + MSG_DEBUG("code [%d], value [0x%02x], ret type [Unknown]", i, value); + return -1; } int MmsGetTextType(MmsCode i, char *pValue) @@ -884,246 +668,258 @@ bool MsgEncode2Base64(void *pSrc, unsigned long srcLen, unsigned long *len, unsi return true; } - -char *MsgDecodeText(char *pOri) +int extract_encoded_word_param(char *encoded_word, char **charset, char **encoding, char **encoded_text, unsigned int *encoded_word_size) { - MSG_BEGIN(); + char *start_ptr = NULL; + char *end_ptr = NULL; + char *q1_ptr = NULL; + char *q2_ptr = NULL; - int size = 0; - int cnt = 0; - char *pSrc = NULL; - char *pTemp = NULL; - char *pRe = NULL; - char *pStrEnd = NULL; - char *pDecStart = NULL; - char *pDecEnd = NULL; - char *pDecQ = NULL; - char *pDecQ2 = NULL; - bool bEncoding = false; - int nCharset = MSG_CHARSET_UTF8; - int nTemp = 0; - char *pReturnStr = NULL; - - char szTempBuf[MSG_LOCAL_TEMP_BUF_SIZE] = {0}; + char *char_set = NULL; + char *l_encoded_text = NULL; - // copy original string - if (strlen(pOri) >= MSG_LOCAL_TEMP_BUF_SIZE) { - pSrc = MsgStrCopy( pOri ); - } else { - memset(szTempBuf, 0, MSG_LOCAL_TEMP_BUF_SIZE); - strcpy(szTempBuf, pOri); + char l_encoding[2] = {0,}; - pSrc = szTempBuf; + if (encoded_word == NULL) + goto __CATCH; + + if ( 6 > strlen(encoded_word)) { + goto __CATCH; } - // it can be one or more encoding methods in a line - while (1) { - cnt++; + start_ptr = encoded_word; - bEncoding = false; + if ( (encoded_word[0] == '=' && encoded_word[1] == '?') //"=?" + && ((q1_ptr = strchr(start_ptr + 2, MSG_CH_QUESTION)) != NULL) // '?' + && ((q2_ptr = strchr(q1_ptr + 1, MSG_CH_QUESTION))!= NULL) // '?' + && ((end_ptr = strstr(q2_ptr + 1, MSG_STR_DEC_END))!= NULL)) //"?=" + { + + //extract character set + if ( q1_ptr - (start_ptr + 2) > 0 ) { + + char_set = (char*)calloc(1, q1_ptr - (start_ptr + 2) + 1); - /* - (ex) "=?euc-kr?B?Y2NqMjEyMw==?=" + strncpy(char_set, (char*)((start_ptr + 2)), q1_ptr - (start_ptr + 2)); - pDecStart: charset (=?euc-kr?B?Y2NqMjEyMw==?=) - pDecQ : Encoding type (B?Y2NqMjEyMw==?=) - pDecQ2 : Encoded text (Y2NqMjEyMw==?=) - pDecEnd : Encoded of text (?=) - */ - if (pSrc == NULL) + MSG_DEBUG("character set [%s][%d]", char_set, strlen(char_set)); + + + } else { + MSG_DEBUG("character set is NULL"); goto __CATCH; + } + + //extract encode type + if ((*(q2_ptr - 1) == MSG_CH_BASE64_UPPER) || (*(q2_ptr - 1) == MSG_CH_BASE64_LOWER) + || (*(q1_ptr + 1) == MSG_CH_BASE64_UPPER) || (*(q1_ptr + 1) == MSG_CH_BASE64_LOWER)) + { + l_encoding[0] = MSG_CH_BASE64_UPPER; + } else if ((*(q2_ptr-1) == MSG_CH_QPRINT_UPPER) || (*(q2_ptr-1) == MSG_CH_QPRINT_LOWER) + || (*(q1_ptr+1) == MSG_CH_QPRINT_UPPER) || (*(q1_ptr+1) == MSG_CH_QPRINT_LOWER)) + { + //QPRINT + l_encoding[0] = MSG_CH_QPRINT_UPPER; - if (((pDecStart = strstr(pSrc, MSG_STR_DEC_START)) != NULL) //"=?" - && ((pDecQ = strchr(pDecStart + 2, MSG_CH_QUESTION)) != NULL) // '?' - && ((pDecQ2 = strchr(pDecQ + 1, MSG_CH_QUESTION))!= NULL) // '?' - && ((pDecEnd = strstr(pDecQ2 + 1, MSG_STR_DEC_END))!= NULL)) { //"=?" - bEncoding = true; - - /* fixme: charset problem - * pDecStart ~ pDecQ : charSet & MSG_CHARSET_USC2 ~ MSG_CHARSET_UTF8 & LATIN - */ - - *pDecQ = '\0'; - nCharset = _MsgGetCode(MSG_CHARSET, pDecStart + 2); - if(nCharset < 0) - goto __CATCH; - *pDecQ = MSG_CH_QUESTION; + } else { + MSG_DEBUG("unknown encoding"); + goto __CATCH; } - // End of encoding - if (!bEncoding) - goto __RETURN; + //extract encoded text + if (end_ptr - q2_ptr > 1) { + l_encoded_text = (char*)calloc(1, end_ptr - q2_ptr); - // find end of string - pStrEnd = pSrc + strlen(pSrc); + strncpy(l_encoded_text, (char*)(q2_ptr + 1), end_ptr - q2_ptr -1); - // Decoding - if ((*(pDecQ2 - 1) == MSG_CH_BASE64_UPPER) || - (*(pDecQ2 - 1) == MSG_CH_BASE64_LOWER) || - (*(pDecQ + 1) == MSG_CH_BASE64_UPPER) || - (*(pDecQ + 1) == MSG_CH_BASE64_LOWER)) { - pTemp = (char *)MsgDecodeBase64((UCHAR *)(pDecQ2 + 1), (ULONG)(pDecEnd - pDecQ2 - 1), (ULONG *)&size); + MSG_DEBUG("encoded text [%s][%d]", l_encoded_text, strlen(l_encoded_text)); + } else { + MSG_DEBUG("encoded text is NULL"); + goto __CATCH; + } - if (pTemp != NULL) { - pTemp[size] = MSG_CH_NULL; + *charset = char_set; + *encoding = g_strdup(l_encoding); + *encoded_text = l_encoded_text; + *encoded_word_size = end_ptr - start_ptr + 2; - if(pRe) { - free(pRe); - pRe = NULL; - } + } else { + MSG_DEBUG("It is not encoded word type"); + return -1; + } - pRe = (char *)malloc((pDecStart-pSrc) + size + (pStrEnd - (pDecEnd + 2)) + 1); - if (pRe == NULL) { - MSG_DEBUG("_MsgDecodeText: pRemalloc fail \n"); - free(pTemp); - pTemp = NULL; + return 0; - goto __RETURN; - } +__CATCH: + MSG_FREE(char_set); + MSG_FREE(l_encoded_text); + return -1; +} - memcpy(pRe, pSrc, pDecStart - pSrc); - memcpy(&pRe[pDecStart-pSrc], pTemp, size); - memcpy(&pRe[(pDecStart - pSrc) + size], pDecEnd + 2, pStrEnd - (pDecEnd + 2)); - pRe[(pDecStart - pSrc) + size + (pStrEnd - (pDecEnd + 2))] = MSG_CH_NULL; +char *MsgDecodeText(const char *pOri) +{ + MSG_BEGIN(); - free(pTemp); - pTemp = NULL; + char *pSrc = NULL; - if (pSrc != NULL && pSrc != szTempBuf) { - free(pSrc); - pSrc = NULL; + char *encoded_word_start_ptr = NULL; + char *normal_word_start_ptr = NULL; + + char *charset = NULL; + char *encoding = NULL; + char *encoded_text = NULL; + char *decoded_text = NULL; + + char *return_string= NULL; + string result_string; + + bool b_encoded_word = false; + + unsigned int encoded_word_size = 0; + unsigned int total_len = 0; + unsigned int decoded_len = 0; + + // copy original string + if (pOri == NULL || strlen(pOri) <= 0) { + MSG_DEBUG("Invalid parameter : [%s]", pOri); + return NULL; + } + + pSrc = g_strdup(pOri); + total_len = strlen(pOri); + + MSG_DEBUG("input text : [%s][%d]", pSrc, total_len); + + normal_word_start_ptr = pSrc; + + while (normal_word_start_ptr < pSrc + total_len) { + + encoded_word_start_ptr = strstr(normal_word_start_ptr, MSG_STR_DEC_START); + + b_encoded_word = false; + + //Find encoded word + while (b_encoded_word == false && encoded_word_start_ptr != NULL ) { + + if (extract_encoded_word_param(encoded_word_start_ptr, &charset, &encoding, &encoded_text, &encoded_word_size) == 0) { + + if (charset && encoding && encoded_text && encoded_word_size > 0) { + b_encoded_word = true; + MSG_DEBUG("charset [%s], encoding [%s], encoded_text [%s], encoded_word_size [%d]", charset, encoding, encoded_text, encoded_word_size); + break; } + + MSG_FREE(charset); + MSG_FREE(encoding); + MSG_FREE(encoded_text); + encoded_word_size = 0; } - } else if ((*(pDecQ2-1) == MSG_CH_QPRINT_UPPER) || - (*(pDecQ2-1) == MSG_CH_QPRINT_LOWER) || - (*(pDecQ+1) == MSG_CH_QPRINT_UPPER) || - (*(pDecQ+1) == MSG_CH_QPRINT_LOWER)) { - pTemp = (char *)MsgDecodeQuotePrintable((UCHAR *)( pDecQ2 + 1 ), (ULONG)(pDecEnd - pDecQ2 - 1), (ULONG *)&size); + encoded_word_start_ptr = strstr(encoded_word_start_ptr+1, MSG_STR_DEC_START); //find next encoded_start_ptr - if (pTemp != NULL) { - int i; - pTemp[size] = MSG_CH_NULL; + } // end of while - for (i = 0; i < size; i++) { - if (pTemp[i] == MSG_CH_UNDERLINE) { - pTemp[i] = MSG_CH_SP; // change '_' to ' ' - } - } + if (b_encoded_word) { - if(pRe) { - free(pRe); - pRe = NULL; - } + //copy normal text + if (encoded_word_start_ptr - normal_word_start_ptr > 0) { + result_string.append(normal_word_start_ptr, encoded_word_start_ptr - normal_word_start_ptr); + MSG_DEBUG("copy normal text : [%s]", result_string.c_str()); + } - pRe = (char *)malloc((pDecStart - pSrc) + size + (pStrEnd - (pDecEnd + 2)) + 1); - if (pRe == NULL) { - MSG_DEBUG("_MsgDecodeText: pRemalloc fail \n"); - free(pTemp); - pTemp = NULL; + if (strcasecmp(encoding, "B") == 0) { - goto __RETURN; - } + MSG_DEBUG("Base64 encoded text [%s][%d]", encoded_text, strlen(encoded_text)); - memcpy(pRe, pSrc, pDecStart - pSrc); - memcpy(&pRe[pDecStart - pSrc], pTemp, size); - memcpy(&pRe[(pDecStart - pSrc) + size], pDecEnd + 2, pStrEnd - (pDecEnd + 2)); - pRe[(pDecStart - pSrc) + size + (pStrEnd - (pDecEnd + 2))] = MSG_CH_NULL; + decoded_text = (char *)MsgDecodeBase64((unsigned char *)encoded_text, strlen(encoded_text), (ULONG *)&decoded_len); - if (pTemp) { - free(pTemp); - pTemp = NULL; - } + if (decoded_text && decoded_len > 0) { + + char *result_text = NULL; + int result_text_len = 0; + + MSG_DEBUG("Base64 decoded text [%s][%d], outlen [%d]", decoded_text, strlen(decoded_text), decoded_len); + + if (MmsPluginTextConvert("UTF-8", charset, decoded_text, decoded_len, &result_text, &result_text_len) == false) { + MSG_DEBUG("MmsPluginTextConvert Fail"); + } + + if(result_text) { + MSG_DEBUG("Text convert result [%s][%d]", result_text, strlen(result_text)); + + result_string.append(result_text, result_text_len); - if (pSrc != NULL && pSrc != szTempBuf) { - free(pSrc); - pSrc = NULL; + MSG_FREE(result_text); + } + + } else { + MSG_DEBUG("Fail base64 decode"); } - } - } else { - goto __RETURN; - } - } + MSG_FREE(decoded_text); + } else if (strcasecmp(encoding, "Q") == 0) { -__RETURN: + char *result_text = NULL; + int result_text_len = 0; - pTemp = strdup(pSrc); - nTemp = strlen(pSrc); + MSG_DEBUG("Qprint encoded text [%s][%d]", encoded_text, strlen(encoded_text)); - {//temp brace; - const char *pToCharSet = "UTF-8"; + decoded_text = (char *)MsgDecodeQuotePrintable((unsigned char *)encoded_text, strlen(encoded_text), (ULONG *)&decoded_len); - UINT16 charset_code = MmsGetBinaryValue(MmsCodeCharSet, nCharset); + if (decoded_text && decoded_len > 0) { - const char *pFromCharSet = MmsPluginTextConvertGetCharSet(charset_code); + MSG_DEBUG("Qprint decoded text [%s][%d], outlen [%d]", decoded_text, strlen(decoded_text), decoded_len); - if (pFromCharSet != NULL && strcmp(pFromCharSet, pToCharSet) != 0) {//Not UTF-8 - char *pDest = NULL; - int destLen = 0; + if (MmsPluginTextConvert("UTF-8", charset, decoded_text, decoded_len, &result_text, &result_text_len) == false) { + MSG_DEBUG("MmsPluginTextConvert Fail"); + } - if (MmsPluginTextConvert(pToCharSet, pFromCharSet, pTemp, nTemp, &pDest, &destLen) == false) { - MSG_DEBUG("MmsPluginTextConvert Fail"); - } + if(result_text) { + MSG_DEBUG("Text convert result [%s][%d]", result_text, strlen(result_text)); - if (pDest) { - free(pTemp); - pTemp = strdup(pDest); - nTemp = destLen; - free(pDest); - } - } + result_string.append(result_text, result_text_len); - } + MSG_FREE(result_text); + } - pReturnStr = (char *)malloc(nTemp + 1); + } else { + MSG_DEBUG("Fail Qprint decode"); + } - if (pReturnStr == NULL) { - goto __CATCH; - } + MSG_FREE(decoded_text); + } - memset(pReturnStr, 0, nTemp + 1); + normal_word_start_ptr = encoded_word_start_ptr+encoded_word_size; //next - if (pTemp) { - memcpy(pReturnStr, pTemp, nTemp); - free(pTemp); - pTemp = NULL; - } + MSG_FREE(charset); + MSG_FREE(encoding); + MSG_FREE(encoded_text); + encoded_word_size = 0; - if(pRe) { - free(pRe); - pRe = NULL; - } + } else { + //copy remain normal text - if (pSrc != NULL && pSrc != szTempBuf) { - free(pSrc); - pSrc = NULL; - } + MSG_DEBUG("last text : [%s]", normal_word_start_ptr); - return pReturnStr; + result_string.append(normal_word_start_ptr); -__CATCH: + break; + } - if(pRe) { - free(pRe); - pRe = NULL; - } + } //end of while - if (pSrc != NULL && pSrc != szTempBuf) { - free(pSrc); - pSrc = NULL; + if (result_string.length() > 0) { + return_string = g_strdup(result_string.c_str()); + MSG_DEBUG("return string: [%s]", return_string); } - if (pTemp) { - free(pTemp); - pTemp = NULL; - } + MSG_FREE(pSrc); - return NULL; + MSG_END(); + return return_string; } - static char gszDebugStringBuf[50]; static char *MmsDebugPrintUnknownValue(int value) @@ -1360,6 +1156,8 @@ const char *MmsDebugGetMimeType(MimeType mimeType) return "MIME_TEXT_XML"; case MIME_TEXT_IMELODY: return "MIME_TEXT_IMELODY"; + case MIME_TEXT_CALENDAR: + return "MIME_TEXT_CALENDAR"; case MIME_TEXT_VND_WAP_WMLSCRIPT: return "MIME_TEXT_VND_WAP_WMLSCRIPT"; case MIME_TEXT_VND_WAP_WML: @@ -1384,6 +1182,9 @@ const char *MmsDebugGetMimeType(MimeType mimeType) return "MIME_TEXT_X_VCARD"; case MIME_TEXT_X_IMELODY: return "MIME_TEXT_X_IMELODY"; + case MIME_TEXT_X_VTODO: + return "MIME_TEXT_X_VTODO"; + case MIME_VIDEO_MPEG4: return "MIME_VIDEO_MPEG4"; @@ -1399,6 +1200,10 @@ const char *MmsDebugGetMimeType(MimeType mimeType) return "MIME_VIDEO_AVI"; case MIME_VIDEO_SDP: return "MIME_VIDEO_SDP"; + case MIME_VIDEO_MP4_ES: + return "MIME_VIDEO_MP4_ES"; + case MIME_VIDEO_MPEG: + return "MIME_VIDEO_MPEG"; case MIME_VIDEO_VND_RN_REALVIDEO: return "MIME_VIDEO_VND_RN_REALVIDEO"; case MIME_VIDEO_X_MP4: @@ -1457,6 +1262,8 @@ const char *MmsDebugGetMmsReadStatus(msg_read_report_status_t readStatus) return "MMS_IS_READ"; case MSG_READ_REPORT_IS_DELETED: return "MMS_IS_DELETED"; + default: + break; } return MmsDebugPrintUnknownValue(readStatus); @@ -1656,7 +1463,7 @@ const char *MmsDebugGetDataType(MmsDataType dataType) bool MmsInitMsgType(MsgType *pMsgType) { - MSG_DEBUG("MmsInitMsgType"); + MSG_DEBUG("ptr : [%p]", pMsgType); pMsgType->offset = 0; pMsgType->size = 0; pMsgType->contentSize = 0; @@ -1669,21 +1476,15 @@ bool MmsInitMsgType(MsgType *pMsgType) pMsgType->szContentID[0] = '\0'; pMsgType->szContentLocation[0] = '\0'; - pMsgType->szContentRepPos[0] = '\0'; - pMsgType->szContentRepSize[0] = '\0'; - pMsgType->szContentRepIndex[0] = '\0'; - MmsInitMsgContentParam(&pMsgType->param); -#ifdef __SUPPORT_DRM__ MmsInitMsgDRMInfo(&pMsgType->drmInfo); -#endif return true; } bool MmsInitMsgBody(MsgBody *pMsgBody) { - MSG_DEBUG("MmsInitMsgBody"); + MSG_DEBUG("ptr : [%p]", pMsgBody); pMsgBody->offset = 0; pMsgBody->size = 0; pMsgBody->body.pText = NULL; @@ -1698,7 +1499,7 @@ bool MmsInitMsgBody(MsgBody *pMsgBody) bool MmsInitMsgContentParam(MsgContentParam *pMsgContentParam) { - MSG_DEBUG("MmsInitMsgContentParam"); + MSG_DEBUG("ptr : [%p]", pMsgContentParam); pMsgContentParam->charset = MSG_CHARSET_UNKNOWN; pMsgContentParam->type = MIME_UNKNOWN; pMsgContentParam->szBoundary[0] = '\0'; @@ -1730,12 +1531,13 @@ bool MmsInitMsgAttrib(MmsAttrib *pAttrib) pAttrib->bHideAddress = false; pAttrib->date = 0; - pAttrib->bUseDeliveryCustomTime = false; + pAttrib->deliveryTime.type = MMS_TIMETYPE_RELATIVE; pAttrib->deliveryTime.time = 0; - pAttrib->bUseExpiryCustomTime = false; + pAttrib->expiryTime.type = MMS_TIMETYPE_RELATIVE; pAttrib->expiryTime.time = 0; + memset(&pAttrib->expiryTime, 0, sizeof(MmsTimeStruct)); pAttrib->msgClass = MMS_MSGCLASS_PERSONAL; pAttrib->msgStatus = MSG_DELIVERY_REPORT_NONE; @@ -1745,13 +1547,6 @@ bool MmsInitMsgAttrib(MmsAttrib *pAttrib) pAttrib->contentType = MIME_UNKNOWN; pAttrib->msgSize = 0; pAttrib->bLeaveCopy = true; - - pAttrib->specialMsgType = MMS_SPECIAL_MSG_TYPE_NONE; -#ifdef __SUPPORT_DRM__ - pAttrib->drmType = MSG_DRM_TYPE_NONE; - pAttrib->roWaitingTimerMax = 0; - pAttrib->pszDrmData = NULL; -#endif pAttrib->version = MMS_VERSION; memset(pAttrib->szFrom, 0, MSG_LOCALE_ADDR_LEN + 10); @@ -1772,9 +1567,10 @@ bool MmsInitMsgAttrib(MmsAttrib *pAttrib) return true; } -#ifdef __SUPPORT_DRM__ + bool MmsInitMsgDRMInfo(MsgDRMInfo *pMsgDrmInfo) { + MSG_DEBUG("ptr : [%p]", pMsgDrmInfo); pMsgDrmInfo->contentType = MIME_UNKNOWN; pMsgDrmInfo->drmType = MSG_DRM_TYPE_NONE; @@ -1836,7 +1632,6 @@ void MmsReleaseMsgDRMInfo(MsgDRMInfo *pDrmInfo) pDrmInfo->drmType = MSG_DRM_TYPE_NONE; } -#endif bool MmsReleaseMmsAttrib(MmsAttrib *pAttrib) { @@ -1917,15 +1712,14 @@ bool MmsReleaseMsgBody(MsgBody *pBody, int type) pMulti = pMulti->pNext; if (pCurrPart) { -#ifdef __SUPPORT_DRM__ MmsReleaseMsgDRMInfo(&pCurrPart->type.drmInfo); -#endif if (pCurrPart->pBody) { - if (pCurrPart->pBody->body.pBinary) { - free(pCurrPart->pBody->body.pBinary); - pCurrPart->pBody->body.pBinary = NULL; + if (pCurrPart->pBody->body.pText) { + free(pCurrPart->pBody->body.pText); + pCurrPart->pBody->body.pText = NULL; } + free(pCurrPart->pBody); pCurrPart->pBody = NULL; } @@ -1952,9 +1746,9 @@ bool MmsReleaseMsgBody(MsgBody *pBody, int type) default: /* Any single part */ - if (pBody->body.pBinary) { - free(pBody->body.pBinary); - pBody->body.pBinary = NULL; + if (pBody->body.pText) { + free(pBody->body.pText); + pBody->body.pText = NULL; } break; @@ -1972,3 +1766,143 @@ void MmsReleaseMmsMsg(MmsMsg *pMmsMsg) bzero(pMmsMsg, sizeof(MmsMsg)); } } + +bool MmsPrintMulitpart(MsgMultipart *pMultipart, int index) +{ + MSG_DEBUG("------------------------------"); + MSG_INFO("[%dth] multipart info", index); + MSG_INFO("header size [%d], body size [%d]", pMultipart->type.size, pMultipart->type.contentSize); + MSG_SEC_INFO("content type [%s]", MmsDebugGetMimeType((MimeType)pMultipart->type.type)); + MSG_SEC_INFO("content ID [%s]", pMultipart->type.szContentID); + MSG_SEC_INFO("content location [%s]", pMultipart->type.szContentLocation); + MSG_SEC_INFO("parameter Name [%s]", pMultipart->type.param.szName); + MSG_SEC_INFO("parameter Filename[%s]", pMultipart->type.param.szFileName); + + if (pMultipart->type.type == MIME_TEXT_PLAIN) { + MSG_SEC_INFO("text info : charset [%d], name [%s]", pMultipart->type.param.charset, pMultipart->type.param.szName); + } + + if (pMultipart->type.drmInfo.drmType != MSG_DRM_TYPE_NONE) { + MSG_INFO("drm info"); + MSG_INFO("drm type [%d] (0: NONE 1: Fowward Lock, 2:Combined Delivery, 3: Separated Delivery)", pMultipart->type.drmInfo.drmType); + MSG_SEC_INFO("drm content type [%s]", MmsDebugGetMimeType((MimeType)pMultipart->type.drmInfo.contentType)); + MSG_SEC_INFO("drm content URI [%s]", pMultipart->type.drmInfo.szContentURI); + MSG_INFO("drm2FullPath [%s]", pMultipart->type.drmInfo.szDrm2FullPath); + } + + MSG_DEBUG("------------------------------"); + return true; +} + +bool MmsIsTextType(int type) +{ + if (type == MIME_TEXT_PLAIN + || type == MIME_TEXT_HTML + || type == MIME_TEXT_VND_WAP_WML + || type == MIME_TEXT_X_VNOTE + || type == MIME_APPLICATION_SMIL + || type == MIME_TEXT_X_IMELODY) + { + return true; + } else { + return false; + } +} + +bool MmsIsMultipart(int type) +{ + if (type == MIME_MULTIPART_RELATED + || type == MIME_APPLICATION_VND_WAP_MULTIPART_MIXED + || type == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED + || type == MIME_APPLICATION_VND_WAP_MULTIPART_ASTERIC + || type == MIME_MULTIPART_MIXED + || type == MIME_MULTIPART_REPORT) { + return true; + } else { + return false; + } +} + +bool MmsIsVitemContent(int type, char *pszName) +{ + switch (type) { + case MIME_TEXT_X_VCARD: + case MIME_TEXT_X_VCALENDAR: + case MIME_TEXT_X_VNOTE: // vnt + case MIME_TEXT_X_VTODO: + case MIME_TEXT_PLAIN: // vbm - It SHOULD be distinguished from a normal text file. + { + char *pszExt = NULL; + + if (!pszName) + break; + + // search file extension. + if ((pszExt = strrchr(pszName, '.')) == NULL) + break; + + if (!strcasecmp(pszExt, ".vbm")) { + return true; + } + + if (!strcasecmp(pszExt, ".vcs")) { + return true; + } + + if (!strcasecmp(pszExt, ".vcf")) { + return true; + } + + if (!strcasecmp(pszExt, ".vnt")) { + return true; + } + + if (!strcasecmp(pszExt, ".vts")) { + return true; + } + + break; + } + default: + break; + } + + MSG_DEBUG("MmsIsVitemContent false."); + return false; +} + +MsgMultipart *MmsAllocMultipart(void) +{ + MsgMultipart *pMultipart = NULL; + + pMultipart = (MsgMultipart *)malloc(sizeof(MsgMultipart)); + + if (pMultipart == NULL) + goto __CATCH; + + pMultipart->pBody = (MsgBody *)malloc(sizeof(MsgBody)); + + if (pMultipart->pBody == NULL) + goto __CATCH; + + MmsInitMsgType(&pMultipart->type); + MmsInitMsgBody(pMultipart->pBody); + + pMultipart->pNext = NULL; + + return pMultipart; + +__CATCH: + + if (pMultipart) { + if (pMultipart->pBody) { + free(pMultipart->pBody); + pMultipart->pBody = NULL; + } + + free(pMultipart); + pMultipart = NULL; + } + + return NULL; +} diff --git a/plugin/mms_plugin/MmsPluginComposer.cpp b/plugin/mms_plugin/MmsPluginComposer.cpp new file mode 100755 index 0000000..f83e94b --- /dev/null +++ b/plugin/mms_plugin/MmsPluginComposer.cpp @@ -0,0 +1,223 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +#include +#include +#include +#include +#include +#include + +#include "MsgCppTypes.h" +#include "MsgStorageTypes.h" +#include "MsgSettingTypes.h" +#include "MsgUtilFile.h" +#include "MsgGconfWrapper.h" +#include "MsgMmsMessage.h" +#include "MmsPluginTypes.h" +#include "MmsPluginDebug.h" +#include "MmsPluginMessage.h" +#include "MmsPluginMIME.h" +#include "MmsPluginStorage.h" +#include "MmsPluginUtil.h" +#include "MmsPluginTcs.h" +#include "MsgSmil.h" + + +#include "MmsPluginComposer.h" +#include "MsgSerialize.h" + +bool composeSendReqHeader(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_DATA_S *pMsgData); + +MmsPluginComposer *MmsPluginComposer::pInstance = NULL; + +MmsPluginComposer *MmsPluginComposer::instance() +{ + if (!MmsPluginComposer::pInstance) + MmsPluginComposer::pInstance = new MmsPluginComposer(); + + return MmsPluginComposer::pInstance; +} + +MmsPluginComposer::MmsPluginComposer(){} +MmsPluginComposer::~MmsPluginComposer(){} + +void MmsPluginComposer::composeSendReq(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_DATA_S *pMmsData) +{ + + if (pMsgInfo->msgType.subType == MSG_SENDREQ_MMS) { + + if (pMmsData->header == NULL) {//send req from user + pMmsData->header = MsgMmsCreateHeader(); + } + + composeSendReqHeader(pMsgInfo, pSendOptInfo, pMmsData); + //TODO:: apply MmsReplaceNonAsciiUtf8 to all multipart FileName; + + int len = g_list_length(pMmsData->multipartlist); + + for (int i = 0; i < len; i++) { + + MMS_MULTIPART_DATA_S *multipart = (MMS_MULTIPART_DATA_S *)g_list_nth_data(pMmsData->multipartlist, i); + + if (multipart) { + if (multipart->type == MIME_UNKNOWN && strlen(multipart->szContentType) == 0) { + const char *content_type = NULL; + MmsGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, multipart->szFileName, &multipart->type, &content_type); + snprintf(multipart->szContentType, sizeof(multipart->szContentType), "%s", content_type); + } + } + } //end for + } +} + +MMSList *getAddressList(const MSG_MESSAGE_INFO_S *pMsgInfo, int recipientType) +{ + MSG_BEGIN(); + + MMSList * addressList = NULL; + + int nAddressCnt = 0; + + nAddressCnt = pMsgInfo->nAddressCnt; + + // Calculate allocated buffer size + for (int i = 0; i < nAddressCnt; ++i) { + + MSG_SEC_DEBUG("recipientType: %d, address value: %s", pMsgInfo->addressList[i].recipientType, pMsgInfo->addressList[i].addressVal); + + if (pMsgInfo->addressList[i].recipientType == MSG_RECIPIENTS_TYPE_UNKNOWN) + pMsgInfo->addressList[i].recipientType = MSG_RECIPIENTS_TYPE_TO; + + if (pMsgInfo->addressList[i].recipientType == recipientType) { + + MMS_ADDRESS_DATA_S * pAddressData = NULL; + if (pMsgInfo->addressList[i].addressType == MSG_ADDRESS_TYPE_PLMN) { + pAddressData = MsgMmsCreateAddress(MSG_ADDRESS_TYPE_PLMN, pMsgInfo->addressList[i].addressVal); + } else if (pMsgInfo->addressList[i].addressType == MSG_ADDRESS_TYPE_EMAIL) { + pAddressData = MsgMmsCreateAddress(MSG_ADDRESS_TYPE_EMAIL, pMsgInfo->addressList[i].addressVal); + } else + ; // Need to consider IPV4, IPV6, and Alias formatted address + + if (pAddressData) + addressList = g_list_append(addressList, pAddressData); + } + } + + MSG_END(); + return addressList; +} + +bool composeSendReqHeader(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_DATA_S *pMsgData) +{ + MSG_BEGIN(); + + bool bAskDeliveryReport = false; + bool bAskReadReply = false; + MmsPriority priority; + MmsTimeStruct expiryTime; + MmsTimeStruct deliveryTime; + MmsMsgClass msgClass; + + struct tm *timeInfo = NULL; + time_t RawTime = 0; + time_t nTimeInSecs = 0; + + MMS_HEADER_DATA_S *pHeaderData = pMsgData->header; + if (pSendOptInfo) { + if (pSendOptInfo->bSetting == false) { + unsigned int settingTime; + + priority = (MmsPriority)MsgSettingGetInt(MMS_SEND_PRIORITY); + + settingTime = (unsigned int)MsgSettingGetInt(MMS_SEND_EXPIRY_TIME); + if (settingTime == 0) { + expiryTime.type = MMS_TIMETYPE_NONE; + expiryTime.time = 0; + } else { + expiryTime.type = MMS_TIMETYPE_RELATIVE; + expiryTime.time = settingTime; + } + + settingTime = (unsigned int)MsgSettingGetInt(MMS_SEND_DELIVERY_TIME); + if (settingTime == 0) { + deliveryTime.type = MMS_TIMETYPE_NONE; + deliveryTime.time = 0; + } else { + deliveryTime.type = MMS_TIMETYPE_RELATIVE; + deliveryTime.time = (unsigned int)settingTime; + } + + MsgSettingGetBool(MMS_SEND_DELIVERY_REPORT, &bAskDeliveryReport); + MsgSettingGetBool(MMS_SEND_READ_REPLY, &bAskReadReply); + } else { + priority = (MmsPriority)pSendOptInfo->option.mmsSendOptInfo.priority; + + expiryTime.type = pSendOptInfo->option.mmsSendOptInfo.expiryTime.type; + expiryTime.time = pSendOptInfo->option.mmsSendOptInfo.expiryTime.time; + + deliveryTime.type = pSendOptInfo->option.mmsSendOptInfo.deliveryTime.type; + deliveryTime.time = pSendOptInfo->option.mmsSendOptInfo.deliveryTime.time; + + bAskDeliveryReport = pSendOptInfo->bDeliverReq; + bAskReadReply = pSendOptInfo->option.mmsSendOptInfo.bReadReq; + } + + msgClass = (MmsMsgClass)MsgSettingGetInt(MMS_SEND_MSG_CLASS); + + //set Header + time(&RawTime); + timeInfo = localtime(&RawTime); + nTimeInSecs = mktime(timeInfo); + pHeaderData->date = nTimeInSecs; + + pHeaderData->bDeliveryReport = bAskDeliveryReport; + pHeaderData->delivery.type = deliveryTime.type; + pHeaderData->delivery.time = deliveryTime.time; + + pHeaderData->expiry.type = expiryTime.type; + pHeaderData->expiry.time = expiryTime.time; + + pHeaderData->messageClass = msgClass; + pHeaderData->messageType = MMS_MSGTYPE_SEND_REQ; + pHeaderData->mmsVersion = MMS_VERSION; + pHeaderData->mmsPriority = priority; + pHeaderData->bReadReport = bAskReadReply; + pHeaderData->bHideAddress = false; + } + + if (pMsgData->smil) { + pHeaderData->contentType = MIME_APPLICATION_VND_WAP_MULTIPART_RELATED; + } else { + pHeaderData->contentType = MIME_APPLICATION_VND_WAP_MULTIPART_MIXED; + } + + char *content_type = MimeGetMimeStringFromMimeInt(pHeaderData->contentType); + if (content_type) { + snprintf(pHeaderData->szContentType, sizeof(pHeaderData->szContentType), "%s", content_type); + } + + snprintf(pHeaderData->szSubject, sizeof(pHeaderData->szSubject), "%s", pMsgInfo->subject); + + //setting adddress + pHeaderData->to = getAddressList(pMsgInfo, MSG_RECIPIENTS_TYPE_TO); + pHeaderData->cc = getAddressList(pMsgInfo, MSG_RECIPIENTS_TYPE_CC); + pHeaderData->bcc = getAddressList(pMsgInfo, MSG_RECIPIENTS_TYPE_BCC); + + //snprintf(pHeaderData->szFrom, sizeof(pHeaderData->szFrom), "%s", pMmsMsg->mmsAttrib.szFrom); + + return true; +} diff --git a/plugin/mms_plugin/MmsPluginConnManWrapper.cpp b/plugin/mms_plugin/MmsPluginConnManWrapper.cpp index 5dac38c..8a9ade5 100755 --- a/plugin/mms_plugin/MmsPluginConnManWrapper.cpp +++ b/plugin/mms_plugin/MmsPluginConnManWrapper.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include @@ -20,20 +20,15 @@ #include "MmsPluginHttp.h" #include #include "net_connection.h" +#include "MmsPluginUtil.h" #define MMS_CONTEXT_INVOKE_WAIT_TIME 30 -#define MMS_CONNECTION_API_WAIT_TIME 50 - -#define MMS_FREE(obj)\ - if (obj){\ - free(obj);\ - obj = NULL;\ - } - +#define MMS_CONNECTION_API_WAIT_TIME 420 static Mutex g_mx; static CndVar g_cv; -static connection_h connection = NULL; +static connection_h g_connection = NULL; +static connection_profile_h g_profile = NULL; void __connection_profile_print(connection_profile_h profile) { @@ -61,147 +56,157 @@ void __connection_profile_print(connection_profile_h profile) MSG_DEBUG("**************************************************************************************************"); ret = connection_profile_get_id(profile, &profile_id); - MSG_DEBUG("Profile Id = [%s]", profile_id); + MSG_DEBUG("return value of connection_profile_get_id [%d]", ret); + MSG_SEC_INFO("Profile Id = [%s]", profile_id); ret = connection_profile_get_name(profile, &profile_name); - MSG_DEBUG("Profile Name = [%s]", profile_name); + MSG_SEC_INFO("Profile Name = [%s]", profile_name); ret = connection_profile_get_type(profile, &profile_type); if (profile_type == CONNECTION_PROFILE_TYPE_CELLULAR) { - MSG_DEBUG("Profile Type = [CELLULAR]"); + MSG_SEC_INFO("Profile Type = [CELLULAR]"); } else if (profile_type == CONNECTION_PROFILE_TYPE_WIFI) { - MSG_DEBUG("Profile Type = [WIFI]"); + MSG_SEC_INFO("Profile Type = [WIFI]"); } else if (profile_type == CONNECTION_PROFILE_TYPE_ETHERNET) { - MSG_DEBUG("Profile Type = [ETHERNET]"); + MSG_SEC_INFO("Profile Type = [ETHERNET]"); } else if (profile_type == CONNECTION_PROFILE_TYPE_BT) { - MSG_DEBUG("Profile Type = [BT]"); + MSG_SEC_INFO("Profile Type = [BT]"); } else { - MSG_DEBUG("Profile Type = Unknown [%d]", profile_type); + MSG_SEC_INFO("Profile Type = Unknown [%d]", profile_type); } ret = connection_profile_get_network_interface_name(profile, &interface_name); - MSG_DEBUG("Profile Interface Name = [%s]", interface_name); + MSG_SEC_INFO("Profile Interface Name = [%s]", interface_name); ret = connection_profile_get_state(profile, &profile_state); if (profile_state == CONNECTION_PROFILE_STATE_DISCONNECTED) { - MSG_DEBUG("Profile State = [DISCONNECTED]"); + MSG_SEC_INFO("Profile State = [DISCONNECTED]"); } else if (profile_state == CONNECTION_PROFILE_STATE_ASSOCIATION) { - MSG_DEBUG("Profile State = [ASSOCIATION]"); + MSG_SEC_INFO("Profile State = [ASSOCIATION]"); } else if (profile_state == CONNECTION_PROFILE_STATE_CONFIGURATION) { - MSG_DEBUG("Profile State = [CONFIGURATION]"); + MSG_SEC_INFO("Profile State = [CONFIGURATION]"); } else if (profile_state == CONNECTION_PROFILE_STATE_CONNECTED) { - MSG_DEBUG("Profile State = [CONNECTED]"); + MSG_SEC_INFO("Profile State = [CONNECTED]"); } else { - MSG_DEBUG("Profile State = Unknown [%d]", profile_state); + MSG_SEC_INFO("Profile State = Unknown [%d]", profile_state); } ret = connection_profile_get_ip_config_type(profile, CONNECTION_ADDRESS_FAMILY_IPV4, &ip_type); - MSG_DEBUG("Profile Ip Config Type = [%d]", ip_type); + MSG_SEC_INFO("Profile Ip Config Type = [%d]", ip_type); ret = connection_profile_get_ip_address(profile, CONNECTION_ADDRESS_FAMILY_IPV4, &ip_address); - MSG_DEBUG("Profile Ip Address = [%s]", ip_address); + MSG_SEC_INFO("Profile Ip Address = [%s]", ip_address); ret = connection_profile_get_subnet_mask(profile, CONNECTION_ADDRESS_FAMILY_IPV4, &subnet_mask); - MSG_DEBUG("Profile Subnet Mask = [%s]", subnet_mask); + MSG_SEC_INFO("Profile Subnet Mask = [%s]", subnet_mask); ret = connection_profile_get_gateway_address(profile, CONNECTION_ADDRESS_FAMILY_IPV4, &gateway_address); - MSG_DEBUG("Profile Gateway Address = [%s]", gateway_address); + MSG_SEC_INFO("Profile Gateway Address = [%s]", gateway_address); ret = connection_profile_get_dns_address(profile, 1, CONNECTION_ADDRESS_FAMILY_IPV4, &dns_address); - MSG_DEBUG("Profile Dns Address = [%s]", dns_address); + MSG_SEC_INFO("Profile Dns Address = [%s]", dns_address); ret = connection_profile_get_proxy_type(profile, &proxy_type); - MSG_DEBUG("Profile Proxy Type = [%d]", proxy_type); + MSG_SEC_INFO("Profile Proxy Type = [%d]", proxy_type); ret = connection_profile_get_proxy_address(profile, CONNECTION_ADDRESS_FAMILY_IPV4, &proxy_address); - MSG_DEBUG("Profile Proxy Address = [%s]", proxy_address); + MSG_SEC_INFO("Profile Proxy Address = [%s]", proxy_address); ret = connection_profile_get_cellular_service_type(profile, &service_type); if (service_type == CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET) { - MSG_DEBUG("Profile Service Type = [INTERNET]"); + MSG_SEC_INFO("Profile Service Type = [INTERNET]"); } else if (service_type == CONNECTION_CELLULAR_SERVICE_TYPE_MMS) { - MSG_DEBUG("Profile Service Type = [MMS]"); + MSG_SEC_INFO("Profile Service Type = [MMS]"); } else if (service_type == CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET) { - MSG_DEBUG("Profile Service Type = [PREPAID_INTERNET]"); + MSG_SEC_INFO("Profile Service Type = [PREPAID_INTERNET]"); } else if (service_type == CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_MMS) { - MSG_DEBUG("Profile Service Type = [PREPAID_MMS]"); + MSG_SEC_INFO("Profile Service Type = [PREPAID_MMS]"); } else if (service_type == CONNECTION_CELLULAR_SERVICE_TYPE_TETHERING) { - MSG_DEBUG("Profile Service Type = [TETHERING]"); + MSG_SEC_INFO("Profile Service Type = [TETHERING]"); } else if (service_type == CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION) { - MSG_DEBUG("Profile Service Type = [APPLICATION]"); + MSG_SEC_INFO("Profile Service Type = [APPLICATION]"); } else { - MSG_DEBUG("Profile Service Type = [Unknown][%d]", service_type); + MSG_SEC_INFO("Profile Service Type = [Unknown][%d]", service_type); } ret = connection_profile_get_cellular_apn(profile, &apn); - MSG_DEBUG("Profile Apn = [%s]", apn); + MSG_SEC_INFO("Profile Apn = [%s]", apn); ret = connection_profile_get_cellular_auth_info(profile, &auth_type, &user_name, &password); - MSG_DEBUG("Profile Auth Type = [%d]", &auth_type); - MSG_DEBUG("Profile Auth Name = [%s]", &user_name); - MSG_DEBUG("Profile Auth Passward = [%s]", &password); + MSG_SEC_INFO("Profile Auth Type = [%d]", &auth_type); + MSG_SEC_INFO("Profile Auth Name = [%s]", &user_name); + MSG_SEC_INFO("Profile Auth Passward = [%s]", &password); ret = connection_profile_get_cellular_home_url(profile, &home_url); - MSG_DEBUG("Profile Home Url = [%s]", home_url); + MSG_SEC_INFO("Profile Home Url = [%s]", home_url); ret = connection_profile_is_cellular_roaming(profile, &is_roaming); - MSG_DEBUG("Profile Roaming = [%d]", is_roaming); + MSG_SEC_INFO("Profile Roaming = [%d]", is_roaming); MSG_DEBUG("**************************************************************************************************"); - MMS_FREE(profile_id); - MMS_FREE(profile_name); - MMS_FREE(interface_name); - MMS_FREE(ip_address); - MMS_FREE(subnet_mask); - MMS_FREE(gateway_address); - MMS_FREE(dns_address); - MMS_FREE(proxy_address); - MMS_FREE(apn); - MMS_FREE(user_name); - MMS_FREE(password); - MMS_FREE(home_url); + MSG_FREE(profile_id); + MSG_FREE(profile_name); + MSG_FREE(interface_name); + MSG_FREE(ip_address); + MSG_FREE(subnet_mask); + MSG_FREE(gateway_address); + MSG_FREE(dns_address); + MSG_FREE(proxy_address); + MSG_FREE(apn); + MSG_FREE(user_name); + MSG_FREE(password); + MSG_FREE(home_url); } static void __connection_type_changed_cb(connection_type_e type, void* user_data) { - MSG_DEBUG("Type changed callback, connection type : %d", type); + MSG_INFO("Type changed callback, connection type : %d", type); } static void __connection_ip_changed_cb(const char* ipv4_address, const char* ipv6_address, void* user_data) { - MSG_DEBUG("IP changed callback, IPv4 address : %s, IPv6 address : %s", + MSG_INFO("IP changed callback, IPv4 address : %s, IPv6 address : %s", ipv4_address, (ipv6_address ? ipv6_address : "NULL")); } static void __connection_proxy_changed_cb(const char* ipv4_address, const char* ipv6_address, void* user_data) { - MSG_DEBUG("Proxy changed callback, IPv4 address : %s, IPv6 address : %s", + MSG_INFO("Proxy changed callback, IPv4 address : %s, IPv6 address : %s", ipv4_address, (ipv6_address ? ipv6_address : "NULL")); } static void __connection_profile_opened_cb(connection_error_e result, void* user_data) { if (result == CONNECTION_ERROR_NONE || result == CONNECTION_ERROR_ALREADY_EXISTS) - MSG_DEBUG("Connection open Succeeded [%d]", result); + MSG_INFO("Connection open Succeeded [%d]", result); else - MSG_DEBUG("Connection open Failed, err : %d", result); + MSG_ERR("Connection open Failed, err : %d", result); MmsPluginCmAgent *cmAgent = MmsPluginCmAgent::instance(); - cmAgent->open_callback(result, user_data); + cmAgent->connection_profile_open_callback(result, user_data); } static void __connection_profile_closed_cb(connection_error_e result, void* user_data) { if (result == CONNECTION_ERROR_NONE) - MSG_DEBUG("Connection close Succeeded"); + MSG_INFO("Connection close Succeeded"); else - MSG_DEBUG("Connection close Failed, err : %d", result); + MSG_ERR("Connection close Failed, err : %d", result); MmsPluginCmAgent *cmAgent = MmsPluginCmAgent::instance(); - cmAgent->close_callback(result, user_data); + cmAgent->connection_profile_close_callback(result, user_data); +} + + +void __connection_profile_state_changed_cb(connection_profile_state_e state, void* user_data) +{ + MmsPluginCmAgent *cmAgent = MmsPluginCmAgent::instance(); + + cmAgent->connection_profile_state_changed_cb(state, user_data); + } static gboolean __connection_create(void *pVoid) @@ -211,20 +216,42 @@ static gboolean __connection_create(void *pVoid) bool ret = false; bool *ret_val = (bool *)pVoid; - if (connection) { - MSG_DEBUG("connection already exist"); + if (g_connection) { + MSG_INFO("connection already exist"); ret = true; } else { - int err = connection_create(&connection); + int err = connection_create(&g_connection); if (CONNECTION_ERROR_NONE == err) { - connection_set_type_changed_cb(connection, __connection_type_changed_cb, NULL); - connection_set_ip_address_changed_cb(connection, __connection_ip_changed_cb, NULL); - connection_set_proxy_address_changed_cb(connection, __connection_proxy_changed_cb, NULL); - ret = true; - MSG_DEBUG("Client registration success [%p] ", connection); + + connection_cellular_state_e cellular_state; + connection_type_e net_state; + + err = connection_get_cellular_state(g_connection, &cellular_state); + + err = connection_get_type(g_connection, &net_state); + + if (cellular_state == CONNECTION_CELLULAR_STATE_AVAILABLE + || cellular_state == CONNECTION_CELLULAR_STATE_CONNECTED) { + + MSG_INFO("Client registration success [%p], cellular_state [%d], net_state [%d]", g_connection, cellular_state, net_state); + + err = connection_set_type_changed_cb(g_connection, __connection_type_changed_cb, NULL); + + err = connection_set_ip_address_changed_cb(g_connection, __connection_ip_changed_cb, NULL); + + err = connection_set_proxy_address_changed_cb(g_connection, __connection_proxy_changed_cb, NULL); + + ret = true; + } else { + + MSG_INFO("Client registration Failed, cellular state [%d], net_state [%d]", cellular_state, net_state); + connection_destroy(g_connection); + g_connection = NULL; + } + } else { - MSG_DEBUG("Client registration failed %d", err); + MSG_WARN("Client registration failed %d", err); } } @@ -241,17 +268,18 @@ static gboolean __connection_destroy(void *pVoid) MSG_BEGIN(); int rv; - int netOpenResult = NET_ERR_NONE; - if (connection != NULL) { - rv = connection_destroy(connection); - connection = NULL; - MSG_DEBUG("connection destory !!"); + if (g_connection != NULL) { + rv = connection_destroy(g_connection); + g_connection = NULL; + MSG_INFO("connection destory !!"); } else { - MSG_DEBUG("Cannot connection destroy : Handle is NULL"); + MSG_ERR("Cannot connection destroy : Handle is NULL"); rv = CONNECTION_ERROR_INVALID_OPERATION; } + MSG_DEBUG("return value of connection destroy [%d]", rv); + MSG_END(); return FALSE; } @@ -260,29 +288,37 @@ static gboolean __connection_profile_open(void *pVoid) { MSG_BEGIN(); - int netOpenResult = NET_ERR_NONE; + int netOpenResult = MSG_CM_ERR_NONE; int *ret_val = (int *)pVoid; - - connection_profile_h profile; int err; - err = connection_get_default_cellular_service_profile(connection, CONNECTION_CELLULAR_SERVICE_TYPE_MMS, &profile); + if (g_profile) { + MSG_WARN("connection profile Already exist!!, It will destroy"); + connection_profile_unset_state_changed_cb(g_profile); + connection_profile_destroy(g_profile); + g_profile = NULL; + } + + err = connection_get_default_cellular_service_profile(g_connection, CONNECTION_CELLULAR_SERVICE_TYPE_MMS, &g_profile); if (err != CONNECTION_ERROR_NONE) { - MSG_DEBUG("connection_get_default_cellular_service_profile Failed!! [%d]", err); - netOpenResult = NET_ERR_UNKNOWN; + MSG_ERR("connection_get_default_cellular_service_profile Failed!! [%d]", err); + netOpenResult = MSG_CM_ERR_UNKNOWN; } else { - if (connection_open_profile(connection, profile, __connection_profile_opened_cb, NULL) != CONNECTION_ERROR_NONE) { - MSG_DEBUG("Connection open Failed!!"); - netOpenResult = NET_ERR_UNKNOWN; + err = connection_profile_set_state_changed_cb(g_profile, __connection_profile_state_changed_cb, g_profile); + + if (connection_open_profile(g_connection, g_profile, __connection_profile_opened_cb, NULL) != CONNECTION_ERROR_NONE) { + MSG_ERR("Connection open Failed!!"); + netOpenResult = MSG_CM_ERR_UNKNOWN; } - } - connection_profile_destroy(profile); + + } if (ret_val) { *ret_val = netOpenResult; + MSG_DEBUG("[%d]", netOpenResult); } MSG_END(); @@ -294,29 +330,22 @@ static gboolean __connection_profile_close(void *pVoid) { MSG_BEGIN(); - int netOpenResult = NET_ERR_NONE; + int netOpenResult = MSG_CM_ERR_NONE; int *ret_val = (int *)pVoid; - connection_profile_h profile; - int err; - - err = connection_get_default_cellular_service_profile(connection, CONNECTION_CELLULAR_SERVICE_TYPE_MMS, &profile); - - if (err != CONNECTION_ERROR_NONE) { - MSG_DEBUG("connection_get_default_cellular_service_profile Failed!! [%d]", err); - netOpenResult = NET_ERR_UNKNOWN; - } else { + if (g_profile) { + connection_profile_unset_state_changed_cb(g_profile); - if (connection_close_profile(connection, profile, __connection_profile_closed_cb, NULL) != CONNECTION_ERROR_NONE) { - MSG_DEBUG("Connection close Failed!!"); - netOpenResult = NET_ERR_UNKNOWN; + if (connection_close_profile(g_connection, g_profile, __connection_profile_closed_cb, NULL) != CONNECTION_ERROR_NONE) { + MSG_ERR("Connection close Failed!!"); + netOpenResult = MSG_CM_ERR_UNKNOWN; } + connection_profile_destroy(g_profile); + g_profile = NULL; } - connection_profile_destroy(profile); - if (ret_val) { *ret_val = netOpenResult; } @@ -331,7 +360,7 @@ void context_invoke_end_cb(gpointer data) { g_mx.lock(); - MSG_DEBUG("@@ SIGNAL @@"); + MSG_INFO("@@ SIGNAL @@"); g_cv.signal(); @@ -349,17 +378,18 @@ void context_invoke(GSourceFunc func, void *ret) g_mx.lock(); - g_main_context_invoke_full(NULL, G_PRIORITY_HIGH, func, ret, context_invoke_end_cb); + g_main_context_invoke_full(NULL, G_PRIORITY_DEFAULT, func, ret, context_invoke_end_cb); - MSG_DEBUG("@@ WAIT @@"); + MSG_INFO("@@ WAIT @@"); time_ret = g_cv.timedwait(g_mx.pMutex(), MMS_CONTEXT_INVOKE_WAIT_TIME); + g_mx.unlock(); if (time_ret == ETIMEDOUT) { - MSG_DEBUG("@@ WAKE by timeout@@"); + MSG_INFO("@@ WAKE by timeout@@"); } else { - MSG_DEBUG("@@ WAKE by signal@@"); + MSG_INFO("@@ WAKE by signal@@"); } MSG_END(); @@ -381,8 +411,6 @@ MmsPluginCmAgent::MmsPluginCmAgent() isCmOpened = false; - isCmRegistered = false; - home_url = NULL; interface_name = NULL; proxy_address = NULL; @@ -391,64 +419,69 @@ MmsPluginCmAgent::MmsPluginCmAgent() MmsPluginCmAgent::~MmsPluginCmAgent() { - MMS_FREE(home_url); - MMS_FREE(interface_name); - MMS_FREE(proxy_address); + MSG_FREE(home_url); + MSG_FREE(interface_name); + MSG_FREE(proxy_address); } bool MmsPluginCmAgent::open() { MSG_BEGIN(); - int netOpenResult = NET_ERR_NONE; - + int netOpenResult = MSG_CM_ERR_NONE; + int bConnection = false; + int time_ret = 0; lock(); - if (isCmOpened == false) { - - isCmRegistered = false; - - context_invoke(__connection_create, &isCmRegistered); - - if (isCmRegistered == true) { + //create connection + context_invoke(__connection_create, &bConnection); - MSG_DEBUG("net_open_connection for MMS"); - - context_invoke(__connection_profile_open, &netOpenResult); - - if (netOpenResult == NET_ERR_NONE) { - - MSG_DEBUG("## WAITING UNTIL Network Connection Open. ##"); + if (bConnection == false || g_connection == NULL) { + MSG_ERR("Failed __connection_create"); + goto __ERR_RETURN; + } - int time_ret = 0; + if (g_profile) { + MSG_WARN("connection profile already exist"); + //TODO:: get data; + //goto __RETURN; + } - time_ret = cv.timedwait(mx.pMutex(), MMS_CONNECTION_API_WAIT_TIME); // isCmOpened will changed by processCBdatas + waitProfileOpen = true; - MSG_DEBUG("## WAKE ##"); + context_invoke(__connection_profile_open, &netOpenResult); - if (time_ret == ETIMEDOUT) { - MSG_DEBUG("Network Connection Open Time Out."); - } + if (netOpenResult != MSG_CM_ERR_NONE) { + MSG_ERR("Failed __connection_profile_open. [%d]", netOpenResult); + goto __ERR_RETURN; + } - if(!isCmOpened) { - MSG_DEBUG("Network Connection Open Failed"); - } + MSG_INFO("## WAITING UNTIL __connection_profile_state CONNECT. ##"); - } else { //error - MSG_FATAL("Error!! net_open_connection_with_profile() failed. [%d]", netOpenResult); - } +// cv.wait(mx.pMutex()); +// MSG_INFO("## WAKE by SIGNAL ##"); - if (isCmOpened == false) { - context_invoke( __connection_destroy, NULL); - } + time_ret = cv.timedwait(mx.pMutex(), MMS_CONNECTION_API_WAIT_TIME); // isCmOpened will changed by processCBdatas - } else { - MSG_FATAL("## Failed network callback registration ##"); - } + if (time_ret == ETIMEDOUT) { + MSG_WARN("## WAKE by timeout ##"); } else { - MSG_DEBUG("Network is already opened."); + MSG_INFO("## WAKE by SIGNAL ##"); + } + + if(isCmOpened == false) { + MSG_WARN(""); + goto __ERR_RETURN; } +//__RETURN: + unlock(); + MSG_END(); + return isCmOpened; + +__ERR_RETURN: + context_invoke(__connection_profile_close, NULL); + context_invoke( __connection_destroy, NULL); unlock(); MSG_END(); return isCmOpened; @@ -461,102 +494,215 @@ void MmsPluginCmAgent::close() lock(); - if (isCmOpened) { - int netOpenResult = NET_ERR_NONE; - - context_invoke(__connection_profile_close, &netOpenResult); - - if (netOpenResult == NET_ERR_NONE) { + int netOpenResult = MSG_CM_ERR_NONE; + int time_ret = 0; - MSG_DEBUG("## WAITING UNTIL Network Connection Close. ##"); + isCmOpened = false; - int time_ret = 0; + if (g_profile == NULL) { + MSG_INFO("connection profile is NULL"); + goto __RETURN; + } - time_ret = cv.timedwait(mx.pMutex(), MMS_CONNECTION_API_WAIT_TIME); + context_invoke(__connection_profile_close, &netOpenResult); - MSG_DEBUG("## WAKE ##"); + if (netOpenResult != MSG_CM_ERR_NONE) { + MSG_ERR("Failed __connection_profile_close. [%d]", netOpenResult); + goto __RETURN; + } - if (time_ret == ETIMEDOUT) { - MSG_DEBUG("Network Connection Close Timed Out."); - } + MSG_INFO("## WAITING UNTIL connection_profile_close_callback ##"); - } else { - MSG_DEBUG("Error!! net_close_connection() failed"); - } + time_ret = cv.timedwait(mx.pMutex(), MMS_CONNECTION_API_WAIT_TIME); - isCmOpened = false; + if (time_ret == ETIMEDOUT) { + MSG_WARN("## WAKE by timeout ##"); } else { - MSG_DEBUG ("Network Connection is not opened."); + MSG_INFO("## WAKE by SIGNAL ##"); } - if (isCmRegistered == true) { + +__RETURN: + if (g_connection) context_invoke(__connection_destroy, NULL); - isCmRegistered = false; - } + + g_profile = NULL; + g_connection = NULL; + + MSG_FREE(this->home_url); + MSG_FREE(this->interface_name); + MSG_FREE(this->proxy_address); unlock(); MSG_END(); } -void MmsPluginCmAgent::open_callback(connection_error_e result, void* user_data) +//profile open callback +void MmsPluginCmAgent::connection_profile_open_callback(connection_error_e result, void* user_data) { lock(); - connection_profile_h profile; connection_cellular_state_e state; + connection_profile_h profile = NULL; + connection_profile_state_e profile_state; int err; if (result == CONNECTION_ERROR_NONE || result == CONNECTION_ERROR_ALREADY_EXISTS) { - err = connection_get_cellular_state(connection, &state); + err = connection_get_cellular_state(g_connection, &state); MSG_DEBUG("connection_get_cellular_state ret [%d], state [%d]", err, state); - err = connection_get_default_cellular_service_profile(connection, CONNECTION_CELLULAR_SERVICE_TYPE_MMS, &profile); - if (err != CONNECTION_ERROR_NONE) { - MSG_DEBUG("connection_get_default_cellular_service_profile Failed!! [%d]", err); + err = connection_get_default_cellular_service_profile(g_connection, CONNECTION_CELLULAR_SERVICE_TYPE_MMS, &profile); + if (err != CONNECTION_ERROR_NONE || profile == NULL) { + + MSG_ERR("Failed connection_get_default_cellular_service_profile. err [%d], profile [%p]", err, profile); + goto __SIGNAL_RETURN; } - if (profile) { - isCmOpened = true; + err = connection_profile_get_state(profile, &profile_state); + + MSG_DEBUG("profile state [%d]", profile_state); + + if (profile_state == CONNECTION_PROFILE_STATE_CONNECTED && waitProfileOpen == true) { - MMS_FREE(this->home_url); - MMS_FREE(this->interface_name); - MMS_FREE(this->proxy_address); + __connection_profile_print(profile); + + MSG_FREE(this->home_url); + MSG_FREE(this->interface_name); + MSG_FREE(this->proxy_address); err = connection_profile_get_cellular_home_url(profile, &this->home_url); + if (err != CONNECTION_ERROR_NONE) { + MSG_ERR("Failed connection_profile_get_cellular_home_url"); + } + err = connection_profile_get_network_interface_name(profile, &this->interface_name); + if (err != CONNECTION_ERROR_NONE) { + MSG_ERR("Failed connection_profile_get_cellular_home_url"); + } + err = connection_profile_get_proxy_address(profile, CONNECTION_ADDRESS_FAMILY_IPV4, &this->proxy_address); + if (err != CONNECTION_ERROR_NONE) { + MSG_ERR("Failed connection_profile_get_cellular_home_url"); + } - __connection_profile_print(profile); + isCmOpened = true; + + goto __SIGNAL_RETURN; //open success - connection_profile_destroy(profile); + } else { + goto __NO_SIGNAL_RETURN; //Just open success } } else { - MSG_DEBUG("connection open profile Failed!! [%d]", result); + MSG_ERR("connection open profile Failed!! [%d]", result); + isCmOpened = false; + goto __SIGNAL_RETURN; + + } + +__NO_SIGNAL_RETURN: //Just Open + if (profile) + connection_profile_destroy(profile); + unlock(); + return; + +__SIGNAL_RETURN: //Error or Already connected + if (profile) + connection_profile_destroy(profile); + + if (waitProfileOpen == true) {//open fail + waitProfileOpen = false; + MSG_INFO("## SIGNAL ##"); + signal(); } + unlock(); + return; +} - MSG_DEBUG("## SIGNAL ##"); + +void MmsPluginCmAgent::connection_profile_close_callback(connection_error_e result, void* user_data) +{ + lock(); + MSG_INFO("result [%d]", result); + MSG_INFO("## SIGNAL ##"); signal(); unlock(); } -void MmsPluginCmAgent::close_callback(connection_error_e result, void* user_data) +void MmsPluginCmAgent::connection_profile_state_changed_cb(connection_profile_state_e state, void* user_data) { + MSG_BEGIN(); + lock(); - MMS_FREE(this->home_url); - MMS_FREE(this->interface_name); - MMS_FREE(this->proxy_address); + int err; + connection_profile_h profile = NULL; - isCmOpened = false; - MSG_DEBUG("## SIGNAL ##"); - signal(); + MSG_INFO("state [%d]", state); + + if (state != CONNECTION_PROFILE_STATE_CONNECTED) { + isCmOpened = false; + goto __NO_SIGNAL_RETURN; + } + + if (isCmOpened == true) { + MSG_INFO("already opened"); + goto __SIGNAL_RETURN; + } + + /* Should get profile to get latest profile info*/ + err = connection_get_default_cellular_service_profile(g_connection, CONNECTION_CELLULAR_SERVICE_TYPE_MMS, &profile); + if (err != CONNECTION_ERROR_NONE || profile == NULL) { + + MSG_ERR("Failed connection_get_default_cellular_service_profile. err [%d], profile [%p]", err, profile); + goto __SIGNAL_RETURN; + } + + if (state == CONNECTION_PROFILE_STATE_CONNECTED ) { + __connection_profile_print(profile); + MSG_FREE(this->home_url); + MSG_FREE(this->interface_name); + MSG_FREE(this->proxy_address); + + err = connection_profile_get_cellular_home_url(profile, &this->home_url); + if (err != CONNECTION_ERROR_NONE) { + MSG_ERR("Failed connection_profile_get_cellular_home_url"); + } + + err = connection_profile_get_network_interface_name(profile, &this->interface_name); + if (err != CONNECTION_ERROR_NONE) { + MSG_ERR("Failed connection_profile_get_cellular_home_url"); + } + + err = connection_profile_get_proxy_address(profile, CONNECTION_ADDRESS_FAMILY_IPV4, &this->proxy_address); + if (err != CONNECTION_ERROR_NONE) { + MSG_ERR("Failed connection_profile_get_cellular_home_url"); + } + + isCmOpened = true; + goto __SIGNAL_RETURN; + } + +__NO_SIGNAL_RETURN://Default + unlock(); + return; + +__SIGNAL_RETURN: //Error or connected + if (profile) + connection_profile_destroy(profile); + + if (waitProfileOpen == true) { + waitProfileOpen = false; + MSG_INFO("## SIGNAL ##"); + signal(); + } unlock(); + return; } bool MmsPluginCmAgent::getInterfaceName(const char **deviceName) diff --git a/plugin/mms_plugin/MmsPluginDecode.cpp b/plugin/mms_plugin/MmsPluginDecode.cpp index b7851f9..cf6e5a6 100755 --- a/plugin/mms_plugin/MmsPluginDecode.cpp +++ b/plugin/mms_plugin/MmsPluginDecode.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include @@ -21,6 +21,8 @@ #include #include "MsgUtilFile.h" +#include "MsgSmil.h" +#include "MsgMmsMessage.h" #include "MmsPluginDebug.h" #include "MmsPluginDecode.h" @@ -28,16 +30,11 @@ #include "MmsPluginStorage.h" #include "MmsPluginDebug.h" #include "MmsPluginMIME.h" -#include "MmsPluginAvCodec.h" -#include "MmsPluginSmil.h" #include "MmsPluginTextConvert.h" #include "MmsPluginUtil.h" -#ifdef __SUPPORT_DRM__ #include "MmsPluginDrm.h" #include "MsgDrmWrapper.h" -#endif - /*Decode wsp*/ static int __MmsGetDecodeOffset(void); @@ -75,9 +72,6 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value static int __MmsBinaryDecodeContentType(FILE *pFile, MsgType *pMsgType, int totalLength); -#ifdef __SUPPORT_DRM__ -static bool __MmsBinaryDecodeDRMContent(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, unsigned int bodyLength, int totalLength); -#endif //util funcion static void __MsgRemoveFilePath(char *pSrc); @@ -93,14 +87,12 @@ static char *__MsgGetStringUntilDelimiter(char *pszString, char delimiter); static bool __MsgParseParameter(MsgType *pType, char *pSrc); static char *__MsgSkipWS(char *s); static char *__MsgSkipComment(char *s, long trim); -static MsgMultipart *__MsgAllocMultipart(void); static char *__MsgConvertLatin2UTF8FileName(char *pSrc); -static bool __MsgIsUTF8String(unsigned char *szSrc, int nChar); -static bool __MsgIsPercentSign(char *pSrc); + +//static bool __MsgIsPercentSign(char *pSrc); static bool __MsgIsMultipartRelated(int type); static bool __MsgIsPresentablePart(int type); -static bool __MsgIsText(int type); static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody); static bool __MsgIsHexChar(char *pSrc); static char __MsgConvertHexValue(char *pSrc); @@ -112,14 +104,7 @@ static bool __MsgIsMultipartMixed(int type); static bool __MsgIsInvalidFileNameChar(char ch); static int __MsgGetLatin2UTFCodeSize(unsigned char *szSrc, int nChar); -static int __MsgLatin5code2UTF(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar); -static int __MsgGetLatin52UTFCodeSize(unsigned char *szSrc, int nChar); static int __MsgLatin2UTF(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar); -static int __MsgLatin7code2UTF(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar); -static int __MsgGetLatin72UTFCodeSize(unsigned char *szSrc, int nChar); -static int __MsgUnicode2UTF(unsigned char *des, int outBufSize, unsigned short *szSrc, int nChar); -static int __MsgGetUnicode2UTFCodeSize(unsigned short *szSrc, int nChar); -static bool __MmsAddrUtilCheckEmailAddress(char *pszAddr); static int __MsgCutUTFString(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar); static void __MsgMIMERemoveQuote(char *szSrc); static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody, char *pszMailboxPath, char *pszMsgFilename, int index, bool bSave); @@ -127,32 +112,23 @@ static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody, static bool __MmsGetMediaPartData(MsgType *pPartType, MsgBody *pPartBody, FILE *pFile); static char *__MmsGetBinaryUTF8Data(char *pData, int nRead, int msgEncodingValue, int msgTypeValue, int msgCharsetValue, int *npRead); -#ifndef __SUPPORT_DRM__ -static bool __MsgMakeFileName(int iMsgType, char *szFileName, int nUntitleIndex); -#else static bool __MsgMakeFileName(int iMsgType, char *szFileName, MsgDrmType drmType, int nUntitleIndex, char *outBuf, int outBufLen); -#endif -static bool __MmsDebugPrintMulitpartEntry(MsgMultipart *pMultipart, int index); -static char gszMmsLoadBuf1[MSG_MMS_DECODE_BUFFER_MAX + 1] = {0, }; -static char gszMmsLoadBuf2[MSG_MMS_DECODE_BUFFER_MAX + 1] = {0, }; +__thread char gszMmsLoadBuf1[MSG_MMS_DECODE_BUFFER_MAX + 1] = {0, }; +__thread char gszMmsLoadBuf2[MSG_MMS_DECODE_BUFFER_MAX + 1] = {0, }; -static char *gpCurMmsDecodeBuff = NULL; -static int gCurMmsDecodeBuffPos = 0; /* next decoding position in gpCurMmsDecodeBuff */ -static int gMmsDecodeMaxLen = 0; -static int gMmsDecodeCurOffset = 0; /* current offset in file (last read) */ -static int gMmsDecodeBufLen = 0; /* number of last read characters */ +__thread char *gpCurMmsDecodeBuff = NULL; +__thread int gCurMmsDecodeBuffPos = 0; /* next decoding position in gpCurMmsDecodeBuff */ +__thread int gMmsDecodeMaxLen = 0; +__thread int gMmsDecodeCurOffset = 0; /* current offset in file (last read) */ +__thread int gMmsDecodeBufLen = 0; /* number of last read characters */ -static char *gpMmsDecodeBuf1 = NULL; -static char *gpMmsDecodeBuf2 = NULL; +__thread char *gpMmsDecodeBuf1 = NULL; +__thread char *gpMmsDecodeBuf2 = NULL; -__thread MmsHeader mmsHeader = +__thread MmsHeader mmsHeader = { - false, //bActive - NULL, //pszOwner - -1, //msgID - (MmsMsgType)MMS_MSGTYPE_ERROR, //MmsMsgType iType; "", //char[] szTrID; //"", //short int version; @@ -200,13 +176,10 @@ __thread MmsHeader mmsHeader = 0, //UINT32 msgSize; }; -#ifdef __SUPPORT_DRM__ - #define MMS_DRM2_CONVERT_BUFFER_MAX 4*1024 const UINT32 MMS_UINTVAR_LENGTH_1 = 0x0000007f; //7bit const UINT32 MMS_UINTVAR_LENGTH_2 = 0x00003fff; //14bit const UINT32 MMS_UINTVAR_LENGTH_3 = 0x001fffff; //21bit -#endif static bool __MmsDecodeInitialize(void) { @@ -266,9 +239,7 @@ void MmsInitHeader() memset(mmsHeader.szMsgID, 0, MMS_MSG_ID_LEN + 1); mmsHeader.msgSize = 0; -#ifdef __SUPPORT_DRM__ mmsHeader.drmType = MSG_DRM_TYPE_NONE; -#endif __MmsDecodeInitialize(); } @@ -414,58 +385,58 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) switch (MmsGetBinaryType(MmsCodeFieldCode, fieldCode)) { case MMS_CODE_RESPONSESTATUS: + { + MmsResponseStatus resposeStatus = MMS_RESPSTATUS_ERROR; if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { MSG_DEBUG("responseStatus GetOneByte fail"); goto __CATCH; } + fieldValue = oneByte; + // range 197 to 223 as it does to the value 192 (Error-transient-failure). // range 236 to 255 as it does to the value 224 (Error-permanent-failure). - if (fieldValue >= 0x0045 && fieldValue <= 0x005F) { - fieldValue = 0x0040; - } else if (fieldValue >= 0x006A && fieldValue <= 0x007F) { - fieldValue = 0x0060; + if (fieldValue >= 197 && fieldValue <= 223) { + fieldValue = 192; + } else if (fieldValue >= 236 && fieldValue <= 255) { + fieldValue = 224; } - fieldValue = MmsGetBinaryType(MmsCodeResponseStatus, (UINT16)(oneByte & 0x7F)); - - if (fieldValue == 0xFFFF) { - MSG_DEBUG("responseStatus error"); - goto __CATCH; - } + resposeStatus = (MmsResponseStatus)MmsGetBinaryType(MmsCodeResponseStatus, (UINT16)(fieldValue & 0x7F)); - mmsHeader.responseStatus = (MmsResponseStatus)fieldValue; + mmsHeader.responseStatus = (MmsResponseStatus)resposeStatus; - MSG_DEBUG("X-Mms-Response-Status = [0x%02x][%s]", oneByte, MmsDebugGetResponseStatus(mmsHeader.responseStatus)); + MSG_SEC_INFO("X-Mms-Response-Status = [0x%02x][0x%02x][%s]", oneByte, fieldValue, MmsDebugGetResponseStatus(mmsHeader.responseStatus)); break; - + } case MMS_CODE_RETRIEVESTATUS: + { + MmsRetrieveStatus RetrieveStatus = MMS_RETRSTATUS_ERROR; if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { MSG_DEBUG("retrieveStatus GetOneByte fail"); goto __CATCH; } - fieldValue = MmsGetBinaryType(MmsCodeRetrieveStatus, (UINT16)(oneByte & 0x7F)); + fieldValue = oneByte; - if (fieldValue == 0xFFFF) { - MSG_DEBUG("retrieveStatus error"); - goto __CATCH; + //195 to 223 as it does to the value 192 (Error-transient-failure). + //228 to 255 as it does to the value 224 (Error-permanent-failure). + if (fieldValue >= 195 && fieldValue <= 223) { + fieldValue = 192; // 192; Error-transient-failure + } else if (fieldValue >= 228 && fieldValue <= 255) { + fieldValue = 224; //224; Error-permanent-failure } - if (fieldValue >= 0x0043 && fieldValue <= 0x005F) { - fieldValue = 0x0040; // 192; Error-transient-failure - } else if (fieldValue >= 0x0064 && fieldValue <= 0x007F) { - fieldValue = 0x0060; //224; Error-permanent-failure - } + RetrieveStatus = (MmsRetrieveStatus)MmsGetBinaryType(MmsCodeRetrieveStatus, (UINT16)(fieldValue & 0x7F)); - mmsHeader.retrieveStatus = (MmsRetrieveStatus)fieldValue; + mmsHeader.retrieveStatus = (MmsRetrieveStatus)RetrieveStatus; - MSG_DEBUG("X-Mms-Retrieve-Status = [0x%02x][%s]", oneByte, MmsDebugGetRetrieveStatus(mmsHeader.retrieveStatus)); + MSG_SEC_INFO("X-Mms-Retrieve-Status = [0x%02x][0x%02x][%s]", oneByte, fieldValue, MmsDebugGetRetrieveStatus(mmsHeader.retrieveStatus)); break; - + } case MMS_CODE_RESPONSETEXT: if (__MmsBinaryDecodeEncodedString(pFile, mmsHeader.szResponseText, MMS_LOCALE_RESP_TEXT_LEN + 1, totalLength) == false) { @@ -473,7 +444,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) goto __CATCH; } - MSG_DEBUG("X-Mms-Response-Text = [%s]", mmsHeader.szResponseText); + MSG_SEC_INFO("X-Mms-Response-Text = [%s]", mmsHeader.szResponseText); break; case MMS_CODE_RETRIEVETEXT: @@ -483,7 +454,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) goto __CATCH; } - MSG_DEBUG("X-Mms-Retrieve-Text = [%s]", mmsHeader.szRetrieveText); + MSG_SEC_INFO("X-Mms-Retrieve-Text = [%s]", mmsHeader.szRetrieveText); break; case MMS_CODE_MSGID: @@ -493,9 +464,9 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) goto __CATCH; } - MSG_DEBUG("Message-ID =[%s]", mmsHeader.szMsgID); + MSG_SEC_INFO("Message-ID =[%s]", mmsHeader.szMsgID); - if (MsgStrlen (mmsHeader.szMsgID) > 2) + if (strlen(mmsHeader.szMsgID) > 2) __MsgMIMERemoveQuote (mmsHeader.szMsgID); break; @@ -530,7 +501,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) pLimitData = NULL; } - MSG_DEBUG("Subject = [%s]", mmsHeader.szSubject); + MSG_SEC_INFO("Subject = [%s]", mmsHeader.szSubject); break; case MMS_CODE_FROM: @@ -574,14 +545,14 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) mmsHeader.pFrom->pNext = NULL; } - MSG_DEBUG("From = [%s]", mmsHeader.pFrom->szAddr); + MSG_SEC_INFO("From = [%s]", mmsHeader.pFrom->szAddr); // DRM_TEMPLATE - end } else if (oneByte == (MmsGetBinaryValue(MmsCodeAddressType, MMS_INSERT_ADDRESS_TOKEN)|0x80)) { /* Present Token only */ - MSG_DEBUG("From = [insert token]"); + MSG_SEC_INFO("From = [insert token]"); } else { /* from data broken */ - MSG_DEBUG("from addr broken"); + MSG_WARN("from addr broken"); gCurMmsDecodeBuffPos--; goto __CATCH; } @@ -604,7 +575,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) pLastTo = pAddr; } - MSG_DEBUG("To = [%s]", mmsHeader.pTo->szAddr); + MSG_SEC_INFO("To = [%s]", pAddr->szAddr); break; case MMS_CODE_BCC: @@ -624,7 +595,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) pLastBcc = pAddr; } - MSG_DEBUG("Bcc = [%s]", mmsHeader.pBcc->szAddr); + MSG_SEC_INFO("Bcc = [%s]", pAddr->szAddr); break; case MMS_CODE_CC: @@ -643,7 +614,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) pLastCc->pNext = pAddr; pLastCc = pAddr; } - MSG_DEBUG("Cc = [%s]", mmsHeader.pCc->szAddr); + MSG_SEC_INFO("Cc = [%s]", pAddr->szAddr); break; case MMS_CODE_CONTENTLOCATION: @@ -652,7 +623,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) MSG_DEBUG("MMS_CODE_CONTENTLOCATION is invalid"); goto __CATCH; } - MSG_DEBUG("X-Mms-Content-Location = [%s]", mmsHeader.szContentLocation); + MSG_SEC_DEBUG("X-Mms-Content-Location = [%s]", mmsHeader.szContentLocation); break; case MMS_CODE_DATE: @@ -662,7 +633,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) goto __CATCH; } - MSG_DEBUG("Date = [%u]", mmsHeader.date); + MSG_SEC_INFO("Date = [%u]", mmsHeader.date); break; case MMS_CODE_DELIVERYREPORT: @@ -681,7 +652,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) mmsHeader.deliveryReport = (MmsReport)fieldValue; - MSG_DEBUG("X-Mms-Delivery-Report =[0x%02x][%s]", oneByte, MmsDebugGetMmsReport(mmsHeader.deliveryReport)); + MSG_SEC_INFO("X-Mms-Delivery-Report =[0x%02x][%s]", oneByte, MmsDebugGetMmsReport(mmsHeader.deliveryReport)); break; case MMS_CODE_DELIVERYTIME: @@ -719,7 +690,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) goto __CATCH; } } - MSG_DEBUG("X-Mms-Delivery-Time : type = [%d], time= [%u]", mmsHeader.deliveryTime.type, mmsHeader.deliveryTime.time); + MSG_SEC_INFO("X-Mms-Delivery-Time : type = [%d], time= [%u]", mmsHeader.deliveryTime.type, mmsHeader.deliveryTime.time); break; case MMS_CODE_EXPIRYTIME: @@ -753,7 +724,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) mmsHeader.expiryTime.type = MMS_TIMETYPE_RELATIVE; if (__MmsBinaryDecodeInteger(pFile, (UINT32*)&mmsHeader.expiryTime.time, &tmpIntLen, totalLength) == false) { - MSG_DEBUG("__MmsBinaryDecodeInteger fail..."); + MSG_INFO("__MmsBinaryDecodeInteger fail..."); goto __CATCH; } } @@ -780,7 +751,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) } } - MSG_DEBUG("X-Mms-Message-Class =[%s]", MmsDebugGetMsgClass(mmsHeader.msgClass)); + MSG_SEC_INFO("X-Mms-Message-Class =[%s]", MmsDebugGetMsgClass(mmsHeader.msgClass)); break; case MMS_CODE_MSGSIZE: @@ -790,7 +761,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) goto __CATCH; } - MSG_DEBUG("X-Mms-Message-Size = [%d]", mmsHeader.msgSize); + MSG_SEC_INFO("X-Mms-Message-Size = [%d]", mmsHeader.msgSize); break; case MMS_CODE_MSGSTATUS: @@ -801,7 +772,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) } mmsHeader.msgStatus = (msg_delivery_report_status_t)MmsGetBinaryType(MmsCodeMsgStatus, (UINT16)(oneByte & 0x7F)); - MSG_DEBUG("X-Mms-Status = [%s]", MmsDebugGetMsgStatus(mmsHeader.msgStatus)); + MSG_SEC_INFO("X-Mms-Status = [%s]", MmsDebugGetMsgStatus(mmsHeader.msgStatus)); break; case MMS_CODE_MSGTYPE: @@ -812,7 +783,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) } mmsHeader.type = (MmsMsgType)MmsGetBinaryType(MmsCodeMsgType, (UINT16)(oneByte & 0x7F)); - MSG_DEBUG("X-Mms-Message-Type = [%s]", MmsDebugGetMsgType(mmsHeader.type)); + MSG_SEC_INFO("X-Mms-Message-Type = [%s]", MmsDebugGetMsgType(mmsHeader.type)); break; case MMS_CODE_PRIORITY: @@ -822,7 +793,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) goto __CATCH; } mmsHeader.priority = (MmsPriority)MmsGetBinaryType(MmsCodePriority, (UINT16)(oneByte & 0x7F)); - MSG_DEBUG("X-Mms-Priority = [%d]", mmsHeader.priority); + MSG_SEC_INFO("X-Mms-Priority = [%d]", mmsHeader.priority); break; case MMS_CODE_READREPLY: @@ -832,7 +803,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) goto __CATCH; } mmsHeader.readReply = (MmsReport)MmsGetBinaryType(MmsCodeReadReply, (UINT16)(oneByte & 0x7F)); - MSG_DEBUG("X-Mms-Read-Report = [0x%02x][%s]", oneByte, MmsDebugGetMmsReport(mmsHeader.readReply)); + MSG_SEC_INFO("X-Mms-Read-Report = [0x%02x][%s]", oneByte, MmsDebugGetMmsReport(mmsHeader.readReply)); break; case MMS_CODE_REPORTALLOWED: @@ -842,7 +813,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) goto __CATCH; } mmsHeader.reportAllowed = (MmsReportAllowed)MmsGetBinaryType(MmsCodeReportAllowed, (UINT16)(oneByte & 0x7F)); - MSG_DEBUG("X-Mms-Report-Allowed = [%d]", MmsDebugGetMmsReportAllowed(mmsHeader.reportAllowed)); + MSG_SEC_INFO("X-Mms-Report-Allowed = [%d]", MmsDebugGetMmsReportAllowed(mmsHeader.reportAllowed)); break; case MMS_CODE_SENDERVISIBILLITY: @@ -852,7 +823,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) goto __CATCH; } mmsHeader.hideAddress= (MmsSenderVisible)!(MmsGetBinaryType(MmsCodeSenderVisibility, (UINT16)(oneByte &0x7F))); - MSG_DEBUG("X-Mms-Sender-Visibility = [%d]", mmsHeader.hideAddress); + MSG_SEC_INFO("X-Mms-Sender-Visibility = [%d]", mmsHeader.hideAddress); break; case MMS_CODE_TRID: @@ -861,7 +832,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) MSG_DEBUG("Transaction ID Too Long"); goto __CATCH; } - MSG_DEBUG("X-Mms-Transaction-Id = [%s]", mmsHeader.szTrID); + MSG_SEC_INFO("X-Mms-Transaction-Id = [%s]", mmsHeader.szTrID); break; case MMS_CODE_VERSION: @@ -871,7 +842,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) } mmsHeader.version = oneByte; - MSG_DEBUG("X-Mms-MMS-Version = [0x%02x]", mmsHeader.version); + MSG_SEC_INFO("X-Mms-MMS-Version = [0x%02x]", mmsHeader.version); break; case MMS_CODE_CONTENTTYPE: @@ -896,7 +867,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) } mmsHeader.readStatus = (msg_read_report_status_t)MmsGetBinaryType(MmsCodeReadStatus, (UINT16)(oneByte & 0x7F)); - MSG_DEBUG("X-Mms-Read-Status = [%s]", MmsDebugGetMmsReadStatus(mmsHeader.readStatus)); + MSG_SEC_INFO("X-Mms-Read-Status = [%s]", MmsDebugGetMmsReadStatus(mmsHeader.readStatus)); break; case MMS_CODE_REPLYCHARGING: @@ -909,7 +880,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) } mmsHeader.replyCharge.chargeType = (MmsReplyChargeType)MmsGetBinaryType(MmsCodeReplyCharging, (UINT16)(oneByte & 0x7F)); - MSG_DEBUG("X-Mms-Reply-Charging = [%d]", mmsHeader.replyCharge.chargeType); + MSG_SEC_INFO("X-Mms-Reply-Charging = [%d]", mmsHeader.replyCharge.chargeType); break; case MMS_CODE_REPLYCHARGINGDEADLINE: @@ -942,7 +913,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) } } - MSG_DEBUG("X-Mms-Reply-Charging-Deadline : type = [%d], time = [%u]", mmsHeader.replyCharge.deadLine.type, mmsHeader.replyCharge.deadLine.time); + MSG_SEC_INFO("X-Mms-Reply-Charging-Deadline : type = [%d], time = [%u]", mmsHeader.replyCharge.deadLine.type, mmsHeader.replyCharge.deadLine.time); // DRM_TEMPLATE - end break; @@ -953,7 +924,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) MSG_DEBUG("1. __MmsBinaryDecodeText fail. (szReplyChargingID)"); goto __CATCH; } - MSG_DEBUG("X-Mms-Reply-Charging-ID = [%s]", mmsHeader.replyCharge.szChargeID); + SECURE_SLOGD("X-Mms-Reply-Charging-ID = [%s]", mmsHeader.replyCharge.szChargeID); break; case MMS_CODE_REPLYCHARGINGSIZE: @@ -963,7 +934,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) MSG_DEBUG("MMS_CODE_REPLYCHARGINGSIZE is invalid"); goto __CATCH; } - MSG_DEBUG("X-Mms-Reply-Charging-Size = [%d]", mmsHeader.replyCharge.chargeSize); + MSG_SEC_INFO("X-Mms-Reply-Charging-Size = [%d]", mmsHeader.replyCharge.chargeSize); break; case MMS_CODE_PREVIOUSLYSENTBY: @@ -1085,7 +1056,7 @@ __RETURN: free(pLastBcc); } - MSG_DEBUG("## Decode Header Success ##"); + MSG_INFO("## Decode Header Success ##"); MSG_END(); return true; @@ -1183,10 +1154,6 @@ bool MmsBinaryDecodeMsgBody(FILE *pFile, char *szFilePath, int totalLength) break; } -#ifdef __SUPPORT_DRM__ - mmsHeader.drmType = MsgGetDRMType(&mmsHeader.msgType, &mmsHeader.msgBody); -#endif - __RETURN: MSG_END(); return true; @@ -1281,8 +1248,7 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value } if (oneByte > 0x7f) { - pMsgType->param.type = MmsGetBinaryType(MmsCodeContentType, - (UINT16)(oneByte & 0x7f)); + pMsgType->param.type = MimeGetMimeIntFromBi((UINT16)(oneByte & 0x7f));//MmsGetBinaryType(MmsCodeContentType,(UINT16)(oneByte & 0x7f)); if (__MmsBinaryDecodeCheckAndDecreaseLength(&valueLength, 1) == false) goto __RETURN; } else { @@ -1290,8 +1256,7 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value textLength = 0; szTypeString = __MmsBinaryDecodeText2(pFile, totalLength, &textLength); - pMsgType->param.type = MmsGetTextType(MmsCodeContentType, szTypeString); - + pMsgType->param.type = MimeGetMimeIntFromMimeString(szTypeString); if (szTypeString) { free(szTypeString); szTypeString = NULL; @@ -1390,18 +1355,19 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value pMsgType->param.szApplicationID = (char*) malloc(textLength + 1); memset(pMsgType->param.szApplicationID, 0, textLength + 1); strncpy(pMsgType->param.szApplicationID, szTypeValue, textLength); - MSG_DEBUG("Application-ID:%s",pMsgType->param.szApplicationID); + MSG_SEC_DEBUG("Application-ID:%s",pMsgType->param.szApplicationID); } else if (strcasecmp(szTypeString,"Reply-To-Application-ID") == 0) { pMsgType->param.szReplyToApplicationID= (char*) malloc(textLength + 1); memset(pMsgType->param.szReplyToApplicationID, 0, textLength + 1); strncpy(pMsgType->param.szReplyToApplicationID, szTypeValue, textLength); - MSG_DEBUG("ReplyToApplication-ID:%s",pMsgType->param.szReplyToApplicationID); + MSG_SEC_DEBUG("ReplyToApplication-ID:%s",pMsgType->param.szReplyToApplicationID); #endif } + + MSG_DEBUG("Unsupported parameter(%s)\n", szTypeValue); free(szTypeValue); szTypeValue = NULL; - MSG_DEBUG("Unsupported parameter(%s)\n", szTypeValue); if (__MmsBinaryDecodeCheckAndDecreaseLength(&valueLength, textLength) == false) goto __RETURN; } @@ -1477,7 +1443,10 @@ static int __MmsBinaryDecodeContentType(FILE *pFile, MsgType *pMsgType, int tota if (oneByte > 0x7F) { /* Short-integer */ - pMsgType->type = MmsGetBinaryType(MmsCodeContentType, (UINT16)(oneByte & 0x7F)); + pMsgType->type = MimeGetMimeIntFromBi((UINT16)(oneByte & 0x7f)); + + MSG_SEC_DEBUG("Constrained-media : Short-integer : Content Type = [0x%04x], MimeType = [0x%04x]", oneByte, pMsgType->type); + length = 1; } else { char *pszTemp = NULL; @@ -1489,6 +1458,9 @@ static int __MmsBinaryDecodeContentType(FILE *pFile, MsgType *pMsgType, int tota szTypeString = __MmsBinaryDecodeText2(pFile, totalLength, &textLength); if (szTypeString && (strchr(szTypeString, ';')) != NULL) { + + MSG_SEC_DEBUG("Constrained-media : Extension-Media : Content Type with delimiter = [%s]", szTypeString); + pszTemp = __MsgGetStringUntilDelimiter(szTypeString, ';'); if (pszTemp) { free(szTypeString); @@ -1496,7 +1468,9 @@ static int __MmsBinaryDecodeContentType(FILE *pFile, MsgType *pMsgType, int tota } } - pMsgType->type = MmsGetTextType(MmsCodeContentType, szTypeString); + pMsgType->type = MimeGetMimeIntFromMimeString(szTypeString); + + MSG_SEC_DEBUG("Constrained-media : Extension-Media : Content Type = [%s], MimeType = [0x%04x]", szTypeString, pMsgType->type); length = textLength; @@ -1520,7 +1494,8 @@ static int __MmsBinaryDecodeContentType(FILE *pFile, MsgType *pMsgType, int tota if (oneByte > 0x7F) { /* Well-known-media */ - pMsgType->type = MmsGetBinaryType(MmsCodeContentType, (UINT16)(oneByte & 0x7F)); + pMsgType->type = MimeGetMimeIntFromBi((UINT16)(oneByte & 0x7f)); + MSG_SEC_DEBUG("Content-general-form : Well-known-media : Content Type = [0x%04x], MimeType = [0x%04x]", oneByte, pMsgType->type); valueLength--; } else { /* Extension-Media */ @@ -1528,7 +1503,11 @@ static int __MmsBinaryDecodeContentType(FILE *pFile, MsgType *pMsgType, int tota textLength = 0; szTypeString = __MmsBinaryDecodeText2(pFile, totalLength, &textLength); - pMsgType->type = MmsGetTextType(MmsCodeContentType, szTypeString); + + pMsgType->type = MimeGetMimeIntFromMimeString(szTypeString); + + MSG_SEC_DEBUG("Content-general-form : Extension-Media : Content Type = [%s], MimeType = [0x%04x]", szTypeString, pMsgType->type); + valueLength -= textLength; if (szTypeString) { @@ -1537,7 +1516,7 @@ static int __MmsBinaryDecodeContentType(FILE *pFile, MsgType *pMsgType, int tota } } - MSG_DEBUG("Content-Type = [%s]", MmsDebugGetMimeType((MimeType)pMsgType->type)); + MSG_SEC_DEBUG("Content-Type = [%s]", MmsDebugGetMimeType((MimeType)pMsgType->type)); if (__MmsBinaryDecodeParameter(pFile, pMsgType, valueLength, totalLength) == false) { MSG_DEBUG("Content-Type parameter fail"); @@ -1610,21 +1589,14 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head goto __CATCH; } - szSrc = MsgChangeHexString(pLatinBuff); - + szSrc = __MsgConvertLatin2UTF8FileName(pLatinBuff); if (szSrc) { - strcpy(pLatinBuff, szSrc); + snprintf(pMsgType->szContentLocation, sizeof(pMsgType->szContentLocation), "%s", szSrc); + MSG_DEBUG("Content Location : [%s]", pMsgType->szContentLocation); free(szSrc); szSrc = NULL; } - textLength = strlen(pLatinBuff); - - if (__MsgLatin2UTF ((unsigned char*)pMsgType->szContentLocation, MMS_CONTENT_ID_LEN + 1, (unsigned char*)pLatinBuff, textLength) < 0) { - MSG_DEBUG("MsgLatin2UTF fail"); - goto __CATCH; - } - free(pLatinBuff); pLatinBuff = NULL; @@ -1635,7 +1607,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head case 0x40: // Content-ID { - char szContentID[MMS_CONTENT_ID_LEN + 1]; + char szContentID[MMS_CONTENT_ID_LEN + 1] = {0, }; pLatinBuff = (char *)malloc(MMS_CONTENT_ID_LEN + 1); if (pLatinBuff == NULL) @@ -1648,23 +1620,18 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head goto __CATCH; } - szSrc = MsgChangeHexString(pLatinBuff); - + szSrc = __MsgConvertLatin2UTF8FileName(pLatinBuff); if (szSrc) { - strcpy(pLatinBuff, szSrc); + snprintf(szContentID, sizeof(szContentID), "%s", szSrc); + MSG_DEBUG("Content ID : [%s]", szContentID); free(szSrc); szSrc = NULL; } - textLength = strlen(pLatinBuff); - if (__MsgLatin2UTF ((unsigned char*)szContentID, MMS_CONTENT_ID_LEN + 1, (unsigned char*)pLatinBuff, textLength) < 0) { - MSG_DEBUG("MsgLatin2UTF fail"); - goto __CATCH; - } free(pLatinBuff); pLatinBuff = NULL; - removeLessGreaterMark(szContentID, pMsgType->szContentID, sizeof(pMsgType->szContentID));//remove "< >" + MmsRemoveLessGreaterChar(szContentID, pMsgType->szContentID, sizeof(pMsgType->szContentID));//remove "< >" if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, length) == false) goto __RETURN; @@ -1701,7 +1668,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head if (oneByte >= 0x80) { pMsgType->disposition = MmsGetBinaryType(MmsCodeMsgDisposition, (UINT16)(oneByte & 0x7F)); - if (pMsgType->disposition == INVALID_HOBJ) { + if (pMsgType->disposition == -1) { MSG_DEBUG("Content-Disposition MmsGetBinaryType fail."); pMsgType->disposition = MSG_DISPOSITION_ATTACHMENT; // default } @@ -1972,7 +1939,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head goto __CATCH; } - removeLessGreaterMark(szContentID, pMsgType->szContentID, sizeof(pMsgType->szContentID));//remove "< >" + MmsRemoveLessGreaterChar(szContentID, pMsgType->szContentID, sizeof(pMsgType->szContentID));//remove "< >" free(pLatinBuff); pLatinBuff = NULL; @@ -2073,7 +2040,7 @@ static bool __MmsBinaryDecodeEntries(FILE *pFile, UINT32 *npEntries, int totalLe goto __CATCH; } - MSG_DEBUG("Number of Entries = [%d]", *npEntries); + MSG_INFO("Number of Entries = [%d]", *npEntries); return true; @@ -2157,7 +2124,7 @@ static bool __MmsBinaryDecodeMultipart(FILE *pFile, char *szFilePath, MsgType *p UINT32 nEntries = 0; MsgMultipart *pMultipart = NULL; MsgMultipart *pLastMultipart = NULL; - MsgMultipart *pPreMultipart = NULL; +// MsgMultipart *pPreMultipart = NULL; int offset = 0; int index = 0; @@ -2186,10 +2153,12 @@ static bool __MmsBinaryDecodeMultipart(FILE *pFile, char *szFilePath, MsgType *p MSG_DEBUG("decoding [%d]th multipart", index); offset = __MmsGetDecodeOffset(); - if (offset >= totalLength) - goto __RETURN; + if (offset >= totalLength) { + MSG_DEBUG("offset is over totalLength"); + break; + } - if ((pMultipart = __MsgAllocMultipart()) == NULL) { + if ((pMultipart = MmsAllocMultipart()) == NULL) { MSG_DEBUG("MsgAllocMultipart Fail"); goto __CATCH; } @@ -2220,18 +2189,18 @@ static bool __MmsBinaryDecodeMultipart(FILE *pFile, char *szFilePath, MsgType *p if (pLastMultipart == NULL) { pMsgBody->body.pMultipart = pMultipart; pLastMultipart = pMultipart; - pPreMultipart = NULL; +// pPreMultipart = NULL; } else { pLastMultipart->pNext = pMultipart; pLastMultipart = pMultipart; - pPreMultipart = pMultipart; +// pPreMultipart = pMultipart; } pMsgType->contentSize += pMultipart->pBody->size; nEntries--; - __MmsDebugPrintMulitpartEntry(pMultipart, index++); + MmsPrintMulitpart(pMultipart, index++); } @@ -2244,7 +2213,7 @@ static bool __MmsBinaryDecodeMultipart(FILE *pFile, char *szFilePath, MsgType *p goto __CATCH; } -__RETURN: +//__RETURN: return true; __CATCH: @@ -2357,35 +2326,6 @@ static bool __MmsBinaryDecodeEachPart(FILE *pFile, char *szFilePath, MsgType *pM break; - -#ifdef __SUPPORT_DRM__ - - case MIME_APPLICATION_VND_OMA_DRM_MESSAGE: /* Contains forwardLock OR combined-delivery media part */ - MSG_DEBUG("MIME_APPLICATION_VND_OMA_DRM_MESSAGE Part"); - - if (__MmsBinaryDecodeDRMContent(pFile, szFilePath, pMsgType, pMsgBody, bodyLength, totalLength) == false) - goto __CATCH; - - offset = __MmsGetDecodeOffset(); - if (offset >= totalLength) - goto __RETURN; - - break; - - case MIME_APPLICATION_VND_OMA_DRM_CONTENT: /* Contains seperate-delivery media part (DCF) */ - - MSG_DEBUG("MIME_APPLICATION_VND_OMA_DRM_CONTENT Part"); - - if (__MmsBinaryDecodeDRMContent(pFile, szFilePath, pMsgType, pMsgBody, bodyLength, totalLength) == false) - goto __CATCH; - - offset = __MmsGetDecodeOffset(); - if (offset >= totalLength) - goto __RETURN; - - break; -#endif - default: MSG_DEBUG("Normal Part"); @@ -2414,655 +2354,152 @@ __CATCH: return false; } -#ifdef __SUPPORT_DRM__ -static bool __MmsBinaryDecodeDRMContent(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, unsigned int bodyLength, int totalLength) -{ - int offset = 0; - char szTempFilePath[MSG_FILEPATH_LEN_MAX] = MSG_DATA_PATH"drm.dcf"; - char *pRawData = NULL; - bool isFileCreated = false; - - MSG_DEBUG("bodyLength: %d\n", bodyLength); - - offset = __MmsGetDecodeOffset(); - - if (offset >= totalLength) - goto __RETURN; - - if (szFilePath != NULL) - strncpy(pMsgBody->szOrgFilePath, szFilePath, strlen(szFilePath)); - if (szFilePath != NULL) - strncpy(pMsgType->szOrgFilePath, szFilePath, strlen(szFilePath)); +/* -------------------------------------------------------------------- + * + * B I N A R Y D E C D E U T I L I T Y + * + * --------------------------------------------------------------------*/ - pRawData = (char *)malloc(bodyLength); - if (pRawData == NULL) { - MSG_DEBUG("pRawData alloc FAIL"); - goto __CATCH; - } +bool __MmsBinaryDecodeGetOneByte(FILE *pFile, UINT8 *pOneByte, int totalLength) +{ + int length = gMmsDecodeMaxLen - gCurMmsDecodeBuffPos; - if (MsgFseek(pFile, offset, SEEK_SET) < 0) { - MSG_DEBUG("MsgFseek() returns -1"); - goto __CATCH; - } - if (MsgReadFile(pRawData, sizeof(char), bodyLength, pFile) != (size_t)bodyLength) { - MSG_DEBUG("FmReadFile() returns false"); - goto __CATCH; - } - if (MsgOpenCreateAndOverwriteFile(szTempFilePath, pRawData, bodyLength) == false) { - MSG_DEBUG("MsgOpenCreateAndOverwriteFile() returns false"); + if (pFile == NULL || pOneByte == NULL) + { + MSG_DEBUG("invalid file or buffer"); goto __CATCH; } - isFileCreated = true; - - if (pMsgType->type == MIME_APPLICATION_VND_OMA_DRM_MESSAGE) { - if (MsgDRM2GetDRMInfo(szTempFilePath, pMsgType) == false) { - MSG_DEBUG("MsgDRM2GetDRMInfo() returns false"); + if (length < 1) { + if (__MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset, + gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) { + MSG_DEBUG("fail to load to buffer"); goto __CATCH; } } - if(remove(szTempFilePath) != 0) - MSG_DEBUG("remove fail"); - isFileCreated = false; - - if (__MmsBinaryDecodeMovePointer(pFile, offset + bodyLength, totalLength) == false) - goto __CATCH; - -__RETURN: - - if (pRawData) { - free(pRawData); - pRawData = NULL; - } + *pOneByte = gpCurMmsDecodeBuff[gCurMmsDecodeBuffPos++]; return true; __CATCH: - if (isFileCreated) - if(remove(szTempFilePath) != 0) - MSG_DEBUG("remove fail"); - - if (pRawData) { - free(pRawData); - pRawData = NULL; - } - return false; } -static int __MmsDrm2BinaryEncodeUintvarLen(UINT32 integer) +/* + * @remark: bufLen < gMmsDecodeMaxLen + */ +bool __MmsBinaryDecodeGetBytes(FILE *pFile, char *szBuff, int bufLen, int totalLength) { - UINT32 length = 0; - - /* Find encoded unitvar length */ - if (integer <= MMS_UINTVAR_LENGTH_1) { - length = 1; - } else { - if (integer <= MMS_UINTVAR_LENGTH_2) { - length = 2; - } else { - if (integer <= MMS_UINTVAR_LENGTH_3) { - length = 3; - } else { - length = 4; - } - } - } - - return length; -} + int length = gMmsDecodeMaxLen - gCurMmsDecodeBuffPos; + int i = 0; -static bool __MmsDrm2BinaryEncodeUintvar(UINT32 integer, int length, char *pszOutput) -{ - const char ZERO = 0x00; - int i = 2; - char szReverse[MSG_STDSTR_LONG] = {0, }; - union { - UINT32 integer; - char bytes[4]; - } source; - source.integer = integer; - memset(szReverse, 0, MSG_STDSTR_LONG); + if (pFile == NULL || szBuff == NULL || bufLen == 0 || bufLen > gMmsDecodeMaxLen) + goto __CATCH; - /* Seperate integer to 4 1 byte integer */ - szReverse[3] = source.bytes[3] & 0x0f; - szReverse[0] = source.bytes[0]; - szReverse[0] = szReverse[0] & 0x7f; + memset(szBuff, 0, bufLen); - while (length >= i) {// initially, i = 2 - /* Move integer bit to proper position */ - source.integer = source.integer << 1; - source.integer = source.integer >> 8; - source.bytes[3] = ZERO; + if (length < bufLen) { + if (__MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset, + gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) { + MSG_DEBUG("fail to load to buffer"); + goto __CATCH; + } + } - /* Retrive 1 encode uintvar */ - szReverse[i-1] = source.bytes[0]; - szReverse[i-1] = szReverse[i-1] | 0x80; - i++; + for (i = 0; i < bufLen - 1; i++) { + szBuff[i] = gpCurMmsDecodeBuff[gCurMmsDecodeBuffPos++]; } - for (i=0; i < length; i++) - pszOutput[i] = szReverse[length - i - 1]; + gCurMmsDecodeBuffPos++; //NULL return true; + +__CATCH: + return false; } -static int __MmsDrm2GetEntriesValueLength(FILE *pFile, int orgOffset) +bool __MmsBinaryDecodeGetLongBytes(FILE *pFile, char *szBuff, int bufLen, int totalLength) { - char szEntries[5] = {0, }; - UINT8 oneByte = 0; - int j = 0; //j is the length of nEntries value - - if (MsgReadFile(szEntries, sizeof(char), 4, pFile) != (size_t)4) { - MSG_DEBUG("FmReadFile() returns false"); - return false; - } + int iPos = 0; - while (true) { - oneByte = szEntries[j++]; + if (pFile == NULL || szBuff == NULL || bufLen == 0) + goto __CATCH; - if (oneByte <= 0x7f) - break; - } + memset(szBuff, 0, bufLen); - //move file pointer to point nEntries - if (MsgFseek(pFile, orgOffset, SEEK_SET) < 0) { - MSG_DEBUG("fail to seek file pointer"); - return false; + if (__MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset, + gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) { + MSG_DEBUG("fail to load to buffer"); + goto __CATCH; } - return j; -} - -static bool __MmsDrm2WriteDataToConvertedFile(FILE *pSrcFile, FILE *pDestinationFile, char *pszMmsLoadTempBuf, int length, int bufLen) -{ - int loadLen = 0, totalLoadLen = 0, nRead = 0; - - for (int i=0; i<(length/bufLen)+1; i++) { - loadLen = (length-totalLoadLen < bufLen) ? length-totalLoadLen : bufLen; - - memset(pszMmsLoadTempBuf, 0, MMS_DRM2_CONVERT_BUFFER_MAX + 1); - - nRead = MsgReadFile(pszMmsLoadTempBuf, sizeof(char), loadLen, pSrcFile); - if (nRead != (size_t)loadLen) { - MSG_DEBUG("FmReadFile() returns false, nRead = %d, loadLen = %d", nRead, loadLen); + while ((bufLen - iPos) >= gMmsDecodeMaxLen) { + if (__MmsBinaryDecodeGetBytes(pFile, szBuff + iPos, gMmsDecodeMaxLen, totalLength) == false) { + MSG_DEBUG("__MmsBinaryDecodeGetBytes fail"); + goto __CATCH; } - if (MsgWriteFile(pszMmsLoadTempBuf, sizeof(char), nRead, pDestinationFile) != (size_t)nRead) { - MSG_DEBUG("File Writing is failed."); - return false; + iPos += gMmsDecodeMaxLen; + } + + if ((bufLen - iPos) > 0) { + if (__MmsBinaryDecodeGetBytes(pFile, szBuff + iPos, (bufLen - iPos), totalLength) == false) { + MSG_DEBUG("__MmsBinaryDecodeGetBytes fail"); + goto __CATCH; } - totalLoadLen += nRead; + iPos += (bufLen - iPos); } return true; -} -/************************************************************************* - * description : make new message file converting CD & FL part of original message file to SD type - * argument : void - * return value - - bool : result of converting -**************************************************************************/ -bool MmsDrm2ConvertMsgBody(char *szOriginFilePath) -{ - FILE *pFile = NULL; - FILE *hConvertedFile = NULL; - FILE *hTempFile = NULL; - FILE *hFile = NULL; - MsgMultipart *pMultipart = NULL; - char szTempFilePath[MSG_FILEPATH_LEN_MAX] = MSG_DATA_PATH"Drm_Convert"; - char szTempFile[MSG_FILEPATH_LEN_MAX] = MSG_DATA_PATH"temp.dm"; - char *pszMmsLoadTempBuf = NULL; - char *pszOrgData = NULL; - int length = 0; - int bufLen = MMS_DRM2_CONVERT_BUFFER_MAX; - int curOffset = 0; +__CATCH: + return false; +} - MSG_DEBUG("start convert~~~~~~"); +/** + * Decode uintvar to 32bit unsigned integer + * + * @param pEncodedData [in] encoded data + * @param pUintVar [out] Decode uintvar (32bit unsigned integer) + * @return The length of uintvar (-1, if cannot be converted to a uintvar) + * + * 0 XXXXXXX -> 0-bit: continue bit & 1~7bit: integer value + * - ------- + */ +static const UINT32 uintvarDecodeTable[] = { 0x00000001, 0x00000080, 0x00004000, 0x00100000, 0x08000000 }; - pFile = MsgOpenFile(szOriginFilePath, "rb"); - if (pFile == NULL) { - MSG_DEBUG("Open decode temporary file fail"); - goto __CATCH; - } +static int __MmsBinaryDecodeUintvar(FILE *pFile, UINT32 *pUintVar, int totalLength) +{ + UINT8 count = 0; + UINT8 oneByte = 0; + UINT32 decodedUintvar = 0; + UINT8 iBuff[5] = {0}; + int length = MSG_MMS_DECODE_BUFFER_MAX - gCurMmsDecodeBuffPos; - hConvertedFile = MsgOpenFile(MMS_DECODE_DRM_CONVERTED_TEMP_FILE, "wb+"); - if (hConvertedFile == NULL) { - MSG_DEBUG("Open decode temporary file fail"); - goto __CATCH; - } - pszMmsLoadTempBuf = (char*)malloc(MMS_DRM2_CONVERT_BUFFER_MAX + 1); - if (pszMmsLoadTempBuf == NULL) { - MSG_DEBUG("malloc for pszMmsLoadTempBuf failed"); - goto __CATCH; - } - memset(pszMmsLoadTempBuf, 0, MMS_DRM2_CONVERT_BUFFER_MAX + 1); + if (pFile == NULL || pUintVar == NULL) + return -1; - // MMS Header copy - length = mmsHeader.msgBody.offset; - if (__MmsDrm2WriteDataToConvertedFile(pFile, hConvertedFile, pszMmsLoadTempBuf, length, bufLen) == false) { - MSG_DEBUG("Write header data fail"); - goto __CATCH; + if (length < 5) { + if (__MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset, + gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) { + MSG_DEBUG("fail to load to buffer"); + goto __CATCH; + } } - curOffset += length; //change offset - - // MMS Body copy - if (MsgIsMultipart(mmsHeader.msgType.type) == true) - { - // nEntries copy - length = __MmsDrm2GetEntriesValueLength(pFile, curOffset); // getting nEntries value's length - - if (__MmsDrm2WriteDataToConvertedFile(pFile, hConvertedFile, pszMmsLoadTempBuf, length, bufLen) == false) { - MSG_DEBUG("Write nEntries fail"); + while (true) { + if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) goto __CATCH; - } - - curOffset += length; //change offset - - // each Multipart entry copy - pMultipart = mmsHeader.msgBody.body.pMultipart; - - while (pMultipart) { - if (pMultipart->type.type == MIME_APPLICATION_VND_OMA_DRM_MESSAGE) { - int orgDataLen = pMultipart->pBody->size; - int nSize = 0; - - MSG_DEBUG("Write MIME_APPLICATION_VND_OMA_DRM_MESSAGE multipart data(orgDataLen = %d).\n", orgDataLen); - - pszOrgData = (char *)malloc(orgDataLen + 1); - if (pszOrgData == NULL) { - MSG_DEBUG("pszOrgData is NULL"); - goto __CATCH; - } - memset(pszOrgData, 0, orgDataLen + 1); - - // move file pointer to data - if (MsgFseek(pFile, pMultipart->pBody->offset, SEEK_SET) < 0) { - MSG_DEBUG("fail to seek file pointer 1"); - goto __CATCH; - } - - if (MsgReadFile(pszOrgData, sizeof(char), orgDataLen, pFile) != (size_t)orgDataLen) { - MSG_DEBUG("FmReadFile() returns false for orgData"); - goto __CATCH; - } - - if((hFile = MsgOpenFile(szTempFile, "wb+")) == NULL) { - MSG_DEBUG("file open failed [%s]", szTempFile); - goto __CATCH; - } - - if (MsgWriteFile(pszOrgData, sizeof(char), orgDataLen, hFile) != (size_t)orgDataLen) { - MSG_DEBUG("File write error"); - goto __CATCH; - } - - if (pszOrgData) { - free(pszOrgData); - pszOrgData = NULL; - } - - MsgFflush(hFile); - MsgCloseFile(hFile); - - hFile = NULL; - - // --> invoking drm agent api, converting data part start - MSG_DEBUG("start data part convert by callling drm agent api"); - - int ret = 0; - ret = MsgDrmConvertDmtoDcfType(szTempFile, szTempFilePath); - MSG_DEBUG("MsgDrmConvertDmtoDcfType returned %s", ret ? "true": "false"); - - if (MsgGetFileSize(szTempFilePath, &nSize) == false) { - MSG_DEBUG("MsgGetFileSize error"); - goto __CATCH; - } - MSG_DEBUG("end data part convert(converted data len = %d)\n", nSize); - - // move file pointer to the head of multipart - if (MsgFseek(pFile, curOffset, SEEK_SET) < 0) { - MSG_DEBUG("fail to seek file pointer 2"); - goto __CATCH; - } - - // read headerLen, dataLen - length = pMultipart->type.offset - curOffset; - memset(pszMmsLoadTempBuf, 0, MMS_DRM2_CONVERT_BUFFER_MAX + 1); - if (MsgReadFile(pszMmsLoadTempBuf, sizeof(char), length, pFile) != (size_t)length) { - MSG_DEBUG("FmReadFile() returns false for headerLen, dataLen"); - goto __CATCH; - } - - curOffset += length; - - // change dataLen based on converted data - { - UINT8 oneByte = 0; - int j = 0; - int encodeLen = 0; - char szOutput[MSG_STDSTR_LONG] = {0, }; - - while (true) { - oneByte = pszMmsLoadTempBuf[j++]; - - if (oneByte <= 0x7f) - break; - } - - encodeLen = __MmsDrm2BinaryEncodeUintvarLen((UINT32)nSize); - __MmsDrm2BinaryEncodeUintvar((UINT32)nSize, encodeLen, szOutput); - - strncpy(&(pszMmsLoadTempBuf[j]), szOutput, encodeLen); - pszMmsLoadTempBuf[j+encodeLen] = '\0'; - - if (MsgWriteFile(pszMmsLoadTempBuf, sizeof(char), length, hConvertedFile) != (size_t)length) { - MSG_DEBUG("FmWriteFile() returns false for dateLen"); - goto __CATCH; - } - } - - - length = pMultipart->pBody->offset - pMultipart->type.offset; - - if (__MmsDrm2WriteDataToConvertedFile(pFile, hConvertedFile, pszMmsLoadTempBuf, length, bufLen) == false) { - MSG_DEBUG("Write content type, headers fail"); - goto __CATCH; - } - - curOffset += length; - - // write converted data - hTempFile = MsgOpenFile(szTempFilePath, "rb"); - if (hTempFile == NULL) { - MSG_DEBUG("Open decode temporary file fail"); - goto __CATCH; - } - - length = nSize; - - if (__MmsDrm2WriteDataToConvertedFile(hTempFile, hConvertedFile, pszMmsLoadTempBuf, length, bufLen) == false) { - MSG_DEBUG("Write converted data fail"); - goto __CATCH; - } - - if (hTempFile != NULL) { - MsgCloseFile(hTempFile); - hTempFile = NULL; - } - - curOffset += pMultipart->pBody->size; - - // move file pointer to the head of multipart - if (MsgFseek(pFile, curOffset, SEEK_SET) < 0) { - MSG_DEBUG("fail to seek file pointer"); - goto __CATCH; - } - } else { // it doesn't need to convert if it is not CD or FL - MSG_DEBUG("Write normal multipart data"); - - length = pMultipart->pBody->offset + pMultipart->pBody->size - curOffset; - - if (__MmsDrm2WriteDataToConvertedFile(pFile, hConvertedFile, pszMmsLoadTempBuf, length, bufLen) == false) { - MSG_DEBUG("Write multipart data fail"); - goto __CATCH; - } - - curOffset += length; - } - - pMultipart = pMultipart->pNext; - } - } - - MSG_DEBUG("end convert~~~~~~"); - - if (pFile != NULL) { - MsgCloseFile(pFile); - pFile = NULL; - } - - if (hConvertedFile != NULL) { - MsgCloseFile(hConvertedFile); - hConvertedFile = NULL; - } - - if (pszMmsLoadTempBuf) { - free(pszMmsLoadTempBuf); - pszMmsLoadTempBuf = NULL; - } - - if(remove(szTempFile) != 0) - MSG_DEBUG("remove fail"); - if(remove(szTempFilePath) != 0) - MSG_DEBUG("remove fail"); - - return true; - -__CATCH: - - if (pFile != NULL) { - MsgCloseFile(pFile); - pFile = NULL; - } - - if (hConvertedFile != NULL) { - MsgCloseFile(hConvertedFile); - hConvertedFile = NULL; - } - - if (hTempFile != NULL) { - MsgCloseFile(hTempFile); - hTempFile = NULL; - } - - if (pszMmsLoadTempBuf) { - free(pszMmsLoadTempBuf); - pszMmsLoadTempBuf = NULL; - } - - if (pszOrgData) { - free(pszOrgData); - pszOrgData = NULL; - } - - if (hFile != NULL) - { - MsgCloseFile(hFile); - hFile = NULL; - } - - if (remove(szTempFile) != 0) - MSG_DEBUG("remove fail"); - - if (remove(szTempFilePath) != 0) - MSG_DEBUG("remove fail"); - - if (remove(MMS_DECODE_DRM_CONVERTED_TEMP_FILE) != 0) - MSG_DEBUG("remove fail"); //remove convertin result if it goes to __CATCH - - return false; -} - -/************************************************************************* - * description : Function for decoding a converted file - * argument : void - * return value - - bool : result of converting -**************************************************************************/ - -bool MmsDrm2ReadMsgConvertedBody(MSG_MESSAGE_INFO_S *pMsg, bool bSavePartsAsTempFiles, bool bRetrieved, char *retrievedPath) -{ - MmsMsg *pMmsMsg; - MmsPluginStorage::instance()->getMmsMessage(&pMmsMsg); - MmsUnregisterDecodeBuffer(); -#ifdef __SUPPORT_DRM__ - MmsReleaseMsgDRMInfo(&pMmsMsg->msgType.drmInfo); -#endif - MmsReleaseMsgBody(&pMmsMsg->msgBody, pMmsMsg->msgType.type); - - if (MmsReadMsgBody(pMsg->msgId, bSavePartsAsTempFiles, bRetrieved, retrievedPath) == false) { - MSG_DEBUG("_MmsReadMsgBody with converted file is failed"); - return false; - } - - return true; -} - -#endif - -/* -------------------------------------------------------------------- - * - * B I N A R Y D E C D E U T I L I T Y - * - * --------------------------------------------------------------------*/ - -bool __MmsBinaryDecodeGetOneByte(FILE *pFile, UINT8 *pOneByte, int totalLength) -{ - int length = gMmsDecodeMaxLen - gCurMmsDecodeBuffPos; - - if (pFile == NULL || pOneByte == NULL) - { - MSG_DEBUG("invalid file or buffer"); - goto __CATCH; - } - - if (length < 1) { - if (__MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset, - gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) { - MSG_DEBUG("fail to load to buffer"); - goto __CATCH; - } - } - - *pOneByte = gpCurMmsDecodeBuff[gCurMmsDecodeBuffPos++]; - - return true; - -__CATCH: - return false; -} - -/* - * @remark: bufLen < gMmsDecodeMaxLen - */ -bool __MmsBinaryDecodeGetBytes(FILE *pFile, char *szBuff, int bufLen, int totalLength) -{ - int length = gMmsDecodeMaxLen - gCurMmsDecodeBuffPos; - int i = 0; - - - if (pFile == NULL || szBuff == NULL || bufLen == 0 || bufLen > gMmsDecodeMaxLen) - goto __CATCH; - - memset(szBuff, 0, bufLen); - - if (length < bufLen) { - if (__MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset, - gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) { - MSG_DEBUG("fail to load to buffer"); - goto __CATCH; - } - } - - for (i = 0; i < bufLen - 1; i++) - szBuff[i] = gpCurMmsDecodeBuff[gCurMmsDecodeBuffPos++]; - - - gCurMmsDecodeBuffPos++; //NULL - - return true; - -__CATCH: - return false; -} - -bool __MmsBinaryDecodeGetLongBytes(FILE *pFile, char *szBuff, int bufLen, int totalLength) -{ - int iPos = 0; - - if (pFile == NULL || szBuff == NULL || bufLen == 0) - goto __CATCH; - - memset(szBuff, 0, bufLen); - - if (__MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset, - gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) { - MSG_DEBUG("fail to load to buffer"); - goto __CATCH; - } - - while ((bufLen - iPos) >= gMmsDecodeMaxLen) { - if (__MmsBinaryDecodeGetBytes(pFile, szBuff + iPos, gMmsDecodeMaxLen, totalLength) == false) { - MSG_DEBUG("__MmsBinaryDecodeGetBytes fail"); - goto __CATCH; - } - - iPos += gMmsDecodeMaxLen; - } - - if ((bufLen - iPos) > 0) { - if (__MmsBinaryDecodeGetBytes(pFile, szBuff + iPos, (bufLen - iPos), totalLength) == false) { - MSG_DEBUG("__MmsBinaryDecodeGetBytes fail"); - goto __CATCH; - } - - iPos += (bufLen - iPos); - } - - return true; - -__CATCH: - return false; -} - -/** - * Decode uintvar to 32bit unsigned integer - * - * @param pEncodedData [in] encoded data - * @param pUintVar [out] Decode uintvar (32bit unsigned integer) - * @return The length of uintvar (-1, if cannot be converted to a uintvar) - * - * 0 XXXXXXX -> 0-bit: continue bit & 1~7bit: integer value - * - ------- - */ -static const UINT32 uintvarDecodeTable[] = { 0x00000001, 0x00000080, 0x00004000, 0x00100000, 0x08000000 }; - -static int __MmsBinaryDecodeUintvar(FILE *pFile, UINT32 *pUintVar, int totalLength) -{ - UINT8 count = 0; - UINT8 oneByte = 0; - UINT32 decodedUintvar = 0; - UINT8 iBuff[5] = {0}; - int length = MSG_MMS_DECODE_BUFFER_MAX - gCurMmsDecodeBuffPos; - - - if (pFile == NULL || pUintVar == NULL) - return -1; - - if (length < 5) { - if (__MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset, - gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) { - MSG_DEBUG("fail to load to buffer"); - goto __CATCH; - } - } - - while (true) { - if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) - goto __CATCH; - - if (oneByte > 0x7f) { - iBuff[count++] = oneByte; - } else { - iBuff[count++] = oneByte; - break; + + if (oneByte > 0x7f) { + iBuff[count++] = oneByte; + } else { + iBuff[count++] = oneByte; + break; } if (count > 4) { @@ -3866,7 +3303,7 @@ static bool __MmsBinaryDecodeCharset(FILE *pFile, UINT32 *nCharSet, int *pCharSe } *nCharSet = MmsGetBinaryType(MmsCodeCharSet, (UINT16)integer); - + MSG_DEBUG("Decoded charset MIBenum = [%d], charset enum = [%d]", integer, *nCharSet); if (*nCharSet == MIME_UNKNOWN) { MSG_DEBUG("MmsGetBinaryType fail.."); *nCharSet = MSG_CHARSET_UNKNOWN; @@ -3933,6 +3370,7 @@ static bool __MmsBinaryDecodeEncodedString(FILE *pFile, char *szBuff, int bufLen } nTemp = __MmsBinaryDecodeText(pFile, szBuff, bufLen, totalLength); + if (nTemp < 0) { /* There can be some error in data - no NULL -> try again with value length */ @@ -3974,9 +3412,13 @@ static bool __MmsBinaryDecodeEncodedString(FILE *pFile, char *szBuff, int bufLen MSG_DEBUG("MmsPluginTextConvert Fail"); } else { - memset(szBuff, 0x00, bufLen); - snprintf(szBuff, destLen, "%s", pDest); + snprintf(szBuff, destLen+1, "%s", pDest); + } + + if (pDest) { + free(pDest); + pDest = NULL; } } break; @@ -4162,19 +3604,19 @@ static int __MmsDecodeGetFilename(FILE *pFile, char *szBuff, int bufLen, int tot if (pLatinBuff) { szSrc = MsgRemoveQuoteFromFilename(pLatinBuff); if (szSrc) { - strcpy(pLatinBuff, szSrc); + strncpy(pLatinBuff, szSrc, textLength); free(szSrc); szSrc = NULL; } szSrc2 = MsgChangeHexString(pLatinBuff); if (szSrc2) { - strcpy(pLatinBuff, szSrc2); + strncpy(pLatinBuff, szSrc2, textLength); free(szSrc2); szSrc2 = NULL; } - if (__MsgIsUTF8String((unsigned char*)pLatinBuff, strlen(pLatinBuff)) == false) { + if (MmsIsUtf8String((unsigned char*)pLatinBuff, strlen(pLatinBuff)) == false) { length = strlen(pLatinBuff); int utf8BufSize = 0; @@ -4210,13 +3652,15 @@ static int __MmsDecodeGetFilename(FILE *pFile, char *szBuff, int bufLen, int tot length = strlen(pUTF8Buff); if ((pExt = strrchr(pUTF8Buff, '.')) != NULL) { - int nameLength = 0; + int nameLength = 0; nameLength = (length < bufLen) ? (length - strlen(pExt)) : (bufLen - strlen(pExt)); strncpy(szBuff, pUTF8Buff, nameLength); - strcat (szBuff, pExt); + g_strlcat(szBuff, pExt,(gsize)bufLen); + } else { strncpy(szBuff, pUTF8Buff, bufLen - 1); } + free(pUTF8Buff); pUTF8Buff = NULL; @@ -4264,7 +3708,7 @@ bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRe if (bRetrieved && (retrievedPath != NULL)) { strncpy(szFullPath, retrievedPath, (strlen(retrievedPath) > MSG_FILEPATH_LEN_MAX ? MSG_FILEPATH_LEN_MAX:strlen(retrievedPath))); } else { - MmsPluginStorage::instance()->getMmsRawFilePath(msgID, szFullPath); + MmsPluginStorage::instance()->getMmsRawFilePath(msgID, szFullPath, sizeof(szFullPath)); } pMsg->msgID = msgID; @@ -4272,8 +3716,8 @@ bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRe /* read from MMS raw file */ strncpy(pMsg->szFileName, szFullPath + strlen(MSG_DATA_PATH), strlen(szFullPath + strlen(MSG_DATA_PATH))); - MSG_DEBUG("msg_id = [%d]", msgID); - MSG_DEBUG("raw file path = [%s]", szFullPath); + MSG_SEC_DEBUG("msg_id = [%d]", msgID); + MSG_SEC_DEBUG("raw file path = [%s]", szFullPath); if (MsgGetFileSize(szFullPath, &nSize) == false) { MSG_FATAL("Fail MsgGetFileSize"); @@ -4282,7 +3726,7 @@ bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRe pFile = MsgOpenFile(szFullPath, "rb"); if (pFile == NULL) { - MSG_DEBUG("Fail MsgOpenFile [%s]", szFullPath); + MSG_SEC_DEBUG("Fail MsgOpenFile [%s]", szFullPath); goto __CATCH; } @@ -4376,7 +3820,7 @@ bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRe } /* make temporary */ - snprintf(szTempMediaDir, MSG_FILEPATH_LEN_MAX, MSG_DATA_PATH"%s.dir", pMsg->szFileName); + snprintf(szTempMediaDir, MSG_FILEPATH_LEN_MAX, "%s%s.dir", MSG_DATA_PATH, pMsg->szFileName); if (MsgIsMultipart(pMsg->msgType.type) == true) { int partIndex = 0; @@ -4385,13 +3829,13 @@ bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRe if (bSavePartsAsTempFiles) { if (mkdir(szTempMediaDir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) { if (errno == EEXIST) { - MSG_DEBUG("exist dir : [%s]", szTempMediaDir); + MSG_SEC_DEBUG("exist dir : [%s]", szTempMediaDir); } else { - MSG_DEBUG("Fail to Create Dir [%s]", szTempMediaDir); + MSG_SEC_DEBUG("Fail to Create Dir [%s]", szTempMediaDir); goto __CATCH; } } else { - MSG_DEBUG("make dir : [%s]", szTempMediaDir); + MSG_SEC_DEBUG("make dir : [%s]", szTempMediaDir); } } @@ -4407,6 +3851,8 @@ bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRe (char*)MSG_DATA_PATH, pMsg->szFileName, partIndex, bSavePartsAsTempFiles) == false) goto __CATCH; + MmsPrintMulitpart(pMultipart, partIndex); + pMultipart = pMultipart->pNext; partIndex ++; } @@ -4446,9 +3892,8 @@ __CATCH: pFile = NULL; } -#ifdef __SUPPORT_DRM__ + MmsReleaseMsgDRMInfo(&pMsg->msgType.drmInfo); -#endif MmsReleaseMsgBody(&pMsg->msgBody, pMsg->msgType.type); @@ -4641,23 +4086,23 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc) pDec = MsgDecodeText(pName); } - switch (_MsgGetCode(MSG_PARAM, pSrc)) { + switch (MmsGetTextType(MmsCodeParameterCode, pSrc)) { case MSG_PARAM_BOUNDARY: /* RFC 822: boundary := 0*69 bcharsnospace */ memset (pType->param.szBoundary, 0, MSG_BOUNDARY_LEN + 1); strncpy(pType->param.szBoundary, pDec, MSG_BOUNDARY_LEN); - MSG_DEBUG("szBoundary = [%s]", pType->param.szBoundary); + MSG_SEC_INFO("szBoundary = [%s]", pType->param.szBoundary); break; case MSG_PARAM_CHARSET: - pType->param.charset = _MsgGetCode(MSG_CHARSET, pDec); + pType->param.charset = MmsGetTextType(MmsCodeParameterCode, pDec); - if (pType->param.charset == INVALID_HOBJ) + if (pType->param.charset == -1) pType->param.charset = MSG_CHARSET_UNKNOWN; - MSG_DEBUG("type = %d [charset] = %d", pType->type, pType->param.charset); + MSG_SEC_INFO("type = %d [charset] = %d", pType->type, pType->param.charset); break; case MSG_PARAM_NAME: @@ -4675,7 +4120,7 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc) } strncpy(pType->param.szName, pUTF8Buff, nameLen); - strcat (pType->param.szName, pExt); + g_strlcat(pType->param.szName, pExt, sizeof(pType->param.szName)); } else { strncpy(pType->param.szName, pUTF8Buff, (MSG_LOCALE_FILENAME_LEN_MAX-1)); } @@ -4695,10 +4140,10 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc) // Remvoe '/', ex) Content-Type: image/gif; name="images/vf7.gif" __MsgRemoveFilePath(pType->param.szName); } else { - MSG_DEBUG("MsgConvertLatin2UTF8FileName(%s) return NULL", pDec); + MSG_SEC_DEBUG("MsgConvertLatin2UTF8FileName(%s) return NULL", pDec); } - MSG_DEBUG("szName = %s", pType->param.szName); + MSG_SEC_INFO("szName = %s", pType->param.szName); break; case MSG_PARAM_FILENAME: @@ -4716,15 +4161,16 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc) } strncpy(pType->param.szFileName, pUTF8Buff, nameLen); - strcat (pType->param.szFileName, pExt); + g_strlcat (pType->param.szFileName, pExt, sizeof(pType->param.szFileName)); } else { strncpy(pType->param.szFileName, pUTF8Buff, (MSG_FILENAME_LEN_MAX-1)); } free(pUTF8Buff); pUTF8Buff = NULL; - if (__MsgChangeSpace(pType->param.szFileName, &szSrc) == true) - strcpy(pType->param.szFileName, szSrc); + if (__MsgChangeSpace(pType->param.szFileName, &szSrc) == true) { + snprintf(pType->param.szFileName, sizeof(pType->param.szFileName), "%s", szSrc); + } if (szSrc) { free(szSrc); @@ -4734,10 +4180,10 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc) // Remvoe '/', ex) Content-Type: image/gif; name="images/vf7.gif" __MsgRemoveFilePath(pType->param.szFileName); } else { - MSG_DEBUG("MsgConvertLatin2UTF8FileName(%s) return NULL", pDec); + MSG_SEC_DEBUG("MsgConvertLatin2UTF8FileName(%s) return NULL", pDec); } - MSG_DEBUG("szFileName = %s", pType->param.szFileName); + MSG_SEC_INFO("szFileName = %s", pType->param.szFileName); break; @@ -4745,8 +4191,8 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc) /* type/subtype of root. Only if content-type is multipart/related */ - pType->param.type = _MsgGetCode(MSG_TYPE, pDec); - MSG_DEBUG("type = %d", pType->param.type); + pType->param.type = MimeGetMimeIntFromMimeString(pDec); + MSG_SEC_INFO("type = %d", pType->param.type); break; @@ -4757,7 +4203,7 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc) memset (pType->param.szStart, 0, MSG_MSG_ID_LEN + 1); strncpy(pType->param.szStart, pDec, MSG_MSG_ID_LEN); - MSG_DEBUG("szStart = %s", pType->param.szStart); + MSG_SEC_INFO("szStart = %s", pType->param.szStart); break; @@ -4768,7 +4214,7 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc) memset (pType->param.szStartInfo, 0, MSG_MSG_ID_LEN + 1); strncpy(pType->param.szStartInfo, pDec, MSG_MSG_ID_LEN); - MSG_DEBUG("szStartInfo = %s", pType->param.szStartInfo); + MSG_SEC_INFO("szStartInfo = %s", pType->param.szStartInfo); break; @@ -4782,7 +4228,7 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc) pType->param.reportType = MSG_PARAM_REPORT_TYPE_UNKNOWN; } - MSG_DEBUG("reportType = %s", pDec); + MSG_SEC_INFO("reportType = %s", pDec); break; default: @@ -4828,7 +4274,7 @@ static char *__MsgSkipComment (char *s,long trim) switch (*s1) { case '(': if (!__MsgSkipComment (s1,(long)NULL)) - return NULL; + goto __NULL_RETURN; t = --s1; break; case ')': @@ -4846,28 +4292,27 @@ static char *__MsgSkipComment (char *s,long trim) break; case '\0': *s = '\0'; - return NULL; + goto __NULL_RETURN; case ' ': break; default: t = s1; break; } - }while (s1++); + } while (s1++); - /* DEADCODE +__NULL_RETURN: return NULL; - */ } static char *__MsgConvertLatin2UTF8FileName(char *pSrc) { char *pUTF8Buff = NULL; - char *pData = NULL; +// char *pData = NULL; //convert utf8 string - if (__MsgIsUTF8String((unsigned char*)pSrc, strlen(pSrc)) == false) { + if (MmsIsUtf8String((unsigned char*)pSrc, strlen(pSrc)) == false) { int length = 0; int utf8BufSize = 0; @@ -4900,14 +4345,13 @@ static char *__MsgConvertLatin2UTF8FileName(char *pSrc) } //convert hex string - if (__MsgIsPercentSign(pUTF8Buff) == true) { - pData = MsgChangeHexString(pUTF8Buff); - if (pData) { - strcpy(pUTF8Buff, pData); - free(pData); - pData = NULL; - } - } +// if (__MsgIsPercentSign(pUTF8Buff) == true) { +// pData = MsgChangeHexString(pUTF8Buff); +// if (pData) { +// free(pUTF8Buff); +// pUTF8Buff = pData; +// } +// } return pUTF8Buff; @@ -4972,7 +4416,7 @@ static void __MsgRemoveFilePath(char *pSrc) } if (pPath) { - MSG_DEBUG("filename(%s)", pSrc); + MSG_SEC_DEBUG("filename(%s)", pSrc); // case : images/vf7.gif -> vf7.gif if (pPath != NULL && *(pPath+1) != '\0') { @@ -4990,108 +4434,23 @@ static void __MsgRemoveFilePath(char *pSrc) } } -static bool __MsgIsUTF8String(unsigned char *szSrc, int nChar) -{ - MSG_DEBUG("MsgIsUTF8String: ---------------"); - - if (szSrc == NULL) { - MSG_DEBUG("szSrc is NULL !!!! ---------------"); - return true; - } - - while (nChar > 0 && (*szSrc != '\0')) { - if (*szSrc < 0x80) { - szSrc++; - nChar--; - } else if ((0xC0 <= *szSrc) && (*szSrc < 0xE0)) { - if (*(szSrc + 1) >= 0x80) { - szSrc += 2; - nChar -= 2; - } else { - MSG_DEBUG("1. NOT utf8 range!"); - goto __CATCH; - } - } else if (*szSrc >= 0xE0) { - if (*(szSrc + 1) >= 0x80) { - if (*(szSrc + 2) >= 0x80) { - szSrc += 3; - nChar -= 3; - } else { - MSG_DEBUG("2. NOT utf8 range!"); - goto __CATCH; - } - } else { - MSG_DEBUG("3. NOT utf8 range!"); - goto __CATCH; - } - } else { - MSG_DEBUG("4. NOT utf8 range!"); - goto __CATCH; - } - } - - return true; - -__CATCH: - return false; -} - +#if 0 static bool __MsgIsPercentSign(char *pSrc) { - char *pCh = NULL; - bool bRet = false; - - pCh = strchr(pSrc , '%'); - - if (pCh != NULL) { - bRet = true; - } else { - bRet = false; - } - - return bRet; -} - -static MsgMultipart *__MsgAllocMultipart(void) -{ - MsgMultipart *pMultipart = NULL; - - MSG_BEGIN(); - - pMultipart = (MsgMultipart*)malloc(sizeof(MsgMultipart)); - if (pMultipart == NULL) { - MSG_DEBUG("pMultipart malloc Fail"); - goto __CATCH; - } - - pMultipart->pBody = (MsgBody*)malloc(sizeof(MsgBody)); - if (pMultipart->pBody == NULL) { - MSG_DEBUG("pMultipart->pBody malloc Fail"); - goto __CATCH; - } - - MmsInitMsgType(&pMultipart->type); - MmsInitMsgBody(pMultipart->pBody); - - pMultipart->pNext = NULL; - - MSG_END(); - return pMultipart; - -__CATCH: + char *pCh = NULL; + bool bRet = false; - if (pMultipart) { - if (pMultipart->pBody) { - free(pMultipart->pBody); - pMultipart->pBody = NULL; - } + pCh = strchr(pSrc , '%'); - free(pMultipart); - pMultipart = NULL; + if (pCh != NULL) { + bRet = true; + } else { + bRet = false; } - return NULL; + return bRet; } +#endif static MsgPresentationFactor __MsgIsPresentationEx(MsgType *multipartType, char* szStart, MimeType typeParam) { @@ -5185,9 +4544,9 @@ static void __MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, M pMsgType->contentSize -= pPresentationInfo->pCurPresentation->pBody->size; pMsgBody->size -= pPresentationInfo->pCurPresentation->pBody->size; if (pPresentationInfo->pCurPresentation) { -#ifdef __SUPPORT_DRM__ + MmsReleaseMsgDRMInfo(&pPresentationInfo->pCurPresentation->type.drmInfo); -#endif + free(pPresentationInfo->pCurPresentation); pPresentationInfo->pCurPresentation = NULL; } @@ -5201,7 +4560,7 @@ static void __MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, M pPresentationInfo->pCurPresentation = NULL; } } - } else if (pPresentationInfo->pCurPresentation != NULL && __MsgIsText(pPresentationInfo->pCurPresentation->type.type)) { + } else if (pPresentationInfo->pCurPresentation != NULL && MmsIsTextType(pPresentationInfo->pCurPresentation->type.type)) { /* NON-Presentable Part is some PLAIN part such as, text/plain, multipart/alternative. * In this case, leave the Presentation part as a multipart and remove other multiparts. */ @@ -5229,9 +4588,9 @@ static void __MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, M } } else { -#ifdef __SUPPORT_DRM__ + MmsReleaseMsgDRMInfo(&pMsgBody->presentationType.drmInfo); -#endif + MmsInitMsgType(&pMsgBody->presentationType); pMsgBody->pPresentationBody = NULL; } @@ -5257,70 +4616,6 @@ static bool __MsgIsPresentablePart(int type) } } -#ifdef __SUPPORT_DRM__ - -bool MsgCopyDrmInfo(MsgType *pPartType) -{ - char *pExt = NULL; - char *pTmpBuf = NULL; - - //convert application/vnd.oma.drm.content to media type - pPartType->type = pPartType->drmInfo.contentType; - - // fix wrong file name presentation on save media screen. - if (pPartType->szContentID[0] == '\0' && pPartType->drmInfo.szContentURI) - strncpy(pPartType->szContentID, pPartType->drmInfo.szContentURI, MSG_MSG_ID_LEN); - - /* set title name (content name) */ - if (pPartType->param.szName[0] == '\0') { - /* szName is vitual name, real filename is *.dcf or *.dm */ - if (pPartType->drmInfo.szContentName && pPartType->drmInfo.szContentName[0] != '\0') { - /* In case of szContentName retrieved from DRM agent is exist. */ - pTmpBuf = pPartType->drmInfo.szContentName; - } else if (pPartType->szContentLocation[0] != '\0') { - /* In case of szContentLocation parsed from MMS header */ - pTmpBuf = strrchr(pPartType->szContentLocation, '/'); - if (pTmpBuf == NULL) - pTmpBuf = pPartType->szContentLocation; - } else { - /* use another name */ - /* possible NULL pointer assignment*/ - pTmpBuf = strdup("untitled"); - } - - if ((pExt = strrchr(pTmpBuf, '.')) != NULL) { - int extLen = 0; - int fileNameLen = 0; - int tmpLen = 0; - - extLen = strlen(pExt); - tmpLen = strlen(pTmpBuf); - fileNameLen = (tmpLen - extLen < MSG_LOCALE_FILENAME_LEN_MAX - extLen)?(tmpLen - extLen):(MSG_LOCALE_FILENAME_LEN_MAX - extLen); - strncpy(pPartType->param.szName, pTmpBuf, fileNameLen); - strcpy (pPartType->param.szName + fileNameLen, pExt); - } else { - strncpy(pPartType->param.szName, pTmpBuf, MSG_LOCALE_FILENAME_LEN_MAX); - __MsgMakeFileName(pPartType->type, pPartType->param.szName, MSG_DRM_TYPE_NONE, 0, pPartType->param.szName, sizeof(pPartType->param.szName)); - } - } - - return true; -} - -#endif - -static bool __MsgIsText(int type) -{ - if (type == MIME_TEXT_PLAIN || type == MIME_TEXT_HTML || type == MIME_TEXT_VND_WAP_WML || - type == MIME_TEXT_X_VNOTE || type == MIME_APPLICATION_SMIL || type == MIME_TEXT_X_IMELODY) { - return true; - } else { - return false; - } -} - - - static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody) { MSG_BEGIN(); @@ -5385,9 +4680,9 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody) pSelectedPart->pNext = NULL; if (pRemoveList) { -#ifdef __SUPPORT_DRM__ + MmsReleaseMsgDRMInfo(&pRemoveList->type.drmInfo); -#endif + MmsReleaseMsgBody(pRemoveList->pBody, pRemoveList->type.type); free(pRemoveList->pBody); @@ -5403,9 +4698,8 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody) memcpy(pPartBody, pSelectedPart->pBody, sizeof(MsgBody)); if (pSelectedPart != NULL) { -#ifdef __SUPPORT_DRM__ + MmsReleaseMsgDRMInfo(&pSelectedPart->type.drmInfo); -#endif if (pSelectedPart->pBody != NULL) { free(pSelectedPart->pBody); @@ -5459,9 +4753,9 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody) } if (pSelectedPart) { -#ifdef __SUPPORT_DRM__ + MmsReleaseMsgDRMInfo(&pSelectedPart->type.drmInfo); -#endif + free(pSelectedPart->pBody); free(pSelectedPart); } @@ -5532,9 +4826,8 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody) pPartType->type = pSelectedPart->type.type; -#ifdef __SUPPORT_DRM__ MmsReleaseMsgDRMInfo(&pSelectedPart->type.drmInfo); -#endif + free(pSelectedPart->pBody); free(pSelectedPart); @@ -5593,9 +4886,9 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody) pTmpMultipart = pRemoveList; while (pTmpMultipart) { -#ifdef __SUPPORT_DRM__ + MmsReleaseMsgDRMInfo(&pTmpMultipart->type.drmInfo); -#endif + MmsReleaseMsgBody(pTmpMultipart->pBody, pTmpMultipart->type.type); pNextRemovePart = pTmpMultipart->pNext; @@ -5614,9 +4907,8 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody) if (pSelectedPart->pBody != NULL) memcpy(pPartBody, pSelectedPart->pBody, sizeof(MsgBody)); -#ifdef __SUPPORT_DRM__ MmsReleaseMsgDRMInfo(&pSelectedPart->type.drmInfo); -#endif + if (pSelectedPart->pBody != NULL) { free(pSelectedPart->pBody); pSelectedPart->pBody = NULL; @@ -5667,7 +4959,8 @@ char *MsgResolveContentURI(char *szSrc) } memset(szTemp, 0, length); - strcpy(szTemp, szSrc); + + strncpy(szTemp, szSrc, length - 1); szReturn = MsgChangeHexString(szTemp); @@ -5714,7 +5007,7 @@ char *MsgRemoveQuoteFromFilename(char *pSrc) cLen--; strncpy(pBuff, &pSrc[1], cLen); } else { - strcpy(pBuff, pSrc); + strncpy(pBuff, pSrc, cLen); } // remove last qoute @@ -5796,51 +5089,47 @@ static bool __MsgCopyNestedMsgType(MsgType *pMsgType1, MsgType *pMsgType2) if(!pMsgType1 || !pMsgType2) return false; - if (pMsgType1->section == INVALID_HOBJ) + //if (pMsgType1->section == INVALID_HOBJ) pMsgType1->section = pMsgType2->section; -#ifdef __SUPPORT_DRM__ - int length = 0; + int length = 0; if (pMsgType1->drmInfo.drmType == MSG_DRM_TYPE_NONE) pMsgType1->drmInfo.drmType = pMsgType2->drmInfo.drmType; if (pMsgType1->szContentID[0] == '\0') { - strcpy(pMsgType1->szContentID, pMsgType2->szContentID); + snprintf(pMsgType1->szContentID, sizeof(pMsgType1->szContentID), "%s", pMsgType2->szContentID); + } - if (pMsgType2->szContentID[0]) { - length = MsgStrlen(pMsgType2->szContentID); - if (pMsgType2->szContentID[0] == '<' && pMsgType2->szContentID[length - 1] == '>') { - pMsgType1->drmInfo.szContentURI = MsgStrNCopy(pMsgType2->szContentID + 1, length - 2); - } else { - pMsgType1->drmInfo.szContentURI = MsgStrCopy(pMsgType2->szContentID); - } - } - } else { - length = MsgStrlen(pMsgType1->szContentID); + if (pMsgType1->szContentID[0] != '\0') { + + length = strlen(pMsgType1->szContentID); if (pMsgType1->szContentID[0] == '<' && pMsgType1->szContentID[length - 1] == '>') { - pMsgType1->drmInfo.szContentURI = MsgStrNCopy(pMsgType1->szContentID + 1, length - 2); + char szTempString[MSG_MSG_ID_LEN + 1]; + MmsRemoveLessGreaterChar(pMsgType1->szContentID, szTempString, sizeof(szTempString)); + pMsgType1->drmInfo.szContentURI = g_strdup(szTempString); } else { - pMsgType1->drmInfo.szContentURI = MsgStrCopy(pMsgType1->szContentID); + pMsgType1->drmInfo.szContentURI = g_strdup(pMsgType1->szContentID); } } -#endif - if (pMsgType1->szContentLocation[0] == '\0') - strcpy(pMsgType1->szContentLocation, pMsgType2->szContentLocation); + if (pMsgType1->szContentLocation[0] == '\0') { + strncpy(pMsgType1->szContentLocation, pMsgType2->szContentLocation, MSG_MSG_ID_LEN); + } /* Copy informations - we shoud open the pMsgType2's orgFile * concerning its offset and size. */ - if (pMsgType2->szOrgFilePath[0] != '\0') - strcpy(pMsgType1->szOrgFilePath, pMsgType2->szOrgFilePath); + if (pMsgType2->szOrgFilePath[0] != '\0') { + strncpy(pMsgType1->szOrgFilePath, pMsgType2->szOrgFilePath, MSG_FILEPATH_LEN_MAX-1); + } - if (pMsgType2->disposition != INVALID_HOBJ) + if (pMsgType2->disposition != -1) pMsgType1->disposition = pMsgType2->disposition; if ((pMsgType1->type != MIME_APPLICATION_VND_OMA_DRM_MESSAGE && pMsgType1->type != MIME_APPLICATION_VND_OMA_DRM_CONTENT) && - pMsgType2->encoding != INVALID_HOBJ) + pMsgType2->encoding != -1) pMsgType1->encoding = pMsgType2->encoding; pMsgType1->contentSize = pMsgType2->contentSize; @@ -5851,332 +5140,93 @@ static bool __MsgCopyNestedMsgType(MsgType *pMsgType1, MsgType *pMsgType2) __MsgCopyNestedMsgParam(&(pMsgType1->param), &(pMsgType2->param)); if (pMsgType1->param.szName[0]) { -#ifdef __SUPPORT_DRM__ - pMsgType1->drmInfo.szContentName = MsgStrCopy(pMsgType2->param.szName); -#endif - } - - return true; -} - -static bool __MsgCopyNestedMsgParam(MsgContentParam *pParam1, MsgContentParam *pParam2) -{ - if (pParam1->charset == MSG_CHARSET_UNKNOWN) - pParam1->charset = pParam2->charset; - - if (pParam1->type == MIME_UNKNOWN) - pParam1->type = pParam2->type; - - /* Don't copy pParam2->pPresentation */ - - /* For alternative: copy the boundary string */ - if (pParam2->szBoundary[0] !='\0') - strcpy(pParam1->szBoundary, pParam2->szBoundary); - - if (pParam1->szFileName[0] =='\0') - strcpy(pParam1->szFileName, pParam2->szFileName); - - if (pParam1->szName[0] =='\0') - strcpy(pParam1->szName, pParam2->szName); - - if (pParam1->szStart[0] =='\0') - strcpy(pParam1->szStart, pParam2->szStart); - - if (pParam1->szStartInfo[0] =='\0') - strcpy(pParam1->szStartInfo, pParam2->szStartInfo); - - return true; -} - -static bool __MsgIsMultipartMixed(int type) -{ - if (type == MIME_APPLICATION_VND_WAP_MULTIPART_MIXED || type == MIME_MULTIPART_MIXED) { - return true; - } else { - return false; - } -} - -bool MmsGetMsgAttrib(MmsMsgID msgID, MmsAttrib* pAttrib) -{ - MmsMsg *pMsg = NULL; - - memset(pAttrib, 0, sizeof(MmsAttrib)); - MmsPluginStorage::instance()->getMmsMessage(&pMsg); - memcpy(pAttrib, &(pMsg->mmsAttrib), sizeof(MmsAttrib)); - - MSG_DEBUG("msgID = %lu ---------------------\n", msgID); - - if ('\0' != pMsg->szTrID[0]) - MSG_DEBUG("szTrID = %s \n", pMsg->szTrID); - - MSG_END(); - return true; -} - -static bool __MsgIsInvalidFileNameChar(char ch) -{ - if ((ch == 0x5C /* \ */) || - (ch == 0x2F /* / */) || - (ch == 0x3A /* : */) || - (ch == 0x2A /* * */) || - (ch == 0x3F /* ? */) || - (ch == 0x22 /* " */) || - (ch == 0x3C /* < */) || - (ch == 0x3E /* > */) || - (ch == 0x7C /* | */)) - return true; - - return false; -} - -bool MmsDataUpdateLastStatus(MmsMsg *pMsg) -{ - MmsMsgMultiStatus* pStatus = NULL; - - pStatus = pMsg->mmsAttrib.pMultiStatus; - - while (pStatus != NULL) { - pStatus->bDeliveyrReportIsLast = false; - pStatus->bReadReplyIsLast = false; - pStatus = pStatus->pNext; + pMsgType1->drmInfo.szContentName = g_strdup(pMsgType2->param.szName); } return true; } +static bool __MsgCopyNestedMsgParam(MsgContentParam *pParam1, MsgContentParam *pParam2) +{ + if (pParam1->charset == MSG_CHARSET_UNKNOWN) + pParam1->charset = pParam2->charset; -bool MmsAddrUtilCompareAddr(char *pszAddr1, char *pszAddr2) -{ - int len1; - int len2; - char *p; - - MmsAddrUtilRemovePlmnString(pszAddr1); - MmsAddrUtilRemovePlmnString(pszAddr2); - - MSG_DEBUG("##### pszAddr1 = %s #####", pszAddr1); - MSG_DEBUG("##### pszAddr2 = %s #####", pszAddr2); - if (!strcmp(pszAddr1, pszAddr2)) - return true; - - len1 = strlen(pszAddr1); - len2 = strlen(pszAddr2); - - if (len1 > len2) { - p = strstr(pszAddr1, pszAddr2); - } else { - p = strstr(pszAddr2, pszAddr1); - } - - if (p) - return true; - - return false; -} - -static int __MsgGetLatin2UTFCodeSize(unsigned char *szSrc, int nChar) -{ - int nCount = 0; - - MSG_DEBUG("---------------"); - - if ((szSrc == NULL) || (nChar <= 0)) { - MSG_DEBUG("szSrc is NULL !!!! ---------------"); - return 0; - } - - while ((nChar > 0) && (*szSrc != '\0')) { - if (0x01 <= *szSrc && *szSrc <= 0x7F) { - nCount += 1; - szSrc++; - nChar--; - } else { - nCount += 2; - szSrc++; - nChar--; - } - } - - return nCount; -} - -static int __MsgLatin5code2UTF(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar) -{ - unsigned char *org; - unsigned char t1; - unsigned char t2; - unsigned short temp = 0; - - org = des; - outBufSize--; //Null Character - - while ((nChar > 0) && (*szSrc != '\0')) { - - if (*szSrc >= 0x01 && *szSrc <= 0x7F) { //basic common - temp = (unsigned short)(*szSrc); - - outBufSize --; - if (outBufSize < 0) - goto __RETURN; - - *des = (unsigned char) ((*szSrc) & 0x007F); - - des++; - szSrc++; - nChar--; - } else if ((*szSrc == 0x00) || (*szSrc >= 0x80 && *szSrc <= 0x9F) || - (*szSrc >= 0xA0 && *szSrc <= 0xCF) || (*szSrc >= 0xD1 && *szSrc <= 0xDC) || - (*szSrc >= 0xDF && *szSrc <= 0xEF) || (*szSrc >= 0xF1 && *szSrc <= 0xFC) || - (*szSrc == 0xFF)) {//uni 0x00A0 ~ 0x00CF - - temp = (unsigned short)(*szSrc); - - outBufSize -= 2; - if (outBufSize < 0) - goto __RETURN; - - t2 = (unsigned char) (temp & 0x003F); // right most 6 bit - t1 = (unsigned char) ((temp & 0x07C0) >> 6); // right most 5 bit - - *des = 0xC0 | (t1 & 0x1F); - *(des+1) = 0x80 | (t2 & 0x3F); - - des += 2; - szSrc += 1; - nChar -= 1; - } else if (*szSrc == 0xD0) {//empty section OR vendor specific codes. - - temp = 0x011E; - - outBufSize -= 2; - if (outBufSize < 0) - goto __RETURN; - - t2 = (unsigned char) (temp & 0x003F); // right most 6 bit - t1 = (unsigned char) ((temp & 0x07C0) >> 6); // right most 5 bit - - *des = 0xC0 | (t1 & 0x1F); - *(des+1) = 0x80 | (t2 & 0x3F); - - des += 2; - szSrc += 1; - nChar -= 1; - } else if (*szSrc == 0xDD) { - temp = 0x0130; - - outBufSize -= 2; - if (outBufSize < 0) - goto __RETURN; - - t2 = (unsigned char) (temp & 0x003F); // right most 6 bit - t1 = (unsigned char) ((temp & 0x07C0) >> 6); // right most 5 bit - - *des = 0xC0 | (t1 & 0x1F); - *(des+1) = 0x80 | (t2 & 0x3F); - - des += 2; - szSrc += 1; - nChar -= 1; - } else if (*szSrc == 0xDE) { - temp = 0x015E; - - outBufSize -= 2; - if (outBufSize < 0) - goto __RETURN; - - t2 = (unsigned char) (temp & 0x003F); // right most 6 bit - t1 = (unsigned char) ((temp & 0x07C0) >> 6); // right most 5 bit - - *des = 0xC0 | (t1 & 0x1F); - *(des+1) = 0x80 | (t2 & 0x3F); - - des += 2; - szSrc += 1; - nChar -= 1; - } else if (*szSrc == 0xF0) { - temp = 0x011F; - outBufSize -= 2; - if (outBufSize < 0) - goto __RETURN; - - t2 = (unsigned char) (temp & 0x003F); // right most 6 bit - t1 = (unsigned char) ((temp & 0x07C0) >> 6); // right most 5 bit - - *des = 0xC0 | (t1 & 0x1F); - *(des+1) = 0x80 | (t2 & 0x3F); - - des += 2; - szSrc += 1; - nChar -= 1; - } else if (*szSrc == 0xFD) { - temp = 0x0131; + if (pParam1->type == MIME_UNKNOWN) + pParam1->type = pParam2->type; - outBufSize -= 2; + /* Don't copy pParam2->pPresentation */ - if (outBufSize < 0) - goto __RETURN; + /* For alternative: copy the boundary string */ + if (pParam2->szBoundary[0] !='\0') { + strncpy(pParam1->szBoundary, pParam2->szBoundary, MSG_BOUNDARY_LEN); + } - t2 = (unsigned char) (temp & 0x003F); // right most 6 bit - t1 = (unsigned char) ((temp & 0x07C0) >> 6); // right most 5 bit + if (pParam1->szFileName[0] =='\0') { + strncpy(pParam1->szFileName, pParam2->szFileName, MSG_FILENAME_LEN_MAX); + } - *des = 0xC0 | (t1 & 0x1F); - *(des+1) = 0x80 | (t2 & 0x3F); + if (pParam1->szName[0] =='\0') { + strncpy(pParam1->szName, pParam2->szName, MSG_LOCALE_FILENAME_LEN_MAX); + } - des += 2; - szSrc += 1; - nChar -= 1; - } else if (*szSrc == 0xFE) { - temp = 0x015F; + if (pParam1->szStart[0] =='\0') { + strncpy(pParam1->szStart, pParam2->szStart, MSG_MSG_ID_LEN); + } - outBufSize -= 2; - if (outBufSize < 0) - goto __RETURN; + if (pParam1->szStartInfo[0] =='\0') { + strncpy(pParam1->szStartInfo, pParam2->szStartInfo, MSG_MSG_ID_LEN); + } + return true; +} - t2 = (unsigned char) (temp & 0x003F); // right most 6 bit - t1 = (unsigned char) ((temp & 0x07C0) >> 6); // right most 5 bit +static bool __MsgIsMultipartMixed(int type) +{ + if (type == MIME_APPLICATION_VND_WAP_MULTIPART_MIXED || type == MIME_MULTIPART_MIXED) { + return true; + } else { + return false; + } +} - *des = 0xC0 | (t1 & 0x1F); - *(des+1) = 0x80 | (t2 & 0x3F); +static bool __MsgIsInvalidFileNameChar(char ch) +{ + if ((ch == 0x5C /* \ */) || + (ch == 0x2F /* / */) || + (ch == 0x3A /* : */) || + (ch == 0x2A /* * */) || + (ch == 0x3F /* ? */) || + (ch == 0x22 /* " */) || + (ch == 0x3C /* < */) || + (ch == 0x3E /* > */) || + (ch == 0x7C /* | */)) + return true; - des += 2; - szSrc += 1; - nChar -= 1; - } else { - return -1; - } - } -__RETURN: - *des = 0; - return(des-org); + return false; } -static int __MsgGetLatin52UTFCodeSize(unsigned char *szSrc, int nChar) +static int __MsgGetLatin2UTFCodeSize(unsigned char *szSrc, int nChar) { int nCount = 0; MSG_DEBUG("---------------"); - if ((szSrc == NULL) || (nChar <= 0)) + if ((szSrc == NULL) || (nChar <= 0)) { + MSG_DEBUG("szSrc is NULL !!!! ---------------"); return 0; + } while ((nChar > 0) && (*szSrc != '\0')) { - if (*szSrc >= 0x01 && *szSrc <= 0x7F) { + if (0x01 <= *szSrc && *szSrc <= 0x7F) { nCount += 1; szSrc++; nChar--; - } else if (*szSrc == 0x00 || (*szSrc >= 0x80 && *szSrc <= 0x9F) || - (*szSrc >= 0xA0 && *szSrc <= 0xCF) || (*szSrc >= 0xD1 && *szSrc <= 0xDC) || - (*szSrc >= 0xDF && *szSrc <= 0xEF) || (*szSrc >= 0xF1 && *szSrc <= 0xFC) || - *szSrc == 0xD0 || *szSrc == 0xDD || *szSrc == 0xDE || *szSrc == 0xF0 || - *szSrc == 0xFD || *szSrc == 0xFE || *szSrc == 0xFF) { //uni 0x00A0 ~ 0x00CF + } else { nCount += 2; szSrc++; nChar--; - } else { - return -1; } } + return nCount; } @@ -6228,262 +5278,162 @@ __RETURN: return (des - org); } - -static int __MsgLatin7code2UTF(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar) +bool MmsAddrUtilCheckEmailAddress(char *pszAddr) { - unsigned char *org; - unsigned char t1; - unsigned char t2; - unsigned char t3; - unsigned short temp = 0; - - MSG_DEBUG("---------------"); - - org = des; - outBufSize--; //Null Character - - while ((nChar > 0) && (*szSrc != '\0')) { - if (*szSrc >= 0x01 && *szSrc <= 0x7F) { - temp = (unsigned short)(*szSrc); - - outBufSize --; - if (outBufSize < 0) - goto __RETURN; - - *des = (unsigned char) (temp & 0x007F); - - des++; - szSrc++; - nChar--; - - } else if ((*szSrc == 0x00) || (*szSrc >= 0x80 && *szSrc <= 0x9F) || - (*szSrc >= 0xA3 && *szSrc <= 0xAD) || (*szSrc == 0xBB)) { // consider 0xA4, 0xA5 - - temp = (unsigned short)(*szSrc); - - outBufSize -= 2; - if (outBufSize < 0) - goto __RETURN; - - t2 = (unsigned char) (temp & 0x003F); // right most 6 bit - t1 = (unsigned char) ((temp & 0xC0) >> 6); // right most 2 bit - - *des = 0xC0 | (t1 & 0x1F); - *(des + 1) = 0x80 | (t2 & 0x3F); - - des += 2; - szSrc += 1; - nChar -= 1; - } else if (*szSrc == 0xA0) { - temp = 0x0020; - //*des = temp to utf-8 - outBufSize--; - if (outBufSize < 0) - goto __RETURN; - - *des = (unsigned char) (temp & 0x007F); - - des++; - szSrc++; - nChar--; - - } else if (*szSrc == 0xA1) { - temp = 0x2018; - - outBufSize -= 3; - if (outBufSize < 0) - goto __RETURN; - - t3 = (unsigned char) (temp & 0x003F); // right most 6 bit - t2 = (unsigned char) ((temp & 0x0FC0) >> 6); // right most 6 bit - t1 = (unsigned char) ((temp & 0xF000) >> 12); // right most 4 bit - - *des = 0xE0 | (t1 & 0x0F); - *(des+1) = 0x80 | (t2 & 0x3F); - *(des+2) = 0x80 | (t3 & 0x3F); - - des += 3; - szSrc += 1; - nChar -= 1; - - } else if (*szSrc == 0xA2) { - temp = 0x2019; - - outBufSize -= 3; - if (outBufSize < 0) - goto __RETURN; - - t3 = (unsigned char) (temp & 0x003F); // right most 6 bit - t2 = (unsigned char) ((temp & 0x0FC0) >> 6); // right most 6 bit - t1 = (unsigned char) ((temp & 0xF000) >> 12); // right most 4 bit + if (!pszAddr || pszAddr[0] == 0) + return false; - *des = 0xE0 | (t1 & 0x0F); - *(des+1) = 0x80 | (t2 & 0x3F); - *(des+2) = 0x80 | (t3 & 0x3F); + if (!strchr (pszAddr, MSG_MMS_CH_EMAIL_AT)) + return false; - des += 3; - szSrc += 1; - nChar -= 1; + return true; +} - } else if (*szSrc == 0xAF) { - temp = 0x2015; +bool MmsAddrUtilRemovePlmnString(char *pszAddr) +{ + char *pszAddrCopy = NULL; + char *pszStrStart = NULL; + char *pszStrTemp = NULL; + int strLen = 0; - outBufSize -= 3; - if (outBufSize < 0) - goto __RETURN; + if ((!pszAddr) || (pszAddr[0] == 0)) { + MSG_DEBUG("pszAddr is null or zero"); + return false; + } - t3 = (unsigned char) (temp & 0x003F); // right most 6 bit - t2 = (unsigned char) ((temp & 0x0FC0) >> 6); // right most 6 bit - t1 = (unsigned char) ((temp & 0xF000) >> 12); // right most 4 bit + strLen = strlen(pszAddr); - *des = 0xE0 | (t1 & 0x0F); - *(des+1) = 0x80 | (t2 & 0x3F); - *(des+2) = 0x80 | (t3 & 0x3F); + pszAddrCopy = (char*)calloc(1,strLen + 1); + if (!pszAddrCopy) { + MSG_DEBUG("pszAddrCopy is NULL, mem alloc failed"); + return false; + } - des += 3; - szSrc += 1; - nChar -= 1; + strncpy(pszAddrCopy, pszAddr, strLen); - } else if (0xB0 <= *szSrc && *szSrc <= 0xB4) { //0x00B0 ~ 0x00B4 + pszAddr[0] = 0; + pszStrStart = pszAddrCopy; - temp = (unsigned short)(*szSrc); + while (true) { + char* pszStrEnd = NULL; + int addressLen = 0; - outBufSize -= 2; - if (outBufSize < 0) - goto __RETURN; + if (MmsAddrUtilCheckEmailAddress(pszAddrCopy)) + pszStrEnd = strstr(pszStrStart, "/TYPE=PLMN"); + else + pszStrEnd = strstr(pszStrStart, "/"); - t2 = (unsigned char) (temp & 0x003F); // right most 6 bit - t1 = (unsigned char) ((temp & 0x07C0) >> 6); // right most 5 bit + if (!pszStrEnd) { + char *pszStart = NULL; + char *pszEnd = NULL; + // "/TYPE=PLMN" not found - *des = 0xC0 | (t1 & 0x1F); - *(des+1) = 0x80 | (t2 & 0x3F); + int remainedLen = strlen(pszStrStart); - des += 2; - szSrc += 1; - nChar -= 1; + if (remainedLen <= 0) + break; + //Email addresscan occur with Sender Name format + //remove the Sender name and only retain the email address. + pszStart = strstr(pszStrStart, "<"); + if (pszStart) { + pszEnd = strstr(pszStrStart, ">"); + + if (pszEnd) { + pszStart++; //skip "<" + g_strlcat(pszAddr, pszStart, pszEnd - pszStart + 1); + break; + } + } - } else if ((0xB5 <= *szSrc && *szSrc <= 0xBA) || - (0xBC <= *szSrc && *szSrc <= 0xD1) || - (0xD3 <= *szSrc && *szSrc <= 0xFE)) { - temp= (unsigned short)(*szSrc + 0x02D0); + //strcat(pszAddr, pszStrStart); + g_strlcat(pszAddr, pszStrStart, strLen + 1); + break; + } - outBufSize -= 2; - if (outBufSize < 0) - goto __RETURN; + // Get one address length + addressLen = pszStrEnd - pszStrStart; - t2 = (unsigned char) (temp & 0x003F); // right most 6 bit - t1 = (unsigned char) ((temp & 0x07C0) >> 6); // right most 5 bit + strncat(pszAddr, pszStrStart, addressLen); - *des = 0xC0 | (t1 & 0x1F); - *(des+1) = 0x80 | (t2 & 0x3F); + // Find next address + pszStrStart = pszStrEnd; - des += 2; - szSrc += 1; - nChar -= 1; + pszStrTemp = strstr(pszStrStart, MSG_MMS_STR_ADDR_DELIMETER); + if (pszStrTemp) { + addressLen = pszStrTemp - pszStrEnd; + pszStrStart += addressLen; } else { - return -1; + pszStrStart += strlen(pszStrEnd); } - } - -__RETURN: - *des = 0; - return(des - org); -} - -static int __MsgGetLatin72UTFCodeSize(unsigned char *szSrc, int nChar) -{ - int nCount = 0; + if (pszStrStart[0] == 0) // end of string + break; - MSG_DEBUG(" ---------------"); - if ((szSrc == NULL) || (nChar <= 0)) - return 0; + g_strlcat(pszAddr, MSG_MMS_STR_ADDR_DELIMETER, strLen + 1); // add ';' + pszStrStart++; // remove ';' + } - while ((nChar > 0) && (*szSrc != '\0')) { + if (pszAddr[0] == 0) + strncpy(pszAddr, pszAddrCopy, strLen); - if ((*szSrc >= 0x01 && *szSrc <= 0x7F) || (*szSrc == 0xA0)) { - nCount += 1; - szSrc++; - nChar--; - } else if (*szSrc == 0x00 || (0x80 <= *szSrc && *szSrc <= 0x9F) || (0xA3 <= *szSrc && *szSrc <= 0xAD) || - (0xB0 <= *szSrc && *szSrc <= 0xB4) || (0xB5 <= *szSrc && *szSrc <= 0xFE)) { - nCount += 2; - szSrc++; - nChar--; - } else if (*szSrc == 0xA1 ||*szSrc == 0xA2 || *szSrc == 0xAF) { - nCount += 3; - szSrc += 1; - nChar -= 1; + free(pszAddrCopy); - } else { - return -1; - } - } - return nCount; + return true; } -static int __MsgUnicode2UTF(unsigned char *des, int outBufSize, unsigned short *szSrc, int nChar) +static int __MsgCutUTFString(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar) { unsigned char *org; - unsigned char t1; - unsigned char t2; - unsigned char t3; - MSG_DEBUG(" ---------------"); + MSG_DEBUG("---------------"); org = des; outBufSize--; // NULL character while ((nChar > 0) && (*szSrc != '\0')) { - if (0x0001 <= *szSrc && *szSrc <= 0x007F) { - /* check outbuffer's room for this UTF8 character */ - + if (*szSrc < 0x80) { outBufSize --; if (outBufSize < 0) goto __RETURN; - *des = (unsigned char) (*szSrc & 0x007F); - + *des = *szSrc; des++; szSrc++; - nChar--; - } else if ((*szSrc == 0x0000) || (0x0080 <= *szSrc && *szSrc <= 0x07FF)) { - /* check outbuffer's room for this UTF8 character */ - + } else if (((0xC0 <= *szSrc) && (*szSrc < 0xE0)) && (*(szSrc+1) >= 0x80)) { outBufSize -= 2; if (outBufSize < 0) goto __RETURN; - t2 = (unsigned char) (*szSrc & 0x003F); // right most 6 bit - t1 = (unsigned char) ((*szSrc & 0x07C0) >> 6); // right most 5 bit - - *des = 0xC0 | (t1 & 0x1F); - *(des+1) = 0x80 | (t2 & 0x3F); + *des = *szSrc; + *(des + 1) = *(szSrc + 1); des += 2; - szSrc += 1; - nChar -= 1; - } else { - /* check outbuffer's room for this UTF8 character */ - + szSrc += 2; + } else if ((*szSrc >= 0xE0) && (*(szSrc+1) >= 0x80) && (*(szSrc+2) >= 0x80)) { outBufSize -= 3; if (outBufSize < 0) goto __RETURN; - t3 = (unsigned char) (*szSrc & 0x003F); // right most 6 bit - t2 = (unsigned char) ((*szSrc & 0x0FC0) >> 6); // right most 6 bit - t1 = (unsigned char) ((*szSrc & 0xF000) >> 12); // right most 4 bit + *des = *szSrc; + *(des + 1) = *(szSrc + 1); + *(des + 2) = *(szSrc + 2); - *des = 0xE0 | (t1 & 0x0F); - *(des+1) = 0x80 | (t2 & 0x3F); - *(des+2) = 0x80 | (t3 & 0x3F); + des += 3; + szSrc += 3; + } else { + outBufSize --; + if (outBufSize < 0) + goto __RETURN; - des += 3; - szSrc += 1; - nChar -= 1; + *des = *szSrc; + des++; + szSrc++; + MSG_DEBUG("utf8 incorrect range!"); } + + nChar--; } __RETURN: @@ -6492,961 +5442,971 @@ __RETURN: return (des - org); } -static int __MsgGetUnicode2UTFCodeSize(unsigned short *szSrc, int nChar) +static void __MsgMIMERemoveQuote(char *szSrc) { - int nCount = 0; + int length = 0; - MSG_DEBUG(" ---------------"); + length = strlen(szSrc); + if (szSrc[0] == MSG_CH_QUOT && szSrc[length-1] == MSG_CH_QUOT) { + int index = 0; - if ((szSrc == NULL) || (nChar <= 0)) { - MSG_DEBUG("szSrc is NULL !!!! ---------------"); - return 0; + for (index = 0; index < length-2; index++) + szSrc[index] = szSrc[index+1]; + szSrc[index] = '\0'; } +} - while ((nChar > 0) && (*szSrc != '\0')) { - if (0x0001 <= *szSrc && *szSrc <= 0x007F) { - nCount += 1; - szSrc++; - nChar--; - } else if ((*szSrc == 0x0000) || (0x0080 <= *szSrc && *szSrc <= 0x07FF)) { - nCount += 2; - szSrc++; - nChar--; - } else { - nCount += 3; - szSrc++; - nChar--; - } +static bool __MsgLoadDataToDecodeBuffer(FILE *pFile, char **ppBuf, int *pPtr, int *pOffset, char *pInBuf1, char *pInBuf2, int maxLen, int *pBufLen, int endOfFile) +{ + MSG_BEGIN(); + int nRead = 0; + int length= 0; + + if (pFile == NULL) { + MSG_DEBUG("Error"); + + *pBufLen = 0; + return false; } - return nCount; -} + if (pPtr == NULL || pInBuf1 == NULL || pInBuf2 == NULL) { + MSG_DEBUG("Error"); -static bool __MmsAddrUtilCheckEmailAddress(char *pszAddr) -{ - if (!pszAddr || pszAddr[0] == 0) + *pBufLen = 0; return false; + } - if (!strchr (pszAddr, MSG_MMS_CH_EMAIL_AT)) + if (*pBufLen == 0) { + length = maxLen - (*pPtr); + } else { + length = (*pBufLen) - (*pPtr); + } + + if (length < 0) + length = 0; + + if ((*ppBuf) == NULL) { + memset(pInBuf1, 0, maxLen); + (*ppBuf) = pInBuf1; + } else if ((*ppBuf) == pInBuf1) { + memset(pInBuf2, 0, maxLen); + if (length) + memcpy(pInBuf2, pInBuf1 + (*pPtr), length); + (*ppBuf) = pInBuf2; + } else { + memset(pInBuf1, 0, maxLen); + if (length) + memcpy(pInBuf1, pInBuf2 + (*pPtr), length); + (*ppBuf) = pInBuf1; + } + + (*pPtr) = 0; + + if (*pOffset == endOfFile) { + *pBufLen = length; + return true; + } + + if (maxLen == length) { + /* (*pPtr) was 0 */ + if (MsgReadFileForDecode(pFile, (*ppBuf), maxLen, &nRead) == false) + return false; + + *pBufLen = nRead; + } else { + if (MsgReadFileForDecode(pFile, (*ppBuf) + length, maxLen - length, &nRead) == false) + return false; + + *pBufLen = length + nRead; + } + + if ((*pOffset = MsgFtell(pFile)) == -1L) { + MSG_DEBUG("MsgFtell Error"); return false; + } + + MSG_END(); return true; } -bool MmsAddrUtilRemovePlmnString(char *pszAddr) +/* + * This function write media data from raw data to file. + * @param pMsg + * @param pPartBody + * @param pszMailboxPath : path of mailbox + * @param pszMsgFilename : name of msg file + * @param index : used for file naming + * @param bSave : if true, file will be save otherwise just filename will be stored. + */ +static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody, char *pszMailboxPath, char *pszMsgFilename, int index, bool bSave) { - char *pszAddrCopy = NULL; - char *pszStrStart = NULL; - char *pszStrTemp = NULL; - int strLen = 0; + FILE *pFile = NULL; + char szFileName[MSG_FILENAME_LEN_MAX+1] = {0, }; // file name of temp file + char szFullPath[MSG_FILEPATH_LEN_MAX] = {0, }; // full absolute path of temp file. + bool bFileExist = false; + MSG_BEGIN(); - if ((!pszAddr) || (pszAddr[0] == 0)) { - MSG_DEBUG("pszAddr is null or zero"); + if (!pPartType) { + MSG_DEBUG("pPartType is NULL"); return false; } - strLen = strlen(pszAddr); + if (pPartType->type == MIME_APPLICATION_SMIL) { + snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", "smil.txt"); + } else { - pszAddrCopy = (char*)calloc(1,strLen + 1); - if (!pszAddrCopy) { - MSG_DEBUG("pszAddrCopy is NULL, mem alloc failed"); - return false; + if (pPartType->param.szName[0] != '\0') { + snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", pPartType->param.szName); + } else if (pPartType->param.szFileName[0] != '\0') { + snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", pPartType->param.szFileName); + } else if (pPartType->szContentLocation[0] != '\0') { + snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", pPartType->szContentLocation); + } else { + snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%lu", (unsigned long)index); + } } - strcpy(pszAddrCopy, pszAddr); + // make full path for save + __MsgMakeFileName(pPartType->type, szFileName, pPartType->drmInfo.drmType, 0, szFileName, sizeof(szFileName)); //FL & CD -> extension(.dm) SD -> extension(.dcf) + snprintf(szFullPath, MSG_FILEPATH_LEN_MAX, "%s%s.dir/%s", pszMailboxPath, pszMsgFilename, szFileName); // get absolute path of each temp file of each part - pszAddr[0] = 0; - pszStrStart = pszAddrCopy; + if (pPartType->type == MIME_APPLICATION_OCTET_STREAM) + MmsGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, szFullPath, (MimeType *)&pPartType->type, NULL); - while (true) { - char* pszStrEnd = NULL; - int addressLen = 0; + // save file + bFileExist = MsgAccessFile(szFullPath, F_OK); - if (__MmsAddrUtilCheckEmailAddress(pszAddrCopy)) - pszStrEnd = strstr(pszStrStart, "/TYPE=PLMN"); - else - pszStrEnd = strstr(pszStrStart, "/"); + MSG_SEC_DEBUG("save flag [%d], filepath [%s], file exist [%d]", bSave, szFullPath, bFileExist); - if (!pszStrEnd) { - // "/TYPE=PLMN" not found + if (bSave == true && bFileExist == false) { - int remainedLen = strlen(pszStrStart); + if ((pFile = MsgOpenFile(szFullPath, "wb+")) == NULL) { + MSG_DEBUG("MsgOpenFile failed"); + goto __CATCH; + } - if (remainedLen <= 0) - break; + if (__MmsGetMediaPartData(pPartType, pPartBody, pFile) == false) { + MSG_DEBUG("MmsGetMediaPartData fail [index:%d]\n", index); + goto __CATCH; + } + + MsgCloseFile(pFile); + pFile = NULL; - strcat(pszAddr, pszStrStart); + snprintf(pPartBody->szOrgFilePath, sizeof(pPartBody->szOrgFilePath), "%s", szFullPath); - break; + //IF DRM type Convert to dcf + if (pPartType->type == MIME_APPLICATION_VND_OMA_DRM_MESSAGE + || pPartType->type == MIME_APPLICATION_VND_OMA_DRM_CONTENT) + { + char destDrmPath[MSG_FILEPATH_LEN_MAX] = {0,}; + + if (MsgDrmConvertDmtoDcfType(pPartBody->szOrgFilePath, destDrmPath) == true) { + MSG_INFO("Success Convert to Dcf"); + + bFileExist = MsgAccessFile(destDrmPath, F_OK); + + if (bFileExist) { + snprintf(pPartBody->szOrgFilePath, sizeof(pPartBody->szOrgFilePath), "%s", destDrmPath); + MsgGetFileName(pPartBody->szOrgFilePath, szFileName, MSG_FILENAME_LEN_MAX); + } + + } else { + MSG_INFO("Fail Convert to Dcf"); + } + + if (MsgDrmIsDrmFile(pPartBody->szOrgFilePath) == true) + MmsPluginDrmGetInfo(pPartBody->szOrgFilePath, pPartType); + + MSG_SEC_INFO("Drm File Path [%s] isdrm [%d]", pPartBody->szOrgFilePath, MsgDrmIsDrmFile(pPartBody->szOrgFilePath)); } - // Get one address length - addressLen = pszStrEnd - pszStrStart; + pPartBody->offset = 0; + pPartBody->size = MsgGetFileSize(pPartBody->szOrgFilePath); - strncat(pszAddr, pszStrStart, addressLen); + if (pPartType->drmInfo.drmType != MSG_DRM_TYPE_NONE) { + MsgDrmRegisterFile(MSG_MODE_FILE, pPartBody->szOrgFilePath, strlen(pPartBody->szOrgFilePath)); - // Find next address - pszStrStart = pszStrEnd; + /* change szDrm2FullPath as current content path*/ + if (pPartType->drmInfo.szDrm2FullPath) { + free(pPartType->drmInfo.szDrm2FullPath); + pPartType->drmInfo.szDrm2FullPath = g_strdup(pPartBody->szOrgFilePath); + } + } - pszStrTemp = strstr(pszStrStart, MSG_MMS_STR_ADDR_DELIMETER); + MSG_SEC_DEBUG("Save Part File to [%s]", pPartBody->szOrgFilePath); - if (pszStrTemp) { - addressLen = pszStrTemp - pszStrEnd; - pszStrStart += addressLen; - } else { - pszStrStart += strlen(pszStrEnd); + } else { + snprintf(pPartBody->szOrgFilePath, sizeof(pPartBody->szOrgFilePath), "%s", szFullPath); + + //IF DRM type check dcf exist + if (pPartType->type == MIME_APPLICATION_VND_OMA_DRM_MESSAGE + || pPartType->type == MIME_APPLICATION_VND_OMA_DRM_CONTENT) + { + char destDrmPath[MSG_FILEPATH_LEN_MAX] = {0,}; + + MsgGetFileNameWithoutExtension(destDrmPath, pPartBody->szOrgFilePath); + strncat(destDrmPath, ".dcf", 4); + + bFileExist = MsgAccessFile(destDrmPath, F_OK); + + if (bFileExist) { + snprintf(pPartBody->szOrgFilePath, sizeof(pPartBody->szOrgFilePath), "%s", destDrmPath); + MsgGetFileName(pPartBody->szOrgFilePath, szFileName, MSG_FILENAME_LEN_MAX); + } + + if (MsgDrmIsDrmFile(pPartBody->szOrgFilePath) == true) + MmsPluginDrmGetInfo(pPartBody->szOrgFilePath, pPartType); } - if (pszStrStart[0] == 0) // end of string - break; + pPartBody->offset = 0; + pPartBody->size = MsgGetFileSize(pPartBody->szOrgFilePath); + MSG_SEC_DEBUG("Set Part File to [%s]", pPartBody->szOrgFilePath); + } - strcat(pszAddr, MSG_MMS_STR_ADDR_DELIMETER); // add ';' - pszStrStart++; // remove ';' + //file name fix + if (szFileName[0] != '\0') { + snprintf(pPartType->param.szFileName, MSG_FILENAME_LEN_MAX+1, "%s.dir/%s", pszMsgFilename, szFileName);// store relative path of each temp file of each part including sub folder. + snprintf(pPartType->param.szName, MSG_LOCALE_FILENAME_LEN_MAX+1, "%s", szFileName); + MSG_SEC_DEBUG("Set Name : %s", pPartType->param.szName); } - if (pszAddr[0] == 0) - strcpy(pszAddr, pszAddrCopy); + MSG_END(); + return true; - free(pszAddrCopy); +__CATCH: - return true; + if (pFile != NULL) { + MsgCloseFile(pFile); + pFile = NULL; + } + MSG_END(); + return false; } -static int __MsgCutUTFString(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar) +bool __MmsGetMediaPartData(MsgType *pPartType, MsgBody *pPartBody, FILE* pFile) { - unsigned char *org; + int nRead = 0; + int nRead2 = 0; + char *pData = NULL; + char *pNewData = NULL; + char *pTempData = NULL; + int msgEncodingValue = 0; + int msgTypeValue = 0; + int msgCharsetValue = 0; - MSG_DEBUG("---------------"); + int offset = 0; + int size = 0; - org = des; - outBufSize--; // NULL character + msgEncodingValue = pPartType->encoding; + msgTypeValue = pPartType->type; + msgCharsetValue = pPartType->param.charset; - while ((nChar > 0) && (*szSrc != '\0')) { - if (*szSrc < 0x80) { - outBufSize --; - if (outBufSize < 0) - goto __RETURN; + offset = pPartBody->offset; + size = pPartBody->size; + + if (pPartBody->szOrgFilePath[0]) { + pTempData = MsgOpenAndReadMmsFile(pPartBody->szOrgFilePath, offset, size, &nRead); - *des = *szSrc; - des++; - szSrc++; - } else if (((0xC0 <= *szSrc) && (*szSrc < 0xE0)) && (*(szSrc+1) >= 0x80)) { - outBufSize -= 2; - if (outBufSize < 0) - goto __RETURN; + if (pTempData == NULL) { + MSG_DEBUG("pTempData read fail"); + goto __CATCH; + } - *des = *szSrc; - *(des + 1) = *(szSrc + 1); + pData = pTempData; + } else if (pPartBody->body.pText) { + pData = pPartBody->body.pText; + nRead = pPartBody->size; + } - des += 2; - szSrc += 2; - } else if ((*szSrc >= 0xE0) && (*(szSrc+1) >= 0x80) && (*(szSrc+2) >= 0x80)) { - outBufSize -= 3; - if (outBufSize < 0) - goto __RETURN; + if (pData == NULL) { + MSG_DEBUG("there is no data"); + goto __RETURN; + } - *des = *szSrc; - *(des + 1) = *(szSrc + 1); - *(des + 2) = *(szSrc + 2); + pNewData = __MmsGetBinaryUTF8Data(pData, nRead, msgEncodingValue, msgTypeValue, msgCharsetValue, &nRead2); - des += 3; - szSrc += 3; - } else { - outBufSize --; - if (outBufSize < 0) - goto __RETURN; + if (pNewData) { + pPartType->encoding = MSG_ENCODING_BINARY; - *des = *szSrc; - des++; - szSrc++; - MSG_DEBUG("utf8 incorrect range!"); + if (MmsIsTextType(msgTypeValue)) + pPartType->param.charset = MSG_CHARSET_UTF8; + + if (MsgWriteFile(pNewData, sizeof(char), nRead2, pFile) != (size_t)nRead2) { + MSG_DEBUG("file writing fail"); + goto __CATCH; } - nChar--; + } else { + if (MsgWriteFile(pData, sizeof(char), nRead, pFile) != (size_t)nRead) { + MSG_DEBUG("file writing fail"); + goto __CATCH; + } } __RETURN: - *des = 0; - return (des - org); -} + if (pNewData) { + free(pNewData); + pNewData = NULL; + } -static void __MsgMIMERemoveQuote(char *szSrc) -{ - int length = 0; + if (pTempData) { + free(pTempData); + pTempData = NULL; + } - length = MsgStrlen(szSrc); - if (szSrc[0] == MSG_CH_QUOT && szSrc[length-1] == MSG_CH_QUOT) { - int index = 0; + return true; - for (index = 0; index < length-2; index++) - szSrc[index] = szSrc[index+1]; - szSrc[index] = '\0'; +__CATCH: + + if (pNewData) { + free(pNewData); + pNewData = NULL; + } + + if (pTempData) { + free(pTempData); + pTempData = NULL; } + + return false; } -static bool __MsgLoadDataToDecodeBuffer(FILE *pFile, char **ppBuf, int *pPtr, int *pOffset, char *pInBuf1, char *pInBuf2, int maxLen, int *pBufLen, int endOfFile) +char *__MmsGetBinaryUTF8Data(char *pData, int nRead, int msgEncodingValue, int msgTypeValue, int msgCharsetValue, int *npRead) { - MSG_BEGIN(); - int nRead = 0; - int length= 0; + int nByte = 0; + int nTemp = 0; + char *pTemp = NULL; - if (pFile == NULL) { - MSG_DEBUG("Error"); + char *pConvertedStr = NULL; + char *pConvertedData = NULL; + char *pNewData = NULL; + char *pReturnData = NULL; - *pBufLen = 0; - return false; - } + const char *pToCodeSet = "UTF-8"; + const char *pFromCodeSet = NULL; - if (pPtr == NULL || pInBuf1 == NULL || pInBuf2 == NULL) { - MSG_DEBUG("Error"); + switch (msgEncodingValue) { + case MSG_ENCODING_BASE64: - *pBufLen = 0; - return false; - } + pConvertedData = (char*)MsgDecodeBase64((UCHAR*)pData, (ULONG)nRead, (ULONG*)&nByte); + MSG_DEBUG("MSG_ENCODING_BASE64 bodyLength [%d]", nByte); - if (*pBufLen == 0) { - length = maxLen - (*pPtr); - } else { - length = (*pBufLen) - (*pPtr); - } + pTemp = pConvertedData; + nTemp = nByte; - if (length < 0) - length = 0; + break; - if ((*ppBuf) == NULL) { - memset(pInBuf1, 0, maxLen); - (*ppBuf) = pInBuf1; - } else if ((*ppBuf) == pInBuf1) { - memset(pInBuf2, 0, maxLen); - if (length) - memcpy(pInBuf2, pInBuf1 + (*pPtr), length); - (*ppBuf) = pInBuf2; - } else { - memset(pInBuf1, 0, maxLen); - if (length) - memcpy(pInBuf1, pInBuf2 + (*pPtr), length); - (*ppBuf) = pInBuf1; - } + case MSG_ENCODING_QUOTE_PRINTABLE: - (*pPtr) = 0; + pConvertedData = (char*)MsgDecodeQuotePrintable((UCHAR*)pData, (ULONG)nRead, (ULONG*)&nByte); + MSG_DEBUG("MSG_ENCODING_QUOTE_PRINTABLE bodyLength [%d]", nByte); - if (*pOffset == endOfFile) { - *pBufLen = length; - return true; - } + pTemp = pConvertedData; + nTemp = nByte; - if (maxLen == length) { - /* (*pPtr) was 0 */ - if (MsgReadFileForDecode(pFile, (*ppBuf), maxLen, &nRead) == false) - return false; + break; - *pBufLen = nRead; - } else { - if (MsgReadFileForDecode(pFile, (*ppBuf) + length, maxLen - length, &nRead) == false) - return false; + default: - *pBufLen = length + nRead; - } + MSG_DEBUG("encoding val [%d] bodyLength [%d]", msgEncodingValue, nRead); + pTemp = pData; + nTemp = nRead; - if ((*pOffset = MsgFtell(pFile)) == -1L) { - MSG_DEBUG("MsgFtell Error"); - return false; + break; } - MSG_END(); + if (MmsIsTextType(msgTypeValue)) { - return true; -} + if (msgCharsetValue == MSG_CHARSET_US_ASCII) { + pNewData = pTemp; + *npRead = nTemp; + } else if (msgCharsetValue == MSG_CHARSET_UTF8) { + // skip BOM (Byte Order Mark) bytes .. (Please refer to the http://www.unicode.org/faq/utf_bom.html#BOM) + if (nTemp >= 3) { + if (((UINT8)pTemp[0]) == 0xEF && ((UINT8)pTemp[1]) == 0xBB && ((UINT8)pTemp[2]) == 0xBF) { + pTemp += 3; + nTemp -= 3; + } + } -bool MsgGetTypeByFileName(int *type, char *szFileName) -{ - char *pExt = NULL; - AvCodecType AvType = AV_CODEC_NONE; + pNewData = pTemp; + *npRead = nTemp; + } else { - pExt = strrchr(szFileName, '.'); - if (pExt == NULL || pExt[0] == '\0') - goto __CATCH; + UINT16 MIBenum = MmsGetBinaryValue(MmsCodeCharSet, msgCharsetValue); - pExt++; + pFromCodeSet = MmsGetTextByCode(MmsCodeCharSet, MIBenum); - if (strcasecmp(pExt, "mp4") == 0 ||strcasecmp(pExt, "mpeg4") == 0 ||strcasecmp(pExt, "3gp") == 0 ||strcasecmp(pExt, "3gpp") == 0) { + MSG_DEBUG("char set enum = [%d], MIBenum = [%d], str = [%s]", msgCharsetValue, MIBenum, pFromCodeSet); - if (szFileName[0] != '/') - goto __CATCH; + if (pFromCodeSet) { + MSG_DEBUG("Convert to UTF-8"); - AvType = AvGetFileCodecType(szFileName); - MSG_DEBUG("AvType(0x%x)\n", AvType); + if (MmsPluginTextConvert(pToCodeSet, pFromCodeSet, pTemp, nTemp, &pConvertedStr, npRead) == true) { + pNewData = pConvertedStr; + } else { + MSG_DEBUG("Failed MmsPluginTextConvert"); + pNewData = pTemp; + *npRead = nTemp; + } - switch (AvType) { - case AV_DEC_AUDIO_MPEG4: - *type = MIME_AUDIO_MP4; - break; + } else {//unsupported charset + MSG_DEBUG("unsupported charset"); + pNewData = pTemp; + *npRead = nTemp; + } + } - case AV_DEC_VIDEO_MPEG4: - *type = MIME_VIDEO_MP4; - break; + } else { + pNewData = pTemp; + *npRead = nTemp; + } - default: - *type = MIME_VIDEO_3GPP; - break; - } - return true; + pReturnData = (char *)malloc(*npRead); + if (pReturnData == NULL) { + MSG_DEBUG("pReturnData alloc fail."); + goto __CATCH; } - if (strcasecmp(pExt, "amr") == 0) { - *type = MIME_AUDIO_AMR; - return true; - } else if ((strcasecmp(pExt, "mid") == 0) || (strcasecmp(pExt, "midi") == 0)) { - *type = MIME_AUDIO_MIDI; - return true; - } else if (strcasecmp(pExt, "imy") == 0) { - *type = MIME_TEXT_X_IMELODY; - return true; + if (pNewData != NULL) { + memset(pReturnData, 0, *npRead); + memcpy(pReturnData, pNewData, *npRead); } - *type = MimeGetMimeFromExtInt((const char*)pExt); - MSG_DEBUG("filename [%s], type [%d]", szFileName, *type); - return true; + if (pConvertedData) { + free(pConvertedData); + pConvertedData = NULL; + } + + if (pConvertedStr) { + free(pConvertedStr); + pConvertedStr = NULL; + } + + return pReturnData; __CATCH: - *type = MIME_UNKNOWN; - MSG_DEBUG("filename [%s], type [%d]", szFileName, *type); - return false; + if (pConvertedData) { + free(pConvertedData); + pConvertedData = NULL; + } -} + if (pConvertedStr) { + free(pConvertedStr); + pConvertedStr = NULL; + } + return NULL; +} -/* - * This function write media data from raw data to file. - * @param pMsg - * @param pPartBody - * @param pszMailboxPath : path of mailbox - * @param pszMsgFilename : name of msg file - * @param index : used for file naming - * @param bSave : if true, file will be save otherwise just filename will be stored. - */ -static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody, char *pszMailboxPath, char *pszMsgFilename, int index, bool bSave) +static bool __MsgMakeFileName(int iMsgType, char *szFileName, MsgDrmType drmType, int nUntitleIndex, char *outBuf, int outBufLen) { - FILE *pFile = NULL; - char szFileName[MSG_FILENAME_LEN_MAX+1] = {0, }; // file name of temp file - char szFullPath[MSG_FILEPATH_LEN_MAX] = {0, }; // full absolute path of temp file. - bool bFileExist = false; - MSG_BEGIN(); + char szTemp[MSG_FILENAME_LEN_MAX+1]={0,}; + char szTempFileName[MSG_FILENAME_LEN_MAX+1]={0,}; + const char *pExt = NULL; - if (!pPartType) { - MSG_DEBUG("pPartType is NULL"); + SECURE_SLOGD("Input : type [0x%x], drmType [%d], filename [%s]", iMsgType, drmType, szFileName); + + if (szFileName == NULL) return false; - } - if (pPartType->type == MIME_APPLICATION_SMIL) { - snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", "smil.txt"); + //Filename + int inp_len = strlen(szFileName); + if (inp_len > 0) { + + pExt = strrchr(szFileName, '.'); + + if (pExt != NULL && *(pExt + 1) != '\0') { + pExt = pExt +1; + } else { + pExt = NULL; + } + + MsgGetFileNameWithoutExtension(szTempFileName, szFileName); } else { - if (pPartType->param.szName[0] != '\0') { - snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", pPartType->param.szName); - } else if (pPartType->param.szFileName[0] != '\0') { - snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", pPartType->param.szFileName); + if (nUntitleIndex >= 1) { + snprintf(szTempFileName, sizeof(szTempFileName), "%s_%d", "untitled", nUntitleIndex); } else { - snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%lu", (unsigned long)index); + snprintf(szTempFileName, sizeof(szTempFileName), "%s", "untitled"); } } + //extension + if (iMsgType == MIME_APPLICATION_VND_OMA_DRM_MESSAGE) + pExt = "dm"; + else if (iMsgType == MIME_APPLICATION_VND_OMA_DRM_CONTENT) + pExt = "dcf"; -#ifndef __SUPPORT_DRM__ - __MsgMakeFileName(pPartType->type, szFileName, 0); //FL & CD -> extension(.dm) SD -> extension(.dcf) -#else - __MsgMakeFileName(pPartType->type, szFileName, pPartType->drmInfo.drmType, 0, szFileName, sizeof(szFileName)); //FL & CD -> extension(.dm) SD -> extension(.dcf) - if (MsgDRMIsForwardLockType(pPartType->drmInfo.drmType)) - MsgChangeDrm2FileName(szFileName); -#endif + if (pExt == NULL) { // find ext from content type + if (iMsgType == MIME_APPLICATION_OCTET_STREAM || iMsgType == MIME_UNKNOWN) { + MSG_DEBUG("unsupported MsgType [%d]", iMsgType); + goto __CATCH; + } - snprintf(szFullPath, MSG_FILEPATH_LEN_MAX, "%s%s.dir/%s", pszMailboxPath, pszMsgFilename, szFileName); // get absolute path of each temp file of each part - snprintf(pPartType->param.szFileName, MSG_FILENAME_LEN_MAX+1, "%s.dir/%s", pszMsgFilename, szFileName);// store relative path of each temp file of each part including sub folder. + pExt = MimeGetExtFromMimeInt((MimeType)iMsgType); + } - if (pPartType->param.szName[0] == '\0') { - snprintf(pPartType->param.szName, MSG_LOCALE_FILENAME_LEN_MAX+1, "%s", szFileName); - MSG_DEBUG("Set Name : %s", pPartType->param.szName); + //Filename + extension + if (pExt) { + snprintf(szTemp, sizeof(szTemp), "%s.%s", szTempFileName, pExt); + } else { + MSG_DEBUG("Failed to get extension of that mime data file."); + goto __CATCH; } - if (pPartType->type == MIME_APPLICATION_OCTET_STREAM) - MsgGetTypeByFileName(&pPartType->type, szFullPath); + snprintf(outBuf, outBufLen, "%s", szTemp); + SECURE_SLOGD("Result : filename [%s]", outBuf); + return true; - // save file - bFileExist = MsgAccessFile(szFullPath, F_OK); +__CATCH: + return false; +} - MSG_DEBUG("save flag [%d], filepath [%s], file exist [%d]", bSave, szFullPath, bFileExist); +bool MsgGetFileNameWithoutExtension (char *szOutputName, char *szName) +{ + char *pszExt = NULL; - if (bSave == true && bFileExist == false) { + if (szOutputName == NULL) { + MSG_DEBUG("szOutputName is NULL"); + return false; + } - if ((pFile = MsgOpenFile(szFullPath, "wb+")) == NULL) { - MSG_DEBUG("MsgOpenFile failed"); - goto __CATCH; - } + strncpy(szOutputName, szName, strlen(szName)); - if (__MmsGetMediaPartData(pPartType, pPartBody, pFile) == false) { - MSG_DEBUG("MmsGetMediaPartData fail [index:%d]\n", index); - goto __CATCH; + if ((pszExt = strrchr(szOutputName, '.'))) { + if (pszExt[0] == '.') + pszExt[0] = '\0'; + } + + return true; +} + +bool MsgGetFileName(char *szFilePath, char *szFileName, int size) +{ + char *filename = NULL; + if (szFilePath) { + filename = strrchr(szFilePath, '/'); + if (filename != NULL) { + snprintf(szFileName, size, "%s", filename + 1); + } else { + snprintf(szFileName, size, "%s", szFilePath); } + } else { + return false; + } - MsgCloseFile(pFile); - pFile = NULL; + return true; +} - snprintf(pPartBody->szOrgFilePath, sizeof(pPartBody->szOrgFilePath), "%s", szFullPath); - pPartBody->offset = 0; - pPartBody->size = MsgGetFileSize(pPartBody->szOrgFilePath); +bool MmsGetMediaPartHeader(int index, MsgType *pHeader) +{ + MmsMsg *pMsg = NULL; + MsgMultipart *pPart = NULL; + if (pHeader == NULL) { + MSG_DEBUG("Invalid pHeader input. It's null"); + return false; + } - if (pPartType->drmInfo.drmType != MSG_DRM_TYPE_NONE) { - MsgDrmRegisterFile(MSG_MODE_FILE, szFullPath, strlen(szFullPath)); + MmsPluginStorage::instance()->getMmsMessage(&pMsg); - /* change szDrm2FullPath as current content path*/ - if (pPartType->drmInfo.szDrm2FullPath) { - free(pPartType->drmInfo.szDrm2FullPath); - pPartType->drmInfo.szDrm2FullPath = MsgStrCopy(szFullPath); - } + MmsInitMsgType(pHeader); + + + /* Requires header of non-presentation */ + if (MsgIsMultipart(pMsg->msgType.type)) { + MSG_DEBUG("Multipart header [index = %d] \n", index); + + pPart = pMsg->msgBody.body.pMultipart; + + while (pPart && index--) + pPart = pPart->pNext; + + if (pPart == NULL) { + MSG_DEBUG("There is no such msg part."); + return false; } - MSG_DEBUG("Save Part File to [%s]", pPartBody->szOrgFilePath); + + memcpy(pHeader, &pPart->type, sizeof(MsgType)); } else { - snprintf(pPartBody->szOrgFilePath, sizeof(pPartBody->szOrgFilePath), "%s", szFullPath); - pPartBody->offset = 0; - pPartBody->size = MsgGetFileSize(pPartBody->szOrgFilePath); - MSG_DEBUG("Set Part File to [%s]", pPartBody->szOrgFilePath); + MSG_DEBUG("Requires singlepart header"); + memcpy(pHeader, &pMsg->msgType, sizeof(MsgType)); } - MSG_END(); return true; +} -__CATCH: - if (pFile != NULL) { - MsgCloseFile(pFile); - pFile = NULL; - } - MSG_END(); - return false; +/////////////////////////////////////////////////////////////////////////////// + +MmsPluginDecoder *MmsPluginDecoder::pInstance = NULL; + +MmsPluginDecoder *MmsPluginDecoder::instance() +{ + if (!MmsPluginDecoder::pInstance) + MmsPluginDecoder::pInstance = new MmsPluginDecoder(); + + return MmsPluginDecoder::pInstance; } -bool __MmsGetMediaPartData(MsgType *pPartType, MsgBody *pPartBody, FILE* pFile) +MmsPluginDecoder::MmsPluginDecoder(){} +MmsPluginDecoder::~MmsPluginDecoder(){} + +void MmsPluginDecoder::decodeMmsPdu(MmsMsg *pMsg, msg_message_id_t msgID, const char *pduFilePath) { - int nRead = 0; - int nRead2 = 0; - char *pData = NULL; - char *pNewData = NULL; - char *pTempData = NULL; - int msgEncodingValue = 0; - int msgTypeValue = 0; - int msgCharsetValue = 0; - int cidLen = 0; - char *szCid = NULL; - int offset = 0; - int size = 0; + MSG_BEGIN(); - msgEncodingValue = pPartType->encoding; - msgTypeValue = pPartType->type; - msgCharsetValue = pPartType->param.charset; + FILE *pFile = NULL; + MsgMultipart *pMultipart = NULL; + int nSize = 0; + char szFullPath[MSG_FILEPATH_LEN_MAX] = {0, }; + char szTempMediaDir[MSG_FILEPATH_LEN_MAX] = {0, }; - cidLen = MsgStrlen(szCid); + MmsInitHeader(); - offset = pPartBody->offset; - size = pPartBody->size; + pMsg->msgID = msgID; - if (pPartBody->szOrgFilePath[0]) { - pTempData = MsgOpenAndReadMmsFile(pPartBody->szOrgFilePath, offset, size, &nRead); + snprintf(szFullPath, sizeof(szFullPath), "%s", pduFilePath); - if (pTempData == NULL) { - MSG_DEBUG("pTempData read fail"); - goto __CATCH; - } + MsgGetFileName(szFullPath, pMsg->szFileName, sizeof(pMsg->szFileName)); - pData = pTempData; - } else if (pPartBody->body.pText) { - pData = pPartBody->body.pText; - nRead = pPartBody->size; + if (MsgGetFileSize(szFullPath, &nSize) == false) { + MSG_FATAL("Fail MsgGetFileSize"); + goto __CATCH; } - if (pData == NULL) { - MSG_DEBUG("there is no data"); - goto __RETURN; + pFile = MsgOpenFile(szFullPath, "rb"); + if (pFile == NULL) { + MSG_SEC_DEBUG("Fail MsgOpenFile [%s]", szFullPath); + goto __CATCH; } - pNewData = __MmsGetBinaryUTF8Data(pData, nRead, msgEncodingValue, msgTypeValue, msgCharsetValue, &nRead2); - pPartType->encoding = MSG_ENCODING_BINARY; - - if (__MsgIsText(msgTypeValue)) - pPartType->param.charset = MSG_CHARSET_UTF8; + MmsRegisterDecodeBuffer(); - if (MsgWriteFile(pNewData, sizeof(char), nRead2, pFile) != (size_t)nRead2) { - MSG_DEBUG("file writing fail"); + if (MmsBinaryDecodeMsgHeader(pFile, nSize) == false) { + MSG_FATAL("Fail to MmsBinaryDecodeMsgHeader"); + goto __CATCH; + } + if (MmsBinaryDecodeMsgBody(pFile, szFullPath, nSize) == false) { + MSG_FATAL("Fail to MmsBinaryDecodeMsgBody"); goto __CATCH; } -__RETURN: + /* Set mmsHeader.msgType & msgBody to pMsg ----------- */ - if (pNewData) { - free(pNewData); - pNewData = NULL; - } + memcpy(&(pMsg->msgType), &(mmsHeader.msgType), sizeof(MsgType)); + memcpy(&(pMsg->msgBody), &(mmsHeader.msgBody), sizeof(MsgBody)); - if (pTempData) { - free(pTempData); - pTempData = NULL; - } +{//attribute convert mmsHeader -> mmsAttribute - return true; + pMsg->mmsAttrib.contentType = (MimeType)mmsHeader.msgType.type; -__CATCH: + pMsg->mmsAttrib.date = mmsHeader.date; - if (pNewData) { - free(pNewData); - pNewData = NULL; + if (mmsHeader.deliveryReport == MMS_REPORT_YES) { + pMsg->mmsAttrib.bAskDeliveryReport = true; } - if (pTempData) { - free(pTempData); - pTempData = NULL; - } + memcpy(&pMsg->mmsAttrib.deliveryTime, &mmsHeader.deliveryTime, sizeof(MmsTimeStruct)); - return false; -} + memcpy(&pMsg->mmsAttrib.expiryTime, &mmsHeader.expiryTime, sizeof(MmsTimeStruct)); -static char *__MmsGetBinaryUTF8Data(char *pData, int nRead, int msgEncodingValue, int msgTypeValue, int msgCharsetValue, int *npRead) -{ - int nChar = 0; - int nByte = 0; - int nTemp = 0; - char *pTemp = NULL; - unsigned short *mszTempStr = NULL; - char *pConvertedStr = NULL; - char *pConvertedData = NULL; - char *pNewData = NULL; - char *pReturnData = NULL; + pMsg->mmsAttrib.msgClass = mmsHeader.msgClass; + snprintf(pMsg->szMsgID, sizeof(pMsg->szMsgID), "%s", mmsHeader.szMsgID); - switch (msgEncodingValue) { - case MSG_ENCODING_BASE64: + pMsg->mmsAttrib.msgType = mmsHeader.type; - pConvertedData = (char*)MsgDecodeBase64((UCHAR*)pData, (ULONG)nRead, (ULONG*)&nByte); - MSG_DEBUG("MSG_ENCODING_BASE64 bodyLength [%d]", nByte); + pMsg->mmsAttrib.version = mmsHeader.version; - pTemp = pConvertedData; - nTemp = nByte; + pMsg->mmsAttrib.msgSize = mmsHeader.msgSize; - break; + pMsg->mmsAttrib.priority = mmsHeader.priority; - case MSG_ENCODING_QUOTE_PRINTABLE: + if (mmsHeader.readReply == MMS_REPORT_YES) { + pMsg->mmsAttrib.bAskReadReply = true; + } - pConvertedData = (char*)MsgDecodeQuotePrintable((UCHAR*)pData, (ULONG)nRead, (ULONG*)&nByte); - MSG_DEBUG("MSG_ENCODING_QUOTE_PRINTABLE bodyLength [%d]", nByte); + snprintf(pMsg->mmsAttrib.szSubject, sizeof(pMsg->mmsAttrib.szSubject), "%s", mmsHeader.szSubject); - pTemp = pConvertedData; - nTemp = nByte; + snprintf(pMsg->szTrID, sizeof(pMsg->szTrID), "%s", mmsHeader.szTrID); - break; + pMsg->mmsAttrib.retrieveStatus = mmsHeader.retrieveStatus; - default: + //FIXME:: mmsHeader will release after delete global mmsHeader + //memset(&(mmsHeader.msgBody), 0x00, sizeof(MsgBody));//After copy to MmsMsg +} + if (pMsg->msgBody.pPresentationBody) { + if(MsgFseek(pFile, pMsg->msgBody.pPresentationBody->offset, SEEK_SET) < 0) + goto __CATCH; - MSG_DEBUG("encoding val [%d] bodyLength [%d]", msgEncodingValue, nRead); - pTemp = pData; - nTemp = nRead; + pMsg->msgBody.pPresentationBody->body.pText = (char *)malloc(pMsg->msgBody.pPresentationBody->size + 1); + if (pMsg->msgBody.pPresentationBody->body.pText == NULL) + goto __CATCH; - break; + memset(pMsg->msgBody.pPresentationBody->body.pText, 0, pMsg->msgBody.pPresentationBody->size + 1); + + ULONG nRead = 0; + nRead = MsgReadFile(pMsg->msgBody.pPresentationBody->body.pText, sizeof(char), pMsg->msgBody.pPresentationBody->size, pFile); + if (nRead == 0) + goto __CATCH; + + } + + MsgCloseFile(pFile); + pFile = NULL; + /* nPartCount */ + pMsg->nPartCount = 0; + + if (MsgIsMultipart(mmsHeader.msgType.type) == true) { + pMultipart = pMsg->msgBody.body.pMultipart; + while (pMultipart) { + pMsg->nPartCount++; + pMultipart = pMultipart->pNext; + } + } else { + if (pMsg->msgBody.size > 0) + pMsg->nPartCount++; } - if (__MsgIsText(msgTypeValue)) { - /* charset converting */ - - switch (msgCharsetValue) { - case MSG_CHARSET_UTF16: - case MSG_CHARSET_USC2: - - MSG_DEBUG("MSG_CHARSET_USC2"); + /* make temporary */ + snprintf(szTempMediaDir, MSG_FILEPATH_LEN_MAX, "%s%s.dir", MSG_DATA_PATH, pMsg->szFileName); - if (((UINT8)pTemp[0]) == 0xFF && ((UINT8)pTemp[1]) == 0xFE) { - nChar = (nTemp / 2 - 1); + if (MsgIsMultipart(pMsg->msgType.type) == true) { + int partIndex = 0; + pMultipart = pMsg->msgBody.body.pMultipart; - mszTempStr = (unsigned short*) malloc(nChar * sizeof(unsigned short)); - if (mszTempStr == NULL) { - MSG_DEBUG("Memory Full !!!"); + //if (bSavePartsAsTempFiles) { + if (mkdir(szTempMediaDir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) { + if (errno == EEXIST) { + MSG_SEC_DEBUG("exist dir : [%s]", szTempMediaDir); + } else { + MSG_SEC_DEBUG("Fail to Create Dir [%s]", szTempMediaDir); goto __CATCH; } - - memcpy(mszTempStr, ((unsigned short*)pTemp + 1), nChar * sizeof(unsigned short)); - - nByte = __MsgGetUnicode2UTFCodeSize(((unsigned short*)pTemp + 1), nChar); - if (nByte < 3) - nByte = 3; //min value - - pConvertedStr = (char *)malloc(nByte + 1); - if (pConvertedStr != NULL) - __MsgUnicode2UTF ((unsigned char*)pConvertedStr, nByte + 1, mszTempStr, nChar); } else { - nChar = (nTemp / 2); - - mszTempStr = (unsigned short*) malloc(nChar * sizeof(unsigned short)); - if (mszTempStr == NULL) { - MSG_DEBUG("Memory Full !!!"); - goto __CATCH; - } - - memcpy(mszTempStr, ((unsigned short*)pTemp), nChar * sizeof(unsigned short)); - - nByte = __MsgGetUnicode2UTFCodeSize(((unsigned short*)pTemp), nChar); - - pConvertedStr = (char *)malloc(nByte + 1); - if (pConvertedStr) - __MsgUnicode2UTF ((unsigned char*)pConvertedStr, nByte + 1, mszTempStr, nChar); + MSG_SEC_DEBUG("make dir : [%s]", szTempMediaDir); } + //} - if (pConvertedStr != NULL) - pNewData = pConvertedStr; - - *npRead = nByte + 1; + if (pMsg->msgBody.pPresentationBody) { + if (__MmsMultipartSaveAsTempFile(&pMsg->msgBody.presentationType, pMsg->msgBody.pPresentationBody, + (char*)MSG_DATA_PATH, pMsg->szFileName, 0, true) == false) + goto __CATCH; + } - break; + while (pMultipart) { - case MSG_CHARSET_US_ASCII: + if (__MmsMultipartSaveAsTempFile(&pMultipart->type, pMultipart->pBody, + (char*)MSG_DATA_PATH, pMsg->szFileName, partIndex, true) == false) + goto __CATCH; - MSG_DEBUG("MSG_CHARSET_US_ASCII"); + MmsPrintMulitpart(pMultipart, partIndex); - /* fall through */ - case MSG_CHARSET_UTF8: + pMultipart = pMultipart->pNext; + partIndex ++; + } - MSG_DEBUG("MSG_CHARSET_UTF8 or Others"); + } else { //single part + if (pMsg->nPartCount > 0) { - // skip BOM (Byte Order Mark) bytes .. (Please refer to the http://www.unicode.org/faq/utf_bom.html#BOM) - if (nTemp >= 3) { - if (((UINT8)pTemp[0]) == 0xEF && ((UINT8)pTemp[1]) == 0xBB && ((UINT8)pTemp[2]) == 0xBF) { - pTemp += 3; - nTemp -= 3; + //if (bSavePartsAsTempFiles) { + if (mkdir(szTempMediaDir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) { + if (errno == EEXIST) { + MSG_DEBUG("exist dir : [%s]", szTempMediaDir); + } else { + MSG_DEBUG("Fail to Create Dir [%s]", szTempMediaDir); + goto __CATCH; + } + } else { + MSG_DEBUG("make dir : [%s]", szTempMediaDir); } - } - pNewData = pTemp; - *npRead = nTemp; + //} - break; - - case MSG_CHARSET_ISO_8859_7: - - /* Greek */ - - MSG_DEBUG("MSG_CHARSET_ISO_8859_7"); + if (__MmsMultipartSaveAsTempFile(&pMsg->msgType, &pMsg->msgBody, + (char*)MSG_DATA_PATH, pMsg->szFileName, 0, true) == false) + goto __CATCH; + } + } + MSG_DEBUG("### Success ###"); + MSG_END(); + return; - nByte = __MsgGetLatin72UTFCodeSize((unsigned char*)pTemp, nTemp); - pConvertedStr = (char *)malloc(nByte + 1); - if (pConvertedStr) - __MsgLatin7code2UTF((unsigned char*)pConvertedStr, nByte + 1, (unsigned char*)pTemp, nTemp); +__CATCH: - pNewData = pConvertedStr; - *npRead = nByte + 1; + MmsInitHeader(); + MmsUnregisterDecodeBuffer(); - break; + if (pFile != NULL) { + MsgCloseFile(pFile); + pFile = NULL; + } - case MSG_CHARSET_ISO_8859_9: - /* Turkish */ - MSG_DEBUG("MSG_CHARSET_ISO_8859_9"); + MmsReleaseMsgDRMInfo(&pMsg->msgType.drmInfo); - nByte = __MsgGetLatin52UTFCodeSize((unsigned char*)pTemp, nTemp); - pConvertedStr = (char *)malloc(nByte + 1); - if (pConvertedStr) - __MsgLatin5code2UTF((unsigned char*)pConvertedStr, nByte + 1, (unsigned char*)pTemp, nTemp); + MmsReleaseMsgBody(&pMsg->msgBody, pMsg->msgType.type); - pNewData = pConvertedStr; - *npRead = nByte + 1; + MSG_DEBUG("### Fail ###"); + MSG_END(); + return; - break; +} - default: +//CID 41989: Removed function decodeMmsPdu which is unused. +#if 0 +void MmsPluginDecoder::decodeMmsPdu(MMS_DATA_S *pMmsData, const char *pduFilePath) +{ + MSG_BEGIN(); - MSG_DEBUG("Other charsets"); + FILE *pFile = NULL; + MsgMultipart * iter_multipart = NULL; + int nSize = 0; + char szFullPath[MSG_FILEPATH_LEN_MAX] = {0, }; - nByte = __MsgGetLatin2UTFCodeSize((unsigned char*)pTemp, nTemp); - pConvertedStr = (char *)malloc(nByte + 1); - if (pConvertedStr) - __MsgLatin2UTF((unsigned char*)pConvertedStr, nByte + 1, (unsigned char*)pTemp, nTemp); + MmsInitHeader(); - pNewData = pConvertedStr; - *npRead = nByte + 1; + //pMsg->msgID = msgID; - break; - } - } else { - pNewData = pTemp; - *npRead = nTemp; - } + snprintf(szFullPath, sizeof(szFullPath), "%s", pduFilePath); - pReturnData = (char *)malloc(*npRead); - if (pReturnData == NULL) { - MSG_DEBUG("pReturnData alloc fail."); + //MsgGetFileName(szFullPath, pMsg->szFileName, sizeof(pMsg->szFileName)); + if (MsgGetFileSize(szFullPath, &nSize) == false) { + MSG_FATAL("Fail MsgGetFileSize"); goto __CATCH; } - if (pNewData != NULL) { - memset(pReturnData, 0, *npRead); - memcpy(pReturnData, pNewData, *npRead); - } - - if (pConvertedData) { - free(pConvertedData); - pConvertedData = NULL; + pFile = MsgOpenFile(szFullPath, "rb"); + if (pFile == NULL) { + MSG_SEC_DEBUG("Fail MsgOpenFile [%s]", szFullPath); + goto __CATCH; } - if (pConvertedStr) { - free(pConvertedStr); - pConvertedStr = NULL; - } + MmsRegisterDecodeBuffer(); - if (mszTempStr) { - free(mszTempStr); - mszTempStr = NULL; + if (MmsBinaryDecodeMsgHeader(pFile, nSize) == false) { + MSG_FATAL("Fail to MmsBinaryDecodeMsgHeader"); + goto __CATCH; } - return pReturnData; - -__CATCH: - - if (pConvertedData) { - free(pConvertedData); - pConvertedData = NULL; + if (MmsBinaryDecodeMsgBody(pFile, szFullPath, nSize) == false) { + MSG_FATAL("Fail to MmsBinaryDecodeMsgBody"); + goto __CATCH; } - if (pConvertedStr) { - free(pConvertedStr); - pConvertedStr = NULL; + //set header + if (pMmsData->header == NULL) { + pMmsData->header = MsgMmsCreateHeader(); } - if (mszTempStr) { - free(mszTempStr); - mszTempStr = NULL; - } + pMmsData->header->messageType = mmsHeader.type; - return NULL; -} + pMmsData->header->mmsVersion = mmsHeader.version; -#ifndef __SUPPORT_DRM__ -static bool __MsgMakeFileName(int iMsgType, char *szFileName, int nUntitleIndex) -{ - char szText[MSG_FILENAME_LEN_MAX+1]={0,}; - char szTemp[MSG_FILENAME_LEN_MAX+1]={0,}; - char szTempFileName[MSG_FILENAME_LEN_MAX+1]={0,}; - char *pExt = NULL; + pMmsData->header->contentType = mmsHeader.msgType.type; + pMmsData->header->date = mmsHeader.date; - MSG_DEBUG("iMsgType = %d, szFileName = %s", iMsgType, szFileName); + pMmsData->header->messageSize = mmsHeader.msgSize; - if (szFileName == NULL) - return false; + pMmsData->header->mmsPriority = mmsHeader.priority; - if (szFileName && (szFileName[0] != '\0')) { - MsgGetFileNameWithoutExtension (szTempFileName, szFileName); + pMmsData->header->messageClass = mmsHeader.msgClass; - pExt = strrchr(szTempFileName, '.'); - if (pExt == NULL) { - memset (szText, 0, MSG_FILENAME_LEN_MAX+1); - strncpy(szText, szTempFileName, MSG_FILEPATH_LEN_MAX - 1); - strcat(szText, "."); // add '.' - } else { - memset (szText, 0, MSG_FILENAME_LEN_MAX+1); - strncpy(szText, szTempFileName, pExt+1 - szFileName); // add '.' - } - } else { - if (nUntitleIndex >= 1) { - snprintf(szText, MSG_FILENAME_LEN_MAX+1, "%s_%d.", "Untitled", nUntitleIndex); - } else { - snprintf(szText, MSG_FILENAME_LEN_MAX+1, "%s.", "Untitled"); - } + if (mmsHeader.deliveryReport == MMS_REPORT_YES) { + pMmsData->header->bDeliveryReport = true; } - if (iMsgType == MIME_APPLICATION_OCTET_STREAM) { - MSG_DEBUG("unsupported MsgType"); - goto __CATCH; - } else { - int nLen = 0; - strncpy(szTemp, szText, MSG_FILENAME_LEN_MAX - 5); - if (iMsgType == MIME_UNKNOWN || (pExt = MimeGetExtFromMimeInt((MimeType)iMsgType)) == NULL) { - MSG_DEBUG("Failed to get extension of that mime data file."); - goto __CATCH; - } - nLen = MSG_FILENAME_LEN_MAX - strlen(szTemp); - strncat(szTemp, pExt, nLen); + if (mmsHeader.readReply == MMS_REPORT_YES) { + pMmsData->header->bReadReport = true; } + memcpy(&pMmsData->header->delivery, &mmsHeader.deliveryTime, sizeof(MmsTimeStruct)); - strcpy(szFileName, szTemp); + memcpy(&pMmsData->header->expiry, &mmsHeader.expiryTime, sizeof(MmsTimeStruct)); - MSG_DEBUG("made szFileName = %s", szFileName); - return true; + snprintf(pMmsData->header->messageID, sizeof(pMmsData->header->messageID), "%s", mmsHeader.szMsgID); -__CATCH: - { - char *p = NULL; - p = strrchr(szText, '.'); - if (p != NULL) - *p = 0; - snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", szText); + snprintf(pMmsData->header->szSubject, sizeof(pMmsData->header->szSubject), "%s", mmsHeader.szSubject); - return false; - } -} -#else -static bool __MsgMakeFileName(int iMsgType, char *szFileName, MsgDrmType drmType, int nUntitleIndex, char *outBuf, int outBufLen) -{ - char szTemp[MSG_FILENAME_LEN_MAX+1]={0,}; - char szTempFileName[MSG_FILENAME_LEN_MAX+1]={0,}; - char *pExt = NULL; + snprintf(pMmsData->header->trID, sizeof(pMmsData->header->trID), "%s", mmsHeader.szTrID); - MSG_DEBUG("Input : type [0x%x], drmType [%d], filename [%s]", iMsgType, drmType, szFileName); + //CID 41989: Moving assignment of iter_multipart before its de-referencing. + iter_multipart = mmsHeader.msgBody.body.pMultipart; + //set multipart + if (pMmsData->header->contentType == MIME_MULTIPART_RELATED || pMmsData->header->contentType == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) { - if (szFileName == NULL) - return false; + MMS_MULTIPART_DATA_S *pMultipart = MsgMmsCreateMultipart(); - int inp_len = strlen(szFileName); - if (inp_len >0) { - MsgGetFileNameWithoutExtension (szTempFileName, szFileName); - } else { - if (nUntitleIndex >= 1) { - snprintf(szTempFileName, sizeof(szTempFileName), "%s_%d", "untitled", nUntitleIndex); - } else { - snprintf(szTempFileName, sizeof(szTempFileName), "%s", "untitled"); - } - } + pMultipart->type = MIME_APPLICATION_SMIL; + snprintf(pMultipart->szContentType, sizeof(pMultipart->szContentType), "%s", "application/smil"); + snprintf(pMultipart->szContentID, sizeof(pMultipart->szContentID), "%s", mmsHeader.msgBody.presentationType.szContentID); + snprintf(pMultipart->szContentLocation, sizeof(pMultipart->szContentLocation), "%s", mmsHeader.msgBody.presentationType.szContentLocation); + snprintf(pMultipart->szFileName, sizeof(pMultipart->szFileName), "%s", mmsHeader.msgBody.presentationType.param.szName); - if (drmType == MSG_DRM_TYPE_SD) { - snprintf(szTemp, sizeof(szTemp), "%s.dcf", szTempFileName); - } else if (MsgDRMIsForwardLockType(drmType)) { - snprintf(szTemp, sizeof(szTemp), "%s.dm", szTempFileName); - } else { - if (iMsgType == MIME_APPLICATION_OCTET_STREAM) { - MSG_DEBUG("unsupported MsgType"); - goto __CATCH; - } else { + //snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), MSG_DATA_PATH"%s", mmsHeader.msgBody.presentationType.param.szFileName); - if (iMsgType == MIME_UNKNOWN) { - MSG_DEBUG("Failed to get extension of that mime data file."); - goto __CATCH; - } + MsgBody *pBody = iter_multipart->pBody; + pMultipart->pMultipartData = MsgOpenAndReadMmsFile(pBody->szOrgFilePath, pBody->offset, pBody->size, (int*)&pMultipart->nMultipartDataLen); - pExt = MimeGetExtFromMimeInt((MimeType)iMsgType); - if (pExt) { - snprintf(szTemp, sizeof(szTemp), "%s.%s", szTempFileName, pExt); - } else { - MSG_DEBUG("Failed to get extension of that mime data file."); - goto __CATCH; - } - } + pMmsData->smil = pMultipart; } - snprintf(outBuf, outBufLen, "%s", szTemp); - MSG_DEBUG("Result : filename [%s]", outBuf); - return true; - -__CATCH: - return false; -} -#endif - -bool MsgGetFileNameWithoutExtension (char *szOutputName, char *szName) -{ - char *pszExt = NULL; - - if (szOutputName == NULL) { - MSG_DEBUG("szOutputName is NULL"); - return false; - } - strncpy(szOutputName, szName, strlen(szName)); + while (iter_multipart) { - if ((pszExt = strrchr(szOutputName, '.'))) { - if (pszExt[0] == '.') - pszExt[0] = '\0'; - } + MMS_MULTIPART_DATA_S *pMultipart = MsgMmsCreateMultipart(); - return true; -} + pMultipart->type = (MimeType)iter_multipart->type.type; -int MmsGetMediaPartCount(msg_message_id_t msgId) -{ - MmsMsg *pMsg; + snprintf(pMultipart->szContentType, sizeof(pMultipart->szContentType), "%s",MimeGetMimeStringFromMimeInt(iter_multipart->type.type)); + snprintf(pMultipart->szContentID, sizeof(pMultipart->szContentID), "%s", iter_multipart->type.szContentID); + snprintf(pMultipart->szContentLocation, sizeof(pMultipart->szContentLocation), "%s", iter_multipart->type.szContentLocation); + snprintf(pMultipart->szFileName, sizeof(pMultipart->szFileName), "%s", iter_multipart->type.param.szName); - MmsPluginStorage::instance()->getMmsMessage(&pMsg); + //snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), "%s", iter_multipart->pBody->szOrgFilePath); - if (msgId != pMsg->msgID) { - MSG_DEBUG("Invalid Message Id"); - return -1; - } + MsgBody *pBody = iter_multipart->pBody; + pMultipart->pMultipartData = MsgOpenAndReadMmsFile(pBody->szOrgFilePath, pBody->offset, pBody->size, (int*)&pMultipart->nMultipartDataLen); - return pMsg->nPartCount; -} -bool MmsGetMediaPartHeader(int index, MsgType *pHeader) -{ - MmsMsg *pMsg = NULL; - MsgMultipart *pPart = NULL; +#ifdef __SUPPORT_DRM__ + if (iter_multipart->type.drmInfo.drmType != MSG_DRM_TYPE_NONE) { + pMultipart->drmType = iter_multipart->type.drmInfo.drmType; + } +#endif - if (pHeader == NULL) { - MSG_DEBUG("Invalid pHeader input. It's null"); - return false; + pMmsData->multipartlist = g_list_append(pMmsData->multipartlist, pMultipart); + iter_multipart = iter_multipart->pNext; } - MmsPluginStorage::instance()->getMmsMessage(&pMsg); - - MmsInitMsgType(pHeader); - - - /* Requires header of non-presentation */ - if (MsgIsMultipart(pMsg->msgType.type)) { - MSG_DEBUG("Multipart header [index = %d] \n", index); - - pPart = pMsg->msgBody.body.pMultipart; - while (pPart && index--) - pPart = pPart->pNext; + MSG_DEBUG("### SUCCESS ###"); + MSG_END(); + return; +__CATCH: - if (pPart == NULL) { - MSG_DEBUG("There is no such msg part."); - return false; - } + MmsInitHeader(); + MmsUnregisterDecodeBuffer(); - memcpy(pHeader, &pPart->type, sizeof(MsgType)); - } else { - MSG_DEBUG("Requires singlepart header"); - memcpy(pHeader, &pMsg->msgType, sizeof(MsgType)); + if (pFile != NULL) { + MsgCloseFile(pFile); + pFile = NULL; } - return true; + MSG_DEBUG("### Fail ###"); + MSG_END(); + return; } - -static bool __MmsDebugPrintMulitpartEntry(MsgMultipart *pMultipart, int index) -{ - MSG_DEBUG("------------------------------"); - MSG_DEBUG("[%dth] multipart info", index); - MSG_DEBUG("header size [%d], body size [%d]", pMultipart->type.size, pMultipart->type.contentSize); - MSG_DEBUG("content type [%s]", MmsDebugGetMimeType((MimeType)pMultipart->type.type)); - MSG_DEBUG("content ID [%s]", pMultipart->type.szContentID); - MSG_DEBUG("content location [%s]", pMultipart->type.szContentLocation); - MSG_DEBUG("parameter Name [%s]", pMultipart->type.param.szName); - MSG_DEBUG("parameter Filename[%s]", pMultipart->type.param.szFileName); - - if (pMultipart->type.type == MIME_TEXT_PLAIN) { - MSG_DEBUG("text info : charset [%d], name [%s]", pMultipart->type.param.charset, pMultipart->type.param.szName); - } -#ifdef __SUPPORT_DRM__ - if (pMultipart->type.drmInfo.drmType != MSG_DRM_TYPE_NONE) { - MSG_DEBUG("drm info"); - MSG_DEBUG("drm type [%d] (0: NONE 1: Fowward Lock, 2:Combined Delivery, 3: Separated Delivery)", pMultipart->type.drmInfo.drmType); - MSG_DEBUG("drm content type [%s]", MmsDebugGetMimeType((MimeType)pMultipart->type.drmInfo.contentType)); - MSG_DEBUG("drm content URI [%s]", pMultipart->type.drmInfo.szContentURI); - MSG_DEBUG("drm2FullPath [%s]", pMultipart->type.drmInfo.szDrm2FullPath); - } #endif - MSG_DEBUG("------------------------------"); - return true; -} diff --git a/plugin/mms_plugin/MmsPluginDrm.cpp b/plugin/mms_plugin/MmsPluginDrm.cpp index a349358..160abdb 100755 --- a/plugin/mms_plugin/MmsPluginDrm.cpp +++ b/plugin/mms_plugin/MmsPluginDrm.cpp @@ -1,90 +1,55 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include + +#if MSG_DRM_SUPPORT #include #include -#include "MsgMmsTypes.h" +#endif + #include "MsgDrmWrapper.h" #include "MmsPluginDrm.h" #include "MmsPluginCodec.h" #include "MmsPluginMIME.h" #include "MmsPluginDebug.h" -#include "MmsPluginUtil.h" - -#ifdef __SUPPORT_DRM__ - -MmsDrm2ConvertState mmsDrm2ConvertState; - -MsgDrmType MsgGetDRMType(MsgType *pMsgType, MsgBody *pMsgBody) -{ - MsgDrmType drmType = MSG_DRM_TYPE_NONE; - MsgMultipart *pMultipart = NULL; - - if (MsgIsMultipart(pMsgType->type)) { - pMultipart = pMsgBody->body.pMultipart; - while (pMultipart) { - if (drmType < pMultipart->type.drmInfo.drmType) - drmType = pMultipart->type.drmInfo.drmType; - - pMultipart = pMultipart->pNext; - } - } else { - drmType = pMsgType->drmInfo.drmType; - } - - return drmType; -} -void MmsDrm2SetConvertState(MmsDrm2ConvertState newConvertState) -{ - mmsDrm2ConvertState = newConvertState; - MSG_DEBUG("MmsDrm2SetConvertState: mmsDrm2ConvertState = %d\n", mmsDrm2ConvertState); -} - -MmsDrm2ConvertState MmsDrm2GetConvertState(void) -{ - return mmsDrm2ConvertState; -} - -bool MsgDRM2GetDRMInfo(char *szFilePath, MsgType *pMsgType) +bool MmsPluginDrmGetInfo(const char *szFilePath, MsgType *pMsgType) { +#if MSG_DRM_SUPPORT if (szFilePath == NULL || pMsgType == NULL) { MSG_DEBUG("Param is NULL szFilePath = %d, pMsgType = %d", szFilePath, pMsgType); return false; } - char szMimeType[DRM_MAX_LEN_MIME + 1]; - char szContentID[DRM_MAX_LEN_CID + 1]; + char szMimeType[DRM_MAX_LEN_MIME + 1] = {0,}; + char szContentID[DRM_MAX_LEN_CID + 1] = {0,}; MSG_DRM_TYPE drmType = MSG_DRM_NONE; int ret = 0; MsgDrmGetDrmType(szFilePath, &drmType); MsgDrmGetMimeTypeEx(szFilePath, szMimeType, sizeof(szMimeType)); MsgDrmGetContentID(szFilePath, szContentID, sizeof(szContentID)); - MSG_DEBUG("drmType: %d", drmType); + + MSG_DEBUG("drmType: [%d], mimetype: [%s], contentID: [%s]", drmType, szMimeType, szContentID); switch (drmType) { case MSG_DRM_FORWARD_LOCK: pMsgType->drmInfo.drmType = MSG_DRM_TYPE_FL; - pMsgType->drmInfo.contentType = (MimeType)_MsgGetCode(MSG_TYPE, szMimeType); - if (MsgCopyDrmInfo(pMsgType) == false) { - MSG_DEBUG("MsgDRM2GetDRMInfo : MsgCopyDrmInfo failed"); - return false; - } + pMsgType->drmInfo.contentType = MimeGetMimeIntFromMimeString(szMimeType); break; case MSG_DRM_COMBINED_DELIVERY: @@ -94,22 +59,23 @@ bool MsgDRM2GetDRMInfo(char *szFilePath, MsgType *pMsgType) case MSG_DRM_SEPARATE_DELIVERY: pMsgType->drmInfo.drmType = MSG_DRM_TYPE_SD; - - pMsgType->drmInfo.contentType = (MimeType)_MsgGetCode(MSG_TYPE, szMimeType); + pMsgType->drmInfo.contentType = MimeGetMimeIntFromMimeString(szMimeType); drm_content_info_s dcfHdrInfo; bzero(&dcfHdrInfo, sizeof(drm_content_info_s)); ret = drm_get_content_info(szFilePath, &dcfHdrInfo); - MSG_DEBUG("drm_get_content_info is failed, ret=[%d]", ret); + if (ret != DRM_RETURN_SUCCESS) + MSG_DEBUG("drm_get_content_info is failed, ret=[%d]", ret); drm_file_info_s fileInfo; bzero(&fileInfo, sizeof(drm_file_info_s)); ret = drm_get_file_info(szFilePath, &fileInfo); - MSG_DEBUG("drm_get_file_info is failed, ret=[%d]", ret); + if (ret != DRM_RETURN_SUCCESS) + MSG_DEBUG("drm_get_file_info is failed, ret=[%d]", ret); if (fileInfo.oma_info.version == DRM_OMA_DRMV1_RIGHTS) { pMsgType->drmInfo.szContentName = MsgRemoveQuoteFromFilename(dcfHdrInfo.title); - pMsgType->drmInfo.szContentDescription = MsgStrCopy(dcfHdrInfo.description); + pMsgType->drmInfo.szContentDescription = g_strdup(dcfHdrInfo.description); } break; @@ -118,60 +84,9 @@ bool MsgDRM2GetDRMInfo(char *szFilePath, MsgType *pMsgType) break; } - pMsgType->drmInfo.szDrm2FullPath = MsgStrCopy(szFilePath); + pMsgType->drmInfo.szDrm2FullPath = g_strdup(szFilePath); MSG_DEBUG("pMsgType->drmInfo.szDrm2FullPath: %s", pMsgType->drmInfo.szDrm2FullPath); +#endif return true; } - -bool MsgDRMIsForwardLockType(MsgDrmType drmType) -{ - switch (drmType) { - case MSG_DRM_TYPE_FL: - case MSG_DRM_TYPE_CD: - return true; - - case MSG_DRM_TYPE_NONE: //SD & plain can be forwarded - case MSG_DRM_TYPE_SD: - default: - return false; - } -} - -bool MsgChangeDrm2FileName(char *szFileName) -{ - char szTempFileName[MSG_FILENAME_LEN_MAX] = {0,}; - - if (szFileName == NULL || szFileName[0] == '\0') - return false; - - MsgGetFileNameWithoutExtension(szTempFileName, szFileName); - - if (strrchr(szTempFileName, '.')) - return true; - - strcat(szTempFileName, ".dcf"); - strcpy(szFileName, szTempFileName); - - MSG_DEBUG("MsgChangeDrm2FileName: made szFileName = %s \n", szFileName); - - return true; -} - -bool MsgIsDCFFile(char *szFilePath) -{ - int length = 0; - - MSG_DEBUG("MsgIsDCFFile: szFilePath = %s \n", szFilePath); - - length = MsgStrlen(szFilePath); - if (szFilePath[length - 4] == '.' && - (szFilePath[length - 3] == 'd' || szFilePath[length - 3] == 'D') && - (szFilePath[length - 2] == 'c' || szFilePath[length - 2] == 'C') && - (szFilePath[length - 1] == 'f' || szFilePath[length - 1] == 'F')) - return true; - - return false; -} - -#endif diff --git a/plugin/mms_plugin/MmsPluginEncode.cpp b/plugin/mms_plugin/MmsPluginEncode.cpp index 2ddccd8..dac05ed 100755 --- a/plugin/mms_plugin/MmsPluginEncode.cpp +++ b/plugin/mms_plugin/MmsPluginEncode.cpp @@ -1,22 +1,24 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include #include #include +#include +#include #include "MsgUtilFile.h" #include "MmsPluginDebug.h" #include "MmsPluginEncode.h" @@ -72,7 +74,7 @@ static bool __MmsBinaryEncodeTrID(FILE *pFile, char *szTrID, int bufLen); static bool __MmsBinaryEncodeMsgID(FILE *pFile, const char *szMsgID); /** 2005-05-24, added for read-reply PDU 1.2 */ static bool __MmsBinaryEncodeFrom(FILE *pFile); static bool __MmsBinaryEncodeTime(FILE *pFile, MmsFieldCode fieldCode, MmsTimeStruct time); -static bool __MmsBinaryEncodeDate(FILE *pFile); +static bool __MmsBinaryEncodeDate(FILE *pFile, time_t inpDateSec); static bool __MmsBinaryEncodeOneAddress(FILE *pFile, MmsFieldCode addrType, char *szAddrStr); static bool __MmsBinaryEncodeAddress(FILE *pFile, MmsFieldCode addrType, char *szAddr); @@ -91,6 +93,8 @@ static bool __MmsBinaryEncodeTextString2(FILE *pFile, UINT8 *source, int length) static bool __MmsBinaryEncodeMmsVersion2(FILE *pFile); static bool __MmsBinaryEncodeFieldCodeAndValue2(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue); +static char *_MsgSkipWS3(char *s); + /** ----------------------------------------------------------------- * M M S E N C O D E * * -----------------------------------------------------------------*/ @@ -186,8 +190,6 @@ static void __MmsUnregisterEncodeBuffer2(void) */ static bool __MmsBinaryEncodeTextString2(FILE *pFile, UINT8 *source, int length) { - MSG_DEBUG("MmsBinaryEncodeTextString2: \n"); - /** * make text string * Text-string = [Quote] *TEXT End-of-string @@ -198,14 +200,14 @@ static bool __MmsBinaryEncodeTextString2(FILE *pFile, UINT8 *source, int length) */ if (pFile == NULL || source == NULL) { - MSG_DEBUG("MmsBinaryEncodeTextString2: source == NULL \n"); + MSG_DEBUG("source == NULL"); goto __CATCH; } if ((gMmsEncodeMaxLen2 - gCurMmsEncodeBuffPos2) < length) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf2, &gCurMmsEncodeBuffPos2, gMmsEncodeMaxLen2, &gMmsEncodeCurOffset2) == false) { - MSG_DEBUG("MmsBinaryEncodeTextString2: MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } @@ -230,18 +232,18 @@ static bool __MmsBinaryEncodeFieldCodeAndValue2(FILE *pFile, UINT8 fieldCode, UI if ((gMmsEncodeMaxLen2 - gCurMmsEncodeBuffPos2) < 2) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf2, &gCurMmsEncodeBuffPos2, gMmsEncodeMaxLen2, &gMmsEncodeCurOffset2) == false) { - MSG_DEBUG("__MmsBinaryEncodeFieldCodeAndValue: MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } if (fieldCode == 0xff) { - MSG_DEBUG("__MmsBinaryEncodeFieldCodeAndValue: invalid fieldCode \n"); + MSG_DEBUG("invalid fieldCode"); goto __CATCH; } if (fieldValue == 0xff) { - MSG_DEBUG("__MmsBinaryEncodeFieldCodeAndValue: invalid fieldValue \n"); + MSG_DEBUG("invalid fieldValue"); return true; } @@ -259,17 +261,15 @@ static bool __MmsBinaryEncodeMmsVersion2(FILE *pFile) UINT8 majorVer = MMS_MAJOR_VERSION; UINT8 minorVer = MMS_MINOR_VERSION; - MSG_DEBUG("__MmsBinaryEncodeMmsVersion2: \n"); - if (pFile == NULL) { - MSG_DEBUG("__MmsBinaryEncodeMmsVersion2: invalid input file \n"); + MSG_DEBUG("invalid input file"); goto __CATCH; } if ((gMmsEncodeMaxLen2 - gCurMmsEncodeBuffPos2) < 2) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf2, &gCurMmsEncodeBuffPos2, gMmsEncodeMaxLen2, &gMmsEncodeCurOffset2) == false) { - MSG_DEBUG("__MmsBinaryEncodeMmsVersion2: MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } @@ -295,8 +295,8 @@ static bool __MmsBinaryEncodeAckIndHdr(FILE *pFile, char *szTrID, bool bReportAl UINT8 fieldCode = 0xff; UINT8 fieldValue = 0xff; - MSG_DEBUG("_MmsBinaryEncodeAckIndHdr: szTrID = %s\n", szTrID); - MSG_DEBUG("_MmsBinaryEncodeAckIndHdr: bReportAllowed = %d\n", bReportAllowed); + MSG_DEBUG("szTrID = %s", szTrID); + MSG_DEBUG("bReportAllowed = %d", bReportAllowed); __MmsCleanEncodeBuff2(); @@ -304,21 +304,21 @@ static bool __MmsBinaryEncodeAckIndHdr(FILE *pFile, char *szTrID, bool bReportAl fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGTYPE) | 0x80; fieldValue = MmsGetBinaryValue(MmsCodeMsgType, MMS_MSGTYPE_ACKNOWLEDGE_IND) | 0x80; if (__MmsBinaryEncodeFieldCodeAndValue2(pFile, fieldCode, fieldValue) == false) { - MSG_DEBUG("_MmsBinaryEncodeAckIndHdr: msgType error\n"); + MSG_DEBUG("msgType error"); goto __CATCH; } /* trID (other type of message) */ length = __MmsBinaryEncodeTextStringLen((UINT8*)szTrID); if (length == -1) { - MSG_DEBUG("_MmsBinaryEncodeAckIndHdr: MmsBinaryEncodeTextStringLen fail \n"); + MSG_DEBUG("MmsBinaryEncodeTextStringLen fail"); goto __CATCH; } if ((gMmsEncodeMaxLen2 - gCurMmsEncodeBuffPos2) < (length + 1)) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf2, &gCurMmsEncodeBuffPos2, gMmsEncodeMaxLen2, &gMmsEncodeCurOffset2) == false) { - MSG_DEBUG("_MmsBinaryEncodeAckIndHdr: MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } @@ -326,13 +326,13 @@ static bool __MmsBinaryEncodeAckIndHdr(FILE *pFile, char *szTrID, bool bReportAl gpMmsEncodeBuf2[gCurMmsEncodeBuffPos2++] = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_TRID) | 0x80; if (__MmsBinaryEncodeTextString2(pFile, (UINT8*)szTrID, length) == false) { - MSG_DEBUG("_MmsBinaryEncodeAckIndHdr: MmsBinaryEncodeTextString fail\n"); + MSG_DEBUG("MmsBinaryEncodeTextString fail"); goto __CATCH; } if (__MmsBinaryEncodeMmsVersion2(pFile) == false) { - MSG_DEBUG("_MmsBinaryEncodeAckIndHdr: __MmsBinaryEncodeMmsVersion error\n"); + MSG_DEBUG("__MmsBinaryEncodeMmsVersion error"); goto __CATCH; } @@ -347,14 +347,14 @@ static bool __MmsBinaryEncodeAckIndHdr(FILE *pFile, char *szTrID, bool bReportAl } if (__MmsBinaryEncodeFieldCodeAndValue2(pFile, fieldCode, fieldValue) == false) { - MSG_DEBUG("_MmsBinaryEncodeAckIndHdr: Report Allowed error\n"); + MSG_DEBUG("Report Allowed error"); goto __CATCH; } /* flush remained data on encoding file */ if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf2, &gCurMmsEncodeBuffPos2, gMmsEncodeMaxLen2, &gMmsEncodeCurOffset2) == false) { - MSG_DEBUG("_MmsBinaryEncodeAckIndHdr: remained data MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("remained data MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } @@ -371,9 +371,9 @@ static bool __MmsBinaryEncodeNotiRespIndHdr(FILE *pFile, char *szTrID, msg_deliv UINT8 fieldCode = 0xff; UINT8 fieldValue = 0xff; - MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: szTrID = %s\n", szTrID); - MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: iStatus = %d\n", iStatus); - MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: bReportAllowed = %d\n", bReportAllowed); + MSG_DEBUG("szTrID = %s", szTrID); + MSG_DEBUG("iStatus = %d", iStatus); + MSG_DEBUG("bReportAllowed = %d", bReportAllowed); __MmsCleanEncodeBuff2(); @@ -382,7 +382,7 @@ static bool __MmsBinaryEncodeNotiRespIndHdr(FILE *pFile, char *szTrID, msg_deliv fieldValue = MmsGetBinaryValue(MmsCodeMsgType, MMS_MSGTYPE_NOTIFYRESP_IND) | 0x80; if (__MmsBinaryEncodeFieldCodeAndValue2(pFile, fieldCode, fieldValue) == false) { - MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: msgType error\n"); + MSG_DEBUG("msgType error"); goto __CATCH; } @@ -390,39 +390,39 @@ static bool __MmsBinaryEncodeNotiRespIndHdr(FILE *pFile, char *szTrID, msg_deliv /* trID (other type of message) */ length = __MmsBinaryEncodeTextStringLen((UINT8*)szTrID); if (length == -1) { - MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: MmsBinaryEncodeTextStringLen fail \n"); + MSG_DEBUG("MmsBinaryEncodeTextStringLen fail"); goto __CATCH; } if ((gMmsEncodeMaxLen2 - gCurMmsEncodeBuffPos2) < (length + 1)) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf2, &gCurMmsEncodeBuffPos2, gMmsEncodeMaxLen2, &gMmsEncodeCurOffset2) == false) { - MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } gpMmsEncodeBuf2[gCurMmsEncodeBuffPos2++] = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_TRID) | 0x80; if (__MmsBinaryEncodeTextString2(pFile, (UINT8*)szTrID, length) == false) { - MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: MmsBinaryEncodeTextString fail\n"); + MSG_DEBUG("MmsBinaryEncodeTextString fail"); goto __CATCH; } if (__MmsBinaryEncodeMmsVersion2(pFile) == false) { - MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: __MmsBinaryEncodeMmsVersion error\n"); + MSG_DEBUG("__MmsBinaryEncodeMmsVersion error"); goto __CATCH; } /* MsgStatus */ - MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: MsgStatus = %d\n", iStatus); + MSG_DEBUG("MsgStatus = %d", iStatus); if (iStatus != MSG_DELIVERY_REPORT_NONE) { fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGSTATUS) | 0x80; fieldValue = MmsGetBinaryValue(MmsCodeMsgStatus, iStatus) | 0x80; if (__MmsBinaryEncodeFieldCodeAndValue2(pFile, fieldCode, fieldValue) == false) { - MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: MsgStatus error\n"); + MSG_DEBUG("MsgStatus error"); goto __CATCH; } } @@ -438,14 +438,14 @@ static bool __MmsBinaryEncodeNotiRespIndHdr(FILE *pFile, char *szTrID, msg_deliv } if (__MmsBinaryEncodeFieldCodeAndValue2(pFile, fieldCode, fieldValue) == false) { - MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: Report Allowed error\n"); + MSG_DEBUG("Report Allowed error"); goto __CATCH; } /* flush remained data on encoding file */ if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf2, &gCurMmsEncodeBuffPos2, gMmsEncodeMaxLen2, &gMmsEncodeCurOffset2) == false) { - MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: remained data MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("remained data MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } @@ -460,10 +460,10 @@ bool MmsEncodeAckInd(FILE *pFile, char *pTrID, bool bReportAllowed) { __MmsRegisterEncodeBuffer2(gszMmsEncodeBuf2, MSG_MMS_ENCODE_BUFFER_MAX); - MSG_DEBUG("_MmsEncodeAckInd: Start Binary Encoding now ============= \n"); + MSG_DEBUG("Start Binary Encoding now ============="); if (__MmsBinaryEncodeAckIndHdr(pFile, pTrID, bReportAllowed) == false) { - MSG_DEBUG("_MmsEncodeAckInd: SendReq Binary encoding fail \n"); + MSG_DEBUG("SendReq Binary encoding fail"); goto __CATCH; } @@ -473,7 +473,7 @@ bool MmsEncodeAckInd(FILE *pFile, char *pTrID, bool bReportAllowed) __CATCH: - MSG_DEBUG("## _MmsEncodeAckInd: failed"); + MSG_DEBUG("Failed"); __MmsUnregisterEncodeBuffer2(); return false; @@ -483,10 +483,10 @@ bool MmsEncodeNotiRespInd(FILE *pFile, char *pTrID, msg_delivery_report_status_t { __MmsRegisterEncodeBuffer2(gszMmsEncodeBuf2, MSG_MMS_ENCODE_BUFFER_MAX); - MSG_DEBUG("_MmsEncodeNotiRespInd: Start Binary Encoding now ============= \n"); + MSG_DEBUG("Start Binary Encoding now ============="); if (__MmsBinaryEncodeNotiRespIndHdr(pFile, pTrID, iStatus, bReportAllowed) == false) { - MSG_DEBUG("_MmsEncodeNotiRespInd: SendReq Binary encoding fail \n"); + MSG_DEBUG("SendReq Binary encoding fail"); goto __CATCH; } @@ -512,14 +512,13 @@ bool MmsEncodeReadReport10(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t m struct tm *dateTime = NULL; time_t RawTime = 0; - time_t dateSec = 0; MmsRegisterEncodeBuffer(gszMmsEncodeBuf, MSG_MMS_ENCODE_BUFFER_MAX); - MSG_DEBUG("_MmsEncodeMsg: Start Binary Encoding now V1.0============= \n"); + MSG_DEBUG("Start Binary Encoding now V1.0============="); if (__MmsBinaryEncodeReadReport10Hdr(pFile, pMsg, mmsReadStatus) == false) { - MSG_DEBUG("_MmsEncodeReadReport10: SendReq Binary encoding fail \n"); + MSG_DEBUG("SendReq Binary encoding fail"); goto __CATCH; } @@ -528,7 +527,7 @@ bool MmsEncodeReadReport10(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t m pText = (char *)malloc(MSG_STDSTR_LONG); if (pText == NULL) { - MSG_DEBUG("__MmsSendReadReportV10: text body malloc fail \n"); + MSG_DEBUG("text body malloc fail"); goto __CATCH; } @@ -536,7 +535,6 @@ bool MmsEncodeReadReport10(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t m time(&RawTime); dateTime = localtime(&RawTime); - dateSec = mktime(dateTime); // get report message if (mmsReadStatus == MSG_READ_REPORT_IS_DELETED) { @@ -549,7 +547,7 @@ bool MmsEncodeReadReport10(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t m maxLen = strlen (pszReportMsg) +16 /* date string */ + 8 /* enter chars */ ; if (maxLen > MSG_STDSTR_LONG) { - snprintf (pText, MSG_STDSTR_LONG, "%s\n", pszReportMsg); + snprintf (pText, MSG_STDSTR_LONG, "%s", pszReportMsg); } else { snprintf(pText, MSG_STDSTR_LONG, "%s\r\n\r\n%.4d/%.2d/%.2d %.2d:%.2d\r\n", pszReportMsg, dateTime->tm_year+1900, dateTime->tm_mon+1, dateTime->tm_mday, dateTime->tm_hour, dateTime->tm_min); @@ -562,7 +560,7 @@ bool MmsEncodeReadReport10(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t m // make body if ((pPart = MmsAllocMultipart()) == NULL) { - MSG_DEBUG("__MmsSendReadReportV10: MsgAllocMultipart Fail \n"); + MSG_DEBUG("MsgAllocMultipart Fail"); goto __CATCH; } @@ -572,7 +570,7 @@ bool MmsEncodeReadReport10(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t m pPart->type.param.charset = MSG_CHARSET_UTF8; if (pPart->pBody == NULL) { - MSG_DEBUG("__MmsSendReadReportV10: pPart->pBody is NULL \n"); + MSG_DEBUG("pPart->pBody is NULL"); goto __CATCH; } @@ -582,11 +580,11 @@ bool MmsEncodeReadReport10(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t m msgBody.body.pMultipart = pPart; if (__MmsBinaryEncodeMsgBody(pFile, &msgType, &msgBody, 1, false) == false) { - MSG_DEBUG("__MmsSendReadReportV10: MmsBinaryEncodeMsgBody fail \n"); + MSG_DEBUG("MmsBinaryEncodeMsgBody fail"); goto __CATCH; } - MSG_DEBUG("__MmsSendReadReportV10: Send To RM ReadReport Msg \n"); + MSG_DEBUG(" Send To RM ReadReport Msg"); if (pText) { free(pText); @@ -631,10 +629,10 @@ bool MmsEncodeReadReport11(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t m { MmsRegisterEncodeBuffer(gszMmsEncodeBuf, MSG_MMS_ENCODE_BUFFER_MAX); - MSG_DEBUG("_MmsEncodeMsg: Start Binary Encoding now V1.1============= \n"); + MSG_DEBUG("Start Binary Encoding now V1.1============="); if (__MmsBinaryEncodeReadReport11Hdr(pFile, pMsg, mmsReadStatus) == false) { - MSG_DEBUG("_MmsEncodeMsg: SendReq Binary encoding fail \n"); + MSG_DEBUG("SendReq Binary encoding fail"); goto __CATCH; } @@ -698,26 +696,26 @@ static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg) fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGTYPE) | 0x80; fieldValue = MmsGetBinaryValue(MmsCodeMsgType, MMS_MSGTYPE_SEND_REQ) | 0x80; if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: msgType error\n"); + MSG_DEBUG("msgType error"); goto __CATCH; } + MSG_SEC_INFO("X-Mms-Message-Type = [%s]", MmsDebugGetMsgType(MMS_MSGTYPE_SEND_REQ)); + /* trID (other type of message) */ if (__MmsBinaryEncodeTrID(pFile, pMsg->szTrID, MMS_TR_ID_LEN + 1) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: trID error\n"); + MSG_DEBUG("trID error"); goto __CATCH; } - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: pMsg->szTrID = %s\n", pMsg->szTrID); - if (__MmsBinaryEncodeMmsVersion(pFile) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: __MmsBinaryEncodeMmsVersion error\n"); + MSG_DEBUG("__MmsBinaryEncodeMmsVersion error"); goto __CATCH; } /* From : Insert Token mode */ if (__MmsBinaryEncodeFrom(pFile) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: __MmsBinaryEncodeFrom fail\n"); + MSG_DEBUG("__MmsBinaryEncodeFrom fail"); goto __CATCH; } @@ -725,40 +723,38 @@ static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg) /* To = Encoded-string-value */ if (__MmsBinaryEncodeAddress(pFile, MMS_CODE_TO, pMsg->mmsAttrib.szTo) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: To __MmsBinaryEncodeAddress fail\n"); + MSG_DEBUG("To __MmsBinaryEncodeAddress fail"); goto __CATCH; } /* Cc = Encoded-string-value */ if (__MmsBinaryEncodeAddress(pFile, MMS_CODE_CC, pMsg->mmsAttrib.szCc) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: Cc __MmsBinaryEncodeAddress fail\n"); + MSG_DEBUG("Cc __MmsBinaryEncodeAddress fail"); goto __CATCH; } /* Bcc = Encoded-string-value */ - if (__MmsBinaryEncodeAddress(pFile, MMS_CODE_BCC, pMsg->mmsAttrib.szBcc) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: Bcc __MmsBinaryEncodeAddress fail\n"); + MSG_DEBUG("Bcc __MmsBinaryEncodeAddress fail"); goto __CATCH; } - - MSG_DEBUG("_MmsBinaryEnocdeSendReqHdr() pMsg->mmsAttrib.szSubject =%s\n",pMsg->mmsAttrib.szSubject); + MSG_SEC_INFO("Subject = [%s]", pMsg->mmsAttrib.szSubject); /* Subject = Encoded-string-value */ if (pMsg->mmsAttrib.szSubject[0]) { length = __MmsBinaryEncodeEncodedStringLen((UINT8*)pMsg->mmsAttrib.szSubject); if (length == -1) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: subject MmsBinaryEncodeEncodedStringLen fail \n"); + MSG_DEBUG("subject MmsBinaryEncodeEncodedStringLen fail"); goto __CATCH; } if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < length + 1) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: subject MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("subject MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } @@ -766,7 +762,7 @@ static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg) fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_SUBJECT) | 0x80; gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = fieldCode; if (__MmsBinaryEncodeEncodedString(pFile, (UINT8*)pMsg->mmsAttrib.szSubject, length) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: subject MmsBinaryEncodeEncodedString fail \n"); + MSG_DEBUG("subject MmsBinaryEncodeEncodedString fail"); goto __CATCH; } } @@ -776,42 +772,38 @@ static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg) fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGCLASS) | 0x80; fieldValue = MmsGetBinaryValue(MmsCodeMsgClass, (int)pMsg->mmsAttrib.msgClass) | 0x80; if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: msgClass error\n"); + MSG_DEBUG("msgClass error"); goto __CATCH; } + + MSG_SEC_INFO("X-Mms-Message-Class = [%s]", MmsDebugGetMsgClass(pMsg->mmsAttrib.msgClass)); + /* MMS-1.3-con-739 */ /* MMS-1.3-con-733 */ /* Date = Long-integer */ - if (!__MmsBinaryEncodeDate(pFile)) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: __MmsBinaryEncodeDate error\n"); - goto __CATCH; + if (!__MmsBinaryEncodeDate(pFile, 0)) { + MSG_DEBUG("__MmsBinaryEncodeDate error"); + goto __CATCH; } /* MMS-1.3-con-733 */ /* Expiry Time : Value-length Absolute-token Date-value */ - if (pMsg->mmsAttrib.bUseExpiryCustomTime == true) { - if (__MmsBinaryEncodeTime(pFile, MMS_CODE_EXPIRYTIME, pMsg->mmsAttrib.expiryCustomTime) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: expiryTime __MmsBinaryEncodeTime fail\n"); - goto __CATCH; - } - } else if (pMsg->mmsAttrib.expiryTime.type != MMS_TIMETYPE_NONE) { // for avoiding the creation of the expiry field in case the user selects the maximum + if (pMsg->mmsAttrib.expiryTime.type != MMS_TIMETYPE_NONE) { // for avoiding the creation of the expiry field in case the user selects the maximum if (__MmsBinaryEncodeTime(pFile, MMS_CODE_EXPIRYTIME, pMsg->mmsAttrib.expiryTime) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: expiryTime __MmsBinaryEncodeTime fail\n"); + MSG_DEBUG("expiryTime __MmsBinaryEncodeTime fail"); goto __CATCH; } + + MSG_DEBUG("X-Mms-Expiry : type = [%d], time = [%u]", pMsg->mmsAttrib.expiryTime.type, pMsg->mmsAttrib.expiryTime.time); } - /* Use Custom time for Delivery Time */ - if (pMsg->mmsAttrib.bUseDeliveryCustomTime == true) { - if (__MmsBinaryEncodeTime(pFile, MMS_CODE_DELIVERYTIME, pMsg->mmsAttrib.deliveryCustomTime) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: deliveryTime __MmsBinaryEncodeTime fail\n"); - goto __CATCH; - } - } else { + if (pMsg->mmsAttrib.deliveryTime.type != MMS_TIMETYPE_NONE) { if (__MmsBinaryEncodeTime(pFile, MMS_CODE_DELIVERYTIME, pMsg->mmsAttrib.deliveryTime) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: deliveryTime __MmsBinaryEncodeTime fail\n"); + MSG_DEBUG("deliveryTime __MmsBinaryEncodeTime fail"); goto __CATCH; } + + MSG_DEBUG("X-Mms-Delivery-Time : type = [%d], time = [%u]", pMsg->mmsAttrib.deliveryTime.type, pMsg->mmsAttrib.deliveryTime.time); } /* Priority */ @@ -822,9 +814,11 @@ static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg) fieldValue = MmsGetBinaryValue(MmsCodePriority, pMsg->mmsAttrib.priority)|0x80; if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: priority error\n"); + MSG_DEBUG("priority error"); goto __CATCH; } + + MSG_SEC_INFO("X-Mms-Priority = [%d]", pMsg->mmsAttrib.priority); } /* Sender Visible (hide | show) */ @@ -833,11 +827,13 @@ static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg) fieldValue = MmsGetBinaryValue(MmsCodeSenderVisibility, MMS_SENDER_HIDE) | 0x80; if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: sender visibility error\n"); + MSG_DEBUG("sender visibility error"); goto __CATCH; } } + MSG_SEC_INFO("X-Mms-Sender-Visibility = [%d]", pMsg->mmsAttrib.bHideAddress); + /* Delivery Report (yes | no) */ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_DELIVERYREPORT)|0x80; @@ -847,8 +843,10 @@ static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg) fieldValue = MmsGetBinaryValue(MmsCodeDeliveryReport, MMS_REPORT_NO) | 0x80; } + MSG_SEC_INFO("X-Mms-Delivery-Report = [%d]", pMsg->mmsAttrib.bAskDeliveryReport); + if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: sender visibility error\n"); + MSG_DEBUG("sender visibility error"); goto __CATCH; } @@ -860,8 +858,10 @@ static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg) fieldValue = MmsGetBinaryValue(MmsCodeReadReply, MMS_REPORT_NO)|0x80; } + MSG_SEC_INFO("X-Mms-Read-Report = [%d]", pMsg->mmsAttrib.bAskReadReply); + if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: read reply error\n"); + MSG_DEBUG("read reply error"); goto __CATCH; } @@ -873,14 +873,14 @@ static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg) fieldValue = MmsGetBinaryValue(MmsCodeReadReply, pMsg->mmsAttrib.replyCharge.chargeType)|0x80; if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: replyCharging error\n"); + MSG_DEBUG("replyCharging error"); goto __CATCH; } /** fixme: Reply-charging-deadline */ if (pMsg->mmsAttrib.replyCharge.deadLine.time > 0) { if (__MmsBinaryEncodeTime(pFile, MMS_CODE_REPLYCHARGINGDEADLINE, pMsg->mmsAttrib.replyCharge.deadLine) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: replyCharging __MmsBinaryEncodeTime fail\n"); + MSG_DEBUG("replyCharging __MmsBinaryEncodeTime fail"); goto __CATCH; } } @@ -892,7 +892,7 @@ static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg) if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + 1)) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } @@ -900,7 +900,7 @@ static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg) gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_REPLYCHARGINGSIZE) | 0x80; if (__MmsBinaryEncodeInteger(pFile, pMsg->mmsAttrib.replyCharge.chargeSize, length) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: replyChargingSize MmsBinaryEncodeInteger error\n"); + MSG_DEBUG("replyChargingSize MmsBinaryEncodeInteger error"); goto __CATCH; } } @@ -909,14 +909,14 @@ static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg) if (pMsg->mmsAttrib.replyCharge.szChargeID[0]) { length = __MmsBinaryEncodeTextStringLen((UINT8*)pMsg->mmsAttrib.replyCharge.szChargeID); if (length == -1) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: szReplyChargingID MmsBinaryEncodeTextStringLen fail\n"); + MSG_DEBUG("szReplyChargingID MmsBinaryEncodeTextStringLen fail"); goto __CATCH; } if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + 1)) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } @@ -924,7 +924,7 @@ static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg) gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_REPLYCHARGINGID) | 0x80; if (__MmsBinaryEncodeTextString(pFile, (UINT8*)pMsg->mmsAttrib.replyCharge.szChargeID, length) == false) { - MSG_DEBUG("szContentLocation MmsBinaryEncodeTextString fail\n"); + MSG_DEBUG("szContentLocation MmsBinaryEncodeTextString fail"); goto __CATCH; } } @@ -932,7 +932,7 @@ static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg) /* flush remained data on encoding file */ if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: remained data MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("remained data MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } @@ -940,7 +940,7 @@ static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg) __CATCH: - MSG_DEBUG("## _MmsBinaryEncodeSendReqHdr: failed"); + MSG_DEBUG("Failed"); return false; } @@ -957,7 +957,7 @@ static bool __MmsBinaryEncodeReadReport10Hdr(FILE *pFile, MmsMsg *pMsg, msg_read goto __CATCH; } - MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: mmsReadStatus = %d\n", mmsReadStatus); + MSG_DEBUG("mmsReadStatus = %d", mmsReadStatus); __MmsCleanEncodeBuff(); @@ -965,49 +965,49 @@ static bool __MmsBinaryEncodeReadReport10Hdr(FILE *pFile, MmsMsg *pMsg, msg_read fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGTYPE) | 0x80; fieldValue = MmsGetBinaryValue(MmsCodeMsgType, MMS_MSGTYPE_SEND_REQ) | 0x80; if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { - MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: msgType error\n"); + MSG_DEBUG("msgType error"); goto __CATCH; } /* trID (other type of message) */ if (__MmsBinaryEncodeTrID(pFile, NULL, 0) == false) { - MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: __MmsBinaryEncodeTrID error\n"); + MSG_DEBUG("__MmsBinaryEncodeTrID error"); goto __CATCH; } if (__MmsBinaryEncodeMmsVersion(pFile) == false) { - MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: __MmsBinaryEncodeMmsVersion error\n"); + MSG_DEBUG("__MmsBinaryEncodeMmsVersion error"); goto __CATCH; } /* Date = Long-integer */ - if (!__MmsBinaryEncodeDate(pFile)) { - MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: date __MmsBinaryEncodeDate error\n"); + if (!__MmsBinaryEncodeDate(pFile, 0)) { + MSG_DEBUG("date __MmsBinaryEncodeDate error"); goto __CATCH; } /* From : Insert Token mode */ if (__MmsBinaryEncodeFrom(pFile) == false) { - MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: __MmsBinaryEncodeFrom fail\n"); + MSG_DEBUG("__MmsBinaryEncodeFrom fail"); goto __CATCH; } - MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: To = %s\n", pMsg->mmsAttrib.szFrom); + MSG_DEBUG("To = %s", pMsg->mmsAttrib.szFrom); /* To = Encoded-string */ if (pMsg && (strchr(pMsg->mmsAttrib.szFrom, '/') == NULL)) { length = strlen(pMsg->mmsAttrib.szFrom); szTo = (char *)malloc(length + 11); if (szTo == NULL) { - MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: szTo alloc fail\n"); + MSG_DEBUG("szTo alloc fail"); goto __CATCH; } snprintf(szTo, length + 11, "%s/TYPE=PLMN", pMsg->mmsAttrib.szFrom); - MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: To = %s\n", szTo); + MSG_DEBUG("To = %s", szTo); if (__MmsBinaryEncodeAddress(pFile, MMS_CODE_TO, szTo) == false) { - MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: To __MmsBinaryEncodeAddress fail\n"); + MSG_DEBUG("To __MmsBinaryEncodeAddress fail"); goto __CATCH; } @@ -1017,7 +1017,7 @@ static bool __MmsBinaryEncodeReadReport10Hdr(FILE *pFile, MmsMsg *pMsg, msg_read } } else { if (__MmsBinaryEncodeAddress(pFile, MMS_CODE_TO, pMsg->mmsAttrib.szFrom) == false) { - MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: To __MmsBinaryEncodeAddress fail\n"); + MSG_DEBUG("To __MmsBinaryEncodeAddress fail"); goto __CATCH; } } @@ -1040,13 +1040,13 @@ static bool __MmsBinaryEncodeReadReport10Hdr(FILE *pFile, MmsMsg *pMsg, msg_read length = __MmsBinaryEncodeEncodedStringLen((UINT8*)szSubject); if (length == -1) { - MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: subject MmsBinaryEncodeEncodedStringLen fail \n"); + MSG_DEBUG("subject MmsBinaryEncodeEncodedStringLen fail"); goto __CATCH; } if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < length + 1) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: subject MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("subject MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } @@ -1054,7 +1054,7 @@ static bool __MmsBinaryEncodeReadReport10Hdr(FILE *pFile, MmsMsg *pMsg, msg_read fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_SUBJECT) | 0x80; gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = fieldCode; if (__MmsBinaryEncodeEncodedString(pFile, (UINT8*)szSubject, length) == false) { - MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: subject MmsBinaryEncodeEncodedString fail \n"); + MSG_DEBUG("subject MmsBinaryEncodeEncodedString fail"); goto __CATCH; } @@ -1062,7 +1062,7 @@ static bool __MmsBinaryEncodeReadReport10Hdr(FILE *pFile, MmsMsg *pMsg, msg_read fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGCLASS) | 0x80; fieldValue = MmsGetBinaryValue(MmsCodeMsgClass, MMS_MSGCLASS_AUTO) | 0x80; if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { - MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: msgClass error\n"); + MSG_DEBUG("msgClass error"); goto __CATCH; } @@ -1071,7 +1071,7 @@ static bool __MmsBinaryEncodeReadReport10Hdr(FILE *pFile, MmsMsg *pMsg, msg_read fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_DELIVERYREPORT) | 0x80; fieldValue = MmsGetBinaryValue(MmsCodeDeliveryReport, MMS_REPORT_NO) | 0x80; if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { - MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: Delivery Report error\n"); + MSG_DEBUG("Delivery Report error"); goto __CATCH; } @@ -1080,7 +1080,7 @@ static bool __MmsBinaryEncodeReadReport10Hdr(FILE *pFile, MmsMsg *pMsg, msg_read fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_READREPLY) | 0x80; fieldValue = MmsGetBinaryValue(MmsCodeReadReply, MMS_REPORT_NO) | 0x80; if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { - MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: Read Reply error\n"); + MSG_DEBUG("Read Reply error"); goto __CATCH; } @@ -1089,7 +1089,7 @@ static bool __MmsBinaryEncodeReadReport10Hdr(FILE *pFile, MmsMsg *pMsg, msg_read fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_SENDERVISIBILLITY) | 0x80; fieldValue = MmsGetBinaryValue(MmsCodeSenderVisibility, MMS_SENDER_SHOW) | 0x80; if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { - MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: Sender Visible error\n"); + MSG_DEBUG("Sender Visible error"); goto __CATCH; } @@ -1100,7 +1100,7 @@ static bool __MmsBinaryEncodeReadReport10Hdr(FILE *pFile, MmsMsg *pMsg, msg_read /* flush remained data on encoding file */ if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: remained data MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("remained data MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } @@ -1127,13 +1127,13 @@ static bool __MmsBinaryEncodeReadReport11Hdr(FILE *pFile, MmsMsg *pMsg, msg_read fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGTYPE) | 0x80; fieldValue = MmsGetBinaryValue(MmsCodeMsgType, MMS_MSGTYPE_READREC_IND) | 0x80; if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { - MSG_DEBUG("_MmsBinaryEncodeReadReport11Hdr: msgType error\n"); + MSG_DEBUG("msgType error"); goto __CATCH; } /* MMS version */ if (__MmsBinaryEncodeMmsVersion(pFile) == false) { - MSG_DEBUG("_MmsBinaryEncodeReadReport11Hdr: __MmsBinaryEncodeMmsVersion error\n"); + MSG_DEBUG("__MmsBinaryEncodeMmsVersion error"); goto __CATCH; } @@ -1147,15 +1147,15 @@ static bool __MmsBinaryEncodeReadReport11Hdr(FILE *pFile, MmsMsg *pMsg, msg_read szTo = (char *)malloc(length + 11); if (szTo == NULL) { - MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: szTo alloc fail\n"); + MSG_DEBUG("szTo alloc fail"); goto __CATCH; } snprintf(szTo, length + 11,"%s/TYPE=PLMN", pMsg->mmsAttrib.szFrom); - MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: To = %s\n", szTo); + MSG_DEBUG("To = %s", szTo); if (__MmsBinaryEncodeAddress(pFile, MMS_CODE_TO, szTo) == false) { - MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: To __MmsBinaryEncodeAddress fail\n"); + MSG_DEBUG("To __MmsBinaryEncodeAddress fail"); goto __CATCH; } @@ -1165,20 +1165,20 @@ static bool __MmsBinaryEncodeReadReport11Hdr(FILE *pFile, MmsMsg *pMsg, msg_read } } else { if (__MmsBinaryEncodeAddress(pFile, MMS_CODE_TO, pMsg->mmsAttrib.szFrom) == false) { - MSG_DEBUG("_MmsBinaryEncodeReadReport11Hdr: To __MmsBinaryEncodeAddress fail\n"); + MSG_DEBUG("To __MmsBinaryEncodeAddress fail"); goto __CATCH; } } /* From : Insert Token mode */ if (__MmsBinaryEncodeFrom(pFile) == false) { - MSG_DEBUG("_MmsBinaryEncodeReadReport11Hdr: __MmsBinaryEncodeFrom fail\n"); + MSG_DEBUG("__MmsBinaryEncodeFrom fail"); goto __CATCH; } /* Date = Long-integer */ - if (!__MmsBinaryEncodeDate(pFile)) { - MSG_DEBUG("_MmsBinaryEncodeReadReport11Hdr: __MmsBinaryEncodeDate error\n"); + if (!__MmsBinaryEncodeDate(pFile, 0)) { + MSG_DEBUG("__MmsBinaryEncodeDate error"); goto __CATCH; } @@ -1187,13 +1187,13 @@ static bool __MmsBinaryEncodeReadReport11Hdr(FILE *pFile, MmsMsg *pMsg, msg_read fieldValue = MmsGetBinaryValue(MmsCodeReadStatus, mmsReadStatus) | 0x80; if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { - MSG_DEBUG("_MmsBinaryEncodeReadReport11Hdr: Read Status error\n"); + MSG_DEBUG("Read Status error"); goto __CATCH; }; if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("_MmsBinaryEncodeReadReport11Hdr: remained data MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("remained data MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } @@ -1211,12 +1211,13 @@ __CATCH: static bool __MmsBinaryEncodeMsgBody(FILE *pFile, MsgType *pType, MsgBody *pBody, int nPartCount, bool bTemplate) { int length = 0; + int index = 0; MsgMultipart *pMultipart = NULL; - MSG_DEBUG("MmsBinaryEncodeMsgBody: nPartCount = %d\n", nPartCount); + MSG_DEBUG("nPartCount = %d", nPartCount); if (pFile == NULL || pType == NULL) { - MSG_DEBUG("MmsBinaryEncodeMsgBody: invalid file handle\n"); + MSG_DEBUG("invalid file handle"); goto __CATCH; } @@ -1232,14 +1233,14 @@ static bool __MmsBinaryEncodeMsgBody(FILE *pFile, MsgType *pType, MsgBody *pBody /* Content type */ length = __MmsBinaryEncodeContentTypeLen(pType); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeMsgBody: MmsBinaryEncodeContentTypeLen fail \n"); + MSG_DEBUG("MmsBinaryEncodeContentTypeLen fail"); goto __CATCH; } if (bTemplate == false) gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_CONTENTTYPE) | 0x80; if (__MmsBinaryEncodeContentType(pFile, pType, length) == false) { - MSG_DEBUG("MmsBinaryEncodeMsgBody: MmsBinaryEncodeContentType fail \n"); + MSG_DEBUG("MmsBinaryEncodeContentType fail"); goto __CATCH; } @@ -1255,11 +1256,11 @@ static bool __MmsBinaryEncodeMsgBody(FILE *pFile, MsgType *pType, MsgBody *pBody if (nEntries >= 0) { length = __MmsBinaryEncodeUintvarLen(nEntries); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeMsgBody: nEntries MmsBinaryEncodeUintvarLen fail \n"); + MSG_DEBUG("nEntries MmsBinaryEncodeUintvarLen fail"); goto __CATCH; } if (__MmsBinaryEncodeUintvar(pFile, nEntries, length) == false) { - MSG_DEBUG("MmsBinaryEncodeMsgBody: nEntries MmsBinaryEncodeUintvar fail \n"); + MSG_DEBUG("nEntries MmsBinaryEncodeUintvar fail"); goto __CATCH; } @@ -1269,7 +1270,7 @@ static bool __MmsBinaryEncodeMsgBody(FILE *pFile, MsgType *pType, MsgBody *pBody if (nEntries > 0) { if (nEntries && pBody->pPresentationBody) { if (__MmsBinaryEncodeMsgPart(pFile, pType->type, &pBody->presentationType, pBody->pPresentationBody) == false) { - MSG_DEBUG("MmsBinaryEncodeMsgBody: __MmsBinaryEncodeMsgPart fail \n"); + MSG_DEBUG("__MmsBinaryEncodeMsgPart fail"); goto __CATCH; } @@ -1279,16 +1280,19 @@ static bool __MmsBinaryEncodeMsgBody(FILE *pFile, MsgType *pType, MsgBody *pBody pMultipart = pBody->body.pMultipart; while (nEntries && pMultipart) { if (__MmsBinaryEncodeMsgPart(pFile, pType->type, &pMultipart->type, pMultipart->pBody) == false) { - MSG_DEBUG("MmsBinaryEncodeMsgBody: __MmsBinaryEncodeMsgPart fail \n"); + MSG_DEBUG("__MmsBinaryEncodeMsgPart fail"); goto __CATCH; } + + MmsPrintMulitpart(pMultipart, index++); + pMultipart = pMultipart->pNext; nEntries--; } } else { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("MmsBinaryEncodeMsgBody: Empty message body MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("Empty message body MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } @@ -1305,7 +1309,7 @@ static bool __MmsBinaryEncodeMsgBody(FILE *pFile, MsgType *pType, MsgBody *pBody length = __MmsBinaryEncodeContentTypeLen(pType); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeMsgBody: Singlepart MmsBinaryEncodeContentTypeLen fail \n"); + MSG_DEBUG("Singlepart MmsBinaryEncodeContentTypeLen fail"); goto __CATCH; } @@ -1321,7 +1325,7 @@ static bool __MmsBinaryEncodeMsgBody(FILE *pFile, MsgType *pType, MsgBody *pBody return true; __CATCH: - MSG_DEBUG("## MmsBinaryEncodeMsgBody: failed\n"); + MSG_DEBUG("Failed"); return false; } @@ -1334,7 +1338,9 @@ static int __MmsBinaryEncodeContentTypeLen(MsgType *pType) const char *szTextType = NULL; int contentType = MIME_UNKNOWN; - MSG_DEBUG("MSmsBinaryEncodeContentTypeLen: type\n"); + bool isAscii = true; + unsigned long tmpLength = 0; + unsigned char tmpFileName[MSG_LOCALE_FILENAME_LEN_MAX+1]; /* * Content-type-value = Constrained-media | Content-general-form @@ -1357,7 +1363,7 @@ static int __MmsBinaryEncodeContentTypeLen(MsgType *pType) if (szTextType != NULL) { length = __MmsBinaryEncodeTextStringLen((UINT8*)szTextType); if (length == -1) { - MSG_DEBUG("MSmsBinaryEncodeContentTypeLen: szTextType MmsBinaryEncodeTextStringLen fail \n"); + MSG_DEBUG("szTextType MmsBinaryEncodeTextStringLen fail"); goto __CATCH; } totalLength += length; @@ -1370,20 +1376,18 @@ static int __MmsBinaryEncodeContentTypeLen(MsgType *pType) /* Parameters -------------------------------------------------------------- */ - MSG_DEBUG("MSmsBinaryEncodeContentTypeLen: parameters \n\n"); - /* Well-known-charset = Any-charset | Integer-value ----------------------- */ if (pType->param.charset != MSG_CHARSET_UNKNOWN) { fieldValue = MmsGetBinaryValue(MmsCodeCharSet, pType->param.charset); length = __MmsBinaryEncodeIntegerLen(fieldValue); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentTypeLen: charSet MmsBinaryEncodeIntegerLen fail \n"); + MSG_DEBUG("charSet MmsBinaryEncodeIntegerLen fail"); goto __CATCH; } totalLength += (length + 1); } else { - if (MmsIsText(contentType)) { // Any-charset + if (MmsIsTextType(contentType)) { // Any-charset if (!MmsIsVitemContent (contentType, pType->param.szName)) totalLength += 2; } @@ -1394,50 +1398,35 @@ static int __MmsBinaryEncodeContentTypeLen(MsgType *pType) if (pType->param.szName[0]) { char* pszName = NULL; - - if (MsgIsASCII (pType->param.szName)) { - MSG_DEBUG("MmsBinaryEncodeContentTypeLen: szName is consisted of ascii char-set chars. \n"); - - pszName = (char *)malloc(strlen(pType->param.szName) +1); - memset(pszName, 0, (strlen(pType->param.szName)+1)); - strcpy(pszName, pType->param.szName); + if (MmsIsAsciiString (pType->param.szName)) { + MSG_DEBUG("Name is consisted of ascii char-set chars."); } else { - MSG_DEBUG("MmsBinaryEncodeContentTypeLen: szName is not consisted of ascii char-set chars. \n"); - MSG_DEBUG("MmsBinaryEncodeContentTypeLen: pType->param.szName : %s\n", pType->param.szName); - - /* if msg-server can't support non ascii, then convert non-ascii to '_' by using _MsgReplaceNonAscii*/ - int filelen = strlen(pType->param.szName); - - pszName = (char *)malloc(filelen + 1); - memset(pszName, 0, (filelen + 1)); - strncpy(pszName, pType->param.szName, filelen); - - MSG_DEBUG("MmsBinaryEncodeContentTypeLen: pszName : %s\n", pszName); + isAscii = false; + MSG_DEBUG("Name is NOT consisted of ascii char-set chars."); } - //change empty space to '_' in the file name - if (MsgIsSpace(pszName)) { - char *pszTempName = NULL; - - MSG_DEBUG("MmsBinaryEncodeContentTypeLen: szName has space(' '). \n"); + pszName = g_strdup(pType->param.szName); - MsgReplaceSpecialChar(pszName, &pszTempName, ' '); + //change empty space to '_' in the file name + MmsReplaceSpaceChar(pszName); - if (pszTempName) { - free(pszName); - pszName = pszTempName; + if (isAscii == false) { + if (MsgEncode2Base64(pszName, strlen(pszName), &tmpLength, tmpFileName) == true) { + g_free(pszName); + pszName = g_strdup_printf("=?UTF-8?B?%s?=", tmpFileName); + MSG_DEBUG("base64 encode filename=[%s]", pszName); } - MSG_DEBUG("MmsBinaryEncodeContentTypeLen: pszName : %s\n", pszName); } length = __MmsBinaryEncodeTextStringLen((UINT8*)pszName); - free(pszName); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentTypeLen: szName MmsBinaryEncodeIntegerLen fail \n"); + MSG_DEBUG("szName MmsBinaryEncodeIntegerLen fail"); goto __CATCH; } + g_free(pszName); + totalLength += (length + 1); } @@ -1445,7 +1434,7 @@ static int __MmsBinaryEncodeContentTypeLen(MsgType *pType) if (pType->param.szApplicationID) { length = __MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szApplicationID); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentTypeLen: szApplicationID MmsBinaryEncodeTextStrinLen fail \n"); + MSG_DEBUG("szApplicationID MmsBinaryEncodeTextStrinLen fail"); goto __CATCH; } @@ -1460,7 +1449,7 @@ static int __MmsBinaryEncodeContentTypeLen(MsgType *pType) if (pType->param.szReplyToApplicationID) { length = __MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szReplyToApplicationID); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentTypeLen: szApplicationID MmsBinaryEncodeTextStrinLen fail \n"); + MSG_DEBUG("szApplicationID MmsBinaryEncodeTextStrinLen fail"); goto __CATCH; } @@ -1483,7 +1472,7 @@ static int __MmsBinaryEncodeContentTypeLen(MsgType *pType) if (szTextType != NULL) { length = __MmsBinaryEncodeTextStringLen((UINT8*)szTextType); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentTypeLen: type param MmsBinaryEncodeTextStringLen fail \n"); + MSG_DEBUG("type param MmsBinaryEncodeTextStringLen fail"); goto __CATCH; } totalLength += (length + 1); @@ -1499,7 +1488,7 @@ static int __MmsBinaryEncodeContentTypeLen(MsgType *pType) /* start = Text-string */ length = __MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szStart); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentType: szStart MmsBinaryEncodeTextStringLen fail \n"); + MSG_DEBUG("szStart MmsBinaryEncodeTextStringLen fail"); goto __CATCH; } @@ -1512,7 +1501,7 @@ static int __MmsBinaryEncodeContentTypeLen(MsgType *pType) /* StartInfo (with multipart/related) = Text-string */ length = __MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szStartInfo); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentType: szStartInfo MmsBinaryEncodeTextStringLen fail \n"); + MSG_DEBUG("szStartInfo MmsBinaryEncodeTextStringLen fail"); goto __CATCH; } @@ -1524,7 +1513,7 @@ static int __MmsBinaryEncodeContentTypeLen(MsgType *pType) __CATCH: - MSG_DEBUG("## MmsBinaryEncodeContentTypeLen: failed"); + MSG_DEBUG("Failed"); return -1; } @@ -1535,13 +1524,13 @@ static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLe const char *szTextType = NULL; int contentType = MIME_UNKNOWN; + bool isAscii = true; + unsigned long tmpLength = 0; + unsigned char tmpFileName[MSG_LOCALE_FILENAME_LEN_MAX+1]; + #ifdef FEATURE_JAVA_MMS const char *szParameter = NULL; #endif - - MSG_DEBUG("************************************************************************************\n"); - MSG_DEBUG("MmsBinaryEncodeContentType: C O N T E N T T Y P E \n\n"); - /* * Content-type-value = Constrained-media | Content-general-form * Constrained-media = Constrained-encoding @@ -1552,7 +1541,7 @@ static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLe */ if (pFile == NULL) { - MSG_DEBUG("MmsBinaryEncodeContentType: invalid file handle\n"); + MSG_DEBUG("invalid file handle"); goto __CATCH; } @@ -1561,17 +1550,19 @@ static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLe length = __MmsBinaryEncodeValueLengthLen(typeLength); if (length == -1) { - MSG_DEBUG("MSmsBinaryEncodeContentType : MmsBinaryEncodeValueLengthLen fail.\n"); + MSG_DEBUG("MmsBinaryEncodeValueLengthLen fail."); goto __CATCH; } if (__MmsBinaryEncodeValueLength(pFile, typeLength, length) == false) { - MSG_DEBUG("MSmsBinaryEncodeContentType : MmsBinaryEncodeValueLength fail.\n"); + MSG_DEBUG("MmsBinaryEncodeValueLength fail."); goto __CATCH; } contentType = pType->type; + MSG_SEC_DEBUG("Content Type : %s", MmsGetTextValue(MmsCodeContentType, (int)contentType)); + fieldValue = MmsGetBinaryValue(MmsCodeContentType, (int)contentType); if (fieldValue == UNDEFINED_BINARY || fieldValue == 0x0049) { /* Extension-media type */ @@ -1585,83 +1576,66 @@ static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLe } else { length = __MmsBinaryEncodeTextStringLen((UINT8*)szTextType); if (length == -1) { - MSG_DEBUG("MSmsBinaryEncodeContentType: szTextType MmsBinaryEncodeTextStringLen fail \n"); + MSG_DEBUG("szTextType MmsBinaryEncodeTextStringLen fail"); goto __CATCH; } if (__MmsBinaryEncodeTextString(pFile, (UINT8*)szTextType, length) == false) { - MSG_DEBUG("MmsBinaryEncodeContentType: szTextType MmsBinaryEncodeTextString fail \n"); + MSG_DEBUG("szTextType MmsBinaryEncodeTextString fail"); goto __CATCH; } } - /* Parameters -------------------------------------------------------------- */ - - MSG_DEBUG("MmsBinaryEncodeContentType: P A R M E T E R S \n\n"); - /* Name = Text-string ------------------------------------------------------ */ - if (pType->param.szName[0]) { - char* pszName = NULL; - - if (MsgIsASCII (pType->param.szName)) { - - MSG_DEBUG("MmsBinaryEncodeContentType: szName is consisted of ascii char-set chars. \n"); - - pszName = (char *)malloc(strlen(pType->param.szName) +1); - memset(pszName, 0, (strlen(pType->param.szName)+1)); - strcpy(pszName, pType->param.szName); + MSG_SEC_DEBUG("Parameter Name : %s", pType->param.szName); + char *pszName = NULL; + if (MmsIsAsciiString (pType->param.szName)) { + MSG_DEBUG("Name is consisted of ascii char-set chars."); } else { - MSG_DEBUG("MmsBinaryEncodeContentTypeLen: szName is not consisted of ascii char-set chars. \n"); - - /* if msg-server can't support non ascii, then convert non-ascii to '_' by using _MsgReplaceNonAscii*/ - int filelen = strlen(pType->param.szName); - - pszName = (char *)malloc(filelen + 1); - memset(pszName, 0, (filelen + 1)); - strncpy(pszName, pType->param.szName, filelen); - - MSG_DEBUG("MmsBinaryEncodeContentType: pszName : %s\n", pszName); + isAscii = false; + MSG_DEBUG("Name is NOT consisted of ascii char-set chars."); } - //change empty space to '_' in the file name - if (MsgIsSpace(pszName)) { - char* pszTempName = NULL; + pszName = g_strdup(pType->param.szName); - MSG_DEBUG("MmsBinaryEncodeContentType: szName has space(' '). \n"); + //change empty space to '_' in the file name + MmsReplaceSpaceChar(pszName); - MsgReplaceSpecialChar(pszName, &pszTempName, ' '); + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_NAME) | 0x80; - if (pszTempName) { - free(pszName); - pszName = pszTempName; + if (isAscii == false) { + if (MsgEncode2Base64(pszName, strlen(pszName), &tmpLength, tmpFileName) == true) { + g_free(pszName); + pszName = g_strdup_printf("=?UTF-8?B?%s?=", tmpFileName); + length = __MmsBinaryEncodeTextStringLen((UINT8*)pszName); + MSG_DEBUG("base64 encode filename=[%s]", pszName); } - MSG_DEBUG("MmsBinaryEncodeContentType: pszName : %s\n", pszName); } length = __MmsBinaryEncodeTextStringLen((UINT8*)pszName); + if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentType: szName MmsBinaryEncodeIntegerLen fail \n"); + MSG_DEBUG("szName MmsBinaryEncodeIntegerLen fail"); free(pszName); goto __CATCH; } - gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_NAME) | 0x80; if (__MmsBinaryEncodeTextString(pFile, (UINT8*)pszName, length) == false) { - MSG_DEBUG("MmsBinaryEncodeContentType: szName MmsBinaryEncodeTextString fail\n"); + MSG_DEBUG("szName MmsBinaryEncodeTextString fail"); free(pszName); goto __CATCH; } free(pszName); } #ifdef FEATURE_JAVA_MMS - MSG_DEBUG(" MmsBinaryEncodeContentType: Application-ID \n"); /* Application-ID: Text-string */ if (pType->param.szApplicationID) { + MSG_SEC_DEBUG("Parameter Application ID : %s", pType->param.szApplicationID); length = __MmsBinaryEncodeTextStringLen((UINT8*) pType->param.szApplicationID); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentType: szApplicationID MmsBinaryEncodeIntegerLen Fail \n"); + MSG_DEBUG("szApplicationID MmsBinaryEncodeIntegerLen Fail"); goto __CATCH; } @@ -1671,7 +1645,7 @@ static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLe szParameter = MmsGetTextValue(MmsCodeParameterCode, MSG_PARAM_APPLICATION_ID); if (szParameter == NULL) { - MSG_DEBUG("MmsBinaryEncodeContentType: szParameter is NULL \n"); + MSG_DEBUG("szParameter is NULL"); goto __CATCH; } @@ -1680,7 +1654,7 @@ static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLe gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] =(UINT8)NULL; if (__MmsBinaryEncodeTextString(pFile, (UINT8*) pType->param.szApplicationID, length) == false) { - MSG_DEBUG(" MmsBinaryEncodeContentType: szApplicationID MmsBinaryEncodeTextString fail\n"); + MSG_DEBUG(" szApplicationID MmsBinaryEncodeTextString fail"); goto __CATCH; } @@ -1688,9 +1662,10 @@ static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLe /* ReplyToApplicationID: Text-string */ if (pType->param.szReplyToApplicationID) { + MSG_SEC_DEBUG("Parameter Reply To Application-ID : %s", pType->param.szReplyToApplicationID); length = __MmsBinaryEncodeTextStringLen((UINT8*) pType->param.szReplyToApplicationID); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentType: szReplyToApplicationID MmsBinaryEncodeIntegerLen Fail \n"); + MSG_DEBUG("szReplyToApplicationID MmsBinaryEncodeIntegerLen Fail"); goto __CATCH; } @@ -1700,7 +1675,7 @@ static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLe szParameter = MmsGetTextValue(MmsCodeParameterCode, MSG_PARAM_REPLY_TO_APPLICATION_ID); if (szParameter == NULL) { - MSG_DEBUG("MmsBinaryEncodeContentType: szParameter is NULL \n"); + MSG_DEBUG("szParameter is NULL"); goto __CATCH; } @@ -1709,7 +1684,7 @@ static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLe gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] =(UINT8)NULL; if (__MmsBinaryEncodeTextString(pFile, (UINT8*) pType->param.szReplyToApplicationID, length) == false) { - MSG_DEBUG(" MmsBinaryEncodeContentType: szApplicationID MmsBinaryEncodeTextString fail\n"); + MSG_DEBUG("szApplicationID MmsBinaryEncodeTextString fail"); goto __CATCH; } } @@ -1718,21 +1693,22 @@ static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLe /* Well-known-charset = Any-charset | Integer-value ----------------------- */ if (pType->param.charset != MSG_CHARSET_UNKNOWN) { + MSG_DEBUG("Parameter Charset : %d", pType->param.charset); fieldValue = MmsGetBinaryValue(MmsCodeCharSet, pType->param.charset); length = __MmsBinaryEncodeIntegerLen(fieldValue); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentType: charSet MmsBinaryEncodeIntegerLen fail \n"); + MSG_DEBUG("charSet MmsBinaryEncodeIntegerLen fail"); goto __CATCH; } gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_CHARSET) | 0x80; if (__MmsBinaryEncodeInteger(pFile, fieldValue, length) == false) { - MSG_DEBUG("MmsBinaryEncodeContentType: charSet MmsBinaryEncodeInteger fail\n"); + MSG_DEBUG("charSet MmsBinaryEncodeInteger fail"); goto __CATCH; } } else { /* Any-charset */ - if (MmsIsText(contentType)) { + if (MmsIsTextType(contentType)) { if (!MmsIsVitemContent (contentType, pType->param.szName)) { gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_CHARSET) | 0x80; fieldValue = 0x0000; //laconic_warning, just to remove warning message @@ -1743,6 +1719,7 @@ static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLe /* type, start, & startInfo : multipart/related only parameters -------------- */ if (contentType == MIME_MULTIPART_RELATED || contentType == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) { + MSG_SEC_DEBUG("Parameter Content Type : %s", MmsGetTextValue(MmsCodeContentType, pType->param.type)); /* type ------------------------------------- */ fieldValue = MmsGetBinaryValue(MmsCodeContentType, pType->param.type); if (fieldValue == UNDEFINED_BINARY || fieldValue == 0x0049) { @@ -1758,13 +1735,13 @@ static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLe } else { length = __MmsBinaryEncodeTextStringLen((UINT8*)szTextType); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentType: type param MmsBinaryEncodeTextStringLen fail \n"); + MSG_DEBUG("type param MmsBinaryEncodeTextStringLen fail"); goto __CATCH; } gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_TYPE) | 0x80; if (__MmsBinaryEncodeTextString(pFile, (UINT8*)szTextType, length) == false) { - MSG_DEBUG("MmsBinaryEncodeContentType: type param MmsBinaryEncodeTextString fail \n"); + MSG_DEBUG("type param MmsBinaryEncodeTextString fail"); goto __CATCH; } } @@ -1772,16 +1749,17 @@ static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLe /* start = Text-string ----------------------- */ if (pType->param.szStart[0]) { /* start = Text-string */ + MSG_DEBUG("Parameter Start: %s", pType->param.szStart); length = __MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szStart); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentType: szStart MmsBinaryEncodeTextStringLen fail \n"); + MSG_DEBUG("szStart MmsBinaryEncodeTextStringLen fail"); goto __CATCH; } gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_START) | 0x80; if (__MmsBinaryEncodeTextString(pFile, (UINT8*)pType->param.szStart, length) == false) { - MSG_DEBUG("MmsBinaryEncodeContentType: szStart MmsBinaryEncodeTextString fail \n"); + MSG_DEBUG("szStart MmsBinaryEncodeTextString fail"); goto __CATCH; } } @@ -1789,15 +1767,16 @@ static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLe /* startInfo = Text-string -------------------- */ if (pType->param.szStartInfo[0]) { /* StartInfo (with multipart/related) = Text-string */ + MSG_DEBUG("Parameter StartInfo: %s", pType->param.szStartInfo); length = __MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szStartInfo); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentType: szStartInfo MmsBinaryEncodeTextStringLen fail \n"); + MSG_DEBUG("szStartInfo MmsBinaryEncodeTextStringLen fail"); goto __CATCH; } gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_START_INFO) | 0x80; if (__MmsBinaryEncodeTextString(pFile, (UINT8*)pType->param.szStartInfo, length) == false) { - MSG_DEBUG("MmsBinaryEncodeContentType: szStartInfo MmsBinaryEncodeTextString fail \n"); + MSG_DEBUG("szStartInfo MmsBinaryEncodeTextString fail"); goto __CATCH; } } @@ -1806,7 +1785,7 @@ static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLe return true; __CATCH: - MSG_DEBUG("## MmsBinaryEncodeContentType: failed"); + MSG_DEBUG("Failed"); return false; } @@ -1822,23 +1801,23 @@ static bool __MmsBinaryEncodeMsgPart(FILE *pFile, int contentType, MsgType *pTyp length = __MmsBinaryEncodeUintvarLen(pType->size); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeMsgPart: 1. headerLeng MmsBinaryEncodeUintvarLen fail \n"); + MSG_DEBUG("1. headerLeng MmsBinaryEncodeUintvarLen fail"); goto __CATCH; } if (__MmsBinaryEncodeUintvar(pFile, pType->size, length) == false) { - MSG_DEBUG("MmsBinaryEncodeMsgPart: 1. eaderLeng fail \n"); + MSG_DEBUG("1. eaderLeng fail"); goto __CATCH; } length = __MmsBinaryEncodeUintvarLen(pBody->size); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeMsgPart: 1. bodyLeng MmsBinaryEncodeUintvarLen fail \n"); + MSG_DEBUG("1. bodyLeng MmsBinaryEncodeUintvarLen fail"); goto __CATCH; } if (__MmsBinaryEncodeUintvar(pFile, pBody->size, length) == false) { - MSG_DEBUG("MmsBinaryEncodeMsgPart: 1. bodyLeng fail \n"); + MSG_DEBUG("1. bodyLeng fail"); goto __CATCH; } @@ -1849,7 +1828,7 @@ static bool __MmsBinaryEncodeMsgPart(FILE *pFile, int contentType, MsgType *pTyp goto __CATCH; if (MsgFseek(pFile2, pType->offset, SEEK_SET) < 0) { - MSG_DEBUG("MmsBinaryEncodeMsgPart: MsgFseek fail \n"); + MSG_DEBUG("MsgFseek fail"); goto __CATCH; } @@ -1858,7 +1837,7 @@ static bool __MmsBinaryEncodeMsgPart(FILE *pFile, int contentType, MsgType *pTyp if ((nRead = MsgReadFile(pData, sizeof(char), pType->size, pFile2)) == 0) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("MmsBinaryEncodeMsgPart: 1. header MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("1. header MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } pType->offset = __MmsGetEncodeOffset(); @@ -1887,36 +1866,36 @@ static bool __MmsBinaryEncodeMsgPart(FILE *pFile, int contentType, MsgType *pTyp contentHdrLen = __MmsBinaryEncodeContentHeaderLen((MimeType)contentType, pType, true); if (contentTypeLen == -1 || length == -1 || contentHdrLen == -1) { - MSG_DEBUG("MmsBinaryEncodeMsgPart: headerLeng calculation fail \n"); + MSG_DEBUG("headerLeng calculation fail"); goto __CATCH; } headerLeng = contentTypeLen + contentHdrLen + length; length = __MmsBinaryEncodeUintvarLen(headerLeng); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeMsgPart: headerLeng MmsBinaryEncodeUintvarLen fail \n"); + MSG_DEBUG("headerLeng MmsBinaryEncodeUintvarLen fail"); goto __CATCH; } if (__MmsBinaryEncodeUintvar(pFile, headerLeng, length) == false) { - MSG_DEBUG("MmsBinaryEncodeMsgPart: headerLeng fail \n"); + MSG_DEBUG("headerLeng fail"); goto __CATCH; } length = __MmsBinaryEncodeUintvarLen(pBody->size); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeMsgPart: bodyLeng MmsBinaryEncodeUintvarLen fail \n"); + MSG_DEBUG("bodyLeng MmsBinaryEncodeUintvarLen fail"); goto __CATCH; } if (__MmsBinaryEncodeUintvar(pFile, pBody->size, length) == false) { - MSG_DEBUG("MmsBinaryEncodeMsgPart: bodyLeng fail \n"); + MSG_DEBUG("bodyLeng fail"); goto __CATCH; } if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("MmsBinaryEncodeMsgPart: 2. header MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("2. header MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } @@ -1924,12 +1903,12 @@ static bool __MmsBinaryEncodeMsgPart(FILE *pFile, int contentType, MsgType *pTyp pType->offset = __MmsGetEncodeOffset(); if (__MmsBinaryEncodeContentType(pFile, pType, contentTypeLen) == false) { - MSG_DEBUG("MmsBinaryEncodeMsgPart: MmsBinaryEncodeContentType fail \n"); + MSG_DEBUG("MmsBinaryEncodeContentType fail"); goto __CATCH; } if (__MmsBinaryEncodeContentHeader(pFile, (MimeType)contentType, pType, true) == false) { - MSG_DEBUG("MmsBinaryEncodeMsgPart: MmsBinaryEncodeContentHeader fail \n"); + MSG_DEBUG("MmsBinaryEncodeContentHeader fail"); goto __CATCH; } @@ -1937,13 +1916,13 @@ static bool __MmsBinaryEncodeMsgPart(FILE *pFile, int contentType, MsgType *pTyp } if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("MmsBinaryEncodeMsgPart: contentBody MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("contentBody MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } /* content-body --------------------------- */ if (__MmsBinaryEncodeContentBody(pFile, pBody) == false) { - MSG_DEBUG("MmsBinaryEncodeMsgPart: __MmsBinaryEncodeContentBody fail \n"); + MSG_DEBUG("__MmsBinaryEncodeContentBody fail"); goto __CATCH; } @@ -1961,7 +1940,7 @@ __CATCH: pData = NULL; } - MSG_DEBUG("## MmsBinaryEncodeMsgPart: failed\n"); + MSG_DEBUG("Failed"); if (pFile2) { MsgCloseFile(pFile2); pFile2 = NULL; @@ -1976,9 +1955,6 @@ static int __MmsBinaryEncodeContentHeaderLen(MimeType contentType, MsgType *pTyp int totalLength = 0; const char *szTextValue = NULL; - - MSG_DEBUG("MmsBinaryEncodeContentHeaderLen: S T A R T \n\n"); - /* content-id ------------------------------------------------- */ if (pType->szContentID[0]) { if (bMultipart) { //Binary Encoding @@ -1987,7 +1963,7 @@ static int __MmsBinaryEncodeContentHeaderLen(MimeType contentType, MsgType *pTyp /* content-id = Quoted-string */ length = __MmsBinaryEncodeTextStringLen((UINT8*)"Content-ID"); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentHeaderLen: Content-ID MmsBinaryEncodeTextStringLen fail.\n"); + MSG_DEBUG("Content-ID MmsBinaryEncodeTextStringLen fail."); goto __CATCH; } @@ -1996,7 +1972,7 @@ static int __MmsBinaryEncodeContentHeaderLen(MimeType contentType, MsgType *pTyp length = __MmsBinaryEncodeQuotedStringLen((UINT8*)pType->szContentID); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentHeader: pType->szContentID MmsBinaryEncodeQuotedStringLen fail.\n"); + MSG_DEBUG("pType->szContentID MmsBinaryEncodeQuotedStringLen fail."); goto __CATCH; } totalLength += length; @@ -2010,7 +1986,7 @@ static int __MmsBinaryEncodeContentHeaderLen(MimeType contentType, MsgType *pTyp /* content-location = Quoted-string */ length = __MmsBinaryEncodeTextStringLen((UINT8*)"Content-Location"); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Location MmsBinaryEncodeTextStringLen fail.\n"); + MSG_DEBUG("Content-Location MmsBinaryEncodeTextStringLen fail."); goto __CATCH; } @@ -2019,7 +1995,7 @@ static int __MmsBinaryEncodeContentHeaderLen(MimeType contentType, MsgType *pTyp length = __MmsBinaryEncodeTextStringLen((UINT8*)pType->szContentLocation); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentHeader: pType->szContentLocation MmsBinaryEncodeTextStringLen fail.\n"); + MSG_DEBUG("pType->szContentLocation MmsBinaryEncodeTextStringLen fail."); goto __CATCH; } @@ -2050,7 +2026,7 @@ static int __MmsBinaryEncodeContentHeaderLen(MimeType contentType, MsgType *pTyp if (szTextValue) { length = __MmsBinaryEncodeTextStringLen((UINT8*)"Content-Disposition"); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Disposition MmsBinaryEncodeTextStringLen fail.\n"); + MSG_DEBUG("Content-Disposition MmsBinaryEncodeTextStringLen fail."); goto __CATCH; } @@ -2058,7 +2034,7 @@ static int __MmsBinaryEncodeContentHeaderLen(MimeType contentType, MsgType *pTyp length = __MmsBinaryEncodeTextStringLen((UINT8*)szTextValue); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Disposition MmsBinaryEncodeTextStringLen fail.\n"); + MSG_DEBUG("Content-Disposition MmsBinaryEncodeTextStringLen fail."); goto __CATCH; } totalLength += length; @@ -2069,8 +2045,7 @@ static int __MmsBinaryEncodeContentHeaderLen(MimeType contentType, MsgType *pTyp return totalLength; __CATCH: - MSG_DEBUG("## MmsBinaryEncodeContentHeadeLen: failed"); - + MSG_DEBUG("Failed"); return -1; } @@ -2079,73 +2054,78 @@ static bool __MmsBinaryEncodeContentHeader(FILE *pFile, MimeType contentType, Ms int length = 0; const char *szTextValue = NULL; - MSG_DEBUG("MmsBinaryEncodeContentHeader: S T A R T \n\n"); - /* content-id ------------------------------------------------- */ if (pType->szContentID[0]) { + + MSG_SEC_DEBUG("Content ID : %s", pType->szContentID); + if (bMultipart) { //Binary Encoding gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeMsgBodyHeaderCode, MMS_BODYHDR_CONTENTID) | 0x80; } else { /* content-id = Quoted-string */ length = __MmsBinaryEncodeTextStringLen((UINT8*)"Content-ID"); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-ID MmsBinaryEncodeTextStringLen fail.\n"); + MSG_DEBUG("Content-ID MmsBinaryEncodeTextStringLen fail."); goto __CATCH; } if (__MmsBinaryEncodeTextString(pFile, (UINT8*)"Content-ID", length) == false) { - MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-ID MmsBinaryEncodeTextString fail.\n"); + MSG_DEBUG("Content-ID MmsBinaryEncodeTextString fail."); goto __CATCH; } } length = __MmsBinaryEncodeQuotedStringLen((UINT8*)pType->szContentID); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentHeader: pType->szContentID MmsBinaryEncodeQuotedStringLen fail.\n"); + MSG_DEBUG("pType->szContentID MmsBinaryEncodeQuotedStringLen fail."); goto __CATCH; } if (__MmsBinaryEncodeQuotedString(pFile, (UINT8*)pType->szContentID, length) == false) { - MSG_DEBUG("MmsBinaryEncodeContentHeader: pType->szContentID MmsBinaryEncodeQuotedString fail.\n"); + MSG_DEBUG("pType->szContentID MmsBinaryEncodeQuotedString fail."); goto __CATCH; } } if (pType->szContentLocation[0]) { + + MSG_SEC_DEBUG("Content Location : %s", pType->szContentLocation); + if (bMultipart) { //Binary Encoding gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeMsgBodyHeaderCode, MMS_BODYHDR_CONTENTLOCATION) | 0x80; } else { /* content-location = Quoted-string */ length = __MmsBinaryEncodeTextStringLen((UINT8*)"Content-Location"); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Location MmsBinaryEncodeTextStringLen fail.\n"); + MSG_DEBUG("Content-Location MmsBinaryEncodeTextStringLen fail."); goto __CATCH; } if (__MmsBinaryEncodeTextString(pFile, (UINT8*)"Content-Location", length) == false) { - MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Location MmsBinaryEncodeTextString fail.\n"); + MSG_DEBUG("Content-Location MmsBinaryEncodeTextString fail."); goto __CATCH; } } length = __MmsBinaryEncodeTextStringLen((UINT8*)pType->szContentLocation); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentHeader: pType->szContentLocation MmsBinaryEncodeTextStringLen fail.\n"); + MSG_DEBUG("pType->szContentLocation MmsBinaryEncodeTextStringLen fail."); goto __CATCH; } if (__MmsBinaryEncodeTextString(pFile, (UINT8*)pType->szContentLocation, length) == false) { - MSG_DEBUG("MmsBinaryEncodeContentHeader: pType->szContentLocation MmsBinaryEncodeTextString fail.\n"); + MSG_DEBUG("pType->szContentLocation MmsBinaryEncodeTextString fail."); goto __CATCH; } } - /* MIME_APPLICATION_VND_WAP_MULTIPART_RELATEDrequires always "inline" */ + /* MIME_APPLICATION_VND_WAP_MULTIPART_RELATED requires always "inline" */ if (contentType != MIME_APPLICATION_VND_WAP_MULTIPART_RELATED && contentType != MIME_MULTIPART_RELATED && pType->disposition != INVALID_VALUE) { + MSG_DEBUG("Content Disposition : %d", pType->disposition); /* * Content-disposition-value = Value-length Disposition *(Parameter) * Disposition = Form-data | Attachment | Inline | Token-text @@ -2174,23 +2154,23 @@ static bool __MmsBinaryEncodeContentHeader(FILE *pFile, MimeType contentType, Ms if (szTextValue) { length = __MmsBinaryEncodeTextStringLen((UINT8*)"Content-Disposition"); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Disposition MmsBinaryEncodeTextStringLen fail.\n"); + MSG_DEBUG("Content-Disposition MmsBinaryEncodeTextStringLen fail."); goto __CATCH; } if (__MmsBinaryEncodeTextString(pFile, (UINT8*)"Content-Disposition", length) == false) { - MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Disposition MmsBinaryEncodeTextString fail.\n"); + MSG_DEBUG("Content-Disposition MmsBinaryEncodeTextString fail."); goto __CATCH; } length = __MmsBinaryEncodeTextStringLen((UINT8*)szTextValue); if (length == -1) { - MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Disposition MmsBinaryEncodeTextStringLen fail.\n"); + MSG_DEBUG("Content-Disposition MmsBinaryEncodeTextStringLen fail."); goto __CATCH; } if (__MmsBinaryEncodeTextString(pFile, (UINT8*)szTextValue, length) == false) { - MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Disposition MmsBinaryEncodeTextString fail.\n"); + MSG_DEBUG("Content-Disposition MmsBinaryEncodeTextString fail."); goto __CATCH; } } @@ -2200,7 +2180,7 @@ static bool __MmsBinaryEncodeContentHeader(FILE *pFile, MimeType contentType, Ms return true; __CATCH: - MSG_DEBUG("## MmsBinaryEncodeContentHeader: failed"); + MSG_DEBUG("Failed"); return false; } @@ -2254,7 +2234,7 @@ static bool __MmsBinaryEncodeContentBody(FILE *pFile, MsgBody *pBody) return true; __CATCH: - MSG_DEBUG("## __MmsBinaryEncodeContentBody: failed\n"); + MSG_DEBUG("##failed"); if (pData) { free(pData); pData = NULL; @@ -2307,14 +2287,14 @@ static bool __MmsBinaryEncodeInteger(FILE *pFile, UINT32 integer, int length) if (pFile == NULL) { - MSG_DEBUG("MmsBinaryEncodeInteger: source == NULL \n"); + MSG_DEBUG("source == NULL"); goto __CATCH; } if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < length) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("MmsBinaryEncodeInteger: MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } @@ -2387,14 +2367,14 @@ static bool __MmsBinaryEncodeLongInteger(FILE *pFile, UINT32 integer, int length */ if (pFile == NULL) { - MSG_DEBUG("MmsBinaryEncodeLongInteger: source == NULL \n"); + MSG_DEBUG("pFile == NULL"); goto __CATCH; } if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < length) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("MmsBinaryEncodeLongInteger: MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } @@ -2419,10 +2399,8 @@ static int __MmsBinaryEncodeTextStringLen(UINT8 *source) { int length = 0; - MSG_DEBUG("MmsBinaryEncodeTextStringLen: \n"); - if (source == NULL) { - MSG_DEBUG("MmsBinaryEncodeTextStringLen: source == NULL \n"); + MSG_DEBUG("source == NULL"); return -1; } @@ -2444,9 +2422,6 @@ static int __MmsBinaryEncodeTextStringLen(UINT8 *source) */ static bool __MmsBinaryEncodeTextString(FILE *pFile, UINT8 *source, int length) { - - MSG_DEBUG("MmsBinaryEncodeTextString: \n"); - /* * make text string * Text-string = [Quote] *TEXT End-of-string @@ -2457,14 +2432,14 @@ static bool __MmsBinaryEncodeTextString(FILE *pFile, UINT8 *source, int length) */ if (pFile == NULL || source == NULL) { - MSG_DEBUG("MmsBinaryEncodeTextString: source == NULL \n"); + MSG_DEBUG("pFile == %p, source = %p", pFile, source); goto __CATCH; } if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < length) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("MmsBinaryEncodeTextString: MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } @@ -2529,14 +2504,14 @@ static bool __MmsBinaryEncodeUintvar(FILE *pFile, UINT32 integer, int length) } source; if (pFile == NULL) { - MSG_DEBUG("MmsBinaryEncodeUintvar: pFile == INVALID_HBOJ \n"); + MSG_DEBUG("pFile == INVALID_HBOJ"); goto __CATCH; } if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < length) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("MmsBinaryEncodeUintvar: MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } @@ -2600,14 +2575,14 @@ static bool __MmsBinaryEncodeValueLength(FILE *pFile, UINT32 integer, int length */ if (pFile == NULL) { - MSG_DEBUG("MmsBinaryEncodeValueLength: pFile == INVALID_HBOJ \n"); + MSG_DEBUG("pFile == INVALID_HBOJ"); goto __CATCH; } if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < length) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("MmsBinaryEncodeValueLength: MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } @@ -2617,7 +2592,7 @@ static bool __MmsBinaryEncodeValueLength(FILE *pFile, UINT32 integer, int length } else { gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)LENGTH_QUOTE; if (__MmsBinaryEncodeUintvar(pFile, integer, length - 1) == false) { // LENGTH_QUOTE - MSG_DEBUG("MmsBinaryEncodeValueLength: MmsBinaryEncodeUintvar fail\n"); + MSG_DEBUG("MmsBinaryEncodeUintvar fail"); goto __CATCH; } } @@ -2631,7 +2606,7 @@ __CATCH: static int __MmsBinaryEncodeQuotedStringLen(UINT8 *pSrc) { if (pSrc == NULL) { - MSG_DEBUG("MmsBinaryEncodeQuotedStringLen: invalid file\n"); + MSG_DEBUG("invalid file"); goto __CATCH; } @@ -2653,14 +2628,14 @@ __CATCH: static bool __MmsBinaryEncodeQuotedString(FILE *pFile, UINT8 *source, int length) { if (source == NULL || pFile == NULL) { - MSG_DEBUG("MmsBinaryEncodeQuotedString: invalid file\n"); + MSG_DEBUG("invalid file"); goto __CATCH; } if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < length) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("MmsBinaryEncodeQuotedString: MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } @@ -2683,26 +2658,23 @@ static int __MmsBinaryEncodeEncodedStringLen(UINT8 *source) int textLeng = 0; int valueLengthLen = 0; - - MSG_DEBUG("MmsBinaryEncodeEncodedStringLen: \n"); - /* value-length charSet text-string */ /* Estimate charset value length and text string length */ charLeng = __MmsBinaryEncodeIntegerLen(charset); if (charLeng == -1) { - MSG_DEBUG("MmsBinaryEncodeEncodedStringLen : charLeng MmsBinaryEncodeTextStringLen fail.\n"); + MSG_DEBUG(" charLeng MmsBinaryEncodeTextStringLen fail."); goto __CATCH;; } textLeng = __MmsBinaryEncodeTextStringLen((UINT8*)source); if (textLeng == -1) { - MSG_DEBUG("MmsBinaryEncodeEncodedStringLen : textLeng MmsBinaryEncodeTextStringLen fail.\n"); + MSG_DEBUG(" textLeng MmsBinaryEncodeTextStringLen fail."); goto __CATCH;; } valueLengthLen = __MmsBinaryEncodeValueLengthLen(charLeng + textLeng); if (valueLengthLen == -1) { - MSG_DEBUG("MmsBinaryEncodeEncodedStringLen : valLengthLen MmsBinaryEncodeTextStringLen fail.\n"); + MSG_DEBUG(" valLengthLen MmsBinaryEncodeTextStringLen fail."); goto __CATCH; } @@ -2725,65 +2697,60 @@ static bool __MmsBinaryEncodeEncodedString(FILE *pFile, UINT8 *source, int lengt int textLeng = 0; int valLengthLen = 0; - - MSG_DEBUG("MmsBinaryEncodeEncodedString: \n"); - /* value-length charSet text-string */ - if (pFile == NULL || source == NULL) { - MSG_DEBUG("MmsBinaryEncodeEncodedString: invalid input parameter\n"); + MSG_DEBUG("invalid input parameter"); goto __CATCH; } /* Estimate charset value length and text string length */ charLeng = __MmsBinaryEncodeIntegerLen(charset); if (charLeng == -1) { - MSG_DEBUG("MmsBinaryEncodeEncodedString : charLeng MmsBinaryEncodeTextStringLen fail.\n"); + MSG_DEBUG("charLeng MmsBinaryEncodeTextStringLen fail."); goto __CATCH;; } textLeng = __MmsBinaryEncodeTextStringLen((UINT8*)source); if (textLeng == -1) { - MSG_DEBUG("MmsBinaryEncodeEncodedString : textLeng MmsBinaryEncodeTextStringLen fail.\n"); + MSG_DEBUG("textLeng MmsBinaryEncodeTextStringLen fail."); goto __CATCH;; } valLengthLen = __MmsBinaryEncodeValueLengthLen(charLeng + textLeng); if (valLengthLen == -1) { - MSG_DEBUG("MmsBinaryEncodeEncodedString : MmsBinaryEncodeValueLengthLen fail.\n"); + MSG_DEBUG("MmsBinaryEncodeValueLengthLen fail."); goto __CATCH; } if (length != (charLeng + textLeng + valLengthLen)) { - MSG_DEBUG("MmsBinaryEncodeEncodedString: invalid length\n"); + MSG_DEBUG("invalid length"); goto __CATCH; } if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < length) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("MmsBinaryEncodeEncodedString: MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } /* Value length of charset value and text string */ if (__MmsBinaryEncodeValueLength(pFile, charLeng + textLeng, valLengthLen) == false) { - MSG_DEBUG("MmsBinaryEncodeEncodedString : MmsBinaryEncodeValueLength fail.\n"); + MSG_DEBUG("MmsBinaryEncodeValueLength fail."); goto __CATCH; } /* fixme: Write charset on buffer -> integer value not long-integer */ if (__MmsBinaryEncodeInteger(pFile, charset, charLeng) == false) { - MSG_DEBUG("MmsBinaryEncodeEncodedString : MmsBinaryEncodeInteger fail.\n"); + MSG_DEBUG("MmsBinaryEncodeInteger fail."); goto __CATCH; } - /* Write text string on buffer */ if (__MmsBinaryEncodeTextString(pFile, (UINT8*)source, textLeng) == false) { - MSG_DEBUG("MmsBinaryEncodeEncodedString : MmsBinaryEncodeTextString fail.\n"); + MSG_DEBUG("MmsBinaryEncodeTextString fail."); goto __CATCH; } @@ -2798,18 +2765,18 @@ static bool __MmsBinaryEncodeFieldCodeAndValue(FILE *pFile, UINT8 fieldCode, UIN if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < 2) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("__MmsBinaryEncodeFieldCodeAndValue: MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } if (fieldCode == 0xff) { - MSG_DEBUG("__MmsBinaryEncodeFieldCodeAndValue: invalid fieldCode \n"); + MSG_DEBUG("invalid fieldCode"); goto __CATCH; } if (fieldValue == 0xff) { - MSG_DEBUG("__MmsBinaryEncodeFieldCodeAndValue: invalid fieldValue \n"); + MSG_DEBUG("invalid fieldValue"); return true; } @@ -2835,34 +2802,36 @@ static bool __MmsBinaryEncodeTrID(FILE *pFile, char *szTrID, int bufLen) dateTime = localtime(&RawTime); dateSec = mktime(dateTime); - fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_TRID) | 0x80; if (fieldCode == 0xff) { - MSG_DEBUG("__MmsBinaryEncodeTrID: invalid fieldCode \n"); + MSG_DEBUG("Invalid fieldCode[0x%02x]", fieldCode & 0x7F); goto __CATCH; } - snprintf(szBuff, MMS_TR_ID_LEN + 1, "%lu.%lu", dateSec, (unsigned long)random()); - MSG_DEBUG("__MmsBinaryEncodeTrID: 2. szBuff = %s\n", szBuff); + if (szTrID && strlen(szTrID)) { + snprintf(szBuff, MMS_TR_ID_LEN + 1, "%s", szTrID); + } else { + snprintf(szBuff, MMS_TR_ID_LEN + 1, "%lu.%lu", dateSec, (unsigned long)random()); + MSG_SEC_DEBUG("Generated Transaction ID = %s", szBuff); + } length = __MmsBinaryEncodeTextStringLen((UINT8*)szBuff); if (length == -1) { - MSG_DEBUG("__MmsBinaryEncodeTrID: MmsBinaryEncodeTextStringLen fail \n"); + MSG_DEBUG("MmsBinaryEncodeTextStringLen fail"); goto __CATCH; } if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + 1)) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("__MmsBinaryEncodeTrID: MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } - gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = fieldCode; if (__MmsBinaryEncodeTextString(pFile, (UINT8*)szBuff, length) == false) { - MSG_DEBUG("__MmsBinaryEncodeTrID: MmsBinaryEncodeTextString fail\n"); + MSG_DEBUG("MmsBinaryEncodeTextString fail"); goto __CATCH; } @@ -2871,6 +2840,7 @@ static bool __MmsBinaryEncodeTrID(FILE *pFile, char *szTrID, int bufLen) strncpy(szTrID, szBuff, bufLen - 1); } + MSG_SEC_INFO("X-Mms-Transaction-Id = [%s]", szBuff); return true; __CATCH: @@ -2885,29 +2855,29 @@ static bool __MmsBinaryEncodeMsgID(FILE *pFile, const char *szMsgID) fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGID) | 0x80; if (fieldCode == 0xff) { - MSG_DEBUG("__MmsBinaryEncodeTrID: invalid fieldCode \n"); + MSG_DEBUG("invalid fieldCode"); goto __CATCH; } - MSG_DEBUG("__MmsBinaryEncodeMsgID: 2. szBuff = %s\n", szMsgID); + MSG_DEBUG("2. szBuff = %s", szMsgID); length = __MmsBinaryEncodeTextStringLen((UINT8*)szMsgID); if (length == -1) { - MSG_DEBUG("__MmsBinaryEncodeMsgID: MmsBinaryEncodeTextStringLen fail \n"); + MSG_DEBUG("MmsBinaryEncodeTextStringLen fail"); goto __CATCH; } if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + 1)) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("__MmsBinaryEncodeTrID: MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = fieldCode; if (__MmsBinaryEncodeTextString(pFile, (UINT8*)szMsgID, length) == false) { - MSG_DEBUG("__MmsBinaryEncodeTrID: MmsBinaryEncodeTextString fail\n"); + MSG_DEBUG("MmsBinaryEncodeTextString fail"); goto __CATCH; } @@ -2923,28 +2893,28 @@ static bool __MmsBinaryEncodeMmsVersion(FILE *pFile) UINT8 majorVer = MMS_MAJOR_VERSION; UINT8 minorVer = MMS_MINOR_VERSION; - MSG_DEBUG("__MmsBinaryEncodeMmsVersion: \n"); - if (pFile == NULL) { - MSG_DEBUG("__MmsBinaryEncodeMmsVersion: invalid input file \n"); + MSG_DEBUG("invalid input file"); goto __CATCH; } if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < 2) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("__MmsBinaryEncodeMmsVersion: MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_VERSION) | 0x80; - MSG_DEBUG("__MmsBinaryEncodeMmsVersion: major version (%d)\n", majorVer); - MSG_DEBUG("__MmsBinaryEncodeMmsVersion: minor version (%d)\n", minorVer); + MSG_DEBUG("major version (%d)", majorVer); + MSG_DEBUG("minor version (%d)", minorVer); gpMmsEncodeBuf[gCurMmsEncodeBuffPos] = (majorVer << 4) | (minorVer & 0x0f) | MSB; + MSG_SEC_INFO("X-Mms-MMS-Version = [0x%02x]", gpMmsEncodeBuf[gCurMmsEncodeBuffPos]); + if (gpMmsEncodeBuf[gCurMmsEncodeBuffPos] < 0x80) { gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] |= 0x80; } else { @@ -2957,15 +2927,19 @@ __CATCH: return false; } -static bool __MmsBinaryEncodeDate(FILE *pFile) +static bool __MmsBinaryEncodeDate(FILE *pFile, time_t inpDateSec) { struct tm *dateTime = NULL; time_t dateSec = 0; - dateSec = time(NULL); + if(inpDateSec > 0) + dateSec = inpDateSec; + else + dateSec = time(NULL); + dateTime = localtime(&dateSec); - MSG_DEBUG("%d - %d - %d, %d : %d (SYSTEM)", dateTime->tm_year + 1900, dateTime->tm_mon + 1, dateTime->tm_mday + MSG_SEC_INFO("%d - %d - %d, %d : %d (SYSTEM)", dateTime->tm_year + 1900, dateTime->tm_mon + 1, dateTime->tm_mday , dateTime->tm_hour, dateTime->tm_min); if (dateSec > 0) { @@ -2975,7 +2949,7 @@ static bool __MmsBinaryEncodeDate(FILE *pFile) if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + 1)) { // + fieldCode if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("__MmsBinaryEncodeDate: MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } @@ -2983,11 +2957,12 @@ static bool __MmsBinaryEncodeDate(FILE *pFile) gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_DATE) | 0x80; if (__MmsBinaryEncodeLongInteger(pFile, dateSec, length) == false) { - MSG_DEBUG("__MmsBinaryEncodeDate: date MmsBinaryEncodeLongInteger error\n"); + MSG_DEBUG("date MmsBinaryEncodeLongInteger error"); goto __CATCH; } + } else { - MSG_DEBUG("__MmsBinaryEncodeDate: date has a negative value (%d) \n", dateSec); + MSG_DEBUG("date has a negative value (%d)", dateSec); goto __CATCH; } return true; @@ -2999,14 +2974,14 @@ __CATCH: static bool __MmsBinaryEncodeFrom(FILE *pFile) { if (pFile == NULL) { - MSG_DEBUG("__MmsBinaryEncodeFrom: invalid input file \n"); + MSG_DEBUG("invalid input file"); goto __CATCH; } if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < 3) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("__MmsBinaryEncodeFrom: MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } @@ -3015,6 +2990,8 @@ static bool __MmsBinaryEncodeFrom(FILE *pFile) /* length of MMS_INSERT_ADDRESS_TOKEN value */ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = 0x01; gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeAddressType, MMS_INSERT_ADDRESS_TOKEN) | 0x80; + + MSG_SEC_INFO("From = [INSERT_ADDRESS_TOKEN]"); return true; __CATCH: @@ -3026,7 +3003,7 @@ static bool __MmsBinaryEncodeOneAddress(FILE *pFile, MmsFieldCode addrType, char int length = 0; if (pFile == NULL) { - MSG_DEBUG("__MmsBinaryEncodeOneAddress: invalid input file \n"); + MSG_DEBUG("invalid input file"); goto __CATCH; } @@ -3034,14 +3011,14 @@ static bool __MmsBinaryEncodeOneAddress(FILE *pFile, MmsFieldCode addrType, char length = __MmsBinaryEncodeEncodedStringLen((UINT8*)szAddrStr); if (length == -1) { - MSG_DEBUG("__MmsBinaryEncodeOneAddress: MmsBinaryEncodeEncodedStringLen fail \n"); + MSG_DEBUG("MmsBinaryEncodeEncodedStringLen fail"); goto __CATCH; } if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < length + 1) { if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("__MmsBinaryEncodeOneAddress: MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } @@ -3050,10 +3027,18 @@ static bool __MmsBinaryEncodeOneAddress(FILE *pFile, MmsFieldCode addrType, char if (__MmsBinaryEncodeEncodedString(pFile, (UINT8*)szAddrStr, length) == false) { - MSG_DEBUG("__MmsBinaryEncodeOneAddress: MmsBinaryEncodeEncodedString fail \n"); + MSG_DEBUG("MmsBinaryEncodeEncodedString fail"); goto __CATCH; } + if (addrType == MMS_CODE_TO ) + MSG_SEC_INFO("To = [%s]", szAddrStr); + else if (addrType == MMS_CODE_CC) + MSG_SEC_INFO("CC = [%s]", szAddrStr); + else if (addrType == MMS_CODE_BCC) + MSG_SEC_INFO("Bcc = [%s]", szAddrStr); + + return true; __CATCH: @@ -3066,7 +3051,7 @@ static bool __MmsBinaryEncodeAddress(FILE *pFile, MmsFieldCode addrType, char *s if (pFile == NULL) { - MSG_DEBUG("__MmsBinaryEncodeAddress: invalid input file \n"); + MSG_DEBUG("invalid input file"); goto __CATCH; } @@ -3080,7 +3065,7 @@ static bool __MmsBinaryEncodeAddress(FILE *pFile, MmsFieldCode addrType, char *s *pSingleAddr = MSG_CH_NULL; if (__MmsBinaryEncodeOneAddress(pFile, addrType, szAddr) == false) { - MSG_DEBUG("__MmsBinaryEncodeAddress: __MmsBinaryEncodeAddress fail\n"); + MSG_DEBUG("__MmsBinaryEncodeAddress fail"); goto __CATCH; } *pSingleAddr = MSG_CH_SEMICOLON; @@ -3089,7 +3074,7 @@ static bool __MmsBinaryEncodeAddress(FILE *pFile, MmsFieldCode addrType, char *s pSingleAddr = NULL; } else { if (__MmsBinaryEncodeOneAddress(pFile, addrType, szAddr) == false) { - MSG_DEBUG("__MmsBinaryEncodeAddress: __MmsBinaryEncodeAddress fail\n"); + MSG_DEBUG("__MmsBinaryEncodeAddress fail"); goto __CATCH; } @@ -3109,14 +3094,14 @@ static bool __MmsBinaryEncodeTime(FILE *pFile, MmsFieldCode fieldCode, MmsTimeSt int length = 0; if (pFile == NULL) { - MSG_DEBUG("__MmsBinaryEncodeTime: invalid input file \n"); + MSG_DEBUG("invalid input file"); goto __CATCH; } if (time.time == 0 || (fieldCode != MMS_CODE_EXPIRYTIME && fieldCode != MMS_CODE_DELIVERYTIME && fieldCode != MMS_CODE_REPLYCHARGINGDEADLINE) || (time.type != MMS_TIMETYPE_ABSOLUTE && time.type != MMS_TIMETYPE_RELATIVE)) { - MSG_DEBUG("__MmsBinaryEncodeTime: time.type = %d \n", time.type); + MSG_DEBUG("time.type = %d", time.type); return true; } @@ -3132,13 +3117,13 @@ static bool __MmsBinaryEncodeTime(FILE *pFile, MmsFieldCode fieldCode, MmsTimeSt } if (timeLen <= 0) { - MSG_DEBUG("__MmsBinaryEncodeTime: MmsBinaryEncodeLongIntegerLen fail \n"); + MSG_DEBUG("MmsBinaryEncodeLongIntegerLen fail"); goto __CATCH; } length = __MmsBinaryEncodeValueLengthLen(timeLen + 1); //time length + time type token if (length == -1) { - MSG_DEBUG("__MmsBinaryEncodeTime: MmsBinaryEncodeValueLengthLen fail \n"); + MSG_DEBUG("MmsBinaryEncodeValueLengthLen fail"); goto __CATCH; } @@ -3146,7 +3131,7 @@ static bool __MmsBinaryEncodeTime(FILE *pFile, MmsFieldCode fieldCode, MmsTimeSt if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { - MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: MsgWriteDataFromEncodeBuffer fail \n"); + MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); goto __CATCH; } } @@ -3156,7 +3141,7 @@ static bool __MmsBinaryEncodeTime(FILE *pFile, MmsFieldCode fieldCode, MmsTimeSt /* value length */ if (__MmsBinaryEncodeValueLength(pFile, timeLen + 1, length) == false) { - MSG_DEBUG("__MmsBinaryEncodeTime: MmsBinaryEncodeValueLength fail \n"); + MSG_DEBUG("MmsBinaryEncodeValueLength fail"); goto __CATCH; } @@ -3164,13 +3149,13 @@ static bool __MmsBinaryEncodeTime(FILE *pFile, MmsFieldCode fieldCode, MmsTimeSt if (time.type == MMS_TIMETYPE_RELATIVE) { gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeTimeType, MMS_TIMETYPE_RELATIVE) | 0x80; if (__MmsBinaryEncodeInteger(pFile, time.time, timeLen) == false) { - MSG_DEBUG("__MmsBinaryEncodeTime: MmsBinaryEncodeLongInteger fail \n"); + MSG_DEBUG("MmsBinaryEncodeLongInteger fail"); goto __CATCH; } } else { gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeTimeType, MMS_TIMETYPE_ABSOLUTE) | 0x80; if (__MmsBinaryEncodeLongInteger(pFile, time.time, timeLen) == false) { - MSG_DEBUG("__MmsBinaryEncodeTime: MmsBinaryEncodeLongInteger fail \n"); + MSG_DEBUG("MmsBinaryEncodeLongInteger fail"); goto __CATCH; } } @@ -3180,3 +3165,109 @@ static bool __MmsBinaryEncodeTime(FILE *pFile, MmsFieldCode fieldCode, MmsTimeSt __CATCH: return false; } + +char *_MsgSkipWS3(char *s) +{ + while (true) { + if ((*s == MSG_CH_CR) || + (*s == MSG_CH_LF) || + (*s == MSG_CH_SP) || + (*s == MSG_CH_TAB)) + ++s; + else + return s; + } +} +////////////////////////////////////////////////////////////////////////////// +static bool __EncodeMmsMessage(MmsMsg *pMmsMsg, const char *raw_filepath) +{ + bool encode_ret = false; + mode_t file_mode = (S_IRUSR | S_IWUSR); + + if (pMmsMsg == NULL || raw_filepath == NULL) { + MSG_DEBUG("Invalid Parameter pMmsMsg = %p , raw_filepath = %p", pMmsMsg, raw_filepath); + return false; + } + + FILE *pFile = MsgOpenFile(raw_filepath, "wb+"); + + if (pFile == NULL) { + MSG_FATAL("File Open Error: %s", strerror(errno)); + goto __CATCH; + } + + if (MsgFseek(pFile, 0L, SEEK_CUR) < 0) { + MSG_DEBUG("File Fseek Error: %s", strerror(errno)); + goto __CATCH; + } + + if (fchmod(fileno(pFile), file_mode) < 0) { + MSG_DEBUG("File chmod Error: %s", strerror(errno)); + goto __CATCH; + } + + switch(pMmsMsg->mmsAttrib.msgType) + { + case MMS_MSGTYPE_SEND_REQ: + case MMS_MSGTYPE_SEND_CONF: + encode_ret = MmsEncodeSendReq(pFile, pMmsMsg); + if (encode_ret == false) { + MSG_DEBUG("Fail to MmsEncodeSendReq"); + goto __CATCH; + } + break; + default: + MSG_DEBUG("Not Support msg type : %d", pMmsMsg->mmsAttrib.msgType); + goto __CATCH; + break; + } + + MsgFsync(pFile); //file is written to device immediately, it prevents missing file data from unexpected power off + MsgCloseFile(pFile); + + return true; + +__CATCH: + if (pFile) { + MsgCloseFile(pFile); + } + + return false; +} + +MmsPluginEncoder *MmsPluginEncoder::pInstance = NULL; + +MmsPluginEncoder *MmsPluginEncoder::instance() +{ + if (!MmsPluginEncoder::pInstance) + MmsPluginEncoder::pInstance = new MmsPluginEncoder(); + + return MmsPluginEncoder::pInstance; +} + +MmsPluginEncoder::MmsPluginEncoder(){} +MmsPluginEncoder::~MmsPluginEncoder(){} + +void MmsPluginEncoder::encodeMmsPdu(MMS_DATA_S *pMmsData, msg_message_id_t msgID, const char *pduFilePath) +{ + MmsMsg *pMmsMsg = (MmsMsg *)calloc(1, sizeof(MmsMsg)); + + if (MmsConvertMmsMsg(pMmsMsg, pMmsData) != true) { + MSG_DEBUG("Fail to Compose MMS Message"); + goto __CATCH; + } + + encodeMmsPdu(pMmsMsg, msgID, pduFilePath); + +__CATCH: + MmsReleaseMmsMsg(pMmsMsg); + MSG_FREE(pMmsMsg); + +} + +void MmsPluginEncoder::encodeMmsPdu(MmsMsg *pMmsMsg, msg_message_id_t msgID, const char *pduFilePath) +{ + pMmsMsg->msgID = msgID; + + __EncodeMmsMessage(pMmsMsg, pduFilePath); +} diff --git a/plugin/mms_plugin/MmsPluginEventHandler.cpp b/plugin/mms_plugin/MmsPluginEventHandler.cpp index 74b2aa5..15c4490 100755 --- a/plugin/mms_plugin/MmsPluginEventHandler.cpp +++ b/plugin/mms_plugin/MmsPluginEventHandler.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include @@ -23,7 +23,7 @@ #include "MmsPluginInternal.h" /*================================================================================================== - IMPLEMENTATION OF SmsPluginEventHandler - Member Functions + IMPLEMENTATION OF MmsPluginEventHandler - Member Functions ==================================================================================================*/ MmsPluginEventHandler *MmsPluginEventHandler::pInstance = NULL; @@ -75,6 +75,10 @@ void MmsPluginEventHandler::handleMmsReceivedData(mmsTranQEntity *pRequest, char // received data is retrieve-conf case eMMS_RETRIEVE_AUTO_CONF: case eMMS_RETRIEVE_MANUAL_CONF: + MSG_ADDRESS_INFO_S addrInfo; + memset(&addrInfo, 0x00, sizeof(MSG_ADDRESS_INFO_S)); + msgInfo.addressList = &addrInfo; + MmsPluginInternal::instance()->processRetrieveConf(&msgInfo, pRequest, pRetrievedFilePath); // callback to MSG FW @@ -106,6 +110,11 @@ void MmsPluginEventHandler::handleMmsError(mmsTranQEntity *pRequest) MSG_DEBUG("pRequest->msgId [%d]", pRequest->msgId); + time_t curTime; + curTime = time(NULL); + + msgInfo.displayTime = curTime; + switch (pRequest->eMmsPduType) { case eMMS_SEND_REQ: case eMMS_SEND_CONF: @@ -157,6 +166,8 @@ void MmsPluginEventHandler::handleMmsError(mmsTranQEntity *pRequest) break; } + MSG_DEBUG("Error value of MsgMmsConfIncomingListner [%d]", err); + MSG_END(); } diff --git a/plugin/mms_plugin/MmsPluginHttp.cpp b/plugin/mms_plugin/MmsPluginHttp.cpp index 5d5a4f9..9e382bb 100755 --- a/plugin/mms_plugin/MmsPluginHttp.cpp +++ b/plugin/mms_plugin/MmsPluginHttp.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include @@ -21,13 +21,8 @@ #include "MmsPluginHttp.h" #include "MmsPluginUserAgent.h" #include "MmsPluginConnManWrapper.h" - -#define MMS_FREE(obj)\ - if (obj){\ - free(obj);\ - obj = NULL;\ - } - +#include "MsgGconfWrapper.h" +#include "MmsPluginUtil.h" static void __http_print_profile(CURL *curl); static int __http_debug_cb (CURL *input_curl, curl_infotype input_info_type, char *input_data , size_t input_size, void *input_void); @@ -39,15 +34,15 @@ static void __httpGetHost(char *szUrl, char *szHost, int nBufferLen); /*================================================================================================== FUNCTION IMPLEMENTATION ==================================================================================================*/ -static int __http_progress_cb(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) -{ - MSG_DEBUG("download(%.0f/%.0f) : upload(%.0f/%.0f)", dlnow, dltotal, ulnow, ultotal); - return 0; -} +//static int __http_progress_cb(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) +//{ +// MSG_INFO("download(%.0f/%.0f) : upload(%.0f/%.0f)", dlnow, dltotal, ulnow, ultotal); +// return 0; +//} static int __http_debug_cb (CURL *input_curl, curl_infotype input_info_type, char *input_data , size_t input_size, void *input_void) { - MSG_DEBUG("curl_infotype [%d] : %s", input_info_type, input_data); + MSG_INFO("curl_infotype [%d] : %s", input_info_type, input_data); return 0; } @@ -75,54 +70,54 @@ static void __http_print_profile(CURL *curl) //time curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &total_time); - MSG_DEBUG("profile http Time: total %.3f seconds", total_time); + MSG_SEC_INFO("profile http Time: total %.3f seconds", total_time); //url curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url); - MSG_DEBUG("profile http Url: %s", url); + MSG_SEC_INFO("profile http Url: %s", url); //size curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD, &size_up); - MSG_DEBUG("profile http Size: upload %.3f bytes", size_up); + MSG_SEC_INFO("profile http Size: upload %.3f bytes", size_up); curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &size_down); - MSG_DEBUG("profile http Size: download %.3f bytes", size_down); + MSG_SEC_INFO("profile http Size: download %.3f bytes", size_down); curl_easy_getinfo(curl, CURLINFO_HEADER_SIZE, &size); - MSG_DEBUG("profile http Size: header %ld bytes", size); + MSG_SEC_INFO("profile http Size: header %ld bytes", size); curl_easy_getinfo(curl, CURLINFO_REQUEST_SIZE, &size); - MSG_DEBUG("profile http Size: request %ld bytes", size); + MSG_SEC_INFO("profile http Size: request %ld bytes", size); //speed curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &speed_upload); - MSG_DEBUG("profile http Speed: upload %.3f bytes/sec", speed_upload); + MSG_SEC_INFO("profile http Speed: upload %.3f bytes/sec", speed_upload); curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD, &speed_download); - MSG_DEBUG("profile http Speed: download %.3f bytes/sec", speed_download); + MSG_SEC_INFO("profile http Speed: download %.3f bytes/sec", speed_download); //content curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &content_type); - MSG_DEBUG("profile http Content: type %s", content_type); + MSG_SEC_INFO("profile http Content: type %s", content_type); curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &content_length); - MSG_DEBUG("profile http Content: length download %.3f", content_length); + MSG_SEC_INFO("profile http Content: length download %.3f", content_length); curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_UPLOAD, &content_length); - MSG_DEBUG("profile http Content: length upload %.3f", content_length); + MSG_SEC_INFO("profile http Content: length upload %.3f", content_length); //ip & port curl_easy_getinfo(curl, CURLINFO_PRIMARY_IP, &ip); - MSG_DEBUG("profile http primary: ip %s", ip); + MSG_SEC_INFO("profile http primary: ip %s", ip); curl_easy_getinfo(curl, CURLINFO_PRIMARY_PORT, &port); - MSG_DEBUG("profile http primary: port %ld", port); + MSG_SEC_INFO("profile http primary: port %ld", port); curl_easy_getinfo(curl, CURLINFO_LOCAL_IP, &ip); - MSG_DEBUG("profile http local: ip %s", ip); + MSG_SEC_INFO("profile http local: ip %s", ip); curl_easy_getinfo(curl, CURLINFO_LOCAL_PORT, &port); - MSG_DEBUG("profile http local: port %ld", port); + MSG_SEC_INFO("profile http local: port %ld", port); MSG_DEBUG("**************************************************************************************************"); } @@ -135,7 +130,7 @@ static void __httpAllocHeaderInfo(curl_slist **responseHeaders, char *szUrl, int bool nResult = __httpGetHeaderField(MMS_HH_CONTENT_TYPE, szBuffer); if (nResult) { snprintf(pcheader, HTTP_REQUEST_LEN, "Content-Type: %s", szBuffer); - MSG_DEBUG("%s", pcheader); + MSG_INFO("%s", pcheader); *responseHeaders = curl_slist_append(*responseHeaders, pcheader); } @@ -145,7 +140,7 @@ static void __httpAllocHeaderInfo(curl_slist **responseHeaders, char *szUrl, int snprintf(szBuffer, 1024, "%d", ulContentLen); if (nResult) { snprintf(pcheader, HTTP_REQUEST_LEN, "Content-Length: %s", szBuffer); - MSG_DEBUG("%s", pcheader); + MSG_INFO("%s", pcheader); *responseHeaders = curl_slist_append(*responseHeaders, pcheader); } } @@ -156,7 +151,7 @@ static void __httpAllocHeaderInfo(curl_slist **responseHeaders, char *szUrl, int __httpGetHost(szUrl, szBuffer, 1024); if (strlen(szBuffer)){ snprintf(pcheader, HTTP_REQUEST_LEN, "Host: %s", szBuffer); - MSG_DEBUG("%s", pcheader); + MSG_INFO("%s", pcheader); *responseHeaders = curl_slist_append(*responseHeaders, pcheader); } @@ -165,7 +160,7 @@ static void __httpAllocHeaderInfo(curl_slist **responseHeaders, char *szUrl, int nResult = __httpGetHeaderField(MMS_HH_ACCEPT, szBuffer); if (nResult) { snprintf(pcheader, HTTP_REQUEST_LEN, "Accept: %s", szBuffer); - MSG_DEBUG("%s", pcheader); + MSG_INFO("%s", pcheader); *responseHeaders = curl_slist_append(*responseHeaders, pcheader); } @@ -174,7 +169,7 @@ static void __httpAllocHeaderInfo(curl_slist **responseHeaders, char *szUrl, int nResult = __httpGetHeaderField(MMS_HH_ACCEPT_CHARSET, szBuffer); if (nResult) { snprintf(pcheader, HTTP_REQUEST_LEN, "Accept-Charset: %s", szBuffer); - MSG_DEBUG("%s", pcheader); + MSG_INFO("%s", pcheader); *responseHeaders = curl_slist_append(*responseHeaders, pcheader); } @@ -183,7 +178,7 @@ static void __httpAllocHeaderInfo(curl_slist **responseHeaders, char *szUrl, int nResult = __httpGetHeaderField(MMS_HH_ACCEPT_LANGUAGE, szBuffer); if (nResult) { snprintf(pcheader, HTTP_REQUEST_LEN, "Accept-Language: %s", szBuffer); - MSG_DEBUG("%s", pcheader); + MSG_INFO("%s", pcheader); *responseHeaders = curl_slist_append(*responseHeaders, pcheader); } /* NOW not support gzip, deflate encoding in MMS Plugin @@ -201,16 +196,16 @@ static void __httpAllocHeaderInfo(curl_slist **responseHeaders, char *szUrl, int nResult = __httpGetHeaderField(MMS_HH_USER_AGENT, szBuffer); if (nResult) { snprintf(pcheader, HTTP_REQUEST_LEN, "User-Agent: %s", szBuffer); - MSG_DEBUG("%s", pcheader); + MSG_INFO("%s", pcheader); *responseHeaders = curl_slist_append(*responseHeaders, pcheader); } memset(szBuffer, 0, 1025); memset(pcheader, 0, HTTP_REQUEST_LEN); - nResult = __httpGetHeaderField(MMS_HH_WAP_PROFILE, szBuffer); + nResult = __httpGetHeaderField(MMS_HH_UA_PROFILE, szBuffer); if (nResult) { snprintf(pcheader, HTTP_REQUEST_LEN, "X-wap-profile: %s", szBuffer); - MSG_DEBUG("%s", pcheader); + MSG_INFO("%s", pcheader); *responseHeaders = curl_slist_append(*responseHeaders, pcheader); } @@ -253,29 +248,38 @@ static bool __httpGetHeaderField(MMS_HTTP_HEADER_FIELD_T httpHeaderItem, char *s case MMS_HH_USER_AGENT: { char szUserAgent[1024 + 1]; - - memset(szUserAgent, 0x00, sizeof(szUserAgent)); - snprintf(szUserAgent, 1024, "%s", MSG_MMS_HH_USER_AGENT); + char *uagent = NULL; + + uagent = MsgSettingGetString(VCONFKEY_BROWSER_USER_AGENT); + if (uagent) { + MSG_SEC_INFO("Get UserAgent : %s = %s", VCONFKEY_BROWSER_USER_AGENT, uagent); + memset(szUserAgent, 0x00, sizeof(szUserAgent)); + MmsRemoveMarkup(uagent, szUserAgent, sizeof(szUserAgent)); + free(uagent); + uagent = NULL; + } else { + memset(szUserAgent, 0x00, sizeof(szUserAgent)); + MSG_SEC_INFO("Get Default UserAgent : %s", MSG_MMS_HH_USER_AGENT); + snprintf(szUserAgent, 1024, "%s", MSG_MMS_HH_USER_AGENT); + } snprintf((char *)szHeaderBuffer, 1024, "%s", szUserAgent); result = true; } break; - case MMS_HH_WAP_PROFILE: + case MMS_HH_UA_PROFILE: { - char szUAProfile[1024 + 1] = {0,}; - - memset(szUAProfile, 0x00, (sizeof(char)*(1024+1) )); - snprintf(szUAProfile, 1024, "%s", MSG_MMS_WAP_PROFILE); + char *szUAProfile = MsgSettingGetString(MSG_MMS_UA_PROFILE); snprintf((char *)szHeaderBuffer, 1024, "%s", szUAProfile); + free(szUAProfile); result = true; } break; default: - MSG_DEBUG("invalid param"); + MSG_WARN("invalid param [%d]", httpHeaderItem); break; } } @@ -337,7 +341,7 @@ static int __http_multi_perform(void *session) int still_running; int ret = 0; - bool abort_flag = false; + bool connection_open_flag = false; CURLMsg *msg; int msgs_left; @@ -345,14 +349,14 @@ static int __http_multi_perform(void *session) multi_handle = curl_multi_init(); if (curl_multi_add_handle(multi_handle, session) != 0) { - MSG_DEBUG("curl_multi_add_handle is failed"); + MSG_ERR("curl_multi_add_handle is failed"); curl_multi_cleanup(multi_handle); return -1; } /* we start some action by calling perform right away */ rcm = curl_multi_perform(multi_handle, &still_running); - MSG_DEBUG("curl_multi_perform first end : rcm = %d, still_running = %d", rcm, still_running); + MSG_INFO("curl_multi_perform first end : rcm = %d, still_running = %d", rcm, still_running); do { struct timeval timeout; @@ -363,25 +367,25 @@ static int __http_multi_perform(void *session) fd_set fdexcep; int maxfd = -1; - long curl_timeo = -1; +// long curl_timeo = -1; FD_ZERO(&fdread); FD_ZERO(&fdwrite); FD_ZERO(&fdexcep); /* set a suitable timeout to play around with */ - timeout.tv_sec = 10; + timeout.tv_sec = 120; timeout.tv_usec = 0; - curl_multi_timeout(multi_handle, &curl_timeo); - if(curl_timeo >= 0) { - MSG_DEBUG("curl_timeo = %ld", curl_timeo); - timeout.tv_sec = curl_timeo / 1000; - if(timeout.tv_sec > 1) - timeout.tv_sec = 1; - else - timeout.tv_usec = (curl_timeo % 1000) * 1000; - } +// curl_multi_timeout(multi_handle, &curl_timeo); +// if(curl_timeo >= 0) { +// MSG_DEBUG("curl_timeo = %ld", curl_timeo); +// timeout.tv_sec = curl_timeo / 1000; +// if(timeout.tv_sec > 1) +// timeout.tv_sec = 1; +// else +// timeout.tv_usec = (curl_timeo % 1000) * 1000; +// } curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); @@ -393,35 +397,41 @@ static int __http_multi_perform(void *session) rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); - switch(rc) { - case -1: - /* select error */ - MSG_DEBUG("select error"); + if (rc == -1){/* select error */ + MSG_ERR("select error"); + ret = -1; break; - case 0: /* timeout */ - default: /* action */ - rcm = curl_multi_perform(multi_handle, &still_running); + } else if (rc == 0){ /* timeout */ + MSG_ERR("time out"); + ret = -1; break; + } else {/* action */ + MSG_DEBUG("rc = %d", rc); + rcm = curl_multi_perform(multi_handle, &still_running); } - abort_flag = MmsPluginHttpAgent::instance()->getAbortFlag(); - if (abort_flag == true) { - MSG_DEBUG("abort flag is Set"); + connection_open_flag = MmsPluginCmAgent::instance()->getCmStatus(); + if (connection_open_flag == false) { + MSG_DEBUG("Connection Closed"); ret = -1; } - MSG_DEBUG("curl_multi_perform end : rcm = %d, still_running = %d, abort_flag = %d", rcm, still_running, abort_flag); + MSG_INFO("curl_multi_perform end : rcm = %d, still_running = %d, cm_open = %d", rcm, still_running, connection_open_flag); - } while(still_running && (abort_flag == false)); + } while(still_running && (connection_open_flag == true)); while ((msg = curl_multi_info_read(multi_handle, &msgs_left))) { if (msg->msg == CURLMSG_DONE) { if (msg->easy_handle == session) { - MSG_DEBUG("HTTP transfer completed with status %d", msg->data.result); + MSG_INFO("HTTP transfer completed with status %d", msg->data.result); + if (msg->data.result != 0) { + ret = msg->data.result; + } + curl_multi_remove_handle(multi_handle, session); } else { - MSG_DEBUG("Unknown handle HTTP transfer completed with status %d", msg->data.result); + MSG_WARN("Unknown handle HTTP transfer completed with status %d", msg->data.result); } } } @@ -543,6 +553,7 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::setSession(http_request_info_s &request_inf && request_info.transaction_type != MMS_HTTP_TRANSACTION_TYPE_POST) { MSG_ERR("transaction_type of request_info is Invaild [%d]", request_info.transaction_type); + http_error = MMS_HTTP_ERROR_TRANSACTION_TYPE; goto __CATCH; } @@ -550,12 +561,14 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::setSession(http_request_info_s &request_inf if (request_info.post_data == NULL || request_info.post_data_len == 0) { MSG_ERR("post data info is Invaild"); + http_error = MMS_HTTP_ERROR_SESSION; goto __CATCH; } } if (request_info.url == NULL || request_info.proxy == NULL || request_info.interface == NULL) { MSG_ERR("request_info parameter invalid url [%s], proxy [%s] interface [%s]", request_info.url, request_info.proxy, request_info.interface); + http_error = MMS_HTTP_ERROR_SESSION; goto __CATCH; } @@ -570,12 +583,13 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::setSession(http_request_info_s &request_inf content_len = 0; } - url = strdup(request_info.url); + url = g_strdup(request_info.url); if (url) { __httpAllocHeaderInfo((curl_slist**)&session_header, url, content_len); if (session_header == NULL) { - MSG_ERR("Failed to __httpAllocHeaderInfo"); + MSG_ERR("Failed to httpAllocHeaderInfo"); + http_error = MMS_HTTP_ERROR_SESSION; goto __CATCH; } @@ -590,7 +604,8 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::setSession(http_request_info_s &request_inf //Set curl option session_option = curl_easy_init(); if (session_option == NULL) { - MSG_DEBUG("curl_easy_init() failed"); + MSG_ERR("curl_easy_init() failed"); + http_error = MMS_HTTP_ERROR_SESSION; goto __CATCH; } @@ -619,7 +634,11 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::setSession(http_request_info_s &request_inf return http_error; __CATCH: - + //CID 338211: freeing url (with check) in case of error + if(url) { + free(url); + url = NULL; + } clearSession(); MSG_END(); @@ -636,7 +655,7 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::startTransaction() __http_print_profile(session_option); if (rc != 0) { - MSG_DEBUG("curl_easy_perform return error rc [%d]", rc); + MSG_ERR("curl_easy_perform return error rc [%d]", rc); http_error = MMS_HTTP_ERROR_TRANSACTION; } @@ -659,14 +678,14 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::httpRequest(http_request_info_s &request_in //set session http_error = this->setSession(request_info); if (http_error != MMS_HTTP_ERROR_NONE) { - MSG_DEBUG("Fail to setSession"); + MSG_ERR("Fail to setSession"); goto __CATCH; } //transaction http_error = this->startTransaction(); if (http_error != MMS_HTTP_ERROR_NONE) { - MSG_DEBUG("Fail to startTransaction"); + MSG_ERR("Fail to startTransaction"); goto __CATCH; } @@ -677,7 +696,7 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::httpRequest(http_request_info_s &request_in respfile = NULL; if (g_file_get_contents(conf_filename, &request_info.response_data, &request_info.response_data_len, NULL) == false) { - MSG_DEBUG("Fail to g_file_get_contents"); + MSG_WARN("Fail to g_file_get_contents"); } } diff --git a/plugin/mms_plugin/MmsPluginInternal.cpp b/plugin/mms_plugin/MmsPluginInternal.cpp index cb1c262..c81a571 100755 --- a/plugin/mms_plugin/MmsPluginInternal.cpp +++ b/plugin/mms_plugin/MmsPluginInternal.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include @@ -24,12 +24,16 @@ #include "MsgMmsMessage.h" #include "MsgGconfWrapper.h" #include "MsgStorageHandler.h" +#include "MsgSerialize.h" +#include "MsgSpamFilter.h" #include "MmsPluginDebug.h" #include "MmsPluginTypes.h" #include "MmsPluginCodec.h" #include "MmsPluginInternal.h" #include "MmsPluginStorage.h" -#include "MmsPluginSmil.h" +#include "MmsPluginAppBase.h" +#include "MmsPluginMIME.h" + /*================================================================================================== IMPLEMENTATION OF MmsPluginInternal - Member Functions ==================================================================================================*/ @@ -67,19 +71,19 @@ void MmsPluginInternal::processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQ if(MsgCreateFileName(fileName) == false) THROW(MsgException::FILE_ERROR, "MsgCreateFileName error"); - MSG_DEBUG("File name = %s", fileName); + MSG_SEC_DEBUG("File name = %s", fileName); if(MsgWriteIpcFile(fileName, pMsgInfo->msgText, pMsgInfo->dataSize) == false) THROW(MsgException::FILE_ERROR, "MsgWriteIpcFile error"); - snprintf(fullPath, MAX_FULL_PATH_SIZE+1, MSG_IPC_DATA_PATH"%s", fileName); + snprintf(fullPath, MAX_FULL_PATH_SIZE+1, "%s%s", MSG_IPC_DATA_PATH, fileName); memset(pMsgInfo->msgData, 0x00, sizeof(pMsgInfo->msgData)); memcpy(pMsgInfo->msgData, fullPath, strlen(fullPath)); pMsgInfo->bTextSms = false; } - MSG_DEBUG("MMS File Path = %s", pMsgInfo->msgData); + MSG_SEC_DEBUG("MMS File Path = %s", pMsgInfo->msgData); MmsInitHeader(); MmsRegisterDecodeBuffer(); @@ -91,7 +95,9 @@ void MmsPluginInternal::processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQ if (!MmsBinaryDecodeMsgHeader(pFile, pMsgInfo->dataSize)) MSG_DEBUG("Decoding Header Failed \r\n"); - MsgDeleteFile(pMsgInfo->msgData + strlen(MSG_IPC_DATA_PATH)); + MsgCloseFile(pFile); + + remove(pMsgInfo->msgData); switch (mmsHeader.type) { case MMS_MSGTYPE_NOTIFICATION_IND: @@ -116,8 +122,6 @@ void MmsPluginInternal::processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQ default: break; } - - MsgCloseFile(pFile); } MSG_END(); @@ -126,12 +130,12 @@ void MmsPluginInternal::processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST_INFO_S *pRequest) { MSG_DEBUG("MmsProcessNotiInd"); - msg_error_t err = MSG_SUCCESS; MSG_MMS_HOME_RETRIEVE_TYPE_T retrieveType; bool bReportAllowed; MmsAttrib attrib; + MsgDbHandler *dbHandle = getDbHandle(); MmsInitMsgAttrib(&attrib); @@ -147,32 +151,129 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST attrib.expiryTime = mmsHeader.expiryTime; - MmsPluginStorage *pStorage = MmsPluginStorage::instance(); - err = pStorage->updateMmsAttrib(pMsgInfo->msgId, &attrib, pMsgInfo->msgType.subType); - if (mmsHeader.pFrom) { MmsAddrUtilRemovePlmnString(mmsHeader.pFrom->szAddr); // From strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pFrom->szAddr, MAX_ADDRESS_VAL_LEN); + if (MmsAddrUtilCheckEmailAddress(pMsgInfo->addressList[0].addressVal)) { + pMsgInfo->addressList[0].addressType = MSG_ADDRESS_TYPE_EMAIL; + } + } + + MMS_DATA_S *mms_data = MsgMmsCreate(); + { + mms_data->header = MsgMmsCreateHeader(); + + MMS_HEADER_DATA_S *pHeader = mms_data->header; + + pHeader->messageType = mmsHeader.type; + + snprintf(pHeader->trID, sizeof(pHeader->trID), "%s", mmsHeader.szTrID); + + pHeader->mmsVersion = mmsHeader.version; + + //From + if (mmsHeader.pFrom) { + MmsAddrUtilRemovePlmnString(mmsHeader.pFrom->szAddr); + snprintf(pHeader->szFrom, sizeof(pHeader->szFrom), "%s", mmsHeader.pFrom->szAddr); + } + + //Subject + snprintf(pHeader->szSubject, sizeof(pHeader->szSubject), "%s", mmsHeader.szSubject); + //Delivery Report + pHeader->bDeliveryReport = mmsHeader.deliveryReport; + //Message Class + pHeader->messageClass = mmsHeader.msgClass; + + //Priority + pHeader->mmsPriority = mmsHeader.priority; + + //Message Size : pMmsMsg->mmsAttrib.msgSize = mmsHeader.msgSize; + //Expiry + pHeader->expiry.type = mmsHeader.expiryTime.type; + pHeader->expiry.time = mmsHeader.expiryTime.time; + + time_t curTime = time(NULL); + + if (pHeader->expiry.type == MMS_TIMETYPE_RELATIVE) { + pHeader->expiry.type = MMS_TIMETYPE_ABSOLUTE; + pHeader->expiry.time += curTime; + } + + //Charge + //contentclass + //int contentClass;//text | image-basic| image-rich | video-basic | video-rich | megapixel | content-basic | content-rich + strncpy(pHeader->contentLocation, mmsHeader.szContentLocation, MMS_LOCATION_LEN); + + pHeader->messageSize = mmsHeader.msgSize; + + MSG_DEBUG("Message size = [%d]", pHeader->messageSize); + + char *pSerializedMms = NULL; + int serializeDataSize = 0; + + char pTempFileName[MSG_FILENAME_LEN_MAX+1] = {0}; + char pTempFilePath[MSG_FILEPATH_LEN_MAX+1] = {0}; + + serializeDataSize = MsgSerializeMms(mms_data, &pSerializedMms); + + if (pSerializedMms) { + if (MsgCreateFileName(pTempFileName) == true) { + pMsgInfo->bTextSms = false; + + snprintf(pTempFilePath, sizeof(pTempFilePath), MSG_IPC_DATA_PATH"%s", pTempFileName); + + MsgOpenCreateAndOverwriteFile(pTempFilePath, pSerializedMms, serializeDataSize); + + //set file name + snprintf(pMsgInfo->msgData, sizeof(pMsgInfo->msgData), "%s", pTempFileName); + } + + free(pSerializedMms); + } + } + MsgMmsRelease(&mms_data); + + // Check contents-location is in noti.ind + if (mmsHeader.szContentLocation[0] == '\0') { + THROW(MsgException::INCOMING_MSG_ERROR, "######## Contents-location is empty in MMS-Noti-Ind #######"); + return false; } int roamState = 0; + char pPduFilePath[MAX_FULL_PATH_SIZE] = {0}; roamState = MsgSettingGetInt(VCONFKEY_TELEPHONY_SVC_ROAM); MsgSettingGetBool(MMS_SEND_REPORT_ALLOWED, &bReportAllowed); - if (checkRejectNotiInd(roamState, bReportAllowed, pMsgInfo->msgData)) { + if (checkRejectNotiInd(roamState, bReportAllowed, pPduFilePath)) { MSG_DEBUG("MMS Message Rejected......"); - pMsgInfo->dataSize = strlen(pMsgInfo->msgData); - pMsgInfo->bTextSms = true; + pMsgInfo->dataSize = strlen(pPduFilePath); memcpy(&pRequest->msgInfo, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S)); - + snprintf(pRequest->msgInfo.msgData, sizeof(pRequest->msgInfo.msgData), "%s", pPduFilePath); pRequest->msgInfo.msgType.subType = MSG_NOTIFYRESPIND_MMS; return false; } + if (MsgCheckFilter(dbHandle, pMsgInfo)){ + encodeNotifyRespInd(mmsHeader.szTrID, MSG_DELIVERY_REPORT_DEFERRED, bReportAllowed, pPduFilePath); + + pMsgInfo->dataSize = strlen(pPduFilePath); + + pRequest->msgInfo.bTextSms = false; + + memcpy(&pRequest->msgInfo, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S)); + + snprintf(pRequest->msgInfo.msgData, sizeof(pRequest->msgInfo.msgData), "%s", pPduFilePath); + MSG_DEBUG("pRequest->msgInfo.msgData = %s", pRequest->msgInfo.msgData); + pRequest->msgInfo.msgType.subType = MSG_NOTIFYRESPIND_MMS; + pRequest->msgInfo.folderId = MSG_SPAMBOX_ID; + + return true; + } + if (roamState == VCONFKEY_TELEPHONY_SVC_ROAM_OFF) { retrieveType = (MSG_MMS_HOME_RETRIEVE_TYPE_T)MsgSettingGetInt(MMS_RECV_HOME_NETWORK); MSG_DEBUG("$$$$$$$$$$ MMS_RECV_HOME_NETWORK = %d $$$$$$$$$$$$$", retrieveType); @@ -183,14 +284,16 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST if (retrieveType == MSG_ABROAD_RESTRICTED) { MSG_DEBUG("MMS Receiving Setting Restricted was selected."); // m-notify-resp-ind encoding process - memset(pMsgInfo->msgData, 0, MAX_MSG_DATA_LEN + 1); + encodeNotifyRespInd(mmsHeader.szTrID, MSG_DELIVERY_REPORT_DEFERRED, bReportAllowed, pPduFilePath); + + pMsgInfo->dataSize = strlen(pPduFilePath); - encodeNotifyRespInd(mmsHeader.szTrID, MSG_DELIVERY_REPORT_DEFERRED, bReportAllowed, pMsgInfo->msgData); + pRequest->msgInfo.bTextSms = false; - pMsgInfo->dataSize = strlen(pMsgInfo->msgData); - pMsgInfo->bTextSms = true; memcpy(&pRequest->msgInfo, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S)); + snprintf(pRequest->msgInfo.msgData, sizeof(pRequest->msgInfo.msgData), "%s", pPduFilePath); + pRequest->msgInfo.msgType.subType = MSG_NOTIFYRESPIND_MMS; return true; @@ -199,34 +302,57 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST // should send http 'GET' if (retrieveType == MSG_HOME_AUTO_DOWNLOAD || retrieveType == MSG_ABROAD_AUTO_DOWNLOAD) { - MSG_DEBUG("=========== START AUTO RETRIEVE MODE ============"); - memset(pMsgInfo->msgData, 0, MAX_MSG_DATA_LEN + 1); + //Check if current request sim index is different from default network SIM + //Convert auto-retrieve to manual retrieve in case sim indexes are different + int default_sim = 0; + default_sim = MsgSettingGetInt(MSG_NETWORK_SIM); - memcpy(pMsgInfo->msgData, mmsHeader.szContentLocation, strlen(mmsHeader.szContentLocation)) ; + MSG_DEBUG("default_sim = %d, pMsgInfo->sim_idx = %d", default_sim, pMsgInfo->sim_idx); - pMsgInfo->dataSize = strlen(pMsgInfo->msgData); + if (default_sim == (int)pMsgInfo->sim_idx) { + MSG_DEBUG("=========== START AUTO RETRIEVE MODE ============"); - pMsgInfo->bTextSms = true; + pMsgInfo->dataSize = strlen(mmsHeader.szContentLocation); - memcpy(&pRequest->msgInfo, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S)); + pRequest->msgInfo.bTextSms = true; + + memcpy(&pRequest->msgInfo, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S)); + + snprintf(pRequest->msgInfo.msgData, sizeof(pRequest->msgInfo.msgData), "%s", mmsHeader.szContentLocation); + + pRequest->msgInfo.msgType.subType = MSG_GET_MMS; - pRequest->msgInfo.msgType.subType = MSG_GET_MMS; + MSG_DEBUG("MSG SUBTYPE = %d msg data %s bTextsms %d", pRequest->msgInfo.msgType.subType, pRequest->msgInfo.msgData, pRequest->msgInfo.bTextSms); + } else { + encodeNotifyRespInd(mmsHeader.szTrID, MSG_DELIVERY_REPORT_DEFERRED, bReportAllowed, pPduFilePath); - MSG_DEBUG("MSG SUBTYPE = %d msg data %s bTextsms %d", pRequest->msgInfo.msgType.subType, pRequest->msgInfo.msgData, pRequest->msgInfo.bTextSms); + pMsgInfo->dataSize = strlen(pPduFilePath); + + pRequest->msgInfo.bTextSms = false; + + memcpy(&pRequest->msgInfo, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S)); + + snprintf(pRequest->msgInfo.msgData, sizeof(pRequest->msgInfo.msgData), "%s", pPduFilePath); + MSG_DEBUG("pRequest->msgInfo.msgData = %s", pRequest->msgInfo.msgData); + pRequest->msgInfo.msgType.subType = MSG_NOTIFYRESPIND_MMS; + } } else { - // should send m-notify-resp-ind + // should send m-notify-resp-ind MSG_DEBUG("=========== START MANUAL RETRIEVE MODE ==========="); // m-notify-resp-ind encoding process - memset(pMsgInfo->msgData, 0, MAX_MSG_DATA_LEN + 1); if (retrieveType == MSG_HOME_MANUAL || retrieveType == MSG_ABROAD_MANUAL) { - encodeNotifyRespInd(mmsHeader.szTrID, MSG_DELIVERY_REPORT_DEFERRED, bReportAllowed, pMsgInfo->msgData); + encodeNotifyRespInd(mmsHeader.szTrID, MSG_DELIVERY_REPORT_DEFERRED, bReportAllowed, pPduFilePath); } - pMsgInfo->dataSize = strlen(pMsgInfo->msgData); - pMsgInfo->bTextSms = true; + pMsgInfo->dataSize = strlen(pPduFilePath); + + pRequest->msgInfo.bTextSms = false; + memcpy(&pRequest->msgInfo, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S)); + snprintf(pRequest->msgInfo.msgData, sizeof(pRequest->msgInfo.msgData), "%s", pPduFilePath); + MSG_DEBUG("pRequest->msgInfo.msgData = %s", pRequest->msgInfo.msgData); pRequest->msgInfo.msgType.subType = MSG_NOTIFYRESPIND_MMS; } @@ -361,6 +487,11 @@ void MmsPluginInternal::processSendConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTranQEn , addressinfo.addressVal , (pMsgInfo->networkStatus == MSG_NETWORK_SEND_SUCCESS)?"Success":"Fail"); + if (msisdn) { + free(msisdn); + msisdn = NULL; + } + // set message-id from mmsc strncpy(recvData.szMsgID, mmsHeader.szMsgID, MMS_MSG_ID_LEN); strncpy(recvData.szTrID, mmsHeader.szTrID, MMS_TR_ID_LEN); @@ -373,30 +504,20 @@ void MmsPluginInternal::processSendConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTranQEn pMsgInfo->displayTime = curTime; - - MmsInitHeader(); -#if 0 // Not Need Release MmsMsg *pMsg = NULL; MmsPluginStorage::instance()->getMmsMessage(&pMsg); -#ifdef __SUPPORT_DRM__ + MmsInitHeader(); MmsReleaseMsgDRMInfo(&pMsg->msgType.drmInfo); -#endif MmsReleaseMsgBody(&pMsg->msgBody, pMsg->msgType.type); -#endif MSG_END(); } - +#if 1 void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTranQEntity *pRequest, char *pRetrievedFilePath) { MSG_BEGIN(); - int partCnt = 0; - int attachCount = 0; - MsgType partHeader; - bool bMultipartRelated = false; - msg_error_t err = MSG_SUCCESS; MMS_RECV_DATA_S recvData = {{0}, }; @@ -449,12 +570,27 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra , (mmsHeader.pFrom)?mmsHeader.pFrom->szAddr:"YOU" , (msisdn == NULL)?"ME":msisdn , (pMsgInfo->networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS)?"Success":"Fail"); + /* PLM P141008-05143 : Notification.Ind address is 1, but MMS retreived Conf address is correct. + So adding correct address to addressList buf to compare address in DB while MsgStoUpdateMMSMessage */ + if (mmsHeader.pFrom) { + pMsgInfo->nAddressCnt = 1; + strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pFrom->szAddr, MAX_ADDRESS_VAL_LEN); + } + + if (msisdn) { + free(msisdn); + msisdn = NULL; + } + pMsgInfo->dataSize = pRequest->getDataLen; // set message-id & MMS TPDU file path - strcpy(recvData.szMsgID, mmsHeader.szMsgID); + snprintf(recvData.szMsgID, sizeof(recvData.szMsgID), "%s", mmsHeader.szMsgID); + if (pRetrievedFilePath) - strncpy(recvData.retrievedFilePath, pRetrievedFilePath, sizeof(recvData.retrievedFilePath)); + strncpy(recvData.retrievedFilePath, pRetrievedFilePath, sizeof(recvData.retrievedFilePath)-1); + + char *filename = NULL; #ifdef FEATURE_JAVA_MMS if (mmsHeader.msgType.param.szApplicationID || mmsHeader.msgType.param.szReplyToApplicationID) { @@ -466,21 +602,20 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra char fullPath[MAX_FULL_PATH_SIZE+1] = {0, }; - char *filename = NULL; - filename = strrchr(pRetrievedFilePath, '/'); + filename = MsgGetFileName(pRetrievedFilePath); - snprintf(fullPath, MAX_FULL_PATH_SIZE+1, "%s%s", MSG_IPC_DATA_PATH, filename + 1); + snprintf(fullPath, MAX_FULL_PATH_SIZE+1, "%s%s", MSG_IPC_DATA_PATH, filename); int ret = rename(pRetrievedFilePath, fullPath); if (ret != 0) { MSG_DEBUG("File rename Error: %s", strerror(errno)); } - if (chmod(fullPath, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP) != 0) { + if (MsgChmod(fullPath, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP) == false) { MSG_DEBUG("File Write Error: %s", strerror(errno)); } - if (chown(fullPath, 0, 6502 ) != 0) { + if (MsgChown(fullPath, 0, 6502 ) == false) { MSG_DEBUG("File Write Error: %s", strerror(errno)); } } @@ -494,97 +629,170 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra MmsPluginStorage *pStorage = MmsPluginStorage::instance(); - MMS_MESSAGE_DATA_S msgData; - memset(&msgData, 0, sizeof(MMS_MESSAGE_DATA_S)); + err = pStorage->updateMmsAttrib(pMsgInfo->msgId, &attrib, pMsgInfo->msgType.subType); + + MSG_DEBUG("Error value of updateMmsAttrib [%d]", err); + + {//make MmsData & insert multipart + MmsMsg *pMmsMsg = NULL; + MmsPluginStorage::instance()->getMmsMessage(&pMmsMsg); + + MMS_DATA_S *pMmsData = MsgMmsCreate(); + pMmsData->header = MsgMmsCreateHeader(); + + MmsConvertMmsData(pMmsMsg, pMmsData); + //CID 41996 : MmsConvertMmsData always returns true + /*if (MmsConvertMmsData(pMmsMsg, pMmsData) != true) { + MSG_DEBUG("Fail to Compose MMS Message"); + goto __CATCH; + }*/ + + bool bFiltered = checkFilterMmsBody(pMmsData); + if (bFiltered == true) { + pMsgInfo->folderId = MSG_SPAMBOX_ID; + } + + MMS_MULTIPART_DATA_S *pSmilMultipart = pMmsData->smil; + if (pSmilMultipart) { + MmsPluginStorage::instance()->insertMultipart(pMsgInfo->msgId, pSmilMultipart); + } + + MMSList *multipart_list = pMmsData->multipartlist; + + for (int i = 0; i < (int)g_list_length(multipart_list); i++) { + MMS_MULTIPART_DATA_S *pMultipart = (MMS_MULTIPART_DATA_S *)g_list_nth_data(multipart_list, i); + MmsPluginStorage::instance()->insertMultipart(pMsgInfo->msgId, pMultipart); + } + + {//make Preview info for APP + MmsPluginAppBase appBase(pMmsData); + appBase.makePreviewInfo(pMsgInfo->msgId, false, pRetrievedFilePath); + appBase.getFirstPageTextFilePath(pMsgInfo->msgText, sizeof(pMsgInfo->msgText)); + } + + MsgMmsRelease(&pMmsData); + + if (MsgGetFileSize(pRetrievedFilePath, (int *)&pMsgInfo->dataSize) == false) { + MSG_SEC_DEBUG("Fail to get mms file size [%s]", pRetrievedFilePath); + goto __CATCH; + } + }//make MmsData & insert multipart - // Conversation is supported only Multipart Related message, Presentation info should be provided - if (mmsHeader.msgType.type == MIME_MULTIPART_RELATED || mmsHeader.msgType.type == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) { - char *pSmilDoc = NULL; +__CATCH: + { MmsMsg *pMsg = NULL; - char szFileName[MSG_FILENAME_LEN_MAX] = {0, }; + pStorage->getMmsMessage(&pMsg); + MmsInitHeader(); + MmsReleaseMsgDRMInfo(&pMsg->msgType.drmInfo); + MmsReleaseMsgBody(&pMsg->msgBody, pMsg->msgType.type); + g_free(filename); filename = NULL; + } + MSG_END(); +} +#else //NEW process RetrieveConf +void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTranQEntity *pRequest, char *pRetrievedFilePath) +{ + MSG_BEGIN(); - msgData.regionCnt = 0; - msgData.pageCnt = 0; - msgData.attachCnt = 0; - msgData.transitionCnt = 0; - msgData.metaCnt = 0; - memset(msgData.szSmilFilePath, 0, MSG_FILEPATH_LEN_MAX); + msg_error_t err = MSG_SUCCESS; - pSmilDoc = MmsSmilGetPresentationData(pMsgInfo->msgId); - MmsSmilParseSmilDoc(&msgData, pSmilDoc); - MmsRemovePims(&msgData); + pMsgInfo->msgId = pRequest->msgId; - MmsPluginStorage::instance()->getMmsMessage(&pMsg); - strcpy(szFileName, pMsg->szFileName); + pMsgInfo->msgType.mainType = MSG_MMS_TYPE; + if (pRequest->eMmsPduType == eMMS_RETRIEVE_AUTO_CONF) + pMsgInfo->msgType.subType = MSG_RETRIEVE_AUTOCONF_MMS; + else + pMsgInfo->msgType.subType = MSG_RETRIEVE_MANUALCONF_MMS; + + strncpy(pMsgInfo->subject, mmsHeader.szSubject, MSG_LOCALE_SUBJ_LEN); + strncpy(pRequest->transactionId, mmsHeader.szTrID, MMS_TR_ID_LEN); + + time_t curTime; + curTime = time(NULL); + + pMsgInfo->displayTime = curTime; - err = pStorage->getMsgText(&msgData, pMsgInfo->msgText); - bMultipartRelated = true; + if (mmsHeader.retrieveStatus == MMS_RETRSTATUS_OK) { + pMsgInfo->networkStatus = MSG_NETWORK_RETRIEVE_SUCCESS; + pMsgInfo->folderId = MSG_INBOX_ID; } else { - MSG_DEBUG("Multipart mixed message doesn't support mms conversation"); + pMsgInfo->networkStatus = MSG_NETWORK_RETRIEVE_FAIL; + pMsgInfo->folderId = MSG_INBOX_ID; + // If failed MMS Retrieve, then saved as MMS Noti Ind Message. + // It will changed in MsgHandleMmsConfIncomingMsg + //pMsgInfo->msgType.subType = MSG_NOTIFICATIONIND_MMS; } - err = pStorage->updateMmsAttrib(pMsgInfo->msgId, &attrib, pMsgInfo->msgType.subType); + char *msisdn = NULL; + msisdn = MsgSettingGetString(MSG_SIM_MSISDN); - partCnt = MmsGetMediaPartCount(pMsgInfo->msgId); - MSG_DEBUG("MmsUiGetMediaAttachInfo: partCnt=%d\n", partCnt ); + if (mmsHeader.pFrom) + MmsAddrUtilRemovePlmnString(mmsHeader.pFrom->szAddr); - if (partCnt < 0) { - MSG_DEBUG("MmsUiGetMediaAttachInfo: partCnt=%d\n", partCnt ); - } else { - for (int i = 0; i < partCnt; ++i) { - if (!MmsGetMediaPartHeader(i, &partHeader)) { - MSG_DEBUG("MmsUiGetMediaAttachInfo: MmsGetMediaPartHeader failed\n" ); - break; - } + MSG_MMS_VLD_INFO("%d, MMS Receive %s End %s->%s %s", pMsgInfo->msgId + , (pRequest->eMmsPduType == eMMS_RETRIEVE_AUTO_CONF)?"Auto":"Manual" + , (mmsHeader.pFrom)?mmsHeader.pFrom->szAddr:"YOU" + , (msisdn == NULL)?"ME":msisdn + , (pMsgInfo->networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS)?"Success":"Fail"); - if (partHeader.contentSize > 0) { - char szBuf[MSG_FILEPATH_LEN_MAX + 1]; + if (msisdn) { + free(msisdn); + msisdn = NULL; + } + + pMsgInfo->dataSize = pRequest->getDataLen; - strcpy((char *)szBuf, partHeader.param.szFileName); - sprintf(partHeader.param.szFileName, MSG_DATA_PATH"%s", szBuf); - if (!bMultipartRelated || MmsCheckAdditionalMedia(&msgData, &partHeader)) { - MMS_ATTACH_S *attachment = NULL; - int tempType; - attachment = (MMS_ATTACH_S *)calloc(sizeof(MMS_ATTACH_S), 1); + { + MmsMsg *pMmsMsg = NULL; + MmsPluginStorage::instance()->getMmsMessage(&pMmsMsg); - MsgGetTypeByFileName(&tempType, partHeader.param.szFileName); - attachment->mediatype = (MimeType)tempType; + MMS_DATA_S *pMmsData = MsgMmsCreate(); + pMmsData->header = MsgMmsCreateHeader(); - strcpy(attachment->szFilePath, partHeader.param.szFileName); + if (MmsConvertMmsData(pMmsMsg, pMmsData) != true) { + MSG_DEBUG("Fail to Compose MMS Message"); + goto __CATCH; + } - strncpy(attachment->szFileName, partHeader.param.szName, MSG_FILENAME_LEN_MAX - 1); + char *pSerializedData = NULL; - attachment->fileSize = partHeader.contentSize; + MsgSerializeMms(pMmsData, &pSerializedData); - _MsgMmsAddAttachment(&msgData, attachment); - attachCount++; + MsgMmsRelease(&pMmsData); - } - } + char fileName[MSG_FILENAME_LEN_MAX] = {0}; + char fileFilePath[MSG_FILEPATH_LEN_MAX] = {0}; + + if (MsgCreateFileName(fileName) == false) + goto __CATCH; + + snprintf(fileFilePath, sizeof(fileFilePath), "%s%s", MSG_DATA_PATH, fileName); + + if (!MsgOpenCreateAndOverwriteFile(fileFilePath, (char *)pSerializedData, (int)strlen(pSerializedData))) { + goto __CATCH; } - } - MmsMakePreviewInfo(pMsgInfo->msgId, &msgData); - MSG_DEBUG("attachCount [%d]", attachCount); - err = pStorage->updateMmsAttachCount(pMsgInfo->msgId, attachCount); + snprintf(pMsgInfo->msgData, sizeof(pMsgInfo->msgData), "%s", fileFilePath); - if (bMultipartRelated) { - MsgMmsReleaseMmsLists(&msgData); + if (MsgGetFileSize(pRetrievedFilePath, (int *)&pMsgInfo->dataSize) == false) { + MSG_SEC_DEBUG("Fail to get mms file size [%s]", pRetrievedFilePath); + goto __CATCH; + } } - MmsMsg *pMsg = NULL; - pStorage->getMmsMessage(&pMsg); - MmsInitHeader(); -#ifdef __SUPPORT_DRM__ - MmsReleaseMsgDRMInfo(&pMsg->msgType.drmInfo); -#endif - MmsReleaseMsgBody(&pMsg->msgBody, pMsg->msgType.type); - +__CATCH: + { + MmsMsg *pMsg = NULL; + MmsPluginStorage::instance()->getMmsMessage(&pMsg); + MmsInitHeader(); + MmsReleaseMsgDRMInfo(&pMsg->msgType.drmInfo); + MmsReleaseMsgBody(&pMsg->msgBody, pMsg->msgType.type); + } MSG_END(); } - +#endif void MmsPluginInternal::processForwardConf(MSG_MESSAGE_INFO_S *msgInfo, mmsTranQEntity *pRequest) { @@ -608,7 +816,7 @@ bool MmsPluginInternal::encodeNotifyRespInd(char *szTrID, msg_delivery_report_st if (MsgCreateFileName(pTempFileName) == false) return false; - snprintf(pTempFilePath, MAX_FULL_PATH_SIZE, MSG_DATA_PATH"%s.noti.ind", pTempFileName); + snprintf(pTempFilePath, MAX_FULL_PATH_SIZE, "%s%s.noti.ind", MSG_DATA_PATH, pTempFileName); pFile = MsgOpenMMSFile(pTempFilePath); @@ -626,7 +834,8 @@ bool MmsPluginInternal::encodeNotifyRespInd(char *szTrID, msg_delivery_report_st MsgCloseFile(pFile); if (pSendFilePath) { - snprintf(pSendFilePath, MAX_MSG_DATA_LEN+1, "%s.mms", pTempFilePath); + //CID 41993: replaced size 'MAX_MSG_DATA_LEN+1' with MAX_FULL_PATH_SIZE + snprintf(pSendFilePath, MAX_FULL_PATH_SIZE, "%s.mms", pTempFilePath); } else { MSG_DEBUG("[ERROR] pSendFilePath is NULL"); return false; @@ -653,7 +862,7 @@ bool MmsPluginInternal::encodeAckInd(char *szTrID, bool bReportAllowed, char *pS if (MsgCreateFileName(pTempFileName) == false) return false; - snprintf(pTempFilePath, MAX_FULL_PATH_SIZE, MSG_DATA_PATH"%s.ack.ind", pTempFileName); + snprintf(pTempFilePath, MAX_FULL_PATH_SIZE, "%s%s.ack.ind", MSG_DATA_PATH, pTempFileName); pFile = MsgOpenMMSFile(pTempFilePath); if (!pFile) { @@ -733,6 +942,70 @@ bool MmsPluginInternal::checkRejectNotiInd(int roamState, bool bReportAllowed, c } + +bool MmsPluginInternal::checkFilterMmsBody(MMS_DATA_S *pMmsData) +{ + + if (pMmsData == NULL) + return false; + + bool bFiltered = false; + MMS_MESSAGE_DATA_S mmsMsg; + MMS_PAGE_S *pPage = NULL; + MMS_MEDIA_S *pMedia = NULL; + char filePath[MSG_FILEPATH_LEN_MAX + 1]; + gchar *fileContent = NULL; + MsgDbHandler *dbHandle = getDbHandle(); + MimeType mimeType = MIME_UNKNOWN; + + memset(&mmsMsg, 0x00, sizeof(MMS_MESSAGE_DATA_S)); + MsgMmsConvertMmsDataToMmsMessageData(pMmsData, &mmsMsg); + + // Get the text data from the 1st slide. + if (mmsMsg.pageCnt <= 0) { + MSG_WARN("pageCnt : %d", mmsMsg.pageCnt); + MsgMmsReleaseMmsLists(&mmsMsg); + return false; + } + + pPage = _MsgMmsGetPage(&mmsMsg, 0); + + if (!pPage) { + MSG_WARN("page is NULL"); + MsgMmsReleaseMmsLists(&mmsMsg); + return false; + } + + for (int j = 0; j < pPage->mediaCnt; ++j) { + pMedia = _MsgMmsGetMedia(pPage, j); + + if (pMedia && pMedia->mediatype == MMS_SMIL_MEDIA_TEXT) { + + MmsGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, pMedia->szFilePath, &mimeType, NULL); + + if (mimeType == MIME_TEXT_X_VCALENDAR || mimeType == MIME_TEXT_X_VCARD || mimeType == MIME_TEXT_X_VTODO || mimeType == MIME_TEXT_X_VNOTE) { + MSG_DEBUG("Media Type is Text, but Vobject file [%s]", pMedia->szFilePath); + } else { + strncpy(filePath, pMedia->szFilePath, MSG_FILEPATH_LEN_MAX); + + g_file_get_contents((const gchar *)filePath, &fileContent, NULL, NULL); + + bFiltered = MsgCheckFilterByWord(dbHandle, (const char *)fileContent); + + g_free(fileContent); + fileContent = NULL; + + if (bFiltered == true) + break; + } + } + } + + MsgMmsReleaseMmsLists(&mmsMsg); + + return bFiltered; +} + bool MmsPluginInternal::getMmsReport(MmsReport mmsReport) { bool result = false; diff --git a/plugin/mms_plugin/MmsPluginMIME.cpp b/plugin/mms_plugin/MmsPluginMIME.cpp index 8c481c7..de8bb40 100755 --- a/plugin/mms_plugin/MmsPluginMIME.cpp +++ b/plugin/mms_plugin/MmsPluginMIME.cpp @@ -1,140 +1,58 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include #include #include "MmsPluginMIME.h" #include "MmsPluginDebug.h" -#include "MmsPluginSmil.h" -#ifndef NULL -#define NULL 0 -#endif +typedef enum _MimeAppType { + MIME_APPLICATION_NONE, + MIME_APPLICATION_CAMERA, + MIME_APPLICATION_VIDEORECORDER, -/* Header field */ -static const char *szMsgField[MSG_FIELD_NUM] = -{ - "Return-Path", - "Message-ID", - "From" , - "To" , - "Cc" , - "Subject", - "Date", - "Mime-Version", - "Content-Type", - "Content-Transfer-Encoding", - "Content-Disposition", //If start param is given in multipart/related, this field will be ignored - "Content-ID", //for start part of multipart/related body - "Content-Location", - "Content-Name", - "Content-Description", - "Content-Vendor", - "Rights-Issuer", - "Return-Receipt-To", /* Delivery confirm */ - "Disposition-Notification-To", /* Read confirm */ - "Content-Rep-Pos", - "Content-Rep-Size", - "Content-Rep-Index" -}; + MIME_APPLICATION_IMAGEVIEWER, + MIME_APPLICATION_FLASHVIEWER, + MIME_APPLICATION_IMAGEEDITOR, + MIME_APPLICATION_THEMEVIEWER, -/* MIME header field parameter */ -static const char *szMsgParam[MSG_PARAM_NUM] = -{ - "charset", - "name", - "filename", - "type", //Only if content-type is multipart/related, - "start", //Only if content-type is multipart/related - "start-info", //Only if content-type is multipart/related - "boundary", - "report-type", // only used as parameter of Content-Type: multipart/report; report-type=delivery-status; -#ifdef FEATURE_JAVA_MMS - "Application-ID", //laconic_javaParamFix - "Reply-To-Application-ID", //laconic_javaParamFix -#endif -}; + MIME_APPLICATION_SOUNDPLAYER, + MIME_APPLICATION_MEDIAPLAYER, + MIME_APPLICATION_VOICEMEMO, -/* Content-Transfer-Encoding header value */ -static const char *szMsgEncoding[MSG_ENCODING_NUM] = -{ - "7bit", - "8bit", - "binary", - "base64", - "quoted-printable" -}; + MIME_APPLICATION_PICSELVIEWER, -/* Content-Disposition header value */ -static const char *szMsgDisposition[MSG_DISPOSITION_NUM] = -{ - "form-data", - "attachment", - "inline" -}; + MIME_APPLICATION_CONTACT, + MIME_APPLICATION_ORGANIZER, -static const char *szMsgAddrType[MSG_ADDR_TYPE_NUM] = -{ - "/TYPE=PLMN", - "", - "/TYPE=IPV4", - "/TYPE=IPV6", - "" -}; + MIME_APPLICATION_MAX +} MimeAppType; -/* character-set value */ -static const char *szMsgCharset [MSG_CHARSET_NUM] = -{ - "us-ascii", - "utf-16", - "usc-2", - "utf-8", - /* MIME character-set value */ - - "iso-2022-kr", - "ks_c_5601-1987", - "euc_kr", - "iso-2022-jp", - "iso-2022-jp-2", - "iso-8859-1", - "iso-8859-2", - "iso-8859-3", - "iso-8859-4", - "iso-8859-5", - "iso-8859-6", - "iso-8859-6-e", - "iso-8859-6-i", - "iso-8859-7", - "iso-8859-8", - "iso-8859-8-i", - "iso-8859-9", - "iso-8859-10", - "iso-8859-15", - "Shift_jis", - "euc-jp", - "gb2312", - "big5", - "win1251", - "window-1251", - "windows-1251", - "koi8-r", - "koi8-u" -}; +typedef struct _MimeTable { + const char *szMIME; + const char *szExt; + bool bDownloadable; + MimeType mime; /* index of mime type */ + MimeType contentType; /* representative mime type */ + MimeAppType appType; + MimeMainType mainType; + int binary; +} MimeTable; /************************************************** MIME definition ***************************************************/ static const MimeTable mimeTable[] = { @@ -216,8 +134,8 @@ static const MimeTable mimeTable[] = { {"audio/amr-wb", "amr", true, MIME_AUDIO_AMR_WB, MIME_AUDIO_AMR_WB, MIME_APPLICATION_VOICEMEMO, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY }, {"audio/mmf", "mmf", true, MIME_AUDIO_MMF, MIME_AUDIO_MMF, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY }, {"audio/smaf", "mmf", true, MIME_AUDIO_SMAF, MIME_AUDIO_SMAF, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY }, - {"audio/iMelody", "imy", true, MIME_AUDIO_IMELODY, MIME_AUDIO_IMELODY, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY }, - {"audio/imelody", "imy", true, MIME_AUDIO_IMELODY2, MIME_AUDIO_IMELODY, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY }, + {"audio/imelody", "imy", true, MIME_AUDIO_IMELODY, MIME_AUDIO_IMELODY, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY }, + {"audio/iMelody", "imy", true, MIME_AUDIO_IMELODY2, MIME_AUDIO_IMELODY, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY }, {"audio/melody", "imy", true, MIME_AUDIO_MELODY, MIME_AUDIO_IMELODY, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY }, {"audio/mid", "mid", true, MIME_AUDIO_MID, MIME_AUDIO_MID, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY }, {"audio/midi", "mid"/*,midi"*/, true, MIME_AUDIO_MIDI, MIME_AUDIO_MID, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY }, @@ -292,14 +210,15 @@ static const MimeTable mimeTable[] = { {"multipart/voice-message", "", false, MIME_MULTIPART_VOICE_MESSAGE, MIME_MULTIPART_VOICE_MESSAGE, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, UNDEFINED_BINARY }, //128 - {"text/txt", "txt", false, MIME_TEXT_TXT, MIME_TEXT_TXT, MIME_APPLICATION_PICSELVIEWER, MIME_MAINTYPE_TEXT, UNDEFINED_BINARY }, + {"text/txt", "", false, MIME_TEXT_TXT, MIME_TEXT_TXT, MIME_APPLICATION_PICSELVIEWER, MIME_MAINTYPE_TEXT, UNDEFINED_BINARY }, {"text/html", "html"/*,htm"*/, false, MIME_TEXT_HTML, MIME_TEXT_HTML, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x02 }, {"text/plain", "txt"/*,vbm,url"*/, false, MIME_TEXT_PLAIN, MIME_TEXT_PLAIN, MIME_APPLICATION_PICSELVIEWER, MIME_MAINTYPE_TEXT, 0x03 }, {"text/css", "", false, MIME_TEXT_CSS, MIME_TEXT_CSS, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x3d }, {"text/xml", "", false, MIME_TEXT_XML, MIME_TEXT_XML, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x28 }, {"text/iMelody", "imy", true, MIME_TEXT_IMELODY, MIME_TEXT_IMELODY, MIME_APPLICATION_SOUNDPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY }, + {"text/calendar", "ics", true, MIME_TEXT_CALENDAR, MIME_TEXT_CALENDAR, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, UNDEFINED_BINARY }, - //134 + //135 {"text/vnd.wap.wmlscript", "", false, MIME_TEXT_VND_WAP_WMLSCRIPT, MIME_TEXT_VND_WAP_WMLSCRIPT, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x09 }, {"text/vnd.wap.wml", "wml", false, MIME_TEXT_VND_WAP_WML, MIME_TEXT_VND_WAP_WML, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x08 }, {"text/vnd.wap.wta-event", "", false, MIME_TEXT_VND_WAP_WTA_EVENT, MIME_TEXT_VND_WAP_WTA_EVENT, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x0a }, @@ -310,30 +229,32 @@ static const MimeTable mimeTable[] = { {"text/vnd.sun.j2me.app-descriptor", "jad", true, MIME_TEXT_VND_SUN_J2ME_APP_DESCRIPTOR, MIME_TEXT_VND_SUN_J2ME_APP_DESCRIPTOR, MIME_APPLICATION_NONE, MIME_MAINTYPE_ETC, UNDEFINED_BINARY }, - //142 + //143 {"text/x-hdml", "", false, MIME_TEXT_X_HDML, MIME_TEXT_X_HDML, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x04 }, - {"text/x-vCalendar", "vcs", true, MIME_TEXT_X_VCALENDAR, MIME_TEXT_X_VCALENDAR, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x06 }, - {"text/x-vCard", "vcf", true, MIME_TEXT_X_VCARD, MIME_TEXT_X_VCARD, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x07 }, + {"text/x-vCalendar", "vcs", true, MIME_TEXT_X_VCALENDAR, MIME_TEXT_X_VCALENDAR, MIME_APPLICATION_NONE, MIME_MAINTYPE_ETC, 0x06 }, + {"text/x-vCard", "vcf", true, MIME_TEXT_X_VCARD, MIME_TEXT_X_VCARD, MIME_APPLICATION_NONE, MIME_MAINTYPE_ETC, 0x07 }, {"text/x-iMelody", "imy", true, MIME_TEXT_X_IMELODY, MIME_TEXT_X_IMELODY, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY }, {"text/x-imelody", "imy", true, MIME_TEXT_X_IMELODY2, MIME_TEXT_X_IMELODY, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY }, {"text/x-vnote", "vnt", true, MIME_TEXT_X_VNOTE, MIME_TEXT_X_VNOTE, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, UNDEFINED_BINARY }, + {"text/x-vtodo", "vts", true, MIME_TEXT_X_VTODO, MIME_TEXT_X_VNOTE, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, UNDEFINED_BINARY }, - //148 + //150 {"video/mpeg4", "mp4", true, MIME_VIDEO_MPEG4, MIME_VIDEO_MP4, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, {"video/mp4", "mp4", true, MIME_VIDEO_MP4, MIME_VIDEO_MP4, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, - {"video/h263", "3gp"/*,3gpp,mp4"*/,true, MIME_VIDEO_H263, MIME_VIDEO_H263, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, + {"video/h263", ""/*,3gpp,mp4"*/,true, MIME_VIDEO_H263, MIME_VIDEO_H263, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, {"video/3gpp", "3gp"/*,3gpp"*/, true, MIME_VIDEO_3GPP, MIME_VIDEO_3GPP, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, {"video/3gp", "3gp"/*,3gpp"*/, true, MIME_VIDEO_3GP, MIME_VIDEO_3GP, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, {"video/avi", "avi", false, MIME_VIDEO_AVI, MIME_VIDEO_AVI, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, {"video/sdp", "sdp", true, MIME_VIDEO_SDP, MIME_APPLICATION_SDP, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, {"video/mp4v-es", "3gp", true, MIME_VIDEO_MP4_ES, MIME_VIDEO_3GP, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, {"video/mpeg", "3gp", true, MIME_VIDEO_MPEG, MIME_VIDEO_3GP, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, + {"video/quicktime", "mov", true, MIME_VIDEO_MOV, MIME_VIDEO_3GP, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, - // 157 + // 160 {"video/vnd.rn-realvideo", "rm", true, MIME_VIDEO_VND_RN_REALVIDEO, MIME_VIDEO_VND_RN_REALVIDEO, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, {"video/vnd.rn-realmedia", "rm", true, MIME_VIDEO_VND_RN_REALMEDIA, MIME_VIDEO_VND_RN_REALMEDIA, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, - //159 + //162 {"video/x-mp4", "mp4", true, MIME_VIDEO_X_MP4, MIME_VIDEO_MP4, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, {"video/x-pv-mp4", "mp4", true, MIME_VIDEO_X_PV_MP4, MIME_VIDEO_MP4, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, {"video/x-pn-realvideo", "rv", true, MIME_VIDEO_X_PN_REALVIDEO, MIME_VIDEO_VND_RN_REALVIDEO, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, @@ -351,84 +272,10 @@ static const int mimeTableIndex[] = { 105, 116, 119, 120, 120, 120, 121, 121, 121, - 128, 134, 142, - 148, 157, 159 + 128, 135, 143, + 150, 160, 162 }; - -/***************** Extension definition *****************/ -static const ExtTable extTable[] = { - - {"txt", MIME_TEXT_PLAIN}, - {"html", MIME_TEXT_HTML}, - {"htm", MIME_TEXT_HTML}, - {"xhtml", MIME_APPLICATION_XHTML_XML}, - {"wml", MIME_TEXT_VND_WAP_WML}, - {"vcs", MIME_TEXT_X_VCALENDAR}, - {"vcf", MIME_TEXT_X_VCARD}, - {"vnt", MIME_TEXT_X_VNOTE}, - {"smil", MIME_APPLICATION_SMIL}, - {"eml", MIME_MESSAGE_RFC822}, - {"gif", MIME_IMAGE_GIF}, - {"jpeg", MIME_IMAGE_JPEG}, - {"jpg", MIME_IMAGE_JPEG}, - {"jpe", MIME_IMAGE_JPEG}, - {"jpz", MIME_IMAGE_JPEG}, - {"tiff", MIME_IMAGE_TIFF}, - {"tif", MIME_IMAGE_TIFF}, - {"png", MIME_IMAGE_PNG}, - {"pnz", MIME_IMAGE_PNG}, - {"wbmp", MIME_IMAGE_VND_WAP_WBMP}, - {"bmp", MIME_IMAGE_BMP}, - {"au", MIME_AUDIO_BASIC}, - {"snd", MIME_AUDIO_BASIC}, - {"mp3", MIME_AUDIO_MP3}, - {"aac", MIME_AUDIO_AAC}, - {"mp4", MIME_AUDIO_MP4}, - {"m4a", MIME_AUDIO_M4A}, - {"amr", MIME_AUDIO_X_AMR}, - {"mmf", MIME_APPLICATION_VND_SMAF}, - {"imy", MIME_AUDIO_X_IMELODY}, - {"mid", MIME_AUDIO_MID}, - {"midi", MIME_AUDIO_MID}, - {"spm", MIME_AUDIO_SP_MIDI}, - {"wav", MIME_AUDIO_WAVE}, - {"3gp", MIME_AUDIO_3GPP}, - {"3gpp", MIME_VIDEO_3GPP}, - {"rm", MIME_VIDEO_VND_RN_REALVIDEO}, - {"ra", MIME_AUDIO_VND_RN_REALAUDIO}, - {"ram", MIME_AUDIO_VND_RN_REALAUDIO}, - {"wma", MIME_AUDIO_X_MS_WMA}, - {"smp", MIME_APPLICATION_STUDIOM}, - {"avi", MIME_VIDEO_AVI}, - {"sdp", MIME_APPLICATION_SDP}, - {"vbm", MIME_TEXT_PLAIN}, - {"url", MIME_TEXT_PLAIN}, - {"jad", MIME_TEXT_VND_SUN_J2ME_APP_DESCRIPTOR}, - {"jar", MIME_APPLICATION_VND_SUN_J2ME_JAVA_ARCHIVE}, - {"dd", MIME_APPLICATION_VND_OMA_DD_XML}, - {"dm", MIME_APPLICATION_VND_OMA_DRM_MESSAGE}, - {"dcf", MIME_APPLICATION_VND_OMA_DRM_CONTENT}, - {"rv", MIME_VIDEO_X_PN_REALVIDEO}, - {"ro", MIME_APPLICATION_VND_OMA_DRM_RIGHTS_XML}, - {"thm", MIME_APPLICATION_VND_SAMSUNG_THEME}, - {"xls", MIME_APPLICATION_X_EXCEL}, - {"pdf", MIME_APPLICATION_PDF}, - {"ppt", MIME_APPLICATION_X_POWERPOINT}, - {"swf", MIME_APPLICATION_X_FLASH}, - {"svg", MIME_IMAGE_SVG}, - {"doc", MIME_APPLICATION_MSWORD}, - {"wmv", MIME_VIDEO_X_MS_WMV}, - {"asf", MIME_VIDEO_X_MS_ASF}, - {"3ga", MIME_AUDIO_M4A}, - {"xmf", MIME_AUDIO_XMF}, - {"mxmf", MIME_AUDIO_MOBILE_XMF}, - {"pvx", MIME_VIDEO_X_PV_PVX}, - {"oro", MIME_APPLICATION_VND_OMA_DRM_RO_XML}, - {"odf", MIME_APPLICATION_VND_OMA_DRM_DCF} -}; - - static int mimeTableEnum[] = { MIME_ASTERISK , @@ -584,6 +431,7 @@ static int mimeTableEnum[] = MIME_TEXT_CSS , MIME_TEXT_XML , MIME_TEXT_IMELODY , + MIME_TEXT_CALENDAR, MIME_TEXT_VND_WAP_WMLSCRIPT , MIME_TEXT_VND_WAP_WML , MIME_TEXT_VND_WAP_WTA_EVENT , @@ -598,7 +446,7 @@ static int mimeTableEnum[] = MIME_TEXT_X_IMELODY , MIME_TEXT_X_IMELODY2 , MIME_TEXT_X_VNOTE , - + MIME_TEXT_X_VTODO, MIME_VIDEO_MPEG4 , MIME_VIDEO_MP4 , @@ -609,6 +457,7 @@ static int mimeTableEnum[] = MIME_VIDEO_SDP , MIME_VIDEO_MP4_ES, MIME_VIDEO_MPEG , + MIME_VIDEO_MOV , MIME_VIDEO_VND_RN_REALVIDEO , MIME_VIDEO_VND_RN_REALMEDIA , MIME_VIDEO_X_MP4 , @@ -623,8 +472,8 @@ static int mimeTableEnum[] = }; -#define MIME_MAX_NUM 166 -#define EXT_MAX 67 +#define MIME_MAX_NUM 167 +#define EXT_MAX 68 #define MIME_SUB_TYPE_VND 1 #define MIME_SUB_TYPE_X 2 @@ -632,41 +481,6 @@ int __MimeGetTableIndexInt(MimeType mime); int __MimeGetTableIndexString(const char *szMime); MimeMainType __MimeGetMainTypeName(const char *szType); - -/* - * This function checks whether a mime is downloadable or not. - * - * @param mime [in] Enumeration number for a MIME type. - * @return This function returns true if downloadable, or false. - */ -bool MimeIsDownloadableInt(MimeType mime) -{ - int index; - - index = __MimeGetTableIndexInt(mime); - if (index == MIME_UNKNOWN) - return false; - - return mimeTable[index].bDownloadable; -} - -/* - * This function checks whether a mime is downloadable or not. - * - * @param mime [in] MIME string. - * @return This function returns true if downloadable, or false. - */ -bool MimeIsDownloadableString(const char *szMime) -{ - int index; - - index = __MimeGetTableIndexString(szMime); - if (index == MIME_UNKNOWN) - return false; - - return mimeTable[index].bDownloadable; -} - /* * This function checks main type of a MIME. * @@ -684,22 +498,6 @@ MimeMainType MimeGetMainTypeInt(MimeType mime) return mimeTable[index].mainType; } -/* - * This function checks main type of a MIME. - * - * @param mime [in] MIME string. - * @return This function returns main type of a MIME. - */ -MimeMainType MimeGetMainTypeString(const char *szMime) -{ - int index; - - index = __MimeGetTableIndexString(szMime); - if (index == MIME_UNKNOWN) - return MIME_MAINTYPE_ETC; - - return mimeTable[index].mainType; -} /* * This function returns a extension name for a specified MIME. @@ -719,67 +517,6 @@ char *MimeGetExtFromMimeInt(MimeType mime) } /* - * This function returns a extension name for a specified MIME. - * - * @param mime [in] MIME string. - * @return This function returns Extension string. - */ -char *MimeGetExtFromMimeString(const char *szMime) -{ - int index; - - index = __MimeGetTableIndexString(szMime); - if (index == MIME_UNKNOWN) - return NULL; - - return (char *)mimeTable[index].szExt; -} - - -/* - * This function returns a MIME type for a specified Extension. - * - * @param mime [in] Extension string. - * @return This function returns MIME string. - */ -char *MimeGetMimeFromExtString(const char *szExt) -{ - int i; - - for (i = 0; i < EXT_MAX; i++) { - if (!strcasecmp( extTable[i].szExt, szExt)) { - int index; - - index = __MimeGetTableIndexInt(extTable[i].mimeType); - if (index == MIME_UNKNOWN) - return NULL; - - return (char *)mimeTable[index].szMIME; - } - } - - return NULL; -} - -/* - * This function returns a MIME type for a specified Extension. - * - * @param mime [in] Extension string. - * @return This function returns MIME string. - */ -MimeType MimeGetMimeFromExtInt(const char *szExt) -{ - int i; - - for (i = 0; i < EXT_MAX; i++) { - if (!strcasecmp( extTable[i].szExt, szExt)) - return extTable[i].mimeType; - } - - return MIME_UNKNOWN; -} - -/* * This function returns index number in MIME definition table with MIME enumeration. * Internal function. */ @@ -807,8 +544,6 @@ int __MimeGetTableIndexInt(MimeType mime) return tableIndex; } - -#define MIME_MAX_LEN 43 /* * This function returns index number in MIME definition table with MIME string. * Internal function. @@ -846,7 +581,8 @@ int __MimeGetTableIndexString(const char *szMime) free(szMIMEType); return 0; } - strcpy(szMIMEType, szMime); + + strncpy(szMIMEType, szMime, strlen(szMime)); type = 0; subtype = 0; @@ -949,7 +685,7 @@ MimeMainType __MimeGetMainTypeName(const char *szType) } - +//For Decode // MimeString -> MimeInt MimeType MimeGetMimeIntFromMimeString(char *szMimeStr) { @@ -989,22 +725,6 @@ MimeType MimeGetMimeIntFromBi(int binCode) return MIME_UNKNOWN; } -// BinaryCode -> MimeInt -char *MimeGetMimeStringFromBi(int binCode) -{ - int index; - - if (binCode < 0x00 || binCode > 0x4b) - return NULL; - - for (index = 0; index < MIME_MAX_NUM; index++) { - if (binCode == mimeTable[index].binary) - return (char *)mimeTable[index].szMIME; - } - - return NULL; -} - // Mimeint -> Binary Value int MimeGetBinaryValueFromMimeInt(MimeType mime) { @@ -1017,309 +737,146 @@ int MimeGetBinaryValueFromMimeInt(MimeType mime) return mimeTable[index].binary; } -// MimeString -> Binary value -int MimeGetBinaryValueFromMimeString(const char *szMime) -{ - int index; - - index = __MimeGetTableIndexString(szMime); - if (index == MIME_UNKNOWN) - return UNDEFINED_BINARY; - - return mimeTable[index].binary; -} +typedef struct { + const char *szExt; + int mainType; + int enumMime; + const char *szContentType; +} ExtTableItem; + +#define EXT_TABLE_SIZE (56) + +const ExtTableItem extTable[EXT_TABLE_SIZE] = { + + //text + {"txt", MIME_MAINTYPE_TEXT, MIME_TEXT_PLAIN, "text/plain"}, + {"html", MIME_MAINTYPE_TEXT, MIME_TEXT_HTML, "text/html"}, + {"xhtml", MIME_MAINTYPE_TEXT, MIME_APPLICATION_XHTML_XML, "application/xhtml+xml"}, + {"vcs", MIME_MAINTYPE_TEXT, MIME_TEXT_X_VCALENDAR, "text/x-vCalendar"}, + {"vcf", MIME_MAINTYPE_TEXT, MIME_TEXT_X_VCARD, "text/x-vCard"}, + {"vnt", MIME_MAINTYPE_TEXT, MIME_TEXT_X_VNOTE, "text/x-vnote"}, + {"vts", MIME_MAINTYPE_TEXT, MIME_TEXT_X_VTODO, "text/x-vtodo"}, + {"ics", MIME_MAINTYPE_TEXT, MIME_TEXT_CALENDAR, "text/calendar"}, + + //image + {"gif", MIME_MAINTYPE_IMAGE, MIME_IMAGE_GIF, "image/gif"}, + //{"jpg", MIME_MAINTYPE_IMAGE, MIME_IMAGE_JPG, "image/jpg"}, + {"jpg", MIME_MAINTYPE_IMAGE, MIME_IMAGE_JPEG, "image/jpeg"}, + {"jpeg", MIME_MAINTYPE_IMAGE, MIME_IMAGE_JPEG, "image/jpeg"}, + {"tiff", MIME_MAINTYPE_IMAGE, MIME_IMAGE_TIFF, "image/tiff"}, + {"tif", MIME_MAINTYPE_IMAGE, MIME_IMAGE_TIF, "image/tif"}, + {"png", MIME_MAINTYPE_IMAGE, MIME_IMAGE_PNG, "image/png"}, + {"wbmp", MIME_MAINTYPE_IMAGE, MIME_IMAGE_VND_WAP_WBMP, "image/vnd.wap.wbmp"}, + {"bmp", MIME_MAINTYPE_IMAGE, MIME_IMAGE_BMP, "image/bmp"}, + {"svg", MIME_MAINTYPE_IMAGE, MIME_IMAGE_SVG, "image/svg+xml"}, + + //audio + {"snd", MIME_MAINTYPE_AUDIO, MIME_AUDIO_BASIC, "audio/basic"}, + {"amr", MIME_MAINTYPE_AUDIO, MIME_AUDIO_AMR, "audio/amr"}, + {"m4a", MIME_MAINTYPE_AUDIO, MIME_AUDIO_M4A, "audio/m4a"}, + {"3gp", MIME_MAINTYPE_AUDIO, MIME_AUDIO_3GPP, "audio/3gpp"}, + {"3gpp", MIME_MAINTYPE_AUDIO, MIME_AUDIO_3GPP, "audio/3gpp"}, + {"mp3", MIME_MAINTYPE_AUDIO, MIME_AUDIO_MPEG, "audio/mpeg"}, + {"aac", MIME_MAINTYPE_AUDIO, MIME_AUDIO_AAC, "audio/aac"}, + {"imy", MIME_MAINTYPE_AUDIO, MIME_AUDIO_IMELODY, "audio/imelody"}, + {"mid", MIME_MAINTYPE_AUDIO, MIME_AUDIO_MID, "audio/mid"}, + {"mmf", MIME_MAINTYPE_AUDIO, MIME_AUDIO_MMF, "audio/mmf"}, + {"spm", MIME_MAINTYPE_AUDIO, MIME_AUDIO_SP_MIDI, "audio/sp-midi"}, + {"wav", MIME_MAINTYPE_AUDIO, MIME_AUDIO_WAV, "audio/wav"}, + {"mp4", MIME_MAINTYPE_AUDIO, MIME_AUDIO_MP4, "audio/mp4"}, + {"wma", MIME_MAINTYPE_AUDIO, MIME_AUDIO_X_MS_WMA, "audio/x-ms-wma"}, + {"rm", MIME_MAINTYPE_AUDIO, MIME_AUDIO_VND_RN_REALAUDIO, "audio/vnd.rn-realaudio"}, + {"ra", MIME_MAINTYPE_AUDIO, MIME_AUDIO_VND_RN_REALAUDIO, "audio/vnd.rn-realaudio"}, + + //video + {"3gp", MIME_MAINTYPE_VIDEO, MIME_VIDEO_3GPP, "video/3gpp"}, + {"3gpp", MIME_MAINTYPE_VIDEO, MIME_VIDEO_3GPP, "video/3gpp"}, + {"mp4", MIME_MAINTYPE_VIDEO, MIME_VIDEO_MP4, "video/mp4"}, + {"rm", MIME_MAINTYPE_VIDEO, MIME_VIDEO_VND_RN_REALVIDEO, "video/vnd.rn-realvideo"}, + {"rv", MIME_MAINTYPE_VIDEO, MIME_VIDEO_VND_RN_REALVIDEO, "video/vnd.rn-realvideo"}, + {"avi", MIME_MAINTYPE_VIDEO, MIME_VIDEO_AVI, "video/avi"}, + {"asf", MIME_MAINTYPE_VIDEO, MIME_VIDEO_X_MS_ASF, "video/x-ms-asf"}, + {"mov", MIME_MAINTYPE_VIDEO, MIME_VIDEO_MOV, "video/quicktime"}, + + //application + {"smil", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_SMIL, "application/smil"}, + {"rm", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_RN_REALMEDIA, "application/vnd.rn-realmedia"}, + {"ram", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_RAM, "application/ram"}, + {"ppt", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_POWERPOINT, "application/vnd.ms-powerpoint"}, + {"xls", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_EXCEL, "application/vnd.ms-excel"}, + {"doc", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_MSWORD, "applcation/vnd.ms-word"}, + {"pdf", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_PDF, "application/pdf"}, + {"swf", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_X_FLASH, "application/x-shockwave-flash"}, + {"dm", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_OMA_DRM_MESSAGE, "application/vnd.oma.drm.message"}, + {"dcf", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_OMA_DRM_CONTENT, "application/vnd.oma.drm.content"}, + {"dd", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_OMA_DD_XML, "application/vnd.oma.dd+xml"}, + {"ro", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_OMA_DRM_RIGHTS_XML, "application/vnd.oma.drm.rights+xml"}, + {"ro", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_OMA_DRM_RIGHTS_WBXML, "application/vnd.oma.drm.rights+wbxml"}, + {"oro", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_OMA_DRM_RO_XML, "application/vnd.oma.drm.ro+xml"}, + {"odf", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_OMA_DRM_DCF, "application/vnd.oma.drm.dcf"}, +}; -/* - * This function checks main type of a MIME. - * - * @param mime [in] Enumeration number for a MIME type. - * @return This function returns application type of a MIME. - */ -MimeAppType MimeGetAppTypeFromInt(MimeType mime) +//GetMimeType from File Extension +bool MmsGetMimeTypeFromExt(MimeMainType mainType, const char *pExt, MimeType *pMimeType, const char **ppszMimeType) { - int index; - - index = __MimeGetTableIndexInt(mime); - if (index == MIME_UNKNOWN) - return MIME_APPLICATION_NONE; - - return mimeTable[index].appType; -} + const ExtTableItem *matchedItem = NULL; -/* - * This function checks main type of a MIME. - * - * @param mime [in] MIME string. - * @return This function returns application type of a MIME. - */ -MimeAppType MimeGetAppTypeFromString(const char *szMime) -{ - int index; + if (pExt == NULL) + return false; - index = __MimeGetTableIndexString(szMime); - if (index == MIME_UNKNOWN) - return MIME_APPLICATION_NONE; + if (pMimeType == NULL && ppszMimeType == NULL) + return false; - return mimeTable[index].appType; -} + int extTableMainSize = sizeof(extTable)/sizeof(ExtTableItem);; + for (int i = 0; i < extTableMainSize; i++) { -/* - * This function returns a application type for a specified Extension. - * - * @param mime [in] Extension string. - * @return This function returns application type. - */ -MimeAppType MimeGetAppTypeFromExtString(const char *szExt) -{ - int i; + if (strcasecmp(extTable[i].szExt, pExt) == 0) { - for (i = 0; i < EXT_MAX; i++) { - if (!strcasecmp( extTable[i].szExt, szExt)) { - int index; + matchedItem = &extTable[i]; - index = __MimeGetTableIndexInt(extTable[i].mimeType); - if (index == MIME_UNKNOWN) - return MIME_APPLICATION_NONE; - return mimeTable[index].appType; + if (mainType == extTable[i].mainType) { + break; + } } } - return MIME_APPLICATION_NONE; -} + if (matchedItem) { + MSG_DEBUG("Found ext = [%s], mainType = [%d], mimeType = [0x%04x], ContentType = [%s]" + , matchedItem->szExt + , matchedItem->mainType + , matchedItem->enumMime + , matchedItem->szContentType); -/* - * This function gets the representative mime type from MimeType - * - * @param mime [in] Enumeration number for a MIME type. - * @return representative mime type Enumeration number - */ + if (pMimeType) + *pMimeType = (MimeType)matchedItem->enumMime; -MimeType MimeGetContentTypeFromInt(MimeType mime) -{ - int index; + if (ppszMimeType) + *ppszMimeType = matchedItem->szContentType; - for (index = 0; index < MIME_MAX_NUM; index++) { - if (mime == mimeTable[index].mime) - return mimeTable[index].contentType; + return true; } - return MIME_UNKNOWN; + return false; } -/* - * This function gets the representative mime type from mime string - * - * @param szMime - string name of MimeType - * @return representative mime type Enumeration number - */ - -MimeType MimeGetContentTypeFromString(const char *szMime) -{ - int index; - - for (index = 0; index < MIME_MAX_NUM; index++) { - if (!strcasecmp(szMime, mimeTable[index].szMIME)) - return mimeTable[index].contentType; - } - - return MIME_UNKNOWN; -} - -/* - * This function gets the index from mime string - * - * @param szMime - string name of MimeType - * @return Enumeration number for a MIME type. - */ - -MimeType MimeGetMimeTypeFromString(const char *szMime) +bool MmsGetMimeTypeFromFileName(MimeMainType mainType, const char *pFileName, MimeType *pMimeType, const char **ppszMimeType) { - int index; - - for (index = 0; index < MIME_MAX_NUM; index++) { - if (!strcasecmp(szMime, mimeTable[index].szMIME)) - return mimeTable[index].mime; - } + const char *pExt = NULL; - return MIME_UNKNOWN; -} - - -int MsgGetCode(MsgHeaderField tableId, char *pStr) -{ - int cCode = 0; - int nNum = MSG_FIELD_UNKNOWN; - char **pTable = NULL; - - switch (tableId) { - case MSG_FIELD: - nNum = MSG_FIELD_NUM; - pTable = (char **)szMsgField; - break; - - case MSG_PARAM: - nNum = MSG_PARAM_NUM; - pTable = (char **)szMsgParam; - break; - - case MSG_TYPE: - return MimeGetMimeIntFromMimeString(pStr); - - case MSG_CHARSET: - nNum = MSG_CHARSET_NUM; - pTable = (char **)szMsgCharset; - break; - - case MSG_ENCODING: - nNum = MSG_ENCODING_NUM; - pTable = (char **)szMsgEncoding; - break; - - case MSG_DISPOSITION: - nNum = MSG_DISPOSITION_NUM; - pTable = (char **)szMsgDisposition; - break; - - case MSG_ADDR_TYPE: - nNum = MSG_ADDR_TYPE_NUM; - pTable = (char **)szMsgAddrType; - break; - - default: - break; - } - - for (cCode = 0; cCode < nNum; cCode++) { - if (!strcasecmp(pStr, pTable[cCode])) { - return cCode; - } - } - - return -1; -} - - -char *MsgGetString(MsgHeaderField tableId, int code) -{ - int nNum = MSG_FIELD_UNKNOWN; - char **pTable = NULL; - - switch (tableId) { - case MSG_FIELD: - nNum = MSG_FIELD_NUM; - pTable = (char **)szMsgField; - break; - - case MSG_PARAM: - nNum = MSG_PARAM_NUM; - pTable = (char **)szMsgParam; - break; - - case MSG_TYPE: - if (code != MIME_UNKNOWN && code != -1) - return MimeGetMimeStringFromMimeInt(code); - else - return (char *)MSG_UNKNOWN_TYPE_STRING; - - case MSG_CHARSET: - nNum = MSG_CHARSET_NUM; - pTable = (char **)szMsgCharset; - break; - - case MSG_ENCODING: - nNum = MSG_ENCODING_NUM; - pTable = (char **)szMsgEncoding; - break; - - case MSG_DISPOSITION: - nNum = MSG_DISPOSITION_NUM; - pTable = (char **)szMsgDisposition; - break; - - case MSG_ADDR_TYPE: - nNum = MSG_ADDR_TYPE_NUM; - pTable = (char **)szMsgAddrType; - break; - - default: - break; - } - - if (code < 0 || code >= nNum || !pTable) - return (char *)MSG_UNKNOWN_TYPE_STRING; - - return pTable[code]; -} + if (pFileName == NULL) + return false; -char *_MsgSkipWS3(char *s) -{ - while (true) { - if ((*s == MSG_CH_CR) || - (*s == MSG_CH_LF) || - (*s == MSG_CH_SP) || - (*s == MSG_CH_TAB)) - ++s; - else - return s; - } -} + if (pMimeType == NULL && ppszMimeType == NULL) + return false; + pExt = strrchr(pFileName, '.'); -int _MsgGetCode(MsgHeaderField tableId, char *pStr) -{ - int cCode = 0; - int nNum = MSG_FIELD_UNKNOWN; - char **pTable = NULL; - - switch (tableId) { - case MSG_FIELD: - nNum = MSG_FIELD_NUM; - pTable = (char **)szMsgField; - break; - - case MSG_PARAM: - nNum = MSG_PARAM_NUM; - pTable = (char **)szMsgParam; - break; - - case MSG_TYPE: - return MimeGetMimeIntFromMimeString(pStr); - - case MSG_CHARSET: - nNum = MSG_CHARSET_NUM; - pTable = (char **)szMsgCharset; - break; - - case MSG_ENCODING: - nNum = MSG_ENCODING_NUM; - pTable = (char **)szMsgEncoding; - break; - - case MSG_DISPOSITION: - nNum = MSG_DISPOSITION_NUM; - pTable = (char **)szMsgDisposition; - break; - - case MSG_ADDR_TYPE: - nNum = MSG_ADDR_TYPE_NUM; - pTable = (char **)szMsgAddrType; - break; - - default: - MSG_DEBUG("_MsgGetCode: Invalid tableId [%d] \n", tableId); - break; - } + if (pExt == NULL || *(pExt + 1) == '\0') + return false; - for (cCode = 0; cCode < nNum; cCode++) { - if (pTable[cCode] != NULL) { - if (!strcasecmp( pStr, pTable[cCode])) { - return cCode; - } - } - } + pExt = pExt + 1; - return INVALID_HOBJ; + return MmsGetMimeTypeFromExt(mainType, pExt, pMimeType, ppszMimeType); } - diff --git a/plugin/mms_plugin/MmsPluginMain.cpp b/plugin/mms_plugin/MmsPluginMain.cpp index ead9151..21e7b6e 100755 --- a/plugin/mms_plugin/MmsPluginMain.cpp +++ b/plugin/mms_plugin/MmsPluginMain.cpp @@ -1,23 +1,25 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include #include "MsgException.h" #include "MsgGconfWrapper.h" #include "MsgUtilFile.h" +#include "MsgMmsMessage.h" +#include "MsgSerialize.h" #include "MmsPluginDebug.h" #include "MmsPluginTypes.h" #include "MmsPluginMain.h" @@ -76,7 +78,7 @@ msg_error_t MmsInitialize() MSG_BEGIN(); // remove temp files - MsgMmsInitDir(); + //MsgMmsInitDir(); MSG_END(); @@ -114,6 +116,10 @@ msg_error_t MmsSubmitRequest(MSG_REQUEST_INFO_S *pReqInfo) MmsPluginTransport::instance()->submitRequest(pReqInfo); } catch (MsgException& e) { MSG_FATAL("%s", e.what()); + + if (e.errorCode() == MsgException::REQ_EXIST_ERROR) + return MSG_SUCCESS; + return MSG_ERR_PLUGIN_TRANSPORT; } catch (exception& e) { MSG_FATAL("%s", e.what()); @@ -140,7 +146,7 @@ msg_error_t MmsAddMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *p return MSG_ERR_PLUGIN_TRANSPORT; } - //MSG_END(); + MSG_END(); return MSG_SUCCESS; } @@ -175,14 +181,15 @@ msg_error_t MmsUpdateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S msg_error_t err = MSG_SUCCESS; try { - if (pMsgInfo->networkStatus == MSG_NETWORK_NOT_SEND || pMsgInfo->networkStatus == MSG_NETWORK_SENDING) { + if (pMsgInfo->networkStatus == MSG_NETWORK_NOT_SEND || pMsgInfo->networkStatus == MSG_NETWORK_SENDING) { //draft update err = MmsPluginStorage::instance()->updateMessage(pMsgInfo, pSendOptInfo, pFileData); + } else { //[Update Message ID & File path only in case of retrieve. Else update Message ID] - if (pMsgInfo->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsgInfo->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) { + if (pMsgInfo->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsgInfo->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) { //retrieve conf err = MmsPluginStorage::instance()->updateConfMessage(pMsgInfo); } else { - err = MmsPluginStorage::instance()->updateMsgServerID(pMsgInfo, pSendOptInfo); + err = MmsPluginStorage::instance()->updateMsgServerID(pMsgInfo, pSendOptInfo); //update send conf } } } catch (MsgException& e) { @@ -199,14 +206,14 @@ msg_error_t MmsUpdateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S } -msg_error_t MmsGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg) +msg_error_t MmsGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char **pDestMsg) { MSG_BEGIN(); msg_error_t err = MSG_SUCCESS; try { - err = MmsPluginStorage::instance()->plgGetMmsMessage(pMsg, pSendOptInfo, pDestMsg); + err = MmsPluginStorage::instance()->getMessage(pMsg, pSendOptInfo, pDestMsg); } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_PLUGIN_STORAGE; @@ -279,7 +286,7 @@ msg_error_t MmsComposeReadReport(MSG_MESSAGE_INFO_S *pMsgInfo) return MSG_SUCCESS; } - +//FIXME::It used for kies but not now msg_error_t MmsRestoreMsg(MSG_MESSAGE_INFO_S *pMsgInfo, char *pRcvBody, int rcvdBodyLen, char *filePath) { MSG_BEGIN(); @@ -303,7 +310,7 @@ msg_error_t MmsRestoreMsg(MSG_MESSAGE_INFO_S *pMsgInfo, char *pRcvBody, int rcvd MSG_DEBUG(":::%d :%s ",rcvdBodyLen, pRcvBody); if (filePath) { - snprintf(filePath, MAX_FULL_PATH_SIZE, MSG_DATA_PATH"BODY_%lu.DATA", random() % 1000000000 + 1); + snprintf(filePath, MAX_FULL_PATH_SIZE, "%sBODY_%lu.DATA", MSG_DATA_PATH, random() % 1000000000 + 1); } else { return MSG_ERR_NULL_POINTER; } diff --git a/plugin/mms_plugin/MmsPluginMessage.cpp b/plugin/mms_plugin/MmsPluginMessage.cpp index 17b223d..7aee565 100755 --- a/plugin/mms_plugin/MmsPluginMessage.cpp +++ b/plugin/mms_plugin/MmsPluginMessage.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include @@ -31,11 +31,11 @@ #include "MmsPluginDebug.h" #include "MmsPluginMessage.h" #include "MmsPluginMIME.h" -#include "MmsPluginAvCodec.h" #include "MmsPluginStorage.h" -#include "MmsPluginSMILValidate.h" -#include "MmsPluginSmil.h" #include "MmsPluginUtil.h" +#include "MmsPluginTcs.h" +#include "MsgSmil.h" +#include "MmsPluginAppBase.h" #define PRINT_KEY_VAL_STR(key, val)\ if (val) {\ @@ -48,71 +48,78 @@ MSG_DEBUG("%-20s: %d", key, val);\ }\ static MsgMultipart *MmsGetNthMultipart(MmsMsg *pMsg, int index); +static MsgMultipart *MmsMakeMultipart(MimeType mimeType, char *szTitleName, char *szOrgFilePath, char *szContentID, char *szContentLocation); static bool MmsSetMsgAddressList(MmsAttrib *pAttrib, const MSG_MESSAGE_INFO_S *pMsgInfo); static char *MmsComposeAddress(const MSG_MESSAGE_INFO_S *pMsgInfo, int recipientType); -static bool MmsGetSmilRawData(MMS_MESSAGE_DATA_S *pMsgBody, char *pRawData, int *nSize); static bool MmsInsertPresentation(MmsMsg *pMsg, MimeType mimeType, const char *content_id, char *pData, int size); -static bool MmsInsertPartFromFile(MmsMsg *pMsg, char *szTitleName, char *szOrgFilePath, char *szContentID); static bool MmsInsertPartFromMultipart(MmsMsg *pMsg, MMS_MULTIPART_DATA_S *pNewMultipart); -static bool MmsGetTypeByFileName(int *type, char *szFileName); static bool MmsInsertPartToMmsData(MMS_MESSAGE_DATA_S *pMsgData, MMS_MULTIPART_DATA_S *pMultipart); +static bool MmsInsertMixedPartToMmsData(MMS_MESSAGE_DATA_S *pMsgData, MMS_MULTIPART_DATA_S *pMultipart); +static void printMmsAttribute(MmsAttrib *pAttrib); -bool MmsSetMsgAddressList(MmsAttrib *pAttrib, const MSG_MESSAGE_INFO_S * pMsgInfo) -{ - MSG_DEBUG("MmsSetMsgAddressList"); - pAttrib->szTo = MmsComposeAddress(pMsgInfo, MSG_RECIPIENTS_TYPE_TO); - MSG_DEBUG("To address: %s", pAttrib->szTo); - pAttrib->szCc = MmsComposeAddress(pMsgInfo, MSG_RECIPIENTS_TYPE_CC); - MSG_DEBUG("Cc address: %s", pAttrib->szCc); - pAttrib->szBcc = MmsComposeAddress(pMsgInfo, MSG_RECIPIENTS_TYPE_BCC); - MSG_DEBUG("Bcc address: %s", pAttrib->szBcc); +bool convertMediaToMultipart(MMS_MEDIA_S *pSrcMedia, MMS_MULTIPART_DATA_S *pDestMultipart); +bool convertAttachToMultipart(MMS_ATTACH_S *pSrcMedia, MMS_MULTIPART_DATA_S *pDestMultipart); +MMSList * MmsConvertAddressToNewStyle(const char *szAddr); +char *MmsConvertAddressToOldStyle(MMSList *pAddressList); - return true; +void printMmsAttribute(MmsAttrib *pAttrib) +{ + MSG_ERR_RET_M(pAttrib == NULL, "attribute is NULL"); + + MSG_DEBUG("# LeaveCopy [%d]", pAttrib->bLeaveCopy); + MSG_DEBUG("# DeliveryTime type [%d], time [%d]", pAttrib->deliveryTime.type, pAttrib->deliveryTime.time); + MSG_DEBUG("# ExpiryTime type [%d], time [%d]", pAttrib->expiryTime.type, pAttrib->expiryTime.time); + MSG_DEBUG("# Priority [%d]", pAttrib->priority); + MSG_DEBUG("# AskDeliveryReport [%d]", pAttrib->bAskDeliveryReport); + MSG_DEBUG("# AskReadReply [%d]", pAttrib->bAskReadReply); } -void MmsSetMsgMultiStatus(MmsAttrib *pAttrib, const MSG_MESSAGE_INFO_S *pMsgInfo) +bool MmsSetMsgAddressList(MmsAttrib *pAttrib, const MSG_MESSAGE_INFO_S * pMsgInfo) { - int nAddressCnt = 0; + MSG_BEGIN(); - nAddressCnt = pMsgInfo->nAddressCnt; + pAttrib->szTo = MmsComposeAddress(pMsgInfo, MSG_RECIPIENTS_TYPE_TO); + if (pAttrib->szTo) { + MSG_SEC_DEBUG("To address: %s", pAttrib->szTo); + } - for (int i = 0; i < nAddressCnt; ++i) { - pAttrib->pMultiStatus = (MmsMsgMultiStatus *)malloc(sizeof(MmsMsgMultiStatus)); - - memset(pAttrib->pMultiStatus->szTo, 0, MAX_ADDRESS_VAL_LEN + 1); - strncpy(pAttrib->pMultiStatus->szTo, pMsgInfo->addressList[i].addressVal, MAX_ADDRESS_VAL_LEN); - - MSG_DEBUG("### pMultistatus->szTo = %s ####", pAttrib->pMultiStatus->szTo); - pAttrib->pMultiStatus->bDeliveryReportIsRead = false; - pAttrib->pMultiStatus->bDeliveyrReportIsLast = false; - pAttrib->pMultiStatus->msgStatus = MMS_MSGSTATUS_NONE; - pAttrib->pMultiStatus->handledTime = 0; - pAttrib->pMultiStatus->bReadReplyIsRead = false; - pAttrib->pMultiStatus->bReadReplyIsLast = false; - pAttrib->pMultiStatus->readStatus = MMS_READSTATUS_NONE; - pAttrib->pMultiStatus->readTime = 0; - - pAttrib->pMultiStatus = pAttrib->pMultiStatus->pNext; + pAttrib->szCc = MmsComposeAddress(pMsgInfo, MSG_RECIPIENTS_TYPE_CC); + if (pAttrib->szCc) { + MSG_SEC_DEBUG("Cc address: %s", pAttrib->szCc); + } + + pAttrib->szBcc = MmsComposeAddress(pMsgInfo, MSG_RECIPIENTS_TYPE_BCC); + if (pAttrib->szBcc) { + MSG_SEC_DEBUG("Bcc address: %s", pAttrib->szBcc); } + + MSG_END(); + return true; } char *MmsComposeAddress(const MSG_MESSAGE_INFO_S *pMsgInfo, int recipientType) { - MSG_DEBUG("MmsComposeAddress"); + MSG_BEGIN(); int addrLen = 0; int nAddressCnt = 0; int nRecpCnt = 0; char pString[MSG_LOCALE_NAME_LEN + MSG_ADDR_LEN + 3] = {0, }; char *szCompose; + const char *typePlmn = "/TYPE=PLMN"; nAddressCnt = pMsgInfo->nAddressCnt; // Calculate allocated buffer size for (int i = 0; i < nAddressCnt; ++i) { - MSG_DEBUG("recipientType: %d, address value: %s", pMsgInfo->addressList[i].recipientType, pMsgInfo->addressList[i].addressVal); + + MSG_SEC_DEBUG("recipientType: %d, address value: %s", pMsgInfo->addressList[i].recipientType, pMsgInfo->addressList[i].addressVal); + + if (pMsgInfo->addressList[i].recipientType == MSG_RECIPIENTS_TYPE_UNKNOWN) + pMsgInfo->addressList[i].recipientType = MSG_RECIPIENTS_TYPE_TO; + if (pMsgInfo->addressList[i].recipientType == recipientType) { if (pMsgInfo->addressList[i].addressType == MSG_ADDRESS_TYPE_PLMN) { - addrLen += strlen(MsgGetString(MSG_ADDR_TYPE, MSG_ADDR_TYPE_PHONE)); + addrLen += strlen(typePlmn); addrLen += strlen(pMsgInfo->addressList[i].addressVal); } else if (pMsgInfo->addressList[i].addressType == MSG_ADDRESS_TYPE_EMAIL) { addrLen += strlen(pMsgInfo->addressList[i].addressVal); @@ -131,49 +138,23 @@ char *MmsComposeAddress(const MSG_MESSAGE_INFO_S *pMsgInfo, int recipientType) for (int i = 0; i < nAddressCnt; ++i) { if (pMsgInfo->addressList[i].recipientType == recipientType) { if (strlen(szCompose) > 0) - strcat(szCompose, MSG_STR_ADDR_DELIMETER); + g_strlcat(szCompose, MSG_STR_ADDR_DELIMETER, addrLen + 1); memset(pString, 0x00, (MSG_LOCALE_NAME_LEN + MSG_ADDR_LEN + 3) * sizeof(char)); if (pMsgInfo->addressList[i].addressType == MSG_ADDRESS_TYPE_PLMN) { - snprintf(pString, MSG_LOCALE_NAME_LEN + MSG_ADDR_LEN + 3, "%s%s", pMsgInfo->addressList[i].addressVal, MsgGetString(MSG_ADDR_TYPE, MSG_ADDR_TYPE_PHONE)); + snprintf(pString, MSG_LOCALE_NAME_LEN + MSG_ADDR_LEN + 3, "%s%s", pMsgInfo->addressList[i].addressVal, typePlmn); MSG_DEBUG("%s", pString); } else if (pMsgInfo->addressList[i].addressType == MSG_ADDRESS_TYPE_EMAIL) { snprintf(pString, MSG_LOCALE_NAME_LEN + MSG_ADDR_LEN + 3, "%s", pMsgInfo->addressList[i].addressVal); } else ; // Need to consider IPV4, IPV6, and Alias formatted address - strcat(szCompose, pString); + g_strlcat(szCompose, pString, addrLen + 1); } } - return szCompose; -} - - -bool MmsGetMsgBodyfromMsgInfo(const MSG_MESSAGE_INFO_S *pMsgInfo, MMS_MESSAGE_DATA_S *pMsgBody, char *pFileData) -{ - MSG_DEBUG("MmsGetMsgBodyfromMsgInfo"); - memset(pMsgBody, 0, sizeof(MMS_MESSAGE_DATA_S)); - - if (pMsgInfo->bTextSms == false) { //if the message body was stored in file. - _MsgMmsDeserializeMessageData(pMsgBody, pFileData); - } - - return true; -} - -bool MmsGetSmilRawData(MMS_MESSAGE_DATA_S *pMsgBody, char **pRawdata) -{ - MSG_BEGIN(); - - if (MsgReadSmilFile(pMsgBody->szSmilFilePath, pRawdata) < 0) - return false; - - MsgDeleteSmilFile(pMsgBody->szSmilFilePath); - MSG_END(); - - return true; + return szCompose; } bool MmsInsertPresentation(MmsMsg *pMsg, MimeType mimeType, const char *content_id, char *pData, int size) @@ -234,214 +215,12 @@ __CATCH: return false; } -bool MmsInsertPartFromFile(MmsMsg *pMsg, char *szTitleName, char *szOrgFilePath, char *szContentID) -{ - MSG_DEBUG("MmsInsertPartFromFile"); - - MsgMultipart *pMultipart = NULL; - MsgMultipart *pLastPart = NULL; - int nFileSize; - MimeType mimeType = MIME_UNKNOWN; - char *pExt = NULL; - - pExt = strrchr(szOrgFilePath, '.'); - - if (pExt == NULL || pExt[0] == '\0' || strrchr(pExt, '/')) - mimeType = MIME_UNKNOWN; - else { - if (strcasecmp(pExt, ".dcf") == 0) - mimeType = MIME_APPLICATION_VND_OMA_DRM_CONTENT; - else { - if (MmsGetTypeByFileName((int *)&mimeType, szOrgFilePath) == false) - goto __CATCH; - } - } - - MSG_DEBUG("MmsInsertPartFromFile: type = %d, name = %s, filepath = %s, cid = %s", mimeType, szTitleName, szOrgFilePath, szContentID); - - if (mimeType == MIME_UNKNOWN) - mimeType = MIME_APPLICATION_OCTET_STREAM; - - if (MmsIsMultipart(pMsg->msgType.type) == true) { - /* Insert as a multipart */ - if (MsgGetFileSize(szOrgFilePath, &nFileSize) == false) { - MSG_DEBUG("MsgGetFileSize: failed"); - goto __CATCH; - } - - pMultipart = MmsMakeMultipart(mimeType, szTitleName, szOrgFilePath, szContentID, NULL); - if (pMultipart == NULL) - goto __CATCH; - - if (pMsg->mmsAttrib.contentType == MIME_APPLICATION_VND_WAP_MULTIPART_MIXED || - pMsg->mmsAttrib.contentType == MIME_MULTIPART_MIXED) - pMultipart->type.disposition = MSG_DISPOSITION_ATTACHMENT; - - if (pMsg->msgBody.body.pMultipart == NULL) { - pMsg->msgBody.body.pMultipart = pMultipart; - } else { - pLastPart = pMsg->msgBody.body.pMultipart; - while (pLastPart->pNext) { - pLastPart = pLastPart->pNext; - } - - pLastPart->pNext = pMultipart; - } - - pMsg->msgBody.size += pMultipart->pBody->size; - pMsg->msgType.contentSize += pMultipart->pBody->size; - } else { - /* Single part - Insert as a message body */ - if (pMsg->mmsAttrib.contentType != mimeType || pMsg->msgType.type != mimeType) - goto __CATCH; - - strncpy(pMsg->msgType.param.szName, szTitleName, MSG_LOCALE_FILENAME_LEN_MAX); - - if (MmsIsText(pMsg->msgType.type) == true) { - pMsg->msgType.param.charset = MSG_CHARSET_UTF8; - } - - strncpy(pMsg->msgBody.szOrgFilePath, szOrgFilePath, MSG_FILEPATH_LEN_MAX - 1); - if (MsgGetFileSize(szOrgFilePath, &nFileSize) == false) { - MSG_DEBUG("MsgGetFileSize: failed"); - goto __CATCH; - } - - pMsg->msgBody.offset = 0; - pMsg->msgBody.size = nFileSize; - pMsg->msgType.contentSize = nFileSize; - } - - pMsg->nPartCount++; - - return true; - -__CATCH: - return false; - -} - -bool MmsIsMultipart(int type) -{ - MSG_DEBUG("MmsIsMultipart"); - if (type == MIME_MULTIPART_RELATED || - type == MIME_APPLICATION_VND_WAP_MULTIPART_MIXED || - type == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED || - type == MIME_APPLICATION_VND_WAP_MULTIPART_ASTERIC || - type == MIME_MULTIPART_MIXED || - type == MIME_MULTIPART_REPORT) { - return true; - } else { - return false; - } -} - -bool MmsIsText(int type) -{ - if (type == MIME_TEXT_PLAIN || - type == MIME_TEXT_HTML || - type == MIME_TEXT_VND_WAP_WML || - type == MIME_TEXT_X_VCARD || - type == MIME_TEXT_X_VCALENDAR || - type == MIME_TEXT_X_VNOTE || - type == MIME_APPLICATION_SMIL || - type == MIME_TEXT_X_IMELODY) { - MSG_DEBUG("MmsIsText true."); - return true; - } else { - MSG_DEBUG("MmsIsText false."); - return false; - } -} - -bool MmsIsVitemContent (int type, char *pszName) -{ - switch (type) { - -/* -* To make Encoding information right. -* case MIME_TEXT_X_VCARD : -* case MIME_TEXT_X_VCALENDAR : -* case MIME_TEXT_X_VNOTE : // vnt -* { -* MSG_DEBUG("MmsIsVitemContent true."); -* return true; -* } -* -*/ - case MIME_TEXT_X_VCARD: - case MIME_TEXT_X_VCALENDAR: - case MIME_TEXT_X_VNOTE: // vnt - case MIME_TEXT_PLAIN: // vbm - It SHOULD be distinguished from a normal text file. - { - char *pszExt = NULL; - - if (!pszName) - break; - - // search file extension. - if ((pszExt = strrchr(pszName, '.')) == NULL) - break; - - if (!strcasecmp(pszExt, ".vbm")) { - MSG_DEBUG("MmsIsVitemContent true."); - return true; - } - } - break; - - default: - break; - } - - MSG_DEBUG("MmsIsVitemContent false."); - return false; -} - - - -MsgMultipart *MmsAllocMultipart(void) -{ - MsgMultipart *pMultipart = NULL; - - pMultipart = (MsgMultipart *)malloc(sizeof(MsgMultipart)); - - if (pMultipart == NULL) - goto __CATCH; - - pMultipart->pBody = (MsgBody *)malloc(sizeof(MsgBody)); - - if (pMultipart->pBody == NULL) - goto __CATCH; - - MmsInitMsgType(&pMultipart->type); - MmsInitMsgBody(pMultipart->pBody); - - pMultipart->pNext = NULL; - - return pMultipart; - -__CATCH: - - if (pMultipart) { - if (pMultipart->pBody) { - free(pMultipart->pBody); - pMultipart->pBody = NULL; - } - - free(pMultipart); - pMultipart = NULL; - } - - return NULL; -} - MsgMultipart *MmsMakeMultipart(MimeType mimeType, char *szTitleName, char *szOrgFilePath, char *szContentID, char *szContentLocation) { MsgMultipart *pMultipart = NULL; if ((pMultipart = MmsAllocMultipart()) == NULL) - return NULL; + goto __CATCH; pMultipart->type.type = mimeType; @@ -460,7 +239,7 @@ MsgMultipart *MmsMakeMultipart(MimeType mimeType, char *szTitleName, char *szOrg snprintf(pMultipart->type.szContentLocation, MSG_MSG_ID_LEN + 1, "%s", szContentLocation); } - if (MmsIsText(mimeType) == true) { + if (MmsIsTextType(mimeType) == true) { if (!MmsIsVitemContent (mimeType, pMultipart->type.param.szName)) { pMultipart->type.param.charset = MSG_CHARSET_UTF8; } @@ -471,85 +250,80 @@ MsgMultipart *MmsMakeMultipart(MimeType mimeType, char *szTitleName, char *szOrg if (szOrgFilePath) { strncpy(pMultipart->pBody->szOrgFilePath, szOrgFilePath, MSG_FILEPATH_LEN_MAX - 1); + strncpy(pMultipart->type.szOrgFilePath, szOrgFilePath, MSG_FILEPATH_LEN_MAX - 1); pMultipart->pBody->offset = 0; pMultipart->pBody->size = MsgGetFileSize(szOrgFilePath); } return pMultipart; + +__CATCH: + + return NULL; } -bool MmsGetTypeByFileName(int *type, char *szFileName) +void MmsComposeNotiMessage(MmsMsg *pMmsMsg, msg_message_id_t msgID) { - char *pExt = NULL; - AvCodecType AvType = AV_CODEC_NONE; + MSG_BEGIN(); - /* AVMS unknown or text/image file format identify type from file extention */ + struct tm *timeInfo = NULL; + time_t RawTime = 0; + time_t nTimeInSecs = 0; - pExt = strrchr(szFileName, '.'); - if (pExt == NULL || pExt[0] == '\0') - goto __CATCH; + MmsInitMsgAttrib(&pMmsMsg->mmsAttrib); + MmsInitMsgType(&pMmsMsg->msgType); + MmsInitMsgBody(&pMmsMsg->msgBody); - pExt++; + pMmsMsg->msgID = msgID; - if (strcasecmp(pExt, "mp4") == 0 || strcasecmp(pExt, "mpeg4") == 0 || - strcasecmp(pExt, "3gp") == 0 || strcasecmp(pExt, "3gpp") == 0) { - /* Audio / Video format. If file exists already, AvGetFileCodecType() can identify the format */ - if (szFileName[0] != '/') - goto __CATCH; + pMmsMsg->mmsAttrib.version = mmsHeader.version; - AvType = AvGetFileCodecType(szFileName); + // setting date + time(&RawTime); + timeInfo = localtime(&RawTime); + nTimeInSecs = mktime(timeInfo); + pMmsMsg->mmsAttrib.date = nTimeInSecs; - switch (AvType) { - case AV_DEC_AUDIO_MPEG4: - *type = MIME_AUDIO_MP4;//*type = MIME_AUDIO_3GPP; - break; + pMmsMsg->mmsAttrib.bReportAllowed = mmsHeader.reportAllowed; + pMmsMsg->mmsAttrib.bAskDeliveryReport = mmsHeader.deliveryReport; - case AV_DEC_VIDEO_MPEG4: - *type = MIME_VIDEO_MP4; - break; + MSG_DEBUG("######## Version = %d ########", pMmsMsg->mmsAttrib.version); - default: - *type = MIME_VIDEO_3GPP; - break; - } - return true; - } + strncpy(pMmsMsg->szTrID, mmsHeader.szTrID, MMS_TR_ID_LEN); + strncpy(pMmsMsg->szMsgID, mmsHeader.szMsgID, MMS_MSG_ID_LEN); + pMmsMsg->szForwardMsgID[0] = '\0'; - if (strcasecmp(pExt, "amr") == 0) { - *type = MIME_AUDIO_AMR; - return true; - } else if ((strcasecmp(pExt, "mid") == 0) || (strcasecmp(pExt, "midi") == 0)) { - *type = MIME_AUDIO_MIDI; - return true; - } else if (strcasecmp(pExt, "imy") == 0) { - *type = MIME_TEXT_X_IMELODY; - return true; + if (mmsHeader.pFrom) { + MmsAddrUtilRemovePlmnString(mmsHeader.pFrom->szAddr ); + strncpy(pMmsMsg->mmsAttrib.szFrom, mmsHeader.pFrom->szAddr, MSG_LOCALE_ADDR_LEN + 9); } - *type = MimeGetMimeFromExtInt((const char *)pExt); + strncpy(pMmsMsg->mmsAttrib.szSubject, mmsHeader.szSubject, MSG_LOCALE_SUBJ_LEN); + strncpy(pMmsMsg->szContentLocation, mmsHeader.szContentLocation, MMS_LOCATION_LEN); - return true; + pMmsMsg->mmsAttrib.msgClass = mmsHeader.msgClass; + pMmsMsg->mmsAttrib.msgSize = mmsHeader.msgSize; + pMmsMsg->mmsAttrib.expiryTime.type = mmsHeader.expiryTime.type; + pMmsMsg->mmsAttrib.expiryTime.time = mmsHeader.expiryTime.time; + pMmsMsg->mmsAttrib.dataType = MMS_DATATYPE_NOTIFY; + pMmsMsg->mmsAttrib.bRead = false; + pMmsMsg->mailbox = MSG_INBOX_ID; -__CATCH: + pMmsMsg->mmsAttrib.replyCharge.chargeType = mmsHeader.replyCharge.chargeType; + pMmsMsg->mmsAttrib.replyCharge.deadLine.type = mmsHeader.replyCharge.deadLine.type; + pMmsMsg->mmsAttrib.replyCharge.deadLine.time = mmsHeader.replyCharge.deadLine.time; + pMmsMsg->mmsAttrib.replyCharge.chargeSize = mmsHeader.replyCharge.chargeSize; - *type = MIME_UNKNOWN; - return false; + strncpy(pMmsMsg->mmsAttrib.replyCharge.szChargeID, mmsHeader.replyCharge.szChargeID, MMS_MSG_ID_LEN); + MSG_END(); } -bool MmsComposeMessage(MmsMsg *pMmsMsg, MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMsgData, char *pFileData) +void MmsComposeReadReportMessage(MmsMsg *pMmsMsg, const MSG_MESSAGE_INFO_S *pMsgInfo, msg_message_id_t selectedMsgId) { - MSG_BEGIN(); - - char *pRawData = NULL; - AutoPtr buf(&pRawData); - struct tm *timeInfo = NULL; time_t RawTime = 0; time_t nTimeInSecs = 0; - msg_error_t err = MSG_SUCCESS; - - // Initialize mmsMsg structure MmsInitMsgAttrib(&pMmsMsg->mmsAttrib); MmsInitMsgType(&pMmsMsg->msgType); MmsInitMsgBody(&pMmsMsg->msgBody); @@ -560,441 +334,76 @@ bool MmsComposeMessage(MmsMsg *pMmsMsg, MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDIN memset(pMmsMsg->szTrID, 0, MMS_TR_ID_LEN + 1); memset(pMmsMsg->szContentLocation, 0, MMS_LOCATION_LEN + 1); - memset(pMmsMsg->szMsgID, 0, MMS_MSG_ID_LEN + 1); memset(pMmsMsg->szForwardMsgID, 0, MMS_MSG_ID_LEN + 1); pMmsMsg->mmsAttrib.dataType = MMS_DATATYPE_DRAFT; - MSG_DEBUG("## delivery = %d ##", pSendOptInfo->bDeliverReq); - MSG_DEBUG("## read = %d ##", pSendOptInfo->option.mmsSendOptInfo.bReadReq); - MSG_DEBUG("## priority = %d ##", pSendOptInfo->option.mmsSendOptInfo.priority); - MSG_DEBUG("## expiryTime = %d ##", pSendOptInfo->option.mmsSendOptInfo.expiryTime.time); - - if (pSendOptInfo->bSetting == false) { - unsigned int expiryTime; - MSG_MMS_DELIVERY_TIME_T deliveryTime; - - pMmsMsg->mmsAttrib.priority = (MmsPriority)MsgSettingGetInt(MMS_SEND_PRIORITY); - - MsgSettingGetBool(MMS_SEND_DELIVERY_REPORT, &pMmsMsg->mmsAttrib.bAskDeliveryReport); - MsgSettingGetBool(MMS_SEND_READ_REPLY, &pMmsMsg->mmsAttrib.bAskReadReply); - MsgSettingGetBool(MSG_KEEP_COPY, &pMmsMsg->mmsAttrib.bLeaveCopy); - - expiryTime = (unsigned int)MsgSettingGetInt(MMS_SEND_EXPIRY_TIME); - - if (expiryTime == 0) - pMmsMsg->mmsAttrib.expiryTime.type = MMS_TIMETYPE_NONE; - else { - pMmsMsg->mmsAttrib.expiryTime.type = MMS_TIMETYPE_RELATIVE; - pMmsMsg->mmsAttrib.expiryTime.time = expiryTime; - } - - deliveryTime = (MSG_MMS_DELIVERY_TIME_T)MsgSettingGetInt(MMS_SEND_DELIVERY_TIME); - - if (deliveryTime == MSG_DELIVERY_TIME_CUSTOM) { - pMmsMsg->mmsAttrib.bUseDeliveryCustomTime = true; - - pMmsMsg->mmsAttrib.deliveryTime.type = MMS_TIMETYPE_RELATIVE; - pMmsMsg->mmsAttrib.deliveryTime.time = (unsigned int)MsgSettingGetInt(MMS_SEND_CUSTOM_DELIVERY); - } else { - pMmsMsg->mmsAttrib.bUseDeliveryCustomTime = false; - - pMmsMsg->mmsAttrib.deliveryTime.type = MMS_TIMETYPE_RELATIVE; - pMmsMsg->mmsAttrib.deliveryTime.time = (unsigned int)deliveryTime; - } - } else { - pMmsMsg->mmsAttrib.priority = (MmsPriority)pSendOptInfo->option.mmsSendOptInfo.priority; - pMmsMsg->mmsAttrib.bAskDeliveryReport = pSendOptInfo->bDeliverReq; - pMmsMsg->mmsAttrib.bAskReadReply = pSendOptInfo->option.mmsSendOptInfo.bReadReq; - pMmsMsg->mmsAttrib.expiryTime.type = pSendOptInfo->option.mmsSendOptInfo.expiryTime.type; - pMmsMsg->mmsAttrib.bLeaveCopy = pSendOptInfo->bKeepCopy; - - if (pMmsMsg->mmsAttrib.expiryTime.type != MMS_TIMETYPE_NONE) - pMmsMsg->mmsAttrib.expiryTime.time = pSendOptInfo->option.mmsSendOptInfo.expiryTime.time; - - pMmsMsg->mmsAttrib.bUseDeliveryCustomTime = pSendOptInfo->option.mmsSendOptInfo.bUseDeliveryCustomTime; - pMmsMsg->mmsAttrib.deliveryTime.type = pSendOptInfo->option.mmsSendOptInfo.deliveryTime.type; - pMmsMsg->mmsAttrib.deliveryTime.time = pSendOptInfo->option.mmsSendOptInfo.deliveryTime.time; - } - - MSG_DEBUG("pSendOptInfo->bSetting = %d", pSendOptInfo->bSetting); - MSG_DEBUG("pMmsMsg->mmsAttrib.bLeaveCopy = %d", pMmsMsg->mmsAttrib.bLeaveCopy); - MSG_DEBUG("pMmsMsg->mmsAttrib.bUseDeliveryCustomTime = %d", pMmsMsg->mmsAttrib.bUseDeliveryCustomTime); - MSG_DEBUG("pMmsMsg->mmsAttrib.deliveryTime.type = %d", pMmsMsg->mmsAttrib.deliveryTime.type); - MSG_DEBUG("pMmsMsg->mmsAttrib.deliveryTime.time = %d", pMmsMsg->mmsAttrib.deliveryTime.time); - - /* MMS-1.3-con-739 */ - pMmsMsg->mmsAttrib.msgClass = (MmsMsgClass)MsgSettingGetInt(MMS_SEND_MSG_CLASS); - /* MMS-1.3-con-739 */ -#ifdef MMS_13_CON_742_ENABLED - /* MMS-1.3-con-742 */ - pMmsMsg->mmsAttrib.deliveryTime.time = (unsigned int)MsgSettingGetInt(MMS_SEND_DELIVERY_TIME); - /* MMS-1.3-con-742 */ -#endif - - MSG_DEBUG("@@@ pMmsMsg->mmsAttrib.bAskDeliveryReport = %d @@@", pMmsMsg->mmsAttrib.bAskDeliveryReport); - MSG_DEBUG("@@@ pMmsMsg->mmsAttrib.bAskReadReply = %d @@@", pMmsMsg->mmsAttrib.bAskReadReply); - MSG_DEBUG("@@@ pMmsMsg->mmsAttrib.priority = %d @@@", pMmsMsg->mmsAttrib.priority); - // setting date time(&RawTime); timeInfo = localtime(&RawTime); nTimeInSecs = mktime(timeInfo); - pMmsMsg->mmsAttrib.date = nTimeInSecs; // todo: need to subtract timeline value to make GMT+0 time + pMmsMsg->mmsAttrib.date = nTimeInSecs; + + // setting szMsgId + MmsPluginStorage::instance()->getMmsMessageId(selectedMsgId, pMmsMsg); //setting subject - strcpy(pMmsMsg->mmsAttrib.szSubject, pMsgInfo->subject); + snprintf(pMmsMsg->mmsAttrib.szSubject, sizeof(pMmsMsg->mmsAttrib.szSubject), "%s", pMsgInfo->subject); //setting adddress MmsSetMsgAddressList(&pMmsMsg->mmsAttrib, pMsgInfo); - //MmsGetMsgBodyfromMsgInfo(pMsgInfo, pMsgData, pFileData); - int pageCnt = _MsgMmsGetPageCount(pMsgData); + if (pMmsMsg->mmsAttrib.szTo) + strncpy(pMmsMsg->mmsAttrib.szFrom, pMmsMsg->mmsAttrib.szTo, strlen(pMmsMsg->mmsAttrib.szTo)); +} + +msg_error_t MmsMakeMultipartThumbnailInfo(MMS_MULTIPART_DATA_S *pMultipart, char *thumbnail_path) +{ + if (pMultipart == NULL || thumbnail_path == NULL) + return MSG_ERR_NULL_POINTER; - if (pageCnt == 0) { // Multipart mixed - pMmsMsg->mmsAttrib.contentType = MIME_APPLICATION_VND_WAP_MULTIPART_MIXED; - pMmsMsg->msgType.type = MIME_APPLICATION_VND_WAP_MULTIPART_MIXED; - MmsMakePreviewInfo(pMsgInfo->msgId, pMsgData); - } else { // Multipart related +// if (MimeGetMainTypeString(MimeGetMimeStringFromMimeInt(pMultipart->type)) != MIME_MAINTYPE_VIDEO) +// return MSG_ERR_INVALID_PARAMETER; - int RawDataSize = 0; + char szFileName[MSG_FILENAME_LEN_MAX+1] = {0, }; + char szFileNameWoExt[MSG_FILENAME_LEN_MAX+1] = {0, }; + char thumbPath[MSG_FILEPATH_LEN_MAX+1] = {0, }; + char *pszExt = NULL; + char *pszOrgFileName = NULL; - time_t RawTime = 0; - time(&RawTime); - snprintf(pMsgData->szSmilFilePath, MSG_FILEPATH_LEN_MAX, "%lu", RawTime); + memset(szFileName, 0x00, MSG_FILENAME_LEN_MAX+1); + memset(thumbPath, 0x00, MSG_FILEPATH_LEN_MAX); - MsgMMSCreateSMIL(pMsgData); + MSG_DEBUG("drm type = %d, %s", pMultipart->drmType, pMultipart->szFilePath); - RawDataSize = MmsGetSmilRawData(pMsgData, &pRawData); - if (RawDataSize < 0) { - MSG_DEBUG("Smil file size is less than 0"); - return false; - } - MSG_DEBUG("%s", pRawData); - if (pRawData) - MmsInsertPresentation(pMmsMsg, MIME_APPLICATION_SMIL, NULL, pRawData, strlen(pRawData)); - - pMmsMsg->mmsAttrib.contentType = MIME_APPLICATION_VND_WAP_MULTIPART_RELATED; - pMmsMsg->msgType.type = MIME_APPLICATION_VND_WAP_MULTIPART_RELATED; - - for (int i = 0; i < pageCnt; ++i) { - MMS_PAGE_S *pPage = _MsgMmsGetPage(pMsgData, i); - int mediaCnt = pPage->mediaCnt; - MSG_DEBUG("PAGE %d's media Cnt: %d", i+1, mediaCnt); - - for (int j = 0; j < mediaCnt; ++j) { - MMS_MEDIA_S *pMedia = _MsgMmsGetMedia(pPage, j); - - switch (pMedia->mediatype) { - case MMS_SMIL_MEDIA_IMG: - case MMS_SMIL_MEDIA_VIDEO: - case MMS_SMIL_MEDIA_AUDIO: - case MMS_SMIL_MEDIA_TEXT: - if (pMedia->szFilePath[0] != 0) { - if (!MmsInsertPartFromFile(pMmsMsg, pMedia->szFileName, pMedia->szFilePath, pMedia->szContentID)) - return false; - } - break; + if (pMultipart->drmType == MSG_DRM_TYPE_NONE) { + pszOrgFileName = strrchr(pMultipart->szFilePath, '/'); + pszExt = strrchr(pMultipart->szFilePath, '.'); - default: - break; - } - } + if (NULL == pszOrgFileName || NULL == pszExt) { + MSG_DEBUG("Fail in getting filename without extension string"); + return MSG_ERR_PLUGIN_STORAGE; } - char szFileName[MSG_FILENAME_LEN_MAX+1] = {0, };; - snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%d.mms", pMsgInfo->msgId); + strncpy(szFileNameWoExt, pszOrgFileName + 1, strlen(pszOrgFileName + 1) - strlen(pszExt)); + snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "thumb_msg_%s", szFileNameWoExt); - MmsPluginStorage *pStorage = MmsPluginStorage::instance(); - err = pStorage->getMsgText(pMsgData, pMsgInfo->msgText); - MmsMakePreviewInfo(pMsgInfo->msgId, pMsgData); - } - -#ifdef FEATURE_JAVA_MMS - MSG_DEBUG("msgAppId: valid:%d appId:%s replyToAppId:%s", pMsgData->msgAppId.valid, pMsgData->msgAppId.appId, pMsgData->msgAppId.replyToAppId); - if (pMsgData->msgAppId.valid) { // check if msgAppId.valid is true, both appId and replytoappId must have a meaning data - if (pMsgData->msgAppId.appId[0] != 0) { - pMmsMsg->msgType.param.szApplicationID = (char *)malloc(strlen(pMsgData->msgAppId.appId) + 1); - if (pMmsMsg->msgType.param.szApplicationID == NULL) { - MSG_DEBUG("Error: out of Memory"); - return false; - } - memset(pMmsMsg->msgType.param.szApplicationID, 0, strlen(pMsgData->msgAppId.appId) + 1); + if (!strcasecmp(pszExt, ".png")) { + snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, MSG_THUMBNAIL_PATH"%s.png", szFileName); + } else { + snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, MSG_THUMBNAIL_PATH"%s.jpg", szFileName); + } - strcpy(pMmsMsg->msgType.param.szApplicationID, pMsgData->msgAppId.appId); + if (MmsMakeImageThumbnail(pMultipart->szFilePath, thumbPath) == true) { + memcpy(thumbnail_path, &thumbPath, strlen(thumbPath)); + MSG_DEBUG("Generated thumbnail: %s ", thumbnail_path); + return MSG_SUCCESS; + } else { + MSG_DEBUG("Fail of generating thumbnail: %s to %s", pMultipart->szFilePath, thumbPath); } + } - if (pMsgData->msgAppId.replyToAppId[0] != 0) { - pMmsMsg->msgType.param.szReplyToApplicationID = (char *)malloc(strlen(pMsgData->msgAppId.replyToAppId) + 1); - if (pMmsMsg->msgType.param.szReplyToApplicationID == NULL) { - MSG_DEBUG("Error: out of Memory"); - return false; - } - memset(pMmsMsg->msgType.param.szReplyToApplicationID, 0, strlen(pMsgData->msgAppId.replyToAppId) + 1); - - strcpy(pMmsMsg->msgType.param.szReplyToApplicationID, pMsgData->msgAppId.replyToAppId); - } - } -#endif - - //Processing Attachment List - for (int i = 0; i < _MsgMmsGetAttachCount(pMsgData); ++i) { - MMS_ATTACH_S *pMedia = _MsgMmsGetAttachment(pMsgData, i); - if (pMedia->szFilePath[0] != 0) { - if (!MmsInsertPartFromFile(pMmsMsg, pMedia->szFileName, pMedia->szFilePath, NULL)) { - free(pMedia); - return false; - } - } - } - - return true; -} - -void MmsComposeNotiMessage(MmsMsg *pMmsMsg, msg_message_id_t msgID) -{ - MSG_BEGIN(); - - struct tm *timeInfo = NULL; - time_t RawTime = 0; - time_t nTimeInSecs = 0; - - MmsInitMsgAttrib(&pMmsMsg->mmsAttrib); - MmsInitMsgType(&pMmsMsg->msgType); - MmsInitMsgBody(&pMmsMsg->msgBody); - - pMmsMsg->msgID = msgID; - - pMmsMsg->mmsAttrib.version = mmsHeader.version; - - // setting date - time(&RawTime); - timeInfo = localtime(&RawTime); - nTimeInSecs = mktime(timeInfo); - pMmsMsg->mmsAttrib.date = nTimeInSecs; - - pMmsMsg->mmsAttrib.bReportAllowed = mmsHeader.reportAllowed; - pMmsMsg->mmsAttrib.bAskDeliveryReport = mmsHeader.deliveryReport; - - MSG_DEBUG("######## Version = %d ########", pMmsMsg->mmsAttrib.version); - - strncpy(pMmsMsg->szTrID, mmsHeader.szTrID, MMS_TR_ID_LEN); - strncpy(pMmsMsg->szMsgID, mmsHeader.szMsgID, MMS_MSG_ID_LEN); - pMmsMsg->szForwardMsgID[0] = '\0'; - - if (mmsHeader.pFrom) { - MmsAddrUtilRemovePlmnString(mmsHeader.pFrom->szAddr ); - strncpy(pMmsMsg->mmsAttrib.szFrom, mmsHeader.pFrom->szAddr, MSG_LOCALE_ADDR_LEN + 9); - } - - strncpy(pMmsMsg->mmsAttrib.szSubject, mmsHeader.szSubject, MSG_LOCALE_SUBJ_LEN); - strncpy(pMmsMsg->szContentLocation, mmsHeader.szContentLocation, MMS_LOCATION_LEN); - - pMmsMsg->mmsAttrib.msgClass = mmsHeader.msgClass; - pMmsMsg->mmsAttrib.msgSize = mmsHeader.msgSize; - pMmsMsg->mmsAttrib.expiryTime.type = mmsHeader.expiryTime.type; - pMmsMsg->mmsAttrib.expiryTime.time = mmsHeader.expiryTime.time; - pMmsMsg->mmsAttrib.dataType = MMS_DATATYPE_NOTIFY; - pMmsMsg->mmsAttrib.bRead = false; - pMmsMsg->mailbox = MSG_INBOX_ID; - - pMmsMsg->mmsAttrib.replyCharge.chargeType = mmsHeader.replyCharge.chargeType; - pMmsMsg->mmsAttrib.replyCharge.deadLine.type = mmsHeader.replyCharge.deadLine.type; - pMmsMsg->mmsAttrib.replyCharge.deadLine.time = mmsHeader.replyCharge.deadLine.time; - pMmsMsg->mmsAttrib.replyCharge.chargeSize = mmsHeader.replyCharge.chargeSize; - - strncpy(pMmsMsg->mmsAttrib.replyCharge.szChargeID, mmsHeader.replyCharge.szChargeID, MMS_MSG_ID_LEN); - - MSG_END(); -} - -void MmsComposeReadReportMessage(MmsMsg *pMmsMsg, const MSG_MESSAGE_INFO_S *pMsgInfo, msg_message_id_t selectedMsgId) -{ - struct tm *timeInfo = NULL; - time_t RawTime = 0; - time_t nTimeInSecs = 0; - - MmsInitMsgAttrib(&pMmsMsg->mmsAttrib); - MmsInitMsgType(&pMmsMsg->msgType); - MmsInitMsgBody(&pMmsMsg->msgBody); - - // setting mmsMsg structure - pMmsMsg->mailbox = pMsgInfo->folderId; - pMmsMsg->msgID = pMsgInfo->msgId; - - memset(pMmsMsg->szTrID, 0, MMS_TR_ID_LEN + 1); - memset(pMmsMsg->szContentLocation, 0, MMS_LOCATION_LEN + 1); - memset(pMmsMsg->szForwardMsgID, 0, MMS_MSG_ID_LEN + 1); - - pMmsMsg->mmsAttrib.dataType = MMS_DATATYPE_DRAFT; - - // setting date - time(&RawTime); - timeInfo = localtime(&RawTime); - nTimeInSecs = mktime(timeInfo); - pMmsMsg->mmsAttrib.date = nTimeInSecs; - - // setting szMsgId - MmsPluginStorage::instance()->getMmsMessageId(selectedMsgId, pMmsMsg); - - //setting subject - strcpy(pMmsMsg->mmsAttrib.szSubject, pMsgInfo->subject); - - //setting adddress - MmsSetMsgAddressList(&pMmsMsg->mmsAttrib, pMsgInfo); - - if (pMmsMsg->mmsAttrib.szTo) - strncpy(pMmsMsg->mmsAttrib.szFrom, pMmsMsg->mmsAttrib.szTo, strlen(pMmsMsg->mmsAttrib.szTo)); -} - -bool MmsFindMatchedMedia(MMS_MESSAGE_DATA_S *pMsgData, char *pszFilePath) -{ - if (pMsgData == NULL || pszFilePath == NULL) - return false; - - if (pMsgData->pagelist) { - for (int pageIdx = 0; pageIdx < pMsgData->pageCnt; pageIdx++) { - MMS_PAGE_S *page = (MMS_PAGE_S *)g_list_nth_data(pMsgData->pagelist, pageIdx); - - if (page && page->medialist) { - for (int mediaIdx = 0; mediaIdx < page->mediaCnt; mediaIdx++) { - MMS_MEDIA_S *media = (MMS_MEDIA_S *)g_list_nth_data(page->medialist, mediaIdx); - if (media) { - if (strcmp(pszFilePath, media->szFilePath) == 0) - return true; - } - } - } - } - } - - return false; -} - -bool MmsCheckAdditionalMedia(MMS_MESSAGE_DATA_S *pMsgData, MsgType *partHeader) -{ - if (MmsFindMatchedMedia(pMsgData, partHeader->param.szFileName)) - return false; - else - return true; -} - -/*PIM objects SHALL be supported as attachments to an MM*/ -bool MmsRemovePims(MMS_MESSAGE_DATA_S *pMsgData) -{ - GList *cur_page = NULL; - GList *cur_media = NULL; - - if (pMsgData == NULL) - return false; - - cur_page = pMsgData->pagelist; - - while(cur_page) { - MMS_PAGE_S *page = (MMS_PAGE_S *)cur_page->data; - if (page) { - cur_media = page->medialist; - - while(cur_media) { - MMS_MEDIA_S *pMedia = (MMS_MEDIA_S *)cur_media->data; - if (pMedia) { - int tempType; - MsgGetTypeByFileName(&tempType, pMedia->szFilePath); - if (tempType == MIME_TEXT_X_VCALENDAR || tempType == MIME_TEXT_X_VCARD) { - page->medialist = g_list_remove_all(page->medialist, pMedia); - page->mediaCnt = g_list_length(page->medialist); - cur_media = page->medialist; - free(pMedia); - } else { - cur_media = g_list_next(cur_media); - } - } else { - cur_media = g_list_next(cur_media); - } - } //cur_media while for remove pims file in list - - if (page->medialist == NULL) {//remove empty page - pMsgData->pagelist = g_list_remove_all(pMsgData->pagelist, page); - pMsgData->pageCnt = g_list_length(pMsgData->pagelist); - cur_page = pMsgData->pagelist; - free(page); - } else { - cur_page = g_list_next(cur_page); - } - } - }//cur_page while - - - return true; -} - -msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg) -{ - MMS_PAGE_S *pPage = NULL; - MMS_MEDIA_S *pMedia = NULL; - - if (pMmsMsg == NULL) - return MSG_ERR_NULL_POINTER; - - MmsPluginStorage::instance()->removePreviewInfo(msgId); //remove exist previnfo - - if (pMmsMsg->pageCnt > 0) { - - MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_PAGE, (char *)"pagecount", pMmsMsg->pageCnt); - - pPage = _MsgMmsGetPage(pMmsMsg, 0); - for (int j = 0; j < pPage->mediaCnt; j++) { - - pMedia = _MsgMmsGetMedia(pPage, j); - MSG_DEBUG("pMedia's Name: %s", pMedia->szFilePath); - - if (pMedia->mediatype == MMS_SMIL_MEDIA_IMG || pMedia->mediatype == MMS_SMIL_MEDIA_VIDEO) { - char szFileName[MSG_FILENAME_LEN_MAX+1] = {0, }; - char thumbPath[MSG_FILEPATH_LEN_MAX+1] = {0, }; - char *pszExt = NULL; - - memset(szFileName, 0x00, MSG_FILENAME_LEN_MAX+1); - memset(thumbPath, 0x00, MSG_FILEPATH_LEN_MAX); - - snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%d.mms",msgId); - - if ((pszExt = strrchr(pMedia->szFilePath, '.')) != NULL && !strcasecmp(pszExt, ".png")) { - snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, MSG_THUMBNAIL_PATH"/%s.png", szFileName); - } else { - snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, MSG_THUMBNAIL_PATH"/%s.jpg", szFileName); - } - - if (pMedia->mediatype == MMS_SMIL_MEDIA_IMG) { - if (makeImageThumbnail(pMedia->szFilePath, thumbPath) == true) { - MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_IMG, thumbPath); - } else { - MSG_DEBUG("Fail of generating thumbnail: %s to %s", pMedia->szFilePath, thumbPath); - } - } else { - if (makeImageThumbnail(pMedia->szFilePath, thumbPath) == true) { - MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_VIDEO, thumbPath); - } else { - MSG_DEBUG("Fail of generating thumbnail: %s to %s", pMedia->szFilePath, thumbPath); - } - } - - } else if (pMedia->mediatype == MMS_SMIL_MEDIA_AUDIO) { - MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_AUDIO, pMedia->szFileName); - } - } - } else { - MSG_DEBUG("There is no page"); - } - - int attachCnt = _MsgMmsGetAttachCount(pMmsMsg); - if (attachCnt > 0) { - MMS_ATTACH_S *pAttach = _MsgMmsGetAttachment(pMmsMsg, 0); - MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_ATTACH, pAttach->szFileName, attachCnt); - } else { - MSG_DEBUG("There is no attachment"); - } - - return MSG_SUCCESS; + return MSG_ERR_PLUGIN_STORAGE; } void MmsPrintFileInfoForVLD(MMS_MESSAGE_DATA_S *pMmsMsg) @@ -1033,42 +442,34 @@ void MmsPrintFileInfoForVLD(MMS_MESSAGE_DATA_S *pMmsMsg) } } -MMS_MEDIA_S *MmsFindMediaWithCID(MMS_MESSAGE_DATA_S *pMsgData, const char *szContentID) +bool IsMatchedMedia(MMS_MEDIA_S *media, MMS_MULTIPART_DATA_S *pMultipart) { + if (strlen(pMultipart->szContentID) > 0) { - if (pMsgData == NULL || szContentID == NULL || strlen(szContentID) == 0) { - MSG_DEBUG("Invalid Parameter pMsgData = %p, szContentID = %p", pMsgData, szContentID); - return NULL; - } - - if (pMsgData->pagelist) { - for (int pageIdx = 0; pageIdx < pMsgData->pageCnt; pageIdx++) { - - MMS_PAGE_S *page = (MMS_PAGE_S *)g_list_nth_data(pMsgData->pagelist, pageIdx); - - if (page && page->medialist) { + char szTempContentID[MSG_MSG_ID_LEN + 1] = {0,}; + MmsRemoveLessGreaterChar(pMultipart->szContentID, szTempContentID, sizeof(szTempContentID)); - for (int mediaIdx = 0; mediaIdx < page->mediaCnt; mediaIdx++) { + if (strcmp(media->szContentID, szTempContentID) == 0) { + return true; + } - MMS_MEDIA_S *media = (MMS_MEDIA_S *)g_list_nth_data(page->medialist, mediaIdx); + if (strcmp(media->szContentLocation, szTempContentID) == 0) { + return true; + } + } - if (media) { - if (strcmp(media->szContentID, szContentID) == 0) { - MSG_DEBUG("Find media with Content ID [%s] from pMsgData", szContentID); - return media; - } + if (strlen(pMultipart->szContentLocation) > 0) { + if (strcmp(media->szContentID, pMultipart->szContentLocation) == 0) { + return true; + } - } else { - MSG_DEBUG("Error media NULL"); - return NULL; - } - } //end for media list - } - } //end for page list + if (strcmp(media->szContentLocation, pMultipart->szContentLocation) == 0) { + return true; + } } - MSG_DEBUG("Not exist Matched media with [%s]", szContentID); - return NULL; + MSG_DEBUG("There is not matched media cid [%s], cl, [%s], multipart cid [%s], cl, [%s]", media->szContentID, media->szContentLocation, pMultipart->szContentID, pMultipart->szContentLocation); + return false; } MsgMultipart *MmsGetNthMultipart(MmsMsg *pMsg, int index) @@ -1096,151 +497,175 @@ MsgMultipart *MmsGetNthMultipart(MmsMsg *pMsg, int index) return NULL; } -bool MmsInsertPartToMmsData(MMS_MESSAGE_DATA_S *pMsgData, MMS_MULTIPART_DATA_S *pMultipart) +bool MmsFindAndInsertPart(MMS_MESSAGE_DATA_S *pMsgData, MMS_MULTIPART_DATA_S *pMultipart) { - MMS_MEDIA_S * match_media = NULL; - bool isPimsFile = false; - int tempType;//MimeType + bool insert_media = false; - if (pMsgData == NULL || pMultipart == NULL) { - return false; - } + if (pMsgData->pagelist) { + for (int pageIdx = 0; pageIdx < pMsgData->pageCnt; pageIdx++) { - //for pims file add to attach - MsgGetTypeByFileName(&tempType, pMultipart->szFilePath); - if (tempType == MIME_TEXT_X_VCALENDAR || tempType == MIME_TEXT_X_VCARD) { - MSG_DEBUG("Pims File"); - isPimsFile = true; - } else { + MMS_PAGE_S *page = (MMS_PAGE_S *)g_list_nth_data(pMsgData->pagelist, pageIdx); + + if (page && page->medialist) { + + for (int mediaIdx = 0; mediaIdx < page->mediaCnt; mediaIdx++) { + + MMS_MEDIA_S *media = (MMS_MEDIA_S *)g_list_nth_data(page->medialist, mediaIdx); + + if (media) { // add media + if (IsMatchedMedia(media, pMultipart) == true) { //matched media - if (strlen(pMultipart->szContentID) > 0) { - char szTempContentID[MSG_MSG_ID_LEN + 1] = {0,}; - removeLessGreaterMark(pMultipart->szContentID, szTempContentID, sizeof(szTempContentID)); - match_media = MmsFindMediaWithCID(pMsgData, szTempContentID); +// if (media->mediatype == MMS_SMIL_MEDIA_IMG_OR_VIDEO) { // ref type is not insert part +// MSG_DEBUG("## Matched but media type is ref ##"); +// return false; +// } - if (match_media == NULL && strlen(pMultipart->szContentLocation) > 0 ) { - match_media = MmsFindMediaWithCID(pMsgData, pMultipart->szContentLocation); + insert_media = true; + media->drmType = pMultipart->drmType; + snprintf(media->szFilePath, sizeof(media->szFilePath), "%s", pMultipart->szFilePath); + snprintf(media->szFileName, sizeof(media->szFileName), "%s", pMultipart->szFileName); + snprintf(media->szContentID, sizeof(media->szContentID), "%s", pMultipart->szContentID); + snprintf(media->szContentLocation, sizeof(media->szContentLocation), "%s", pMultipart->szContentLocation); + snprintf(media->szContentType, sizeof(media->szContentType), "%s", pMultipart->szContentType); + + MSG_SEC_DEBUG("InsertPart to pageIndx [%d] mediaIdx[%d] media[%p] : path = [%s], name = [%s], cid = [%s], cl = [%s], ct = [%s]"\ + , pageIdx, mediaIdx, media, media->szFilePath, media->szFileName, media->szContentID, media->szContentLocation, media->szContentType); + } + } + } //end for media list } + } //end for page list + } - } else { - MSG_DEBUG("ContentID is NULL"); - match_media = NULL; - } + return insert_media; +} +bool MmsInsertPartToMmsData(MMS_MESSAGE_DATA_S *pMsgData, MMS_MULTIPART_DATA_S *pMultipart) +{ + MSG_BEGIN(); + + bool isInsert = false; + + if (pMsgData == NULL || pMultipart == NULL) { + return false; } - if (match_media && isPimsFile == false) { // set file path - snprintf(match_media->szFilePath, sizeof(match_media->szFilePath), "%s", pMultipart->szFilePath); - snprintf(match_media->szFileName, sizeof(match_media->szFileName), "%s", pMultipart->szFileName); - snprintf(match_media->szContentID, sizeof(match_media->szContentID), "%s", pMultipart->szContentID); - snprintf(match_media->szContentLocation, sizeof(match_media->szContentLocation), "%s", pMultipart->szContentLocation); - snprintf(match_media->szContentType, sizeof(match_media->szContentType), "%s", pMultipart->szContentType); - } else { // add attach + isInsert = MmsFindAndInsertPart(pMsgData, pMultipart); + if (isInsert == false) { MMS_ATTACH_S *attachment = NULL; attachment = (MMS_ATTACH_S *)calloc(sizeof(MMS_ATTACH_S), 1); + attachment->drmType = pMultipart->drmType; + + if (strlen(pMultipart->szContentType) > 0) { + snprintf(attachment->szContentType, sizeof(attachment->szContentType), "%s", pMultipart->szContentType); + attachment->mediatype = pMultipart->type; + } - attachment->mediatype = (MimeType)tempType; - snprintf(attachment->szContentType, sizeof(attachment->szContentType), "%s", pMultipart->szContentType); snprintf(attachment->szFilePath, sizeof(attachment->szFilePath), "%s", pMultipart->szFilePath); snprintf(attachment->szFileName, sizeof(attachment->szFileName), "%s", pMultipart->szFileName); attachment->fileSize = MsgGetFileSize(attachment->szFilePath); + MSG_SEC_DEBUG("Insert Attach to attachment[%p] : path = [%s], name = [%s], ct = [%s], size = [%d]"\ + , attachment, attachment->szFilePath, attachment->szFileName, attachment->szContentType, attachment->fileSize); + if (_MsgMmsAddAttachment(pMsgData, attachment) != MSG_SUCCESS) { g_free(attachment); return false; } } + MSG_END(); return true; } -bool MmsEncodeMmsMessage(MmsMsg *pMmsMsg, const char *raw_filepath) +bool MmsInsertMixedPartToMmsData(MMS_MESSAGE_DATA_S *pMsgData, MMS_MULTIPART_DATA_S *pMultipart) { - bool encode_ret = false; - mode_t file_mode = (S_IRUSR | S_IWUSR); + MSG_BEGIN(); - if (pMmsMsg == NULL || raw_filepath == NULL) { - MSG_DEBUG("Invalid Parameter pMmsMsg = %p , raw_filepath = %p", pMmsMsg, raw_filepath); + if (pMsgData == NULL || pMultipart == NULL) { return false; } - FILE *pFile = MsgOpenFile(raw_filepath, "wb+"); - - if (pFile == NULL) { - MSG_FATAL("File Open Error: %s", strerror(errno)); - goto __CATCH; - } - - if (MsgFseek(pFile, 0L, SEEK_CUR) < 0) { - MSG_DEBUG("File Fseek Error: %s", strerror(errno)); - goto __CATCH; - } + MimeMainType mainType = MimeGetMainTypeInt(pMultipart->type); + MmsSmilMediaType mediatype = MMS_SMIL_MEDIA_INVALID; - if (fchmod(fileno(pFile), file_mode) < 0) { - MSG_DEBUG("File chmod Error: %s", strerror(errno)); - goto __CATCH; - } - - switch(pMmsMsg->mmsAttrib.msgType) - { - case MMS_MSGTYPE_SEND_REQ: - case MMS_MSGTYPE_SEND_CONF: - encode_ret = MmsEncodeSendReq(pFile, pMmsMsg); - if (encode_ret == false) { - MSG_DEBUG("Fail to MmsEncodeSendReq"); - goto __CATCH; - } + switch(mainType) { + case MIME_MAINTYPE_AUDIO: + mediatype = MMS_SMIL_MEDIA_AUDIO; break; - default: - MSG_DEBUG("Not Support msg type : %d", pMmsMsg->mmsAttrib.msgType); - goto __CATCH; + case MIME_MAINTYPE_IMAGE: + mediatype = MMS_SMIL_MEDIA_IMG; + break; + case MIME_MAINTYPE_TEXT: + mediatype = MMS_SMIL_MEDIA_TEXT; + break; + case MIME_MAINTYPE_VIDEO: + mediatype = MMS_SMIL_MEDIA_VIDEO; + break; + default : + mediatype = MMS_SMIL_MEDIA_INVALID; break; } - MsgFsync(pFile); //file is written to device immediately, it prevents missing file data from unexpected power off - MsgCloseFile(pFile); + if (mediatype != MMS_SMIL_MEDIA_INVALID) { + MMS_PAGE_S *pPage = (MMS_PAGE_S *)calloc(1, sizeof(MMS_PAGE_S)); + MMS_MEDIA_S *media = (MMS_MEDIA_S *)calloc(1, sizeof(MMS_MEDIA_S)); - return true; + media->mediatype = mediatype; + media->drmType = pMultipart->drmType; + snprintf(media->szFilePath, sizeof(media->szFilePath), "%s", pMultipart->szFilePath); + snprintf(media->szFileName, sizeof(media->szFileName), "%s", pMultipart->szFileName); + snprintf(media->szContentID, sizeof(media->szContentID), "%s", pMultipart->szContentID); + snprintf(media->szContentLocation, sizeof(media->szContentLocation), "%s", pMultipart->szContentLocation); + snprintf(media->szContentType, sizeof(media->szContentType), "%s", pMultipart->szContentType); -__CATCH: - if (pFile) { - MsgCloseFile(pFile); - } + MSG_SEC_DEBUG("InsertPart to media[%p] type[%d] : path = [%s], name = [%s], cid = [%s], cl = [%s], ct = [%s]"\ + , media, mediatype, media->szFilePath, media->szFileName, media->szContentID, media->szContentLocation, media->szContentType); - return false; -} + if (_MsgMmsAddMedia(pPage, media) != MSG_SUCCESS) { + g_free(pPage); + g_free(media); + return false; + } -bool MmsInsertPartFromMultipart(MmsMsg *pMsg, MMS_MULTIPART_DATA_S *pNewMultipart) -{ - MsgMultipart *pMultipart = NULL; - MsgMultipart *pLastPart = NULL; + if (_MsgMmsAddPage(pMsgData, pPage) != MSG_SUCCESS) { + g_free(pPage); + g_free(media); + return false; + } - MimeType mimeType = MIME_UNKNOWN; - char *pExt = NULL; + } else { + MMS_ATTACH_S *attachment = NULL; + attachment = (MMS_ATTACH_S *)calloc(sizeof(MMS_ATTACH_S), 1); - pExt = strrchr(pNewMultipart->szFilePath, '.'); + attachment->mediatype = pMultipart->type; + attachment->drmType = pMultipart->drmType; + snprintf(attachment->szContentType, sizeof(attachment->szContentType), "%s", pMultipart->szContentType); + snprintf(attachment->szFilePath, sizeof(attachment->szFilePath), "%s", pMultipart->szFilePath); + snprintf(attachment->szFileName, sizeof(attachment->szFileName), "%s", pMultipart->szFileName); + attachment->fileSize = MsgGetFileSize(attachment->szFilePath); + MSG_SEC_DEBUG("Insert Attach to attachment[%p] : path = [%s], name = [%s], ct = [%s], size = [%d]"\ + , attachment, attachment->szFilePath, attachment->szFileName, attachment->szContentType, attachment->fileSize); - if (pExt == NULL || pExt[0] == '\0' || strrchr(pExt, '/')) { - //mimeType = MIME_UNKNOWN; - mimeType = MimeGetMimeIntFromMimeString(pNewMultipart->szContentType); - } else { - if (strcasecmp(pExt, ".dcf") == 0) - mimeType = MIME_APPLICATION_VND_OMA_DRM_CONTENT; - else { - if (MmsGetTypeByFileName((int *)&mimeType, pNewMultipart->szFilePath) == false) - goto __CATCH; + if (_MsgMmsAddAttachment(pMsgData, attachment) != MSG_SUCCESS) { + g_free(attachment); + return false; } } - MSG_DEBUG("type = %d, name = %s, filepath = %s, cid = %s, cl = %s", mimeType, pNewMultipart->szFileName, pNewMultipart->szFilePath, pNewMultipart->szContentID, pNewMultipart->szContentLocation); + MSG_END(); + return true; +} - if (mimeType == MIME_UNKNOWN) - mimeType = MIME_APPLICATION_OCTET_STREAM; +bool MmsInsertPartFromMultipart(MmsMsg *pMsg, MMS_MULTIPART_DATA_S *pNewMultipart) +{ + MsgMultipart *pMultipart = NULL; + MsgMultipart *pLastPart = NULL; if (MmsIsMultipart(pMsg->msgType.type) == true) { /* Insert as a multipart */ - pMultipart = MmsMakeMultipart(mimeType, pNewMultipart->szFileName, pNewMultipart->szFilePath, pNewMultipart->szContentID, pNewMultipart->szContentLocation); + pMultipart = MmsMakeMultipart(pNewMultipart->type, pNewMultipart->szFileName, pNewMultipart->szFilePath, pNewMultipart->szContentID, pNewMultipart->szContentLocation); if (pMultipart == NULL) goto __CATCH; @@ -1264,12 +689,12 @@ bool MmsInsertPartFromMultipart(MmsMsg *pMsg, MMS_MULTIPART_DATA_S *pNewMultipar pMsg->msgType.contentSize += pMultipart->pBody->size; } else { /* Single part - Insert as a message body */ - if (pMsg->mmsAttrib.contentType != mimeType || pMsg->msgType.type != mimeType) + if (pMsg->mmsAttrib.contentType != pNewMultipart->type || pMsg->msgType.type != pNewMultipart->type) goto __CATCH; strncpy(pMsg->msgType.param.szName, pNewMultipart->szFileName, MSG_LOCALE_FILENAME_LEN_MAX); - if (MmsIsText(pMsg->msgType.type) == true) { + if (MmsIsTextType(pMsg->msgType.type) == true) { pMsg->msgType.param.charset = MSG_CHARSET_UTF8; } @@ -1288,11 +713,11 @@ __CATCH: } -bool MmsMakeMmsData(MmsMsg *pMsg, MMS_MESSAGE_DATA_S *pMmsMsg) +bool MmsConvertMsgData(MmsMsg *pMsg, MMS_MESSAGE_DATA_S *pMmsMsg) { MSG_BEGIN(); - bzero(pMmsMsg, sizeof(MMS_MESSAGE_DATA_S)); + //bzero(pMmsMsg, sizeof(MMS_MESSAGE_DATA_S)); pMmsMsg->regionCnt = 0; pMmsMsg->pageCnt = 0; pMmsMsg->attachCnt = 0; @@ -1302,12 +727,11 @@ bool MmsMakeMmsData(MmsMsg *pMsg, MMS_MESSAGE_DATA_S *pMmsMsg) if (pMsg->mmsAttrib.contentType == MIME_MULTIPART_RELATED || pMsg->mmsAttrib.contentType == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) { char *pSmilDoc = NULL; - if (pMsg->msgBody.pPresentationBody) { if (pMsg->msgBody.pPresentationBody->body.pText) { pSmilDoc = pMsg->msgBody.pPresentationBody->body.pText; if (pSmilDoc) { - MmsSmilParseSmilDocOnlyLayout(pMmsMsg, pSmilDoc); + MsgSmilParseSmilDoc(pMmsMsg, pSmilDoc); } pMmsMsg->smil.type = MIME_APPLICATION_SMIL; @@ -1315,37 +739,106 @@ bool MmsMakeMmsData(MmsMsg *pMsg, MMS_MESSAGE_DATA_S *pMmsMsg) snprintf(pMmsMsg->smil.szContentID, MSG_MSG_ID_LEN, "%s", pMsg->msgBody.presentationType.szContentID); snprintf(pMmsMsg->smil.szContentLocation, MSG_MSG_ID_LEN, "%s", pMsg->msgBody.presentationType.szContentLocation); snprintf(pMmsMsg->smil.szFileName, MSG_FILENAME_LEN_MAX, "%s", pMsg->msgBody.presentationType.param.szName); - snprintf(pMmsMsg->smil.szFilePath, MSG_FILEPATH_LEN_MAX, MSG_DATA_PATH"%s", pMsg->msgBody.presentationType.param.szFileName); + snprintf(pMmsMsg->smil.szFilePath, MSG_FILEPATH_LEN_MAX, "%s%s", MSG_DATA_PATH, pMsg->msgBody.presentationType.param.szFileName); + } + } else { + MSG_DEBUG("Not Exist pPresentationBody"); + } + } + + /*If mms content type is TEXTPLAN add to First Page*/ + if (pMsg->mmsAttrib.contentType == MIME_TEXT_PLAIN) { + MsgType partHeader; + int partCnt = pMsg->nPartCount; + + if (partCnt <= 0) { + MSG_DEBUG("partCnt=%d\n", partCnt ); + } else { + + if (MmsGetMediaPartHeader(0, &partHeader) == false) { + MSG_DEBUG("Failed to get MediaPart MmsGetMediaPartHeader" ); + goto FREE_CATCH; + } + + if (partHeader.contentSize > 0) { + char szBuf[MSG_FILEPATH_LEN_MAX + 1] = {0,}; + MMS_PAGE_S *page = NULL; + MMS_MEDIA_S *media = NULL; + + snprintf(szBuf, sizeof(szBuf), "%s", partHeader.param.szFileName); + snprintf(partHeader.param.szFileName, sizeof(partHeader.param.szFileName), "%s%s", MSG_DATA_PATH, szBuf); + + page = (MMS_PAGE_S *)calloc(1, sizeof(MMS_PAGE_S)); + if (page == NULL) { + MSG_FATAL("page allocation error"); + goto FREE_CATCH; + } + + media = (MMS_MEDIA_S *)calloc(1, sizeof(MMS_MEDIA_S)); + if (media == NULL) { + MSG_FATAL("media allocation error"); + free(page); + goto FREE_CATCH; + } + + media->mediatype = MMS_SMIL_MEDIA_TEXT; + snprintf(media->szFilePath, sizeof(media->szFilePath), "%s", partHeader.param.szFileName); + snprintf(media->szFileName, sizeof(media->szFileName), "%s", partHeader.param.szName); + snprintf(media->szContentID, sizeof(media->szContentID), "%s", partHeader.szContentID); + snprintf(media->szContentLocation, sizeof(media->szContentLocation), "%s", partHeader.szContentLocation); + + _MsgMmsAddMedia(page, media); + + _MsgMmsAddPage(pMmsMsg, page); } - } else { - MSG_DEBUG("Not Exist pPresentationBody"); + } - } + } else { - int partCnt = pMsg->nPartCount; + int partCnt = pMsg->nPartCount; - for (int i = 0; i < partCnt; ++i) { + for (int i = 0; i < partCnt; ++i) { - MsgMultipart *multipart = MmsGetNthMultipart(pMsg, i); - MMS_MULTIPART_DATA_S pMultipart; + MsgMultipart *multipart = MmsGetNthMultipart(pMsg, i); + MMS_MULTIPART_DATA_S pMultipart; - if (multipart == NULL) { - MSG_DEBUG("multipart is NULL [%d]", i); - goto FREE_CATCH; - } + if (multipart == NULL) { + MSG_DEBUG("multipart is NULL [%d]", i); + goto FREE_CATCH; + } + + bzero(&pMultipart, sizeof(MMS_MULTIPART_DATA_S)); + + pMultipart.type = (MimeType)multipart->type.type; + MSG_DEBUG("Mime Type : %s :%d", MimeGetMimeStringFromMimeInt(multipart->type.type), multipart->type.type); + snprintf(pMultipart.szContentID, sizeof(pMultipart.szContentID), "%s", multipart->type.szContentID); + snprintf(pMultipart.szContentLocation, sizeof(pMultipart.szContentLocation), "%s", multipart->type.szContentLocation); + snprintf(pMultipart.szFileName, sizeof(pMultipart.szFileName), "%s", multipart->type.param.szName); + snprintf(pMultipart.szFilePath, sizeof(pMultipart.szFilePath), "%s", multipart->pBody->szOrgFilePath); + snprintf(pMultipart.szContentType, sizeof(pMultipart.szContentType), "%s",MimeGetMimeStringFromMimeInt(multipart->type.type)); + + if (multipart->type.drmInfo.drmType != MSG_DRM_TYPE_NONE) { + pMultipart.drmType = multipart->type.drmInfo.drmType; + } - bzero(&pMultipart, sizeof(MMS_MULTIPART_DATA_S)); - snprintf(pMultipart.szContentID, sizeof(pMultipart.szContentID), "%s", multipart->type.szContentID); - snprintf(pMultipart.szContentLocation, sizeof(pMultipart.szContentLocation), "%s", multipart->type.szContentLocation); - snprintf(pMultipart.szFileName, sizeof(pMultipart.szFileName), "%s", multipart->type.param.szName); - snprintf(pMultipart.szFilePath, sizeof(pMultipart.szFilePath), "%s", multipart->pBody->szOrgFilePath); - snprintf(pMultipart.szContentType, sizeof(pMultipart.szContentType), "%s",MimeGetMimeStringFromMimeInt(multipart->type.type)); + _MsgMmsMultipartPrint(&pMultipart); - if (MmsInsertPartToMmsData(pMmsMsg, &pMultipart) == false) { - MSG_DEBUG("Fail to MmsSetMultipartToMmsData"); - goto FREE_CATCH; + if (pMsg->mmsAttrib.contentType == MIME_MULTIPART_RELATED || pMsg->mmsAttrib.contentType == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) { + if (MmsInsertPartToMmsData(pMmsMsg, &pMultipart) == false) { + MSG_DEBUG("Fail to MmsSetMultipartToMmsData"); + goto FREE_CATCH; + } + } else { + if (MmsInsertMixedPartToMmsData(pMmsMsg, &pMultipart) == false) { + MSG_DEBUG("Fail to MmsSetMultipartToMmsData"); + goto FREE_CATCH; + } + } } } + + _MsgMmsRemoveEmptyObject(pMmsMsg); + MSG_END(); return true; FREE_CATCH: @@ -1387,239 +880,584 @@ void MmsPrintMmsMsg(const MmsMsg *pMmsMsg) } -bool MmsComposeSendReq(MmsMsg *pMmsMsg, MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMsgData) +int MmsUpdateMultipartList(MSG_MESSAGE_INFO_S *pMsgInfo) { MSG_BEGIN(); + MMSList *multipart_list = NULL; - char *pRawData = NULL; - AutoPtr buf(&pRawData); - struct tm *timeInfo = NULL; - time_t RawTime = 0; - time_t nTimeInSecs = 0; + if (MmsPluginStorage::instance()->getMultipartList(pMsgInfo->msgId, &multipart_list) != MSG_SUCCESS) + return -1; + + for (int i = 0; i < (int)g_list_length(multipart_list); i++) { + MMS_MULTIPART_DATA_S *pMultipart = (MMS_MULTIPART_DATA_S *)g_list_nth_data(multipart_list, i); + MmsPluginStorage::instance()->updateMultipart(pMsgInfo->msgId, true, pMultipart); + } + + MSG_END(); + return 0; +} + +int MmsUpdatePreviewData(MSG_MESSAGE_INFO_S *pMsgInfo) +{ + MSG_BEGIN(); + + char szFullPath[MSG_FILEPATH_LEN_MAX] = {0, }; + MmsMsg mmsMsg; + + memset(&mmsMsg, 0, sizeof(MmsMsg)); + + MmsPluginStorage::instance()->getMmsRawFilePath(pMsgInfo->msgId, szFullPath, sizeof(szFullPath)); + MmsPluginDecoder::instance()->decodeMmsPdu(&mmsMsg, pMsgInfo->msgId, szFullPath); + + {//make Preview info for APP + MmsPluginAppBase appBase(&mmsMsg); + appBase.makePreviewInfo(pMsgInfo->msgId, true, szFullPath); + appBase.getFirstPageTextFilePath(pMsgInfo->msgText, sizeof(pMsgInfo->msgText)); + } + MmsReleaseMmsMsg(&mmsMsg); + MSG_END(); + return 0; +} + +//MmsMsg -> MMS_DATA_S +bool MmsConvertMmsData(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData) +{ + MSG_BEGIN(); + + MMS_HEADER_DATA_S *pHeaderData = pMmsData->header; + if (pHeaderData) { + + snprintf(pHeaderData->messageID, sizeof(pHeaderData->messageID), "%s", pMmsMsg->szMsgID); + snprintf(pHeaderData->trID, sizeof(pHeaderData->trID), "%s", pMmsMsg->szTrID); + snprintf(pHeaderData->contentLocation, sizeof(pHeaderData->contentLocation), "%s", pMmsMsg->szContentLocation); + snprintf(pHeaderData->szContentType, sizeof(pHeaderData->szContentType), "%s", MimeGetMimeStringFromMimeInt(pMmsMsg->mmsAttrib.contentType)); + + pHeaderData->messageType = pMmsMsg->mmsAttrib.msgType; + pHeaderData->mmsVersion = pMmsMsg->mmsAttrib.version; + pHeaderData->messageClass = pMmsMsg->mmsAttrib.msgClass; + pHeaderData->contentClass = 0; + pHeaderData->mmsPriority = pMmsMsg->mmsAttrib.priority; + pHeaderData->expiry.type = pMmsMsg->mmsAttrib.expiryTime.type; + pHeaderData->expiry.time = pMmsMsg->mmsAttrib.expiryTime.time; + + pHeaderData->bDeliveryReport = pMmsMsg->mmsAttrib.bAskDeliveryReport; + pHeaderData->date = pMmsMsg->mmsAttrib.date; + pHeaderData->mmsVersion = pMmsMsg->mmsAttrib.version; + + pHeaderData->bReadReport = pMmsMsg->mmsAttrib.bAskReadReply; + pHeaderData->bHideAddress = pMmsMsg->mmsAttrib.bHideAddress; + + snprintf(pHeaderData->szSubject, sizeof(pHeaderData->szSubject), "%s", pMmsMsg->mmsAttrib.szSubject); + + pHeaderData->to = MmsConvertAddressToNewStyle(pMmsMsg->mmsAttrib.szTo); + pHeaderData->cc = MmsConvertAddressToNewStyle(pMmsMsg->mmsAttrib.szCc); + pHeaderData->bcc = MmsConvertAddressToNewStyle(pMmsMsg->mmsAttrib.szBcc); + + snprintf(pHeaderData->szFrom, sizeof(pHeaderData->szFrom), "%s", pMmsMsg->mmsAttrib.szFrom); + } + + if (pMmsMsg->mmsAttrib.contentType == MIME_MULTIPART_RELATED || pMmsMsg->mmsAttrib.contentType == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) { + + MMS_MULTIPART_DATA_S *pMultipart = MsgMmsCreateMultipart(); + + pMultipart->type = MIME_APPLICATION_SMIL; + snprintf(pMultipart->szContentType, sizeof(pMultipart->szContentType), "%s", "application/smil"); + snprintf(pMultipart->szContentID, sizeof(pMultipart->szContentID), "%s", pMmsMsg->msgBody.presentationType.szContentID); + snprintf(pMultipart->szContentLocation, sizeof(pMultipart->szContentLocation), "%s", pMmsMsg->msgBody.presentationType.szContentLocation); + snprintf(pMultipart->szFileName, sizeof(pMultipart->szFileName), "%s", pMmsMsg->msgBody.presentationType.param.szName); + snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), MSG_DATA_PATH"%s", pMmsMsg->msgBody.presentationType.param.szFileName); + + pMmsData->smil = pMultipart; + } + + int partCnt = pMmsMsg->nPartCount; + + for (int i = 0; i < partCnt; ++i) { + + MsgMultipart *multipart = MmsGetNthMultipart(pMmsMsg, i); + + if (multipart) { + + MMS_MULTIPART_DATA_S *pMultipart = MsgMmsCreateMultipart(); + + pMultipart->type = (MimeType)multipart->type.type; + + snprintf(pMultipart->szContentType, sizeof(pMultipart->szContentType), "%s",MimeGetMimeStringFromMimeInt(multipart->type.type)); + snprintf(pMultipart->szContentID, sizeof(pMultipart->szContentID), "%s", multipart->type.szContentID); + snprintf(pMultipart->szContentLocation, sizeof(pMultipart->szContentLocation), "%s", multipart->type.szContentLocation); + snprintf(pMultipart->szFileName, sizeof(pMultipart->szFileName), "%s", multipart->type.param.szName); + snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), "%s", multipart->pBody->szOrgFilePath); + +#ifdef __SUPPORT_DRM__ + if (multipart->type.drmInfo.drmType != MSG_DRM_TYPE_NONE) { + pMultipart->drmType = multipart->type.drmInfo.drmType; + } +#endif + pMmsData->multipartlist = g_list_append(pMmsData->multipartlist, pMultipart); + } + } + + MSG_END(); + return true; +} + +//For Encode raw file +bool MmsConvertMmsMsg(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData) +{ + MSG_BEGIN(); // Initialize mmsMsg structure MmsInitMsgAttrib(&pMmsMsg->mmsAttrib); MmsInitMsgType(&pMmsMsg->msgType); MmsInitMsgBody(&pMmsMsg->msgBody); - // setting mmsMsg structure - pMmsMsg->mailbox = pMsgInfo->folderId; - pMmsMsg->msgID = pMsgInfo->msgId; - - memset(pMmsMsg->szTrID, 0, MMS_TR_ID_LEN + 1); - memset(pMmsMsg->szContentLocation, 0, MMS_LOCATION_LEN + 1); - memset(pMmsMsg->szMsgID, 0, MMS_MSG_ID_LEN + 1); - memset(pMmsMsg->szForwardMsgID, 0, MMS_MSG_ID_LEN + 1); - pMmsMsg->mmsAttrib.dataType = MMS_DATATYPE_DRAFT; - pMmsMsg->mmsAttrib.msgType = MMS_MSGTYPE_SEND_REQ; - if (pSendOptInfo->bSetting == false) { - unsigned int expiryTime; - MSG_MMS_DELIVERY_TIME_T deliveryTime; + MMS_HEADER_DATA_S *pHeaderData = pMmsData->header; + + if (pHeaderData) { - pMmsMsg->mmsAttrib.priority = (MmsPriority)MsgSettingGetInt(MMS_SEND_PRIORITY); + if (strlen(pHeaderData->contentLocation) > 0) { + snprintf(pMmsMsg->szContentLocation, sizeof(pMmsMsg->szContentLocation), "%s", pHeaderData->contentLocation); + } - MsgSettingGetBool(MMS_SEND_DELIVERY_REPORT, &pMmsMsg->mmsAttrib.bAskDeliveryReport); - MsgSettingGetBool(MMS_SEND_READ_REPLY, &pMmsMsg->mmsAttrib.bAskReadReply); - MsgSettingGetBool(MSG_KEEP_COPY, &pMmsMsg->mmsAttrib.bLeaveCopy); + pMmsMsg->mmsAttrib.contentType = (MimeType)pHeaderData->contentType; + pMmsMsg->msgType.type = pHeaderData->contentType; + pMmsMsg->mmsAttrib.date = pHeaderData->date; + pMmsMsg->mmsAttrib.bAskDeliveryReport = pHeaderData->bDeliveryReport; + pMmsMsg->mmsAttrib.deliveryTime.type = pHeaderData->delivery.type; + pMmsMsg->mmsAttrib.deliveryTime.time = pHeaderData->delivery.time; + pMmsMsg->mmsAttrib.expiryTime.type = pHeaderData->expiry.type; + pMmsMsg->mmsAttrib.expiryTime.time = pHeaderData->expiry.time; + pMmsMsg->mmsAttrib.msgClass = (MmsMsgClass)pHeaderData->messageClass; + + if (strlen(pHeaderData->messageID) > 0) { + snprintf(pMmsMsg->szMsgID, sizeof(pMmsMsg->szMsgID), "%s", pHeaderData->messageID); + } - expiryTime = (unsigned int)MsgSettingGetInt(MMS_SEND_EXPIRY_TIME); + pMmsMsg->mmsAttrib.msgType = (MmsMsgType)pHeaderData->messageType; + pMmsMsg->mmsAttrib.version = pHeaderData->mmsVersion; + pMmsMsg->mmsAttrib.priority = (MmsPriority)pHeaderData->mmsPriority; + pMmsMsg->mmsAttrib.bAskReadReply = pHeaderData->bReadReport; + pMmsMsg->mmsAttrib.bHideAddress = pHeaderData->bHideAddress; - if (expiryTime == 0) - pMmsMsg->mmsAttrib.expiryTime.type = MMS_TIMETYPE_NONE; - else { - pMmsMsg->mmsAttrib.expiryTime.type = MMS_TIMETYPE_RELATIVE; - pMmsMsg->mmsAttrib.expiryTime.time = expiryTime; + if (strlen(pHeaderData->trID) > 0) { + snprintf(pMmsMsg->szTrID, sizeof(pMmsMsg->szTrID), "%s", pHeaderData->trID); } - deliveryTime = (MSG_MMS_DELIVERY_TIME_T)MsgSettingGetInt(MMS_SEND_DELIVERY_TIME); - if (deliveryTime == MSG_DELIVERY_TIME_CUSTOM) { - pMmsMsg->mmsAttrib.bUseDeliveryCustomTime = true; + snprintf(pMmsMsg->mmsAttrib.szSubject, sizeof(pMmsMsg->mmsAttrib.szSubject), "%s", pHeaderData->szSubject); + + pMmsMsg->mmsAttrib.szTo = MmsConvertAddressToOldStyle(pHeaderData->to); + pMmsMsg->mmsAttrib.szCc = MmsConvertAddressToOldStyle(pHeaderData->cc); + pMmsMsg->mmsAttrib.szBcc = MmsConvertAddressToOldStyle(pHeaderData->bcc); + + snprintf(pMmsMsg->mmsAttrib.szFrom, sizeof(pMmsMsg->mmsAttrib.szFrom), "%s", pHeaderData->szFrom); + } //CID 41988: Moving all de-referencing of pHeaderData inside null-check block + + printMmsAttribute(&pMmsMsg->mmsAttrib); + + if (pMmsData->multipartlist) { + + if (pMmsData->smil) { + + MMS_MULTIPART_DATA_S *smil_multipart = pMmsData->smil; + + if (smil_multipart) { + + pMmsMsg->mmsAttrib.contentType = MIME_APPLICATION_VND_WAP_MULTIPART_RELATED; + pMmsMsg->msgType.type = MIME_APPLICATION_VND_WAP_MULTIPART_RELATED; - pMmsMsg->mmsAttrib.deliveryTime.type = MMS_TIMETYPE_RELATIVE; - pMmsMsg->mmsAttrib.deliveryTime.time = (unsigned int)MsgSettingGetInt(MMS_SEND_CUSTOM_DELIVERY); + gchar *contents = NULL; + gsize length = 0; + + if (MsgAccessFile(smil_multipart->szFilePath, F_OK)) { + g_file_get_contents(smil_multipart->szFilePath, &contents, &length, NULL); + + MmsInsertPresentation(pMmsMsg, MIME_APPLICATION_SMIL, NULL, contents, length); + + g_free(contents); + + } else { + contents = smil_multipart->pMultipartData; + length = smil_multipart->nMultipartDataLen; + + MmsInsertPresentation(pMmsMsg, MIME_APPLICATION_SMIL, NULL, contents, length); + } + } } else { - pMmsMsg->mmsAttrib.bUseDeliveryCustomTime = false; + pMmsMsg->mmsAttrib.contentType = MIME_APPLICATION_VND_WAP_MULTIPART_MIXED; + pMmsMsg->msgType.type = MIME_APPLICATION_VND_WAP_MULTIPART_MIXED; + } + + int len = g_list_length(pMmsData->multipartlist); + + for (int i = 0; i < len; i++) { + + MMS_MULTIPART_DATA_S *multipart = (MMS_MULTIPART_DATA_S *)g_list_nth_data(pMmsData->multipartlist, i); + + if (multipart) { + if (multipart->type == MIME_UNKNOWN) + multipart->type = MimeGetMimeIntFromMimeString(multipart->szContentType); + + if (MmsInsertPartFromMultipart(pMmsMsg, multipart) == false) { + return false; + } + } + } //end for + } + + MSG_END(); + return true; +} + +char *MmsConvertAddressToOldStyle(MMSList *pAddressList) +{ + MSG_BEGIN(); + int addrLen = 0; + int nAddressCnt = 0; + char pString[MSG_LOCALE_NAME_LEN + MSG_ADDR_LEN + 3] = {0, }; + char *szCompose = NULL; + + nAddressCnt = g_list_length(pAddressList); + + // Calculate allocated buffer size + for (int i = 0; i < nAddressCnt; ++i) { - pMmsMsg->mmsAttrib.deliveryTime.type = MMS_TIMETYPE_RELATIVE; - pMmsMsg->mmsAttrib.deliveryTime.time = (unsigned int)deliveryTime; + MMS_ADDRESS_DATA_S * pAddressData = (MMS_ADDRESS_DATA_S *)g_list_nth_data(pAddressList, i); + if (pAddressData) { + MSG_SEC_DEBUG("address type : %d, address value: %s", pAddressData->address_type, pAddressData->address_val); + if (pAddressData->address_type == MSG_ADDRESS_TYPE_PLMN) { + addrLen += strlen("/TYPE=PLMN"); + addrLen += strlen(pAddressData->address_val); + } else { + addrLen += strlen(pAddressData->address_val); + } } - } else { - pMmsMsg->mmsAttrib.priority = (MmsPriority)pSendOptInfo->option.mmsSendOptInfo.priority; - pMmsMsg->mmsAttrib.bAskDeliveryReport = pSendOptInfo->bDeliverReq; - pMmsMsg->mmsAttrib.bAskReadReply = pSendOptInfo->option.mmsSendOptInfo.bReadReq; - pMmsMsg->mmsAttrib.expiryTime.type = pSendOptInfo->option.mmsSendOptInfo.expiryTime.type; - pMmsMsg->mmsAttrib.bLeaveCopy = pSendOptInfo->bKeepCopy; - - if (pMmsMsg->mmsAttrib.expiryTime.type != MMS_TIMETYPE_NONE) - pMmsMsg->mmsAttrib.expiryTime.time = pSendOptInfo->option.mmsSendOptInfo.expiryTime.time; - - pMmsMsg->mmsAttrib.bUseDeliveryCustomTime = pSendOptInfo->option.mmsSendOptInfo.bUseDeliveryCustomTime; - pMmsMsg->mmsAttrib.deliveryTime.type = pSendOptInfo->option.mmsSendOptInfo.deliveryTime.type; - pMmsMsg->mmsAttrib.deliveryTime.time = pSendOptInfo->option.mmsSendOptInfo.deliveryTime.time; } - MSG_DEBUG("pSendOptInfo->bSetting = %d", pSendOptInfo->bSetting); - MSG_DEBUG("pMmsMsg->mmsAttrib.bLeaveCopy = %d", pMmsMsg->mmsAttrib.bLeaveCopy); + if (nAddressCnt > 1) + addrLen = addrLen + nAddressCnt - 1; - MSG_DEBUG("pMmsMsg->mmsAttrib.bUseDeliveryCustomTime = %d", pMmsMsg->mmsAttrib.bUseDeliveryCustomTime); - MSG_DEBUG("pMmsMsg->mmsAttrib.deliveryTime.type = %d", pMmsMsg->mmsAttrib.deliveryTime.type); - MSG_DEBUG("pMmsMsg->mmsAttrib.deliveryTime.time = %d", pMmsMsg->mmsAttrib.deliveryTime.time); + szCompose = (char *)calloc(addrLen + 1, 1); - MSG_DEBUG("pMmsMsg->mmsAttrib.priority = %d", pMmsMsg->mmsAttrib.priority); + // Address String copy + for (int i = 0; i < nAddressCnt; ++i) { - MSG_DEBUG("pMmsMsg->mmsAttrib.bAskDeliveryReport = %d", pMmsMsg->mmsAttrib.bAskDeliveryReport); - MSG_DEBUG("pMmsMsg->mmsAttrib.bAskReadReply = %d", pMmsMsg->mmsAttrib.bAskReadReply); + MMS_ADDRESS_DATA_S * pAddressData = (MMS_ADDRESS_DATA_S *)g_list_nth_data(pAddressList, i); - MSG_DEBUG("pMmsMsg->mmsAttrib.expiryTime.type = %d", pMmsMsg->mmsAttrib.expiryTime.type); - MSG_DEBUG("pMmsMsg->mmsAttrib.expiryTime.time = %d", pMmsMsg->mmsAttrib.expiryTime.time); + if (pAddressData) { + if (strlen(szCompose) > 0) + strcat(szCompose, MSG_STR_ADDR_DELIMETER); - /* MMS-1.3-con-739 */ - pMmsMsg->mmsAttrib.msgClass = (MmsMsgClass)MsgSettingGetInt(MMS_SEND_MSG_CLASS); - /* MMS-1.3-con-739 */ -#ifdef MMS_13_CON_742_ENABLED - /* MMS-1.3-con-742 */ - pMmsMsg->mmsAttrib.deliveryTime.time = (unsigned int)MsgSettingGetInt(MMS_SEND_DELIVERY_TIME); - /* MMS-1.3-con-742 */ -#endif + memset(pString, 0x00, (MSG_LOCALE_NAME_LEN + MSG_ADDR_LEN + 3) * sizeof(char)); + if (pAddressData->address_type == MSG_ADDRESS_TYPE_PLMN) { + snprintf(pString, MSG_LOCALE_NAME_LEN + MSG_ADDR_LEN + 3, "%s%s", pAddressData->address_val, "/TYPE=PLMN"); + MSG_DEBUG("%s", pString); + } else { + snprintf(pString, MSG_LOCALE_NAME_LEN + MSG_ADDR_LEN + 3, "%s", pAddressData->address_val); + } - // setting date - time(&RawTime); - timeInfo = localtime(&RawTime); - nTimeInSecs = mktime(timeInfo); - pMmsMsg->mmsAttrib.date = nTimeInSecs; // todo: need to subtract timeline value to make GMT+0 time + strcat(szCompose, pString); + } - //setting subject - strcpy(pMmsMsg->mmsAttrib.szSubject, pMsgInfo->subject); + } - //setting adddress - MmsSetMsgAddressList(&pMmsMsg->mmsAttrib, pMsgInfo); + MSG_END(); + return szCompose; - //default type mixed - pMmsMsg->mmsAttrib.contentType = MIME_APPLICATION_VND_WAP_MULTIPART_MIXED; - pMmsMsg->msgType.type = MIME_APPLICATION_VND_WAP_MULTIPART_MIXED; +} - int pageCnt = _MsgMmsGetPageCount(pMsgData); +MMSList * MmsConvertAddressToNewStyle(const char *szAddr) +{ + MMSList *pAddressList = NULL; + MMS_ADDRESS_DATA_S *pAddressData = NULL; - if (pageCnt > 0) { // Multipart related + char *pTempChar = NULL; + char *pStartPtr= NULL; + char *pEndPtr= NULL; - int RawDataSize = 0; - time_t RawTime = 0; - time(&RawTime); + if (szAddr == NULL) + return NULL; - snprintf(pMsgData->szSmilFilePath, MSG_FILEPATH_LEN_MAX, "%lu", RawTime); + pTempChar = strdup(szAddr); - MsgMMSCreateSMIL(pMsgData); + pStartPtr = pTempChar; - RawDataSize = MmsGetSmilRawData(pMsgData, &pRawData); - if (RawDataSize < 0) { - MSG_DEBUG("Smil file size is less than 0"); - return false; - } - MSG_DEBUG("%s", pRawData); - if (pRawData) - MmsInsertPresentation(pMmsMsg, MIME_APPLICATION_SMIL, NULL, pRawData, strlen(pRawData)); + while (pStartPtr && pStartPtr[0]) { - pMmsMsg->mmsAttrib.contentType = MIME_APPLICATION_VND_WAP_MULTIPART_RELATED; - pMmsMsg->msgType.type = MIME_APPLICATION_VND_WAP_MULTIPART_RELATED; + int addLen = 0; + char tempAddress[512] = {0,}; + char tempAddress2[512] = {0,}; - } + pEndPtr = strchr(pStartPtr, MSG_CH_SEMICOLON); - if (pMmsMsg->msgType.type == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) { - - int pageCnt = _MsgMmsGetPageCount(pMsgData); - - for (int i = 0; i < pageCnt; ++i) { - MMS_PAGE_S *pPage = _MsgMmsGetPage(pMsgData, i); - int mediaCnt = pPage->mediaCnt; - MSG_DEBUG("PAGE %d's media Cnt: %d", i+1, mediaCnt); - - for (int j = 0; j < mediaCnt; ++j) { - MMS_MEDIA_S *pMedia = _MsgMmsGetMedia(pPage, j); - if (pMedia->szFilePath[0] != 0) { - MMS_MULTIPART_DATA_S *pMultipart = (MMS_MULTIPART_DATA_S *)calloc(1, sizeof(MMS_MULTIPART_DATA_S)); - if (pMultipart) { - snprintf(pMultipart->szContentID, sizeof(pMultipart->szContentID), "%s", pMedia->szContentID); - snprintf(pMultipart->szContentLocation, sizeof(pMultipart->szContentLocation), "%s", pMedia->szContentLocation); - snprintf(pMultipart->szFileName, sizeof(pMultipart->szFileName), "%s", pMedia->szFileName); - snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), "%s", pMedia->szFilePath); - snprintf(pMultipart->szContentType, sizeof(pMultipart->szContentType), "%s", pMedia->szContentType); - - if (!MmsInsertPartFromMultipart(pMmsMsg, pMultipart)) { - free(pMultipart); - pMultipart = NULL; - return false; - } + if (pEndPtr) { + addLen = pEndPtr - pStartPtr; + } else { + addLen = strlen(pStartPtr); + } - free(pMultipart); - pMultipart = NULL; - } - } + if (addLen) { + strncpy(tempAddress, pStartPtr, addLen); + int addr_type; + int addLen2; + char *pSlash = strchr(tempAddress, '/'); + + if (pSlash) { + addLen2 = pSlash - tempAddress; + addr_type = MSG_ADDRESS_TYPE_PLMN; + } else { + addLen2 = strlen(tempAddress); + addr_type = MSG_ADDRESS_TYPE_EMAIL; + } + + if (addLen2) { + strncpy(tempAddress2, tempAddress, addLen2); + pAddressData = MsgMmsCreateAddress(addr_type, tempAddress2); } + + if (pAddressData) + pAddressList = g_list_append(pAddressList, pAddressData); + + pStartPtr = pStartPtr + addLen + 1; + } else { + break; } } - //Processing Attachment List - for (int i = 0; i < _MsgMmsGetAttachCount(pMsgData); ++i) { - MMS_ATTACH_S *pMedia = _MsgMmsGetAttachment(pMsgData, i); - if (pMedia->szFilePath[0] != 0) { - MMS_MULTIPART_DATA_S *pMultipart = (MMS_MULTIPART_DATA_S *)calloc(1, sizeof(MMS_MULTIPART_DATA_S)); - if (pMultipart) { - snprintf(pMultipart->szContentID, sizeof(pMultipart->szContentID), "%s", pMedia->szFileName); - snprintf(pMultipart->szContentLocation, sizeof(pMultipart->szContentLocation), "%s", pMedia->szFileName); - snprintf(pMultipart->szFileName, sizeof(pMultipart->szFileName), "%s", pMedia->szFileName); - snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), "%s", pMedia->szFilePath); - snprintf(pMultipart->szContentType, sizeof(pMultipart->szContentType), "%s", pMedia->szContentType); - - if (!MmsInsertPartFromMultipart(pMmsMsg, pMultipart)) { - free(pMultipart); - pMultipart = NULL; - return false; - } + if (pTempChar) + free(pTempChar); - free(pMultipart); - pMultipart = NULL; - } + MSG_END(); + return pAddressList; +} + +bool convertMediaToMultipart(MMS_MEDIA_S *pSrcMedia, MMS_MULTIPART_DATA_S *pDestMultipart) +{ + bzero(pDestMultipart, sizeof(MMS_MULTIPART_DATA_S)); + + snprintf(pDestMultipart->szContentID, sizeof(pDestMultipart->szContentID), "%s", pSrcMedia->szContentID); + snprintf(pDestMultipart->szContentLocation, sizeof(pDestMultipart->szContentLocation), "%s", pSrcMedia->szContentLocation); + snprintf(pDestMultipart->szFileName, sizeof(pDestMultipart->szFileName), "%s", pSrcMedia->szFileName); + snprintf(pDestMultipart->szFilePath, sizeof(pDestMultipart->szFilePath), "%s", pSrcMedia->szFilePath); + + + if (strlen(pSrcMedia->szContentType) > 0) { + snprintf(pDestMultipart->szContentType, sizeof(pDestMultipart->szContentType), "%s", pSrcMedia->szContentType); + pDestMultipart->type = MimeGetMimeIntFromMimeString(pSrcMedia->szContentType); + + } else { + MimeMainType mainType = MIME_MAINTYPE_UNKNOWN; + MimeType pMimeType = MIME_UNKNOWN; + const char *pszMimeType = NULL; + + if (pSrcMedia->mediatype == MMS_SMIL_MEDIA_IMG) + mainType = MIME_MAINTYPE_IMAGE; + else if (pSrcMedia->mediatype == MMS_SMIL_MEDIA_AUDIO) + mainType = MIME_MAINTYPE_AUDIO; + else if (pSrcMedia->mediatype == MMS_SMIL_MEDIA_VIDEO) + mainType = MIME_MAINTYPE_VIDEO; + else if (pSrcMedia->mediatype == MMS_SMIL_MEDIA_TEXT) + mainType = MIME_MAINTYPE_TEXT; + + MmsGetMimeTypeFromFileName(mainType, pSrcMedia->szFilePath, &pMimeType, &pszMimeType); + + if (pszMimeType) { + snprintf(pDestMultipart->szContentType, sizeof(pDestMultipart->szContentType), "%s", pszMimeType); + pDestMultipart->type = pMimeType; + } else { + snprintf(pDestMultipart->szContentType, sizeof(pDestMultipart->szContentType), "%s", "application/octet-stream"); + pDestMultipart->type = MIME_APPLICATION_OCTET_STREAM; } } return true; } -int MmsUpdatePreviewData(MSG_MESSAGE_INFO_S *pMsgInfo) +bool convertAttachToMultipart(MMS_ATTACH_S *pSrcMedia, MMS_MULTIPART_DATA_S *pDestMultipart) { - MSG_BEGIN(); - MmsMsg *pMmsMsg; - MMS_MESSAGE_DATA_S msgData = {0,}; + bzero(pDestMultipart, sizeof(MMS_MULTIPART_DATA_S)); + + snprintf(pDestMultipart->szFileName, sizeof(pDestMultipart->szFileName), "%s", pSrcMedia->szFileName); + snprintf(pDestMultipart->szFilePath, sizeof(pDestMultipart->szFilePath), "%s", pSrcMedia->szFilePath); - MmsPluginStorage::instance()->getMmsMessage(&pMmsMsg); + if (strlen(pSrcMedia->szContentType) > 0) { + snprintf(pDestMultipart->szContentType, sizeof(pDestMultipart->szContentType), "%s", pSrcMedia->szContentType); + pDestMultipart->type = MimeGetMimeIntFromMimeString(pSrcMedia->szContentType); + } else { - MmsReleaseMmsMsg(pMmsMsg); + MimeMainType mainType = MIME_MAINTYPE_UNKNOWN; + MimeType pMimeType = MIME_UNKNOWN; + const char *pszMimeType = NULL; - if (MmsReadMsgBody(pMsgInfo->msgId, true, false, NULL) == false) { - MSG_DEBUG("Fail to MmsReadMsgBody"); - goto __CATCH; + MmsGetMimeTypeFromFileName(mainType, pSrcMedia->szFilePath, &pMimeType, &pszMimeType); + + if (pszMimeType) { + snprintf(pDestMultipart->szContentType, sizeof(pDestMultipart->szContentType), "%s", pszMimeType); + pDestMultipart->type = pMimeType; + } else { + snprintf(pDestMultipart->szContentType, sizeof(pDestMultipart->szContentType), "%s", "application/octet-stream"); + pDestMultipart->type = MIME_APPLICATION_OCTET_STREAM; + } } - if (MmsMakeMmsData(pMmsMsg, &msgData) == false) { - MSG_DEBUG("Fail to makeMmsMessageData"); - goto __CATCH; + return true; +} + +bool convertMsgMultipartToMultipart(MsgMultipart *pSrcMultipart, MMS_MULTIPART_DATA_S *pDestMultipart) +{ + pDestMultipart->type = (MimeType)pSrcMultipart->type.type; + + MSG_DEBUG("Mime Type : %s :%d", MimeGetMimeStringFromMimeInt(pSrcMultipart->type.type), pSrcMultipart->type.type); + snprintf(pDestMultipart->szContentID, sizeof(pDestMultipart->szContentID), "%s", pSrcMultipart->type.szContentID); + snprintf(pDestMultipart->szContentLocation, sizeof(pDestMultipart->szContentLocation), "%s", pSrcMultipart->type.szContentLocation); + snprintf(pDestMultipart->szFileName, sizeof(pDestMultipart->szFileName), "%s", pSrcMultipart->type.param.szName); + snprintf(pDestMultipart->szFilePath, sizeof(pDestMultipart->szFilePath), "%s", pSrcMultipart->pBody->szOrgFilePath); + + snprintf(pDestMultipart->szContentType, sizeof(pDestMultipart->szContentType), "%s", MimeGetMimeStringFromMimeInt(pSrcMultipart->type.type)); + + if (pSrcMultipart->type.drmInfo.drmType != MSG_DRM_TYPE_NONE) { + pDestMultipart->drmType = pSrcMultipart->type.drmInfo.drmType; } - MmsMakePreviewInfo(pMsgInfo->msgId, &msgData); + return true; +} - MmsPluginStorage::instance()->getMsgText(&msgData, pMsgInfo->msgText); +gint __compare_str(gconstpointer a, gconstpointer b) +{ + return g_strcmp0((char *)a, (char *)b); +} - MmsReleaseMmsMsg(pMmsMsg); - MsgMmsReleaseMmsLists(&msgData); +// change file name to Ascii & space -> '_' +// If replaced filename is duplicated, then it append number +bool MmsChangeFileNameToAscii(MMS_MESSAGE_DATA_S *pMsgData) +{ + int pageCnt; + int mediaCnt; + int attachCnt; - MSG_END(); - return 0; + GList *r_list = NULL;//renamed file list -__CATCH: - MmsReleaseMmsMsg(pMmsMsg); - MsgMmsReleaseMmsLists(&msgData); - return -1; + pageCnt = g_list_length(pMsgData->pagelist); + + for (int i = 0; i < pageCnt; i++) { + MMS_PAGE_S *pPage = NULL; + pPage = (MMS_PAGE_S *)g_list_nth_data(pMsgData->pagelist, i); + if (pPage == NULL) { + //CID 355351: Freeing r_list in case of error too to prevent memory leak + if(r_list != NULL) + g_list_free(r_list); + return false; + } + + mediaCnt = g_list_length(pPage->medialist); + for (int j = 0; j < mediaCnt; j++) { + MMS_MEDIA_S *pMedia = NULL; + pMedia = (MMS_MEDIA_S *)g_list_nth_data(pPage->medialist, j); + if (pMedia == NULL) { + //CID 355351: Freeing r_list in case of error too to prevent memory leak + if(r_list != NULL) + g_list_free(r_list); + return false; + } + + if (strlen(pMedia->szFileName) > 0) { + char *str = NULL; + + MmsReplaceSpaceChar(pMedia->szFileName); + + str = MmsReplaceNonAsciiUtf8(pMedia->szFileName, '_'); + + if (str) { + int count = 1; + char *str2 = g_strdup(str); + char *ext = strrchr(str, '.'); + + if (ext == NULL || *(ext + 1) == '\0') { + ext = NULL; + } else { + *ext = '\0'; + ext = ext + 1; + } + + while (g_list_find_custom(r_list, str2, __compare_str) != NULL) { + + g_free(str2); + + if (ext) + str2 = g_strdup_printf("%s_%d.%s", str, count++, ext); + else + str2 = g_strdup_printf("%s_%d", str, count++); + } + + g_free(str); + + snprintf(pMedia->szFileName, sizeof(pMedia->szFileName), "%s", str2); + + MSG_DEBUG("replace filename [%s]", pMedia->szFileName); + + r_list = g_list_append(r_list, pMedia->szFileName); + + g_free(str2); + } + } + }//end for media + }//end for page + + attachCnt = g_list_length(pMsgData->attachlist); + for (int i = 0; i < attachCnt; i++) { + MMS_ATTACH_S *pAttach = NULL; + pAttach = (MMS_ATTACH_S *)g_list_nth_data(pMsgData->attachlist, i); + if (pAttach == NULL) { + //CID 355351: Freeing r_list in case of error too to prevent memory leak + if(r_list != NULL) + g_list_free(r_list); + return false; + } + + if (strlen(pAttach->szFileName) > 0) { + char *str = NULL; + + MmsReplaceSpaceChar(pAttach->szFileName); + + str = MmsReplaceNonAsciiUtf8(pAttach->szFileName, '_'); + if (str) { + int count = 1; + char *str2 = g_strdup(str); + char *ext = strrchr(str, '.'); + + if (ext == NULL || *(ext + 1) == '\0') { + ext = NULL; + } else { + *ext = '\0'; + ext = ext + 1; + } + + while (g_list_find_custom(r_list, str2, __compare_str) != NULL) { + + g_free(str2); + + if (ext) + str2 = g_strdup_printf("%s_%d.%s", str, count++, ext); + else + str2 = g_strdup_printf("%s_%d", str, count++); + } + + g_free(str); + + snprintf(pAttach->szFileName, sizeof(pAttach->szFileName), "%s", str2); + + MSG_DEBUG("replace filename [%s]", pAttach->szFileName); + + g_free(str2); + } + } + + }//end for attach + + g_list_free(r_list); + + return true; } + diff --git a/plugin/mms_plugin/MmsPluginSMILValidate.cpp b/plugin/mms_plugin/MmsPluginSMILValidate.cpp index 3fc947b..3c5ab54 100755 --- a/plugin/mms_plugin/MmsPluginSMILValidate.cpp +++ b/plugin/mms_plugin/MmsPluginSMILValidate.cpp @@ -1,17 +1,17 @@ /* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include "MsgMmsMessage.h" @@ -22,7 +22,7 @@ #define MSG_RETURN_VAL_IF_FAIL(Expr, Val) \ if (!(Expr)) { \ - MSG_DEBUG("%s:[%s] Failed - %d\n", __FUNCTION__, __LINE__, Val); \ + MSG_DEBUG("%s:[%d] Failed - %d\n", __FUNCTION__, __LINE__, Val); \ return Val; \ }; @@ -103,7 +103,7 @@ MSG_SMIL_ERR_E _MsgMMSAddDefaultSMILRootLayout(MMS_MESSAGE_DATA_S *pMsgData) pMsgData->rootlayout.height.value = MSG_SMIL_ROOT_LAYOUT_HEIGHT; pMsgData->rootlayout.height.bUnitPercent = MSG_SMIL_ROOT_LAYOUT_IN_PERCENT; - pMsgData->rootlayout.bgColor = MmsSmilAtoIHexa((char *)&pContent[1]); + pMsgData->rootlayout.bgColor = MsgSmilAtoIHexa((char *)&pContent[1]); MSG_END(); return MSG_SMIL_SUCCESS; @@ -235,7 +235,7 @@ MSG_SMIL_ERR_E _MsgMMSAddDefaultFirstSMILRegion(MMS_MESSAGE_DATA_S *pMsgData, bo pRegion->fit = MMSUI_IMAGE_REGION_FIT_MEET; else pRegion->fit = MMSUI_IMAGE_REGION_FIT_HIDDEN; - pRegion->bgColor = MmsSmilAtoIHexa((char *)&pContent[1]); + pRegion->bgColor = MsgSmilAtoIHexa((char *)&pContent[1]); pRegion->nLeft.value = MSG_SMIL_FIRST_REG_LEFT; pRegion->nLeft.bUnitPercent = true; @@ -285,7 +285,7 @@ MSG_SMIL_ERR_E _MsgMMSAddDefaultSecondSMILRegion(MMS_MESSAGE_DATA_S *pMsgData, b pRegion->fit = MMSUI_IMAGE_REGION_FIT_MEET; else pRegion->fit = MMSUI_IMAGE_REGION_FIT_HIDDEN; - pRegion->bgColor = MmsSmilAtoIHexa((char *)&pContent[1]); + pRegion->bgColor = MsgSmilAtoIHexa((char *)&pContent[1]); pRegion->nLeft.value = MSG_SMIL_SECOND_REG_LEFT; pRegion->nLeft.bUnitPercent = true; @@ -335,7 +335,7 @@ MSG_SMIL_ERR_E _MsgMMSAddDefaultFullSMILRegion(MMS_MESSAGE_DATA_S *pMsgData) pRegion->fit = MMSUI_IMAGE_REGION_FIT_MEET; else pRegion->fit = MMSUI_IMAGE_REGION_FIT_HIDDEN; - pRegion->bgColor = MmsSmilAtoIHexa((char *)&pContent[1]); + pRegion->bgColor = MsgSmilAtoIHexa((char *)&pContent[1]); pRegion->nLeft.value = MSG_SMIL_FULL_REG_LEFT; pRegion->nLeft.bUnitPercent = true; diff --git a/plugin/mms_plugin/MmsPluginSmil.cpp b/plugin/mms_plugin/MmsPluginSmil.cpp deleted file mode 100755 index 79ce1c9..0000000 --- a/plugin/mms_plugin/MmsPluginSmil.cpp +++ /dev/null @@ -1,2660 +0,0 @@ -/* -* Copyright 2012-2013 Samsung Electronics Co., Ltd -* -* Licensed under the Flora License, Version 1.1 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://floralicense.org/license/ -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include - -#include "MsgMmsMessage.h" -#include "MsgUtilFile.h" -#include "MmsPluginTypes.h" -#include "MmsPluginSmil.h" -#include "MmsPluginMIME.h" -#include "MmsPluginStorage.h" -#include "MmsPluginDebug.h" -#include "MmsPluginCodec.h" - -#define MSG_STDSTR_SHORT 0x7F - -/* static variables */ -static char gszEmptyRawDoc[] = ""; -static MmsSmilDoc *__gpaMmsSmilDoc[MMS_SMIL_MAX_DOC]={NULL, }; -static char gszColor[MMS_SMIL_COLOR_SIZE] = {0, }; - - -char *MmsSmilGetPresentationData(msg_message_id_t msgId) -{ - MmsMsg *pMsg; - - MmsPluginStorage::instance()->getMmsMessage(&pMsg); - - if (pMsg == NULL) { - MSG_DEBUG("pMsg is NULL"); - goto _LCATCH; - } - - if (msgId != pMsg->msgID) { - MSG_DEBUG("Invalid Message Id"); - return NULL; - } - - if (!pMsg->msgBody.pPresentationBody) - goto _LCATCH; - - if (!pMsg->msgBody.pPresentationBody->body.pText) - goto _LCATCH; - else - return pMsg->msgBody.pPresentationBody->body.pText; - -_LCATCH: - return NULL; -} - -bool MmsSmilParseSmilDoc(MMS_MESSAGE_DATA_S *pMmsMsg, char *pSmilDoc) -{ - xmlDocPtr doc; - xmlNodePtr cur; - MSG_DEBUG("%s", pSmilDoc); - doc = xmlParseMemory(pSmilDoc, strlen(pSmilDoc)); - - if (doc == NULL) { - MSG_DEBUG("Document not parsed successfully. \n"); - return false; - } - - cur = xmlDocGetRootElement(doc); - - if (cur == NULL) { - MSG_DEBUG("empty document\n"); - xmlFreeDoc(doc); - return false; - } - - if (xmlStrcmp(cur->name, (const xmlChar *) "smil")) { - MSG_DEBUG("document of the wrong type, root node != smil"); - xmlFreeDoc(doc); - return false; - } - - MmsSmilGetElement(pMmsMsg, cur); - - xmlFreeDoc(doc); - - return true; -} - -void MmsSmilGetElement(MMS_MESSAGE_DATA_S *pMmsMsg, xmlNode *a_node) -{ - MSG_BEGIN(); - - int elementType; - int attrType; - MMS_SMIL_ROOTLAYOUT rootlayout = {}; - static bool cmd[ELEMENT_MAX] = {false, }; - static MMS_SMIL_REGION *pRegion; - static MMS_PAGE_S *pPage; - static MMS_MEDIA_S *pMedia; - static MMS_SMIL_TRANSITION *pTransition; - static MMS_SMIL_META *pMeta; - - xmlNode *cur_node = NULL; - - for (cur_node = a_node; cur_node; cur_node = cur_node->next) { - MSG_DEBUG("******* node, name: %s ***\n", cur_node->name); - - if (cur_node->type == XML_ELEMENT_NODE) { - // Get Smil Element ===================================================== - MSG_DEBUG("*** node type: Element, name: %s ***\n", cur_node->name); - - switch (elementType = MmsSmilGetElementID((char *)cur_node->name)) { - case ELEMENT_ROOTLAYOUT: - memset(cmd, 0, ELEMENT_MAX); - cmd[ELEMENT_ROOTLAYOUT] = true; - break; - - case ELEMENT_REGION: - pRegion = (MMS_SMIL_REGION *)calloc(sizeof(MMS_SMIL_REGION), 1); - memset(cmd, 0, ELEMENT_MAX); - cmd[ELEMENT_REGION] = true; - break; - - case ELEMENT_TRANSITION: - pTransition = (MMS_SMIL_TRANSITION *)calloc(sizeof(MMS_SMIL_TRANSITION), 1); - memset(cmd, 0, ELEMENT_MAX); - cmd[ELEMENT_TRANSITION] = true; - break; - - case ELEMENT_META: - pMeta = (MMS_SMIL_META *)calloc(sizeof(MMS_SMIL_META), 1); - memset(cmd, 0, ELEMENT_MAX); - cmd[ELEMENT_META] = true; - break; - - case ELEMENT_PAR: - pPage = (MMS_PAGE_S *)calloc(sizeof(MMS_PAGE_S), 1); - memset(cmd, 0, ELEMENT_MAX); - cmd[ELEMENT_PAR] = true; - break; - - case ELEMENT_PARAM: // Need to check the original element type - break; - - case ELEMENT_TEXT: - pMedia = (MMS_MEDIA_S *)calloc(sizeof(MMS_MEDIA_S), 1); - pMedia->mediatype = MMS_SMIL_MEDIA_TEXT; - memset(cmd, 0, ELEMENT_MAX); - cmd[ELEMENT_TEXT] = true; - break; - - case ELEMENT_IMG: - pMedia = (MMS_MEDIA_S *)calloc(sizeof(MMS_MEDIA_S), 1); - pMedia->mediatype = MMS_SMIL_MEDIA_IMG; - memset(cmd, 0, ELEMENT_MAX); - cmd[ELEMENT_IMG] = true; - break; - - case ELEMENT_AUDIO: - pMedia = (MMS_MEDIA_S *)calloc(sizeof(MMS_MEDIA_S), 1); - pMedia->mediatype = MMS_SMIL_MEDIA_AUDIO; - memset(cmd, 0, ELEMENT_MAX); - cmd[ELEMENT_AUDIO] = true; - break; - - case ELEMENT_VIDEO: - pMedia = (MMS_MEDIA_S *)calloc(sizeof(MMS_MEDIA_S), 1); - pMedia->mediatype = MMS_SMIL_MEDIA_VIDEO; - memset(cmd, 0, ELEMENT_MAX); - cmd[ELEMENT_VIDEO] = true; - break; - - case ELEMENT_REF: - pMedia = (MMS_MEDIA_S *)calloc(sizeof(MMS_MEDIA_S), 1); - pMedia->mediatype = MMS_SMIL_MEDIA_IMG_OR_VIDEO; - memset(cmd, 0, ELEMENT_MAX); - cmd[ELEMENT_REF] = true; - break; - - case ELEMENT_ANIMATE: - pMedia = (MMS_MEDIA_S *)calloc(sizeof(MMS_MEDIA_S), 1); - pMedia->mediatype = MMS_SMIL_MEDIA_ANIMATE; - memset(cmd, 0, ELEMENT_MAX); - cmd[ELEMENT_ANIMATE] = true; - break; - - default: - memset(cmd, 0, ELEMENT_MAX); - break; - } - - //Get Smil Attribute ===================================================== - xmlAttr *pAttr = cur_node->properties; - SMIL_ATTRIBUTE_T paramType = ATTRIBUTE_UNKNOWN; - - for ( ; pAttr; pAttr = pAttr->next) { - MSG_DEBUG("AttributeType: (%s, %s) ", pAttr->name, pAttr->children->content); - switch (attrType = MmsSmilGetAttrID((char *)pAttr->name)) { - case ATTRIBUTE_ID: - { - if (cmd[ELEMENT_REGION]) { - strncpy(pRegion->szID, (char *)pAttr->children->content, MAX_SMIL_REGION_ID - 1); - } else if (cmd[ELEMENT_TRANSITION]) { - strncpy(pTransition->szID, (char *)pAttr->children->content, MAX_SMIL_TRANSITION_ID - 1); - } else if (cmd[ELEMENT_META]) { - strncpy(pMeta->szID, (char *)pAttr->children->content, MAX_SMIL_META_ID - 1); - } - } - break; - - case ATTRIBUTE_TOP: - { - int bUnitPercent; - int value; - - if (strchr((char *)pAttr->children->content, '%')) - bUnitPercent = true; - else - bUnitPercent = false; - - value = atoi((char *)pAttr->children->content); - - if (cmd[ELEMENT_REGION]) { - pRegion->nTop.bUnitPercent = bUnitPercent; - pRegion->nTop.value = value; - } - } - break; - - case ATTRIBUTE_LEFT: - { - int bUnitPercent; - int value; - - if (strchr((char *)pAttr->children->content, '%')) - bUnitPercent = true; - else - bUnitPercent = false; - - value = atoi((char *)pAttr->children->content); - - if (cmd[ELEMENT_REGION]) { - pRegion->nLeft.bUnitPercent = bUnitPercent; - pRegion->nLeft.value = value; - } - } - break; - - - case ATTRIBUTE_WIDTH: - { - int bUnitPercent; - int value; - - if (strchr((char *)pAttr->children->content, '%')) - bUnitPercent = true; - else - bUnitPercent = false; - - value = atoi((char *)pAttr->children->content); - - if (cmd[ELEMENT_ROOTLAYOUT]) { - rootlayout.width.bUnitPercent = bUnitPercent; - rootlayout.width.value = value; - } else if (cmd[ELEMENT_REGION]) { - pRegion->width.bUnitPercent = bUnitPercent; - pRegion->width.value = value; - } - } - break; - - case ATTRIBUTE_HEIGHT: - { - int bUnitPercent; - int value; - - if (strchr((char *)pAttr->children->content, '%')) - bUnitPercent = true; - else - bUnitPercent = false; - - value = atoi((char *)pAttr->children->content); - - if (cmd[ELEMENT_ROOTLAYOUT]) { - rootlayout.height.bUnitPercent = bUnitPercent; - rootlayout.height.value = value; - } else if (cmd[ELEMENT_REGION]) { - pRegion->height.bUnitPercent = bUnitPercent; - pRegion->height.value = value; - } - } - break; - - case ATTRIBUTE_FIT: - if (cmd[ELEMENT_REGION]) { - if (!strcmp((char *)pAttr->children->content, "meet")) { - pRegion->fit = MMSUI_IMAGE_REGION_FIT_MEET; - } else { - pRegion->fit = MMSUI_IMAGE_REGION_FIT_HIDDEN; - } - } - break; - - case ATTRIBUTE_BGCOLOR: - if (cmd[ELEMENT_ROOTLAYOUT]) { - rootlayout.bBgColor = true; - rootlayout.bgColor = MmsSmilGetColorValue(pAttr->children->content); - } else if (cmd[ELEMENT_REGION]) { - pRegion->bBgColor = true; - pRegion->bgColor = MmsSmilGetColorValue(pAttr->children->content); - } else if (cmd[ELEMENT_TEXT]) - pMedia->sMedia.sText.nBgColor = MmsSmilGetColorValue(pAttr->children->content); - else - pMedia->sMedia.sAVI.nBgColor = MmsSmilGetColorValue(pAttr->children->content); - - break; - - case ATTRIBUTE_DUR: - if (cmd[ELEMENT_PAR]) - pPage->nDur = MmsSmilGetTime((char *)pAttr->children->content); - else if (cmd[ELEMENT_TRANSITION]) - pTransition->nDur = MmsSmilGetTime((char *)pAttr->children->content); - else if (cmd[ELEMENT_TEXT]) - pMedia->sMedia.sText.nDurTime = MmsSmilGetTime((char *)pAttr->children->content); - else - pMedia->sMedia.sAVI.nDurTime = MmsSmilGetTime((char *)pAttr->children->content); - -#ifdef MMS_SMIL_ANIMATE - if (cmd[ELEMENT_ANIMATE]) - pMedia->sMedia.sAVI.nDur = MmsSmilGetTime((char *)pAttr->children->content); -#endif - break; - - case ATTRIBUTE_SRC: - { - char *szSrc; - char szTmpSrc[MSG_FILEPATH_LEN_MAX] = {0,}; - char szOutBuf[MSG_FILEPATH_LEN_MAX] = {0, }; - int cLen; - int ret; - MsgMultipart *pPart = NULL; - MmsMsg *pMsg; - - szSrc = MsgChangeHexString((char *)pAttr->children->content); - if (szSrc == NULL) - break; - - memcpy(pMedia->szSrc, szSrc, strlen(szSrc) + 1); - free(szSrc); - - cLen = strlen(pMedia->szSrc); - if (!strncasecmp(pMedia->szSrc, "cid:", 4)) { - strncpy(szTmpSrc, pMedia->szSrc + 4, cLen - 4); - szTmpSrc[cLen - 4] = '\0'; - } else { - strncpy(szTmpSrc, pMedia->szSrc, cLen); - szTmpSrc[cLen] = '\0'; - } - - MmsPluginStorage::instance()->getMmsMessage(&pMsg); - pPart = pMsg->msgBody.body.pMultipart; -#ifndef __SUPPORT_DRM__ - ret = MmsSmilGetMediaSrcForNormalMsg(szOutBuf, szTmpSrc, pPart); -#else - ret = MmsSmilGetMediaSrcForNormalMsg(szOutBuf, szTmpSrc, pPart, pMedia); -#endif - if (ret >= 0 && strlen(szOutBuf) > 0) { - strcpy(pMedia->szSrc, szOutBuf); - MmsSmilGetMediaFilePath(pMedia, szTmpSrc, pMsg->msgID); - } - break; - } - case ATTRIBUTE_COLOR: - if (cmd[ELEMENT_TEXT]) - pMedia->sMedia.sText.nColor = MmsSmilGetColorValue(pAttr->children->content); - break; - - case ATTRIBUTE_SIZE: - if (cmd[ELEMENT_TEXT]) - pMedia->sMedia.sText.nSize = atoi((char *)pAttr->children->content); - break; - - case ATTRIBUTE_BOLD: - if (cmd[ELEMENT_TEXT]) { - pMedia->sMedia.sText.bBold = MmsSmilGetFontAttrib((char *)pAttr->children->content); - } - break; - - case ATTRIBUTE_UNDERLINE: - if (cmd[ELEMENT_TEXT]) - pMedia->sMedia.sText.bUnderLine = MmsSmilGetFontAttrib((char *)pAttr->children->content); - break; - - case ATTRIBUTE_ITALIC: - if (cmd[ELEMENT_TEXT]) - pMedia->sMedia.sText.bItalic = MmsSmilGetFontAttrib((char *)pAttr->children->content); - break; - - case ATTRIBUTE_REVERSE: - if (cmd[ELEMENT_TEXT]) - pMedia->sMedia.sText.bReverse = MmsSmilGetFontAttrib((char *)pAttr->children->content); - break; - - case ATTRIBUTE_DIRECTION: - if (cmd[ELEMENT_TEXT]) - pMedia->sMedia.sText.nDirection = MmsSmilGetFontDirection((char *)pAttr->children->content); - break; - case ATTRIBUTE_REGION: - strncpy(pMedia->regionId, (char *)pAttr->children->content, MAX_SMIL_REGION_ID - 1); - break; - - case ATTRIBUTE_TRANSIN: - if (cmd[ELEMENT_TEXT]) - strncpy(pMedia->sMedia.sText.szTransInId, (char *)pAttr->children->content, MAX_SMIL_TRANSIN_ID - 1); - else - strncpy(pMedia->sMedia.sAVI.szTransInId, (char *)pAttr->children->content, MAX_SMIL_TRANSIN_ID - 1); - break; - - case ATTRIBUTE_TRANSOUT: - if (cmd[ELEMENT_TEXT]) - strncpy(pMedia->sMedia.sText.szTransOutId, (char *)pAttr->children->content, MAX_SMIL_TRANSOUT_ID - 1); - else - strncpy(pMedia->sMedia.sAVI.szTransOutId, (char *)pAttr->children->content, MAX_SMIL_TRANSOUT_ID - 1); - break; - - case ATTRIBUTE_BEGIN: - if (cmd[ELEMENT_TEXT]) - pMedia->sMedia.sText.nBegin = MmsSmilGetTime((char *)pAttr->children->content); - else - pMedia->sMedia.sAVI.nBegin = MmsSmilGetTime((char *)pAttr->children->content); - break; - - case ATTRIBUTE_END: - if (cmd[ELEMENT_TEXT]) - pMedia->sMedia.sText.nEnd = MmsSmilGetTime((char *)pAttr->children->content); - else - pMedia->sMedia.sAVI.nEnd = MmsSmilGetTime((char *)pAttr->children->content); - break; - - case ATTRIBUTE_REPEAT_COUNT: - if (cmd[ELEMENT_TEXT]) - pMedia->sMedia.sText.nRepeat = atoi((char *)pAttr->children->content); - else - pMedia->sMedia.sAVI.nRepeat = atoi((char *)pAttr->children->content); - break; - - case ATTRIBUTE_NAME: - if (!strcmp((char *)pAttr->children->content, "foreground-color") || !strcmp((char *)pAttr->children->content, "foregroundcolor")) - paramType = ATTRIBUTE_FGCOLOR; - else if (!strcmp((char *)pAttr->children->content, "background-color") || !strcmp((char *)pAttr->children->content, "backgroundcolor")) - paramType = ATTRIBUTE_BGCOLOR; - else if (!strcmp((char *)pAttr->children->content, "textsize")) - paramType = ATTRIBUTE_SIZE; - else if (!strcmp((char *)pAttr->children->content, "textattribute")) - paramType = ATTRIBUTE_TEXTFORMAT; - - if (cmd[ELEMENT_META]) - strncpy(pMeta->szName, (char *)pAttr->children->content, MAX_SMIL_META_NAME - 1); - break; - - case ATTRIBUTE_VALUE: - if (paramType == ATTRIBUTE_SIZE && cmd[ELEMENT_TEXT]) - pMedia->sMedia.sText.nSize = MmsSmilGetFontSizeValue((char *)pAttr->children->content); - else if (paramType == ATTRIBUTE_FGCOLOR && cmd[ELEMENT_TEXT]) - pMedia->sMedia.sText.nColor = MmsSmilGetColorValue(pAttr->children->content); - else if (paramType == ATTRIBUTE_BGCOLOR && cmd[ELEMENT_TEXT]) - pMedia->sMedia.sText.nBgColor = MmsSmilGetColorValue(pAttr->children->content); - else if (paramType == ATTRIBUTE_TEXTFORMAT && cmd[ELEMENT_TEXT]) { - MmsSmilFontType fontType; - - fontType = MmsSmilGetFontTypeValue((char *)pAttr->children->content); - - if (fontType == MMS_SMIL_FONT_TYPE_BOLD) - pMedia->sMedia.sText.bBold = true; - else - pMedia->sMedia.sText.bBold = false; - - if (fontType == MMS_SMIL_FONT_TYPE_ITALIC) - pMedia->sMedia.sText.bItalic = true; - else - pMedia->sMedia.sText.bItalic = false; - - if (fontType == MMS_SMIL_FONT_TYPE_UNDERLINE) - pMedia->sMedia.sText.bUnderLine = true; - else - pMedia->sMedia.sText.bUnderLine = false; - } - break; - - case ATTRIBUTE_ALT: - strncpy(pMedia->szAlt, (char *)pAttr->children->content, MAX_SMIL_ALT_LEN - 1); - break; - - case ATTRIBUTE_TYPE: - pTransition->nType = (MmsSmilTransType)atoi((char *)pAttr->children->content); - - switch (pTransition->nType) { - case MMS_SMIL_TRANS_SLIDEWIPE: - pTransition->nSubType = MMS_SMIL_TRANS_SUB_FROM_LEFT; - break; - case MMS_SMIL_TRANS_BARWIPE: - pTransition->nSubType = MMS_SMIL_TRANS_SUB_TOP_TO_BOTTOM; - break; - case MMS_SMIL_TRANS_BARNDOORWIPE: - pTransition->nSubType = MMS_SMIL_TRANS_SUB_HORIZONTAL; - break; - default: - pTransition->nSubType = MMS_SMIL_TRANS_SUB_NONE; - break; - } - - break; - - case ATTRIBUTE_SUBTYPE: - pTransition->nSubType = (MmsSmilTransSubType)atoi((char *)pAttr->children->content); - break; - - case ATTRIBUTE_CONTENT: - strncpy(pMeta->szContent, (char *)pAttr->children->content, MAX_SMIL_META_CONTENT - 1); - break; -#ifdef MMS_SMIL_ANIMATE - case ATTRIBUTE_ATTRIBUTE_NAME: - strcpy(pMedia->sMedia.sAVI.nAttributeName, (char *)pAttr->children->content); - break; - - case ATTRIBUTE_ATTRIBUTE_TYPE: - strcpy(pMedia->sMedia.sAVI.nAttributeType, (char *)pAttr->children->content); - break; - - case ATTRIBUTE_TARGET_ELEMENT: - strcpy(pMedia->sMedia.sAVI.nTargetElement, (char *)pAttr->children->content); - break; - - case ATTRIBUTE_FROM: - pMedia->sMedia.sAVI.nFrom = atoi((char *)pAttr->children->content); - break; - - case ATTRIBUTE_TO: - pMedia->sMedia.sAVI.nTo = atoi((char *)pAttr->children->content); - break; - - case ATTRIBUTE_BY: - pMedia->sMedia.sAVI.nBy = atoi((char *)pAttr->children->content); - break; - - case ATTRIBUTE_VALUES: - pMedia->sMedia.sAVI.nValues = atoi((char *)pAttr->children->content); - break; - - case ATTRIBUTE_CALCMODE: - strcpy(pMedia->sMedia.sAVI.nCalcMode, (char *)pAttr->children->content); - break; -#endif - default: - MSG_DEBUG("Undefined Attribute was found!!!!!"); - } - } - - if (paramType == ATTRIBUTE_UNKNOWN && cmd[ELEMENT_REGION]) { - // Insert a region to region list - _MsgMmsAddRegion(pMmsMsg, pRegion); - } else if (paramType == ATTRIBUTE_UNKNOWN && cmd[ELEMENT_PAR]) { - //Insert a page to page list - _MsgMmsAddPage(pMmsMsg, pPage); - } else if (paramType == ATTRIBUTE_UNKNOWN && (cmd[ELEMENT_TEXT] ||cmd[ELEMENT_IMG] ||cmd[ELEMENT_AUDIO] ||cmd[ELEMENT_VIDEO] ||cmd[ELEMENT_ANIMATE])) { - //Insert a media to media list - _MsgMmsAddMedia(pPage, pMedia); - } else if (paramType == ATTRIBUTE_UNKNOWN && cmd[ELEMENT_ROOTLAYOUT]) { - _MsgMmsSetRootLayout(pMmsMsg, &rootlayout); - } else if (paramType == ATTRIBUTE_UNKNOWN && cmd[ELEMENT_TRANSITION]) { - //Insert a transition to transition list - _MsgMmsAddTransition(pMmsMsg, pTransition); - } else if (paramType == ATTRIBUTE_UNKNOWN && cmd[ELEMENT_META]) { - //Insert a meta to meta list - _MsgMmsAddMeta(pMmsMsg, pMeta); - } - - paramType = ATTRIBUTE_UNKNOWN; - } - - MmsSmilGetElement(pMmsMsg, cur_node->children); - } - - MSG_END(); -} - - -int MmsSmilGetColorValue(xmlChar *content) -{ - int color; - - if (content[0] == '#') // RGB value - color = MmsSmilAtoIHexa((char *)&content[1]); - else if (content[0] == '0' && (content[1] == 'x' || content[1] == 'X')) - color = MmsSmilAtoIHexa((char *)&content[2]); - else { - MSG_DEBUG("Invalid Color Value"); - color = -1; - } - - return color; -} - -int MmsSmilAtoIHexa(char *pInput) -{ - int res = 0; - int len = 0; - int temp = 1; - int i = 0; - int j = 0; - char *pOutput = NULL; - - MSG_DEBUG("__MmsSmilAtoIHexa() enter..\n"); - - len = strlen(pInput); - pOutput = (char *)malloc(len + 1); - - if (pOutput == NULL) { - MSG_DEBUG("__MmsSmilAtoIHexa: Memory full \n"); - goto __CATCH; - } - - memset(pOutput, 0, len + 1); - - for (i = len - 1; i >= 0; i--) { - for (j = 0; j < (len - 1 - i); j++) { - temp *= 16; - } - - switch (pInput[i]) { - case '0': - pOutput[i] = 0; - break; - - case '1': - pOutput[i] = 1; - break; - - case '2': - pOutput[i] = 2; - break; - - case '3': - pOutput[i] = 3; - break; - - case '4': - pOutput[i] = 4; - break; - - case '5': - pOutput[i] = 5; - break; - - case '6': - pOutput[i] = 6; - break; - - case '7': - pOutput[i] = 7; - break; - - case '8': - pOutput[i] = 8; - break; - - case '9': - pOutput[i] = 9; - break; - - case 'a': - case 'A': - pOutput[i] = 10; - break; - - case 'b': - case 'B': - pOutput[i] = 11; - break; - - case 'c': - case 'C': - pOutput[i] = 12; - break; - - case 'd': - case 'D': - pOutput[i] = 13; - break; - - case 'e': - case 'E': - pOutput[i] = 14; - break; - - case 'f': - case 'F': - pOutput[i] = 15; - break; - } - - res += (pOutput[i] * temp); - temp = 1; - } - -__CATCH: - - if (pOutput) { - free(pOutput); - pOutput = NULL; - } - - return res; -} - -int MmsSmilGetTime(char *pValue) -{ - char *pTemp = NULL; - bool bMSec = false; - int retVal = 0; - int i = 0; - int len = 0; - - if (pValue == NULL || pValue[0] == '\0') - return 0; - - len = strlen(pValue); - - /* Default time unit -> millisecond */ - if (strstr(pValue, "msec")) - bMSec = true; - - if (strstr(pValue, "ms")) - bMSec = true; - - pTemp = (char *)malloc(strlen(pValue) + 1); - - if (NULL == pTemp) { - MSG_DEBUG("__MmsSmilGetTime : malloc for