18
18
License along with this library; if not, write to the Free Software
19
19
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</p>
21
<interface name="org.freedesktop.Telepathy.Channel.Type.ContactSearch"
22
tp:causes-havoc='not well-tested'>
21
<interface name="org.freedesktop.Telepathy.Channel.Type.ContactSearch.DRAFT"
22
tp:causes-havoc='experimental'>
23
23
<tp:requires interface="org.freedesktop.Telepathy.Channel"/>
25
<tp:struct name="Search_Key_Info">
26
<tp:docstring>A struct representing details on search strings.</tp:docstring>
27
<tp:member type="b" name="Is_Mandatory">
28
<tp:docstring>Booleans indicating if the search key is mandatory.
31
<tp:member type="g" name="Type_Signature">
32
<tp:docstring>The type signature of the value for this search key.
37
<tp:mapping name="Search_Key_Info_Map">
38
<tp:docstring>A dictionary mapping string search key names to its search details.
40
<tp:member type="s" name="Term"/>
41
<tp:member type="(bg)" tp:type="Search_Key_Info" name="Details"/>
44
<method name="GetSearchKeys" tp:name-for-bindings="Get_Search_Keys">
45
<arg direction="out" type="s">
47
A string with any instructions from the server
50
<arg direction="out" type="a{s(bg)}" tp:type="Search_Key_Info_Map">
51
<tp:docstring xmlns="http://www.w3.org/1999/xhtml">
52
A dictionary mapping string search key names to its search details.
55
<tp:docstring xmlns="http://www.w3.org/1999/xhtml">
56
<p>Returns any instructions from the server along with a dictionary of
57
search key names to their types, and a boolean indicating if the key is
58
mandatory. The following well-known search key names should be used
59
where appropriate:</p>
61
<dt>s:first</dt><dd>The desired contact's given name</dd>
62
<dt>s:last</dt><dd>The desired contact's family name</dd>
63
<dt>s:nick</dt><dd>The desired contact's nickname</dd>
64
<dt>s:email</dt><dd>The e-mail address of the desired contact</dd>
68
<tp:error name="org.freedesktop.Telepathy.Error.Disconnected"/>
69
<tp:error name="org.freedesktop.Telepathy.Error.NetworkError"/>
70
<tp:error name="org.freedesktop.Telepathy.Error.NotAvailable"/>
25
<tp:docstring xmlns="http://www.w3.org/1999/xhtml">
26
<p>A channel type for searching server-stored user directories. A new
27
channel should be requested by a client for each search attempt, and
28
closed when the search is completed or the required result has been
29
found in order to free unused handles.</p>
31
<p>Before searching, the
32
<tp:member-ref>AvailableSearchKeys</tp:member-ref> property should be
33
inspected to determine the valid search keys which can be provided to
34
the <tp:member-ref>Search</tp:member-ref> method. A search request is
35
then started by providing some of these terms to the Search method, and
36
the <tp:member-ref>SearchState</tp:member-ref> will change from
37
<code>Not_Started</code> to <code>In_Progress</code>. As results are
38
returned by the server, the
39
<tp:member-ref>SearchResultReceived</tp:member-ref> signal is emitted
40
for each contact found; when the search is complete, the search state
41
will be set to <code>Completed</code>. If the search fails after Search
42
has been called, the state will change to <code>Failed</code>. A
43
running search can be cancelled by calling
44
<tp:member-ref>Stop</tp:member-ref>.</p>
46
<p>If the protocol supports limiting the number of results returned by a
47
search and subsequently requesting more results, after
48
<tp:member-ref>Limit</tp:member-ref> results have been received the
49
search state will be set to <code>More_Available</code>. Clients may
50
call <tp:member-ref>More</tp:member-ref> to request another
51
<tp:member-ref>Limit</tp:member-ref> results. If allowed by the
52
connection manager, clients may specify the "page size" by specifying
53
<tp:member-ref>Limit</tp:member-ref> when calling
54
<tp:dbus-ref namespace="org.freedesktop.Telepathy.Connection.Interface.Requests">CreateChannel</tp:dbus-ref>.
57
<p>The client should call the channel's <tp:dbus-ref
58
namespace="org.freedesktop.Telepathy.Channel">Close</tp:dbus-ref>
59
method when it is finished with the channel, so that any handles held
60
only by the channel can be released.</p>
62
<p>Each channel can only be used for a single search; a new channel
63
should be requested for each subsequent search. Connection managers
64
MUST support multiple ContactSearch channels being open at once (even
65
to the same server, if applicable).</p>
67
<p>It does not make sense to request this channel type using <tp:dbus-ref
68
namespace="org.freedesktop.Telepathy.Connection.Interface.Requests">EnsureChannel</tp:dbus-ref>;
69
clients SHOULD request channels of this type using
71
namespace="org.freedesktop.Telepathy.Connection.Interface.Requests">CreateChannel</tp:dbus-ref>
75
<p>A contact search channel that is already in use for a different
76
search isn't useful.</p>
73
80
<tp:enum name="Channel_Contact_Search_State" type="u">
74
<tp:enumvalue suffix="Before" value="0">
81
<tp:enumvalue suffix="Not_Started" value="0">
75
82
<tp:docstring>The search has not started</tp:docstring>
77
<tp:enumvalue suffix="During" value="1">
84
<tp:enumvalue suffix="In_Progress" value="1">
78
85
<tp:docstring>The search is in progress</tp:docstring>
80
<tp:enumvalue suffix="After" value="2">
87
<tp:enumvalue suffix="More_Available" value="2">
88
<tp:docstring>The search has paused, but more results can be retrieved
89
by calling <tp:member-ref>More</tp:member-ref>.</tp:docstring>
91
<tp:enumvalue suffix="Completed" value="3">
81
92
<tp:docstring>The search has been completed</tp:docstring>
94
<tp:enumvalue suffix="Failed" value="4">
95
<tp:docstring>The search has failed</tp:docstring>
84
<method name="GetSearchState" tp:name-for-bindings="Get_Search_State">
85
<arg direction="out" type="u" tp:type="Channel_Contact_Search_State">
86
<tp:docstring>The search state represented as one of the values of
87
ChannelContactSearchState</tp:docstring>
90
Returns the current state of this search channel object.
93
<method name="Search">
94
<arg direction="in" name="Terms" type="a{sv}" tp:type="String_Variant_Map">
99
<property name="SearchState" tp:name-for-bindings="Search_State"
100
access="read" type="u" tp:type="Channel_Contact_Search_State">
102
The current state of this search channel object. Change notification
103
is via <tp:member-ref>SearchStateChanged</tp:member-ref>.
107
<signal name="SearchStateChanged"
108
tp:name-for-bindings="Search_State_Changed">
109
<arg name="State" type="u" tp:type="Channel_Contact_Search_State">
110
<tp:docstring>The new search state</tp:docstring>
112
<arg name="Error" type="s" tp:type="DBus_Error_Name">
113
<tp:docstring xmlns="http://www.w3.org/1999/xhtml">
114
If the new state is <code>Failed</code>, the name of a D-Bus error
115
describing what went wrong. Otherwise, the empty string.
118
<arg name="Details" type="a{sv}" tp:type="String_Variant_Map">
119
<tp:docstring xmlns="http://www.w3.org/1999/xhtml">
120
<p>Additional information about the state transition, which may
121
include the following well-known keys:</p>
124
<dt>debug-message (s)</dt>
125
<dd>Debugging information on the change, corresponding to the
126
message part of a D-Bus error message, which SHOULD NOT be
127
displayed to users under normal circumstances</dd>
131
<p>This argument allows for future extensions. For instance,
132
if moving to state <code>Failed</code> because the server
133
rejected one of our search terms, we could define a key
134
that indicates which terms were invalid.</p>
138
<tp:docstring xmlns="http://www.w3.org/1999/xhtml">
139
<p>Emitted when the <tp:member-ref>SearchState</tp:member-ref> property
140
changes. The implementation MUST NOT make transitions other than the
144
<li><code>Not_Started</code> → <code>In_Progress</code></li>
145
<li><code>In_Progress</code> → <code>More_Available</code></li>
146
<li><code>More_Available</code> → <code>In_Progress</code></li>
147
<li><code>In_Progress</code> → <code>Completed</code></li>
148
<li><code>In_Progress</code> → <code>Failed</code></li>
153
<tp:simple-type name="Contact_Search_Key" type="s">
154
<tp:docstring xmlns="http://www.w3.org/1999/xhtml">
155
<p>Any of the following search keys, with the indicated result for
159
<dt>The empty string</dt>
160
<dd>Search for the search term in some implementation-dependent
161
set of fields, using an implementation-dependent algorithm
162
(e.g. searching for each word mentioned)
164
The "one big search box" approach to searching, as is familiar
165
from Google. The Sametime plugin to Pidgin appears to search in
170
<dt>A <tp:type>VCard_Field</tp:type></dt>
171
<dd>Search for the search term in fields matching that name (for
172
instance, <code>nickname</code> would search nicknames, and
173
<code>tel</code> would search any available phone number,
174
regardless of its work/home/mobile/... status).</dd>
176
<dt>A <tp:type>VCard_Field</tp:type> followed by
177
"<code>;</code>" and a
178
<tp:type>VCard_Type_Parameter</tp:type> of the form
179
"<code>type=...</code>"</dt>
180
<dd>Search for the search term in fields of that name and type
181
only (for instance, <code>tel;type=mobile</code>).</dd>
183
<dt><code>x-telepathy-identifier</code></dt>
184
<dd>Search for contacts whose identifier in the IM protocol
185
matches the search term (e.g. contains it as a substring)
187
Otherwise, starting a search by identifier would require the UI
188
to know the vCard field name corresponding to identifiers in
189
this protocol, which might be non-standard (like
190
<code>x-jabber</code>) or not exist at all.
194
<dt><code>x-gender</code></dt>
195
<dd>For the search term "male" or "female", search only for contacts
196
listed as male or female, respectively. The results for other
197
search terms are undefined; it is likely that contacts with
198
unspecified gender will only be matched if this search key
199
is omitted from the request.
201
Examples in XEP-0055 suggest this usage, and at least Gadu-Gadu
202
also supports limiting search results by gender.
206
<dt><code>x-n-family</code></dt>
207
<dd>Search for the search term in contacts' family names
208
(the first component of the vCard field <code>n</code>).
210
Gadu-Gadu and TOC seem to support this mode of searching.
214
<dt><code>x-n-given</code></dt>
215
<dd>Search for the search term in contacts' given names
216
(the second component of the vCard field <code>n</code>).
218
As for <code>x-n-family</code>.
222
<dt><code>x-online</code></dt>
223
<dd>For the search term "yes", search only for contacts who are
224
currently online. The results for other search terms are undefined.
225
<tp:rationale>Gadu-Gadu appears to support this.</tp:rationale>
228
<dt><code>x-adr-locality</code></dt>
229
<dd>Search for the search term as a locality or city (the fourth
230
component of the vCard field <code>adr</code>).
232
Gadu-Gadu and TOC appear to support this.
239
<property name="Limit" type="u" access="read"
240
tp:name-for-bindings="Limit">
241
<tp:docstring xmlns="http://www.w3.org/1999/xhtml">
242
<p>If supported by the protocol, the maximum number of results that
243
should be returned, where <code>0</code> represents no limit. If the
244
protocol does not support limiting results, this should be
247
<p>For example, if the terms passed to
248
<tp:member-ref>Search</tp:member-ref> match <i>Antonius</i>,
249
<i>Bridget</i> and <i>Charles</i> and this property is
250
<code>2</code>, the search service SHOULD only return <i>Antonius</i>
251
and <i>Bridget</i>.</p>
253
<p>This property cannot change during the lifetime of the channel.
254
This property SHOULD be in the Allowed_Properties of a
255
<tp:type>Requestable_Channel_Class</tp:type> if and only if the
256
protocol supports specifying a limit; implementations SHOULD use
257
<code>0</code> as the default if possible, or a protocol-specific
258
sensible default otherwise.</p>
262
<property name="AvailableSearchKeys" type="as" access="read"
263
tp:name-for-bindings="Available_Search_Keys">
265
The set of search keys supported by this channel. Example values
266
include [""] (for protocols where several address fields are
267
implicitly searched) or ["x-n-given", "x-n-family", "nickname",
268
"email"] (for XMPP XEP-0055, without extensibility via Data Forms).
269
This property cannot change during the lifetime of a channel.
272
It can be in the <tp:dbus-ref
273
namespace="org.freedesktop.Telepathy.Connection.Interface.Requests">NewChannels</tp:dbus-ref>
274
signal for round-trip reduction.
279
<tp:mapping name="Contact_Search_Map">
280
<tp:docstring>A map from search keys to search terms.</tp:docstring>
281
<tp:member name="Key" type="s" tp:type="Contact_Search_Key">
283
The search key to match against
287
<tp:member name="Term" type="s">
289
The term or terms to be searched for in the search key; depending on
290
the protocol and the server implementation, this may be matched by
291
exact or approximate equality, substring matching, word matching
292
or any other matching algorithm
297
<method name="Search" tp:name-for-bindings="Search">
298
<arg direction="in" name="Terms"
299
type="a{ss}" tp:type="Contact_Search_Map">
96
301
A dictionary mapping search key names to the desired values
100
Send a request to start a search for contacts on this connection. A
101
valid search request will cause the SearchStateChanged signal to be
102
emitted with the status CHANNEL_CONTACT_SEARCH_STATE_DURING.
305
Send a request to start a search for contacts on this connection. This
306
may only be called while the <tp:member-ref>SearchState</tp:member-ref>
307
is Not_Started; a valid search request will cause the
308
<tp:member-ref>SearchStateChanged</tp:member-ref> signal to be emitted
309
with the state In_Progress.
104
311
<tp:possible-errors>
105
<tp:error name="org.freedesktop.Telepathy.Error.Disconnected"/>
312
<tp:error name="org.freedesktop.Telepathy.Error.NotAvailable">
314
The <tp:member-ref>SearchState</tp:member-ref> is no longer
315
Not_Started, so this method is no longer available.
318
<tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument">
320
The search terms included something this connection manager cannot
106
324
<tp:error name="org.freedesktop.Telepathy.Error.NetworkError"/>
107
<tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/>
108
</tp:possible-errors>
325
</tp:possible-errors>
328
<method name="More" tp:name-for-bindings="More">
329
<tp:docstring xmlns="http://www.w3.org/1999/xhtml">
330
Request that a search in <tp:member-ref>SearchState</tp:member-ref>
331
<code>More_Available</code> move back to state <code>In_Progress</code>
332
and continue listing up to <tp:member-ref>Limit</tp:member-ref> more results.
335
<tp:error name="org.freedesktop.Telepathy.Error.NotAvailable">
337
The <tp:member-ref>SearchState</tp:member-ref> is not
338
<code>More_Available</code>.
341
</tp:possible-errors>
344
<method name="Stop" tp:name-for-bindings="Stop">
345
<tp:docstring xmlns="http://www.w3.org/1999/xhtml">
346
<p>Stop the current search. This may not be called while the
347
<tp:member-ref>SearchState</tp:member-ref> is Not_Started. If called
348
while the SearchState is In_Progress,
349
<tp:member-ref>SearchStateChanged</tp:member-ref> will be emitted,
350
with the state Failed and the error
351
<code>org.freedesktop.Telepathy.Errors.Cancelled</code>.</p>
353
<p>Calling this method on a search in state Completed or Failed
354
succeeds, but has no effect.</p>
357
<p>Specifying Stop to succeed when the search has finished means that
358
clients who call Stop just before receiving
359
<tp:member-ref>SearchStateChanged</tp:member-ref> don't have to
360
handle a useless error.</p>
363
<p>Depending on the protocol, the connection manager may not be
364
able to prevent the server from sending further results after this
365
method returns; if this is the case, it MUST ignore any further
369
<tp:error name="org.freedesktop.Telepathy.Error.NotAvailable">
371
The <tp:member-ref>SearchState</tp:member-ref> is Not_Started, so
372
this method is not yet available.
375
</tp:possible-errors>
110
378
<signal name="SearchResultReceived"
111
379
tp:name-for-bindings="Search_Result_Received">
112
380
<arg name="Contact" type="u" tp:type="Contact_Handle">
113
<tp:docstring>An integer handle for the contact</tp:docstring>
381
<tp:docstring>An integer handle for the contact, which will remain
382
valid at least until this Channel closes</tp:docstring>
115
<arg name="Values" type="a{sv}" tp:type="String_Variant_Map">
116
<tp:docstring>A dictionary mapping search key names to values for this contact</tp:docstring>
384
<arg name="Info" type="a(sasas)" tp:type="Contact_Info_Field[]">
385
<tp:docstring xmlns="http://www.w3.org/1999/xhtml">
386
<p>An array of fields representing information about this
387
contact, in the same format used in the <tp:dbus-ref
388
namespace="org.freedesktop.Telepathy.Connection.Interface">ContactInfo.DRAFT</tp:dbus-ref>
389
interface. It is possible that a separate call to <tp:dbus-ref
390
namespace="org.freedesktop.Telepathy.Connection.Interface.ContactInfo.DRAFT">RequestContactInfo</tp:dbus-ref>
391
would return more information than this signal provides.</p>
393
<p>This array SHOULD include the <code>x-telepathy-identifier</code>
394
field, whose values matches the result of calling <tp:dbus-ref
395
namespace="org.freedesktop.Telepathy.Connection">InspectHandles</tp:dbus-ref>
396
on the Contact handle.</p>
399
<p>UIs will most likely want to show the identifier to the user;
400
while they could do this by inspecting the signalled handle,
401
including it in this signal is cheap and removes a roundtrip to
119
407
Emitted when a search result is received from the server.
122
<signal name="SearchStateChanged"
123
tp:name-for-bindings="Search_State_Changed">
124
<arg name="State" type="u" tp:type="Channel_Contact_Search_State">
125
<tp:docstring>An integer representing the new search state</tp:docstring>
411
<property name="Server" tp:name-for-bindings="Server"
412
type="s" access="read">
128
Emitted when the search state (as returned by the GetSearchState
414
<p>For protocols which support searching for contacts on multiple
415
servers with different DNS names (like XMPP), the DNS name of the
416
server being searched by this channel, e.g.
417
"characters.shakespeare.lit". Otherwise, the empty string.</p>
420
<p>XEP 0055 defines a mechanism for XMPP clients to search services
421
of their choice for contacts, such as users.jabber.org (the "Jabber
422
User Directory").</p>
425
<p>This property cannot change during the lifetime of the channel.
426
This property SHOULD be in the Allowed_Properties of a
427
<tp:type>Requestable_Channel_Class</tp:type> if and only if the
428
protocol supports querying multiple different servers;
429
implementations SHOULD use a sensible default if possible if this
430
property is not specified in a channel request.</p>
433
<p>This allows a client to perform searches on a protocol it knows
434
nothing about without requiring the user to guess a valid server's
132
<tp:docstring xmlns="http://www.w3.org/1999/xhtml">
133
<p>A channel type for searching server-stored user directories. A new channel
134
should be requested by a client for each search attempt, and it should be
135
closed when the search is completed or the required result has been found
136
in order to free unused handles. The search can be cancelled at any time
137
by calling the channel Close method, although depending upon the protocol
138
the connection manager may not be able to prevent the server from sending
141
<p>Before searching, the GetSearchKeys method should be used to discover any
142
instructions sent by the server, and the valid search keys which can be
143
provided to the Search method. A search request is then started by
144
providing some of these terms to the Search method, and the search status
145
will be set to CHANNEL_CONTACT_SEARCH_STATE_DURING. When results are
146
returned by the server, the SearchResultReceived signal is emitted for each
147
contact found, and when the search is complete, the search status will be
148
set to CHANNEL_SEARCH_STATE_AFTER.</p>
152
442
<!-- vim:set sw=2 sts=2 et ft=xml: -->