On 2014-03-25 19:39, Waqas Hussain wrote:
> You can retrieve the port a session is connected to

Not sure if we have docs for net.server internals, but to check what
port a session is connected to:

    session.conn:serverport()

You mentioned filtering and modifying stanzas, and we happen to have
filters that might be more efficient than event hooks.  Example:

{{{
local add_filter = require "util.filters".add_filter;

module:hook("resource-bind", function(event)
  local session = event.session;
  if session.conn:serverport() == 6222 then
    add_filter(session, "stanzas/out", function(stanza)
      -- do things with stanza here
      return stanza; -- or nil to drop it
    end);
  end
end);
}}}

--
Kim "Zash" Alvefur

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to