MUC: Include 'nick' attribute in affiliation lists (thanks jc)
authorMatthew Wild <mwild1@gmail.com>
Fri, 14 Sep 2018 12:05:47 +0100
changeset 9315 6cab07323274
parent 9314 9b0604fe01f1
child 9316 b95ef295c66d
MUC: Include 'nick' attribute in affiliation lists (thanks jc)
plugins/muc/muc.lib.lua
spec/scansion/muc_register.scs
--- a/plugins/muc/muc.lib.lua	Thu Sep 13 21:09:55 2018 +0200
+++ b/plugins/muc/muc.lib.lua	Fri Sep 14 12:05:47 2018 +0100
@@ -965,7 +965,8 @@
 		or self:get_members_only() and self:get_whois() == "anyone" and affiliation_rank >= valid_affiliations.member then
 			local reply = st.reply(stanza):query("http://jabber.org/protocol/muc#admin");
 			for jid in self:each_affiliation(_aff or "none") do
-				reply:tag("item", {affiliation = _aff, jid = jid}):up();
+				local nick = self:get_registered_nick(jid);
+				reply:tag("item", {affiliation = _aff, jid = jid, nick = nick }):up();
 			end
 			origin.send(reply:up());
 			return true;
--- a/spec/scansion/muc_register.scs	Thu Sep 13 21:09:55 2018 +0200
+++ b/spec/scansion/muc_register.scs	Fri Sep 14 12:05:47 2018 +0100
@@ -365,3 +365,19 @@
 		</query>
 	</iq>
 
+# To check the status of the room is as expected, Romeo requests the member list
+
+Romeo sends:
+	<iq id='member3' to='room@conference.localhost' type='get'>
+		<query xmlns='http://jabber.org/protocol/muc#admin'>
+			<item affiliation='member'/>
+		</query>
+	</iq>
+
+Romeo receives:
+	<iq from='room@conference.localhost' type='result' id='member3'>
+		<query xmlns='http://jabber.org/protocol/muc#admin'>
+			<item jid="${Juliet's JID}" affiliation='member' nick='Juliet'/>
+		</query>
+	</iq>
+