kopano-presence
===============

a simple daemon for collecting and exporting user presence information across multiple protocols in a unified way.

uses a 'plugin' per supported protocol. at the moment only XMPP and spreed are supported, but in the future we could add for example asterisk, IRC..

clients can both query the daemon with presence information (for example, the user is 'available' for XMPP and 'away' for spreed) and update presence information (for example, make a user 'available' on spreed). updating is only needed for the spreed plugin at the moment.

queries and updates are performed with simple GET and PUT requests, respectively, using a simple (and identical) JSON format. an example of this:

{
    "AuthenticationToken":"1415697944:markd@kopano.com:SLDJMBNNFNN5/RIXFJPXVKCKNV6SBHYGLFLE5G/TVLY=", 
    "Type": "UserStatus,
    "UserStatus": [
        {
            "user_id": "markd@kopano.com", 
            "xmpp": {
                "status": "available", 
                "message": ""
            }, 
            "spreed": {
                "status": "available", 
                "message": "feeling chatty.."
            }
        }
    ]
}

users are globally identified by account and domain name as registered in each system, for example markd@kopano.com. so XMPP for example has to be setup this way.

the daemon uses shared-secret authentication, with configurable expiration of tokens (see comments in presence.cfg).

the daemon itself only maintains four states: available, busy, away, unavailable. 

XMPP plugin
===========

uses python-sleekxmpp and a single user account to receive presence updates, as configured in presence.cfg. this user obviously has to be able to see the presence status of (all) other users.  

states are mapped to the four states mentioned above (for example, 'xa' becomes 'away'). 

the plugin runs as one ore more threads in the background (setup by sleekxmpp).

spreed plugin
=============

the only thing this adds on top of the builtin GET and PUT requests is a simple timer per user, which makes users become 'unavailable' after a configure number of minutes without any update from the client. 

this also runs as a thread in the background.
