summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSangkoo Kim <sangkoo.kim@samsung.com>2016-02-24 16:16:52 +0900
committerSangkoo Kim <sangkoo.kim@samsung.com>2016-02-24 17:04:49 +0900
commitbc7ac1d480b466cae726d86367d18f05c0eb0f7f (patch)
tree17de4ff6e255bc694447a952732f3935616e1666
parent3b6a8a27dd394fb3a49b9d35699dbbf290fdf345 (diff)
downloadmsg-service-bc7ac1d480b466cae726d86367d18f05c0eb0f7f.tar.gz
msg-service-bc7ac1d480b466cae726d86367d18f05c0eb0f7f.tar.bz2
msg-service-bc7ac1d480b466cae726d86367d18f05c0eb0f7f.zip
Change-Id: I4bdfd8ccb4cd1834095b095f1089dbf09f676131 Signed-off-by: Sangkoo Kim <sangkoo.kim@samsung.com>
-rwxr-xr-xpackaging/msg-service.spec4
-rwxr-xr-xutils/CMakeLists.txt4
-rwxr-xr-xutils/MsgContact.cpp36
-rwxr-xr-xutils/MsgVMessage.cpp4
4 files changed, 40 insertions, 8 deletions
diff --git a/packaging/msg-service.spec b/packaging/msg-service.spec
index 006cad7..ce47b28 100755
--- a/packaging/msg-service.spec
+++ b/packaging/msg-service.spec
@@ -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
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index bd3a173..b26fa27 100755
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -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})
diff --git a/utils/MsgContact.cpp b/utils/MsgContact.cpp
index b438b9a..63e909a 100755
--- a/utils/MsgContact.cpp
+++ b/utils/MsgContact.cpp
@@ -22,10 +22,12 @@
#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
}
diff --git a/utils/MsgVMessage.cpp b/utils/MsgVMessage.cpp
index f74c982..b5d210d 100755
--- a/utils/MsgVMessage.cpp
+++ b/utils/MsgVMessage.cpp
@@ -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';