diff options
author | Waqas Hussain <waqas20@gmail.com> | 2010-10-16 23:00:42 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2010-10-16 23:00:42 +0500 |
commit | b7e51a203d3d95961294c711ae0d9c449ddb040d (patch) | |
tree | 376af083a7225da43a8659f6d0d6184966d10baa /plugins | |
parent | 85b44a1dfd59fee9a26527cc759ef72780a1668c (diff) | |
download | prosody-b7e51a203d3d95961294c711ae0d9c449ddb040d.tar.gz prosody-b7e51a203d3d95961294c711ae0d9c449ddb040d.zip |
Monster whitespace commit (beware the whitespace monster).
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/adhoc/adhoc.lib.lua | 2 | ||||
-rw-r--r-- | plugins/mod_admin_adhoc.lua | 2 | ||||
-rw-r--r-- | plugins/mod_component.lua | 2 | ||||
-rw-r--r-- | plugins/mod_compression.lua | 2 | ||||
-rw-r--r-- | plugins/mod_console.lua | 10 | ||||
-rw-r--r-- | plugins/mod_offline.lua | 28 | ||||
-rw-r--r-- | plugins/mod_posix.lua | 14 | ||||
-rw-r--r-- | plugins/mod_presence.lua | 36 | ||||
-rw-r--r-- | plugins/mod_register.lua | 2 | ||||
-rw-r--r-- | plugins/mod_roster.lua | 4 | ||||
-rw-r--r-- | plugins/mod_uptime.lua | 4 | ||||
-rw-r--r-- | plugins/mod_watchregistrations.lua | 4 | ||||
-rw-r--r-- | plugins/mod_welcome.lua | 4 | ||||
-rw-r--r-- | plugins/muc/muc.lib.lua | 4 |
14 files changed, 59 insertions, 59 deletions
diff --git a/plugins/adhoc/adhoc.lib.lua b/plugins/adhoc/adhoc.lib.lua index d4ffd80c..0cb4efe1 100644 --- a/plugins/adhoc/adhoc.lib.lua +++ b/plugins/adhoc/adhoc.lib.lua @@ -46,7 +46,7 @@ function _M.handle_cmd(command, origin, stanza) stanza = st.error_reply(stanza, data.error.type, data.error.condition, data.error.message); origin.send(stanza); return true; - else + else cmdtag = command:cmdtag("executing", sessionid); end diff --git a/plugins/mod_admin_adhoc.lua b/plugins/mod_admin_adhoc.lua index 37930c01..9ddb3b9f 100644 --- a/plugins/mod_admin_adhoc.lua +++ b/plugins/mod_admin_adhoc.lua @@ -579,7 +579,7 @@ local end_user_session_desc = adhoc_new("End User Session", "http://jabber.org/p local get_user_password_desc = adhoc_new("Get User Password", "http://jabber.org/protocol/admin#get-user-password", get_user_password_handler, "admin"); local get_user_roster_desc = adhoc_new("Get User Roster","http://jabber.org/protocol/admin#get-user-roster", get_user_roster_handler, "admin"); local get_user_stats_desc = adhoc_new("Get User Statistics","http://jabber.org/protocol/admin#user-stats", get_user_stats_handler, "admin"); -local get_online_users_desc = adhoc_new("Get List of Online Users", "http://jabber.org/protocol/admin#get-online-users", get_online_users_command_handler, "admin"); +local get_online_users_desc = adhoc_new("Get List of Online Users", "http://jabber.org/protocol/admin#get-online-users", get_online_users_command_handler, "admin"); local list_modules_desc = adhoc_new("List loaded modules", "http://prosody.im/protocol/modules#list", list_modules_handler, "admin"); local load_module_desc = adhoc_new("Load module", "http://prosody.im/protocol/modules#load", load_module_handler, "admin"); local reload_modules_desc = adhoc_new("Reload module", "http://prosody.im/protocol/modules#reload", reload_modules_handler, "admin"); diff --git a/plugins/mod_component.lua b/plugins/mod_component.lua index 022792cf..1de576a0 100644 --- a/plugins/mod_component.lua +++ b/plugins/mod_component.lua @@ -59,7 +59,7 @@ function handle_component_auth(event) -- If component not already created for this host, create one now if not hosts[session.host].connected then local send = session.send; - session.component_session = cm_register_component(session.host, function (_, data) + session.component_session = cm_register_component(session.host, function (_, data) if data.attr and data.attr.xmlns == "jabber:client" then data.attr.xmlns = nil; end diff --git a/plugins/mod_compression.lua b/plugins/mod_compression.lua index b5e273fd..82403016 100644 --- a/plugins/mod_compression.lua +++ b/plugins/mod_compression.lua @@ -39,7 +39,7 @@ end); module:hook("s2s-stream-features", function(event) local origin, features = event.origin, event.features; -- FIXME only advertise compression support when TLS layer has no compression enabled - if not origin.compressed then + if not origin.compressed then features:add_child(compression_stream_feature); end end); diff --git a/plugins/mod_console.lua b/plugins/mod_console.lua index 9972e420..ba19c42e 100644 --- a/plugins/mod_console.lua +++ b/plugins/mod_console.lua @@ -257,8 +257,8 @@ function def_env.server:uptime() local hours = t%24; t = (t - hours)/24; local days = t; - return true, string.format("This server has been running for %d day%s, %d hour%s and %d minute%s (since %s)", - days, (days ~= 1 and "s") or "", hours, (hours ~= 1 and "s") or "", + return true, string.format("This server has been running for %d day%s, %d hour%s and %d minute%s (since %s)", + days, (days ~= 1 and "s") or "", hours, (hours ~= 1 and "s") or "", minutes, (minutes ~= 1 and "s") or "", os.date("%c", prosody.start_time)); end @@ -526,11 +526,11 @@ function def_env.s2s:show(match_jid) end end end - local subhost_filter = function (h) + local subhost_filter = function (h) return (match_jid and h:match(match_jid)); end for session in pairs(incoming_s2s) do - if session.to_host == host and ((not match_jid) or host:match(match_jid) + if session.to_host == host and ((not match_jid) or host:match(match_jid) or (session.from_host and session.from_host:match(match_jid)) -- Pft! is what I say to list comprehensions or (session.hosts and #array.collect(keys(session.hosts)):filter(subhost_filter)>0)) then @@ -573,7 +573,7 @@ function def_env.s2s:close(from, to) if hosts[from] and not hosts[to] then -- Is an outgoing connection local session = hosts[from].s2sout[to]; - if not session then + if not session then print("No outgoing connection from "..from.." to "..to) else (session.close or s2smanager.destroy_session)(session); diff --git a/plugins/mod_offline.lua b/plugins/mod_offline.lua index edd14190..a3ca21d0 100644 --- a/plugins/mod_offline.lua +++ b/plugins/mod_offline.lua @@ -35,20 +35,20 @@ end); module:hook("message/offline/broadcast", function(event) local origin = event.origin; - if origin.priority >= 0 then - local node, host = origin.username, origin.host; - - local data = datamanager.list_load(node, host, "offline"); - if not data then return true; end - for _, stanza in ipairs(data) do - stanza = st.deserialize(stanza); - stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = host, stamp = stanza.attr.stamp}):up(); -- XEP-0203 - stanza:tag("x", {xmlns = "jabber:x:delay", from = host, stamp = stanza.attr.stamp_legacy}):up(); -- XEP-0091 (deprecated) - stanza.attr.stamp, stanza.attr.stamp_legacy = nil, nil; - origin.send(stanza); - end - return true; - end + if origin.priority >= 0 then + local node, host = origin.username, origin.host; + + local data = datamanager.list_load(node, host, "offline"); + if not data then return true; end + for _, stanza in ipairs(data) do + stanza = st.deserialize(stanza); + stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = host, stamp = stanza.attr.stamp}):up(); -- XEP-0203 + stanza:tag("x", {xmlns = "jabber:x:delay", from = host, stamp = stanza.attr.stamp_legacy}):up(); -- XEP-0091 (deprecated) + stanza.attr.stamp, stanza.attr.stamp_legacy = nil, nil; + origin.send(stanza); + end + return true; + end end); module:hook("message/offline/delete", function(event) diff --git a/plugins/mod_posix.lua b/plugins/mod_posix.lua index cb504787..e86b7854 100644 --- a/plugins/mod_posix.lua +++ b/plugins/mod_posix.lua @@ -111,7 +111,7 @@ local function write_pidfile() end end -local syslog_opened +local syslog_opened; function syslog_sink_maker(config) if not syslog_opened then pposix.syslog_open("prosody"); @@ -119,12 +119,12 @@ function syslog_sink_maker(config) end local syslog, format = pposix.syslog_log, string.format; return function (name, level, message, ...) - if ... then - syslog(level, format(message, ...)); - else - syslog(level, message); - end - end; + if ... then + syslog(level, format(message, ...)); + else + syslog(level, message); + end + end; end require "core.loggingmanager".register_sink_type("syslog", syslog_sink_maker); diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua index ab2cac38..65abe665 100644 --- a/plugins/mod_presence.lua +++ b/plugins/mod_presence.lua @@ -59,15 +59,15 @@ function handle_normal_presence(origin, stanza) priority[1] = "0"; end end - local priority = stanza:child_with_name("priority"); - if priority and #priority > 0 then - priority = t_concat(priority); - if s_find(priority, "^[+-]?[0-9]+$") then - priority = tonumber(priority); - if priority < -128 then priority = -128 end - if priority > 127 then priority = 127 end - else priority = 0; end - else priority = 0; end + local priority = stanza:child_with_name("priority"); + if priority and #priority > 0 then + priority = t_concat(priority); + if s_find(priority, "^[+-]?[0-9]+$") then + priority = tonumber(priority); + if priority < -128 then priority = -128 end + if priority > 127 then priority = 127 end + else priority = 0; end + else priority = 0; end if full_sessions[origin.full_jid] then -- if user is still connected origin.send(stanza); -- reflect their presence back to them end @@ -115,15 +115,15 @@ function handle_normal_presence(origin, stanza) end end - if priority >= 0 then - local offline = offlinemanager.load(node, host); - if offline then - for _, msg in ipairs(offline) do - origin.send(msg); -- FIXME do we need to modify to/from in any way? - end - offlinemanager.deleteAll(node, host); - end - end + if priority >= 0 then + local offline = offlinemanager.load(node, host); + if offline then + for _, msg in ipairs(offline) do + origin.send(msg); -- FIXME do we need to modify to/from in any way? + end + offlinemanager.deleteAll(node, host); + end + end end if stanza.attr.type == "unavailable" then origin.presence = nil; diff --git a/plugins/mod_register.lua b/plugins/mod_register.lua index 1e916e73..1df73297 100644 --- a/plugins/mod_register.lua +++ b/plugins/mod_register.lua @@ -151,7 +151,7 @@ module:hook("stanza/iq/jabber:iq:register:query", function(event) if usermanager_create_user(username, password, host) then session.send(st.reply(stanza)); -- user created! module:log("info", "User account created: %s@%s", username, host); - module:fire_event("user-registered", { + module:fire_event("user-registered", { username = username, host = host, source = "mod_register", session = session }); else diff --git a/plugins/mod_roster.lua b/plugins/mod_roster.lua index 2eb70df3..fe2eea71 100644 --- a/plugins/mod_roster.lua +++ b/plugins/mod_roster.lua @@ -63,7 +63,7 @@ module:hook("iq/self/jabber:iq:roster:query", function(event) else -- stanza.attr.type == "set" local query = stanza.tags[1]; if #query.tags == 1 and query.tags[1].name == "item" - and query.tags[1].attr.xmlns == "jabber:iq:roster" and query.tags[1].attr.jid + and query.tags[1].attr.xmlns == "jabber:iq:roster" and query.tags[1].attr.jid -- Protection against overwriting roster.pending, until we move it and query.tags[1].attr.jid ~= "pending" then local item = query.tags[1]; @@ -103,7 +103,7 @@ module:hook("iq/self/jabber:iq:roster:query", function(event) else r_item.subscription = "none"; end - for _, child in ipairs(item) do + for _, child in ipairs(item) do if child.name == "group" then local text = t_concat(child); if text and text ~= "" then diff --git a/plugins/mod_uptime.lua b/plugins/mod_uptime.lua index c3860af6..52b33c74 100644 --- a/plugins/mod_uptime.lua +++ b/plugins/mod_uptime.lua @@ -34,8 +34,8 @@ function uptime_text() local hours = t%24; t = (t - hours)/24; local days = t; - return string.format("This server has been running for %d day%s, %d hour%s and %d minute%s (since %s)", - days, (days ~= 1 and "s") or "", hours, (hours ~= 1 and "s") or "", + return string.format("This server has been running for %d day%s, %d hour%s and %d minute%s (since %s)", + days, (days ~= 1 and "s") or "", hours, (hours ~= 1 and "s") or "", minutes, (minutes ~= 1 and "s") or "", os.date("%c", prosody.start_time)); end diff --git a/plugins/mod_watchregistrations.lua b/plugins/mod_watchregistrations.lua index f006818e..ac1e6302 100644 --- a/plugins/mod_watchregistrations.lua +++ b/plugins/mod_watchregistrations.lua @@ -9,7 +9,7 @@ local host = module:get_host(); -local registration_watchers = module:get_option("registration_watchers") +local registration_watchers = module:get_option("registration_watchers") or module:get_option("admins") or {}; local registration_alert = module:get_option("registration_notification") or "User $username just registered on $host from $ip"; @@ -21,7 +21,7 @@ module:hook("user-registered", module:log("debug", "Notifying of new registration"); local message = st.message{ type = "chat", from = host } :tag("body") - :text(registration_alert:gsub("%$(%w+)", + :text(registration_alert:gsub("%$(%w+)", function (v) return user[v] or user.session and user.session[v] or nil; end)); for _, jid in ipairs(registration_watchers) do diff --git a/plugins/mod_welcome.lua b/plugins/mod_welcome.lua index 8f92010a..8f9cca2a 100644 --- a/plugins/mod_welcome.lua +++ b/plugins/mod_welcome.lua @@ -11,9 +11,9 @@ local welcome_text = module:get_option("welcome_message") or "Hello $username, w local st = require "util.stanza"; -module:hook("user-registered", +module:hook("user-registered", function (user) - local welcome_stanza = + local welcome_stanza = st.message({ to = user.username.."@"..user.host, from = host }) :tag("body"):text(welcome_text:gsub("$(%w+)", user)); core_route_stanza(hosts[host], welcome_stanza); diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 4a8ad922..89bd1304 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -588,8 +588,8 @@ function room_mt:send_form(origin, stanza) end local valid_whois = { - moderators = true, - anyone = true, + moderators = true, + anyone = true, } function room_mt:process_form(origin, stanza) |