# HG changeset patch # User Kim Alvefur # Date 1413803628 -7200 # Node ID 16893646a458216dac6c8465e42e01a612d08f80 # Parent 5ccb3ee2cf722ffc6fc3b23696b720086e9cbe56 mod_smacks: Move wrap_session() contents into separate direction-specific routines diff -r 5ccb3ee2cf72 -r 16893646a458 mod_smacks/mod_smacks.lua --- a/mod_smacks/mod_smacks.lua Mon Oct 20 13:11:28 2014 +0200 +++ b/mod_smacks/mod_smacks.lua Mon Oct 20 13:13:48 2014 +0200 @@ -105,7 +105,7 @@ return stanza; end -local function wrap_session(session, resume) +local function wrap_session_out(session, resume) if not resume then session.outgoing_stanza_queue = {}; session.last_acknowledged_stanza = 0; @@ -121,7 +121,10 @@ end return session_close(...); end + return session; +end +local function wrap_session_in(session, resume) if not resume then session.handled_stanza_count = 0; add_filter(session, "stanzas/in", count_incoming_stanzas, 1000); @@ -130,6 +133,12 @@ return session; end +local function wrap_session(session, resume) + wrap_session_out(session, resume); + wrap_session_in(session, resume); + return session; +end + function handle_enable(session, stanza, xmlns_sm) local ok, err, err_text = can_do_smacks(session); if not ok then