Saturday, May 31, 2008

First steps

It's six days after official start of GSoC coding and I should summarize what I've done so far. I will try to publish a blogpost during each weekend throughout the coding period.

My project is about extending functionality of Gajim jabber client so first thing to do was to explore and try to understand current code that takes care of XMPP communication. Gajim is using fork of xmpppy library extended by implementation of non-blocking transports meaning a lot of callbacks and queue of received and sent messages that notifies plugged objects in (on?) regular intervals. As for networking, there are three relevant layers in Gajim architecture - Connection class as interface between UI and xmpppy (one instance per jabber account), Client class that estabilish connection to XMPP server and handles authentication, and transport classes putting data to sockets in particular format (SSL, TLS, TCP, for HTTP proxy, for SOCKS5 proxy). Transport are not aware of XMPP stanzas.

In the most simple case, BOSH messages are XMPP messages wrapped by body tag with BOSH-related attributes, sent to HTTP-server/proxy-like Connection Manager instead of straight to XMPP server. Communication scheme is a bit different in order to allow server-initiated requests in HTTP (see XEP-0124). With this assumption I looked for a place to begin coding - I was deciding whether to start with Connection, Client or Transport and since the stream initiation slightly differs in XMPP over BOSH and plain XMPP, I went for a BOSHClient class, derived from NBCommonClient. In existing code, Connection object holds instance of NonBlockingClient which also derived from NBCommonClient as shown on class diagram:

The idea is to use BOSHClient instead of NonBlockingClient for accounts connecting to BOSH Connection Manager. So far, I am able to build and send initial request and receive, parse and poorly check the response. After that I would like to integrate Gajim module for SASL authentication and then send first message via BOSH.