# HG changeset patch # User Kim Alvefur # Date 1289676285 -3600 # Node ID aa797b0a98e7425668435250cc53f4ebfda68f11 # Parent 8e508f08cc7f010a138805fbf0bbcb5c52a53612 plugins.groupchat: Add methods for changing affiliation and role diff -r 8e508f08cc7f -r aa797b0a98e7 plugins/groupchat.lua --- 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);