[ejabberd] ejabberd behavior b/w user disconnected vs user unavailable

Holger Weiß holger at zedat.fu-berlin.de
Thu Mar 12 14:34:08 MSK 2015

* Gaurav Jain <monkeyfdude at gmail.com> [2015-03-11 22:11]:
> What is the ejabbered behavior for user who is un-expectedly disconnected
> from internet
> vs
> user who explicitly sent an 'unavailable' presence?
> Would they both be considered offline (for both single user chat or MUC)?

Yes.  (As soon as ejabberd actually notices that the client is

> I want a behavior where if a user is disconnected from internet, offline
> messages to be sent
> If user sent a explicit unavailble presence, I dont want offline messages
> to be sent.
> How can that be accomplished? I can write my hook. But I need to know in
> which situations, the hook will be called.

I don't see an easy way to distinguish these cases without modifying the
ejabberd code.  The 'unset_presence_hook' is called in both cases,
usually with the same arguments.

Distinguishing these cases sounds like an unusual requirement to me.
You didn't mention *why* you want to deliver offline messages only in
one of these cases.  Maybe there's a better way to implement whatever
you're actually trying to achieve ...


¹ https://www.ejabberd.im/faq/tcp

More information about the ejabberd mailing list