mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-20 17:27:00 +01:00
Reuse some translation strings
This commit is contained in:
parent
adfb924808
commit
d7250111ce
@ -411,7 +411,7 @@ bind(R, #{user := U, server := S, access := Access, lang := Lang,
|
||||
ejabberd_hooks:run(forbidden_session_hook, LServer, [JID]),
|
||||
?INFO_MSG("(~s) Forbidden c2s session for ~s",
|
||||
[SockMod:pp(Socket), jid:encode(JID)]),
|
||||
Txt = <<"Denied by ACL">>,
|
||||
Txt = <<"Access denied by service policy">>,
|
||||
{error, xmpp:err_not_allowed(Txt, Lang), State}
|
||||
end
|
||||
end.
|
||||
@ -658,7 +658,7 @@ process_presence_out(#{user := User, server := Server, lserver := LServer,
|
||||
MyBareJID = jid:remove_resource(JID),
|
||||
case acl:match_rule(LServer, Access, MyBareJID) of
|
||||
deny ->
|
||||
ErrText = <<"Denied by ACL">>,
|
||||
ErrText = <<"Access denied by service policy">>,
|
||||
Err = xmpp:err_forbidden(ErrText, Lang),
|
||||
send_error(State, Pres, Err);
|
||||
allow ->
|
||||
|
@ -369,7 +369,7 @@ do_route(Packet) ->
|
||||
<<"Server connections to local "
|
||||
"subdomains are forbidden">>, Lang);
|
||||
forbidden ->
|
||||
xmpp:err_forbidden(<<"Denied by ACL">>, Lang);
|
||||
xmpp:err_forbidden(<<"Access denied by service policy">>, Lang);
|
||||
internal_server_error ->
|
||||
xmpp:err_internal_server_error()
|
||||
end,
|
||||
|
@ -199,7 +199,7 @@ handle_info({route, Packet}, #{access := Access} = State) ->
|
||||
xmpp_stream_in:send(State, Packet);
|
||||
deny ->
|
||||
Lang = xmpp:get_lang(Packet),
|
||||
Err = xmpp:err_not_allowed(<<"Denied by ACL">>, Lang),
|
||||
Err = xmpp:err_not_allowed(<<"Access denied by service policy">>, Lang),
|
||||
ejabberd_router:route_error(Packet, Err),
|
||||
State
|
||||
end;
|
||||
|
@ -237,7 +237,7 @@ disco_identity(Acc, _From, _To, Node, Lang) ->
|
||||
-define(INFO_RESULT(Allow, Feats, Lang),
|
||||
case Allow of
|
||||
deny ->
|
||||
{error, xmpp:err_forbidden(<<"Denied by ACL">>, Lang)};
|
||||
{error, xmpp:err_forbidden(<<"Access denied by service policy">>, Lang)};
|
||||
allow ->
|
||||
{result, Feats}
|
||||
end).
|
||||
@ -252,7 +252,7 @@ disco_features(Acc, From, #jid{lserver = LServer} = _To, <<"announce">>, Lang) -
|
||||
case {acl:match_rule(LServer, Access1, From),
|
||||
acl:match_rule(global, Access2, From)} of
|
||||
{deny, deny} ->
|
||||
Txt = <<"Denied by ACL">>,
|
||||
Txt = <<"Access denied by service policy">>,
|
||||
{error, xmpp:err_forbidden(Txt, Lang)};
|
||||
_ ->
|
||||
{result, []}
|
||||
@ -303,7 +303,7 @@ disco_features(Acc, From, #jid{lserver = LServer} = _To, Node, Lang) ->
|
||||
-define(ITEMS_RESULT(Allow, Items, Lang),
|
||||
case Allow of
|
||||
deny ->
|
||||
{error, xmpp:err_forbidden(<<"Denied by ACL">>, Lang)};
|
||||
{error, xmpp:err_forbidden(<<"Access denied by service policy">>, Lang)};
|
||||
allow ->
|
||||
{result, Items}
|
||||
end).
|
||||
@ -417,7 +417,7 @@ commands_result(Allow, From, To, Request) ->
|
||||
case Allow of
|
||||
deny ->
|
||||
Lang = Request#adhoc_command.lang,
|
||||
{error, xmpp:err_forbidden(<<"Denied by ACL">>, Lang)};
|
||||
{error, xmpp:err_forbidden(<<"Access denied by service policy">>, Lang)};
|
||||
allow ->
|
||||
announce_commands(From, To, Request)
|
||||
end.
|
||||
@ -843,7 +843,7 @@ add_store_hint(El) ->
|
||||
-spec route_forbidden_error(stanza()) -> ok.
|
||||
route_forbidden_error(Packet) ->
|
||||
Lang = xmpp:get_lang(Packet),
|
||||
Err = xmpp:err_forbidden(<<"Denied by ACL">>, Lang),
|
||||
Err = xmpp:err_forbidden(<<"Access denied by service policy">>, Lang),
|
||||
ejabberd_router:route_error(Packet, Err).
|
||||
|
||||
-spec init_cache(module(), binary(), gen_mod:opts()) -> ok.
|
||||
|
@ -192,7 +192,7 @@ get_local_identity(Acc, _From, _To, Node, Lang) ->
|
||||
|
||||
-define(INFO_RESULT(Allow, Feats, Lang),
|
||||
case Allow of
|
||||
deny -> {error, xmpp:err_forbidden(<<"Denied by ACL">>, Lang)};
|
||||
deny -> {error, xmpp:err_forbidden(<<"Access denied by service policy">>, Lang)};
|
||||
allow -> {result, Feats}
|
||||
end).
|
||||
|
||||
@ -310,7 +310,7 @@ get_sm_items(Acc, From,
|
||||
Items ++ Nodes ++ get_user_resources(User, Server)};
|
||||
{allow, <<"config">>} -> {result, []};
|
||||
{_, <<"config">>} ->
|
||||
{error, xmpp:err_forbidden(<<"Denied by ACL">>, Lang)};
|
||||
{error, xmpp:err_forbidden(<<"Access denied by service policy">>, Lang)};
|
||||
_ -> Acc
|
||||
end
|
||||
end.
|
||||
@ -432,7 +432,7 @@ get_local_items(Acc, From, #jid{lserver = LServer} = To,
|
||||
_ ->
|
||||
LNode = tokenize(Node),
|
||||
Allow = acl:match_rule(LServer, configure, From),
|
||||
Err = xmpp:err_forbidden(<<"Denied by ACL">>, Lang),
|
||||
Err = xmpp:err_forbidden(<<"Access denied by service policy">>, Lang),
|
||||
case LNode of
|
||||
[<<"config">>] ->
|
||||
?ITEMS_RESULT(Allow, LNode, {error, Err});
|
||||
@ -765,7 +765,7 @@ get_stopped_nodes(_Lang) ->
|
||||
-define(COMMANDS_RESULT(LServerOrGlobal, From, To,
|
||||
Request, Lang),
|
||||
case acl:match_rule(LServerOrGlobal, configure, From) of
|
||||
deny -> {error, xmpp:err_forbidden(<<"Denied by ACL">>, Lang)};
|
||||
deny -> {error, xmpp:err_forbidden(<<"Access denied by service policy">>, Lang)};
|
||||
allow -> adhoc_local_commands(From, To, Request)
|
||||
end).
|
||||
|
||||
@ -1737,7 +1737,7 @@ adhoc_sm_commands(_Acc, From,
|
||||
action = Action, xdata = XData} = Request) ->
|
||||
case acl:match_rule(LServer, configure, From) of
|
||||
deny ->
|
||||
{error, xmpp:err_forbidden(<<"Denied by ACL">>, Lang)};
|
||||
{error, xmpp:err_forbidden(<<"Access denied by service policy">>, Lang)};
|
||||
allow ->
|
||||
ActionIsExecute = Action == execute orelse Action == complete,
|
||||
if Action == cancel ->
|
||||
|
@ -522,7 +522,7 @@ process_slot_request(#iq{lang = Lang, from = From} = IQ,
|
||||
deny ->
|
||||
?DEBUG("Denying HTTP upload slot request from ~s",
|
||||
[jid:encode(From)]),
|
||||
Txt = <<"Denied by ACL">>,
|
||||
Txt = <<"Access denied by service policy">>,
|
||||
xmpp:make_error(IQ, xmpp:err_forbidden(Txt, Lang))
|
||||
end.
|
||||
|
||||
|
@ -262,7 +262,7 @@ do_route(Host, ServerHost, Access, Packet) ->
|
||||
end;
|
||||
deny ->
|
||||
Lang = xmpp:get_lang(Packet),
|
||||
Err = xmpp:err_forbidden(<<"Denied by ACL">>, Lang),
|
||||
Err = xmpp:err_forbidden(<<"Access denied by service policy">>, Lang),
|
||||
ejabberd_router:route_error(Packet, Err)
|
||||
end.
|
||||
|
||||
|
@ -133,7 +133,7 @@ authenticate(#{stream_id := StreamID, server := Server,
|
||||
Err = xmpp:make_error(IQ, xmpp:err_jid_malformed()),
|
||||
process_auth_failure(State, U, Err, 'jid-malformed');
|
||||
false ->
|
||||
Txt = <<"Denied by ACL">>,
|
||||
Txt = <<"Access denied by service policy">>,
|
||||
Err = xmpp:make_error(IQ, xmpp:err_forbidden(Txt, Lang)),
|
||||
process_auth_failure(State, U, Err, 'forbidden')
|
||||
end.
|
||||
|
@ -1059,7 +1059,7 @@ get_roomconfig_text(allow_visitor_status, Lang) ->
|
||||
?T(<<"Allow visitors to send status text in "
|
||||
"presence updates">>);
|
||||
get_roomconfig_text(captcha_protected, Lang) ->
|
||||
?T(<<"Make room captcha protected">>);
|
||||
?T(<<"Make room CAPTCHA protected">>);
|
||||
get_roomconfig_text(description, Lang) ->
|
||||
?T(<<"Room description">>);
|
||||
%% get_roomconfig_text(subject, Lang) -> "Subject";
|
||||
|
@ -183,7 +183,7 @@ process_bytestreams(#iq{type = get, from = JID, to = To, lang = Lang} = IQ) ->
|
||||
StreamHost = get_streamhost(Host, ServerHost),
|
||||
xmpp:make_iq_result(IQ, #bytestreams{hosts = [StreamHost]});
|
||||
deny ->
|
||||
xmpp:make_error(IQ, xmpp:err_forbidden(<<"Denied by ACL">>, Lang))
|
||||
xmpp:make_error(IQ, xmpp:err_forbidden(<<"Access denied by service policy">>, Lang))
|
||||
end;
|
||||
process_bytestreams(#iq{type = set, lang = Lang,
|
||||
sub_els = [#bytestreams{sid = SID}]} = IQ)
|
||||
@ -232,7 +232,7 @@ process_bytestreams(#iq{type = set, lang = Lang, from = InitiatorJID, to = To,
|
||||
xmpp:make_error(IQ, xmpp:err_internal_server_error(Txt, Lang))
|
||||
end;
|
||||
deny ->
|
||||
Txt = <<"Denied by ACL">>,
|
||||
Txt = <<"Access denied by service policy">>,
|
||||
xmpp:make_error(IQ, xmpp:err_forbidden(Txt, Lang))
|
||||
end.
|
||||
|
||||
|
@ -127,7 +127,7 @@ process_iq(#iq{from = From, to = To} = IQ, Source) ->
|
||||
process_iq(#iq{type = set, lang = Lang,
|
||||
sub_els = [#register{remove = true}]} = IQ,
|
||||
_Source, _IsCaptchaEnabled, _AllowRemove = false) ->
|
||||
Txt = <<"Denied by ACL">>,
|
||||
Txt = <<"Access denied by service policy">>,
|
||||
xmpp:make_error(IQ, xmpp:err_forbidden(Txt, Lang));
|
||||
process_iq(#iq{type = set, lang = Lang, to = To, from = From,
|
||||
sub_els = [#register{remove = true,
|
||||
@ -270,7 +270,7 @@ try_register_or_set_password(User, Server, Password,
|
||||
xmpp:make_error(IQ, Error)
|
||||
end;
|
||||
deny ->
|
||||
Txt = <<"Denied by ACL">>,
|
||||
Txt = <<"Access denied by service policy">>,
|
||||
xmpp:make_error(IQ, xmpp:err_forbidden(Txt, Lang))
|
||||
end;
|
||||
_ ->
|
||||
@ -322,8 +322,8 @@ try_register(User, Server, Password, SourceRaw, Lang) ->
|
||||
case {acl:match_rule(Server, Access, JID),
|
||||
check_ip_access(SourceRaw, IPAccess)}
|
||||
of
|
||||
{deny, _} -> {error, xmpp:err_forbidden(<<"Denied by ACL">>, Lang)};
|
||||
{_, deny} -> {error, xmpp:err_forbidden(<<"Denied by ACL">>, Lang)};
|
||||
{deny, _} -> {error, xmpp:err_forbidden(<<"Access denied by service policy">>, Lang)};
|
||||
{_, deny} -> {error, xmpp:err_forbidden(<<"Access denied by service policy">>, Lang)};
|
||||
{allow, allow} ->
|
||||
Source = may_remove_resource(SourceRaw),
|
||||
case check_timeout(Source) of
|
||||
|
@ -184,7 +184,7 @@ process_local_iq(#iq{type = set, from = From, lang = Lang,
|
||||
Access = gen_mod:get_module_opt(Server, ?MODULE, access, all),
|
||||
case acl:match_rule(Server, Access, From) of
|
||||
deny ->
|
||||
Txt = <<"Denied by ACL">>,
|
||||
Txt = <<"Access denied by service policy">>,
|
||||
xmpp:make_error(IQ, xmpp:err_not_allowed(Txt, Lang));
|
||||
allow ->
|
||||
process_iq_set(IQ)
|
||||
|
@ -320,7 +320,7 @@ check_from_to(From, To) ->
|
||||
|
||||
-spec mk_error(term()) -> stanza_error().
|
||||
mk_error(forbidden) ->
|
||||
xmpp:err_forbidden(<<"Denied by ACL">>, ?MYLANG);
|
||||
xmpp:err_forbidden(<<"Access denied by service policy">>, ?MYLANG);
|
||||
mk_error(host_unknown) ->
|
||||
xmpp:err_not_allowed(<<"Host unknown">>, ?MYLANG);
|
||||
mk_error({codec_error, Why}) ->
|
||||
|
Loading…
Reference in New Issue
Block a user