[Council] [standards-jig] feature negotiation vs. jabber:x:data (fwd)

Peter Saint-Andre stpeter at jabber.org
Mon Nov 11 18:08:54 CST 2002


Perhaps I should've posted this to council at jabber.org instead, but here's
the forward....

Peter

--
Peter Saint-Andre
Jabber Software Foundation
http://www.jabber.org/people/stpeter.php

---------- Forwarded message ----------
Date: Mon, 11 Nov 2002 18:04:09 -0600 (CST)
From: Peter Saint-Andre <stpeter at jabber.org>
Reply-To: standards-jig at jabber.org
To: standards-jig at jabber.org
Subject: [standards-jig] feature negotiation vs. jabber:x:data

At the last Council meeting we talked about using jabber:x:data rather
than a dedicated feature negotiation namespace. This post shows what that
might look like. For each example, the first protocol snippet is the
jabber:iq:negotiate XML from JEP-0020 and the second one (e.g., 1') is the
translation of that example into jabber:x:data. As we will see, there is a
fundamental asymmetry here, so bear with me.

The first set of examples in JEP-0020 use the scenario of a user (Jack)
who wishes to send a file to another user (Jill). Before the file transfer
can take place, Jill first uses jabber:iq:negotiate to ask Jack what file
transfer methods he supports. Jack then answers with her preferred method.

Example 1. Normal Negotiation Exchange

(Jill Sender presents options to Jack Recipient...)

<iq type="get" id="1" to="jack at jabber.org/client">
  <query xmlns="jabber:iq:negotiate">
    <feature type="jabber:iq:oob">
      <option>p2p-initiate</option>
      <option>p2p-receive</option>
      <option>webdav</option>
      <option>jabber-pass</option>
    </feature>
  </query>
</iq>

(Jack informs Jill regarding preferred option...)

<iq type="result" id="1" to="jill at jabber.org/pda">
  <query xmlns="jabber:iq:negotiate">
    <feature type="jabber:iq:oob">
      <option>p2p-initiate</option>
    </feature>    
  </query>
</iq>

Example 1' -- this is the jabber:x:data translation!

(In jabber:x:data, the first step for Jill is to send a form to Jack.)

<iq type="set" id="1" to="jack at jabber.org/client">
  <query xmlns="jabber:iq:negotiate">
    <x xmlns='jabber:x:data' type='form'>
      <field type='list-multi' var='jabber:iq:oob'>
        <option><value>p2p-initiate</value></option>
        <option><value>p2p-receive</value></option>
        <option><value>webdav</value></option>
        <option><value>jabber-pass</value></option>
      </field>
    </x>
  </query>
</iq>

<iq type="result" id="1" to="jill at jabber.org/pda">
  <query xmlns="jabber:iq:negotiate">
    <x xmlns='jabber:x:data' type='submit'>
      <field var='jabber:iq:oob'>
        <value>p2p-initiate</value>
      </field>
    </x>
  </query>
</iq>

Example 2. Feature Not Implemented

<iq type="error" id="1" to="jill at jabber.org/pda">
  <error code="501">Jabber File Transfers are not supported</error>
</iq>

Example 2'

<iq type="error" id="1" to="jill at jabber.org/pda">
  <error code="501">Jabber File Transfers are not supported</error>
</iq>

Example 3. Unsupported Options

<iq type="error" id="1" to="jill at jabber.org/pda">
  <error code="406">Unsupported Options</error>
</iq>

Example 3'

<iq type="error" id="1" to="jill at jabber.org/pda">
  <error code="406">Unsupported Options</error>
</iq>

Example 4. Negotiating place and time for lunch

<iq type="get" id="1" to="jack at jabber.org/pda">
  <query xmlns="jabber:iq:negotiate">
    <feature type=":x:lunch#place">
      <option>Subway</option>
      <option>Chipotle</option>
      <option>Illegal Pete's</option>
      <option>Manny's Underground</option>
      <option>Flying Dog Cafe</option>
    </feature>
    <feature type=":x:lunch#time">
      <option>11:30</option>
      <option>12:00</option>
      <option>12:30</option>
      <option>13:00</option>
    </feature>
  </query>
</iq>

Example 4'

<iq type="set" id="1" to="jack at jabber.org/pda">
  <query xmlns="jabber:iq:negotiate">
    <x xmlns='jabber:x:data' type='form'>
      <field type='list-multi' var=':x:lunch#place'>
        <option><value>Subway</value></option>
        <option><value>Chipotle</value></option>
        <option><value>Illegal Pete's</value></option>
        <option><value>Manny's Underground</value></option>
        <option><value>Flying Dog Cafe</value></option>
      </field>
      <field type='list-multi' var=':x:lunch#time'>
        <option><value>11:30</value></option>
        <option><value>12:00</value></option>
        <option><value>12:30</value></option>
        <option><value>13:00</value></option>
      </field>
    </x>
  </query>
</iq>

Example 5. Lunch negotiation result

<iq type="result" id="1" to="jill at jabber.org/home">
  <query xmlns="jabber:iq:negotiate">
    <feature type=":x:lunch#place">
      <option>Flying Dog Cafe</option>
    </feature>
    <feature type=":x:lunch#time">
      <option>12:30</option>
    </feature>
  </query>
</iq>

Example 5'

<iq type="result" id="1" to="jill at jabber.org/home">
  <query xmlns="jabber:iq:negotiate">
    <x xmlns='jabber:x:data' type='form'>
      <field var=':x:lunch#place'>
        <value>Flying Dog Cafe</value>
      </field>
      <field var=':x:lunch#time'>
        <value>12:30</value>
      </field>
    </x>
  </query>
</iq>

SOME EXTRA EXAMPLES

In a recent post, I laid out a possible flow for negotiating offline
message handling when logging into a server. Here are the
jabber:iq:negotiate snippets (note these are slightly different from what
I posted earlier today):

(user tells server pop3 is desired)

<iq type='set' id='a2'>
  <query xmlns='jabber:iq:negotiate'>
    <feature type='http://jabber.org/protocol/offline'>
      <option>pop3</option>
    </feature>
  </query>
</iq>

(server says OK)

<iq type='result' id='a2'>
  <query xmlns='jabber:iq:negotiate'>
    <feature type='http://jabber.org/protocol/offline'>
      <option>pop3</option>
    </feature>
  </query>
</iq>

Here is the jabber:x:data translation of these snippets:

<iq type="set" id="a2">
  <query xmlns="jabber:iq:negotiate">
    <x xmlns='jabber:x:data' type='form'>
      <field type='list-multi' var='http://jabber.org/protocol/offline'>
        <option><value>pop3</value></option>
      </field>
    </x>
  </query>
</iq>

<iq type="result" id="a2">
  <query xmlns="jabber:iq:negotiate">
    <x xmlns='jabber:x:data' type='submit'>
      <field type='list-multi' var='http://jabber.org/protocol/offline'>
        <option><value>pop3</value></option>
      </field>
    </x>
  </query>
</iq>

******

These are rough-and-ready translations done in a hurry in order to promote
discussion. Complain on-list if you see errors.

Peter

--
Peter Saint-Andre
Jabber Software Foundation
http://www.jabber.org/people/stpeter.php

_______________________________________________
Standards-JIG mailing list
Standards-JIG at jabber.org
http://mailman.jabber.org/listinfo/standards-jig




More information about the Council mailing list