Monster whitespace commit (beware the whitespace monster).
authorWaqas Hussain <waqas20@gmail.com>
Sat, 16 Oct 2010 18:00:42 +0000 (23:00 +0500)
committerWaqas Hussain <waqas20@gmail.com>
Sat, 16 Oct 2010 18:00:42 +0000 (23:00 +0500)
42 files changed:
core/certmanager.lua
core/componentmanager.lua
core/loggingmanager.lua
core/s2smanager.lua
core/usermanager.lua
core/xmlhandlers.lua
net/connlisteners.lua
net/dns.lua
net/http.lua
net/httpserver.lua
net/xmppcomponent_listener.lua
plugins/adhoc/adhoc.lib.lua
plugins/mod_admin_adhoc.lua
plugins/mod_component.lua
plugins/mod_compression.lua
plugins/mod_console.lua
plugins/mod_offline.lua
plugins/mod_posix.lua
plugins/mod_presence.lua
plugins/mod_register.lua
plugins/mod_roster.lua
plugins/mod_uptime.lua
plugins/mod_watchregistrations.lua
plugins/mod_welcome.lua
plugins/muc/muc.lib.lua
tests/test.lua
tests/test_core_configmanager.lua
tests/test_core_stanza_router.lua
tests/test_sasl.lua
tests/test_util_multitable.lua
tests/util/logger.lua
tools/xep227toprosody.lua [changed mode: 0644->0755]
util/array.lua
util/broadcast.lua
util/dataforms.lua
util/hmac.lua
util/iterators.lua
util/logger.lua
util/sasl/scram.lua
util/set.lua
util/xmppstream.lua
util/ztact.lua

index eadddd788965ce59350d1cc2f18835360ee9596c..3f7bb3484ea3b8f1581c60fadcde8f6c3ccbd338 100644 (file)
@@ -69,8 +69,8 @@ function create_context(host, mode, config)
                else
                        log("error", "SSL/TLS: Error initialising for host %s: %s", host, err );
                end
-        end
-        return ctx, err;
+       end
+       return ctx, err;
 end
 
 function reload_ssl_config()
index 14d9c06de6920d03ab23beaa9a85df7ab7fb18ac..6e06ae8227ba07bc1c6a3abfcfdcb589465b423b 100644 (file)
@@ -92,7 +92,7 @@ function create_component(host, component, events)
                        ssl_ctx_in = certmanager.create_context(host, "server");
                end
        end
-       return { type = "component", host = host, connected = true, s2sout = {}, 
+       return { type = "component", host = host, connected = true, s2sout = {},
                        ssl_ctx = ssl_ctx, ssl_ctx_in = ssl_ctx_in, events = events or events_new(),
                        dialback_secret = configmanager.get(host, "core", "dialback_secret") or uuid_gen(),
                        disallow_s2s = configmanager.get(host, "core", "disallow_s2s"); };
index 96cd32dc55dbeec8f3a03311587131d1a511d469..3cd0943179d4209f9166b5fc7d3d82a3d9f37518 100644 (file)
@@ -10,7 +10,7 @@
 local format, rep = string.format, string.rep;
 local pcall = pcall;
 local debug = debug;
-local tostring, setmetatable, rawset, pairs, ipairs, type = 
+local tostring, setmetatable, rawset, pairs, ipairs, type =
        tostring, setmetatable, rawset, pairs, ipairs, type;
 local io_open, io_write = io.open, io.write;
 local math_max, rep = math.max, string.rep;
@@ -168,7 +168,7 @@ function reload_logging()
 
        default_logging = { { to = "console" , levels = { min = (debug_mode and "debug") or "info" } } };
        default_file_logging = {
-               { to = "file", levels = { min = (debug_mode and "debug") or "info" }, timestamps = true } 
+               { to = "file", levels = { min = (debug_mode and "debug") or "info" }, timestamps = true }
        };
        default_timestamp = "%b %d %H:%M:%S";
 
index 0ad8f83bfa2cee072e10b6266ed1bffcfcc139e1..c4a94682cdfbdd23807b05281f9569d5a4b94b24 100644 (file)
@@ -16,10 +16,8 @@ local socket = require "socket";
 local format = string.format;
 local t_insert, t_sort = table.insert, table.sort;
 local get_traceback = debug.traceback;
-local tostring, pairs, ipairs, getmetatable, newproxy, error, tonumber,
-      setmetatable
-    = tostring, pairs, ipairs, getmetatable, newproxy, error, tonumber,
-      setmetatable;
+local tostring, pairs, ipairs, getmetatable, newproxy, error, tonumber, setmetatable
+    = tostring, pairs, ipairs, getmetatable, newproxy, error, tonumber, setmetatable;
 
 local idna_to_ascii = require "util.encodings".idna.to_ascii;
 local connlisteners_get = require "net.connlisteners".get;
index 5fc4a8229edbe60332818846ce13bd59872c82fe..153be63ee80c17b4d26afd57fe7433f64668c3c6 100644 (file)
@@ -50,11 +50,11 @@ function initialize_host(host)
                        host_session.users = new_null_provider();
                end
        end);
