Fix build error 95/42695/1
authorseunggi.hong <seunggi.hong@samsung.com>
Wed, 1 Jul 2015 13:19:20 +0000 (22:19 +0900)
committerseunggi.hong <seunggi.hong@samsung.com>
Wed, 1 Jul 2015 13:19:20 +0000 (22:19 +0900)
Change-Id: Ia527cbf3d3eaf5a5ff9b70db9e55e2589d893b5d

externals/MsgSoundPlayer.cpp
framework/deliver-handler/MsgDeliverHandler.cpp
framework/main.cpp
framework/plugin-manager/MsgPluginManager.cpp
framework/storage-handler/MsgStorageFilter.cpp
include/utils/MsgGconfWrapper.h
utils/MsgContact.cpp
utils/MsgGconfWrapper.cpp
utils/MsgVMessage.cpp

index 6d8c14b..e9b14e1 100755 (executable)
@@ -43,7 +43,7 @@
 ==================================================================================================*/
 #define MAX_SOUND_FILE_LEN 1024
 
-#define DEFAULT_ALERT_FILE             "/opt/usr/share/settings/Alerts/notification_sdk.wav"
+#define DEFAULT_ALERT_FILE             "/opt/usr/share/settings/Alerts/Whistle.ogg"
 
 #define HAPTIC_TEST_ITERATION 1
 #define MSG_VIBRATION_INTERVAL 3000
@@ -202,13 +202,7 @@ MsgSoundPlayer* MsgSoundPlayer::instance()
 
 void MsgSoundPlayer::MsgGetRingtonePath(char *userRingtonePath, char **msg_tone_file_path_p)
 {
-
 #ifndef MSG_WEARABLE_PROFILE
-       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);
@@ -218,7 +212,13 @@ void MsgSoundPlayer::MsgGetRingtonePath(char *userRingtonePath, char **msg_tone_
                return;
        }
 
