comparison plugins/mod_vcard.lua @ 13658:33806569d7c5

mod_vcard: Switch store name for MUC hosts (thanks lissine)
author Matthew Wild <mwild1@gmail.com>
date Thu, 06 Feb 2025 17:37:59 +0000
parents 4298e6565fec
children 12c01089bdb7
comparison
equal deleted inserted replaced
13657:404d3644ac4a 13658:33806569d7c5
10 local jid = require "prosody.util.jid"; 10 local jid = require "prosody.util.jid";
11 local sha1 = require "prosody.util.hashes".sha1; 11 local sha1 = require "prosody.util.hashes".sha1;
12 local st = require "prosody.util.stanza" 12 local st = require "prosody.util.stanza"
13 local jid_split = require "prosody.util.jid".split; 13 local jid_split = require "prosody.util.jid".split;
14 14
15 local vcards = module:open_store(); 15 local store_name = module:get_option_string("vcard_store_name");
16
17 local is_component = module:get_host_type() == "component";
18 if is_component and not store_name and module:get_option_string("component_module") == "muc" then
19 store_name = "vcard_muc";
20 end
21
22 local vcards = module:open_store(store_name);
16 23
17 module:add_feature("vcard-temp"); 24 module:add_feature("vcard-temp");
18 25
19 local is_component = module:get_host_type() == "component";
20 26
21 local function handle_vcard(event) 27 local function handle_vcard(event)
22 local session, stanza = event.origin, event.stanza; 28 local session, stanza = event.origin, event.stanza;
23 local to = stanza.attr.to; 29 local to = stanza.attr.to;
24 if stanza.attr.type == "get" then 30 if stanza.attr.type == "get" then