4 * Copyright (c) 2010 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #ifndef __CTSVC_STRUCT_H__
21 #define __CTSVC_STRUCT_H__
27 #include <tzplatform_config.h>
29 #include "contacts_views.h"
31 #define CTSVC_SOCK_PATH "/run/user/%d/system_share"
32 #define CTSVC_IMG_FULL_PATH_SIZE_MAX 1024 /* current max length file path is 256 */
33 #define CTSVC_PATH_MAX_LEN 1024
34 #define CTSVC_STR_SHORT_LEN 1024
35 #define STRING_EQUAL 0
37 #define SAFE_STR(src) (src) ? src : ""
38 #define SAFE_STRDUP(src) (src) ? strdup(src) : NULL
39 #define SAFE_STRLEN(src) ((src) ? strlen(src) : 0)
40 #define FREEandSTRDUP(dest, src) \
43 if (src) dest = strdup(src);\
46 #define GET_STR(copy, str) (copy) ? (SAFE_STRDUP(str)) : (str)
47 #define CHECK_DIRTY_STR(src1, src2, is_dirty) \
49 if (src1 && NULL == src2) \
51 else if (NULL == src1 && src2) \
53 else if (src1 && src2 && 0 != strcmp(src1, src2)) \
56 #define CHECK_DIRTY_VAL(src1, src2, is_dirty) \
63 CTSVC_PERMISSION_CONTACT_NONE = 0x0,
64 CTSVC_PERMISSION_CONTACT_READ = 0x1,
65 CTSVC_PERMISSION_CONTACT_WRITE = 0x2,
66 CTSVC_PERMISSION_PHONELOG_READ = 0x4,
67 CTSVC_PERMISSION_PHONELOG_WRITE = 0x8,
71 CTSVC_RECORD_INVALID = -1,
72 CTSVC_RECORD_ADDRESSBOOK,
76 CTSVC_RECORD_MY_PROFILE,
77 CTSVC_RECORD_SIMPLE_CONTACT,
85 CTSVC_RECORD_NICKNAME,
87 CTSVC_RECORD_MESSENGER,
88 CTSVC_RECORD_GROUP_RELATION,
89 CTSVC_RECORD_ACTIVITY,
90 CTSVC_RECORD_ACTIVITY_PHOTO,
92 CTSVC_RECORD_RELATIONSHIP,
94 CTSVC_RECORD_EXTENSION,
95 CTSVC_RECORD_UPDATED_INFO,
96 CTSVC_RECORD_PHONELOG,
97 CTSVC_RECORD_SPEEDDIAL,
101 } ctsvc_record_type_e;
109 CTSVC_FILTER_COMPOSITE,
110 } ctsvc_filter_type_e;
113 unsigned int property_id;
118 typedef int (*__ctsvc_record_create_cb)(contacts_record_h *out_record);
119 typedef int (*__ctsvc_record_destroy_cb)(contacts_record_h record, bool delete_child);
120 typedef int (*__ctsvc_record_clone_cb)(contacts_record_h record, contacts_record_h *out_record);
122 typedef int (*__ctsvc_record_get_str_cb)(contacts_record_h record, unsigned int property_id, char **out_str);
123 typedef int (*__ctsvc_record_get_str_p_cb)(contacts_record_h record, unsigned int property_id, char **out_str);
124 typedef int (*__ctsvc_record_get_int_cb)(contacts_record_h record, unsigned int property_id, int *out_value);
125 typedef int (*__ctsvc_record_get_bool_cb)(contacts_record_h record, unsigned int property_id, bool *value);
126 typedef int (*__ctsvc_record_get_lli_cb)(contacts_record_h record, unsigned int property_id, long long int *value);
127 typedef int (*__ctsvc_record_get_double_cb)(contacts_record_h record, unsigned int property_id, double *value);
129 typedef int (*__ctsvc_record_set_str_cb)(contacts_record_h record, unsigned int property_id, const char *value, bool *is_dirty);
130 typedef int (*__ctsvc_record_set_int_cb)(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
131 typedef int (*__ctsvc_record_set_bool_cb)(contacts_record_h record, unsigned int property_id, bool value, bool *is_dirty);
132 typedef int (*__ctsvc_record_set_lli_cb)(contacts_record_h record, unsigned int property_id, long long int value, bool *is_dirty);
133 typedef int (*__ctsvc_record_set_double_cb)(contacts_record_h record, unsigned int property_id, double value, bool *is_dirty);
135 typedef int (*__ctsvc_record_add_child_record_cb)(contacts_record_h record, unsigned int property_id, contacts_record_h child_record);
136 typedef int (*__ctsvc_record_remove_child_record_cb)(contacts_record_h record, unsigned int property_id, contacts_record_h child_record);
137 typedef int (*__ctsvc_record_get_child_record_count_cb)(contacts_record_h record, unsigned int property_id, int *count);
138 typedef int (*__ctsvc_record_get_child_record_at_p_cb)(contacts_record_h record, unsigned int property_id, int index, contacts_record_h *out_record);
139 typedef int (*__ctsvc_record_clone_child_record_list_cb)(contacts_record_h record, unsigned int property_id, contacts_list_h *out_list);
142 __ctsvc_record_create_cb create;
143 __ctsvc_record_destroy_cb destroy;
144 __ctsvc_record_clone_cb clone;
145 __ctsvc_record_get_str_cb get_str;
146 __ctsvc_record_get_str_p_cb get_str_p;
147 __ctsvc_record_get_int_cb get_int;
148 __ctsvc_record_get_bool_cb get_bool;
149 __ctsvc_record_get_lli_cb get_lli;
150 __ctsvc_record_get_double_cb get_double;
151 __ctsvc_record_set_str_cb set_str;
152 __ctsvc_record_set_int_cb set_int;
153 __ctsvc_record_set_bool_cb set_bool;
154 __ctsvc_record_set_lli_cb set_lli;
155 __ctsvc_record_set_double_cb set_double;
156 __ctsvc_record_add_child_record_cb add_child_record;
157 __ctsvc_record_remove_child_record_cb remove_child_record;
158 __ctsvc_record_get_child_record_count_cb get_child_record_count;
159 __ctsvc_record_get_child_record_at_p_cb get_child_record_at_p;
160 __ctsvc_record_clone_child_record_list_cb clone_child_record_list;
161 } ctsvc_record_plugin_cb_s;
165 const ctsvc_record_plugin_cb_s *plugin_cbs;
166 const char *view_uri;
167 unsigned int property_max_count;
168 unsigned char *properties_flags;
169 unsigned char property_flag;
179 GSList *filter_ops; /* ctsvc_filter_operator_e op; */
180 GSList *filters; /* ctsvc_filter_h l_filter; */
181 property_info_s *properties;
182 unsigned int property_count;
183 } ctsvc_composite_filter_s;
196 } ctsvc_attribute_filter_s;
200 ctsvc_composite_filter_s *filter;
201 unsigned int *projection;
202 unsigned int projection_count;
203 unsigned int sort_property_id;
205 property_info_s *properties;
206 unsigned int property_count;
214 GList *deleted_records;
224 } ctsvc_addressbook_s;
235 char *image_thumbnail_path;
242 bool has_phonenumber;
247 char *display_name_index;
248 char *image_thumbnail_path;
254 char *addressbook_ids;
256 char *snippet_string;
257 double favorite_prio;
264 bool has_phonenumber;
269 char *image_thumbnail_path;
275 int display_source_type;
276 } ctsvc_simple_contact_s;
289 char *phonetic_first;
290 char *phonetic_middle;
293 char *reverse_lookup;
304 char *cleaned; /* internally used */
305 char *normalized; /* internally used */
306 char *lookup; /* internally used : for min match */
351 bool is_leap_month; /* deprecated */
370 } ctsvc_group_relation_s;
388 char *service_operation;
403 } ctsvc_relationship_s;
430 ctsvc_list_s *photos;
431 char *service_operation;
441 } ctsvc_activity_photo_s;
455 char *assistant_name;
466 int person_id; /* person id */
469 int extra_data1; /* duration, message_id */
470 char *extra_data2; /*short message*/
498 int changed_ver; /* internally used, check when updating contact */
501 bool has_phonenumber;
504 char *reverse_display_name;
505 int display_source_type;
506 int display_name_language;
507 int reverse_display_name_language;
509 char *reverse_sort_name;
511 char *reverse_sortkey;
513 char *image_thumbnail_path;
519 ctsvc_list_s *company;
520 ctsvc_list_s *numbers;
521 ctsvc_list_s *emails;
522 ctsvc_list_s *grouprelations;
523 ctsvc_list_s *events;
524 ctsvc_list_s *messengers;
525 ctsvc_list_s *postal_addrs;
527 ctsvc_list_s *nicknames;
528 ctsvc_list_s *profiles;
529 ctsvc_list_s *relationships;
530 ctsvc_list_s *images;
531 ctsvc_list_s *extensions;
541 char *reverse_display_name;
543 char *image_thumbnail_path;
546 ctsvc_list_s *company;
547 ctsvc_list_s *numbers;
548 ctsvc_list_s *emails;
549 ctsvc_list_s *events;
550 ctsvc_list_s *messengers;
551 ctsvc_list_s *postal_addrs;
553 ctsvc_list_s *nicknames;
554 ctsvc_list_s *profiles;
555 ctsvc_list_s *relationships;
556 ctsvc_list_s *images;
557 ctsvc_list_s *extensions;
559 } ctsvc_my_profile_s;
576 int last_changed_type; /* it is used for _contacts_my_profile_updated_info */
577 } ctsvc_updated_info_s;
585 char *image_thumbnail_path;
611 } ctsvc_result_value_s;
620 int connection_count;
623 #endif /* __CTSVC_STRUCT_H__ */