Comparison

plugins/mod_smacks.lua @ 11981:5d8264f464a2

mod_smacks: Reorder imports etc Mostly sorted by name of import (sort -k4) and grouped by kind
author Kim Alvefur <zash@zash.se>
date Wed, 01 Dec 2021 23:18:18 +0100
parent 11980:a91494a4c3d0
child 11982:c7c0c40487e2
comparison
equal deleted inserted replaced
11980:a91494a4c3d0 11981:5d8264f464a2
9 -- 9 --
10 -- This project is MIT/X11 licensed. Please see the 10 -- This project is MIT/X11 licensed. Please see the
11 -- COPYING file in the source package for more information. 11 -- COPYING file in the source package for more information.
12 -- 12 --
13 13
14 local tonumber = tonumber;
15 local tostring = tostring;
16 local math_max = math.max;
17 local math_min = math.min;
18 local os_time = os.time;
19 local t_remove = table.remove;
20
21 local cache = require "util.cache";
22 local datetime = require "util.datetime";
23 local add_filter = require "util.filters".add_filter;
24 local jid = require "util.jid";
14 local st = require "util.stanza"; 25 local st = require "util.stanza";
15 local cache = require "util.cache"; 26 local timer = require "util.timer";
16 local uuid_generate = require "util.uuid".generate; 27 local uuid_generate = require "util.uuid".generate;
17 local jid = require "util.jid"; 28
18 29 local sessionmanager = require "core.sessionmanager";
19 local t_remove = table.remove; 30 local core_process_stanza = prosody.core_process_stanza;
20 local math_min = math.min; 31
21 local math_max = math.max; 32 local xmlns_errors = "urn:ietf:params:xml:ns:xmpp-stanzas";
22 local os_time = os.time; 33 local xmlns_delay = "urn:xmpp:delay";
23 local tonumber, tostring = tonumber, tostring;
24 local add_filter = require "util.filters".add_filter;
25 local timer = require "util.timer";
26 local datetime = require "util.datetime";
27
28 local xmlns_mam2 = "urn:xmpp:mam:2"; 34 local xmlns_mam2 = "urn:xmpp:mam:2";
29 local xmlns_sm2 = "urn:xmpp:sm:2"; 35 local xmlns_sm2 = "urn:xmpp:sm:2";
30 local xmlns_sm3 = "urn:xmpp:sm:3"; 36 local xmlns_sm3 = "urn:xmpp:sm:3";
31 local xmlns_errors = "urn:ietf:params:xml:ns:xmpp-stanzas";
32 local xmlns_delay = "urn:xmpp:delay";
33 37
34 local sm2_attr = { xmlns = xmlns_sm2 }; 38 local sm2_attr = { xmlns = xmlns_sm2 };
35 local sm3_attr = { xmlns = xmlns_sm3 }; 39 local sm3_attr = { xmlns = xmlns_sm3 };
36 40
37 local resume_timeout = module:get_option_number("smacks_hibernation_time", 600); 41 local resume_timeout = module:get_option_number("smacks_hibernation_time", 600);
40 local max_unacked_stanzas = module:get_option_number("smacks_max_unacked_stanzas", 0); 44 local max_unacked_stanzas = module:get_option_number("smacks_max_unacked_stanzas", 0);
41 local max_inactive_unacked_stanzas = module:get_option_number("smacks_max_inactive_unacked_stanzas", 256); 45 local max_inactive_unacked_stanzas = module:get_option_number("smacks_max_inactive_unacked_stanzas", 256);
42 local delayed_ack_timeout = module:get_option_number("smacks_max_ack_delay", 30); 46 local delayed_ack_timeout = module:get_option_number("smacks_max_ack_delay", 30);
43 local max_hibernated_sessions = module:get_option_number("smacks_max_hibernated_sessions", 10); 47 local max_hibernated_sessions = module:get_option_number("smacks_max_hibernated_sessions", 10);
44 local max_old_sessions = module:get_option_number("smacks_max_old_sessions", 10); 48 local max_old_sessions = module:get_option_number("smacks_max_old_sessions", 10);
45 local core_process_stanza = prosody.core_process_stanza;
46 local sessionmanager = require "core.sessionmanager";
47 49
48 assert(max_hibernated_sessions > 0, "smacks_max_hibernated_sessions must be greater than 0"); 50 assert(max_hibernated_sessions > 0, "smacks_max_hibernated_sessions must be greater than 0");
49 assert(max_old_sessions > 0, "smacks_max_old_sessions must be greater than 0"); 51 assert(max_old_sessions > 0, "smacks_max_old_sessions must be greater than 0");
50 52
51 local c2s_sessions = module:shared("/*/c2s/sessions"); 53 local c2s_sessions = module:shared("/*/c2s/sessions");