remove contacts-service2 dependency from libmsg_utils.so 53/63153/2
authorKyeonghun Lee <kh9090.lee@samsung.com>
Tue, 22 Mar 2016 08:28:06 +0000 (17:28 +0900)
committerKyeonghun Lee <kh9090.lee@samsung.com>
Tue, 22 Mar 2016 08:39:41 +0000 (17:39 +0900)
Change-Id: Ibfa09e5f465f1444d2d3d2dc58b56477c070ac7b

16 files changed:
framework/main.cpp
framework/storage-handler/MsgStorageMessage.cpp
framework/transaction-manager/MsgCmdHandlerTransport.cpp
include/proxy/MsgProxyContact.h [new file with mode: 0644]
include/utils/MsgContact.h
include/utils/MsgUtilStorage.h
plugin/sms_cdma_plugin/SmsCdmaPluginTransport.cpp
plugin/sms_plugin/SmsPluginTransport.cpp
proxy/CMakeLists.txt
proxy/MsgHandleControl.cpp
proxy/MsgHandleStorage.cpp
proxy/MsgProxyContact.cpp [new file with mode: 0644]
utils/CMakeLists.txt
utils/MsgContact.cpp
utils/MsgUtilFunction.cpp
utils/MsgUtilStorage.cpp

index 628d1ce..dd7068f 100755 (executable)
@@ -156,12 +156,6 @@ int main(void)
                MSG_DEBUG("Fail to start Messaging Framework!!!");
        }
 
-       /* contacts-service is not used for gear */
-#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
-       /* Close Contact Sevice */
-       MsgCloseContactSvc();
-#endif /*MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
-
        /* Disconnect to DB */
        MsgStoDisconnectDB();
 
index cca6132..fd143b1 100755 (executable)
@@ -2074,11 +2074,7 @@ msg_error_t MsgStoGetMessage(msg_message_id_t msgId, MSG_MESSAGE_INFO_S *pMsg, M
 
 
        /* get address information. */
-       /*contacts-service is not used for gear */
-       /*contactNameOrder is never used */
-#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
-       MsgStoGetAddressByMsgId(dbHandle, pMsg->msgId, MsgGetContactNameOrder(), &pMsg->nAddressCnt, &pMsg->addressList);
-#endif /*MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
+       MsgStoGetAddressByMsgId(dbHandle, pMsg->msgId, &pMsg->nAddressCnt, &pMsg->addressList);
 
        /* Get MMS body if it is MMS. */
        if ((pMsg->networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS &&
index 17bb937..c69dcb5 100755 (executable)
@@ -597,8 +597,7 @@ int MsgIncomingMMSConfMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent)
        MsgDbHandler *dbHandle = getDbHandle();
        int tmpAddrCnt = 0;
        MSG_ADDRESS_INFO_S *tmpAddr = NULL;
-       int order = MsgGetContactNameOrder();
-       err = MsgStoGetAddressByMsgId(dbHandle, msgInfo.msgId, order, &tmpAddrCnt, &tmpAddr);
+       err = MsgStoGetAddressByMsgId(dbHandle, msgInfo.msgId, &tmpAddrCnt, &tmpAddr);
        if (err != MSG_SUCCESS) {
                MSG_DEBUG("MsgStoGetAddressByMsgId() fail.");
        }
diff --git a/include/proxy/MsgProxyContact.h b/include/proxy/MsgProxyContact.h
new file mode 100644 (file)
index 0000000..3d1d0be
--- /dev/null
@@ -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_PROXY_CONTACT_H
+#define MSG_PROXY_CONTACT_H
+
+
+/*==================================================================================================
+                                         INCLUDE FILES
+==================================================================================================*/
+#include "MsgStorageTypes.h"
+#include "MsgInternalTypes.h"
+
+/*==================================================================================================
+                                     FUNCTION PROTOTYPES
+==================================================================================================*/
+msg_error_t MsgOpenContactSvc();
+msg_error_t MsgCloseContactSvc();
+
+msg_error_t MsgGetContactSearchList(const char *pSearchVal, MSG_ADDRESS_INFO_S **pAddrInfo, int *count);
+
+
+#endif /* MSG_PROXY_CONTACT_H */
+
index 235635b..b71fc07 100755 (executable)
 /*==================================================================================================
                                      FUNCTION PROTOTYPES
 ==================================================================================================*/
-msg_error_t MsgOpenContactSvc();
-msg_error_t MsgCloseContactSvc();
-
 msg_error_t MsgInitContactSvc();
 
 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);
 
-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);
index 07ed625..ffa2f8a 100755 (executable)
@@ -39,9 +39,9 @@ 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, msg_struct_list_s *pAddress);
-msg_error_t MsgStoGetAddressByConvId(MsgDbHandler *pDbHandle, msg_thread_id_t convId, int contactNameOrder, msg_struct_list_s *pAddrlist);
+msg_error_t MsgStoGetAddressByMsgId(MsgDbHandler *pDbHandle, msg_message_id_t msgId, int *nAddressCnt, MSG_ADDRESS_INFO_S **pAddress);
+msg_error_t MsgStoGetAddressByMsgId(MsgDbHandler *pDbHandle, msg_message_id_t msgId, msg_struct_list_s *pAddress);
+msg_error_t MsgStoGetAddressByConvId(MsgDbHandler *pDbHandle, msg_thread_id_t convId, 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);
index 07b7423..47e64ba 100755 (executable)
@@ -260,13 +260,7 @@ void SmsPluginTransport::submitRequest(sms_request_info_s *pReqInfo)
 
        /* Get address informations. */
        MsgDbHandler *dbHandle = getDbHandle();
