TpChannelDispatchOperation: telepathy-glib API Reference Manual

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

## Functions

TpChannelDispatchOperation * | tp_channel_dispatch_operation_new ()
void | tp_channel_dispatch_operation_init_known_interfaces ()
void | (*tp_cli_channel_dispatch_operation_callback_for_claim) ()
TpProxyPendingCall * | tp_cli_channel_dispatch_operation_call_claim ()
void | (*tp_cli_channel_dispatch_operation_callback_for_handle_with) ()
TpProxyPendingCall * | tp_cli_channel_dispatch_operation_call_handle_with ()
void | (*tp_cli_channel_dispatch_operation_callback_for_handle_with_time) ()
TpProxyPendingCall * | tp_cli_channel_dispatch_operation_call_handle_with_time ()
void | (*tp_cli_channel_dispatch_operation_signal_callback_channel_lost) ()
TpProxySignalConnection * | tp_cli_channel_dispatch_operation_connect_to_channel_lost ()
void | (*tp_cli_channel_dispatch_operation_signal_callback_finished) ()
TpProxySignalConnection * | tp_cli_channel_dispatch_operation_connect_to_finished ()
TpAccount * | tp_channel_dispatch_operation_borrow_account ()
GPtrArray * | tp_channel_dispatch_operation_borrow_channels ()
TpConnection * | tp_channel_dispatch_operation_borrow_connection ()
GHashTable * | tp_channel_dispatch_operation_borrow_immutable_properties ()
GStrv | tp_channel_dispatch_operation_borrow_possible_handlers ()
TpAccount * | tp_channel_dispatch_operation_get_account ()
GPtrArray * | tp_channel_dispatch_operation_get_channels ()
TpConnection * | tp_channel_dispatch_operation_get_connection ()
GStrv | tp_channel_dispatch_operation_get_possible_handlers ()
void | tp_channel_dispatch_operation_handle_with_async ()
gboolean | tp_channel_dispatch_operation_handle_with_finish ()
void | tp_channel_dispatch_operation_handle_with_time_async ()
gboolean | tp_channel_dispatch_operation_handle_with_time_finish ()
void | tp_channel_dispatch_operation_claim_async ()
gboolean | tp_channel_dispatch_operation_claim_finish ()
void | tp_channel_dispatch_operation_claim_with_async ()
gboolean | tp_channel_dispatch_operation_claim_with_finish ()
void | tp_channel_dispatch_operation_close_channels_async ()
gboolean | tp_channel_dispatch_operation_close_channels_finish ()
void | tp_channel_dispatch_operation_leave_channels_async ()
gboolean | tp_channel_dispatch_operation_leave_channels_finish ()
void | tp_channel_dispatch_operation_destroy_channels_async ()
gboolean | tp_channel_dispatch_operation_destroy_channels_finish ()

## Properties

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

## Signals

void | channel-lost | Has Details

## Types and Values

struct | TpChannelDispatchOperation
struct | TpChannelDispatchOperationClass
#define | TP_CHANNEL_DISPATCH_OPERATION_FEATURE_CORE

## Object Hierarchy

        GObject
        ╰── TpProxy
            ╰── TpChannelDispatchOperation

## Includes

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

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

## Functions

### tp_channel_dispatch_operation_new ()

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

`tp_channel_dispatch_operation_new` is deprecated and should not be used in newly-written code.

Since 0.19.9. New code should get TpChannelDispatchOperation objects from a TpBaseClient

Convenience function to create a new channel dispatch operation proxy.

The `immutable_properties` argument is not yet used.

#### Parameters

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.

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

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

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

#### Parameters

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.

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

#### Parameters

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.

#### Parameters

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>

#### Parameters

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.

#### Parameters

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>

#### Parameters

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

    TpAccount *
    tp_channel_dispatch_operation_borrow_account
                                   (TpChannelDispatchOperation *self);

`tp_channel_dispatch_operation_borrow_account` is deprecated and should not be used in newly-written code.

Since 0.19.9. New code should use `tp_channel_dispatch_operation_get_account()` instead.

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

[skip]

#### Parameters

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

`tp_channel_dispatch_operation_borrow_channels` is deprecated and should not be used in newly-written code.

Since 0.19.9. New code should use `tp_channel_dispatch_operation_get_channels()` instead.

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.

[skip]

#### Parameters

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

`tp_channel_dispatch_operation_borrow_connection` is deprecated and should not be used in newly-written code.

