Created
January 25, 2013 00:14
-
-
Save legastero/4630085 to your computer and use it in GitHub Desktop.
Ponder options in exposing FIS data over disco.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<iq type="get" id="disco1"> | |
<query xmlns="http://jabber.org/protocol/disco#items" node="urn:xmpp:fis:0" /> | |
</iq> | |
<iq type="result" id="disco1"> | |
<query xmlns="http://jabber.org/protocol/disco#items" node="urn:xmpp:fis:0"> | |
<item jid="a@b" node="test1.txt" name="test1.txt" /> | |
<item jid="a@b" node="test2.txt" name="test2.txt" /> | |
<item jid="a@b" node="pics" name="pics" /> | |
</query> | |
</iq> | |
<!-- Get information about a node --> | |
<iq type="get" id="disco2"> | |
<query xmlns="http://jabber.org/protocol/disco#info" node="test1.txt" /> | |
</iq> | |
<!-- Discover that a node is a file --> | |
<iq type="result" id="disco2"> | |
<query xmlns="http://jabber.org/protocol/disco#info" node="test1.txt"> | |
<identity category="filesys" type="file" name="test1.txt" /> | |
<identity category="hierarchy" type="leaf" /> | |
</query> | |
</iq> | |
<!-- We could include the file metadata in the result here --> | |
<iq type="result" id="disco2-alternate1"> | |
<query xmlns="http://jabber.org/protocol/disco#info" node="test1.txt"> | |
<identity category="filesys" type="file" name="test1.txt" /> | |
<identity category="hierarchy" type="leaf" /> | |
<x xmlns="jabber:x:data"> | |
<field var="FORM_TYPE"><value>urn:xmpp:fis:0</value></field> | |
<field var="desc"><value>This is a test</value></field> | |
<field var="size"><value>1022</value></field> | |
<field var="hash-algo"><value>sha-1</value></field> | |
<field var="hash"><value>552da749930852c69ae5d2141d3766b1</value></field> | |
</x> | |
</query> | |
</iq> | |
<!-- We could also just include the file metadata XML directly instead of creating new form fields--> | |
<iq type="result" id="disco2-alternate2"> | |
<query xmlns="http://jabber.org/protocol/disco#info" node="test1.txt"> | |
<identity category="filesys" type="file" name="test1.txt" /> | |
<identity category="hierarchy" type="leaf" /> | |
<x xmlns="jabber:x:data"> | |
<field var="FORM_TYPE"><value>urn:xmpp:fis:0</value></field> | |
<field var="metadata"> | |
<wrapper xmlns="urn:xmpp:xml-element"> | |
<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> | |
</wrapper> | |
</field> | |
</x> | |
</query> | |
</iq> | |
<!-- Retrieve a node's FIS metadata outside of disco --> | |
<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> | |
<!-- Discover that a node is a directory --> | |
<iq type="get" id="disco3"> | |
<query xmlns="http://jabber.org/protocol/disco#info" node="pics" /> | |
</iq> | |
<iq type="result" id="disco3"> | |
<query xmlns="http://jabber.org/protocol/disco#info" node="pics"> | |
<identity category="filesys" type="directory" name="pics" /> | |
<identity category="hierarchy" type="branch" /> | |
</query> | |
</iq> | |
<!-- Get items in a directory --> | |
<iq type="get" id="disco4"> | |
<query xmlns="http://jabber.org/protocol/disco#info" node="pics" /> | |
</iq> | |
<iq type="result" id="disco4"> | |
<query xmlns="http://jabber.org/protocol/disco#items" node="urn:xmpp:fis:0"> | |
<item jid="a@b" node="pics/pic1.png" name="pic1.png" /> | |
<item jid="a@b" node="pics/pic2.jpg" name="pic2.jpg" /> | |
</query> | |
</iq> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment