Connection interface

Connection interface — client-side wrappers for Connection core functionality

Functions

Object Hierarchy


Includes

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

Description

This section documents the auto-generated C wrappers for the Connection D-Bus interface. These are not generally useful (the TpConnection object provides a more convenient API for them).

Functions

tp_cli_connection_callback_for_connect ()

void
(*tp_cli_connection_callback_for_connect)
                               (TpConnection *proxy,
                                const GError *error,
                                gpointer user_data,
                                GObject *weak_object);

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

Parameters

proxy

the proxy on which the call was made

 

error

NULL on success, or an error on failure

 

user_data

user-supplied data

 

weak_object

user-supplied object

 

tp_cli_connection_call_connect ()

TpProxyPendingCall *
tp_cli_connection_call_connect (TpConnection *proxy,
                                gint timeout_ms,
                                tp_cli_connection_callback_for_connect callback,
                                gpointer user_data,
                                GDestroyNotify destroy,
                                GObject *weak_object);

Start a Connect method call.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Request that the connection be established. This will be done asynchronously and errors will be returned by emitting <tp:member-ref>StatusChanged</tp:member-ref> signals.</p> <p>Calling this method on a Connection that is already connecting or connected is allowed, and has no effect.</p>

Parameters

proxy

the TpProxy

 

timeout_ms

the timeout in milliseconds, or -1 to use the default

 

callback

called when the method call succeeds or fails; may be NULL to make a "fire and forget" call with no reply tracking

 

user_data

user-supplied data passed to the callback; must be NULL if callback is NULL

 

destroy

called with the user_data as argument, after the call has succeeded, failed or been cancelled; must be NULL if callback is NULL

 

weak_object

If not NULL, a GObject which will be weakly referenced; if it is destroyed, this call will automatically be cancelled. Must be NULL if callback is NULL

 

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

void
(*tp_cli_connection_callback_for_disconnect)
                               (TpConnection *proxy,
                                const GError *error,
                                gpointer user_data,
                                GObject *weak_object);

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

Parameters

proxy

the proxy on which the call was made

 

error

NULL on success, or an error on failure

 

user_data

user-supplied data

 

weak_object

user-supplied object

 

tp_cli_connection_call_disconnect ()

TpProxyPendingCall *
tp_cli_connection_call_disconnect (TpConnection *proxy,
                                   gint timeout_ms,
                                   tp_cli_connection_callback_for_disconnect callback,
                                   gpointer user_data,
                                   GDestroyNotify destroy,
                                   GObject *weak_object);

Start a Disconnect method call.

Request that the connection be closed. This closes the connection if it's not already in DISCONNECTED state, and destroys the connection object.

Parameters

proxy

the TpProxy

 

timeout_ms

the timeout in milliseconds, or -1 to use the default

 

callback

called when the method call succeeds or fails; may be NULL to make a "fire and forget" call with no reply tracking

 

user_data

user-supplied data passed to the callback; must be NULL if callback is NULL

 

destroy

called with the user_data as argument, after the call has succeeded, failed or been cancelled; must be NULL if callback is NULL

 

weak_object

If not NULL, a GObject which will be weakly referenced; if it is destroyed, this call will automatically be cancelled. Must be NULL if callback is NULL

 

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

void
(*tp_cli_connection_signal_callback_self_contact_changed)
                               (TpConnection *proxy,
                                guint arg_Self_Handle,
                                const gchar *arg_Self_ID,
                                gpointer user_data,
                                GObject *weak_object);

Represents the signature of a callback for the signal SelfContactChanged.

Parameters

proxy

The proxy on which tp_cli_connection_connect_to_self_contact_changed() was called

 

arg_Self_Handle

The new value of the SelfHandle property. (TpContactHandle)

 

arg_Self_ID

The new value of the SelfID property.

 

user_data

User-supplied data

 

weak_object

User-supplied weakly referenced object

 

tp_cli_connection_connect_to_self_contact_changed ()

TpProxySignalConnection *
tp_cli_connection_connect_to_self_contact_changed
                               (TpConnection *proxy,
                                tp_cli_connection_signal_callback_self_contact_changed callback,
                                gpointer user_data,
                                GDestroyNotify destroy,
                                GObject *weak_object,
                                GError **error);

