Description
This interface allows DBus clients to use the ChannelDispatcher to send one-off text messages to a contact, identified by account and target ID, without requiring the caller to handle channels or be the primary message UI.
Rationale:
This enables entities other than the main UI to send messages to contacts.
Methods
SendMessage (o: Account, s: Target_ID, aa{sv}: Message, u: Flags) → s: Token
Parameters
- Account — o
- Target_ID — s
- Message — aa{sv} (Message_Part_List)
- Flags — u
Returns
- Token — s
Submit a message to the server for sending, like the Messages.SendMessage method.
If the Account is connected and a Text channel to the Target_ID already exists, this method is equivalent to sending the same message via that channel.
Otherwise, this method creates a channel (connecting the Account if appropriate), sends the desired message, and closes the channel as if via Channel.Close, without acknowledging any messages received on that channel during that time.
If any messages are received on that channel before it is closed, a correct connection manager implementation will reopen the channel when it is closed, resulting in those "rescued" messages being processed by the system's normal Handler for text channels. In particular, this deals with the situation where a successful or failed delivery report is received before the channel is closed.
Rationale:
Expecting a trivial client (perhaps a send-only IRC bot, or a simple SMS-sending API) to go through all those steps to send a message seems somewhat unreasonable. Having this as a method in the ChannelDispatcher lets it take some short-cuts if required, and centralizes the implementation to reduce the risk of mistakes that cause message loss.
The ChannelDispatcher SHOULD support this method for any connection manager that would accept channel requests of this form:
{ …Channel.ChannelType: …Channel.Type.Text, …Channel.TargetHandleType: Contact, …Channel.TargetID: Target_ID }
However, if the connection manager provides additional APIs (such as a way to open "send-only" channels), the ChannelDispatcher MAY use those: it is not required to use those exact request parameters.
This method may raise any error that would be raised by the Requests.EnsureChannel or Messages.SendMessage methods, or signalled by the Failed signal.
Possible Errors
- Disconnected
- Network Error
- Not Implemented
- Invalid Handle
- Invalid Handle
- Offline
- Not Available
- Permission Denied