Typically, the implementation of the protocol at a low level, assume the library. I decided to think (to dream):
how should such a “library” work in the Inferno OS, if everything is presented as files.
The utility for implementing XMPP, later, simply, XMPP, establishes a connection with the JABBER server, as a result, files are created for running and managing the server at the / mnt / xmpp mount point:
presence — the file where we write our status and commands (unavailable, for example), show parameters — how to display (away — temporarily left, chat — chat, dnd — resource is busy or do not disturb ...), status — recipient status (online, ready to the chat ... write a message), priority - resource priority, - we “told” the server how to display us;
message file, from where we will read messages from the server.
Work with the roster. You need files to display all the information about the corresponding JabberID and manipulate them.
An example of obtaining information from the server:
')
<item jid='romeo@example.net '
name = 'Romeo'
subscription = 'both'>
<group> Friends </ group>
<group> Body </ group>
</ item>For each item in the roster, the parameters are used:
jid, subscription, name, <group> .
It is possible that in our mount folder there should be folders with destination JIDs, one folder - one destination, for example folders:
iuser@jabber.orgsecondusr@xmpp.ru ,
In each of these files:
item - text file from where we read / write the parameters: name - how to display the name of this contact, subscription - subscription,
group - the group in which the contact is made;
the presence and management of the recipient’s subscription is determined by the
<presence> tag , which means we need the same file:
presence - file where we write commands (subscribe, unsubscribe, probe or empty line), read information about the user and his status: show, status, priority parameters;
message - from where / where we read / write messages with the parameters type, subject and body (having written there the text - it goes to the recipient, from here we read the received message). For example:
echo hello> /mnt/xmpp/iuser@jabber.org/message will send the text “hello” to iuser@jabber.org.
Creating a folder - a contact is automatically created.
Unfortunately, I do not know thoroughly either Inferno or all the features of XMPP - it's all in the process.
The opinion of others is very interesting:
how should it be? :-)