Last activity by presence away status

Daniele Ricci
Added 8 months ago

I'd like to implement a last activity plugin that takes into account the time passed since last presence with show=away OR last disconnection (i.e. WhatsApp-like). I can imagine I could do this in a few ways:

  • IQ-based last activity (XEP-0012) - needs modification to client's presence for adding time information
  • Last activity in presence (XEP-0256) - doesn't work with offline users since offline presence is not stored or kept in memory (for obvious performance reasons)

The first solution can be implemented using an ExtendedPresenceProcessor for adding maybe a delay tag to incoming presence, and then reading it from the last activity plugin (my own version of course). Possible performance impact because of the ExtendedPresenceProcessor. However, no client modifications required.

The second solution would require patching Tigase itself because ExtendedPresenceProcessors are called when receiving presence from clients, rather than when they are about to be broadcasted. And this solution is a pain for clients because they have to wait for presence data to come in and eventually ask for a last presence via IQ if a presence hasn't been received.

Any performance-wise (and possibly respecting standards) suggestions? Pointers, anything would be help.