TpChannelDispatcher

TpChannelDispatcher — proxy object for the Telepathy channel dispatcher

Synopsis


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

                    TpChannelDispatcher;
                    TpChannelDispatcherClass;
TpChannelDispatcher* tp_channel_dispatcher_new          (TpDBusDaemon *bus_daemon);
void                tp_channel_dispatcher_init_known_interfaces
                                                        (void);

void                (*tp_cli_channel_dispatcher_callback_for_create_channel)
                                                        (TpChannelDispatcher *proxy,
                                                         const gchar *out_Request,
                                                         const GError *error,
                                                         gpointer user_data,
                                                         GObject *weak_object);
TpProxyPendingCall* tp_cli_channel_dispatcher_call_create_channel
                                                        (TpChannelDispatcher *proxy,
                                                         gint timeout_ms,
                                                         const gchar *in_Account,
                                                         GHashTable *in_Requested_Properties,
                                                         gint64 in_User_Action_Time,
                                                         const gchar *in_Preferred_Handler,
                                                         tp_cli_channel_dispatcher_callback_for_create_channel callback,
                                                         gpointer user_data,
                                                         GDestroyNotify destroy,
                                                         GObject *weak_object);
void                (*tp_cli_channel_dispatcher_callback_for_ensure_channel)
                                                        (TpChannelDispatcher *proxy,
                                                         const gchar *out_Request,
                                                         const GError *error,
                                                         gpointer user_data,
                                                         GObject *weak_object);
TpProxyPendingCall* tp_cli_channel_dispatcher_call_ensure_channel
                                                        (TpChannelDispatcher *proxy,
                                                         gint timeout_ms,
                                                         const gchar *in_Account,
                                                         GHashTable *in_Requested_Properties,
                                                         gint64 in_User_Action_Time,
                                                         const gchar *in_Preferred_Handler,
                                                         tp_cli_channel_dispatcher_callback_for_ensure_channel callback,
                                                         gpointer user_data,
                                                         GDestroyNotify destroy,
                                                         GObject *weak_object);

void                (*tp_cli_channel_dispatcher_interface_operation_list_signal_callback_dispatch_operation_finished)
                                                        (TpChannelDispatcher *proxy,
                                                         const gchar *arg_Dispatch_Operation,
                                                         gpointer user_data,
                                                         GObject *weak_object);
TpProxySignalConnection* tp_cli_channel_dispatcher_interface_operation_list_connect_to_dispatch_operation_finished
                                                        (TpChannelDispatcher *proxy,
                                                         tp_cli_channel_dispatcher_interface_operation_list_signal_callback_dispatch_operation_finished callback,
                                                         gpointer user_data,
                                                         GDestroyNotify destroy,
                                                         GObject *weak_object,
                                                         GError **error);
void                (*tp_cli_channel_dispatcher_interface_operation_list_signal_callback_new_dispatch_operation)
                                                        (TpChannelDispatcher *proxy,
                                                         const gchar *arg_Dispatch_Operation,
                                                         GHashTable *arg_Properties,
                                                         gpointer user_data,
                                                         GObject *weak_object);
TpProxySignalConnection* tp_cli_channel_dispatcher_interface_operation_list_connect_to_new_dispatch_operation
                                                        (TpChannelDispatcher *proxy,
                                                         tp_cli_channel_dispatcher_interface_operation_list_signal_callback_new_dispatch_operation callback,
                                                         gpointer user_data,
                                                         GDestroyNotify destroy,
                                                         GObject *weak_object,
                                                         GError **error);

Object Hierarchy

  GObject
   +----TpProxy
         +----TpChannelDispatcher

Description

The TpChannelDispatcher object can be used to communicate with any implementation of the Telepathy ChannelDispatcher service to request new channels.

Details

TpChannelDispatcher

typedef struct _TpChannelDispatcher TpChannelDispatcher;

The Channel Dispatcher's main D-Bus API is used to request channels, which is done by calling tp_cli_channel_dispatcher_call_create_channel() or tp_cli_channel_dispatcher_call_ensure_channel() as appropriate.

The Telepathy Channel Dispatcher is also responsible for responding to new channels and launching client processes to handle them. However, clients that can work with incoming channels do not have to call methods on the channel dispatcher: instead, they must register with the channel dispatcher passively, by taking a bus name starting with TP_CLIENT_BUS_NAME_BASE and implementing the TpSvcClient interface. See the Telepathy D-Bus Interface Specification for details.

This proxy is usable but incomplete: convenience methods will be added in a later version of telepathy-glib, along with a mechanism similar to tp_connection_call_when_ready().

Since 0.7.32


TpChannelDispatcherClass

typedef struct {
} TpChannelDispatcherClass;

The class of a TpChannelDispatcher.


tp_channel_dispatcher_new ()