-       if(userRingtonePath && userRingtonePath[0] != '\0') {
+       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;
+
+       bool bUserRingtone = userRingtonePath && userRingtonePath[0] != '\0';
+       if (bUserRingtone) {
                tmpFilePath = userRingtonePath;
        } else {
                if (ringtoneType == MSG_RINGTONE_TYPE_DEFAULT) {
@@ -241,10 +241,10 @@ void MsgSoundPlayer::MsgGetRingtonePath(char *userRingtonePath, char **msg_tone_
                }
        } else {
                MSG_DEBUG("Set ringtone to tmpFilePath.");
-               strncpy(msg_tone_file_path, tmpFilePath, MSG_FILEPATH_LEN_MAX);
+               snprintf(msg_tone_file_path, MSG_FILEPATH_LEN_MAX, "%s", tmpFilePath);
        }
 
-       if (tmpFilePath && userRingtonePath[0] == '\0') {
+       if (tmpFilePath && !bUserRingtone) {
                free(tmpFilePath);
                tmpFilePath = NULL;
        }
@@ -321,7 +321,7 @@ void MsgSoundPlayer::MsgGetPlayStatus(bool bVoiceMail, bool *bPlaySound, bool *b
        MSG_SEC_DEBUG("Msg Setting : Noti Alert=[%d], With vibration=[%d]", bMsgSettingNoti, bMsgSettingVibration);
 
        int callStatus = 0;
-       int alertOnCall = 0;
+//     int alertOnCall = 0;
 
        callStatus = MsgSettingGetInt(VCONFKEY_CALL_STATE);
        MSG_DEBUG("Call Status [%d]", callStatus);
@@ -331,7 +331,7 @@ void MsgSoundPlayer::MsgGetPlayStatus(bool bVoiceMail, bool *bPlaySound, bool *b
                /* 1. On Call */
 
                *bOnCall = true; // set call status;
-
+#if 0
                alertOnCall = MsgSettingGetInt(VCONFKEY_CISSAPPL_ALERT_ON_CALL_INT);
                MSG_DEBUG("Alert On Call [%d]", alertOnCall);
 
@@ -368,11 +368,11 @@ void MsgSoundPlayer::MsgGetPlayStatus(bool bVoiceMail, bool *bPlaySound, bool *b
                                }
                        }
                }
+#endif
        } 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) {
@@ -391,22 +391,18 @@ void MsgSoundPlayer::MsgGetPlayStatus(bool bVoiceMail, bool *bPlaySound, bool *b
                        }
                } 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) {
+                                       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.");
-                                       }
+                               if ((bSoundOn || bVibrationOn) && bMsgSettingVibration) {
+                                       MSG_DEBUG("Play vibration.");
+                                       *bPlayVibration = true;
                                } else {
-                                       MSG_DEBUG("It doesn't play sound/vibration.");
+                                       MSG_DEBUG("It doesn't play vibration.");
                                }
                        } else {
                                MSG_DEBUG("It doesn't play sound/vibration.");
index 42039eb..7b06a32 100755 (executable)
@@ -42,7 +42,7 @@
 void MsgPlayTTSMode(MSG_SUB_TYPE_T msgSubType, msg_message_id_t msgId, bool isFavorites)
 {
        MSG_BEGIN();
-
+#if 0
        bool bNotification = true;
 
        if (MsgSettingGetBool(MSG_SETTING_NOTIFICATION, &bNotification) != MSG_SUCCESS) {
@@ -127,7 +127,7 @@ void MsgPlayTTSMode(MSG_SUB_TYPE_T msgSubType, msg_message_id_t msgId, bool isFa
        }
 
        MsgChangePmState();
-
+#endif
        MSG_END();
 }
 
@@ -215,6 +215,8 @@ msg_error_t MsgHandleMmsConfIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, msg_reques
 
                        // MMS Received Ind Process Func
                        MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(pMsgInfo->msgType.mainType);
+                       if (plg == NULL)
+                               return MSG_ERR_NULL_POINTER;
 
                        //Contents of msg Data was removed and replaced to retrievedFilePath
                        // NOTICE:: now it was moved to handleEvent in MsgListnerThread
@@ -626,6 +628,9 @@ 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);
 
+       if (plg == NULL)
+               return MSG_ERR_NULL_POINTER;
+
        // Read the default network SIM
        MsgPlugin *sms_plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE);
 
index b8b12a4..12c48ee 100755 (executable)
@@ -238,8 +238,6 @@ int main(void)
                return -1;
        }
 
-       // Regist vconf CB.
-       MsgSettingRegVconfCB();
 
        mainloop = g_main_loop_new(NULL, FALSE);
 
@@ -255,8 +253,6 @@ int main(void)
                MSG_DEBUG("Fail to start Messaging Framework!!!");
        }
 
-       // Remove vconf CB
-       MsgSettingRemoveVconfCB();
        //contacts-service is not used for gear
 #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
        // Close Contact Sevice
index 6515d11..f734e63 100755 (executable)
@@ -890,20 +890,15 @@ MsgPlugin::MsgPlugin(MSG_MAIN_TYPE_T mainType, const char *libPath): mSupportedM
        mLibHandler = dlopen(libPath, RTLD_NOW);
 
        if (!mLibHandler)
-               THROW(MsgException::PLUGIN_ERROR, "ERROR dlopen library : [%s] [%s]", libPath, dlerror());
-
-       // Clear Error
-       dlerror();
+               THROW(MsgException::PLUGIN_ERROR, "ERROR dlopen library : [%s]", libPath);
 
        // assign the c function pointers
        msg_error_t(*pFunc)(MSG_PLUGIN_HANDLER_S*) = NULL;
 
        pFunc = (msg_error_t(*)(MSG_PLUGIN_HANDLER_S*))dlsym(mLibHandler, "MsgPlgCreateHandle");
 
