summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonghee Ye <donghee.ye@samsung.com>2013-04-04 18:56:24 +0900
committerDonghee Ye <donghee.ye@samsung.com>2013-04-04 20:45:49 +0900
commit2b965b11802740ec0d447318f1cad69f5cae989d (patch)
tree1b41b5608a4f4857c12e5ba62749da694f84efa3
parenta860756623127895e06c9de57e4486d9ac525950 (diff)
downloadcontacts-service-2b965b11802740ec0d447318f1cad69f5cae989d.tar.gz
contacts-service-2b965b11802740ec0d447318f1cad69f5cae989d.tar.bz2
contacts-service-2b965b11802740ec0d447318f1cad69f5cae989d.zip
Update version 0.9.61
- Change display order - Support unlimited vcard size - Change _contacts_profile property - Change _contacts_activity property - Remove unused property : account_id 1/2/3 property of person - Fix : getting group relation with query Change-Id: I1efb4c17ace95ad8a02d9d9cf11e6ee099afb7fd
-rwxr-xr-xCMakeLists.txt2
-rwxr-xr-xcommon/ctsvc_localize.c5
-rwxr-xr-xcommon/ctsvc_localize.h2
-rw-r--r--common/ctsvc_normalize.c4
-rw-r--r--common/ctsvc_normalize.h2
-rw-r--r--common/ctsvc_record_contact.c84
-rwxr-xr-xcommon/ctsvc_record_person.c21
-rw-r--r--common/ctsvc_setting.c13
-rw-r--r--common/ctsvc_setting.h2
-rw-r--r--common/ctsvc_struct.h16
-rw-r--r--common/ctsvc_vcard.c1091
-rw-r--r--common/ctsvc_view.c54
-rw-r--r--common/ctsvc_view.h40
-rw-r--r--common/ipc/ctsvc_ipc_activity.c4
-rw-r--r--common/ipc/ctsvc_ipc_person.c6
-rw-r--r--common/ipc/ctsvc_ipc_profile.c22
-rw-r--r--contacts-service2.manifest4
-rw-r--r--include/contacts.h21
-rwxr-xr-xinclude/contacts_views.h24
-rw-r--r--native/ctsvc_db_init.c10
-rw-r--r--native/ctsvc_db_plugin_activity.c38
-rw-r--r--native/ctsvc_db_plugin_contact.c6
-rw-r--r--native/ctsvc_db_plugin_contact_helper.c2
-rw-r--r--native/ctsvc_db_plugin_grouprelation.c2
-rw-r--r--native/ctsvc_db_plugin_my_profile.c4
-rw-r--r--native/ctsvc_db_plugin_number_helper.c5
-rw-r--r--native/ctsvc_db_plugin_person.c15
-rwxr-xr-xnative/ctsvc_db_plugin_person_helper.c21
-rw-r--r--native/ctsvc_db_plugin_phonelog.c3
-rw-r--r--native/ctsvc_db_plugin_profile.c32
-rw-r--r--native/ctsvc_db_plugin_profile_helper.c40
-rwxr-xr-xnative/ctsvc_db_query.c3
-rw-r--r--packaging/contacts-service.spec6
-rwxr-xr-xschema.sql2
-rwxr-xr-xserver/ctsvc_server_sim.c2
35 files changed, 789 insertions, 819 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 261ad19..9e2e22e 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,7 +13,7 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(EXEC_PREFIX "\${prefix}")
SET(INCLUDEDIR "\${prefix}/${DEST_INCLUDE_DIR}")
SET(VERSION_MAJOR 0)
-SET(VERSION "${VERSION_MAJOR}.9.59")
+SET(VERSION "${VERSION_MAJOR}.9.61")
EXECUTE_PROCESS(COMMAND build-util/generator.sh)
diff --git a/common/ctsvc_localize.c b/common/ctsvc_localize.c
index 89c31a5..fb550a8 100755
--- a/common/ctsvc_localize.c
+++ b/common/ctsvc_localize.c
@@ -103,7 +103,7 @@ static const unsigned char hangul_jamo_jongseong[] = {
0xAA, 0xAC, 0xAD, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, // to jongseong 0x11A8~0x11FF
0xC7, 0xC8, 0xCC, 0xCE, 0xD3, 0xD7, 0xD9, 0xDF, 0xF1, 0xF2, 0x00};
-static const unsigned char japanese_halfwidth_katakana_to_hiragana[] = { // 0xff66 - 0xff9f
+static const unsigned char japanese_halfwidth_katakana_to_hiragana[] = { // 0xff66 - 0xff9d
0x92, 0x41, 0x43, 0x45, 0x47, 0x49, 0x83, 0x85, 0x87, 0x63,
0x00, 0x42, 0x44, 0x46, 0x48, 0x4A, 0x4B, 0x4D, 0x4F, 0x51,
0x53, 0x55, 0x57, 0x59, 0x5B, 0x5D, 0x5F, 0x61, 0x64, 0x66,
@@ -257,7 +257,7 @@ int ctsvc_convert_japanese_to_hiragana_unicode(UChar *src, UChar *dest, int dest
dest[j] = unicode_value1 << 8 | unicode_value2;
i++;
}
- else if (unicode_value2 >= 0x66 && unicode_value2 <= 0x9f) {
+ else if (unicode_value2 >= 0x66 && unicode_value2 <= 0x9d) {
unicode_value2 = japanese_halfwidth_katakana_to_hiragana[unicode_value2 - 0x66];
dest[j] = unicode_value1 << 8 | unicode_value2;
}
@@ -531,6 +531,7 @@ int ctsvc_get_name_sort_type(const char *src)
break;
default:
ret = CTSVC_SORT_OTHERS;
+ break;
}
return ret;
diff --git a/common/ctsvc_localize.h b/common/ctsvc_localize.h
index 3e07d78..2411e68 100755
--- a/common/ctsvc_localize.h
+++ b/common/ctsvc_localize.h
@@ -22,6 +22,7 @@
#include <unicode/utypes.h>
enum SORTTYPE{
+ CTSVC_SORT_OTHERS, // -1??
CTSVC_SORT_NUMBER, // 0
CTSVC_SORT_PRIMARY, // 1
CTSVC_SORT_SECONDARY, // 2
@@ -29,7 +30,6 @@ enum SORTTYPE{
CTSVC_SORT_KOREAN, // 4
CTSVC_SORT_JAPANESE, // 5
CTSVC_SORT_CJK, // 6
- CTSVC_SORT_OTHERS = 100,// 0
};
int ctsvc_check_utf8(char c);
diff --git a/common/ctsvc_normalize.c b/common/ctsvc_normalize.c
index 544c6dc..07fc667 100644
--- a/common/ctsvc_normalize.c
+++ b/common/ctsvc_normalize.c
@@ -781,7 +781,7 @@ static bool __ctsvc_compare_pinyin_letter(const char *haystack, int haystack_lan
if (haystack_lang != CTSVC_LANG_CHINESE || needle_lang != CTSVC_LANG_ENGLISH)
return false;
- for(i=0, k=0; i < strlen(temp_needle); i++)
+ for(i=0, k=0; i < sizeof(temp_needle); i++)
{
if (isupper(needle[i]))
temp_needle[i] = tolower(needle[i]);
@@ -792,6 +792,8 @@ static bool __ctsvc_compare_pinyin_letter(const char *haystack, int haystack_lan
for(i=0, j=0; i < strlen(haystack) && j < strlen(temp_needle) ; i+=len)
{
len = ctsvc_check_utf8(haystack[i]);
+ if (len < 0)
+ return false;
memcpy(temp, haystack + i, len );
temp[len] = '\0';
diff --git a/common/ctsvc_normalize.h b/common/ctsvc_normalize.h
index f52e0a6..8710a54 100644
--- a/common/ctsvc_normalize.h
+++ b/common/ctsvc_normalize.h
@@ -19,8 +19,6 @@
#ifndef __TIZEN_SOCIAL_CTSVC_NORMALIZE_H__
#define __TIZEN_SOCIAL_CTSVC_NORMALIZE_H__
-#define CTSVC_MIN_MATCH_NORMALIZED_NUMBER_SIZE 8
-
enum LANGTYPE{
CTSVC_LANG_NUMBER = 0,
CTSVC_LANG_DEFAULT = 1,
diff --git a/common/ctsvc_record_contact.c b/common/ctsvc_record_contact.c
index 9f9f06f..e714c8f 100644
--- a/common/ctsvc_record_contact.c
+++ b/common/ctsvc_record_contact.c
@@ -951,6 +951,8 @@ static int __ctsvc_activity_destroy(contacts_record_h record, bool delete_child)
free(activity->source_name);
free(activity->status);
+ free(activity->service_operation);
+ free(activity->uri);
free(activity->sync_data1);
free(activity->sync_data2);
free(activity->sync_data3);
@@ -1050,11 +1052,12 @@ static int __ctsvc_profile_destroy(contacts_record_h record, bool delete_child)
free(profile->label);
free(profile->uid);
free(profile->text);
- free(profile->appsvc_operation);
- free(profile->data1);
- free(profile->data2);
- free(profile->data3);
- free(profile->data4);
+ free(profile->service_operation);
+ free(profile->mime);
+ free(profile->app_id);
+ free(profile->uri);
+ free(profile->category);
+ free(profile->extra_data);
free(profile);
return CONTACTS_ERROR_NONE;
@@ -2867,6 +2870,12 @@ static int __ctsvc_activity_get_str_real(contacts_record_h record, unsigned int
case CTSVC_PROPERTY_ACTIVITY_STATUS:
*out_str = GET_STR(copy, activity->status);
break;
+ case CTSVC_PROPERTY_ACTIVITY_SERVICE_OPERATION:
+ *out_str = GET_STR(copy, activity->service_operation);
+ break;
+ case CTSVC_PROPERTY_ACTIVITY_URI:
+ *out_str = GET_STR(copy, activity->uri);
+ break;
case CTSVC_PROPERTY_ACTIVITY_SYNC_DATA1:
*out_str = GET_STR(copy, activity->sync_data1);
break;
@@ -2935,20 +2944,23 @@ static int __ctsvc_profile_get_str_real(contacts_record_h record, unsigned int p
case CTSVC_PROPERTY_PROFILE_TEXT:
*out_str = GET_STR(copy, profile->text);
break;
- case CTSVC_PROPERTY_PROFILE_APPSVC_OPERATION:
- *out_str = GET_STR(copy, profile->appsvc_operation);
+ case CTSVC_PROPERTY_PROFILE_SERVICE_OPERATION:
+ *out_str = GET_STR(copy, profile->service_operation);
+ break;
+ case CTSVC_PROPERTY_PROFILE_MIME:
+ *out_str = GET_STR(copy, profile->mime);
break;
- case CTSVC_PROPERTY_PROFILE_DATA1:
- *out_str = GET_STR(copy, profile->data1);
+ case CTSVC_PROPERTY_PROFILE_APP_ID:
+ *out_str = GET_STR(copy, profile->app_id);
break;
- case CTSVC_PROPERTY_PROFILE_DATA2:
- *out_str = GET_STR(copy, profile->data2);
+ case CTSVC_PROPERTY_PROFILE_URI:
+ *out_str = GET_STR(copy, profile->uri);
break;
- case CTSVC_PROPERTY_PROFILE_DATA3:
- *out_str = GET_STR(copy, profile->data3);
+ case CTSVC_PROPERTY_PROFILE_CATEGORY:
+ *out_str = GET_STR(copy, profile->category);
break;
- case CTSVC_PROPERTY_PROFILE_DATA4:
- *out_str = GET_STR(copy, profile->data4);
+ case CTSVC_PROPERTY_PROFILE_EXTRA_DATA:
+ *out_str = GET_STR(copy, profile->extra_data);
break;
default :
CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(profile)", property_id);
@@ -3402,6 +3414,12 @@ static int __ctsvc_activity_set_str(contacts_record_h record, unsigned int prope
case CTSVC_PROPERTY_ACTIVITY_STATUS:
FREEandSTRDUP(activity->status, str);
break;
+ case CTSVC_PROPERTY_ACTIVITY_SERVICE_OPERATION:
+ FREEandSTRDUP(activity->service_operation, str);
+ break;
+ case CTSVC_PROPERTY_ACTIVITY_URI:
+ FREEandSTRDUP(activity->uri, str);
+ break;
case CTSVC_PROPERTY_ACTIVITY_SYNC_DATA1:
FREEandSTRDUP(activity->sync_data1, str);
break;
@@ -3450,20 +3468,23 @@ static int __ctsvc_profile_set_str(contacts_record_h record, unsigned int proper
case CTSVC_PROPERTY_PROFILE_TEXT:
FREEandSTRDUP(profile->text, str);
break;
- case CTSVC_PROPERTY_PROFILE_APPSVC_OPERATION:
- FREEandSTRDUP(profile->appsvc_operation, str);
+ case CTSVC_PROPERTY_PROFILE_SERVICE_OPERATION:
+ FREEandSTRDUP(profile->service_operation, str);
break;
- case CTSVC_PROPERTY_PROFILE_DATA1:
- FREEandSTRDUP(profile->data1, str);
+ case CTSVC_PROPERTY_PROFILE_MIME:
+ FREEandSTRDUP(profile->mime, str);
break;
- case CTSVC_PROPERTY_PROFILE_DATA2:
- FREEandSTRDUP(profile->data2, str);
+ case CTSVC_PROPERTY_PROFILE_APP_ID:
+ FREEandSTRDUP(profile->app_id, str);
break;
- case CTSVC_PROPERTY_PROFILE_DATA3:
- FREEandSTRDUP(profile->data3, str);
+ case CTSVC_PROPERTY_PROFILE_URI:
+ FREEandSTRDUP(profile->uri, str);
break;
- case CTSVC_PROPERTY_PROFILE_DATA4:
- FREEandSTRDUP(profile->data4, str);
+ case CTSVC_PROPERTY_PROFILE_CATEGORY:
+ FREEandSTRDUP(profile->category, str);
+ break;
+ case CTSVC_PROPERTY_PROFILE_EXTRA_DATA:
+ FREEandSTRDUP(profile->extra_data, str);
break;
default :
CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(profile)", property_id);
@@ -3867,6 +3888,8 @@ static int __ctsvc_activity_clone(contacts_record_h record, contacts_record_h *o
out_data->timestamp = src_data->timestamp;
out_data->source_name = SAFE_STRDUP(src_data->source_name);
out_data->status = SAFE_STRDUP(src_data->status);
+ out_data->service_operation = SAFE_STRDUP(src_data->service_operation);
+ out_data->uri = SAFE_STRDUP(src_data->uri);
out_data->sync_data1 = SAFE_STRDUP(src_data->sync_data1);
out_data->sync_data2 = SAFE_STRDUP(src_data->sync_data2);
out_data->sync_data3 = SAFE_STRDUP(src_data->sync_data3);
@@ -4199,11 +4222,12 @@ static int __ctsvc_profile_clone(contacts_record_h record, contacts_record_h *ou
out_data->label = SAFE_STRDUP(src_data->label);
out_data->uid = SAFE_STRDUP(src_data->uid);
out_data->text = SAFE_STRDUP(src_data->text);
- out_data->appsvc_operation = SAFE_STRDUP(src_data->appsvc_operation);
- out_data->data1 = SAFE_STRDUP(src_data->data1);
- out_data->data2 = SAFE_STRDUP(src_data->data2);
- out_data->data3 = SAFE_STRDUP(src_data->data3);
- out_data->data4 = SAFE_STRDUP(src_data->data4);
+ out_data->service_operation = SAFE_STRDUP(src_data->service_operation);
+ out_data->mime = SAFE_STRDUP(src_data->mime);
+ out_data->app_id = SAFE_STRDUP(src_data->app_id);
+ out_data->uri = SAFE_STRDUP(src_data->uri);
+ out_data->category = SAFE_STRDUP(src_data->category);
+ out_data->extra_data = SAFE_STRDUP(src_data->extra_data);
CTSVC_RECORD_COPY_BASE(&(out_data->base), &(src_data->base));
diff --git a/common/ctsvc_record_person.c b/common/ctsvc_record_person.c
index 2ea5887..eb57492 100755
--- a/common/ctsvc_record_person.c
+++ b/common/ctsvc_record_person.c
@@ -103,9 +103,6 @@ static int __ctsvc_person_clone(contacts_record_h record, contacts_record_h *out
out_data->person_id = src_data->person_id;
out_data->name_contact_id = src_data->name_contact_id;
out_data->link_count = src_data->link_count;
- out_data->account_id1 = src_data->account_id1;
- out_data->account_id2 = src_data->account_id2;
- out_data->account_id3 = src_data->account_id3;
out_data->addressbook_ids = SAFE_STRDUP(src_data->addressbook_ids);
out_data->display_name = SAFE_STRDUP(src_data->display_name);
out_data->display_name_index = SAFE_STRDUP(src_data->display_name_index);
@@ -133,15 +130,6 @@ static int __ctsvc_person_get_int(contacts_record_h record, unsigned int propert
case CTSVC_PROPERTY_PERSON_LINK_COUNT:
*out = person->link_count;
break;
- case CTSVC_PROPERTY_PERSON_ACCOUNT_ID1:
- *out = person->account_id1;
- break;
- case CTSVC_PROPERTY_PERSON_ACCOUNT_ID2:
- *out = person->account_id2;
- break;
- case CTSVC_PROPERTY_PERSON_ACCOUNT_ID3:
- *out = person->account_id3;
- break;
default:
ASSERT_NOT_REACHED("This field(%d) is not supported in value(person)", property_id);
return CONTACTS_ERROR_INVALID_PARAMETER;
@@ -225,15 +213,6 @@ static int __ctsvc_person_set_int(contacts_record_h record, unsigned int propert
case CTSVC_PROPERTY_PERSON_LINK_COUNT:
person->link_count = value;
break;
- case CTSVC_PROPERTY_PERSON_ACCOUNT_ID1:
- person->account_id1 = value;
- break;
- case CTSVC_PROPERTY_PERSON_ACCOUNT_ID2:
- person->account_id2 = value;
- break;
- case CTSVC_PROPERTY_PERSON_ACCOUNT_ID3:
- person->account_id3 = value;
- break;
default:
ASSERT_NOT_REACHED("This field(0x%0x) is not supported in value(person)", property_id);
return CONTACTS_ERROR_INVALID_PARAMETER;
diff --git a/common/ctsvc_setting.c b/common/ctsvc_setting.c
index da39065..37b309e 100644
--- a/common/ctsvc_setting.c
+++ b/common/ctsvc_setting.c
@@ -35,9 +35,11 @@ static int name_display_order = -1;
static int name_sorting_order = -1;
static int primary_sort = -1;
static int secondary_sort = -1;
+static int phonenumber_min_match_digit = -1;
static const char *CTSVC_VCONF_DISPLAY_ORDER = VCONFKEY_CONTACTS_SVC_NAME_DISPLAY_ORDER;
static const char *CTSVC_VCONF_SORTING_ORDER = VCONFKEY_CONTACTS_SVC_NAME_SORTING_ORDER;
+static const char *CTSVC_VCONF_PHONENUMBER_MIN_MATCH_DIGIT = VCONFKEY_CONTACTS_SVC_PHONENUMBER_MIN_MATCH_DIGIT;
const char* ctsvc_get_default_language_vconfkey(void)
{
@@ -140,6 +142,12 @@ int ctsvc_register_vconf(void)
name_sorting_order = CONTACTS_NAME_SORTING_ORDER_FIRSTLAST;
}
+ ret = vconf_get_int(CTSVC_VCONF_PHONENUMBER_MIN_MATCH_DIGIT, &phonenumber_min_match_digit);
+ if (ret < 0) {
+ CTS_ERR("vconf_get_int() Failed(%d)", ret);
+ phonenumber_min_match_digit = 8;
+ }
+
ret = vconf_get_int(ctsvc_get_default_language_vconfkey(), &primary_sort);
WARN_IF(ret < 0, "vconf_get_int() Failed(%d)", ret);
@@ -205,3 +213,8 @@ int ctsvc_get_secondary_language(void)
return secondary_sort;
}
+int ctsvc_get_phonenumber_min_match_digit(void)
+{
+ return phonenumber_min_match_digit;
+}
+
diff --git a/common/ctsvc_setting.h b/common/ctsvc_setting.h
index 424d4e6..316a8d7 100644
--- a/common/ctsvc_setting.h
+++ b/common/ctsvc_setting.h
@@ -26,6 +26,6 @@ int ctsvc_get_default_language(void);
int ctsvc_get_secondary_language(void);
const char *ctsvc_get_default_language_vconfkey(void);
const char *ctsvc_get_secondary_language_vconfkey(void);
-
+int ctsvc_get_phonenumber_min_match_digit(void);
#endif /* __TIZEN_SOCIAL_CTSVC_SETTING_H__ */
diff --git a/common/ctsvc_struct.h b/common/ctsvc_struct.h
index 93e153a..eae39c3 100644
--- a/common/ctsvc_struct.h
+++ b/common/ctsvc_struct.h
@@ -244,9 +244,6 @@ typedef struct {
char *vibration;
char *status;
int link_count;
- int account_id1;
- int account_id2;
- int account_id3;
char *addressbook_ids;
}ctsvc_person_s;
@@ -377,11 +374,12 @@ typedef struct {
char *uid;
char *text;
int order;
- char *appsvc_operation;
- char *data1;
- char *data2;
- char *data3;
- char *data4;
+ char *service_operation;
+ char *mime;
+ char *app_id;
+ char *uri;
+ char *category;
+ char *extra_data;
}ctsvc_profile_s;
typedef struct {
@@ -418,6 +416,8 @@ typedef struct {
char *status;
int timestamp;
ctsvc_list_s* photos;
+ char *service_operation;
+ char *uri;
char *sync_data1;
char *sync_data2;
char *sync_data3;
diff --git a/common/ctsvc_vcard.c b/common/ctsvc_vcard.c
index 1709413..f8d3e96 100644
--- a/common/ctsvc_vcard.c
+++ b/common/ctsvc_vcard.c
@@ -34,10 +34,22 @@
#include "ctsvc_vcard.h"
#define SMART_STRDUP(src) (src && *src)?strdup(src):NULL
-#define CTSVC_VCARD_FILE_MAX_SIZE 1024*1024
-#define CTSVC_VCARD_PHOTO_MAX_SIZE 1024*100
+#define CTSVC_VCARD_PHOTO_MAX_SIZE 1024*1024
#define CTSVC_VCARD_IMAGE_LOCATION "/opt/usr/data/contacts-svc/img/vcard"
+#define CTSVC_VCARD_APPEND_STR(buf, buf_size, len, str) do { \
+ if ((len = __ctsvc_vcard_append_str(buf, buf_size, len, str)) < 0) { \
+ ERR("__ctsvc_vcard_append_str() Failed"); \
+ return CONTACTS_ERROR_INTERNAL; \
+ } \
+} while (0)
+
+#define CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, content) do { \
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ":"); \
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content); \
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, CTSVC_CRLF); \
+} while (0)
+
enum {
CTSVC_VCARD_VER_NONE,
CTSVC_VCARD_VER_2_1,
@@ -161,19 +173,62 @@ static void __ctsvc_vcard_initial(void)
}
};
+
+static int __ctsvc_vcard_append_str(char **buf, int *buf_size, int len, const char *str)
+{
+ int len_temp = 0;
+ char *tmp = NULL;
+ const char *safe_str = SAFE_STR(str);
+ int str_len = 0;
+ bool need_realloc = false;
+
+ str_len = strlen(safe_str);
+ while ((*buf_size-len) < (str_len+1)) {
+ *buf_size = *buf_size * 2;
+ need_realloc = true;
+ }
+
+ if (need_realloc) {
+ if (NULL == (tmp = realloc(*buf, *buf_size))) {
+ free(*buf);
+ return -1;
+ }
+ else
+ *buf = tmp;
+ }
+
+ len_temp = snprintf(*buf+len, *buf_size-len+1, "%s", safe_str);
+ len += len_temp;
+ return len;
+}
+
#define CTS_VCARD_FOLDING_LIMIT 75
-static inline int __ctsvc_vcard_add_folding(char *src)
+static inline int __ctsvc_vcard_add_folding(char **buf, int *buf_size, int buf_len)
{
+ char *buf_copy = NULL;
int len, result_len;
- char result[CTSVC_VCARD_FILE_MAX_SIZE] = {0};
char *r;
const char *s;
- s = src;
- r = result;
+ buf_copy = calloc(1, *buf_size);
+
+ s = *buf;
+ r = buf_copy;
len = result_len = 0;
+
while (*s) {
+ if (*buf_size < result_len + 5) {
+ char *tmp = NULL;
+ *buf_size = *buf_size + 1000;
+ if (NULL == (tmp = realloc(buf_copy, *buf_size))) {
+ free(buf_copy);
+ return -1;
+ }
+ else
+ buf_copy = tmp;
+ }
+
if ('\r' == *s)
len--;
else if ('\n' == *s)
@@ -195,19 +250,15 @@ static inline int __ctsvc_vcard_add_folding(char *src)
s++;
len++;
result_len++;
- RETVM_IF(sizeof(result) - 5 < result_len, CONTACTS_ERROR_INVALID_PARAMETER,
- "src is too long\n(%s)", src);
}
*r = '\0';
-
- memcpy(src, result, result_len+1);
- return CONTACTS_ERROR_NONE;
+ free(*buf);
+ *buf = buf_copy;
+ return result_len;
}
-static inline int __ctsvc_vcard_append_name(ctsvc_list_s *names,
- char *dest, int dest_size)
+static inline int __ctsvc_vcard_append_name(ctsvc_list_s *names, char **buf, int *buf_size, int len)
{
- int ret_len;
char display[1024] = {0};
GList *cursor = names->records;
ctsvc_name_s *name;
@@ -216,28 +267,18 @@ static inline int __ctsvc_vcard_append_name(ctsvc_list_s *names,
name = (ctsvc_name_s *)cursor->data;
- ret_len = snprintf(dest, dest_size, "%s", content_name[CTSVC_VCARD_VALUE_N]);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
-
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ":%s",
- SAFE_STR(name->last));
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
-
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";%s",
- SAFE_STR(name->first));
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
-
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";%s",
- SAFE_STR(name->addition));
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
-
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";%s",
- SAFE_STR(name->prefix));
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
-
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";%s%s",
- SAFE_STR(name->suffix), CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_N]);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ":");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, name->last);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, name->first);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, name->addition);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, name->prefix);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, name->suffix);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, CTSVC_CRLF);
if (name->first && name->last) {
contacts_name_display_order_e order;
@@ -263,30 +304,26 @@ static inline int __ctsvc_vcard_append_name(ctsvc_list_s *names,
else
snprintf(display, sizeof(display), "%s%s", SAFE_STR(name->first), SAFE_STR(name->last));
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_FN],
- display, CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_FN]);
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, display);
if (name->phonetic_first) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_PHONETIC_FIRST_NAME], name->phonetic_first, CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_PHONETIC_FIRST_NAME]);
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, name->phonetic_first);
}
if (name->phonetic_middle) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_PHONETIC_MIDDLE_NAME], name->phonetic_middle, CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_PHONETIC_MIDDLE_NAME]);
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, name->phonetic_middle);
}
+
if (name->phonetic_last) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_PHONETIC_LAST_NAME], name->phonetic_last, CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_PHONETIC_LAST_NAME]);
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, name->phonetic_last);
}
- return ret_len;
+ return len;
}
static inline const char* __ctsvc_get_img_suffix(int type)
@@ -350,12 +387,12 @@ static inline const char* __ctsvc_get_image_type_str(int type)
}
}
-static inline int __ctsvc_vcard_put_company_logo(const char *path, char *dest, int dest_size)
+static inline int __ctsvc_vcard_put_company_logo(const char *path, char **buf, int *buf_size, int len)
{
int ret, fd, type;
gsize read_len;
char *suffix;
- gchar *buf;
+ gchar *buf_image;
guchar image[CTSVC_VCARD_PHOTO_MAX_SIZE] = {0};
suffix = strrchr(path, '.');
@@ -380,126 +417,106 @@ static inline int __ctsvc_vcard_put_company_logo(const char *path, char *dest, i
close(fd);
RETVM_IF(ret < 0, CONTACTS_ERROR_SYSTEM, "System : read() Failed(%d)", errno);
- ret = 0;
- buf = g_base64_encode(image, read_len);
- if (buf) {
- ret = snprintf(dest, dest_size, "%s;ENCODING=BASE64;TYPE=%s:%s%s%s",
- content_name[CTSVC_VCARD_VALUE_LOGO],
- __ctsvc_get_image_type_str(type), buf, CTSVC_CRLF, CTSVC_CRLF);
- g_free(buf);
+ buf_image = g_base64_encode(image, read_len);
+ if (buf_image) {
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_LOGO]);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";ENCODING=BASE64;TYPE=");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, __ctsvc_get_image_type_str(type));
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, buf_image);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, CTSVC_CRLF);
+ g_free(buf_image);
}
-
- return ret;
+ return len;
}
-static inline int __ctsvc_vcard_put_company_type(int type, char *label, char *dest, int dest_size)
+static inline int __ctsvc_vcard_put_company_type(int type, char *label, char **buf, int* buf_size, int len)
{
- int ret_len = 0;
- if (type == CONTACTS_COMPANY_TYPE_WORK)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "WORK");
- else if (type == CONTACTS_COMPANY_TYPE_CUSTOM)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=X-%s", label);
- return ret_len;
+ if (type == CONTACTS_COMPANY_TYPE_WORK) {
+ CTSVC_VCARD_APPEND_STR(buf,buf_size,len,";TYPE=WORK");
+ }
+
+ else if (type == CONTACTS_COMPANY_TYPE_CUSTOM) {
+ CTSVC_VCARD_APPEND_STR(buf,buf_size,len,"TYPE=X-");
+ CTSVC_VCARD_APPEND_STR(buf,buf_size,len, label);
+ }
+ return len;
}
-static inline int __ctsvc_vcard_append_company(ctsvc_list_s *company_list,
- char *dest, int dest_size)
+static inline int __ctsvc_vcard_append_company(ctsvc_list_s *company_list, char **buf, int *buf_size, int len)
{
- int ret_len = 0;
GList *cursor;
ctsvc_company_s *company;
for (cursor=company_list->records;cursor;cursor=cursor->next) {
company = (ctsvc_company_s *)cursor->data;
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s",
- content_name[CTSVC_VCARD_VALUE_ORG]);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_ORG]);
- ret_len += __ctsvc_vcard_put_company_type(company->type, SAFE_STR(company->label), dest+ret_len, dest_size-ret_len);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ len = __ctsvc_vcard_put_company_type(company->type, SAFE_STR(company->label), buf, buf_size, len);
+ RETV_IF(len < 0, CONTACTS_ERROR_INTERNAL);
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ":%s", SAFE_STR(company->name));
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf,buf_size,len,":");
+ CTSVC_VCARD_APPEND_STR(buf,buf_size,len,company->name);
if (company->department) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";%s",
- company->department);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf,buf_size,len,";");
+ CTSVC_VCARD_APPEND_STR(buf,buf_size,len,company->department);
}
-
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s", CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf,buf_size,len,CTSVC_CRLF);
if (company->job_title) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_TITLE],
- company->job_title, CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf,buf_size,len,content_name[CTSVC_VCARD_VALUE_TITLE]);
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, company->job_title);
}
if (company->role) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_ROLE],
- company->role, CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf,buf_size,len,content_name[CTSVC_VCARD_VALUE_ROLE]);
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, company->role);
}
if (company->location) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_X_TIZEN_COMPANY_LOCATION],
- company->location, CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf,buf_size,len,content_name[CTSVC_VCARD_VALUE_X_TIZEN_COMPANY_LOCATION]);
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, company->location);
}
if (company->description) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_X_TIZEN_COMPANY_DESCRIPTION],
- company->description, CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf,buf_size,len,content_name[CTSVC_VCARD_VALUE_X_TIZEN_COMPANY_DESCRIPTION]);
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, company->description);
}
if (company->phonetic_name) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_X_TIZEN_COMPANY_PHONETIC_NAME],
- company->phonetic_name, CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf,buf_size,len,content_name[CTSVC_VCARD_VALUE_X_TIZEN_COMPANY_PHONETIC_NAME]);
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, company->phonetic_name);
}
if (company->assistant_name) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_X_TIZEN_COMPANY_ASSISTANT_NAME],
- company->assistant_name, CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf,buf_size,len,content_name[CTSVC_VCARD_VALUE_X_TIZEN_COMPANY_ASSISTANT_NAME]);
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, company->assistant_name);
}
if (company->logo) {
- ret_len += __ctsvc_vcard_put_company_logo(company->logo, dest+ret_len, dest_size-ret_len);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ len = __ctsvc_vcard_put_company_logo(company->logo, buf, buf_size, len);
+ RETV_IF(len < 0, CONTACTS_ERROR_INTERNAL);
}
}
- return ret_len;
+ return len;
}
-static inline int __ctsvc_vcard_append_note(ctsvc_list_s *note_list,
- char *dest, int dest_size)
+static inline int __ctsvc_vcard_append_note(ctsvc_list_s *note_list, char **buf, int *buf_size, int len)
{
- int ret_len = 0;
GList *cursor;
ctsvc_note_s *note;
for (cursor=note_list->records;cursor;cursor=cursor->next) {
note = (ctsvc_note_s *)cursor->data;
if (note->note) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_NOTE],
- SAFE_STR(note->note), CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_NOTE]);
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, note->note);
}
}
- return ret_len;
+ return len;
}
static inline int __ctsvc_vcard_2_put_postal_type(int type, char *dest, int dest_size)
@@ -522,82 +539,75 @@ static inline int __ctsvc_vcard_2_put_postal_type(int type, char *dest, int dest
return ret_len;
}
-static inline int __ctsvc_vcard_put_postal_type(int type, char *label, char *dest, int dest_size)
+static inline int __ctsvc_vcard_put_postal_type(int type, char *label, char **buf, int *buf_size, int len)
{
- int ret_len = 0;
-
+ char *type_str = NULL;
if (type == CONTACTS_ADDRESS_TYPE_DOM)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "DOM");
- if (type == CONTACTS_ADDRESS_TYPE_INTL)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "INTL");
- if (type == CONTACTS_ADDRESS_TYPE_HOME)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "HOME");
- if (type == CONTACTS_ADDRESS_TYPE_WORK)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "WORK");
- if (type == CONTACTS_ADDRESS_TYPE_POSTAL)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "POSTAL");
- if (type == CONTACTS_ADDRESS_TYPE_PARCEL)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "PARCEL");
- if (type == CONTACTS_ADDRESS_TYPE_CUSTOM)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=X-%s", label);
+ type_str = "DOM";
+ else if (type == CONTACTS_ADDRESS_TYPE_INTL)
+ type_str = "INTL";
+ else if (type == CONTACTS_ADDRESS_TYPE_HOME)
+ type_str = "HOME";
+ else if (type == CONTACTS_ADDRESS_TYPE_WORK)
+ type_str = "WORK";
+ else if (type == CONTACTS_ADDRESS_TYPE_POSTAL)
+ type_str = "POSTAL";
+ else if (type == CONTACTS_ADDRESS_TYPE_PARCEL)
+ type_str = "PARCEL";
- return ret_len;
+ if (type == CONTACTS_ADDRESS_TYPE_CUSTOM) {
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=X-");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, "label");
+ return len;
+ }
+
+ if (type_str) {
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, type_str);
+ }
+ return len;
}
-static inline int __ctsvc_vcard_append_postals(ctsvc_list_s *address_list,
- char *dest, int dest_size)
+static inline int __ctsvc_vcard_append_postals(ctsvc_list_s *address_list, char **buf, int* buf_size, int len)
{
- int ret_len = 0;
GList *cursor;
ctsvc_address_s *address;
for (cursor = address_list->records;cursor;cursor=cursor->next) {
address = cursor->data;
if (address) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s",
- content_name[CTSVC_VCARD_VALUE_ADR]);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_ADR]);
- ret_len += __ctsvc_vcard_put_postal_type(address->type, SAFE_STR(address->label), dest+ret_len,
- dest_size-ret_len);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ len = __ctsvc_vcard_put_postal_type(address->type, SAFE_STR(address->label), buf, buf_size, len);
+ RETV_IF(len < 0, CONTACTS_ERROR_INTERNAL);
if (address->is_default) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";%s", "PREF");
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";PREF");
}
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ":%s",
- SAFE_STR(address->pobox));
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";%s",
- SAFE_STR(address->extended));
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";%s",
- SAFE_STR(address->street));
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";%s",
- SAFE_STR(address->locality));
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";%s",
- SAFE_STR(address->region));
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";%s",
- SAFE_STR(address->postalcode));
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";%s%s",
- SAFE_STR(address->country), CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ":");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, address->pobox);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, address->extended);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, address->street);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, address->locality);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, address->region);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, address->postalcode);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, address->country);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, CTSVC_CRLF);
}
}
- return ret_len;
+ return len;
}
-static inline int __ctsvc_vcard_append_nicknames(ctsvc_list_s *nickname_list,
- char *dest, int dest_size)
+static inline int __ctsvc_vcard_append_nicknames(ctsvc_list_s *nickname_list, char **buf, int* buf_size, int len)
{
bool first;
- int ret_len = 0;
GList *cursor;
ctsvc_nickname_s *nickname;
@@ -606,24 +616,21 @@ static inline int __ctsvc_vcard_append_nicknames(ctsvc_list_s *nickname_list,
nickname = cursor->data;
if (nickname->nickname && *nickname->nickname) {
if (first) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:",
- content_name[CTSVC_VCARD_VALUE_NICKNAME]);
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s", nickname->nickname);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_NICKNAME]);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ":");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, nickname->nickname);
first = false;
}
else {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ",%s", nickname->nickname);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ",");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, nickname->nickname);
}
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
}
}
+ if (!first)
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, CTSVC_CRLF);
- if (ret_len > 0) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s", CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
- }
-
- return ret_len;
+ return len;
}
static inline int __ctsvc_vcard_2_put_number_type(int type, char *dest, int dest_size)
@@ -661,69 +668,66 @@ static inline int __ctsvc_vcard_2_put_number_type(int type, char *dest, int dest
return ret_len;
}
-static inline int __ctsvc_vcard_put_number_type(int type, char *label, char *dest, int dest_size)
+static inline int __ctsvc_vcard_put_number_type(int type, char *label, char **buf, int *buf_size, int len)
{
- int ret_len = 0;
if (type & CONTACTS_NUMBER_TYPE_HOME)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "HOME");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=HOME");
if (type & CONTACTS_NUMBER_TYPE_MSG)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "MSG");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=MSG");
if (type & CONTACTS_NUMBER_TYPE_WORK)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "WORK");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=WORK");
if (type & CONTACTS_NUMBER_TYPE_VOICE)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "VOICE");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=VOICE");
if (type & CONTACTS_NUMBER_TYPE_FAX)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "FAX");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=FAX");
if (type & CONTACTS_NUMBER_TYPE_CELL)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "CELL");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=CELL");
if (type & CONTACTS_NUMBER_TYPE_VIDEO)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "VIDEO");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=VIDEO");
if (type & CONTACTS_NUMBER_TYPE_PAGER)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "PAGER");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=PAGER");
if (type & CONTACTS_NUMBER_TYPE_BBS)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "BBS");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=BBS");
if (type & CONTACTS_NUMBER_TYPE_MODEM)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "MODEM");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=MODEM");
if (type & CONTACTS_NUMBER_TYPE_CAR)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "CAR");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=CAR");
if (type & CONTACTS_NUMBER_TYPE_ISDN)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "ISDN");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=ISDN");
if (type & CONTACTS_NUMBER_TYPE_PCS)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "PCS");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=PCS");
if (type & CONTACTS_NUMBER_TYPE_ASSISTANT)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "X-ASSISTANT");
- if (type == CONTACTS_NUMBER_TYPE_CUSTOM)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=X-%s", label);
- return ret_len;
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=X-ASSISTANT");
+ if (type == CONTACTS_NUMBER_TYPE_CUSTOM) {
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=X-");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, label);
+ return len;
+ }
+ return len;
}
-static inline int __ctsvc_vcard_append_numbers(ctsvc_list_s *number_list,
- char *dest, int dest_size)
+static inline int __ctsvc_vcard_append_numbers(ctsvc_list_s *number_list, char **buf, int* buf_size, int len)
{
- int ret_len = 0;
GList *cursor;
ctsvc_number_s *number;
for (cursor=number_list->records;cursor;cursor=cursor->next) {
number = cursor->data;
if (number->number) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s",
- content_name[CTSVC_VCARD_VALUE_TEL]);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf,buf_size,len,content_name[CTSVC_VCARD_VALUE_TEL]);
+
+ len = __ctsvc_vcard_put_number_type(number->type, SAFE_STR(number->label), buf, buf_size, len);
+ RETV_IF(len < 0, CONTACTS_ERROR_INTERNAL);
- ret_len += __ctsvc_vcard_put_number_type(number->type, SAFE_STR(number->label), dest+ret_len, dest_size-ret_len);
if (number->is_default) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";%s", "PREF");
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf,buf_size,len,";PREF");
}
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ":%s%s",
- number->number, CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, number->number);
}
}
- return ret_len;
+ return len;
}
static inline int __ctsvc_vcard_2_put_email_type(int type, char *dest, int dest_size)
@@ -738,260 +742,269 @@ static inline int __ctsvc_vcard_2_put_email_type(int type, char *dest, int dest_
return ret_len;
}
-static inline int __ctsvc_vcard_put_email_type(int type, char *label, char *dest, int dest_size)
+static inline int __ctsvc_vcard_put_email_type(int type, char *label, char **buf, int *buf_size, int len)
{
- int ret_len = 0;
-
+ char *type_str = NULL;
if (CONTACTS_EMAIL_TYPE_HOME == type)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "HOME");
+ type_str = "HOME";
else if (CONTACTS_EMAIL_TYPE_WORK == type)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "WORK");
+ type_str = "WORK";
else if (CONTACTS_EMAIL_TYPE_MOBILE == type)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "CELL");
- else if (CONTACTS_EMAIL_TYPE_CUSTOM == type)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=X-%s", label);
+ type_str = "CELL";
+ else if (CONTACTS_EMAIL_TYPE_CUSTOM == type) {
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=X-");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, label);
+ return len;
+ }
- return ret_len;
+ if (type_str) {
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, type_str);
+ }
+ return len;
}
-static inline int __ctsvc_vcard_append_emails(ctsvc_list_s *email_list,
- char *dest, int dest_size)
+static inline int __ctsvc_vcard_append_emails(ctsvc_list_s *email_list, char **buf, int *buf_size, int len)
{
- int ret_len = 0;
GList *cursor;
ctsvc_email_s *email;
for (cursor=email_list->records;cursor;cursor=cursor->next) {
email = cursor->data;
if (email->email_addr) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s",
- content_name[CTSVC_VCARD_VALUE_EMAIL]);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_EMAIL]);
- ret_len += __ctsvc_vcard_put_email_type(email->type, SAFE_STR(email->label), dest+ret_len, dest_size-ret_len);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ len = __ctsvc_vcard_put_email_type(email->type, SAFE_STR(email->label), buf, buf_size, len);
+ RETV_IF(len < 0, CONTACTS_ERROR_INTERNAL);
if (email->is_default) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";%s", "PREF");
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";PREF");
}
-
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ":%s%s",
- email->email_addr, CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, email->email_addr);
}
}
-
- return ret_len;
+ return len;
}
-static inline int __ctsvc_vcard_put_url_type(int type, char *label, char *dest, int dest_size)
+static inline int __ctsvc_vcard_put_url_type(int type, char *label, char **buf, int *buf_size, int len)
{
- int ret_len = 0;
+ char *type_str = NULL;
if (CONTACTS_URL_TYPE_HOME == type)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "HOME");
+ type_str = "HOME";
else if (CONTACTS_URL_TYPE_WORK == type)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "WORK");
- else if (CONTACTS_URL_TYPE_CUSTOM == type)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=X-%s", label);
-
- return ret_len;
+ type_str = "WORK";
+ else if (CONTACTS_URL_TYPE_CUSTOM == type) {
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=X-");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, label);
+ return len;
+ }
+ if (type_str) {
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, type_str);
+ }
+ return len;
}
-static inline int __ctsvc_vcard_append_webs(ctsvc_list_s *url_list,
- char *dest, int dest_size)
+static inline int __ctsvc_vcard_append_webs(ctsvc_list_s *url_list, char **buf, int *buf_size, int len)
{
- int ret_len = 0;
GList *cursor;
ctsvc_url_s *url;
for (cursor=url_list->records;cursor;cursor=cursor->next) {
url = cursor->data;
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s",
- content_name[CTSVC_VCARD_VALUE_URL]);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_URL]);
- ret_len += __ctsvc_vcard_put_url_type(url->type, SAFE_STR(url->label), dest+ret_len, dest_size-ret_len);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ len = __ctsvc_vcard_put_url_type(url->type, SAFE_STR(url->label), buf, buf_size, len);
+ RETV_IF(len < 0, CONTACTS_ERROR_INTERNAL);
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ":%s%s",
- url->url, CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, url->url);
}
- return ret_len;
+ return len;
}
-static inline int __ctsvc_vcard_append_events(ctsvc_list_s *event_list,
- char *dest, int dest_size)
+#define VCARD_INIT_LENGTH 1024
+#define VCARD_ITEM_LENGTH 1024
+
+static inline int __ctsvc_vcard_append_events(ctsvc_list_s *event_list, char **buf, int *buf_size, int len)
{
- int ret_len = 0;
GList *cursor;
ctsvc_event_s *data;
+ char event[VCARD_ITEM_LENGTH] = {0};
for (cursor=event_list->records;cursor;cursor=cursor->next) {
data = cursor->data;
if (!data->date) continue;
+ event[0] = '\0';
if (CONTACTS_EVENT_TYPE_BIRTH == data->type) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%d-%02d-%02d%s",
+ snprintf(event, sizeof(event), "%s:%d-%02d-%02d%s",
content_name[CTSVC_VCARD_VALUE_BDAY],
data->date/10000, (data->date%10000)/100, data->date%100,
CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
}
else if (CONTACTS_EVENT_TYPE_ANNIVERSARY == data->type) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s;TYPE=ANNIVERSARY:%d-%02d-%02d%s",
+ snprintf(event, sizeof(event), "%s;TYPE=ANNIVERSARY:%d-%02d-%02d%s",
content_name[CTSVC_VCARD_VALUE_X_TIZEN_EVENT],
data->date/10000, (data->date%10000)/100, data->date%100,
CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
}
else if (CONTACTS_EVENT_TYPE_CUSTOM == data->type) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s;X-%s:%d-%02d-%02d%s",
+ snprintf(event, sizeof(event), "%s;X-%s:%d-%02d-%02d%s",
content_name[CTSVC_VCARD_VALUE_X_TIZEN_EVENT],
SAFE_STR(data->label),
data->date/10000, (data->date%10000)/100, data->date%100,
CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
}
else {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%d-%02d-%02d%s",
+ snprintf(event, sizeof(event), "%s:%d-%02d-%02d%s",
content_name[CTSVC_VCARD_VALUE_X_TIZEN_EVENT],
data->date/10000, (data->date%10000)/100, data->date%100,
CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
}
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, event);
}
- return ret_len;
+ return len;
}
-static inline int __ctsvc_vcard_append_messengers(ctsvc_list_s *messenger_list, char *dest, int dest_size)
+static inline int __ctsvc_vcard_append_messengers(ctsvc_list_s *messenger_list, char **buf, int *buf_size, int len)
{
- int ret_len = 0;
GList *cursor;
ctsvc_messenger_s *messenger;
+ const char *content_name_messenger = NULL;
+ const char *content_name_x_type = NULL;
for (cursor=messenger_list->records;cursor;cursor=cursor->next) {
messenger = cursor->data;
+
+ content_name_messenger = NULL;
+ content_name_x_type = NULL;
+
if (messenger->im_id && *messenger->im_id) {
switch (messenger->type) {
case CONTACTS_MESSENGER_TYPE_WLM:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_X_MSN], messenger->im_id, CTSVC_CRLF);
+ content_name_messenger = content_name[CTSVC_VCARD_VALUE_X_MSN];
break;
case CONTACTS_MESSENGER_TYPE_YAHOO:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_X_YAHOO], messenger->im_id, CTSVC_CRLF);
+ content_name_messenger = content_name[CTSVC_VCARD_VALUE_X_YAHOO];
break;
case CONTACTS_MESSENGER_TYPE_ICQ:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_X_ICQ], messenger->im_id, CTSVC_CRLF);
+ content_name_messenger = content_name[CTSVC_VCARD_VALUE_X_ICQ];
break;
case CONTACTS_MESSENGER_TYPE_AIM:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_X_AIM], messenger->im_id, CTSVC_CRLF);
+ content_name_messenger = content_name[CTSVC_VCARD_VALUE_X_AIM];
break;
case CONTACTS_MESSENGER_TYPE_JABBER:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_X_JABBER], messenger->im_id, CTSVC_CRLF);
+ content_name_messenger = content_name[CTSVC_VCARD_VALUE_X_JABBER];
break;
case CONTACTS_MESSENGER_TYPE_SKYPE:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_X_SKYPE_USERNAME], messenger->im_id, CTSVC_CRLF);
+ content_name_messenger = content_name[CTSVC_VCARD_VALUE_X_SKYPE_USERNAME];
break;
case CONTACTS_MESSENGER_TYPE_QQ:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_X_QQ], messenger->im_id, CTSVC_CRLF);
+ content_name_messenger = content_name[CTSVC_VCARD_VALUE_X_QQ];
break;
case CONTACTS_MESSENGER_TYPE_GOOGLE:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_X_GOOGLE_TALK], messenger->im_id, CTSVC_CRLF);
+ content_name_messenger = content_name[CTSVC_VCARD_VALUE_X_GOOGLE_TALK];
break;
case CONTACTS_MESSENGER_TYPE_FACEBOOK:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s;TYPE=FACEBOOK:%s%s",
- content_name[CTSVC_VCARD_VALUE_X_TIZEN_MESSENGER], messenger->im_id, CTSVC_CRLF);
+ content_name_x_type = "FACEBOOK";
break;
case CONTACTS_MESSENGER_TYPE_IRC:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s;TYPE=IRC:%s%s",
- content_name[CTSVC_VCARD_VALUE_X_TIZEN_MESSENGER], messenger->im_id, CTSVC_CRLF);
+ content_name_x_type = "IRC";
break;
case CONTACTS_MESSENGER_TYPE_CUSTOM:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s;TYPE=X-%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_X_TIZEN_MESSENGER], SAFE_STR(messenger->label), messenger->im_id, CTSVC_CRLF);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_X_TIZEN_MESSENGER]);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=X-");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, messenger->label);
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, messenger->im_id);
break;
default:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_X_TIZEN_MESSENGER], messenger->im_id, CTSVC_CRLF);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_X_TIZEN_MESSENGER]);
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, messenger->im_id);
break;
}
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+
+ if (content_name_messenger) {
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name_messenger);
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, messenger->im_id);
+ }
+ else if(content_name_x_type) {
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_X_TIZEN_MESSENGER]);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name_x_type);
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, messenger->im_id);
+ }
}
}
- return ret_len;
+ return len;
}
-static inline int __ctsvc_vcard_put_relationship_type(int type, char *label, char *dest, int dest_size)
+static inline int __ctsvc_vcard_put_relationship_type(int type, char *label, char **buf, int* buf_size, int len)
{
- int ret_len = 0;
+ const char *type_str = NULL;
+
switch (type) {
case CONTACTS_RELATIONSHIP_TYPE_ASSISTANT:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "ASSISTANT");
+ type_str = "ASSISTANT";
break;
case CONTACTS_RELATIONSHIP_TYPE_BROTHER:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "BROTHER");
+ type_str = "BROTHER";
break;
case CONTACTS_RELATIONSHIP_TYPE_CHILD:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "CHILD");
+ type_str = "CHILD";
break;
case CONTACTS_RELATIONSHIP_TYPE_DOMESTIC_PARTNER:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "DOMESTIC_PARTNER");
+ type_str = "DOMESTIC_PARTNER";
break;
case CONTACTS_RELATIONSHIP_TYPE_FATHER:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "FATHER");
+ type_str = "FATHER";
break;
case CONTACTS_RELATIONSHIP_TYPE_FRIEND:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "FRIEND");
+ type_str = "FRIEND";
break;
case CONTACTS_RELATIONSHIP_TYPE_MANAGER:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "MANAGER");
+ type_str = "MANAGER";
break;
case CONTACTS_RELATIONSHIP_TYPE_MOTHER:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "MOTHER");
+ type_str = "MOTHER";
break;
case CONTACTS_RELATIONSHIP_TYPE_PARENT:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "PARENT");
+ type_str = "PARENT";
break;
case CONTACTS_RELATIONSHIP_TYPE_PARTNER:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "PARTNER");
+ type_str = "PARTNER";
break;
case CONTACTS_RELATIONSHIP_TYPE_REFERRED_BY:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "REFERRED_BY");
+ type_str = "REFERRED_BY";
break;
case CONTACTS_RELATIONSHIP_TYPE_RELATIVE:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "RELATIVE");
+ type_str = "RELATIVE";
break;
case CONTACTS_RELATIONSHIP_TYPE_SISTER:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "SISTER");
+ type_str = "SISTER";
break;
case CONTACTS_RELATIONSHIP_TYPE_SPOUSE:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=%s", "SPOUSE");
+ type_str = "SPOUSE";
break;
case CONTACTS_RELATIONSHIP_TYPE_CUSTOM:
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ";TYPE=X-%s", label);
- break;
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=X-");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, label);
+ return len;
}
- return ret_len;
-}
+ if (type_str) {
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, type_str);
+ }
+ return len;
+}
-static inline int __ctsvc_vcard_append_relationships(ctsvc_list_s *relationship_list, char *dest, int dest_size)
+static inline int __ctsvc_vcard_append_relationships(ctsvc_list_s *relationship_list, char **buf, int *buf_size, int len)
{
- int ret_len = 0;
GList *cursor;
ctsvc_relationship_s *relationship;
@@ -999,26 +1012,23 @@ static inline int __ctsvc_vcard_append_relationships(ctsvc_list_s *relationship_
relationship = cursor->data;
if (relationship->name) {
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "X-TIZEN-RELATIONSHIP");
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
-
- ret_len += __ctsvc_vcard_put_relationship_type(relationship->type, SAFE_STR(relationship->label), dest+ret_len, dest_size-ret_len);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, "X-TIZEN-RELATIONSHIP");
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, ":%s%s", relationship->name, CTSVC_CRLF);
- RETV_IF(dest_size <= ret_len, CONTACTS_ERROR_INTERNAL);
+ len = __ctsvc_vcard_put_relationship_type(relationship->type, SAFE_STR(relationship->label), buf, buf_size, len);
+ RETV_IF(len < 0, CONTACTS_ERROR_INTERNAL);
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, relationship->name);
}
}
- return ret_len;
+ return len;
}
-static inline int __ctsvc_vcard_put_photo(ctsvc_list_s *image_list, char *dest, int dest_size)
+static inline int __ctsvc_vcard_put_photo(ctsvc_list_s *image_list, char **buf, int *buf_size, int len)
{
int ret = 0, fd, type;
gsize read_len;
char *suffix;
- gchar *buf;
+ gchar *buf_image;
guchar image[CTSVC_VCARD_PHOTO_MAX_SIZE] = {0};
GList *cursor;
@@ -1051,267 +1061,236 @@ static inline int __ctsvc_vcard_put_photo(ctsvc_list_s *image_list, char *dest,
close(fd);
RETVM_IF(ret < 0, CONTACTS_ERROR_SYSTEM, "System : read() Failed(%d)", errno);
- ret = 0;
- buf = g_base64_encode(image, read_len);
+ buf_image = g_base64_encode(image, read_len);
- if (buf) {
- ret = snprintf(dest, dest_size, "%s;ENCODING=BASE64;TYPE=%s:%s%s%s",
- content_name[CTSVC_VCARD_VALUE_PHOTO],
- __ctsvc_get_image_type_str(type), buf, CTSVC_CRLF, CTSVC_CRLF);
- g_free(buf);
- RETV_IF(dest_size <= ret, CONTACTS_ERROR_INTERNAL);
+ if (buf_image) {
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_PHOTO]);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";ENCODING=BASE64;TYPE=");
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, __ctsvc_get_image_type_str(type));
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, buf_image);
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, CTSVC_CRLF);
+ g_free(buf_image);
}
}
- return ret;
+ return len;
}
-static inline int __ctsvc_vcard_append_contact(ctsvc_contact_s *contact,
- char *dest, int dest_size)
+static inline int __ctsvc_vcard_append_contact(ctsvc_contact_s *contact, char **buf, int *buf_size, int len)
{
- int ret_len = 0;
- int ret;
-
if (contact->name) {
- ret = __ctsvc_vcard_append_name(contact->name,
- dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
+ len = __ctsvc_vcard_append_name(contact->name, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
if (contact->company) {
- ret = __ctsvc_vcard_append_company(contact->company,
- dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
+ len = __ctsvc_vcard_append_company(contact->company, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
if (contact->note) {
- ret = __ctsvc_vcard_append_note(contact->note,
- dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
+ len = __ctsvc_vcard_append_note(contact->note, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
if (contact->postal_addrs) {
- ret = __ctsvc_vcard_append_postals(contact->postal_addrs,
- dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
+ len = __ctsvc_vcard_append_postals(contact->postal_addrs, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
if (contact->numbers) {
- ret = __ctsvc_vcard_append_numbers(contact->numbers,
- dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
+ len = __ctsvc_vcard_append_numbers(contact->numbers, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
if (contact->emails) {
- ret = __ctsvc_vcard_append_emails(contact->emails,
- dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
+ len = __ctsvc_vcard_append_emails(contact->emails, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
if (contact->nicknames) {
- ret = __ctsvc_vcard_append_nicknames(contact->nicknames,
- dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
+ len = __ctsvc_vcard_append_nicknames(contact->nicknames, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
if (contact->urls) {
- ret = __ctsvc_vcard_append_webs(contact->urls,
- dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
+ len = __ctsvc_vcard_append_webs(contact->urls, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
if (contact->events) {
- ret = __ctsvc_vcard_append_events(contact->events,
- dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
+ len = __ctsvc_vcard_append_events(contact->events, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
if (contact->images) {
- ret = __ctsvc_vcard_put_photo(contact->images,
- dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
+ len = __ctsvc_vcard_put_photo(contact->images, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
if (contact->messengers) {
- ret = __ctsvc_vcard_append_messengers(contact->messengers, dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
+ len = __ctsvc_vcard_append_messengers(contact->messengers, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
if (contact->relationships) {
- ret = __ctsvc_vcard_append_relationships(contact->relationships, dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
- }
- if (contact->uid)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_UID],
- contact->uid, CTSVC_CRLF);
+ len = __ctsvc_vcard_append_relationships(contact->relationships, buf, buf_size, len);
+ RETV_IF(len < 0, len);
+ }
+
+ if (contact->uid) {
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_UID]);
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, contact->uid);
+ }
+
if (contact->changed_time) {
struct tm ts;
gmtime_r((time_t *)&contact->changed_time, &ts);
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%04d-%02d-%02dT%02d:%02d:%02dZ%s",
+ char temp[VCARD_ITEM_LENGTH] = {0};
+ snprintf(temp, sizeof(temp), "%s:%04d-%02d-%02dT%02d:%02d:%02dZ%s",
content_name[CTSVC_VCARD_VALUE_REV],
1900+ts.tm_year, 1+ts.tm_mon, ts.tm_mday,
ts.tm_hour, ts.tm_min, ts.tm_sec,
CTSVC_CRLF);
+
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, temp);
}
#if 0
ctsvc_list_s* profile;
#endif
- return ret_len;
+ return len;
}
-static inline int __ctsvc_vcard_append_my_profile(ctsvc_my_profile_s *my_profile, char *dest, int dest_size)
+static inline int __ctsvc_vcard_append_my_profile(ctsvc_my_profile_s *my_profile, char **buf, int *buf_size, int len)
{
- int ret_len = 0;
- int ret;
-
if (my_profile->name) {
- ret = __ctsvc_vcard_append_name(my_profile->name,
- dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
+ len = __ctsvc_vcard_append_name(my_profile->name, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
if (my_profile->company) {
- ret = __ctsvc_vcard_append_company(my_profile->company,
- dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
+ len = __ctsvc_vcard_append_company(my_profile->company, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
if (my_profile->note) {
- ret = __ctsvc_vcard_append_note(my_profile->note,
- dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
+ len = __ctsvc_vcard_append_note(my_profile->note, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
if (my_profile->postal_addrs) {
- ret = __ctsvc_vcard_append_postals(my_profile->postal_addrs,
- dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
+ len = __ctsvc_vcard_append_postals(my_profile->postal_addrs, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
if (my_profile->numbers) {
- ret = __ctsvc_vcard_append_numbers(my_profile->numbers,
- dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
+ len = __ctsvc_vcard_append_numbers(my_profile->numbers, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
if (my_profile->emails) {
- ret = __ctsvc_vcard_append_emails(my_profile->emails,
- dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
+ len = __ctsvc_vcard_append_emails(my_profile->emails, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
if (my_profile->nicknames) {
- ret = __ctsvc_vcard_append_nicknames(my_profile->nicknames,
- dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
+ len = __ctsvc_vcard_append_nicknames(my_profile->nicknames, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
if (my_profile->urls) {
- ret = __ctsvc_vcard_append_webs(my_profile->urls,
- dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
+ len = __ctsvc_vcard_append_webs(my_profile->urls, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
if (my_profile->events) {
- ret = __ctsvc_vcard_append_events(my_profile->events,
- dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
+ len = __ctsvc_vcard_append_events(my_profile->events, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
if (my_profile->images) {
- ret = __ctsvc_vcard_put_photo(my_profile->images,
- dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
+ len = __ctsvc_vcard_put_photo(my_profile->images, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
if (my_profile->messengers) {
- ret = __ctsvc_vcard_append_messengers(my_profile->messengers, dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
+ len = __ctsvc_vcard_append_messengers(my_profile->messengers, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
if (my_profile->relationships) {
- ret = __ctsvc_vcard_append_relationships(my_profile->relationships, dest+ret_len, dest_size-ret_len);
- RETV_IF(ret < 0, ret);
- ret_len += ret;
- }
- if (my_profile->uid)
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%s%s",
- content_name[CTSVC_VCARD_VALUE_UID],
- my_profile->uid, CTSVC_CRLF);
+ len = __ctsvc_vcard_append_relationships(my_profile->relationships, buf, buf_size, len);
+ RETV_IF(len < 0, len);
+ }
+
+ if (my_profile->uid) {
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_UID]);
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, my_profile->uid);
+ }
+
if (my_profile->changed_time) {
struct tm ts;
gmtime_r((time_t *)&my_profile->changed_time, &ts);
- ret_len += snprintf(dest+ret_len, dest_size-ret_len, "%s:%04d-%02d-%02dT%02d:%02d:%02dZ%s",
+ char temp[VCARD_ITEM_LENGTH] = {0};
+ snprintf(temp, sizeof(temp), "%s:%04d-%02d-%02dT%02d:%02d:%02dZ%s",
content_name[CTSVC_VCARD_VALUE_REV],
1900+ts.tm_year, 1+ts.tm_mon, ts.tm_mday,
ts.tm_hour, ts.tm_min, ts.tm_sec,
CTSVC_CRLF);
+
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, temp);
}
+
#if 0
ctsvc_list_s* profile;
#endif
- return ret_len;
-
+ return len;
}
static int __ctsvc_vcard_make(ctsvc_contact_s *contact, char **vcard_stream)
{
- int ret_len, ret;
- char result[CTSVC_VCARD_FILE_MAX_SIZE] = {0};
+ char *buf = NULL;
+ int buf_size = VCARD_INIT_LENGTH;
+ int len = 0;
__ctsvc_vcard_initial();
- ret_len = snprintf(result, sizeof(result), "%s%s", "BEGIN:VCARD", CTSVC_CRLF);
- ret_len += snprintf(result+ret_len, sizeof(result)-ret_len,
- "%s%s%s", "VERSION:", "3.0", CTSVC_CRLF);
+ buf = calloc(1, buf_size);
+ CTSVC_VCARD_APPEND_STR(&buf, &buf_size, len, "BEGIN:VCARD");
+ CTSVC_VCARD_APPEND_STR(&buf, &buf_size, len, CTSVC_CRLF);
- ret = __ctsvc_vcard_append_contact(contact,
- result+ret_len, sizeof(result)-ret_len);
- RETVM_IF(ret < 0, CONTACTS_ERROR_INTERNAL,
- "This contact has too many information");
- ret_len += ret;
- RETVM_IF(sizeof(result)-ret_len <= 0, CONTACTS_ERROR_INTERNAL,
- "This contact has too many information");
+ CTSVC_VCARD_APPEND_STR(&buf, &buf_size, len, "VERSION:3.0");
+ CTSVC_VCARD_APPEND_STR(&buf, &buf_size, len, CTSVC_CRLF);
+
+ len = __ctsvc_vcard_append_contact(contact, &buf, &buf_size, len);
+ if (len < 0) {
+ free(buf);
+ return CONTACTS_ERROR_INTERNAL;
+ }
- ret_len += snprintf(result+ret_len, sizeof(result)-ret_len,
- "%s%s", "END:VCARD", CTSVC_CRLF);
- ret = __ctsvc_vcard_add_folding(result);
- RETV_IF (CONTACTS_ERROR_NONE != ret, ret);
+ CTSVC_VCARD_APPEND_STR(&buf, &buf_size, len, "END:VCARD");
+ CTSVC_VCARD_APPEND_STR(&buf, &buf_size, len, CTSVC_CRLF);
- *vcard_stream = strdup(result);
+ len = __ctsvc_vcard_add_folding(&buf, &buf_size, len);
+ if (len < 0) {
+ free(buf);
+ return CONTACTS_ERROR_INTERNAL;
+ }
+ *vcard_stream = buf;
return CONTACTS_ERROR_NONE;
}
static int __ctsvc_vcard_make_from_my_profile(ctsvc_my_profile_s *my_profile, char **vcard_stream)
{
- int ret_len, ret;
- char result[CTSVC_VCARD_FILE_MAX_SIZE] = {0};
+ char *buf = NULL;
+ int buf_size = VCARD_INIT_LENGTH;
+ int len = 0;
__ctsvc_vcard_initial();
- ret_len = snprintf(result, sizeof(result), "%s%s", "BEGIN:VCARD", CTSVC_CRLF);
- ret_len += snprintf(result+ret_len, sizeof(result)-ret_len,
- "%s%s%s", "VERSION:", "3.0", CTSVC_CRLF);
+ buf = calloc(1, buf_size);
+ CTSVC_VCARD_APPEND_STR(&buf, &buf_size, len, "BEGIN:VCARD");
+ CTSVC_VCARD_APPEND_STR(&buf, &buf_size, len, CTSVC_CRLF);
- ret = __ctsvc_vcard_append_my_profile(my_profile,
- result+ret_len, sizeof(result)-ret_len);
- RETVM_IF(ret < 0, CONTACTS_ERROR_INTERNAL,
- "This contact has too many information");
- ret_len += ret;
- RETVM_IF(sizeof(result)-ret_len <= 0, CONTACTS_ERROR_INTERNAL,
- "This contact has too many information");
+ CTSVC_VCARD_APPEND_STR(&buf, &buf_size, len, "VERSION:3.0");
+ CTSVC_VCARD_APPEND_STR(&buf, &buf_size, len, CTSVC_CRLF);
- ret_len += snprintf(result+ret_len, sizeof(result)-ret_len,
- "%s%s", "END:VCARD", CTSVC_CRLF);
+ len = __ctsvc_vcard_append_my_profile(my_profile, &buf, &buf_size, len);
+ if (len < 0) {
+ free(buf);
+ return CONTACTS_ERROR_INTERNAL;
+ }
- ret = __ctsvc_vcard_add_folding(result);
- RETV_IF (CONTACTS_ERROR_NONE != ret, ret);
+ CTSVC_VCARD_APPEND_STR(&buf, &buf_size, len, "END:VCARD");
+ CTSVC_VCARD_APPEND_STR(&buf, &buf_size, len, CTSVC_CRLF);
- *vcard_stream = strdup(result);
+ len = __ctsvc_vcard_add_folding(&buf, &buf_size, len);
+ if (len < 0) {
+ free(buf);
+ return CONTACTS_ERROR_INTERNAL;
+ }
+
+ *vcard_stream = buf;
return CONTACTS_ERROR_NONE;
}
@@ -1350,11 +1329,9 @@ API int contacts_vcard_make_from_my_profile(contacts_record_h record, char **vca
}
-static int __ctsvc_vcard_append_person(ctsvc_person_s *person, ctsvc_list_s *list_contacts, char *dest, int dest_size)
+static int __ctsvc_vcard_append_person(ctsvc_person_s *person, ctsvc_list_s *list_contacts, char **buf, int *buf_size, int len)
{
int ret;
- int ret_len = 0;
- int total_len = 0;
int changed_time = 0;
ctsvc_contact_s *contact;
ctsvc_simple_contact_s *simple_contact;
@@ -1364,10 +1341,8 @@ static int __ctsvc_vcard_append_person(ctsvc_person_s *person, ctsvc_list_s *lis
simple_contact = (ctsvc_simple_contact_s *)cursor->data;
ret = contacts_db_get_record(_contacts_contact._uri, simple_contact->contact_id, (contacts_record_h *)&contact);
if (CONTACTS_ERROR_NONE == ret && contact && contact->id == person->name_contact_id && contact->name) {
- ret_len = __ctsvc_vcard_append_name(contact->name, dest+total_len, dest_size-total_len);
- RETVM_IF(ret_len < 0, CONTACTS_ERROR_INTERNAL, "This person has too many information");
- total_len += ret_len;
- break;
+ len = __ctsvc_vcard_append_name(contact->name, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
}
@@ -1375,90 +1350,84 @@ static int __ctsvc_vcard_append_person(ctsvc_person_s *person, ctsvc_list_s *lis
simple_contact = (ctsvc_simple_contact_s *)cursor->data;
ret = contacts_db_get_record(_contacts_contact._uri, simple_contact->contact_id, (contacts_record_h *)&contact);
if (CONTACTS_ERROR_NONE == ret && contact && contact->company && contact->company->cursor) {
- ret_len = __ctsvc_vcard_append_company(contact->company, dest+total_len, dest_size-total_len);
- RETVM_IF(ret_len < 0, CONTACTS_ERROR_INTERNAL, "This person has too many information");
- total_len += ret_len;
+ len = __ctsvc_vcard_append_company(contact->company, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
}
+
for(cursor=list_contacts->records;cursor;cursor=cursor->next) {
simple_contact = (ctsvc_simple_contact_s *)cursor->data;
ret = contacts_db_get_record(_contacts_contact._uri, simple_contact->contact_id, (contacts_record_h *)&contact);
if (CONTACTS_ERROR_NONE == ret && contact && contact->note && contact->note->cursor) {
- ret_len = __ctsvc_vcard_append_note(contact->note, dest+total_len, dest_size-total_len);
- RETVM_IF(ret_len < 0, CONTACTS_ERROR_INTERNAL, "This person has too many information");
- total_len += ret_len;
+ len = __ctsvc_vcard_append_note(contact->note, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
}
for(cursor=list_contacts->records;cursor;cursor=cursor->next) {
simple_contact = (ctsvc_simple_contact_s *)cursor->data;
ret = contacts_db_get_record(_contacts_contact._uri, simple_contact->contact_id, (contacts_record_h *)&contact);
if (CONTACTS_ERROR_NONE == ret && contact && contact->postal_addrs && contact->postal_addrs->cursor) {
- ret_len = __ctsvc_vcard_append_postals(contact->postal_addrs, dest+total_len, dest_size-total_len);
- RETVM_IF(ret_len < 0, CONTACTS_ERROR_INTERNAL, "This person has too many information");
- total_len += ret_len;
+ len = __ctsvc_vcard_append_postals(contact->postal_addrs, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
}
for(cursor=list_contacts->records;cursor;cursor=cursor->next) {
simple_contact = (ctsvc_simple_contact_s *)cursor->data;
ret = contacts_db_get_record(_contacts_contact._uri, simple_contact->contact_id, (contacts_record_h *)&contact);
if (CONTACTS_ERROR_NONE == ret && contact && contact->numbers && contact->numbers->cursor) {
- ret_len = __ctsvc_vcard_append_numbers(contact->numbers, dest+total_len, dest_size-total_len);
- RETVM_IF(ret_len < 0, CONTACTS_ERROR_INTERNAL, "This person has too many information");
- total_len += ret_len;
+ len = __ctsvc_vcard_append_numbers(contact->numbers, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
}
+
for(cursor=list_contacts->records;cursor;cursor=cursor->next) {
simple_contact = (ctsvc_simple_contact_s *)cursor->data;
ret = contacts_db_get_record(_contacts_contact._uri, simple_contact->contact_id, (contacts_record_h *)&contact);
if (CONTACTS_ERROR_NONE == ret && contact && contact->emails && contact->emails->cursor) {
- ret_len = __ctsvc_vcard_append_emails(contact->emails, dest+total_len, dest_size-total_len);
- RETVM_IF(ret_len < 0, CONTACTS_ERROR_INTERNAL, "This person has too many information");
- total_len += ret_len;
+ len = __ctsvc_vcard_append_emails(contact->emails, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
}
+
for(cursor=list_contacts->records;cursor;cursor=cursor->next) {
simple_contact = (ctsvc_simple_contact_s *)cursor->data;
ret = contacts_db_get_record(_contacts_contact._uri, simple_contact->contact_id, (contacts_record_h *)&contact);
if (CONTACTS_ERROR_NONE == ret && contact && contact->nicknames && contact->nicknames->cursor) {
- ret_len = __ctsvc_vcard_append_nicknames(contact->nicknames, dest+total_len, dest_size-total_len);
- RETVM_IF(ret_len < 0, CONTACTS_ERROR_INTERNAL, "This person has too many information");
- total_len += ret_len;
+ len = __ctsvc_vcard_append_nicknames(contact->nicknames, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
}
for(cursor=list_contacts->records;cursor;cursor=cursor->next) {
simple_contact = (ctsvc_simple_contact_s *)cursor->data;
ret = contacts_db_get_record(_contacts_contact._uri, simple_contact->contact_id, (contacts_record_h *)&contact);
if (CONTACTS_ERROR_NONE == ret && contact && contact->urls && contact->urls->cursor) {
- ret_len = __ctsvc_vcard_append_webs(contact->urls, dest+total_len, dest_size-total_len);
- RETVM_IF(ret_len < 0, CONTACTS_ERROR_INTERNAL, "This person has too many information");
- total_len += ret_len;
+ len = __ctsvc_vcard_append_webs(contact->urls, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
}
+
for(cursor=list_contacts->records;cursor;cursor=cursor->next) {
simple_contact = (ctsvc_simple_contact_s *)cursor->data;
ret = contacts_db_get_record(_contacts_contact._uri, simple_contact->contact_id, (contacts_record_h *)&contact);
if (CONTACTS_ERROR_NONE == ret && contact && contact->events && contact->events->cursor) {
- ret_len = __ctsvc_vcard_append_events(contact->events, dest+total_len, dest_size-total_len);
- RETVM_IF(ret_len < 0, CONTACTS_ERROR_INTERNAL, "This person has too many information");
- total_len += ret_len;
+ len = __ctsvc_vcard_append_events(contact->events, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
}
for(cursor=list_contacts->records;cursor;cursor=cursor->next) {
simple_contact = (ctsvc_simple_contact_s *)cursor->data;
ret = contacts_db_get_record(_contacts_contact._uri, simple_contact->contact_id, (contacts_record_h *)&contact);
if (CONTACTS_ERROR_NONE == ret && contact && contact->images && contact->images->cursor) {
- ret_len = __ctsvc_vcard_put_photo(contact->images, dest+total_len, dest_size-total_len);
- RETVM_IF(ret_len < 0, CONTACTS_ERROR_INTERNAL, "This person has too many information");
- total_len += ret_len;
+ len = __ctsvc_vcard_put_photo(contact->images, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
}
for(cursor=list_contacts->records;cursor;cursor=cursor->next) {
simple_contact = (ctsvc_simple_contact_s *)cursor->data;
ret = contacts_db_get_record(_contacts_contact._uri, simple_contact->contact_id, (contacts_record_h *)&contact);
if (CONTACTS_ERROR_NONE == ret && contact && contact->messengers && contact->messengers->cursor) {
- ret_len = __ctsvc_vcard_append_messengers(contact->messengers, dest+total_len, dest_size-total_len);
- RETVM_IF(ret_len < 0, CONTACTS_ERROR_INTERNAL, "This person has too many information");
- total_len += ret_len;
+ len = __ctsvc_vcard_append_messengers(contact->messengers, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
}
@@ -1466,9 +1435,8 @@ static int __ctsvc_vcard_append_person(ctsvc_person_s *person, ctsvc_list_s *lis
simple_contact = (ctsvc_simple_contact_s *)cursor->data;
ret = contacts_db_get_record(_contacts_contact._uri, simple_contact->contact_id, (contacts_record_h *)&contact);
if (CONTACTS_ERROR_NONE == ret && contact && contact->relationships && contact->relationships->cursor) {
- ret_len = __ctsvc_vcard_append_relationships(contact->relationships, dest+total_len, dest_size-total_len);
- RETVM_IF(ret_len < 0, CONTACTS_ERROR_INTERNAL, "This person has too many information");
- total_len += ret_len;
+ len = __ctsvc_vcard_append_relationships(contact->relationships, buf, buf_size, len);
+ RETV_IF(len < 0, len);
}
}
@@ -1476,9 +1444,8 @@ static int __ctsvc_vcard_append_person(ctsvc_person_s *person, ctsvc_list_s *lis
simple_contact = (ctsvc_simple_contact_s *)cursor->data;
ret = contacts_db_get_record(_contacts_contact._uri, simple_contact->contact_id, (contacts_record_h *)&contact);
if (CONTACTS_ERROR_NONE == ret && contact && contact->uid) {
- ret_len = snprintf(dest+total_len, dest_size-total_len, "%s:%s%s", content_name[CTSVC_VCARD_VALUE_UID], contact->uid, CTSVC_CRLF);
- RETVM_IF(ret_len < 0, CONTACTS_ERROR_INTERNAL, "This person has too many information");
- total_len += ret_len;
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_UID]);
+ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, contact->uid);
}
}
for(cursor=list_contacts->records;cursor;cursor=cursor->next) {
@@ -1487,67 +1454,61 @@ static int __ctsvc_vcard_append_person(ctsvc_person_s *person, ctsvc_list_s *lis
if (CONTACTS_ERROR_NONE == ret && contact && changed_time < contact->changed_time)
changed_time = contact->changed_time;
}
+
if (changed_time) {
struct tm ts;
gmtime_r((time_t *)&changed_time, &ts);
- ret_len = snprintf(dest+total_len, dest_size-total_len, "%s:%04d-%02d-%02dT%02d:%02d:%02dZ%s",
+ char temp[VCARD_ITEM_LENGTH] = {0};
+ snprintf(temp, sizeof(temp), "%s:%04d-%02d-%02dT%02d:%02d:%02dZ%s",
content_name[CTSVC_VCARD_VALUE_REV],
1900+ts.tm_year, 1+ts.tm_mon, ts.tm_mday,
ts.tm_hour, ts.tm_min, ts.tm_sec,
CTSVC_CRLF);
- RETVM_IF(ret_len < 0, CONTACTS_ERROR_INTERNAL, "This person has too many information");
- total_len += ret_len;
+
+ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, temp);
}
#if 0
ctsvc_list_s* profile;
#endif
- return total_len;
+ return len;
}
static int __ctsvc_vcard_make_from_person(ctsvc_person_s *person, ctsvc_list_s *list_contacts,
char **vcard_stream)
{
- int ret_len, ret;
- char *result = NULL;
+ int ret;
+ char *buf = NULL;
+ int buf_size = VCARD_INIT_LENGTH;
+ int len = 0;
RETV_IF(NULL == vcard_stream, CONTACTS_ERROR_INVALID_PARAMETER);
*vcard_stream = NULL;
- result = calloc(1, CTSVC_VCARD_FILE_MAX_SIZE);
- RETVM_IF(NULL == result, CONTACTS_ERROR_OUT_OF_MEMORY, "Out of memory : calloc() Failed()");
-
__ctsvc_vcard_initial();
- ret_len = snprintf(result, CTSVC_VCARD_FILE_MAX_SIZE, "%s%s", "BEGIN:VCARD", CTSVC_CRLF);
- ret_len += snprintf(result+ret_len, CTSVC_VCARD_FILE_MAX_SIZE-ret_len, "%s%s%s", "VERSION:", "3.0", CTSVC_CRLF);
- ret = __ctsvc_vcard_append_person(person, list_contacts, result+ret_len, CTSVC_VCARD_FILE_MAX_SIZE-ret_len);
- if (ret < 0) {
- free(result);
- return ret;
- }
+ buf = calloc(1, buf_size);
+ CTSVC_VCARD_APPEND_STR(&buf, &buf_size, len, "BEGIN:VCARD");
+ CTSVC_VCARD_APPEND_STR(&buf, &buf_size, len, CTSVC_CRLF);
- ret_len += ret;
- if (CTSVC_VCARD_FILE_MAX_SIZE-ret_len <= 0) {
- CTS_ERR("This person has too many information");
- free(result);
- return CONTACTS_ERROR_INTERNAL;
- }
+ CTSVC_VCARD_APPEND_STR(&buf, &buf_size, len, "VERSION:3.0");
+ CTSVC_VCARD_APPEND_STR(&buf, &buf_size, len, CTSVC_CRLF);
- ret_len += snprintf(result+ret_len, CTSVC_VCARD_FILE_MAX_SIZE-ret_len, "%s%s", "END:VCARD", CTSVC_CRLF);
- if (CTSVC_VCARD_FILE_MAX_SIZE-ret_len <= 0) {
- CTS_ERR("This person has too many information");
- free(result);
+ len = __ctsvc_vcard_append_person(person, list_contacts, &buf, &buf_size, len);
+ if (len < 0) {
+ free(buf);
return CONTACTS_ERROR_INTERNAL;
}
- ret = __ctsvc_vcard_add_folding(result);
- if (CONTACTS_ERROR_NONE != ret) {
- free(result);
+ CTSVC_VCARD_APPEND_STR(&buf, &buf_size, len, "END:VCARD");
+ CTSVC_VCARD_APPEND_STR(&buf, &buf_size, len, CTSVC_CRLF);
+
+ len = __ctsvc_vcard_add_folding(&buf, &buf_size, len);
+ if (len < 0) {
+ free(buf);
return ret;
}
- *vcard_stream = strdup(result);
- free(result);
+ *vcard_stream = buf;
return CONTACTS_ERROR_NONE;
}
diff --git a/common/ctsvc_view.c b/common/ctsvc_view.c
index 1c6f1f7..58b408c 100644
--- a/common/ctsvc_view.c
+++ b/common/ctsvc_view.c
@@ -59,9 +59,6 @@ API const _contacts_person_property_ids _contacts_person = {
.is_favorite = CTSVC_PROPERTY_PERSON_IS_FAVORITE,
.favorite_priority = CTSVC_PROPERTY_PERSON_FAVORITE_PRIORITY,
.link_count = CTSVC_PROPERTY_PERSON_LINK_COUNT,
- .account_id1 = CTSVC_PROPERTY_PERSON_ACCOUNT_ID1,
- .account_id2 = CTSVC_PROPERTY_PERSON_ACCOUNT_ID2,
- .account_id3 = CTSVC_PROPERTY_PERSON_ACCOUNT_ID3,
.addressbook_ids = CTSVC_PROPERTY_PERSON_ADDRESSBOOK_IDS,
.has_phonenumber = CTSVC_PROPERTY_PERSON_HAS_PHONENUMBER,
.has_email = CTSVC_PROPERTY_PERSON_HAS_EMAIL,
@@ -243,18 +240,19 @@ API const _contacts_note_property_ids _contacts_note = {
};
API const _contacts_profile_property_ids _contacts_profile = {
- ._uri = CTSVC_VIEW_URI_PROFILE,
+ ._uri = CTSVC_VIEW_URI_PROFILE,
.id = CTSVC_PROPERTY_PROFILE_ID,
.type = CTSVC_PROPERTY_PROFILE_TYPE,
.label = CTSVC_PROPERTY_PROFILE_LABEL,
- .uid = CTSVC_PROPERTY_PROFILE_UID,
- .text = CTSVC_PROPERTY_PROFILE_TEXT,
+ .uid = CTSVC_PROPERTY_PROFILE_UID,
+ .text = CTSVC_PROPERTY_PROFILE_TEXT,
.order = CTSVC_PROPERTY_PROFILE_ORDER,
- .appsvc_operation = CTSVC_PROPERTY_PROFILE_APPSVC_OPERATION,
- .data1 = CTSVC_PROPERTY_PROFILE_DATA1,
- .data2 = CTSVC_PROPERTY_PROFILE_DATA2,
- .data3 = CTSVC_PROPERTY_PROFILE_DATA3,
- .data4 = CTSVC_PROPERTY_PROFILE_DATA4,
+ .service_operation = CTSVC_PROPERTY_PROFILE_SERVICE_OPERATION,
+ .mime = CTSVC_PROPERTY_PROFILE_MIME,
+ .app_id = CTSVC_PROPERTY_PROFILE_APP_ID,
+ .uri = CTSVC_PROPERTY_PROFILE_URI,
+ .category = CTSVC_PROPERTY_PROFILE_CATEGORY,
+ .extra_data = CTSVC_PROPERTY_PROFILE_EXTRA_DATA,
.contact_id = CTSVC_PROPERTY_PROFILE_CONTACT_ID
};
@@ -360,6 +358,8 @@ API const _contacts_activity_property_ids _contacts_activity = {
.source_name = CTSVC_PROPERTY_ACTIVITY_SOURCE_NAME,
.status = CTSVC_PROPERTY_ACTIVITY_STATUS,
.timestamp = CTSVC_PROPERTY_ACTIVITY_TIMESTAMP,
+ .service_operation = CTSVC_PROPERTY_ACTIVITY_SERVICE_OPERATION,
+ .uri = CTSVC_PROPERTY_ACTIVITY_URI,
.sync_data1 = CTSVC_PROPERTY_ACTIVITY_SYNC_DATA1,
.sync_data2 = CTSVC_PROPERTY_ACTIVITY_SYNC_DATA2,
.sync_data3 = CTSVC_PROPERTY_ACTIVITY_SYNC_DATA3,
@@ -416,9 +416,6 @@ API const _contacts_person_contact_property_ids _contacts_person_contact = {
.status = CTSVC_PROPERTY_PERSON_STATUS,
.is_favorite = CTSVC_PROPERTY_PERSON_IS_FAVORITE,
.link_count = CTSVC_PROPERTY_PERSON_LINK_COUNT,
- .account_id1 = CTSVC_PROPERTY_PERSON_ACCOUNT_ID1,
- .account_id2 = CTSVC_PROPERTY_PERSON_ACCOUNT_ID2,
- .account_id3 = CTSVC_PROPERTY_PERSON_ACCOUNT_ID3,
.addressbook_ids = CTSVC_PROPERTY_PERSON_ADDRESSBOOK_IDS,
.has_phonenumber = CTSVC_PROPERTY_PERSON_HAS_PHONENUMBER,
.has_email = CTSVC_PROPERTY_PERSON_HAS_EMAIL,
@@ -497,9 +494,6 @@ API const _contacts_person_grouprel_property_ids _contacts_person_grouprel = {
.has_phonenumber = CTSVC_PROPERTY_PERSON_HAS_PHONENUMBER,
.has_email = CTSVC_PROPERTY_PERSON_HAS_EMAIL,
.link_count = CTSVC_PROPERTY_PERSON_LINK_COUNT,
- .account_id1 = CTSVC_PROPERTY_PERSON_ACCOUNT_ID1,
- .account_id2 = CTSVC_PROPERTY_PERSON_ACCOUNT_ID2,
- .account_id3 = CTSVC_PROPERTY_PERSON_ACCOUNT_ID3,
.addressbook_ids = CTSVC_PROPERTY_PERSON_ADDRESSBOOK_IDS,
.address_book_id = CTSVC_PROPERTY_CONTACT_ADDRESSBOOK_ID,
.group_id = CTSVC_PROPERTY_GROUP_RELATION_GROUP_ID,
@@ -581,6 +575,8 @@ API const _contacts_contact_activity_property_ids _contacts_contact_activity = {
.source_name = CTSVC_PROPERTY_ACTIVITY_SOURCE_NAME,
.status = CTSVC_PROPERTY_ACTIVITY_STATUS,
.timestamp = CTSVC_PROPERTY_ACTIVITY_TIMESTAMP,
+ .service_operation = CTSVC_PROPERTY_ACTIVITY_SERVICE_OPERATION,
+ .uri = CTSVC_PROPERTY_ACTIVITY_URI,
.sync_data1 = CTSVC_PROPERTY_ACTIVITY_SYNC_DATA1,
.sync_data2 = CTSVC_PROPERTY_ACTIVITY_SYNC_DATA2,
.sync_data3 = CTSVC_PROPERTY_ACTIVITY_SYNC_DATA3,
@@ -635,9 +631,6 @@ const property_info_s __property_person[] = {
{CTSVC_PROPERTY_PERSON_IS_FAVORITE, CTSVC_SEARCH_PROPERTY_ALL, "is_favorite"},
{CTSVC_PROPERTY_PERSON_FAVORITE_PRIORITY, CTSVC_SEARCH_PROPERTY_FILTER, "favorite_prio"},
{CTSVC_PROPERTY_PERSON_LINK_COUNT, CTSVC_SEARCH_PROPERTY_ALL, "link_count"},
- {CTSVC_PROPERTY_PERSON_ACCOUNT_ID1, CTSVC_SEARCH_PROPERTY_ALL, "account_id1"},
- {CTSVC_PROPERTY_PERSON_ACCOUNT_ID2, CTSVC_SEARCH_PROPERTY_ALL, "account_id2"},
- {CTSVC_PROPERTY_PERSON_ACCOUNT_ID3, CTSVC_SEARCH_PROPERTY_ALL, "account_id3"},
{CTSVC_PROPERTY_PERSON_ADDRESSBOOK_IDS, CTSVC_SEARCH_PROPERTY_PROJECTION, "addressbook_ids"},
{CTSVC_PROPERTY_PERSON_HAS_PHONENUMBER, CTSVC_SEARCH_PROPERTY_ALL, "has_phonenumber"},
{CTSVC_PROPERTY_PERSON_HAS_EMAIL, CTSVC_SEARCH_PROPERTY_ALL, "has_email"},
@@ -790,11 +783,12 @@ const property_info_s __property_profile[] = {
{CTSVC_PROPERTY_PROFILE_UID, CTSVC_SEARCH_PROPERTY_ALL, "data3"},
{CTSVC_PROPERTY_PROFILE_TEXT, CTSVC_SEARCH_PROPERTY_ALL, "data4"},
{CTSVC_PROPERTY_PROFILE_ORDER, CTSVC_SEARCH_PROPERTY_ALL, "data5"},
- {CTSVC_PROPERTY_PROFILE_APPSVC_OPERATION, CTSVC_SEARCH_PROPERTY_ALL, "data6"},
- {CTSVC_PROPERTY_PROFILE_DATA1, CTSVC_SEARCH_PROPERTY_ALL, "data7"},
- {CTSVC_PROPERTY_PROFILE_DATA2, CTSVC_SEARCH_PROPERTY_ALL, "data8"},
- {CTSVC_PROPERTY_PROFILE_DATA3, CTSVC_SEARCH_PROPERTY_ALL, "data9"},
- {CTSVC_PROPERTY_PROFILE_DATA4, CTSVC_SEARCH_PROPERTY_ALL, "data10"},
+ {CTSVC_PROPERTY_PROFILE_SERVICE_OPERATION, CTSVC_SEARCH_PROPERTY_ALL, "data6"},
+ {CTSVC_PROPERTY_PROFILE_MIME, CTSVC_SEARCH_PROPERTY_ALL, "data7"},
+ {CTSVC_PROPERTY_PROFILE_APP_ID, CTSVC_SEARCH_PROPERTY_ALL, "data8"},
+ {CTSVC_PROPERTY_PROFILE_URI, CTSVC_SEARCH_PROPERTY_ALL, "data9"},
+ {CTSVC_PROPERTY_PROFILE_CATEGORY, CTSVC_SEARCH_PROPERTY_ALL, "data10"},
+ {CTSVC_PROPERTY_PROFILE_EXTRA_DATA, CTSVC_SEARCH_PROPERTY_ALL, "data11"},
};
const property_info_s __property_activity_photo[] = {
@@ -810,6 +804,8 @@ const property_info_s __property_activity[] = {
{CTSVC_PROPERTY_ACTIVITY_SOURCE_NAME, CTSVC_SEARCH_PROPERTY_ALL, "source_name"},
{CTSVC_PROPERTY_ACTIVITY_STATUS, CTSVC_SEARCH_PROPERTY_ALL, "status"},
{CTSVC_PROPERTY_ACTIVITY_TIMESTAMP, CTSVC_SEARCH_PROPERTY_ALL, "timestamp"},
+ {CTSVC_PROPERTY_ACTIVITY_SERVICE_OPERATION, CTSVC_SEARCH_PROPERTY_ALL, "service_operation"},
+ {CTSVC_PROPERTY_ACTIVITY_URI, CTSVC_SEARCH_PROPERTY_ALL, "uri"},
{CTSVC_PROPERTY_ACTIVITY_SYNC_DATA1, CTSVC_SEARCH_PROPERTY_ALL, "sync_data1"},
{CTSVC_PROPERTY_ACTIVITY_SYNC_DATA2, CTSVC_SEARCH_PROPERTY_ALL, "sync_data2"},
{CTSVC_PROPERTY_ACTIVITY_SYNC_DATA3, CTSVC_SEARCH_PROPERTY_ALL, "sync_data3"},
@@ -941,9 +937,6 @@ const property_info_s __property_person_contact[] = { // _contacts_person_conta
{CTSVC_PROPERTY_PERSON_STATUS, CTSVC_SEARCH_PROPERTY_PROJECTION, "status"},
{CTSVC_PROPERTY_PERSON_IS_FAVORITE, CTSVC_SEARCH_PROPERTY_ALL, "is_favorite"},
{CTSVC_PROPERTY_PERSON_LINK_COUNT, CTSVC_SEARCH_PROPERTY_ALL, "link_count"},
- {CTSVC_PROPERTY_PERSON_ACCOUNT_ID1, CTSVC_SEARCH_PROPERTY_ALL, "account_id1"},
- {CTSVC_PROPERTY_PERSON_ACCOUNT_ID2, CTSVC_SEARCH_PROPERTY_ALL, "account_id2"},
- {CTSVC_PROPERTY_PERSON_ACCOUNT_ID3, CTSVC_SEARCH_PROPERTY_ALL, "account_id3"},
{CTSVC_PROPERTY_PERSON_ADDRESSBOOK_IDS, CTSVC_SEARCH_PROPERTY_PROJECTION, "addressbook_ids"},
{CTSVC_PROPERTY_PERSON_HAS_PHONENUMBER, CTSVC_SEARCH_PROPERTY_ALL, "has_phonenumber"},
{CTSVC_PROPERTY_PERSON_HAS_EMAIL, CTSVC_SEARCH_PROPERTY_ALL, "has_email"},
@@ -1005,9 +998,6 @@ const property_info_s __property_person_grouprel[] = { // _contacts_person_group
{CTSVC_PROPERTY_PERSON_STATUS, CTSVC_SEARCH_PROPERTY_PROJECTION, "status"},
{CTSVC_PROPERTY_PERSON_IS_FAVORITE, CTSVC_SEARCH_PROPERTY_ALL, "is_favorite"},
{CTSVC_PROPERTY_PERSON_LINK_COUNT, CTSVC_SEARCH_PROPERTY_ALL, "link_count"},
- {CTSVC_PROPERTY_PERSON_ACCOUNT_ID1, CTSVC_SEARCH_PROPERTY_ALL, "account_id1"},
- {CTSVC_PROPERTY_PERSON_ACCOUNT_ID2, CTSVC_SEARCH_PROPERTY_ALL, "account_id2"},
- {CTSVC_PROPERTY_PERSON_ACCOUNT_ID3, CTSVC_SEARCH_PROPERTY_ALL, "account_id3"},
{CTSVC_PROPERTY_PERSON_ADDRESSBOOK_IDS, CTSVC_SEARCH_PROPERTY_PROJECTION, "addressbook_ids"},
{CTSVC_PROPERTY_PERSON_HAS_PHONENUMBER, CTSVC_SEARCH_PROPERTY_ALL, "has_phonenumber"},
{CTSVC_PROPERTY_PERSON_HAS_EMAIL, CTSVC_SEARCH_PROPERTY_ALL, "has_email"},
@@ -1109,6 +1099,8 @@ const property_info_s __property_contact_activity[] = { // _contacts_contact_ac
{CTSVC_PROPERTY_ACTIVITY_SOURCE_NAME, CTSVC_SEARCH_PROPERTY_ALL, "source_name"},
{CTSVC_PROPERTY_ACTIVITY_STATUS, CTSVC_SEARCH_PROPERTY_PROJECTION, "status"},
{CTSVC_PROPERTY_ACTIVITY_TIMESTAMP, CTSVC_SEARCH_PROPERTY_ALL, "timestamp"},
+ {CTSVC_PROPERTY_ACTIVITY_SERVICE_OPERATION, CTSVC_SEARCH_PROPERTY_ALL, "service_operation"},
+ {CTSVC_PROPERTY_ACTIVITY_URI, CTSVC_SEARCH_PROPERTY_ALL, "uri"},
{CTSVC_PROPERTY_ACTIVITY_SYNC_DATA1, CTSVC_SEARCH_PROPERTY_PROJECTION, "sync_data1"},
{CTSVC_PROPERTY_ACTIVITY_SYNC_DATA2, CTSVC_SEARCH_PROPERTY_PROJECTION, "sync_data2"},
{CTSVC_PROPERTY_ACTIVITY_SYNC_DATA3, CTSVC_SEARCH_PROPERTY_PROJECTION, "sync_data3"},
diff --git a/common/ctsvc_view.h b/common/ctsvc_view.h
index 684eb2f..a7510f1 100644
--- a/common/ctsvc_view.h
+++ b/common/ctsvc_view.h
@@ -172,17 +172,14 @@ typedef enum {
CTSVC_PROPERTY_PERSON_IS_FAVORITE = (CTSVC_PROPERTY_PERSON | CTSVC_VIEW_DATA_TYPE_BOOL) +6,
CTSVC_PROPERTY_PERSON_FAVORITE_PRIORITY = (CTSVC_PROPERTY_PERSON | CTSVC_VIEW_DATA_TYPE_DOUBLE | CTSVC_READ_ONLY_PROPERTY) +7,
CTSVC_PROPERTY_PERSON_LINK_COUNT = (CTSVC_PROPERTY_PERSON | CTSVC_VIEW_DATA_TYPE_INT | CTSVC_READ_ONLY_PROPERTY) +8,
- CTSVC_PROPERTY_PERSON_ACCOUNT_ID1 = (CTSVC_PROPERTY_PERSON | CTSVC_VIEW_DATA_TYPE_INT | CTSVC_READ_ONLY_PROPERTY) +9,
- CTSVC_PROPERTY_PERSON_ACCOUNT_ID2 = (CTSVC_PROPERTY_PERSON | CTSVC_VIEW_DATA_TYPE_INT | CTSVC_READ_ONLY_PROPERTY) +10,
- CTSVC_PROPERTY_PERSON_ACCOUNT_ID3 = (CTSVC_PROPERTY_PERSON | CTSVC_VIEW_DATA_TYPE_INT | CTSVC_READ_ONLY_PROPERTY) +11,
- CTSVC_PROPERTY_PERSON_ADDRESSBOOK_IDS = (CTSVC_PROPERTY_PERSON | CTSVC_VIEW_DATA_TYPE_STR | CTSVC_READ_ONLY_PROPERTY) +12,
- CTSVC_PROPERTY_PERSON_HAS_PHONENUMBER = (CTSVC_PROPERTY_PERSON | CTSVC_VIEW_DATA_TYPE_BOOL | CTSVC_READ_ONLY_PROPERTY) +13,
- CTSVC_PROPERTY_PERSON_HAS_EMAIL = (CTSVC_PROPERTY_PERSON | CTSVC_VIEW_DATA_TYPE_BOOL | CTSVC_READ_ONLY_PROPERTY) +14,
- CTSVC_PROPERTY_PERSON_DISPLAY_NAME_INDEX = (CTSVC_PROPERTY_PERSON | CTSVC_VIEW_DATA_TYPE_STR | CTSVC_READ_ONLY_PROPERTY) +15,
- CTSVC_PROPERTY_PERSON_STATUS = (CTSVC_PROPERTY_PERSON | CTSVC_VIEW_DATA_TYPE_STR | CTSVC_READ_ONLY_PROPERTY) +16,
+ CTSVC_PROPERTY_PERSON_ADDRESSBOOK_IDS = (CTSVC_PROPERTY_PERSON | CTSVC_VIEW_DATA_TYPE_STR | CTSVC_READ_ONLY_PROPERTY) +9,
+ CTSVC_PROPERTY_PERSON_HAS_PHONENUMBER = (CTSVC_PROPERTY_PERSON | CTSVC_VIEW_DATA_TYPE_BOOL | CTSVC_READ_ONLY_PROPERTY) +10,
+ CTSVC_PROPERTY_PERSON_HAS_EMAIL = (CTSVC_PROPERTY_PERSON | CTSVC_VIEW_DATA_TYPE_BOOL | CTSVC_READ_ONLY_PROPERTY) +11,
+ CTSVC_PROPERTY_PERSON_DISPLAY_NAME_INDEX = (CTSVC_PROPERTY_PERSON | CTSVC_VIEW_DATA_TYPE_STR | CTSVC_READ_ONLY_PROPERTY) +12,
+ CTSVC_PROPERTY_PERSON_STATUS = (CTSVC_PROPERTY_PERSON | CTSVC_VIEW_DATA_TYPE_STR | CTSVC_READ_ONLY_PROPERTY) +13,
// person-stat
- CTSVC_PROPERTY_PERSON_USAGE_TYPE = (CTSVC_PROPERTY_PERSON | CTSVC_VIEW_DATA_TYPE_INT) +17,
- CTSVC_PROPERTY_PERSON_TIMES_USED = (CTSVC_PROPERTY_PERSON | CTSVC_VIEW_DATA_TYPE_INT) +18,
+ CTSVC_PROPERTY_PERSON_USAGE_TYPE = (CTSVC_PROPERTY_PERSON | CTSVC_VIEW_DATA_TYPE_INT) +14,
+ CTSVC_PROPERTY_PERSON_TIMES_USED = (CTSVC_PROPERTY_PERSON | CTSVC_VIEW_DATA_TYPE_INT) +15,
// simple contact : read only
// contact
@@ -374,11 +371,12 @@ typedef enum {
CTSVC_PROPERTY_PROFILE_UID = (CTSVC_PROPERTY_PROFILE | CTSVC_VIEW_DATA_TYPE_STR) +4,
CTSVC_PROPERTY_PROFILE_TEXT = (CTSVC_PROPERTY_PROFILE | CTSVC_VIEW_DATA_TYPE_STR) +5,
CTSVC_PROPERTY_PROFILE_ORDER = (CTSVC_PROPERTY_PROFILE | CTSVC_VIEW_DATA_TYPE_INT) +6,
- CTSVC_PROPERTY_PROFILE_APPSVC_OPERATION = (CTSVC_PROPERTY_PROFILE | CTSVC_VIEW_DATA_TYPE_STR) +7,
- CTSVC_PROPERTY_PROFILE_DATA1 = (CTSVC_PROPERTY_PROFILE | CTSVC_VIEW_DATA_TYPE_STR) +8,
- CTSVC_PROPERTY_PROFILE_DATA2 = (CTSVC_PROPERTY_PROFILE | CTSVC_VIEW_DATA_TYPE_STR) +9,
- CTSVC_PROPERTY_PROFILE_DATA3 = (CTSVC_PROPERTY_PROFILE | CTSVC_VIEW_DATA_TYPE_STR) +10,
- CTSVC_PROPERTY_PROFILE_DATA4 = (CTSVC_PROPERTY_PROFILE | CTSVC_VIEW_DATA_TYPE_STR) +11,
+ CTSVC_PROPERTY_PROFILE_SERVICE_OPERATION = (CTSVC_PROPERTY_PROFILE | CTSVC_VIEW_DATA_TYPE_STR) +7,
+ CTSVC_PROPERTY_PROFILE_MIME = (CTSVC_PROPERTY_PROFILE | CTSVC_VIEW_DATA_TYPE_STR) +8,
+ CTSVC_PROPERTY_PROFILE_APP_ID = (CTSVC_PROPERTY_PROFILE | CTSVC_VIEW_DATA_TYPE_STR) +9,
+ CTSVC_PROPERTY_PROFILE_URI = (CTSVC_PROPERTY_PROFILE | CTSVC_VIEW_DATA_TYPE_STR) +10,
+ CTSVC_PROPERTY_PROFILE_CATEGORY = (CTSVC_PROPERTY_PROFILE | CTSVC_VIEW_DATA_TYPE_STR) +11,
+ CTSVC_PROPERTY_PROFILE_EXTRA_DATA = (CTSVC_PROPERTY_PROFILE | CTSVC_VIEW_DATA_TYPE_STR) +12,
// activity
CTSVC_PROPERTY_ACTIVITY_ID = (CTSVC_PROPERTY_ACTIVITY | CTSVC_VIEW_DATA_TYPE_INT | CTSVC_READ_ONLY_PROPERTY),
@@ -386,11 +384,13 @@ typedef enum {
CTSVC_PROPERTY_ACTIVITY_SOURCE_NAME = (CTSVC_PROPERTY_ACTIVITY | CTSVC_VIEW_DATA_TYPE_STR) +2,
CTSVC_PROPERTY_ACTIVITY_STATUS = (CTSVC_PROPERTY_ACTIVITY | CTSVC_VIEW_DATA_TYPE_STR) +3,
CTSVC_PROPERTY_ACTIVITY_TIMESTAMP = (CTSVC_PROPERTY_ACTIVITY | CTSVC_VIEW_DATA_TYPE_INT) +4,
- CTSVC_PROPERTY_ACTIVITY_SYNC_DATA1 = (CTSVC_PROPERTY_ACTIVITY | CTSVC_VIEW_DATA_TYPE_STR) +5,
- CTSVC_PROPERTY_ACTIVITY_SYNC_DATA2 = (CTSVC_PROPERTY_ACTIVITY | CTSVC_VIEW_DATA_TYPE_STR) +6,
- CTSVC_PROPERTY_ACTIVITY_SYNC_DATA3 = (CTSVC_PROPERTY_ACTIVITY | CTSVC_VIEW_DATA_TYPE_STR) +7,
- CTSVC_PROPERTY_ACTIVITY_SYNC_DATA4 = (CTSVC_PROPERTY_ACTIVITY | CTSVC_VIEW_DATA_TYPE_STR) +8,
- CTSVC_PROPERTY_ACTIVITY_ACTIVITY_PHOTO = (CTSVC_PROPERTY_ACTIVITY | CTSVC_VIEW_DATA_TYPE_REC) +9,
+ CTSVC_PROPERTY_ACTIVITY_SERVICE_OPERATION = (CTSVC_PROPERTY_ACTIVITY | CTSVC_VIEW_DATA_TYPE_STR) +5,
+ CTSVC_PROPERTY_ACTIVITY_URI = (CTSVC_PROPERTY_ACTIVITY | CTSVC_VIEW_DATA_TYPE_STR) +6,
+ CTSVC_PROPERTY_ACTIVITY_SYNC_DATA1 = (CTSVC_PROPERTY_ACTIVITY | CTSVC_VIEW_DATA_TYPE_STR) +7,
+ CTSVC_PROPERTY_ACTIVITY_SYNC_DATA2 = (CTSVC_PROPERTY_ACTIVITY | CTSVC_VIEW_DATA_TYPE_STR) +8,
+ CTSVC_PROPERTY_ACTIVITY_SYNC_DATA3 = (CTSVC_PROPERTY_ACTIVITY | CTSVC_VIEW_DATA_TYPE_STR) +9,
+ CTSVC_PROPERTY_ACTIVITY_SYNC_DATA4 = (CTSVC_PROPERTY_ACTIVITY | CTSVC_VIEW_DATA_TYPE_STR) +10,
+ CTSVC_PROPERTY_ACTIVITY_ACTIVITY_PHOTO = (CTSVC_PROPERTY_ACTIVITY | CTSVC_VIEW_DATA_TYPE_REC) +11,
// activity photo
CTSVC_PROPERTY_ACTIVITY_PHOTO_ID = (CTSVC_PROPERTY_ACTIVITY_PHOTO | CTSVC_VIEW_DATA_TYPE_INT | CTSVC_READ_ONLY_PROPERTY),
diff --git a/common/ipc/ctsvc_ipc_activity.c b/common/ipc/ctsvc_ipc_activity.c
index 7f9a708..8907df8 100644
--- a/common/ipc/ctsvc_ipc_activity.c
+++ b/common/ipc/ctsvc_ipc_activity.c
@@ -29,6 +29,8 @@ static int __ctsvc_ipc_unmarshal_activity(pims_ipc_data_h ipc_data, const char*
if (ctsvc_ipc_unmarshal_string(ipc_data, &activity_p->source_name) != CONTACTS_ERROR_NONE) break;
if (ctsvc_ipc_unmarshal_string(ipc_data, &activity_p->status) != CONTACTS_ERROR_NONE) break;
if (ctsvc_ipc_unmarshal_int(ipc_data, &activity_p->timestamp) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_unmarshal_string(ipc_data, &activity_p->service_operation) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_unmarshal_string(ipc_data, &activity_p->uri) != CONTACTS_ERROR_NONE) break;
if (ctsvc_ipc_unmarshal_string(ipc_data, &activity_p->sync_data1) != CONTACTS_ERROR_NONE) break;
if (ctsvc_ipc_unmarshal_string(ipc_data, &activity_p->sync_data2) != CONTACTS_ERROR_NONE) break;
if (ctsvc_ipc_unmarshal_string(ipc_data, &activity_p->sync_data3) != CONTACTS_ERROR_NONE) break;
@@ -56,6 +58,8 @@ static int __ctsvc_ipc_marshal_activity(const contacts_record_h record, pims_ipc
if (ctsvc_ipc_marshal_string((activity_p->source_name),ipc_data) != CONTACTS_ERROR_NONE) break;
if (ctsvc_ipc_marshal_string((activity_p->status),ipc_data) != CONTACTS_ERROR_NONE) break;
if (ctsvc_ipc_marshal_int((activity_p->timestamp),ipc_data) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_marshal_string((activity_p->service_operation),ipc_data) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_marshal_string((activity_p->uri),ipc_data) != CONTACTS_ERROR_NONE) break;
if (ctsvc_ipc_marshal_string((activity_p->sync_data1),ipc_data) != CONTACTS_ERROR_NONE) break;
if (ctsvc_ipc_marshal_string((activity_p->sync_data2),ipc_data) != CONTACTS_ERROR_NONE) break;
if (ctsvc_ipc_marshal_string((activity_p->sync_data3),ipc_data) != CONTACTS_ERROR_NONE) break;
diff --git a/common/ipc/ctsvc_ipc_person.c b/common/ipc/ctsvc_ipc_person.c
index 09c5b9a..a249964 100644
--- a/common/ipc/ctsvc_ipc_person.c
+++ b/common/ipc/ctsvc_ipc_person.c
@@ -36,9 +36,6 @@ static int __ctsvc_ipc_unmarshal_person(pims_ipc_data_h ipc_data, const char* vi
if (ctsvc_ipc_unmarshal_string(ipc_data, &person_p->vibration) != CONTACTS_ERROR_NONE) break;
if (ctsvc_ipc_unmarshal_string(ipc_data, &person_p->status) != CONTACTS_ERROR_NONE) break;
if (ctsvc_ipc_unmarshal_int(ipc_data, &person_p->link_count) != CONTACTS_ERROR_NONE) break;
- if (ctsvc_ipc_unmarshal_int(ipc_data, &person_p->account_id1) != CONTACTS_ERROR_NONE) break;
- if (ctsvc_ipc_unmarshal_int(ipc_data, &person_p->account_id2) != CONTACTS_ERROR_NONE) break;
- if (ctsvc_ipc_unmarshal_int(ipc_data, &person_p->account_id3) != CONTACTS_ERROR_NONE) break;
if (ctsvc_ipc_unmarshal_string(ipc_data, &person_p->addressbook_ids) != CONTACTS_ERROR_NONE) break;
return CONTACTS_ERROR_NONE;
@@ -68,9 +65,6 @@ static int __ctsvc_ipc_marshal_person(const contacts_record_h record, pims_ipc_d
if (ctsvc_ipc_marshal_string((person_p->vibration),ipc_data) != CONTACTS_ERROR_NONE) break;
if (ctsvc_ipc_marshal_string((person_p->status),ipc_data) != CONTACTS_ERROR_NONE) break;
if (ctsvc_ipc_marshal_int((person_p->link_count),ipc_data) != CONTACTS_ERROR_NONE) break;
- if (ctsvc_ipc_marshal_int((person_p->account_id1),ipc_data) != CONTACTS_ERROR_NONE) break;
- if (ctsvc_ipc_marshal_int((person_p->account_id2),ipc_data) != CONTACTS_ERROR_NONE) break;
- if (ctsvc_ipc_marshal_int((person_p->account_id3),ipc_data) != CONTACTS_ERROR_NONE) break;
if (ctsvc_ipc_marshal_string((person_p->addressbook_ids),ipc_data) != CONTACTS_ERROR_NONE) break;
return CONTACTS_ERROR_NONE;
diff --git a/common/ipc/ctsvc_ipc_profile.c b/common/ipc/ctsvc_ipc_profile.c
index 190c83d..36ad3d7 100644
--- a/common/ipc/ctsvc_ipc_profile.c
+++ b/common/ipc/ctsvc_ipc_profile.c
@@ -30,11 +30,12 @@ static int __ctsvc_ipc_unmarshal_profile(pims_ipc_data_h ipc_data, const char* v
if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->uid) != CONTACTS_ERROR_NONE) break;
if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->text) != CONTACTS_ERROR_NONE) break;
if (ctsvc_ipc_unmarshal_int(ipc_data, &profile_p->order) != CONTACTS_ERROR_NONE) break;
- if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->appsvc_operation) != CONTACTS_ERROR_NONE) break;
- if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->data1) != CONTACTS_ERROR_NONE) break;
- if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->data2) != CONTACTS_ERROR_NONE) break;
- if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->data3) != CONTACTS_ERROR_NONE) break;
- if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->data4) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->service_operation) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->mime) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->app_id) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->uri) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->category) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->extra_data) != CONTACTS_ERROR_NONE) break;
return CONTACTS_ERROR_NONE;
} while(0);
@@ -57,11 +58,12 @@ static int __ctsvc_ipc_marshal_profile(const contacts_record_h record, pims_ipc_
if (ctsvc_ipc_marshal_string((profile_p->uid),ipc_data) != CONTACTS_ERROR_NONE) break;
if (ctsvc_ipc_marshal_string((profile_p->text),ipc_data) != CONTACTS_ERROR_NONE) break;
if (ctsvc_ipc_marshal_int((profile_p->order),ipc_data) != CONTACTS_ERROR_NONE) break;
- if (ctsvc_ipc_marshal_string((profile_p->appsvc_operation),ipc_data) != CONTACTS_ERROR_NONE) break;
- if (ctsvc_ipc_marshal_string((profile_p->data1),ipc_data) != CONTACTS_ERROR_NONE) break;
- if (ctsvc_ipc_marshal_string((profile_p->data2),ipc_data) != CONTACTS_ERROR_NONE) break;
- if (ctsvc_ipc_marshal_string((profile_p->data3),ipc_data) != CONTACTS_ERROR_NONE) break;
- if (ctsvc_ipc_marshal_string((profile_p->data4),ipc_data) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_marshal_string((profile_p->service_operation),ipc_data) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_marshal_string((profile_p->mime),ipc_data) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_marshal_string((profile_p->app_id),ipc_data) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_marshal_string((profile_p->uri),ipc_data) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_marshal_string((profile_p->category),ipc_data) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_marshal_string((profile_p->extra_data),ipc_data) != CONTACTS_ERROR_NONE) break;
return CONTACTS_ERROR_NONE;
} while(0);
diff --git a/contacts-service2.manifest b/contacts-service2.manifest
index 9da25a6..4ff2437 100644
--- a/contacts-service2.manifest
+++ b/contacts-service2.manifest
@@ -10,9 +10,9 @@
</request>
</define>
<assign>
- <filesystem path="/usr/lib/libcontacts-service2.so.0.9.59" label="_"/>
+ <filesystem path="/usr/lib/libcontacts-service2.so.0.9.61" label="_"/>
<filesystem path="/usr/lib/libcontacts-service2.so.0" label="_"/>
- <filesystem path="/usr/lib/libcontacts-service3.so.0.9.59" label="_"/>
+ <filesystem path="/usr/lib/libcontacts-service3.so.0.9.61" label="_"/>
<filesystem path="/usr/lib/libcontacts-service3.so.0" label="_"/>
<filesystem path="/opt/usr/dbspace/.contacts-svc.db" label="contacts-service::db"/>
<filesystem path="/opt/usr/dbspace/.contacts-svc.db-journal" label="contacts-service::db"/>
diff --git a/include/contacts.h b/include/contacts.h
index 1e904e0..14dd0d2 100644
--- a/include/contacts.h
+++ b/include/contacts.h
@@ -648,9 +648,6 @@
* <tr><td>boolean</td><td> is_favorite </td><td>read, write</td><td> </td></tr>
* <tr><td>double</td><td> favorite_priority </td><td> filter only </td><td> The priority of favorite contacts. You can not set the value but you can use it as sorting key. </td></tr>
* <tr><td>integer</td><td> link_count </td><td>read, write</td><td> </td></tr>
- * <tr><td>integer</td><td> account_id1 </td><td>read, write</td><td> </td></tr>
- * <tr><td>integer</td><td> account_id2 </td><td>read, write</td><td> </td></tr>
- * <tr><td>integer</td><td> account_id3 </td><td>read, write</td><td> </td></tr>
* <tr><td>integer</td><td> addressbook_ids </td><td>read, write</td><td> </td></tr>
* <tr><td>boolean</td><td> has_phonenumber </td><td>read only</td><td> </td></tr>
* <tr><td>boolean</td><td> has_email </td><td>read only</td><td> </td></tr>
@@ -957,11 +954,12 @@
* <tr><td>string</td><td> uid </td><td>read, write</td><td> </td></tr>
* <tr><td>string</td><td> text </td><td>read, write</td><td> </td></tr>
* <tr><td>integer</td><td> order </td><td>read, write</td><td> </td></tr>
- * <tr><td>string</td><td> appsvc_operation </td><td>read, write</td><td> </td></tr>
- * <tr><td>string</td><td> data1 </td><td>read, write</td><td> </td></tr>
- * <tr><td>string</td><td> data2 </td><td>read, write</td><td> </td></tr>
- * <tr><td>string</td><td> data3 </td><td>read, write</td><td> </td></tr>
- * <tr><td>string</td><td> data4 </td><td>read, write</td><td> </td></tr>
+ * <tr><td>string</td><td> service_operation </td><td>read, write</td><td> </td></tr>
+ * <tr><td>string</td><td> mime </td><td>read, write</td><td> </td> </tr>
+ * <tr><td>string</td><td> app_id </td><td>read, write</td><td> </td> </tr>
+ * <tr><td>string</td><td> uri </td><td>read, write</td><td> </td ></tr>
+ * <tr><td>string</td><td> catagory </td><td>read, write</td><td></td></tr>
+ * <tr><td>string</td><td> extra_data </td><td>read, write</td><td> </td></tr>
* </table>
*
* @section CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity _contacts_activity view
@@ -978,6 +976,8 @@
* <tr><td>string</td><td> source_name </td><td>read, write</td><td> </td></tr>
* <tr><td>int</td><td> timestamp </td><td>read, write</td><td> </td></tr>
* <tr><td>string</td><td> status </td><td>read, write</td><td> </td></tr>
+ * <tr><td>string</td><td> service_operation </td><td></td><td> </td></tr>
+ * <tr><td>string</td><td> uri </td><td></td><td> </td></tr>
* <tr><td>string</td><td> sync_data1 </td><td>read, write</td><td> </td></tr>
* <tr><td>string</td><td> sync_data2 </td><td>read, write</td><td> </td></tr>
* <tr><td>string</td><td> sync_data3 </td><td>read, write</td><td> </td></tr>
@@ -1172,9 +1172,6 @@
* <tr><td>string</td><td> status </td><td></td><td> </td></tr>
* <tr><td>boolean</td><td> is_favorite </td><td></td><td> </td></tr>
* <tr><td>integer</td><td> link_count </td><td></td><td> </td></tr>
- * <tr><td>integer</td><td> account_id1 </td><td></td><td> </td></tr>
- * <tr><td>integer</td><td> account_id2 </td><td></td><td> </td></tr>
- * <tr><td>integer</td><td> account_id3 </td><td></td><td> </td></tr>
* <tr><td>integer</td><td> addressbook_ids </td><td></td><td> </td></tr>
* <tr><td>boolean</td><td> has_phonenumber </td><td></td><td> </td></tr>
* <tr><td>boolean</td><td> has_email </td><td></td><td> </td></tr>
@@ -1312,6 +1309,8 @@
* <tr><td>string</td><td> source_name </td><td></td><td> </td></tr>
* <tr><td>string</td><td> status </td><td></td><td> </td></tr>
* <tr><td>integer</td><td> timestamp </td><td></td><td> </td></tr>
+ * <tr><td>string</td><td> service_operation </td><td></td><td> </td></tr>
+ * <tr><td>string</td><td> uri </td><td></td><td> </td></tr>
* <tr><td>string</td><td> sync_data1 </td><td></td><td> </td></tr>
* <tr><td>string</td><td> sync_data2 </td><td></td><td> </td></tr>
* <tr><td>string</td><td> sync_data3 </td><td></td><td> </td></tr>
diff --git a/include/contacts_views.h b/include/contacts_views.h
index feb21ef..c770a5b 100755
--- a/include/contacts_views.h
+++ b/include/contacts_views.h
@@ -65,9 +65,6 @@ _CONTACTS_BEGIN_VIEW()
_CONTACTS_PROPERTY_BOOL( is_favorite ) // read, write
_CONTACTS_PROPERTY_DOUBLE( favorite_priority ) // read only
_CONTACTS_PROPERTY_INT( link_count ) // read only
- _CONTACTS_PROPERTY_INT( account_id1 ) // read only
- _CONTACTS_PROPERTY_INT( account_id2 ) // read only
- _CONTACTS_PROPERTY_INT( account_id3 ) // read only
_CONTACTS_PROPERTY_STR( addressbook_ids ) // read only
_CONTACTS_PROPERTY_BOOL( has_phonenumber ) // read only
_CONTACTS_PROPERTY_BOOL( has_email ) // read only
@@ -318,11 +315,12 @@ _CONTACTS_BEGIN_VIEW()
_CONTACTS_PROPERTY_STR( uid ) // read, write
_CONTACTS_PROPERTY_STR( text ) // read, write
_CONTACTS_PROPERTY_INT( order ) // read, write
- _CONTACTS_PROPERTY_STR( appsvc_operation ) // read, write
- _CONTACTS_PROPERTY_STR( data1 ) // read, write
- _CONTACTS_PROPERTY_STR( data2 ) // read, write
- _CONTACTS_PROPERTY_STR( data3 ) // read, write
- _CONTACTS_PROPERTY_STR( data4 ) // read, write
+ _CONTACTS_PROPERTY_STR( service_operation ) // read, write
+ _CONTACTS_PROPERTY_STR( mime ) // read, write
+ _CONTACTS_PROPERTY_STR( app_id ) // read, write
+ _CONTACTS_PROPERTY_STR( uri ) // read, write
+ _CONTACTS_PROPERTY_STR( category ) // read, write
+ _CONTACTS_PROPERTY_STR( extra_data ) // read, write
_CONTACTS_PROPERTY_INT( contact_id ) // read, write once
_CONTACTS_END_VIEW( _contacts_profile )
@@ -341,6 +339,8 @@ _CONTACTS_BEGIN_VIEW()
_CONTACTS_PROPERTY_STR( source_name ) // read, write
_CONTACTS_PROPERTY_STR( status ) // read, write
_CONTACTS_PROPERTY_INT( timestamp ) // read, write
+ _CONTACTS_PROPERTY_STR( service_operation ) // read, write
+ _CONTACTS_PROPERTY_STR( uri ) // read, write
_CONTACTS_PROPERTY_STR( sync_data1 ) // read, write
_CONTACTS_PROPERTY_STR( sync_data2 ) // read, write
_CONTACTS_PROPERTY_STR( sync_data3 ) // read, write
@@ -425,9 +425,6 @@ _CONTACTS_BEGIN_READ_ONLY_VIEW()
_CONTACTS_PROPERTY_PROJECTION_STR( status )
_CONTACTS_PROPERTY_BOOL( is_favorite )
_CONTACTS_PROPERTY_PROJECTION_INT( link_count )
- _CONTACTS_PROPERTY_PROJECTION_INT( account_id1 )
- _CONTACTS_PROPERTY_PROJECTION_INT( account_id2 )
- _CONTACTS_PROPERTY_PROJECTION_INT( account_id3 )
_CONTACTS_PROPERTY_PROJECTION_STR( addressbook_ids )
_CONTACTS_PROPERTY_BOOL( has_phonenumber )
_CONTACTS_PROPERTY_BOOL( has_email )
@@ -488,9 +485,6 @@ _CONTACTS_BEGIN_READ_ONLY_VIEW()
_CONTACTS_PROPERTY_PROJECTION_STR( status )
_CONTACTS_PROPERTY_BOOL( is_favorite )
_CONTACTS_PROPERTY_PROJECTION_INT( link_count )
- _CONTACTS_PROPERTY_PROJECTION_INT( account_id1 )
- _CONTACTS_PROPERTY_PROJECTION_INT( account_id2 )
- _CONTACTS_PROPERTY_PROJECTION_INT( account_id3 )
_CONTACTS_PROPERTY_PROJECTION_STR( addressbook_ids )
_CONTACTS_PROPERTY_BOOL( has_phonenumber )
_CONTACTS_PROPERTY_BOOL( has_email )
@@ -591,6 +585,8 @@ _CONTACTS_BEGIN_READ_ONLY_VIEW()
_CONTACTS_PROPERTY_STR( source_name )
_CONTACTS_PROPERTY_PROJECTION_STR( status )
_CONTACTS_PROPERTY_INT( timestamp )
+ _CONTACTS_PROPERTY_STR( service_operation )
+ _CONTACTS_PROPERTY_STR( uri )
_CONTACTS_PROPERTY_PROJECTION_STR( sync_data1 )
_CONTACTS_PROPERTY_PROJECTION_STR( sync_data2 )
_CONTACTS_PROPERTY_PROJECTION_STR( sync_data3 )
diff --git a/native/ctsvc_db_init.c b/native/ctsvc_db_init.c
index 7cedd43..707522f 100644
--- a/native/ctsvc_db_init.c
+++ b/native/ctsvc_db_init.c
@@ -268,9 +268,6 @@ static int __ctsvc_db_create_views()
"persons.vibration, "
"status, "
"link_count, "
- "account_id1, "
- "account_id2, "
- "account_id3, "
"addressbook_ids, "
"persons.has_phonenumber, "
"persons.has_email, "
@@ -509,7 +506,8 @@ static int __ctsvc_db_create_views()
"data7, "
"data8, "
"data9, "
- "data10 "
+ "data10, "
+ "data11 "
"FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
"ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
"WHERE datatype = %d AND is_my_profile = 0 ",
@@ -549,6 +547,8 @@ static int __ctsvc_db_create_views()
"source_name, "
"status, "
"timestamp, "
+ "service_operation, "
+ "uri, "
"sync_data1, "
"sync_data2, "
"sync_data3, "
@@ -807,6 +807,8 @@ static int __ctsvc_db_create_views()
"AC.source_name, "
"AC.status, "
"AC.timestamp, "
+ "AC.service_operation, "
+ "AC.uri, "
"AC.sync_data1, "
"AC.sync_data2, "
"AC.sync_data3, "
diff --git a/native/ctsvc_db_plugin_activity.c b/native/ctsvc_db_plugin_activity.c
index 960efaf..bdfc9b7 100644
--- a/native/ctsvc_db_plugin_activity.c
+++ b/native/ctsvc_db_plugin_activity.c
@@ -116,9 +116,10 @@ static int __ctsvc_db_activity_insert_record( contacts_record_h record, int *id
}
snprintf(query, sizeof(query), "INSERT INTO "CTS_TABLE_ACTIVITIES"("
- "contact_id, source_name, status, timestamp, sync_data1, sync_data2, "
- "sync_data3, sync_data4) "
- "VALUES(%d, ?, ?, %d, ?, ?, ?, ?)",
+ "contact_id, source_name, status, timestamp, "
+ "service_operation, uri, "
+ "sync_data1, sync_data2, sync_data3, sync_data4) "
+ "VALUES(%d, ?, ?, %d, ?, ?, ?, ?, ?, ?)",
activity->contact_id, activity->timestamp);
stmt = cts_query_prepare(query);
@@ -132,14 +133,18 @@ static int __ctsvc_db_activity_insert_record( contacts_record_h record, int *id
cts_stmt_bind_text(stmt, 1, activity->source_name);
if (activity->status)
cts_stmt_bind_text(stmt, 2, activity->status);
+ if (activity->service_operation)
+ cts_stmt_bind_text(stmt, 3, activity->service_operation);
+ if (activity->uri)
+ cts_stmt_bind_text(stmt, 4, activity->uri);
if (activity->sync_data1)
- cts_stmt_bind_text(stmt, 3, activity->sync_data1);
+ cts_stmt_bind_text(stmt, 5, activity->sync_data1);
if (activity->sync_data2)
- cts_stmt_bind_text(stmt, 4, activity->sync_data2);
+ cts_stmt_bind_text(stmt, 6, activity->sync_data2);
if (activity->sync_data3)
- cts_stmt_bind_text(stmt, 5, activity->sync_data3);
+ cts_stmt_bind_text(stmt, 7, activity->sync_data3);
if (activity->sync_data4)
- cts_stmt_bind_text(stmt, 6, activity->sync_data4);
+ cts_stmt_bind_text(stmt, 8, activity->sync_data4);
ret = cts_stmt_step(stmt);
if (CONTACTS_ERROR_NONE != ret) {
@@ -221,6 +226,10 @@ static int __ctsvc_db_activity_value_set(cts_stmt stmt, contacts_record_h *recor
activity->status = SAFE_STRDUP(temp);
activity->timestamp = ctsvc_stmt_get_int(stmt, i++);
temp = ctsvc_stmt_get_text(stmt, i++);
+ activity->service_operation = SAFE_STRDUP(temp);
+ temp = ctsvc_stmt_get_text(stmt, i++);
+ activity->uri = SAFE_STRDUP(temp);
+ temp = ctsvc_stmt_get_text(stmt, i++);
activity->sync_data1 = SAFE_STRDUP(temp);
temp = ctsvc_stmt_get_text(stmt, i++);
activity->sync_data2 = SAFE_STRDUP(temp);
@@ -275,7 +284,8 @@ static int __ctsvc_db_activity_get_record( int id, contacts_record_h* out_record
contacts_record_h record;
snprintf(query, sizeof(query), "SELECT id, contact_id, source_name, status, "
- "timestamp, sync_data1, sync_data2, sync_data3, sync_data4 "
+ "timestamp, service_operation, uri, "
+ "sync_data1, sync_data2, sync_data3, sync_data4 "
"FROM "CTSVC_DB_VIEW_ACTIVITY" WHERE id = %d", id);
stmt = cts_query_prepare(query);
@@ -352,9 +362,7 @@ static int __ctsvc_db_activity_get_all_records( int offset, int limit,
contacts_list_h list;
len = snprintf(query, sizeof(query),
- "SELECT id, contact_id, source_name, status, "
- "timestamp, sync_data1, sync_data2, sync_data3, sync_data4 "
- "FROM "CTSVC_DB_VIEW_ACTIVITY);
+ "SELECT id FROM "CTSVC_DB_VIEW_ACTIVITY);
if (0 < limit) {
len += snprintf(query+len, sizeof(query)-len, " LIMIT %d", limit);
@@ -478,6 +486,14 @@ static int __ctsvc_db_activity_get_records_with_query( contacts_query_h query, i
case CTSVC_PROPERTY_ACTIVITY_TIMESTAMP:
activity->timestamp = ctsvc_stmt_get_int(stmt, i);
break;
+ case CTSVC_PROPERTY_ACTIVITY_SERVICE_OPERATION:
+ temp = ctsvc_stmt_get_text(stmt, i);
+ activity->service_operation = SAFE_STRDUP(temp);
+ break;
+ case CTSVC_PROPERTY_ACTIVITY_URI:
+ temp = ctsvc_stmt_get_text(stmt, i);
+ activity->uri = SAFE_STRDUP(temp);
+ break;
case CTSVC_PROPERTY_ACTIVITY_SYNC_DATA1:
temp = ctsvc_stmt_get_text(stmt, i);
activity->sync_data1 = SAFE_STRDUP(temp);
diff --git a/native/ctsvc_db_plugin_contact.c b/native/ctsvc_db_plugin_contact.c
index f295911..b5d8cdb 100644
--- a/native/ctsvc_db_plugin_contact.c
+++ b/native/ctsvc_db_plugin_contact.c
@@ -1209,7 +1209,9 @@ static int __ctsvc_db_contact_update_record( contacts_record_h record )
version = ctsvc_get_next_ver();
- ctsvc_db_create_set_query(record, &set, &bind_text);
+ ret = ctsvc_db_create_set_query(record, &set, &bind_text);
+ WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_db_create_set_query() Failed(%d)", ret);
+
if (set && *set)
len = snprintf(query_set, sizeof(query_set), "%s, ", set);
len += snprintf(query_set+len, sizeof(query_set)-len, " changed_ver=%d, changed_time=%d, has_phonenumber=%d, has_email=%d",
@@ -1740,7 +1742,7 @@ inline static int __ctsvc_find_person_to_link_with_number(const char *normalized
ret = ctsvc_clean_number(normalized_number, clean_num, sizeof(clean_num));
if (0 < ret) {
- ret = ctsvc_normalize_number(clean_num, normal_num, CTSVC_NUMBER_MAX_LEN, CTSVC_MIN_MATCH_NORMALIZED_NUMBER_SIZE);
+ ret = ctsvc_normalize_number(clean_num, normal_num, CTSVC_NUMBER_MAX_LEN, ctsvc_get_phonenumber_min_match_digit());
snprintf(query, sizeof(query),
"SELECT C.person_id FROM "CTS_TABLE_CONTACTS" C, "CTS_TABLE_DATA" D "
"ON C.contact_id=D.contact_id AND D.datatype=%d AND C.deleted = 0 "
diff --git a/native/ctsvc_db_plugin_contact_helper.c b/native/ctsvc_db_plugin_contact_helper.c
index b8f1238..7c98892 100644
--- a/native/ctsvc_db_plugin_contact_helper.c
+++ b/native/ctsvc_db_plugin_contact_helper.c
@@ -1073,7 +1073,7 @@ int ctsvc_contact_update_data_profile(contacts_list_h profile_list, int contact_
contacts_list_get_current_record_p(profile_list, &record);
profile = (ctsvc_profile_s*)record;
if (0 < profile->id) {
- if (profile->appsvc_operation)
+ if (profile->text)
ret = ctsvc_db_profile_update(record, is_my_profile);
else
ret = ctsvc_db_profile_delete(profile->id, is_my_profile);
diff --git a/native/ctsvc_db_plugin_grouprelation.c b/native/ctsvc_db_plugin_grouprelation.c
index bb37b9d..851f152 100644
--- a/native/ctsvc_db_plugin_grouprelation.c
+++ b/native/ctsvc_db_plugin_grouprelation.c
@@ -181,7 +181,7 @@ static int __ctsvc_db_grouprelation_get_records_with_query( contacts_query_h que
switch(property_id) {
case CTSVC_PROPERTY_GROUP_RELATION_CONTACT_ID:
- group_relation->id = ctsvc_stmt_get_int(stmt, i);
+ group_relation->contact_id = ctsvc_stmt_get_int(stmt, i);
break;
case CTSVC_PROPERTY_GROUP_RELATION_GROUP_ID:
group_relation->group_id = ctsvc_stmt_get_int(stmt, i);
diff --git a/native/ctsvc_db_plugin_my_profile.c b/native/ctsvc_db_plugin_my_profile.c
index 28d42de..fd31897 100644
--- a/native/ctsvc_db_plugin_my_profile.c
+++ b/native/ctsvc_db_plugin_my_profile.c
@@ -626,7 +626,9 @@ static int __ctsvc_db_my_profile_update_record( contacts_record_h record )
version = ctsvc_get_next_ver();
- ctsvc_db_create_set_query(record, &set, &bind_text);
+ ret = ctsvc_db_create_set_query(record, &set, &bind_text);
+ WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_db_create_set_query() Failed(%d)", ret);
+
if (set && *set)
len = snprintf(query_set, sizeof(query_set), "%s, ", set);
len += snprintf(query_set+len, sizeof(query_set)-len, " changed_ver=%d, changed_time=%d", version, (int)time(NULL));
diff --git a/native/ctsvc_db_plugin_number_helper.c b/native/ctsvc_db_plugin_number_helper.c
index 4a11043..c426877 100644
--- a/native/ctsvc_db_plugin_number_helper.c
+++ b/native/ctsvc_db_plugin_number_helper.c
@@ -27,6 +27,7 @@
#include "ctsvc_db_plugin_number_helper.h"
#include "ctsvc_record.h"
#include "ctsvc_notification.h"
+#include "ctsvc_setting.h"
int ctsvc_db_number_insert(contacts_record_h record, int contact_id, bool is_my_profile, int *id)
{
@@ -57,7 +58,7 @@ int ctsvc_db_number_insert(contacts_record_h record, int contact_id, bool is_my_
cts_stmt_bind_text(stmt, 2, number->number);
ret = ctsvc_clean_number(number->number, clean_num, sizeof(clean_num));
if (0 < ret) {
- ret = ctsvc_normalize_number(clean_num, normal_num, CTSVC_NUMBER_MAX_LEN, CTSVC_MIN_MATCH_NORMALIZED_NUMBER_SIZE);
+ ret = ctsvc_normalize_number(clean_num, normal_num, CTSVC_NUMBER_MAX_LEN, ctsvc_get_phonenumber_min_match_digit());
if (CONTACTS_ERROR_NONE == ret)
cts_stmt_bind_text(stmt, 3, normal_num);
}
@@ -130,7 +131,7 @@ int ctsvc_db_number_update(contacts_record_h record, bool is_my_profile)
if (ctsvc_record_check_property_flag((ctsvc_record_s *)record, CTSVC_PROPERTY_NUMBER_NUMBER, CTSVC_PROPERTY_FLAG_DIRTY)) {
ret = ctsvc_clean_number(number->number, clean_num, sizeof(clean_num));
if (0 < ret) {
- ret = ctsvc_normalize_number(clean_num, normal_num, CTSVC_NUMBER_MAX_LEN, CTSVC_MIN_MATCH_NORMALIZED_NUMBER_SIZE);
+ ret = ctsvc_normalize_number(clean_num, normal_num, CTSVC_NUMBER_MAX_LEN, ctsvc_get_phonenumber_min_match_digit());
if (CONTACTS_ERROR_NONE == ret) {
char query_set[CTS_SQL_MAX_LEN] = {0};
snprintf(query_set, sizeof(query_set), "%s, data4=?", set);
diff --git a/native/ctsvc_db_plugin_person.c b/native/ctsvc_db_plugin_person.c
index ff9a4de..a5faaa8 100644
--- a/native/ctsvc_db_plugin_person.c
+++ b/native/ctsvc_db_plugin_person.c
@@ -85,9 +85,6 @@ static int __ctsvc_db_person_get_record( int id, contacts_record_h* out_record )
"persons.vibration, "
"status, "
"link_count, "
- "account_id1, "
- "account_id2, "
- "account_id3, "
"addressbook_ids, "
"persons.has_phonenumber, "
"persons.has_email, "
@@ -416,9 +413,6 @@ static int __ctsvc_db_person_get_all_records( int offset, int limit, contacts_li
"vibration, "
"status, "
"link_count, "
- "account_id1, "
- "account_id2, "
- "account_id3, "
"addressbook_ids, "
"has_phonenumber, "
"has_email, "
@@ -548,15 +542,6 @@ static int __ctsvc_db_person_get_records_with_query( contacts_query_h query, int
case CTSVC_PROPERTY_PERSON_LINK_COUNT:
person->link_count = ctsvc_stmt_get_int(stmt, i);
break;
- case CTSVC_PROPERTY_PERSON_ACCOUNT_ID1:
- person->account_id1 = ctsvc_stmt_get_int(stmt, i);
- break;
- case CTSVC_PROPERTY_PERSON_ACCOUNT_ID2:
- person->account_id2 = ctsvc_stmt_get_int(stmt, i);
- break;
- case CTSVC_PROPERTY_PERSON_ACCOUNT_ID3:
- person->account_id3 = ctsvc_stmt_get_int(stmt, i);
- break;
case CTSVC_PROPERTY_PERSON_ADDRESSBOOK_IDS:
temp = ctsvc_stmt_get_text(stmt, i);
person->addressbook_ids = SAFE_STRDUP(temp);
diff --git a/native/ctsvc_db_plugin_person_helper.c b/native/ctsvc_db_plugin_person_helper.c
index dd62644..92ebaf2 100755
--- a/native/ctsvc_db_plugin_person_helper.c
+++ b/native/ctsvc_db_plugin_person_helper.c
@@ -92,15 +92,6 @@ int ctsvc_db_person_create_record_from_stmt_with_projection(cts_stmt stmt, unsig
case CTSVC_PROPERTY_PERSON_LINK_COUNT:
person->link_count = ctsvc_stmt_get_int(stmt, i);
break;
- case CTSVC_PROPERTY_PERSON_ACCOUNT_ID1:
- person->account_id1 = ctsvc_stmt_get_int(stmt, i);
- break;
- case CTSVC_PROPERTY_PERSON_ACCOUNT_ID2:
- person->account_id2 = ctsvc_stmt_get_int(stmt, i);
- break;
- case CTSVC_PROPERTY_PERSON_ACCOUNT_ID3:
- person->account_id3 = ctsvc_stmt_get_int(stmt, i);
- break;
case CTSVC_PROPERTY_PERSON_ADDRESSBOOK_IDS:
temp = ctsvc_stmt_get_text(stmt, i);
person->addressbook_ids = SAFE_STRDUP(temp);
@@ -182,9 +173,6 @@ int ctsvc_db_person_create_record_from_stmt(cts_stmt stmt, contacts_record_h *re
person->status = SAFE_STRDUP(temp);
person->link_count = ctsvc_stmt_get_int(stmt, i++);
- person->account_id1 = ctsvc_stmt_get_int(stmt, i++);
- person->account_id2 = ctsvc_stmt_get_int(stmt, i++);
- person->account_id3 = ctsvc_stmt_get_int(stmt, i++);
temp = ctsvc_stmt_get_text(stmt, i++);
person->addressbook_ids = SAFE_STRDUP(temp);
@@ -269,7 +257,7 @@ int ctsvc_db_insert_person(contacts_record_h record)
cts_stmt stmt = NULL;
char query[CTS_SQL_MIN_LEN] = {0};
contacts_record_h addressbook;
- int account_id, version;
+ int version;
ctsvc_contact_s *contact = (ctsvc_contact_s*)record;
char *status = NULL;
@@ -278,7 +266,6 @@ int ctsvc_db_insert_person(contacts_record_h record)
CTS_ERR("contacts_svc_get_addressbook() Failed\n");
return CONTACTS_ERROR_DB;
}
- contacts_record_get_int(addressbook, _contacts_address_book.account_id, &account_id);
contacts_record_destroy(addressbook, true);
snprintf(query, sizeof(query),
@@ -300,10 +287,10 @@ int ctsvc_db_insert_person(contacts_record_h record)
snprintf(query, sizeof(query),
"INSERT INTO "CTS_TABLE_PERSONS"(name_contact_id, created_ver, changed_ver, "
"has_phonenumber, has_email, ringtone_path, vibration, status, "
- "image_thumbnail_path, link_count, account_id1, addressbook_ids) "
- "VALUES(%d, %d, %d, %d, %d, ?, ?, ?, ?, 1, %d, '%d') ",
+ "image_thumbnail_path, link_count, addressbook_ids) "
+ "VALUES(%d, %d, %d, %d, %d, ?, ?, ?, ?, 1, '%d') ",
contact->id, version, version,
- contact->has_phonenumber, contact->has_email, account_id, contact->addressbook_id);
+ contact->has_phonenumber, contact->has_email, contact->addressbook_id);
stmt = cts_query_prepare(query);
if (NULL == stmt) {
diff --git a/native/ctsvc_db_plugin_phonelog.c b/native/ctsvc_db_plugin_phonelog.c
index 7848c06..18963d1 100644
--- a/native/ctsvc_db_plugin_phonelog.c
+++ b/native/ctsvc_db_plugin_phonelog.c
@@ -30,6 +30,7 @@
#include "ctsvc_db_query.h"
#include "ctsvc_db_init.h"
#include "ctsvc_notification.h"
+#include "ctsvc_setting.h"
#ifdef _CONTACTS_IPC_SERVER
#include "ctsvc_server_change_subject.h"
@@ -406,7 +407,7 @@ static int __ctsvc_db_phonelog_insert(ctsvc_phonelog_s *phonelog, int *id)
if (phonelog->log_type < CONTACTS_PLOG_TYPE_EMAIL_RECEIVED) {
ret = ctsvc_clean_number(phonelog->address, clean_num, sizeof(clean_num));
if (0 < ret) {
- ret = ctsvc_normalize_number(clean_num, normal_num, CTSVC_NUMBER_MAX_LEN, CTSVC_MIN_MATCH_NORMALIZED_NUMBER_SIZE);
+ ret = ctsvc_normalize_number(clean_num, normal_num, CTSVC_NUMBER_MAX_LEN, ctsvc_get_phonenumber_min_match_digit());
cts_stmt_bind_text(stmt, 2, normal_num);
}
}
diff --git a/native/ctsvc_db_plugin_profile.c b/native/ctsvc_db_plugin_profile.c
index 0833158..a098866 100644
--- a/native/ctsvc_db_plugin_profile.c
+++ b/native/ctsvc_db_plugin_profile.c
@@ -64,8 +64,8 @@ static int __ctsvc_db_profile_insert_record( contacts_record_h record, int *id )
char query[CTS_SQL_MAX_LEN] = {0};
ctsvc_profile_s *profile = (ctsvc_profile_s *)record;
- RETVM_IF(NULL == profile->appsvc_operation, CONTACTS_ERROR_INVALID_PARAMETER,
- "Invalid parameter : profile uid is NULL");
+ RETVM_IF(NULL == profile->text, CONTACTS_ERROR_INVALID_PARAMETER,
+ "Invalid parameter : profile text is NULL");
ret = ctsvc_begin_trans();
if (CONTACTS_ERROR_NONE != ret) {
@@ -148,7 +148,7 @@ static int __ctsvc_db_profile_update_record( contacts_record_h record )
int contact_id;
char query[CTS_SQL_MAX_LEN] = {0};
ctsvc_profile_s *profile = (ctsvc_profile_s *)record;
- RETVM_IF(NULL == profile->appsvc_operation, CONTACTS_ERROR_INVALID_PARAMETER, "appsvc_operation is empty");
+ RETVM_IF(NULL == profile->text, CONTACTS_ERROR_INVALID_PARAMETER, "profile text is empty");
ret = ctsvc_begin_trans();
if (CONTACTS_ERROR_NONE != ret) {
@@ -248,7 +248,7 @@ static int __ctsvc_db_profile_get_all_records( int offset, int limit, contacts_l
len = snprintf(query, sizeof(query),
"SELECT id, data.contact_id, is_default, data1, data2, "
- "data3, data4, data5, data6, data7, data8, data9, data10 "
+ "data3, data4, data5, data6, data7, data8, data9, data10, data11 "
"FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
"ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
"WHERE datatype = %d AND is_my_profile=0 ",
@@ -353,25 +353,29 @@ static int __ctsvc_db_profile_get_records_with_query( contacts_query_h query, in
case CTSVC_PROPERTY_PROFILE_ORDER:
profile->order = ctsvc_stmt_get_int(stmt, i);
break;
- case CTSVC_PROPERTY_PROFILE_APPSVC_OPERATION:
+ case CTSVC_PROPERTY_PROFILE_SERVICE_OPERATION:
temp = ctsvc_stmt_get_text(stmt, i);
- profile->appsvc_operation = SAFE_STRDUP(temp);
+ profile->service_operation = SAFE_STRDUP(temp);
break;
- case CTSVC_PROPERTY_PROFILE_DATA1:
+ case CTSVC_PROPERTY_PROFILE_MIME:
temp = ctsvc_stmt_get_text(stmt, i);
- profile->data1 = SAFE_STRDUP(temp);
+ profile->mime = SAFE_STRDUP(temp);
break;
- case CTSVC_PROPERTY_PROFILE_DATA2:
+ case CTSVC_PROPERTY_PROFILE_APP_ID:
temp = ctsvc_stmt_get_text(stmt, i);
- profile->data2 = SAFE_STRDUP(temp);
+ profile->app_id = SAFE_STRDUP(temp);
break;
- case CTSVC_PROPERTY_PROFILE_DATA3:
+ case CTSVC_PROPERTY_PROFILE_URI:
temp = ctsvc_stmt_get_text(stmt, i);
- profile->data3 = SAFE_STRDUP(temp);
+ profile->uri = SAFE_STRDUP(temp);
break;
- case CTSVC_PROPERTY_PROFILE_DATA4:
+ case CTSVC_PROPERTY_PROFILE_CATEGORY:
temp = ctsvc_stmt_get_text(stmt, i);
- profile->data4 = SAFE_STRDUP(temp);
+ profile->category = SAFE_STRDUP(temp);
+ break;
+ case CTSVC_PROPERTY_PROFILE_EXTRA_DATA:
+ temp = ctsvc_stmt_get_text(stmt, i);
+ profile->extra_data = SAFE_STRDUP(temp);
break;
default:
break;
diff --git a/native/ctsvc_db_plugin_profile_helper.c b/native/ctsvc_db_plugin_profile_helper.c
index d0074dc..e00cab0 100644
--- a/native/ctsvc_db_plugin_profile_helper.c
+++ b/native/ctsvc_db_plugin_profile_helper.c
@@ -49,15 +49,17 @@ int ctsvc_db_profile_get_value_from_stmt(cts_stmt stmt, contacts_record_h *recor
profile->text = SAFE_STRDUP(temp);
profile->order = ctsvc_stmt_get_int(stmt, start_count++);
temp = ctsvc_stmt_get_text(stmt, start_count++);
- profile->appsvc_operation = SAFE_STRDUP(temp);
+ profile->service_operation = SAFE_STRDUP(temp);
temp = ctsvc_stmt_get_text(stmt, start_count++);
- profile->data1 = SAFE_STRDUP(temp);
+ profile->mime = SAFE_STRDUP(temp);
temp = ctsvc_stmt_get_text(stmt, start_count++);
- profile->data2 = SAFE_STRDUP(temp);
+ profile->app_id = SAFE_STRDUP(temp);
temp = ctsvc_stmt_get_text(stmt, start_count++);
- profile->data3 = SAFE_STRDUP(temp);
+ profile->uri = SAFE_STRDUP(temp);
temp = ctsvc_stmt_get_text(stmt, start_count++);
- profile->data4 = SAFE_STRDUP(temp);
+ profile->category = SAFE_STRDUP(temp);
+ temp = ctsvc_stmt_get_text(stmt, start_count++);
+ profile->extra_data = SAFE_STRDUP(temp);
*record = (contacts_record_h)profile;
return CONTACTS_ERROR_NONE;
@@ -72,16 +74,18 @@ static inline int __ctsvc_profile_bind_stmt(cts_stmt stmt, ctsvc_profile_s *prof
if (profile->text)
cts_stmt_bind_text(stmt, start_cnt+2, profile->text);
cts_stmt_bind_int(stmt, start_cnt+3, profile->order);
- if (profile->appsvc_operation)
- cts_stmt_bind_text(stmt, start_cnt+4, profile->appsvc_operation);
- if (profile->data1)
- cts_stmt_bind_text(stmt, start_cnt+5, profile->data1);
- if (profile->data2)
- cts_stmt_bind_text(stmt, start_cnt+6, profile->data2);
- if (profile->data3)
- cts_stmt_bind_text(stmt, start_cnt+7, profile->data3);
- if (profile->data4)
- cts_stmt_bind_text(stmt, start_cnt+8, profile->data4);
+ if (profile->service_operation)
+ cts_stmt_bind_text(stmt, start_cnt+4, profile->service_operation);
+ if (profile->mime)
+ cts_stmt_bind_text(stmt, start_cnt+5, profile->mime);
+ if (profile->app_id)
+ cts_stmt_bind_text(stmt, start_cnt+6, profile->app_id);
+ if (profile->uri)
+ cts_stmt_bind_text(stmt, start_cnt+7, profile->uri);
+ if (profile->category)
+ cts_stmt_bind_text(stmt, start_cnt+8, profile->category);
+ if (profile->extra_data)
+ cts_stmt_bind_text(stmt, start_cnt+9, profile->extra_data);
return CONTACTS_ERROR_NONE;
}
@@ -92,7 +96,7 @@ int ctsvc_db_profile_insert(contacts_record_h record, int contact_id, bool is_my
char query[CTS_SQL_MAX_LEN] = {0};
ctsvc_profile_s *profile = (ctsvc_profile_s *)record;
- RETV_IF(NULL == profile->appsvc_operation, CONTACTS_ERROR_NONE);
+ RETV_IF(NULL == profile->service_operation, CONTACTS_ERROR_NONE);
RETVM_IF(contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
"Invalid parameter : contact_id(%d) is mandatory field to insert profile record ", profile->contact_id);
RETVM_IF(0 < profile->id, CONTACTS_ERROR_INVALID_PARAMETER,
@@ -100,8 +104,8 @@ int ctsvc_db_profile_insert(contacts_record_h record, int contact_id, bool is_my
snprintf(query, sizeof(query),
"INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, data1, data2, data3, data4, data5, "
- "data6, data7, data8, data9, data10) "
- "VALUES(%d, %d, %d, %d, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
+ "data6, data7, data8, data9, data10, data11) "
+ "VALUES(%d, %d, %d, %d, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
contact_id, is_my_profile, CTSVC_DATA_PROFILE, profile->type);
stmt = cts_query_prepare(query);
diff --git a/native/ctsvc_db_query.c b/native/ctsvc_db_query.c
index d610296..6bcb479 100755
--- a/native/ctsvc_db_query.c
+++ b/native/ctsvc_db_query.c
@@ -35,6 +35,7 @@
#include "ctsvc_view.h"
#include "ctsvc_inotify.h"
#include "ctsvc_localize.h"
+#include "ctsvc_setting.h"
#include "ctsvc_db_plugin_person_helper.h"
@@ -265,7 +266,7 @@ static inline int __ctsvc_db_create_str_condition(ctsvc_composite_filter_s *com_
if (filter->value.s) {
if (filter->property_id == CTSVC_PROPERTY_NUMBER_NUMBER_FILTER) {
char dest[strlen(filter->value.s)+1];
- ret = ctsvc_normalize_number(filter->value.s, dest, sizeof(dest), CTSVC_MIN_MATCH_NORMALIZED_NUMBER_SIZE);
+ ret = ctsvc_normalize_number(filter->value.s, dest, sizeof(dest), ctsvc_get_phonenumber_min_match_digit());
if (CONTACTS_ERROR_NONE == ret)
*bind_text = g_slist_append(*bind_text, strdup(dest));
else
diff --git a/packaging/contacts-service.spec b/packaging/contacts-service.spec
index d1c8bc2..cea2629 100644
--- a/packaging/contacts-service.spec
+++ b/packaging/contacts-service.spec
@@ -1,6 +1,6 @@
Name: contacts-service
Summary: Contacts Service
-Version: 0.9.59
+Version: 0.9.61
Release: 1
Group: TO_BE/FILLED_IN
License: Apache-2.0
@@ -83,8 +83,8 @@ chmod 660 /opt/usr/dbspace/.contacts-svc.db-journal
chmod 775 /opt/usr/data/contacts-svc
chmod 770 -R /opt/usr/data/contacts-svc/img/
chmod 660 /opt/usr/data/contacts-svc/.CONTACTS_SVC_*
-vconftool set -t int file/private/contacts-service/default_lang 100
+vconftool set -t int file/private/contacts-service/default_lang 100 -g 6005
vconftool set -t int db/contacts-svc/name_sorting_order 0 -g 6005
vconftool set -t int db/contacts-svc/name_display_order 0 -g 6005
vconftool set -t int db/contacts-svc/phonenumber_min_match_digit 8 -g 6005
@@ -109,8 +109,6 @@ vconftool set -t int db/contacts-svc/phonenumber_min_match_digit 8 -g 6005
%files -n contacts-service2-devel
%defattr(-,root,root,-)
-%{_libdir}/libcontacts-service2.so.*
-%{_libdir}/libcontacts-service3.so.*
%{_libdir}/libcontacts-service2.so
%{_libdir}/libcontacts-service3.so
%{_libdir}/pkgconfig/contacts-service2.pc
diff --git a/schema.sql b/schema.sql
index 4e22529..4e331d4 100755
--- a/schema.sql
+++ b/schema.sql
@@ -364,6 +364,8 @@ CREATE TABLE activities
source_name TEXT,
status TEXT,
timestamp INTEGER,
+ service_operation TEXT,
+ uri TEXT,
sync_data1 TEXT,
sync_data2 TEXT,
sync_data3 TEXT,
diff --git a/server/ctsvc_server_sim.c b/server/ctsvc_server_sim.c
index 4167bf5..1f12c79 100755
--- a/server/ctsvc_server_sim.c
+++ b/server/ctsvc_server_sim.c
@@ -49,7 +49,7 @@
static TapiHandle *ghandle = NULL;
static TelSimPbType_t gsim_type = TAPI_SIM_PB_UNKNOWNN;
static void* greturn_data = NULL;
-static int gsim_addressbook_id =0;
+static int gsim_addressbook_id = -1;
typedef struct {
unsigned int index_max;