comparison mod_mam_muc/mod_mam_muc.lua @ 1139:b32d65e41755

mod_mam_muc: Get room objects in a less awkward fashion
author Kim Alvefur <zash@zash.se>
date Sat, 10 Aug 2013 21:08:45 +0200
parents 5c97ee75cadb
children 402cb9b604eb
comparison
equal deleted inserted replaced
1138:5c97ee75cadb 1139:b32d65e41755
24 local uuid = require "util.uuid".generate; 24 local uuid = require "util.uuid".generate;
25 local default_max_items, max_max_items = 20, module:get_option_number("max_archive_query_results", 50); 25 local default_max_items, max_max_items = 20, module:get_option_number("max_archive_query_results", 50);
26 --local rooms_to_archive = module:get_option_set("rooms_to_archive",{}); 26 --local rooms_to_archive = module:get_option_set("rooms_to_archive",{});
27 -- TODO Should be possible to enforce it too 27 -- TODO Should be possible to enforce it too
28 28
29 local rooms = hosts[module.host].modules.muc.rooms;
29 local archive_store = "archive2"; 30 local archive_store = "archive2";
30 31
31 -- Handle archive queries 32 -- Handle archive queries
32 module:hook("iq-get/bare/"..xmlns_mam..":query", function(event) 33 module:hook("iq-get/bare/"..xmlns_mam..":query", function(event)
33 local origin, stanza = event.origin, event.stanza; 34 local origin, stanza = event.origin, event.stanza;
34 local room = jid_split(stanza.attr.to); 35 local room = jid_split(stanza.attr.to);
35 local query = stanza.tags[1]; 36 local query = stanza.tags[1];
36 37
37 local room_obj = hosts[module.host].modules.muc.rooms[jid_bare(stanza.attr.to)]; 38 local room_obj = rooms[room];
38 if not room_obj then 39 if not room_obj then
39 return -- FIXME not found 40 return -- FIXME not found
40 end 41 end
41 local from = jid_bare(stanza.attr.from); 42 local from = jid_bare(stanza.attr.from);
42 43