-       char *error = dlerror();
-
-       if (error != NULL)
-               THROW(MsgException::PLUGIN_ERROR, "ERROR dlsym library : [%s]", dlerror());
+       if (!pFunc)
+               THROW(MsgException::PLUGIN_ERROR, "ERROR dlsym library");
 
        if ((*pFunc)(&mPlgHandler) != MSG_SUCCESS)
                THROW(MsgException::PLUGIN_ERROR, "ERROR to create plugin handle");
index 0239ec2..9ae5e49 100755 (executable)
@@ -227,25 +227,26 @@ msg_error_t MsgStoGetFilterList(msg_struct_list_s *pFilterList)
 
        pFilterList->msg_struct_info = (msg_struct_t *)calloc(rowCnt, sizeof(MSG_FILTER_S *));
 
-       msg_struct_s* pTmp = NULL;
-
-       for (int i = 0; i < rowCnt; i++)
-       {
-               pFilterList->msg_struct_info[i] = (msg_struct_t)new msg_struct_s;
-
-               pTmp = (msg_struct_s *)pFilterList->msg_struct_info[i];
-               pTmp->type = MSG_STRUCT_FILTER;
-               pTmp->data = new 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++);
-               memset(pFilter->filterValue, 0x00, sizeof(pFilter->filterValue));
-               dbHandle->getColumnToString(index++, MAX_FILTER_VALUE_LEN, pFilter->filterValue);
-               pFilter->bActive = dbHandle->getColumnToInt(index++);
+       if (pFilterList->msg_struct_info != NULL) {
+               msg_struct_s* pTmp = NULL;
+
+               for (int i = 0; i < rowCnt; i++)
+               {
+                       pFilterList->msg_struct_info[i] = (msg_struct_t)new msg_struct_s;
+
+                       pTmp = (msg_struct_s *)pFilterList->msg_struct_info[i];
+                       pTmp->type = MSG_STRUCT_FILTER;
+                       pTmp->data = new 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++);
+                       memset(pFilter->filterValue, 0x00, sizeof(pFilter->filterValue));
+                       dbHandle->getColumnToString(index++, MAX_FILTER_VALUE_LEN, pFilter->filterValue);
+                       pFilter->bActive = dbHandle->getColumnToInt(index++);
+               }
        }
 
-
        dbHandle->freeTable();
 
        MSG_END();
index 0c9793a..ebb8de7 100755 (executable)
@@ -60,13 +60,7 @@ msg_error_t  MsgSettingSetIndicator(int SmsCnt, int MmsCnt);
 int    MsgSettingGetAutoReject();
 bool   MsgSettingGetUnknownAutoReject();
 
-void   MsgSettingRegVconfCB();
-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
index e0155e5..01cf873 100755 (executable)
@@ -220,21 +220,6 @@ void normalizeNumber(const char *orig, char* dest, unsigned int destSize)
 }
 
 
-//static void MsgContactSvcCallback(const char *view_uri, void *user_data)
-//{
-//     MSG_DEBUG("MsgContactSvcCallback is called.");
-//     if (!strcmp(CONTACT_CALLBACK_USER_DATA, (const char*)user_data)) {
-//             MSG_DEBUG("Contact Data is Changed!!!");
-//             MsgSyncContact();
-//     } else if (!strcmp(ADDRESSBOOK_CALLBACK_USER_DATA, (const char*)user_data)) {
-//             MSG_DEBUG("Address Book Data is Changed!!!");
-//             MsgSyncAddressbook();
-//     }
-//
-//     if (ContactDbHandle.disconnect() != MSG_SUCCESS)
-//             MSG_DEBUG("DB Disconnect Fail");
-//}
-
 #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
 /*==================================================================================================
                                      FUNCTION IMPLEMENTATION
@@ -1409,6 +1394,7 @@ int MsgContactSVCEndTrans(bool bSuccess)
 
 bool checkBlockingMode(char *address, bool *pisFavorites)
 {
+#if 0
        MsgZoneChange();
 
        msg_error_t err = MSG_SUCCESS;
@@ -1556,6 +1542,12 @@ bool checkBlockingMode(char *address, bool *pisFavorites)
        MsgZoneRevert();
 
        return isblock;
+#else
+       if (pisFavorites != NULL)
+               *pisFavorites = false;
+
+       return false;
+#endif
 }
 #endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED
 
index 4e1d7af..b7ff747 100755 (executable)
@@ -20,9 +20,6 @@
 #include "MsgUtilStorage.h"
 #include "MsgGconfWrapper.h"
 #include "MsgException.h"
-#ifdef MSG_PENDING_PUSH_MESSAGE
-#include "MsgIpcSocket.h"
-#endif
 
 #ifdef USE_GCONF
 
@@ -32,10 +29,6 @@ MSG_GOBJECT_CLIENT_S* pClient = NULL;
 
 #endif
 
-#ifdef MSG_PENDING_PUSH_MESSAGE
-int bPushServiceReady = 0;
-#endif
-
 int autoReject = 0;
 bool bUnknownAutoReject = false;
 
@@ -44,47 +37,6 @@ bool bUnknownAutoReject = false;
 /*==================================================================================================
                                      FUNCTION IMPLEMENTATION
 ==================================================================================================*/