-       /* contacts-service is not used for gear */
-#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
-       MsgStoGetAddressByMsgId(dbHandle, pReqInfo->msgInfo.msgId, 0, &pReqInfo->msgInfo.nAddressCnt, &pReqInfo->msgInfo.addressList);
-#else
-       /*contactNameOrder is never used */
        MsgStoGetAddressByMsgId(dbHandle, pReqInfo->msgInfo.msgId, &pReqInfo->msgInfo.nAddressCnt, &pReqInfo->msgInfo.addressList);
-#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
 
        MSG_DEBUG("pReqInfo->msgInfo.nAddressCnt [%d]", pReqInfo->msgInfo.nAddressCnt);
 
index 4db781d..11b8b06 100755 (executable)
@@ -101,7 +101,7 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo)
 
        /* Get address informations. */
        MsgDbHandler *dbHandle = getDbHandle();
-       MsgStoGetAddressByMsgId(dbHandle, pReqInfo->msgInfo.msgId, 0, &pReqInfo->msgInfo.nAddressCnt, &pReqInfo->msgInfo.addressList);
+       MsgStoGetAddressByMsgId(dbHandle, pReqInfo->msgInfo.msgId, &pReqInfo->msgInfo.nAddressCnt, &pReqInfo->msgInfo.addressList);
        MSG_DEBUG("pReqInfo->msgInfo.nAddressCnt [%d]", pReqInfo->msgInfo.nAddressCnt);
 
        /* Get MSISDN */
