higher level channel requesting in telepathy-glib

Thanks to the awesome work of Guillaume, telepathy-glib 0.11.12 now includes high-level API for requesting communications channels via Mission Control (the Channel Dispatcher). API is provided both for channels you wish to handle, or channels you want someone else to handle. The API uses the same asynchronous patterns as used in GIO.

For instance, to request a text channel to a contact that you want someone else (i.e. Empathy) to handle:

GHashTable *props = tp_asv_new (
    TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_TEXT,
    TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT,
    TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING, "escher@tuxedo.cat",
    NULL);
 
TpAccountChannelRequest *request = tp_account_channel_request_new (TP_ACCOUNT (account),
    props, G_MAXINT64 /* current time */);
 
tp_account_channel_request_ensure_channel_async (request,
    NULL, NULL, _channel_ready, NULL);
 
g_hash_table_destroy (props);
g_object_unref (request);
static void
_channel_ready (GObject *request,
    GAsyncResult *res,
    gpointer user_data)
{
  GError *error = NULL;
 
  if (!tp_account_channel_request_ensure_channel_finish (
      TP_ACCOUNT_CHANNEL_REQUEST (request), res, &error))
    handle_error (error);
 
  ...
}

I’ve spent some time this week updating telepathy-glib examples to take advantage of new APIs, and they’ve all become noticeably shorter. The last two missing pieces of the puzzle are high-level wrappers for channel types (we have prototypes for tubes: stream, dbus) and a library of GTK+ widgets (a libfolks-gtk maybe?).

Author: Danielle

Danielle is an Australian software engineer, computer scientist and feminist. She doesn't really work on GNOME any more (sadly). Opinions and writing are solely her own and so not represent her employer, the GNOME Foundation, or anyone else but herself.

Leave a Reply

Your email address will not be published. Required fields are marked *

Creative Commons Attribution-ShareAlike 2.5 Australia
This work by Danielle Madeley is licensed under a Creative Commons Attribution-ShareAlike 2.5 Australia.