TpConnectionManager

TpConnectionManager — proxy object for a Telepathy connection manager

Synopsis

#include <telepathy-glib/telepathy-glib.h>

void                tp_list_connection_managers_async   (TpDBusDaemon *dbus_daemon,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
GList *             tp_list_connection_managers_finish  (GAsyncResult *result,
                                                         GError **error);
struct              TpConnectionManager;
struct              TpConnectionManagerClass;
TpConnectionManager * tp_connection_manager_new         (TpDBusDaemon *dbus,
                                                         const gchar *name,
                                                         const gchar *manager_filename,
                                                         GError **error);
const gchar *       tp_connection_manager_get_name      (TpConnectionManager *self);
#define             TP_CONNECTION_MANAGER_FEATURE_CORE
enum                TpCMInfoSource;
#define             TP_TYPE_CM_INFO_SOURCE
TpCMInfoSource      tp_connection_manager_get_info_source
                                                        (TpConnectionManager *self);
gboolean            tp_connection_manager_activate      (TpConnectionManager *self);
gboolean            tp_connection_manager_is_running    (TpConnectionManager *self);
GList *             tp_connection_manager_dup_protocols (TpConnectionManager *self);
gchar **            tp_connection_manager_dup_protocol_names
                                                        (TpConnectionManager *self);
gboolean            tp_connection_manager_has_protocol  (TpConnectionManager *self,
                                                         const gchar *protocol);
TpProtocol *        tp_connection_manager_get_protocol  (TpConnectionManager *self,
                                                         const gchar *protocol);
                    TpConnectionManagerParam;
const gchar *       tp_connection_manager_param_get_name
                                                        (const TpConnectionManagerParam *param);
const gchar *       tp_connection_manager_param_get_dbus_signature
                                                        (const TpConnectionManagerParam *param);
gboolean            tp_connection_manager_param_is_required
                                                        (const TpConnectionManagerParam *param);
gboolean            tp_connection_manager_param_is_required_for_registration
                                                        (const TpConnectionManagerParam *param);
gboolean            tp_connection_manager_param_is_secret
                                                        (const TpConnectionManagerParam *param);
gboolean            tp_connection_manager_param_is_dbus_property
                                                        (const TpConnectionManagerParam *param);
gboolean            tp_connection_manager_param_get_default
                                                        (const TpConnectionManagerParam *param,
                                                         GValue *value);
GVariant *          tp_connection_manager_param_dup_default_variant
                                                        (const TpConnectionManagerParam *param);
gboolean            tp_connection_manager_check_valid_name
                                                        (const gchar *name,
                                                         GError **error);
gboolean            tp_connection_manager_check_valid_protocol_name
                                                        (const gchar *name,
                                                         GError **error);
void                tp_connection_manager_init_known_interfaces
                                                        (void);
TpConnectionManagerParam * tp_connection_manager_param_copy
                                                        (const TpConnectionManagerParam *in);
void                tp_connection_manager_param_free    (TpConnectionManagerParam *param);

Object Hierarchy

  GObject
   +----TpProxy
         +----TpConnectionManager
  GEnum
   +----TpCMInfoSource
  GBoxed
   +----TpConnectionManagerParam

Properties

  "always-introspect"        gboolean              : Read / Write
  "cm-name"                  gchar*                : Read
  "info-source"              guint                 : Read
  "manager-file"             gchar*                : Read / Write / Construct

Signals

  "activated"                                      : Has Details
  "exited"                                         : Has Details
  "got-info"                                       : Has Details

Description

TpConnectionManager objects represent Telepathy connection managers. They can be used to open connections.

Details

tp_list_connection_managers_async ()

void                tp_list_connection_managers_async   (TpDBusDaemon *dbus_daemon,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);

List the available (running or installed) connection managers, asynchronously, and wait for their TP_CONNECTION_MANAGER_FEATURE_CORE feature to be ready.

dbus_daemon :

a TpDBusDaemon, or NULL to use tp_dbus_daemon_dup(). [allow-none]

callback :

a callback to call with a list of CMs

user_data :

data to pass to callback

Since 0.17.6


tp_list_connection_managers_finish ()

GList *             tp_list_connection_managers_finish  (GAsyncResult *result,
                                                         GError **error);

Finish listing the available connection managers.

Free the list after use, for instance with g_list_free_full (list, g_object_unref).

result :

the result of tp_list_connection_managers_async()

error :

used to raise an error if the operation failed

Returns :

a newly allocated list of references to TpConnectionManager objects. [transfer full][element-type TelepathyGLib.ConnectionManager]

Since 0.17.6


struct TpConnectionManager

struct TpConnectionManager;

A proxy object for a Telepathy connection manager.

This might represent a connection manager which is currently running (in which case it can be introspected) or not (in which case its capabilities can be read from .manager files in the filesystem). Accordingly, this object never emits "invalidated" unless all references to it are discarded.

Various fields and methods on this object do not work until TP_CONNECTION_MANAGER_FEATURE_CORE is prepared. Use tp_proxy_prepare_async() to wait for this to happen.

Since 0.7.1


struct TpConnectionManagerClass

struct TpConnectionManagerClass {
};

The class of a TpConnectionManager.

Since 0.7.1


tp_connection_manager_new ()

TpConnectionManager * tp_connection_manager_new         (TpDBusDaemon *dbus,
                                                         const gchar *name,
                                                         const gchar *manager_filename,
                                                         GError **error);

Convenience function to create a new connection manager proxy. If its protocol and parameter information are required, you should call tp_proxy_prepare_async() on the result.

dbus :

Proxy for the D-Bus daemon

name :

The connection manager name (such as "gabble")

manager_filename :

The "manager-file" property, which may (and generally should) be NULL. [allow-none]

error :

used to return an error if NULL is returned

Returns :

a new reference to a connection manager proxy, or NULL if error is set.

tp_connection_manager_get_name ()

const gchar *       tp_connection_manager_get_name      (TpConnectionManager *self);

Return the internal name of this connection manager in the Telepathy D-Bus API, e.g. "gabble" or "haze". This is often the name of the binary without the "telepathy-" prefix.

The returned string is valid as long as self is. Copy it with g_strdup() if a longer lifetime is required.

self :

a connection manager

Returns :

the "cm-name" property

Since 0.7.26


TP_CONNECTION_MANAGER_FEATURE_CORE

#define             TP_CONNECTION_MANAGER_FEATURE_CORE

Expands to a call to a function that returns a quark for the "core" feature on a TpConnectionManager.

After this feature is prepared, basic information about the connection manager's protocols (tp_connection_manager_dup_protocols()), and their available parameters, will have been retrieved, either by activating the connection manager over D-Bus or by reading the .manager file in which that information is cached.

Since 0.11.11, this feature also finds any extra interfaces that this connection manager has, and adds them to "interfaces" (where they can be queried with tp_proxy_has_interface()).

One can ask for a feature to be prepared using the tp_proxy_prepare_async() function, and waiting for it to callback.

Since 0.11.3


enum TpCMInfoSource

typedef enum {
  TP_CM_INFO_SOURCE_NONE,
  TP_CM_INFO_SOURCE_FILE,
  TP_CM_INFO_SOURCE_LIVE
} TpCMInfoSource;

Describes possible sources of information on connection managers' supported protocols.

Since 0.11.5, there is a corresponding GEnumClass type, TP_TYPE_CM_INFO_SOURCE.

TP_CM_INFO_SOURCE_NONE

no information available

TP_CM_INFO_SOURCE_FILE

information came from a .manager file

TP_CM_INFO_SOURCE_LIVE

information came from the connection manager

Since 0.7.1


TP_TYPE_CM_INFO_SOURCE

#define TP_TYPE_CM_INFO_SOURCE (tp_cm_info_source_get_type ())

The GEnumClass type of a TpCMInfoSource.

Since 0.11.5


tp_connection_manager_get_info_source ()

TpCMInfoSource      tp_connection_manager_get_info_source
                                                        (TpConnectionManager *self);

If protocol and parameter information has been obtained from the connection manager, return TP_CM_INFO_SOURCE_LIVE; if it has been obtained from the cache in the .manager file, return TP_CM_INFO_SOURCE_FILE. If this information has not yet been obtained, or obtaining it failed, return TP_CM_INFO_SOURCE_NONE.

This may increase at any time that the main loop is running; the "notify" signal is emitted.

self :

a connection manager

Returns :

the value of the "info-source" property

Since 0.7.26


tp_connection_manager_activate ()

gboolean            tp_connection_manager_activate      (TpConnectionManager *self);

Attempt to run and introspect the connection manager, asynchronously. Since 0.7.26 this function is not generally very useful, since the connection manager will now be activated automatically if necessary.

If the CM was already running, do nothing and return FALSE.

On success, emit "activated" when the CM appears on the bus, and "got-info" when its capabilities have been (re-)discovered.

On failure, emit "exited" without first emitting activated.

self :

a connection manager proxy

Returns :

TRUE if activation was needed and is now in progress, FALSE if the connection manager was already running and no additional signals will be emitted.

Since 0.7.1


tp_connection_manager_is_running ()

gboolean            tp_connection_manager_is_running    (TpConnectionManager *self);

Return TRUE if this connection manager currently appears to be running. This may change at any time that the main loop is running; the "activated" and "exited" signals are emitted.

self :

a connection manager

Returns :

whether the connection manager is currently running

Since 0.7.26


tp_connection_manager_dup_protocols ()

GList *             tp_connection_manager_dup_protocols (TpConnectionManager *self);

Return objects representing all protocols supported by this connection manager.

If this function is called before the connection manager information has been obtained, the result is always NULL. Use tp_proxy_prepare_async() to wait for this.

The caller must free the list, for instance with g_list_free_full (l, g_object_unref).

self :

a connection manager

Returns :

a list of TpProtocol objects representing the protocols supported by self, owned by the caller. [transfer full][element-type TelepathyGLib.Protocol]

Since 0.17.6


tp_connection_manager_dup_protocol_names ()

gchar **            tp_connection_manager_dup_protocol_names
                                                        (TpConnectionManager *self);

Returns a list of protocol names supported by this connection manager. These are the internal protocol names used by the Telepathy specification (e.g. "jabber" and "msn"), rather than user-visible names in any particular locale.

If this function is called before the connection manager information has been obtained, the result is always NULL. Use tp_proxy_prepare_async() to wait for this.

The result is copied and must be freed by the caller, but it is not necessarily still true after the main loop is re-entered.

self :

a connection manager

Returns :

a GStrv of protocol names. [array zero-terminated=1][transfer full]

Since 0.7.26


tp_connection_manager_has_protocol ()

gboolean            tp_connection_manager_has_protocol  (TpConnectionManager *self,
                                                         const gchar *protocol);

Return whether protocol is supported by this connection manager.

If this function is called before the connection manager information has been obtained, the result is always FALSE. Use tp_proxy_prepare_async() to wait for this.

self :

a connection manager

protocol :

the name of a protocol as defined in the Telepathy D-Bus API, e.g. "jabber" or "msn"

Returns :

TRUE if this connection manager supports protocol

Since 0.7.26


tp_connection_manager_get_protocol ()

TpProtocol *        tp_connection_manager_get_protocol  (TpConnectionManager *self,
                                                         const gchar *protocol);

Returns an object representing a protocol, or NULL if this connection manager does not support the specified protocol.

If this function is called before the connection manager information has been obtained, the result is always NULL. Use tp_proxy_prepare_async() to wait for this.

The result should be referenced with g_object_ref() if it will be kept.

self :

a connection manager

protocol :

the name of a protocol as defined in the Telepathy D-Bus API, e.g. "jabber" or "msn"

Returns :

an object representing the protocol, or NULL. [transfer none]

Since 0.11.11


TpConnectionManagerParam

typedef struct _TpConnectionManagerParam TpConnectionManagerParam;

Structure representing a connection manager parameter.

Since 0.7.1


tp_connection_manager_param_get_name ()

const gchar *       tp_connection_manager_param_get_name
                                                        (const TpConnectionManagerParam *param);

param :

a parameter supported by a TpConnectionManager

Returns :

the name of the parameter

Since 0.7.26


tp_connection_manager_param_get_dbus_signature ()

const gchar *       tp_connection_manager_param_get_dbus_signature
                                                        (const TpConnectionManagerParam *param);

param :

a parameter supported by a TpConnectionManager

Returns :

the D-Bus signature of the parameter

Since 0.7.26


tp_connection_manager_param_is_required ()

gboolean            tp_connection_manager_param_is_required
                                                        (const TpConnectionManagerParam *param);

param :

a parameter supported by a TpConnectionManager

Returns :

TRUE if the parameter is normally required

Since 0.7.26


tp_connection_manager_param_is_required_for_registration ()

gboolean            tp_connection_manager_param_is_required_for_registration
                                                        (const TpConnectionManagerParam *param);

param :

a parameter supported by a TpConnectionManager

Returns :

TRUE if the parameter is required when registering a new account (by setting the special "register" parameter to TRUE)

Since 0.7.26


tp_connection_manager_param_is_secret ()

gboolean            tp_connection_manager_param_is_secret
                                                        (const TpConnectionManagerParam *param);

param :

a parameter supported by a TpConnectionManager

Returns :

TRUE if the parameter's value is a password or other secret

Since 0.7.26


tp_connection_manager_param_is_dbus_property ()

gboolean            tp_connection_manager_param_is_dbus_property
                                                        (const TpConnectionManagerParam *param);

param :

a parameter supported by a TpConnectionManager

Returns :

TRUE if the parameter represents a D-Bus property of the same name

Since 0.7.26


tp_connection_manager_param_get_default ()

gboolean            tp_connection_manager_param_get_default
                                                        (const TpConnectionManagerParam *param,
                                                         GValue *value);

Get the default value for this parameter, if there is one. If FALSE is returned, value is left uninitialized.

param :

a parameter supported by a TpConnectionManager

value :

pointer to an unset (all zeroes) GValue into which the default's type and value are written

Returns :

TRUE if there is a default value

Since 0.7.26


tp_connection_manager_param_dup_default_variant ()

GVariant *          tp_connection_manager_param_dup_default_variant
                                                        (const TpConnectionManagerParam *param);

Get the default value for this parameter.

Use g_variant_get_type() to check that the type is what you expect. For instance, a string parameter should have type G_VARIANT_TYPE_STRING.

param :

a parameter supported by a TpConnectionManager

Returns :

the default value, or NULL if there is no default

Since 0.19.0


tp_connection_manager_check_valid_name ()

gboolean            tp_connection_manager_check_valid_name
                                                        (const gchar *name,
                                                         GError **error);

Check that the given string is a valid connection manager name, i.e. that it consists entirely of ASCII letters, digits and underscores, and starts with a letter.

name :

a possible connection manager name

error :

used to raise TP_ERROR_INVALID_ARGUMENT if FALSE is returned

Returns :

TRUE if name is valid

Since 0.7.1


tp_connection_manager_check_valid_protocol_name ()

gboolean            tp_connection_manager_check_valid_protocol_name
                                                        (const gchar *name,
                                                         GError **error);

Check that the given string is a valid protocol name, i.e. that it consists entirely of ASCII letters, digits and hyphen/minus, and starts with a letter or underscore.

name :

a possible protocol name

error :

used to raise TP_ERROR_INVALID_ARGUMENT if FALSE is returned

Returns :

TRUE if name is valid

Since 0.7.1


tp_connection_manager_init_known_interfaces ()

void                tp_connection_manager_init_known_interfaces
                                                        (void);

Ensure that the known interfaces for TpConnectionManager have been set up. This is done automatically when necessary, but for correct overriding of library interfaces by local extensions, you should call this function before calling tp_proxy_or_subclass_hook_on_interface_add() with first argument TP_TYPE_CONNECTION_MANAGER.

Since 0.7.32


tp_connection_manager_param_copy ()

TpConnectionManagerParam * tp_connection_manager_param_copy
                                                        (const TpConnectionManagerParam *in);

in :

the TpConnectionManagerParam to copy

Returns :

a newly (slice) allocated TpConnectionManagerParam, free with tp_connection_manager_param_free()

Since 0.11.3


tp_connection_manager_param_free ()

void                tp_connection_manager_param_free    (TpConnectionManagerParam *param);

Frees param, which was copied with tp_connection_manager_param_copy().

param :

the TpConnectionManagerParam to free

Since 0.11.3

Property Details

The "always-introspect" property

  "always-introspect"        gboolean              : Read / Write

If TRUE, always introspect the connection manager as it comes online, even if we already have its info from a .manager file. Default FALSE.

Default value: FALSE


The "cm-name" property

  "cm-name"                  gchar*                : Read

The name of the connection manager, e.g. "gabble" (read-only).

Default value: NULL

Since 0.19.3


The "info-source" property

  "info-source"              guint                 : Read

Where we got the current information on supported protocols (a TpCMInfoSource).

Since 0.7.26, the "notify" signal is emitted for this property.

(Note that this is of type G_TYPE_UINT, not TP_TYPE_CM_INFO_SOURCE, for historical reasons.)

Allowed values: <= 2

Default value: 0


The "manager-file" property

  "manager-file"             gchar*                : Read / Write / Construct

The absolute path of the .manager file. If set to NULL (the default), the XDG data directories will be searched for a .manager file of the correct name.

If set to the empty string, no .manager file will be read.

Default value: NULL

Signal Details

The "activated" signal

void                user_function                      (TpConnectionManager *self,
                                                        gpointer             user_data)      : Has Details

Emitted when the connection manager's well-known name appears on the bus.

self :

the connection manager proxy

user_data :

user data set when the signal handler was connected.

The "exited" signal

void                user_function                      (TpConnectionManager *self,
                                                        gpointer             user_data)      : Has Details

Emitted when the connection manager's well-known name disappears from the bus or when activation fails.

self :

the connection manager proxy

user_data :

user data set when the signal handler was connected.

The "got-info" signal

void                user_function                      (TpConnectionManager *self,
                                                        guint                source,
                                                        gpointer             user_data)      : Has Details

Emitted when the connection manager's capabilities have been discovered.

This signal is not very helpful. Using tp_proxy_prepare_async() instead is recommended.

self :

the connection manager proxy

source :

a TpCMInfoSource

user_data :

user data set when the signal handler was connected.

See Also

TpConnection