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

Gaurav Jain monkeyfdude at gmail.com
Thu Mar 12 18:55:32 MSK 2015


OK.

* The reason for this is mobile users. iOS and other platforms does not
allow apps to keep network sessions alive/connected when the app is in
background.
* So, when user presses home button or switches app, he will get
disconnected soon. But that does not mean he intended not to receive
messages any more. So, in this case offline messages should be sent via
Push Mechanism

* However, user can explicitly say that he/she does not want to receive
messages from this room/user any more whether connected or disconnected
with internet. So, in this case push notifications should not be sent from
those users/room.


I did look at the code and I found unset_presence_hook is called with four
args, User, Server, Resource and Status. It does not give the full Presence
packet to the hook. I wanted to inject some data in the presence packet
sent by client and have a hook process that data.

Is my understanding correct? If so, how can I get access to full packet.
set_presence_hook does give the full packet.




Best Regards,





On Thu, Mar 12, 2015 at 4:34 AM, Holger Weiß <holger at zedat.fu-berlin.de>
wrote:

> * 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
> disconnected.¹)
>
> > 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 ...
>
> Holger
>
> ¹ https://www.ejabberd.im/faq/tcp
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20150312/5c55b3ed/attachment.html>


More information about the ejabberd mailing list