Software /
code /
prosody
Comparison
plugins/muc/muc.lib.lua @ 9239:03e37f7d6c97
MUC: Add some comments for clarity
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 03 Sep 2018 12:19:42 +0100 |
parent | 9238:0c1a1172d942 |
child | 9263:4285d1efaf03 |
comparison
equal
deleted
inserted
replaced
9238:0c1a1172d942 | 9239:03e37f7d6c97 |
---|---|
68 local affiliation = self:get_affiliation(bare_real_jid); | 68 local affiliation = self:get_affiliation(bare_real_jid); |
69 occupant.role = self:get_default_role(affiliation); | 69 occupant.role = self:get_default_role(affiliation); |
70 return occupant; | 70 return occupant; |
71 end | 71 end |
72 | 72 |
73 -- nick is in the form of an in-room JID | |
73 function room_mt:get_occupant_by_nick(nick) | 74 function room_mt:get_occupant_by_nick(nick) |
74 local occupant = self._occupants[nick]; | 75 local occupant = self._occupants[nick]; |
75 if occupant == nil then return nil end | 76 if occupant == nil then return nil end |
76 return occupant_lib.copy(occupant); | 77 return occupant_lib.copy(occupant); |
77 end | 78 end |
1448 local room_name, room_host = jid_split(room_jid); | 1449 local room_name, room_host = jid_split(room_jid); |
1449 | 1450 |
1450 room._affiliation_data = frozen._affiliation_data; | 1451 room._affiliation_data = frozen._affiliation_data; |
1451 | 1452 |
1452 if frozen.jid and frozen._affiliations then | 1453 if frozen.jid and frozen._affiliations then |
1454 -- Old storage format | |
1453 room._affiliations = frozen._affiliations; | 1455 room._affiliations = frozen._affiliations; |
1454 else | 1456 else |
1457 -- New storage format | |
1455 for jid, data in pairs(frozen) do | 1458 for jid, data in pairs(frozen) do |
1456 local node, host, resource = jid_split(jid); | 1459 local node, host, resource = jid_split(jid); |
1457 if host:sub(1,1) ~= "_" and not resource and type(data) == "string" then | 1460 if host:sub(1,1) ~= "_" and not resource and type(data) == "string" then |
1458 -- bare jid: affiliation | 1461 -- bare jid: affiliation |
1459 room._affiliations[jid] = data; | 1462 room._affiliations[jid] = data; |