TpChannelDispatchOperation

TpChannelDispatchOperation — proxy object for a to the Telepathy channel dispatcher

Functions

Properties

TpAccount * account Read / Write / Construct Only
GVariant * cdo-properties Read / Write / Construct Only
TpChannel * channel Read / Write / Construct Only
TpConnection * connection Read / Write / Construct Only
GStrv possible-handlers Read

Types and Values

Object Hierarchy

    GObject
    ╰── TpProxy
        ╰── TpChannelDispatchOperation

Includes

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

Description

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

Functions

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.

Parameters

Returns

the value of “account”.

[transfer none]

Since 0.19.9


tp_channel_dispatch_operation_get_channel ()

TpChannel *
tp_channel_dispatch_operation_get_channel
                               (TpChannelDispatchOperation *self);

Returns the TpChannel of this ChannelDispatchOperation.

Parameters

Returns

the value of “channel”.

[transfer none]


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.

Parameters

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.

Parameters

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

 

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

Parameters

self

a TpChannelDispatchOperation

 

result

a GAsyncResult

 

error

a GError to fill

 

Returns

TRUE if the HandleWithTime() call was successful, otherwise FALSE


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 channel 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 channel further in this case.

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

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

Called by an approver to claim channel and close it right away. If this method is called successfully, self has been claimed and tp_channel_close_async() has been called on 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.

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

 

tp_channel_dispatch_operation_close_channel_finish ()

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

Finishes an async operation initiated using tp_channel_dispatch_operation_close_channel_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 the channel, otherwise FALSE


tp_channel_dispatch_operation_leave_channel_async ()

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

Called by an approver to claim channel and leave it right away. If this method is called successfully, self has been claimed and tp_channel_leave_async() has been called on 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.

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

 

tp_channel_dispatch_operation_leave_channel_finish ()

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

Finishes an async operation initiated using tp_channel_dispatch_operation_leave_channel_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 been attempted on the channel, otherwise FALSE


tp_channel_dispatch_operation_destroy_channel_async ()

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

Called by an approver to claim channel and destroy it right away. If this method is called successfully, self has been claimed and tp_channel_destroy_async() has been called on 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.

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

 

tp_channel_dispatch_operation_destroy_channel_finish ()

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

Finishes an async operation initiated using tp_channel_dispatch_operation_destroy_channel_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 the channel, otherwise FALSE

Types and Values

struct TpChannelDispatchOperation

struct TpChannelDispatchOperation;

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

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

If the user wishes to reject the communication channel, or if the user accepts the channel 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 channel 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 all the channel 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 channel, 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)

  • “channel” 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 channel 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.

Flags: Read / Write / Construct Only

Since 0.11.5


The “cdo-properties” property

  “cdo-properties”           GVariant *

The immutable D-Bus properties of this ChannelDispatchOperation, represented by a GVariant of type G_VARIANT_TYPE_VARDICT where the keys are D-Bus interface name + "." + property name.

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.

Flags: Read / Write / Construct Only

Allowed values: GVariant<a{sv}>

Default value: NULL


The “channel” property

  “channel”                  TpChannel *

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.

Flags: Read / Write / Construct Only


The “connection” property

  “connection”               TpConnection *

The TpConnection with which the channel is 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.

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

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.

Flags: Read

Since 0.11.5

See Also

TpChannelDispatcher