-       host_session.users = new_null_provider(); -- Start with the default usermanager provider
-       local auth_provider = config.get(host, "core", "authentication") or default_provider;
-       if auth_provider ~= "null" then
-               modulemanager.load(host, "auth_"..auth_provider);
-       end
+       host_session.users = new_null_provider(); -- Start with the default usermanager provider
+       local auth_provider = config.get(host, "core", "authentication") or default_provider;
+       if auth_provider ~= "null" then
+               modulemanager.load(host, "auth_"..auth_provider);
+       end
 end;
 prosody.events.add_handler("host-activated", initialize_host, 100);
 prosody.events.add_handler("component-activated", initialize_host, 100);
index b7992f77a817cdf8e7bc279ec4f92a3a3c2768cb..182da8940284e1e2f0f804fa7fa9fb08bc62f96a 100644 (file)
@@ -68,8 +68,8 @@ function init_xmlhandlers(session, stream_callbacks)
                        attr[i] = nil;
                        local ns, nm = k:match(ns_pattern);
                        if nm ~= "" then
-                               ns = ns_prefixes[ns]; 
-                               if ns then 
+                               ns = ns_prefixes[ns];
+                               if ns then
                                        attr[ns..":"..nm] = attr[k];
                                        attr[k] = nil;
                                end
index 93dce8b3aecb5c179c2bb09e7ee6a41c325af6ef..e13f85deb71cd55c38a867b7b9aecfda79c4435a 100644 (file)
@@ -13,8 +13,8 @@ local server = require "net.server";
 local log = require "util.logger".init("connlisteners");
 local tostring = tostring;
 
-local dofile, pcall, error = 
-       dofile, pcall, error
+local dofile, pcall, error =
+      dofile, pcall, error
 
 module "connlisteners"
 
index 29d9cf36d227a52df80b9e4ae75a730e094b4e2c..d40174dfe9e8979283a60c96b44d38fdbdbe3328 100644 (file)
@@ -674,11 +674,11 @@ function resolver:query(qname, qtype, qclass)    -- - - - - - - - - - -- query
                retry  = socket.gettime() + self.delays[1]
        };
 
-  -- remember the query
+       -- remember the query
        self.active[id] = self.active[id] or {};
        self.active[id][question] = o;
 
-  -- remember which coroutine wants the answer
+       -- remember which coroutine wants the answer
        local co = coroutine.running();
        if co then
                set(self.wanted, qclass, qtype, qname, co, true);
@@ -738,7 +738,7 @@ function resolver:servfail(sock)
                        end
                end
        end
-   
+
        if num == self.best_server then
                self.best_server = self.best_server + 1;
                if self.best_server > #self.server then
@@ -887,12 +887,12 @@ end
 function resolver:lookup(qname, qtype, qclass)    -- - - - - - - - - -  lookup
        self:query (qname, qtype, qclass)
        while self:pulse() do
