I have an ejabberd server at jabber.domain.com, with an xmpp component written in python (using sleekxmpp) at presence.domain.com.
I wanted the component to get a notification each time a client changed his presence from available to unavailable and vice-versa.
The clients themselves don't have any contacts.
Currently, I have set up my clients to send their available presence stanzas to admin@presence.domain.com, and I do get their online/offline presence notifications. But I feel this isn't the right approach.
I was hoping the clients wouldn't be aware of the component at presence.domain.com, and they would just connect to jabber.domain.com and the component should somehow get notified by the server about the clients presence.
Is there a way to do that?
Is my component setup correct? or should I think about using an xmpp plugin/module/etc..
Thanks
It is possible for a component to subscribe to a user's presence exactly the same way a user does. Also it is possible for the user to subscribe to a component's presence. You just have to follow the usual pattern, i.e. the component/user sends a <presence/> of type subscribe which the user/component can accept by sending a <presence/> of type subscribed.
You can also have the user just send a presence to the component directly.
There is no need to write custom hooks or create proxy users.
Getting ejabberd to notify an external module on client presence change