summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorDonghee Ye <donghee.ye@samsung.com>2013-03-21 22:33:06 +0900
committerDonghee Ye <donghee.ye@samsung.com>2013-03-21 22:33:06 +0900
commit0a406ee1c0d13c1cf74a4b30d1c3b60c2a1d67cf (patch)
treee09f1c87722cf0654d5cdc184b5daa5b1837d88d /server
parentdc8e1e8e287491261ce54e4ea5aa0bfba393883f (diff)
downloadcontacts-service-0a406ee1c0d13c1cf74a4b30d1c3b60c2a1d67cf.tar.gz
contacts-service-0a406ee1c0d13c1cf74a4b30d1c3b60c2a1d67cf.tar.bz2
contacts-service-0a406ee1c0d13c1cf74a4b30d1c3b60c2a1d67cf.zip
Merge from Master
Update 0.9.55 - Set my_profile image_thumbnail_path as read-only property - Remove groups table join of view_person_contact_grouprel - Fix error : Update contact which has only additional name - Subscribe account change noti : addressbook deletes when account is deleted - Check account_id validation when inserting addressbook - Allow to insert one addressbook with same account_id - Fix bug - image resize - Change group property name : system_id -> extra_data Change-Id: Id11400adfa588c5524cf8c5c518d78569a103306
Diffstat (limited to 'server')
-rwxr-xr-xserver/CMakeLists.txt8
-rw-r--r--server/ctsvc_server_bg.c28
2 files changed, 35 insertions, 1 deletions
diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt
index 144fa1c..c0813b8 100755
--- a/server/CMakeLists.txt
+++ b/server/CMakeLists.txt
@@ -68,13 +68,19 @@ SET(SRCS
${CMAKE_SOURCE_DIR}/common/ctsvc_view.c
${CMAKE_SOURCE_DIR}/native/ctsvc_activity.c
+
${CMAKE_SOURCE_DIR}/native/ctsvc_db_init.c
${CMAKE_SOURCE_DIR}/native/ctsvc_db_plugin_activity.c
+
${CMAKE_SOURCE_DIR}/native/ctsvc_db_plugin_address_helper.c
${CMAKE_SOURCE_DIR}/native/ctsvc_db_plugin_address.c
+
${CMAKE_SOURCE_DIR}/native/ctsvc_db_plugin_addressbook.c
+ ${CMAKE_SOURCE_DIR}/native/ctsvc_db_plugin_addressbook_helper.c
+
${CMAKE_SOURCE_DIR}/native/ctsvc_db_plugin_company_helper.c
${CMAKE_SOURCE_DIR}/native/ctsvc_db_plugin_company.c
+
${CMAKE_SOURCE_DIR}/native/ctsvc_db_plugin_contact_helper.c
${CMAKE_SOURCE_DIR}/native/ctsvc_db_plugin_contact.c
${CMAKE_SOURCE_DIR}/native/ctsvc_db_plugin_my_profile.c
@@ -153,7 +159,7 @@ SET(SRCS
)
INCLUDE(FindPkgConfig)
-pkg_check_modules(ctsvc_server_pkgs REQUIRED glib-2.0 pims-ipc gobject-2.0 tapi dlog capi-media-image-util badge)
+pkg_check_modules(ctsvc_server_pkgs REQUIRED glib-2.0 pims-ipc gobject-2.0 tapi dlog capi-media-image-util accounts-svc badge)
FOREACH(flag ${ctsvc_server_pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
diff --git a/server/ctsvc_server_bg.c b/server/ctsvc_server_bg.c
index 7416328..0d02a40 100644
--- a/server/ctsvc_server_bg.c
+++ b/server/ctsvc_server_bg.c
@@ -21,12 +21,15 @@
#include <stdlib.h>
#include <unistd.h> //sleep
+#include <account.h>
+
#include "contacts.h"
#include "internal.h"
#include "ctsvc_schema.h"
#include "ctsvc_sqlite.h"
#include "ctsvc_server_bg.h"
#include "ctsvc_utils.h"
+#include "ctsvc_db_plugin_addressbook_helper.h"
#define CTSVC_SERVER_BG_DELETE_COUNT 50
#define CTSVC_SERVER_BG_DELETE_STEP_TIME 1
@@ -50,6 +53,8 @@ GThread *__ctsvc_server_bg_delete_thread = NULL;
GCond __ctsvc_server_bg_delete_cond;
GMutex __ctsvc_server_bg_delete_mutex;
+account_subscribe_h account = NULL;
+
static int __ctsvc_server_bg_contact_delete_step1(__ctsvc_delete_data_s* data)
{
char query[CTS_SQL_MIN_LEN] = {0,};
@@ -376,6 +381,14 @@ static void __ctsvc_server_contact_deleted_cb(const char *view_uri, void *data)
ctsvc_server_bg_delete_start();
}
+static bool __ctsvc_server_account_delete_cb(const char* event_type, int account_id, void* user_data)
+{
+ SERVER_FN_CALL;
+ if (strcmp(event_type, ACCOUNT_NOTI_NAME_DELETE) == 0)
+ ctsvc_addressbook_delete(account_id);
+ return true;
+}
+
void ctsvc_server_bg_add_cb()
{
int ret;
@@ -383,6 +396,16 @@ void ctsvc_server_bg_add_cb()
SERVER_DBG("call contacts_db_add_changed_cb (_contacts_address_book) : return (%d)", ret);
ret = contacts_db_add_changed_cb(_contacts_contact._uri, __ctsvc_server_contact_deleted_cb, NULL);
SERVER_DBG("call contacts_db_add_changed_cb (_contacts_contact): return (%d)", ret);
+
+ ret = account_subscribe_create(&account);
+ if (ACCOUNT_ERROR_NONE == ret) {
+ ret = account_subscribe_notification(account, __ctsvc_server_account_delete_cb, NULL);
+ if (ACCOUNT_ERROR_NONE != ret) {
+ SERVER_DBG("account_subscribe_notification Failed (%d)", ret);
+ }
+ }
+ else
+ SERVER_DBG("account_subscribe_create Failed (%d)", ret);
}
void ctsvc_server_bg_remove_cb()
@@ -392,5 +415,10 @@ void ctsvc_server_bg_remove_cb()
SERVER_DBG("call contacts_db_remove_changed_cb (_contacts_address_book): return (%d)", ret);
ret = contacts_db_remove_changed_cb(_contacts_contact._uri, __ctsvc_server_contact_deleted_cb, NULL);
SERVER_DBG("call contacts_db_remove_changed_cb (_contacts_contact) : return (%d)", ret);
+
+ if (account) {
+ account_unsubscribe_notification(account); // unsubscirbe & destroy
+ account = NULL;
+ }
}