From 4896e7ca7e604309d65e8d0baefc24ad362b6772 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 26 Jan 2014 18:35:03 +0100 Subject: mod_posix: Daemonize by default only when installed --- plugins/mod_posix.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mod_posix.lua b/plugins/mod_posix.lua index 7a6ccd94..69542c96 100644 --- a/plugins/mod_posix.lua +++ b/plugins/mod_posix.lua @@ -128,7 +128,7 @@ function syslog_sink_maker(config) end require "core.loggingmanager".register_sink_type("syslog", syslog_sink_maker); -local daemonize = module:get_option("daemonize"); +local daemonize = module:get_option("daemonize", prosody.installed); if daemonize == nil then local no_daemonize = module:get_option("no_daemonize"); --COMPAT w/ 0.5 daemonize = not no_daemonize; -- cgit v1.2.3 From f73e31b9c2bcade1f146ff957117ae02e15f537e Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 26 Jan 2014 21:16:24 +0100 Subject: modulemanager: Always load a platform-specific module, add stub modules for Windows and unknown platforms --- core/modulemanager.lua | 2 +- plugins/mod_unknown.lua | 4 ++++ plugins/mod_windows.lua | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 plugins/mod_unknown.lua create mode 100644 plugins/mod_windows.lua diff --git a/core/modulemanager.lua b/core/modulemanager.lua index 2ad2fc17..2e488fd5 100644 --- a/core/modulemanager.lua +++ b/core/modulemanager.lua @@ -29,7 +29,7 @@ pcall = function(f, ...) return xpcall(function() return f(unpack(params, 1, n)) end, function(e) return tostring(e).."\n"..debug_traceback(); end); end -local autoload_modules = {"presence", "message", "iq", "offline", "c2s", "s2s"}; +local autoload_modules = {prosody.platform, "presence", "message", "iq", "offline", "c2s", "s2s"}; local component_inheritable_modules = {"tls", "dialback", "iq", "s2s"}; -- We need this to let modules access the real global namespace diff --git a/plugins/mod_unknown.lua b/plugins/mod_unknown.lua new file mode 100644 index 00000000..4d20b8ad --- /dev/null +++ b/plugins/mod_unknown.lua @@ -0,0 +1,4 @@ +-- Unknown platform stub +module:set_global(); + +-- TODO Do things that make sense if we don't know about the platform diff --git a/plugins/mod_windows.lua b/plugins/mod_windows.lua new file mode 100644 index 00000000..8085fd88 --- /dev/null +++ b/plugins/mod_windows.lua @@ -0,0 +1,4 @@ +-- Windows platform stub +module:set_global(); + +-- TODO Add Windows-specific things here -- cgit v1.2.3 From 6712a420669b560523170bedbe03f13ee941c52e Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 27 Jan 2014 16:47:54 +0100 Subject: tools/ejabberd2prosody: Handle new room member format. --- tools/ejabberd2prosody.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ejabberd2prosody.lua b/tools/ejabberd2prosody.lua index bc916fb8..be1504b2 100755 --- a/tools/ejabberd2prosody.lua +++ b/tools/ejabberd2prosody.lua @@ -163,7 +163,7 @@ end function muc_room(node, host, properties) local store = { jid = node.."@"..host, _data = {}, _affiliations = {} }; for _,aff in ipairs(properties.affiliations) do - store._affiliations[_table_to_jid(aff[1])] = aff[2]; + store._affiliations[_table_to_jid(aff[1])] = aff[2][1] or aff[2]; end store._data.subject = properties.subject; if properties.subject_author then -- cgit v1.2.3 From e5faa1bfa21a99addfa92f637af6d8cf32144b34 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 28 Jan 2014 19:21:21 +0100 Subject: MUC: Tag PMs with , like presence stanzas --- 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 462d6893..d09c768e 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -570,6 +570,7 @@ function room_mt:handle_to_occupant(origin, stanza) -- PM, vCards, etc end stanza.attr.from, stanza.attr.to, stanza.attr.id = from, to, id; else -- message + stanza:tag("x", { xmlns = "http://jabber.org/protocol/muc#user" }):up(); stanza.attr.from = current_nick; for jid in pairs(o_data.sessions) do stanza.attr.to = jid; -- cgit v1.2.3 From c5c7ef5b0f47d1e51117f756420176f1f0a2466d Mon Sep 17 00:00:00 2001 From: Florian Zeitz Date: Fri, 31 Jan 2014 12:01:12 +0100 Subject: mod_c2s: Break out stream opening into a separate function --- plugins/mod_c2s.lua | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua index 3bdffc7d..7a8af406 100644 --- a/plugins/mod_c2s.lua +++ b/plugins/mod_c2s.lua @@ -38,7 +38,6 @@ local runner_callbacks = {}; --- Stream events handlers local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'}; -local default_stream_attr = { ["xmlns:stream"] = "http://etherx.jabber.org/streams", xmlns = stream_callbacks.default_ns, version = "1.0", id = "" }; function stream_callbacks.streamopened(session, attr) local send = session.send; @@ -58,9 +57,7 @@ function stream_callbacks.streamopened(session, attr) return; end - send(""..st.stanza("stream:stream", { - xmlns = 'jabber:client', ["xmlns:stream"] = 'http://etherx.jabber.org/streams'; - id = session.streamid, from = session.host, version = '1.0', ["xml:lang"] = 'en' }):top_tag()); + session:open_stream(); (session.log or log)("debug", "Sent reply to client"); session.notopen = nil; @@ -129,8 +126,7 @@ local function session_close(session, reason) local log = session.log or log; if session.conn then if session.notopen then - session.send(""); - session.send(st.stanza("stream:stream", default_stream_attr):top_tag()); + session:open_stream(); end if reason then -- nil == no err, initiated by us, false == initiated by client local stream_error = st.stanza("stream:error"); @@ -178,6 +174,19 @@ local function session_close(session, reason) end end +local function session_open_stream(session) + local attr = { + ["xmlns:stream"] = 'http://etherx.jabber.org/streams', + xmlns = stream_callbacks.default_ns, + version = "1.0", + ["xml:lang"] = 'en', + id = session.streamid or "", + from = session.host + }; + session.send(""); + session.send(st.stanza("stream:stream", attr):top_tag()); +end + module:hook_global("user-deleted", function(event) local username, host = event.username, event.host; local user = hosts[host].sessions[username]; @@ -225,6 +234,7 @@ function listener.onconnect(conn) conn:setoption("keepalive", opt_keepalives); end + session.open_stream = session_open_stream; session.close = session_close; local stream = new_xmpp_stream(session, stream_callbacks); -- cgit v1.2.3