TpChannelDispatcher* tp_channel_dispatcher_new          (TpDBusDaemon *bus_daemon);

Convenience function to create a new channel dispatcher proxy.

bus_daemon : Proxy for the D-Bus daemon
Returns : a new reference to a channel dispatcher proxy

tp_channel_dispatcher_init_known_interfaces ()

void                tp_channel_dispatcher_init_known_interfaces
                                                        (void);

Ensure that the known interfaces for TpChannelDispatcher 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_CHANNEL_DISPATCHER.

Since 0.7.32


tp_cli_channel_dispatcher_callback_for_create_channel ()

void                (*tp_cli_channel_dispatcher_callback_for_create_channel)
                                                        (TpChannelDispatcher *proxy,
                                                         const gchar *out_Request,
                                                         const GError *error,
                                                         gpointer user_data,
                                                         GObject *weak_object);

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

proxy : the proxy on which the call was made
out_Request : Used to return an 'out' argument if error is NULL: A <tp:dbus-ref namespace="org.freedesktop.Telepathy">ChannelRequest</tp:dbus-ref> object.
error : NULL on success, or an error on failure
user_data : user-supplied data
weak_object : user-supplied object

tp_cli_channel_dispatcher_call_create_channel ()

TpProxyPendingCall* tp_cli_channel_dispatcher_call_create_channel
                                                        (TpChannelDispatcher *proxy,
                                                         gint timeout_ms,
                                                         const gchar *in_Account,
                                                         GHashTable *in_Requested_Properties,
                                                         gint64 in_User_Action_Time,
                                                         const gchar *in_Preferred_Handler,
                                                         tp_cli_channel_dispatcher_callback_for_create_channel callback,
                                                         gpointer user_data,
                                                         GDestroyNotify destroy,
                                                         GObject *weak_object);

Start a CreateChannel method call.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Start a request to create a channel. This initially just creates a <tp:dbus-ref namespace="org.freedesktop.Telepathy">ChannelRequest</tp:dbus-ref> object, which can be used to continue the request and track its success or failure.</p> <tp:rationale> <p>The request can take a long time - in the worst case, the channel dispatcher has to ask the account manager to put the account online, the account manager has to ask the operating system to obtain an Internet connection, and the operating system has to ask the user whether to activate an Internet connection using an on-demand mechanism like dialup.</p> <p>This means that using a single D-Bus method call and response to represent the whole request will tend to lead to that call timing out, which is not the behaviour we want.</p> </tp:rationale> <p>If this method is called for an Account that is disabled, invalid or otherwise unusable, no error is signalled until <tp:dbus-ref namespace="org.freedesktop.Telepathy">ChannelRequest.Proceed</tp:dbus-ref> is called, at which point <tp:dbus-ref namespace="org.freedesktop.Telepathy">ChannelRequest.Failed</tp:dbus-ref> is emitted with an appropriate error.</p> <tp:rationale> <p>This means there's only one code path for errors, apart from InvalidArgument for &quot;that request makes no sense&quot;.</p> <p>It also means that the request will proceed if the account is enabled after calling CreateChannel, but before calling Proceed.</p> </tp:rationale>

proxy : the TpProxy
timeout_ms : the timeout in milliseconds, or -1 to use the default
in_Account : Used to pass an 'in' argument: The <tp:dbus-ref namespace="org.freedesktop.Telepathy">Account</tp:dbus-ref> for which the new channel is to be created.
in_Requested_Properties : Used to pass an 'in' argument: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>A dictionary containing desirable properties. This has the same semantics as the corresponding parameter to <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>. </p> <p>Certain properties will not necessarily make sense in this dictionary: for instance, <tp:dbus-ref namespace="org.freedesktop.Telepathy.Channel">TargetHandle</tp:dbus-ref> can only be given if the requester is able to interact with a <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection</tp:dbus-ref> to the desired account.</p>
in_User_Action_Time : Used to pass an 'in' argument: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>The time at which user action occurred, or 0 if this channel request is for some reason not involving user action. The <tp:dbus-ref namespace="org.freedesktop.Telepathy.ChannelRequest">UserActionTime</tp:dbus-ref> property will be set to this value, and it will eventually be passed as the <code>User_Action_Time</code> parameter of <tp:dbus-ref namespace="org.freedesktop.Telepathy.Client.Handler">HandleChannels</tp:dbus-ref>.</p>
in_Preferred_Handler : Used to pass an 'in' argument: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Either the well-known bus name (starting with <code>org.freedesktop.Telepathy.Client.</code>) of the preferred handler for this channel, or an empty string to indicate that any handler would be acceptable. The channel dispatcher SHOULD dispatch as many as possible of the resulting channels (ideally, all of them) to that handler, and SHOULD remember the preferred handler so it can try to dispatch subsequent channels in the same bundle to the same handler.</p> <tp:rationale> <p>This must be the well-known bus name, not the unique name, to ensure that all handlers do indeed have the Client API, and the Client object on the handler can be located easily.</p> <p>This is partly so the channel dispatcher can call <tp:dbus-ref namespace="org.freedesktop.Telepathy.Client.Handler">HandleChannels</tp:dbus-ref> on it, and partly so the channel dispatcher can recover state if it crashes and is restarted.</p> </tp:rationale> <p>If this is a well-known bus name and the handler has the Requests interface, the channel dispatcher SHOULD call <tp:dbus-ref namespace="org.freedesktop.Telepathy.Client.Interface.Requests">AddRequest</tp:dbus-ref> on that Handler after this method has returned.</p> <tp:rationale> <p>This ordering allows a Handler which calls CreateChannel with itself as the preferred handler to associate the call to AddRequest with that call.</p> </tp:rationale> <p>This is copied to the ChannelRequest that is returned, as the <tp:dbus-ref namespace="org.freedesktop.Telepathy.ChannelRequest">PreferredHandler</tp:dbus-ref> property.</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_channel_dispatcher_callback_for_ensure_channel ()

