Interface ChannelDispatchOperation

Interface Index (Compact) | Summary | Description | Methods | Signals | Properties

Methods

HandleWith (s: Handler, x: UserActionTime) nothing
Claim () nothing

Signals

Finished (s: Error, s: Message)

Properties

Interfaces as (DBus_Interface_List) Read only
Connection o Read only
Account o Read only
Channel o Read only
ChannelProperties a{sv} (Qualified_Property_Value_Map) Read only
PossibleHandlers as (DBus_Well_Known_Name_List) Read only
Added in 0.17.26. (as a stable interface)

Description

A channel dispatch operation is an object in the ChannelDispatcher representing an unrequested channel being announced to client Approver processes.

These objects can result from new incoming channels or channels which are automatically created for some reason, but cannot result from outgoing requests for channels.

More specifically, whenever the Connection.Interface.Requests.NewChannel signal contains a channel whose Requested property is false, a ChannelDispatchOperation object is created for that channel.

If no handler at all can handle a channel, the channel dispatcher SHOULD terminate that channel instead of creating a channel dispatcher for it. It is RECOMMENDED that the channel dispatcher closes the channel using Channel.Interface.Destroyable1.Destroy if supported, or Channel.Close otherwise.

If a handler with BypassApproval = True could handle the channel in the dispatch operation, then the channel dispatcher SHOULD call HandleChannel on that handler, and (assuming the call succeeds) emit Finished and stop processing that channel without involving any approvers.

Rationale:

Some channel types can be picked up "quietly" by an existing channel handler. If a Text channel is added to an existing bundle containing a Call1 channel, there shouldn't be any approvers, flashing icons or notification bubbles, if the the UI for the Call channel can just add a text box and display the message.

Otherwise, the channel dispatcher SHOULD send the channel dispatch operation to all relevant approvers (in parallel) and wait for an approver to claim the channel or request that it is handled. See AddDispatchOperation for more details on this.

Finally, if the approver requested it, the channel dispatcher SHOULD send the channel to a handler.

Methods

(Permalink)

HandleWith (s: Handler, x: UserActionTime) → nothing

Parameters

  • Handler — s (DBus_Bus_Name)
  • The well-known bus name (starting with im.telepathy.v1.Client.) of the channel handler that should handle the channel, or the empty string if the client has no preferred channel handler.

  • UserActionTime — x (User_Action_Timestamp)
  • The time at which user action occurred, or 0 if no user action was involved in selecting the Handler or approving handling.

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 ChannelDispatchOperation object to disappear, emitting Finished.

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 channel further in this case, unless it is separately invoked as the handler.

Approvers which are also channel handlers SHOULD use Claim instead of HandleWith to request that they can handle a channel themselves.

(FIXME: list some possible errors)

If the channel handler raises an error from HandleChannel, this method MAY respond by raising that same error, even if it is not specifically documented here.


Possible Errors

  • Invalid Argument
  • The selected handler is non-empty, but is not a syntactically correct DBus_Bus_Name or does not start with "im.telepathy.v1.Client.".
  • Not Available
  • The selected handler is temporarily unable to handle this channel.
  • Not Implemented
  • The selected handler is syntactically correct, but will never be able to handle this channel (for instance because the channel does not match its HandlerChannelFilter, or because HandleChannel raised NotImplemented).
  • Not Yours
  • At the time that HandleWith was called, this dispatch operation was processing an earlier call to HandleWith. The earlier call has now succeeded, so some Handler nominated by another approver is now responsible for the channel. In this situation, the second call to HandleWith MUST NOT return until the first one has returned successfully or unsuccessfully, and if the first call to HandleChannel fails, the channel dispatcher SHOULD try to obey the choice of Handler made by the second call to HandleWith.
(Permalink)

Claim () → nothing

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 does not have the HandleChannel method called on it.

Clients that call Claim on channels but do not immediately close them SHOULD implement the Handler interface and its HandledChannels property.

Approvers wishing to reject channels MUST call this method to claim ownership of them, and MUST NOT call Close on the channels unless/until this method returns successfully.

Rationale:

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 Channel.Interface.Destroyable1.Destroy if the destructive behaviour of that method is desired.

Similarly, an Approver for Call1 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.

If successful, this method will cause the ChannelDispatchOperation object to disappear, emitting Finished, in the same way as for HandleWith.

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

(FIXME: list some other possible errors)


Possible Errors

  • Not Yours
  • At the time that Claim was called, this dispatch operation was processing a call to HandleWith which has now succeeded, so some Handler nominated by another approver is now responsible for the channel.

Signals

(Permalink)

Finished (s: Error, s: Message)

Parameters

  • Error — s (DBus_Error_Name)
  • If the channel dispatch operation finished because the channel was successfully dispatched, the empty string.

    Otherwise, the name of a D-Bus error indicating why the channel closed. If no better reason can be found, im.telepathy.v1.Error.NotAvailable MAY be used as a fallback; this means that this error SHOULD NOT be given any more specific meaning.

  • Message — s
  • A string associated with the D-Bus error.

Emitted when this dispatch operation finishes. The dispatch operation is no longer present and further methods must not be called on it.

Approvers that have a user interface SHOULD stop notifying the user about the channel in response to this signal.

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.

Rationale:

Otherwise, clients might accidentally call HandleWith or Claim on a new dispatch operation instead of the one they intended to handle.

This signal MUST NOT be emitted until all Approvers that were invoked have returned (successfully or with an error) from their AddDispatchOperation method.

Rationale:

This means that Approvers can connect to the Finished 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 Finished, then download properties (and on error, perhaps assume that the operation has already Finished).

Properties

Accessed using the org.freedesktop.DBus.Properties interface.
(Permalink)

Interfaces — as (DBus_Interface_List)

Read only
A list of the extra interfaces provided by this channel dispatch operation. This property cannot change.
(Permalink)

Connection — o

Read only
The Connection with which the Channel is associated. The well-known bus name to use can be derived from this object path by removing the leading '/' and replacing all subsequent '/' by '.'. This property cannot change.
(Permalink)

Account — o

Read only
The Account with which the Connection and Channel is associated. This property cannot change.
(Permalink)

Channel — o

Read only

The Channel object. Its well-known bus name is the same as that of the Connection. This property cannot change.

(Permalink)

ChannelProperties — a{sv} (Qualified_Property_Value_Map)

Read only

Properties of the Channel, equivalent to the properties in Channel_Details. This property cannot change.

(Permalink)

PossibleHandlers — as (DBus_Well_Known_Name_List)

Read only

The well known bus names (starting with im.telepathy.v1.Client.) of the possible Handlers for this channel. The channel dispatcher MUST place the most preferred handlers first, according to some reasonable heuristic. As a result, approvers SHOULD use the first handler by default.

The heuristic used to prioritize handlers SHOULD give a higher priority to handlers that are already running.

Rationale:

If, for instance, Empathy and Kopete have similar functionality, and Empathy is running, we should prefer to send channels to it rather than launching Kopete via service activation.