-           local recvt = {}
-           for i, s in ipairs(self.socket) do
-              recvt[i] = s
-           end
-           socket.select(recvt, nil, 4)
-        end
+               local recvt = {}
+               for i, s in ipairs(self.socket) do
+                       recvt[i] = s
+               end
+               socket.select(recvt, nil, 4)
+       end
        --print(self.cache);
        return self:peek(qname, qtype, qclass);
 end
index 11407c4d4445e8529ce921d839409567986f137a..63ae31adae01a0c1b7a017ddec49a35964767bac 100644 (file)
@@ -19,7 +19,7 @@ local listener = connlisteners_get("httpclient") or error("No httpclient listene
 local t_insert, t_concat = table.insert, table.concat;
 local pairs, ipairs = pairs, ipairs;
 local tonumber, tostring, xpcall, select, debug_traceback, char, format =
-        tonumber, tostring, xpcall, select, debug.traceback, string.char, string.format;
+      tonumber, tostring, xpcall, select, debug.traceback, string.char, string.format;
 
 local log = require "util.logger".init("http");
 
@@ -46,10 +46,10 @@ function formencode(form)
 end
 
 local function expectbody(reqt, code)
-    if reqt.method == "HEAD" then return nil end
-    if code == 204 or code == 304 or code == 301 then return nil end
-    if code >= 100 and code < 200 then return nil end
-    return 1
+       if reqt.method == "HEAD" then return nil end
+       if code == 204 or code == 304 or code == 301 then return nil end
+       if code >= 100 and code < 200 then return nil end
+       return 1
 end
 
 local function request_reader(request, data, startpos)
index b6a080b684ff7f10c87075462d067a7e596340b7..ca830a5a13966c05558b507ddb841bc9d1db90b1 100644 (file)
@@ -31,7 +31,7 @@ module "httpserver"
 local default_handler;
 
 local function expectbody(reqt)
-    return reqt.method == "POST";
+       return reqt.method == "POST";
 end
 
 local function send_response(request, response)
@@ -212,8 +212,8 @@ function new_from_config(ports, handle_request, default_options)
                        ssl.options = "no_sslv2";
                end
                
-               new{ port = port, interface = interface, 
-                       base = base, handler = handle_request, 
+               new{ port = port, interface = interface,
+                       base = base, handler = handle_request,
                        ssl = ssl, type = (ssl and "ssl") or "tcp" };
        end
 end
index 6f02b136954027a78a8ac03c01a95065a3c95dd2..a96a1cffd57eac0d948bb4f596d64a8635ebfc23 100644 (file)
@@ -67,13 +67,13 @@ end
 
 function stream_callbacks.streamopened(session, attr)
        if config.get(attr.to, "core", "component_module") ~= "component" then
-               -- Trying to act as a component domain which 
+               -- Trying to act as a component domain which
                -- hasn't been configured
                session:close{ condition = "host-unknown", text = tostring(attr.to).." does not match any configured external components" };
                return;
        end
        
-       -- Note that we don't create the internal component 
+       -- Note that we don't create the internal component
        -- until after the external component auths successfully
 
        session.host = attr.to;
index d4ffd80ceee8b449201cc58a3e9344fbf24d8793..0cb4efe1097c06b4bfe6f32384bd9ed348367844 100644 (file)
@@ -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
 
index 37930c013d4beb5ab21a76e57651f012b2e68367..9ddb3b9ffa977ba7467ddfb36444ed64d0de43fc 100644 (file)
@@ -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");
index 022792cf3d723e1f7691a072a3938663967d0b23..1de576a026f0f300790945a1965ebbd75cd0c900 100644 (file)
@@ -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
index b5e273fd3bfa8c41ede0c29fdea4c9288c27d8be..82403016d9e936c47503a18e21ca863f5dede10d 100644 (file)
@@ -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);
index 9972e420f6236c288e262ba17c44122675871178..ba19c42e8110f3393b990f0e620c9de34c59e663 100644 (file)
@@ -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);
index edd141902de86b3c1ea684d839201f3a784e071b..a3ca21d0ebab2f58d5a963075b428effa488c5d1 100644 (file)
@@ -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)
index cb504787f67fb4260ffc28ef0b2abe2f7684d375..e86b785450f77152b9ac21959444aef78dbc4104 100644 (file)
@@ -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);
 
