TpConnectionManager

## TpConnectionManager TpConnectionManager — proxy object for a Telepathy connection manager |

## Synopsis

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

    void                (*TpConnectionManagerListCb)        (TpConnectionManager * const *cms,
                                                             gsize n_cms,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    void                tp_list_connection_managers         (TpDBusDaemon *bus_daemon,
                                                             TpConnectionManagerListCb callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
                        TpConnectionManager;
                        TpConnectionManagerProtocol;
                        TpConnectionManagerParam;
                        TpConnectionManagerClass;
    enum                TpCMInfoSource;
    TpConnectionManager* tp_connection_manager_new          (TpDBusDaemon *dbus,
                                                             const gchar *name,
                                                             const gchar *manager_filename,
                                                             GError **error);
    gboolean            tp_connection_manager_activate      (TpConnectionManager *self);
    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_cli_connection_manager_callback_for_get_parameters)
                                                            (TpConnectionManager *proxy,
                                                             const GPtrArray *out0,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    TpProxyPendingCall* tp_cli_connection_manager_call_get_parameters
                                                            (TpConnectionManager *proxy,
                                                             gint timeout_ms,
                                                             const gchar *in_proto,
                                                             tp_cli_connection_manager_callback_for_get_parameters callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
    gboolean            tp_cli_connection_manager_run_get_parameters
                                                            (TpConnectionManager *proxy,
                                                             gint timeout_ms,
                                                             const gchar *in_proto,
                                                             GPtrArray **out0,
                                                             GError **error,
                                                             GMainLoop **loop);
    void                (*tp_cli_connection_manager_callback_for_list_protocols)
                                                            (TpConnectionManager *proxy,
                                                             const gchar **out0,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    TpProxyPendingCall* tp_cli_connection_manager_call_list_protocols
                                                            (TpConnectionManager *proxy,
                                                             gint timeout_ms,
                                                             tp_cli_connection_manager_callback_for_list_protocols callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
    gboolean            tp_cli_connection_manager_run_list_protocols
                                                            (TpConnectionManager *proxy,
                                                             gint timeout_ms,
                                                             gchar ***out0,
                                                             GError **error,
                                                             GMainLoop **loop);
    void                (*tp_cli_connection_manager_callback_for_request_connection)
                                                            (TpConnectionManager *proxy,
                                                             const gchar *out0,
                                                             const gchar *out1,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    TpProxyPendingCall* tp_cli_connection_manager_call_request_connection
                                                            (TpConnectionManager *proxy,
                                                             gint timeout_ms,
                                                             const gchar *in_proto,
                                                             GHashTable *in_parameters,
                                                             tp_cli_connection_manager_callback_for_request_connection callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
    gboolean            tp_cli_connection_manager_run_request_connection
                                                            (TpConnectionManager *proxy,
                                                             gint timeout_ms,
                                                             const gchar *in_proto,
                                                             GHashTable *in_parameters,
                                                             gchar **out0,
                                                             gchar **out1,
                                                             GError **error,
                                                             GMainLoop **loop);
    void                (*tp_cli_connection_manager_signal_callback_new_connection)
                                                            (TpConnectionManager *proxy,
                                                             const gchar *arg_bus_name,
                                                             const gchar *arg_object_path,
                                                             const gchar *arg_proto,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    TpProxySignalConnection* tp_cli_connection_manager_connect_to_new_connection
                                                            (TpConnectionManager *proxy,
                                                             tp_cli_connection_manager_signal_callback_new_connection callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object,
                                                             GError **error);

## Object Hierarchy

      GObject
       +----TpProxy
             +----TpConnectionManager

## Properties

      "always-introspect"        gboolean              : Read / Write
      "connection-manager"       gchararray            : Read
      "info-source"              guint                 : Read
      "manager-file"             gchararray            : Read / Write / Construct

## Signals

      "activated"                                      : Run Last / Has Details
      "exited"                                         : Run Last / Has Details
      "got-info"                                       : Run Last / Has Details

## Description

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

## Details

### TpConnectionManagerListCb ()

    void                (*TpConnectionManagerListCb)        (TpConnectionManager * const *cms,
                                                             gsize n_cms,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);

Signature of the callback supplied to `tp_list_connection_managers()`.

`cms` : | `NULL`-terminated array of TpConnectionManager (the objects will be unreferenced and the array will be freed after the callback returns, so the callback must reference any CMs it stores a pointer to), or `NULL` on error
`n_cms` : | number of connection managers in `cms` (not including the final `NULL`)
`error` : | `NULL` on success, or an error that occurred
`user_data` : | user-supplied data
`weak_object` : | user-supplied weakly referenced object

Since 0.7.1

### tp_list_connection_managers ()

    void                tp_list_connection_managers         (TpDBusDaemon *bus_daemon,
                                                             TpConnectionManagerListCb callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

List the available (running or installed) connection managers. Call the callback when done.

`bus_daemon` : | proxy for the D-Bus daemon
`callback` : | callback to be called when listing the CMs succeeds or fails; not called if the `weak_object` goes away
`user_data` : | user-supplied data for the callback
`destroy` : | callback to destroy the user-supplied data, called after `callback`, but also if the `weak_object` goes away
`weak_object` : | if not `NULL`, will be weakly referenced; the callback will not be called, and the call will be cancelled, if the object has vanished

Since 0.7.1

### TpConnectionManager

    typedef struct {
        TpProxy parent;

        const gchar *name;
        const TpConnectionManagerProtocol * const *protocols;

        gboolean running:1;
        gboolean always_introspect:1;
        TpCMInfoSource info_source:2;
        guint reserved_flags:28;

        TpConnectionManagerPrivate *priv;
    } 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.

On initialization, we find and read the .manager file, and emit got-info(FILE) on success, got-info(NONE) if no file or if reading the file failed.

When the CM runs, we automatically introspect it if `always_introspect` is `TRUE`. On success we emit got-info(LIVE). On failure, re-emit got-info(NONE) or got-info(FILE) as appropriate.

If we're asked to activate the CM, it'll implicitly be introspected.

If the CM exits, we still consider it to have been "introspected". If it's re-run, we introspect it again.

TpProxy `parent`; | The parent class instance
const gchar *`name`; | The identifier of the connection manager (e.g. "gabble"). Should be considered read-only
const TpConnectionManagerProtocol * const *`protocols`; | If info_source > `TP_CM_INFO_SOURCE_NONE`, a `NULL`-terminated array of pointers to TpConnectionManagerProtocol structures; otherwise `NULL`. Should be considered read-only
gboolean `running` :1; | `TRUE` if the CM is currently known to be running. Should be considered read-only
gboolean `always_introspect` :1; | `TRUE` if the CM will be introspected automatically. Should be considered read-only: use the "always-introspect" property if you want to change it
TpCMInfoSource `info_source` :2; | The source of `protocols`, or `TP_CM_INFO_SOURCE_NONE` if no info has been discovered yet
guint `reserved_flags` :28; | Reserved for future use
TpConnectionManagerPrivate *`priv`; | Pointer to opaque private data

Since 0.7.1

### TpConnectionManagerProtocol

    typedef struct {
      gchar *name;
      TpConnectionManagerParam *params;
    } TpConnectionManagerProtocol;

Structure representing a protocol supported by a connection manager. Note that the size of this structure may change, so its size must not be relied on.

gchar *`name`; | The name of this connection manager
TpConnectionManagerParam *`params`; | Array of TpConnectionManagerParam structures, terminated by a structure whose `name` is `NULL`

Since 0.7.1

### TpConnectionManagerParam

    typedef struct {
      gchar *name;
      gchar *dbus_signature;
      GValue default_value;
      guint flags;

      gpointer priv;
    } TpConnectionManagerParam;

Structure representing a connection manager parameter.

gchar *`name`; | The name of this parameter
gchar *`dbus_signature`; | This parameter's D-Bus signature
GValue `default_value`; | This parameter's default value, or an arbitrary value of an appropriate type if `TP_CONN_MGR_PARAM_FLAG_HAS_DEFAULT` is not set on this parameter, or an unset GValue if the signature is not recognised by telepathy-glib
guint `flags`; | This parameter's flags (a combination of TpConnMgrParamFlags)
gpointer `priv`; | Pointer to opaque private data

Since 0.7.1

### TpConnectionManagerClass

    typedef struct {
    } TpConnectionManagerClass;

The class of a TpConnectionManager.

Since 0.7.1

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

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

`dbus` : | Proxy for the D-Bus daemon
`name` : | The connection manager name
`manager_filename` : | The "manager-file" property
`error` : | used to return an error if `NULL` is returned
Returns : | a new reference to a connection manager proxy

### tp_connection_manager_activate ()

    gboolean            tp_connection_manager_activate      (TpConnectionManager *self);

Attempt to run and introspect the connection manager, asynchronously.

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

`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_cli_connection_manager_callback_for_get_parameters ()

    void                (*tp_cli_connection_manager_callback_for_get_parameters)
                                                            (TpConnectionManager *proxy,
                                                             const GPtrArray *out0,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);

Signature of the callback called when a GetParameters method call succeeds or fails.

`proxy` : | the proxy on which the call was made
`out0` : | Used to return an 'out' argument if `error` is `NULL`: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> An array of structs representing possible parameters.
`error` : | `NULL` on success, or an error on failure
`user_data` : | user-supplied data
`weak_object` : | user-supplied object

### tp_cli_connection_manager_call_get_parameters ()

    TpProxyPendingCall* tp_cli_connection_manager_call_get_parameters
                                                            (TpConnectionManager *proxy,
                                                             gint timeout_ms,
                                                             const gchar *in_proto,
                                                             tp_cli_connection_manager_callback_for_get_parameters callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

Start a GetParameters method call.

Get a list of the parameters which must or may be provided to the RequestConnection method when connecting to the given protocol, or registering (the boolean &quot;register&quot; parameter is available, and set to true).

`proxy` : | the TpProxy
`timeout_ms` : | the timeout in milliseconds, or -1 to use the default
`in_proto` : | Used to pass an 'in' argument: The required protocol name
`callback` : | called when the method call succeeds or fails
`user_data` : | user-supplied data passed to the callback
`destroy` : | called with the user_data as argument, after the call has succeeded, failed or been cancelled
`weak_object` : | A GObject which will be weakly referenced; if it is destroyed, this callback will automatically be disconnected
Returns : | a TpProxyPendingCall representing the call in progress. It is borrowed from the object, and will become invalid when the callback is called, the call is cancelled or the TpProxy becomes invalid.

### tp_cli_connection_manager_run_get_parameters ()

    gboolean            tp_cli_connection_manager_run_get_parameters
                                                            (TpConnectionManager *proxy,
                                                             gint timeout_ms,
                                                             const gchar *in_proto,
                                                             GPtrArray **out0,
                                                             GError **error,
                                                             GMainLoop **loop);

Call the method GetParameters and run the main loop until it returns. Before calling this method, you must add a reference to any borrowed objects you need to keep, and generally ensure that everything is in a consistent state.

Get a list of the parameters which must or may be provided to the RequestConnection method when connecting to the given protocol, or registering (the boolean &quot;register&quot; parameter is available, and set to true).

`proxy` : | A TpConnectionManager or subclass
`timeout_ms` : | Timeout in milliseconds, or -1 for default
`in_proto` : | Used to pass an 'in' argument: The required protocol name
`out0` : | Used to return an 'out' argument if `TRUE` is returned: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> An array of structs representing possible parameters.
`error` : | If not `NULL`, used to return errors if `FALSE` is returned
`loop` : | If not `NULL`, set before re-entering the main loop, to point to a GMainLoop which can be used to cancel this call with `g_main_loop_quit()`, causing a return of `FALSE` with `error` set to `TP_DBUS_ERROR_CANCELLED`
Returns : | TRUE on success, FALSE and sets `error` on error

### tp_cli_connection_manager_callback_for_list_protocols ()

    void                (*tp_cli_connection_manager_callback_for_list_protocols)
                                                            (TpConnectionManager *proxy,
                                                             const gchar **out0,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);

Signature of the callback called when a ListProtocols method call succeeds or fails.

`proxy` : | the proxy on which the call was made
`out0` : | Used to return an 'out' argument if `error` is `NULL`: A array of string protocol identifiers supported by this manager
`error` : | `NULL` on success, or an error on failure
`user_data` : | user-supplied data
`weak_object` : | user-supplied object

### tp_cli_connection_manager_call_list_protocols ()

    TpProxyPendingCall* tp_cli_connection_manager_call_list_protocols
                                                            (TpConnectionManager *proxy,
                                                             gint timeout_ms,
                                                             tp_cli_connection_manager_callback_for_list_protocols callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

Start a ListProtocols method call.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> Get a list of protocol identifiers that are implemented by this connection manager. The following well-known values should be used when applicable:

`proxy` : | the TpProxy
`timeout_ms` : | the timeout in milliseconds, or -1 to use the default
`callback` : | called when the method call succeeds or fails
`user_data` : | user-supplied data passed to the callback
`destroy` : | called with the user_data as argument, after the call has succeeded, failed or been cancelled
`weak_object` : | A GObject which will be weakly referenced; if it is destroyed, this callback will automatically be disconnected
Returns : | a TpProxyPendingCall representing the call in progress. It is borrowed from the object, and will become invalid when the callback is called, the call is cancelled or the TpProxy becomes invalid.

### tp_cli_connection_manager_run_list_protocols ()

    gboolean            tp_cli_connection_manager_run_list_protocols
                                                            (TpConnectionManager *proxy,
                                                             gint timeout_ms,
                                                             gchar ***out0,
                                                             GError **error,
                                                             GMainLoop **loop);

Call the method ListProtocols and run the main loop until it returns. Before calling this method, you must add a reference to any borrowed objects you need to keep, and generally ensure that everything is in a consistent state.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> Get a list of protocol identifiers that are implemented by this connection manager. The following well-known values should be used when applicable:

`proxy` : | A TpConnectionManager or subclass
`timeout_ms` : | Timeout in milliseconds, or -1 for default
`out0` : | Used to return an 'out' argument if `TRUE` is returned: A array of string protocol identifiers supported by this manager
`error` : | If not `NULL`, used to return errors if `FALSE` is returned
`loop` : | If not `NULL`, set before re-entering the main loop, to point to a GMainLoop which can be used to cancel this call with `g_main_loop_quit()`, causing a return of `FALSE` with `error` set to `TP_DBUS_ERROR_CANCELLED`
Returns : | TRUE on success, FALSE and sets `error` on error

### tp_cli_connection_manager_callback_for_request_connection ()

    void                (*tp_cli_connection_manager_callback_for_request_connection)
                                                            (TpConnectionManager *proxy,
                                                             const gchar *out0,
                                                             const gchar *out1,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);

Signature of the callback called when a RequestConnection method call succeeds or fails.

`proxy` : | the proxy on which the call was made
`out0` : | Used to return an 'out' argument if `error` is `NULL`: A D-Bus service name where the new Connection object can be found
`out1` : | Used to return an 'out' argument if `error` is `NULL`: The D-Bus object path to the Connection on this service
`error` : | `NULL` on success, or an error on failure
`user_data` : | user-supplied data
`weak_object` : | user-supplied object

### tp_cli_connection_manager_call_request_connection ()

    TpProxyPendingCall* tp_cli_connection_manager_call_request_connection
                                                            (TpConnectionManager *proxy,
                                                             gint timeout_ms,
                                                             const gchar *in_proto,
                                                             GHashTable *in_parameters,
                                                             tp_cli_connection_manager_callback_for_request_connection callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

Start a RequestConnection method call.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Request a Connection object representing a given account on a given protocol with the given parameters. The method returns the bus name and the object path where the new Connection object can be found, which should have the status of Connection_Status_Disconnected, to allow signal handlers to be attached before connecting is started with the Connect method.</p> <p>In order to allow Connection objects to be discovered by new clients, the object path and well-known bus name must be of the form <code>/org/freedesktop/Telepathy/Connection/cmname/proto/account</code> and <code>org.freedesktop.Telepathy.Connection.cmname.proto.account</code> where:</p> <ul> <li><em>cmname</em> is the same connection manager name that appears in the connection manager's object path and well-known bus name</li> <li><em>proto</em> is the protocol name as seen in ListProtocols, but with &quot;-&quot; replaced with &quot;_&quot; to get a valid object path/bus name</li> <li><em>account</em> SHOULD be a series of elements formed such that any valid distinct connection instance on this protocol has a distinct name; this might be formed by including the server name followed by the user name (escaped via some suitable mechanism like telepathy-glib's `tp_escape_as_identifier()` function to preserve uniqueness), or on protocols where connecting multiple times is permissable, a per-connection identifier might be necessary to ensure uniqueness</li> </ul> <p>Clients MUST NOT attempt to parse the <em>account</em> part of the bus name. Connection managers MAY use any unique string for this part.</p> <p>The parameters which must and may be provided in the parameters dictionary can be discovered with the GetParameters method. These parameters, their types, and their default values may be cached in files so that all available connection managers do not need to be started to discover which protocols are available.</p> <p>To request values for these parameters from the user, a client must have prior knowledge of the meaning of the parameter names, so the following well-known names and types should be used where appropriate:</p> <dl> <dt>s:account</dt> <dd>The identifier for the user's account on the server</dd> <dt>s:server</dt><dd>A fully qualified domain name or numeric IPv4 or IPv6 address. Using the fully-qualified domain name form is recommended whenever possible. If this parameter is specified and the account for that protocol also specifies a server, this parameter should override that in the user id.</dd> <dt>q:port</dt><dd>A TCP or UDP port number. If this parameter is specified and the account for that protocol also specifies a port, this parameter should override that in the account.</dd> <dt>s:password</dt><dd>A password associated with the account.</dd> <dt>b:require-encryption</dt><dd>Require encryption for this connection. A connection should fail to connect if require-encryption is set and an encrypted connection is not possible.</dd> <dt>b:register</dt><dd>This account should be created on the server if it does not already exist.</dd> <dt>s:ident</dt><dd>The local username to report to the server if necessary, such as in IRC.</dd> <dt>s:fullname</dt><dd>The user's full name if the service requires this when authenticating or registering.</dd> <dt>s:stun-server</dt><dd>The IP address or FQDN of a STUN server to use for NAT traversal, without any &quot;:port&quot; suffix.</dd> <dt>q:stun-port</dt><dd>The UDP port number on the stun-server to use for STUN. Only significant if the stun-server is also supplied.</dd> </dl> <p>Every successful RequestConnection call will cause the emission of a NewConnection signal for the same newly created connection. The requester can use the returned object path and service name independently of the emission of that signal. In that case this signal emission is most useful for, e.g. other processes that are monitoring the creation of new connections.</p>

`proxy` : | the TpProxy
`timeout_ms` : | the timeout in milliseconds, or -1 to use the default
`in_proto` : | Used to pass an 'in' argument: The protocol identifier
`in_parameters` : | Used to pass an 'in' argument: A dictionary mapping parameter name to the variant boxed value
`callback` : | called when the method call succeeds or fails
`user_data` : | user-supplied data passed to the callback
`destroy` : | called with the user_data as argument, after the call has succeeded, failed or been cancelled
`weak_object` : | A GObject which will be weakly referenced; if it is destroyed, this callback will automatically be disconnected
Returns : | a TpProxyPendingCall representing the call in progress. It is borrowed from the object, and will become invalid when the callback is called, the call is cancelled or the TpProxy becomes invalid.

### tp_cli_connection_manager_run_request_connection ()

    gboolean            tp_cli_connection_manager_run_request_connection
                                                            (TpConnectionManager *proxy,
                                                             gint timeout_ms,
                                                             const gchar *in_proto,
                                                             GHashTable *in_parameters,
                                                             gchar **out0,
                                                             gchar **out1,
                                                             GError **error,
                                                             GMainLoop **loop);

Call the method RequestConnection and run the main loop until it returns. Before calling this method, you must add a reference to any borrowed objects you need to keep, and generally ensure that everything is in a consistent state.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Request a Connection object representing a given account on a given protocol with the given parameters. The method returns the bus name and the object path where the new Connection object can be found, which should have the status of Connection_Status_Disconnected, to allow signal handlers to be attached before connecting is started with the Connect method.</p> <p>In order to allow Connection objects to be discovered by new clients, the object path and well-known bus name must be of the form <code>/org/freedesktop/Telepathy/Connection/cmname/proto/account</code> and <code>org.freedesktop.Telepathy.Connection.cmname.proto.account</code> where:</p> <ul> <li><em>cmname</em> is the same connection manager name that appears in the connection manager's object path and well-known bus name</li> <li><em>proto</em> is the protocol name as seen in ListProtocols, but with &quot;-&quot; replaced with &quot;_&quot; to get a valid object path/bus name</li> <li><em>account</em> SHOULD be a series of elements formed such that any valid distinct connection instance on this protocol has a distinct name; this might be formed by including the server name followed by the user name (escaped via some suitable mechanism like telepathy-glib's `tp_escape_as_identifier()` function to preserve uniqueness), or on protocols where connecting multiple times is permissable, a per-connection identifier might be necessary to ensure uniqueness</li> </ul> <p>Clients MUST NOT attempt to parse the <em>account</em> part of the bus name. Connection managers MAY use any unique string for this part.</p> <p>The parameters which must and may be provided in the parameters dictionary can be discovered with the GetParameters method. These parameters, their types, and their default values may be cached in files so that all available connection managers do not need to be started to discover which protocols are available.</p> <p>To request values for these parameters from the user, a client must have prior knowledge of the meaning of the parameter names, so the following well-known names and types should be used where appropriate:</p> <dl> <dt>s:account</dt> <dd>The identifier for the user's account on the server</dd> <dt>s:server</dt><dd>A fully qualified domain name or numeric IPv4 or IPv6 address. Using the fully-qualified domain name form is recommended whenever possible. If this parameter is specified and the account for that protocol also specifies a server, this parameter should override that in the user id.</dd> <dt>q:port</dt><dd>A TCP or UDP port number. If this parameter is specified and the account for that protocol also specifies a port, this parameter should override that in the account.</dd> <dt>s:password</dt><dd>A password associated with the account.</dd> <dt>b:require-encryption</dt><dd>Require encryption for this connection. A connection should fail to connect if require-encryption is set and an encrypted connection is not possible.</dd> <dt>b:register</dt><dd>This account should be created on the server if it does not already exist.</dd> <dt>s:ident</dt><dd>The local username to report to the server if necessary, such as in IRC.</dd> <dt>s:fullname</dt><dd>The user's full name if the service requires this when authenticating or registering.</dd> <dt>s:stun-server</dt><dd>The IP address or FQDN of a STUN server to use for NAT traversal, without any &quot;:port&quot; suffix.</dd> <dt>q:stun-port</dt><dd>The UDP port number on the stun-server to use for STUN. Only significant if the stun-server is also supplied.</dd> </dl> <p>Every successful RequestConnection call will cause the emission of a NewConnection signal for the same newly created connection. The requester can use the returned object path and service name independently of the emission of that signal. In that case this signal emission is most useful for, e.g. other processes that are monitoring the creation of new connections.</p>

`proxy` : | A TpConnectionManager or subclass
`timeout_ms` : | Timeout in milliseconds, or -1 for default
`in_proto` : | Used to pass an 'in' argument: The protocol identifier
`in_parameters` : | Used to pass an 'in' argument: A dictionary mapping parameter name to the variant boxed value
`out0` : | Used to return an 'out' argument if `TRUE` is returned: A D-Bus service name where the new Connection object can be found
`out1` : | Used to return an 'out' argument if `TRUE` is returned: The D-Bus object path to the Connection on this service
`error` : | If not `NULL`, used to return errors if `FALSE` is returned
`loop` : | If not `NULL`, set before re-entering the main loop, to point to a GMainLoop which can be used to cancel this call with `g_main_loop_quit()`, causing a return of `FALSE` with `error` set to `TP_DBUS_ERROR_CANCELLED`
Returns : | TRUE on success, FALSE and sets `error` on error

### tp_cli_connection_manager_signal_callback_new_connection ()

    void                (*tp_cli_connection_manager_signal_callback_new_connection)
                                                            (TpConnectionManager *proxy,
                                                             const gchar *arg_bus_name,
                                                             const gchar *arg_object_path,
                                                             const gchar *arg_proto,
                                                             gpointer user_data,
                                                             GObject *weak_object);

Represents the signature of a callback for the signal NewConnection.

`proxy` : | The proxy on which `tp_cli_connection_manager_connect_to_new_connection()` was called
`arg_bus_name` : | The D-Bus service where the connection object can be found
`arg_object_path` : | The object path of the Connection object on this service
`arg_proto` : | The identifier for the protocol this connection uses
`user_data` : | User-supplied data
`weak_object` : | User-supplied weakly referenced object

### tp_cli_connection_manager_connect_to_new_connection ()

    TpProxySignalConnection* tp_cli_connection_manager_connect_to_new_connection
                                                            (TpConnectionManager *proxy,
                                                             tp_cli_connection_manager_signal_callback_new_connection callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object,
                                                             GError **error);

Connect a handler to the signal NewConnection.

Emitted when a new Connection object is created.

`proxy` : | A TpConnectionManager or subclass
`callback` : | Callback to be called when the signal is received
`user_data` : | User-supplied data for the callback
`destroy` : | Destructor for the user-supplied data, which will be called when this signal is disconnected, or before this function returns `NULL`
`weak_object` : | A GObject which will be weakly referenced; if it is destroyed, this callback will automatically be disconnected
`error` : | If not `NULL`, used to raise an error if `NULL` is returned
Returns : | a TpProxySignalConnection containing all of the above, which can be used to disconnect the signal; or `NULL` if the proxy does not have the desired interface or has become invalid.

## Property Details

### The `"always-introspect"` property

      "always-introspect"        gboolean              : Read / Write

Opportunistically introspect the CM when it's run.

Default value: FALSE

### The `"connection-manager"` property

      "connection-manager"       gchararray            : Read

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

Default value: NULL

### The `"info-source"` property

      "info-source"              guint                 : Read

Where we got the current information on supported protocols.

Allowed values: <= 2

Default value: 0

### The `"manager-file"` property

      "manager-file"             gchararray            : Read / Write / Construct

The .manager filename.

Default value: NULL

## Signal Details

### The `"activated"` signal

    void                user_function                      (TpConnectionManager *self,
                                                            gpointer             user_data)      : Run Last / 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)      : Run Last / 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)      : Run Last / Has Details

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

`self` : | the connection manager proxy
`source` : | a TpCMInfoSource
`user_data` : | user data set when the signal handler was connected.

## See Also

TpConnection