From 9efed2370d64fd2d18c5d87eb3904d03756c7df0 Mon Sep 17 00:00:00 2001 From: Jean-Benoit MARTIN Date: Fri, 21 Mar 2014 14:55:07 +0100 Subject: [PATCH] Remove hardcoded path for multiuser support Bug-Tizen: PTREL-185 Change-Id: I2be4de2fa64bd91a8934f1af4a48f01133922b49 Signed-off-by: Jean-Benoit MARTIN --- CMakeLists.txt | 25 +- framework/CMakeLists.txt | 2 +- framework/main.cpp | 2 +- framework/submit-handler/MsgSubmitHandler.cpp | 4 +- .../transaction-manager/MsgCmdHandlerStorage.cpp | 19 + include/common/MsgInternalTypes.h | 13 +- include/utils/MsgNotificationWrapper.h | 2 +- include/utils/MsgSqliteWrapper.h | 4 +- msg_service-init-DB.sh | 356 +++++++++++++++++++ packaging/msg-service.spec | 381 +-------------------- plugin/mms_plugin/CMakeLists.txt | 2 +- plugin/mms_plugin/MmsPluginDecode.cpp | 37 +- plugin/mms_plugin/MmsPluginHttp.cpp | 2 +- plugin/mms_plugin/MmsPluginInternal.cpp | 10 +- plugin/mms_plugin/MmsPluginMain.cpp | 2 +- plugin/mms_plugin/MmsPluginMessage.cpp | 6 +- plugin/mms_plugin/MmsPluginSmil.cpp | 4 +- plugin/mms_plugin/MmsPluginStorage.cpp | 8 +- plugin/mms_plugin/MmsPluginUserAgent.cpp | 2 +- plugin/mms_plugin/include/MmsPluginDrm.h | 2 +- utils/CMakeLists.txt | 2 +- utils/MsgSqliteWrapper.cpp | 50 ++- utils/MsgUtilFile.cpp | 12 +- utils/MsgUtilStorage.cpp | 18 +- 24 files changed, 543 insertions(+), 422 deletions(-) create mode 100644 msg_service-init-DB.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 186ffea..dac5893 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,12 @@ SET(MAPI-LIB msg_mapi) SET(SMS-PLUGIN-LIB msg_sms_plugin) SET(MMS-PLUGIN-LIB msg_mms_plugin) +########################################################## +# Add Definition +########################################################## +#IF(DEFINED MSGFW_DB_SCHEMA) +# ADD_DEFINITIONS(-DMSGFW_DB_SCHEMA=\"${MSGFW_DB_SCHEMA}\") +#ENDIF(DEFINED MSGFW_DB_SCHEMA) ########################################################## # Add Subdirectories @@ -44,27 +50,26 @@ INSTALL(FILES ${MAPI-HEADERS} DESTINATION include/msg-service) # Install etc Files ########################################################## CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config/plugin.cfg.in ${CMAKE_CURRENT_SOURCE_DIR}/config/plugin.cfg @ONLY) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config/plugin.cfg DESTINATION /usr/share/msg-service) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config/plugin.cfg DESTINATION ${SHARE_INSTALL_PREFIX}/msg-service) SET(RINGTONE-FILES ${CMAKE_CURRENT_SOURCE_DIR}/config/message_tone/Sherbet.wav ) -INSTALL(FILES ${RINGTONE-FILES} DESTINATION /usr/share/media/) +INSTALL(FILES ${RINGTONE-FILES} DESTINATION ${SHARE_INSTALL_PREFIX}/media/) CONFIGURE_FILE(msg-service.pc.in msg-service.pc @ONLY) INSTALL(FILES ${CMAKE_BINARY_DIR}/msg-service.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) SET(RC_LOCAL_SCRIPT msg-server) -INSTALL(PROGRAMS ${RC_LOCAL_SCRIPT} DESTINATION /etc/rc.d/init.d) - -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/msg-service.service DESTINATION /usr/lib/systemd/user) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/msg-service-log.service DESTINATION /usr/lib/systemd/user) +INSTALL(PROGRAMS ${RC_LOCAL_SCRIPT} DESTINATION ${SYSCONF_INSTALL_DIR}/rc.d/init.d) -# LICENSE file -INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE.Flora DESTINATION /usr/share/license/msg-service) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/msg-service.service DESTINATION ${UNITDIR_USER}) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/msg-service-log.service DESTINATION ${UNITDIR_USER}) +# db init script +INSTALL(FILES ${CMAKE_SOURCE_DIR}/msg_service-init-DB.sh DESTINATION ${TZ_SYS_SHARE}/msg-service) #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}/sysinfo-message.xml DESTINATION ${SYSCONF_INSTALL_DIR}/config) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/sysinfo-message.emul.xml DESTINATION ${SYSCONF_INSTALL_DIR}/config) diff --git a/framework/CMakeLists.txt b/framework/CMakeLists.txt index ef2ad7f..536bf64 100755 --- a/framework/CMakeLists.txt +++ b/framework/CMakeLists.txt @@ -27,7 +27,7 @@ INCLUDE_DIRECTORIES( ) INCLUDE(FindPkgConfig) -pkg_check_modules(plugin_manager_pkgs REQUIRED glib-2.0 dlog vconf) +pkg_check_modules(plugin_manager_pkgs REQUIRED glib-2.0 dlog vconf libtzplatform-config) FOREACH(flag ${plugin_manager_pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") diff --git a/framework/main.cpp b/framework/main.cpp index 9f182c1..6661ddd 100755 --- a/framework/main.cpp +++ b/framework/main.cpp @@ -110,7 +110,7 @@ msg_error_t InitMmsDir() // 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); + snprintf(exeStr, 1024, "rm %s/*.DATA", MSG_IPC_DATA_PATH); system(exeStr); } else diff --git a/framework/submit-handler/MsgSubmitHandler.cpp b/framework/submit-handler/MsgSubmitHandler.cpp index 7cf32bc..a601310 100755 --- a/framework/submit-handler/MsgSubmitHandler.cpp +++ b/framework/submit-handler/MsgSubmitHandler.cpp @@ -131,7 +131,7 @@ 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); @@ -237,7 +237,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: diff --git a/framework/transaction-manager/MsgCmdHandlerStorage.cpp b/framework/transaction-manager/MsgCmdHandlerStorage.cpp index 5ba9191..e3306e5 100755 --- a/framework/transaction-manager/MsgCmdHandlerStorage.cpp +++ b/framework/transaction-manager/MsgCmdHandlerStorage.cpp @@ -15,6 +15,9 @@ */ #include +#include +#include +#include #include "MsgDebug.h" #include "MsgUtilFile.h" @@ -28,6 +31,7 @@ #include "MsgContact.h" #include "MsgCmdHandler.h" +#define DB_MSG_SERVICE_GROUPE 6011 /*================================================================================================== FUNCTION IMPLEMENTATION @@ -1026,6 +1030,8 @@ int MsgResetDatabaseHandler(const MSG_CMD_S *pCmd, char **ppEvent) int MsgGetMemSizeHandler(const MSG_CMD_S *pCmd, char **ppEvent) { msg_error_t err = MSG_SUCCESS; + struct stat sts; + int ret,fd; char* encodedData = NULL; AutoPtr buf(&encodedData); @@ -1035,6 +1041,19 @@ int MsgGetMemSizeHandler(const MSG_CMD_S *pCmd, char **ppEvent) // Get Memory size unsigned int memsize = 0; + ret = stat(MSG_DATA_ROOT_PATH, &sts); + if (ret == -1 && errno == ENOENT){ + mkdir(MSG_DATA_ROOT_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + fd = creat(MSG_DATA_ROOT_PATH, 0755); + if (0 <= fd){ + ret = fchown(fd, -1, DB_MSG_SERVICE_GROUPE); + if (-1 == ret){ + MSG_DEBUG("Failed to fchown on %s",MSG_DATA_ROOT_PATH); + } + close(fd); + } + } + memsize = MsgDu(MSG_DATA_ROOT_PATH); dataSize = MsgEncodeMemSize(&memsize, &encodedData); diff --git a/include/common/MsgInternalTypes.h b/include/common/MsgInternalTypes.h index 9ba43e3..3e31e3a 100755 --- a/include/common/MsgInternalTypes.h +++ b/include/common/MsgInternalTypes.h @@ -28,17 +28,18 @@ ==================================================================================================*/ #include "MsgMmsTypes.h" #include +#include /*================================================================================================== DEFINES ==================================================================================================*/ -#define MSG_DATA_ROOT_PATH "/opt/usr/data/msg-service/" -#define MSG_DATA_PATH MSG_DATA_ROOT_PATH"msgdata/" -#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/" +#define MSG_DATA_ROOT_PATH tzplatform_mkpath(TZ_USER_DATA,"msg-service") +#define MSG_DATA_PATH tzplatform_mkpath3(TZ_USER_DATA,"msg-service","msgdata") +#define MSG_SMIL_FILE_PATH tzplatform_mkpath3(TZ_USER_DATA,"msg-service","smildata") +#define MSG_IPC_DATA_PATH tzplatform_mkpath3(TZ_USER_DATA,"msg-service","ipcdata") +#define MSG_THUMBNAIL_PATH tzplatform_mkpath4(TZ_USER_DATA,"msg-service","ipcdata","thumbnails") // temporary -#define TPDU_LOG_FILE MSG_DATA_ROOT_PATH"tpduLog.txt" +#define TPDU_LOG_FILE tzplatform_mkpath3(TZ_USER_DATA,"msg-service","tpduLog.txt") #define MSG_NATIONAL_SIM "memory/private/msg-service/national_sim" #define MSG_SIM_MSISDN "memory/private/msg-service/msisdn" #define MAX_FULL_PATH_SIZE 320 // max length for internal file path diff --git a/include/utils/MsgNotificationWrapper.h b/include/utils/MsgNotificationWrapper.h index 8642c4e..f97ff54 100755 --- a/include/utils/MsgNotificationWrapper.h +++ b/include/utils/MsgNotificationWrapper.h @@ -29,7 +29,7 @@ ==================================================================================================*/ #define MSG_APP_PACKAGE_NAME "message" #define MSG_SYS_PACKAGE_NAME "sys_string" -#define NORMAL_MSG_ICON_PATH "/opt/usr/apps/8r4r5ddzzn/shared/res/screen-density-xhigh/mainmenu.png" +#define NORMAL_MSG_ICON_PATH tzplatform_mkpath(TZ_USER_APP,"8r4r5ddzzn/shared/res/screen-density-xhigh/mainmenu.png") #define MSG_APP_LOCALEDIR "/usr/apps/org.tizen.message/res/locale" diff --git a/include/utils/MsgSqliteWrapper.h b/include/utils/MsgSqliteWrapper.h index 8f35985..6ef7468 100755 --- a/include/utils/MsgSqliteWrapper.h +++ b/include/utils/MsgSqliteWrapper.h @@ -20,13 +20,14 @@ /*================================================================================================== INCLUDE FILES ==================================================================================================*/ +#include #include "MsgTypes.h" /*================================================================================================== DEFINES ==================================================================================================*/ -#define MSGFW_DB_NAME "/opt/usr/dbspace/.msg_service.db" +#define MSGFW_DB_NAME tzplatform_mkpath(TZ_USER_DB,".msg_service.db") #define MSGFW_MESSAGE_TABLE_NAME "MSG_MESSAGE_TABLE" #define MSGFW_FOLDER_TABLE_NAME "MSG_FOLDER_TABLE" @@ -56,6 +57,7 @@ ==================================================================================================*/ void MsgReleaseMemoryDB(); msg_error_t MsgConvertStrWithEscape(const char *input, char **output); +int XSystem(const char *argv[]); /*================================================================================================== CLASS DEFINITIONS diff --git a/msg_service-init-DB.sh b/msg_service-init-DB.sh new file mode 100644 index 0000000..91cee0f --- /dev/null +++ b/msg_service-init-DB.sh @@ -0,0 +1,356 @@ +#!/bin/sh + +source /etc/tizen-platform.conf + +if [ ! -f $TZ_USER_DB/.msg_service.db ] +then + mkdir -p $TZ_USER_DB/ + sqlite3 $TZ_USER_DB/.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 :db_msg_service $TZ_USER_DB/.msg_service.db +chown :db_msg_service $TZ_USER_DB/.msg_service.db-journal +chmod 660 $TZ_USER_DB/.msg_service.db +chmod 660 $TZ_USER_DB/.msg_service.db-journal +chsmack -a 'User' $TZ_USER_DB/.msg_service.db* + +########## Setting Config Value (Internal keys) ########## +vcuid=$UID +users_gid=$(getent group $TZ_SYS_USER_GROUP | cut -f3 -d':') +# Message Server Status +vconftool set -t bool memory/msg/ready 0 -i -g users_gid -u $vcuid + +# SMS Send Options +vconftool set -t int db/msg/network_mode 2 -u $vcuid + +# 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 + +########## 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# MMS Size Options +vconftool set -t int db/private/msg-service/size_opt/msg_size 300 -u $vcuid + +# 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 + +# 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 db/private/msg-service/notification_priv_id 0 -u $vcuid diff --git a/packaging/msg-service.spec b/packaging/msg-service.spec index 6c244e9..4e4aa89 100755 --- a/packaging/msg-service.spec +++ b/packaging/msg-service.spec @@ -49,6 +49,7 @@ BuildRequires: pkgconfig(tapi) BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(feedback) BuildRequires: pkgconfig(capi-network-connection) +BuildRequires: pkgconfig(libtzplatform-config) %description Description: Messaging Framework Library @@ -106,12 +107,15 @@ cp %{SOURCE1001} %{SOURCE1002} %{SOURCE1003} %{SOURCE1004} %{SOURCE1005} . %build -%cmake . +%cmake . \ + -DTZ_SYS_SHARE=%TZ_SYS_SHARE \ + -DUNITDIR_USER=%{_unitdir_user} \ + -DTZ_SYS_SMACK=%TZ_SYS_SMACK + make %{?jobs:-j%jobs} %install rm -rf %{buildroot} -mkdir -p %{buildroot}/usr/share/license mkdir -p %{buildroot}/etc/config mkdir -p %{buildroot}/var/log/msgfw @@ -145,361 +149,6 @@ rm %{buildroot}/etc/config/sysinfo-message.emul.xml %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 -chsmack -a 'User' /opt/usr/dbspace/.msg_service.db* -mkdir -p /opt/usr/data/msg-service -chgrp db_msg_service /opt/usr/data/msg-service - -########## Setting Config Value (Internal keys) ########## -vcuid=5000 -# Message Server Status -vconftool set -t bool memory/msg/ready 0 -i -g 5000 -u $vcuid - -# SMS Send Options -vconftool set -t int db/msg/network_mode 2 -u $vcuid - -# 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 - -########## 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 - -# 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 - -# 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 - -# 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 - -# 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 - -# 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 - -# 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 - -# MMS Size Options -vconftool set -t int db/private/msg-service/size_opt/msg_size 300 -u $vcuid - -# 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 - -# 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 db/private/msg-service/notification_priv_id 0 -u $vcuid - -/sbin/ldconfig /bin/systemctl daemon-reload if [ "$1" = "1" ]; then systemctl stop msg-service.service @@ -513,8 +162,8 @@ fi %files %manifest %{name}.manifest +%license LICENSE.Flora %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 @@ -522,7 +171,7 @@ fi %{_libdir}/libmsg_utils.so %{_libdir}/libmsg_transaction_proxy.so %{_libdir}/libmsg_vobject.so -/usr/share/license/msg-service/LICENSE.Flora +%TZ_SYS_SHARE/%{name}/msg_service-init-DB.sh %files devel %manifest %{name}-devel.manifest @@ -533,11 +182,12 @@ fi %files tools %manifest %{name}-tools.manifest +%license LICENSE.Flora %defattr(-,root,root,-) %{_bindir}/msg-helper %{_bindir}/msg-server %{_datadir}/media/Sherbet.wav -%attr(0644,root,root)/usr/share/msg-service/plugin.cfg +%attr(0644,root,root)%{_datadir}/msg-service/plugin.cfg %{_sysconfdir}/rc.d/init.d/msg-server %{_sysconfdir}/rc.d/rc3.d/S70msg-server %{_sysconfdir}/rc.d/rc5.d/S70msg-server @@ -545,23 +195,20 @@ fi %{_unitdir_user}/msg-service-log.service %{_unitdir_user}/tizen-middleware.target.wants/msg-service.service %{_unitdir_user}/tizen-middleware.target.wants/msg-service-log.service -/usr/share/license/msg-service/LICENSE.Flora -/etc/config/sysinfo-message.xml - -%attr(0755,app,app)/var/log/msgfw - +%{_sysconfdir}/config/sysinfo-message.xml +%attr(0755,root,%TZ_SYS_USER_GROUP) /var/log/msgfw %files -n sms-plugin %manifest sms-plugin.manifest +%license LICENSE.Flora %defattr(-,root,root,-) %{_libdir}/libmsg_sms_plugin.so -/usr/share/license/msg-service/LICENSE.Flora %files -n mms-plugin %manifest mms-plugin.manifest +%license LICENSE.Flora %defattr(-,root,root,-) %{_libdir}/libmsg_mms_plugin.so -/usr/share/license/msg-service/LICENSE.Flora %changelog * Wed Oct 25 2012 Sangkoo Kim diff --git a/plugin/mms_plugin/CMakeLists.txt b/plugin/mms_plugin/CMakeLists.txt index a0f874a..b568b25 100755 --- a/plugin/mms_plugin/CMakeLists.txt +++ b/plugin/mms_plugin/CMakeLists.txt @@ -45,7 +45,7 @@ INCLUDE_DIRECTORIES( ) 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 network libxml-2.0 drm-client libcurl mm-fileinfo mmutil-jpeg vconf dlog media-thumbnail capi-network-connection libtzplatform-config) FOREACH(flag ${mms_plugin_pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") diff --git a/plugin/mms_plugin/MmsPluginDecode.cpp b/plugin/mms_plugin/MmsPluginDecode.cpp index b7851f9..f6a8df3 100755 --- a/plugin/mms_plugin/MmsPluginDecode.cpp +++ b/plugin/mms_plugin/MmsPluginDecode.cpp @@ -2418,12 +2418,21 @@ __CATCH: 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 szTempFilePath[MSG_FILEPATH_LEN_MAX]; char *pRawData = NULL; bool isFileCreated = false; + int lenght; MSG_DEBUG("bodyLength: %d\n", bodyLength); + lenght = snprintf(NULL,0,"%s/drm.dcf",MSG_DATA_PATH); + if (lenght >= MSG_FILEPATH_LEN_MAX){ + MSG_DEBUG("File path lenght is too long "); + goto __CATCH; + } + + snprintf(szTempFilePath,lenght,"%s/drm.dcf",MSG_DATA_PATH); + offset = __MmsGetDecodeOffset(); if (offset >= totalLength) @@ -2614,16 +2623,34 @@ bool MmsDrm2ConvertMsgBody(char *szOriginFilePath) 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 szTempFilePath[MSG_FILEPATH_LEN_MAX]; + char szTempFile[MSG_FILEPATH_LEN_MAX]; char *pszMmsLoadTempBuf = NULL; char *pszOrgData = NULL; int length = 0; int bufLen = MMS_DRM2_CONVERT_BUFFER_MAX; int curOffset = 0; - + int lenghtFilePath; MSG_DEBUG("start convert~~~~~~"); + lenghtFilePath = snprintf(NULL,0,"%s/Drm_Convert",MSG_DATA_PATH); + + if (lenghtFilePath >= MSG_FILEPATH_LEN_MAX){ + MSG_DEBUG("File path lenght is too long "); + goto __CATCH; + } + + snprintf(szTempFilePath,lenghtFilePath,"%s/Drm_Convert",MSG_DATA_PATH); + + lenghtFilePath = snprintf(NULL,0,"%s/temp.dm",MSG_DATA_PATH); + + if (lenghtFilePath >= MSG_FILEPATH_LEN_MAX){ + MSG_DEBUG("File path lenght is too long "); + goto __CATCH; + } + + snprintf(szTempFilePath,lenghtFilePath,"%s/temp.dm",MSG_DATA_PATH); + pFile = MsgOpenFile(szOriginFilePath, "rb"); if (pFile == NULL) { MSG_DEBUG("Open decode temporary file fail"); @@ -4376,7 +4403,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; diff --git a/plugin/mms_plugin/MmsPluginHttp.cpp b/plugin/mms_plugin/MmsPluginHttp.cpp index 6c79cc3..6ac3bb1 100755 --- a/plugin/mms_plugin/MmsPluginHttp.cpp +++ b/plugin/mms_plugin/MmsPluginHttp.cpp @@ -648,7 +648,7 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::httpRequest(http_request_info_s &request_in { MSG_BEGIN(); - const char *conf_filename = MSG_DATA_PATH"mms.conf"; + const char *conf_filename = tzplatform_mkpath4(TZ_USER_DATA,"msg-service","msgdata","mms.conf"); MMS_HTTP_ERROR_E http_error = MMS_HTTP_ERROR_NONE; diff --git a/plugin/mms_plugin/MmsPluginInternal.cpp b/plugin/mms_plugin/MmsPluginInternal.cpp index cb1c262..8f3435b 100755 --- a/plugin/mms_plugin/MmsPluginInternal.cpp +++ b/plugin/mms_plugin/MmsPluginInternal.cpp @@ -72,7 +72,7 @@ void MmsPluginInternal::processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQ 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)); @@ -469,7 +469,7 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra char *filename = NULL; filename = strrchr(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 + 1); int ret = rename(pRetrievedFilePath, fullPath); if (ret != 0) { @@ -541,7 +541,7 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra char szBuf[MSG_FILEPATH_LEN_MAX + 1]; strcpy((char *)szBuf, partHeader.param.szFileName); - sprintf(partHeader.param.szFileName, MSG_DATA_PATH"%s", szBuf); + sprintf(partHeader.param.szFileName, "%s/%s", MSG_DATA_PATH, szBuf); if (!bMultipartRelated || MmsCheckAdditionalMedia(&msgData, &partHeader)) { MMS_ATTACH_S *attachment = NULL; int tempType; @@ -608,7 +608,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); @@ -653,7 +653,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) { diff --git a/plugin/mms_plugin/MmsPluginMain.cpp b/plugin/mms_plugin/MmsPluginMain.cpp index ead9151..35738e4 100755 --- a/plugin/mms_plugin/MmsPluginMain.cpp +++ b/plugin/mms_plugin/MmsPluginMain.cpp @@ -303,7 +303,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, "%s/BODY_%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..cc38758 100755 --- a/plugin/mms_plugin/MmsPluginMessage.cpp +++ b/plugin/mms_plugin/MmsPluginMessage.cpp @@ -959,9 +959,9 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg) 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); + snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, "%s/%s.png", MSG_THUMBNAIL_PATH, szFileName); } else { - snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, MSG_THUMBNAIL_PATH"/%s.jpg", szFileName); + snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, "%s/%s.jpg", MSG_THUMBNAIL_PATH, szFileName); } if (pMedia->mediatype == MMS_SMIL_MEDIA_IMG) { @@ -1315,7 +1315,7 @@ 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"); diff --git a/plugin/mms_plugin/MmsPluginSmil.cpp b/plugin/mms_plugin/MmsPluginSmil.cpp index 79ce1c9..5cd68fa 100755 --- a/plugin/mms_plugin/MmsPluginSmil.cpp +++ b/plugin/mms_plugin/MmsPluginSmil.cpp @@ -1030,7 +1030,7 @@ bool MmsSmilGetMediaFilePath(MMS_MEDIA_S *pMedia, char *pszTemp, int msgID) return false; } - snprintf(pMedia->szFilePath, MSG_FILEPATH_LEN_MAX, "%s%s", MSG_DATA_PATH, pMedia->szSrc); + snprintf(pMedia->szFilePath, MSG_FILEPATH_LEN_MAX, "%s/%s", MSG_DATA_PATH, pMedia->szSrc); MSG_DEBUG("pMedia's filePath: %s", pMedia->szFilePath); __MmsGetRealFileName(pMedia->mediatype, pMedia->szSrc, pMedia->szFileName, msgID); @@ -1138,7 +1138,7 @@ bool MMSGenerateSmilBuffer(MMS_MESSAGE_DATA_S *pstMsgBody) } char fullpath[MSG_FILEPATH_LEN_MAX] = {0,}; - snprintf(fullpath, MSG_FILEPATH_LEN_MAX, MSG_SMIL_FILE_PATH"%s", pstMsgBody->szSmilFilePath); + snprintf(fullpath, MSG_FILEPATH_LEN_MAX, "%s/%s", MSG_SMIL_FILE_PATH, pstMsgBody->szSmilFilePath); if (MsgWriteSmilFile(fullpath, pszRawData, strlen(pszRawData) + 1) == false) { MSG_DEBUG("MMSGenerateSmilBuffer: MsgWriteSmilFile failed"); diff --git a/plugin/mms_plugin/MmsPluginStorage.cpp b/plugin/mms_plugin/MmsPluginStorage.cpp index f2c32c0..169f6c9 100755 --- a/plugin/mms_plugin/MmsPluginStorage.cpp +++ b/plugin/mms_plugin/MmsPluginStorage.cpp @@ -82,7 +82,7 @@ void MmsPluginStorage::composeReadReport(MSG_MESSAGE_INFO_S *pMsgInfo) version = MmsPluginStorage::instance()->getMmsVersion(pMsgInfo->msgId); - snprintf((char *)pMsgInfo->msgData, MAX_MSG_DATA_LEN+1, MSG_DATA_PATH"%d-Read-Rec.ind", pMsgInfo->msgId); + snprintf((char *)pMsgInfo->msgData, MAX_MSG_DATA_LEN+1, "%s/%d-Read-Rec.ind", MSG_DATA_PATH, pMsgInfo->msgId); if (version == 0x90) pMsgInfo->msgType.subType = MSG_READREPLY_MMS; @@ -205,7 +205,7 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE } //mms file - snprintf(raw_filepath, sizeof(raw_filepath), MSG_DATA_PATH"%d.mms", pMsgInfo->msgId); + snprintf(raw_filepath, sizeof(raw_filepath), "%s/%d.mms", MSG_DATA_PATH, pMsgInfo->msgId); //encode mms if (MmsEncodeMmsMessage(&mmsMsg, raw_filepath) == false) { @@ -228,7 +228,7 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE } } - snprintf(raw_filedir, sizeof(raw_filedir), MSG_DATA_PATH"%d.mms.dir", pMsgInfo->msgId); + snprintf(raw_filedir, sizeof(raw_filedir), "%s/%d.mms.dir", MSG_DATA_PATH, pMsgInfo->msgId); MsgRmRf(raw_filedir); rmdir(raw_filedir); @@ -1085,7 +1085,7 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I } //mms file - snprintf(raw_filepath, sizeof(raw_filepath), MSG_DATA_PATH"%d.mms", pMsgInfo->msgId); + snprintf(raw_filepath, sizeof(raw_filepath), "%s/%d.mms", MSG_DATA_PATH, pMsgInfo->msgId); //encode mms if (MmsEncodeMmsMessage(pMmsMsg, raw_filepath) == false) { diff --git a/plugin/mms_plugin/MmsPluginUserAgent.cpp b/plugin/mms_plugin/MmsPluginUserAgent.cpp index 5ef83ef..969f67e 100755 --- a/plugin/mms_plugin/MmsPluginUserAgent.cpp +++ b/plugin/mms_plugin/MmsPluginUserAgent.cpp @@ -690,7 +690,7 @@ bool MmsPluginUaManager::processReceivedData(int msgId, char *pRcvdBody, int rcv if (MsgCreateFileName(fileName) == false) return false; - snprintf(retrievedFilePath, MSG_FILEPATH_LEN_MAX, MSG_DATA_PATH"%s", fileName); + snprintf(retrievedFilePath, MSG_FILEPATH_LEN_MAX, "%s/%s", MSG_DATA_PATH, fileName); MSG_DEBUG("retrievedFilePaths [%s]", retrievedFilePath); diff --git a/plugin/mms_plugin/include/MmsPluginDrm.h b/plugin/mms_plugin/include/MmsPluginDrm.h index e8563f2..b136a56 100755 --- a/plugin/mms_plugin/include/MmsPluginDrm.h +++ b/plugin/mms_plugin/include/MmsPluginDrm.h @@ -22,7 +22,7 @@ #ifdef __SUPPORT_DRM__ -#define MMS_DECODE_DRM_CONVERTED_TEMP_FILE MSG_DATA_PATH"Mms_Decode_Drm_Converted" +#define MMS_DECODE_DRM_CONVERTED_TEMP_FILE tzplatform_mkpath4(TZ_USER_DATA,"msg-service","msgdata","Mms_Decode_Drm_Converted") #define MMS_MIMETYPELENGTH 50 typedef enum { diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index cf2905f..d2f30fd 100755 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -44,7 +44,7 @@ INCLUDE_DIRECTORIES( ) INCLUDE(FindPkgConfig) -pkg_check_modules(utils_pkgs REQUIRED glib-2.0 vconf db-util contacts-service2 dlog pmapi mm-session alarm-service notification drm-client appsvc) +pkg_check_modules(utils_pkgs REQUIRED glib-2.0 vconf db-util contacts-service2 dlog pmapi mm-session alarm-service notification drm-client appsvc libtzplatform-config) FOREACH(flag ${utils_pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") diff --git a/utils/MsgSqliteWrapper.cpp b/utils/MsgSqliteWrapper.cpp index 68734f9..bc3fdbf 100755 --- a/utils/MsgSqliteWrapper.cpp +++ b/utils/MsgSqliteWrapper.cpp @@ -19,6 +19,9 @@ #include #include #include +#include +#include +#include #include "MsgDebug.h" #include "MsgSqliteWrapper.h" @@ -28,6 +31,7 @@ extern "C" #include } +#define MSGFW_DB_INIT_SCRIPT tzplatform_mkpath(TZ_SYS_SHARE,"msg-service/msg_service-init-DB.sh") /*================================================================================================== VARIABLES @@ -52,18 +56,29 @@ MsgDbHandler::~MsgDbHandler() freeTable(); } - msg_error_t MsgDbHandler::connect() { int ret = 0; + struct stat sts; if (handle == NULL) { char strDBName[64]; memset(strDBName, 0x00, sizeof(strDBName)); + if (strlen(MSGFW_DB_NAME) >= 64){ + MSG_DEBUG("DB path is too long"); + return MSG_ERR_DB_CONNECT; + } snprintf(strDBName, 64, "%s", MSGFW_DB_NAME); + /* Check if the DB exists; if not, create it and initialize it */ + ret = stat(MSGFW_DB_NAME, &sts); + if (ret == -1 && errno == ENOENT){ + const char *argv_script[] = {"/bin/sh", MSGFW_DB_INIT_SCRIPT, NULL }; + ret = XSystem(argv_script); + } + ret = db_util_open(strDBName, &handle, DB_UTIL_REGISTER_HOOK_METHOD); if (ret == SQLITE_OK) @@ -495,3 +510,36 @@ msg_error_t MsgConvertStrWithEscape(const char *input, char **output) return MSG_SUCCESS; } + +int XSystem(const char *argv[]) +{ + int status = 0; + pid_t pid; + pid = fork(); + switch (pid) { + case -1: + perror("fork failed"); + return -1; + case 0: + /* child */ + execvp(argv[0], (char *const *)argv); + _exit(-1); + default: + /* parent */ + break; + } + if (waitpid(pid, &status, 0) == -1) { + perror("waitpid failed"); + return -1; + } + if (WIFSIGNALED(status)) { + perror("signal"); + return -1; + } + if (!WIFEXITED(status)) { + /* shouldn't happen */ + perror("should not happen"); + return -1; + } + return WEXITSTATUS(status); +} diff --git a/utils/MsgUtilFile.cpp b/utils/MsgUtilFile.cpp index f1b7901..0fc2b9f 100755 --- a/utils/MsgUtilFile.cpp +++ b/utils/MsgUtilFile.cpp @@ -227,7 +227,7 @@ bool MsgOpenAndReadFile(const char *pFileName, char **ppData, int *pDataSize) char fullPath[MAX_FULL_PATH_SIZE] = {0}; - snprintf(fullPath, MAX_FULL_PATH_SIZE, MSG_IPC_DATA_PATH"%s", pFileName); + snprintf(fullPath, MAX_FULL_PATH_SIZE, "%s/%s", MSG_IPC_DATA_PATH, pFileName); MSG_DEBUG("open file name: %s", fullPath); @@ -302,7 +302,7 @@ bool MsgWriteIpcFile(const char *pFileName, const char *pData, int DataSize) char fullPath[MAX_FULL_PATH_SIZE] = {0}; - snprintf(fullPath, MAX_FULL_PATH_SIZE, MSG_IPC_DATA_PATH"%s", pFileName); + snprintf(fullPath, MAX_FULL_PATH_SIZE, "%s/%s", MSG_IPC_DATA_PATH, pFileName); FILE *pFile = MsgOpenFile(fullPath, "wb+"); @@ -347,7 +347,7 @@ int MsgReadSmilFile(const char *pFileName, char **ppData) int nSize = 0; char fullPath[MAX_FULL_PATH_SIZE] = {0}; - snprintf(fullPath, MAX_FULL_PATH_SIZE, MSG_SMIL_FILE_PATH"%s", pFileName); + snprintf(fullPath, MAX_FULL_PATH_SIZE, "%s/%s", MSG_SMIL_FILE_PATH, pFileName); MSG_DEBUG("open file name: %s", fullPath); @@ -452,7 +452,7 @@ void MsgDeleteFile(const char *pFileName) char fullPath[MAX_FULL_PATH_SIZE] = {0}; try { - snprintf(fullPath, MAX_FULL_PATH_SIZE, MSG_IPC_DATA_PATH"%s", pFileName); + snprintf(fullPath, MAX_FULL_PATH_SIZE, "%s/%s", MSG_IPC_DATA_PATH, pFileName); MSG_DEBUG("%s", fullPath); @@ -475,7 +475,7 @@ void MsgDeleteSmilFile(const char *pFileName) try { char fullPath[MAX_FULL_PATH_SIZE] = {0}; - snprintf(fullPath, MAX_FULL_PATH_SIZE, MSG_SMIL_FILE_PATH"%s", pFileName); + snprintf(fullPath, MAX_FULL_PATH_SIZE, "%s/%s", MSG_SMIL_FILE_PATH, pFileName); if (remove(fullPath) != 0) MSG_FATAL("File Delete Error [%s]: %s", fullPath, strerror(errno)); @@ -901,7 +901,7 @@ void MsgMmsInitDir() if(strstr(d->d_name, ".dir") != NULL) { char filePath[MSG_FILEPATH_LEN_MAX] = {0,}; - snprintf(filePath, MSG_FILEPATH_LEN_MAX, MSG_DATA_PATH"%s", d->d_name); + snprintf(filePath, MSG_FILEPATH_LEN_MAX, "%s/%s", MSG_DATA_PATH, d->d_name); MsgRmRf(filePath); rmdir(filePath); diff --git a/utils/MsgUtilStorage.cpp b/utils/MsgUtilStorage.cpp index b4034aa..f43c6ce 100755 --- a/utils/MsgUtilStorage.cpp +++ b/utils/MsgUtilStorage.cpp @@ -24,7 +24,10 @@ #include #include +#include +#include +#define DB_MSG_SERVICE_GROUPE 6011 static int msgCntLimit[MSG_COUNT_LIMIT_MAILBOX_TYPE_MAX][MSG_COUNT_LIMIT_MSG_TYPE_MAX] = {{10, 10, 0, 10, 10}, {5, 10, 0, 0, 0}, {10, 10, 0, 0, 0}, {10, 10, 0, 0, 0}, {0, 0, 10, 0, 0}}; @@ -182,10 +185,23 @@ msg_error_t MsgStoCheckMsgCntFull(MsgDbHandler *pDbHandle, const MSG_MESSAGE_TYP msg_error_t err = MSG_SUCCESS; struct statfs buf = {0}; + int fd, ret; if (statfs(MSG_DATA_ROOT_PATH, &buf) == -1) { MSG_DEBUG("statfs(\"%s\") failed - %d", MSG_DATA_ROOT_PATH); - return MSG_ERR_STORAGE_ERROR; + if (mkdir(MSG_DATA_ROOT_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) { + MSG_DEBUG("Error while mkdir %s", MSG_DATA_ROOT_PATH); + return MSG_ERR_STORAGE_ERROR; + } else { + fd = creat(MSG_DATA_ROOT_PATH, 0755); + if (0 <= fd){ + ret = fchown(fd, -1, DB_MSG_SERVICE_GROUPE); + if (-1 == ret){ + MSG_DEBUG("Failed to fchown on %s",MSG_DATA_ROOT_PATH); + } + close(fd); + } + } } unsigned long freeSpace = (buf.f_bfree * buf.f_bsize); -- 2.7.4