Connect a handler to the signal SelfContactChanged.

Emitted whenever the <tp:member-ref>SelfHandle</tp:member-ref> and <tp:member-ref>SelfID</tp:member-ref> property changes. If the connection is not yet in the CONNECTED state, this signal is not guaranteed to be emitted.

Parameters

proxy

A TpConnection 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.


tp_cli_connection_signal_callback_status_changed ()

void
(*tp_cli_connection_signal_callback_status_changed)
                               (TpConnection *proxy,
                                guint arg_Status,
                                guint arg_Reason,
                                gpointer user_data,
                                GObject *weak_object);

Represents the signature of a callback for the signal StatusChanged.

Parameters

proxy

The proxy on which tp_cli_connection_connect_to_status_changed() was called

 

arg_Status

An integer indicating the new status, as defined by ConnectionStatus (TpConnectionStatus)

 

arg_Reason

An integer indicating the reason for the status change, as defined by ConnectionStatusReason (TpConnectionStatusReason)

 

user_data

User-supplied data

 

weak_object

User-supplied weakly referenced object

 

tp_cli_connection_connect_to_status_changed ()

TpProxySignalConnection *
tp_cli_connection_connect_to_status_changed
                               (TpConnection *proxy,
                                tp_cli_connection_signal_callback_status_changed callback,
                                gpointer user_data,
                                GDestroyNotify destroy,
                                GObject *weak_object,
                                GError **error);

Connect a handler to the signal StatusChanged.

Emitted when the status of the connection changes. All states and reasons have numerical values, as defined in ConnectionStatus and ConnectionStatusReason.

Parameters

proxy

A TpConnection 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.


tp_cli_connection_signal_callback_connection_error ()

void
(*tp_cli_connection_signal_callback_connection_error)
                               (TpConnection *proxy,
                                const gchar *arg_Error,
                                GHashTable *arg_Details,
                                gpointer user_data,
                                GObject *weak_object);

Represents the signature of a callback for the signal ConnectionError.

Parameters

proxy

The proxy on which tp_cli_connection_connect_to_connection_error() was called

 

arg_Error

The name of a D-Bus error describing the error that occurred, which may correspond to a <tp:type>Connection_Status_Reason</tp:type>, or may be a more specific Telepathy error (such as <code>im.telepathy.v1.Error.ConnectionRefused</code> for Connection_Status_Reason_Network_Error) or a protocol-specific or connection-manager-specific error in a suitable namespace. <tp:rationale> For instance, a SIP connection manager could signal &quot;402 Payment Required&quot; as an error in a connection-manager-specific namespace, or a link-local XMPP implementation that used Avahi could provide the error given to it by the avahi-daemon. </tp:rationale>

 

arg_Details

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Additional information about the error, which may include the following well-known keys:</p> <dl> <dt>debug-message (s)</dt> <dd>Debugging information on the change, corresponding to the message part of a D-Bus error message, which SHOULD NOT be displayed to users under normal circumstances</dd> <dt>server-message (s)</dt> <dd>A human-readable message from the server explaining what happened. This may be in the user's native language, or in the server operator's native language, or even in Lojban.</dd> <dt>user-requested (b), expected-hostname (s), certificate-hostname (s)</dt> <dd>The same details defined in <tp:type>TLS_Certificate_Rejection</tp:type>.</dd> </dl>

 

user_data

User-supplied data

 

weak_object

User-supplied weakly referenced object

 

tp_cli_connection_connect_to_connection_error ()

TpProxySignalConnection *
tp_cli_connection_connect_to_connection_error
                               (TpConnection *proxy,
                                tp_cli_connection_signal_callback_connection_error callback,
                                gpointer user_data,
                                GDestroyNotify destroy,
                                GObject *weak_object,
                                GError **error);

