TpConnectionManager

TpConnectionManager — proxy object for a Telepathy connection manager

Functions

Properties

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

Signals

void activated Has Details
void exited Has Details
void got-info Has Details

Types and Values

Object Hierarchy

    GBoxed
    ╰── TpConnectionManagerParam
    GEnum
    ╰── TpCMInfoSource
    GObject
    ╰── TpProxy
        ╰── TpConnectionManager

Includes

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

Description

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

Functions

tp_list_connection_managers_async ()

void
tp_list_connection_managers_async (TpClientFactory *factory,
                                   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.

factory will be used to create the TpConnectionManager objects using tp_client_factory_ensure_connection_manager().

Parameters

factory

a TpClientFactory

 

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).

Parameters

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


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.

Parameters

self

a connection manager

 

Returns

the “cm-name” property

Since 0.7.26


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.

Parameters

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.

Parameters

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.

Parameters

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).

Parameters

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.

Parameters

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.

Parameters

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.

Parameters

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


tp_connection_manager_param_get_name ()

const gchar *
tp_connection_manager_param_get_name (const TpConnectionManagerParam *param);

Parameters

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);

Parameters

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);

Parameters

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);

Parameters

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);

Parameters

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);

Parameters

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_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.

Parameters

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.

Parameters

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.

Parameters

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_param_copy ()

TpConnectionManagerParam *
tp_connection_manager_param_copy (const TpConnectionManagerParam *in);

Parameters

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().

Parameters

param

the TpConnectionManagerParam to free

 

Since 0.11.3


tp_connection_manager_param_dup_variant_type ()

GVariantType *
tp_connection_manager_param_dup_variant_type
                               (const TpConnectionManagerParam *param);

Parameters

param

a parameter supported by a TpConnectionManager

 

Returns

the GVariantType of the parameter.

[transfer full]

Since 0.23.1

Types and Values

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_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

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.

Members

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


TpConnectionManagerParam

typedef struct _TpConnectionManagerParam TpConnectionManagerParam;

Structure representing a connection manager parameter.

Since 0.7.1

Property Details

The “always-introspect” property

  “always-introspect”        gboolean

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

Flags: Read / Write

Default value: FALSE


The “cm-name” property

  “cm-name”                  gchar *

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

Flags: Read

Default value: NULL

Since 0.19.3


The “info-source” property

  “info-source”              guint

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.)

Flags: Read

Allowed values: <= 2

Default value: 0


The “manager-file” property

  “manager-file”             gchar *

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.

Flags: Read / Write / Construct

Default value: NULL

Signal Details

The “activated” signal

void
user_function (TpConnectionManager *self,
               gpointer             user_data)

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

Parameters

self

the connection manager proxy

 

user_data

user data set when the signal handler was connected.

 

Flags: Has Details


The “exited” signal

void
user_function (TpConnectionManager *self,
               gpointer             user_data)

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

Parameters

self

the connection manager proxy

 

user_data

user data set when the signal handler was connected.

 

Flags: Has Details


The “got-info” signal

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

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

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

Parameters

self

the connection manager proxy

 

source

a TpCMInfoSource

 

user_data

user data set when the signal handler was connected.

 

Flags: Has Details

See Also

TpConnection