From 882dc829654a71a93eafadd4e6e2ee1eabaa2c8c Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Tue, 1 Apr 2014 10:02:58 -0400 Subject: MUC: Fixed traceback when a JID not in a room requested a role change for an occupant. --- plugins/muc/muc.lib.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/muc/muc.lib.lua') diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 0dbe81fa..8028f5ae 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -1060,7 +1060,7 @@ function room_mt:can_set_role(actor_jid, occupant_jid, role) if actor_jid == true then return true; end local actor = self._occupants[self._jid_nick[actor_jid]]; - if actor.role == "moderator" then + if actor and actor.role == "moderator" then if occupant.affiliation ~= "owner" and occupant.affiliation ~= "admin" then if actor.affiliation == "owner" or actor.affiliation == "admin" then return true; -- cgit v1.2.3 From 5feba6765f7b51377e94eb45b5ae90a89d629c78 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 17 Nov 2015 17:01:25 +0000 Subject: muc.lib: Fix pattern so that it doesn't match hashes containing null bytes, causing dropped stanzas (thanks Jitsi folk!) --- plugins/muc/muc.lib.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/muc/muc.lib.lua') diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 8028f5ae..d42fb2eb 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -361,7 +361,7 @@ local function construct_stanza_id(room, stanza) end local function deconstruct_stanza_id(room, stanza) local from_jid_possiblybare, to_nick = stanza.attr.from, stanza.attr.to; - local from_jid, id, to_jid_hash = (base64.decode(stanza.attr.id) or ""):match("^(.+)%z(.*)%z(.+)$"); + local from_jid, id, to_jid_hash = (base64.decode(stanza.attr.id) or ""):match("^(%Z+)%z(%Z*)%z(.+)$"); local from_nick = room._jid_nick[from_jid]; if not(from_nick) then return; end -- cgit v1.2.3 From 17d6ea116ea31334f034d5f2433c2c4cff79e2ff Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 16 Dec 2015 16:41:48 +0000 Subject: MUC: Fix incorrect nesting of status codes when room config changes (fixes #579) --- plugins/muc/muc.lib.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'plugins/muc/muc.lib.lua') diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index d42fb2eb..5879c256 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -736,7 +736,7 @@ function room_mt:process_form(origin, stanza) if dirty or whois_changed then local msg = st.message({type='groupchat', from=self.jid}) - :tag('x', {xmlns='http://jabber.org/protocol/muc#user'}):up() + :tag('x', {xmlns='http://jabber.org/protocol/muc#user'}); if dirty then msg.tags[1]:tag('status', {code = '104'}):up(); @@ -745,6 +745,7 @@ function room_mt:process_form(origin, stanza) local code = (whois == 'moderators') and "173" or "172"; msg.tags[1]:tag('status', {code = code}):up(); end + msg:up(); self:broadcast_message(msg, false) end -- cgit v1.2.3 From 719894dc32640ea7da3b2697eee0035ef5ef42e4 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 19 Apr 2016 17:20:39 +0200 Subject: MUC: Accept missing form as "instant room" request (fixes #377) --- plugins/muc/muc.lib.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'plugins/muc/muc.lib.lua') diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 5879c256..f8e8f74d 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -668,6 +668,14 @@ function room_mt:process_form(origin, stanza) if form.attr.type == "cancel" then origin.send(st.reply(stanza)); return; end if form.attr.type ~= "submit" then origin.send(st.error_reply(stanza, "cancel", "bad-request", "Not a submitted form")); return; end + if form.tags[1] == nil then + -- instant room + if self.save then self:save(true); end + origin.send(st.reply(stanza)); + return true; + end + + local fields = self:get_form_layout():data(form); if fields.FORM_TYPE ~= "http://jabber.org/protocol/muc#roomconfig" then origin.send(st.error_reply(stanza, "cancel", "bad-request", "Form is not of type room configuration")); return; end -- cgit v1.2.3 From ea65eee0c1b2cf82e18b556017343f26fca1e7e7 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 9 Dec 2017 14:39:48 +0100 Subject: MUC: Always send subject message, even if it is empty (fixes #1053) --- plugins/muc/muc.lib.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'plugins/muc/muc.lib.lua') diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index f8e8f74d..4b299bde 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -207,9 +207,7 @@ function room_mt:send_history(to, stanza) self:_route_stanza(msg); end end - if self._data['subject'] then - self:_route_stanza(st.message({type='groupchat', from=self._data['subject_from'] or self.jid, to=to}):tag("subject"):text(self._data['subject'])); - end + self:_route_stanza(st.message({type='groupchat', from=self._data['subject_from'] or self.jid, to=to}):tag("subject"):text(self._data['subject'])); end function room_mt:get_disco_info(stanza) -- cgit v1.2.3