Comparison

plugins/muc/password.lib.lua @ 6991:84e01dbb739e

MUC: Update all config form handlers to take advantage of the new per-option events
author Matthew Wild <mwild1@gmail.com>
date Fri, 11 Dec 2015 15:33:58 +0000
parent 6329:6b3eb1611587
child 7352:50b24b3476e6
comparison
equal deleted inserted replaced
6990:f476e2497568 6991:84e01dbb739e
32 label = "Password"; 32 label = "Password";
33 value = get_password(event.room) or ""; 33 value = get_password(event.room) or "";
34 }); 34 });
35 end); 35 end);
36 36
37 module:hook("muc-config-submitted", function(event) 37 module:hook("muc-config-submitted/muc#roomconfig_roomsecret", function(event)
38 local new = event.fields["muc#roomconfig_roomsecret"]; 38 if set_password(event.room, event.value) then
39 if new ~= nil and set_password(event.room, new) then
40 event.status_codes["104"] = true; 39 event.status_codes["104"] = true;
41 end 40 end
42 end); 41 end);
43 42
44 -- Don't allow anyone to join room unless they provide the password 43 -- Don't allow anyone to join room unless they provide the password