index ab2cac38a9ce379410b08acffc96a0e981db6d2c..65abe665e29725b3dcda5665e867908fd4255239 100644 (file)
@@ -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;
index 1e916e735cdb80e7f19f9582ee6dc44398b0b111..1df73297b7ed0ca5a50f6b4b4842913e5d6c1f29 100644 (file)
@@ -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
index 2eb70df3d44394de30fd9b96b7ae9e096bfd67d8..fe2eea71e9cc570051cff6bd6bef137a85ac27ee 100644 (file)
@@ -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
index c3860af6535508ea58200bc06657f6a644fa6659..52b33c7489ea2cecda57624e9579a3ba97229706 100644 (file)
@@ -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
 
index f006818e7c06dafabe17513dd62738433ccf8a4e..ac1e63022aec66b9be587cecaf35530b899b4b45 100644 (file)
@@ -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
index 8f92010a013d7279bac927f178f4651ce0901820..8f9cca2ab2ce4a4315413e5203ca0a7b19ea1378 100644 (file)
@@ -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);
index 4a8ad922f71d63730e378ec38635da22fc8c9e49..89bd1304506289215bb77a00ebfce4c5a96dd525 100644 (file)
@@ -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)
index bb9bc876b517bbdab195b880b5d5aecba9defa11..ae5b24f03cb6b17e8d761ef16313b3dd5ac83dda 100644 (file)
@@ -217,7 +217,7 @@ function new_line_coverage_monitor(file)
                        for line, active in pairs(lines_hit) do
                                if active ~= nil then total_active_lines = total_active_lines + 1; end
                                if coverage_file then
-                                       if active == false then coverage_file:write(fn, "|", line, "|", name or "", "|miss\n"); 
+                                       if active == false then coverage_file:write(fn, "|", line, "|", name or "", "|miss\n");
                                        else coverage_file:write(fn, "|", line, "|", name or "", "|", tostring(success), "\n"); end
                                end
                        end
index c4ed746faf888438b2c0679ccf91b8942a860490..132dfc7456bd98360556bf3c4ec52328c6f908e4 100644 (file)
@@ -29,7 +29,7 @@ end
 
 function set(set, u)
        assert_equal(set("*"), false, "Set with no section/key");
-       assert_equal(set("*", "set_test"), false, "Set with no key");   
+       assert_equal(set("*", "set_test"), false, "Set with no key");
 
        assert_equal(set("*", "set_test", "testkey"), true, "Setting a nil global value");
        assert_equal(set("*", "set_test", "testkey", 123), true, "Setting a global value");
index 97dc2e19358c88c9504e988e958d4d5eef473fda..0a93694f90257100ecd135bf0c0bf151108e29ba 100644 (file)
@@ -66,7 +66,7 @@ function core_process_stanza(core_process_stanza, u)
                function env.core_post_stanza(p_origin, p_stanza)
                        assert_equal(p_origin, local_user_session, "origin of handled stanza is not correct");
                        assert_equal(p_stanza, msg, "handled stanza is not correct one: "..p_stanza:pretty_print());
-                       target_handled = true;          
+                       target_handled = true;
                end
 
                env.hosts = hosts;
@@ -84,7 +84,7 @@ function core_process_stanza(core_process_stanza, u)
                function env.core_route_stanza(p_origin, p_stanza)
                        assert_equal(p_origin, local_user_session, "origin of handled stanza is not correct");
                        assert_equal(p_stanza, msg, "handled stanza is not correct one: "..p_stanza:pretty_print());
