telepathy-glib Reference Manual | ||||
---|---|---|---|---|
TpChannelDispatchOperationTpChannelDispatchOperation — proxy object for a to the Telepathy channel dispatcher |
#include <telepathy-glib/channel-dispatch-operation.h> struct TpChannelDispatchOperation; struct TpChannelDispatchOperationClass; TpChannelDispatchOperation* tp_channel_dispatch_operation_new (TpDBusDaemon *bus_daemon, const gchar *object_path, GHashTable *immutable_properties, GError **error); void tp_channel_dispatch_operation_init_known_interfaces (void); void (*tp_cli_channel_dispatch_operation_callback_for_claim) (TpChannelDispatchOperation *proxy, const GError *error, gpointer user_data, GObject *weak_object); TpProxyPendingCall* tp_cli_channel_dispatch_operation_call_claim (TpChannelDispatchOperation *proxy, gint timeout_ms, tp_cli_channel_dispatch_operation_callback_for_claim callback, gpointer user_data, GDestroyNotify destroy, GObject *weak_object); void (*tp_cli_channel_dispatch_operation_callback_for_handle_with) (TpChannelDispatchOperation *proxy, const GError *error, gpointer user_data, GObject *weak_object); TpProxyPendingCall* tp_cli_channel_dispatch_operation_call_handle_with (TpChannelDispatchOperation *proxy, gint timeout_ms, const gchar *in_Handler, tp_cli_channel_dispatch_operation_callback_for_handle_with callback, gpointer user_data, GDestroyNotify destroy, GObject *weak_object); void (*tp_cli_channel_dispatch_operation_signal_callback_channel_lost) (TpChannelDispatchOperation *proxy, const gchar *arg_Channel, const gchar *arg_Error, const gchar *arg_Message, gpointer user_data, GObject *weak_object); TpProxySignalConnection* tp_cli_channel_dispatch_operation_connect_to_channel_lost (TpChannelDispatchOperation *proxy, tp_cli_channel_dispatch_operation_signal_callback_channel_lost callback, gpointer user_data, GDestroyNotify destroy, GObject *weak_object, GError **error); void (*tp_cli_channel_dispatch_operation_signal_callback_finished) (TpChannelDispatchOperation *proxy, gpointer user_data, GObject *weak_object); TpProxySignalConnection* tp_cli_channel_dispatch_operation_connect_to_finished (TpChannelDispatchOperation *proxy, tp_cli_channel_dispatch_operation_signal_callback_finished callback, gpointer user_data, GDestroyNotify destroy, GObject *weak_object, GError **error);
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.
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 D-Bus signal ChannelLost is emitted; this class
doesn't (yet) have a GObject binding for this signal, but you can use
tp_cli_channel_dispatch_operation_connect_to_channel_lost()
. If all channels
close, there is nothing more to dispatch, so the invalidated signal will be
emitted with the domain TP_DBUS_ERRORS
and the error code
TP_DBUS_ERROR_OBJECT_REMOVED
.
If the channel dispatcher crashes or exits, the invalidated
signal will be emitted with the domain TP_DBUS_ERRORS
and the error code
TP_DBUS_ERROR_NAME_OWNER_LOST
. In a high-quality implementation, the
dispatcher should be restarted, at which point it will create new
channel dispatch operations for any undispatched channels, and the approver
will be notified again.
This proxy is usable but incomplete: accessors for the D-Bus properties will
be added in a later version of telepathy-glib, along with a mechanism
similar to tp_connection_call_when_ready()
.
Since 0.7.32
struct TpChannelDispatchOperationClass { };
The class of a TpChannelDispatchOperation.
TpChannelDispatchOperation* tp_channel_dispatch_operation_new (TpDBusDaemon *bus_daemon, const gchar *object_path, GHashTable *immutable_properties, GError **error);
Convenience function to create a new channel dispatch operation proxy.
The immutable_properties
argument is not yet used.
bus_daemon : |
Proxy for the D-Bus daemon |
object_path : |
The non-NULL object path of this channel dispatch operation |
immutable_properties : |
As many as are known of the immutable D-Bus
properties of this channel dispatch operation, or NULL if none are known
|
error : |
Used to raise an error if NULL is returned
|
Returns : | a new reference to an channel dispatch operation proxy, or NULL if
object_path is not syntactically valid or the channel dispatcher is not
running
|
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
void (*tp_cli_channel_dispatch_operation_callback_for_claim) (TpChannelDispatchOperation *proxy, const GError *error, gpointer user_data, GObject *weak_object);
Signature of the callback called when a Claim method call succeeds or fails.
proxy : |
the proxy on which the call was made |
error : |
NULL on success, or an error on failure
|
user_data : |
user-supplied data |
weak_object : |
user-supplied object |
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. "busy") if desired. The channel dispatcher, which is designed to have no specific knowledge of particular channel types, can't do that.</p> </tp:rationale> <p>If successful, this method will cause the ChannelDispatchOperation object to disappear, emitting <tp:member-ref>Finished</tp:member-ref>, in the same way as for <tp:member-ref>HandleWith</tp:member-ref>.</p> <p>This method may fail because the dispatch operation has already been completed. Again, see HandleWith for more details. The approver MUST NOT attempt to interact with the channels further in this case.</p> <p>(FIXME: list some other possible errors)</p>
proxy : |
the TpProxy |
timeout_ms : |
the timeout in milliseconds, or -1 to use the default |
callback : |
called when the method call succeeds or fails;
may be NULL to make a "fire and forget" call with no
reply tracking
|
user_data : |
user-supplied data passed to the callback;
must be NULL if callback is NULL
|
destroy : |
called with the user_data as argument, after the
call has succeeded, failed or been cancelled;
must be NULL if callback is NULL
|
weak_object : |
If not NULL , a GObject which will be
weakly referenced; if it is destroyed, this call
will automatically be cancelled. Must be NULL if
callback is NULL
|
Returns : | a TpProxyPendingCall representing the call in progress. It is borrowed from the object, and will become invalid when the callback is called, the call is cancelled or the TpProxy becomes invalid. |
void (*tp_cli_channel_dispatch_operation_callback_for_handle_with) (TpChannelDispatchOperation *proxy, const GError *error, gpointer user_data, GObject *weak_object);
Signature of the callback called when a HandleWith method call succeeds or fails.
proxy : |
the proxy on which the call was made |
error : |
NULL on success, or an error on failure
|
user_data : |
user-supplied data |
weak_object : |
user-supplied object |
TpProxyPendingCall* tp_cli_channel_dispatch_operation_call_handle_with (TpChannelDispatchOperation *proxy, gint timeout_ms, const gchar *in_Handler, tp_cli_channel_dispatch_operation_callback_for_handle_with callback, gpointer user_data, GDestroyNotify destroy, GObject *weak_object);
Start a HandleWith method call.
<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Called by an approver to accept a channel bundle and request that the given handler be used to handle it.</p> <p>If successful, this method will cause the ChannelDispatchOperation object to disappear, emitting <tp:member-ref>Finished</tp:member-ref>.</p> <p>However, this method may fail because the dispatch has already been completed and the object has already gone. If this occurs, it indicates that another approver has asked for the bundle to be handled by a particular handler. The approver MUST NOT attempt to interact with the channels further in this case, unless it is separately invoked as the handler.</p> <p>Approvers which are also channel handlers SHOULD use <tp:member-ref>Claim</tp:member-ref> instead of HandleWith to request that they can handle a channel bundle themselves.</p> <p>(FIXME: list some possible errors)</p> <p>If the channel handler raises an error from <tp:dbus-ref namespace="org.freedesktop.Telepathy.Client.Handler">HandleChannels</tp:dbus-ref>, this method MAY respond by raising that same error, even if it is not specifically documented here.</p>
proxy : |
the TpProxy |
timeout_ms : |
the timeout in milliseconds, or -1 to use the default |
in_Handler : |
Used to pass an 'in' argument: <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>The well-known bus name (starting with <code>org.freedesktop.Telepathy.Client.</code>) of the channel handler that should handle the channel, or the empty string if the client has no preferred channel handler.</p> |
callback : |
called when the method call succeeds or fails;
may be NULL to make a "fire and forget" call with no
reply tracking
|
user_data : |
user-supplied data passed to the callback;
must be NULL if callback is NULL
|
destroy : |
called with the user_data as argument, after the
call has succeeded, failed or been cancelled;
must be NULL if callback is NULL
|
weak_object : |
If not NULL , a GObject which will be
weakly referenced; if it is destroyed, this call
will automatically be cancelled. Must be NULL if
callback is NULL
|
Returns : | a TpProxyPendingCall representing the call in progress. It is borrowed from the object, and will become invalid when the callback is called, the call is cancelled or the TpProxy becomes invalid. |
void (*tp_cli_channel_dispatch_operation_signal_callback_channel_lost) (TpChannelDispatchOperation *proxy, const gchar *arg_Channel, const gchar *arg_Error, const gchar *arg_Message, gpointer user_data, GObject *weak_object);
Represents the signature of a callback for the signal ChannelLost.
proxy : |
The proxy on which tp_cli_channel_dispatch_operation_connect_to_channel_lost()
was called
|
arg_Channel : |
The <tp:dbus-ref namespace="org.freedesktop.Telepathy">Channel</tp:dbus-ref> that closed. |
arg_Error : |
<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>The name of a D-Bus error indicating why the channel closed. If no better reason can be found, <code>org.freedesktop.Telepathy.Error.NotAvailable</code> MAY be used as a fallback; this means that this error SHOULD NOT be given any more specific meaning.</p> |
arg_Message : |
A string associated with the D-Bus error. |
user_data : |
User-supplied data |
weak_object : |
User-supplied weakly referenced object |
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 "connect to signals then recover state" model - first connect to ChannelLost and <tp:member-ref>Finished</tp:member-ref>, then download <tp:member-ref>Channels</tp:member-ref> (and on error, perhaps assume that the operation has already Finished).</p> </tp:rationale>
proxy : |
A TpChannelDispatchOperation or subclass |
callback : |
Callback to be called when the signal is received |
user_data : |
User-supplied data for the callback |
destroy : |
Destructor for the user-supplied data, which
will be called when this signal is disconnected, or
before this function returns NULL
|
weak_object : |
A GObject which will be weakly referenced; if it is destroyed, this callback will automatically be disconnected |
error : |
If not NULL , used to raise an error if NULL is
returned
|
Returns : | a TpProxySignalConnection containing all of the
above, which can be used to disconnect the signal; or
NULL if the proxy does not have the desired interface
or has become invalid.
|
void (*tp_cli_channel_dispatch_operation_signal_callback_finished) (TpChannelDispatchOperation *proxy, gpointer user_data, GObject *weak_object);
Represents the signature of a callback for the signal Finished.
proxy : |
The proxy on which tp_cli_channel_dispatch_operation_connect_to_finished()
was called
|
user_data : |
User-supplied data |
weak_object : |
User-supplied weakly referenced object |
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 "connect to signals then recover state" model - first connect to <tp:member-ref>ChannelLost</tp:member-ref> and Finished, then download <tp:member-ref>Channels</tp:member-ref> (and on error, perhaps assume that the operation has already Finished).</p> </tp:rationale>
proxy : |
A TpChannelDispatchOperation or subclass |
callback : |
Callback to be called when the signal is received |
user_data : |
User-supplied data for the callback |
destroy : |
Destructor for the user-supplied data, which
will be called when this signal is disconnected, or
before this function returns NULL
|
weak_object : |
A GObject which will be weakly referenced; if it is destroyed, this callback will automatically be disconnected |
error : |
If not NULL , used to raise an error if NULL is
returned
|
Returns : | a TpProxySignalConnection containing all of the
above, which can be used to disconnect the signal; or
NULL if the proxy does not have the desired interface
or has become invalid.
|