Connect a handler to the signal ConnectionError.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Emitted when an error occurs that renders this connection unusable. </p> <p>Whenever this signal is emitted, it MUST immediately be followed by a <tp:member-ref>StatusChanged</tp:member-ref> signal with status Connection_Status_Disconnected and an appropriate reason code.</p> <p>Connection managers SHOULD emit this signal on disconnection, but need not do so. Clients MUST support connection managers that emit StatusChanged(Disconnected, ...) without first emitting ConnectionError.</p> <tp:rationale> <p>This signal provides additional information about the reason for disconnection. The reason for connection is always straightforward - it was requested - so it does not need further explanation. However, on errors, it can be useful to provide additional information.</p> <p>The <tp:type>Connection_Status_Reason</tp:type> is not given here, since it will be signalled in <tp:member-ref>StatusChanged</tp:member-ref>. A reasonable client implementation would be to store the information given by this signal until StatusChanged is received, at which point the information given by this signal can be used to supplement the StatusChanged signal.</p> </tp:rationale>

Parameters

proxy

A TpConnection 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.


tp_cli_connection_call_add_client_interest ()

TpProxyPendingCall *
tp_cli_connection_call_add_client_interest
                               (TpConnection *proxy,
                                gint timeout_ms,
                                const gchar **in_Tokens,
                                tp_cli_connection_callback_for_add_client_interest callback,
                                gpointer user_data,
                                GDestroyNotify destroy,
                                GObject *weak_object);

Start a AddClientInterest method call.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Register a client's interest in notifications related to one or more interfaces.</p> <p>Groups of notifications are identified by a token which is either a D-Bus interface name, or a string that starts with a D-Bus interface name. The meaning of each token is given by that D-Bus interface, which MUST define it in its documentation.</p> <tp:rationale> <p>Initially, all interests are in entire interface, but allowing other strings allows subscription to part of an interface; for instance, an interest in ...MailNotification/count could track the number of messages without caring about their detailed content.</p> </tp:rationale> <p>For each token with which this method interacts, the Connection tracks an &quot;interest count&quot; (like a reference count) for each unique bus name that has called this method. When a client calls this method, for each token, the interest count for its unique bus name is incremented; when <tp:member-ref>RemoveClientInterest</tp:member-ref> is called, all interest counts for that unique bus name are decremented. If the unique bus name leaves the bus (for instance, if the client crashes or exits), all interest counts for that unique bus name are set to zero.</p> <p>The Connection can then use these reference counts to avoid subscribing to protocol-level notifications unless at least one client has a non-zero interest count for the relevant token.</p> <tp:rationale> <p>This method exists to reduce memory and network overhead when there is no active subscription.</p> <p>One situation where this is useful is <tp:dbus-ref namespace="im.telepathy.v1.Connection.Interface">Location1</tp:dbus-ref>: on XMPP, location updates are received over PEP. If the Connection advertises the <code>geoloc+notify</code> capability, it will be sent location updates for all contacts. To avoid consuming resources for this, the connection should avoid advertising that capability until a client has expressed an interest in contacts' locations.</p> <p>Another example of a protocol that benefits from this method is the Google XMPP Mail Notification extension, which can be used to implement <tp:dbus-ref namespace="im.telepathy.v1.Connection.Interface">MailNotification1</tp:dbus-ref>. In this protocol, the CM receives a notification that something has changed, but to get more information, the CM must request this information. Knowing that nobody is currently interested in this information, the CM can avoid generating useless network traffic. Similarly, the CM may free the list of unread messages to reduce memory overhead.</p> </tp:rationale> <p>If this method is called for an interface that might require protocol-level subscription, but the connection cannot set up that subscription yet (for instance because the <tp:member-ref>Status</tp:member-ref> is not Connected yet), the Connection MUST remember the client's interest, and attempt to subscribe to the appropriate protocol feature when this becomes possible.</p> <p>Clients MAY ignore any errors raised by this method; it is intended to be called with the reply ignored.</p> <tp:rationale> <p>The only reason it could fail is if it's unimplemented, in which case the only thing the client can usefully do is to proceed as if it had succeeded.</p> </tp:rationale>

Parameters

proxy

the TpProxy

 

timeout_ms

the timeout in milliseconds, or -1 to use the default

 

in_Tokens

Used to pass an 'in' argument: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Interfaces or parts of interfaces in which to register an interest, represented by either a <tp:type>DBus_Interface</tp:type>, or a string prefixed with a <tp:type>DBus_Interface</tp:type>.</p> <p>If the Connection does not support one of these tokens, this is not considered to be an error; the unsupported token is simply ignored.</p>

 

callback

called when the method call succeeds or fails; may be NULL to make a "fire and forget" call with no reply tracking

 