-                       target_routed = true;           
+                       target_routed = true;
                end
 
                function env.core_post_stanza(...) env.core_route_stanza(...); end
@@ -104,7 +104,7 @@ function core_process_stanza(core_process_stanza, u)
                function env.core_route_stanza(p_origin, p_stanza)
                        assert_equal(p_origin, local_user_session, "origin of handled stanza is not correct");
                        assert_equal(p_stanza, msg, "handled stanza is not correct one: "..p_stanza:pretty_print());
-                       target_routed = true;           
+                       target_routed = true;
                end
 
                function env.core_post_stanza(...)
@@ -129,7 +129,7 @@ function core_process_stanza(core_process_stanza, u)
                function env.core_route_stanza(p_origin, p_stanza)
                        assert_equal(p_origin, local_user_session, "origin of handled stanza is not correct");
                        assert_equal(p_stanza, msg, "handled stanza is not correct one: "..p_stanza:pretty_print());
-                       target_routed = true;           
+                       target_routed = true;
                end
 
                function env.core_post_stanza(...)
@@ -151,7 +151,7 @@ function core_process_stanza(core_process_stanza, u)
                function env.core_route_stanza(p_origin, p_stanza)
                        assert_equal(p_origin, s2sin_session, "origin of handled stanza is not correct");
                        assert_equal(p_stanza, msg, "handled stanza is not correct one: "..p_stanza:pretty_print());
-                       target_routed = true;           
+                       target_routed = true;
                end
 
                function env.core_post_stanza(...)
@@ -173,7 +173,7 @@ function core_process_stanza(core_process_stanza, u)
                function env.core_post_stanza(p_origin, p_stanza)
                        assert_equal(p_origin, local_user_session, "origin of handled stanza is not correct");
                        assert_equal(p_stanza, msg, "handled stanza is not correct one: "..p_stanza:pretty_print());
-                       target_handled = true;          
+                       target_handled = true;
                end
 
                env.hosts = hosts;
index 7c0b02f871a1e49030c8f0224fde0e32f8df6374..8bd1a2ff8fda8fcc2b78edd3f79a2cd947fcd631 100644 (file)
@@ -8,30 +8,30 @@
 
 
 --- WARNING! ---
