Comparison

plugins/muc/muc.lib.lua @ 6197:1ee4d8953544

plugins/muc/muc.lib: Don't try and get occupant jids for annotating invite affiliation changes
author daurnimator <quae@daurnimator.com>
date Mon, 31 Mar 2014 14:44:52 -0400
parent 6196:e73bb1568d87
child 6198:8936b9fbedfd
comparison
equal deleted inserted replaced
6196:e73bb1568d87 6197:1ee4d8953544
1270 module:hook("muc-invite", function(event) 1270 module:hook("muc-invite", function(event)
1271 local room, stanza = event.room, event.stanza 1271 local room, stanza = event.room, event.stanza
1272 local invitee = stanza.attr.to 1272 local invitee = stanza.attr.to
1273 if room:get_members_only() and not room:get_affiliation(invitee) then 1273 if room:get_members_only() and not room:get_affiliation(invitee) then
1274 local from = stanza:get_child("x", "http://jabber.org/protocol/muc#user"):get_child("invite").attr.from 1274 local from = stanza:get_child("x", "http://jabber.org/protocol/muc#user"):get_child("invite").attr.from
1275 local current_nick = room:get_occupant_jid(from)
1276 log("debug", "%s invited %s into members only room %s, granting membership", from, invitee, room.jid); 1275 log("debug", "%s invited %s into members only room %s, granting membership", from, invitee, room.jid);
1277 room:set_affiliation(from, invitee, "member", "Invited by " .. current_nick) 1276 room:set_affiliation(from, invitee, "member", "Invited by " .. from); -- This might fail; ignore for now
1278 end 1277 end
1279 end); 1278 end);
1280 1279
1281 function room_mt:handle_mediated_decline(origin, stanza) 1280 function room_mt:handle_mediated_decline(origin, stanza)
1282 local payload = stanza:get_child("x", "http://jabber.org/protocol/muc#user"):get_child("decline"); 1281 local payload = stanza:get_child("x", "http://jabber.org/protocol/muc#user"):get_child("decline");