user_data

user-supplied data passed to the callback; must be NULL if callback is NULL

 

destroy

called with the user_data as argument, after the call has succeeded, failed or been cancelled; must be NULL if callback is NULL

 

weak_object

If not NULL, a GObject which will be weakly referenced; if it is destroyed, this call will automatically be cancelled. Must be NULL if callback is NULL

 

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

TpProxyPendingCall *
tp_cli_connection_call_remove_client_interest
                               (TpConnection *proxy,
                                gint timeout_ms,
                                const gchar **in_Tokens,
                                tp_cli_connection_callback_for_remove_client_interest callback,
                                gpointer user_data,
                                GDestroyNotify destroy,
                                GObject *weak_object);

Start a RemoveClientInterest method call.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Release an interest registered using <tp:member-ref>AddClientInterest</tp:member-ref>. See that method's documentation for details.</p> <p>Clients MAY ignore any errors raised by this method; it is intended to be called with the reply ignored.</p> <tp:rationale> <p>The only reasons it could fail are if it's unimplemented, or if the client's reference-counting is wrong and it has tried to remove a client interest that it did not add. In both cases, there's nothing the client could do about it.</p> </tp:rationale>

Parameters

proxy

the TpProxy

 

timeout_ms

the timeout in milliseconds, or -1 to use the default

 

in_Tokens

Used to pass an 'in' argument: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Interfaces or parts of interfaces that were previously passed to <tp:member-ref>AddClientInterest</tp:member-ref>.</p>

 

callback

called when the method call succeeds or fails; may be NULL to make a "fire and forget" call with no reply tracking

 

user_data

user-supplied data passed to the callback; must be NULL if callback is NULL

 

destroy

called with the user_data as argument, after the call has succeeded, failed or been cancelled; must be NULL if callback is NULL

 

weak_object

If not NULL, a GObject which will be weakly referenced; if it is destroyed, this call will automatically be cancelled. Must be NULL if callback is NULL

 

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

void
(*tp_cli_connection_callback_for_add_client_interest)
                               (TpConnection *proxy,
                                const GError *error,
                                gpointer user_data,
                                GObject *weak_object);

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

Parameters

proxy

the proxy on which the call was made

 

error

NULL on success, or an error on failure

 

user_data

user-supplied data

 

weak_object

user-supplied object

 

tp_cli_connection_callback_for_remove_client_interest ()

void
(*tp_cli_connection_callback_for_remove_client_interest)
                               (TpConnection *proxy,
                                const GError *error,
                                gpointer user_data,
                                GObject *weak_object);

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

Parameters

proxy

the proxy on which the call was made

 

error

NULL on success, or an error on failure

 

user_data

user-supplied data

 

weak_object

user-supplied object

 

tp_cli_connection_call_get_contact_attributes ()

TpProxyPendingCall *
tp_cli_connection_call_get_contact_attributes
                               (TpConnection *proxy,
                                gint timeout_ms,
                                const GArray *in_Handles,
                                const gchar **in_Interfaces,
                                tp_cli_connection_callback_for_get_contact_attributes callback,
                                gpointer user_data,
                                GDestroyNotify destroy,
                                GObject *weak_object);

Start a GetContactAttributes method call.

Return any number of contact attributes for the given handles.

Parameters

proxy

the TpProxy

 

timeout_ms

the timeout in milliseconds, or -1 to use the default

 

in_Handles

Used to pass an 'in' argument: An array of handles representing contacts.

 

in_Interfaces

Used to pass an 'in' argument: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>A list of strings indicating which D-Bus interfaces the calling process is interested in. All supported attributes from these interfaces, whose values can be obtained without additional network activity, will be in the reply.</p> <p>Attributes from the interface <tp:dbus-ref>im.telepathy.v1.Connection</tp:dbus-ref> are always returned, and need not be requested explicitly.</p> <p>As well as returning cached information immediately, the connection MAY start asynchronous requests to obtain better values for the contact attributes. If better values are later obtained by this process, they will be indicated with the usual signals (such as <tp:dbus-ref namespace="im.telepathy.v1.Connection.Interface.Aliasing1">AliasesChanged</tp:dbus-ref>).</p> <tp:rationale> For instance, an XMPP connection manager could download vCards in response to a request for <tp:dbus-ref namespace="im.telepathy.v1.Connection.Interface">Aliasing1</tp:dbus-ref> attributes. </tp:rationale>

 

