telepathyClient: Add IM subscription request support
Based on initial work from Guillaume Desmottes https://bugzilla.gnome.org/show_bug.cgi?id=653941
This commit is contained in:

committed by
Jasper St. Pierre

parent
071c49b7c6
commit
fefee3b49e
@ -19,6 +19,10 @@ struct _ShellTpClientPrivate
|
||||
ShellTpClientHandleChannelsImpl handle_channels_impl;
|
||||
gpointer user_data_handle_channels;
|
||||
GDestroyNotify destroy_handle_channels;
|
||||
|
||||
ShellTpClientContactListChangedImpl contact_list_changed_impl;
|
||||
gpointer user_data_contact_list_changed;
|
||||
GDestroyNotify destroy_contact_list_changed;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -77,6 +81,16 @@ struct _ShellTpClientPrivate
|
||||
* Signature of the implementation of the HandleChannels method.
|
||||
*/
|
||||
|
||||
/**
|
||||
* ShellTpClientContactListChangedImpl:
|
||||
* @connection: a #TpConnection having %TP_CONNECTION_FEATURE_CORE prepared
|
||||
* if possible
|
||||
* @added: (element-type TelepathyGLib.Contact): a #GPtrArray of added #TpContact
|
||||
* @removed: (element-type TelepathyGLib.Contact): a #GPtrArray of removed #TpContact
|
||||
*
|
||||
* Signature of the implementation of the ContactListChanged method.
|
||||
*/
|
||||
|
||||
static void
|
||||
shell_tp_client_init (ShellTpClient *self)
|
||||
{
|
||||
@ -220,6 +234,13 @@ shell_tp_client_dispose (GObject *object)
|
||||
self->priv->user_data_handle_channels = NULL;
|
||||
}
|
||||
|
||||
if (self->priv->destroy_contact_list_changed != NULL)
|
||||
{
|
||||
self->priv->destroy_contact_list_changed (self->priv->user_data_contact_list_changed);
|
||||
self->priv->destroy_contact_list_changed = NULL;
|
||||
self->priv->user_data_contact_list_changed = NULL;
|
||||
}
|
||||
|
||||
if (dispose != NULL)
|
||||
dispose (object);
|
||||
}
|
||||
@ -278,6 +299,43 @@ shell_tp_client_set_handle_channels_func (ShellTpClient *self,
|
||||
self->priv->destroy_handle_channels = destroy;
|
||||
}
|
||||
|
||||
void
|
||||
shell_tp_client_set_contact_list_changed_func (ShellTpClient *self,
|
||||
ShellTpClientContactListChangedImpl contact_list_changed_impl,
|
||||
gpointer user_data,
|
||||
GDestroyNotify destroy)
|
||||
{
|
||||
g_assert (self->priv->contact_list_changed_impl == NULL);
|
||||
|
||||
self->priv->contact_list_changed_impl = contact_list_changed_impl;
|
||||
self->priv->user_data_handle_channels = user_data;
|
||||
self->priv->destroy_handle_channels = destroy;
|
||||
}
|
||||
|
||||
static void
|
||||
on_contact_list_changed (TpConnection *conn,
|
||||
GPtrArray *added,
|
||||
GPtrArray *removed,
|
||||
gpointer user_data)
|
||||
{
|
||||
ShellTpClient *self = (ShellTpClient *) user_data;
|
||||
|
||||
g_assert (self->priv->contact_list_changed_impl != NULL);
|
||||
|
||||
self->priv->contact_list_changed_impl (conn,
|
||||
added, removed,
|
||||
self->priv->user_data_contact_list_changed);
|
||||
}
|
||||
|
||||
void
|
||||
shell_tp_client_grab_contact_list_changed (ShellTpClient *self,
|
||||
TpConnection *conn)
|
||||
{
|
||||
g_signal_connect (conn, "contact-list-changed",
|
||||
G_CALLBACK (on_contact_list_changed),
|
||||
self);
|
||||
}
|
||||
|
||||
/* Telepathy utility functions */
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user