summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2014-01-28 16:51:14 +0100
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2014-01-29 14:34:09 +0100
commit64a23de2293f6cdcc5e5dd494471100e7e5964e8 (patch)
treef6735ae508e06da22d28e5b45b5d129dc25dd91f
parentc5264ae5d06f57b271c342a9beef792aee2a9d66 (diff)
new TpChannelManager APItelepathy-salut-0.99.7
-rw-r--r--src/ft-manager.c15
-rw-r--r--src/im-manager.c51
-rw-r--r--src/muc-manager.c86
-rw-r--r--src/roomlist-manager.c37
-rw-r--r--src/tubes-manager.c41
5 files changed, 90 insertions, 140 deletions
diff --git a/src/ft-manager.c b/src/ft-manager.c
index 83936445..4b166330 100644
--- a/src/ft-manager.c
+++ b/src/ft-manager.c
@@ -272,16 +272,16 @@ salut_ft_manager_channel_created (SalutFtManager *self,
if (request_token != NULL)
requests = g_slist_prepend (requests, request_token);
- tp_channel_manager_emit_new_channel (self, TP_EXPORTABLE_CHANNEL (chan),
- requests);
+ tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (self),
+ TP_EXPORTABLE_CHANNEL (chan), requests);
g_slist_free (requests);
}
static gboolean
salut_ft_manager_handle_request (TpChannelManager *manager,
- gpointer request_token,
- GHashTable *request_properties)
+ TpChannelManagerRequest *request,
+ GHashTable *request_properties)
{
SalutFtManager *self = SALUT_FT_MANAGER (manager);
SalutFtManagerPrivate *priv = SALUT_FT_MANAGER_GET_PRIVATE (self);
@@ -457,13 +457,13 @@ salut_ft_manager_handle_request (TpChannelManager *manager,
goto error;
}
- salut_ft_manager_channel_created (self, chan, request_token);
+ salut_ft_manager_channel_created (self, chan, request);
return TRUE;
error:
- tp_channel_manager_emit_request_failed (self, request_token,
- error->domain, error->code, error->message);
+ tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (self),
+ request, error->domain, error->code, error->message);
g_error_free (error);
return TRUE;
}
@@ -546,7 +546,6 @@ channel_manager_iface_init (gpointer g_iface,
iface->foreach_channel = salut_ft_manager_foreach_channel;
iface->type_foreach_channel_class =
salut_ft_manager_type_foreach_channel_class;
- iface->request_channel = salut_ft_manager_handle_request;
iface->create_channel = salut_ft_manager_handle_request;
iface->ensure_channel = salut_ft_manager_handle_request;
}
diff --git a/src/im-manager.c b/src/im-manager.c
index ecaec174..041d1ebb 100644
--- a/src/im-manager.c
+++ b/src/im-manager.c
@@ -376,9 +376,9 @@ salut_im_manager_type_foreach_channel_class (GType type,
static gboolean
salut_im_manager_requestotron (SalutImManager *self,
- gpointer request_token,
- GHashTable *request_properties,
- gboolean require_new)
+ TpChannelManagerRequest *request,
+ GHashTable *request_properties,
+ gboolean require_new)
{
SalutImManagerPrivate *priv = SALUT_IM_MANAGER_GET_PRIVATE (self);
TpBaseConnection *base_conn = (TpBaseConnection *) priv->connection;
@@ -423,7 +423,7 @@ salut_im_manager_requestotron (SalutImManager *self,
if (channel == NULL)
{
salut_im_manager_new_channel (self, handle,
- tp_base_connection_get_self_handle (base_conn), request_token);
+ tp_base_connection_get_self_handle (base_conn), request);
return TRUE;
}
@@ -434,13 +434,13 @@ salut_im_manager_requestotron (SalutImManager *self,
goto error;
}
- tp_channel_manager_emit_request_already_satisfied (self, request_token,
- channel);
+ tp_channel_manager_emit_request_already_satisfied (TP_CHANNEL_MANAGER (self),
+ request, channel);
return TRUE;
error:
- tp_channel_manager_emit_request_failed (self, request_token,
- error->domain, error->code, error->message);
+ tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (self),
+ request, error->domain, error->code, error->message);
g_error_free (error);
return TRUE;
}
@@ -448,36 +448,24 @@ error:
static gboolean
salut_im_manager_create_channel (TpChannelManager *manager,
- gpointer request_token,
- GHashTable *request_properties)
+ TpChannelManagerRequest *request,
+ GHashTable *request_properties)
{
SalutImManager *self = SALUT_IM_MANAGER (manager);
- return salut_im_manager_requestotron (self, request_token,
+ return salut_im_manager_requestotron (self, request,
request_properties, TRUE);
}
static gboolean
-salut_im_manager_request_channel (TpChannelManager *manager,
- gpointer request_token,
- GHashTable *request_properties)
-{
- SalutImManager *self = SALUT_IM_MANAGER (manager);
-
- return salut_im_manager_requestotron (self, request_token,
- request_properties, FALSE);
-}
-
-
-static gboolean
salut_im_manager_ensure_channel (TpChannelManager *manager,
- gpointer request_token,
- GHashTable *request_properties)
+ TpChannelManagerRequest *request,
+ GHashTable *request_properties)
{
SalutImManager *self = SALUT_IM_MANAGER (manager);
- return salut_im_manager_requestotron (self, request_token,
+ return salut_im_manager_requestotron (self, request,
request_properties, FALSE);
}
@@ -492,7 +480,6 @@ salut_im_manager_channel_manager_iface_init (gpointer g_iface,
iface->type_foreach_channel_class =
salut_im_manager_type_foreach_channel_class;
iface->create_channel = salut_im_manager_create_channel;
- iface->request_channel = salut_im_manager_request_channel;
iface->ensure_channel = salut_im_manager_ensure_channel;
}
@@ -506,7 +493,7 @@ im_channel_closed_cb (SalutImChannel *chan,
SalutImManagerPrivate *priv = SALUT_IM_MANAGER_GET_PRIVATE (self);
TpHandle handle;
- tp_channel_manager_emit_channel_closed_for_object (self,
+ tp_channel_manager_emit_channel_closed_for_object (TP_CHANNEL_MANAGER (self),
TP_EXPORTABLE_CHANNEL (chan));
if (priv->channels)
@@ -542,8 +529,8 @@ salut_im_manager_new_channel (SalutImManager *mgr,
if (contact == NULL)
{
gchar *message = g_strdup_printf ("%s is not online", name);
- tp_channel_manager_emit_request_failed (mgr, request, TP_ERROR,
- TP_ERROR_NOT_AVAILABLE, message);
+ tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (mgr), request,
+ TP_ERROR, TP_ERROR_NOT_AVAILABLE, message);
g_free (message);
return NULL;
}
@@ -562,8 +549,8 @@ salut_im_manager_new_channel (SalutImManager *mgr,
if (request != NULL)
requests = g_slist_prepend (requests, request);
- tp_channel_manager_emit_new_channel (mgr, TP_EXPORTABLE_CHANNEL (chan),
- requests);
+ tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (mgr),
+ TP_EXPORTABLE_CHANNEL (chan), requests);
g_slist_free (requests);
diff --git a/src/muc-manager.c b/src/muc-manager.c
index 86ff5478..7b3d26ec 100644
--- a/src/muc-manager.c
+++ b/src/muc-manager.c
@@ -171,7 +171,7 @@ cancel_queued_requests (gpointer k,
for (iter = requests_satisfied; iter != NULL; iter = iter->next)
{
- tp_channel_manager_emit_request_failed (self,
+ tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (self),
iter->data, TP_ERROR, TP_ERROR_DISCONNECTED,
"Unable to complete this channel request, we're disconnecting!");
}
@@ -419,15 +419,15 @@ muc_channel_closed_cb (SalutMucChannel *chan,
/* channel is actually reappearing, announce it */
if (tp_base_channel_is_respawning (base))
{
- tp_channel_manager_emit_new_channel (self,
+ tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (self),
TP_EXPORTABLE_CHANNEL (chan), NULL);
return;
}
if (tp_base_channel_is_registered (base))
{
- tp_channel_manager_emit_channel_closed_for_object (self,
- TP_EXPORTABLE_CHANNEL (chan));
+ tp_channel_manager_emit_channel_closed_for_object (
+ TP_CHANNEL_MANAGER (self), TP_EXPORTABLE_CHANNEL (chan));
}
if (tp_base_channel_is_destroyed (base)
@@ -446,8 +446,8 @@ muc_channel_tube_closed_cb (SalutTubeIface *tube,
{
SalutMucChannel *channel;
- tp_channel_manager_emit_channel_closed_for_object (mgr,
- TP_EXPORTABLE_CHANNEL (tube));
+ tp_channel_manager_emit_channel_closed_for_object (
+ TP_CHANNEL_MANAGER (mgr), TP_EXPORTABLE_CHANNEL (tube));
channel = g_object_get_qdata (G_OBJECT (tube), TUBE_TEXT_QUARK);
g_assert (channel != NULL);
@@ -464,7 +464,7 @@ muc_channel_new_tube_cb (SalutMucChannel *channel,
SalutTubeIface *tube,
SalutMucManager *mgr)
{
- tp_channel_manager_emit_new_channel (mgr,
+ tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (mgr),
TP_EXPORTABLE_CHANNEL (tube), NULL);
g_signal_connect (tube, "closed",
@@ -499,7 +499,7 @@ muc_channel_ready_cb (SalutMucChannel *chan,
{
GSList *satisfied = g_hash_table_lookup (priv->queued_requests, chan);
- tp_channel_manager_emit_new_channel (mgr,
+ tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (mgr),
TP_EXPORTABLE_CHANNEL (chan), satisfied);
}
g_hash_table_remove (priv->queued_requests, chan);
@@ -514,7 +514,7 @@ muc_channel_ready_cb (SalutMucChannel *chan,
requests_satisfied = g_hash_table_lookup (priv->queued_requests, tube);
- tp_channel_manager_emit_new_channel (mgr,
+ tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (mgr),
TP_EXPORTABLE_CHANNEL (tube), requests_satisfied);
g_hash_table_remove (priv->queued_requests, tube);
@@ -538,8 +538,8 @@ muc_channel_join_error_cb (SalutMucChannel *chan,
GSList *_l; \
for (_l = requests; _l != NULL; _l = _l->next) \
{ \
- tp_channel_manager_emit_request_failed (mgr, _l->data, \
- error->domain, error->code, error->message); \
+ tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (mgr), \
+ _l->data, error->domain, error->code, error->message); \
} \
}
@@ -711,7 +711,7 @@ salut_muc_manager_request_new_muc_channel (SalutMucManager *mgr,
if (request_token != NULL)
tokens = g_slist_prepend (tokens, request_token);
- tp_channel_manager_emit_new_channel (mgr,
+ tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (mgr),
TP_EXPORTABLE_CHANNEL (text_chan), tokens);
}
else
@@ -765,7 +765,7 @@ handle_tube_channel_request (SalutMucManager *self,
{
GSList *request_tokens = g_slist_append (NULL, request_token);
- tp_channel_manager_emit_new_channel (self,
+ tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (self),
TP_EXPORTABLE_CHANNEL (new_channel), request_tokens);
g_slist_free (request_tokens);
@@ -848,9 +848,9 @@ handle_dbus_tube_channel_request (SalutMucManager *self,
static gboolean
salut_muc_manager_request (SalutMucManager *self,
- gpointer request_token,
- GHashTable *request_properties,
- gboolean require_new)
+ TpChannelManagerRequest *request,
+ GHashTable *request_properties,
+ gboolean require_new)
{
SalutMucManagerPrivate *priv = SALUT_MUC_MANAGER_GET_PRIVATE (self);
GError *error = NULL;
@@ -898,8 +898,9 @@ salut_muc_manager_request (SalutMucManager *self,
{
if (tp_base_channel_is_registered (TP_BASE_CHANNEL (text_chan)))
{
- tp_channel_manager_emit_request_already_satisfied (self,
- request_token, TP_EXPORTABLE_CHANNEL (text_chan));
+ tp_channel_manager_emit_request_already_satisfied (
+ TP_CHANNEL_MANAGER (self), request,
+ TP_EXPORTABLE_CHANNEL (text_chan));
}
else
{
@@ -907,15 +908,16 @@ salut_muc_manager_request (SalutMucManager *self,
if (salut_muc_channel_is_ready (text_chan))
{
- GSList *tokens = g_slist_append (NULL, request_token);
- tp_channel_manager_emit_new_channel (self,
+ GSList *tokens = g_slist_append (NULL, request);
+ tp_channel_manager_emit_new_channel (
+ TP_CHANNEL_MANAGER (self),
TP_EXPORTABLE_CHANNEL (text_chan), tokens);
g_slist_free (tokens);
}
else
{
associate_channel_to_data (priv->queued_requests,
- text_chan, request_token);
+ text_chan, request);
}
}
}
@@ -923,20 +925,20 @@ salut_muc_manager_request (SalutMucManager *self,
else
{
text_chan = salut_muc_manager_request_new_muc_channel (self,
- handle, request_token, TRUE, NULL);
+ handle, request, TRUE, NULL);
}
return TRUE;
}
else if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE1))
{
- if (handle_stream_tube_channel_request (self, request_token,
+ if (handle_stream_tube_channel_request (self, request,
request_properties, require_new, handle, &error))
return TRUE;
}
else if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE1))
{
- if (handle_dbus_tube_channel_request (self, request_token,
+ if (handle_dbus_tube_channel_request (self, request,
request_properties, require_new, handle, &error))
return TRUE;
}
@@ -946,45 +948,30 @@ salut_muc_manager_request (SalutMucManager *self,
}
error:
- tp_channel_manager_emit_request_failed (self, request_token,
- error->domain, error->code, error->message);
+ tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (self),
+ request, error->domain, error->code, error->message);
g_error_free (error);
return TRUE;
}
static gboolean
salut_muc_manager_create_channel (TpChannelManager *manager,
- gpointer request_token,
- GHashTable *request_properties)
-{
- SalutMucManager *self = SALUT_MUC_MANAGER (manager);
-
- return salut_muc_manager_request (self, request_token, request_properties,
- TRUE);
-}
-
-
-static gboolean
-salut_muc_manager_request_channel (TpChannelManager *manager,
- gpointer request_token,
- GHashTable *request_properties)
+ TpChannelManagerRequest *request,
+ GHashTable *request_properties)
{
SalutMucManager *self = SALUT_MUC_MANAGER (manager);
- return salut_muc_manager_request (self, request_token, request_properties,
- FALSE);
+ return salut_muc_manager_request (self, request, request_properties, TRUE);
}
-
static gboolean
salut_muc_manager_ensure_channel (TpChannelManager *manager,
- gpointer request_token,
- GHashTable *request_properties)
+ TpChannelManagerRequest *request,
+ GHashTable *request_properties)
{
SalutMucManager *self = SALUT_MUC_MANAGER (manager);
- return salut_muc_manager_request (self, request_token, request_properties,
- FALSE);
+ return salut_muc_manager_request (self, request, request_properties, FALSE);
}
@@ -996,7 +983,6 @@ static void salut_muc_manager_iface_init (gpointer g_iface,
iface->foreach_channel = salut_muc_manager_foreach_channel;
iface->type_foreach_channel_class =
salut_muc_manager_type_foreach_channel_class;
- iface->request_channel = salut_muc_manager_request_channel;
iface->create_channel = salut_muc_manager_create_channel;
iface->ensure_channel = salut_muc_manager_ensure_channel;
}
@@ -1101,8 +1087,8 @@ invite_stanza_callback (WockyPorter *porter,
chan = salut_muc_manager_new_muc_channel (self, room_handle,
connection, inviter_handle, FALSE, FALSE, TRUE);
- tp_channel_manager_emit_new_channel (self, TP_EXPORTABLE_CHANNEL (chan),
- NULL);
+ tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (self),
+ TP_EXPORTABLE_CHANNEL (chan), NULL);
}
/* FIXME handle properly */
diff --git a/src/roomlist-manager.c b/src/roomlist-manager.c
index 076588b3..80d724dc 100644
--- a/src/roomlist-manager.c
+++ b/src/roomlist-manager.c
@@ -325,7 +325,7 @@ roomlist_channel_closed_cb (SalutRoomlistChannel *channel,
SalutRoomlistManagerPrivate *priv =
SALUT_ROOMLIST_MANAGER_GET_PRIVATE (self);
- tp_channel_manager_emit_channel_closed_for_object (self,
+ tp_channel_manager_emit_channel_closed_for_object (TP_CHANNEL_MANAGER (self),
TP_EXPORTABLE_CHANNEL (channel));
if (priv->roomlist_channels != NULL)
@@ -414,8 +414,9 @@ salut_roomlist_manager_request (TpChannelManager *manager,
/* reuse the first channel */
roomlist_channel = priv->roomlist_channels->data;
- tp_channel_manager_emit_request_already_satisfied (self,
- request_token, TP_EXPORTABLE_CHANNEL (roomlist_channel));
+ tp_channel_manager_emit_request_already_satisfied (
+ TP_CHANNEL_MANAGER (self), request_token,
+ TP_EXPORTABLE_CHANNEL (roomlist_channel));
return TRUE;
}
@@ -427,15 +428,15 @@ salut_roomlist_manager_request (TpChannelManager *manager,
roomlist_channel);
request_tokens = g_slist_prepend (NULL, request_token);
- tp_channel_manager_emit_new_channel (self,
+ tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (self),
TP_EXPORTABLE_CHANNEL (roomlist_channel), request_tokens);
g_slist_free (request_tokens);
return TRUE;
error:
- tp_channel_manager_emit_request_failed (self, request_token,
- error->domain, error->code, error->message);
+ tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (self),
+ request_token, error->domain, error->code, error->message);
g_error_free (error);
return TRUE;
}
@@ -443,30 +444,19 @@ error:
static gboolean
salut_roomlist_manager_create_channel (TpChannelManager *manager,
- gpointer request_token,
- GHashTable *request_properties)
+ TpChannelManagerRequest *request,
+ GHashTable *request_properties)
{
- return salut_roomlist_manager_request (manager, request_token,
+ return salut_roomlist_manager_request (manager, request,
request_properties, TRUE);
}
-
-static gboolean
-salut_roomlist_manager_request_channel (TpChannelManager *manager,
- gpointer request_token,
- GHashTable *request_properties)
-{
- return salut_roomlist_manager_request (manager, request_token,
- request_properties, FALSE);
-}
-
-
static gboolean
salut_roomlist_manager_ensure_channel (TpChannelManager *manager,
- gpointer request_token,
- GHashTable *request_properties)
+ TpChannelManagerRequest *request,
+ GHashTable *request_properties)
{
- return salut_roomlist_manager_request (manager, request_token,
+ return salut_roomlist_manager_request (manager, request,
request_properties, FALSE);
}
@@ -479,7 +469,6 @@ static void salut_roomlist_manager_iface_init (gpointer g_iface,
iface->foreach_channel = salut_roomlist_manager_foreach_channel;
iface->type_foreach_channel_class =
salut_roomlist_manager_type_foreach_channel_class;
- iface->request_channel = salut_roomlist_manager_request_channel;
iface->create_channel = salut_roomlist_manager_create_channel;
iface->ensure_channel = salut_roomlist_manager_ensure_channel;
}
diff --git a/src/tubes-manager.c b/src/tubes-manager.c
index 98895c17..544c0ea3 100644
--- a/src/tubes-manager.c
+++ b/src/tubes-manager.c
@@ -347,7 +347,7 @@ iq_tube_request_cb (WockyPorter *porter,
}
/* announce tube channel */
- tp_channel_manager_emit_new_channel (self,
+ tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (self),
TP_EXPORTABLE_CHANNEL (chan), NULL);
g_hash_table_unref (parameters);
@@ -679,7 +679,7 @@ channel_closed_cb (SalutTubeIface *tube,
"id", &id,
NULL);
- tp_channel_manager_emit_channel_closed_for_object (self,
+ tp_channel_manager_emit_channel_closed_for_object (TP_CHANNEL_MANAGER (self),
TP_EXPORTABLE_CHANNEL (tube));
if (priv->tubes != NULL)
@@ -802,9 +802,9 @@ new_channel_from_request (SalutTubesManager *self,
static gboolean
salut_tubes_manager_requestotron (SalutTubesManager *self,
- gpointer request_token,
- GHashTable *request_properties,
- gboolean require_new)
+ TpChannelManagerRequest *request,
+ GHashTable *request_properties,
+ gboolean require_new)
{
SalutTubesManagerPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
SALUT_TYPE_TUBES_MANAGER, SalutTubesManagerPrivate);
@@ -907,10 +907,10 @@ salut_tubes_manager_requestotron (SalutTubesManager *self,
request_properties);
g_assert (new_channel != NULL);
- if (request_token != NULL)
- tokens = g_slist_prepend (NULL, request_token);
+ if (request != NULL)
+ tokens = g_slist_prepend (NULL, request);
- tp_channel_manager_emit_new_channel (self,
+ tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (self),
TP_EXPORTABLE_CHANNEL (new_channel), tokens);
g_slist_free (tokens);
@@ -925,14 +925,15 @@ salut_tubes_manager_requestotron (SalutTubesManager *self,
goto error;
}
- tp_channel_manager_emit_request_already_satisfied (self,
- request_token, TP_EXPORTABLE_CHANNEL (new_channel));
+ tp_channel_manager_emit_request_already_satisfied (
+ TP_CHANNEL_MANAGER (self), request,
+ TP_EXPORTABLE_CHANNEL (new_channel));
}
return TRUE;
error:
- tp_channel_manager_emit_request_failed (self, request_token,
+ tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (self), request,
error->domain, error->code, error->message);
g_error_free (error);
return TRUE;
@@ -940,26 +941,15 @@ error:
static gboolean
salut_tubes_manager_create_channel (TpChannelManager *manager,
- gpointer request_token,
- GHashTable *request_properties)
+ TpChannelManagerRequest *request,
+ GHashTable *request_properties)
{
SalutTubesManager *self = SALUT_TUBES_MANAGER (manager);
- return salut_tubes_manager_requestotron (self, request_token,
+ return salut_tubes_manager_requestotron (self, request,
request_properties, TRUE);
}
-static gboolean
-salut_tubes_manager_request_channel (TpChannelManager *manager,
- gpointer request_token,
- GHashTable *request_properties)
-{
- SalutTubesManager *self = SALUT_TUBES_MANAGER (manager);
-
- return salut_tubes_manager_requestotron (self, request_token,
- request_properties, FALSE);
-}
-
SalutTubesManager *
salut_tubes_manager_new (
SalutConnection *conn,
@@ -985,7 +975,6 @@ salut_tubes_manager_iface_init (gpointer g_iface,
iface->type_foreach_channel_class =
salut_tubes_manager_type_foreach_channel_class;
iface->create_channel = salut_tubes_manager_create_channel;
- iface->request_channel = salut_tubes_manager_request_channel;
}
static void