Since 0.19.9. New code should use `tp_channel_dispatch_operation_get_connection()` instead.

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

[skip]

#### Parameters

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

`tp_channel_dispatch_operation_borrow_immutable_properties` is deprecated and should not be used in newly-written code.

Since 0.19.9. New code should use individual property getters like `tp_channel_dispatch_operation_get_connection()`, `tp_channel_dispatch_operation_get_account()`, `tp_channel_dispatch_operation_get_channels()`, or `tp_channel_dispatch_operation_get_possible_handlers()` instead.

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.

[skip]

#### Parameters

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

`tp_channel_dispatch_operation_borrow_possible_handlers` is deprecated and should not be used in newly-written code.

Since 0.19.9. New code should use `tp_channel_dispatch_operation_get_possible_handlers()` instead.

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.

[skip]

#### Parameters

self | a TpChannelDispatchOperation |

#### Returns

the value of “possible-handlers”.

[transfer none]

Since: 0.11.5

### tp_channel_dispatch_operation_get_account ()

    TpAccount *
    tp_channel_dispatch_operation_get_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.

[skip]

#### Parameters

self | a TpChannelDispatchOperation |

#### Returns

the value of “account”.

[transfer none]

Since: 0.19.9

### tp_channel_dispatch_operation_get_channels ()

    GPtrArray *
    tp_channel_dispatch_operation_get_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.

#### Parameters

self | a TpChannelDispatchOperation |

#### Returns

the value of “channels”.

[transfer none][element-type TelepathyGLib.Channel]

Since: 0.19.9

### tp_channel_dispatch_operation_get_connection ()

    TpConnection *
    tp_channel_dispatch_operation_get_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.

[skip]

#### Parameters

self | a TpChannelDispatchOperation |

#### Returns

the value of “connection”.

[transfer none]

Since: 0.19.9

### tp_channel_dispatch_operation_get_possible_handlers ()

    GStrv
    tp_channel_dispatch_operation_get_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.

[skip]

#### Parameters

self | a TpChannelDispatchOperation |

#### Returns

the value of “possible-handlers”.

[transfer none]

Since: 0.19.9

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

#### Parameters

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

#### Parameters

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.

#### Parameters

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

#### Parameters

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

`tp_channel_dispatch_operation_claim_async` is deprecated and should not be used in newly-written code.

since 0.15.0. Use `tp_channel_dispatch_operation_claim_with_async()`

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 way as 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_handle_with_async()` for more details. The approver MUST NOT attempt to interact with the channels further in this case.

#### Parameters

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

`tp_channel_dispatch_operation_claim_finish` is deprecated and should not be used in newly-written code.

since 0.15.0. Use `tp_channel_dispatch_operation_claim_with_finish()`

Finishes an async call to `Claim()`.

#### Parameters

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

### tp_channel_dispatch_operation_claim_with_async ()

    void
    tp_channel_dispatch_operation_claim_with_async
                                   (TpChannelDispatchOperation *self,
                                    TpBaseClient *client,
                                    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 way as 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_handle_with_async()` for more details. The approver MUST NOT attempt to interact with the channels further in this case.

This is an improved version of `tp_channel_dispatch_operation_claim_async()` as it tells `client` about the new channels being handled.

`TP_CHANNEL_DISPATCH_OPERATION_FEATURE_CORE` feature must be prepared before calling this function.

#### Parameters

self | a TpChannelDispatchOperation |
client | the TpBaseClient claiming `self` |
callback | a callback to call when the call returns |
user_data | data to pass to `callback` |

Since: 0.15.0

### tp_channel_dispatch_operation_claim_with_finish ()

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

Finishes an async call to `Claim()` initiated using `tp_channel_dispatch_operation_claim_with_async()`.

#### Parameters

self | a TpChannelDispatchOperation |
result | a GAsyncResult |
error | a GError to fill |

#### Returns

`TRUE` if the `Claim()` call was successful, otherwise `FALSE`

Since: 0.15.0

### tp_channel_dispatch_operation_close_channels_async ()

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

Called by an approver to claim channels and close them all right away. If this method is called successfully, `self` has been claimed and `tp_channel_close_async()` has been called on all of its channels.

