aboutsummaryrefslogtreecommitdiff
path: root/src/mod_proxy65_service.erl
diff options
context:
space:
mode:
authorEvgeny Khramtsov <ekhramtsov@process-one.net>2019-08-02 13:55:48 +0300
committerEvgeny Khramtsov <ekhramtsov@process-one.net>2019-08-02 13:59:42 +0300
commit5a976719fb821801fd162cde4516085416ef71e6 (patch)
tree9811d2e4b7da2e4396259a2e1ce7e1c839c5194a /src/mod_proxy65_service.erl
parentBump pkix version (diff)
Introduce 'vcard' option for the modules supporting vCards
The mapping between vCard's XML elements and YAML elements of 'vcard' option is straightforward. For example, if you want mod_muc to return the following vCard: ``` <vCard xmlns='vcard-temp'> <FN>Conferences</FN> <ADR> <WORK/> <STREET>Elm Street</STREET> </ADR> </vCard> ``` you need to set the configuration as: ``` modules: ... mod_muc: vcard: fn: Conferences adr: - work: true street: Elm Street ... ```
Diffstat (limited to 'src/mod_proxy65_service.erl')
-rw-r--r--src/mod_proxy65_service.erl17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/mod_proxy65_service.erl b/src/mod_proxy65_service.erl
index bac3911fe..31344d27e 100644
--- a/src/mod_proxy65_service.erl
+++ b/src/mod_proxy65_service.erl
@@ -171,11 +171,18 @@ process_disco_items(#iq{type = get} = IQ) ->
process_vcard(#iq{type = set, lang = Lang} = IQ) ->
Txt = ?T("Value 'set' of 'type' attribute is not allowed"),
xmpp:make_error(IQ, xmpp:err_not_allowed(Txt, Lang));
-process_vcard(#iq{type = get, lang = Lang} = IQ) ->
- xmpp:make_iq_result(
- IQ, #vcard_temp{fn = <<"ejabberd/mod_proxy65">>,
- url = ejabberd_config:get_uri(),
- desc = misc:get_descr(Lang, ?T("ejabberd SOCKS5 Bytestreams module"))}).
+process_vcard(#iq{type = get, to = To, lang = Lang} = IQ) ->
+ ServerHost = ejabberd_router:host_of_route(To#jid.lserver),
+ VCard = case mod_proxy65_opt:vcard(ServerHost) of
+ undefined ->
+ #vcard_temp{fn = <<"ejabberd/mod_proxy65">>,
+ url = ejabberd_config:get_uri(),
+ desc = misc:get_descr(
+ Lang, ?T("ejabberd SOCKS5 Bytestreams module"))};
+ V ->
+ V
+ end,
+ xmpp:make_iq_result(IQ, VCard).
-spec process_bytestreams(iq()) -> iq().
process_bytestreams(#iq{type = get, from = JID, to = To, lang = Lang} = IQ) ->