TpChannelDispatchOperation

TpChannelDispatchOperation — proxy object for a to the Telepathy channel dispatcher

Synopsis

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

struct              TpChannelDispatchOperation;
struct              TpChannelDispatchOperationClass;
void                tp_channel_dispatch_operation_init_known_interfaces
                                                        (void);

#define             TP_CHANNEL_DISPATCH_OPERATION_FEATURE_CORE
TpAccount *         tp_channel_dispatch_operation_get_account
                                                        (TpChannelDispatchOperation *self);
GPtrArray *         tp_channel_dispatch_operation_get_channels
                                                        (TpChannelDispatchOperation *self);
TpConnection *      tp_channel_dispatch_operation_get_connection
                                                        (TpChannelDispatchOperation *self);
GStrv               tp_channel_dispatch_operation_get_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_with_async
                                                        (TpChannelDispatchOperation *self,
                                                         TpBaseClient *client,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
gboolean            tp_channel_dispatch_operation_claim_with_finish
                                                        (TpChannelDispatchOperation *self,
                                                         GAsyncResult *result,
                                                         GError **error);
void                tp_channel_dispatch_operation_close_channels_async
                                                        (TpChannelDispatchOperation *self,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
gboolean            tp_channel_dispatch_operation_close_channels_finish
                                                        (TpChannelDispatchOperation *self,
                                                         GAsyncResult *result,
                                                         GError **error);
void                tp_channel_dispatch_operation_leave_channels_async
                                                        (TpChannelDispatchOperation *self,
                                                         TpChannelGroupChangeReason reason,
                                                         const gchar *message,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
gboolean            tp_channel_dispatch_operation_leave_channels_finish
                                                        (TpChannelDispatchOperation *self,
                                                         GAsyncResult *result,
                                                         GError **error);
void                tp_channel_dispatch_operation_destroy_channels_async
                                                        (TpChannelDispatchOperation *self,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
gboolean            tp_channel_dispatch_operation_destroy_channels_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"                                   : 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_channel_dispatch_operation_claim_with_async(). 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_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_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_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.

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.

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.

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.

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

TP_CHANNEL_DISPATCH_OPERATION_FEATURE_CORE feature must be prepared before calling this function.

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

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.

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

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.

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

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.

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

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

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