equal
deleted
inserted
replaced
1320 } |
1320 } |
1321 for jid, presence in occupant:each_session() do |
1321 for jid, presence in occupant:each_session() do |
1322 frozen[jid] = st.preserialize(presence); |
1322 frozen[jid] = st.preserialize(presence); |
1323 end |
1323 end |
1324 end |
1324 end |
|
1325 local history = self._history; |
|
1326 if history then |
|
1327 frozen._last_message = st.preserialize(history[#history].stanza); |
|
1328 frozen._last_message_at = history[#history].timestamp; |
|
1329 end |
1325 end |
1330 end |
1326 return frozen; |
1331 return frozen; |
1327 end |
1332 end |
1328 |
1333 |
1329 function _M.restore_room(frozen) |
1334 function _M.restore_room(frozen) |
1334 return room; |
1339 return room; |
1335 end |
1340 end |
1336 |
1341 |
1337 local room_jid = frozen._jid; |
1342 local room_jid = frozen._jid; |
1338 local room = _M.new_room(room_jid, frozen._data); |
1343 local room = _M.new_room(room_jid, frozen._data); |
|
1344 |
|
1345 if frozen._last_message and frozen._last_message_at then |
|
1346 room._history = { |
|
1347 { stanza = st.deserialize(frozen._last_message), |
|
1348 timestamp = frozen._last_message_at, }, |
|
1349 }; |
|
1350 end |
1339 |
1351 |
1340 local occupants = {}; |
1352 local occupants = {}; |
1341 local occupant_sessions = {}; |
1353 local occupant_sessions = {}; |
1342 local room_name, room_host = jid_split(room_jid); |
1354 local room_name, room_host = jid_split(room_jid); |
1343 for jid, data in pairs(frozen) do |
1355 for jid, data in pairs(frozen) do |