+++ /dev/null
-/*
-* Copyright (c) 2011 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.
-*/
-
-/******************************************************************************
- * File: dbus-client-auth.c
- * Desc:
- * Created on: Oct, 2014
- * Auth: Yongjin Kim <youth.kim@samsung.com>
- *
- *****************************************************************************/
-
-#include <gio/gio.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <glib.h>
-#include <glib-object.h>
-
-#include <dbus-server.h>
-
-#include "dbus_client.h"
-#include "dbus_client_auth.h"
-#include "service_adaptor_client_type.h"
-#include "service_adaptor_client_log.h"
-#include "private/service-adaptor-client-auth.h"
-
-#include "util/service_adaptor_client_util.h"
-
-/******************************************************************************
- * Global variables and defines
- ******************************************************************************/
-
-/******************************************************************************
- * Private interface
- ******************************************************************************/
-
-/******************************************************************************
- * Private interface definition
- ******************************************************************************/
-
-/******************************************************************************
- * Public interface definition
- ******************************************************************************/
-
-/** @brief
- * @return service_adaptor_error_s
- * @remarks :
- */
-int _dbus_get_auth_plugin_list(GList **plugin_list,
- const char *imsi,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
-
- ipc_check_proxy(sac_interface_proxy);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_GET_AUTH_PLUGIN_LIST_METHOD,
- g_variant_new("(s)",
- imsi),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE(MAKE_RETURN_TYPE(private_plugin_list_type)))) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- } else {
- GVariant *call_result_struct[3];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
- call_result_struct[2] = g_variant_get_child_value(call_result, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[1]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[2]);
- ret = SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED;
- } else {
- gsize list_count = g_variant_n_children(call_result_struct[0]);
-
- for (gsize i = 0; i < list_count; i++) {
- GVariant *plugin_info_struct[private_service_adaptor_plugin_s_type_length];
- GVariant *plugin_info_entry_v = g_variant_get_child_value(call_result_struct[0], i);
- service_adaptor_plugin_s *info = (service_adaptor_plugin_s *) g_malloc0(sizeof(service_adaptor_plugin_s));
-
- for (size_t j = 0; j < private_service_adaptor_plugin_s_type_length; j++) {
- plugin_info_struct[j] = g_variant_get_child_value(plugin_info_entry_v, j);
- }
-
- int idx = 0;
- info->name = ipc_g_variant_dup_string(plugin_info_struct[idx++]);
- info->login = g_variant_get_boolean(plugin_info_struct[idx++]);
-
- for (size_t j = 0; j < private_service_adaptor_plugin_s_type_length; j++) {
- g_variant_unref(plugin_info_struct[j]);
- }
-
- *plugin_list = g_list_append(*plugin_list, info);
- }
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- g_variant_unref(call_result_struct[2]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-/** @brief
- * @return service_adaptor_error_s
- * @remarks :
- */
-int _dbus_set_auth(const char *service_name,
- const char *imsi,
- const char *plugin_name,
- const char *app_id,
- const char *app_secret,
- unsigned int service_id,
- void *user_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
-
- ipc_check_proxy(sac_interface_proxy);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_SET_AUTH_METHOD,
- g_variant_new("(" private_service_adaptor_set_auth_s_type ")",
- service_name, imsi, plugin_name, app_id, app_secret, "", "", service_id),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- sac_error("G_IO_ERROR DEBUG (%d)", (int)(g_error->code));
- if (g_error->code == G_IO_ERROR_TIMED_OUT) {
- error->code = SERVICE_ADAPTOR_ERROR_NETWORK;
- ret = SERVICE_ADAPTOR_ERROR_NETWORK;
- }
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE("(ts)"))) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- } else {
- GVariant *call_result_struct[2];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[0]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[1]);
- ret = _get_result_code(remote_call_result);
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
+++ /dev/null
-/*
-* Copyright (c) 2011 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.
-*/
-
-/******************************************************************************
- * File: dbus-client-contact.c
- * Desc:
- * Created on: Oct, 2014
- * Auth: Yongjin Kim <youth.kim@samsung.com>
- *
- *****************************************************************************/
-
-#include <gio/gio.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <glib.h>
-#include <glib-object.h>
-
-#include <dbus-server.h>
-
-#include "dbus_client.h"
-#include "dbus_client_contact.h"
-#include "service_adaptor_client_type.h"
-#include "service_adaptor_client_log.h"
-#include "private/service-adaptor-client-contact.h"
-
-#include "util/service_adaptor_client_util.h"
-/******************************************************************************
- * Global variables and defines
- ******************************************************************************/
-
-/******************************************************************************
- * Private interface
- ******************************************************************************/
-
-static void __safe_g_variant_builder_add_contact_string(GVariantBuilder *builder,
- const char *data)
-{
- if (NULL == data) {
- g_variant_builder_add(builder, "s", "");
- } else {
- char *_data = g_strconcat(" ", data, NULL);
- g_variant_builder_add(builder, "s", _data);
- free(_data);
- }
-}
-
-static char *__safe_dup_contact_string(char *data)
-{
- char *str = __safe_add_string(data);
- char *ret = NULL;
- if (0 < strlen(str)) {
- ret = g_strconcat(" ", str, NULL);
- } else {
- ret = strdup(str);
- }
-
- return ret;
-}
-
-/******************************************************************************
- * Private interface definition
- ******************************************************************************/
-
-GVariant *__create_contact_req_type(const char *service_name,
- service_adaptor_contact_req_s *contact_req,
- void *user_data)
-{
- GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE(private_contact_info_req_list_type));
-
- for (int i = 0; i < contact_req->cts_len; i++) {
- g_variant_builder_open(builder, G_VARIANT_TYPE(private_service_adaptor_contact_info_req_s_type));
- __safe_g_variant_builder_add_string(builder, contact_req->cts[i]->tp);
- __safe_g_variant_builder_add_string(builder, contact_req->cts[i]->id);
- __safe_g_variant_builder_add_string(builder, contact_req->cts[i]->pn);
- __safe_g_variant_builder_add_contact_string(builder, contact_req->cts[i]->nm);
- __safe_g_variant_builder_add_string(builder, contact_req->cts[i]->cc);
- g_variant_builder_close(builder);
- }
-
- GVariant *request = g_variant_new("(" private_service_adaptor_contact_req_s_type ")", __safe_add_string(service_name), contact_req->tt, builder, contact_req->cts_len);
-
- g_variant_builder_unref(builder);
-
- return request;
-}
-
-void __get_contact_res_type(GVariant *call_result_struct,
- service_adaptor_contact_res_s **contact_res,
- void **server_data)
-{
- GVariant *res_info_struct[private_service_adaptor_contact_res_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_contact_res_s_type_length; j++) {
- res_info_struct[j] = g_variant_get_child_value(call_result_struct, j);
- }
-
- int idx = 0;
- *contact_res = (service_adaptor_contact_res_s *) calloc(1, sizeof(service_adaptor_contact_res_s));
-
- if (NULL != (*contact_res)) {
- (*contact_res)->tt = g_variant_get_int64(res_info_struct[idx++]);
- sac_info("tt : %lld", (*contact_res)->tt);
-
- /* cts list */
- gsize cts_count = g_variant_n_children(res_info_struct[idx]);
- sac_info("cts count : %d", (int)cts_count);
-
- if (0 == cts_count) {
- (*contact_res)->cts_len = 0;
- sac_info("cts len : %u", (*contact_res)->cts_len);
-
- for (size_t j = 0; j < private_service_adaptor_contact_res_s_type_length; j++) {
- g_variant_unref(res_info_struct[j]);
- }
- return;
- }
-
- (*contact_res)->cts = (service_adaptor_contact_info_res_s **) calloc(cts_count, sizeof(service_adaptor_contact_info_res_s*));
-
- if (NULL == ((*contact_res)->cts)) {
- sac_error("Critical : Memory allocation failed");
- (*contact_res)->cts_len = 0;
-
- for (size_t j = 0; j < private_service_adaptor_contact_res_s_type_length; j++) {
- g_variant_unref(res_info_struct[j]);
- }
- return;
- }
- for (gsize i = 0; i < cts_count; i++) {
- GVariant *cts_info_struct[private_service_adaptor_contact_info_res_s_type_length];
- GVariant *cts_info_entry_v = g_variant_get_child_value(res_info_struct[idx], i);
-
- (*contact_res)->cts[i] = (service_adaptor_contact_info_res_s *) calloc(1, sizeof(service_adaptor_contact_info_res_s));
-
- if (NULL != ((*contact_res)->cts[i])) {
- for (size_t j = 0; j < private_service_adaptor_contact_info_res_s_type_length; j++) {
- cts_info_struct[j] = g_variant_get_child_value(cts_info_entry_v, j);
- }
-
- int idx2 = 0;
- (*contact_res)->cts[i]->duid = ipc_g_variant_dup_string(cts_info_struct[idx2++]);
- (*contact_res)->cts[i]->id = ipc_g_variant_dup_string(cts_info_struct[idx2++]);
- (*contact_res)->cts[i]->msisdn = ipc_g_variant_dup_string(cts_info_struct[idx2++]);
- (*contact_res)->cts[i]->ty = ipc_g_variant_dup_string(cts_info_struct[idx2++]);
- (*contact_res)->cts[i]->cc = ipc_g_variant_dup_string(cts_info_struct[idx2++]);
- (*contact_res)->cts[i]->pn = ipc_g_variant_dup_string(cts_info_struct[idx2++]);
- (*contact_res)->cts[i]->nm = ipc_g_variant_dup_string(cts_info_struct[idx2++]);
-
- /* evnt list */
- gsize evnt_count = g_variant_n_children(cts_info_struct[idx2]);
- (*contact_res)->cts[i]->evnt = (char **) calloc(evnt_count, sizeof(char *));
-
- if (NULL != ((*contact_res)->cts[i]->evnt)) {
- for (gsize k = 0; k < evnt_count; k++) {
- GVariant *evnt_info_struct;
- GVariant *evnt_info_entry_v = g_variant_get_child_value(cts_info_struct[idx2], k);
- evnt_info_struct = g_variant_get_child_value(evnt_info_entry_v, 0);
-
- (*contact_res)->cts[i]->evnt[k] = ipc_g_variant_dup_string(evnt_info_struct);
-
- g_variant_unref(evnt_info_struct);
- }
- }
- idx2++;
- /* evnt list */
-
- (*contact_res)->cts[i]->evnt_len = g_variant_get_uint32(cts_info_struct[idx2++]);
-
- /* image list */
- gsize img_count = g_variant_n_children(cts_info_struct[idx2]);
- sac_info("img_count : %d", (int)img_count);
- (*contact_res)->cts[i]->images = (service_adaptor_profile_image_h *) calloc(img_count, sizeof(service_adaptor_profile_image_h));
-
- if (NULL != ((*contact_res)->cts[i]->images)) {
- for (gsize k = 0; k < img_count; k++) {
- (*contact_res)->cts[i]->images[k] = (service_adaptor_profile_image_h) calloc(1, sizeof(struct _service_adaptor_profile_image_s));
- if (NULL != (*contact_res)->cts[i]->images[k]) {
- GVariant *img_info_struct[2];
- GVariant *img_info_entry_v = g_variant_get_child_value(cts_info_struct[idx2], k);
- img_info_struct[0] = g_variant_get_child_value(img_info_entry_v, 0);
-
- img_info_struct[1] = g_variant_get_child_value(img_info_entry_v, 1);
-
- (*contact_res)->cts[i]->images[k]->index = g_variant_get_int32(img_info_struct[0]);
- sac_info("Test (image index : %d)", (*contact_res)->cts[i]->images[k]->index);
- char *path = ipc_g_variant_dup_string(img_info_struct[1]);
- sac_info("Test (path : %s)", path);
-
- if (NULL != path) {
- strncpy((*contact_res)->cts[i]->images[k]->path, path, (CONTACT_PROFILE_IMAGE_PATH_LEN - 1));
- }
-
- g_variant_unref(img_info_struct[0]);
- g_variant_unref(img_info_struct[1]);
- }
- }
- }
- idx2++;
- /* image list */
-
- (*contact_res)->cts[i]->images_len = g_variant_get_uint32(cts_info_struct[idx2++]);
-
-
- /*(*contact_res)->cts[i]->img = ipc_g_variant_dup_string(cts_info_struct[idx2++]);*/
-
- /* adrs list */
- gsize adrs_count = g_variant_n_children(cts_info_struct[idx2]);
- (*contact_res)->cts[i]->adrs = (char **) calloc(adrs_count, sizeof(char *));
-
- if (NULL != ((*contact_res)->cts[i]->adrs)) {
- for (gsize k = 0; k < adrs_count; k++) {
- GVariant *adrs_info_struct;
- GVariant *adrs_info_entry_v = g_variant_get_child_value(cts_info_struct[idx2], k);
- adrs_info_struct = g_variant_get_child_value(adrs_info_entry_v, 0);
-
- (*contact_res)->cts[i]->adrs[k] = ipc_g_variant_dup_string(adrs_info_struct);
-
- g_variant_unref(adrs_info_struct);
- }
- }
- idx2++;
- /* adrs list */
-
- (*contact_res)->cts[i]->adrs_len = g_variant_get_uint32(cts_info_struct[idx2++]);
-
- /* mail list */
- gsize mail_count = g_variant_n_children(cts_info_struct[idx2]);
- (*contact_res)->cts[i]->mail = (char **) calloc(mail_count, sizeof(char *));
-
- if (NULL != ((*contact_res)->cts[i]->mail)) {
- for (gsize k = 0; k < mail_count; k++) {
- GVariant *mail_info_struct;
- GVariant *mail_info_entry_v = g_variant_get_child_value(cts_info_struct[idx2], k);
- mail_info_struct = g_variant_get_child_value(mail_info_entry_v, 0);
-
- (*contact_res)->cts[i]->mail[k] = ipc_g_variant_dup_string(mail_info_struct);
-
- g_variant_unref(mail_info_struct);
- }
- }
- idx2++;
- /* mail list */
-
- (*contact_res)->cts[i]->mail_len = g_variant_get_uint32(cts_info_struct[idx2++]);
- (*contact_res)->cts[i]->org = ipc_g_variant_dup_string(cts_info_struct[idx2++]);
- (*contact_res)->cts[i]->prsc = ipc_g_variant_dup_string(cts_info_struct[idx2++]);
- (*contact_res)->cts[i]->status = ipc_g_variant_dup_string(cts_info_struct[idx2++]);
- (*contact_res)->cts[i]->sids = g_variant_get_uint32(cts_info_struct[idx2++]);
- (*contact_res)->cts[i]->profile_type = g_variant_get_int32(cts_info_struct[idx2++]);
- (*contact_res)->cts[i]->profile_url = ipc_g_variant_dup_string(cts_info_struct[idx2++]);
-
- for (size_t j = 0; j < private_service_adaptor_contact_info_res_s_type_length; j++) {
- g_variant_unref(cts_info_struct[j]);
- }
- }
- }
- idx++;
- /* cts list */
-
- (*contact_res)->cts_len = g_variant_get_uint32(res_info_struct[idx++]);
- }
-
- for (size_t j = 0; j < private_service_adaptor_contact_res_s_type_length; j++) {
- g_variant_unref(res_info_struct[j]);
- }
-}
-
-GVariant *__create_profile_req_type(const char *service_name,
- service_adaptor_profile_req_s *profile_req,
- void *user_data)
-{
- GVariantBuilder *evnt_builder = g_variant_builder_new(G_VARIANT_TYPE("a(s)"));
-
- for (gsize j = 0; j < profile_req->evnt_len; j++) {
- __safe_g_variant_builder_add_array_string(evnt_builder, profile_req->evnt[j]);
- }
-
- GVariantBuilder *adrs_builder = g_variant_builder_new(G_VARIANT_TYPE("a(s)"));
-
- for (gsize j = 0; j < profile_req->adrs_len; j++) {
- __safe_g_variant_builder_add_array_string(adrs_builder, profile_req->adrs[j]);
- }
-
- GVariantBuilder *mail_builder = g_variant_builder_new(G_VARIANT_TYPE("a(s)"));
-
- for (gsize j = 0; j < profile_req->mail_len; j++) {
- __safe_g_variant_builder_add_array_string(mail_builder, profile_req->mail[j]);
- }
-
- char *converted_nm = __safe_dup_contact_string(profile_req->nm);
- GVariant *request = g_variant_new("(" private_service_adaptor_profile_req_s_type ")", __safe_add_string(service_name),
- __safe_add_string(profile_req->cc), __safe_add_string(profile_req->pn), converted_nm,
- evnt_builder, profile_req->evnt_len,
- __safe_add_string(profile_req->img),
- adrs_builder, profile_req->adrs_len, mail_builder, profile_req->mail_len,
- __safe_add_string(profile_req->org), __safe_add_string(profile_req->prsc), __safe_add_string(profile_req->status));
- free(converted_nm);
-
- g_variant_builder_unref(evnt_builder);
- g_variant_builder_unref(adrs_builder);
- g_variant_builder_unref(mail_builder);
-
- return request;
-}
-
-void __get_profile_res_type(GVariant *call_result_struct,
- service_adaptor_profile_res_s **profile_res,
- void **server_data)
-{
- GVariant *res_info_struct[private_service_adaptor_profile_res_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_profile_res_s_type_length; j++) {
- res_info_struct[j] = g_variant_get_child_value(call_result_struct, j);
- }
-
- int idx = 0;
- *profile_res = (service_adaptor_profile_res_s *) calloc(1, sizeof(service_adaptor_profile_res_s));
- if (NULL != *profile_res) {
- (*profile_res)->nm = ipc_g_variant_dup_string(res_info_struct[idx++]);
- (*profile_res)->img = ipc_g_variant_dup_string(res_info_struct[idx++]);
- (*profile_res)->prsc = ipc_g_variant_dup_string(res_info_struct[idx++]);
- (*profile_res)->status = ipc_g_variant_dup_string(res_info_struct[idx++]);
- }
-
- for (size_t j = 0; j < private_service_adaptor_profile_res_s_type_length; j++) {
- g_variant_unref(res_info_struct[j]);
- }
-}
-
-GVariant *__create_del_me_profile_req_type(const char *service_name,
- void *user_data)
-{
-
- GVariant *request = g_variant_new("(" private_service_adaptor_essential_s_type ")", __safe_add_string(service_name));
-
-
- return request;
-}
-
-
-GVariant *__create_file_path_req_type(const char *service_name,
- service_adaptor_profile_image_h *images,
- unsigned int images_len,
- void *user_data)
-{
-
-
- if (NULL == images) {
- images_len = 0;
- }
-
- GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(iis)"));
-
- for (int j = 0; j < images_len; j++) {
- sac_debug_func("[DBG] Set me profile image meta Params %dth [DBG]", j);
- sac_debug_func("type (%d) index (%d) path (%s)", images[j]->type, images[j]->index, images[j]->path);
- g_variant_builder_add(builder, "(iis)", (int32_t)(images[j]->type), (int32_t)images[j]->index, __safe_add_string(images[j]->path));
- }
-
- GVariant *request = g_variant_new("(" private_service_adaptor_contact_profile_image_req_s_type ")", __safe_add_string(service_name), builder, images_len);
-
- g_variant_builder_unref(builder);
-
- return request;
-}
-
-void __get_failed_image_meta_res_type(GVariant *call_result_struct,
- service_adaptor_profile_image_h **images,
- unsigned int *images_len)
-{
- GVariant *res_info_struct[private_service_adaptor_contact_profile_image_req_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_contact_profile_image_req_s_type_length; j++) {
- res_info_struct[j] = g_variant_get_child_value(call_result_struct, j);
- }
- int idx = 0;
- idx++; /* skip first value */
- gsize list_count = g_variant_n_children(res_info_struct[idx]);
-
- if (0 < list_count) {
- *images = (service_adaptor_profile_image_h *) calloc(list_count, sizeof(service_adaptor_profile_image_h));
- if (NULL == (*images)) {
- sac_error("Critical : Memory allocation failed!!");
- } else {
- for (int i = 0; i < list_count; i++) {
- (*images)[i] = (service_adaptor_profile_image_h)calloc(1, sizeof(struct _service_adaptor_profile_image_s));
- if (NULL == ((*images)[i])) {
- sac_error("Critical : Memory allocation failed!!");
- } else {
- GVariant *path_info_struct[3] = {NULL, };
- GVariant *path_info_entry_v = g_variant_get_child_value(res_info_struct[idx], i);
- path_info_struct[0] = g_variant_get_child_value(path_info_entry_v, 0);
- path_info_struct[1] = g_variant_get_child_value(path_info_entry_v, 1);
- path_info_struct[2] = g_variant_get_child_value(path_info_entry_v, 2);
-
- ((*images)[i])->type = g_variant_get_int32(path_info_struct[0]);
- ((*images)[i])->index = g_variant_get_int32(path_info_struct[1]);
- char *path = ipc_g_variant_dup_string(path_info_struct[2]);;
- snprintf(((*images)[i])->path, 2048, "%s", (path ? path : ""));
- free(path);
-
- g_variant_unref(path_info_struct[0]);
- g_variant_unref(path_info_struct[1]);
- g_variant_unref(path_info_struct[2]);
- }
- }
- }
- }
- idx++;
-
- *images_len = g_variant_get_uint32(res_info_struct[idx++]);
-
- for (size_t j = 0; j < private_service_adaptor_contact_profile_image_req_s_type_length; j++) {
- g_variant_unref(res_info_struct[j]);
- }
-}
-
-GVariant *__create_privacy_req_type(const char *service_name,
- service_adaptor_privacy_req_s *privacy_req,
- void *user_data)
-{
- GVariantBuilder *cts_builder = g_variant_builder_new(G_VARIANT_TYPE("a(ss)"));
-
- for (gsize j = 0; j < privacy_req->cts_len; j++) {
- g_variant_builder_open(cts_builder, G_VARIANT_TYPE("(ss)"));
- __safe_g_variant_builder_add_string(cts_builder, privacy_req->cts[j]->cc);
- __safe_g_variant_builder_add_string(cts_builder, privacy_req->cts[j]->pn);
- g_variant_builder_close(cts_builder);
- }
-
- GVariant *request = g_variant_new("(" private_service_adaptor_privacy_req_s_type ")", __safe_add_string(service_name), privacy_req->lvl, cts_builder, privacy_req->cts_len);
-
- g_variant_builder_unref(cts_builder);
-
- return request;
-}
-
-void __get_privacy_res_type(GVariant *call_result_struct,
- service_adaptor_privacy_res_s **privacy_res,
- void **server_data)
-{
- GVariant *res_info_struct[private_service_adaptor_privacy_res_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_privacy_res_s_type_length; j++) {
- res_info_struct[j] = g_variant_get_child_value(call_result_struct, j);
- }
-
- int idx = 0;
- *privacy_res = (service_adaptor_privacy_res_s *) calloc(1, sizeof(service_adaptor_privacy_res_s));
- if (NULL != *privacy_res) {
- (*privacy_res)->lvl = g_variant_get_uint32(res_info_struct[idx++]);
- (*privacy_res)->prscon = g_variant_get_uint32(res_info_struct[idx++]);
- }
-
- for (size_t j = 0; j < private_service_adaptor_privacy_res_s_type_length; j++) {
- g_variant_unref(res_info_struct[j]);
- }
-}
-
-void __get_profile_type_res_type(GVariant *call_result_struct,
- char **url)
-{
- GVariant *res_info_struct = NULL;
-
- res_info_struct = g_variant_get_child_value(call_result_struct, 0);
-
- *url = ipc_g_variant_dup_string(res_info_struct);
-
- g_variant_unref(res_info_struct);
-}
-
-
-/******************************************************************************
- * Public interface definition
- ******************************************************************************/
-
-/** @brief
- * @return service_adaptor_error_s
- * @remarks :
- */
-int _dbus_set_new_contact_list(const char *service_name,
- service_adaptor_contact_req_s *contact_req,
- void *user_data,
- service_adaptor_contact_res_s **contact_res,
- void **server_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
-
- ipc_check_proxy(sac_interface_proxy);
-
- GVariant *request = __create_contact_req_type(service_name, contact_req, user_data);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_SET_NEW_CONTACT_LIST_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE(MAKE_RETURN_TYPE(private_service_adaptor_contact_res_s_type)))) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- } else {
- GVariant *call_result_struct[3];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
- call_result_struct[2] = g_variant_get_child_value(call_result, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[1]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[2]);
- ret = _get_result_code(remote_call_result);
- } else {
- if (NULL != contact_res) {
- __get_contact_res_type(call_result_struct[0], contact_res, server_data);
- }
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- g_variant_unref(call_result_struct[2]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_set_contact_list(const char *service_name,
- service_adaptor_contact_req_s *contact_req,
- void *user_data,
- service_adaptor_contact_res_s **contact_res,
- void **server_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
-
- ipc_check_proxy(sac_interface_proxy);
-
- GVariant *request = __create_contact_req_type(service_name, contact_req, user_data);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_SET_CONTACT_LIST_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE(MAKE_RETURN_TYPE(private_service_adaptor_contact_res_s_type)))) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- } else {
- GVariant *call_result_struct[3];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
- call_result_struct[2] = g_variant_get_child_value(call_result, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[1]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[2]);
- ret = _get_result_code(remote_call_result);
- } else {
- if (NULL != contact_res) {
- __get_contact_res_type(call_result_struct[0], contact_res, server_data);
- }
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- g_variant_unref(call_result_struct[2]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_get_contact_list(const char *service_name,
- service_adaptor_contact_res_s **contact_res,
- void **server_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
-
- ipc_check_proxy(sac_interface_proxy);
-
- GVariant *request = g_variant_new("(" private_service_adaptor_essential_s_type ")", __safe_add_string(service_name));
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_GET_CONTACT_LIST_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE(MAKE_RETURN_TYPE(private_service_adaptor_contact_res_s_type)))) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- } else {
- GVariant *call_result_struct[3];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
- call_result_struct[2] = g_variant_get_child_value(call_result, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[1]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[2]);
- ret = _get_result_code(remote_call_result);
- } else {
- if (NULL != contact_res) {
- __get_contact_res_type(call_result_struct[0], contact_res, server_data);
- }
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- g_variant_unref(call_result_struct[2]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_get_contact_infos_polling(const char *service_name,
- service_adaptor_contact_req_s *contact_req,
- void *user_data,
- service_adaptor_contact_res_s **contact_res,
- void **server_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
-
- ipc_check_proxy(sac_interface_proxy);
-
- GVariant *request = __create_contact_req_type(service_name, contact_req, user_data);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_GET_CONTACT_INFOS_POLLING_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE(MAKE_RETURN_TYPE(private_service_adaptor_contact_res_s_type)))) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- } else {
- GVariant *call_result_struct[3];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
- call_result_struct[2] = g_variant_get_child_value(call_result, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[1]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[2]);
- ret = _get_result_code(remote_call_result);
- } else {
- if (NULL != contact_res) {
- __get_contact_res_type(call_result_struct[0], contact_res, server_data);
- }
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- g_variant_unref(call_result_struct[2]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_set_me_profile_with_push(const char *service_name,
- service_adaptor_profile_req_s *profile_req,
- void *user_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
-
- ipc_check_proxy(sac_interface_proxy);
-
- GVariant *request = __create_profile_req_type(service_name, profile_req, user_data);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_SET_ME_PROFILE_WITH_PUSH_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE("(ts)"))) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- } else {
- GVariant *call_result_struct[2];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[0]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[1]);
- ret = _get_result_code(remote_call_result);
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_get_profile(const char *service_name,
- service_adaptor_profile_req_s *profile_req,
- void *user_data,
- service_adaptor_profile_res_s **profile_res,
- void **server_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
-
- ipc_check_proxy(sac_interface_proxy);
-
- GVariant *request = __create_profile_req_type(service_name, profile_req, user_data);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_GET_PROFILE_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE(MAKE_RETURN_TYPE(private_service_adaptor_profile_res_s_type)))) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- } else {
- GVariant *call_result_struct[3];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
- call_result_struct[2] = g_variant_get_child_value(call_result, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[1]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[2]);
- ret = _get_result_code(remote_call_result);
- } else {
- if (NULL != profile_res) {
- __get_profile_res_type(call_result_struct[0], profile_res, server_data);
- }
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- g_variant_unref(call_result_struct[2]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_set_profile_image_meta_with_push(const char *service_name,
- service_adaptor_profile_image_h *images,
- unsigned int images_len,
- void *user_data,
- service_adaptor_profile_image_h **failed_images,
- unsigned int *failed_images_len,
- void **server_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
-
- ipc_check_proxy(sac_interface_proxy);
-
- GVariant *request = __create_file_path_req_type(service_name, images, images_len, user_data);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_SET_PROFILE_IMAGE_META_WITH_PUSH_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE(MAKE_RETURN_TYPE(private_service_adaptor_contact_profile_image_req_s_type)))) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- } else {
- GVariant *call_result_struct[3];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
- call_result_struct[2] = g_variant_get_child_value(call_result, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[1]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[2]);
- ret = _get_result_code(remote_call_result);
- if ((NULL != failed_images) && (NULL != failed_images_len)) {
- __get_failed_image_meta_res_type(call_result_struct[0], failed_images, failed_images_len);
- }
- } else {
- /* __get_failed_image_meta_res_type(call_result_struct[0], failed_images, failed_images_len); */
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- g_variant_unref(call_result_struct[2]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_delete_me_profile_image_meta_with_push(const char *service_name,
- void *user_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
-
- ipc_check_proxy(sac_interface_proxy);
-
- GVariant *request = __create_del_me_profile_req_type(service_name, user_data);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_DEL_ME_PROFILE_IMAGE_META_WITH_PUSH_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE("(ts)"))) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- } else {
- GVariant *call_result_struct[2];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[0]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[1]);
- ret = _get_result_code(remote_call_result);
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_set_me_profile_privacy(const char *service_name,
- service_adaptor_privacy_req_s *privacy_req,
- void *user_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
-
- ipc_check_proxy(sac_interface_proxy);
-
- GVariant *request = __create_privacy_req_type(service_name, privacy_req, user_data);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_SET_ME_PROFILE_PRIVACY_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE("(ts)"))) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- } else {
- GVariant *call_result_struct[2];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[0]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[1]);
- ret = _get_result_code(remote_call_result);
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_get_me_profile_privacy(const char *service_name,
- service_adaptor_privacy_res_s **privacy_res,
- void **server_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
-
- ipc_check_proxy(sac_interface_proxy);
-
- GVariant *request = g_variant_new("(" private_service_adaptor_essential_s_type ")", __safe_add_string(service_name));
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_GET_PROFILE_PRIVACY_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE(MAKE_RETURN_TYPE(private_service_adaptor_privacy_res_s_type)))) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- } else {
- GVariant *call_result_struct[3];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
- call_result_struct[2] = g_variant_get_child_value(call_result, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[1]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[2]);
- ret = _get_result_code(remote_call_result);
- } else {
- if (NULL != privacy_res) {
- __get_privacy_res_type(call_result_struct[0], privacy_res, server_data);
- }
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- g_variant_unref(call_result_struct[2]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_set_me_presence_with_push(const char *service_name,
- service_adaptor_presence_req_s *presence_req,
- void *user_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
-
- ipc_check_proxy(sac_interface_proxy);
-
- GVariant *request = g_variant_new("(" private_service_adaptor_presence_req_s_type ")",
- __safe_add_string(service_name), __safe_add_string(presence_req->prsc),
- __safe_add_string(presence_req->status), presence_req->prscon);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_SET_ME_PRESENCE_WITH_PUSH_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE("(ts)"))) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- } else {
- GVariant *call_result_struct[2];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[0]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[1]);
- ret = _get_result_code(remote_call_result);
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_set_me_presence_on_off_with_push(const char *service_name,
- service_adaptor_presence_req_s *presence_req,
- void *user_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
-
- ipc_check_proxy(sac_interface_proxy);
-
- GVariant *request = g_variant_new("(" private_service_adaptor_presence_req_s_type ")", __safe_add_string(service_name), __safe_add_string(presence_req->prsc), __safe_add_string(presence_req->status), presence_req->prscon);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_SET_ME_PRESENCE_ON_OFF_WITH_PUSH_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE("(ts)"))) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- } else {
- GVariant *call_result_struct[2];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[0]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[1]);
- ret = _get_result_code(remote_call_result);
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-
-int _dbus_set_me_profile_type(const char *service_name,
- int type,
- char **url,
- void *user_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
-
- ipc_check_proxy(sac_interface_proxy);
-
- GVariant *request = g_variant_new("(" private_service_adaptor_set_me_profile_type_req_s_type ")", __safe_add_string(service_name), type);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_SET_ME_PROFILE_TYPE_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE(MAKE_RETURN_TYPE(private_service_adaptor_essential_s_type)))) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- } else {
- GVariant *call_result_struct[3];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
- call_result_struct[2] = g_variant_get_child_value(call_result, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[1]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[2]);
- ret = _get_result_code(remote_call_result);
- } else {
- __get_profile_type_res_type(call_result_struct[0], url);
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- g_variant_unref(call_result_struct[2]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
+++ /dev/null
-/*
-* Copyright (c) 2011 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.
-*/
-
-/******************************************************************************
- * File: dbus-client-message.c
- * Desc:
- * Created on: Oct, 2014
- * Auth: Yongjin Kim <youth.kim@samsung.com>
- *
- *****************************************************************************/
-
-#include <gio/gio.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <glib.h>
-#include <glib-object.h>
-
-#include <dbus-server.h>
-
-#include "dbus_client.h"
-#include "dbus_client_message.h"
-#include "service_adaptor_client_type.h"
-#include "service_adaptor_client_log.h"
-#include "private/service-adaptor-client-message.h"
-
-#include "util/service_adaptor_client_util.h"
-/******************************************************************************
- * Global variables and defines
- ******************************************************************************/
-
-/******************************************************************************
- * Private interface
- ******************************************************************************/
-
-/******************************************************************************
- * Private interface definition
- ******************************************************************************/
-
-#define __FREE_ERROR_CODE(err) do { if (err) free(err->msg); free(err); (err) = NULL; } while (0)
-
-#define __FREE_POINTER_ARRAY(__arr, __len) do { \
- if ((NULL != (__arr)) && (0 < (__len))) { \
- for (int __idx = 0; __idx < (__len); __idx++) { \
- __SAFE_FREE(__arr[__idx]); \
- } \
- __SAFE_FREE((__arr)); \
- } } while (0)
-
-#define __ipc_get_simple_error_code() do { \
- GVariant *call_result_struct[2]; \
- call_result_struct[0] = g_variant_get_child_value(call_result, 0); \
- call_result_struct[1] = g_variant_get_child_value(call_result, 1); \
-\
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[0]); \
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) { \
- error->code = remote_call_result; \
- error->msg = ipc_g_variant_dup_string(call_result_struct[1]); \
- ret = _get_result_code(remote_call_result); \
- } \
- g_variant_unref(call_result_struct[0]); \
- g_variant_unref(call_result_struct[1]); \
- } while (0)
-
-void __free_wrong_receiver_s(service_adaptor_wrong_receiver_s *wrong_receiver)
-{
- __SAFE_FREE(wrong_receiver->invalid_receivers);
- __SAFE_FREE(wrong_receiver->interrupted_receivers);
- __SAFE_FREE(wrong_receiver->disabled_receivers);
- __SAFE_FREE(wrong_receiver->existing_chatmembers);
- __FREE_POINTER_ARRAY(wrong_receiver->did_violation_users, wrong_receiver->did_violation_users_len);
- __SAFE_FREE(wrong_receiver->invitation_denieds);
-}
-
-void __free_ordered_chat_member_s_list(service_adaptor_ordered_chat_member_s **ordered_chat_members, unsigned int ordered_chat_members_len)
-{
- if ((NULL != ordered_chat_members) && (0 < ordered_chat_members_len)) {
- for (int i = 0; i < ordered_chat_members_len; i++) {
- if (NULL != ordered_chat_members[i]) {
- __SAFE_FREE(ordered_chat_members[i]->name);
- __SAFE_FREE(ordered_chat_members[i]);
- }
- }
- }
-}
-void __free_inbox_message_s_list(service_adaptor_inbox_message_s **inbox_messages, unsigned int inbox_messages_len)
-{
- if ((NULL != inbox_messages) && (0 < inbox_messages_len)) {
- for (int i = 0; i < inbox_messages_len; i++) {
- if (NULL != inbox_messages[i]) {
- __SAFE_FREE(inbox_messages[i]->chat_msg);
- __SAFE_FREE(inbox_messages[i]);
- }
- }
- }
-}
-void __get_create_chatroom_res_type(GVariant *parameters,
- int64_t *request_id,
- int64_t *chatroom_id,
- int *default_message_ttl,
- service_adaptor_wrong_receiver_s *wrong_receiver)
-{
- GVariant *in_parameters = g_variant_get_child_value(parameters, 0);
- GVariant *res_struct[private_service_adaptor_create_chatroom_res_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_create_chatroom_res_s_type_length; j++) {
- res_struct[j] = g_variant_get_child_value(in_parameters, j);
- }
-
- int idx = 0;
- *request_id = g_variant_get_int64(res_struct[idx++]);
- *chatroom_id = g_variant_get_int64(res_struct[idx++]);
- *default_message_ttl = g_variant_get_int32(res_struct[idx++]);
-
- GVariant *res_info_struct[private_service_adaptor_wrong_receiver_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_wrong_receiver_s_type_length; j++) {
- res_info_struct[j] = g_variant_get_child_value(res_struct[idx], j);
- }
-
- int idx2 = 0;
-
- gsize invalid_count = g_variant_n_children(res_info_struct[idx2]);
- wrong_receiver->invalid_receivers = (int64_t *) calloc(invalid_count, sizeof(int64_t));
-
- if (NULL != wrong_receiver->invalid_receivers) {
- for (gsize i = 0; i < invalid_count; i++) {
- GVariant *info_entry_v = g_variant_get_child_value(res_info_struct[idx2], i);
- GVariant *info_struct = g_variant_get_child_value(info_entry_v, 0);
-
- wrong_receiver->invalid_receivers[i] = g_variant_get_int64(info_struct);
-
- g_variant_unref(info_struct);
- }
- idx2++;
- wrong_receiver->invalid_receivers_len = g_variant_get_uint32(res_info_struct[idx2++]);
- } else {
- wrong_receiver->invalid_receivers_len = 0U;
- idx2++;
- idx2++;
- }
-
- gsize interrupted_count = g_variant_n_children(res_info_struct[idx2]);
- wrong_receiver->interrupted_receivers = (int64_t *) calloc(interrupted_count, sizeof(int64_t));
-
- if (NULL != wrong_receiver->interrupted_receivers) {
- for (gsize i = 0; i < interrupted_count; i++) {
- GVariant *info_entry_v = g_variant_get_child_value(res_info_struct[idx2], i);
- GVariant *info_struct = g_variant_get_child_value(info_entry_v, 0);
-
- wrong_receiver->interrupted_receivers[i] = g_variant_get_int64(info_struct);
-
- g_variant_unref(info_struct);
- }
- idx2++;
- wrong_receiver->interrupted_receivers_len = g_variant_get_uint32(res_info_struct[idx2++]);
- } else {
- wrong_receiver->interrupted_receivers_len = 0U;
- idx2++;
- idx2++;
- }
-
- gsize disabled_count = g_variant_n_children(res_info_struct[idx2]);
- wrong_receiver->disabled_receivers = (int64_t *) calloc(disabled_count, sizeof(int64_t));
-
- if (NULL != wrong_receiver->disabled_receivers) {
- for (gsize i = 0; i < disabled_count; i++) {
- GVariant *info_entry_v = g_variant_get_child_value(res_info_struct[idx2], i);
- GVariant *info_struct = g_variant_get_child_value(info_entry_v, 0);
-
- wrong_receiver->disabled_receivers[i] = g_variant_get_int64(info_struct);
-
- g_variant_unref(info_struct);
- }
- idx2++;
- wrong_receiver->disabled_receivers_len = g_variant_get_uint32(res_info_struct[idx2++]);
- } else {
- wrong_receiver->disabled_receivers_len = 0U;
- idx2++;
- idx2++;
- }
-
- gsize existing_count = g_variant_n_children(res_info_struct[idx2]);
- wrong_receiver->existing_chatmembers = (int64_t *) calloc(existing_count, sizeof(int64_t));
-
- if (NULL != wrong_receiver->existing_chatmembers) {
- for (gsize i = 0; i < existing_count; i++) {
- GVariant *info_entry_v = g_variant_get_child_value(res_info_struct[idx2], i);
- GVariant *info_struct = g_variant_get_child_value(info_entry_v, 0);
-
- wrong_receiver->existing_chatmembers[i] = g_variant_get_int64(info_struct);
-
- g_variant_unref(info_struct);
- }
- idx2++;
- wrong_receiver->existing_chatmembers_len = g_variant_get_uint32(res_info_struct[idx2++]);
- } else {
- wrong_receiver->existing_chatmembers_len = 0U;
- idx2++;
- idx2++;
- }
-
- gsize did_violation_users_count = g_variant_n_children(res_info_struct[idx2]);
- wrong_receiver->did_violation_users = (service_adaptor_did_violation_users_s **) calloc(did_violation_users_count, sizeof(service_adaptor_did_violation_users_s *));
-
- if (NULL != wrong_receiver->did_violation_users) {
- for (gsize i = 0; i < did_violation_users_count; i++) {
- GVariant *info_entry_v = g_variant_get_child_value(res_info_struct[idx2], i);
- GVariant *info_struct[private_service_adaptor_did_violation_users_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_did_violation_users_s_type_length; j++) {
- info_struct[j] = g_variant_get_child_value(info_entry_v, j);
- }
-
- int idx3 = 0;
- wrong_receiver->did_violation_users[i] = (service_adaptor_did_violation_users_s *) calloc(1, sizeof(service_adaptor_did_violation_users_s));
- if (NULL != wrong_receiver->did_violation_users[i]) {
- wrong_receiver->did_violation_users[i]->usera = g_variant_get_int64(info_struct[idx3++]);
- wrong_receiver->did_violation_users[i]->userb = g_variant_get_int64(info_struct[idx3++]);
- }
-
- for (size_t j = 0; j < private_service_adaptor_did_violation_users_s_type_length; j++) {
- g_variant_unref(info_struct[j]);
- }
- }
- idx2++;
- wrong_receiver->did_violation_users_len = g_variant_get_uint32(res_info_struct[idx2++]);
- } else {
- wrong_receiver->did_violation_users_len = 0U;
- idx2++;
- idx2++;
- }
-
- gsize denieds_count = g_variant_n_children(res_info_struct[idx2]);
- wrong_receiver->invitation_denieds = (int64_t *) calloc(denieds_count, sizeof(int64_t));
-
- if (NULL != wrong_receiver->invitation_denieds) {
- for (gsize i = 0; i < denieds_count; i++) {
- GVariant *info_entry_v = g_variant_get_child_value(res_info_struct[idx2], i);
- GVariant *info_struct = g_variant_get_child_value(info_entry_v, 0);
-
- wrong_receiver->invitation_denieds[i] = g_variant_get_int64(info_struct);
-
- g_variant_unref(info_struct);
- }
- idx2++;
- wrong_receiver->invitation_denieds_len = g_variant_get_uint32(res_info_struct[idx2++]);
- } else {
- wrong_receiver->invitation_denieds_len = 0U;
- idx2++;
- idx2++;
- }
-
- for (size_t j = 0; j < private_service_adaptor_wrong_receiver_s_type_length; j++) {
- g_variant_unref(res_info_struct[j]);
- }
-
- for (size_t j = 0; j < private_service_adaptor_create_chatroom_res_s_type_length; j++) {
- g_variant_unref(res_struct[j]);
- }
-}
-
-void __get_change_chatroom_meta_res_type(GVariant *parameters,
- int64_t *request_id,
- int64_t *chatroom_id)
-{
- GVariant *in_parameters = g_variant_get_child_value(parameters, 0);
- GVariant *res_struct[private_service_adaptor_change_chatroom_meta_res_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_change_chatroom_meta_res_s_type_length; j++) {
- res_struct[j] = g_variant_get_child_value(in_parameters, j);
- }
-
- int idx = 0;
- *request_id = g_variant_get_int64(res_struct[idx++]);
- *chatroom_id = g_variant_get_int64(res_struct[idx++]);
-
- for (size_t j = 0; j < private_service_adaptor_change_chatroom_meta_res_s_type_length; j++) {
- g_variant_unref(res_struct[j]);
- }
-}
-
-void __get_chat_res_type(GVariant *parameters,
- int64_t *request_id,
- int64_t *chatroom_id,
- service_adaptor_processed_msg_s ***processed_msgs,
- unsigned int *processed_msgs_len)
-{
- GVariant *in_parameters = g_variant_get_child_value(parameters, 0);
- GVariant *res_struct[private_service_adaptor_chat_res_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_chat_res_s_type_length; j++) {
- res_struct[j] = g_variant_get_child_value(in_parameters, j);
- }
-
- int idx = 0;
- *request_id = g_variant_get_int64(res_struct[idx++]);
- *chatroom_id = g_variant_get_int64(res_struct[idx++]);
-
- gsize list_count = g_variant_n_children(res_struct[idx]);
-
- *processed_msgs = (service_adaptor_processed_msg_s **) calloc(list_count, sizeof(service_adaptor_processed_msg_s *));
-
- if (NULL != *processed_msgs) {
- for (gsize i = 0; i < list_count; i++) {
- GVariant *info_struct[private_service_adaptor_processed_msg_s_type_length];
- GVariant *info_entry_v = g_variant_get_child_value(res_struct[idx], i);
-
- (*processed_msgs)[i] = (service_adaptor_processed_msg_s *) calloc(1, sizeof(service_adaptor_processed_msg_s));
-
- if (NULL != (*processed_msgs)[i]) {
- for (size_t j = 0; j < private_service_adaptor_processed_msg_s_type_length; j++) {
- info_struct[j] = g_variant_get_child_value(info_entry_v, j);
- }
-
- int idx2 = 0;
- (*processed_msgs)[i]->msg_id = g_variant_get_int64(info_struct[idx2++]);
- (*processed_msgs)[i]->sent_time = g_variant_get_int64(info_struct[idx2++]);
-
- for (size_t j = 0; j < private_service_adaptor_processed_msg_s_type_length; j++) {
- g_variant_unref(info_struct[j]);
- }
- }
- }
- idx++;
- *processed_msgs_len = g_variant_get_uint32(res_struct[idx++]);
- } else {
- *processed_msgs_len = 0U;
- idx++;
- idx++;
- }
-
- for (size_t j = 0; j < private_service_adaptor_chat_res_s_type_length; j++) {
- g_variant_unref(res_struct[j]);
- }
-}
-
-void __get_allow_chat_res_type(GVariant *parameters,
- int64_t *request_id,
- int64_t *chatroom_id,
- service_adaptor_delivery_ack_s ***delivery_acks,
- unsigned int *delivery_acks_len,
- unsigned long long *last_delivery_acks_timestamp,
- service_adaptor_read_ack_s ***read_acks,
- unsigned int *read_acks_len,
- unsigned long long *last_read_acks_timestamp,
- service_adaptor_ordered_chat_member_s ***ordered_chat_members,
- unsigned int *ordered_chat_members_len,
- char **chatroom_title,
- int *default_message_ttl)
-{
- GVariant *in_parameters = g_variant_get_child_value(parameters, 0);
- GVariant *res_struct[private_service_adaptor_allow_chat_res_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_allow_chat_res_s_type_length; j++) {
- res_struct[j] = g_variant_get_child_value(in_parameters, j);
- }
-
- int idx = 0;
- *request_id = g_variant_get_int64(res_struct[idx++]);
- *chatroom_id = g_variant_get_int64(res_struct[idx++]);
-
- gsize delivery_acks_count = g_variant_n_children(res_struct[idx]);
- *delivery_acks = (service_adaptor_delivery_ack_s **) calloc(delivery_acks_count, sizeof(service_adaptor_delivery_ack_s *));
-
- if (NULL != *delivery_acks) {
- for (gsize i = 0; i < delivery_acks_count; i++) {
- GVariant *info_struct[private_service_adaptor_delivery_ack_s_type_length];
- GVariant *info_entry_v = g_variant_get_child_value(res_struct[idx], i);
-
- (*delivery_acks)[i] = (service_adaptor_delivery_ack_s *) calloc(1, sizeof(service_adaptor_delivery_ack_s));
-
- if (NULL == (*delivery_acks)[i]) {
- continue;
- }
-
- for (size_t j = 0; j < private_service_adaptor_delivery_ack_s_type_length; j++) {
- info_struct[j] = g_variant_get_child_value(info_entry_v, j);
- }
-
- int idx2 = 0;
- (*delivery_acks)[i]->user_id = g_variant_get_int64(info_struct[idx2++]);
- (*delivery_acks)[i]->msg_id = g_variant_get_int64(info_struct[idx2++]);
- (*delivery_acks)[i]->timestamp = g_variant_get_uint64(info_struct[idx2++]);
-
- for (size_t j = 0; j < private_service_adaptor_delivery_ack_s_type_length; j++) {
- g_variant_unref(info_struct[j]);
- }
- }
- idx++;
-
- *delivery_acks_len = g_variant_get_uint32(res_struct[idx++]);
- } else {
- *delivery_acks_len = 0U;
- idx++;
- idx++;
- }
- *last_delivery_acks_timestamp = g_variant_get_uint64(res_struct[idx++]);
-
- gsize read_acks_count = g_variant_n_children(res_struct[idx]);
- *read_acks = (service_adaptor_read_ack_s **) calloc(read_acks_count, sizeof(service_adaptor_read_ack_s *));
-
- if (NULL != *read_acks) {
- for (gsize i = 0; i < read_acks_count; i++) {
- GVariant *info_struct[private_service_adaptor_read_ack_s_type_length];
- GVariant *info_entry_v = g_variant_get_child_value(res_struct[idx], i);
-
- (*read_acks)[i] = (service_adaptor_read_ack_s *) calloc(1, sizeof(service_adaptor_read_ack_s));
- if (NULL == (*read_acks)[i]) {
- continue;
- }
-
- for (size_t j = 0; j < private_service_adaptor_read_ack_s_type_length; j++) {
- info_struct[j] = g_variant_get_child_value(info_entry_v, j);
- }
-
- int idx2 = 0;
- (*read_acks)[i]->user_id = g_variant_get_int64(info_struct[idx2++]);
- (*read_acks)[i]->msg_id = g_variant_get_int64(info_struct[idx2++]);
- (*read_acks)[i]->timestamp = g_variant_get_uint64(info_struct[idx2++]);
-
- for (size_t j = 0; j < private_service_adaptor_read_ack_s_type_length; j++) {
- g_variant_unref(info_struct[j]);
- }
- }
- idx++;
-
- *read_acks_len = g_variant_get_uint32(res_struct[idx++]);
- } else {
- *read_acks_len = 0U;
- }
- *last_read_acks_timestamp = g_variant_get_uint64(res_struct[idx++]);
-
- gsize ordered_chat_member_count = g_variant_n_children(res_struct[idx]);
- *ordered_chat_members = (service_adaptor_ordered_chat_member_s **) calloc(ordered_chat_member_count, sizeof(service_adaptor_ordered_chat_member_s *));
-
- if (NULL != *ordered_chat_members) {
- for (gsize i = 0; i < ordered_chat_member_count; i++) {
- GVariant *info_struct[private_service_adaptor_ordered_chat_member_s_type_length];
- GVariant *info_entry_v = g_variant_get_child_value(res_struct[idx], i);
-
- (*ordered_chat_members)[i] = (service_adaptor_ordered_chat_member_s *) calloc(1, sizeof(service_adaptor_ordered_chat_member_s));
-
- if (NULL != (*ordered_chat_members)[i]) {
- for (size_t j = 0; j < private_service_adaptor_ordered_chat_member_s_type_length; j++) {
- info_struct[j] = g_variant_get_child_value(info_entry_v, j);
- }
-
- int idx2 = 0;
- (*ordered_chat_members)[i]->user_id = g_variant_get_int64(info_struct[idx2++]);
- (*ordered_chat_members)[i]->available = g_variant_get_boolean(info_struct[idx2++]);
- (*ordered_chat_members)[i]->name = ipc_g_variant_dup_string(info_struct[idx2++]);
-
- for (size_t j = 0; j < private_service_adaptor_ordered_chat_member_s_type_length; j++) {
- g_variant_unref(info_struct[j]);
- }
- }
- }
- idx++;
- *ordered_chat_members_len = g_variant_get_uint32(res_struct[idx++]);
- } else {
- *ordered_chat_members_len = 0U;
- idx++;
- idx++;
- }
- *chatroom_title = ipc_g_variant_dup_string(res_struct[idx++]);
- *default_message_ttl = g_variant_get_int32(res_struct[idx++]);
-
- for (size_t j = 0; j < private_service_adaptor_allow_chat_res_s_type_length; j++) {
- g_variant_unref(res_struct[j]);
- }
-}
-
-void __get_all_unread_message_res_type(GVariant *parameters,
- int64_t *request_id)
-{
- GVariant *in_parameters = g_variant_get_child_value(parameters, 0);
- GVariant *res_struct[private_service_adaptor_all_unread_message_res_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_all_unread_message_res_s_type_length; j++) {
- res_struct[j] = g_variant_get_child_value(in_parameters, j);
- }
-
- int idx = 0;
- *request_id = g_variant_get_int64(res_struct[idx++]);
-
- for (size_t j = 0; j < private_service_adaptor_all_unread_message_res_s_type_length; j++) {
- g_variant_unref(res_struct[j]);
- }
-}
-void __get_channel_disconnected_res_type(GVariant *parameters,
- char **service_name)
-{
- GVariant *in_parameters = g_variant_get_child_value(parameters, 0);
- GVariant *res_struct[private_service_adaptor_channel_disconnected_res_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_channel_disconnected_res_s_type_length; j++) {
- res_struct[j] = g_variant_get_child_value(in_parameters, j);
- }
-
- int idx = 0;
- *service_name = ipc_g_variant_dup_string(res_struct[idx++]);
-
- for (size_t j = 0; j < private_service_adaptor_channel_disconnected_res_s_type_length; j++) {
- g_variant_unref(res_struct[j]);
- }
-}
-
-
-void __get_forward_online_message_req_type(GVariant *parameters,
- int64_t *request_id,
- int64_t *chatroom_id,
- int *chat_type,
- service_adaptor_inbox_message_s *inbox_msg,
- bool *skip_reply)
-{
- GVariant *in_parameters = g_variant_get_child_value(parameters, 0);
- GVariant *res_struct[private_service_adaptor_forward_online_message_req_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_forward_online_message_req_s_type_length; j++) {
- res_struct[j] = g_variant_get_child_value(in_parameters, j);
- }
-
- int idx = 0;
- *request_id = g_variant_get_int64(res_struct[idx++]);
- *chatroom_id = g_variant_get_int64(res_struct[idx++]);
- *chat_type = g_variant_get_int32(res_struct[idx++]);
-
- GVariant *res_info_struct[private_service_adaptor_inbox_message_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_inbox_message_s_type_length; j++) {
- res_info_struct[j] = g_variant_get_child_value(res_struct[idx], j);
- }
-
- int idx2 = 0;
-
- inbox_msg->msg_id = g_variant_get_int64(res_info_struct[idx2++]);
- inbox_msg->msg_type = g_variant_get_int32(res_info_struct[idx2++]);
- inbox_msg->sender = g_variant_get_int64(res_info_struct[idx2++]);
- inbox_msg->receiver = g_variant_get_int64(res_info_struct[idx2++]);
- inbox_msg->sent_time = g_variant_get_int64(res_info_struct[idx2++]);
- inbox_msg->chat_msg = ipc_g_variant_dup_string(res_info_struct[idx2++]);
- inbox_msg->chatroom_id = g_variant_get_int64(res_info_struct[idx2++]);
- inbox_msg->chat_type = g_variant_get_int32(res_info_struct[idx2++]);
- inbox_msg->message_ttl = g_variant_get_int32(res_info_struct[idx2++]);
-
- for (size_t j = 0; j < private_service_adaptor_inbox_message_s_type_length; j++) {
- g_variant_unref(res_info_struct[j]);
- }
- idx++;
-
- *skip_reply = g_variant_get_boolean(res_struct[idx++]);
-
- for (size_t j = 0; j < private_service_adaptor_forward_online_message_req_s_type_length; j++) {
- g_variant_unref(res_struct[j]);
- }
-}
-
-void __get_forward_unread_message_req_type(GVariant *parameters,
- int64_t *request_id,
- service_adaptor_inbox_message_s ***inbox_msgs,
- unsigned int *inbox_msgs_len,
- char **next_pagination_key)
-{
- GVariant *in_parameters = g_variant_get_child_value(parameters, 0);
- GVariant *res_struct[private_service_adaptor_forward_unread_message_req_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_forward_unread_message_req_s_type_length; j++) {
- res_struct[j] = g_variant_get_child_value(in_parameters, j);
- }
-
- int idx = 0;
- *request_id = g_variant_get_int64(res_struct[idx++]);
-
- gsize list_count = g_variant_n_children(res_struct[idx]);
-
- *inbox_msgs = (service_adaptor_inbox_message_s **) calloc(list_count, sizeof(service_adaptor_inbox_message_s *));
-
- if (NULL != *inbox_msgs) {
- for (gsize i = 0; i < list_count; i++) {
- GVariant *info_struct[private_service_adaptor_inbox_message_s_type_length];
- GVariant *info_entry_v = g_variant_get_child_value(res_struct[idx], i);
-
- (*inbox_msgs)[i] = (service_adaptor_inbox_message_s *) calloc(1, sizeof(service_adaptor_inbox_message_s));
-
- if (NULL != (*inbox_msgs)[i]) {
- for (size_t j = 0; j < private_service_adaptor_inbox_message_s_type_length; j++) {
- info_struct[j] = g_variant_get_child_value(info_entry_v, j);
- }
-
- int idx2 = 0;
- (*inbox_msgs)[i]->msg_id = g_variant_get_int64(info_struct[idx2++]);
- (*inbox_msgs)[i]->msg_type = g_variant_get_int32(info_struct[idx2++]);
- (*inbox_msgs)[i]->sender = g_variant_get_int64(info_struct[idx2++]);
- (*inbox_msgs)[i]->receiver = g_variant_get_int64(info_struct[idx2++]);
- (*inbox_msgs)[i]->sent_time = g_variant_get_int64(info_struct[idx2++]);
- (*inbox_msgs)[i]->chat_msg = ipc_g_variant_dup_string(info_struct[idx2++]);
- (*inbox_msgs)[i]->chatroom_id = g_variant_get_int64(info_struct[idx2++]);
- (*inbox_msgs)[i]->chat_type = g_variant_get_int32(info_struct[idx2++]);
- (*inbox_msgs)[i]->message_ttl = g_variant_get_int32(info_struct[idx2++]);
-
- for (size_t j = 0; j < private_service_adaptor_inbox_message_s_type_length; j++) {
- g_variant_unref(info_struct[j]);
- }
- }
- }
- idx++;
- *inbox_msgs_len = g_variant_get_uint32(res_struct[idx++]);
- } else {
- *inbox_msgs_len = 0U;
- idx++;
- idx++;
- }
- *next_pagination_key = ipc_g_variant_dup_string(res_struct[idx++]);
-
- for (size_t j = 0; j < private_service_adaptor_forward_unread_message_req_s_type_length; j++) {
- g_variant_unref(res_struct[j]);
- }
-}
-
-void __get_read_message_res_type(GVariant *parameters,
- int64_t *request_id,
- int64_t *chatroom_id)
-{
- GVariant *in_parameters = g_variant_get_child_value(parameters, 0);
- GVariant *res_struct[private_service_adaptor_read_message_res_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_read_message_res_s_type_length; j++) {
- res_struct[j] = g_variant_get_child_value(in_parameters, j);
- }
-
- int idx = 0;
- *request_id = g_variant_get_int64(res_struct[idx++]);
- *chatroom_id = g_variant_get_int64(res_struct[idx++]);
-
- for (size_t j = 0; j < private_service_adaptor_read_message_res_s_type_length; j++) {
- g_variant_unref(res_struct[j]);
- }
-}
-
-void __get_invite_chat_res_type(GVariant *parameters,
- int64_t *request_id,
- int64_t *chatroom_id,
- int64_t *sent_time,
- service_adaptor_wrong_receiver_s *wrong_receiver)
-{
- GVariant *in_parameters = g_variant_get_child_value(parameters, 0);
- GVariant *res_struct[private_service_adaptor_invite_chat_res_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_invite_chat_res_s_type_length; j++) {
- res_struct[j] = g_variant_get_child_value(in_parameters, j);
- }
-
- int idx = 0;
- *request_id = g_variant_get_int64(res_struct[idx++]);
- *chatroom_id = g_variant_get_int64(res_struct[idx++]);
- *sent_time = g_variant_get_int64(res_struct[idx++]);
-
- GVariant *res_info_struct[private_service_adaptor_wrong_receiver_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_wrong_receiver_s_type_length; j++) {
- res_info_struct[j] = g_variant_get_child_value(res_struct[idx], j);
- }
-
- int idx2 = 0;
-
- gsize invalid_count = g_variant_n_children(res_info_struct[idx2]);
- wrong_receiver->invalid_receivers = (int64_t *) calloc(invalid_count, sizeof(int64_t));
-
- if (NULL != wrong_receiver->invalid_receivers) {
- for (gsize i = 0; i < invalid_count; i++) {
- GVariant *info_entry_v = g_variant_get_child_value(res_info_struct[idx2], i);
- GVariant *info_struct = g_variant_get_child_value(info_entry_v, 0);
-
- wrong_receiver->invalid_receivers[i] = g_variant_get_int64(info_struct);
-
- g_variant_unref(info_struct);
- }
- idx2++;
- wrong_receiver->invalid_receivers_len = g_variant_get_uint32(res_info_struct[idx2++]);
- } else {
- wrong_receiver->invalid_receivers_len = 0U;
- idx2++;
- idx2++;
- }
-
- gsize interrupted_count = g_variant_n_children(res_info_struct[idx2]);
- wrong_receiver->interrupted_receivers = (int64_t *) calloc(interrupted_count, sizeof(int64_t));
-
- if (NULL != wrong_receiver->interrupted_receivers) {
- for (gsize i = 0; i < interrupted_count; i++) {
- GVariant *info_entry_v = g_variant_get_child_value(res_info_struct[idx2], i);
- GVariant *info_struct = g_variant_get_child_value(info_entry_v, 0);
-
- wrong_receiver->interrupted_receivers[i] = g_variant_get_int64(info_struct);
-
- g_variant_unref(info_struct);
- }
- idx2++;
- wrong_receiver->interrupted_receivers_len = g_variant_get_uint32(res_info_struct[idx2++]);
- } else {
- wrong_receiver->interrupted_receivers_len = 0U;
- idx2++;
- idx2++;
- }
-
- gsize disabled_count = g_variant_n_children(res_info_struct[idx2]);
- wrong_receiver->disabled_receivers = (int64_t *) calloc(disabled_count, sizeof(int64_t));
-
- if (NULL != wrong_receiver->disabled_receivers) {
- for (gsize i = 0; i < disabled_count; i++) {
- GVariant *info_entry_v = g_variant_get_child_value(res_info_struct[idx2], i);
- GVariant *info_struct = g_variant_get_child_value(info_entry_v, 0);
-
- wrong_receiver->disabled_receivers[i] = g_variant_get_int64(info_struct);
-
- g_variant_unref(info_struct);
- }
- idx2++;
- wrong_receiver->disabled_receivers_len = g_variant_get_uint32(res_info_struct[idx2++]);
- } else {
- wrong_receiver->disabled_receivers_len = 0U;
- idx2++;
- idx2++;
- }
-
- gsize existing_count = g_variant_n_children(res_info_struct[idx2]);
- wrong_receiver->existing_chatmembers = (int64_t *) calloc(existing_count, sizeof(int64_t));
-
- if (NULL != wrong_receiver->existing_chatmembers) {
- for (gsize i = 0; i < existing_count; i++) {
- GVariant *info_entry_v = g_variant_get_child_value(res_info_struct[idx2], i);
- GVariant *info_struct = g_variant_get_child_value(info_entry_v, 0);
-
- wrong_receiver->existing_chatmembers[i] = g_variant_get_int64(info_struct);
-
- g_variant_unref(info_struct);
- }
- idx2++;
- wrong_receiver->existing_chatmembers_len = g_variant_get_uint32(res_info_struct[idx2++]);
- } else {
- wrong_receiver->existing_chatmembers_len = 0U;
- idx2++;
- idx2++;
- }
-
- gsize did_violation_count = g_variant_n_children(res_info_struct[idx2]);
- wrong_receiver->did_violation_users = (service_adaptor_did_violation_users_s **) calloc(did_violation_count, sizeof(service_adaptor_did_violation_users_s *));
-
- if (NULL != wrong_receiver->did_violation_users) {
- for (gsize i = 0; i < did_violation_count; i++) {
- GVariant *info_entry_v = g_variant_get_child_value(res_info_struct[idx2], i);
- GVariant *info_struct[private_service_adaptor_did_violation_users_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_did_violation_users_s_type_length; j++) {
- info_struct[j] = g_variant_get_child_value(info_entry_v, j);
- }
-
- int idx3 = 0;
-
- wrong_receiver->did_violation_users[i] = (service_adaptor_did_violation_users_s *) calloc(1, sizeof(service_adaptor_did_violation_users_s));
- if (NULL != wrong_receiver->did_violation_users[i]) {
- wrong_receiver->did_violation_users[i]->usera = g_variant_get_int64(info_struct[idx3++]);
- wrong_receiver->did_violation_users[i]->userb = g_variant_get_int64(info_struct[idx3++]);
- }
-
- for (size_t j = 0; j < private_service_adaptor_did_violation_users_s_type_length; j++) {
- g_variant_unref(info_struct[j]);
- }
- }
- idx2++;
- wrong_receiver->did_violation_users_len = g_variant_get_uint32(res_info_struct[idx2++]);
- } else {
- wrong_receiver->did_violation_users_len = 0U;
- idx2++;
- idx2++;
- }
-
- gsize denieds_count = g_variant_n_children(res_info_struct[idx2]);
- wrong_receiver->invitation_denieds = (int64_t *) calloc(denieds_count, sizeof(int64_t));
-
- if (NULL != wrong_receiver->invitation_denieds) {
- for (gsize i = 0; i < denieds_count; i++) {
- GVariant *info_entry_v = g_variant_get_child_value(res_info_struct[idx2], i);
- GVariant *info_struct = g_variant_get_child_value(info_entry_v, 0);
-
- wrong_receiver->invitation_denieds[i] = g_variant_get_int64(info_struct);
-
- g_variant_unref(info_struct);
- }
- idx2++;
- wrong_receiver->invitation_denieds_len = g_variant_get_uint32(res_info_struct[idx2++]);
- } else {
- wrong_receiver->invitation_denieds_len = 0U;
- idx2++;
- idx2++;
- }
-
-
- for (size_t j = 0; j < private_service_adaptor_wrong_receiver_s_type_length; j++) {
- g_variant_unref(res_info_struct[j]);
- }
-
- for (size_t j = 0; j < private_service_adaptor_invite_chat_res_s_type_length; j++) {
- g_variant_unref(res_struct[j]);
- }
-}
-
-void __get_end_chat_res_type(GVariant *parameters,
- int64_t *request_id)
-{
- GVariant *in_parameters = g_variant_get_child_value(parameters, 0);
- GVariant *res_struct[private_service_adaptor_end_chat_res_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_end_chat_res_s_type_length; j++) {
- res_struct[j] = g_variant_get_child_value(in_parameters, j);
- }
-
- int idx = 0;
- *request_id = g_variant_get_int64(res_struct[idx++]);
-
- for (size_t j = 0; j < private_service_adaptor_end_chat_res_s_type_length; j++) {
- g_variant_unref(res_struct[j]);
- }
-}
-
-void __get_unseal_message_res_type(GVariant *parameters,
- int64_t *request_id,
- int64_t *chatroom_id)
-{
- GVariant *in_parameters = g_variant_get_child_value(parameters, 0);
- GVariant *res_struct[private_service_adaptor_unseal_message_res_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_unseal_message_res_s_type_length; j++) {
- res_struct[j] = g_variant_get_child_value(in_parameters, j);
- }
-
- int idx = 0;
- *request_id = g_variant_get_int64(res_struct[idx++]);
- *chatroom_id = g_variant_get_int64(res_struct[idx++]);
-
- for (size_t j = 0; j < private_service_adaptor_unseal_message_res_s_type_length; j++) {
- g_variant_unref(res_struct[j]);
- }
-}
-void __get_save_call_log_res_type(GVariant *parameters,
- int64_t *request_id)
-{
- GVariant *in_parameters = g_variant_get_child_value(parameters, 0);
- GVariant *res_struct[private_service_adaptor_save_call_log_res_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_save_call_log_res_s_type_length; j++) {
- res_struct[j] = g_variant_get_child_value(in_parameters, j);
- }
-
- int idx = 0;
- *request_id = g_variant_get_int64(res_struct[idx++]);
-
- for (size_t j = 0; j < private_service_adaptor_save_call_log_res_s_type_length; j++) {
- g_variant_unref(res_struct[j]);
- }
-}
-
-void __get_current_time_res_type(GVariant *parameters,
- int64_t *request_id,
- int64_t *current_time_millis)
-{
- GVariant *in_parameters = g_variant_get_child_value(parameters, 0);
- GVariant *res_struct[private_service_adaptor_current_time_res_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_current_time_res_s_type_length; j++) {
- res_struct[j] = g_variant_get_child_value(in_parameters, j);
- }
-
- int idx = 0;
- *request_id = g_variant_get_int64(res_struct[idx++]);
- *current_time_millis = g_variant_get_int64(res_struct[idx++]);
-
- for (size_t j = 0; j < private_service_adaptor_current_time_res_s_type_length; j++) {
- g_variant_unref(res_struct[j]);
- }
-}
-
-void __get_chat_id_list_res_type(GVariant *call_result_struct,
- service_adaptor_chat_id_s ***chat_ids,
- unsigned int *chat_ids_len,
- void **server_data)
-{
- GVariant *res_info_struct[private_service_adaptor_chat_id_list_res_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_chat_id_list_res_s_type_length; j++) {
- res_info_struct[j] = g_variant_get_child_value(call_result_struct, j);
- }
-
- int idx = 0;
- gsize list_count = g_variant_n_children(res_info_struct[idx]);
-
- *chat_ids = (service_adaptor_chat_id_s **) calloc(list_count, sizeof(service_adaptor_chat_id_s *));
-
- if (NULL != *chat_ids) {
- for (gsize i = 0; i < list_count; i++) {
- GVariant *list_info_struct[private_service_adaptor_chat_id_s_type_length];
- GVariant *list_info_entry_v = g_variant_get_child_value(res_info_struct[idx], i);
- (*chat_ids)[i] = (service_adaptor_chat_id_s *) calloc(1, sizeof(service_adaptor_chat_id_s));
-
- if (NULL != (*chat_ids)[i]) {
- for (size_t j = 0; j < private_service_adaptor_chat_id_s_type_length; j++) {
- list_info_struct[j] = g_variant_get_child_value(list_info_entry_v, j);
- }
-
- int idx2 = 0;
- (*chat_ids)[i]->chatid = g_variant_get_int64(list_info_struct[idx2++]);
- (*chat_ids)[i]->msisdn = ipc_g_variant_dup_string(list_info_struct[idx2++]);
-
- for (size_t j = 0; j < private_service_adaptor_chat_id_s_type_length; j++) {
- g_variant_unref(list_info_struct[j]);
- }
- }
- }
- idx++;
- *chat_ids_len = g_variant_get_uint32(res_info_struct[idx++]);
- } else {
- *chat_ids_len = 0U;
- idx++;
- idx++;
- }
-
- for (size_t j = 0; j < private_service_adaptor_chat_id_list_res_s_type_length; j++) {
- g_variant_unref(res_info_struct[j]);
- }
-}
-
-/******************************************************************************
- * Public interface definition
- ******************************************************************************/
-
-void on_message_signal(GDBusProxy *proxy,
- gchar *sender_name,
- gchar *signal_name,
- GVariant *parameters,
- gpointer user_data)
-{
- if (0 == g_strcmp0(signal_name, PRIVATE_DBUS_REPLY_CREATE_CHATROOM_SIGNAL)) {
- int64_t request_id = 0;
- int64_t chatroom_id = 0;
- int default_message_ttl = 0;
- service_adaptor_wrong_receiver_s wrong_receiver;
- service_adaptor_error_s *error_code = NULL;
-
- __get_create_chatroom_res_type(parameters, &request_id, &chatroom_id, &default_message_ttl, &wrong_receiver);
-
- service_adaptor_task_h task = _queue_get_task(request_id);
-
- if (NULL == task) {
- __free_wrong_receiver_s(&wrong_receiver);
- return;
- }
-
- GVariant *call_result[2];
- call_result[0] = g_variant_get_child_value(parameters, 1);
- call_result[1] = g_variant_get_child_value(parameters, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result[0]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error_code = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
-
- if (NULL != error_code) {
- error_code->code = remote_call_result;
- error_code->msg = ipc_g_variant_dup_string(call_result[1]);
- }
- }
-
- service_adaptor_reply_create_chatroom_cb callback = (service_adaptor_reply_create_chatroom_cb) task->callback;
-
- if (NULL != callback) {
- callback(task->handle, request_id, chatroom_id, default_message_ttl, &wrong_receiver, error_code, task->user_data);
- }
-
- _queue_del_task(task);
- __free_wrong_receiver_s(&wrong_receiver);
- __FREE_ERROR_CODE(error_code);
- } else if (0 == g_strcmp0(signal_name, PRIVATE_DBUS_REPLY_CHANGE_CHATROOM_META_SIGNAL)) {
- int64_t request_id = 0;
- int64_t chatroom_id = 0;
- service_adaptor_error_s *error_code = NULL;
-
- __get_change_chatroom_meta_res_type(parameters, &request_id, &chatroom_id);
-
- service_adaptor_task_h task = _queue_get_task(request_id);
-
- if (NULL == task) {
- return;
- }
-
- GVariant *call_result[2];
- call_result[0] = g_variant_get_child_value(parameters, 1);
- call_result[1] = g_variant_get_child_value(parameters, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result[0]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error_code = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
-
- if (NULL != error_code) {
- error_code->code = remote_call_result;
- error_code->msg = ipc_g_variant_dup_string(call_result[1]);
- }
- }
-
- service_adaptor_reply_change_chatroom_meta_cb callback = (service_adaptor_reply_change_chatroom_meta_cb) task->callback;
-
- if (NULL != callback) {
- callback(task->handle, request_id, chatroom_id, error_code, task->user_data);
- }
- __FREE_ERROR_CODE(error_code);
-
- _queue_del_task(task);
- } else if (0 == g_strcmp0(signal_name, PRIVATE_DBUS_REPLY_CHAT_SIGNAL)) {
- int64_t request_id = 0;
- int64_t chatroom_id = 0;
- service_adaptor_processed_msg_s **processed_msgs = NULL;
- unsigned int processed_msgs_len = 0;
- service_adaptor_error_s *error_code = NULL;
-
- __get_chat_res_type(parameters, &request_id, &chatroom_id, &processed_msgs, &processed_msgs_len);
-
- service_adaptor_task_h task = _queue_get_task(request_id);
-
- if (NULL == task) {
- __FREE_POINTER_ARRAY(processed_msgs, processed_msgs_len);
- __SAFE_FREE(processed_msgs);
- return;
- }
-
- GVariant *call_result[2];
- call_result[0] = g_variant_get_child_value(parameters, 1);
- call_result[1] = g_variant_get_child_value(parameters, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result[0]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error_code = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
-
- if (NULL != error_code) {
- error_code->code = remote_call_result;
- error_code->msg = ipc_g_variant_dup_string(call_result[1]);
- }
- }
-
- service_adaptor_reply_chat_cb callback = (service_adaptor_reply_chat_cb) task->callback;
-
- if (NULL != callback) {
- callback(task->handle, request_id, chatroom_id, processed_msgs, processed_msgs_len, error_code, task->user_data);
- }
- __FREE_POINTER_ARRAY(processed_msgs, processed_msgs_len);
- __SAFE_FREE(processed_msgs);
- __FREE_ERROR_CODE(error_code);
-
- _queue_del_task(task);
- } else if (0 == g_strcmp0(signal_name, PRIVATE_DBUS_REPLY_ALLOW_CHAT_SIGNAL)) {
- int64_t request_id = 0;
- int64_t chatroom_id = 0;
- service_adaptor_delivery_ack_s **delivery_acks = NULL;
- unsigned int delivery_acks_len = 0;
- unsigned long long last_delivery_acks_timestamp = 0;
- service_adaptor_read_ack_s **read_acks = NULL;
- unsigned int read_acks_len = 0;
- unsigned long long last_read_acks_timestamp = 0;
- service_adaptor_ordered_chat_member_s **ordered_chat_members = NULL;
- unsigned int ordered_chat_members_len = 0;
- char *chatroom_title = NULL;
- int default_message_ttl = 0;
- service_adaptor_error_s *error_code = NULL;
-
-
- __get_allow_chat_res_type(parameters, &request_id, &chatroom_id,
- &delivery_acks, &delivery_acks_len, &last_delivery_acks_timestamp,
- &read_acks, &read_acks_len, &last_read_acks_timestamp,
- &ordered_chat_members, &ordered_chat_members_len,
- &chatroom_title, &default_message_ttl);
-
- service_adaptor_task_h task = _queue_get_task(request_id);
-
- if (NULL == task) {
- __FREE_POINTER_ARRAY(delivery_acks, delivery_acks_len);
- __SAFE_FREE(delivery_acks);
- __FREE_POINTER_ARRAY(read_acks, read_acks_len);
- __SAFE_FREE(read_acks);
- __free_ordered_chat_member_s_list(ordered_chat_members, ordered_chat_members_len);
- __SAFE_FREE(ordered_chat_members);
- __SAFE_FREE(chatroom_title);
- return;
- }
-
- GVariant *call_result[2];
- call_result[0] = g_variant_get_child_value(parameters, 1);
- call_result[1] = g_variant_get_child_value(parameters, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result[0]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error_code = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
-
- if (NULL != error_code) {
- error_code->code = remote_call_result;
- error_code->msg = ipc_g_variant_dup_string(call_result[1]);
- }
- }
-
- service_adaptor_reply_allow_chat_cb callback = (service_adaptor_reply_allow_chat_cb) task->callback;
- if (NULL != callback) {
- callback(task->handle, request_id, chatroom_id,
- delivery_acks, delivery_acks_len, last_delivery_acks_timestamp,
- read_acks, read_acks_len, last_read_acks_timestamp,
- ordered_chat_members, ordered_chat_members_len,
- chatroom_title, default_message_ttl, error_code, task->user_data);
- }
- __FREE_POINTER_ARRAY(delivery_acks, delivery_acks_len);
- __SAFE_FREE(delivery_acks);
- __FREE_POINTER_ARRAY(read_acks, read_acks_len);
- __SAFE_FREE(read_acks);
- __free_ordered_chat_member_s_list(ordered_chat_members, ordered_chat_members_len);
- __SAFE_FREE(ordered_chat_members);
- __SAFE_FREE(chatroom_title);
- __FREE_ERROR_CODE(error_code);
-
- _queue_del_task(task);
- } else if (0 == g_strcmp0(signal_name, PRIVATE_DBUS_REPLY_ALL_UNREAD_MESSAGE_SIGNAL)) {
- int64_t request_id = 0;
- service_adaptor_error_s *error_code = NULL;
-
- __get_all_unread_message_res_type(parameters, &request_id);
-
- service_adaptor_task_h task = _queue_get_task(request_id);
-
- if (NULL == task) {
- return;
- }
-
- GVariant *call_result[2];
- call_result[0] = g_variant_get_child_value(parameters, 1);
- call_result[1] = g_variant_get_child_value(parameters, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result[0]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error_code = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
-
- if (NULL != error_code) {
- error_code->code = remote_call_result;
- error_code->msg = ipc_g_variant_dup_string(call_result[1]);
- }
- }
-
- service_adaptor_reply_all_unread_message_cb callback = (service_adaptor_reply_all_unread_message_cb) task->callback;
-
- if (NULL != callback) {
- callback(task->handle, request_id, error_code, task->user_data);
- }
- __FREE_ERROR_CODE(error_code);
-
- _queue_del_task(task);
- } else if (0 == g_strcmp0(signal_name, PRIVATE_DBUS_REQUEST_FORWARD_ONLINE_MESSAGE_SIGNAL)) {
- int64_t request_id = 0;
- int64_t chatroom_id = 0;
- int chat_type = 0;
- service_adaptor_inbox_message_s inbox_msg;
- bool skip_reply = false;
- service_adaptor_error_s *error_code = NULL;
-
- __get_forward_online_message_req_type(parameters, &request_id, &chatroom_id, &chat_type, &inbox_msg, &skip_reply);
-
- service_adaptor_task_h task = _queue_get_task(-100);
-
- if (NULL == task) {
- __SAFE_FREE(inbox_msg.chat_msg);
- return;
- }
-
- GVariant *call_result[2];
- call_result[0] = g_variant_get_child_value(parameters, 1);
- call_result[1] = g_variant_get_child_value(parameters, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result[0]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error_code = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
-
- if (NULL != error_code) {
- error_code->code = remote_call_result;
- error_code->msg = ipc_g_variant_dup_string(call_result[1]);
- }
- }
-
- service_adaptor_request_forward_online_message_cb callback = (service_adaptor_request_forward_online_message_cb) task->callback;
-
- if (NULL != callback) {
- callback(task->handle, request_id, chatroom_id, chat_type, &inbox_msg, skip_reply, error_code, task->user_data);
- }
- __SAFE_FREE(inbox_msg.chat_msg);
- __FREE_ERROR_CODE(error_code);
- } else if (0 == g_strcmp0(signal_name, PRIVATE_DBUS_REQUEST_FORWARD_UNREAD_MESSAGE_SIGNAL)) {
- int64_t request_id = 0;
- service_adaptor_inbox_message_s **inbox_msgs = NULL;
- uint32_t inbox_msgs_len = 0;
- char *next_pagination_key = NULL;
- service_adaptor_error_s *error_code = NULL;
-
- __get_forward_unread_message_req_type(parameters, &request_id, &inbox_msgs, &inbox_msgs_len, &next_pagination_key);
-
- service_adaptor_task_h task = _queue_get_task(-101);
-
- if (NULL == task) {
- __SAFE_FREE(next_pagination_key);
- __free_inbox_message_s_list(inbox_msgs, inbox_msgs_len);
- __SAFE_FREE(inbox_msgs);
- return;
- }
-
- GVariant *call_result[2];
- call_result[0] = g_variant_get_child_value(parameters, 1);
- call_result[1] = g_variant_get_child_value(parameters, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result[0]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error_code = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
-
- if (NULL != error_code) {
- error_code->code = remote_call_result;
- error_code->msg = ipc_g_variant_dup_string(call_result[1]);
- }
- }
-
- service_adaptor_request_forward_unread_message_cb callback = (service_adaptor_request_forward_unread_message_cb) task->callback;
-
- if (NULL != callback) {
- callback(task->handle, request_id, inbox_msgs, inbox_msgs_len, next_pagination_key, error_code, task->user_data);
- }
- __SAFE_FREE(next_pagination_key);
- __free_inbox_message_s_list(inbox_msgs, inbox_msgs_len);
- __SAFE_FREE(inbox_msgs);
- __FREE_ERROR_CODE(error_code);
- } else if (0 == g_strcmp0(signal_name, PRIVATE_DBUS_REPLY_CHANNEL_DISCONNECTED_SIGNAL)) {
- char *service_name = NULL;
- service_adaptor_error_s *error_code = NULL;
-
- __get_channel_disconnected_res_type(parameters, &service_name);
-
- service_adaptor_task_h task = _queue_get_task(-102);
-
- if (NULL == task) {
- __SAFE_FREE(service_name);
- return;
- }
-
- GVariant *call_result[2];
- call_result[0] = g_variant_get_child_value(parameters, 1);
- call_result[1] = g_variant_get_child_value(parameters, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result[0]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error_code = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
-
- if (NULL != error_code) {
- error_code->code = remote_call_result;
- error_code->msg = ipc_g_variant_dup_string(call_result[1]);
- }
- }
-
- service_adaptor_reply_channel_disconnected_cb callback = (service_adaptor_reply_channel_disconnected_cb) task->callback;
-
- if ((NULL != callback) && (NULL != task->handle) && (NULL != ((service_adaptor_h)task->handle)->service_name) && (NULL != service_name)
- && (0 == strncmp(((service_adaptor_h)task->handle)->service_name, service_name, strlen(((service_adaptor_h)task->handle)->service_name)))) {
- callback(task->handle, error_code, task->user_data);
- }
- __SAFE_FREE(service_name);
- __FREE_ERROR_CODE(error_code);
- } else if (0 == g_strcmp0(signal_name, PRIVATE_DBUS_REPLY_READ_MESSAGE_SIGNAL)) {
- int64_t request_id = 0;
- int64_t chatroom_id = 0;
- service_adaptor_error_s *error_code = NULL;
-
- __get_read_message_res_type(parameters, &request_id, &chatroom_id);
-
- service_adaptor_task_h task = _queue_get_task(request_id);
-
- if (NULL == task) {
- return;
- }
-
- GVariant *call_result[2];
- call_result[0] = g_variant_get_child_value(parameters, 1);
- call_result[1] = g_variant_get_child_value(parameters, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result[0]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error_code = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
-
- if (NULL != error_code) {
- error_code->code = remote_call_result;
- error_code->msg = ipc_g_variant_dup_string(call_result[1]);
- }
- }
-
- service_adaptor_reply_read_message_cb callback = (service_adaptor_reply_read_message_cb) task->callback;
- if (NULL != callback) {
- callback(task->handle, request_id, chatroom_id, error_code, task->user_data);
- }
- __FREE_ERROR_CODE(error_code);
-
- _queue_del_task(task);
- } else if (0 == g_strcmp0(signal_name, PRIVATE_DBUS_REPLY_INVITE_CHAT_SIGNAL)) {
- int64_t request_id = 0;
- int64_t chatroom_id = 0;
- int64_t sent_time = 0;
- service_adaptor_wrong_receiver_s wrong_receiver;
- service_adaptor_error_s *error_code = NULL;
-
- __get_invite_chat_res_type(parameters, &request_id, &chatroom_id, &sent_time, &wrong_receiver);
-
- service_adaptor_task_h task = _queue_get_task(request_id);
-
- if (NULL == task) {
- __free_wrong_receiver_s(&wrong_receiver);
- return;
- }
-
- GVariant *call_result[2];
- call_result[0] = g_variant_get_child_value(parameters, 1);
- call_result[1] = g_variant_get_child_value(parameters, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result[0]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error_code = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
-
- if (NULL != error_code) {
- error_code->code = remote_call_result;
- error_code->msg = ipc_g_variant_dup_string(call_result[1]);
- }
- }
-
- service_adaptor_reply_invite_chat_cb callback = (service_adaptor_reply_invite_chat_cb) task->callback;
- if (NULL != callback) {
- callback(task->handle, request_id, chatroom_id, sent_time, &wrong_receiver, error_code, task->user_data);
- }
-
- __free_wrong_receiver_s(&wrong_receiver);
- __FREE_ERROR_CODE(error_code);
- _queue_del_task(task);
- } else if (0 == g_strcmp0(signal_name, PRIVATE_DBUS_REPLY_END_CHAT_SIGNAL)) {
- int64_t request_id = 0;
- service_adaptor_error_s *error_code = NULL;
-
- __get_end_chat_res_type(parameters, &request_id);
-
- service_adaptor_task_h task = _queue_get_task(request_id);
-
- if (NULL == task) {
- return;
- }
-
- GVariant *call_result[2];
- call_result[0] = g_variant_get_child_value(parameters, 1);
- call_result[1] = g_variant_get_child_value(parameters, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result[0]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error_code = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
-
- if (NULL != error_code) {
- error_code->code = remote_call_result;
- error_code->msg = ipc_g_variant_dup_string(call_result[1]);
- }
- }
-
- service_adaptor_reply_end_chat_cb callback = (service_adaptor_reply_end_chat_cb) task->callback;
- if (NULL != callback) {
- callback(task->handle, request_id, error_code, task->user_data);
- }
- __FREE_ERROR_CODE(error_code);
-
- _queue_del_task(task);
- } else if (0 == g_strcmp0(signal_name, PRIVATE_DBUS_REPLY_UNSEAL_MESSAGE_SIGNAL)) {
- int64_t request_id = 0;
- int64_t chatroom_id = 0;
- service_adaptor_error_s *error_code = NULL;
-
- __get_unseal_message_res_type(parameters, &request_id, &chatroom_id);
-
- service_adaptor_task_h task = _queue_get_task(request_id);
-
- if (NULL == task) {
- return;
- }
-
- GVariant *call_result[2];
- call_result[0] = g_variant_get_child_value(parameters, 1);
- call_result[1] = g_variant_get_child_value(parameters, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result[0]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error_code = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
-
- if (NULL != error_code) {
- error_code->code = remote_call_result;
- error_code->msg = ipc_g_variant_dup_string(call_result[1]);
- }
- }
-
- service_adaptor_reply_unseal_message_cb callback = (service_adaptor_reply_unseal_message_cb) task->callback;
- if (NULL != callback) {
- callback(task->handle, request_id, chatroom_id, error_code, task->user_data);
- }
- __FREE_ERROR_CODE(error_code);
-
- _queue_del_task(task);
- } else if (0 == g_strcmp0(signal_name, PRIVATE_DBUS_REPLY_SAVE_CALL_LOG_SIGNAL)) {
- int64_t request_id = 0;
- service_adaptor_error_s *error_code = NULL;
-
- __get_save_call_log_res_type(parameters, &request_id);
-
- service_adaptor_task_h task = _queue_get_task(request_id);
-
- if (NULL == task) {
- return;
- }
-
- GVariant *call_result[2];
- call_result[0] = g_variant_get_child_value(parameters, 1);
- call_result[1] = g_variant_get_child_value(parameters, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result[0]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error_code = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
-
- if (NULL != error_code) {
- error_code->code = remote_call_result;
- error_code->msg = ipc_g_variant_dup_string(call_result[1]);
- }
- }
-
- service_adaptor_reply_save_call_log_cb callback = (service_adaptor_reply_save_call_log_cb) task->callback;
- if (NULL != callback) {
- callback(task->handle, request_id, error_code, task->user_data);
- }
- __FREE_ERROR_CODE(error_code);
-
- _queue_del_task(task);
- } else if (0 == g_strcmp0(signal_name, PRIVATE_DBUS_REPLY_CURRENT_TIME_SIGNAL)) {
- int64_t request_id = 0;
- int64_t current_time_millis = 0;
- service_adaptor_error_s *error_code = NULL;
-
- __get_current_time_res_type(parameters, &request_id, ¤t_time_millis);
-
- service_adaptor_task_h task = _queue_get_task(request_id);
-
- if (NULL == task) {
- return;
- }
-
- GVariant *call_result[2];
- call_result[0] = g_variant_get_child_value(parameters, 1);
- call_result[1] = g_variant_get_child_value(parameters, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result[0]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error_code = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
-
- if (NULL != error_code) {
- error_code->code = remote_call_result;
- error_code->msg = ipc_g_variant_dup_string(call_result[1]);
- }
- }
-
- service_adaptor_reply_current_time_cb callback = (service_adaptor_reply_current_time_cb) task->callback;
- if (NULL != callback) {
- callback(task->handle, request_id, current_time_millis, error_code, task->user_data);
- }
- __FREE_ERROR_CODE(error_code);
-
- _queue_del_task(task);
- }
-}
-
-/** @brief
- * @return service_adaptor_error_s
- * @remarks :
- */
-int _dbus_request_create_chatroom(const char *service_name,
- long long int request_id,
- int chat_type,
- long long int *receivers,
- unsigned int receivers_len,
- const char *chatroom_title,
- void *user_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
- ipc_check_proxy(sac_interface_proxy);
-
- if ((NULL == service_name) || (NULL == receivers) || (1 > receivers_len)) {
- error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- error->msg = strdup("Invalid Param");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(x)"));
-
- for (int i = 0; i < receivers_len; i++) {
- g_variant_builder_add(builder, "(x)", receivers[i]);
- }
-
- GVariant *request = g_variant_new("(" private_service_adaptor_create_chatroom_req_s_type ")", __safe_add_string(service_name),
- request_id, chat_type, builder, receivers_len, __safe_add_string(chatroom_title));
-
- g_variant_builder_unref(builder);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_REQUEST_CREATE_CHATROOM_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE("(ts)"))) {
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- } else {
- __ipc_get_simple_error_code();
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-/** @brief
- * @return service_adaptor_error_s
- * @remarks :
- */
-int _dbus_request_change_chatroom_meta(const char *service_name,
- long long int request_id,
- long long int chatroom_id,
- const char *chatroom_title,
- int default_message_ttl,
- void *user_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
- ipc_check_proxy(sac_interface_proxy);
-
- if (NULL == service_name) {
- error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- error->msg = strdup("Invalid Param");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- GVariant *request = g_variant_new("(" private_service_adaptor_change_chatroom_meta_req_s_type ")", __safe_add_string(service_name),
- request_id, chatroom_id, __safe_add_string(chatroom_title), default_message_ttl);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_REQUEST_CHANGE_CHATROOM_META_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE("(ts)"))) {
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- } else {
- __ipc_get_simple_error_code();
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-
-int _dbus_request_chat(const char *service_name,
- long long int request_id,
- long long int chatroom_id,
- service_adaptor_chat_msg_s **chat_msgs,
- unsigned int chat_msgs_len,
- void *user_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
- ipc_check_proxy(sac_interface_proxy);
-
- if ((NULL == service_name) || (chat_msgs == NULL) || (1 > chat_msgs_len)) {
- error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- error->msg = strdup("Invalid Param");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a" private_service_adaptor_chat_msg_s_type));
-
- for (int i = 0; i < chat_msgs_len; i++) {
- g_variant_builder_open(builder, G_VARIANT_TYPE(private_service_adaptor_chat_msg_s_type));
- g_variant_builder_add(builder, "x", chat_msgs[i]->msg_id);
- g_variant_builder_add(builder, "i", chat_msgs[i]->msg_type);
- __safe_g_variant_builder_add_string(builder, chat_msgs[i]->chatmsg);
- g_variant_builder_add(builder, "i", chat_msgs[i]->message_ttl);
- g_variant_builder_close(builder);
- }
-
- GVariant *request = g_variant_new("(" private_service_adaptor_chat_req_s_type ")", __safe_add_string(service_name), request_id, chatroom_id, builder, chat_msgs_len);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_REQUEST_CHAT_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE("(ts)"))) {
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- } else {
- __ipc_get_simple_error_code();
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_request_allow_chat(const char *service_name,
- long long int request_id,
- long long int chatroom_id,
- bool is_auto_allow,
- int max_count,
- bool need_delivery_ack,
- unsigned long long last_delivery_ack_timestamp,
- bool need_read_ack,
- unsigned long long last_read_ack_timestamp,
- bool need_ordered_chat_member_list,
- void *user_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
- ipc_check_proxy(sac_interface_proxy);
-
- if ((NULL == service_name)) {
- error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- error->msg = strdup("Invalid Param");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- GVariant *request = g_variant_new("(" private_service_adaptor_allow_chat_req_s_type ")",
- __safe_add_string(service_name), request_id, chatroom_id, is_auto_allow, max_count,
- need_delivery_ack, last_delivery_ack_timestamp,
- need_read_ack, last_read_ack_timestamp, need_ordered_chat_member_list);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_REQUEST_ALLOW_CHAT_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE("(ts)"))) {
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- } else {
- __ipc_get_simple_error_code();
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_request_all_unread_message(const char *service_name,
- long long int request_id,
- int max_count,
- void *user_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
- ipc_check_proxy(sac_interface_proxy);
-
- if ((NULL == service_name)) {
- error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- error->msg = strdup("Invalid Param");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- GVariant *request = g_variant_new("(" private_service_adaptor_all_unread_message_req_s_type ")", __safe_add_string(service_name), request_id, max_count);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_REQUEST_ALL_UNREAD_MESSAGE_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE("(ts)"))) {
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- } else {
- __ipc_get_simple_error_code();
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_reply_forward_online_message(const char *service_name,
- long long int request_id,
- long long int chatroom_id,
- bool mark_as_read,
- void *user_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
- ipc_check_proxy(sac_interface_proxy);
-
- if ((NULL == service_name)) {
- error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- error->msg = strdup("Invalid Param");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- GVariant *request = g_variant_new("(" private_service_adaptor_forward_online_message_res_s_type ")", __safe_add_string(service_name), request_id, chatroom_id, mark_as_read);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_REPLY_FORWARD_ONLINE_MESSAGE_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE("(ts)"))) {
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- } else {
- __ipc_get_simple_error_code();
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_reply_forward_unread_message(const char *service_name,
- long long int request_id,
- const char *next_pagination_key,
- int max_count,
- void *user_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
- ipc_check_proxy(sac_interface_proxy);
-
- if ((NULL == service_name)) {
- error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- error->msg = strdup("Invalid Param");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- GVariant *request = g_variant_new("(" private_service_adaptor_forward_unread_message_res_s_type ")", __safe_add_string(service_name), request_id, __safe_add_string(next_pagination_key), max_count);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_REPLY_FORWARD_UNREAD_MESSAGE_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE("(ts)"))) {
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- } else {
- __ipc_get_simple_error_code();
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_request_read_message(const char *service_name,
- long long int request_id,
- long long int chatroom_id,
- service_adaptor_inbox_message_s *inbox_msg,
- void *user_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
- ipc_check_proxy(sac_interface_proxy);
-
- if ((NULL == service_name) || (NULL == inbox_msg)) {
- error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- error->msg = strdup("Invalid Param");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- GVariant *request = g_variant_new("(" private_service_adaptor_read_message_req_s_type ")", __safe_add_string(service_name), request_id, chatroom_id, inbox_msg->msg_id, inbox_msg->msg_type, inbox_msg->sender, inbox_msg->receiver, inbox_msg->sent_time, __safe_add_string(inbox_msg->chat_msg), inbox_msg->chatroom_id, inbox_msg->chat_type, inbox_msg->message_ttl);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_REQUEST_READ_MESSAGE_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE("(ts)"))) {
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- } else {
- __ipc_get_simple_error_code();
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_request_invite_chat(const char *service_name,
- long long int request_id,
- long long int chatroom_id,
- long long int *inviting_members,
- unsigned int inviting_members_len,
- void *user_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
- ipc_check_proxy(sac_interface_proxy);
-
- if ((NULL == service_name) || (NULL == inviting_members) || (1 > inviting_members_len)) {
- error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- error->msg = strdup("Invalid Param");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(x)"));
-
- for (int i = 0; i < inviting_members_len; i++) {
- g_variant_builder_add(builder, "(x)", inviting_members[i]);
- }
-
- GVariant *request = g_variant_new("(" private_service_adaptor_invite_chat_req_s_type ")", __safe_add_string(service_name), request_id, chatroom_id, builder, inviting_members_len);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_REQUEST_INVITE_CHAT_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE("(ts)"))) {
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- } else {
- __ipc_get_simple_error_code();
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_request_end_chat(const char *service_name,
- long long int request_id,
- service_adaptor_end_chat_s **end_chats,
- unsigned int end_chats_len,
- void *user_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
- ipc_check_proxy(sac_interface_proxy);
-
- if ((NULL == service_name) || (NULL == end_chats) || (1 > end_chats_len)) {
- error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- error->msg = strdup("Invalid Param");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a" private_service_adaptor_end_chat_s_type));
-
- for (int i = 0; i < end_chats_len; i++) {
- g_variant_builder_add(builder, private_service_adaptor_end_chat_s_type, end_chats[i]->chatroom_id, end_chats[i]->deny_invitation);
- }
-
- GVariant *request = g_variant_new("(" private_service_adaptor_end_chat_req_s_type ")", __safe_add_string(service_name), request_id, builder, end_chats_len);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_REQUEST_END_CHAT_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE("(ts)"))) {
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- } else {
- __ipc_get_simple_error_code();
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-
-int _dbus_request_unseal_message(const char *service_name,
- long long int request_id,
- long long int chatroom_id,
- long long int sender_id,
- long long int message_id,
- const char *message_detail,
- void *user_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
- ipc_check_proxy(sac_interface_proxy);
-
- if ((NULL == service_name)) {
- error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- error->msg = strdup("Invalid Param");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- GVariant *request = g_variant_new("(" private_service_adaptor_unseal_message_req_s_type ")", __safe_add_string(service_name),
- request_id, chatroom_id, sender_id, message_id, __safe_add_string(message_detail));
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_REQUEST_UNSEAL_MESSAGE_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE("(ts)"))) {
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- } else {
- __ipc_get_simple_error_code();
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-
-int _dbus_request_save_call_log(const char *service_name,
- long long int request_id,
- long long int chatroom_id,
- const char *call_id,
- const char *call_log_type,
- long long int call_sender_id,
- long long int call_receiver_id,
- int conversaction_second,
- void *user_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
- ipc_check_proxy(sac_interface_proxy);
-
- if ((NULL == service_name)) {
- error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- error->msg = strdup("Invalid Param");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- GVariant *request = g_variant_new("(" private_service_adaptor_save_call_log_req_s_type ")", __safe_add_string(service_name),
- request_id, chatroom_id, call_id, call_log_type, call_sender_id, call_receiver_id, conversaction_second);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_REQUEST_SAVE_CALL_LOG_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE("(ts)"))) {
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- } else {
- __ipc_get_simple_error_code();
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_request_current_time(const char *service_name,
- long long int request_id,
- void *user_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
- ipc_check_proxy(sac_interface_proxy);
-
- if ((NULL == service_name)) {
- error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- error->msg = strdup("Invalid Param");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- GVariant *request = g_variant_new("(" private_service_adaptor_current_time_req_s_type ")", __safe_add_string(service_name), request_id);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_REQUEST_CURRENT_TIME_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE("(ts)"))) {
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- } else {
- __ipc_get_simple_error_code();
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_request_get_connection_policy(const char *service_name,
- service_adaptor_connection_policy_e *policy,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
- ipc_check_proxy(sac_interface_proxy);
-
- if ((NULL == service_name)) {
- error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- error->msg = strdup("Invalid Param");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- GVariant *request = g_variant_new("(" private_service_adaptor_get_connection_policy_req_s_type ")", __safe_add_string(service_name));
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_REQUEST_GET_CONNECTION_POLICY_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result,
- G_VARIANT_TYPE(MAKE_RETURN_TYPE(private_service_adaptor_connection_policy_res_s_type)))) {
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- } else {
- GVariant *call_result_struct[3];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
- call_result_struct[2] = g_variant_get_child_value(call_result, 2);
-
- GVariant *gv_policy = g_variant_get_child_value(call_result_struct[0], 0);
- *policy = (int) g_variant_get_int32(gv_policy);
- g_variant_unref(gv_policy);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[1]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[2]);
- ret = _get_result_code(remote_call_result);
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- g_variant_unref(call_result_struct[2]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_request_set_connection_policy(const char *service_name,
- service_adaptor_connection_policy_e *policy,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
- ipc_check_proxy(sac_interface_proxy);
-
- if ((NULL == service_name)) {
- error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- error->msg = strdup("Invalid Param");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- GVariant *request = g_variant_new("(" private_service_adaptor_set_connection_policy_req_s_type ")", __safe_add_string(service_name), (int32_t)*policy);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_REQUEST_SET_CONNECTION_POLICY_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result,
- G_VARIANT_TYPE(MAKE_RETURN_TYPE(private_service_adaptor_connection_policy_res_s_type)))) {
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- } else {
- GVariant *call_result_struct[3];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
- call_result_struct[2] = g_variant_get_child_value(call_result, 2);
-
- GVariant *gv_policy = g_variant_get_child_value(call_result_struct[0], 0);
- *policy = (int) g_variant_get_int32(gv_policy);
- g_variant_unref(gv_policy);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[1]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[2]);
- ret = _get_result_code(remote_call_result);
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- g_variant_unref(call_result_struct[2]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_get_chat_id_list(const char *service_name,
- service_adaptor_phone_number_s **phone_numbers,
- unsigned int phone_numbers_len,
- void *user_data,
- service_adaptor_chat_id_s ***chat_ids,
- unsigned int *chat_ids_len,
- void **server_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
- ipc_check_proxy(sac_interface_proxy);
-
- if ((NULL == service_name) || (NULL == phone_numbers) || (1 > phone_numbers_len)) {
- error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- error->msg = strdup("Invalid Param");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a" private_service_adaptor_phone_number_s_type));
-
- for (int i = 0; i < phone_numbers_len; i++) {
- g_variant_builder_open(builder, G_VARIANT_TYPE(private_service_adaptor_phone_number_s_type));
- __safe_g_variant_builder_add_string(builder, phone_numbers[i]->phonenumber);
- __safe_g_variant_builder_add_string(builder, phone_numbers[i]->ccc);
- g_variant_builder_close(builder);
- }
-
- GVariant *request = g_variant_new("(" private_service_adaptor_chat_id_list_req_s_type ")", __safe_add_string(service_name), builder, phone_numbers_len);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_GET_CHAT_ID_LIST_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE(MAKE_RETURN_TYPE(private_service_adaptor_chat_id_list_res_s_type)))) {
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- } else {
- GVariant *call_result_struct[3];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
- call_result_struct[2] = g_variant_get_child_value(call_result, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[1]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[2]);
- ret = _get_result_code(remote_call_result);
- } else {
- if ((NULL != chat_ids) && (NULL != chat_ids_len)) {
- __get_chat_id_list_res_type(call_result_struct[0], chat_ids, chat_ids_len, server_data);
- }
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- g_variant_unref(call_result_struct[2]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_get_msisdn_list(const char *service_name,
- long long int *chat_ids,
- unsigned int chat_ids_len,
- void *user_data,
- service_adaptor_chat_id_s ***msisdns,
- unsigned int *msisdns_len,
- void **server_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
- ipc_check_proxy(sac_interface_proxy);
-
- if ((NULL == service_name) || (NULL == chat_ids) || (1 > chat_ids_len)) {
- error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- error->msg = strdup("Invalid Param");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(x)"));
-
- for (int i = 0; i < chat_ids_len; i++) {
- g_variant_builder_add(builder, "(x)", chat_ids[i]);
- }
-
- GVariant *request = g_variant_new("(" private_service_adaptor_msisdn_list_req_s_type ")", __safe_add_string(service_name), builder, chat_ids_len);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_GET_MSISDN_LIST_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE(MAKE_RETURN_TYPE(private_service_adaptor_chat_id_list_res_s_type)))) {
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- } else {
- GVariant *call_result_struct[3];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
- call_result_struct[2] = g_variant_get_child_value(call_result, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[1]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[2]);
- ret = _get_result_code(remote_call_result);
- } else {
- if ((NULL != msisdns) && (NULL != msisdns_len)) {
- __get_chat_id_list_res_type(call_result_struct[0], msisdns, msisdns_len, server_data);
- }
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- g_variant_unref(call_result_struct[2]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
+++ /dev/null
-/*
-* Copyright (c) 2011 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.
-*/
-
-/******************************************************************************
- * File: dbus-client-push.c
- * Desc:
- * Created on: Oct, 2014
- * Auth: Yongjin Kim <youth.kim@samsung.com>
- *
- *****************************************************************************/
-
-#include <gio/gio.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <glib.h>
-#include <glib-object.h>
-
-#include <dbus-server.h>
-
-#include "dbus_client.h"
-#include "dbus_client_push.h"
-#include "service_adaptor_client_type.h"
-#include "private/service-adaptor-client-push.h"
-#include "service_adaptor_client_log.h"
-
-#include "util/service_adaptor_client_util.h"
-/******************************************************************************
- * Global variables and defines
- ******************************************************************************/
-
-/******************************************************************************
- * Private interface
- ******************************************************************************/
-
-/******************************************************************************
- * Private interface definition
- ******************************************************************************/
-
-#define __SAFE_FREE(x) do { free(x); (x) = NULL; } while (0)
-
-void __get_push_data_type(GVariant *parameters,
- uint32_t *service_id,
- service_adaptor_push_notification_s *noti_info)
-{
- GVariant *in_parameters = g_variant_get_child_value(parameters, 0);
- GVariant *res_struct[private_service_adaptor_push_data_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_push_data_s_type_length; j++) {
- res_struct[j] = g_variant_get_child_value(in_parameters, j);
- }
-
- int idx = 0;
- *service_id = g_variant_get_uint32(res_struct[idx++]);
- noti_info->data = ipc_g_variant_dup_string(res_struct[idx++]);
- noti_info->message = ipc_g_variant_dup_string(res_struct[idx++]);
- noti_info->time = g_variant_get_int64(res_struct[idx++]);
-
- for (size_t j = 0; j < private_service_adaptor_push_data_s_type_length; j++) {
- g_variant_unref(res_struct[j]);
- }
-}
-
-/******************************************************************************
- * Public interface definition
- ******************************************************************************/
-
-void on_push_signal(GDBusProxy *proxy,
- gchar *sender_name,
- gchar *signal_name,
- GVariant *parameters,
- gpointer user_data)
-{
- if (0 == g_strcmp0(signal_name, PRIVATE_DBUS_PUSH_DATA_SIGNAL)) {
- uint32_t service_id = 0;
- service_adaptor_push_notification_s noti_info;
- service_adaptor_error_s *error_code = NULL;
- service_adaptor_error_s error;
- error.msg = NULL;
- __get_push_data_type(parameters, &service_id, ¬i_info);
-
- service_adaptor_task_h task = _signal_queue_get_task(service_id);
-
- sac_debug("==on_push_signal== task(%p) service_id(%u)", task, service_id);
-
- if (NULL == task) {
- __SAFE_FREE(noti_info.data);
- __SAFE_FREE(noti_info.message);
- return;
- }
-
- GVariant *call_result[2];
- call_result[0] = g_variant_get_child_value(parameters, 1);
- call_result[1] = g_variant_get_child_value(parameters, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result[0]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error_code = &error;
-
- if (NULL != error_code) {
- error_code->code = remote_call_result;
- error_code->msg = ipc_g_variant_dup_string(call_result[1]);
- }
- }
-
- sac_debug("push data : %s", noti_info.data);
- sac_debug("push message : %s", noti_info.message);
- sac_debug("push time : %lld", noti_info.time);
-
- service_adaptor_push_notification_cb callback = (service_adaptor_push_notification_cb) task->callback;
-
- if (NULL != callback) {
- callback(task->handle, ¬i_info, error_code, task->user_data);
- }
- __SAFE_FREE(noti_info.data);
- __SAFE_FREE(noti_info.message);
- __SAFE_FREE(error.msg);
- }
-}
-
-static int __dbus_push_simple_operation(const char *file_name,
- service_adaptor_error_s *error,
- const char *method_name)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
-
- ipc_check_proxy(sac_interface_proxy);
-
- GVariant *request = g_variant_new("(" private_service_adaptor_push_register_req_s_type ")", file_name);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- method_name,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE("(ts)"))) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- } else {
- GVariant *call_result_struct[2];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[0]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[1]);
- ret = SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED;
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_push_register(const char *file_name,
- service_adaptor_error_s *error)
-{
- return __dbus_push_simple_operation(file_name, error, PRIVATE_DBUS_PUSH_REGISTER_METHOD);
-}
-
-int _dbus_push_deregister(const char *file_name,
- service_adaptor_error_s *error)
-{
- return __dbus_push_simple_operation(file_name, error, PRIVATE_DBUS_PUSH_DEREGISTER_METHOD);
-}
+++ /dev/null
-/*
-* Copyright (c) 2011 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.
-*/
-
-/******************************************************************************
- * File: dbus-client-shop.c
- * Desc:
- * Created on: Oct, 2014
- * Auth: Yongjin Kim <youth.kim@samsung.com>
- *
- *****************************************************************************/
-
-#include <gio/gio.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <glib.h>
-#include <glib-object.h>
-
-#include <dbus-server.h>
-
-#include "dbus_client.h"
-#include "dbus_client_shop.h"
-#include "service_adaptor_client_type.h"
-#include "private/service-adaptor-client-shop.h"
-
-#include "util/service_adaptor_client_util.h"
-/******************************************************************************
- * Global variables and defines
- ******************************************************************************/
-
-/******************************************************************************
- * Private interface
- ******************************************************************************/
-
-/******************************************************************************
- * Private interface definition
- ******************************************************************************/
-
-void __get_item_list_res_type(GVariant *call_result_struct,
- service_adaptor_shop_item_s ***items,
- unsigned int *items_len,
- void **server_data)
-{
- GVariant *res_info_struct[private_service_adaptor_shop_res_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_shop_res_s_type_length; j++) {
- res_info_struct[j] = g_variant_get_child_value(call_result_struct, j);
- }
-
- int idx = 0;
- gsize item_count = g_variant_n_children(res_info_struct[idx]);
-
- *items = (service_adaptor_shop_item_s **) g_malloc0(sizeof(service_adaptor_shop_item_s *) * item_count);
-
- for (gsize i = 0; i < item_count; i++) {
- GVariant *item_info_struct[private_service_adaptor_shop_item_s_type_length];
- GVariant *item_info_entry_v = g_variant_get_child_value(res_info_struct[idx], i);
- (*items)[i] = (service_adaptor_shop_item_s *) g_malloc0(sizeof(service_adaptor_shop_item_s));
-
- for (size_t j = 0; j < private_service_adaptor_shop_item_s_type_length; j++) {
- item_info_struct[j] = g_variant_get_child_value(item_info_entry_v, j);
- }
-
- int idx2 = 0;
- (*items)[i]->item_id = g_variant_get_int32(item_info_struct[idx2++]);
- (*items)[i]->category_id = g_variant_get_int32(item_info_struct[idx2++]);
-
- gsize ids_count = g_variant_n_children(item_info_struct[idx2]);
- (*items)[i]->sticker_ids = (long *) g_malloc0(sizeof(long) * ids_count);
-
- for (gsize k = 0; k < ids_count; k++) {
- GVariant *ids_info_entry_v = g_variant_get_child_value(item_info_struct[idx2], k);
- GVariant *ids_info_struct = g_variant_get_child_value(ids_info_entry_v, 0);;
-
- (*items)[i]->sticker_ids[k] = g_variant_get_int32(ids_info_struct);
-
- g_variant_unref(ids_info_struct);
- }
- idx2++;
-
- (*items)[i]->sticker_ids_len = g_variant_get_uint32(item_info_struct[idx2++]);
- (*items)[i]->title = ipc_g_variant_dup_string(item_info_struct[idx2++]);
- (*items)[i]->character = ipc_g_variant_dup_string(item_info_struct[idx2++]);
- (*items)[i]->version = g_variant_get_int32(item_info_struct[idx2++]);
- (*items)[i]->download_url = ipc_g_variant_dup_string(item_info_struct[idx2++]);
- (*items)[i]->panel_url = ipc_g_variant_dup_string(item_info_struct[idx2++]);
- (*items)[i]->sticker_url = ipc_g_variant_dup_string(item_info_struct[idx2++]);
- (*items)[i]->file_size = g_variant_get_int32(item_info_struct[idx2++]);
- (*items)[i]->count = g_variant_get_int32(item_info_struct[idx2++]);
- (*items)[i]->character_code = ipc_g_variant_dup_string(item_info_struct[idx2++]);
- (*items)[i]->startdate = (long long int) g_variant_get_int64(item_info_struct[idx2++]);
- (*items)[i]->enddate = (long long int) g_variant_get_int64(item_info_struct[idx2++]);
- (*items)[i]->expired_date = (long long int) g_variant_get_int64(item_info_struct[idx2++]);
- (*items)[i]->valid_period = (long long int) g_variant_get_int64(item_info_struct[idx2++]);
-
- for (size_t j = 0; j < private_service_adaptor_shop_item_s_type_length; j++) {
- g_variant_unref(item_info_struct[j]);
- }
- }
- idx++;
-
- *items_len = g_variant_get_uint32(res_info_struct[idx++]);
-
- for (size_t j = 0; j < private_service_adaptor_shop_res_s_type_length; j++) {
- g_variant_unref(res_info_struct[j]);
- }
-}
-
-GVariant *__create_shop_req_type(const char *service_name,
- service_adaptor_shop_info_s *info,
- void *user_data)
-{
- GVariant *request = g_variant_new("(" private_service_adaptor_shop_req_s_type ")", __safe_add_string(service_name), info->category_id, info->item_id, info->sticker_id, __safe_add_string(info->lang_cd), __safe_add_string(info->cntry_cd), info->rwidth, info->rheight, info->start_idx, info->count);
-
- return request;
-}
-
-void __get_shop_res_type(GVariant *call_result_struct,
- service_adaptor_shop_item_s **item,
- void **server_data)
-{
- GVariant *res_info_struct[private_service_adaptor_shop_item_s_type_length];
-
- for (size_t j = 0; j < private_service_adaptor_shop_item_s_type_length; j++) {
- res_info_struct[j] = g_variant_get_child_value(call_result_struct, j);
- }
-
- int idx = 0;
- *item = (service_adaptor_shop_item_s *) calloc(1, sizeof(service_adaptor_shop_item_s));
- if (NULL != *item) {
- (*item)->item_id = g_variant_get_int32(res_info_struct[idx++]);
- (*item)->category_id = g_variant_get_int32(res_info_struct[idx++]);
-
- gsize ids_count = g_variant_n_children(res_info_struct[idx]);
- (*item)->sticker_ids = (long *) calloc(ids_count, sizeof(long));
-
- if (NULL != (*item)->sticker_ids) {
- for (gsize i = 0; i < ids_count; i++) {
- GVariant *ids_info_entry_v = g_variant_get_child_value(res_info_struct[idx], i);
- GVariant *ids_info_struct = g_variant_get_child_value(ids_info_entry_v, 0);;
-
- (*item)->sticker_ids[i] = g_variant_get_int32(ids_info_struct);
-
- g_variant_unref(ids_info_struct);
- }
- idx++;
- (*item)->sticker_ids_len = g_variant_get_uint32(res_info_struct[idx++]);
- } else {
- (*item)->sticker_ids_len = 0U;
- idx++;
- idx++;
- }
- (*item)->title = ipc_g_variant_dup_string(res_info_struct[idx++]);
- (*item)->character = ipc_g_variant_dup_string(res_info_struct[idx++]);
- (*item)->version = g_variant_get_int32(res_info_struct[idx++]);
- (*item)->download_url = ipc_g_variant_dup_string(res_info_struct[idx++]);
- (*item)->panel_url = ipc_g_variant_dup_string(res_info_struct[idx++]);
- (*item)->sticker_url = ipc_g_variant_dup_string(res_info_struct[idx++]);
- (*item)->file_size = g_variant_get_int32(res_info_struct[idx++]);
- (*item)->count = g_variant_get_int32(res_info_struct[idx++]);
- (*item)->character_code = ipc_g_variant_dup_string(res_info_struct[idx++]);
- (*item)->startdate = g_variant_get_int64(res_info_struct[idx++]);
- (*item)->enddate = g_variant_get_int64(res_info_struct[idx++]);
- (*item)->expired_date = g_variant_get_int64(res_info_struct[idx++]);
- (*item)->valid_period = g_variant_get_int64(res_info_struct[idx++]);
- }
-
- for (size_t j = 0; j < private_service_adaptor_shop_item_s_type_length; j++) {
- g_variant_unref(res_info_struct[j]);
- }
-}
-
-/******************************************************************************
- * Public interface definition
- ******************************************************************************/
-
-/** @brief
- * @return service_adaptor_error_s
- * @remarks :
- */
-int _dbus_get_item_list(const char *service_name,
- service_adaptor_shop_info_s *info,
- void *user_data,
- service_adaptor_shop_item_s ***items,
- unsigned int *items_len,
- void **server_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
-
- ipc_check_proxy(sac_interface_proxy);
-
- GVariant *request = __create_shop_req_type(service_name, info, user_data);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_GET_ITEM_LIST_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE(MAKE_RETURN_TYPE(private_service_adaptor_shop_res_s_type)))) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- } else {
- GVariant *call_result_struct[3];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
- call_result_struct[2] = g_variant_get_child_value(call_result, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[1]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[2]);
- ret = _get_result_code(remote_call_result);
- } else {
- if ((NULL != items) && (NULL != items_len)) {
- __get_item_list_res_type(call_result_struct[0], items, items_len, server_data);
- }
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- g_variant_unref(call_result_struct[2]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_download_item_package(const char *service_name,
- service_adaptor_shop_info_s *info,
- void *user_data,
- service_adaptor_shop_item_s **item,
- void **server_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
-
- ipc_check_proxy(sac_interface_proxy);
-
- GVariant *request = __create_shop_req_type(service_name, info, user_data);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_DOWNLOAD_ITEM_PACKAGE_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE(MAKE_RETURN_TYPE(private_service_adaptor_shop_item_s_type)))) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- } else {
- GVariant *call_result_struct[3];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
- call_result_struct[2] = g_variant_get_child_value(call_result, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[1]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[2]);
- ret = _get_result_code(remote_call_result);
- } else {
- if (NULL != item) {
- __get_shop_res_type(call_result_struct[0], item, server_data);
- }
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- g_variant_unref(call_result_struct[2]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_download_sticker(const char *service_name,
- service_adaptor_shop_info_s *info,
- void *user_data,
- service_adaptor_shop_item_s **item,
- void **server_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
-
- ipc_check_proxy(sac_interface_proxy);
-
- GVariant *request = __create_shop_req_type(service_name, info, user_data);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_DOWNLOAD_STICKER_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE(MAKE_RETURN_TYPE(private_service_adaptor_shop_item_s_type)))) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- } else {
- GVariant *call_result_struct[3];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
- call_result_struct[2] = g_variant_get_child_value(call_result, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[1]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[2]);
- ret = _get_result_code(remote_call_result);
- } else {
- if (NULL != item) {
- __get_shop_res_type(call_result_struct[0], item, server_data);
- }
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- g_variant_unref(call_result_struct[2]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
-int _dbus_get_panel_url(const char *service_name,
- service_adaptor_shop_info_s *info,
- void *user_data,
- service_adaptor_shop_item_s **item,
- void **server_data,
- service_adaptor_error_s *error)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- GError *g_error = NULL;
- GVariant *call_result = NULL;
-
- GDBusProxy *sac_interface_proxy = _dbus_get_sac_interface_proxy();
-
- ipc_check_proxy(sac_interface_proxy);
-
- GVariant *request = __create_shop_req_type(service_name, info, user_data);
-
- call_result = g_dbus_proxy_call_sync(sac_interface_proxy,
- PRIVATE_DBUS_GET_PANEL_URL_METHOD,
- request,
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &g_error);
-
- if (NULL == call_result) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
-
- if (NULL != g_error) {
- error->msg = __SAFE_STRDUP(g_error->message);
- g_error_free(g_error);
- }
- } else {
- if (FALSE == g_variant_is_of_type(call_result, G_VARIANT_TYPE(MAKE_RETURN_TYPE(private_service_adaptor_shop_item_s_type)))) {
- error->code = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- error->msg = strdup("D-Bus return type error");
- ret = SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE;
- } else {
- GVariant *call_result_struct[3];
- call_result_struct[0] = g_variant_get_child_value(call_result, 0);
- call_result_struct[1] = g_variant_get_child_value(call_result, 1);
- call_result_struct[2] = g_variant_get_child_value(call_result, 2);
-
- uint64_t remote_call_result = g_variant_get_uint64(call_result_struct[1]);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != remote_call_result) {
- error->code = remote_call_result;
- error->msg = ipc_g_variant_dup_string(call_result_struct[2]);
- ret = _get_result_code(remote_call_result);
- } else {
- if (NULL != item) {
- __get_shop_res_type(call_result_struct[0], item, server_data);
- }
- }
-
- g_variant_unref(call_result_struct[0]);
- g_variant_unref(call_result_struct[1]);
- g_variant_unref(call_result_struct[2]);
- }
-
- g_variant_unref(call_result);
- }
-
- return ret;
-}
-
+++ /dev/null
-/*
-* Copyright (c) 2011 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.
-*/
-
-/******************************************************************************
- * File: service-adaptor-client-auth.c
- * Desc:
- * Created on: Oct, 2014
- * Auth: Yongjin Kim <youth.kim@samsung.com>
- *
- *****************************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "private/service-adaptor-client-auth.h"
-#include "service_adaptor_client_type.h"
-#include "service_adaptor_client_log.h"
-#include "dbus_client.h"
-#include "dbus_client_auth.h"
-
-#include "util/service_adaptor_client_util.h"
-/** @brief Gets Auth Plugin List
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_get_auth_plugin(service_adaptor_h handle,
- service_adaptor_plugin_h **plugins,
- unsigned int *plugins_len,
- service_adaptor_error_s **error_code)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
- error.msg = NULL;
- GList *plugin_list = NULL;
- int len = 0;
-
- if ((NULL == handle) || (NULL == plugins) || (0 == plugins_len)) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invalid Argument");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- ret = _dbus_get_auth_plugin_list(&plugin_list, handle->imsi ? handle->imsi : "", &error);
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- _assign_error_code(&error, error_code);
- }
-
- int size = g_list_length(plugin_list);
- service_adaptor_plugin_h *plugins_array = (service_adaptor_plugin_h *) calloc(size, sizeof(service_adaptor_plugin_h));
-
- if (NULL == plugins_array) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_UNKNOWN, "Memory allocation failed");
- return SERVICE_ADAPTOR_ERROR_UNKNOWN;
- }
-
- for (GList *list = g_list_first(plugin_list); list != NULL; list = g_list_next(list)) {
- service_adaptor_plugin_h plugin = (service_adaptor_plugin_h) list->data;
-
- if (NULL == plugin) {
- continue;
- }
-
- plugins_array[len] = (service_adaptor_plugin_h) calloc(1, sizeof(service_adaptor_plugin_s));
- if (NULL != plugins_array[len]) {
- plugins_array[len]->name = _safe_strdup(plugin->name);
- plugins_array[len]->login = plugin->login;
- }
- len++;
- }
-
- *plugins = plugins_array;
- *plugins_len = size;
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Logins Auth Plugin using appId and appSecret
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_set_auth_plugin(service_adaptor_h handle,
- service_adaptor_plugin_h plugin_handle)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_plugin_h plugin = NULL;
-
- if ((NULL == handle) || (NULL == plugin_handle) || (NULL == plugin_handle->name)) {
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- plugin = (service_adaptor_plugin_h) calloc(1, sizeof(service_adaptor_plugin_s));
-
- if (NULL == plugin) {
- return SERVICE_ADAPTOR_ERROR_UNKNOWN;
- }
-
- plugin->name = _safe_strdup(plugin_handle->name);
- plugin->login = plugin_handle->login;
-
- handle->plugin = plugin;
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Renuests Channel Auth
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_set_auth(service_adaptor_h handle,
- const char *service_name,
- const char *app_id,
- const char *app_secret,
- unsigned int service_id,
- service_adaptor_error_s **error_code,
- void *user_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
- error.msg = NULL;
-
- if ((NULL == handle) || (NULL == handle->imsi) || (NULL == handle->plugin) || (NULL == handle->plugin->name) || (NULL == service_name) || (NULL == app_id) || (NULL == app_secret)) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invalid Argument");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- if (NULL != handle->service_name) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_STATE, "Duplicated handle usage (Destroy and create new handle)");
- return SERVICE_ADAPTOR_ERROR_INVALID_STATE;
- }
-
- char *_service_name = strdup(service_name);
- char *_app_id = strdup(app_id);
- if ((NULL == _service_name) || (NULL == _app_id)) {
- free(_service_name);
- free(_app_id);
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_UNKNOWN, "Memory allocation failed");
- return SERVICE_ADAPTOR_ERROR_UNKNOWN;
- }
-
- sac_debug("set_auth mutex lock");
- g_mutex_lock(&handle->set_auth_mutex);
- ret = _dbus_set_auth(service_name, handle->imsi, handle->plugin->name, app_id, app_secret, service_id, user_data, &error);
- g_mutex_unlock(&handle->set_auth_mutex);
- sac_debug("set_auth mutex unlock");
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- sac_info("set_auth API failed: %d (%s)", ret, _service_name);
- free(_service_name);
- free(_app_id);
- _assign_error_code(&error, error_code);
- } else {
- sac_info("set_auth API success (%s)", _service_name);
- handle->service_name = _service_name;
- handle->app_id = _app_id;
- handle->service_id = service_id;
- }
-
- sac_api_end(ret);
- return ret;
-}
-
+++ /dev/null
-/*
-* Copyright (c) 2011 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.
-*/
-
-/******************************************************************************
- * File: service-adaptor-client-contact.c
- * Desc:
- * Created on: Oct, 2014
- * Auth: Yongjin Kim <youth.kim@samsung.com>
- *
- *****************************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "service_adaptor_client_type.h"
-#include "service_adaptor_client_log.h"
-#include "private/service-adaptor-client-contact.h"
-#include "dbus_client.h"
-#include "dbus_client_contact.h"
-
-#include "util/service_adaptor_client_util.h"
-/** @brief Resets contact information in Contact Server and
- * uploads native contact information of device to the server
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_set_new_contact_list(service_adaptor_h handle,
- service_adaptor_contact_req_s *contact_req,
- void *user_data,
- service_adaptor_contact_res_s **contact_res,
- service_adaptor_error_s **error_code,
- void **server_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
- error.msg = NULL;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == contact_req)) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invalid Argument");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- if (NULL == handle->service_name) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_STATE, "Invalid handle state");
- return SERVICE_ADAPTOR_ERROR_INVALID_STATE;
- }
-
- ret = _dbus_set_new_contact_list(handle->service_name, contact_req, user_data, contact_res, server_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- _assign_error_code(&error, error_code);
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Synchronizes native contact information of device with Contact Server
- * according to [type] field of each contact
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_set_contact_list(service_adaptor_h handle,
- service_adaptor_contact_req_s *contact_req,
- void *user_data,
- service_adaptor_contact_res_s **contact_res,
- service_adaptor_error_s **error_code,
- void **server_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
- error.msg = NULL;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == contact_req)) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invalid Argument");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- if (NULL == handle->service_name) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_STATE, "Invalid handle state");
- return SERVICE_ADAPTOR_ERROR_INVALID_STATE;
- }
-
- ret = _dbus_set_contact_list(handle->service_name, contact_req, user_data, contact_res, server_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- _assign_error_code(&error, error_code);
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Gets profile and service registration information of each contact
- * (only contacts agreed to share with me are returned)
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_get_contact_infos_latest(service_adaptor_h handle,
- service_adaptor_contact_res_s **contact_res,
- service_adaptor_error_s **error_code,
- void **server_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
- error.msg = NULL;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == contact_res)) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invalid Argument");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- if (NULL == handle->service_name) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_STATE, "Invalid handle state");
- return SERVICE_ADAPTOR_ERROR_INVALID_STATE;
- }
-
- ret = _dbus_get_contact_list(handle->service_name, contact_res, server_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- _assign_error_code(&error, error_code);
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Gets profiles and service registration information of contacts
- * that have been updated since last update
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_get_contact_infos_polling(service_adaptor_h handle,
- service_adaptor_contact_req_s *contact_req,
- void *user_data,
- service_adaptor_contact_res_s **contact_res,
- service_adaptor_error_s **error_code,
- void **server_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
- error.msg = NULL;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == contact_req)) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invalid Argument");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- if (NULL == handle->service_name) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_STATE, "Invalid handle state");
- return SERVICE_ADAPTOR_ERROR_INVALID_STATE;
- }
-
- ret = _dbus_get_contact_infos_polling(handle->service_name, contact_req, user_data, contact_res, server_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- _assign_error_code(&error, error_code);
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Sets or updates device’s profile to server
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_set_me_profile_with_push(service_adaptor_h handle,
- service_adaptor_profile_req_s *profile_req,
- service_adaptor_error_s **error_code,
- void *user_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
- error.msg = NULL;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == profile_req)) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invalid Argument");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- if (NULL == handle->service_name) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_STATE, "Invalid handle state");
- return SERVICE_ADAPTOR_ERROR_INVALID_STATE;
- }
-
- ret = _dbus_set_me_profile_with_push(handle->service_name, profile_req, user_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- _assign_error_code(&error, error_code);
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Gets the profile information of a contact which is correspondent with
- * country code (optional) and phone number (mandatory)
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_get_profile(service_adaptor_h handle,
- service_adaptor_profile_req_s *profile_req,
- void *user_data,
- service_adaptor_profile_res_s **profile_res,
- service_adaptor_error_s **error_code,
- void **server_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
- error.msg = NULL;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == profile_req) || (NULL == profile_res)) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invalid Argument");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- if (NULL == handle->service_name) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_STATE, "Invalid handle state");
- return SERVICE_ADAPTOR_ERROR_INVALID_STATE;
- }
-
- ret = _dbus_get_profile(handle->service_name, profile_req, user_data,
- profile_res, server_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- _assign_error_code(&error, error_code);
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Uploads profile image meta to File Server and sets my profile image to Profile Server
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_set_profile_image_meta_with_push(service_adaptor_h handle,
- service_adaptor_profile_image_h *images,
- unsigned int images_len,
- void *user_data,
- service_adaptor_profile_image_h **failed_images,
- unsigned int *failed_images_len,
- service_adaptor_error_s **error_code,
- void **server_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
- error.msg = NULL;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == images)) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invalid Argument");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- if (NULL == handle->service_name) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_STATE, "Invalid handle state");
- return SERVICE_ADAPTOR_ERROR_INVALID_STATE;
- }
-
- ret = _dbus_set_profile_image_meta_with_push(handle->service_name,
- images, images_len, user_data, failed_images, failed_images_len, server_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- _assign_error_code(&error, error_code);
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Deletes profile image meta from Profile Server
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_delete_me_profile_image_meta_with_push(service_adaptor_h handle,
- service_adaptor_error_s **error_code,
- void *user_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
-
- if ((NULL == handle) || (NULL == handle->plugin)) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invalid Argument");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- if (NULL == handle->service_name) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_STATE, "Invalid handle state");
- return SERVICE_ADAPTOR_ERROR_INVALID_STATE;
- }
-
- ret = _dbus_delete_me_profile_image_meta_with_push(handle->service_name, user_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- _assign_error_code(&error, error_code);
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Sets the level of privacy, the scope of people to be opened
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_set_me_profile_privacy(service_adaptor_h handle,
- service_adaptor_privacy_req_s *privacy_req,
- service_adaptor_error_s **error_code,
- void *user_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
- error.msg = NULL;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == privacy_req)) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invalid Argument");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- if (NULL == handle->service_name) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_STATE, "Invalid handle state");
- return SERVICE_ADAPTOR_ERROR_INVALID_STATE;
- }
-
- ret = _dbus_set_me_profile_privacy(handle->service_name, privacy_req, user_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- _assign_error_code(&error, error_code);
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Gets my profile’s privacy level
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_get_me_profile_privacy(service_adaptor_h handle,
- service_adaptor_privacy_res_s **privacy_res,
- service_adaptor_error_s **error_code,
- void **server_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
- error.msg = NULL;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == privacy_res)) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invalid Argument");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- if (NULL == handle->service_name) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_STATE, "Invalid handle state");
- return SERVICE_ADAPTOR_ERROR_INVALID_STATE;
- }
-
- ret = _dbus_get_me_profile_privacy(handle->service_name, privacy_res, server_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- _assign_error_code(&error, error_code);
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Sets my presence information to Presence Server
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_set_me_presence_with_push(service_adaptor_h handle,
- service_adaptor_presence_req_s *presence_req,
- service_adaptor_error_s **error_code,
- void *user_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == presence_req)) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invalid Argument");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- if (NULL == handle->service_name) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_STATE, "Invalid handle state");
- return SERVICE_ADAPTOR_ERROR_INVALID_STATE;
- }
-
- ret = _dbus_set_me_presence_with_push(handle->service_name, presence_req, user_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- _assign_error_code(&error, error_code);
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Sets my presence ON/OFF information to Presence Server
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_set_me_presence_on_off_with_push(service_adaptor_h handle,
- service_adaptor_presence_req_s *presence_req,
- service_adaptor_error_s **error_code,
- void *user_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
- error.msg = NULL;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == presence_req)) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invalid Argument");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- if (NULL == handle->service_name) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_STATE, "Invalid handle state");
- return SERVICE_ADAPTOR_ERROR_INVALID_STATE;
- }
-
- ret = _dbus_set_me_presence_on_off_with_push(handle->service_name,
- presence_req, user_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- _assign_error_code(&error, error_code);
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-int service_adaptor_set_me_profile_type(service_adaptor_h handle,
- int profile_type,
- char **profile_url,
- service_adaptor_error_s **error_code,
- void *user_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
- error.msg = NULL;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == profile_url)) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invalid Argument");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- if (NULL == handle->service_name) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_STATE, "Invalid handle state");
- return SERVICE_ADAPTOR_ERROR_INVALID_STATE;
- }
-
- ret = _dbus_set_me_profile_type(handle->service_name,
- profile_type, profile_url, user_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- _assign_error_code(&error, error_code);
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-
-
-int service_adaptor_profile_image_create(service_adaptor_profile_image_h *image)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- if (NULL == image) {
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- *image = (service_adaptor_profile_image_h)calloc(1, sizeof(struct _service_adaptor_profile_image_s));
-
- if (NULL == *image) {
- return SERVICE_ADAPTOR_ERROR_UNKNOWN;
- }
-
- memset((*image)->path, 0, 2048);
-
- sac_api_end(ret);
- return ret;
-}
-
-int service_adaptor_profile_image_set_element(service_adaptor_profile_image_h image,
- service_adaptor_contact_request_type_e req_type,
- int index,
- const char *path)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- if ((NULL == image) || (NULL == path)) {
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- image->type = req_type;
- image->index = index;
- strncpy(image->path, path, (CONTACT_PROFILE_IMAGE_PATH_LEN - 1));
-
- sac_api_end(ret);
- return ret;
-}
-
-int service_adaptor_profile_image_get_index(service_adaptor_profile_image_h image, int *index)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- if ((NULL == image) || (NULL == index)) {
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- *index = image->index;
-
- sac_api_end(ret);
- return ret;
-}
-
-int service_adaptor_profile_image_get_url(service_adaptor_profile_image_h image, char **url)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- if ((NULL == image) || (NULL == url)) {
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- if ('\0' == image->path[0]) {
- *url = NULL;
- ret = SERVICE_ADAPTOR_ERROR_NO_DATA;
- } else {
- *url = strdup(image->path);
- if (*url == NULL) {
- ret = SERVICE_ADAPTOR_ERROR_UNKNOWN;
- }
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-int service_adaptor_profile_image_get_req_type(service_adaptor_profile_image_h image, int *req_type)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- if ((NULL == image) || (NULL == req_type)) {
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- *req_type = image->type;
-
- sac_api_end(ret);
- return ret;
-}
-
-void service_adaptor_profile_image_destroy(service_adaptor_profile_image_h image)
-{
- free(image);
-}
-
+++ /dev/null
-/*
-* Copyright (c) 2011 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.
-*/
-
-/******************************************************************************
- * File: service-adaptor-client-messaging.c
- * Desc:
- * Created on: Oct, 2014
- * Auth: Yongjin Kim <youth.kim@samsung.com>
- *
- *****************************************************************************/
-
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "private/service-adaptor-client-message.h"
-#include "service_adaptor_client_type.h"
-#include "service_adaptor_client_log.h"
-#include "dbus_client.h"
-#include "dbus_client_message.h"
-
-#include "util/service_adaptor_client_util.h"
-/** @brief Requests Creating Chatroom
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_request_create_chatroom(service_adaptor_h handle,
- long long int request_id,
- int chat_type,
- long long int *receivers,
- unsigned int receivers_len,
- const char *chatroom_title,
- service_adaptor_reply_create_chatroom_cb callback,
- service_adaptor_error_s **error_code,
- void *user_data)
-{
- sac_api_start_msg(request_id);
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (0 > chat_type) || (1 < chat_type) ||
- (NULL == chatroom_title) || (NULL == receivers) || (1 > receivers_len)) {
- if (NULL != error_code) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if (NULL != _error) {
- _error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- _error->msg = strdup("Invalid Argument");
- }
- *error_code = _error;
- }
-
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- _queue_add_task(request_id, (uint32_t) callback, handle, user_data);
-
- error.code = SERVICE_ADAPTOR_ERROR_NONE;
- error.msg = NULL;
- ret = _dbus_request_create_chatroom(handle->service_name, request_id, chat_type, receivers, receivers_len, chatroom_title, user_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if ((NULL != _error) && (NULL != error_code)) {
- _error->code = error.code;
- _error->msg = error.msg;
- *error_code = _error;
- } else {
- free(_error);
- free(error.msg);
- }
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Requests Changing Chatroom metadata
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_request_change_chatroom_meta(service_adaptor_h handle,
- long long int request_id,
- long long int chatroom_id,
- const char *chatroom_title,
- int default_message_ttl,
- service_adaptor_reply_change_chatroom_meta_cb callback,
- service_adaptor_error_s **error_code,
- void *user_data)
-
-{
- sac_api_start_msg(request_id);
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
-
- if ((NULL == handle) || (NULL == handle->plugin)) {
- if (NULL != error_code) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if (NULL != _error) {
- _error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- _error->msg = strdup("Invalid Argument");
- }
- *error_code = _error;
- }
-
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- _queue_add_task(request_id, (uint32_t) callback, handle, user_data);
-
- error.code = SERVICE_ADAPTOR_ERROR_NONE;
- error.msg = NULL;
- ret = _dbus_request_change_chatroom_meta(handle->service_name, request_id, chatroom_id, chatroom_title, default_message_ttl, user_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if ((NULL != _error) && (NULL != error_code)) {
- _error->code = error.code;
- _error->msg = error.msg;
- *error_code = _error;
- } else {
- free(_error);
- free(error.msg);
- }
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-
-/** @brief Requests Chat
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_request_chat(service_adaptor_h handle,
- long long int request_id,
- long long int chatroom_id,
- service_adaptor_chat_msg_s **chat_msgs,
- unsigned int chat_msgs_len,
- service_adaptor_reply_chat_cb callback,
- service_adaptor_error_s **error_code,
- void *user_data)
-{
- sac_api_start_msg(request_id);
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == chat_msgs) || (1 > chat_msgs_len)) {
- if (NULL != error_code) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if (NULL != _error) {
- _error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- _error->msg = strdup("Invalid Argument");
- }
- *error_code = _error;
- }
-
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- _queue_add_task(request_id, (uint32_t) callback, handle, user_data);
-
- error.code = SERVICE_ADAPTOR_ERROR_NONE;
- error.msg = NULL;
- ret = _dbus_request_chat(handle->service_name, request_id, chatroom_id, chat_msgs, chat_msgs_len, user_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if ((NULL != _error) && (NULL != error_code)) {
- _error->code = error.code;
- _error->msg = error.msg;
- *error_code = _error;
- } else {
- free(_error);
- free(error.msg);
- }
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Requests Allow Chat
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_request_allow_chat(service_adaptor_h handle,
- long long int request_id,
- long long int chatroom_id,
- bool is_auto_allow,
- int max_count,
- bool need_delivery_ack,
- unsigned long long last_delivery_ack_timestamp,
- bool need_read_ack,
- unsigned long long last_read_ack_timestamp,
- bool need_ordered_chat_member_list,
- service_adaptor_reply_allow_chat_cb callback,
- service_adaptor_error_s **error_code,
- void *user_data)
-{
- sac_api_start_msg(request_id);
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
-
- if ((NULL == handle) || (NULL == handle->plugin)) {
- if (NULL != error_code) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if (NULL != _error) {
- _error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- _error->msg = strdup("Invalid Argument");
- }
- *error_code = _error;
- }
-
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- _queue_add_task(request_id, (uint32_t) callback, handle, user_data);
-
- error.code = SERVICE_ADAPTOR_ERROR_NONE;
- error.msg = NULL;
- ret = _dbus_request_allow_chat(handle->service_name, request_id, chatroom_id, is_auto_allow, max_count,
- need_delivery_ack, last_delivery_ack_timestamp, need_read_ack, last_read_ack_timestamp,
- need_ordered_chat_member_list, user_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if ((NULL != _error) && (NULL != error_code)) {
- _error->code = error.code;
- _error->msg = error.msg;
- *error_code = _error;
- } else {
- free(_error);
- free(error.msg);
- }
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Requests All Unread Message
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_request_all_unread_message(service_adaptor_h handle,
- long long int request_id,
- int max_count,
- service_adaptor_reply_all_unread_message_cb callback,
- service_adaptor_error_s **error_code,
- void *user_data)
-{
- sac_api_start_msg(request_id);
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
-
- if ((NULL == handle) || (NULL == handle->plugin)) {
- if (NULL != error_code) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if (NULL != _error) {
- _error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- _error->msg = strdup("Invalid Argument");
- }
- *error_code = _error;
- }
-
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- _queue_add_task(request_id, (uint32_t) callback, handle, user_data);
-
- error.code = SERVICE_ADAPTOR_ERROR_NONE;
- error.msg = NULL;
- ret = _dbus_request_all_unread_message(handle->service_name, request_id, max_count, user_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if ((NULL != _error) && (NULL != error_code)) {
- _error->code = error.code;
- _error->msg = error.msg;
- *error_code = _error;
- } else {
- free(_error);
- free(error.msg);
- }
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Registers Forward Online Message Listener
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_register_channel_disconnected_listener(service_adaptor_h handle,
- service_adaptor_reply_channel_disconnected_cb callback,
- void *user_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
-
- _queue_add_task(TASK_MESSAGE_CHANNEL_DISCONNECTED_MESSAGE, (uint32_t) callback, handle, user_data);
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Unregisters Forward Online Message Listener
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_unregister_channel_disconnected_listener(service_adaptor_h handle,
- void *user_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
-
- service_adaptor_task_h task = _queue_get_task(TASK_MESSAGE_CHANNEL_DISCONNECTED_MESSAGE);
-
- if (NULL == task) {
- return SERVICE_ADAPTOR_ERROR_UNKNOWN;
- }
-
- _queue_del_task(task);
-
- sac_api_end(ret);
- return ret;
-}
-
-
-
-/** @brief Registers Forward Online Message Listener
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_register_forward_online_message_listener(service_adaptor_h handle,
- service_adaptor_request_forward_online_message_cb callback,
- void *user_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
-
- _queue_add_task(TASK_MESSAGE_FORWARD_ONLINE_MESSAGE, (uint32_t) callback, handle, user_data);
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Unregisters Forward Online Message Listener
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_unregister_forward_online_message_listener(service_adaptor_h handle,
- void *user_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
-
- service_adaptor_task_h task = _queue_get_task(TASK_MESSAGE_FORWARD_ONLINE_MESSAGE);
-
- if (NULL == task) {
- return SERVICE_ADAPTOR_ERROR_UNKNOWN;
- }
-
- _queue_del_task(task);
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Requests Forward Online Message
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_reply_forward_online_message(service_adaptor_h handle,
- long long int request_id,
- long long int chatroom_id,
- bool mark_as_read,
- service_adaptor_error_s **error_code,
- void *user_data)
-{
- sac_api_start_msg(request_id);
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
-
- if ((NULL == handle) || (NULL == handle->plugin)) {
- if (NULL != error_code) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if (NULL != _error) {
- _error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- _error->msg = strdup("Invalid Argument");
- }
- *error_code = _error;
- }
-
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- error.code = SERVICE_ADAPTOR_ERROR_NONE;
- error.msg = NULL;
- ret = _dbus_reply_forward_online_message(handle->service_name, request_id, chatroom_id, mark_as_read, user_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if ((NULL != _error) && (NULL != error_code)) {
- _error->code = error.code;
- _error->msg = error.msg;
- *error_code = _error;
- } else {
- free(_error);
- free(error.msg);
- }
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Registers Forward Unread Message Listener
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_register_forward_unread_message_listener(service_adaptor_h handle,
- service_adaptor_request_forward_unread_message_cb callback,
- void *user_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
-
- _queue_add_task(TASK_MESSAGE_FORWARD_UNREAD_MESSAGE, (uint32_t) callback, handle, user_data);
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Unregisters Forward Unread Message Listener
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_unregister_forward_unread_message_listener(service_adaptor_h handle,
- void *user_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
-
- service_adaptor_task_h task = _queue_get_task(TASK_MESSAGE_FORWARD_UNREAD_MESSAGE);
-
- if (NULL == task) {
- return SERVICE_ADAPTOR_ERROR_UNKNOWN;
- }
-
- _queue_del_task(task);
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Requests Forward Unread Message
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_reply_forward_unread_message(service_adaptor_h handle,
- long long int request_id,
- const char *next_pagination_key,
- int max_count,
- service_adaptor_error_s **error_code,
- void *user_data)
-{
- sac_api_start_msg(request_id);
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
-
- if ((NULL == handle) || (NULL == handle->plugin)) {
- if (NULL != error_code) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if (NULL != _error) {
- _error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- _error->msg = strdup("Invalid Argument");
- }
- *error_code = _error;
- }
-
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- error.code = SERVICE_ADAPTOR_ERROR_NONE;
- error.msg = NULL;
- ret = _dbus_reply_forward_unread_message(handle->service_name, request_id, next_pagination_key, max_count, user_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if ((NULL != _error) && (NULL != error_code)) {
- _error->code = error.code;
- _error->msg = error.msg;
- *error_code = _error;
- } else {
- free(_error);
- free(error.msg);
- }
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Requests Read Message
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_request_read_message(service_adaptor_h handle,
- long long int request_id,
- long long int chatroom_id,
- service_adaptor_inbox_message_s *inbox_msg,
- service_adaptor_reply_read_message_cb callback,
- service_adaptor_error_s **error_code,
- void *user_data)
-{
- sac_api_start_msg(request_id);
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
-
- _queue_add_task(request_id, (uint32_t) callback, handle, user_data);
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == inbox_msg)) {
- if (NULL != error_code) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if (NULL != _error) {
- _error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- _error->msg = strdup("Invalid Argument");
- }
- *error_code = _error;
- }
-
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- error.code = SERVICE_ADAPTOR_ERROR_NONE;
- error.msg = NULL;
- ret = _dbus_request_read_message(handle->service_name, request_id, chatroom_id, inbox_msg, user_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if ((NULL != _error) && (NULL != error_code)) {
- _error->code = error.code;
- _error->msg = error.msg;
- *error_code = _error;
- } else {
- free(_error);
- free(error.msg);
- }
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Requests Invite Chat
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_request_invite_chat(service_adaptor_h handle,
- long long int request_id,
- long long int chatroom_id,
- long long int *inviting_members,
- unsigned int inviting_members_len,
- service_adaptor_reply_invite_chat_cb callback,
- service_adaptor_error_s **error_code,
- void *user_data)
-{
- sac_api_start_msg(request_id);
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == inviting_members) || (1 > inviting_members_len)) {
- if (NULL != error_code) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if (NULL != _error) {
- _error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- _error->msg = strdup("Invalid Argument");
- }
- *error_code = _error;
- }
-
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- _queue_add_task(request_id, (uint32_t) callback, handle, user_data);
-
- error.code = SERVICE_ADAPTOR_ERROR_NONE;
- error.msg = NULL;
- ret = _dbus_request_invite_chat(handle->service_name, request_id, chatroom_id, inviting_members, inviting_members_len, user_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if ((NULL != _error) && (NULL != error_code)) {
- _error->code = error.code;
- _error->msg = error.msg;
- *error_code = _error;
- } else {
- free(_error);
- free(error.msg);
- }
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Requests End Chat
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_request_end_chat(service_adaptor_h handle,
- long long int request_id,
- service_adaptor_end_chat_s **end_chats,
- unsigned int end_chats_len,
- service_adaptor_reply_end_chat_cb callback,
- service_adaptor_error_s **error_code,
- void *user_data)
-{
- sac_api_start_msg(request_id);
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == end_chats) || (1 > end_chats_len)) {
- if (NULL != error_code) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if (NULL != _error) {
- _error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- _error->msg = strdup("Invalid Argument");
- }
- *error_code = _error;
- }
-
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- _queue_add_task(request_id, (uint32_t) callback, handle, user_data);
-
- error.code = SERVICE_ADAPTOR_ERROR_NONE;
- error.msg = NULL;
- ret = _dbus_request_end_chat(handle->service_name, request_id, end_chats, end_chats_len, user_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if ((NULL != _error) && (NULL != error_code)) {
- _error->code = error.code;
- _error->msg = error.msg;
- *error_code = _error;
- } else {
- free(_error);
- free(error.msg);
- }
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Requests Unseal Message
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_request_unseal_message(service_adaptor_h handle,
- long long int request_id,
- long long int chatroom_id,
- long long int sender_id,
- long long int message_id,
- const char *message_detail,
- service_adaptor_reply_unseal_message_cb callback,
- service_adaptor_error_s **error_code,
- void *user_data)
-{
- sac_api_start_msg(request_id);
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == message_detail)) {
- if (NULL != error_code) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if (NULL != _error) {
- _error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- _error->msg = strdup("Invalid Argument");
- }
- *error_code = _error;
- }
-
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- _queue_add_task(request_id, (uint32_t) callback, handle, user_data);
-
- error.code = SERVICE_ADAPTOR_ERROR_NONE;
- error.msg = NULL;
- ret = _dbus_request_unseal_message(handle->service_name, request_id, chatroom_id,
- sender_id, message_id, message_detail, user_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if ((NULL != _error) && (NULL != error_code)) {
- _error->code = error.code;
- _error->msg = error.msg;
- *error_code = _error;
- } else {
- free(_error);
- free(error.msg);
- }
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Requests Save Call Log
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_request_save_call_log(service_adaptor_h handle,
- long long int request_id,
- long long int chatroom_id,
- const char *call_id,
- const char *call_log_type,
- long long int call_sender_id,
- long long int call_receiver_id,
- int conversaction_second,
- service_adaptor_reply_save_call_log_cb callback,
- service_adaptor_error_s **error_code,
- void *user_data)
-{
- sac_api_start_msg(request_id);
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
-
- if ((NULL == handle) || (NULL == handle->plugin)) {
- if (NULL != error_code) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if (NULL != _error) {
- _error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- _error->msg = strdup("Invalid Argument");
- }
- *error_code = _error;
- }
-
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- _queue_add_task(request_id, (uint32_t) callback, handle, user_data);
-
- error.code = SERVICE_ADAPTOR_ERROR_NONE;
- error.msg = NULL;
- ret = _dbus_request_save_call_log(handle->service_name, request_id, chatroom_id,
- call_id, call_log_type, call_sender_id, call_receiver_id,
- conversaction_second, user_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if ((NULL != _error) && (NULL != error_code)) {
- _error->code = error.code;
- _error->msg = error.msg;
- *error_code = _error;
- } else {
- free(_error);
- free(error.msg);
- }
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Requests Current Time
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_request_current_time(service_adaptor_h handle,
- long long int request_id,
- service_adaptor_reply_current_time_cb callback,
- service_adaptor_error_s **error_code,
- void *user_data)
-{
- sac_api_start_msg(request_id);
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
-
- if ((NULL == handle) || (NULL == handle->plugin)) {
- if (NULL != error_code) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if (NULL != _error) {
- _error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- _error->msg = strdup("Invalid Argument");
- }
- *error_code = _error;
- }
-
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- _queue_add_task(request_id, (uint32_t) callback, handle, user_data);
-
- error.code = SERVICE_ADAPTOR_ERROR_NONE;
- error.msg = NULL;
- ret = _dbus_request_current_time(handle->service_name, request_id, user_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if ((NULL != _error) && (NULL != error_code)) {
- _error->code = error.code;
- _error->msg = error.msg;
- *error_code = _error;
- } else {
- free(_error);
- free(error.msg);
- }
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_request_get_connection_policy(service_adaptor_h handle,
- service_adaptor_connection_policy_e *policy,
- service_adaptor_error_s **error_code)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == policy)) {
- if (NULL != error_code) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if (NULL != _error) {
- _error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- _error->msg = strdup("Invalid Argument");
- }
- *error_code = _error;
- }
-
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- error.code = SERVICE_ADAPTOR_ERROR_NONE;
- error.msg = NULL;
- ret = _dbus_request_get_connection_policy(handle->service_name, policy, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if ((NULL != _error) && (NULL != error_code)) {
- _error->code = error.code;
- _error->msg = error.msg;
- *error_code = _error;
- } else {
- free(_error);
- free(error.msg);
- }
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_request_set_connection_policy(service_adaptor_h handle,
- service_adaptor_connection_policy_e *policy,
- service_adaptor_error_s **error_code)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == policy)) {
- if (NULL != error_code) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if (NULL != _error) {
- _error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- _error->msg = strdup("Invalid Argument");
- }
- *error_code = _error;
- }
-
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- error.code = SERVICE_ADAPTOR_ERROR_NONE;
- error.msg = NULL;
- ret = _dbus_request_set_connection_policy(handle->service_name, policy, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if ((NULL != _error) && (NULL != error_code)) {
- _error->code = error.code;
- _error->msg = error.msg;
- *error_code = _error;
- } else {
- free(_error);
- free(error.msg);
- }
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-
-
-/** @brief Requests chat id based on phone number
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_get_chat_id_list(service_adaptor_h handle,
- service_adaptor_phone_number_s **phone_numbers,
- unsigned int phone_numbers_len,
- void *user_data,
- service_adaptor_chat_id_s ***chat_ids,
- unsigned int *chat_ids_len,
- service_adaptor_error_s **error_code,
- void **server_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == phone_numbers) || (1 > phone_numbers_len) || (NULL == chat_ids) || (NULL == chat_ids_len)) {
- if (NULL != error_code) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if (NULL != _error) {
- _error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- _error->msg = strdup("Invalid Argument");
- }
- *error_code = _error;
- }
-
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- if (service_adaptor_check_handle_validate(handle)) {
- service_adaptor_set_last_result(SERVICE_ADAPTOR_ERROR_INVALID_STATE, "Invalid handle (Please success set_auth first)");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- error.code = SERVICE_ADAPTOR_ERROR_NONE;
- error.msg = NULL;
- ret = _dbus_get_chat_id_list(handle->service_name, phone_numbers, phone_numbers_len, user_data, chat_ids, chat_ids_len, server_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if ((NULL != _error) && (NULL != error_code)) {
- _error->code = error.code;
- _error->msg = error.msg;
- *error_code = _error;
- } else {
- free(_error);
- free(error.msg);
- }
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Requests MSISDN based on User ID
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_get_msisdn_list(service_adaptor_h handle,
- long long int *chat_ids,
- unsigned int chat_ids_len,
- void *user_data,
- service_adaptor_chat_id_s ***msisdns,
- unsigned int *msisdns_len,
- service_adaptor_error_s **error_code,
- void **server_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == chat_ids) || (1 > chat_ids_len) || (NULL == msisdns) || (msisdns_len == NULL)) {
- if (NULL != error_code) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if (NULL != _error) {
- _error->code = SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- _error->msg = strdup("Invalid Argument");
- }
- *error_code = _error;
- }
-
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- error.code = SERVICE_ADAPTOR_ERROR_NONE;
- error.msg = NULL;
- ret = _dbus_get_msisdn_list(handle->service_name, chat_ids, chat_ids_len, user_data, msisdns, msisdns_len, server_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- service_adaptor_error_s *_error = (service_adaptor_error_s *) calloc(1, sizeof(service_adaptor_error_s));
- if ((NULL != _error) && (NULL != error_code)) {
- _error->code = error.code;
- _error->msg = error.msg;
- *error_code = _error;
- } else {
- free(_error);
- free(error.msg);
- }
- }
-
- sac_api_end(ret);
- return ret;
-}
+++ /dev/null
-/*
-* Copyright (c) 2011 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.
-*/
-
-/******************************************************************************
- * File: service-adaptor-client-push.c
- * Desc:
- * Created on: Oct, 2014
- * Auth: Yongjin Kim <youth.kim@samsung.com>
- *
- *****************************************************************************/
-
-#include <stdio.h>
-#include <glib.h>
-#include <stdint.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "private/service-adaptor-client-push.h"
-#include "service_adaptor_client_type.h"
-#include "service_adaptor_client_private.h"
-#include "service_adaptor_client_log.h"
-#include "dbus/dbus_client_push.h"
-
-#include "util/service_adaptor_client_util.h"
-/** @brief Registers a callback function to receive push notification from push service
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_connect_push_service(service_adaptor_h handle,
- service_adaptor_push_notification_cb callback,
- service_adaptor_error_s **error_code,
- void *user_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
-
- if ((NULL == handle) || (NULL == callback)) {
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invalid Parameter");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- sac_debug("Connect push service : service_id(%d)", handle->service_id);
-
- _signal_queue_add_task(handle->service_id, (uint32_t) callback, handle, user_data);
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Deregisters the callback function that had been registered to push service
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_disconnect_push_service(service_adaptor_h handle)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
-
- if (NULL == handle) {
- service_adaptor_set_last_result(SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invlid parameters");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- service_adaptor_task_h task = _signal_queue_get_task(handle->service_id);
-
- if (NULL == task) {
- return SERVICE_ADAPTOR_ERROR_NONE;
- }
-
- sac_debug("Disconnect push service : service_id(%d)", handle->service_id);
-
- _signal_queue_del_task(task);
-
- sac_api_end(ret);
- return ret;
-}
-
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_register_push_service(service_adaptor_h handle,
- const char *service_file_name)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
- error.msg = NULL;
-
- if ((NULL == handle) || (NULL == service_file_name)) {
- service_adaptor_set_last_result(SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invlid parameters");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- ret = _dbus_push_register(service_file_name, &error);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != ret) {
- sac_error("Error occured (%lld)(%s)", error.code, error.msg);
- service_adaptor_set_last_result(error.code, error.msg);
- free(error.msg);
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_deregister_push_service(service_adaptor_h handle,
- const char *service_file_name)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
- error.msg = NULL;
-
- if ((NULL == handle) || (NULL == service_file_name)) {
- service_adaptor_set_last_result(SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invlid parameters");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- ret = _dbus_push_deregister(service_file_name, &error);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != ret) {
- sac_error("Error occured (%lld)(%s)", error.code, error.msg);
- service_adaptor_set_last_result(error.code, error.msg);
- free(error.msg);
- }
-
- sac_api_end(ret);
- return ret;
-}
+++ /dev/null
-/*
-* Copyright (c) 2011 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.
-*/
-
-/******************************************************************************
- * File: service-adaptor-client-shop.c
- * Desc:
- * Created on: Oct, 2014
- * Auth: Yongjin Kim <youth.kim@samsung.com>
- *
- *****************************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "private/service-adaptor-client-shop.h"
-#include "service_adaptor_client_type.h"
-#include "service_adaptor_client_log.h"
-#include "dbus_client.h"
-#include "dbus_client_shop.h"
-
-#include "util/service_adaptor_client_util.h"
-/** @brief Requests List of Item
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_get_item_list(service_adaptor_h handle,
- service_adaptor_shop_info_s *info,
- void *user_data,
- service_adaptor_shop_item_s ***items,
- unsigned int *items_len,
- service_adaptor_error_s **error_code,
- void **server_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
- error.msg = NULL;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == info) || (NULL == items)) {
- sac_error("Invalid Parameter");
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invalid Parameter");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- if (NULL == handle->service_name) {
- sac_error("The service_name is NULL");
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_STATE, "Invalid handle state");
- return SERVICE_ADAPTOR_ERROR_INVALID_STATE;
- }
-
- ret = _dbus_get_item_list(handle->service_name, info, user_data, items, items_len, server_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- _assign_error_code(&error, error_code);
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Requests Item Information for Download
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_download_item_package(service_adaptor_h handle,
- service_adaptor_shop_info_s *info,
- void *user_data,
- service_adaptor_shop_item_s **item,
- service_adaptor_error_s **error_code,
- void **server_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
- error.msg = NULL;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == info) || (NULL == item)) {
- sac_error("Invalid Parameter");
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invalid Parameter");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- if (NULL == handle->service_name) {
- sac_error("The service_name is NULL");
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_STATE, "Invalid handle state");
- return SERVICE_ADAPTOR_ERROR_INVALID_STATE;
- }
-
- ret = _dbus_download_item_package(handle->service_name, info, user_data, item, server_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- _assign_error_code(&error, error_code);
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Requests Download of Item
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_download_sticker(service_adaptor_h handle,
- service_adaptor_shop_info_s *info,
- void *user_data,
- service_adaptor_shop_item_s **item,
- service_adaptor_error_s **error_code,
- void **server_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
- error.msg = NULL;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == info) || (NULL == item)) {
- sac_error("Invalid Parameter");
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invalid Parameter");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- if (NULL == handle->service_name) {
- sac_error("The service_name is NULL");
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_STATE, "Invalid handle state");
- return SERVICE_ADAPTOR_ERROR_INVALID_STATE;
- }
-
- ret = _dbus_download_sticker(handle->service_name, info, user_data, item, server_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- _assign_error_code(&error, error_code);
- }
-
- sac_api_end(ret);
- return ret;
-}
-
-/** @brief Requests Item Panel URL
- * @return int
- * @remarks :
- */
-SERVICE_ADAPTOR_CLIENT_PUBLIC_API
-int service_adaptor_get_panel_url(service_adaptor_h handle,
- service_adaptor_shop_info_s *info,
- void *user_data,
- service_adaptor_shop_item_s **item,
- service_adaptor_error_s **error_code,
- void **server_data)
-{
- sac_api_start();
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
- service_adaptor_error_s error;
- error.msg = NULL;
-
- if ((NULL == handle) || (NULL == handle->plugin) || (NULL == info) || (NULL == item)) {
- sac_error("Invalid Parameter");
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER, "Invalid Parameter");
- return SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER;
- }
-
- if (NULL == handle->service_name) {
- sac_error("The service_name is NULL");
- _set_error_code(error_code, SERVICE_ADAPTOR_ERROR_INVALID_STATE, "Invalid handle state");
- return SERVICE_ADAPTOR_ERROR_INVALID_STATE;
- }
-
- ret = _dbus_get_panel_url(handle->service_name, info, user_data, item, server_data, &error);
-
- if (ret != SERVICE_ADAPTOR_ERROR_NONE) {
- _assign_error_code(&error, error_code);
- }
-
- sac_api_end(ret);
- return ret;
-}
-
+++ /dev/null
-/*
- * Auth Plugin Client
- *
- * Copyright (c) 2014 - 2015 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 <stdio.h>
-#include <string.h>
-#include <glib.h>
-
-#include "sal_provider_base.h"
-
-static void __session_start_cb(ipc_provider_session_h session, const char *client_uri);
-
-static void __session_stop_cb(ipc_provider_session_h session, const char *session_uri);
-
-static ipc_provider_base_req_s __base_req_handler = {
- __session_start_cb,
- __session_stop_cb,
- };
-
-ipc_provider_base_req_s *sal_provider_base_init(void)
-{
- return &__base_req_handler;
-}
-
-static void __session_start_cb(ipc_provider_session_h session, const char *client_uri)
-{
-}
-
-static void __session_stop_cb(ipc_provider_session_h session, const char *session_uri)
-{
-}
-
-/*
-#include "service_adaptor_errors.h"
-#include "service_adaptor_internal.h"
-#include "sal_service_provider.h"
-#include "sal_auth_provider.h"
-
-API int auth_provider_create(auth_provider_h *provider)
-{
- SAL_FN_CALL;
-
- auth_provider_h auth_provider = (auth_provider_h) g_malloc0(sizeof(auth_provider_s));
-
- auth_provider->oauth1_get_access_token = NULL;
- auth_provider->oauth1_get_extra_data = NULL;
-
- auth_provider->oauth2_get_access_token = NULL;
- auth_provider->oauth2_get_extra_data = NULL;
-
- *provider = auth_provider;
-
- return SERVICE_ADAPTOR_ERROR_NONE;
-}
-
-API app_control_h auth_provider_message(auth_provider_h provider, const char *operation, void *user_data)
-{
- SAL_FN_CALL;
-
- app_control_h reply = NULL;
-
- RETV_IF(NULL == provider, reply);
-
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
-
- if (0 == strcmp(operation, OAUTH1_0_GET_ACCESS_TOKEN_URI)) {
- app_control_create(&reply);
-
- char *access_token = NULL;
- ret = provider->oauth1_get_access_token(&access_token);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != ret) {
- SAL_ERR("oauth1_get_access_token() Fail (%d)", ret);
- app_control_add_extra_data(reply, PLUGIN_RESULT_KEY, PLUGIN_RESULT_VALUE_FAILURE);
- return reply;
- }
-
- app_control_add_extra_data(reply, PLUGIN_RESULT_KEY, PLUGIN_RESULT_VALUE_SUCCESS);
- app_control_add_extra_data(reply, OAUTH1_0_ACCESS_TOKEN_KEY, access_token);
- }
-
- return reply;
-}
-
-API int auth_provider_add_extra_data(auth_provider_h provider, app_control_h reply)
-{
- SAL_FN_CALL;
-
- RETV_IF(NULL == provider, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == reply, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
-
- app_control_add_extra_data(reply, PLUGIN_KEY_AUTH, PLUGIN_VALUE_TRUE);
-
- if (NULL != provider->oauth1_get_access_token) {
- app_control_add_extra_data(reply, OAUTH1_0_GET_ACCESS_TOKEN_URI, PLUGIN_VALUE_TRUE);
- }
-
- if (NULL != provider->oauth1_get_extra_data) {
- app_control_add_extra_data(reply, OAUTH1_0_GET_EXTRA_DATA_URI, PLUGIN_VALUE_TRUE);
- }
-
- if (NULL != provider->oauth2_get_access_token) {
- app_control_add_extra_data(reply, OAUTH2_0_GET_ACCESS_TOKEN_URI, PLUGIN_VALUE_TRUE);
- }
-
- if (NULL != provider->oauth2_get_extra_data) {
- app_control_add_extra_data(reply, OAUTH2_0_GET_EXTRA_DATA_URI, PLUGIN_VALUE_TRUE);
- }
-
- return SERVICE_ADAPTOR_ERROR_NONE;
-}
-*/
+++ /dev/null
-/*
- * Auth Plugin Client
- *
- * Copyright (c) 2014 - 2015 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 __SAL_PROVIDER_BASE_H__
-#define __SAL_PROVIDER_BASE_H__
-
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#include "sal_ipc_provider_base.h"
-
-ipc_provider_base_req_s *sal_provider_base_init(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __SAL_PROVIDER_BASE_H__ */
+++ /dev/null
-/*
- * Service Provider internal
- *
- * Copyright (c) 2014 - 2015 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 __SAL_PROVIDER_INTERNAL_H__
-#define __SAL_PROVIDER_INTERNAL_H__
-
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __SAL_PROVIDER_INTERNAL_H__ */
+++ /dev/null
-/*
- * Service Plugin Client
- *
- * Copyright (c) 2014 - 2015 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 <stdio.h>
-#include <string.h>
-#include <glib.h>
-
-#include "sal_log.h"
-#include "sal_ipc.h"
-#include "sal_types.h"
-#include "sal_ipc_provider.h"
-
-#include <app_control.h>
-#include <service_app.h>
-
-#include "service_adaptor_type.h"
-#include "service_provider.h"
-
-#define ERROR_MESSAGE_MAX_LENGTH 2048
-
-static __thread int last_error_code = 0;
-
-static __thread char last_error_message[ERROR_MESSAGE_MAX_LENGTH] = {0, };
-
-
-USER_DATA_TYPEDEF(_ipc_state_data_t, 2);
-
-static void __ipc_connection_callback(ipc_provider_connection_state_e state, void *user_data)
-{
- SAL_FN_CALL;
-
- USER_DATA_DEFINE(_ipc_state_data_t, _callback_data) = (USER_DATA_TYPE(_ipc_state_data_t)*)user_data;
- service_provider_channel_cb callback = (service_provider_channel_cb)USER_DATA_ELEMENT(_callback_data, 0);
- void *_user_data = (void *)USER_DATA_ELEMENT(_callback_data, 1);
-
- int ret = SERVICE_PROVIDER_RECOMMENDED_DEFAULT;
- if (IPC_PROVIDER_CONNECTION_OPENED == state) {
- ret = callback(SERVICE_PROVIDER_CHANNEL_OPENED, _user_data);
- if (SERVICE_PROVIDER_APPLICATION_SHUTDOWN == ret) {
- SAL_INFO("Application termication");
- /* TODO release internal memory */
- USER_DATA_DESTROY(_callback_data);
- service_app_exit();
- } else { /* default (alive) */
-
- }
- } else {
- ret = callback(SERVICE_PROVIDER_CHANNEL_CLOSED, _user_data);
- /* TODO release internal memory */
- if (SERVICE_PROVIDER_APPLICATION_CONTINUE == ret) {
-
- } else { /* default (shutdown) */
- SAL_INFO("Application termication");
- USER_DATA_DESTROY(_callback_data);
- service_app_exit();
- }
- }
-
- SAL_FN_END;
-}
-
-API int service_provider_set_storage_provider(storage_provider_s *storage_provider, void *user_data)
-{
- SAL_FN_CALL;
-
- RETV_IF(NULL == storage_provider, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == storage_provider->open, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == storage_provider->read, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == storage_provider->write, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == storage_provider->fsync, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == storage_provider->close, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == storage_provider->remove, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == storage_provider->rename, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == storage_provider->mkdir, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == storage_provider->chmod, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == storage_provider->access, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == storage_provider->stat, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == storage_provider->opendir, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == storage_provider->readdir, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == storage_provider->closedir, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
-
- return SERVICE_ADAPTOR_ERROR_NONE;
-}
-
-API int service_provider_open_channel(app_control_h app_control,
- service_provider_channel_cb callback,
- void *user_data)
-{
- SAL_FN_CALL;
-
- RETV_IF(NULL == app_control, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == callback, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
-
- int ret = 0;
- char *_operation = NULL;
- ret = app_control_get_operation(app_control, &_operation);
-
- RETVM_IF(APP_CONTROL_ERROR_OUT_OF_MEMORY == ret, SERVICE_ADAPTOR_ERROR_OUT_OF_MEMORY, "Out of Memory");
- RETVM_IF(NULL == _operation, SERVICE_ADAPTOR_ERROR_NO_DATA, "No operation data");
-
- if (0 != g_strcmp0(APP_CONTROL_OPERATION_SERVICE_PROVIDER_CHANNEL, _operation)) {
- SAL_ERR("operation ID is not matched");
- free(_operation);
- return SERVICE_ADAPTOR_ERROR_NO_DATA;
- }
-
- USER_DATA_DEFINE(_ipc_state_data_t, _callback_data) = NULL;
-
- USER_DATA_VAL(_callback_data) = USER_DATA_CREATE(_ipc_state_data_t);
-
- if (NULL == USER_DATA_VAL(_callback_data)) {
- SAL_ERR("Out of memory");
- free(_operation);
- return SERVICE_ADAPTOR_ERROR_OUT_OF_MEMORY;
- }
-
- USER_DATA_ELEMENT(_callback_data, 0) = (user_data_t)callback;
- USER_DATA_ELEMENT(_callback_data, 1) = (user_data_t)user_data;
-
- ipc_provider_base_req_s *base_req = sal_provider_base_init();
- ipc_provider_storage_req_s *storage_req = sal_provider_storage_init();
-
- ret = sal_ipc_provider_init(base_req,
- storage_req,
- __ipc_connection_callback,
- USER_DATA_VAL(_callback_data));
-
- free(_operation);
-
- return sal_provider_return_ipc_ret(ret);
-}
-
-API int service_provider_set_last_error(int code, const char *message)
-{
- SAL_FN_CALL;
- SAL_ERR("<thread-safe> set last error : [%d][%s]", code, message);
-
- last_error_code = code;
- if (message)
- snprintf(last_error_message, ERROR_MESSAGE_MAX_LENGTH, "%s", message);
- else
- last_error_message[0] = '\0';
-
- return SERVICE_ADAPTOR_ERROR_NONE;
-}
-
-API int service_provider_set_session_event_cb(service_provider_session_event_cb callback, void *user_data)
-{
- SAL_FN_CALL;
- return SERVICE_ADAPTOR_ERROR_NONE;
-}
-API int service_provider_unset_session_event_cb(void)
-{
- SAL_FN_CALL;
- return SERVICE_ADAPTOR_ERROR_NONE;
-}
-API int service_provider_get_session_property(service_provider_session_h session, const char *key, char **value)
-{
- SAL_FN_CALL;
- return SERVICE_ADAPTOR_ERROR_NONE;
-}
-API int service_provider_foreach_session_property(service_provider_session_h session, service_provider_session_property_cb callback, void *user_data)
-{
- SAL_FN_CALL;
- return SERVICE_ADAPTOR_ERROR_NONE;
-}
-API int service_provider_get_session_service_mask(service_provider_session_h session, int *service_mask)
-{
- SAL_FN_CALL;
- return SERVICE_ADAPTOR_ERROR_NONE;
-}
-
+++ /dev/null
-/*
- * Service Plugin Client
- *
- * Copyright (c) 2014 - 2015 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 __SERVICE_PLUGIN_CLIENT_H__
-#define __SERVICE_PLUGIN_CLIENT_H__
-
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#include "sal_provider_base.h"
-#include "sal_provider_storage.h"
-
-/**
- * @brief Describes infromation about Plugin Handle
- */
-typedef struct _service_provider_s {
- service_adaptor_error_e(*connect)(void);
- service_adaptor_error_e(*disconnect)(void);
-
- auth_provider_h auth_provider;
- storage_provider_h storage_provider;
-
- char *uri;
- char *name;
-} service_provider_s;
-typedef struct _service_provider_s *service_provider_h;
-
-/*
-int service_provider_create(service_provider_h *provider);
-int service_provider_destroy(service_provider_h provider);
-int service_provider_set_auth_provider(service_provider_h provider, auth_provider_h auth_provider);
-int service_provider_unset_auth_provider(service_provider_h provider);
-int service_provider_set_storage_provider(service_provider_h provider, storage_provider_h storage_provider);
-int service_provider_unset_storage_provider(service_provider_h provider);
-int service_provider_message(service_provider_h provider, app_control_h app_control, void *user_data);
-*/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __SERVICE_PLUGIN_CLIENT_H__ */
+++ /dev/null
-/*
- * Storage Plugin Client
- *
- * Copyright (c) 2014 - 2015 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 <stdio.h>
-#include <string.h>
-#include <glib.h>
-
-#include "sal_provider_storage.h"
-
-static void __download_cb(ipc_provider_session_h session, const char *session_uri,
- const char *local_path, const char *cloud_path);
-
-static ipc_provider_storage_req_s __storage_req_handler = {
- __download_cb,
- };
-
-ipc_provider_storage_req_s *sal_provider_storage_init(void)
-
-{
- return &__storage_req_handler;
-}
-
-static void __download_cb(ipc_provider_session_h session, const char *session_uri,
- const char *local_path, const char *cloud_path)
-{
-}
-
-
-/*
-#include <app.h>
-
-#include "service_adaptor_errors.h"
-#include "service_adaptor_internal.h"
-#include "cloud_service.h"
-#include "sal_service_provider.h"
-#include "sal_storage_provider.h"
-
-API int storage_provider_create(storage_provider_h *provider)
-{
- SAL_FN_CALL;
-
- storage_provider_h storage_provider = (storage_provider_h) g_malloc0(sizeof(storage_provider_s));
-
- storage_provider->cloud_remove_file = NULL;
-
- *provider = storage_provider;
-
- return SERVICE_ADAPTOR_ERROR_NONE;
-}
-
-API app_control_h storage_provider_message(storage_provider_h provider, const char *operation, void *user_data)
-{
- SAL_FN_CALL;
-
- app_control_h reply = NULL;
-
- RETV_IF(NULL == provider, reply);
-
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
-
- if (0 == strcmp(operation, CLOUD_REMOVE_FILE_URI)) {
- app_control_create(&reply);
-
- char *cloud_path = NULL;
- app_control_get_extra_data((app_control_h) user_data, CLOUD_CLOUD_PATH_KEY, &cloud_path);
-
- ret = provider->cloud_remove_file(cloud_path);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != ret) {
- SAL_ERR("cloud_remove_file() Fail (%d)", ret);
- app_control_add_extra_data(reply, PLUGIN_RESULT_KEY, PLUGIN_RESULT_VALUE_FAILURE);
- return reply;
- }
-
- app_control_add_extra_data(reply, PLUGIN_RESULT_KEY, PLUGIN_RESULT_VALUE_SUCCESS);
- }
-
- return reply;
-}
-
-API int storage_provider_add_extra_data(storage_provider_h provider, app_control_h reply)
-{
- SAL_FN_CALL;
-
- RETV_IF(NULL == provider, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == reply, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
-
- app_control_add_extra_data(reply, PLUGIN_KEY_STORAGE, PLUGIN_VALUE_TRUE);
-
- if (NULL != provider->cloud_remove_file) {
- app_control_add_extra_data(reply, CLOUD_REMOVE_FILE_URI, PLUGIN_VALUE_TRUE);
- }
-
- return SERVICE_ADAPTOR_ERROR_NONE;
-}
-
-
-
-API int storage_provider_stat_set_path (storage_provider_stat_h stat, const char *path);
-API int storage_provider_stat_set_size (storage_provider_stat_h stat, unsigned long long size);
-API int storage_provider_stat_set_dir (storage_provider_stat_h stat, bool is_dir);
-API int storage_provider_stat_set_mode (storage_provider_stat_h stat, int mode);
-API int storage_provider_stat_set_atime (storage_provider_stat_h stat, unsigned long long timestamp);
-API int storage_provider_stat_set_mtime (storage_provider_stat_h stat, unsigned long long timestamp);
-API int storage_provider_stat_set_ctime (storage_provider_stat_h stat, unsigned long long timestamp);
-*/
+++ /dev/null
-/*
- * Storage Plugin Client
- *
- * Copyright (c) 2014 - 2015 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 __STORAGE_PLUGIN_CLIENT_H__
-#define __STORAGE_PLUGIN_CLIENT_H__
-
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#include "sal_ipc_provider_storage.h"
-
-ipc_provider_storage_req_s *sal_provider_storage_init(void);
-
-/*
-#include <app.h>
-
-#include "service_adaptor_errors.h"
-
-#define CLOUD_LOCAL_PATH_KEY "local_path"
-#define CLOUD_CLOUD_PATH_KEY "cloud_path"
-*/
-/**
- * @brief Describes infromation about Cloud Service
- * @key name, ...
- */
-/*
-#define CLOUD_REMOVE_FILE_URI "http://tizen.org/service-adaptor/storage/cloud/remove_file"
-#define CLOUD_DOWNLOAD_FILE_URI "http://tizen.org/service-adaptor/storage/cloud/download_file"
-#define CLOUD_UPLOAD_FILE_URI "http://tizen.org/service-adaptor/storage/cloud/upload_file"
-#define CLOUD_DOWNLOAD_FILE_THUMBNAIL_URI "http://tizen.org/service-adaptor/storage/cloud/download_file_thumbnail"
-#define CLOUD_GET_FILE_LIST_URI "http://tizen.org/service-adaptor/storage/cloud/get_file_list"
-*/
-/**
- * @brief Describes infromation about Storage Plugin Handle
- */
-/*
-typedef struct _storage_provider_s
-{
- // Cloud
- service_adaptor_error_e (*cloud_remove_file)(const char *cloud_path);
- service_adaptor_error_e (*cloud_download_file)(const char *cloud_path, const char *local_path);
- service_adaptor_error_e (*cloud_upload_file)(const char *local_path, const char *cloud_path);
- service_adaptor_error_e (*cloud_download_file_thumbnail)(const char *cloud_path, const char *local_path);
-
- // Posix
-} storage_provider_s;
-typedef struct _storage_provider_s *storage_provider_h;
-
-int storage_provider_create(storage_provider_h *provider);
-app_control_h storage_provider_message(storage_provider_h provider, const char *operation, void *user_data);
-int storage_provider_add_extra_data(storage_provider_h provider, app_control_h reply);
-*/
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __STORAGE_PLUGIN_CLIENT_H__ */
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(sal-test)
-
-SET(CMAKE_SKIP_BUILD_RPATH TRUE)
-
-IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
- SET(CMAKE_BUILD_TYPE "Debug")
-ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
-
-MESSAGE("")
-MESSAGE(">>> current directory: ${CMAKE_CURRENT_SOURCE_DIR}")
-MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}")
-
-ADD_DEFINITIONS("-DSERVICE_ADAPTOR_DEBUGGING")
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--gc-sections")
-
-SET(TEST-EXE "sal-test")
-SET(TEST-SRCS
- ${CMAKE_SOURCE_DIR}/test/test.c
-)
-
-INCLUDE_DIRECTORIES(
- ${CMAKE_SOURCE_DIR}/include
- ${CMAKE_SOURCE_DIR}/client
-)
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(test_pkgs REQUIRED dlog glib-2.0 capi-appfw-application libtzplatform-config)
-
-FOREACH(flag ${test_pkgs_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-#message(">>>[${TEST-EXE}] extra_cflags ${EXTRA_CFLAGS}")
-#message(">>>[${TEST-EXE}] test_pkgs_cflags ${test_pkgs_CFLAGS}")
-#message(">>>[${TEST-EXE}] result ${CMAKE_C_FLAGS}")
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
-
-ADD_EXECUTABLE(${TEST-EXE} ${TEST-SRCS})
-TARGET_LINK_LIBRARIES(${TEST-EXE} ${test_pkgs_LDFLAGS} service-adaptor-client)
-INSTALL(TARGETS ${TEST-EXE} DESTINATION bin)
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <glib-object.h>
-#include <glib-unix.h>
-#include <tzplatform-config.h>
-
-#include "service_adaptor_client.h"
-
-service_plugin_h service_plugin = NULL;
-
-void _service_auth_oauth1_cb(int result, service_auth_oauth1_h oauth1, void *user_data)
-{
- char *access_token = NULL;
- service_auth_oauth1_get_access_token(oauth1, &access_token);
-
- printf("access_token = %s (%s)\n", access_token, (char *) user_data);
-}
-
-bool _service_storage_cloud_file_cb(int result, service_storage_cloud_file_h file, void *user_data)
-{
- char *cloud_path = NULL;
- service_storage_cloud_file_get_cloud_path(file, &cloud_path);
-
- printf("cloud_path = %s (%s)\n", cloud_path, (char *) user_data);
-
- return true;
-}
-
-void _service_plugin_login_callback(int result, void *user_data)
-{
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
-
- ret = service_plugin_start_all(service_plugin);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != ret) {
- printf("service_plugin_start Failed(%d)\n", ret);
- return;
- }
-
- /* operation */
- service_auth_oauth1_h oauth1 = NULL;
- ret = service_auth_oauth1_create(service_plugin, &oauth1);
- ret = service_auth_oauth1_set_callback(oauth1, _service_auth_oauth1_cb, NULL);
- ret = service_auth_oauth1_set_operation(oauth1, SERVICE_AUTH_OAUTH1_0_GET_ACCESS_TOKEN_URI);
-
- service_task_h auth_task = NULL;
- ret = service_auth_oauth1_create_task(oauth1, &auth_task);
- ret = service_task_start(auth_task);
- if (SERVICE_ADAPTOR_ERROR_NONE == ret) {
- printf("service_auth_oauth1_get_access_token() Request Successed\n");
- }
-
- char *cloud_path = tzplatform_mkstr(TZ_SYS_ROOT, "/cloud");
- service_storage_cloud_file_h file = NULL;
- ret = service_storage_cloud_file_create(service_plugin, &file);
- ret = service_storage_cloud_file_set_callback(file, _service_storage_cloud_file_cb, NULL);
- ret = service_storage_cloud_file_set_cloud_path(file, cloud_path);
- ret = service_storage_cloud_file_set_operation(file, SERVICE_STORAGE_CLOUD_REMOVE_FILE_URI);
-
- service_task_h task = NULL;
- ret = service_storage_cloud_file_create_task(file, &task);
- ret = service_task_start(task);
- if (SERVICE_ADAPTOR_ERROR_NONE == ret) {
- printf("service_storage_cloud_remove_file() Request Successed: %s\n", cloud_path);
- }
-}
-
-bool _service_adaptor_plugin_callback(const char *uri, int service_mask, void *user_data)
-{
- if (0 != strcmp(uri, "org.tizen.service-plugin-sample")) {
- return true;
- }
-
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
-
- ret = service_plugin_create(uri, &service_plugin);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != ret) {
- printf("service_plugin_create(%s) Failed(%d)\n", uri, ret);
- return true;
- }
-
- ret = service_plugin_login(service_plugin, _service_plugin_login_callback, NULL);
-
- if (SERVICE_ADAPTOR_ERROR_NONE != ret) {
- printf("service_plugin_login(%s) Failed(%d)\n", uri, ret);
- return true;
- }
-
- return true;
-}
-
-static gint _sigterm_callback(void *data)
-{
- g_main_loop_quit((GMainLoop*)data);
-
- return 0;
-}
-
-int main()
-{
- GMainLoop *loop = NULL;
-
-#if !GLIB_CHECK_VERSION(2, 32, 0)
- g_thread_init(NULL);
-#endif
-#if !GLIB_CHECK_VERSION(2, 35, 0)
- g_type_init();
-#endif
-
- /* init */
- int ret = SERVICE_ADAPTOR_ERROR_NONE;
-
- ret = service_adaptor_connect();
- ret = service_adaptor_foreach_service_plugin(_service_adaptor_plugin_callback, NULL);
-
- loop = g_main_loop_new(NULL, FALSE);
-
- g_unix_signal_add_full(G_PRIORITY_HIGH, SIGINT,
- _sigterm_callback, loop, NULL);
- g_unix_signal_add_full(G_PRIORITY_HIGH, SIGTERM,
- _sigterm_callback, loop, NULL);
-
- g_main_loop_run(loop);
-
- g_main_loop_unref(loop);
-
- /* deinit */
- ret = service_plugin_stop(service_plugin);
- ret = service_plugin_destroy(service_plugin);
- ret = service_adaptor_disconnect();
-
- return ret;
-}