On Tue, Mar 25, 2014 at 1:35 PM, Jiibii Bii <jiibii...@gmail.com> wrote:
> Hello
> I need to modifiy Prosody in ordre to:
> - listen on 2 other ports than 5222
> - filter or modify stanza (up and down)  for sessions on these new ports (
> session on 5222 are not filtered)
> I think, the filtering can be done in a 'module' ( maybe there are already
> modules for do that)
> But can I use a module to make Prosody listen on several ports?
> or do I need to modify the core of Prosody ( ie xmppclient_listener.lua or
> session_manager.lua ? )
> If someone has an idea where I can start, it would be nice to help me.
> Thanks a lot.

This should all be doable with a custom plugin/module and some config
change. You wouldn't need to modify Prosody's core.

Set the client ports you need in your Prosody config: c2s_ports = {
5222, 6222, 7222 };

Now you'll write a plugin which listens on stanzas that you are
interested in. See mod_stanza_counter in prosody-modules for an
example of a plugin which hooks all stanzas. For the best performance
in benchmarks, you should generally only hook stanzas that you need :)

Stanza handlers get an event object, that contains the stanza and the
sending session. You can stop an event by doing a 'return true;' from
a handler, or let it continue with a 'return', 'return nil', or not
having a return statement (all of which are equivalent for this). You
can retrieve the port a session is connected to, and just 'return;' in
case it's 5222. See dev docs on the Prosody website for relevant

Your mention of 'xmppclient_listener.lua' suggests that you are on an
old Prosody version. You should consider upgrading (not necessary, but
may improve things). You can also join the Prosody chatroom and talk
with us there if you need: https://prosody.im/discuss#chatroom

Waqas Hussain

You received this message because you are subscribed to the Google Groups 
"prosody-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prosody-dev+unsubscr...@googlegroups.com.
To post to this group, send email to prosody-dev@googlegroups.com.
Visit this group at http://groups.google.com/group/prosody-dev.
For more options, visit https://groups.google.com/d/optout.

Reply via email to