No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0273.xml 31KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. %ents;
  5. ]>
  6. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  7. <xep>
  8. <header>
  9. <title>Stanza Interception and Filtering Technology (SIFT)</title>
  10. <abstract>This specification defines an XMPP protocol extension that enables a client to exercise control over the XML stanzas it will receive from the server by instructing the server to intercept and filter inbound stanzas.</abstract>
  11. &LEGALNOTICE;
  12. <number>0273</number>
  13. <status>Deferred</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <approver>Council</approver>
  17. <dependencies>
  18. <spec>XMPP Core</spec>
  19. </dependencies>
  20. <supersedes/>
  21. <supersededby/>
  22. <shortname>sift</shortname>
  23. &hildjj;
  24. &metajack;
  25. &stpeter;
  26. <revision>
  27. <version>0.4</version>
  28. <date>2011-06-27</date>
  29. <initials>psa</initials>
  30. <remark><p>Made it clear that presence means presence notifications; added support for subscription-related presence stanzas; described payload matching in greater detail; added use case for allowing only core XMPP child elements; increased protocol version number from 1 to 2.</p></remark>
  31. </revision>
  32. <revision>
  33. <version>0.3</version>
  34. <date>2010-05-03</date>
  35. <initials>psa</initials>
  36. <remark><p>Specified sending of an empty &lt;sift/&gt; element to disable SIFT processing; removed invisibility use case because that is handled by outbound privacy lists, not inbound SIFT.</p></remark>
  37. </revision>
  38. <revision>
  39. <version>0.2</version>
  40. <date>2010-02-16</date>
  41. <initials>psa</initials>
  42. <remark><p>Simplified feature discovery to use standard XMPP disco.</p></remark>
  43. </revision>
  44. <revision>
  45. <version>0.1</version>
  46. <date>2009-09-15</date>
  47. <initials>psa</initials>
  48. <remark><p>Initial published version as accepted for publication by the XMPP Council.</p></remark>
  49. </revision>
  50. <revision>
  51. <version>0.0.8</version>
  52. <date>2009-08-14</date>
  53. <initials>psa</initials>
  54. <remark><p>Clarified service and feature discovery processes, error flows, and other small matters in the text.</p></remark>
  55. </revision>
  56. <revision>
  57. <version>0.0.7</version>
  58. <date>2009-08-11</date>
  59. <initials>psa</initials>
  60. <remark><p>Defined IQ-get for retrieving supported SIFT features; added support for sifting based on sender type; removed restriction on matching against only the bare JID of the recipient and defined support for sifting on the bare JID, full JID, or both.</p></remark>
  61. </revision>
  62. <revision>
  63. <version>0.0.6</version>
  64. <date>2009-05-19</date>
  65. <initials>jjh/psa</initials>
  66. <remark><p>Added requirements section; clarified relation to negative presence priorities.</p></remark>
  67. </revision>
  68. <revision>
  69. <version>0.0.5</version>
  70. <date>2009-05-18</date>
  71. <initials>jjh/psa</initials>
  72. <remark><p>More clearly distinguished between interception and filtering usages; clarified business rules.</p></remark>
  73. </revision>
  74. <revision>
  75. <version>0.0.4</version>
  76. <date>2009-05-18</date>
  77. <initials>psa/jjh</initials>
  78. <remark><p>Added information about service discovery; clarified several small matters in the text.</p></remark>
  79. </revision>
  80. <revision>
  81. <version>0.0.3</version>
  82. <date>2009-05-15</date>
  83. <initials>psa/jjh</initials>
  84. <remark><p>Clarified that SIFT applies to interception of message and presence stanzas directed to the bare JID and to filtering of IQ stanzas directed to the full JID; corrected syntax to match those semantics; added use cases; defined XML schema.</p></remark>
  85. </revision>
  86. <revision>
  87. <version>0.0.2</version>
  88. <date>2009-05-14</date>
  89. <initials>psa</initials>
  90. <remark><p>Slight clarifications and corrections.</p></remark>
  91. </revision>
  92. <revision>
  93. <version>0.0.1</version>
  94. <date>2009-05-14</date>
  95. <initials>jjh/jm/psa</initials>
  96. <remark><p>First draft.</p></remark>
  97. </revision>
  98. </header>
  99. <section1 topic='Introduction' anchor='intro'>
  100. <p>In some scenarios a client might want to control the XML stanzas it will receive over its stream with the server. Some potential use cases include:</p>
  101. <ul>
  102. <li>A mobile client might want to receive messages but not presence notifications, since the latter are quite "chatty" and can run down the battery.</li>
  103. <li>A softphone might want to receive IQ stanzas only if the payload is qualified by an XML namespace related to the use of &xep0166; for Internet telephony.</li>
  104. <li>A presence compositor might want to receive presence updates but not message stanzas or IQ stanzas, and only from the user's own resources (i.e., not from other entities).</li>
  105. </ul>
  106. <p>Although &xmppim; specifies the use of a negative presence priority to block inbound message delivery, it does not enable the client to block inbound presence notifications, filter inbound IQ stanzas, or otherwise exercise fine-grained control over the delivery of inbound stanzas. While it would be possible to define particular values of negative presence priorities for some delivery control methods (e.g., &lt;priority&gt;-2&lt;priority&gt; could be hardcoded to mean "don't send me messages or presence"), that would be an ugly hack and thus inconsistent with &xep0134;. Therefore, this specification defines a stanza interception and filtering technology (a.k.a. "SIFT") that is more consistent with the underlying design of XMPP.</p>
  107. <p>The following taxonomy of client types is not exhaustive but might assist developers in understanding the scenarios in which SIFT might be useful.</p>
  108. <table caption='Client Types Categorized by Sending Presence Notifications, Receiving Presence Notifications, and Receiving Messages'>
  109. <tr>
  110. <th>Type</th>
  111. <th>Sends Presence *</th>
  112. <th>Receives Presence **</th>
  113. <th>Receives Messages</th>
  114. </tr>
  115. <tr>
  116. <td>Normal User</td>
  117. <td align='center'>Yes</td>
  118. <td align='center'>Yes</td>
  119. <td align='center'>Yes</td>
  120. </tr>
  121. <tr>
  122. <td>Invisible User</td>
  123. <td align='center'>No</td>
  124. <td align='center'>Yes</td>
  125. <td align='center'>Yes</td>
  126. </tr>
  127. <tr>
  128. <td>Large-Scale Bot</td>
  129. <td align='center'>Yes</td>
  130. <td align='center'>No</td>
  131. <td align='center'>Yes</td>
  132. </tr>
  133. <tr>
  134. <td>Presentity</td>
  135. <td align='center'>Yes</td>
  136. <td align='center'>Yes</td>
  137. <td align='center'>No</td>
  138. </tr>
  139. <tr>
  140. <td>Presence Watcher</td>
  141. <td align='center'>No</td>
  142. <td align='center'>Yes</td>
  143. <td align='center'>No</td>
  144. </tr>
  145. <tr>
  146. <td>Presence Publisher</td>
  147. <td align='center'>Yes</td>
  148. <td align='center'>No</td>
  149. <td align='center'>No</td>
  150. </tr>
  151. <tr>
  152. <td>Message Subscriber</td>
  153. <td align='center'>No</td>
  154. <td align='center'>No</td>
  155. <td align='center'>Yes</td>
  156. </tr>
  157. <tr>
  158. <td>Message Publisher</td>
  159. <td align='center'>No</td>
  160. <td align='center'>No</td>
  161. <td align='center'>No</td>
  162. </tr>
  163. </table>
  164. <p>* Note: SIFT is not used to control outbound presence, since that use case is already covered by &xep0016;; this table includes information about outbound presence only to motivate various scenarios in which SIFT can be used.</p>
  165. <p>** Note: For purposes of this taxonomy, we refer only to presence notifications (available and unavailable), not also to subscription-related presence stanzas (subscribe, unsubscribe, etc.).</p>
  166. </section1>
  167. <section1 topic='Requirements' anchor='reqs'>
  168. <p>The SIFT protocol is designed to meet the following requirements.</p>
  169. <ol start='1'>
  170. <li>Make it possible for a client to disable receipt of various inbound stanzas (presence notifications, subscription-related presence stanzas, message stanzas, IQ stanzas) while still receiving other kinds of stanzas.</li>
  171. <li>Make it possible for a client to "sift" based on all senders, local vs. remote senders, or other senders vs. oneself.</li>
  172. <li>Make it possible for a client to "sift" based on whether the recipient is the user's bare JID or the particular client's full JID.</li>
  173. <li>Enable future extensibility based on regular expressions, XPath expressions, etc.</li>
  174. </ol>
  175. </section1>
  176. <section1 topic='Protocol' anchor='protocol'>
  177. <p>The SIFT protocol is used to <em>intercept</em> or <em>filter</em> inbound stanzas only, not outbound stanzas sent by the client to the server or other entities. By "intercept" is meant that the server will not deliver any such stanza kind (message, presence notification, presence subscription, or IQ) to the client, and by "filter" is meant that the server will apply a rule to determine if the specific stanza will be delivered to the client (e.g., matching against a payload namespace); in general we refer to these actions as "sifting". The SIFT protocol enables the server to support only basic interception (even here to support interception only for particular kinds of stanzas), basic filtering as defined by the rules described in this specification, or advanced filtering using extensions to SIFT defined in other specifications. Each of the features supported by the server can be discovered by the client for maximum interoperability. The features, the process for discovering them, and the process for enabling them are described in the following sections.</p>
  178. <section2 topic='Features' anchor='features'>
  179. <p>SIFT supports the features defined below. Each feature is identified by a separate value for 'var' attribute qualified by the 'http://jabber.org/protocol/disco#info' namespace as specified in &xep0030;.</p>
  180. <section3 topic='Stanza Kinds' anchor='features-stanzas'>
  181. <p>A server MAY support any combination of sifting IQ stanzas, message stanzas, presence notifications, and presence subscriptions, as advertised by the following service discovery features.</p>
  182. <dl>
  183. <di>
  184. <dt>urn:xmpp:sift:stanzas:iq</dt>
  185. <dd>The server enables the client to sift all &IQ; stanzas or ones that match the specified criteria.</dd>
  186. </di>
  187. <di>
  188. <dt>urn:xmpp:sift:stanzas:message</dt>
  189. <dd>The server enables the client to sift all &MESSAGE; stanzas or ones that match the specified criteria.</dd>
  190. </di>
  191. <di>
  192. <dt>urn:xmpp:sift:stanzas:presence</dt>
  193. <dd>The server enables the client to sift all &PRESENCE; notifications (i.e., presence stanzas with no 'type' or with a type of "unavailable") or ones that match the specified criteria.</dd>
  194. </di>
  195. <di>
  196. <dt>urn:xmpp:sift:stanzas:sub</dt>
  197. <dd>The server enables the client to sift all subscription-related &PRESENCE; stanzas (i.e., presence stanzas with a type of "subscribe", "subscribed", "unsubscribe", or "unsubscribed") or ones that match the specified criteria.</dd>
  198. </di>
  199. </dl>
  200. </section3>
  201. <section3 topic='Sender' anchor='features-sender'>
  202. <p>A server MAY enable the client to sift based on sender. The following features are supported.</p>
  203. <dl>
  204. <di>
  205. <dt>urn:xmpp:sift:senders:all</dt>
  206. <dd>The server shall sift this kind of stanza no matter who the sender is. This is the <strong>default</strong>.</dd>
  207. </di>
  208. <di>
  209. <dt>urn:xmpp:sift:senders:local</dt>
  210. <dd>The server shall sift this kind of stanza only from entities associated with the same local domain as the user itself (not from remote domains).</dd>
  211. </di>
  212. <di>
  213. <dt>urn:xmpp:sift:senders:others</dt>
  214. <dd>The server shall sift this kind of stanza only from other entities (not from the user itself).</dd>
  215. </di>
  216. <di>
  217. <dt>urn:xmpp:sift:senders:remote</dt>
  218. <dd>The server shall sift this kind of stanza only from entities associated with remote domains (not from the same local domain as the user itself).</dd>
  219. </di>
  220. <di>
  221. <dt>urn:xmpp:sift:senders:self</dt>
  222. <dd>The server shall sift this kind of stanza only from the user itself (not from other entities).</dd>
  223. </di>
  224. </dl>
  225. <p>These values are child elements of the &lt;iq/&gt;, &lt;message/&gt;, &lt;presence/&gt;, and &lt;sub/&gt; elements when the server returns a features discovery result, whereas they are values of the 'sender' attribute when the client enables sift support.</p>
  226. </section3>
  227. <section3 topic='Recipient' anchor='features-recipient'>
  228. <p>A server MAY enable the client to filter based on recipient. The following features are supported.</p>
  229. <dl>
  230. <di>
  231. <dt>urn:xmpp:sift:recipients:all</dt>
  232. <dd>The server shall sift this kind of stanza if the recipient is the bare JID &LOCALBARE; of the user or the full JID &LOCALFULL; of the particular resource. This is the <strong>default</strong>.</dd>
  233. </di>
  234. <di>
  235. <dt>urn:xmpp:sift:recipients:bare</dt>
  236. <dd>The server shall sift this kind of stanza only if the recipient is the bare JID &LOCALBARE; of the user.</dd>
  237. </di>
  238. <di>
  239. <dt>urn:xmpp:sift:recipients:full</dt>
  240. <dd>The server shall sift this kind of stanza only if the recipient is the full JID &LOCALFULL; of the particular resource.</dd>
  241. </di>
  242. </dl>
  243. <p>These values are child elements of the &lt;iq/&gt;, &lt;message/&gt;, &lt;presence/&gt;, and &lt;sub/&gt; elements when the server returns a features discovery result, whereas they are values of the 'recipient' attribute when the client enables sift support.</p>
  244. </section3>
  245. <section3 topic='Payload' anchor='features-payload'>
  246. <p>A server MAY enable the client to sift based on the XML namespace and element name of the payload(s) that the client allows for delivery. If so, the server shall advertise a feature of <strong>urn:xmpp:sift:payloads:qname</strong>.</p>
  247. <p>By "payload" is meant a first-level child element of an &IQ;, &MESSAGE;, or &PRESENCE; stanza. <strong>This includes elements defined in &rfc6120; and &rfc6121;.</strong> As a result, if the server supports payload matching then a client can even sift out elements allowed by the 'jabber:client' namespace, such as message &SUBJECT; and presence &STATUS;.</p>
  248. </section3>
  249. <section3 topic='Advanced Matching' anchor='features-advanced'>
  250. <p>A server could match based on more complex criteria, e.g. Regular Expressions or XPath Expressions; such functionality is implicitly allowed because the XML schema specifies the &lt;xs:any/&gt; notation, but any such advanced matching shall be defined in separate specifications.</p>
  251. </section3>
  252. </section2>
  253. <section2 topic='Discovering Supported Features' anchor='discovering'>
  254. <p>A client can discover if its server supports SIFT by sending a disco#info request.</p>
  255. <example caption='A disco#info query'><![CDATA[
  256. <iq type='get'
  257. from='romeo@montague.lit/pda'
  258. to='montague.lit'
  259. id='bf4vb167'>
  260. <query xmlns='http://jabber.org/protocol/disco#info'/>
  261. </iq>
  262. ]]></example>
  263. <p>If a server supports the SIFT protocol, it MUST advertise that fact in its responses to "disco#info" requests by returning a feature of "urn:xmpp:sift:2" &VNOTE;. The server MUST also specify which features it supports.</p>
  264. <p>In the following reply, the server indicates that it supports a minimal subset of SIFT features merely for the sake of presence blocking.</p>
  265. <example caption='Minimal server support'><![CDATA[
  266. <iq type='result'
  267. from='montague.lit'
  268. to='romeo@montague.lit/pda'
  269. id='bf4vb167'>
  270. <query xmlns='http://jabber.org/protocol/disco#info'>
  271. <feature var='urn:xmpp:sift:2'/>
  272. <feature var='urn:xmpp:sift:stanzas:presence'/>
  273. </query>
  274. </iq>
  275. ]]></example>
  276. <p>In the following reply, the server indicates that it supports a wider range of SIFT features.</p>
  277. <example caption='More extensive server support'><![CDATA[
  278. <iq type='result'
  279. from='montague.lit'
  280. to='romeo@montague.lit/pda'
  281. id='bf4vb167'>
  282. <query xmlns='http://jabber.org/protocol/disco#info'>
  283. <feature var='urn:xmpp:sift:2'/>
  284. <feature var='urn:xmpp:sift:recipients:all'/>
  285. <feature var='urn:xmpp:sift:senders:all'/>
  286. <feature var='urn:xmpp:sift:senders:others'/>
  287. <feature var='urn:xmpp:sift:stanzas:iq'/>
  288. <feature var='urn:xmpp:sift:stanzas:message'/>
  289. <feature var='urn:xmpp:sift:stanzas:presence'/>
  290. <feature var='urn:xmpp:sift:stanzas:sub'/>
  291. </query>
  292. </iq>
  293. ]]></example>
  294. <p>To enable clients to cache information about supported features, a server SHOULD return &xep0115; data via stream features as described in <cite>XEP-0115</cite>.</p>
  295. </section2>
  296. <section2 topic='Enabling SIFT' anchor='enabling'>
  297. <p>To enable sifting of stanzas, the client sends an IQ-set to the server containing a &lt;sift/&gt; child element that in turn contains an &lt;iq/&gt; element, a &lt;message/&gt; element, a &lt;presence/&gt; element, or some combination of those elements. Each of these elements MAY include a 'recipient' attribute whose value is "all", "bare", or "full" (defaulting to "all"). Each of these elements MAY also include a 'sender' attribute whose value is "all", "local", "others", "remote", or "self" (defaulting to "all").</p>
  298. <p>Note: The last SIFT request sent from the client to the server overrides all previous SIFT requests; SIFT requests are not cumulative. Therefore, each SIFT request needs to contain all the SIFT rules that the client wishes the server to enforce, not a delta from the previous request.</p>
  299. <example caption="Sifting of message and presence stanzas"><![CDATA[
  300. <iq from='romeo@montague.lit/pda'
  301. id='rv491g37'
  302. to='romeo@montague.lit'
  303. type='set'>
  304. <sift xmlns='urn:xmpp:sift:2'>
  305. <message sender='others'/>
  306. <presence/>
  307. </sift>
  308. </iq>
  309. ]]></example>
  310. <p>The foregoing IQ-set means "sift messages from others and presence from all senders, no matter if the recipient is my bare JID or my full JID".</p>
  311. <p>Each of the child elements &IQ;, &MESSAGE;, &PRESENCE;, and &lt;sub/&gt; MAY also contain one or more &lt;allow/&gt; children whose 'name' attribute specifies the element name and whose 'ns' attribute specifies the XML namespace of stanza payloads the client would like to allow. If no &lt;allow/&gt; elements are included, then sifting of that kind of stanza is completed without reference to the payload.</p>
  312. <example caption="Sifting for particular IQ payloads"><![CDATA[
  313. <iq from='romeo@montague.lit/pda'
  314. id='bs01jg75'
  315. to='romeo@montague.lit'
  316. type='set'>
  317. <sift xmlns='urn:xmpp:sift:2'>
  318. <iq>
  319. <allow name='jingle' ns='urn:xmpp:jingle:1'/>
  320. <allow name='query' ns='http://jabber.org/protocol/disco#info'/>
  321. </iq>
  322. <message/>
  323. </sift>
  324. </iq>
  325. ]]></example>
  326. <p>The foregoing IQ-set means "filter out inbound IQ stanzas except if the payload matches &lt;jingle xmlns='urn:xmpp:jingle:1'/&gt; or &lt;query xmlns='http://jabber.org/protocol/disco#info'/&gt;".</p>
  327. <p>In XMPP, an IQ stanza can contain only one payload element, so the filtering logic is straightforward. However, a message or presence stanza can contain multiple payload elements (cf. &xep0226;). Therefore, filtering for message and presence stanzas means that if the stanza contains the defined payload or payloads (perhaps in addition to other payloads), the server shall deliver it to the client.</p>
  328. <p>For instance, the following example shows how a client would filter inbound messages and IQs to only receive SOAP payloads as specified in &xep0072;.</p>
  329. <example caption="Sifting for SOAP"><![CDATA[
  330. <iq from='romeo@montague.lit/pda'
  331. id='cid143n9'
  332. to='romeo@montague.lit'
  333. type='set'>
  334. <sift xmlns='urn:xmpp:sift:2'>
  335. <iq>
  336. <allow name='Envelope' ns='http://www.w3.org/2003/05/soap-envelope'/>
  337. </iq>
  338. <message>
  339. <allow name='Envelope' ns='http://www.w3.org/2003/05/soap-envelope'/>
  340. </message>
  341. </sift>
  342. </iq>
  343. ]]></example>
  344. <p>Similarly, the following example shows how a client would filter inbound presence notifications to only receive notifications that contain entity capabilities data as specified in <cite>XEP-0115</cite>.</p>
  345. <example caption="Sifting for entity capabilities"><![CDATA[
  346. <iq from='romeo@montague.lit/pda'
  347. id='zl2f36d8'
  348. to='romeo@montague.lit'
  349. type='set'>
  350. <sift xmlns='urn:xmpp:sift:2'>
  351. <presence>
  352. <allow name='c' ns='http://jabber.org/protocol/caps'/>
  353. </presence>
  354. </sift>
  355. </iq>
  356. ]]></example>
  357. <p>An even more strict example is filtering out all children of the XMPP &MESSAGE; stanza except &BODY;.</p>
  358. <example caption="Sifting Out All But Message Bodies"><![CDATA[
  359. <iq from='romeo@montague.lit/pda'
  360. id='b8dv163d'
  361. to='romeo@montague.lit'
  362. type='set'>
  363. <sift xmlns='urn:xmpp:sift:2'>
  364. <message>
  365. <allow name='body' ns='jabber:client'/>
  366. </message>
  367. </sift>
  368. </iq>
  369. ]]></example>
  370. <p>Naturally, the server could return the typical XMPP error conditions, such as &unavailable; if the server does not support the SIFT protocol or the version specified by the client, &feature; if the server does not support a particular feature (e.g., &IQ; sifting) requested by the client, &badrequest; if the request is malformed, &internalserver; if the server experiences a malfunction while attempting to process the request, and so on.</p>
  371. </section2>
  372. <section2 topic='Disabling SIFT' anchor='disable'>
  373. <p>To completely disable all SIFT processing, the client sends an empty &lt;sift/&gt; element.</p>
  374. <example caption="Disabling all SIFT processing"><![CDATA[
  375. <iq from='romeo@montague.lit/pda'
  376. id='mxi371g9'
  377. to='romeo@montague.lit'
  378. type='set'>
  379. <sift xmlns='urn:xmpp:sift:2'/>
  380. </iq>
  381. ]]></example>
  382. </section2>
  383. </section1>
  384. <section1 topic='Business Rules' anchor='rules'>
  385. <section2 topic='Handling IQ Stanzas' anchor='rules-iq'>
  386. <p>If the client does not request filtering of inbound IQ stanzas, the server MUST pass through to the client all IQ stanzas that are addressed to the full JID of the client (subject to appropriate security controls as defined in the relevant RFCs and XEPs).</p>
  387. <p>If the client requests filtering of inbound IQ stanzas, for unfiltered payload name+namespace combinations the server MUST pass through to the client all IQ stanzas that are addressed to the full JID of the client (subject to appropriate security controls as defined in the relevant RFCs and XEPs), whereas for filtered payload name+namespace combinations the server MUST respond to all IQ stanzas in a way consistent with the specification for the given payload namespace (if defined) or as specified in XMPP-CORE and XMPP-IM for IQs where no full JID &LOCALFULL; matches; typically that means returning a &unavailable; error.</p>
  388. </section2>
  389. <section2 topic='Handling Message Stanzas' anchor='rules-message'>
  390. <p>When a client indicates that it wishes to receive messages, the server SHOULD deliver to the client all messages in the offline message queue and MUST deliver to the client any subsequent messages that would normally be delivered to the client in accordance with the rules defined in &xmppcore; and XMPP-IM.</p>
  391. <p>If the client subsequently indicates that it wants the server to intercept inbound messages (and there are no other connected or available resources that have expressed interest in receiving inbound messages), the server SHOULD treat messages as if there were no connected or available resources (e.g., storing them offline for later delivery); if the client then indicates again that it wishes to receive inbound messages, the server SHOULD send those queued messages to the client so that it can get back in sync regarding messages received from its contacts.</p>
  392. </section2>
  393. <section2 topic='Handling Presence Notifications' anchor='rules-presence'>
  394. <p>When the client indicates that it wishes to receive inbound presence notifications, the server SHOULD send outbound presence probes on the client's behalf. Responses to these presence probes are addressed to the bare JID of the account and then broadcasted to all of the resources that have expressed interest in receiving inbound presence notifications.</p>
  395. <p>If the client subsequently indicates that it wants the server to intercept inbound presence notifications, the server MUST NOT deliver to the client presence notifications that are addressed to the bare JID or full JID as defined by the 'recipient' attribute.</p>
  396. <p>If the client then indicates again that it wishes to receive inbound presence notifications, the server shall resynchronize the client regarding the presence states of its contacts (how it does so is implementation-specific, e.g. whether it queues received presence notifications or re-probes the user's contacts).</p>
  397. </section2>
  398. <section2 topic='Handling Subscriptions' anchor='rules-sub'>
  399. <p>When the client indicates that it wishes to receive inbound subscription-related presence stanzas, it MUST deliver presence stanzas of type "subscribe", "subscribed", "unsubscribe", and "unsubscribed" to the client in accordane with the rules in &xmppim;.</p>
  400. <p>If the client subsequently indicates that it wants the server to intercept inbound subscription-related presence stanzas, the server MUST NOT deliver to the client such stanzas that are addressed to the bare JID or full JID as defined by the 'recipient' attribute.</p>
  401. </section2>
  402. <section2 topic='Lack of Sifting' anchor='rules-none'>
  403. <p>Naturally, if the server advertises support for the SIFT protocol but the client does not send any IQ-set stanzas containing SIFT payloads, the server MUST proceed as it normally would in accordance with the core XMPP specifications.</p>
  404. </section2>
  405. </section1>
  406. <section1 topic='Use Cases' anchor='usecases'>
  407. <section2 topic='Negative Presence Priority' anchor='priority'>
  408. <p>XMPP-IM defines the concept of negative values for the presence &lt;priority/&gt; element, where a negative value instructs the server to not deliver to the client any messages that are directed to the bare JID of the user. This behavior can be emulated using SIFT by asking the server to intercept inbound message stanzas for the bare JID, but not presence notifications or IQ stanzas.</p>
  409. <example caption="Emulating negative presence priority"><![CDATA[
  410. <iq from='romeo@montague.lit/pda'
  411. id='zkd71d37'
  412. to='romeo@montague.lit'
  413. type='set'>
  414. <sift xmlns='urn:xmpp:sift:2'>
  415. <message recipient='bare'/>
  416. </sift>
  417. </iq>
  418. ]]></example>
  419. <p>If a client requests message sifting, but sends presence, it SHOULD specify a negative priority as a hint to contacts.</p>
  420. </section2>
  421. <section2 topic='Presence Hush' anchor='nopresence'>
  422. <p>Because inbound presence notifications can be "chatty", mobile clients and other entities with limited battery life might want to "hush" the presence session by asking the server to intercept inbound presence notifications but not message stanzas.</p>
  423. <example caption="Hushing the presence session"><![CDATA[
  424. <iq from='romeo@montague.lit/pda'
  425. id='uh2s64g9'
  426. to='romeo@montague.lit'
  427. type='set'>
  428. <sift xmlns='urn:xmpp:sift:2'>
  429. <presence/>
  430. </sift>
  431. </iq>
  432. ]]></example>
  433. </section2>
  434. <section2 topic='Removing Extraneous Message Extensions' anchor='basicmessage'>
  435. <p>Some XMPP-based services include a large number of extensions in messages (e.g., microblogging extensions). A client might want to filter out those extensions and allow only the bare minimum elements allowed by the base XMPP specifications. It can do so by specifying that the only payloads it wants to receive are the &BODY;, &SUBJECT;, and &THREAD; elements qualified by the 'jabber:client' namespace.</p>
  436. <example caption="Removing extraneous message extensions"><![CDATA[
  437. <iq from='romeo@montague.lit/pda'
  438. id='nj3fac27'
  439. to='romeo@montague.lit'
  440. type='set'>
  441. <sift xmlns='urn:xmpp:sift:2'>
  442. <message>
  443. <allow name='body' ns='jabber:client'/>
  444. <allow name='subject' ns='jabber:client'/>
  445. <allow name='thread' ns='jabber:client'/>
  446. </message>
  447. </sift>
  448. </iq>
  449. ]]></example>
  450. </section2>
  451. </section1>
  452. <section1 topic='Security Considerations' anchor='security'>
  453. <p>To follow.</p>
  454. </section1>
  455. <section1 topic='IANA Considerations' anchor='iana'>
  456. <p>This document requires no interaction with &IANA;.</p>
  457. </section1>
  458. <section1 topic='XMPP Registrar Considerations' anchor='reg'>
  459. <section2 topic='Protocol Namespaces' anchor='registrar-ns'>
  460. <p>This specification defines the following XML namespace:</p>
  461. <ul>
  462. <li>urn:xmpp:sift:2</li>
  463. </ul>
  464. <p>Upon advancement of this specification from a status of Experimental to a status of Draft, the &REGISTRAR; shall add the foregoing namespace to the registry located at &NAMESPACES;, as described in Section 4 of &xep0053;.</p>
  465. </section2>
  466. <section2 topic='Protocol Versioning' anchor='registrar-versioning'>
  467. &NSVER;
  468. </section2>
  469. </section1>
  470. <section1 topic='XML Schema' anchor='schema'>
  471. <code><![CDATA[
  472. <?xml version='1.0' encoding='UTF-8'?>
  473. <xs:schema
  474. xmlns:xs='http://www.w3.org/2001/XMLSchema'
  475. targetNamespace='urn:xmpp:sift:2'
  476. xmlns='urn:xmpp:sift:2'
  477. elementFormDefault='qualified'>
  478. <xs:element name='sift'>
  479. <xs:complexType>
  480. <xs:sequence>
  481. <xs:element name='iq'
  482. type='siftElementType'
  483. minOccurs='0'
  484. maxOccurs='1'/>
  485. <xs:element name='message'
  486. type='siftElementType'
  487. minOccurs='0'
  488. maxOccurs='1'/>
  489. <xs:element name='presence'
  490. type='siftElementType'
  491. minOccurs='0'
  492. maxOccurs='1'/>
  493. <xs:element name='sub'
  494. type='siftElementType'
  495. minOccurs='0'
  496. maxOccurs='1'/>
  497. </xs:sequence>
  498. </xs:complexType>
  499. </xs:element>
  500. <xs:element name='siftElementType'>
  501. <xs:complexType>
  502. <xs:sequence>
  503. <xs:element name='allow'
  504. type='allowElementType'
  505. minOccurs='0'
  506. maxOccurs='unbounded'/>
  507. <xs:any namespace='##other'
  508. minOccurs='0'
  509. maxOccurs='unbounded'/>
  510. </xs:sequence>
  511. <xs:attribute name='recipient'
  512. use='optional'
  513. default='all'>
  514. <xs:simpleType>
  515. <xs:restriction base='xs:NCName'>
  516. <xs:enumeration value='all'/>
  517. <xs:enumeration value='bare'/>
  518. <xs:enumeration value='full'/>
  519. </xs:restriction>
  520. </xs:simpleType>
  521. </xs:attribute>
  522. <xs:attribute name='sender'
  523. use='optional'
  524. default='all'>
  525. <xs:simpleType>
  526. <xs:restriction base='xs:NCName'>
  527. <xs:enumeration value='all'/>
  528. <xs:enumeration value='local'/>
  529. <xs:enumeration value='others'/>
  530. <xs:enumeration value='remote'/>
  531. <xs:enumeration value='self'/>
  532. </xs:restriction>
  533. </xs:simpleType>
  534. </xs:attribute>
  535. </xs:complexType>
  536. </xs:element>
  537. <xs:simpleType name='empty'>
  538. <xs:restriction base='xs:string'>
  539. <xs:enumeration value=''/>
  540. </xs:restriction>
  541. </xs:simpleType>
  542. </xs:schema>
  543. ]]></code>
  544. </section1>
  545. <section1 topic='Acknowledgements' anchor='acks'>
  546. <p>The authors wish to acknowledge feedback received from Dave Cridland, Jack Erwin, Fabio Forno, Waqas Hussain, Craig Kaes, Dirk Meyer, Chris Newton, Christopher Orr, Robert Quattlebaum, Travis Shirk, Mike Taylor, Matthew Wild, and Jiří Zárevúcký, as well as from participants at XMPP Summit #7 in July 2009 and XMPP Summit #8 in February 2010.</p>
  547. </section1>
  548. </xep>