-static void MsgVconfCB(keynode_t *key, void* data)
-{
-#if 0
-       char *keyStr = NULL;
-       keyStr = vconf_keynode_get_name(key);
-
-       if (!keyStr)
-               return;
-
-       if (!g_strcmp0(keyStr, VCONFKEY_CISSAPPL_AUTO_REJECT_INT)) {
-               autoReject = vconf_keynode_get_int(key);
-               MSG_DEBUG("[%s] key CB called. set to [%d].", VCONFKEY_CISSAPPL_AUTO_REJECT_INT, autoReject);
-       } else if (!g_strcmp0(keyStr, VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL)) {
-               bUnknownAutoReject = vconf_keynode_get_bool(key);
-               MSG_DEBUG("[%s] key CB called. set to [%d].", VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL, bUnknownAutoReject);
-       }
-#ifdef MSG_PENDING_PUSH_MESSAGE
-       else if (!g_strcmp0(keyStr, VCONFKEY_USER_SERVICE_READY)){
-               bPushServiceReady = vconf_keynode_get_int(key);
-               MSG_DEBUG("[%s] key CB called. set to [%d].", VCONFKEY_USER_SERVICE_READY, bPushServiceReady);
-
-               if(bPushServiceReady)
-               {
-                       try {
-                               if (MsgSendPendingPushMsg() == MSG_SUCCESS) {
-                                       MSG_DEBUG("MsgSendPendingPushMsg success");
-                               } else {
-                                       MSG_DEBUG("MsgSendPendingPushMsg fail");
-                               }
-                       } catch (MsgException& e) {
-                               MSG_FATAL("%s", e.what());
-                               MSG_DEBUG("MsgSendPendingPushMsg fail");
-                       }
-               }
-       }
-#endif
-       else {
-               MSG_DEBUG("key did not match.");
-       }
-#endif
-}
 
 msg_error_t MsgSettingSetString(const char *pKey, const char *pSetValue)
 {
@@ -282,75 +234,3 @@ void MsgSettingRemoveVconfCBCommon(const char *pKey, _vconf_change_cb pCb)
                MSG_DEBUG("Success to remove vconf CB with [%s]", pKey);
        }
 }
