X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=utils%2FMsgUtilFunction.cpp;h=01743739ec5b68e834ba10b0608e23c3361f1237;hb=05890ff1c4104fa5f556b97eb9283c68dfa85d22;hp=72ca1b565f8a36edbb8a4e5b208f9b0e83ce6dee;hpb=79fd21d5513806a3512d7af99aef6f8ac3dd6c81;p=platform%2Fcore%2Fmessaging%2Fmsg-service.git diff --git a/utils/MsgUtilFunction.cpp b/utils/MsgUtilFunction.cpp index 72ca1b5..0174373 100755 --- a/utils/MsgUtilFunction.cpp +++ b/utils/MsgUtilFunction.cpp @@ -14,19 +14,35 @@ * limitations under the License. */ -#include +#include #include "MsgDebug.h" #include "MsgContact.h" +#include "MsgGconfWrapper.h" #include "MsgUtilFile.h" #include "MsgUtilFunction.h" +#include "MsgUtilStorage.h" #include #include #include #include #include +#include +#include +#include + +typedef struct _msg_launch_app_data { + char *app_id; + bundle *bundle_data; +} msg_launch_app_data; + +#define DEFAULT_MIN_MATCH_DIGIT 8 +#define SYSPOPUP_BUS_NAME "org.tizen.DevicePolicyManager" +#define SYSPOPUP_OBJECT_PATH "/org/tizen/DevicePolicyManager/Syspopup" +#define SYSPOPUP_INTERFACE "org.tizen.DevicePolicyManager.Syspopup" +#define SYSPOPUP_METHOD_SHOW "show" enum _FEATURE_INDEX_E { FEATURE_INDEX_SMS = 0, @@ -39,7 +55,17 @@ static bool b_feature_support[] = { [FEATURE_INDEX_MMS] = false, }; -int _dbus_owner_id = 0; +static int dpm_policy_enable[] = { + [MSG_UNKNOWN_TYPE] = 0, + [MSG_SMS_TYPE] = 1, + [MSG_MMS_TYPE] = 1, +}; + +#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED +static int phonenumberMinMatchDigit = -1; +#endif + +pthread_mutex_t mx = PTHREAD_MUTEX_INITIALIZER; /*================================================================================================== FUNCTION IMPLEMENTATION @@ -71,7 +97,28 @@ bool MsgCheckFeatureSupport(const char *feature_name) return result; } -// Encoders + +int MsgContactGetMinMatchDigit() +{ +#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED + if (phonenumberMinMatchDigit <= 0) { + if (MsgSettingGetInt(VCONFKEY_CONTACTS_SVC_PHONENUMBER_MIN_MATCH_DIGIT, &phonenumberMinMatchDigit) != MSG_SUCCESS) { + MSG_INFO("MsgSettingGetInt() is failed"); + } + MSG_DEBUG("phonenumberMinMatchDigit [%d]", phonenumberMinMatchDigit); + + if (phonenumberMinMatchDigit < 1) { + phonenumberMinMatchDigit = DEFAULT_MIN_MATCH_DIGIT; + } + } + + return phonenumberMinMatchDigit; +#else + return DEFAULT_MIN_MATCH_DIGIT; +#endif +} + +/* Encoders */ int MsgEncodeCountInfo(MSG_COUNT_INFO_S *pCountInfo, char **ppDest) { int dataSize = 0; @@ -102,8 +149,7 @@ int MsgEncodeRecipientList(MSG_RECIPIENTS_LIST_S *pRecipientList, char **ppDest) memcpy(p, &count, sizeof(int)); p = (void*)((char*)p + sizeof(int)); - for (int i = 0; i < count; i++) - { + for (int i = 0; i < count; i++) { memcpy(p, &(pRecipientList->recipientAddr[i]), sizeof(MSG_ADDRESS_INFO_S)); p = (void*)((char*)p + sizeof(MSG_ADDRESS_INFO_S)); } @@ -210,8 +256,7 @@ int MsgEncodeFolderList(msg_struct_list_s *pFolderList, char **ppDest) msg_struct_s *folder_info = NULL; - for (int i = 0; i < count; i++) - { + for (int i = 0; i < count; i++) { folder_info = (msg_struct_s *)pFolderList->msg_struct_info[i]; memcpy(p, folder_info->data, sizeof(MSG_FOLDER_INFO_S)); p = (void*)((char*)p + sizeof(MSG_FOLDER_INFO_S)); @@ -237,8 +282,7 @@ int MsgEncodeFilterList(msg_struct_list_s *pFilterList, char **ppDest) msg_struct_s *filter_info = NULL; - for (int i = 0; i < count; i++) - { + for (int i = 0; i < count; i++) { filter_info = (msg_struct_s *)pFilterList->msg_struct_info[i]; memcpy(p, filter_info->data, sizeof(MSG_FILTER_S)); p = (void*)((char*)p + sizeof(MSG_FILTER_S)); @@ -281,8 +325,7 @@ int MsgEncodeThreadViewList(msg_struct_list_s *pThreadViewList, char **ppDest) msg_struct_s *thread_info = NULL; - for (int i = 0; i < count; i++) - { + for (int i = 0; i < count; i++) { thread_info = (msg_struct_s *)pThreadViewList->msg_struct_info[i]; memcpy(p, thread_info->data, sizeof(MSG_THREAD_VIEW_S)); p = (void*)((char*)p + sizeof(MSG_THREAD_VIEW_S)); @@ -307,8 +350,7 @@ int MsgEncodeConversationViewList(msg_struct_list_s *pConvViewList, char **ppDes memcpy(p, &count, sizeof(int)); p = (void*)((char*)p + sizeof(int)); - for (int i = 0; i < count; i++) - { + for (int i = 0; i < count; i++) { memcpy(p, &(pConvViewList->msg_struct_info[i]), sizeof(msg_struct_list_s)); p = (void*)((char*)p + sizeof(msg_struct_list_s)); } @@ -405,6 +447,25 @@ int MsgEncodeStorageChangeData(const msg_storage_change_type_t storageChangeType } +int MsgEncodeThreadChangeData(const msg_storage_change_type_t storageChangeType, const msg_thread_id_t threadId, char **ppDest) +{ + int dataSize = 0; + + dataSize = sizeof(msg_storage_change_type_t) + sizeof(msg_thread_id_t); + + *ppDest = (char*)new char[dataSize]; + + void* p = (void*)*ppDest; + + memcpy(p, &storageChangeType, sizeof(msg_storage_change_type_t)); + p = (void*)((char*)p + sizeof(msg_storage_change_type_t)); + + memcpy(p, &threadId, sizeof(msg_thread_id_t)); + + return dataSize; +} + + int MsgEncodeReportMsgData(const msg_report_type_t msgReportType, const MSG_MESSAGE_INFO_S *pMsgInfo, char **ppDest) { int dataSize = 0; @@ -488,8 +549,7 @@ int MsgEncodeThreadInfo(MSG_THREAD_VIEW_S *pThreadInfo, char **ppDest) } - -// Decoders +/* Decoders */ void MsgDecodeMsgId(char *pSrc, msg_message_id_t *pMsgId) { memcpy(pMsgId, pSrc, sizeof(msg_message_id_t)); @@ -519,7 +579,7 @@ void MsgDecodeMsgInfo(char *pSrc, MSG_MESSAGE_INFO_S *pMsgInfo) pMsgInfo->addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S) * pMsgInfo->nAddressCnt]; memset(pMsgInfo->addressList, 0x00, sizeof(MSG_ADDRESS_INFO_S) * pMsgInfo->nAddressCnt); - for (int i=0; inAddressCnt; i++) { + for (int i = 0; i < pMsgInfo->nAddressCnt; i++) { memcpy(&(pMsgInfo->addressList[i]), pSrc + (sizeof(MSG_ADDRESS_INFO_S)*i), sizeof(MSG_ADDRESS_INFO_S)); } } @@ -535,14 +595,13 @@ void MsgDecodeMsgInfo(char *pSrc, MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I pSrc = pSrc + sizeof(MSG_SENDINGOPT_INFO_S); - if(pMsgInfo->nAddressCnt > 0) { pMsgInfo->addressList = NULL; pMsgInfo->addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S) * pMsgInfo->nAddressCnt]; memset(pMsgInfo->addressList, 0x00, sizeof(MSG_ADDRESS_INFO_S) * pMsgInfo->nAddressCnt); - for (int i=0; inAddressCnt; i++) { + for (int i = 0; i < pMsgInfo->nAddressCnt; i++) { memcpy(&(pMsgInfo->addressList[i]), pSrc + (sizeof(MSG_ADDRESS_INFO_S)*i), sizeof(MSG_ADDRESS_INFO_S)); } } @@ -556,13 +615,12 @@ void MsgDecodeRecipientList(char *pSrc, MSG_RECIPIENTS_LIST_S *pRecipientList) memcpy(&count, pSrc, sizeof(int)); pSrc = pSrc + sizeof(int); - pRecipientList->recipientCnt= count; + pRecipientList->recipientCnt = count; pRecipientList->recipientAddr = (MSG_ADDRESS_INFO_S*)new char[sizeof(MSG_ADDRESS_INFO_S)*count]; MSG_ADDRESS_INFO_S* pInfoTmp = pRecipientList->recipientAddr; - for (int i = 0; i < count; i++) - { + for (int i = 0; i < count; i++) { memcpy(pInfoTmp, pSrc, sizeof(MSG_ADDRESS_INFO_S)); pSrc = pSrc + sizeof(MSG_ADDRESS_INFO_S); pInfoTmp++; @@ -577,19 +635,16 @@ void MsgDecodeFolderList(char *pSrc, msg_struct_list_s *pFolderList) memcpy(&count, pSrc, sizeof(int)); pSrc = pSrc + sizeof(int); - if( count > 0 ) - { + if( count > 0 ) { pFolderList->nCount = count; pFolderList->msg_struct_info = (msg_struct_t *)calloc(count, sizeof(msg_struct_t)); - if (pFolderList->msg_struct_info == NULL) - { + if (pFolderList->msg_struct_info == NULL) { pFolderList->nCount = 0; return; } msg_struct_s *pInfoTmp = NULL; - for (int i = 0; i < count; i++) - { + for (int i = 0; i < count; i++) { pFolderList->msg_struct_info[i] = (msg_struct_t )new msg_struct_s; pInfoTmp = (msg_struct_s *)pFolderList->msg_struct_info[i]; pInfoTmp->type = MSG_STRUCT_FOLDER_INFO; @@ -597,9 +652,7 @@ void MsgDecodeFolderList(char *pSrc, msg_struct_list_s *pFolderList) memcpy(pInfoTmp->data, pSrc, sizeof(MSG_FOLDER_INFO_S)); pSrc = pSrc + sizeof(MSG_FOLDER_INFO_S); } - } - else if ( count == 0 ) - { + } else if ( count == 0 ) { pFolderList->nCount = count; pFolderList->msg_struct_info = NULL; } @@ -613,8 +666,7 @@ void MsgDecodeFilterList(char *pSrc, msg_struct_list_s *pFilterList) memcpy(&count, pSrc, sizeof(int)); pSrc = pSrc + sizeof(int); - if( count > 0 ) - { + if( count > 0 ) { pFilterList->nCount = count; pFilterList->msg_struct_info = (msg_struct_t *)calloc(count, sizeof(MSG_FILTER_S *)); @@ -625,8 +677,7 @@ void MsgDecodeFilterList(char *pSrc, msg_struct_list_s *pFilterList) msg_struct_s *pStructTmp = NULL; - for (int i = 0; i < count; i++) - { + for (int i = 0; i < count; i++) { pFilterList->msg_struct_info[i] = (msg_struct_t )new msg_struct_s; pStructTmp = (msg_struct_s *)pFilterList->msg_struct_info[i]; pStructTmp->type = MSG_STRUCT_FILTER; @@ -634,13 +685,10 @@ void MsgDecodeFilterList(char *pSrc, msg_struct_list_s *pFilterList) memcpy(pStructTmp->data, pSrc, sizeof(MSG_FILTER_S)); pSrc = pSrc + sizeof(MSG_FILTER_S); } - } - else if ( count == 0 ) - { + } else if ( count == 0 ) { pFilterList->nCount = count; pFilterList->msg_struct_info = NULL; } - } @@ -701,7 +749,6 @@ void MsgDecodeReportStatus(char *pSrc, msg_struct_list_s *report_list) msg_struct_t *report_status = (msg_struct_t *)new char[sizeof(msg_struct_t)*count]; for (int i = 0; i < count; i++) { - msg_struct_s *report_status_item = new msg_struct_s; report_status_item->type = MSG_STRUCT_REPORT_STATUS_INFO; report_status_item->data = new MSG_REPORT_STATUS_INFO_S; @@ -733,7 +780,7 @@ void MsgDecodeThreadInfo(char *pSrc, MSG_THREAD_VIEW_S *pThreadInfo) memcpy(pThreadInfo, pSrc, sizeof(MSG_THREAD_VIEW_S)); } -// Event Encoder +/* Event Encoder */ int MsgMakeEvent(const void *pData, int DataSize, MSG_EVENT_TYPE_T MsgEvent, msg_error_t MsgError, void **ppEvent) { MSG_EVENT_S* pMsgEvent = NULL; @@ -793,7 +840,6 @@ int msg_verify_email(const char *raw) } for (int i = 0; raw[i]; i++) { - if (raw[i] == '@') { onlyNum = false; @@ -833,14 +879,12 @@ char* msg_clean_country_code(char *src) { int ret = 1; - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 1: case 7: break; case 2: - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 0: case 7: break; @@ -860,8 +904,7 @@ char* msg_clean_country_code(char *src) } break; case 3: - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 0: case 1: case 2: @@ -881,8 +924,7 @@ char* msg_clean_country_code(char *src) } break; case 4: - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 0: case 1: case 3: @@ -902,8 +944,7 @@ char* msg_clean_country_code(char *src) } break; case 5: - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 1: case 2: case 3: @@ -923,8 +964,7 @@ char* msg_clean_country_code(char *src) } break; case 6: - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 0: case 1: case 2: @@ -944,8 +984,7 @@ char* msg_clean_country_code(char *src) } break; case 8: - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 1: case 2: case 4: @@ -965,8 +1004,7 @@ char* msg_clean_country_code(char *src) } break; case 9: - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 0: case 1: case 2: @@ -1012,6 +1050,28 @@ char* msg_normalize_number(char *src) } +char *getTranslateText(const char *pkg_name, const char *locale_dir, const char *text) +{ + char *notiMsg = NULL; + char *lang = NULL; + + lang = vconf_get_str(VCONFKEY_LANGSET); + + setlocale(LC_MESSAGES, lang); + + bindtextdomain(pkg_name, locale_dir); + + notiMsg = dgettext(pkg_name, text); + + if (lang) { + free(lang); + lang = NULL; + } + + return g_strdup(notiMsg); +} + + msg_error_t MsgMakeSortRule(const MSG_SORT_RULE_S *pSortRule, char *pSqlSort) { char sql[128]; @@ -1025,21 +1085,12 @@ msg_error_t MsgMakeSortRule(const MSG_SORT_RULE_S *pSortRule, char *pSqlSort) else strncpy(order, "DESC", 5); - int nameOrder = MsgGetContactNameOrder(); - - switch (pSortRule->sortType) - { + switch (pSortRule->sortType) { case MSG_SORT_BY_DISPLAY_FROM : - if (nameOrder == 0) - snprintf(sql, sizeof(sql), "ORDER BY B.FIRST_NAME %s, B.LAST_NAME %s, B.ADDRESS_VAL, A.DISPLAY_TIME DESC;", order, order); - else - snprintf(sql, sizeof(sql), "ORDER BY B.LAST_NAME %s, B.FIRST_NAME %s, B.ADDRESS_VAL, A.DISPLAY_TIME DESC;", order, order); + snprintf(sql, sizeof(sql), "ORDER BY B.FIRST_NAME %s, B.LAST_NAME %s, B.ADDRESS_VAL, A.DISPLAY_TIME DESC;", order, order); break; case MSG_SORT_BY_DISPLAY_TO : - if (nameOrder == 0) - snprintf(sql, sizeof(sql), "ORDER BY B.FIRST_NAME %s, B.LAST_NAME %s, B.ADDRESS_VAL, A.DISPLAY_TIME DESC;", order, order); - else - snprintf(sql, sizeof(sql), "ORDER BY B.LAST_NAME %s, B.FIRST_NAME %s, B.ADDRESS_VAL, A.DISPLAY_TIME DESC;", order, order); + snprintf(sql, sizeof(sql), "ORDER BY B.FIRST_NAME %s, B.LAST_NAME %s, B.ADDRESS_VAL, A.DISPLAY_TIME DESC;", order, order); break; case MSG_SORT_BY_DISPLAY_TIME : snprintf(sql, sizeof(sql), "ORDER BY DISPLAY_TIME %s;", order); @@ -1054,10 +1105,7 @@ msg_error_t MsgMakeSortRule(const MSG_SORT_RULE_S *pSortRule, char *pSqlSort) snprintf(sql, sizeof(sql), "ORDER BY A.STORAGE_ID %s, A.DISPLAY_TIME DESC;", order); break; case MSG_SORT_BY_THREAD_NAME : - if (nameOrder == 0) - snprintf(sql, sizeof(sql), "ORDER BY FIRST_NAME %s, LAST_NAME %s;", order, order); - else - snprintf(sql, sizeof(sql), "ORDER BY LAST_NAME %s, FIRST_NAME %s;", order, order); + snprintf(sql, sizeof(sql), "ORDER BY FIRST_NAME %s, LAST_NAME %s;", order, order); break; case MSG_SORT_BY_THREAD_DATE : snprintf(sql, sizeof(sql), "ORDER BY MSG_TIME %s;", order); @@ -1088,7 +1136,7 @@ msg_error_t msg_write_text_to_msg_info(MSG_MESSAGE_INFO_S *pMsgInfo, char *text) if (pMsgInfo->dataSize > MAX_MSG_TEXT_LEN) { pMsgInfo->bTextSms = false; - // Save Message Data into File + /* Save Message Data into File */ char fileName[MSG_FILENAME_LEN_MAX+1]; memset(fileName, 0x00, sizeof(fileName)); @@ -1172,38 +1220,176 @@ gchar * msg_replace_non_ascii_char(const gchar *pszText, gunichar replacementCha gchar *res; gsize result_len = 0; const gchar *p; - result_len = g_utf8_strlen (pszText, -1) + 1; //+1 for malloc of non-terminating chracter + result_len = g_utf8_strlen(pszText, -1) + 1; /* +1 for malloc of non-terminating chracter */ res = (gchar *)g_malloc (result_len * sizeof (gchar)); int i = 0; - for (p = pszText, i = 0; *p != '\0'; p = g_utf8_next_char (p), i++) { - res[i] = isascii(g_utf8_get_char (p)) ? *p : replacementChar; + for (p = pszText, i = 0; *p != '\0'; p = g_utf8_next_char(p), i++) { + res[i] = isascii(g_utf8_get_char(p)) ? *p : replacementChar; } res[i] = '\0'; return res; } -void MsgDbusInit() + +static int __find_login_user(uid_t *uid) { - MSG_DEBUG(); + uid_t *uids = NULL; - _dbus_owner_id = g_bus_own_name(G_BUS_TYPE_SYSTEM, - "msg-service.dbus.service", - G_BUS_NAME_OWNER_FLAGS_NONE, - NULL, NULL, NULL, - NULL, NULL); + int uids_len = sd_get_active_uids(&uids); + if (uids == NULL) + return -1; - if (_dbus_owner_id == 0) { - MSG_ERR("g_bus_own_name() error"); + if (uids_len != 1) { + free(uids); + return -1; } - MSG_DEBUG("owner_id = [%d]", _dbus_owner_id); + *uid = uids[0]; + + free(uids); + return 0; } -void MsgDbusDeinit() + +uid_t msg_get_login_user() { - MSG_DEBUG(); - if (_dbus_owner_id) - g_bus_unown_name(_dbus_owner_id); + uid_t uid = -1; - _dbus_owner_id = 0; + if (__find_login_user(&uid) < 0) { + MSG_WARN("Cannot find login user"); + } + + MSG_DEBUG("login user id [%d]", uid); + + return uid; +} + + +void* _msg_launch_app(void *data) +{ + pthread_mutex_lock(&mx); + if (data) { + msg_launch_app_data *ad = (msg_launch_app_data *)data; + int ret = aul_launch_app_for_uid(ad->app_id, ad->bundle_data, msg_get_login_user()); + if (ret <= 0) { + MSG_ERR("aul_launch_app_for_uid() is failed : %d", ret); + } + + g_free(ad->app_id); + bundle_free(ad->bundle_data); + g_free(ad); + } + pthread_mutex_unlock(&mx); + + return NULL; +} + +msg_error_t msg_launch_app(const char *app_id, bundle *bundle_data) +{ + msg_launch_app_data *data = (msg_launch_app_data *)calloc(1, sizeof(msg_launch_app_data)); + if (data == NULL) { + MSG_ERR("Memory alloc failed!"); + return MSG_ERR_MEMORY_ERROR; + } + + data->app_id = g_strdup(app_id); + data->bundle_data = bundle_dup(bundle_data); + pthread_t thd; + + if (pthread_create(&thd, NULL, &_msg_launch_app, data) < 0) { + MSG_ERR("pthread_create() error"); + } + + pthread_detach(thd); + return MSG_SUCCESS; +} + + +msg_error_t msg_aul_svc_set_operation(bundle *bundle_data, const char *operation) +{ + int ret = aul_svc_set_operation(bundle_data, operation); + if (ret < 0) { + MSG_ERR("aul_svc_set_operation() is failed : %d", ret); + return MSG_ERR_UNKNOWN; + } + + return MSG_SUCCESS; +} + + +msg_error_t msg_aul_svc_set_uri(bundle *bundle_data, char *uri) +{ + int ret = aul_svc_set_uri(bundle_data, uri); + if (ret < 0) { + MSG_ERR("aul_svc_set_uri() is failed : %d", ret); + return MSG_ERR_UNKNOWN; + } + + return MSG_SUCCESS; +} + + +void msg_set_dpm_policy(int type, int state) +{ + dpm_policy_enable[type] = state; +} + + +bool msg_check_dpm_policy(int type) +{ + return dpm_policy_enable[MSG_SMS_TYPE]; +// return dpm_policy_enable[type]; +} + + +void msg_syspopup_message(bool is_sending) +{ + MSG_INFO("popup toast for dpm restriction. is_sending [%d]", is_sending); + + GDBusConnection *connection = NULL; + GDBusProxy *dbus_proxy = NULL; + GVariant *result = NULL; + GError *error = NULL; + + connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); + if (error) { + MSG_ERR("Connecting to system bus failed: %s\n", error->message); + goto _DBUS_ERROR; + } + + dbus_proxy = g_dbus_proxy_new_sync(connection, G_DBUS_PROXY_FLAGS_NONE, NULL, + SYSPOPUP_BUS_NAME, SYSPOPUP_OBJECT_PATH, SYSPOPUP_INTERFACE, NULL, &error); + if (error) { + MSG_ERR("Connecting to proxy failed: %s\n", error->message); + goto _DBUS_ERROR; + } + + result = g_dbus_proxy_call_sync(dbus_proxy, SYSPOPUP_METHOD_SHOW, + g_variant_new("(s)", is_sending ? "message-sending" : "message-retrieving"), + G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error); + if (error) { + MSG_ERR("invoking proxy call failed: %s\n", error->message); + goto _DBUS_ERROR; + } + +_DBUS_ERROR: + if (error) { + g_error_free(error); + error = NULL; + } + + if (connection) { + g_object_unref(connection); + connection = NULL; + } + + if (dbus_proxy) { + g_object_unref(dbus_proxy); + dbus_proxy = NULL; + } + + if (result) { + g_object_unref(result); + result = NULL; + } }