This document intends to show how using Python can result in simpler, shorter, and more easily implemented code.
Idle Time Implementations
I've looked at "Gaim":http://gaim.sf.net 0.66 and "Gabber":http://gabber.jabberstudio.net 1.9.0's implementations of idle time for the purposes of comparison. The code listed here is responsible for listening to 'IQs?' with the type 'jabber:iq:last' and responding with the current idle time. We assume that dispatching is already handled. It should build XML that looks something like:
<iq to='homestar@homestarrunner.com' type='result' id='idle2' from='marzipan@homestarrunner.com'> <query xmlns = 'jabber:iq:last' seconds='17'></query> </iq>Gaim
From the 'src/protocols/jabber/jabber.c' file:
static void jabber_handlelast(gjconn gjc, xmlnode iqnode) { xmlnode x, querytag