--- This file contains a mix of encodings below. 
+-- This file contains a mix of encodings below.
 -- Many editors will unquestioningly convert these for you.
 -- Please be careful :(  (I recommend Scite)
 ---------------------------------
 
-local  gmatch = string.gmatch;
-local  t_concat, t_insert = table.concat, table.insert;
-local  to_byte, to_char = string.byte, string.char;
+local gmatch = string.gmatch;
+local t_concat, t_insert = table.concat, table.insert;
+local to_byte, to_char = string.byte, string.char;
 
 local function _latin1toutf8(str)
-               if not str then return str; end
-                local p = {};
-                for ch in gmatch(str, ".") do
-                        ch = to_byte(ch);
-                        if (ch < 0x80) then
-                                t_insert(p, to_char(ch));
-                        elseif (ch < 0xC0) then
-                                t_insert(p, to_char(0xC2, ch));
-                        else
-                                t_insert(p, to_char(0xC3, ch - 64));
-                        end
-                end
-                return t_concat(p);
-        end
+       if not str then return str; end
+       local p = {};
+       for ch in gmatch(str, ".") do
+               ch = to_byte(ch);
+               if (ch < 0x80) then
+                       t_insert(p, to_char(ch));
+               elseif (ch < 0xC0) then
+                       t_insert(p, to_char(0xC2, ch));
+               else
+                       t_insert(p, to_char(0xC3, ch - 64));
+               end
+       end
+       return t_concat(p);
+end
 
 function latin1toutf8()
        local function assert_utf8(latin, utf8)
index 4b7e4fccff88bbb073f824d724edcffb5fb4ef1c..ed10b1283011b6ec64d60ea09d9b138e18edb92c 100644 (file)
@@ -32,7 +32,7 @@ function get(get, multitable)
                        should_have[item] = nil;
                end
                if next(should_have) then
-                       return false, "not-enough";     
+                       return false, "not-enough";
                end
                return true, "has-all";
        end
index e62a1aa8ccca4c991e60d09b4ddea2b099886eca..35facd4e45ae0472e3a9eeb0908920b778f5fade 100644 (file)
@@ -33,7 +33,7 @@ function init(name)
                                        local inf = debug.getinfo(3, 'Snl');
                                        level = level .. ","..tostring(inf.short_src):match("[^/]*$")..":"..inf.currentline;
                                end
-                               if ... then 
+                               if ... then
                                        print(name, getstring(logstyles[level], level), format(message, ...));
                                else
                                        print(name, getstring(logstyles[level], level), message);
old mode 100644 (file)
new mode 100755 (executable)
index 313b219..bfe06c4
@@ -114,7 +114,7 @@ function store_offline_messages(username, host, offline_messages)
                --print("message :"..ch:pretty_print());
                local ret, err = dm.list_append(username, host, "offline", st.preserialize(ch));
                print("["..(err or "success").."] stored offline message: " ..username.."@"..host.." - "..ch.attr.from);
-       end
+       end
 end
 
 
index 98c0ebe8a4586669bdeae53f3d99b008047dd81a..6c1f04606642bc5cdb700f36e289a0aa655d319e 100644 (file)
@@ -6,8 +6,8 @@
 -- COPYING file in the source package for more information.
 --
 
-local t_insert, t_sort, t_remove, t_concat 
-       = table.insert, table.sort, table.remove, table.concat;
+local t_insert, t_sort, t_remove, t_concat
+    = table.insert, table.sort, table.remove, table.concat;
 
 local array = {};
 local array_base = {};
index c74bf4e1b9e2b721961eb8c3243468b424874a63..be17461db3fa607a5c69f8787e8d88c1ca1a1e82 100644 (file)
@@ -7,8 +7,8 @@
 --
 
 
-local ipairs, pairs, setmetatable, type = 
-        ipairs, pairs, setmetatable, type;
+local ipairs, pairs, setmetatable, type =
+      ipairs, pairs, setmetatable, type;
 
 module "pubsub"
 
index 7814ada0232c0c8508af5a7ed4e58f07fbc1df39..ae745e03ed334d08c4ef9d284ce900b69527943f 100644 (file)
@@ -126,7 +126,7 @@ function form_t.data(layout, stanza)
        return data;
 end
 
-field_readers["text-single"] = 
+field_readers["text-single"] =
        function (field_tag)
                local value = field_tag:child_with_name("value");
                if value then
@@ -134,13 +134,13 @@ field_readers["text-single"] =
                end
        end
 
-field_readers["text-private"] = 
+field_readers["text-private"] =
        field_readers["text-single"];
 
 field_readers["jid-single"] =
        field_readers["text-single"];
 
-field_readers["jid-multi"] = 
+field_readers["jid-multi"] =
        function (field_tag)
                local result = {};
                for value_tag in field_tag:childtags() do
@@ -151,7 +151,7 @@ field_readers["jid-multi"] =
                return result;
        end
 
-field_readers["text-multi"] = 
+field_readers["text-multi"] =
        function (field_tag)
                local result = {};
                for value_tag in field_tag:childtags() do
@@ -176,7 +176,7 @@ field_readers["list-multi"] =
                return result;
        end
 
-field_readers["boolean"] = 
+field_readers["boolean"] =
        function (field_tag)
                local value = field_tag:child_with_name("value");
                if value then
@@ -185,10 +185,10 @@ field_readers["boolean"] =
                        else
                                return false;
                        end
-               end             
+               end
        end
 
-field_readers["hidden"] = 
+field_readers["hidden"] =
        function (field_tag)
                local value = field_tag:child_with_name("value");
                if value then
index 66dd41d81d8978796d371bc64ed080f8a35da4c4..6df6986e2f25f2b86d11e84a32d8902a0070ed22 100644 (file)
@@ -40,7 +40,7 @@ hash
 blocksize
        the blocksize for the hash function in bytes
 hex
-  return raw hash or hexadecimal string
+       return raw hash or hexadecimal string
 --]]
 function hmac(key, message, hash, blocksize, hex)
        if #key > blocksize then
