Remove dependency of contact-service on wearable 13/60213/2 accepted/tizen/ivi/20160225.081639 accepted/tizen/mobile/20160225.081549 accepted/tizen/tv/20160225.081609 accepted/tizen/wearable/20160225.081623 submit/tizen/20160224.101252
authorSangkoo Kim <sangkoo.kim@samsung.com>
Wed, 24 Feb 2016 07:16:52 +0000 (16:16 +0900)
committerSangkoo Kim <sangkoo.kim@samsung.com>
Wed, 24 Feb 2016 08:04:49 +0000 (17:04 +0900)
Change-Id: I4bdfd8ccb4cd1834095b095f1089dbf09f676131
Signed-off-by: Sangkoo Kim <sangkoo.kim@samsung.com>
packaging/msg-service.spec
utils/CMakeLists.txt
utils/MsgContact.cpp
utils/MsgVMessage.cpp

index 006cad7..ce47b28 100755 (executable)
@@ -35,7 +35,6 @@ BuildRequires: pkgconfig(capi-system-device)
 BuildRequires: pkgconfig(capi-system-info)
 BuildRequires: pkgconfig(capi-system-system-settings)
 BuildRequires: pkgconfig(capi-telephony)
-BuildRequires: pkgconfig(contacts-service2)
 BuildRequires: pkgconfig(cynara-client)
 BuildRequires: pkgconfig(cynara-creds-commons)
 BuildRequires: pkgconfig(cynara-creds-socket)
@@ -61,6 +60,9 @@ BuildRequires: pkgconfig(sqlite3)
 BuildRequires: pkgconfig(storage)
 BuildRequires: pkgconfig(tapi)
 BuildRequires: pkgconfig(vconf)
+%if "%{?profile}" == "mobile"
+BuildRequires: pkgconfig(contacts-service2)
+%endif
 
 %description
 Description: Messaging Framework Library
index bd3a173..b26fa27 100755 (executable)
@@ -46,7 +46,11 @@ 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)
+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)
+ENDIF()
 pkg_check_modules(utils_pkgs REQUIRED ${PKG_MODULES})
 
 FOREACH(flag ${utils_pkgs_CFLAGS})
index b438b9a..63e909a 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
@@ -38,11 +40,14 @@ MsgDbHandler ContactDbHandle;
 #define PHONENUMBER_MIN_MATCH_DIGIT VCONFKEY_CONTACTS_SVC_PHONENUMBER_MIN_MATCH_DIGIT
 #define DEFAULT_MIN_MATCH_DIGIT 8
 
+#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
 static int phonenumberMinMatchDigit = -1;
+#endif
 
 /*==================================================================================================
                                      INTERNAL FUNCTION IMPLEMENTATION
 ==================================================================================================*/
+
 int countryCodeLength(const char *src)
 {
        int ret = 0;
@@ -203,12 +208,12 @@ 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) {
@@ -225,13 +230,14 @@ msg_error_t MsgOpenContactSvc()
        } 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) {
@@ -245,20 +251,21 @@ msg_error_t MsgCloseContactSvc()
                        return MSG_ERR_DB_DISCONNECT;
                }
        }
-
+#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
        return MSG_SUCCESS;
 }
 
 
 msg_error_t MsgInitContactSvc()
 {
+#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
        phonenumberMinMatchDigit = MsgSettingGetInt(PHONENUMBER_MIN_MATCH_DIGIT);
        MSG_DEBUG("phonenumberMinMatchDigit [%d]", phonenumberMinMatchDigit);
 
        if (phonenumberMinMatchDigit < 1) {
                phonenumberMinMatchDigit = DEFAULT_MIN_MATCH_DIGIT;
        }
-
+#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
        return MSG_SUCCESS;
 }
 
@@ -266,7 +273,7 @@ msg_error_t MsgInitContactSvc()
 msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_INFO_S *pContactInfo)
 {
        MSG_BEGIN();
-
+#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
        msg_error_t err = MSG_SUCCESS;
 
        if ((err = MsgOpenContactSvc()) != MSG_SUCCESS) {
@@ -487,6 +494,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;
@@ -496,6 +504,7 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
 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;
 
@@ -581,6 +590,7 @@ msg_error_t MsgGetContactSearchList(const char *pSearchVal, MSG_ADDRESS_INFO_S *
 
        contacts_list_destroy(personNumbers, true);
 
+#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
        MSG_END();
 
        return MSG_SUCCESS;
@@ -589,14 +599,20 @@ 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 (first == NULL || last == NULL || middle == NULL || prefix == NULL || suffix == NULL || displayName == NULL || size ==0) {
                MSG_DEBUG("Invalid parameter.");
                return MSG_ERR_INVALID_PARAMETER;
@@ -658,12 +674,15 @@ msg_error_t MsgGetContactStyleDisplayName(const char *first, const char *last, c
 
        MSG_SEC_DEBUG("displayName [%s]", displayName);
 
+#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
        return MSG_SUCCESS;
 }
 
 
 void MsgAddPhoneLog(const MSG_MESSAGE_INFO_S *pMsgInfo)
 {
+#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
+
        msg_error_t err = MSG_SUCCESS;
 
        if ((err = MsgOpenContactSvc()) != MSG_SUCCESS) {
@@ -749,11 +768,13 @@ void MsgAddPhoneLog(const MSG_MESSAGE_INFO_S *pMsgInfo)
 
                contacts_record_destroy(plog, true);
        }
+#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
 }
 
 
 void MsgDeletePhoneLog(msg_message_id_t msgId)
 {
+#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
        msg_error_t err = MSG_SUCCESS;
 
        if ((err = MsgOpenContactSvc()) != MSG_SUCCESS) {
@@ -812,6 +833,7 @@ void MsgDeletePhoneLog(msg_message_id_t msgId)
        contacts_query_destroy(query);
        contacts_filter_destroy(filter);
        contacts_list_destroy(plogs, true);
+#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
 }
 
 
@@ -960,7 +982,11 @@ bool checkBlockingMode(char *address, bool *pisFavorites)
 
 int MsgContactGetMinMatchDigit()
 {
+#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
        return phonenumberMinMatchDigit;
+#else
+       return DEFAULT_MIN_MATCH_DIGIT;
+#endif
 }
 
 
index f74c982..b5d210d 100755 (executable)
@@ -254,7 +254,7 @@ static int __msgsvc_vmsg_append_str(char **buf, int *buf_size, int len, const ch
                char *r = (char *)(*buf+len);
 
                while (*s) {
-                       switch (*s) {
+                       switch ((unsigned int)*s) {
                        case '\r':
                                if (*(s+1) && '\n' == *(s+1)) {
                                        s++;
@@ -1684,7 +1684,7 @@ static char* __msgsvc_vmsg_remove_escape_char(char *str)
        while (*s) {
                if (*s == '\\' && *(s+1)) {
                        char *n = (char*)(s+1);
-                       switch (*n) {
+                       switch ((unsigned int)*n) {
                        case 'n':
                        case 'N':
                                *r = '\n';