-
-
-void MsgSettingRegVconfCB()
-{
-#if 0
-       // Set default values.
-       autoReject = MsgSettingGetInt(VCONFKEY_CISSAPPL_AUTO_REJECT_INT);
-       MsgSettingGetBool(VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL, &bUnknownAutoReject);
-
-       MsgSettingRegVconfCBCommon(VCONFKEY_CISSAPPL_AUTO_REJECT_INT, MsgVconfCB);
-       MsgSettingRegVconfCBCommon(VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL, MsgVconfCB);
-
-#ifdef MSG_PENDING_PUSH_MESSAGE
-       MsgSettingRegVconfCBCommon(VCONFKEY_USER_SERVICE_READY, MsgVconfCB);
-#endif
-#endif
-}
-
-void MsgSettingRemoveVconfCB()
-{
-#if 0
-       MsgSettingRemoveVconfCBCommon(VCONFKEY_CISSAPPL_AUTO_REJECT_INT, MsgVconfCB);
-       MsgSettingRemoveVconfCBCommon(VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL, MsgVconfCB);
-#endif
-}
-
-msg_error_t MsgSendPendingPushMsg(void)
-{
-       MSG_BEGIN();
-
-       // establish connection to msgfw daemon
-       MsgIpcClientSocket client;
-       client.connect(MSG_SOCKET_PATH);
-
-       // composing command
-       int cmdSize = sizeof(MSG_CMD_S); // cmd type, MSG_SYNCML_MESSAGE_DATA_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_SEND_PENDING_PUSH_MESSAGE;
-
-       memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN);
-
-       // Send Command to Messaging FW
-       client.write(cmdBuf, cmdSize);
-
-       // Receive result from Transaction Manager
-       char* retBuf = NULL;
-       AutoPtr<char> 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_SEND_PENDING_PUSH_MESSAGE)
-               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);
-}
index 9fa9159..e269c7b 100755 (executable)
@@ -235,7 +235,9 @@ if(strlen(pMsg->subject) > 0)
                                        goto __CATCH_FAIL__;
 
                                msgText = (char *)calloc(1, fileSize);
-                               memcpy(msgText, pFileData, fileSize);
+                               if(pFileData && msgText)
+                                       memcpy(msgText, pFileData, fileSize);
+
                                pObject->numOfBiData = fileSize;
                                pObject->pszValue[0] = msgText;
                        }
@@ -255,8 +257,8 @@ if(strlen(pMsg->subject) > 0)
                //Insert VBody for mms raw data;
                char* pFileData = NULL;
                MMS_DATA_S *pMmsData = NULL;
-               int             fileSize = 0;
-               char*   msgText = NULL;
+               int fileSize = 0;
+               char* msgText = NULL;
 #if 0
                char            filePath[MSG_FILEPATH_LEN_MAX] = {0, };
                if(pMsg->msgType.subType == MSG_NOTIFICATIONIND_MMS)
@@ -285,6 +287,8 @@ if(strlen(pMsg->subject) > 0)
                } else {
                        fileSize = strlen(pMsg->msgData);
                        pFileData = (char *)calloc(1, fileSize+1);
+                       if (!pFileData)
+                               goto __CATCH_FAIL__;
                        snprintf(pFileData, fileSize, "%s", pMsg->msgData);
                }
 
@@ -292,6 +296,7 @@ if(strlen(pMsg->subject) > 0)
                if (pFileData) {
                        if (MsgDeserializeMmsData(pFileData, fileSize, &pMmsData) != 0) {
                                MSG_DEBUG("Fail to Deserialize Message Data");
+                               MsgMmsRelease(&pMmsData);
                                goto __CATCH_FAIL__;
                        }
 
@@ -303,7 +308,10 @@ if(strlen(pMsg->subject) > 0)
 
                int serializedDataSize = 0;
 
-               serializedDataSize = MsgSerializeMms(pMmsData, &pFileData);
+               if (pMmsData) {
+                       MsgMmsSetMultipartListData(pMmsData);//app file -> data
+                       serializedDataSize = MsgSerializeMms(pMmsData, &pFileData);
+               }
 
                if (pFileData) {
                        fileSize = serializedDataSize;
@@ -314,10 +322,9 @@ if(strlen(pMsg->subject) > 0)
 #endif
                MSG_DEBUG("FILE SIZE IS %d, %s", fileSize, pFileData);
                msgText = (char *)calloc(1, fileSize);
-               if(pFileData)
+               if(pFileData && msgText)
                        memcpy(msgText, pFileData, fileSize);
 
-
                pObject->numOfBiData = fileSize;
                pObject->pszValue[0] = msgText;
                pObject->valueCount = 1;