diff options
Diffstat (limited to 'src/mcd-account-compat.c')
-rw-r--r-- | src/mcd-account-compat.c | 121 |
1 files changed, 0 insertions, 121 deletions
diff --git a/src/mcd-account-compat.c b/src/mcd-account-compat.c index dba47339..7f3cb706 100644 --- a/src/mcd-account-compat.c +++ b/src/mcd-account-compat.c @@ -202,127 +202,6 @@ account_compat_iface_init (McSvcAccountInterfaceCompatClass *iface, #undef IMPLEMENT } -static void -process_channel_request (McdAccount *account, gpointer userdata, - const GError *error) -{ - McdChannel *channel = MCD_CHANNEL (userdata); - McdConnection *connection; - - if (error) - { - g_warning ("%s: got error: %s", G_STRFUNC, error->message); - /* TODO: report the error to the requestor process */ - g_object_unref (channel); - return; - } - DEBUG ("called"); - connection = mcd_account_get_connection (account); - g_return_if_fail (connection != NULL); - g_return_if_fail (mcd_connection_get_connection_status (connection) - == TP_CONNECTION_STATUS_CONNECTED); - - mcd_connection_request_channel (connection, channel); -} - -static void -on_channel_status_changed (McdChannel *channel, McdChannelStatus status, - McdAccount *account) -{ - McdAccountCompatReq *req_data; - - DEBUG ("%u", status); - g_return_if_fail (MCD_IS_ACCOUNT (account)); - - if (status == MCD_CHANNEL_STATUS_FAILED && - (req_data = g_object_get_data ((GObject *)channel, COMPAT_REQ_DATA)) - != NULL) - { - const GError *error; - McdMaster *master; - - master = mcd_master_get_default (); - g_return_if_fail (MCD_IS_SERVICE (master)); - - error = mcd_channel_get_error (channel); - g_signal_emit_by_name (master, "mcd-error", - req_data->requestor_serial, - req_data->requestor_client_id, error->code); - } - else if (status == MCD_CHANNEL_STATUS_DISPATCHED) - { - /* we don't need the request data anymore */ - g_object_set_data ((GObject *)channel, COMPAT_REQ_DATA, NULL); - } -} - -static void -compat_req_data_free (McdAccountCompatReq *req) -{ - g_free (req->requestor_client_id); - g_slice_free (McdAccountCompatReq, req); -} - -gboolean -_mcd_account_compat_request_channel_nmc4 (McdAccount *account, - const struct mcd_channel_request *req, - GError **error) -{ - McdChannel *channel; - McdAccountCompatReq *req_data; - GHashTable *properties; - GValue *value; - McdDispatcher *dispatcher; - - properties = g_hash_table_new_full (g_str_hash, g_str_equal, - NULL, - (GDestroyNotify)tp_g_value_slice_free); - - value = tp_g_value_slice_new (G_TYPE_STRING); - g_value_set_string (value, req->channel_type); - g_hash_table_insert (properties, TP_IFACE_CHANNEL ".ChannelType", value); - - if (req->channel_handle_string) - { - value = tp_g_value_slice_new (G_TYPE_STRING); - g_value_set_string (value, req->channel_handle_string); - g_hash_table_insert (properties, TP_IFACE_CHANNEL ".TargetID", value); - } - - if (req->channel_handle) - { - value = tp_g_value_slice_new (G_TYPE_UINT); - g_value_set_uint (value, req->channel_handle); - g_hash_table_insert (properties, TP_IFACE_CHANNEL ".TargetHandle", - value); - } - - value = tp_g_value_slice_new (G_TYPE_UINT); - g_value_set_uint (value, req->channel_handle_type); - g_hash_table_insert (properties, TP_IFACE_CHANNEL ".TargetHandleType", - value); - - channel = mcd_channel_new_request (properties, 0, NULL); - g_hash_table_unref (properties); - - dispatcher = mcd_master_get_dispatcher (mcd_master_get_default ()); - _mcd_dispatcher_add_request (dispatcher, account, channel); - - req_data = g_slice_new0 (McdAccountCompatReq); - req_data->requestor_serial = req->requestor_serial; - req_data->requestor_client_id = g_strdup (req->requestor_client_id); - g_object_set_data_full ((GObject *)channel, COMPAT_REQ_DATA, - req_data, (GDestroyNotify)compat_req_data_free); - - g_signal_connect (channel, "status-changed", - G_CALLBACK (on_channel_status_changed), account); - - return _mcd_account_online_request (account, - process_channel_request, - channel, - error); -} - /** * mcd_account_compat_get_profile: * @account: the #McdAccount. |