Difference between revisions of "Gajim PubSub"
Revision as of 21:24, 24 July 2010
My name's Tomasz Melcer and I am a student of Computer Science (first year). This is my Summer of Code proposal.
Ad-Hoc Commands and Publish-Subscribe for Gajim
XEP-0050 (http://xmpp.org/extensions/xep-0050.html) describes the Ad-Hoc Commands extension to Jabber/XMPP protocol. It allows building user-friendly remote interfaces to XMPP applications like bots or other jabber clients. XEP-0060 (http://xmpp.org/extensions/xep-0060.html) describes a generic protocol to publish data and notify users about new content. Both can be used to create a Jabber-based discussion groups, similar to Usenet. My goal is to implement both protocols in Gajim - Jabber client written in Python, then build a pubsub-based discussion groups service.
Python, xmpppy and Gajim
Python is a very easy to use scripting language. It was developed to allow writing software fast and without bugs. I like it very much, so I choosed xmpppy library and Gajim jabber client to work on. xmpppy is very modular jabber library, which was used for example to write transport to irc. Gajim is a relatively new jabber client. Despite that it already has many features, like avatars, file transfer and MUC.
Why yet another protocol? There are already such things like Usenet, mailing lists and web-based forums. Actually, they have one common disadvantage for me: they aren't jabber based ;-). All of them are based on the "pull"-type protocols, that often have no means of notifying the user of new content, user needs to check periodically for it. They also have other drawbacks: doesn't allow to easily browse older messages (mailing lists), are uncomfortable (forums), provide no means to configure service by user (usenet). Besides, PubSub looks like it was written to make a board :-).
The payload of pubsub items are simply an atom entries. Some fields of entry are filled by posting user agent, some by the server (these are marked with asterix (*). Elements used by the implementation are:
- atom:content - plain unicode text data with lines separated by \n,
- atom:author with atom:name and jid sub-elements - description of author; jid element contains jid of author just like in atom:email field,
- atom:category (*) - group id
- atom:generator - name of user agent used to create message
- atom:id (*) - (equal to id of pubsub item)
- atom:title - subject of message
My implementation is using python, xmpppy and sqlite to keep lists of subscribers and groups. For now it is very experimental and doesn't allow many actions that could be handled, like creating new nodes by users. This will be added as a part of further development.
Gajim can now list existing nodes (in an extended version of disco browser ui), subscribe/unsubscribe and post a new message, so it is possible to use it to create newsletters. The UI for writing messages is not currently very comfortable, but this will change.
- xmpppy: an API for Ad-Hoc Commands (probably some testing/example tools too)
- Gajim: GUI for invoking commands
- Gajim: expose changing status messages as a command
- xmpppy: a subset of pubsub that will be enough to receive events from pubsub.com (Atom syndication format wrapped in pubsub)
- Gajim: GUI for displaying new events from pubsub.com and changing subscription options
- discussion groups: server component as a service and Gajim as a client; both will be developed simultaneously.
- (2006.05.27) Made testing bot to the "responder" part of the commands implementation in xmpppy (in xmpppy's repository).
- (2006.06.03) Prepared some testing environment (local repositories). Tried to make a client-requester class in xmpppy, seems that this is not a way to go - Gajim uses its own stanza dispatcher mechanism built on top of the xmpppy's one, bots won't use 'requester' part of commands... this would not be useful. Found out why I don't get mails from jabber-soc mailing lists ('-' instead of '_' in procmailrc).
- (2006.06.23) My commands' implementation now lacks only invoking commands. The GUI, retrieving command list and reporting errors are done. New code is in Gajim's branch: svn://svn.gajim.org/gajim/branches/ad_hoc.
- (2006.06.25) Invoking commands works... as long as forms sent by responder use only text-single, boolean and list-single fields. Gajim never handled jid-single/jid-multi fields. Moreover, data form class in xmpppy is weak, it doesn't ease handling forms as much as I expected, so I'll probably have to rewrite it to keep code clean.
- (2006.06.26) We (Asterix and I) decided that I'll make new wrapper for data forms. Gajim now uses something that I call a wrapper for a wrapper for a wrapper, and to keep things clean I'll make yet another wrapper (;-)) to use in my code, that will do everything the old classes do now. After SoC I'll move old code to use only the new class, so everything will be consistent.
- (2006.07.06) Due to hardware failure I've got some delay... but my new data forms seems to work. Shiny, new wrapper, that makes use of pythonic features like properties, iterators and unicode objects... Not like the old one. I started moving my code to new wrapper, but I've got a bug somewhere in the gui, I spend few hours looking for it. I hope I'll find it quickly tomorrow.
- (2006.07.07) The GUI works with the wrapper, now i just have to implement all field types and fine-tune the GUI.
- (2006.07.12) All fields are implemented. Example screenshot:  (65 kB)
- (2006.07.15) Gajim does not use disco wrapper class from xmpppy, so I could not use commands class from xmpppy. Now it looks well and works well too... I looked at the pubsub.com service description, and at the atom-over-pubsub proposal, they don't differ too much. Good to know. It is possible to implement both in one interface.
- (2006.07.17) Adhoc Commands code finished. Now Atom&PubSub!
- (2006.07.22) My branch of Gajim can now receive notifications from pubsub.com, when logged in to their server. Some GUI glitches left.
- (2006.08.08) The service bot can list groups, subscribe and unsubscribe jids. I will soon publish its code. Gajim can present the list of nodes, now working on (un)subscribing UI. I had small delays, but now everything is ok.
- (2006.08.19) The service agent works, Gajim allows to send messages and receive them (actually as single messages, there's now special gui for now - this means that after subscribing to a node using gajim user can get messages using any jabber client capable of displaying messages with subjects). I had some delays due to family affairs, but now it is done! Now I'm going to finish the data forms wrapper. After that I'll start extending groups service, a post-SoC effect :-).