From 598ddfd001374594677f48826263358606bafb73 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sun, 25 Oct 2009 04:19:24 +0500 Subject: MUC: Fixed an issue with multi-session nicks where the 'from' attribute in a presence broadcast was not being properly set. --- plugins/muc/muc.lib.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 7a635e8e..251d6d1f 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -239,6 +239,7 @@ function room_mt:handle_to_occupant(origin, stanza) -- PM, vCards, etc pr = st.clone(occupant.sessions[new_jid]) :tag("x", {xmlns='http://jabber.org/protocol/muc#user'}) :tag("item", {affiliation=occupant.affiliation, role=occupant.role}); + pr.attr.from = current_nick; self:broadcast_except_nick(pr, current_nick); end else -- cgit v1.2.3 From 8f2c13031523bd23ce4418a72273ca355a52182a Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sun, 25 Oct 2009 21:06:35 +0500 Subject: xmppserver_listener: Minor logging fix: Prefer the session logger when available to log invalid XML warnings. --- net/xmppserver_listener.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/xmppserver_listener.lua b/net/xmppserver_listener.lua index f7ea35f7..fa6acbb7 100644 --- a/net/xmppserver_listener.lua +++ b/net/xmppserver_listener.lua @@ -61,8 +61,8 @@ local function session_reset_stream(session) function session.data(conn, data) local ok, err = parser:parse(data); if ok then return; end - (log or session.log)("warn", "Received invalid XML: %s", data); - (log or session.log)("warn", "Problem was: %s", err); + (session.log or log)("warn", "Received invalid XML: %s", data); + (session.log or log)("warn", "Problem was: %s", err); session:close("xml-not-well-formed"); end -- cgit v1.2.3 From 1580c8c12baa2d40e5e51c5d4139d6be3cba4138 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sun, 25 Oct 2009 21:07:32 +0500 Subject: MUC: Fixed: affiliation='none' was omitted from some presence broadcasts. --- plugins/muc/muc.lib.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 251d6d1f..312dcc37 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -115,7 +115,7 @@ function room_mt:broadcast_presence(stanza, sid, code, nick) stanza = get_filtered_presence(stanza); local occupant = self._occupants[stanza.attr.from]; stanza:tag("x", {xmlns='http://jabber.org/protocol/muc#user'}) - :tag("item", {affiliation=occupant.affiliation, role=occupant.role, nick=nick}):up(); + :tag("item", {affiliation=occupant.affiliation or "none", role=occupant.role or "none", nick=nick}):up(); if code then stanza:tag("status", {code=code}):up(); end @@ -162,7 +162,7 @@ function room_mt:send_occupant_list(to) local pres = get_filtered_presence(o_data.sessions[o_data.jid]); pres.attr.to, pres.attr.from = to, occupant; pres:tag("x", {xmlns='http://jabber.org/protocol/muc#user'}) - :tag("item", {affiliation=o_data.affiliation, role=o_data.role}):up(); + :tag("item", {affiliation=o_data.affiliation or "none", role=o_data.role or "none"}):up(); self:route_stanza(pres); end end @@ -232,13 +232,13 @@ function room_mt:handle_to_occupant(origin, stanza) -- PM, vCards, etc occupant.sessions[from] = nil; pr.attr.to = from; pr:tag("x", {xmlns='http://jabber.org/protocol/muc#user'}) - :tag("item", {affiliation=occupant.affiliation, role='none'}):up() + :tag("item", {affiliation=occupant.affiliation or "none", role='none'}):up() :tag("status", {code='110'}); self:route_stanza(pr); if jid ~= new_jid then pr = st.clone(occupant.sessions[new_jid]) :tag("x", {xmlns='http://jabber.org/protocol/muc#user'}) - :tag("item", {affiliation=occupant.affiliation, role=occupant.role}); + :tag("item", {affiliation=occupant.affiliation or "none", role=occupant.role or "none"}); pr.attr.from = current_nick; self:broadcast_except_nick(pr, current_nick); end @@ -323,7 +323,7 @@ function room_mt:handle_to_occupant(origin, stanza) -- PM, vCards, etc else pr.attr.to = from; self:route_stanza(pr:tag("x", {xmlns='http://jabber.org/protocol/muc#user'}) - :tag("item", {affiliation=affiliation, role=role}):up() + :tag("item", {affiliation=affiliation or "none", role=role or "none"}):up() :tag("status", {code='110'})); end self:send_history(from); -- cgit v1.2.3 From 60087d4680a0804c9e5c6fdb4ec236f8f5096012 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sun, 25 Oct 2009 21:21:25 +0500 Subject: mod_console: Added proper cleanup for disconnected console sessions. --- plugins/mod_console.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/mod_console.lua b/plugins/mod_console.lua index a46eec12..5a092298 100644 --- a/plugins/mod_console.lua +++ b/plugins/mod_console.lua @@ -127,7 +127,11 @@ function console_listener.listener(conn, data) end function console_listener.disconnect(conn, err) - + local session = sessions[conn]; + if session then + session.disconnect(); + sessions[conn] = nil; + end end connlisteners_register('console', console_listener); -- cgit v1.2.3 From c07ef005e8b80a849b5b6fcf1a7aff94077cc940 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sun, 25 Oct 2009 21:26:36 +0500 Subject: Prosody top-level error handler modified to log properly on non-string error messages. --- prosody | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prosody b/prosody index 99d7602c..e22e5945 100755 --- a/prosody +++ b/prosody @@ -282,7 +282,7 @@ end function loop() -- Error handler for errors that make it this far local function catch_uncaught_error(err) - if err:match("%d*: interrupted!$") then + if type(err) == "string" and err:match("%d*: interrupted!$") then return "quitting"; end -- cgit v1.2.3 From c73ece03d8efcc4b46712ff32b7da610cb21dc4f Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Tue, 27 Oct 2009 01:15:05 +0500 Subject: mod_welcome: Change $user to $username in default welcome message (thanks to chris for spotting) --- plugins/mod_welcome.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mod_welcome.lua b/plugins/mod_welcome.lua index cc50cba3..edcfbd8c 100644 --- a/plugins/mod_welcome.lua +++ b/plugins/mod_welcome.lua @@ -7,7 +7,7 @@ -- local host = module:get_host(); -local welcome_text = module:get_option("welcome_message") or "Hello $user, welcome to the $host IM server!"; +local welcome_text = module:get_option("welcome_message") or "Hello $username, welcome to the $host IM server!"; local st = require "util.stanza"; -- cgit v1.2.3