Mercurial > prosody-hg
comparison plugins/muc/muc.lib.lua @ 11915:e0b58717f0c5
MUC: Actually set the new affiliation data if it was previously empty
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 16 Nov 2021 15:00:02 +0000 |
| parents | 037b2c019f58 |
| children | f995d62044fa |
comparison
equal
deleted
inserted
replaced
| 11914:8f7946ce7d66 | 11915:e0b58717f0c5 |
|---|---|
| 1537 if key == nil then return nil, "invalid key"; end | 1537 if key == nil then return nil, "invalid key"; end |
| 1538 local data = self._affiliation_data[jid]; | 1538 local data = self._affiliation_data[jid]; |
| 1539 if not data then | 1539 if not data then |
| 1540 if value == nil then return true; end | 1540 if value == nil then return true; end |
| 1541 data = {}; | 1541 data = {}; |
| 1542 self._affiliation_data[jid] = data; | |
| 1542 end | 1543 end |
| 1543 local old_value = data[key]; | 1544 local old_value = data[key]; |
| 1544 data[key] = value; | 1545 data[key] = value; |
| 1545 if old_value ~= value then | 1546 if old_value ~= value then |
| 1546 module:fire_event("muc-set-affiliation-data/"..key, { | 1547 module:fire_event("muc-set-affiliation-data/"..key, { |
