From 9c9ddf430ae64840c6a360a8e1e81d064045fbe8 Mon Sep 17 00:00:00 2001 From: Keebum Kim Date: Sun, 3 Feb 2013 19:06:02 +0900 Subject: [PATCH] Modify Contact service open related. --- utils/MsgContact.cpp | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/utils/MsgContact.cpp b/utils/MsgContact.cpp index 617870b..ae4ada3 100755 --- a/utils/MsgContact.cpp +++ b/utils/MsgContact.cpp @@ -91,6 +91,13 @@ msg_error_t MsgCloseContactSvc() msg_error_t MsgInitContactSvc(MsgContactChangeCB cb) { + msg_error_t err = MSG_SUCCESS; + + if ((err = MsgOpenContactSvc()) != MSG_SUCCESS) { + MSG_DEBUG("MsgOpenContactSvc fail."); + return err; + } + int errCode = CONTACTS_ERROR_NONE; if (!isContactSvcConnected) { @@ -117,15 +124,22 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I { MSG_BEGIN(); - MSG_DEBUG("Address Type [%d], Address Value [%s]", pAddrInfo->addressType, pAddrInfo->addressVal); + msg_error_t err = MSG_SUCCESS; - memset(pContactInfo, 0x00, sizeof(MSG_CONTACT_INFO_S)); + if ((err = MsgOpenContactSvc()) != MSG_SUCCESS) { + MSG_DEBUG("MsgOpenContactSvc fail."); + return err; + } if (!isContactSvcConnected) { MSG_DEBUG("Contact Service Not Opened."); return MSG_ERR_UNKNOWN; } + MSG_DEBUG("Address Type [%d], Address Value [%s]", pAddrInfo->addressType, pAddrInfo->addressVal); + + memset(pContactInfo, 0x00, sizeof(MSG_CONTACT_INFO_S)); + if (pAddrInfo->addressType == MSG_ADDRESS_TYPE_PLMN && strlen(pAddrInfo->addressVal) > (MAX_PHONE_NUMBER_LEN+1)) { MSG_DEBUG("Phone Number is too long [%s]", pAddrInfo->addressVal); return MSG_SUCCESS; @@ -531,6 +545,12 @@ bool MsgDeleteContact(int index) int MsgGetContactNameOrder() { + msg_error_t err = MSG_SUCCESS; + + if ((err = MsgOpenContactSvc()) != MSG_SUCCESS) { + MSG_DEBUG("MsgOpenContactSvc fail."); + return 0; + } if (!isContactSvcConnected) { MSG_DEBUG("Contact Service Not Opened."); @@ -556,6 +576,13 @@ int MsgGetContactNameOrder() void MsgAddPhoneLog(const MSG_MESSAGE_INFO_S *pMsgInfo) { + msg_error_t err = MSG_SUCCESS; + + if ((err = MsgOpenContactSvc()) != MSG_SUCCESS) { + MSG_DEBUG("MsgOpenContactSvc fail."); + return; + } + if (!isContactSvcConnected) { MSG_DEBUG("Contact Service Not Opened."); return; @@ -628,6 +655,13 @@ void MsgAddPhoneLog(const MSG_MESSAGE_INFO_S *pMsgInfo) void MsgDeletePhoneLog(msg_message_id_t msgId) { + msg_error_t err = MSG_SUCCESS; + + if ((err = MsgOpenContactSvc()) != MSG_SUCCESS) { + MSG_DEBUG("MsgOpenContactSvc fail."); + return; + } + MSG_DEBUG("MsgDeletePhoneLog [%d]", msgId); if (!isContactSvcConnected) { -- 2.7.4