plugins.groupchat: Add methods for changing affiliation and role

Sat, 13 Nov 2010 20:24:45 +0100

author
Kim Alvefur <zash@zash.se>
date
Sat, 13 Nov 2010 20:24:45 +0100
changeset 45
aa797b0a98e7
parent 44
8e508f08cc7f
child 46
1f0fa4af29b8

plugins.groupchat: Add methods for changing affiliation and role

plugins/groupchat.lua file | annotate | diff | comparison | revisions
--- a/plugins/groupchat.lua	Thu Nov 11 03:09:06 2010 +0100
+++ b/plugins/groupchat.lua	Sat Nov 13 20:24:45 2010 +0100
@@ -122,6 +122,20 @@
 	self:send(st.presence({type="unavailable"}));
 end
 
+function room_mt:set_role(nick, role, reason)
+	self:send(st.iq({type="set"})
+		:query(xmlns_muc .. "#admin")
+			:tag("item", {nick = nick, role = role})
+				:tag("reason"):text(reason or ""));
+end
+
+function room_mt:set_affiliation(nick, affiliation, reason)
+	self:send(st.iq({type="set"})
+		:query(xmlns_muc .. "#admin")
+			:tag("item", {nick = nick, affiliation = affiliation})
+				:tag("reason"):text(reason or ""));
+end
+
 function room_mt:event(name, arg)
 	self.bot.stream:debug("Firing room event: %s", name);
 	return self.events.fire_event(name, arg);

mercurial