Mercurial > prosody-modules
diff mod_smacks/mod_smacks.lua @ 640:d87131b29bbd
mod_smacks: Remove dependency on connlisteners (use sessions table shared by mod_c2s directly)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 28 Apr 2012 18:16:47 +0100 |
parents | 2c07bcf56a36 |
children | 06a78cba6499 |
line wrap: on
line diff
--- a/mod_smacks/mod_smacks.lua Sat Apr 28 18:10:36 2012 +0100 +++ b/mod_smacks/mod_smacks.lua Sat Apr 28 18:16:47 2012 +0100 @@ -8,7 +8,6 @@ local add_filter = require "util.filters".add_filter; local timer = require "util.timer"; local datetime = require "util.datetime"; -local connlisteners = require "net.connlisteners"; local xmlns_sm = "urn:xmpp:sm:2"; local xmlns_errors = "urn:ietf:params:xml:ns:xmpp-stanzas"; @@ -20,6 +19,7 @@ local s2s_smacks = module:get_option_boolean("smacks_enabled_s2s", false); local max_unacked_stanzas = 0; +local c2s_sessions = module:shared("/*/c2s/sessions"); local session_registry = {}; local function can_do_smacks(session, advertise_only) @@ -256,7 +256,7 @@ if original_session.conn then session.log("debug", "mod_smacks closing an old connection for this session"); local conn = original_session.conn; - connlisteners.get("xmppclient").associate_session(conn, nil); + c2s_sessions[conn] = nil; conn:close(); end original_session.ip = session.ip; @@ -281,7 +281,7 @@ -- Inform xmppstream of the new session (passed to its callbacks) stream:set_session(original_session); -- Similar for connlisteners - connlisteners.get("xmppclient").associate_session(session.conn, original_session); + c2s_sessions[session.conn] = original_session; session.send(st.stanza("resumed", { xmlns = xmlns_sm, h = original_session.handled_stanza_count, previd = id }));