Hi,
Attached is the patch which allows subscribing to events in common/events.py (using publisher/subscriber pattern). As a side-effect, this patch decouples systray.py and common/events.py (common/events.py no longer even imports common.gajim).
The patch allows additional modules to be written, which do the different things when events arrive (e.g. blinking LED, executing external program). Existing things, such as emiting DBus messages on new events also may be restructured to use this mechanism.