Can external component get the user''s session?


If I want start a service once a client log on and when it disconnect the service stopped. How does the external component get invoked?


He Qi


I think you can achieve that with a plugin that is registered as PacketInterceptor to intercept of type available (online) and unavailable (offline). Once the plugin sees the correct user (from “from” attribute), it can spawn/kill the external component.


I wonder what kind of service you’'re developing that requires such functionality…

Message was edited by: aznidin


Ryan suggested a better class to implement than the PacketInterceptor, which I think is also more appropriate in your case, i.e. SessionEventListener

Message was edited by: aznidin


I want to implement Email gateway. It can listen for new mail. A component named JMC has implement this. But I am new to python and cann’'t understand it well.

Hi, ni hao

Thank you for response.

How do PacketInterceptor send packet to other component?

Hi 你好

JMC doesn’‘t implement email gateway the way you think it does. It’‘s not a wildfire plugin, but strictly an external component implementation. Once JMC runs, it runs as a service forever (ofcourse, unless you kill it). It doesn’'t run per user connection, like you plan to do via plugin.

To use JMC service, user needs to register to JMC using jabber:iq:register. Once registered, JMC and users will subscribe to each other’‘s presence. When users add an email profile for JMC to fetch, the profile becomes another XMPP entity. For each of the profiles, users will also need to subscribe to it’'s presence. The subscription is invoked by JMC.

I think, before you try to develop your own email gateway, you should try to install JMC and see if it fits your purpose. IMHO, the functionalities provided by JMC should be enough for most implementations. You don’‘t have to know Python to make it work, although you may have to install several other libraries that JMC depends on before you can successfully run JMC. To me, it’'s still easier than writing your own email gateway.