Update version 0.9.77.1
authorDonghee Ye <donghee.ye@samsung.com>
Mon, 6 May 2013 11:01:41 +0000 (20:01 +0900)
committerDonghee Ye <donghee.ye@samsung.com>
Mon, 6 May 2013 11:01:41 +0000 (20:01 +0900)
- Change socket file path to /tmp
- Disable native library build
- Fix : parse vcard with company value
- Fix : parse vcard image
- Fix inotify : subscribe samce callback

Change-Id: Ie8548111bbd71e31e567e6d18ca840ed031ce3df

CMakeLists.txt
client/ctsvc_client_ipc.c
common/ctsvc_inotify.c
common/ctsvc_socket.h
common/ctsvc_vcard.c
common/ipc/ctsvc_ipc_define.h
contacts-service2.manifest
native/ctsvc_db_plugin_contact_helper.c
native/ctsvc_db_query.c
packaging/contacts-service.spec

index 54de660..55b2aa6 100755 (executable)
@@ -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.75.1")
+SET(VERSION "${VERSION_MAJOR}.9.77.1")
 
 EXECUTE_PROCESS(COMMAND build-util/generator.sh)
 
@@ -57,7 +57,6 @@ INSTALL(FILES ${HEADER_FILES} DESTINATION ${DEST_INCLUDE_DIR})
 FILE(GLOB DB_FILES ${CMAKE_CURRENT_SOURCE_DIR}/build-util/.contacts-svc.db*)
 INSTALL(FILES ${DB_FILES} DESTINATION /opt/usr/dbspace)
 
-ADD_SUBDIRECTORY(native)
 ADD_SUBDIRECTORY(client)
 ADD_SUBDIRECTORY(server)
 
index 30b9b50..6d2bece 100644 (file)
@@ -1,7 +1,8 @@
 
 
 #include <glib.h>
-//#include <glib-oject.h>
+#include <pims-ipc-data.h>
+
 #include "ctsvc_client_ipc.h"
 
 #include "ctsvc_internal.h"
@@ -14,7 +15,6 @@
 #include "ctsvc_ipc_define.h"
 #include "ctsvc_ipc_marshal.h"
 #include "ctsvc_view.h"
-#include <pims-ipc-data.h>
 #include "ctsvc_mutex.h"
 
 static __thread pims_ipc_h __contacts_ipc = NULL;
@@ -30,11 +30,9 @@ int ctsvc_ipc_connect_on_thread(void)
        pims_ipc_data_h outdata = NULL;
 
        // ipc create
