changeset 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
parents 091b042cada0
children 6b860de18a53
files mod_vcard_muc/mod_vcard_muc.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
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);