diff --git a/src/mod_disco.erl b/src/mod_disco.erl index f77cb7ef4..e2632a0b4 100644 --- a/src/mod_disco.erl +++ b/src/mod_disco.erl @@ -41,7 +41,7 @@ -include("ejabberd.hrl"). -include("logger.hrl"). - +-include("translate.hrl"). -include("xmpp.hrl"). -include_lib("stdlib/include/ms_transform.hrl"). -include("mod_roster.hrl"). @@ -195,10 +195,12 @@ process_local_iq_info(#iq{type = get, lang = Lang, -spec get_local_identity([identity()], jid(), jid(), binary(), binary()) -> [identity()]. -get_local_identity(Acc, _From, _To, <<"">>, _Lang) -> +get_local_identity(Acc, _From, To, <<"">>, _Lang) -> + Host = To#jid.lserver, + Name = gen_mod:get_module_opt(Host, ?MODULE, name, ?T("ejabberd")), Acc ++ [#identity{category = <<"server">>, type = <<"im">>, - name = <<"ejabberd">>}]; + name = Name}]; get_local_identity(Acc, _From, _To, _Node, _Lang) -> Acc. @@ -456,6 +458,7 @@ depends(_Host, _Opts) -> mod_opt_type(extra_domains) -> fun (Hs) -> [iolist_to_binary(H) || H <- Hs] end; mod_opt_type(iqdisc) -> fun gen_iq_handler:check_type/1; +mod_opt_type(name) -> fun iolist_to_binary/1; mod_opt_type(server_info) -> fun (L) -> lists:map(fun (Opts) -> @@ -466,4 +469,4 @@ mod_opt_type(server_info) -> end, L) end; -mod_opt_type(_) -> [extra_domains, iqdisc, server_info]. +mod_opt_type(_) -> [extra_domains, iqdisc, server_info, name]. diff --git a/src/mod_http_upload.erl b/src/mod_http_upload.erl index d85ff9244..f7ff56b0b 100644 --- a/src/mod_http_upload.erl +++ b/src/mod_http_upload.erl @@ -91,6 +91,7 @@ -include("ejabberd_http.hrl"). -include("xmpp.hrl"). -include("logger.hrl"). +-include("translate.hrl"). -record(state, {server_host :: binary(), @@ -215,7 +216,7 @@ depends(_Host, _Opts) -> init([ServerHost, Opts]) -> process_flag(trap_exit, true), Hosts = gen_mod:get_opt_hosts(ServerHost, Opts, <<"upload.@HOST@">>), - Name = gen_mod:get_opt(name, Opts, <<"HTTP File Upload">>), + Name = gen_mod:get_opt(name, Opts, ?T("HTTP File Upload")), Access = gen_mod:get_opt(access, Opts, local), MaxSize = gen_mod:get_opt(max_size, Opts, 104857600), SecretLength = gen_mod:get_opt(secret_length, Opts, 40), diff --git a/src/mod_irc.erl b/src/mod_irc.erl index 0db4142b6..ab8b31c2c 100644 --- a/src/mod_irc.erl +++ b/src/mod_irc.erl @@ -45,6 +45,7 @@ -include("logger.hrl"). -include("xmpp.hrl"). -include("mod_irc.hrl"). +-include("translate.hrl"). -define(DEFAULT_IRC_ENCODING, <<"iso8859-15">>). @@ -432,11 +433,12 @@ sm_route(Host, ServerHost, Packet) -> closed_connection(Host, From, Server) -> ets:delete(irc_connection, {From, Server, Host}). -iq_disco(_ServerHost, <<"">>, Lang) -> +iq_disco(ServerHost, <<"">>, Lang) -> + Name = gen_mod:get_module_opt(ServerHost, ?MODULE, name, ?T("IRC Transport")), #disco_info{ identities = [#identity{category = <<"conference">>, type = <<"irc">>, - name = translate:translate(Lang, <<"IRC Transport">>)}], + name = translate:translate(Lang, Name)}], features = [?NS_DISCO_INFO, ?NS_DISCO_ITEMS, ?NS_MUC, ?NS_REGISTER, ?NS_VCARD, ?NS_COMMANDS]}; iq_disco(ServerHost, Node, Lang) -> @@ -986,11 +988,13 @@ mod_opt_type(access) -> mod_opt_type(db_type) -> fun(T) -> ejabberd_config:v_db(?MODULE, T) end; mod_opt_type(default_encoding) -> fun iolist_to_binary/1; +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; mod_opt_type(_) -> - [access, db_type, default_encoding, host, hosts]. + [access, db_type, default_encoding, host, hosts, name]. -spec extract_ident(stanza()) -> binary(). extract_ident(Packet) -> diff --git a/src/mod_muc.erl b/src/mod_muc.erl index 7ec18ca9c..d3ad90cb4 100644 --- a/src/mod_muc.erl +++ b/src/mod_muc.erl @@ -75,6 +75,7 @@ -include("logger.hrl"). -include("xmpp.hrl"). -include("mod_muc.hrl"). +-include("translate.hrl"). -record(state, {hosts = [] :: [binary()], @@ -526,9 +527,10 @@ process_disco_info(#iq{type = get, to = To, lang = Lang, Features = [?NS_DISCO_INFO, ?NS_DISCO_ITEMS, ?NS_REGISTER, ?NS_MUC, ?NS_VCARD, ?NS_MUCSUB, ?NS_MUC_UNIQUE | RSMFeatures ++ MAMFeatures], + Name = gen_mod:get_module_opt(ServerHost, ?MODULE, name, ?T("Chatrooms")), Identity = #identity{category = <<"conference">>, type = <<"text">>, - name = translate:translate(Lang, <<"Chatrooms">>)}, + name = translate:translate(Lang, Name)}, xmpp:make_iq_result( IQ, #disco_info{features = Features, identities = [Identity], @@ -880,6 +882,7 @@ mod_opt_type(ram_db_type) -> fun(T) -> ejabberd_config:v_db(?MODULE, T) end; mod_opt_type(history_size) -> fun (I) when is_integer(I), I >= 0 -> I end; mod_opt_type(host) -> fun iolist_to_binary/1; +mod_opt_type(name) -> fun iolist_to_binary/1; mod_opt_type(hosts) -> fun (L) -> lists:map(fun iolist_to_binary/1, L) end; mod_opt_type(max_room_desc) -> @@ -975,7 +978,7 @@ mod_opt_type({default_room_options, presence_broadcast}) -> end; mod_opt_type(_) -> [access, access_admin, access_create, access_persistent, - db_type, ram_db_type, history_size, host, hosts, + db_type, ram_db_type, history_size, host, hosts, name, max_room_desc, max_room_id, max_room_name, max_rooms_discoitems, max_user_conferences, max_users, max_users_admin_threshold, max_users_presence, diff --git a/src/mod_multicast.erl b/src/mod_multicast.erl index 84e45e242..f2a48ecaf 100644 --- a/src/mod_multicast.erl +++ b/src/mod_multicast.erl @@ -44,7 +44,7 @@ -include("ejabberd.hrl"). -include("logger.hrl"). - +-include("translate.hrl"). -include("xmpp.hrl"). -record(state, @@ -261,10 +261,12 @@ process_iq(_, _) -> -define(FEATURE(Feat), Feat). iq_disco_info(From, Lang, State) -> + Name = gen_mod:get_module_opt(State#state.lserver, ?MODULE, + name, ?T("Multicast")), #disco_info{ identities = [#identity{category = <<"service">>, type = <<"multicast">>, - name = translate:translate(Lang, <<"Multicast">>)}], + name = translate:translate(Lang, Name)}], features = [?NS_DISCO_INFO, ?NS_DISCO_ITEMS, ?NS_VCARD, ?NS_ADDRESS], xdata = iq_disco_info_extras(From, State)}. @@ -1119,6 +1121,7 @@ depends(_Host, _Opts) -> mod_opt_type(access) -> fun acl:access_rules_validator/1; mod_opt_type(host) -> fun iolist_to_binary/1; +mod_opt_type(name) -> fun iolist_to_binary/1; mod_opt_type({limits, Type}) when (Type == local) or (Type == remote) -> fun(L) -> lists:map( @@ -1128,4 +1131,4 @@ mod_opt_type({limits, Type}) when (Type == local) or (Type == remote) -> ({presence, I} = O) when is_integer(I) -> O end, L) end; -mod_opt_type(_) -> [access, host, {limits, local}, {limits, remote}]. +mod_opt_type(_) -> [access, host, {limits, local}, {limits, remote}, name]. diff --git a/src/mod_proxy65_service.erl b/src/mod_proxy65_service.erl index f76839295..718f97ee8 100644 --- a/src/mod_proxy65_service.erl +++ b/src/mod_proxy65_service.erl @@ -40,6 +40,7 @@ -include("ejabberd.hrl"). -include("logger.hrl"). -include("xmpp.hrl"). +-include("translate.hrl"). -define(PROCNAME, ejabberd_mod_proxy65_service). @@ -144,7 +145,7 @@ process_disco_info(#iq{type = set, lang = Lang} = IQ) -> process_disco_info(#iq{type = get, to = To, lang = Lang} = IQ) -> Host = ejabberd_router:host_of_route(To#jid.lserver), Name = gen_mod:get_module_opt(Host, mod_proxy65, name, - <<"SOCKS5 Bytestreams">>), + ?T("SOCKS5 Bytestreams")), Info = ejabberd_hooks:run_fold(disco_info, Host, [], [Host, ?MODULE, <<"">>, <<"">>]), xmpp:make_iq_result( diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl index 0c39bbbe9..47ee8fa3e 100644 --- a/src/mod_pubsub.erl +++ b/src/mod_pubsub.erl @@ -44,6 +44,7 @@ -include("xmpp.hrl"). -include("pubsub.hrl"). -include("mod_roster.hrl"). +-include("translate.hrl"). -define(STDTREE, <<"tree">>). -define(STDNODE, <<"flat">>). @@ -829,7 +830,7 @@ process_disco_info(#iq{from = From, to = To, lang = Lang, type = get, Info = ejabberd_hooks:run_fold(disco_info, ServerHost, [], [ServerHost, ?MODULE, <<>>, <<>>]), - case iq_disco_info(Host, Node, From, Lang) of + case iq_disco_info(ServerHost, Host, Node, From, Lang) of {result, IQRes} -> XData = IQRes#disco_info.xdata ++ Info, xmpp:make_iq_result(IQ, IQRes#disco_info{node = Node, xdata = XData}); @@ -970,22 +971,23 @@ node_disco_info(Host, Node, _From, _Identity, _Features) -> Other -> Other end. --spec iq_disco_info(binary(), binary(), jid(), binary()) +-spec iq_disco_info(binary(), binary(), binary(), jid(), binary()) -> {result, disco_info()} | {error, stanza_error()}. -iq_disco_info(Host, SNode, From, Lang) -> +iq_disco_info(ServerHost, Host, SNode, From, Lang) -> [Node | _] = case SNode of <<>> -> [<<>>]; _ -> str:tokens(SNode, <<"!">>) end, case Node of <<>> -> + Name = gen_mod:get_module_opt(ServerHost, ?MODULE, name, + ?T("Publish-Subscribe")), {result, #disco_info{ identities = [#identity{ category = <<"pubsub">>, type = <<"service">>, - name = translate:translate( - Lang, <<"Publish-Subscribe">>)}], + name = translate:translate(Lang, Name)}], features = [?NS_DISCO_INFO, ?NS_DISCO_ITEMS, ?NS_PUBSUB, @@ -3853,6 +3855,7 @@ purge_offline(Host, LJID, Node) -> mod_opt_type(access_createnode) -> fun acl:access_rules_validator/1; 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; @@ -3874,7 +3877,7 @@ mod_opt_type(pep_mapping) -> mod_opt_type(plugins) -> fun (A) when is_list(A) -> A end; mod_opt_type(_) -> - [access_createnode, db_type, host, hosts, + [access_createnode, db_type, host, hosts, name, ignore_pep_from_offline, iqdisc, last_item_cache, max_items_node, nodetree, pep_mapping, plugins, max_subscriptions_node, default_node_config]. 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].