void                (*tp_cli_channel_dispatcher_callback_for_ensure_channel)
                                                        (TpChannelDispatcher *proxy,
                                                         const gchar *out_Request,
                                                         const GError *error,
                                                         gpointer user_data,
                                                         GObject *weak_object);

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

proxy : the proxy on which the call was made
out_Request : Used to return an 'out' argument if error is NULL: A <tp:dbus-ref namespace="org.freedesktop.Telepathy">ChannelRequest</tp:dbus-ref> object.
error : NULL on success, or an error on failure
user_data : user-supplied data
weak_object : user-supplied object

tp_cli_channel_dispatcher_call_ensure_channel ()

TpProxyPendingCall* tp_cli_channel_dispatcher_call_ensure_channel
                                                        (TpChannelDispatcher *proxy,
                                                         gint timeout_ms,
                                                         const gchar *in_Account,
                                                         GHashTable *in_Requested_Properties,
                                                         gint64 in_User_Action_Time,
                                                         const gchar *in_Preferred_Handler,
                                                         tp_cli_channel_dispatcher_callback_for_ensure_channel callback,
                                                         gpointer user_data,
                                                         GDestroyNotify destroy,
                                                         GObject *weak_object);

Start a EnsureChannel method call.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Start a request to ensure that a channel exists, creating it if necessary. This initially just creates a <tp:dbus-ref namespace="org.freedesktop.Telepathy">ChannelRequest</tp:dbus-ref> object, which can be used to continue the request and track its success or failure.</p> <p>If this method is called for an Account that is disabled, invalid or otherwise unusable, no error is signalled until <tp:dbus-ref namespace="org.freedesktop.Telepathy">ChannelRequest.Proceed</tp:dbus-ref> is called, at which point <tp:dbus-ref namespace="org.freedesktop.Telepathy">ChannelRequest.Failed</tp:dbus-ref> is emitted with an appropriate error.</p> <tp:rationale> <p>The rationale is as for <tp:dbus-ref namespace="org.freedesktop.Telepathy.ChannelDispatcher">CreateChannel</tp:dbus-ref>.</p> </tp:rationale>

proxy : the TpProxy
timeout_ms : the timeout in milliseconds, or -1 to use the default
in_Account : Used to pass an 'in' argument: The <tp:dbus-ref namespace="org.freedesktop.Telepathy">Account</tp:dbus-ref> for which the new channel is to be created.
in_Requested_Properties : Used to pass an 'in' argument: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>A dictionary containing desirable properties. This has the same semantics as the corresponding parameter to <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.EnsureChannel</tp:dbus-ref>. </p> <p>Certain properties will not necessarily make sense in this dictionary: for instance, <tp:dbus-ref namespace="org.freedesktop.Telepathy.Channel">TargetHandle</tp:dbus-ref> can only be given if the requester is able to interact with a <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection</tp:dbus-ref> to the desired account.</p>
in_User_Action_Time : Used to pass an 'in' argument: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>The time at which user action occurred, or 0 if this channel request is for some reason not involving user action.</p> <p>This parameter is used in the same way as the corresponding parameter to <tp:member-ref>CreateChannel</tp:member-ref>.</p>
in_Preferred_Handler : Used to pass an 'in' argument: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Either the well-known bus name (starting with <code>org.freedesktop.Telepathy.Client.</code>) of the preferred handler for this channel, or an empty string to indicate that any handler would be acceptable. The behaviour and rationale are the same as for the corresponding parameter to <tp:member-ref>CreateChannel</tp:member-ref>, except as noted here.</p> <p>If any new channels are created in response to this request, the channel dispatcher SHOULD dispatch as many as possible of the resulting channels (ideally, all of them) to that handler, and SHOULD remember the preferred handler so it can try to dispatch subsequent channels in the same bundle to the same handler. If the requested channel already exists (that is, <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.EnsureChannel</tp:dbus-ref> returns <code>Yours=False</code>) then the channel dispatcher SHOULD re-dispatch the channel to its existing handler, and MUST NOT dispatch it to this client (unless it is the existing handler); the request is still deemed to have succeeded in this case.</p> <tp:rationale> <p>An address book application, for example, might call <tp:dbus-ref namespace="org.freedesktop.Telepathy.ChannelDispatcher">EnsureChannel</tp:dbus-ref> to ensure that a text channel with a particular contact is displayed to the user; it does not care whether a new channel was made. An IM client might call <tp:dbus-ref namespace="org.freedesktop.Telepathy.ChannelDispatcher">EnsureChannel</tp:dbus-ref> in response to the user double-clicking an entry in the contact list, with itself as the <code>Preferred_Handler</code>; if the user already has a conversation with that contact in another application, they would expect the existing window to be presented, rather than their double-click leading to an error message. So the request should succeed, even if its <code>Preferred_Handler</code> is not used.</p> </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_channel_dispatcher_interface_operation_list_signal_callback_dispatch_operation_finished ()