-       if (__contacts_ipc == NULL)
-       {
+       if (__contacts_ipc == NULL) {
                __contacts_ipc = pims_ipc_create(CTSVC_IPC_SOCKET_PATH);
-               if (__contacts_ipc == NULL)
-               {
+               if (__contacts_ipc == NULL) {
                        CTS_ERR("pims_ipc_create() Failed(%d)", CONTACTS_ERROR_IPC_NOT_AVALIABLE);
                        return CONTACTS_ERROR_IPC_NOT_AVALIABLE;
                }
@@ -146,8 +144,6 @@ bool ctsvc_ipc_is_busy()
        return ret;
 }
 
-
-
 int ctsvc_ipc_connect(void)
 {
        int ret = CONTACTS_ERROR_NONE;
@@ -155,34 +151,28 @@ int ctsvc_ipc_connect(void)
        pims_ipc_data_h outdata = NULL;
 
        // ipc create
-       if (__contacts_global_ipc == NULL)
-       {
+       if (__contacts_global_ipc == NULL) {
                __contacts_global_ipc = pims_ipc_create(CTSVC_IPC_SOCKET_PATH);
-               if (__contacts_global_ipc == NULL)
-               {
+               if (__contacts_global_ipc == NULL) {
                        CTS_ERR("[GLOBAL_IPC_CHANNEL] pims_ipc_create() Failed(%d)", CONTACTS_ERROR_IPC_NOT_AVALIABLE);
                        return CONTACTS_ERROR_IPC_NOT_AVALIABLE;
                }
        }
-       else
-       {
+       else {
                CTS_DBG("[GLOBAL_IPC_CHANNEL] contacts already connected");
                return CONTACTS_ERROR_NONE;
        }
 
        // ipc call
-       if (pims_ipc_call(__contacts_global_ipc, CTSVC_IPC_MODULE, CTSVC_IPC_SERVER_CONNECT, indata, &outdata) != 0)
-       {
+       if (pims_ipc_call(__contacts_global_ipc, CTSVC_IPC_MODULE, CTSVC_IPC_SERVER_CONNECT, indata, &outdata) != 0) {
                CTS_ERR("[GLOBAL_IPC_CHANNEL] pims_ipc_call failed");
                return CONTACTS_ERROR_IPC;
        }
 
-       if (outdata)
-       {
+       if (outdata) {
                // check outdata
                unsigned int size = 0;
                ret = *(int*) pims_ipc_data_get(outdata,&size);
-
                pims_ipc_data_destroy(outdata);
 
                if (ret == CONTACTS_ERROR_NONE)
index fbe63de..c479ba6 100755 (executable)
@@ -281,7 +281,7 @@ int ctsvc_inotify_subscribe(const char *view_uri,
        }
 
        if (same_noti) {
-//             __ctsvc_inotify_watch(__inoti_fd, path);
+               __ctsvc_inotify_watch(__inoti_fd, path);
                CTS_ERR("The same callback(%s) is already exist", path);
                return CONTACTS_ERROR_SYSTEM;
        }
index 98d4105..5265800 100644 (file)
@@ -24,7 +24,7 @@
 #ifndef __TIZEN_SOCIAL_CTSVC_SOCKET_H__\r
 #define __TIZEN_SOCIAL_CTSVC_SOCKET_H__\r
 \r
-#define CTSVC_SOCKET_PATH "/opt/usr/data/contacts-svc/.contacts-svc.sock"
+#define CTSVC_SOCKET_PATH "/tmp/.contacts-svc.sock"
 #define CTSVC_SOCKET_MSG_SIZE 1024
 #define CTSVC_SIM_MAX_TEXT_LEN 40
 #define CTSVC_SIM_NUM_EMAIL_MAX_COUNT 4
index 0c66fc6..d99d883 100644 (file)
@@ -131,9 +131,6 @@ enum{
        CTSVC_VCARD_IMG_TIFF,
 };
 
-static int __ctsvc_tmp_image_id = 0;
-static int __ctsvc_tmp_logo_id = 0;
-
 static const char *content_name[CTSVC_VCARD_VALUE_MAX] = {0};
 const char *CTSVC_CRLF = "\r\n";
 
@@ -2323,7 +2320,7 @@ static inline int __ctsvc_vcard_get_photo(contacts_record_h contact, ctsvc_list_
        type = __ctsvc_vcard_get_image_type(val);
 
        ret = snprintf(dest, sizeof(dest), "%s/vcard-image-%d.%s",
-                       CTSVC_VCARD_IMAGE_LOCATION, __ctsvc_tmp_image_id++, __ctsvc_get_img_suffix(type));
+                       CTSVC_VCARD_IMAGE_LOCATION, (int)time(NULL), __ctsvc_get_img_suffix(type));
        RETVM_IF(ret<=0, CONTACTS_ERROR_INTERNAL, "Destination file name was not created");
 
        fd = open(dest, O_WRONLY|O_CREAT|O_TRUNC, 0660);
@@ -2474,18 +2471,37 @@ static inline void __ctsvc_vcard_get_company_type(contacts_record_h company, cha
        contacts_record_set_int(company, _contacts_company.type, type);
 }
 
+static contacts_record_h __ctsvc_vcard_get_company_empty_record(ctsvc_list_s *company_list, int property_id)
+{
+       contacts_record_h record_temp = NULL;
+       contacts_record_h record = NULL;
+       contacts_list_h list = (contacts_list_h)company_list;
+
+       contacts_list_last(list);
+       while (CONTACTS_ERROR_NONE == contacts_list_get_current_record_p(list, &record_temp)) {
+               char *value = NULL;
+               contacts_record_get_str_p(record_temp, property_id, &value);
+               if (NULL == value) {
+                       record = record_temp;
+                       break;
+               }
+               contacts_list_prev(list);
+       }
+
+       return record_temp;
+}
+
 static inline int __ctsvc_vcard_get_company_value(ctsvc_list_s *company_list, int property_id, char *val)
 {
-       unsigned int count;
        char *value;
        contacts_record_h company;
 
-       contacts_list_get_count((contacts_list_h)company_list, &count);
-       RETVM_IF(count == 0, CONTACTS_ERROR_INVALID_PARAMETER, "list is empty");
-
-       contacts_list_last((contacts_list_h)company_list);
-       contacts_list_get_current_record_p((contacts_list_h)company_list, &company);
-       RETVM_IF(NULL == company, CONTACTS_ERROR_INVALID_PARAMETER, "contacts_list_get_current_record_p() return NULL");
+       company = __ctsvc_vcard_get_company_empty_record(company_list, property_id);
+       if (NULL == company) {
+               int ret = contacts_record_create(_contacts_company._uri, &company);
+               RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create is failed(%d)", ret);
+               contacts_list_add((contacts_list_h)company_list, company);
+       }
 
        value = __ctsvc_get_content_value(val);
        RETV_IF(NULL == value, CONTACTS_ERROR_NO_DATA);
@@ -2495,27 +2511,28 @@ static inline int __ctsvc_vcard_get_company_value(ctsvc_list_s *company_list, in
        return CONTACTS_ERROR_NONE;
 }
 
-
 static inline int __ctsvc_vcard_get_company(ctsvc_list_s *company_list, char *val)
 {
-       int ret;
-       char *temp, *start;
+       char *temp, *start, *depart;
        const char separator = ';';
        contacts_record_h company;
 
-       ret = contacts_record_create(_contacts_company._uri, &company);
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create is failed(%d)", ret);
-       contacts_list_add((contacts_list_h)company_list, company);
+       company = __ctsvc_vcard_get_company_empty_record(company_list, _contacts_company.name);
+       if (NULL == company) {
+               int ret = contacts_record_create(_contacts_company._uri, &company);
+               RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create is failed(%d)", ret);
+               contacts_list_add((contacts_list_h)company_list, company);
+       }
 
        start = __ctsvc_get_content_value(val);
        RETV_IF(NULL == start, CONTACTS_ERROR_NO_DATA);
 
-       temp = __ctsvc_strtok(start, separator);
+       depart = __ctsvc_strtok(start, separator);
        contacts_record_set_str(company, _contacts_company.name, __ctsvc_vcard_remove_escape_char(start));
 
-       temp = __ctsvc_strtok(temp, separator);
-       if (temp)
-               contacts_record_set_str(company, _contacts_company.department, __ctsvc_vcard_remove_escape_char(temp));
+       temp = __ctsvc_strtok(depart, separator);
+       if (depart)
+               contacts_record_set_str(company, _contacts_company.department, __ctsvc_vcard_remove_escape_char(depart));
 
        if (val != temp) {
                *(temp-1) = '\0';
@@ -2528,19 +2545,18 @@ static inline int __ctsvc_vcard_get_company(ctsvc_list_s *company_list, char *va
 static inline int __ctsvc_vcard_get_company_logo(ctsvc_list_s *company_list, char *val)
 {
        int ret, type, fd;
-       unsigned int count;
        gsize size;
        guchar *buf;
        char dest[CTSVC_IMG_FULL_PATH_SIZE_MAX] = {0};
        char *temp;
        contacts_record_h company;
 
-       contacts_list_get_count((contacts_list_h)company_list, &count);
-       RETVM_IF(count == 0, CONTACTS_ERROR_INVALID_PARAMETER, "list is empty");
-
-       contacts_list_last((contacts_list_h)company_list);
-       contacts_list_get_current_record_p((contacts_list_h)company_list, &company);
-       RETVM_IF(NULL == company, CONTACTS_ERROR_INVALID_PARAMETER, "contacts_list_get_current_record_p() return NULL");
+       company = __ctsvc_vcard_get_company_empty_record(company_list, _contacts_company.logo);
+       if (NULL == company) {
+               ret = contacts_record_create(_contacts_company._uri, &company);
+               RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create is failed(%d)", ret);
+               contacts_list_add((contacts_list_h)company_list, company);
+       }
 
        temp = strchr(val , ':');
        RETVM_IF(NULL == temp, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : val is invalid(%s)", val);
@@ -2549,7 +2565,7 @@ static inline int __ctsvc_vcard_get_company_logo(ctsvc_list_s *company_list, cha
        type = __ctsvc_vcard_get_image_type(val);
 
        ret = snprintf(dest, sizeof(dest), "%s/%d-%d-logo.%s", CTSVC_VCARD_IMAGE_LOCATION,
-                       getpid(), __ctsvc_tmp_logo_id++, __ctsvc_get_img_suffix(type));
+                       getpid(), (int)time(NULL), __ctsvc_get_img_suffix(type));
        RETVM_IF(ret<=0, CONTACTS_ERROR_SYSTEM, "Destination file name was not created");
 
        fd = open(dest, O_WRONLY|O_CREAT|O_TRUNC, 0660);
index bfba52f..c2d28c3 100644 (file)
@@ -21,9 +21,9 @@
 #define __CTSVC_IPC_DEFINE_H__
 
 #define CTSVC_IPC_SERVICE              "contacts_svc_ipc"
-#define CTSVC_IPC_SOCKET_PATH          "/opt/usr/data/contacts-svc/."CTSVC_IPC_SERVICE
+#define CTSVC_IPC_SOCKET_PATH          "/tmp/."CTSVC_IPC_SERVICE
 
-#define CTSVC_IPC_SOCKET_PATH_FOR_CHANGE_SUBSCRIPTION    "/opt/usr/data/contacts-svc/."CTSVC_IPC_SERVICE"_for_subscribe"
+#define CTSVC_IPC_SOCKET_PATH_FOR_CHANGE_SUBSCRIPTION    "/tmp/."CTSVC_IPC_SERVICE"_for_subscribe"
 #define CTSVC_IPC_SUBSCRIBE_MODULE               "ctsvc_ipc_subscribe_module"
 
 #define CTSVC_IPC_MODULE               "ctsvc_ipc_module"
index 215fa27..4ede090 100644 (file)
                </request>
        </define>
        <assign>
-               <filesystem path="/usr/lib/libcontacts-service2.so.0.9.75.1" label="_"/>
+               <filesystem path="/usr/lib/libcontacts-service2.so.0.9.77.1" label="_"/>
                <filesystem path="/usr/lib/libcontacts-service2.so.0" label="_"/>
-               <filesystem path="/usr/lib/libcontacts-service3.so.0.9.75.1" 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"/>
                <filesystem path="/etc/rc.d/init.d/contacts-service-ipcd.sh" label="_" exec_label="none"/>
index 2ce7eea..ce8e6e7 100644 (file)
@@ -231,8 +231,8 @@ int ctsvc_db_contact_delete(int contact_id)
                ctsvc_end_trans(false);
                return ret;
        }
-
        rel_changed = cts_db_change();
+
        snprintf(query, sizeof(query),
                        "UPDATE %s SET deleted = 1, person_id = 0, changed_ver=%d WHERE contact_id = %d",
                        CTS_TABLE_CONTACTS, version, contact_id);
index 21e9a16..59301f0 100755 (executable)
@@ -1157,7 +1157,6 @@ static inline int __ctsvc_db_search_records_with_query_exec(ctsvc_query_s *s_que
        RETVM_IF(NULL == stmt, CONTACTS_ERROR_DB , "DB error : cts_query_prepare() Failed");
 
        i = 1;
-
        len = g_slist_length(bind);
        for (cursor=bind; cursor;cursor=cursor->next, i++)
                sqlite3_bind_text(stmt, i, cursor->data, strlen(cursor->data), SQLITE_STATIC);
index 7176112..d2a14c7 100644 (file)
@@ -1,6 +1,6 @@
 Name:       contacts-service
 Summary:    Contacts Service
-Version: 0.9.75.1
+Version: 0.9.77.1
 Release:    1
 Group:      TO_BE/FILLED_IN
 License:    Apache-2.0
@@ -96,7 +96,6 @@ vconftool set -t int db/contacts-svc/phonenumber_min_match_digit 8 -g 6005
 %manifest contacts-service2.manifest
 %defattr(-,root,root,-)
 %{_libdir}/libcontacts-service2.so.*
-%{_libdir}/libcontacts-service3.so.*
 %{_bindir}/contacts-service-ipcd*
 /etc/rc.d/rc*.d/S50contacts-svc-helper
 /opt/usr/data/contacts-svc/.CONTACTS_SVC_*
@@ -110,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}/pkgconfig/contacts-service2.pc
-%{_libdir}/pkgconfig/contacts-service3.pc
 %{_includedir}/contacts-svc/contacts.h
 %{_includedir}/contacts-svc/contacts_*.h