callback

called when the method call succeeds or fails; may be NULL to make a "fire and forget" call with no reply tracking

 

user_data

user-supplied data passed to the callback; must be NULL if callback is NULL

 

destroy

called with the user_data as argument, after the call has succeeded, failed or been cancelled; must be NULL if callback is NULL

 

weak_object

If not NULL, a GObject which will be weakly referenced; if it is destroyed, this call will automatically be cancelled. Must be NULL if callback is NULL

 

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

void
(*tp_cli_connection_callback_for_get_contact_attributes)
                               (TpConnection *proxy,
                                GHashTable *out_Attributes,
                                const GError *error,
                                gpointer user_data,
                                GObject *weak_object);

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

Parameters

proxy

the proxy on which the call was made

 

out_Attributes

Used to return an 'out' argument if error is NULL: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>A dictionary mapping the contact handles to contact attributes. If any of the requested handles are in fact invalid, they are simply omitted from this mapping. If contact attributes are not immediately known, the behaviour is defined by the interface; the attribute should either be omitted from the result or replaced with a default value.</p> <p>Each contact's attributes will always include at least the identifier that would be obtained by inspecting the handle (<code>im.telepathy.v1.Connection/contact-id</code>).</p>

 

error

NULL on success, or an error on failure

 

user_data

user-supplied data

 

weak_object

user-supplied object

 

tp_cli_connection_call_get_contact_by_id ()

TpProxyPendingCall *
tp_cli_connection_call_get_contact_by_id
                               (TpConnection *proxy,
                                gint timeout_ms,
                                const gchar *in_Identifier,
                                const gchar **in_Interfaces,
                                tp_cli_connection_callback_for_get_contact_by_id callback,
                                gpointer user_data,
                                GDestroyNotify destroy,
                                GObject *weak_object);

Start a GetContactByID method call.

Return any number of contact attributes for the given identifier. <tp:rationale> This is for a single identifier to make it simpler to use for the most common use case. For multiple contacts case, <tp:member-ref>GetContactAttributes</tp:member-ref> should be used. </tp:rationale>

Parameters

proxy

the TpProxy

 

timeout_ms

the timeout in milliseconds, or -1 to use the default

 

in_Identifier

Used to pass an 'in' argument: An identifier representing a contact.

 

in_Interfaces

Used to pass an 'in' argument: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>A list of strings indicating which D-Bus interfaces the calling process is interested in. All supported attributes from these interfaces, whose values can be obtained without additional network activity, will be in the reply.</p> <p>See <tp:member-ref>GetContactAttributes</tp:member-ref> for details.</p>

 

callback

called when the method call succeeds or fails; may be NULL to make a "fire and forget" call with no reply tracking

 

user_data

user-supplied data passed to the callback; must be NULL if callback is NULL

 

destroy

called with the user_data as argument, after the call has succeeded, failed or been cancelled; must be NULL if callback is NULL

 

weak_object

If not NULL, a GObject which will be weakly referenced; if it is destroyed, this call will automatically be cancelled. Must be NULL if callback is NULL

 

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

void
(*tp_cli_connection_callback_for_get_contact_by_id)
                               (TpConnection *proxy,
                                guint out_Handle,
                                GHashTable *out_Attributes,
                                const GError *error,
                                gpointer user_data,
                                GObject *weak_object);

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

Parameters

proxy

the proxy on which the call was made

 

out_Handle

Used to return an 'out' argument if error is NULL: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>The contact's handle</p> (TpContactHandle)

 

out_Attributes

Used to return an 'out' argument if error is NULL: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>All supported attributes of the contact on the given interfaces that can be returned without network round-trips. If contact attributes are not immediately known, the behaviour is defined by the interface; the attribute should either be omitted from the result or replaced with a default value.</p> <p>The contact's attributes will always include at least the identifier that would be obtained by inspecting the handle (<code>org.freedesktop.Telepathy.Connection/contact-id</code>).</p>

 

error

NULL on success, or an error on failure

 

user_data

user-supplied data

 

weak_object

user-supplied object

 

Types and Values

See Also

TpConnection