This document defines an XMPP protocol extension for editing one text document by several people. This can be useful when several people write different parts of one single document, or one person edits the text and other people can see the changes. The advantage of using this protocol in compared to using a version control systems is that all changes are distributed between editors in real-time.
To start editing a file, the user must subscribe to it on special "server" The server stores text files. A User first can ask for list of these documents.
After that the server returns a list of the documents. For each list item an ID and description is given.
Then the user can send a subscribe request to the server by sending the documents ID. Attribute type can be rdwr for full access or rdonly for read-only access.
After successful subscription, the server sends the full contents of the document to the new editor.
If an editor wants to commit the changes he made, then he sends a patch file to this text in GNU diff(1) unified format without first two lines (they specify file names and modification dates, that is not needed).
If server accepts the patch, then it resends it to all subscribed text editors and readers.
If server receives an error IQ reply from one of the editors/readers on any of above requests, then it must remove him from subscribers list and may send a message to him about this.