comparison mod_mam_muc/mod_mam_muc.lua @ 2427:e5795f5f7a7b

mod_mam_muc: More room JID variable renaming for more consistency
author Kim Alvefur <zash@zash.se>
date Thu, 22 Dec 2016 16:16:39 +0100
parents deedb77c4f96
children 06e3b0ef8bdf
comparison
equal deleted inserted replaced
2426:deedb77c4f96 2427:e5795f5f7a7b
352 end 352 end
353 end 353 end
354 354
355 -- Handle messages 355 -- Handle messages
356 function save_to_history(self, stanza) 356 function save_to_history(self, stanza)
357 local room = jid_split(self.jid); 357 local room_node = jid_split(self.jid);
358 358
359 -- Policy check 359 -- Policy check
360 if not logging_enabled(self) then return end -- Don't log 360 if not logging_enabled(self) then return end -- Don't log
361 361
362 -- And stash it 362 -- And stash it
363 local with = stanza.name 363 local with = stanza.name
364 if stanza.attr.type then 364 if stanza.attr.type then
365 with = with .. "<" .. stanza.attr.type 365 with = with .. "<" .. stanza.attr.type
366 end 366 end
367 archive:append(room, nil, stanza, time_now(), with); 367 archive:append(room_node, nil, stanza, time_now(), with);
368 end 368 end
369 369
370 module:hook("muc-broadcast-message", function (event) 370 module:hook("muc-broadcast-message", function (event)
371 local room, stanza = event.room, event.stanza; 371 local room, stanza = event.room, event.stanza;
372 if stanza:get_child("body") then 372 if stanza:get_child("body") then
382 save_to_history(event.room, st.stanza("presence", { type = "unavailable", from = event.nick })); 382 save_to_history(event.room, st.stanza("presence", { type = "unavailable", from = event.nick }));
383 end); 383 end);
384 end 384 end
385 385
386 module:hook("muc-room-destroyed", function(event) 386 module:hook("muc-room-destroyed", function(event)
387 local username = jid_split(event.room.jid); 387 local room_node = jid_split(event.room.jid);
388 archive:delete(username); 388 archive:delete(room_node);
389 end); 389 end);
390 390
391 -- TODO should we perhaps log presence as well? 391 -- TODO should we perhaps log presence as well?
392 -- And role/affiliation changes? 392 -- And role/affiliation changes?
393 393