summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyeonghun Lee <kh9090.lee@samsung.com>2017-06-20 17:54:10 +0900
committerKyeonghun Lee <kh9090.lee@samsung.com>2017-06-20 18:07:49 +0900
commit63ae6330993372e2eb8509b22a18242366565030 (patch)
tree3ddd690004e1e8ab9ceb5dc6afa35c733fbcfd20
parentb4361bf160d46b1bebdc8a8edb90adc8fb0baa86 (diff)
downloadmsg-service-63ae6330993372e2eb8509b22a18242366565030.tar.gz
msg-service-63ae6330993372e2eb8509b22a18242366565030.tar.bz2
msg-service-63ae6330993372e2eb8509b22a18242366565030.zip
codes related to phone log to msg-service moved
Change-Id: I489d62446d5292028658ce721aed37fa4c618a6f Signed-off-by: Kyeonghun Lee <kh9090.lee@samsung.com>
-rwxr-xr-xframework/deliver-handler/MsgDeliverHandler.cpp2
-rwxr-xr-xframework/transaction-manager/MsgCmdHandlerTransport.cpp4
-rw-r--r--include/proxy/MsgProxyContact.h37
-rwxr-xr-xinclude/utils/MsgContact.h4
-rw-r--r--manager/inc/msg-manager-contact.h1
-rw-r--r--manager/src/msg-manager-contact.cpp95
-rw-r--r--manager/src/msg-manager.cpp130
-rwxr-xr-xpackaging/msg-service.spec2
-rwxr-xr-xplugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp2
-rwxr-xr-xplugin/sms_plugin/SmsPluginEventHandler.cpp2
-rwxr-xr-xproxy/CMakeLists.txt1
-rwxr-xr-xproxy/MsgHandleControl.cpp2
-rwxr-xr-xproxy/MsgHandleStorage.cpp2
-rw-r--r--proxy/MsgProxyContact.cpp174
-rwxr-xr-xutils/CMakeLists.txt2
-rwxr-xr-xutils/MsgContact.cpp158
16 files changed, 155 insertions, 463 deletions
diff --git a/framework/deliver-handler/MsgDeliverHandler.cpp b/framework/deliver-handler/MsgDeliverHandler.cpp
index b2e79e0..c87d802 100755
--- a/framework/deliver-handler/MsgDeliverHandler.cpp
+++ b/framework/deliver-handler/MsgDeliverHandler.cpp
@@ -158,8 +158,6 @@ msg_error_t MsgHandleMmsConfIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, msg_reques
snprintf(msgId, sizeof(msgId), "%u", pMsgInfo->msgId);
bundle_add_str(b, EVT_KEY_MSG_ID, msgId);
eventsystem_send_system_event(SYS_EVENT_INCOMMING_MSG, b);
- bundle_add_str(b, "cmd", "incoming_msg");
- msg_launch_app(MSG_MGR_APP_ID, b);
bundle_free(b);
}
#endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED
diff --git a/framework/transaction-manager/MsgCmdHandlerTransport.cpp b/framework/transaction-manager/MsgCmdHandlerTransport.cpp
index 0c8b63b..a566771 100755
--- a/framework/transaction-manager/MsgCmdHandlerTransport.cpp
+++ b/framework/transaction-manager/MsgCmdHandlerTransport.cpp
@@ -521,8 +521,6 @@ int MsgIncomingMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent)
bundle_add_str(b, EVT_KEY_MSG_TYPE, EVT_VAL_PUSH);
} else {
bundle_add_str(b, EVT_KEY_MSG_TYPE, EVT_VAL_SMS);
- bundle_add_str(b, "cmd", "incoming_msg");
- msg_launch_app(MSG_MGR_APP_ID, b);
}
eventsystem_send_system_event(SYS_EVENT_INCOMMING_MSG, b);
bundle_free(b);
@@ -777,8 +775,6 @@ __BYPASS_UPDATE:
snprintf(msgId, sizeof(msgId), "%u", msgInfo.msgId);
bundle_add_str(b, EVT_KEY_MSG_ID, msgId);
eventsystem_send_system_event(SYS_EVENT_INCOMMING_MSG, b);
- bundle_add_str(b, "cmd", "incoming_msg");
- msg_launch_app(MSG_MGR_APP_ID, b);
bundle_free(b);
}
#endif /*MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
diff --git a/include/proxy/MsgProxyContact.h b/include/proxy/MsgProxyContact.h
deleted file mode 100644
index abbd660..0000000
--- a/include/proxy/MsgProxyContact.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-#ifndef MSG_PROXY_CONTACT_H
-#define MSG_PROXY_CONTACT_H
-
-
-/*==================================================================================================
- INCLUDE FILES
-==================================================================================================*/
-#include "MsgStorageTypes.h"
-#include "MsgInternalTypes.h"
-
-/*==================================================================================================
- FUNCTION PROTOTYPES
-==================================================================================================*/
-msg_error_t MsgOpenContactSvc();
-msg_error_t MsgCloseContactSvc();
-
-msg_error_t MsgGetContactSearchList(const char *pSearchVal, MSG_ADDRESS_INFO_S **pAddrInfo, int *count);
-
-
-#endif /* MSG_PROXY_CONTACT_H */
-
diff --git a/include/utils/MsgContact.h b/include/utils/MsgContact.h
index 343d49d..b199b46 100755
--- a/include/utils/MsgContact.h
+++ b/include/utils/MsgContact.h
@@ -26,6 +26,10 @@
/*==================================================================================================
FUNCTION PROTOTYPES
==================================================================================================*/
+msg_error_t MsgOpenContactSvc();
+msg_error_t MsgCloseContactSvc();
+
+msg_error_t MsgGetContactSearchList(const char *pSearchVal, MSG_ADDRESS_INFO_S **pAddrInfo, int *count);
msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_INFO_S *pContactInfo);
msg_error_t MsgGetContactStyleDisplayName(const char *first, const char *last, const char *middle, const char *prefix, const char *suffix, int contactNameOrder, char *displayName, unsigned int size);
diff --git a/manager/inc/msg-manager-contact.h b/manager/inc/msg-manager-contact.h
index d53eebb..6ab0840 100644
--- a/manager/inc/msg-manager-contact.h
+++ b/manager/inc/msg-manager-contact.h
@@ -69,7 +69,6 @@ typedef struct {
int MsgMgrOpenContactSvc();
int MsgMgrCloseContactSvc();
-void MsgMgrAddPhoneLog(contactInfo *contact_info);
int MsgMgrGetContactInfo(const MSG_MGR_ADDRESS_INFO_S *pAddrInfo, MSG_MGR_CONTACT_INFO_S *pContactInfo);
char* msg_mgr_clean_country_code(char *src);
diff --git a/manager/src/msg-manager-contact.cpp b/manager/src/msg-manager-contact.cpp
index b39ec27..eb8405d 100644
--- a/manager/src/msg-manager-contact.cpp
+++ b/manager/src/msg-manager-contact.cpp
@@ -79,101 +79,6 @@ int MsgMgrCloseContactSvc()
}
-void MsgMgrAddPhoneLog(contactInfo *contact_info)
-{
- int err = 0;
-
- if ((err = MsgMgrOpenContactSvc()) != 0) {
- MSG_MGR_DEBUG("MsgMgrOpenContactSvc fail.");
- return;
- }
-
- if (!isContactSvcConnected) {
- MSG_MGR_DEBUG("Contact Service Not Opened.");
- return;
- }
-
- int addr_cnt = msg_list_length(contact_info->addrList);
- if (addr_cnt < 1) {
- MSG_MGR_DEBUG("address count is [%d]", addr_cnt);
- return;
- }
-
- for (int i = 0; i < addr_cnt; i++) {
- int ret = 0;
- contacts_record_h plog = NULL;
- char addressVal[MAX_ADDRESS_VAL_LEN + 1] = {0};
-
- msg_struct_t addr_data = msg_list_nth_data(contact_info->addrList, i);
-
- ret = contacts_record_create(_contacts_phone_log._uri, &plog);
- if (ret != CONTACTS_ERROR_NONE) {
- MSG_MGR_DEBUG("contacts_record_create() Error [%d]", ret);
- contacts_record_destroy(plog, true);
- break;
- }
-
- contacts_record_set_int(plog, _contacts_phone_log.sim_slot_no, contact_info->simIndex-1);
- msg_get_str_value(addr_data, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, addressVal, MAX_ADDRESS_VAL_LEN);
- MSG_MGR_SEC_DEBUG("addressVal : %s", addressVal);
- contacts_record_set_str(plog, _contacts_phone_log.address, addressVal);
- contacts_record_set_int(plog, _contacts_phone_log.log_time, (int)time(NULL));
-
- char strText[MAX_CONTACT_TEXT_LEN + 1];
- memset(strText, 0x00, sizeof(strText));
-
- if (contact_info->msgType != MSG_TYPE_MMS && contact_info->msgType != MSG_TYPE_MMS_NOTI && contact_info->msgType != MSG_TYPE_MMS_JAVA) {
- strncpy(strText, contact_info->msgText, MAX_CONTACT_TEXT_LEN);
- MSG_MGR_SEC_DEBUG("msgText : %s", strText);
- } else {
- if (strlen(contact_info->subject) > 0 || contact_info->msgType == MSG_TYPE_MMS_NOTI) {
- strncpy(strText, contact_info->subject, MAX_CONTACT_TEXT_LEN);
- MSG_MGR_SEC_DEBUG("subject : %s", strText);
- } else {
- char *pFileData = NULL;
- gsize fileSize = 0;
-
- if (contact_info->msgText[0] != '\0' && g_file_get_contents(contact_info->msgText, &pFileData, &fileSize, NULL) == true) {
- if (pFileData)
- strncpy(strText, pFileData, 100);
- }
-
- if (pFileData)
- g_free(pFileData);
-
- MSG_MGR_SEC_DEBUG("msgText : %s", strText);
- }
- }
-
- contacts_record_set_str(plog, _contacts_phone_log.extra_data2, strText);
- contacts_record_set_int(plog, _contacts_phone_log.extra_data1, contact_info->msgId);
-
- if (contact_info->folderId == MSG_INBOX_ID) {
- if (contact_info->msgType != MSG_TYPE_MMS && contact_info->msgType != MSG_TYPE_MMS_NOTI && contact_info->msgType != MSG_TYPE_MMS_JAVA)
- contacts_record_set_int(plog, _contacts_phone_log.log_type, CONTACTS_PLOG_TYPE_SMS_INCOMING);
- else
- contacts_record_set_int(plog, _contacts_phone_log.log_type, CONTACTS_PLOG_TYPE_MMS_INCOMING);
- } else if (contact_info->folderId == MSG_OUTBOX_ID || contact_info->folderId == MSG_SENTBOX_ID) {
- if (contact_info->msgType != MSG_TYPE_MMS && contact_info->msgType != MSG_TYPE_MMS_NOTI && contact_info->msgType != MSG_TYPE_MMS_JAVA)
- contacts_record_set_int(plog, _contacts_phone_log.log_type, CONTACTS_PLOG_TYPE_SMS_OUTGOING);
- else
- contacts_record_set_int(plog, _contacts_phone_log.log_type, CONTACTS_PLOG_TYPE_MMS_OUTGOING);
- } else if (contact_info->folderId == MSG_SPAMBOX_ID) {
- if (contact_info->msgType != MSG_TYPE_MMS && contact_info->msgType != MSG_TYPE_MMS_NOTI && contact_info->msgType != MSG_TYPE_MMS_JAVA)
- contacts_record_set_int(plog, _contacts_phone_log.log_type, CONTACTS_PLOG_TYPE_SMS_BLOCKED);
- else
- contacts_record_set_int(plog, _contacts_phone_log.log_type, CONTACTS_PLOG_TYPE_MMS_BLOCKED);
- }
-
- ret = contacts_db_insert_record(plog, NULL);
- if (ret != CONTACTS_ERROR_NONE) {
- MSG_MGR_DEBUG("contacts_db_insert_record() Error [%d]", ret);
- }
-
- contacts_record_destroy(plog, true);
- }
-}
-
int MsgMgrGetContactInfo(const MSG_MGR_ADDRESS_INFO_S *pAddrInfo, MSG_MGR_CONTACT_INFO_S *pContactInfo)
{
MSG_MGR_BEGIN();
diff --git a/manager/src/msg-manager.cpp b/manager/src/msg-manager.cpp
index 8f2fba8..84907d9 100644
--- a/manager/src/msg-manager.cpp
+++ b/manager/src/msg-manager.cpp
@@ -123,130 +123,6 @@ void service_app_terminate(void *data)
return;
}
-void _incoming_msg_func(app_control_h app_control)
-{
- MSG_MGR_BEGIN();
-
- int ret = 0;
- char *rcv_msg_type = NULL;
- char *rcv_msg_id = NULL;
-
- ret = app_control_get_extra_data(app_control, EVENT_KEY_MSG_ID, &rcv_msg_id);
- if (ret != APP_CONTROL_ERROR_NONE || rcv_msg_id == NULL) {
- MSG_MGR_ERR("app_control_get_extra_data failed");
- return;
- }
-
- ret = app_control_get_extra_data(app_control, EVENT_KEY_MSG_TYPE, &rcv_msg_type);
- if (ret != APP_CONTROL_ERROR_NONE || rcv_msg_type == NULL) {
- MSG_MGR_ERR("app_control_get_extra_data failed");
- g_free(rcv_msg_id);
- return;
- }
-
- MSG_MGR_INFO("rcv_msg_type(%s), rcv_msg_id(%s)", rcv_msg_type, rcv_msg_id);
-
- int msg_err = MSG_SUCCESS;
- msg_message_id_t msg_id = atoi(rcv_msg_id);
- msg_struct_t msg = NULL;
- msg_struct_t opt = NULL;
- contactInfo contact_info = {0, };
- contact_info.msgId = msg_id;
-
- g_free(rcv_msg_id);
- g_free(rcv_msg_type);
-
- msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
- opt = msg_create_struct(MSG_STRUCT_SENDOPT);
- msg_err = msg_get_message(msg_handle, msg_id, msg, opt);
- if (msg_err != MSG_SUCCESS) {
- MSG_MGR_ERR("msg_get_message() failed [%d]", msg_err);
- msg_release_struct(&msg);
- msg_release_struct(&opt);
- return;
- }
-
- msg_get_int_value(msg, MSG_MESSAGE_TYPE_INT, &contact_info.msgType);
- msg_get_int_value(msg, MSG_MESSAGE_FOLDER_ID_INT, &contact_info.folderId);
- msg_get_int_value(msg, MSG_MESSAGE_SIM_INDEX_INT, &contact_info.simIndex);
- msg_get_list_handle(msg, MSG_MESSAGE_ADDR_LIST_HND, (void **)&contact_info.addrList);
- msg_get_str_value(msg, MSG_MESSAGE_SUBJECT_STR, contact_info.subject, MAX_CONTACT_TEXT_LEN);
- int msgSize = 0;
- msg_get_int_value(msg, MSG_MESSAGE_DATA_SIZE_INT, &msgSize);
- if (msgSize > 0)
- msg_get_str_value(msg, MSG_MESSAGE_SMS_DATA_STR, contact_info.msgText, MAX_CONTACT_TEXT_LEN);
-
- if ((contact_info.folderId == MSG_INBOX_ID || contact_info.folderId == MSG_SPAMBOX_ID)) {
- MsgMgrAddPhoneLog(&contact_info);
- }
-
- msg_release_struct(&msg);
- msg_release_struct(&opt);
-
- MSG_MGR_END();
-}
-
-void _outgoing_msg_func(app_control_h app_control)
-{
- MSG_MGR_BEGIN();
-
- int ret = 0;
- char *sent_msg_type = NULL;
- char *sent_msg_id = NULL;
-
- ret = app_control_get_extra_data(app_control, EVENT_KEY_OUT_MSG_ID, &sent_msg_id);
- if (ret != APP_CONTROL_ERROR_NONE || sent_msg_id == NULL) {
- MSG_MGR_ERR("app_control_get_extra_data failed");
- return;
- }
-
- ret = app_control_get_extra_data(app_control, EVENT_KEY_OUT_MSG_TYPE, &sent_msg_type);
- if (ret != APP_CONTROL_ERROR_NONE || sent_msg_type == NULL) {
- MSG_MGR_ERR("app_control_get_extra_data failed");
- g_free(sent_msg_id);
- return;
- }
-
- MSG_MGR_INFO("sent_msg_type(%s) sent_msg_id(%s)", sent_msg_type, sent_msg_id);
-
- int msg_err = MSG_SUCCESS;
- msg_message_id_t msg_id = atoi(sent_msg_id);
- msg_struct_t msg = NULL;
- msg_struct_t opt = NULL;
- contactInfo contact_info = {0, };
- contact_info.msgId = msg_id;
-
- g_free(sent_msg_id);
- g_free(sent_msg_type);
-
- msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
- opt = msg_create_struct(MSG_STRUCT_SENDOPT);
- msg_err = msg_get_message(msg_handle, msg_id, msg, opt);
- if (msg_err != MSG_SUCCESS) {
- MSG_MGR_ERR("msg_get_message() failed [%d]", msg_err);
- msg_release_struct(&msg);
- msg_release_struct(&opt);
- return;
- }
-
- msg_get_int_value(msg, MSG_MESSAGE_TYPE_INT, &contact_info.msgType);
- msg_get_int_value(msg, MSG_MESSAGE_FOLDER_ID_INT, &contact_info.folderId);
- msg_get_int_value(msg, MSG_MESSAGE_SIM_INDEX_INT, &contact_info.simIndex);
- msg_get_list_handle(msg, MSG_MESSAGE_ADDR_LIST_HND, (void **)&contact_info.addrList);
- msg_get_str_value(msg, MSG_MESSAGE_SUBJECT_STR, contact_info.subject, 100);
- int msgSize = 0;
- msg_get_int_value(msg, MSG_MESSAGE_DATA_SIZE_INT, &msgSize);
- if (msgSize > 0)
- msg_get_str_value(msg, MSG_MESSAGE_SMS_DATA_STR, contact_info.msgText, 100);
-
- MsgMgrAddPhoneLog(&contact_info);
-
- msg_release_struct(&msg);
- msg_release_struct(&opt);
-
- MSG_MGR_END();
-}
-
void _refresh_noti_func(app_control_h app_control)
{
char *type = NULL;
@@ -757,11 +633,7 @@ void service_app_control(app_control_h app_control, void *data)
if (ret == APP_CONTROL_ERROR_NONE && cmd) {
MSG_MGR_INFO("cmd [%s]", cmd);
- if (g_strcmp0(cmd, "incoming_msg") == 0) {
- _incoming_msg_func(app_control);
- } else if (g_strcmp0(cmd, "outgoing_msg") == 0) {
- _outgoing_msg_func(app_control);
- } else if (g_strcmp0(cmd, "refresh_noti") == 0) {
+ if (g_strcmp0(cmd, "refresh_noti") == 0) {
_refresh_noti_func(app_control);
} else if (g_strcmp0(cmd, "add_noti") == 0) {
_add_noti_func(app_control);
diff --git a/packaging/msg-service.spec b/packaging/msg-service.spec
index 01878b1..4536fd0 100755
--- a/packaging/msg-service.spec
+++ b/packaging/msg-service.spec
@@ -27,6 +27,7 @@ BuildRequires: pkgconfig(capi-network-connection)
BuildRequires: pkgconfig(capi-system-device)
BuildRequires: pkgconfig(capi-system-info)
BuildRequires: pkgconfig(capi-telephony)
+BuildRequires: pkgconfig(contacts-service2)
BuildRequires: pkgconfig(csr)
BuildRequires: pkgconfig(cynara-client)
BuildRequires: pkgconfig(cynara-creds-commons)
@@ -50,7 +51,6 @@ BuildRequires: pkgconfig(motion)
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(tapi)
BuildRequires: pkgconfig(vconf)
-BuildRequires: pkgconfig(contacts-service2)
# Below BuildRequires-statements are only for msg-manager
BuildRequires: gettext-tools
BuildRequires: hash-signer
diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp
index 5b0411f..a030ac2 100755
--- a/plugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp
+++ b/plugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp
@@ -473,8 +473,6 @@ void SmsPluginEventHandler::handleSentStatus(msg_network_status_t NetStatus)
snprintf(msgId, sizeof(msgId), "%u", sentInfo.reqInfo.msgInfo.msgId);
bundle_add_str(b, EVT_KEY_OUT_MSG_ID, msgId);
eventsystem_send_system_event(SYS_EVENT_OUTGOING_MSG, b);
- bundle_add_str(b, "cmd", "outgoing_msg");
- msg_launch_app(MSG_MGR_APP_ID, b);
bundle_free(b);
}
} else {
diff --git a/plugin/sms_plugin/SmsPluginEventHandler.cpp b/plugin/sms_plugin/SmsPluginEventHandler.cpp
index 68fdf01..3f75041 100755
--- a/plugin/sms_plugin/SmsPluginEventHandler.cpp
+++ b/plugin/sms_plugin/SmsPluginEventHandler.cpp
@@ -111,8 +111,6 @@ void SmsPluginEventHandler::handleSentStatus(msg_network_status_t NetStatus)
snprintf(msgId, sizeof(msgId), "%u", sentInfo.reqInfo.msgInfo.msgId);
bundle_add_str(b, EVT_KEY_OUT_MSG_ID, msgId);
eventsystem_send_system_event(SYS_EVENT_OUTGOING_MSG, b);
- bundle_add_str(b, "cmd", "outgoing_msg");
- msg_launch_app(MSG_MGR_APP_ID, b);
bundle_free(b);
}
} else {
diff --git a/proxy/CMakeLists.txt b/proxy/CMakeLists.txt
index ddab5f3..d6e2c2d 100755
--- a/proxy/CMakeLists.txt
+++ b/proxy/CMakeLists.txt
@@ -15,7 +15,6 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -O2 -g -Wall")
##########################################################
SET(TRANS-PROXY-SRCS
- ${CMAKE_SOURCE_DIR}/proxy/MsgProxyContact.cpp
${CMAKE_SOURCE_DIR}/proxy/MsgProxyListener.cpp
${CMAKE_SOURCE_DIR}/proxy/MsgHandleControl.cpp
${CMAKE_SOURCE_DIR}/proxy/MsgHandleSetting.cpp
diff --git a/proxy/MsgHandleControl.cpp b/proxy/MsgHandleControl.cpp
index 8220910..81d0dfa 100755
--- a/proxy/MsgHandleControl.cpp
+++ b/proxy/MsgHandleControl.cpp
@@ -22,7 +22,7 @@
#include "MsgException.h"
#include "MsgUtilFile.h"
#include "MsgGconfWrapper.h"
-#include "MsgProxyContact.h"
+#include "MsgContact.h"
#include "MsgProxyListener.h"
#include "MsgHandle.h"
#include "MsgSqliteWrapper.h"
diff --git a/proxy/MsgHandleStorage.cpp b/proxy/MsgHandleStorage.cpp
index 488ffd6..11ccef3 100755
--- a/proxy/MsgHandleStorage.cpp
+++ b/proxy/MsgHandleStorage.cpp
@@ -22,7 +22,7 @@
#include "MsgProxyListener.h"
#include "MsgHandle.h"
-#include "MsgProxyContact.h"
+#include "MsgContact.h"
#include "MsgVMessage.h"
/*==================================================================================================
IMPLEMENTATION OF MsgHandle - Storage Member Functions
diff --git a/proxy/MsgProxyContact.cpp b/proxy/MsgProxyContact.cpp
deleted file mode 100644
index 9dd54b0..0000000
--- a/proxy/MsgProxyContact.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-#include <MsgProxyContact.h>
-#include <MsgContact.h>
-#include <MsgDebug.h>
-
-#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
-extern "C"
-{
- #include <contacts.h>
-}
-#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
-
-
-/*==================================================================================================
- VARIABLES
-==================================================================================================*/
-__thread bool isContactSvcConnected = false;
-
-
-/*==================================================================================================
- FUNCTION IMPLEMENTATION
-==================================================================================================*/
-msg_error_t MsgOpenContactSvc()
-{
-#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
- int errCode = CONTACTS_ERROR_NONE;
-
- if (!isContactSvcConnected) {
- errCode = contacts_connect();
-
- if (errCode == CONTACTS_ERROR_NONE) {
- MSG_DEBUG("Connect to Contact Service Success");
- isContactSvcConnected = true;
- } else {
- MSG_DEBUG("Connect to Contact Service Fail [%d]", errCode);
- isContactSvcConnected = false;
- return MSG_ERR_DB_CONNECT;
- }
- } else {
- MSG_DEBUG("Already connected to Contact Service.");
- }
-#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
- return MSG_SUCCESS;
-}
-
-
-msg_error_t MsgCloseContactSvc()
-{
-#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
- int errCode = CONTACTS_ERROR_NONE;
-
- if (isContactSvcConnected) {
- errCode = contacts_disconnect();
-
- if (errCode == CONTACTS_ERROR_NONE) {
- MSG_DEBUG("Disconnect to Contact Service Success");
- isContactSvcConnected = false;
- } else {
- MSG_DEBUG("Disconnect to Contact Service Fail [%d]", errCode);
- return MSG_ERR_DB_DISCONNECT;
- }
- }
-#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
- return MSG_SUCCESS;
-}
-
-msg_error_t MsgGetContactSearchList(const char *pSearchVal, MSG_ADDRESS_INFO_S **pAddrInfo, int *count)
-{
- MSG_BEGIN();
-#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
-
- msg_error_t err = MSG_SUCCESS;
-
- *count = 0;
-
- if (pSearchVal == NULL) {
- MSG_DEBUG("pSearchVal is NULL.");
- return MSG_ERR_NULL_POINTER;
- }
-
- if (pAddrInfo == NULL) {
- MSG_DEBUG("pAddrInfo is NULL.");
- return MSG_ERR_NULL_POINTER;
- }
-
- if ((err = MsgOpenContactSvc()) != MSG_SUCCESS) {
- MSG_DEBUG("MsgOpenContactSvc fail.");
- return err;
- }
-
- if (!isContactSvcConnected) {
- MSG_DEBUG("Contact Service Not Opened.");
- return MSG_ERR_UNKNOWN;
- }
-
- MSG_SEC_DEBUG("pSearchVal [%s]", pSearchVal);
-
- int ret = 0;
- unsigned int index = 0;
- contacts_query_h query = NULL;
- contacts_filter_h filter = NULL;
- contacts_list_h personNumbers = NULL;
-
- ret = contacts_query_create(_contacts_person_number._uri, &query);
- ret = contacts_filter_create(_contacts_person_number._uri, &filter);
-
- ret = contacts_filter_add_str(filter, _contacts_person_number.display_name, CONTACTS_MATCH_CONTAINS, pSearchVal);
- ret = contacts_query_set_filter(query, filter);
-
- ret = contacts_db_get_records_with_query(query, 0, 0, &personNumbers);
- if (ret != CONTACTS_ERROR_NONE) {
- MSG_DEBUG("contacts_db_get_records_with_query() Error [%d]", ret);
- contacts_query_destroy(query);
- contacts_filter_destroy(filter);
- contacts_list_destroy(personNumbers, true);
- return MSG_ERR_UNKNOWN;
- }
-
- ret = contacts_list_get_count(personNumbers, count);
- if (*count == 0 || ret != CONTACTS_ERROR_NONE) {
- MSG_DEBUG("No Serach Data from Contact Service.");
- *count = 0;
- contacts_query_destroy(query);
- contacts_filter_destroy(filter);
- contacts_list_destroy(personNumbers, true);
- return MSG_SUCCESS;
- }
-
- contacts_query_destroy(query);
- contacts_filter_destroy(filter);
-
- MSG_DEBUG(" *count [%d]", *count);
-
- *pAddrInfo = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S) * (*count)];
- memset(*pAddrInfo, 0x00, (sizeof(MSG_ADDRESS_INFO_S) * (*count)));
-
- contacts_record_h personNumber = NULL;
-
- while (CONTACTS_ERROR_NONE == contacts_list_get_current_record_p(personNumbers, &personNumber)) {
- char* normalizedNumber = NULL;
- ret = contacts_record_get_str(personNumber, _contacts_person_number.normalized_number, &normalizedNumber);
- if (ret != CONTACTS_ERROR_NONE) {
- MSG_DEBUG("contacts_record_get_int() Error [%d]", ret);
- } else if (normalizedNumber) {
- MSG_DEBUG("normalizedNumber [%s]", normalizedNumber);
- strncpy((*pAddrInfo)[index].addressVal, normalizedNumber, MAX_ADDRESS_VAL_LEN);
- }
-
- contacts_list_next(personNumbers);
- index++;
- }
-
- contacts_list_destroy(personNumbers, true);
-
-#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
- MSG_END();
-
- return MSG_SUCCESS;
-}
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index c20bbaa..5b5b6a6 100755
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -45,7 +45,7 @@ INCLUDE_DIRECTORIES(
INCLUDE(FindPkgConfig)
-SET(PKG_MODULES glib-2.0 vconf dlog libxml-2.0 boost json-glib-1.0 capi-system-info capi-media-thumbnail-util capi-media-image-util aul sqlite3 capi-media-metadata-extractor icu-uc libsystemd-login libsmack csr)
+SET(PKG_MODULES glib-2.0 vconf dlog libxml-2.0 boost json-glib-1.0 capi-system-info capi-media-thumbnail-util capi-media-image-util aul sqlite3 capi-media-metadata-extractor icu-uc libsystemd-login libsmack csr contacts-service2)
pkg_check_modules(utils_pkgs REQUIRED ${PKG_MODULES})
FOREACH(flag ${utils_pkgs_CFLAGS})
diff --git a/utils/MsgContact.cpp b/utils/MsgContact.cpp
index 3548641..e2a92da 100755
--- a/utils/MsgContact.cpp
+++ b/utils/MsgContact.cpp
@@ -22,13 +22,17 @@
#include "MsgGconfWrapper.h"
#include "MsgContact.h"
+#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
+extern "C"
+{
+ #include <contacts.h>
+}
+#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
/*==================================================================================================
VARIABLES
==================================================================================================*/
-#if 0
__thread bool isContactSvcConnected = false;
-#endif
/*==================================================================================================
INTERNAL FUNCTION IMPLEMENTATION
@@ -197,11 +201,148 @@ void normalizeNumber(const char *orig, char* dest, unsigned int destSize)
/*==================================================================================================
FUNCTION IMPLEMENTATION
==================================================================================================*/
+msg_error_t MsgOpenContactSvc()
+{
+#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
+ int errCode = CONTACTS_ERROR_NONE;
+
+ if (!isContactSvcConnected) {
+ errCode = contacts_connect();
+
+ if (errCode == CONTACTS_ERROR_NONE) {
+ MSG_DEBUG("Connect to Contact Service Success");
+ isContactSvcConnected = true;
+ } else {
+ MSG_DEBUG("Connect to Contact Service Fail [%d]", errCode);
+ isContactSvcConnected = false;
+ return MSG_ERR_DB_CONNECT;
+ }
+ } else {
+ MSG_DEBUG("Already connected to Contact Service.");
+ }
+#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
+ return MSG_SUCCESS;
+}
+
+
+msg_error_t MsgCloseContactSvc()
+{
+#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
+ int errCode = CONTACTS_ERROR_NONE;
+
+ if (isContactSvcConnected) {
+ errCode = contacts_disconnect();
+
+ if (errCode == CONTACTS_ERROR_NONE) {
+ MSG_DEBUG("Disconnect to Contact Service Success");
+ isContactSvcConnected = false;
+ } else {
+ MSG_DEBUG("Disconnect to Contact Service Fail [%d]", errCode);
+ return MSG_ERR_DB_DISCONNECT;
+ }
+ }
+#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
+ return MSG_SUCCESS;
+}
+
+msg_error_t MsgGetContactSearchList(const char *pSearchVal, MSG_ADDRESS_INFO_S **pAddrInfo, int *count)
+{
+ MSG_BEGIN();
+#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
+
+ msg_error_t err = MSG_SUCCESS;
+
+ *count = 0;
+
+ if (pSearchVal == NULL) {
+ MSG_DEBUG("pSearchVal is NULL.");
+ return MSG_ERR_NULL_POINTER;
+ }
+
+ if (pAddrInfo == NULL) {
+ MSG_DEBUG("pAddrInfo is NULL.");
+ return MSG_ERR_NULL_POINTER;
+ }
+
+ if ((err = MsgOpenContactSvc()) != MSG_SUCCESS) {
+ MSG_DEBUG("MsgOpenContactSvc fail.");
+ return err;
+ }
+
+ if (!isContactSvcConnected) {
+ MSG_DEBUG("Contact Service Not Opened.");
+ return MSG_ERR_UNKNOWN;
+ }
+
+ MSG_SEC_DEBUG("pSearchVal [%s]", pSearchVal);
+
+ int ret = 0;
+ unsigned int index = 0;
+ contacts_query_h query = NULL;
+ contacts_filter_h filter = NULL;
+ contacts_list_h personNumbers = NULL;
+
+ ret = contacts_query_create(_contacts_person_number._uri, &query);
+ ret = contacts_filter_create(_contacts_person_number._uri, &filter);
+
+ ret = contacts_filter_add_str(filter, _contacts_person_number.display_name, CONTACTS_MATCH_CONTAINS, pSearchVal);
+ ret = contacts_query_set_filter(query, filter);
+
+ ret = contacts_db_get_records_with_query(query, 0, 0, &personNumbers);
+ if (ret != CONTACTS_ERROR_NONE) {
+ MSG_DEBUG("contacts_db_get_records_with_query() Error [%d]", ret);
+ contacts_query_destroy(query);
+ contacts_filter_destroy(filter);
+ contacts_list_destroy(personNumbers, true);
+ return MSG_ERR_UNKNOWN;
+ }
+
+ ret = contacts_list_get_count(personNumbers, count);
+ if (*count == 0 || ret != CONTACTS_ERROR_NONE) {
+ MSG_DEBUG("No Serach Data from Contact Service.");
+ *count = 0;
+ contacts_query_destroy(query);
+ contacts_filter_destroy(filter);
+ contacts_list_destroy(personNumbers, true);
+ return MSG_SUCCESS;
+ }
+
+ contacts_query_destroy(query);
+ contacts_filter_destroy(filter);
+
+ MSG_DEBUG(" *count [%d]", *count);
+
+ *pAddrInfo = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S) * (*count)];
+ memset(*pAddrInfo, 0x00, (sizeof(MSG_ADDRESS_INFO_S) * (*count)));
+
+ contacts_record_h personNumber = NULL;
+
+ while (CONTACTS_ERROR_NONE == contacts_list_get_current_record_p(personNumbers, &personNumber)) {
+ char* normalizedNumber = NULL;
+ ret = contacts_record_get_str(personNumber, _contacts_person_number.normalized_number, &normalizedNumber);
+ if (ret != CONTACTS_ERROR_NONE) {
+ MSG_DEBUG("contacts_record_get_int() Error [%d]", ret);
+ } else if (normalizedNumber) {
+ MSG_DEBUG("normalizedNumber [%s]", normalizedNumber);
+ strncpy((*pAddrInfo)[index].addressVal, normalizedNumber, MAX_ADDRESS_VAL_LEN);
+ }
+
+ contacts_list_next(personNumbers);
+ index++;
+ }
+
+ contacts_list_destroy(personNumbers, true);
+
+#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
+ MSG_END();
+
+ return MSG_SUCCESS;
+}
+
msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_INFO_S *pContactInfo)
{
MSG_BEGIN();
#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
-#if 0
msg_error_t err = MSG_SUCCESS;
if ((err = MsgOpenContactSvc()) != MSG_SUCCESS) {
@@ -421,7 +562,6 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
}
contacts_record_destroy(contact, true);
-#endif
#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
MSG_END();
@@ -432,7 +572,6 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
msg_error_t MsgGetContactStyleDisplayName(const char *first, const char *last, const char *middle, const char *prefix, const char *suffix, int contactNameOrder, char *displayName, unsigned int size)
{
#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
-#if 0
if (first == NULL || last == NULL || middle == NULL || prefix == NULL || suffix == NULL || displayName == NULL || size ==0) {
MSG_DEBUG("Invalid parameter.");
return MSG_ERR_INVALID_PARAMETER;
@@ -493,7 +632,6 @@ msg_error_t MsgGetContactStyleDisplayName(const char *first, const char *last, c
}
MSG_SEC_DEBUG("displayName [%s]", displayName);
-#endif
#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
return MSG_SUCCESS;
}
@@ -502,7 +640,6 @@ msg_error_t MsgGetContactStyleDisplayName(const char *first, const char *last, c
void MsgAddPhoneLog(const MSG_MESSAGE_INFO_S *pMsgInfo)
{
#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
-#if 0
msg_error_t err = MSG_SUCCESS;
if ((err = MsgOpenContactSvc()) != MSG_SUCCESS) {
@@ -539,11 +676,11 @@ void MsgAddPhoneLog(const MSG_MESSAGE_INFO_S *pMsgInfo)
memset(strText, 0x00, sizeof(strText));
if (pMsgInfo->msgType.mainType == MSG_SMS_TYPE) {
- strncpy(strText, pMsgInfo->msgText, 100);
+ g_strlcpy(strText, pMsgInfo->msgText, sizeof(strText));
MSG_SEC_DEBUG("msgText : %s", strText);
} else if (pMsgInfo->msgType.mainType == MSG_MMS_TYPE) {
if (strlen(pMsgInfo->subject) > 0 || pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS) {
- strncpy(strText, pMsgInfo->subject, 100);
+ g_strlcpy(strText, pMsgInfo->subject, sizeof(strText));
MSG_SEC_DEBUG("subject : %s", strText);
} else {
char *pFileData = NULL;
@@ -588,7 +725,6 @@ void MsgAddPhoneLog(const MSG_MESSAGE_INFO_S *pMsgInfo)
contacts_record_destroy(plog, true);
}
-#endif
#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
}
@@ -596,7 +732,6 @@ void MsgAddPhoneLog(const MSG_MESSAGE_INFO_S *pMsgInfo)
void MsgDeletePhoneLog(msg_message_id_t msgId)
{
#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
-#if 0
msg_error_t err = MSG_SUCCESS;
if ((err = MsgOpenContactSvc()) != MSG_SUCCESS) {
@@ -655,7 +790,6 @@ void MsgDeletePhoneLog(msg_message_id_t msgId)
contacts_query_destroy(query);
contacts_filter_destroy(filter);
contacts_list_destroy(plogs, true);
-#endif
#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
}