If successful, this method will cause the “invalidated” signal to be emitted, in the same way as 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_handle_with_async()` for more details.

`TP_CHANNEL_DISPATCH_OPERATION_FEATURE_CORE` feature must be prepared before calling this function.

#### Parameters

self | a TpChannelDispatchOperation |
callback | a callback to call when the request has been satisfied |
user_data | data to pass to `callback` |

Since: 0.15.1

### tp_channel_dispatch_operation_close_channels_finish ()

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

Finishes an async operation initiated using `tp_channel_dispatch_operation_close_channels_async()`.

#### Parameters

self | a TpChannelDispatchOperation |
result | a GAsyncResult |
error | a GError to fill |

#### Returns

`TRUE` if the `Claim()` call was successful and `Close()` has at least been attempted on all the channels, otherwise `FALSE`

Since: 0.15.1

### tp_channel_dispatch_operation_leave_channels_async ()

    void
    tp_channel_dispatch_operation_leave_channels_async
                                   (TpChannelDispatchOperation *self,
                                    TpChannelGroupChangeReason reason,
                                    const gchar *message,
                                    GAsyncReadyCallback callback,
                                    gpointer user_data);

Called by an approver to claim channels and leave them all right away. If this method is called successfully, `self` has been claimed and `tp_channel_leave_async()` has been called on all of its channels.

If successful, this method will cause the “invalidated” signal to be emitted, in the same way as 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_handle_with_async()` for more details.

`TP_CHANNEL_DISPATCH_OPERATION_FEATURE_CORE` feature must be prepared before calling this function.

#### Parameters

self | a TpChannelDispatchOperation |
reason | the leave reason |
message | the leave message |
callback | a callback to call when the request has been satisfied |
user_data | data to pass to `callback` |

Since: 0.15.2

### tp_channel_dispatch_operation_leave_channels_finish ()

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

Finishes an async operation initiated using `tp_channel_dispatch_operation_leave_channels_async()`.

#### Parameters

self | a TpChannelDispatchOperation |
result | a GAsyncResult |
error | a GError to fill |

#### Returns

`TRUE` if the `Claim()` call was successful and `tp_channel_leave_async()` has at least been attempted on all the channels, otherwise `FALSE`

Since: 0.15.2

### tp_channel_dispatch_operation_destroy_channels_async ()

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

Called by an approver to claim channels and destroy them all right away. If this method is called successfully, `self` has been claimed and `tp_channel_destroy_async()` has been called on all of its channels.

If successful, this method will cause the “invalidated” signal to be emitted, in the same way as 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_handle_with_async()` for more details.

`TP_CHANNEL_DISPATCH_OPERATION_FEATURE_CORE` feature must be prepared before calling this function.

#### Parameters

self | a TpChannelDispatchOperation |
callback | a callback to call when the request has been satisfied |
user_data | data to pass to `callback` |

Since: 0.15.2

### tp_channel_dispatch_operation_destroy_channels_finish ()

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

Finishes an async operation initiated using `tp_channel_dispatch_operation_destroy_channels_async()`.

#### Parameters

self | a TpChannelDispatchOperation |
result | a GAsyncResult |
error | a GError to fill |

#### Returns

`TRUE` if the `Claim()` call was successful and `tp_channel_destroy_async()` has at least been attempted on all the channels, otherwise `FALSE`

Since: 0.15.2

## Types and Values

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

Creating a TpChannelDispatchOperation directly is deprecated: it should only be created via a TpBaseClient.

Since 0.16, TpChannelDispatchOperation always has a non-`NULL` “factory”, which will be propagated to the TpAccount, TpConnection and TpChannel.

Since: 0.7.32

### struct TpChannelDispatchOperationClass

    struct TpChannelDispatchOperationClass {
    };

The class of a TpChannelDispatchOperation.

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

## Property Details

### The `“account”` property

      “account”                  TpAccount *

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

Owner: TpChannelDispatchOperation

Flags: Read / Write / Construct Only

Since: 0.11.5

### The `“cdo-properties”` property

      “cdo-properties”           GHashTable_gchararray+GValue_*

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

Owner: TpChannelDispatchOperation

Flags: Read / Write / Construct Only

Since: 0.11.5

### The `“channels”` property

      “channels”                 GPtrArray *

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

Owner: TpChannelDispatchOperation

Flags: Read / Write / Construct Only

Since: 0.11.5

### The `“connection”` property

      “connection”               TpConnection *

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

Owner: TpChannelDispatchOperation

Flags: Read / Write / Construct Only

Since: 0.11.5

### The `“possible-handlers”` property

      “possible-handlers”        GStrv

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

Owner: TpChannelDispatchOperation

Flags: Read

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)

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

#### Parameters

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

Flags: Has Details

Since: 0.11.5

## See Also

TpChannelDispatcher