Connection Managers

In general, there is little need for a client to interact directly with the Connection Managers. In general, the work to obtaining and manage connections should be handled by the Account Manager.

Support for the various communication protocols is provided by several Connection Managers. For instance, the telepathy-gabble Connection Manager provides support for the XMPP protocol, also known as Jabber.

There is no central Telepathy D-Bus service in Telepathy. Instead there are several connection manager services, activated on demand. Each connection manager implements the Telepathy specification, allowing a Telepathy client to utilise any messaging protocol.

All Telepathy Connection Managers have bus names that begin with org.freedesktop.Telepathy.ConnectionManager. You can discover all available connection managers by calling the D-Bus ListActivatableNames method and then comparing the names with that prefix.

A Connection Manager may implement more than one protocol (e.g. telepathy-haze is a connection manager using libpurple and thus provides many protocols). You may then discover what protocols are provided by each connection manager by calling the ConnectionManagers's ListProtocols method.

Account Object Paths

Account object paths are of the form /org/freedesktop/Telepathy/Account/cm-name/protocol-name/account-name (e.g. /org/freedesktop/Telepathy/Account/gabble/jabber/bob_40example_2com0).

If required (i.e. for an accounts editor) you can parse the account object path in telepathy-glib using tp_account_parse_object_path.

Read more about accounts in Section 3.1 ― Accounts.

5.1.1. telepathy-glib

telepathy-glib provides the tp_list_connection_managers function to list the available connection managers. This is demonstrated in Example 5-1.

telepathy-glib's TpConnectionManager object automatically calls ListProtocols upon creation and emits the got-info signal when it has returned. You can examine the TpConnectionManager::protocols struct field in your signal handler.

Example 5-1tp_list_connection_managers Example
static void
get_connection_managers (TpDBusDaemon *bus_daemon)
        /* let's get a list of the connection managers */
        tp_list_connection_managers (bus_daemon, got_connection_managers,
                        NULL, NULL, NULL);

static void
got_connection_managers (TpConnectionManager    * const * cms,
                         gsize                   ncms,
                         const GError           *error,
                         gpointer                user_data,
                         GObject                *weak_object)
        g_print (" > got_connection_managers\n");

        /* From the documentation:
         *  tp_list_connection_managers() will wait for each
         *  TpConnectionManager to become ready, so all connection managers
         *  passed to callback will be ready */

        int i;
        for (i = 0; i < ncms; i++)
                TpConnectionManager *cm = cms[i];

                if (!tp_connection_manager_is_ready (cm))
                        /* this should never happen, unless there is an
                         * error */
                        g_print ("CM not ready!\n");

                g_print (" - %s\n", cm->name);

                /* get the protocols */
                const TpConnectionManagerProtocol * const *iter;
                for (iter = cm->protocols; iter && *iter; iter++)
                        const TpConnectionManagerProtocol *prot = *iter;
                        g_print ("   . %s\n", prot->name);

Complete Source Code