re-add server side using functions 77/45677/1
authorGukhwan Cho <gh78.cho@samsung.com>
Fri, 10 Jul 2015 12:18:46 +0000 (21:18 +0900)
committerMyoungHoon Chae <mhoon.chae@samsung.com>
Mon, 10 Aug 2015 09:06:31 +0000 (18:06 +0900)
Change-Id: I2e5fc2788a0e9ca50c9eae6af55fab625b8bd1e9
Signed-off-by: Gukhwan Cho <gh78.cho@samsung.com>
common/ctsvc_record_contact.c
common/ctsvc_record_person.c
common/ctsvc_record_result.c
common/ctsvc_record_sdn.c
common/ctsvc_record_speeddial.c

index efadad9..e20ac29 100644 (file)
@@ -108,8 +108,10 @@ static int __ctsvc_event_clone(contacts_record_h record, contacts_record_h *out_
 static int __ctsvc_event_get_int(contacts_record_h record, unsigned int property_id, int *out);
 static int __ctsvc_event_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
 static int __ctsvc_event_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_event_get_bool(contacts_record_h record, unsigned int property_id, bool *value);
 static int __ctsvc_event_set_int(contacts_record_h record, unsigned int property_id, int value);
 static int __ctsvc_event_set_str(contacts_record_h record, unsigned int property_id, const char* str);
+static int __ctsvc_event_set_bool(contacts_record_h record, unsigned int property_id, bool value);
 
 static int __ctsvc_extension_create(contacts_record_h *out_record);
 static int __ctsvc_extension_destroy(contacts_record_h record, bool delete_child);
@@ -127,6 +129,7 @@ static int __ctsvc_group_relation_get_int(contacts_record_h record, unsigned int
 static int __ctsvc_group_relation_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
 static int __ctsvc_group_relation_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
 static int __ctsvc_group_relation_set_int(contacts_record_h record, unsigned int property_id, int value);
+static int __ctsvc_group_relation_set_str(contacts_record_h record, unsigned int property_id, const char* str);
 
 static int __ctsvc_messenger_create(contacts_record_h *out_record);
 static int __ctsvc_messenger_destroy(contacts_record_h record, bool delete_child);
@@ -211,6 +214,8 @@ static int __ctsvc_simple_contact_get_bool(contacts_record_h record, unsigned in
 static int __ctsvc_simple_contact_get_int(contacts_record_h record, unsigned int property_id, int *out);
 static int __ctsvc_simple_contact_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
 static int __ctsvc_simple_contact_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_simple_contact_set_int(contacts_record_h record, unsigned int property_id, int value);
+static int __ctsvc_simple_contact_set_str(contacts_record_h record, unsigned int property_id, const char* str);
 
 static int __ctsvc_url_create(contacts_record_h *out_record);
 static int __ctsvc_url_destroy(contacts_record_h record, bool delete_child);
@@ -318,12 +323,12 @@ ctsvc_record_plugin_cb_s event_plugin_cbs = {
        .get_str = __ctsvc_event_get_str,
        .get_str_p = __ctsvc_event_get_str_p,
        .get_int = __ctsvc_event_get_int,
-       .get_bool = NULL,
+       .get_bool = __ctsvc_event_get_bool,
        .get_lli = NULL,
        .get_double = NULL,
        .set_str = __ctsvc_event_set_str,
        .set_int = __ctsvc_event_set_int,
-       .set_bool = NULL,
+       .set_bool = __ctsvc_event_set_bool,
        .set_lli = NULL,
        .set_double = NULL,
        .add_child_record = NULL,
@@ -453,7 +458,7 @@ ctsvc_record_plugin_cb_s group_relation_plugin_cbs = {
        .get_bool = NULL,
        .get_lli = NULL,
        .get_double = NULL,
-       .set_str = NULL,
+       .set_str = __ctsvc_group_relation_set_str,
        .set_int = __ctsvc_group_relation_set_int,
        .set_bool = NULL,
        .set_lli = NULL,
@@ -629,8 +634,8 @@ ctsvc_record_plugin_cb_s simple_contact_plugin_cbs = {
        .get_bool = __ctsvc_simple_contact_get_bool,
        .get_lli = NULL,
        .get_double = NULL,
-       .set_str = NULL,
-       .set_int = NULL,
+       .set_str = __ctsvc_simple_contact_set_str,
+       .set_int = __ctsvc_simple_contact_set_int,
        .set_bool = NULL,
        .set_lli = NULL,
        .set_double = NULL,
@@ -1863,6 +1868,32 @@ static int __ctsvc_contact_set_int(contacts_record_h record, unsigned int proper
        return CONTACTS_ERROR_NONE;
 }
 
+static int __ctsvc_simple_contact_set_int(contacts_record_h record, unsigned int property_id, int value)
+{
+       ctsvc_simple_contact_s *contact = (ctsvc_simple_contact_s *)record;
+
+       switch(property_id) {
+       case CTSVC_PROPERTY_CONTACT_ID:
+               contact->contact_id = value;
+               break;
+       case CTSVC_PROPERTY_CONTACT_DISPLAY_SOURCE_DATA_ID:
+               contact->display_source_type = value;
+               break;
+       case CTSVC_PROPERTY_CONTACT_PERSON_ID:
+               contact->person_id = value;
+               break;
+       case CTSVC_PROPERTY_CONTACT_ADDRESSBOOK_ID:
+               RETVM_IF(0 < contact->contact_id, CONTACTS_ERROR_INVALID_PARAMETER,
+                               "Invalide parameter : property_id(%d) is a read-only value (contact)", property_id);
+               contact->addressbook_id = value;
+               break;
+       default:
+               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(simple contact)", property_id);
+               return CONTACTS_ERROR_INVALID_PARAMETER;
+       }
+       return CONTACTS_ERROR_NONE;
+}
+
 static int __ctsvc_name_set_int(contacts_record_h record, unsigned int property_id, int value)
 {
        ctsvc_name_s *name = (ctsvc_name_s *)record;
@@ -3233,6 +3264,40 @@ static int __ctsvc_contact_set_str(contacts_record_h record, unsigned int proper
 }
 
 
+static int __ctsvc_simple_contact_set_str(contacts_record_h record, unsigned int property_id, const char* str)
+{
+       ctsvc_simple_contact_s *contact = (ctsvc_simple_contact_s *)record;
+
+       switch(property_id) {
+       case CTSVC_PROPERTY_CONTACT_DISPLAY_NAME:
+               FREEandSTRDUP(contact->display_name, str);
+               break;
+/*
+               CTS_ERR("Invalid parameter : property_id(%d) is a read-only value (contact)", property_id);
+               return CONTACTS_ERROR_INVALID_PARAMETER;
+*/
+       case CTSVC_PROPERTY_CONTACT_RINGTONE:
+               FREEandSTRDUP(contact->ringtone_path, str);
+               break;
+       case CTSVC_PROPERTY_CONTACT_IMAGE_THUMBNAIL:
+               FREEandSTRDUP(contact->image_thumbnail_path, str);
+               break;
+       case CTSVC_PROPERTY_CONTACT_UID:
+               FREEandSTRDUP(contact->uid, str);
+               break;
+       case CTSVC_PROPERTY_CONTACT_VIBRATION:
+               FREEandSTRDUP(contact->vibration, str);
+               break;
+       case CTSVC_PROPERTY_CONTACT_MESSAGE_ALERT:
+               FREEandSTRDUP(contact->message_alert, str);
+               break;
+       default :
+               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(simple_contact)", property_id);
+               return CONTACTS_ERROR_INVALID_PARAMETER;
+       }
+       return CONTACTS_ERROR_NONE;
+}
+
 static int __ctsvc_name_set_str(contacts_record_h record, unsigned int property_id, const char* str)
 {
        ctsvc_name_s *name = (ctsvc_name_s *)record;
@@ -3468,6 +3533,25 @@ static int __ctsvc_messenger_set_str(contacts_record_h record, unsigned int prop
        return CONTACTS_ERROR_NONE;
 }
 
+static int __ctsvc_group_relation_set_str(contacts_record_h record, unsigned int property_id, const char* str)
+{
+       ctsvc_group_relation_s *group_relation = (ctsvc_group_relation_s *)record;
+
+       switch(property_id) {
+       case CTSVC_PROPERTY_GROUP_RELATION_GROUP_NAME:
+               FREEandSTRDUP(group_relation->group_name, str);
+               break;
+/*
+               CTS_ERR("Invalid parameter : property_id(%d) is a read-only value (group_relation)", property_id);
+               return CONTACTS_ERROR_INVALID_PARAMETER;
+*/
+       default :
+               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(group_relation)", property_id);
+               return CONTACTS_ERROR_INVALID_PARAMETER;
+       }
+       return CONTACTS_ERROR_NONE;
+}
+
 static int __ctsvc_activity_set_str(contacts_record_h record, unsigned int property_id, const char* str)
 {
        ctsvc_activity_s *activity = (ctsvc_activity_s *)record;
@@ -3697,6 +3781,20 @@ static int __ctsvc_email_get_bool(contacts_record_h record, unsigned int propert
        return CONTACTS_ERROR_NONE;
 }
 
+static int __ctsvc_event_get_bool(contacts_record_h record, unsigned int property_id, bool *value)
+{
+       ctsvc_event_s *event = (ctsvc_event_s *)record;
+       switch (property_id) {
+       case CTSVC_PROPERTY_EVENT_IS_LEAP_MONTH: /* deprecated */
+               *value = event->is_leap_month;
+               break;
+       default:
+               CTS_ERR("Invalid parameter : property_id(0x%x) is not supported in value(event)", property_id);
+               return CONTACTS_ERROR_INVALID_PARAMETER;
+       }
+       return CONTACTS_ERROR_NONE;
+}
+
 static int __ctsvc_image_get_bool(contacts_record_h record, unsigned int property_id, bool *value)
 {
        ctsvc_image_s *image = (ctsvc_image_s *)record;
@@ -3780,6 +3878,21 @@ static int __ctsvc_email_set_bool(contacts_record_h record, unsigned int propert
        return CONTACTS_ERROR_NONE;
 }
 
+static int __ctsvc_event_set_bool(contacts_record_h record, unsigned int property_id, bool value)
+{
+       ctsvc_event_s *event = (ctsvc_event_s *)record;
+
+       switch(property_id) {
+       case CTSVC_PROPERTY_EVENT_IS_LEAP_MONTH: /* deprecated */
+               event->is_leap_month = value;
+               break;
+       default:
+               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(event)", property_id);
+               return CONTACTS_ERROR_INVALID_PARAMETER;
+       }
+       return CONTACTS_ERROR_NONE;
+}
+
 static int __ctsvc_image_set_bool(contacts_record_h record, unsigned int property_id, bool value)
 {
        ctsvc_image_s *image = (ctsvc_image_s *)record;
index 0e30445..f56f368 100644 (file)
@@ -29,6 +29,7 @@ static int __ctsvc_person_get_int(contacts_record_h record, unsigned int propert
 static int __ctsvc_person_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
 static int __ctsvc_person_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
 static int __ctsvc_person_get_bool(contacts_record_h record, unsigned int property_id, bool *value);
+static int __ctsvc_person_set_int(contacts_record_h record, unsigned int property_id, int value);
 static int __ctsvc_person_set_str(contacts_record_h record, unsigned int property_id, const char* str);
 static int __ctsvc_person_set_bool(contacts_record_h record, unsigned int property_id, bool value);
 
@@ -44,7 +45,7 @@ ctsvc_record_plugin_cb_s person_plugin_cbs = {
        .get_lli = NULL,
        .get_double = NULL,
        .set_str = __ctsvc_person_set_str,
-       .set_int = NULL,
+       .set_int = __ctsvc_person_set_int,
        .set_bool = __ctsvc_person_set_bool,
        .set_lli = NULL,
        .set_double = NULL,
@@ -206,6 +207,27 @@ static int __ctsvc_person_get_bool(contacts_record_h record, unsigned int proper
        return CONTACTS_ERROR_NONE;
 }
 
+static int __ctsvc_person_set_int(contacts_record_h record, unsigned int property_id, int value)
+{
+       ctsvc_person_s *person = (ctsvc_person_s *)record;
+
+       switch(property_id) {
+       case CTSVC_PROPERTY_PERSON_DISPLAY_CONTACT_ID:
+               person->name_contact_id = value;
+               break;
+       case CTSVC_PROPERTY_PERSON_ID:
+               person->person_id = value;
+               break;
+       case CTSVC_PROPERTY_PERSON_LINK_COUNT:
+               person->link_count = value;
+               break;
+       default:
+               CTS_ERR("This field(0x%0x) is not supported in value(person)", property_id);
+               return CONTACTS_ERROR_INVALID_PARAMETER;
+       }
+       return CONTACTS_ERROR_NONE;
+}
+
 static int __ctsvc_person_set_str(contacts_record_h record, unsigned int property_id, const char* str)
 {
        ctsvc_person_s *person = (ctsvc_person_s *)record;
index 06ee532..1628a63 100644 (file)
@@ -33,6 +33,10 @@ static int __ctsvc_result_clone(contacts_record_h record, contacts_record_h *out
 static int __ctsvc_result_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
 static int __ctsvc_result_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
 static int __ctsvc_result_get_int(contacts_record_h record, unsigned int property_id, int* out_value);
+static int __ctsvc_result_get_bool(contacts_record_h record, unsigned int property_id, bool* out_value);
+static int __ctsvc_result_set_int(contacts_record_h record, unsigned int property_id, int value);
+static int __ctsvc_result_set_bool(contacts_record_h record, unsigned int property_id, bool value);
+static int __ctsvc_result_set_str(contacts_record_h record, unsigned int property_id, const char *str);
 
 ctsvc_record_plugin_cb_s result_plugin_cbs = {
        .create = __ctsvc_result_create,
@@ -41,12 +45,12 @@ ctsvc_record_plugin_cb_s result_plugin_cbs = {
        .get_str = __ctsvc_result_get_str,
        .get_str_p = __ctsvc_result_get_str_p,
        .get_int = __ctsvc_result_get_int,
-       .get_bool = NULL,
+       .get_bool = __ctsvc_result_get_bool,
        .get_lli = NULL,
        .get_double = NULL,
-       .set_str = NULL,
-       .set_int = NULL,
-       .set_bool = NULL,
+       .set_str = __ctsvc_result_set_str,
+       .set_int = __ctsvc_result_set_int,
+       .set_bool = __ctsvc_result_set_bool,
        .set_lli = NULL,
        .set_double = NULL,
        .add_child_record = NULL,
@@ -200,3 +204,172 @@ static int __ctsvc_result_get_int(contacts_record_h record, unsigned int propert
        return CONTACTS_ERROR_NO_DATA;
 }
 
+static int __ctsvc_result_set_int(contacts_record_h record, unsigned int property_id, int value)
+{
+       ctsvc_result_s* result = (ctsvc_result_s *)record;
+       GSList *cursor;
+       ctsvc_result_value_s *data;
+
+       /* TODO: check the value type of property_id is int */
+       for (cursor = result->values;cursor;cursor=cursor->next) {
+               data = cursor->data;
+               if (data->property_id == property_id) {
+                       if (data->type == CTSVC_VIEW_DATA_TYPE_INT) {
+#ifdef _CONTACTS_IPC_SERVER
+                               if (property_id == CTSVC_PROPERTY_PHONELOG_SIM_SLOT_NO)
+                                       data->value.i = ctsvc_server_sim_get_sim_slot_no_by_info_id(value);
+                               else
+#endif /* _CONTACTS_IPC_SERVER */
+                               data->value.i = value;
+                               return CONTACTS_ERROR_NONE;
+                       }
+                       else {
+                               CTS_ERR("use another get_type API, (type : %d)", data->type);
+                               return CONTACTS_ERROR_INVALID_PARAMETER;
+                       }
+               }
+       }
+
+       data = calloc(1, sizeof(ctsvc_result_value_s));
+       if (NULL == data) {
+               CTS_ERR("calloc() Fail");
+               return CONTACTS_ERROR_OUT_OF_MEMORY;
+       }
+       data->property_id = property_id;
+       data->type = CTSVC_VIEW_DATA_TYPE_INT;
+#ifdef _CONTACTS_IPC_SERVER
+       if (property_id == CTSVC_PROPERTY_PHONELOG_SIM_SLOT_NO)
+               data->value.i = ctsvc_server_sim_get_sim_slot_no_by_info_id(value);
+       else
+#endif /* _CONTACTS_IPC_SERVER */
+       data->value.i = value;
+       result->values = g_slist_append(result->values, (void*)data);
+       return CONTACTS_ERROR_NONE;
+}
+
+static int __ctsvc_result_set_bool(contacts_record_h record, unsigned int property_id, bool value)
+{
+       ctsvc_result_s* result = (ctsvc_result_s *)record;
+       GSList *cursor;
+       ctsvc_result_value_s *data;
+
+       /* TODO: check the value type of property_id is int */
+       for (cursor = result->values;cursor;cursor=cursor->next) {
+               data = cursor->data;
+               if (data->property_id == property_id) {
+                       if (data->type == CTSVC_VIEW_DATA_TYPE_BOOL) {
+                               data->value.b = value;
+                               return CONTACTS_ERROR_NONE;
+                       }
+                       else {
+                               CTS_ERR("use another get_type API, (type : %d)", data->type);
+                               return CONTACTS_ERROR_INVALID_PARAMETER;
+                       }
+               }
+       }
+
+       data = calloc(1, sizeof(ctsvc_result_value_s));
+       if (NULL == data) {
+               CTS_ERR("calloc() Fail");
+               return CONTACTS_ERROR_OUT_OF_MEMORY;
+       }
+       data->property_id = property_id;
+       data->type = CTSVC_VIEW_DATA_TYPE_BOOL;
+       data->value.i = value;
+       result->values = g_slist_append(result->values, (void*)data);
+       return CONTACTS_ERROR_NONE;
+}
+
+static int __ctsvc_result_set_str(contacts_record_h record, unsigned int property_id, const char *str)
+{
+       ctsvc_result_s* result = (ctsvc_result_s *)record;
+       GSList *cursor;
+       ctsvc_result_value_s *data;
+       char *full_path = NULL;
+       int str_len;
+
+       /* TODO: check the value type of property_id is int */
+       for (cursor = result->values;cursor;cursor=cursor->next) {
+               data = cursor->data;
+               if (data->property_id == property_id) {
+                       if (data->type == CTSVC_VIEW_DATA_TYPE_STR) {
+                               switch (property_id) {
+                               case CTSVC_PROPERTY_PERSON_IMAGE_THUMBNAIL:
+                               case CTSVC_PROPERTY_CONTACT_IMAGE_THUMBNAIL:
+                                       if (str) {
+                                               str_len = strlen(CTSVC_CONTACT_IMG_FULL_LOCATION) + strlen(str) + 2;
+                                               full_path = calloc(1, str_len);
+                                               if (NULL == full_path) {
+                                                       CTS_ERR("calloc() Fail");
+                                                       return CONTACTS_ERROR_OUT_OF_MEMORY;
+                                               }
+                                               snprintf(full_path, str_len, "%s/%s", CTSVC_CONTACT_IMG_FULL_LOCATION, str);
+                                       }
+                                       free(data->value.s);
+                                       data->value.s = full_path;
+                                       return CONTACTS_ERROR_NONE;
+                               default:
+                                       FREEandSTRDUP(data->value.s, str);
+                                       return CONTACTS_ERROR_NONE;
+                               }
+                       }
+                       else {
+                               CTS_ERR("use another get_type API, (type : %d)", data->type);
+                               return CONTACTS_ERROR_INVALID_PARAMETER;
+                       }
+               }
+       }
+
+       data = calloc(1, sizeof(ctsvc_result_value_s));
+       if (NULL == data) {
+               CTS_ERR("calloc() Fail");
+               return CONTACTS_ERROR_OUT_OF_MEMORY;
+       }
+       data->property_id = property_id;
+       data->type = CTSVC_VIEW_DATA_TYPE_STR;
+       switch (property_id) {
+       case CTSVC_PROPERTY_PERSON_IMAGE_THUMBNAIL:
+       case CTSVC_PROPERTY_CONTACT_IMAGE_THUMBNAIL:
+               if (str) {
+                       str_len = strlen(CTSVC_CONTACT_IMG_FULL_LOCATION) + strlen(str) + 2;
+                       full_path = calloc(1, str_len);
+                       if (NULL == full_path) {
+                               CTS_ERR("calloc() Fail");
+                               free(data);
+                               return CONTACTS_ERROR_OUT_OF_MEMORY;
+                       }
+                       snprintf(full_path, str_len, "%s/%s", CTSVC_CONTACT_IMG_FULL_LOCATION, str);
+               }
+               free(data->value.s);
+               data->value.s = full_path;
+               break;
+       default:
+               data->value.s = SAFE_STRDUP(str);
+               break;
+       }
+
+       result->values = g_slist_append(result->values, (void*)data);
+       return CONTACTS_ERROR_NONE;
+}
+
+static int __ctsvc_result_get_bool(contacts_record_h record, unsigned int property_id, bool* out_value)
+{
+       ctsvc_result_s* result = (ctsvc_result_s *)record;
+       GSList *cursor;
+       for (cursor = result->values;cursor;cursor=cursor->next) {
+               ctsvc_result_value_s *data = cursor->data;
+               if (data->property_id == property_id) {
+                       if (data->type == CTSVC_VIEW_DATA_TYPE_BOOL) {
+                               *out_value = data->value.b;
+                               return CONTACTS_ERROR_NONE;
+                       }
+                       else {
+                               CTS_ERR("use another get_type API, (type : %d)", data->type);
+                               return CONTACTS_ERROR_INVALID_PARAMETER;
+                       }
+               }
+       }
+
+       return CONTACTS_ERROR_NO_DATA;
+}
+
index 8aaafa6..c679474 100644 (file)
@@ -32,6 +32,8 @@ static int __ctsvc_sdn_clone(contacts_record_h record, contacts_record_h *out_re
 static int __ctsvc_sdn_get_int(contacts_record_h record, unsigned int property_id, int *out);
 static int __ctsvc_sdn_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
 static int __ctsvc_sdn_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_sdn_set_int(contacts_record_h record, unsigned int property_id, int value);
+static int __ctsvc_sdn_set_str(contacts_record_h record, unsigned int property_id, const char* str);
 
 ctsvc_record_plugin_cb_s sdn_plugin_cbs = {
        .create = __ctsvc_sdn_create,
@@ -43,8 +45,8 @@ ctsvc_record_plugin_cb_s sdn_plugin_cbs = {
        .get_bool = NULL,
        .get_lli = NULL,
        .get_double = NULL,
-       .set_str = NULL,
-       .set_int = NULL,
+       .set_str = __ctsvc_sdn_set_str,
+       .set_int = __ctsvc_sdn_set_int,
        .set_bool = NULL,
        .set_lli = NULL,
        .set_double = NULL,
@@ -151,3 +153,39 @@ static int __ctsvc_sdn_get_str(contacts_record_h record, unsigned int property_i
        return __ctsvc_sdn_get_str_real(record, property_id, out_str, true);
 }
 
+static int __ctsvc_sdn_set_int(contacts_record_h record, unsigned int property_id, int value)
+{
+       ctsvc_sdn_s* sdn = (ctsvc_sdn_s*)record;
+
+       switch(property_id) {
+       case CTSVC_PROPERTY_SDN_ID:
+               sdn->id = value;
+               break;
+       case CTSVC_PROPERTY_SDN_SIM_SLOT_NO:
+               sdn->sim_slot_no = value;
+               break;
+       default:
+               CTS_ERR("This field(%d) is not supported in value(sdn)", property_id);
+               return CONTACTS_ERROR_INVALID_PARAMETER;
+       }
+       return CONTACTS_ERROR_NONE;
+}
+
+static int __ctsvc_sdn_set_str(contacts_record_h record, unsigned int property_id, const char* str)
+{
+       ctsvc_sdn_s* sdn = (ctsvc_sdn_s*)record;
+
+       switch(property_id) {
+       case CTSVC_PROPERTY_SDN_NAME:
+               FREEandSTRDUP(sdn->name, str);
+               break;
+       case CTSVC_PROPERTY_SDN_NUMBER:
+               FREEandSTRDUP(sdn->number, str);
+               break;
+       default :
+               CTS_ERR("This field(%d) is not supported in value(sdn)", property_id);
+               return CONTACTS_ERROR_INVALID_PARAMETER;
+       }
+       return CONTACTS_ERROR_NONE;
+}
+
index e85b91c..b5b76be 100644 (file)
@@ -33,6 +33,7 @@ static int __ctsvc_speeddial_get_int(contacts_record_h record, unsigned int prop
 static int __ctsvc_speeddial_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
 static int __ctsvc_speeddial_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
 static int __ctsvc_speeddial_set_int(contacts_record_h record, unsigned int property_id, int value);
+static int __ctsvc_speeddial_set_str(contacts_record_h record, unsigned int property_id, const char* str);
 
 
 ctsvc_record_plugin_cb_s speeddial_plugin_cbs = {
@@ -45,7 +46,7 @@ ctsvc_record_plugin_cb_s speeddial_plugin_cbs = {
        .get_bool = NULL,
        .get_lli = NULL,
        .get_double = NULL,
-       .set_str = NULL,
+       .set_str = __ctsvc_speeddial_set_str,
        .set_int = __ctsvc_speeddial_set_int,
        .set_bool = NULL,
        .set_lli = NULL,
@@ -198,3 +199,26 @@ static int __ctsvc_speeddial_set_int(contacts_record_h record, unsigned int prop
        return CONTACTS_ERROR_NONE;
 }
 
+static int __ctsvc_speeddial_set_str(contacts_record_h record, unsigned int property_id, const char* str)
+{
+       ctsvc_speeddial_s *speeddial = (ctsvc_speeddial_s*)record;
+
+       switch(property_id) {
+       case CTSVC_PROPERTY_SPEEDDIAL_DISPLAY_NAME:
+               FREEandSTRDUP(speeddial->display_name, str);
+               break;
+       case CTSVC_PROPERTY_SPEEDDIAL_NUMBER:
+               FREEandSTRDUP(speeddial->number, str);
+               break;
+       case CTSVC_PROPERTY_SPEEDDIAL_IMAGE_THUMBNAIL:
+               FREEandSTRDUP(speeddial->image_thumbnail_path, str);
+               break;
+       case CTSVC_PROPERTY_SPEEDDIAL_NUMBER_LABEL:
+               FREEandSTRDUP(speeddial->label, str);
+               break;
+       default :
+               CTS_ERR("This field(%d) is not supported in value(speeddial)", property_id);
+               return CONTACTS_ERROR_INVALID_PARAMETER;
+       }
+       return CONTACTS_ERROR_NONE;
+}