[Telepathy] Accessing the ContactList for a connection.

Michael R. Head burner at suppressingfire.org
Thu Feb 14 19:12:36 PST 2008


Hi, I'm trying to find my way around the telepathy API (for a maemo
project) and what I'd like to do right now is use mission control to
access a Connected account's contact list and print out the first
contact in the list. (after that, I'd like to send a message to that
contact, but I'll work on that later).

I'm having a little trouble figuring out which calls to make. It seems
like I should be getting a ContactList channel and storing the result in
a  TP_HANDLE_TYPE_LIST, but I'm not sure what the handle int should be
set to... actually I'm not sure how these handles work yet, and I'm
having trouble translating between the telepathy spec and the
appropriate libtelepathy/telepathy-glib calls I should be making.

Anyway, here's my snippet, which of course fails because I'm not putting
in a good value for handle:

  TpConn* tp_connection = mission_control_get_connection(mc, account, &error);
  if (tp_connection == NULL) {
    g_assert(error != NULL);
    g_error("Connection was not created: \"%s\" (code: %i)\n", error->message, error->code);
    g_error_free(error);
  } else {
    /* We have a connection! */
    guint handle = 0;
    const gchar* bus_name = dbus_g_proxy_get_bus_name (DBUS_G_PROXY (tp_connection));
    TpChan * contact_list_channel  = tp_conn_new_channel (dbus_conn, tp_connection, bus_name, TP_IFACE_CHANNEL_TYPE_CONTACT_LIST, TP_HANDLE_TYPE_LIST, handle, TRUE);
  }

And the output:
...
mission-control-test[3723]: GLIB WARNING ** default - RequestChannel() failed: invalid handle 0 (org.freedesktop.Telepathy.Error.InvalidHandle)

-- 
Michael R. Head <burner at suppressingfire.org>
http://www.core.binghamton.edu/~burner/new/resume.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3259 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/telepathy/attachments/20080214/d84b5e50/attachment.bin 


More information about the Telepathy mailing list