index 69315d1..ddab5f3 100755 (executable)
@@ -15,6 +15,7 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -O2 -g -Wall")
 ##########################################################
 
 SET(TRANS-PROXY-SRCS
+       ${CMAKE_SOURCE_DIR}/proxy/MsgProxyContact.cpp
        ${CMAKE_SOURCE_DIR}/proxy/MsgProxyListener.cpp
        ${CMAKE_SOURCE_DIR}/proxy/MsgHandleControl.cpp
        ${CMAKE_SOURCE_DIR}/proxy/MsgHandleSetting.cpp
@@ -24,14 +25,14 @@ SET(TRANS-PROXY-SRCS
 )
 
 INCLUDE_DIRECTORIES(
-    ${CMAKE_SOURCE_DIR}/include/mapi
+       ${CMAKE_SOURCE_DIR}/include/mapi
        ${CMAKE_SOURCE_DIR}/include/common
        ${CMAKE_SOURCE_DIR}/include/utils
        ${CMAKE_SOURCE_DIR}/include/proxy
 )
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(trans_proxy_pkgs REQUIRED glib-2.0 dlog vconf)
+pkg_check_modules(trans_proxy_pkgs REQUIRED glib-2.0 dlog vconf contacts-service2)
 
 FOREACH(flag ${trans_proxy_pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index 6c24cf6..21478be 100755 (executable)
@@ -20,9 +20,9 @@
 #include "MsgDebug.h"
 #include "MsgCppTypes.h"
 #include "MsgException.h"
-#include "MsgContact.h"
 #include "MsgUtilFile.h"
 #include "MsgGconfWrapper.h"
+#include "MsgProxyContact.h"
 #include "MsgProxyListener.h"
 #include "MsgHandle.h"
 #include "MsgSqliteWrapper.h"
index 85ec53c..94d8ed2 100755 (executable)
@@ -22,7 +22,7 @@
 #include "MsgProxyListener.h"
 #include "MsgHandle.h"
 
-#include "MsgContact.h"
+#include "MsgProxyContact.h"
 #include "MsgVMessage.h"
 /*==================================================================================================
                                      IMPLEMENTATION OF MsgHandle - Storage Member Functions
diff --git a/proxy/MsgProxyContact.cpp b/proxy/MsgProxyContact.cpp
new file mode 100644 (file)
index 0000000..8f78570
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * 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 <MsgProxyContact.h>
+#include <MsgContact.h>
+#include <MsgDebug.h>
+
+#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
+extern "C"
+{
+       #include <contacts.h>
+}
+#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
+
+
+/*==================================================================================================
+                                     VARIABLES
+==================================================================================================*/
+__thread bool isContactSvcConnected = false;
+
+
+/*==================================================================================================
+                                     FUNCTION IMPLEMENTATION
+==================================================================================================*/
+msg_error_t MsgOpenContactSvc()
+{
+#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
+       int errCode = CONTACTS_ERROR_NONE;
+
+       if (!isContactSvcConnected) {
+               errCode = contacts_connect();
+
+               if (errCode == CONTACTS_ERROR_NONE) {
+                       MSG_DEBUG("Connect to Contact Service Success");
+                       isContactSvcConnected = true;
+               } else {
+                       MSG_DEBUG("Connect to Contact Service Fail [%d]", errCode);
+                       isContactSvcConnected = false;
+                       return MSG_ERR_DB_CONNECT;
+               }
+       } else {
+               MSG_DEBUG("Already connected to Contact Service.");
+       }
+#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
+       return MSG_SUCCESS;
+}
+
+
+msg_error_t MsgCloseContactSvc()
+{
+#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
+       int errCode = CONTACTS_ERROR_NONE;
+
+       if (isContactSvcConnected) {
+               errCode = contacts_disconnect();
+
+               if (errCode == CONTACTS_ERROR_NONE) {
+                       MSG_DEBUG("Disconnect to Contact Service Success");
+                       isContactSvcConnected = false;
+               } else {
+                       MSG_DEBUG("Disconnect to Contact Service Fail [%d]", errCode);
+                       return MSG_ERR_DB_DISCONNECT;
+               }
+       }
+#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
+       return MSG_SUCCESS;
+}
+
+msg_error_t MsgGetContactSearchList(const char *pSearchVal, MSG_ADDRESS_INFO_S **pAddrInfo, int *count)
+{
+       MSG_BEGIN();
+#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
+
+       msg_error_t err = MSG_SUCCESS;
+
+       *count = 0;
+
+       if (pSearchVal == NULL) {
+               MSG_DEBUG("pSearchVal is NULL.");
+               return MSG_ERR_NULL_POINTER;
+       }
+
+       if (pAddrInfo == NULL) {
+               MSG_DEBUG("pAddrInfo is NULL.");
+               return MSG_ERR_NULL_POINTER;
+       }
+
+       if ((err = MsgOpenContactSvc()) != MSG_SUCCESS) {
+               MSG_DEBUG("MsgOpenContactSvc fail.");
+               return err;
+       }
+
+       if (!isContactSvcConnected) {
+               MSG_DEBUG("Contact Service Not Opened.");
+               return MSG_ERR_UNKNOWN;
+       }
+
+       MSG_SEC_DEBUG("pSearchVal [%s]", pSearchVal);
+
+       int ret = 0;
+       unsigned int index = 0;
+       contacts_query_h query = NULL;
+       contacts_filter_h filter = NULL;
+       contacts_list_h personNumbers = NULL;
+
+       ret = contacts_query_create(_contacts_person_number._uri, &query);
+       ret = contacts_filter_create(_contacts_person_number._uri, &filter);
+
+       ret = contacts_filter_add_str(filter, _contacts_person_number.display_name, CONTACTS_MATCH_CONTAINS, pSearchVal);
+       ret = contacts_query_set_filter(query, filter);
+
+       ret = contacts_db_get_records_with_query(query, 0, 0, &personNumbers);
+       if (ret != CONTACTS_ERROR_NONE) {
+               MSG_DEBUG("contacts_db_get_records_with_query() Error [%d]", ret);
+               contacts_query_destroy(query);
+               contacts_filter_destroy(filter);
+               contacts_list_destroy(personNumbers, true);
+               return MSG_ERR_UNKNOWN;
+       }
+
+       ret = contacts_list_get_count(personNumbers, count);
+       if (*count == 0 || ret != CONTACTS_ERROR_NONE) {
+               MSG_DEBUG("No Serach Data from Contact Service.");
+               *count = 0;
+               contacts_query_destroy(query);
+               contacts_filter_destroy(filter);
+               contacts_list_destroy(personNumbers, true);
+               return MSG_SUCCESS;
+       }
+
+       contacts_query_destroy(query);
+       contacts_filter_destroy(filter);
+
+       MSG_DEBUG(" *count [%d]", *count);
+
+       *pAddrInfo = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S) * (*count)];
+       memset(*pAddrInfo, 0x00, (sizeof(MSG_ADDRESS_INFO_S) * (*count)));
+
+       contacts_record_h personNumber = NULL;
+
+       while (CONTACTS_ERROR_NONE == contacts_list_get_current_record_p(personNumbers, &personNumber)) {
+               char* normalizedNumber = NULL;
+               ret = contacts_record_get_str(personNumber, _contacts_person_number.normalized_number, &normalizedNumber);
+               if (ret != CONTACTS_ERROR_NONE) {
+                       MSG_DEBUG("contacts_record_get_int() Error [%d]", ret);
+               }
+               else if (normalizedNumber) {
+                       MSG_DEBUG("normalizedNumber [%s]", normalizedNumber);
+                       strncpy((*pAddrInfo)[index].addressVal, normalizedNumber, MAX_ADDRESS_VAL_LEN);
+               }
+
+               contacts_list_next(personNumbers);
+               index++;
+       }
+
+       contacts_list_destroy(personNumbers, true);
+
+#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
+       MSG_END();
+
+       return MSG_SUCCESS;
+}
index 276172d..3b96a1b 100755 (executable)
@@ -46,11 +46,7 @@ INCLUDE_DIRECTORIES(
 
 INCLUDE(FindPkgConfig)
 
-IF(_MSG_WEARABLE_PROFILE)
 SET(PKG_MODULES glib-2.0 vconf dlog libxml-2.0 storage json-glib-1.0 capi-system-info capi-media-thumbnail-util capi-media-image-util capi-content-media-content aul sqlite3 capi-media-metadata-extractor icu-uc libsystemd-login)
-ELSE()
-SET(PKG_MODULES glib-2.0 vconf contacts-service2 dlog libxml-2.0 storage json-glib-1.0 capi-system-info capi-media-thumbnail-util capi-media-image-util capi-content-media-content aul sqlite3 capi-media-metadata-extractor icu-uc libsystemd-login)
-ENDIF()
 pkg_check_modules(utils_pkgs REQUIRED ${PKG_MODULES})
 
 FOREACH(flag ${utils_pkgs_CFLAGS})
index 195d406..9e6a197 100755 (executable)
 #include "MsgGconfWrapper.h"
 #include "MsgContact.h"
 
-#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
-extern "C"
-{
-       #include <contacts.h>
-}
-#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
 
 /*==================================================================================================
                                      VARIABLES
 ==================================================================================================*/
+#if 0
 __thread bool isContactSvcConnected = false;
-
-MsgDbHandler ContactDbHandle;
-
+#endif
 /* phonenumber minimum match digit. */
 #define PHONENUMBER_MIN_MATCH_DIGIT VCONFKEY_CONTACTS_SVC_PHONENUMBER_MIN_MATCH_DIGIT
 #define DEFAULT_MIN_MATCH_DIGIT 8
@@ -211,51 +204,6 @@ void normalizeNumber(const char *orig, char* dest, unsigned int destSize)
 /*==================================================================================================
                                      FUNCTION IMPLEMENTATION
 ==================================================================================================*/
-msg_error_t MsgOpenContactSvc()
-{
-#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
-       int errCode = CONTACTS_ERROR_NONE;
-
-       if (!isContactSvcConnected) {
-               errCode = contacts_connect();
-
-               if (errCode == CONTACTS_ERROR_NONE) {
-                       MSG_DEBUG("Connect to Contact Service Success");
-                       isContactSvcConnected = true;
-               } else {
-                       MSG_DEBUG("Connect to Contact Service Fail [%d]", errCode);
-                       isContactSvcConnected = false;
-                       return MSG_ERR_DB_CONNECT;
-               }
-       } else {
-               MSG_DEBUG("Already connected to Contact Service.");
-       }
-#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
-       return MSG_SUCCESS;
-}
-
-
-msg_error_t MsgCloseContactSvc()
-{
-#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
-       int errCode = CONTACTS_ERROR_NONE;
-
-       if (isContactSvcConnected) {
-               errCode = contacts_disconnect();
-
-               if (errCode == CONTACTS_ERROR_NONE) {
-                       MSG_DEBUG("Disconnect to Contact Service Success");
-                       isContactSvcConnected = false;
-               } else {
-                       MSG_DEBUG("Disconnect to Contact Service Fail [%d]", errCode);
-                       return MSG_ERR_DB_DISCONNECT;
-               }
-       }
-#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
-       return MSG_SUCCESS;
-}
-
-
 msg_error_t MsgInitContactSvc()
 {
 #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
@@ -276,6 +224,7 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
 {
        MSG_BEGIN();
 #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
+#if 0
        msg_error_t err = MSG_SUCCESS;
 
        if ((err = MsgOpenContactSvc()) != MSG_SUCCESS) {
@@ -495,103 +444,7 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
        }
 
        contacts_record_destroy(contact, true);
-
-#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
-       MSG_END();
-
-       return MSG_SUCCESS;
-}
-
-
-msg_error_t MsgGetContactSearchList(const char *pSearchVal, MSG_ADDRESS_INFO_S **pAddrInfo, int *count)
-{
-       MSG_BEGIN();
-#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
-
-       msg_error_t err = MSG_SUCCESS;
-
-       *count = 0;
-
-       if (pSearchVal == NULL) {
-               MSG_DEBUG("pSearchVal is NULL.");
-               return MSG_ERR_NULL_POINTER;
-       }
-
-       if (pAddrInfo == NULL) {
-               MSG_DEBUG("pAddrInfo is NULL.");
-               return MSG_ERR_NULL_POINTER;
-       }
-
-       if ((err = MsgOpenContactSvc()) != MSG_SUCCESS) {
-               MSG_DEBUG("MsgOpenContactSvc fail.");
-               return err;
-       }
-
-       if (!isContactSvcConnected) {
-               MSG_DEBUG("Contact Service Not Opened.");
-               return MSG_ERR_UNKNOWN;
-       }
-
-       MSG_SEC_DEBUG("pSearchVal [%s]", pSearchVal);
-
-       int ret = 0;
-       unsigned int index = 0;
-       contacts_query_h query = NULL;
-       contacts_filter_h filter = NULL;
-       contacts_list_h personNumbers = NULL;
-
-       ret = contacts_query_create(_contacts_person_number._uri, &query);
-       ret = contacts_filter_create(_contacts_person_number._uri, &filter);
-
-       ret = contacts_filter_add_str(filter, _contacts_person_number.display_name, CONTACTS_MATCH_CONTAINS, pSearchVal);
-       ret = contacts_query_set_filter(query, filter);
-
-       ret = contacts_db_get_records_with_query(query, 0, 0, &personNumbers);
-       if (ret != CONTACTS_ERROR_NONE) {
-               MSG_DEBUG("contacts_db_get_records_with_query() Error [%d]", ret);
-               contacts_query_destroy(query);
-               contacts_filter_destroy(filter);
-               contacts_list_destroy(personNumbers, true);
-               return MSG_ERR_UNKNOWN;
-       }
-
-       ret = contacts_list_get_count(personNumbers, count);
-       if (*count == 0 || ret != CONTACTS_ERROR_NONE) {
-               MSG_DEBUG("No Serach Data from Contact Service.");
-               *count = 0;
-               contacts_query_destroy(query);
-               contacts_filter_destroy(filter);
-               contacts_list_destroy(personNumbers, true);
-               return MSG_SUCCESS;
-       }
-
-       contacts_query_destroy(query);
-       contacts_filter_destroy(filter);
-
-       MSG_DEBUG(" *count [%d]", *count);
-
-       *pAddrInfo = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S) * (*count)];
-       memset(*pAddrInfo, 0x00, (sizeof(MSG_ADDRESS_INFO_S) * (*count)));
-
-       contacts_record_h personNumber = NULL;
-
-       while (CONTACTS_ERROR_NONE == contacts_list_get_current_record_p(personNumbers, &personNumber)) {
-               char* normalizedNumber = NULL;
-               ret = contacts_record_get_str(personNumber, _contacts_person_number.normalized_number, &normalizedNumber);
-               if (ret != CONTACTS_ERROR_NONE) {
-                       MSG_DEBUG("contacts_record_get_int() Error [%d]", ret);
-               }
-               else if (normalizedNumber) {
-                       MSG_DEBUG("normalizedNumber [%s]", normalizedNumber);
-                       strncpy((*pAddrInfo)[index].addressVal, normalizedNumber, MAX_ADDRESS_VAL_LEN);
-               }
-
-               contacts_list_next(personNumbers);
-               index++;
-       }
-
-       contacts_list_destroy(personNumbers, true);
-
+#endif
 #endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
        MSG_END();
 
@@ -599,22 +452,10 @@ msg_error_t MsgGetContactSearchList(const char *pSearchVal, MSG_ADDRESS_INFO_S *
 }
 
 
-int MsgGetContactNameOrder()
-{
-#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
-       contacts_name_display_order_e order = CONTACTS_NAME_DISPLAY_ORDER_FIRSTLAST;
-
-       return (int)order;
-#else
-       return 0;
-#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
-}
-
-
 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)
 {
 #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
-
+#if 0
        if (first == NULL || last == NULL || middle == NULL || prefix == NULL || suffix == NULL || displayName == NULL || size ==0) {
                MSG_DEBUG("Invalid parameter.");
                return MSG_ERR_INVALID_PARAMETER;
@@ -675,7 +516,7 @@ msg_error_t MsgGetContactStyleDisplayName(const char *first, const char *last, c
        }
 
        MSG_SEC_DEBUG("displayName [%s]", displayName);
-
+#endif
 #endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
        return MSG_SUCCESS;
 }
index 9ca6cc8..5618966 100755 (executable)
@@ -1020,7 +1020,7 @@ msg_error_t MsgMakeSortRule(const MSG_SORT_RULE_S *pSortRule, char *pSqlSort)
        else
                strncpy(order, "DESC", 5);
 
-       int nameOrder = MsgGetContactNameOrder();
+       int nameOrder = 0;
 
        switch (pSortRule->sortType) {
                case MSG_SORT_BY_DISPLAY_FROM :
index 5646e0b..4bdc18e 100755 (executable)
@@ -438,7 +438,7 @@ msg_error_t MsgStoAddAddress(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S *
        return err;
 }
 
-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 *nAddressCnt, MSG_ADDRESS_INFO_S **pAddress)
 {
        char sqlQuery[MAX_QUERY_LEN+1];
        int rowCnt = 0, index = 0;
@@ -487,7 +487,7 @@ msg_error_t MsgStoGetAddressByMsgId(MsgDbHandler *pDbHandle, msg_message_id_t ms
        return MSG_SUCCESS;
 }
 
-msg_error_t MsgStoGetAddressByMsgId(MsgDbHandler *pDbHandle, msg_message_id_t msgId, int contactNameOrder, msg_struct_list_s *pAddress)
+msg_error_t MsgStoGetAddressByMsgId(MsgDbHandler *pDbHandle, msg_message_id_t msgId, msg_struct_list_s *pAddress)
 {
        char sqlQuery[MAX_QUERY_LEN+1];
 
@@ -554,7 +554,7 @@ msg_error_t MsgStoGetAddressByMsgId(MsgDbHandler *pDbHandle, msg_message_id_t ms
 }
 
 
-msg_error_t MsgStoGetAddressByConvId(MsgDbHandler *pDbHandle, msg_thread_id_t convId, int contactNameOrder, msg_struct_list_s *pAddrlist)
+msg_error_t MsgStoGetAddressByConvId(MsgDbHandler *pDbHandle, msg_thread_id_t convId, msg_struct_list_s *pAddrlist)
 {
        char sqlQuery[MAX_QUERY_LEN+1];
 
@@ -1155,7 +1155,6 @@ msg_error_t MsgStoSetConversationDisplayName(MsgDbHandler *pDbHandle, int contac
                return err;
        }
 
-       int order = MsgGetContactNameOrder();
        msg_struct_s *pAddrInfo = NULL;
        MSG_ADDRESS_INFO_S *address = NULL;
 
@@ -1163,7 +1162,7 @@ msg_error_t MsgStoSetConversationDisplayName(MsgDbHandler *pDbHandle, int contac
                memset(displayName, 0x00, sizeof(displayName));
                MsgDbHandler tmpDbHandle;
                msg_struct_list_s addressList = {0, };
-               MsgStoGetAddressByConvId(&tmpDbHandle, (msg_thread_id_t)pDbHandle->getColumnToInt(i), order, &addressList);
+               MsgStoGetAddressByConvId(&tmpDbHandle, (msg_thread_id_t)pDbHandle->getColumnToInt(i), &addressList);
 
                for (int j = 0; j < addressList.nCount; j++) {
                        if (j >0)
@@ -1226,14 +1225,12 @@ msg_error_t MsgStoSetConversationDisplayName(MsgDbHandler *pDbHandle, msg_thread
 
        msg_struct_list_s addressList = {0, };
 
-       int order = MsgGetContactNameOrder();
-
        msg_struct_s *pAddrInfo = NULL;
        MSG_ADDRESS_INFO_S *address = NULL;
 
        memset(displayName, 0x00, sizeof(displayName));
 
-       MsgStoGetAddressByConvId(pDbHandle, convId, order, &addressList);
+       MsgStoGetAddressByConvId(pDbHandle, convId, &addressList);
 
        for (int j = 0; j < addressList.nCount; j++) {
                if (j >0)
@@ -2274,10 +2271,7 @@ msg_error_t MsgStoGetAddressList(const msg_thread_id_t threadId, msg_struct_list
 
        msg_error_t err = MSG_SUCCESS;
 
-       /* contacts-service is not used for gear */
-       int order = MsgGetContactNameOrder();
-
-       err = MsgStoGetAddressByConvId(dbHandle, threadId, order, pAddrList);
+       err = MsgStoGetAddressByConvId(dbHandle, threadId, pAddrList);
 
        return err;
 }