## TpChannelDispatchOperation TpChannelDispatchOperation — proxy object for a to the Telepathy channel dispatcher |

## Synopsis

    #include <telepathy-glib/channel-dispatch-operation.h>

    struct              TpChannelDispatchOperation;
    struct              TpChannelDispatchOperationClass;
    TpChannelDispatchOperation * tp_channel_dispatch_operation_new
                                                            (TpDBusDaemon *bus_daemon,
                                                             const gchar *object_path,
                                                             GHashTable *immutable_properties,
                                                             GError **error);
    void                tp_channel_dispatch_operation_init_known_interfaces
                                                            (void);

    void                (*tp_cli_channel_dispatch_operation_callback_for_claim)
                                                            (TpChannelDispatchOperation *proxy,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    TpProxyPendingCall * tp_cli_channel_dispatch_operation_call_claim
                                                            (TpChannelDispatchOperation *proxy,
                                                             gint timeout_ms,
                                                             tp_cli_channel_dispatch_operation_callback_for_claim callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
    void                (*tp_cli_channel_dispatch_operation_callback_for_handle_with)
                                                            (TpChannelDispatchOperation *proxy,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    TpProxyPendingCall * tp_cli_channel_dispatch_operation_call_handle_with
                                                            (TpChannelDispatchOperation *proxy,
                                                             gint timeout_ms,
                                                             const gchar *in_Handler,
                                                             tp_cli_channel_dispatch_operation_callback_for_handle_with callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
    void                (*tp_cli_channel_dispatch_operation_callback_for_handle_with_time)
                                                            (TpChannelDispatchOperation *proxy,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    TpProxyPendingCall * tp_cli_channel_dispatch_operation_call_handle_with_time
                                                            (TpChannelDispatchOperation *proxy,
                                                             gint timeout_ms,
                                                             const gchar *in_Handler,
                                                             gint64 in_UserActionTime,
                                                             tp_cli_channel_dispatch_operation_callback_for_handle_with_time callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
    void                (*tp_cli_channel_dispatch_operation_signal_callback_channel_lost)
                                                            (TpChannelDispatchOperation *proxy,
                                                             const gchar *arg_Channel,
                                                             const gchar *arg_Error,
                                                             const gchar *arg_Message,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    TpProxySignalConnection * tp_cli_channel_dispatch_operation_connect_to_channel_lost
                                                            (TpChannelDispatchOperation *proxy,
                                                             tp_cli_channel_dispatch_operation_signal_callback_channel_lost callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object,
                                                             GError **error);
    void                (*tp_cli_channel_dispatch_operation_signal_callback_finished)
                                                            (TpChannelDispatchOperation *proxy,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    TpProxySignalConnection * tp_cli_channel_dispatch_operation_connect_to_finished
                                                            (TpChannelDispatchOperation *proxy,
                                                             tp_cli_channel_dispatch_operation_signal_callback_finished callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object,
                                                             GError **error);
    #define             TP_CHANNEL_DISPATCH_OPERATION_FEATURE_CORE
    TpAccount *         tp_channel_dispatch_operation_borrow_account
                                                            (TpChannelDispatchOperation *self);
    GPtrArray *         tp_channel_dispatch_operation_borrow_channels
                                                            (TpChannelDispatchOperation *self);
    TpConnection *      tp_channel_dispatch_operation_borrow_connection
                                                            (TpChannelDispatchOperation *self);
    GHashTable *        tp_channel_dispatch_operation_borrow_immutable_properties
                                                            (TpChannelDispatchOperation *self);
    GStrv               tp_channel_dispatch_operation_borrow_possible_handlers
                                                            (TpChannelDispatchOperation *self);
    void                tp_channel_dispatch_operation_handle_with_async
                                                            (TpChannelDispatchOperation *self,
                                                             const gchar *handler,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            tp_channel_dispatch_operation_handle_with_finish
                                                            (TpChannelDispatchOperation *self,
                                                             GAsyncResult *result,
                                                             GError **error);
    void                tp_channel_dispatch_operation_handle_with_time_async
                                                            (TpChannelDispatchOperation *self,
                                                             const gchar *handler,
                                                             gint64 user_action_time,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            tp_channel_dispatch_operation_handle_with_time_finish
                                                            (TpChannelDispatchOperation *self,
                                                             GAsyncResult *result,
                                                             GError **error);
    void                tp_channel_dispatch_operation_claim_async
                                                            (TpChannelDispatchOperation *self,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            tp_channel_dispatch_operation_claim_finish
                                                            (TpChannelDispatchOperation *self,
                                                             GAsyncResult *result,
                                                             GError **error);

## Object Hierarchy

      GObject
       +----TpProxy
             +----TpChannelDispatchOperation

## Properties

      "account"                  TpAccount*            : Read / Write / Construct Only
      "cdo-properties"           GHashTable_gchararray+GValue_*  : Read / Write / Construct Only
      "channels"                 GPtrArray*            : Read / Write / Construct Only
      "connection"               TpConnection*         : Read / Write / Construct Only
      "possible-handlers"        GStrv*                : Read

## Signals

      "channel-lost"                                   : Run Last / Has Details

## Description

One of the channel dispatcher's functions is to offer incoming channels to Approver clients for approval. Approvers respond to the channel dispatcher via a TpChannelDispatchOperation object.

## Details

### struct TpChannelDispatchOperation

    struct TpChannelDispatchOperation;

One of the channel dispatcher's functions is to offer incoming channels to Approver clients for approval. An approver should generally ask the user whether they want to participate in the requested communication channels (join the chat or chatroom, answer the call, accept the file transfer, or whatever is appropriate). A collection of channels offered in this way is represented by a ChannelDispatchOperation object.

If the user wishes to accept the communication channels, the approver should call `tp_cli_channel_dispatch_operation_call_handle_with()` to indicate the user's or approver's preferred handler for the channels (the empty string indicates no particular preference, and will cause any suitable handler to be used).

If the user wishes to reject the communication channels, or if the user accepts the channels and the approver will handle them itself, the approver should call `tp_cli_channel_dispatch_operation_call_claim()`. If this method succeeds, the approver immediately has control over the channels as their primary handler, and may do anything with them (in particular, it may close them in whatever way seems most appropriate).

There are various situations in which the channel dispatch operation will be closed, causing the "invalidated" signal to be emitted. If this happens, the approver should stop prompting the user.

Because all approvers are launched simultaneously, the user might respond to another approver; if this happens, the "invalidated" signal will be emitted with the domain `TP_DBUS_ERRORS` and the error code `TP_DBUS_ERROR_OBJECT_REMOVED`.

If a channel closes, the "channel-lost" signal is emitted. If all channels close, there is nothing more to dispatch, so the "invalidated" signal will be emitted with the domain `TP_DBUS_ERRORS` and the error code `TP_DBUS_ERROR_OBJECT_REMOVED`.

If the channel dispatcher crashes or exits, the "invalidated" signal will be emitted with the domain `TP_DBUS_ERRORS` and the error code `TP_DBUS_ERROR_NAME_OWNER_LOST`. In a high-quality implementation, the dispatcher should be restarted, at which point it will create new channel dispatch operations for any undispatched channels, and the approver will be notified again.

This proxy is usable but incomplete: accessors for the D-Bus properties 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

### struct TpChannelDispatchOperationClass

    struct TpChannelDispatchOperationClass {
    };

The class of a TpChannelDispatchOperation.

### tp_channel_dispatch_operation_new ()

    TpChannelDispatchOperation * tp_channel_dispatch_operation_new
                                                            (TpDBusDaemon *bus_daemon,
                                                             const gchar *object_path,
                                                             GHashTable *immutable_properties,
                                                             GError **error);

Convenience function to create a new channel dispatch operation proxy.

The `immutable_properties` argument is not yet used.

`bus_daemon` : | Proxy for the D-Bus daemon
`object_path` : | The non-NULL object path of this channel dispatch operation
`immutable_properties` : | As many as are known of the immutable D-Bus properties of this channel dispatch operation, or `NULL` if none are known
`error` : | Used to raise an error if `NULL` is returned
Returns : | a new reference to an channel dispatch operation proxy, or `NULL` if `object_path` is not syntactically valid or the channel dispatcher is not running

### tp_channel_dispatch_operation_init_known_interfaces ()

    void                tp_channel_dispatch_operation_init_known_interfaces
                                                            (void);

Ensure that the known interfaces for TpChannelDispatchOperation 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_DISPATCH_OPERATION`.

Since 0.7.32

### tp_cli_channel_dispatch_operation_callback_for_claim ()

    void                (*tp_cli_channel_dispatch_operation_callback_for_claim)
                                                            (TpChannelDispatchOperation *proxy,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);

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

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

    TpProxyPendingCall * tp_cli_channel_dispatch_operation_call_claim
                                                            (TpChannelDispatchOperation *proxy,
                                                             gint timeout_ms,
                                                             tp_cli_channel_dispatch_operation_callback_for_claim callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

Start a Claim method call.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Called by an approver to claim channels for handling internally. If this method is called successfully, the process calling this method becomes the handler for the channel, but <em>does not</em> have the <tp:dbus-ref namespace="org.freedesktop.Telepathy.Client.Handler">HandleChannels</tp:dbus-ref> method called on it.</p> <p>Clients that call Claim on channels but do not immediately close them SHOULD implement the Handler interface and its <tp:dbus-ref namespace="org.freedesktop.Telepathy.Client.Handler">HandledChannels</tp:dbus-ref> property.</p> <p>Approvers wishing to reject channels MUST call this method to claim ownership of them, and MUST NOT call <tp:dbus-ref namespace="org.freedesktop.Telepathy.Channel">Close</tp:dbus-ref> on the channels unless/until this method returns successfully.</p> <tp:rationale> <p>The channel dispatcher can't know how best to close arbitrary channel types, so it leaves it up to the approver to do so. For instance, for Text channels it is necessary to acknowledge any messages that have already been displayed to the user first - ideally, the approver would display and then acknowledge the messages - or to call <tp:dbus-ref namespace="org.freedesktop.Telepathy">Channel.Interface.Destroyable.Destroy</tp:dbus-ref> if the destructive behaviour of that method is desired.</p> <p>Similarly, an Approver for StreamedMedia channels can close the channel with a reason (e.g. &quot;busy&quot;) if desired. The channel dispatcher, which is designed to have no specific knowledge of particular channel types, can't do that.</p> </tp:rationale> <p>If successful, this method will cause the ChannelDispatchOperation object to disappear, emitting <tp:member-ref>Finished</tp:member-ref>, in the same way as for <tp:member-ref>HandleWith</tp:member-ref>.</p> <p>This method may fail because the dispatch operation has already been completed. Again, see HandleWith for more details. The approver MUST NOT attempt to interact with the channels further in this case.</p> <p>(FIXME: list some other possible errors)</p>

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

    void                (*tp_cli_channel_dispatch_operation_callback_for_handle_with)
                                                            (TpChannelDispatchOperation *proxy,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);

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

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

    TpProxyPendingCall * tp_cli_channel_dispatch_operation_call_handle_with
                                                            (TpChannelDispatchOperation *proxy,
                                                             gint timeout_ms,
                                                             const gchar *in_Handler,
                                                             tp_cli_channel_dispatch_operation_callback_for_handle_with callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

Start a HandleWith method call.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Called by an approver to accept a channel bundle and request that the given handler be used to handle it.</p> <p>If successful, this method will cause the ChannelDispatchOperation object to disappear, emitting <tp:member-ref>Finished</tp:member-ref>.</p> <p>However, this method may fail because the dispatch has already been completed and the object has already gone. If this occurs, it indicates that another approver has asked for the bundle to be handled by a particular handler. The approver MUST NOT attempt to interact with the channels further in this case, unless it is separately invoked as the handler.</p> <p>Approvers which are also channel handlers SHOULD use <tp:member-ref>Claim</tp:member-ref> instead of HandleWith to request that they can handle a channel bundle themselves.</p> <p>(FIXME: list some possible errors)</p> <p>If the channel handler raises an error from <tp:dbus-ref namespace="org.freedesktop.Telepathy.Client.Handler">HandleChannels</tp:dbus-ref>, this method MAY respond by raising that same error, even if it is not specifically documented here.</p>

`proxy` : | the TpProxy
`timeout_ms` : | the timeout in milliseconds, or -1 to use the default
`in_Handler` : | Used to pass an 'in' argument: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>The well-known bus name (starting with <code>org.freedesktop.Telepathy.Client.</code>) of the channel handler that should handle the channel, or the empty string if the client has no preferred channel handler.</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_dispatch_operation_callback_for_handle_with_time ()

    void                (*tp_cli_channel_dispatch_operation_callback_for_handle_with_time)
                                                            (TpChannelDispatchOperation *proxy,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);

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

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

    TpProxyPendingCall * tp_cli_channel_dispatch_operation_call_handle_with_time
                                                            (TpChannelDispatchOperation *proxy,
                                                             gint timeout_ms,
                                                             const gchar *in_Handler,
                                                             gint64 in_UserActionTime,
                                                             tp_cli_channel_dispatch_operation_callback_for_handle_with_time callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

Start a HandleWithTime method call.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>A variant of <tp:member-ref>HandleWith</tp:member-ref> allowing the approver to pass an user action time. This timestamp will be passed to the Handler when <tp:dbus-ref namespace="org.freedesktop.Telepathy.Client.Handler">HandleChannels</tp:dbus-ref> is called.</p>

`proxy` : | the TpProxy
`timeout_ms` : | the timeout in milliseconds, or -1 to use the default
`in_Handler` : | Used to pass an 'in' argument: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>The well-known bus name (starting with <code>org.freedesktop.Telepathy.Client.</code>) of the channel handler that should handle the channel, or the empty string if the client has no preferred channel handler.</p>
`in_UserActionTime` : | Used to pass an 'in' argument: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>The time at which user action occurred.</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_dispatch_operation_signal_callback_channel_lost ()

    void                (*tp_cli_channel_dispatch_operation_signal_callback_channel_lost)
                                                            (TpChannelDispatchOperation *proxy,
                                                             const gchar *arg_Channel,
                                                             const gchar *arg_Error,
                                                             const gchar *arg_Message,
                                                             gpointer user_data,
                                                             GObject *weak_object);

Represents the signature of a callback for the signal ChannelLost.

`proxy` : | The proxy on which `tp_cli_channel_dispatch_operation_connect_to_channel_lost()` was called
`arg_Channel` : | The <tp:dbus-ref namespace="org.freedesktop.Telepathy">Channel</tp:dbus-ref> that closed.
`arg_Error` : | <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>The name of a D-Bus error indicating why the channel closed. If no better reason can be found, <code>org.freedesktop.Telepathy.Error.NotAvailable</code> MAY be used as a fallback; this means that this error SHOULD NOT be given any more specific meaning.</p>
`arg_Message` : | A string associated with the D-Bus error.
`user_data` : | User-supplied data
`weak_object` : | User-supplied weakly referenced object

### tp_cli_channel_dispatch_operation_connect_to_channel_lost ()

    TpProxySignalConnection * tp_cli_channel_dispatch_operation_connect_to_channel_lost
                                                            (TpChannelDispatchOperation *proxy,
                                                             tp_cli_channel_dispatch_operation_signal_callback_channel_lost callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object,
                                                             GError **error);

Connect a handler to the signal ChannelLost.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>A channel has closed before it could be claimed or handled. If this is emitted for the last remaining channel in a channel dispatch operation, it MUST immediately be followed by <tp:member-ref>Finished</tp:member-ref>.</p> <p>This signal MUST NOT be emitted until all Approvers that were invoked have returned (successfully or with an error) from their <tp:dbus-ref namespace="org.freedesktop.Telepathy.Client.Approver">AddDispatchOperation</tp:dbus-ref> method.</p> <tp:rationale> <p>This means that Approvers can connect to the ChannelLost signal in a race-free way. Non-approver processes that discover a channel dispatch operation in some way (such as observers) will have to follow the usual &quot;connect to signals then recover state&quot; model - first connect to ChannelLost and <tp:member-ref>Finished</tp:member-ref>, then download <tp:member-ref>Channels</tp:member-ref> (and on error, perhaps assume that the operation has already Finished).</p> </tp:rationale>

`proxy` : | A TpChannelDispatchOperation 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_dispatch_operation_signal_callback_finished ()

    void                (*tp_cli_channel_dispatch_operation_signal_callback_finished)
                                                            (TpChannelDispatchOperation *proxy,
                                                             gpointer user_data,
                                                             GObject *weak_object);

Represents the signature of a callback for the signal Finished.

`proxy` : | The proxy on which `tp_cli_channel_dispatch_operation_connect_to_finished()` was called
`user_data` : | User-supplied data
`weak_object` : | User-supplied weakly referenced object

### tp_cli_channel_dispatch_operation_connect_to_finished ()

    TpProxySignalConnection * tp_cli_channel_dispatch_operation_connect_to_finished
                                                            (TpChannelDispatchOperation *proxy,
                                                             tp_cli_channel_dispatch_operation_signal_callback_finished callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object,
                                                             GError **error);

Connect a handler to the signal Finished.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Emitted when this dispatch operation finishes. The dispatch operation is no longer present and further methods must not be called on it.</p> <p>Approvers that have a user interface SHOULD stop notifying the user about the channels in response to this signal; they MAY assume that on errors, they would have received <tp:member-ref>ChannelLost</tp:member-ref> first.</p> <p>Its object path SHOULD NOT be reused for a subsequent dispatch operation; the ChannelDispatcher MUST choose object paths in a way that avoids immediate re-use.</p> <tp:rationale> <p>Otherwise, clients might accidentally call <tp:member-ref>HandleWith</tp:member-ref> or <tp:member-ref>Claim</tp:member-ref> on a new dispatch operation instead of the one they intended to handle.</p> </tp:rationale> <p>This signal MUST NOT be emitted until all Approvers that were invoked have returned (successfully or with an error) from their <tp:dbus-ref namespace="org.freedesktop.Telepathy.Client.Approver">AddDispatchOperation</tp:dbus-ref> method.</p> <tp:rationale> <p>This means that Approvers can connect to the ChannelLost signal in a race-free way. Non-approver processes that discover a channel dispatch operation in some way (such as observers) will have to follow the usual &quot;connect to signals then recover state&quot; model - first connect to <tp:member-ref>ChannelLost</tp:member-ref> and Finished, then download <tp:member-ref>Channels</tp:member-ref> (and on error, perhaps assume that the operation has already Finished).</p> </tp:rationale>

`proxy` : | A TpChannelDispatchOperation 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_CHANNEL_DISPATCH_OPERATION_FEATURE_CORE

    #define             TP_CHANNEL_DISPATCH_OPERATION_FEATURE_CORE

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

When this feature is prepared, the basic properties of the ChannelDispatchOperation have been retrieved and are available for use.

Specifically, this implies that:

- "connection" is set (but TP_CONNECTION_FEATURE_CORE is not necessarily prepared) - "account" is set (but TP_ACCOUNT_FEATURE_CORE is not necessarily prepared) - "channels" is set (but TP_CHANNEL_FEATURE_CORE is not necessarily prepared) - "possible-handlers" is set - any extra interfaces will have been set up in TpProxy (i.e. "interfaces" contains at least all extra ChannelDispatchOperation interfaces)

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

Since 0.11.5

### tp_channel_dispatch_operation_borrow_account ()

    TpAccount *         tp_channel_dispatch_operation_borrow_account
                                                            (TpChannelDispatchOperation *self);

Returns the TpAccount of this ChannelDispatchOperation. The returned pointer is only valid while `self` is valid - reference it with `g_object_ref()` if needed.

`self` : | a TpChannelDispatchOperation
Returns : | the value of "account". [transfer none]

Since 0.11.5

### tp_channel_dispatch_operation_borrow_channels ()

    GPtrArray *         tp_channel_dispatch_operation_borrow_channels
                                                            (TpChannelDispatchOperation *self);

Returns a GPtrArray containing the TpChannel of this ChannelDispatchOperation. The returned array and its TpChannel are only valid while `self` is valid - copy array and reference channels with `g_object_ref()` if needed.

`self` : | a TpChannelDispatchOperation
Returns : | the value of "channels". [transfer none]

Since 0.11.5

### tp_channel_dispatch_operation_borrow_connection ()

    TpConnection *      tp_channel_dispatch_operation_borrow_connection
                                                            (TpChannelDispatchOperation *self);

Returns the TpConnection of this ChannelDispatchOperation. The returned pointer is only valid while `self` is valid - reference it with `g_object_ref()` if needed.

`self` : | a TpChannelDispatchOperation
Returns : | the value of "connection". [transfer none]

Since 0.11.5

### tp_channel_dispatch_operation_borrow_immutable_properties ()

    GHashTable *        tp_channel_dispatch_operation_borrow_immutable_properties
                                                            (TpChannelDispatchOperation *self);

Returns the immutable D-Bus properties of this channel. The returned hash table is only valid while `self` is valid - reference it with `g_hash_table_ref()` if needed.

`self` : | a TpChannelDispatchOperation
Returns : | the value of "cdo-properties". [transfer none][element-type utf8 GObject.Value]

Since 0.11.5

### tp_channel_dispatch_operation_borrow_possible_handlers ()

    GStrv               tp_channel_dispatch_operation_borrow_possible_handlers
                                                            (TpChannelDispatchOperation *self);

Returns a GStrv containing the possible handlers of this ChannelDispatchOperation. The returned array and its strings are only valid while `self` is valid - copy it with g_strdupv if needed.

`self` : | a TpChannelDispatchOperation
Returns : | the value of "possible-handlers". [transfer none]

Since 0.11.5

### tp_channel_dispatch_operation_handle_with_async ()

    void                tp_channel_dispatch_operation_handle_with_async
                                                            (TpChannelDispatchOperation *self,
                                                             const gchar *handler,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Called by an approver to accept a channel bundle and request that the given handler be used to handle it.

If successful, this method will cause the "invalidated" signal to be emitted with the TP_DBUS_ERROR_OBJECT_REMOVED error code.

However, this method may fail because the dispatch has already been completed and the object has already gone. If this occurs, it indicates that another approver has asked for the bundle to be handled by a particular handler. The approver MUST NOT attempt to interact with the channels further in this case, unless it is separately invoked as the handler.

Approvers which are also channel handlers SHOULD use `tp_channel_dispatch_operation_claim_async()` instead of `tp_channel_dispatch_operation_handle_with_async()` to request that they can handle a channel bundle themselves.

`self` : | a TpChannelDispatchOperation
`handler` : | The well-known bus name (starting with TP_CLIENT_BUS_NAME_BASE) of the channel handler that should handle the channel, or `NULL` if the client has no preferred channel handler. [allow-none]
`callback` : | a callback to call when the call returns
`user_data` : | data to pass to `callback`

Since 0.11.5

### tp_channel_dispatch_operation_handle_with_finish ()

    gboolean            tp_channel_dispatch_operation_handle_with_finish
                                                            (TpChannelDispatchOperation *self,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes an async call to `HandleWith()`.

`self` : | a TpChannelDispatchOperation
`result` : | a GAsyncResult
`error` : | a GError to fill
Returns : | `TRUE` if the `HandleWith()` call was successful, otherwise `FALSE`

Since 0.11.5

### tp_channel_dispatch_operation_handle_with_time_async ()

    void                tp_channel_dispatch_operation_handle_with_time_async
                                                            (TpChannelDispatchOperation *self,
                                                             const gchar *handler,
                                                             gint64 user_action_time,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

A variant of `tp_channel_dispatch_operation_handle_with_async()` allowing the approver to pass an user action time. This timestamp will be passed to the Handler when HandleChannels is called.

If an X server timestamp for the user action causing this method call is available, `user_action_time` should be this timestamp (for instance, the result of `gdk_event_get_time()` if it is not `GDK_CURRENT_TIME`). Otherwise, it may be `TP_USER_ACTION_TIME_NOT_USER_ACTION` to behave as if there was no user action or it happened a long time ago, or `TP_USER_ACTION_TIME_CURRENT_TIME` to have the Handler behave as though the user action had just happened (resembling, but not numerically equal to, `GDK_CURRENT_TIME`).

This method has been introduced in telepathy-mission-control 5.5.0.

`self` : | a TpChannelDispatchOperation
`handler` : | The well-known bus name (starting with TP_CLIENT_BUS_NAME_BASE) of the channel handler that should handle the channel, or `NULL` if the client has no preferred channel handler. [allow-none]
`user_action_time` : | the time at which user action occurred, or one of the special values `TP_USER_ACTION_TIME_NOT_USER_ACTION` or `TP_USER_ACTION_TIME_CURRENT_TIME`
`callback` : | a callback to call when the call returns
`user_data` : | data to pass to `callback`

Since 0.11.7

### tp_channel_dispatch_operation_handle_with_time_finish ()

    gboolean            tp_channel_dispatch_operation_handle_with_time_finish
                                                            (TpChannelDispatchOperation *self,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes an async call to `HandleWithTime()`.

`self` : | a TpChannelDispatchOperation
`result` : | a GAsyncResult
`error` : | a GError to fill
Returns : | `TRUE` if the `HandleWithTime()` call was successful, otherwise `FALSE`

Since 0.11.7

### tp_channel_dispatch_operation_claim_async ()

    void                tp_channel_dispatch_operation_claim_async
                                                            (TpChannelDispatchOperation *self,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Called by an approver to claim channels for handling internally. If this method is called successfully, the process calling this method becomes the handler for the channel.

If successful, this method will cause the "invalidated" signal to be emitted, in the same wayas for `tp_channel_dispatch_operation_handle_with_async()`.

This method may fail because the dispatch operation has already been completed. Again, see `tp_channel_dispatch_operation_claim_async()` for more details. The approver MUST NOT attempt to interact with the channels further in this case.

`self` : | a TpChannelDispatchOperation
`callback` : | a callback to call when the call returns
`user_data` : | data to pass to `callback`

Since 0.11.5

### tp_channel_dispatch_operation_claim_finish ()

    gboolean            tp_channel_dispatch_operation_claim_finish
                                                            (TpChannelDispatchOperation *self,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes an async call to `Claim()`.

`self` : | a TpChannelDispatchOperation
`result` : | a GAsyncResult
`error` : | a GError to fill
Returns : | `TRUE` if the `Claim()` call was successful, otherwise `FALSE`

Since 0.11.5

## Property Details

### The `"account"` property

      "account"                  TpAccount*            : Read / Write / Construct Only

The TpAccount with which the connection and channels are associated.

Read-only except during construction.

This is not guaranteed to be set until `tp_proxy_prepare_async()` has finished preparing `TP_CHANNEL_DISPATCH_OPERATION_FEATURE_CORE`.

Since 0.11.5

### The `"cdo-properties"` property

      "cdo-properties"           GHashTable_gchararray+GValue_*  : Read / Write / Construct Only

The immutable D-Bus properties of this ChannelDispatchOperation, represented by a GHashTable where the keys are D-Bus interface name + "." + property name, and the values are GValue instances.

Read-only except during construction. If this is not provided during construction, it is not guaranteed to be set until `tp_proxy_prepare_async()` has finished preparing `TP_CHANNEL_DISPATCH_OPERATION_FEATURE_CORE`.

Since 0.11.5

### The `"channels"` property

      "channels"                 GPtrArray*            : Read / Write / Construct Only

A GPtrArray containing the TpChannel to be dispatched.

Read-only.

This is not guaranteed to be set until `tp_proxy_prepare_async()` has finished preparing `TP_CHANNEL_DISPATCH_OPERATION_FEATURE_CORE`.

Since 0.11.5

### The `"connection"` property

      "connection"               TpConnection*         : Read / Write / Construct Only

The TpConnection with which the channels are associated.

Read-only except during construction.

This is not guaranteed to be set until `tp_proxy_prepare_async()` has finished preparing `TP_CHANNEL_DISPATCH_OPERATION_FEATURE_CORE`.

Since 0.11.5

### The `"possible-handlers"` property

      "possible-handlers"        GStrv*                : Read

A GStrv containing the well known bus names (starting with TP_CLIENT_BUS_NAME_BASE) of the possible Handlers for the channels

Read-only except during construction.

This is not guaranteed to be set until `tp_proxy_prepare_async()` has finished preparing `TP_CHANNEL_DISPATCH_OPERATION_FEATURE_CORE`.

Since 0.11.5

## Signal Details

### The `"channel-lost"` signal

    void                user_function                      (TpChannelDispatchOperation *self,
                                                            TpChannel                  *channel,
                                                            guint                       domain,
                                                            gint                        code,
                                                            gchar                      *message,
                                                            gpointer                    user_data)      : Run Last / Has Details

Emitted when a channel has closed before it could be claimed or handled.

`self` : | a TpChannelDispatchOperation
`channel` : | the TpChannel that closed
`domain` : | domain of a GError indicating why the channel has been closed
`code` : | error code of a GError indicating why the channel has been closed
`message` : | a message associated with the error
`user_data` : | user data set when the signal handler was connected.

Since 0.11.5

## See Also

TpChannelDispatcher