Diff

mod_vcard_muc/mod_vcard_muc.lua @ 3077:f16b021e8a61

mod_vcard_muc: Get room from rooms table when get_room_from_jid API is not supported Closes #1152
author Michel Le Bihan <michel@lebihan.pl>
date Wed, 30 May 2018 19:14:01 +0200
parent 3046:d0db28768980
child 3655:d7b589dec591
line wrap: on
line diff
--- a/mod_vcard_muc/mod_vcard_muc.lua	Wed May 30 10:02:38 2018 +0200
+++ b/mod_vcard_muc/mod_vcard_muc.lua	Wed May 30 19:14:01 2018 +0200
@@ -13,12 +13,17 @@
 local sha1 = require"util.hashes".sha1;
 
 local mod_muc = module:depends"muc";
-local get_room_from_jid = mod_muc.get_room_from_jid;
 
 local vcards = module:open_store();
 
 module:add_feature("vcard-temp");
 
+local get_room_from_jid = rawget(mod_muc, "get_room_from_jid") or
+	function (jid)
+		local rooms = rawget(mod_muc, "rooms");
+		return rooms[jid];
+	end
+
 local function broadcast_presence(room_jid, to)
 	local room = get_room_from_jid(room_jid);
 	local room_node = jid_split(room_jid);