diff options
author | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2018-01-08 11:29:17 +0300 |
---|---|---|
committer | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2018-01-08 11:29:17 +0300 |
commit | 9d943614668b0e88e4b28958cef165bdee165e9a (patch) | |
tree | a2a741b593b418ce850637f2e5a57cec4e578721 /src/mod_vcard.erl | |
parent | Update copyright dates in header files (diff) |
Process 'name' option for all route-registering modules
The option allows to set arbitrary text for disco#info identity name.
Previously, option 'name' was supported by mod_proxy65 and mod_http_upload
only. Now, all the following modules support this option as well:
- mod_disco
- mod_irc
- mod_muc
- mod_multicast
- mod_pubsub
- mod_vcard
Example:
```
modules:
...
mod_disco:
name: "Cool XMPP Server"
...
```
Diffstat (limited to '')
-rw-r--r-- | src/mod_vcard.erl | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mod_vcard.erl b/src/mod_vcard.erl index d140dec1c..352c80324 100644 --- a/src/mod_vcard.erl +++ b/src/mod_vcard.erl @@ -46,6 +46,7 @@ -include("logger.hrl"). -include("xmpp.hrl"). -include("mod_vcard.hrl"). +-include("translate.hrl"). -define(JUD_MATCHES, 30). -define(VCARD_CACHE, vcard_cache). @@ -286,10 +287,12 @@ disco_features(Acc, _From, _To, _Node, _Lang) -> -spec disco_identity([identity()], jid(), jid(), binary(), binary()) -> [identity()]. -disco_identity(Acc, _From, _To, <<"">>, Lang) -> +disco_identity(Acc, _From, To, <<"">>, Lang) -> + Host = ejabberd_router:host_of_route(To#jid.lserver), + Name = gen_mod:get_module_opt(Host, ?MODULE, name, ?T("vCard User Search")), [#identity{category = <<"directory">>, type = <<"user">>, - name = translate:translate(Lang, <<"vCard User Search">>)}|Acc]; + name = translate:translate(Lang, Name)}|Acc]; disco_identity(Acc, _From, _To, _Node, _Lang) -> Acc. @@ -542,6 +545,7 @@ depends(_Host, _Opts) -> mod_opt_type(allow_return_all) -> fun (B) when is_boolean(B) -> B end; mod_opt_type(db_type) -> fun(T) -> ejabberd_config:v_db(?MODULE, T) end; +mod_opt_type(name) -> fun iolist_to_binary/1; mod_opt_type(host) -> fun iolist_to_binary/1; mod_opt_type(hosts) -> fun (L) -> lists:map(fun iolist_to_binary/1, L) end; @@ -563,4 +567,4 @@ mod_opt_type(O) when O == use_cache; O == cache_missed -> mod_opt_type(_) -> [allow_return_all, db_type, host, hosts, iqdisc, matches, search, search_all_hosts, cache_life_time, cache_size, - use_cache, cache_missed]. + use_cache, cache_missed, name]. |