Comparison

plugins/muc/mod_muc.lua @ 9237:b86c2e135797

MUC: Add support for storing additional data with MUC affiliations XEP-0045 registration provides examples of registering a nickname and various other details. This also allows modules to store arbitrary private data about an affiliated entity.
author Matthew Wild <mwild1@gmail.com>
date Mon, 03 Sep 2018 12:18:13 +0100
parent 9221:6dc1aeefa876
child 9240:f9a83aca4421
comparison
equal deleted inserted replaced
9236:83375ec33619 9237:b86c2e135797
105 if is_admin(jid) then return "owner"; end 105 if is_admin(jid) then return "owner"; end
106 return _get_affiliation(self, jid); 106 return _get_affiliation(self, jid);
107 end 107 end
108 108
109 local _set_affiliation = room_mt.set_affiliation; 109 local _set_affiliation = room_mt.set_affiliation;
110 function room_mt:set_affiliation(actor, jid, affiliation, reason) 110 function room_mt:set_affiliation(actor, jid, affiliation, reason, data)
111 if affiliation ~= "owner" and is_admin(jid) then return nil, "modify", "not-acceptable"; end 111 if affiliation ~= "owner" and is_admin(jid) then return nil, "modify", "not-acceptable"; end
112 return _set_affiliation(self, actor, jid, affiliation, reason); 112 return _set_affiliation(self, actor, jid, affiliation, reason, data);
113 end 113 end
114 end 114 end
115 115
116 local persistent_rooms_storage = module:open_store("persistent"); 116 local persistent_rooms_storage = module:open_store("persistent");
117 local persistent_rooms = module:open_store("persistent", "map"); 117 local persistent_rooms = module:open_store("persistent", "map");