summaryrefslogtreecommitdiff
path: root/spec/Channel_Dispatch_Operation.xml
blob: 85789fdbe8a65323a945fc5435d734c74c464029 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
<?xml version="1.0" ?>
<node name="/Channel_Dispatch_Operation"
  xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">

  <tp:copyright>Copyright © 2008-2009 Collabora Ltd.</tp:copyright>
  <tp:copyright>Copyright © 2008-2009 Nokia Corporation</tp:copyright>
  <tp:license xmlns="http://www.w3.org/1999/xhtml">
    <p>This library is free software; you can redistribute it and/or
      modify it under the terms of the GNU Lesser General Public
      License as published by the Free Software Foundation; either
      version 2.1 of the License, or (at your option) any later version.</p>

    <p>This library is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      Lesser General Public License for more details.</p>

    <p>You should have received a copy of the GNU Lesser General Public
      License along with this library; if not, write to the Free Software
      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
      MA 02110-1301, USA.</p>
  </tp:license>

  <interface name="im.telepathy.v1.ChannelDispatchOperation">
    <tp:added version="0.17.26">(as a stable interface)</tp:added>

    <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
      <p>A channel dispatch operation is an object in the ChannelDispatcher
        representing an unrequested channel being announced to
        client
        <tp:dbus-ref namespace="im.telepathy.v1.Client">Approver</tp:dbus-ref>
        processes.</p>

      <p>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.</p>

      <p>More specifically, whenever the <tp:dbus-ref
        namespace="im.telepathy.v1">Connection.Interface.Requests.NewChannel</tp:dbus-ref>
        signal contains a channel whose <tp:dbus-ref
        namespace="im.telepathy.v1.Channel">Requested</tp:dbus-ref>
        property is false, a ChannelDispatchOperation
        object is created for that channel.</p>

      <p>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 <tp:dbus-ref
          namespace="im.telepathy.v1">Channel.Interface.Destroyable1.Destroy</tp:dbus-ref>
        if supported, or <tp:dbus-ref
          namespace="im.telepathy.v1">Channel.Close</tp:dbus-ref>
        otherwise.</p>

      <p>If a handler with <tp:dbus-ref
          namespace="im.telepathy.v1.Client.Handler">BypassApproval</tp:dbus-ref>
        <code>= True</code> could handle the channel in the dispatch
        operation, then the channel dispatcher SHOULD call <tp:dbus-ref
          namespace="im.telepathy.v1.Client.Handler">HandleChannel</tp:dbus-ref>
        on that handler, and (assuming the call succeeds) emit
        <tp:member-ref>Finished</tp:member-ref> and stop processing that
        channel without involving any approvers.</p>

      <tp:rationale>
        <p>Some channel types can be picked up "quietly" by an existing
          channel handler. If a <tp:dbus-ref
            namespace="im.telepathy.v1.Channel.Type">Text</tp:dbus-ref>
          channel is added to an existing bundle containing a <tp:dbus-ref
            namespace="im.telepathy.v1.Channel.Type">Call1</tp:dbus-ref>
          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.</p>
      </tp:rationale>

      <p>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
        <tp:dbus-ref
          namespace="im.telepathy.v1.Client.Approver">AddDispatchOperation</tp:dbus-ref>
        for more details on this.</p>

      <p>Finally, if the approver requested it, the channel dispatcher SHOULD
        send the channel to a handler.</p>
    </tp:docstring>

    <property name="Interfaces" tp:name-for-bindings="Interfaces"
      type="as" access="read" tp:type="DBus_Interface[]">
      <tp:docstring>
        A list of the extra interfaces provided by this channel dispatch
        operation. This property cannot change.
      </tp:docstring>
    </property>

    <property name="Connection" tp:name-for-bindings="Connection"
      type="o" access="read">
      <tp:docstring>
        The <tp:dbus-ref
          namespace="im.telepathy.v1">Connection</tp:dbus-ref>
        with which the <tp:member-ref>Channel</tp:member-ref> 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.
      </tp:docstring>
    </property>

    <property name="Account" tp:name-for-bindings="Account"
      type="o" access="read">
      <tp:docstring>
        The <tp:dbus-ref
          namespace="im.telepathy.v1">Account</tp:dbus-ref>
        with which the <tp:member-ref>Connection</tp:member-ref>
        and <tp:member-ref>Channel</tp:member-ref> is
        associated. This property cannot change.
      </tp:docstring>
    </property>

    <property name="Channel" type="o" tp:name-for-bindings="Channel"
      access="read">
      <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
        <p>The Channel object. Its well-known bus name is the same
          as that of the <tp:member-ref>Connection</tp:member-ref>.
          This property cannot change.</p>
      </tp:docstring>
    </property>

    <property name="ChannelProperties" access="read" type="a{sv}"
      tp:type="Qualified_Property_Value_Map"
      tp:name-for-bindings="Channel_Properties">
      <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
        <p>Properties of the <tp:member-ref>Channel</tp:member-ref>,
          equivalent to the properties in <tp:type>Channel_Details</tp:type>.
          This property cannot change.</p>
      </tp:docstring>
    </property>

    <property name="PossibleHandlers" tp:name-for-bindings="Possible_Handlers"
      type="as" access="read" tp:type="DBus_Well_Known_Name[]">
      <tp:docstring>
        <p>The well known bus names (starting with
          <code>im.telepathy.v1.Client.</code>) of the possible
          <tp:dbus-ref
            namespace="im.telepathy.v1.Client">Handler</tp:dbus-ref>s
          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.</p>

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

        <tp:rationale>
          <p>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.</p>
        </tp:rationale>
      </tp:docstring>
    </property>

    <method name="HandleWith" tp:name-for-bindings="Handle_With">
      <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 channel 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
          themselves.</p>

        <p>(FIXME: list some possible errors)</p>

        <p>If the channel handler raises an error from <tp:dbus-ref
            namespace="im.telepathy.v1.Client.Handler">HandleChannel</tp:dbus-ref>,
          this method
          MAY respond by raising that same error, even if it is not
          specifically documented here.</p>
      </tp:docstring>

      <arg direction="in" type="s" tp:type="DBus_Bus_Name" name="Handler">
        <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
          <p>The well-known bus name (starting with
            <code>im.telepathy.v1.Client.</code>) of the channel
            handler that should handle the channel, or the empty string
            if the client has no preferred channel handler.</p>
        </tp:docstring>
      </arg>

      <arg direction="in" type="x" tp:type="User_Action_Timestamp" name="UserActionTime">
        <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
          <p>The time at which user action occurred,
            or 0 if no user action was involved in selecting the
            Handler or approving handling.</p>
        </tp:docstring>
      </arg>

      <tp:possible-errors>
        <tp:error name="im.telepathy.v1.Error.InvalidArgument">
          <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
            The selected handler is non-empty, but is not a syntactically
            correct <tp:type>DBus_Bus_Name</tp:type> or does not start with
            "<code>im.telepathy.v1.Client.</code>".
          </tp:docstring>
        </tp:error>
        <tp:error name="im.telepathy.v1.Error.NotAvailable">
          <tp:docstring>
            The selected handler is temporarily unable to handle this
            channel.
          </tp:docstring>
        </tp:error>
        <tp:error name="im.telepathy.v1.Error.NotImplemented">
          <tp:docstring>
            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).
          </tp:docstring>
        </tp:error>
        <tp:error name="im.telepathy.v1.Error.NotYours">
          <tp:docstring>
            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.
          </tp:docstring>
        </tp:error>
      </tp:possible-errors>
    </method>

    <method name="Claim" tp:name-for-bindings="Claim">
      <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="im.telepathy.v1.Client.Handler">HandleChannel</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="im.telepathy.v1.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="im.telepathy.v1.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="im.telepathy.v1">Channel.Interface.Destroyable1.Destroy</tp:dbus-ref>
            if the destructive behaviour of that method is desired.</p>

          <p>Similarly, an Approver for <tp:dbus-ref
            namespace="imt1.Channel.Type">Call1</tp:dbus-ref> 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 channel further in this
          case.</p>

        <p>(FIXME: list some other possible errors)</p>
      </tp:docstring>

      <tp:possible-errors>
        <tp:error name="im.telepathy.v1.Error.NotYours">
          <tp:docstring>
            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.
          </tp:docstring>
        </tp:error>
      </tp:possible-errors>
    </method>

    <signal name="Finished" tp:name-for-bindings="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 channel in response to this signal.</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="im.telepathy.v1.Client.Approver">AddDispatchOperation</tp:dbus-ref>
          method.</p>

        <tp:rationale>
          <p>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).</p>
        </tp:rationale>
      </tp:docstring>

      <arg name="Error" type="s" tp:type="DBus_Error_Name">
        <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
          <p>If the channel dispatch operation finished because the
            channel was successfully dispatched, the empty string.</p>

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

      <arg name="Message" type="s">
        <tp:docstring>
          A string associated with the D-Bus error.
        </tp:docstring>
      </arg>
    </signal>

  </interface>
</node>
<!-- vim:set sw=2 sts=2 et ft=xml: -->