index cc50482721b485b5ecce731c820813b0ad203284..dc692d64eac36e93a14b07c38488b56de10c5d44 100644 (file)
@@ -73,7 +73,7 @@ function count(f, s, var)
                var = ret[1];
                if var == nil then break; end
                x = x + 1;
-       end     
+       end
        
        return x;
 end
@@ -131,7 +131,7 @@ function it2array(f, s, var)
        return t;
 end
 
--- Treat the return of an iterator as key,value pairs, 
+-- Treat the return of an iterator as key,value pairs,
 -- and build a table
 function it2table(f, s, var)
        local t, var = {};
index 80b5bcd08416b9f02d0ebebb57f34470d40ef341..1fbd49779dcea8673d5a25208edb5d70a4333cae 100644 (file)
@@ -72,7 +72,7 @@ function make_logger(source_name, level)
        end
 
        -- To make sure our cached lengths stay in sync with reality
-       modify_hooks[logger] = function () num_level_handlers, num_source_handlers = #level_handlers, source_handlers and #source_handlers; end; 
+       modify_hooks[logger] = function () num_level_handlers, num_source_handlers = #level_handlers, source_handlers and #source_handlers; end;
        
        return logger;
 end
index 7354c8fc0906cc7e0effd4957993339dafab8d96..c846a7d12fb60f472b8007754b1394e67eb29675 100644 (file)
@@ -67,7 +67,7 @@ end
 -- hash algorithm independent Hi(PBKDF2) implementation
 function Hi(hmac, str, salt, i)
        local Ust = hmac(str, salt.."\0\0\0\1");
-       local res = Ust;        
+       local res = Ust;
        for n=1,i-1 do
                local Und = hmac(str, Ust)
                res = binaryXOR(res, Und)
@@ -80,8 +80,8 @@ local function validate_username(username)
        -- check for forbidden char sequences
        for eq in username:gmatch("=(.?.?)") do
                if eq ~= "2D" and eq ~= "3D" then
-                       return false 
-               end 
+                       return false
+               end
        end
        
        -- replace =2D with , and =3D with =
index ee154ece11e1f5977be607735fa197acf10de4e4..e4cc2dffbd428b6be84c2ec749ba0cd2156b67b3 100644 (file)
@@ -6,7 +6,7 @@
 -- COPYING file in the source package for more information.
 --
 
-local ipairs, pairs, setmetatable, next, tostring = 
+local ipairs, pairs, setmetatable, next, tostring =
       ipairs, pairs, setmetatable, next, tostring;
 local t_concat = table.concat;
 
index d22c923b6f7987781556d5863331ccda4a95379e..2f232fd81127fe71626ab5bbb73941618af1c539 100644 (file)
@@ -69,8 +69,8 @@ function new_sax_handlers(session, stream_callbacks)
                        attr[i] = nil;
                        local ns, nm = k:match(ns_pattern);
                        if nm ~= "" then
-                               ns = ns_prefixes[ns]; 
-                               if ns then 
+                               ns = ns_prefixes[ns];
+                               if ns then
                                        attr[ns..":"..nm] = attr[k];
                                        attr[k] = nil;
                                end
index 2507bf8e0107fadc90c93cf23de6a522503f7fee..40aa8843c7e46dd493f54e4ac143152d6f30cc6b 100644 (file)
@@ -347,7 +347,7 @@ function lson_encode (mixed, f, indent, indents)    --------------- lson_encode
       f ('[')  f (lson_encode (k))  f ('] = ')
       lson_encode (v, f, indent+1, indents)
       f (',')
-      end 
+      end
     f (' }')
     end  end  end