aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/rostermanager.lua12
-rw-r--r--core/s2smanager.lua4
-rw-r--r--core/sessionmanager.lua2
-rw-r--r--plugins/adhoc/adhoc.lib.lua4
-rw-r--r--plugins/mod_admin_adhoc.lua11
-rw-r--r--plugins/mod_component.lua2
-rw-r--r--plugins/mod_dialback.lua3
-rw-r--r--plugins/mod_posix.lua12
-rw-r--r--plugins/mod_presence.lua6
-rw-r--r--plugins/mod_s2s/mod_s2s.lua2
-rw-r--r--util/datamanager.lua18
11 files changed, 37 insertions, 39 deletions
diff --git a/core/rostermanager.lua b/core/rostermanager.lua
index 59ba6579..524b61be 100644
--- a/core/rostermanager.lua
+++ b/core/rostermanager.lua
@@ -83,15 +83,15 @@ end
function load_roster(username, host)
local jid = username.."@"..host;
- log("debug", "load_roster: asked for: "..jid);
+ log("debug", "load_roster: asked for: %s", jid);
local user = bare_sessions[jid];
local roster;
if user then
roster = user.roster;
if roster then return roster; end
- log("debug", "load_roster: loading for new user: "..username.."@"..host);
+ log("debug", "load_roster: loading for new user: %s@%s", username, host);
else -- Attempt to load roster for non-loaded user
- log("debug", "load_roster: loading for offline user: "..username.."@"..host);
+ log("debug", "load_roster: loading for offline user: %s@%s", username, host);
end
local data, err = datamanager.load(username, host, "roster");
roster = data or {};
@@ -99,7 +99,7 @@ function load_roster(username, host)
if not roster[false] then roster[false] = { broken = err or nil }; end
if roster[jid] then
roster[jid] = nil;
- log("warn", "roster for "..jid.." has a self-contact");
+ log("warn", "roster for %s has a self-contact", jid);
end
if not err then
hosts[host].events.fire_event("roster-load", username, host, roster);
@@ -108,7 +108,7 @@ function load_roster(username, host)
end
function save_roster(username, host, roster)
- log("debug", "save_roster: saving roster for "..username.."@"..host);
+ log("debug", "save_roster: saving roster for %s@%s", username, host);
if not roster then
roster = hosts[host] and hosts[host].sessions[username] and hosts[host].sessions[username].roster;
--if not roster then
@@ -238,7 +238,7 @@ function set_contact_pending_out(username, host, jid) -- subscribe
roster[jid] = item;
end
item.ask = "subscribe";
- log("debug", "set_contact_pending_out: saving roster; set "..username.."@"..host..".roster["..jid.."].ask=subscribe");
+ log("debug", "set_contact_pending_out: saving roster; set %s@%s.roster[%q].ask=subscribe", username, host, jid);
return save_roster(username, host, roster);
end
function unsubscribe(username, host, jid)
diff --git a/core/s2smanager.lua b/core/s2smanager.lua
index 5fe3a375..ece90e8f 100644
--- a/core/s2smanager.lua
+++ b/core/s2smanager.lua
@@ -87,7 +87,7 @@ function mark_connected(session)
local from, to = session.from_host, session.to_host;
- session.log("info", session.direction.." s2s connection "..from.."->"..to.." complete");
+ session.log("info", "%s s2s connection %s->%s complete", session.direction, from, to);
local event_data = { session = session };
if session.type == "s2sout" then
@@ -105,7 +105,7 @@ function mark_connected(session)
if session.direction == "outgoing" then
if sendq then
- session.log("debug", "sending "..#sendq.." queued stanzas across new outgoing connection to "..session.to_host);
+ session.log("debug", "sending %d queued stanzas across new outgoing connection to %s", #sendq, session.to_host);
for i, data in ipairs(sendq) do
send(data[1]);
sendq[i] = nil;
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua
index bd9255a2..f542c021 100644
--- a/core/sessionmanager.lua
+++ b/core/sessionmanager.lua
@@ -38,7 +38,7 @@ function new_session(conn)
getmetatable(session.trace).__gc = function () open_sessions = open_sessions - 1; end;
end
open_sessions = open_sessions + 1;
- log("debug", "open sessions now: ".. open_sessions);
+ log("debug", "open sessions now: %d", open_sessions);
local filter = initialize_filters(session);
local w = conn.write;
diff --git a/plugins/adhoc/adhoc.lib.lua b/plugins/adhoc/adhoc.lib.lua
index f9510172..acdae6b9 100644
--- a/plugins/adhoc/adhoc.lib.lua
+++ b/plugins/adhoc/adhoc.lib.lua
@@ -65,8 +65,8 @@ function _M.handle_cmd(command, origin, stanza)
if (action == "prev") or (action == "next") or (action == "complete") then
actions:tag(action):up();
else
- module:log("error", 'Command "'..command.name..
- '" at node "'..command.node..'" provided an invalid action "'..action..'"');
+ module:log("error", "Command %q at node %q provided an invalid action %q",
+ command.name, command.node, action);
end
end
cmdtag:add_child(actions);
diff --git a/plugins/mod_admin_adhoc.lua b/plugins/mod_admin_adhoc.lua
index ee89d84f..016eeb4a 100644
--- a/plugins/mod_admin_adhoc.lua
+++ b/plugins/mod_admin_adhoc.lua
@@ -63,15 +63,14 @@ function add_user_command_handler(self, data, state)
return { status = "completed", error = { message = "Account already exists" } };
else
if usermanager_create_user(username, fields.password, host) then
- module:log("info", "Created new account " .. username.."@"..host);
+ module:log("info", "Created new account %s@%s", username, host);
return { status = "completed", info = "Account successfully created" };
else
return { status = "completed", error = { message = "Failed to write data to disk" } };
end
end
else
- module:log("debug", (fields.accountjid or "<nil>") .. " " .. (fields.password or "<nil>") .. " "
- .. (fields["password-verify"] or "<nil>"));
+ module:log("debug", "Invalid data, password mismatch or empty username while creating account for %s", fields.accountjid or "<nil>");
return { status = "completed", error = { message = "Invalid data.\nPassword mismatch, or empty username" } };
end
else
@@ -143,10 +142,10 @@ function delete_user_command_handler(self, data, state)
for _, aJID in ipairs(fields.accountjids) do
local username, host, resource = jid.split(aJID);
if (host == data.to) and usermanager_user_exists(username, host) and disconnect_user(aJID) and usermanager_create_user(username, nil, host) then
- module:log("debug", "User " .. aJID .. " has been deleted");
+ module:log("debug", "User %s has been deleted", aJID);
succeeded[#succeeded+1] = aJID;
else
- module:log("debug", "Tried to delete non-existant user "..aJID);
+ module:log("debug", "Tried to delete non-existant user %s", aJID);
failed[#failed+1] = aJID;
end
end
@@ -165,7 +164,7 @@ function disconnect_user(match_jid)
local sessions = host.sessions[node] and host.sessions[node].sessions;
for resource, session in pairs(sessions or {}) do
if not givenResource or (resource == givenResource) then
- module:log("debug", "Disconnecting "..node.."@"..hostname.."/"..resource);
+ module:log("debug", "Disconnecting %s@%s/%s", node, hostname, resource);
session:close();
end
end
diff --git a/plugins/mod_component.lua b/plugins/mod_component.lua
index 738124cc..4037ad28 100644
--- a/plugins/mod_component.lua
+++ b/plugins/mod_component.lua
@@ -124,7 +124,7 @@ local xmlns_xmpp_streams = "urn:ietf:params:xml:ns:xmpp-streams";
function stream_callbacks.error(session, error, data, data2)
if session.destroyed then return; end
- module:log("warn", "Error processing component stream: "..tostring(error));
+ module:log("warn", "Error processing component stream: %s", tostring(error));
if error == "no-stream" then
session:close("invalid-namespace");
elseif error == "parse-error" then
diff --git a/plugins/mod_dialback.lua b/plugins/mod_dialback.lua
index 67be15e3..73a799e9 100644
--- a/plugins/mod_dialback.lua
+++ b/plugins/mod_dialback.lua
@@ -102,7 +102,6 @@ module:hook("stanza/jabber:server:dialback:verify", function(event)
if origin.type == "s2sout_unauthed" or origin.type == "s2sout" then
local attr = stanza.attr;
local dialback_verifying = dialback_requests[attr.from.."/"..(attr.id or "")];
- module:log("debug", tostring(dialback_verifying).." "..attr.from.." "..origin.to_host);
if dialback_verifying and attr.from == origin.to_host then
local valid;
if attr.type == "valid" then
@@ -110,7 +109,7 @@ module:hook("stanza/jabber:server:dialback:verify", function(event)
valid = "valid";
else
-- Warn the original connection that is was not verified successfully
- log("warn", "authoritative server for "..(attr.from or "(unknown)").." denied the key");
+ log("warn", "authoritative server for %s denied the key", attr.from or "(unknown)");
valid = "invalid";
end
if not dialback_verifying.sends2s then
diff --git a/plugins/mod_posix.lua b/plugins/mod_posix.lua
index 1670ac95..db594ccc 100644
--- a/plugins/mod_posix.lua
+++ b/plugins/mod_posix.lua
@@ -34,19 +34,19 @@ module:hook("server-started", function ()
if gid then
local success, msg = pposix.setgid(gid);
if success then
- module:log("debug", "Changed group to "..gid.." successfully.");
+ module:log("debug", "Changed group to %s successfully.", gid);
else
- module:log("error", "Failed to change group to "..gid..". Error: "..msg);
- prosody.shutdown("Failed to change group to "..gid);
+ module:log("error", "Failed to change group to %s. Error: %s", gid, msg);
+ prosody.shutdown("Failed to change group to %s", gid);
end
end
if uid then
local success, msg = pposix.setuid(uid);
if success then
- module:log("debug", "Changed user to "..uid.." successfully.");
+ module:log("debug", "Changed user to %s successfully.", uid);
else
- module:log("error", "Failed to change user to "..uid..". Error: "..msg);
- prosody.shutdown("Failed to change user to "..uid);
+ module:log("error", "Failed to change user to %s. Error: %s", uid, msg);
+ prosody.shutdown("Failed to change user to %s", uid);
end
end
end);
diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua
index 09a6f9f2..3cac0973 100644
--- a/plugins/mod_presence.lua
+++ b/plugins/mod_presence.lua
@@ -160,7 +160,7 @@ function send_presence_of_available_resources(user, host, jid, recipient_session
end
end
end
- log("debug", "broadcasted presence of "..count.." resources from "..user.."@"..host.." to "..jid);
+ log("debug", "broadcasted presence of %d resources from %s@%s to %s", count, user, host, jid);
return count;
end
@@ -169,7 +169,7 @@ function handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_
if to_bare == from_bare then return; end -- No self contacts
local st_from, st_to = stanza.attr.from, stanza.attr.to;
stanza.attr.from, stanza.attr.to = from_bare, to_bare;
- log("debug", "outbound presence "..stanza.attr.type.." from "..from_bare.." for "..to_bare);
+ log("debug", "outbound presence %s from %s for %s", stanza.attr.type, from_bare, to_bare);
if stanza.attr.type == "probe" then
stanza.attr.from, stanza.attr.to = st_from, st_to;
return;
@@ -214,7 +214,7 @@ function handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_b
local node, host = jid_split(to_bare);
local st_from, st_to = stanza.attr.from, stanza.attr.to;
stanza.attr.from, stanza.attr.to = from_bare, to_bare;
- log("debug", "inbound presence "..stanza.attr.type.." from "..from_bare.." for "..to_bare);
+ log("debug", "inbound presence %s from %s for %s", stanza.attr.type, from_bare, to_bare);
if stanza.attr.type == "probe" then
local result, err = rostermanager.is_contact_subscribed(node, host, from_bare);
diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua
index 16a8b461..314be3f0 100644
--- a/plugins/mod_s2s/mod_s2s.lua
+++ b/plugins/mod_s2s/mod_s2s.lua
@@ -99,7 +99,7 @@ function route_to_existing_session(event)
log("error", "We are going to send from %s instead of %s", tostring(host.from_host), tostring(from_host));
end
if host.sends2s(stanza) then
- host.log("debug", "stanza sent over "..host.type);
+ host.log("debug", "stanza sent over %s", host.type);
return true;
end
end
diff --git a/util/datamanager.lua b/util/datamanager.lua
index a5d676cc..30c1e298 100644
--- a/util/datamanager.lua
+++ b/util/datamanager.lua
@@ -115,18 +115,18 @@ function load(username, host, datastore)
if not data then
local mode = lfs.attributes(getpath(username, host, datastore), "mode");
if not mode then
- log("debug", "Assuming empty "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil"));
+ log("debug", "Assuming empty %s storage ('%s') for user: %s@%s", datastore, ret, username or "nil", host or "nil");
return nil;
else -- file exists, but can't be read
-- TODO more detailed error checking and logging?
- log("error", "Failed to load "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil"));
+ log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, ret, username or "nil", host or "nil");
return nil, "Error reading storage";
end
end
setfenv(data, {});
local success, ret = pcall(data);
if not success then
- log("error", "Unable to load "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil"));
+ log("error", "Unable to load %s storage ('%s') for user: %s@%s", datastore, ret, username or "nil", host or "nil");
return nil, "Error reading storage";
end
return ret;
@@ -145,7 +145,7 @@ function store(username, host, datastore, data)
-- save the datastore
local f, msg = io_open(getpath(username, host, datastore, nil, true), "w+");
if not f then
- log("error", "Unable to write to "..datastore.." storage ('"..msg.."') for user: "..(username or "nil").."@"..(host or "nil"));
+ log("error", "Unable to write to %s storage ('%s') for user: %s@%s", datastore, msg, username or "nil", host or "nil");
return nil, "Error saving to storage";
end
f:write("return ");
@@ -166,7 +166,7 @@ function list_append(username, host, datastore, data)
-- save the datastore
local f, msg = io_open(getpath(username, host, datastore, "list", true), "a+");
if not f then
- log("error", "Unable to write to "..datastore.." storage ('"..msg.."') for user: "..(username or "nil").."@"..(host or "nil"));
+ log("error", "Unable to write to %s storage ('%s') for user: %s@%s", datastore, msg, username or "nil", host or "nil");
return;
end
f:write("item(");
@@ -184,7 +184,7 @@ function list_store(username, host, datastore, data)
-- save the datastore
local f, msg = io_open(getpath(username, host, datastore, "list", true), "w+");
if not f then
- log("error", "Unable to write to "..datastore.." storage ('"..msg.."') for user: "..(username or "nil").."@"..(host or "nil"));
+ log("error", "Unable to write to %s storage ('%s') for user: %s@%s", datastore, msg, username or "nil", host or "nil");
return;
end
for _, d in ipairs(data) do
@@ -207,11 +207,11 @@ function list_load(username, host, datastore)
if not data then
local mode = lfs.attributes(getpath(username, host, datastore, "list"), "mode");
if not mode then
- log("debug", "Assuming empty "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil"));
+ log("debug", "Assuming empty %s storage ('%s') for user: %s@%s", datastore, ret, username or "nil", host or "nil");
return nil;
else -- file exists, but can't be read
-- TODO more detailed error checking and logging?
- log("error", "Failed to load "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil"));
+ log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, ret, username or "nil", host or "nil");
return nil, "Error reading storage";
end
end
@@ -219,7 +219,7 @@ function list_load(username, host, datastore)
setfenv(data, {item = function(i) t_insert(items, i); end});
local success, ret = pcall(data);
if not success then
- log("error", "Unable to load "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil"));
+ log("error", "Unable to load %s storage ('%s') for user: %s@%s", datastore, ret, username or "nil", host or "nil");
return nil, "Error reading storage";
end
return items;