void                (*tp_cli_channel_dispatcher_interface_operation_list_signal_callback_dispatch_operation_finished)
                                                        (TpChannelDispatcher *proxy,
                                                         const gchar *arg_Dispatch_Operation,
                                                         gpointer user_data,
                                                         GObject *weak_object);

Represents the signature of a callback for the signal DispatchOperationFinished.

proxy : The proxy on which tp_cli_channel_dispatcher_interface_operation_list_connect_to_dispatch_operation_finished() was called
arg_Dispatch_Operation : The dispatch operation that was closed.
user_data : User-supplied data
weak_object : User-supplied weakly referenced object

tp_cli_channel_dispatcher_interface_operation_list_connect_to_dispatch_operation_finished ()

TpProxySignalConnection* tp_cli_channel_dispatcher_interface_operation_list_connect_to_dispatch_operation_finished
                                                        (TpChannelDispatcher *proxy,
                                                         tp_cli_channel_dispatcher_interface_operation_list_signal_callback_dispatch_operation_finished callback,
                                                         gpointer user_data,
                                                         GDestroyNotify destroy,
                                                         GObject *weak_object,
                                                         GError **error);

Connect a handler to the signal DispatchOperationFinished.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> Emitted when a dispatch operation finishes (i.e. exactly once per emission of <tp:dbus-ref namespace="org.freedesktop.Telepathy">ChannelDispatchOperation.Finished</tp:dbus-ref>). <tp:rationale> Strictly speaking this is redundant with ChannelDispatchOperation.Finished, but it provides full change-notification for the <tp:member-ref>DispatchOperations</tp:member-ref> property. </tp:rationale>

proxy : A TpChannelDispatcher 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_channel_dispatcher_interface_operation_list_signal_callback_new_dispatch_operation ()

void                (*tp_cli_channel_dispatcher_interface_operation_list_signal_callback_new_dispatch_operation)
                                                        (TpChannelDispatcher *proxy,
                                                         const gchar *arg_Dispatch_Operation,
                                                         GHashTable *arg_Properties,
                                                         gpointer user_data,
                                                         GObject *weak_object);

Represents the signature of a callback for the signal NewDispatchOperation.

proxy : The proxy on which tp_cli_channel_dispatcher_interface_operation_list_connect_to_new_dispatch_operation() was called
arg_Dispatch_Operation : The dispatch operation that was created.
arg_Properties : The same properties that would appear in the Properties member of <tp:type-ref>Dispatch_Operation_Details</tp:type-ref>.
user_data : User-supplied data
weak_object : User-supplied weakly referenced object

tp_cli_channel_dispatcher_interface_operation_list_connect_to_new_dispatch_operation ()

TpProxySignalConnection* tp_cli_channel_dispatcher_interface_operation_list_connect_to_new_dispatch_operation
                                                        (TpChannelDispatcher *proxy,
                                                         tp_cli_channel_dispatcher_interface_operation_list_signal_callback_new_dispatch_operation callback,
                                                         gpointer user_data,
                                                         GDestroyNotify destroy,
                                                         GObject *weak_object,
                                                         GError **error);

Connect a handler to the signal NewDispatchOperation.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Emitted when a dispatch operation is added to <tp:member-ref>DispatchOperations</tp:member-ref>.</p>

proxy : A TpChannelDispatcher 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.

See Also

TpChannelDispatchOperation, TpChannelRequest