From c71e65917c71c44c90bb6298f87d1d9cbdcab283 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 3 Apr 2015 19:13:35 +0100 Subject: rostermanager: Remove unused parameter --- core/rostermanager.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core') diff --git a/core/rostermanager.lua b/core/rostermanager.lua index 19d07c94..7e165c27 100644 --- a/core/rostermanager.lua +++ b/core/rostermanager.lua @@ -227,7 +227,7 @@ function is_contact_pending_in(username, host, jid) local roster = load_roster(username, host); return roster[false].pending[jid]; end -function set_contact_pending_in(username, host, jid, pending) +function set_contact_pending_in(username, host, jid) local roster = load_roster(username, host); local item = roster[jid]; if item and (item.subscription == "from" or item.subscription == "both") then -- cgit v1.2.3 From b13254c2335e51a71717381956ee9a1653b2a129 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 3 Apr 2015 19:20:24 +0100 Subject: loggingmanager: Improve code structure (removes empty if branch) --- core/loggingmanager.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'core') diff --git a/core/loggingmanager.lua b/core/loggingmanager.lua index c6361146..f348dbdf 100644 --- a/core/loggingmanager.lua +++ b/core/loggingmanager.lua @@ -45,16 +45,16 @@ local logging_levels = { "debug", "info", "warn", "error" } -- This function is called automatically when a new sink type is added [see apply_sink_rules()] local function add_rule(sink_config) local sink_maker = log_sink_types[sink_config.to]; - if sink_maker then - -- Create sink - local sink = sink_maker(sink_config); + if not sink_maker then + return; -- No such sink type + end - -- Set sink for all chosen levels - for level in pairs(get_levels(sink_config.levels or logging_levels)) do - logger.add_level_sink(level, sink); - end - else - -- No such sink type + -- Create sink + local sink = sink_maker(sink_config); + + -- Set sink for all chosen levels + for level in pairs(get_levels(sink_config.levels or logging_levels)) do + logger.add_level_sink(level, sink); end end -- cgit v1.2.3 From 0ad8fd85fa831220bb9b408080dfd021bf92480e Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 3 Apr 2015 19:22:55 +0100 Subject: hostmanager: Rename variable to avoid shadowing 'type()' function --- core/hostmanager.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/hostmanager.lua b/core/hostmanager.lua index 7f9d1610..d7329cd2 100644 --- a/core/hostmanager.lua +++ b/core/hostmanager.lua @@ -55,8 +55,8 @@ end prosody_events.add_handler("server-starting", load_enabled_hosts); local function host_send(stanza) - local name, type = stanza.name, stanza.attr.type; - if type == "error" or (name == "iq" and type == "result") then + local name, stanza_type = stanza.name, stanza.attr.type; + if stanza_type == "error" or (name == "iq" and stanza_type == "result") then local dest_host_name = select(2, jid_split(stanza.attr.to)); local dest_host = hosts[dest_host_name] or { type = "unknown" }; log("warn", "Unhandled response sent to %s host %s: %s", dest_host.type, dest_host_name, tostring(stanza)); -- cgit v1.2.3 From abbf2f169475445d4c54c48616c2d4f0c432ebcd Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 3 Apr 2015 19:31:05 +0100 Subject: sessionmanager: Rename parameter to avoid varible name conflict --- core/sessionmanager.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua index 8767e869..d833dbe5 100644 --- a/core/sessionmanager.lua +++ b/core/sessionmanager.lua @@ -193,8 +193,8 @@ function bind_resource(session, resource) return true; end -function send_to_available_resources(user, host, stanza) - local jid = user.."@"..host; +function send_to_available_resources(username, host, stanza) + local jid = username.."@"..host; local count = 0; local user = bare_sessions[jid]; if user then -- cgit v1.2.3