Skip to content

Instantly share code, notes, and snippets.

@legastero
Created January 24, 2013 23:50
Show Gist options
  • Save legastero/4629838 to your computer and use it in GitHub Desktop.
Save legastero/4629838 to your computer and use it in GitHub Desktop.
Experiment with cleaning up the XML in the new FIS XEP.
<!-- Notes:
The <offer />, and <request /> wrappers aren't needed, since that
information is provided by the IQ type.
The node attribute is the path of a file or directory in these
examples, but its not really required that the two match. There
could be a mapping of UUIDs to paths, with the node being the UUID.
Using the term node would make it easier conceptually for
future XEPs that tie in pubsub updates for new/changed/removed
files.
As for the search portion of FIS, I'm not sure what is best. Doing
something like:
<query xmlns="urn:xmpp:fis:search:0">...</query>
may be the best option since the form request in jabber:iq:search
can't be scoped to request what kind of search you want to make.
-->
<!-- Example 1: Request shared root directory -->
<iq type="get" id="1">
<query xmlns="urn:xmpp:fis" />
</iq>
<iq type="result" id="1">
<query xmlns="urn:xmpp:fis:0">
<file xmlns='urn:xmpp:jingle:apps:file-transfer:3'>
<date>1969-07-21T02:56:15Z</date>
<desc>This is a test. If this were a real file...</desc>
<name>test.txt</name>
<size>1022</size>
<hash xmlns='urn:xmpp:hashes:1' algo='sha-1'>552da749930852c69ae5d2141d3766b1</hash>
</file>
<file xmlns='urn:xmpp:jingle:apps:file-transfer:3'>
<name>test2.txt</name>
</file>
<directory name='pics' />
</query>
</iq>
<iq type="result" id="1-alternate">
<query xmlns="urn:xmpp:fis:0" />
</iq>
<!-- Example 2: Request a specific file's data -->
<iq type="get" id="2">
<query xmlns="urn:xmpp:fis:0" node="test2.txt" />
</iq>
<iq type="result" id="2">
<query xmlns="urn:xmpp:fis:0" node="test2.txt">
<file xmlns='urn:xmpp:jingle:apps:file-transfer:3'>
<name>test2.txt</name>
<size>1000</size>
</file>
</query>
</iq>
<!-- Example 3: Request a directory's contents -->
<iq type="get" id="3">
<query xmlns="urn:xmpp:fis:0" node="pics" />
</iq>
<iq type="result" id="3">
<query xmlns="urn:xmpp:fis:0" node="pics">
<file xmlns='urn:xmpp:jingle:apps:file-transfer:3'>
<name>test3.png</name>
</file>
<file xmlns='urn:xmpp:jingle:apps:file-transfer:3'>
<name>test4.png</name>
</file>
<directory name="landscapes" />
</query>
</iq>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment