aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-06-26 02:14:14 +0200
committerKim Alvefur <zash@zash.se>2018-06-26 02:14:14 +0200
commit57b6b0c61eee204e2f8c3b67239db1c593e59724 (patch)
tree089aa15970b5b3e994daaccf036b7636f8a061a1 /plugins/muc
parent269d98209c96d9aa7715198d9d5fed720be751c0 (diff)
downloadprosody-57b6b0c61eee204e2f8c3b67239db1c593e59724.tar.gz
prosody-57b6b0c61eee204e2f8c3b67239db1c593e59724.zip
MUC: Reorder subject related arguments to increasing requiredness (API break)
Diffstat (limited to 'plugins/muc')
-rw-r--r--plugins/muc/subject.lib.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/muc/subject.lib.lua b/plugins/muc/subject.lib.lua
index 14091d4e..2cf2b92a 100644
--- a/plugins/muc/subject.lib.lua
+++ b/plugins/muc/subject.lib.lua
@@ -12,7 +12,7 @@ local st = require "util.stanza";
local muc_util = module:require "muc/util";
local valid_roles = muc_util.valid_roles;
-local function create_subject_message(from, subject)
+local function create_subject_message(subject, from)
return st.message({from = from; type = "groupchat"})
:tag("subject"):text(subject or ""):up();
end
@@ -53,7 +53,7 @@ end);
local function get_subject(room)
-- a <message/> stanza from the room JID (or from the occupant JID of the entity that set the subject)
- return room._data.subject_from or room.jid, room._data.subject;
+ return room._data.subject, room._data.subject_from or room.jid;
end
local function send_subject(room, to)
@@ -62,13 +62,13 @@ local function send_subject(room, to)
room:route_stanza(msg);
end
-local function set_subject(room, from, subject)
+local function set_subject(room, subject, from)
if subject == "" then subject = nil; end
- local old_from, old_subject = get_subject(room);
+ local old_subject, old_from = get_subject(room);
if old_subject == subject and old_from == from then return false; end
room._data.subject_from = from;
room._data.subject = subject;
- local msg = create_subject_message(from, subject);
+ local msg = create_subject_message(subject, from);
room:broadcast_message(msg);
return true;
end
@@ -90,7 +90,7 @@ module:hook("muc-occupant-groupchat", function(event)
local role_rank = valid_roles[occupant and occupant.role or "none"];
if role_rank >= valid_roles.moderator or
( role_rank >= valid_roles.participant and get_changesubject(room) ) then -- and participant
- set_subject(room, occupant.nick, subject:get_text());
+ set_subject(room, subject:get_text(), occupant.nick);
room:save();
return true;
else