Software / code / prosody
Comparison
plugins/muc/register.lib.lua @ 9298:2d71040a959f
MUC: If a user with an existing affiliation registers, preserve that affiliation (thanks jc)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 13 Sep 2018 14:46:24 +0100 |
| parent | 9262:37b7cf3470f1 |
| child | 10225:9bdd9b6bf362 |
| child | 10341:4e406944ff85 |
comparison
equal
deleted
inserted
replaced
| 9297:8680a874f483 | 9298:2d71040a959f |
|---|---|
| 172 end | 172 end |
| 173 | 173 |
| 174 -- Checks passed, save the registration | 174 -- Checks passed, save the registration |
| 175 if registered_nick ~= desired_nick then | 175 if registered_nick ~= desired_nick then |
| 176 local registration_data = { reserved_nickname = desired_nick }; | 176 local registration_data = { reserved_nickname = desired_nick }; |
| 177 local ok, err_type, err_condition = room:set_affiliation(true, user_jid, "member", nil, registration_data); | 177 local ok, err_type, err_condition = room:set_affiliation(true, user_jid, affiliation or "member", nil, registration_data); |
| 178 if not ok then | 178 if not ok then |
| 179 origin.send(st.error_reply(stanza, err_type, err_condition)); | 179 origin.send(st.error_reply(stanza, err_type, err_condition)); |
| 180 return true; | 180 return true; |
| 181 end | 181 end |
| 182 module:log("debug", "Saved nick registration for %s: %s", user_jid, desired_nick); | 182 module:log("debug", "Saved nick registration for %s: %s", user_jid, desired_nick); |