mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-28 16:34:13 +01:00
Use ejabberd_router:route_error/4 wherever possible
This commit is contained in:
parent
4d6eb31264
commit
ca1b22bdd4
@ -87,14 +87,12 @@ process_iq(From, To, #iq{type = T, lang = Lang, sub_els = [El]} = Packet)
|
|||||||
From, To, Packet);
|
From, To, Packet);
|
||||||
[] ->
|
[] ->
|
||||||
Txt = <<"No module is handling this query">>,
|
Txt = <<"No module is handling this query">>,
|
||||||
Err = xmpp:make_error(
|
Err = xmpp:err_service_unavailable(Txt, Lang),
|
||||||
Packet,
|
ejabberd_router:route_error(To, From, Packet, Err)
|
||||||
xmpp:err_service_unavailable(Txt, Lang)),
|
|
||||||
ejabberd_router:route(To, From, Err)
|
|
||||||
end;
|
end;
|
||||||
process_iq(From, To, #iq{type = T} = Packet) when T == get; T == set ->
|
process_iq(From, To, #iq{type = T} = Packet) when T == get; T == set ->
|
||||||
Err = xmpp:make_error(Packet, xmpp:err_bad_request()),
|
Err = xmpp:err_bad_request(),
|
||||||
ejabberd_router:route(To, From, Err);
|
ejabberd_router:route_error(To, From, Packet, Err);
|
||||||
process_iq(From, To, #iq{type = T} = Packet) when T == result; T == error ->
|
process_iq(From, To, #iq{type = T} = Packet) when T == result; T == error ->
|
||||||
process_iq_reply(From, To, Packet).
|
process_iq_reply(From, To, Packet).
|
||||||
|
|
||||||
@ -186,9 +184,8 @@ bounce_resource_packet(_From, #jid{lresource = <<"">>},
|
|||||||
bounce_resource_packet(From, To, Packet) ->
|
bounce_resource_packet(From, To, Packet) ->
|
||||||
Lang = xmpp:get_lang(Packet),
|
Lang = xmpp:get_lang(Packet),
|
||||||
Txt = <<"No available resource found">>,
|
Txt = <<"No available resource found">>,
|
||||||
Err = xmpp:make_error(Packet,
|
Err = xmpp:err_item_not_found(Txt, Lang),
|
||||||
xmpp:err_item_not_found(Txt, Lang)),
|
ejabberd_router:route_error(To, From, Packet, Err),
|
||||||
ejabberd_router:route(To, From, Err),
|
|
||||||
stop.
|
stop.
|
||||||
|
|
||||||
%%====================================================================
|
%%====================================================================
|
||||||
|
@ -173,9 +173,8 @@ check_in_subscription(Acc, User, Server, _JID, _Type, _Reason) ->
|
|||||||
bounce_offline_message(From, To, Packet) ->
|
bounce_offline_message(From, To, Packet) ->
|
||||||
Lang = xmpp:get_lang(Packet),
|
Lang = xmpp:get_lang(Packet),
|
||||||
Txt = <<"User session not found">>,
|
Txt = <<"User session not found">>,
|
||||||
Err = xmpp:make_error(
|
Err = xmpp:err_service_unavailable(Txt, Lang),
|
||||||
Packet, xmpp:err_service_unavailable(Txt, Lang)),
|
ejabberd_router:route_error(To, From, Packet, Err),
|
||||||
ejabberd_router:route(To, From, Err),
|
|
||||||
stop.
|
stop.
|
||||||
|
|
||||||
-spec disconnect_removed_user(binary(), binary()) -> ok.
|
-spec disconnect_removed_user(binary(), binary()) -> ok.
|
||||||
@ -602,9 +601,8 @@ route_message(From, To, Packet, Type) ->
|
|||||||
ejabberd_hooks:run(offline_message_hook, LServer,
|
ejabberd_hooks:run(offline_message_hook, LServer,
|
||||||
[From, To, Packet]);
|
[From, To, Packet]);
|
||||||
false ->
|
false ->
|
||||||
Err = xmpp:make_error(Packet,
|
Err = xmpp:err_service_unavailable(),
|
||||||
xmpp:err_service_unavailable()),
|
ejabberd_router:route_error(To, From, Packet, Err)
|
||||||
ejabberd_router:route(To, From, Err)
|
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@ -724,14 +722,12 @@ process_iq(From, To, #iq{type = T, lang = Lang, sub_els = [El]} = Packet)
|
|||||||
From, To, Packet);
|
From, To, Packet);
|
||||||
[] ->
|
[] ->
|
||||||
Txt = <<"No module is handling this query">>,
|
Txt = <<"No module is handling this query">>,
|
||||||
Err = xmpp:make_error(
|
Err = xmpp:err_service_unavailable(Txt, Lang),
|
||||||
Packet,
|
ejabberd_router:route_error(To, From, Packet, Err)
|
||||||
xmpp:err_service_unavailable(Txt, Lang)),
|
|
||||||
ejabberd_router:route(To, From, Err)
|
|
||||||
end;
|
end;
|
||||||
process_iq(From, To, #iq{type = T} = Packet) when T == get; T == set ->
|
process_iq(From, To, #iq{type = T} = Packet) when T == get; T == set ->
|
||||||
Err = xmpp:make_error(Packet, xmpp:err_bad_request()),
|
Err = xmpp:err_bad_request(),
|
||||||
ejabberd_router:route(To, From, Err),
|
ejabberd_router:route_error(To, From, Packet, Err),
|
||||||
ok;
|
ok;
|
||||||
process_iq(_From, _To, #iq{}) ->
|
process_iq(_From, _To, #iq{}) ->
|
||||||
ok.
|
ok.
|
||||||
|
@ -147,7 +147,7 @@ process_iq(_Host, Module, Function, From, To, IQ0) ->
|
|||||||
[xmpp:pp(IQ), {E, {R, erlang:get_stacktrace()}}]),
|
[xmpp:pp(IQ), {E, {R, erlang:get_stacktrace()}}]),
|
||||||
Txt = <<"Module failed to handle the query">>,
|
Txt = <<"Module failed to handle the query">>,
|
||||||
Err = xmpp:err_internal_server_error(Txt, IQ#iq.lang),
|
Err = xmpp:err_internal_server_error(Txt, IQ#iq.lang),
|
||||||
ejabberd_router:route(To, From, xmpp:make_error(IQ, Err))
|
ejabberd_router:route_error(To, From, IQ, Err)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec process_iq(module(), atom(), iq()) -> ignore | iq().
|
-spec process_iq(module(), atom(), iq()) -> ignore | iq().
|
||||||
|
@ -601,10 +601,7 @@ announce_all(From, To, Packet) ->
|
|||||||
Access = get_access(Host),
|
Access = get_access(Host),
|
||||||
case acl:match_rule(Host, Access, From) of
|
case acl:match_rule(Host, Access, From) of
|
||||||
deny ->
|
deny ->
|
||||||
Lang = xmpp:get_lang(Packet),
|
route_forbidden_error(From, To, Packet);
|
||||||
Txt = <<"Denied by ACL">>,
|
|
||||||
Err = xmpp:make_error(Packet, xmpp:err_forbidden(Txt, Lang)),
|
|
||||||
ejabberd_router:route(To, From, Err);
|
|
||||||
allow ->
|
allow ->
|
||||||
Local = jid:make(To#jid.server),
|
Local = jid:make(To#jid.server),
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
@ -618,10 +615,7 @@ announce_all_hosts_all(From, To, Packet) ->
|
|||||||
Access = get_access(global),
|
Access = get_access(global),
|
||||||
case acl:match_rule(global, Access, From) of
|
case acl:match_rule(global, Access, From) of
|
||||||
deny ->
|
deny ->
|
||||||
Lang = xmpp:get_lang(Packet),
|
route_forbidden_error(From, To, Packet);
|
||||||
Txt = <<"Denied by ACL">>,
|
|
||||||
Err = xmpp:make_error(Packet, xmpp:err_forbidden(Txt, Lang)),
|
|
||||||
ejabberd_router:route(To, From, Err);
|
|
||||||
allow ->
|
allow ->
|
||||||
Local = jid:make(To#jid.server),
|
Local = jid:make(To#jid.server),
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
@ -636,10 +630,7 @@ announce_online(From, To, Packet) ->
|
|||||||
Access = get_access(Host),
|
Access = get_access(Host),
|
||||||
case acl:match_rule(Host, Access, From) of
|
case acl:match_rule(Host, Access, From) of
|
||||||
deny ->
|
deny ->
|
||||||
Lang = xmpp:get_lang(Packet),
|
route_forbidden_error(From, To, Packet);
|
||||||
Txt = <<"Denied by ACL">>,
|
|
||||||
Err = xmpp:make_error(Packet, xmpp:err_forbidden(Txt, Lang)),
|
|
||||||
ejabberd_router:route(To, From, Err);
|
|
||||||
allow ->
|
allow ->
|
||||||
announce_online1(ejabberd_sm:get_vh_session_list(Host),
|
announce_online1(ejabberd_sm:get_vh_session_list(Host),
|
||||||
To#jid.server,
|
To#jid.server,
|
||||||
@ -650,10 +641,7 @@ announce_all_hosts_online(From, To, Packet) ->
|
|||||||
Access = get_access(global),
|
Access = get_access(global),
|
||||||
case acl:match_rule(global, Access, From) of
|
case acl:match_rule(global, Access, From) of
|
||||||
deny ->
|
deny ->
|
||||||
Lang = xmpp:get_lang(Packet),
|
route_forbidden_error(From, To, Packet);
|
||||||
Txt = <<"Denied by ACL">>,
|
|
||||||
Err = xmpp:make_error(Packet, xmpp:err_forbidden(Txt, Lang)),
|
|
||||||
ejabberd_router:route(To, From, Err);
|
|
||||||
allow ->
|
allow ->
|
||||||
announce_online1(ejabberd_sm:dirty_get_sessions_list(),
|
announce_online1(ejabberd_sm:dirty_get_sessions_list(),
|
||||||
To#jid.server,
|
To#jid.server,
|
||||||
@ -673,10 +661,7 @@ announce_motd(From, To, Packet) ->
|
|||||||
Access = get_access(Host),
|
Access = get_access(Host),
|
||||||
case acl:match_rule(Host, Access, From) of
|
case acl:match_rule(Host, Access, From) of
|
||||||
deny ->
|
deny ->
|
||||||
Lang = xmpp:get_lang(Packet),
|
route_forbidden_error(From, To, Packet);
|
||||||
Txt = <<"Denied by ACL">>,
|
|
||||||
Err = xmpp:make_error(Packet, xmpp:err_forbidden(Txt, Lang)),
|
|
||||||
ejabberd_router:route(To, From, Err);
|
|
||||||
allow ->
|
allow ->
|
||||||
announce_motd(Host, Packet)
|
announce_motd(Host, Packet)
|
||||||
end.
|
end.
|
||||||
@ -685,10 +670,7 @@ announce_all_hosts_motd(From, To, Packet) ->
|
|||||||
Access = get_access(global),
|
Access = get_access(global),
|
||||||
case acl:match_rule(global, Access, From) of
|
case acl:match_rule(global, Access, From) of
|
||||||
deny ->
|
deny ->
|
||||||
Lang = xmpp:get_lang(Packet),
|
route_forbidden_error(From, To, Packet);
|
||||||
Txt = <<"Denied by ACL">>,
|
|
||||||
Err = xmpp:make_error(Packet, xmpp:err_forbidden(Txt, Lang)),
|
|
||||||
ejabberd_router:route(To, From, Err);
|
|
||||||
allow ->
|
allow ->
|
||||||
Hosts = ?MYHOSTS,
|
Hosts = ?MYHOSTS,
|
||||||
[announce_motd(Host, Packet) || Host <- Hosts]
|
[announce_motd(Host, Packet) || Host <- Hosts]
|
||||||
@ -707,10 +689,7 @@ announce_motd_update(From, To, Packet) ->
|
|||||||
Access = get_access(Host),
|
Access = get_access(Host),
|
||||||
case acl:match_rule(Host, Access, From) of
|
case acl:match_rule(Host, Access, From) of
|
||||||
deny ->
|
deny ->
|
||||||
Lang = xmpp:get_lang(Packet),
|
route_forbidden_error(From, To, Packet);
|
||||||
Txt = <<"Denied by ACL">>,
|
|
||||||
Err = xmpp:make_error(Packet, xmpp:err_forbidden(Txt, Lang)),
|
|
||||||
ejabberd_router:route(To, From, Err);
|
|
||||||
allow ->
|
allow ->
|
||||||
announce_motd_update(Host, Packet)
|
announce_motd_update(Host, Packet)
|
||||||
end.
|
end.
|
||||||
@ -719,10 +698,7 @@ announce_all_hosts_motd_update(From, To, Packet) ->
|
|||||||
Access = get_access(global),
|
Access = get_access(global),
|
||||||
case acl:match_rule(global, Access, From) of
|
case acl:match_rule(global, Access, From) of
|
||||||
deny ->
|
deny ->
|
||||||
Lang = xmpp:get_lang(Packet),
|
route_forbidden_error(From, To, Packet);
|
||||||
Txt = <<"Denied by ACL">>,
|
|
||||||
Err = xmpp:make_error(Packet, xmpp:err_forbidden(Txt, Lang)),
|
|
||||||
ejabberd_router:route(To, From, Err);
|
|
||||||
allow ->
|
allow ->
|
||||||
Hosts = ?MYHOSTS,
|
Hosts = ?MYHOSTS,
|
||||||
[announce_motd_update(Host, Packet) || Host <- Hosts]
|
[announce_motd_update(Host, Packet) || Host <- Hosts]
|
||||||
@ -738,10 +714,7 @@ announce_motd_delete(From, To, Packet) ->
|
|||||||
Access = get_access(Host),
|
Access = get_access(Host),
|
||||||
case acl:match_rule(Host, Access, From) of
|
case acl:match_rule(Host, Access, From) of
|
||||||
deny ->
|
deny ->
|
||||||
Lang = xmpp:get_lang(Packet),
|
route_forbidden_error(From, To, Packet);
|
||||||
Txt = <<"Denied by ACL">>,
|
|
||||||
Err = xmpp:make_error(Packet, xmpp:err_forbidden(Txt, Lang)),
|
|
||||||
ejabberd_router:route(To, From, Err);
|
|
||||||
allow ->
|
allow ->
|
||||||
announce_motd_delete(Host)
|
announce_motd_delete(Host)
|
||||||
end.
|
end.
|
||||||
@ -750,10 +723,7 @@ announce_all_hosts_motd_delete(From, To, Packet) ->
|
|||||||
Access = get_access(global),
|
Access = get_access(global),
|
||||||
case acl:match_rule(global, Access, From) of
|
case acl:match_rule(global, Access, From) of
|
||||||
deny ->
|
deny ->
|
||||||
Lang = xmpp:get_lang(Packet),
|
route_forbidden_error(From, To, Packet);
|
||||||
Txt = <<"Denied by ACL">>,
|
|
||||||
Err = xmpp:make_error(Packet, xmpp:err_forbidden(Txt, Lang)),
|
|
||||||
ejabberd_router:route(To, From, Err);
|
|
||||||
allow ->
|
allow ->
|
||||||
Hosts = ?MYHOSTS,
|
Hosts = ?MYHOSTS,
|
||||||
[announce_motd_delete(Host) || Host <- Hosts]
|
[announce_motd_delete(Host) || Host <- Hosts]
|
||||||
@ -827,6 +797,12 @@ get_access(Host) ->
|
|||||||
add_store_hint(El) ->
|
add_store_hint(El) ->
|
||||||
xmpp:set_subtag(El, #hint{type = store}).
|
xmpp:set_subtag(El, #hint{type = store}).
|
||||||
|
|
||||||
|
-spec route_forbidden_error(jid(), jid(), stanza()) -> ok.
|
||||||
|
route_forbidden_error(From, To, Packet) ->
|
||||||
|
Lang = xmpp:get_lang(Packet),
|
||||||
|
Err = xmpp:err_forbidden(<<"Denied by ACL">>, Lang),
|
||||||
|
ejabberd_router:route_error(To, From, Packet, Err).
|
||||||
|
|
||||||
%%-------------------------------------------------------------------------
|
%%-------------------------------------------------------------------------
|
||||||
export(LServer) ->
|
export(LServer) ->
|
||||||
Mod = gen_mod:db_mod(LServer, ?MODULE),
|
Mod = gen_mod:db_mod(LServer, ?MODULE),
|
||||||
|
@ -378,9 +378,8 @@ do_route1(Host, ServerHost, Access, _HistorySize, _RoomShaper,
|
|||||||
deny ->
|
deny ->
|
||||||
ErrText = <<"Only service administrators are allowed "
|
ErrText = <<"Only service administrators are allowed "
|
||||||
"to send service messages">>,
|
"to send service messages">>,
|
||||||
Err = xmpp:make_error(
|
Err = xmpp:err_forbidden(ErrText, Lang),
|
||||||
Packet, xmpp:err_forbidden(ErrText, Lang)),
|
ejabberd_router:route_error(To, From, Packet, Err)
|
||||||
ejabberd_router:route(To, From, Err)
|
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
do_route1(_Host, _ServerHost, _Access, _HistorySize, _RoomShaper,
|
do_route1(_Host, _ServerHost, _Access, _HistorySize, _RoomShaper,
|
||||||
@ -409,9 +408,8 @@ do_route1(Host, ServerHost, Access, HistorySize, RoomShaper,
|
|||||||
false ->
|
false ->
|
||||||
Lang = xmpp:get_lang(Packet),
|
Lang = xmpp:get_lang(Packet),
|
||||||
ErrText = <<"Room creation is denied by service policy">>,
|
ErrText = <<"Room creation is denied by service policy">>,
|
||||||
Err = xmpp:make_error(
|
Err = xmpp:err_forbidden(ErrText, Lang),
|
||||||
Packet, xmpp:err_forbidden(ErrText, Lang)),
|
ejabberd_router:route_error(To, From, Packet, Err)
|
||||||
ejabberd_router:route(To, From, Err)
|
|
||||||
end;
|
end;
|
||||||
false ->
|
false ->
|
||||||
Lang = xmpp:get_lang(Packet),
|
Lang = xmpp:get_lang(Packet),
|
||||||
|
@ -167,10 +167,8 @@ normal_state({route, From, <<"">>,
|
|||||||
shaper:update(Activity#activity.message_shaper, Size),
|
shaper:update(Activity#activity.message_shaper, Size),
|
||||||
if Activity#activity.message /= undefined ->
|
if Activity#activity.message /= undefined ->
|
||||||
ErrText = <<"Traffic rate limit is exceeded">>,
|
ErrText = <<"Traffic rate limit is exceeded">>,
|
||||||
Err = xmpp:make_error(
|
Err = xmpp:err_resource_constraint(ErrText, Lang),
|
||||||
Packet,
|
ejabberd_router:route_error(StateData#state.jid, From, Packet, Err),
|
||||||
xmpp:err_resource_constraint(ErrText, Lang)),
|
|
||||||
ejabberd_router:route(StateData#state.jid, From, Err),
|
|
||||||
{next_state, normal_state, StateData};
|
{next_state, normal_state, StateData};
|
||||||
Now >= Activity#activity.message_time + MinMessageInterval,
|
Now >= Activity#activity.message_time + MinMessageInterval,
|
||||||
MessageShaperInterval == 0 ->
|
MessageShaperInterval == 0 ->
|
||||||
@ -328,8 +326,8 @@ normal_state({route, From, <<"">>,
|
|||||||
end
|
end
|
||||||
catch _:{xmpp_codec, Why} ->
|
catch _:{xmpp_codec, Why} ->
|
||||||
ErrTxt = xmpp:format_error(Why),
|
ErrTxt = xmpp:format_error(Why),
|
||||||
Err = xmpp:make_error(IQ0, xmpp:err_bad_request(ErrTxt, Lang)),
|
Err = xmpp:err_bad_request(ErrTxt, Lang),
|
||||||
ejabberd_router:route(StateData#state.jid, From, Err)
|
ejabberd_router:route_error(StateData#state.jid, From, IQ0, Err)
|
||||||
end;
|
end;
|
||||||
normal_state({route, From, <<"">>, #iq{} = IQ}, StateData) ->
|
normal_state({route, From, <<"">>, #iq{} = IQ}, StateData) ->
|
||||||
Err = xmpp:err_bad_request(),
|
Err = xmpp:err_bad_request(),
|
||||||
@ -1821,9 +1819,8 @@ add_new_user(From, Nick, Packet, StateData) ->
|
|||||||
{false, _, _, _} when NUsers >= MaxUsers orelse NUsers >= MaxAdminUsers ->
|
{false, _, _, _} when NUsers >= MaxUsers orelse NUsers >= MaxAdminUsers ->
|
||||||
Txt = <<"Too many users in this conference">>,
|
Txt = <<"Too many users in this conference">>,
|
||||||
Err = xmpp:err_resource_constraint(Txt, Lang),
|
Err = xmpp:err_resource_constraint(Txt, Lang),
|
||||||
ErrPacket = xmpp:make_error(Packet, Err),
|
|
||||||
if not IsSubscribeRequest ->
|
if not IsSubscribeRequest ->
|
||||||
ejabberd_router:route(UserRoomJID, From, ErrPacket),
|
ejabberd_router:route_error(UserRoomJID, From, Packet, Err),
|
||||||
StateData;
|
StateData;
|
||||||
true ->
|
true ->
|
||||||
{error, Err}
|
{error, Err}
|
||||||
@ -1831,18 +1828,16 @@ add_new_user(From, Nick, Packet, StateData) ->
|
|||||||
{false, _, _, _} when NConferences >= MaxConferences ->
|
{false, _, _, _} when NConferences >= MaxConferences ->
|
||||||
Txt = <<"You have joined too many conferences">>,
|
Txt = <<"You have joined too many conferences">>,
|
||||||
Err = xmpp:err_resource_constraint(Txt, Lang),
|
Err = xmpp:err_resource_constraint(Txt, Lang),
|
||||||
ErrPacket = xmpp:make_error(Packet, Err),
|
|
||||||
if not IsSubscribeRequest ->
|
if not IsSubscribeRequest ->
|
||||||
ejabberd_router:route(UserRoomJID, From, ErrPacket),
|
ejabberd_router:route_error(UserRoomJID, From, Packet, Err),
|
||||||
StateData;
|
StateData;
|
||||||
true ->
|
true ->
|
||||||
{error, Err}
|
{error, Err}
|
||||||
end;
|
end;
|
||||||
{false, _, _, _} ->
|
{false, _, _, _} ->
|
||||||
Err = xmpp:err_service_unavailable(),
|
Err = xmpp:err_service_unavailable(),
|
||||||
ErrPacket = xmpp:make_error(Packet, Err),
|
|
||||||
if not IsSubscribeRequest ->
|
if not IsSubscribeRequest ->
|
||||||
ejabberd_router:route(UserRoomJID, From, ErrPacket),
|
ejabberd_router:route_error(UserRoomJID, From, Packet, Err),
|
||||||
StateData;
|
StateData;
|
||||||
true ->
|
true ->
|
||||||
{error, Err}
|
{error, Err}
|
||||||
@ -1856,9 +1851,8 @@ add_new_user(From, Nick, Packet, StateData) ->
|
|||||||
ErrText = <<"Membership is required to enter this room">>,
|
ErrText = <<"Membership is required to enter this room">>,
|
||||||
xmpp:err_registration_required(ErrText, Lang)
|
xmpp:err_registration_required(ErrText, Lang)
|
||||||
end,
|
end,
|
||||||
ErrPacket = xmpp:make_error(Packet, Err),
|
|
||||||
if not IsSubscribeRequest ->
|
if not IsSubscribeRequest ->
|
||||||
ejabberd_router:route(UserRoomJID, From, ErrPacket),
|
ejabberd_router:route_error(UserRoomJID, From, Packet, Err),
|
||||||
StateData;
|
StateData;
|
||||||
true ->
|
true ->
|
||||||
{error, Err}
|
{error, Err}
|
||||||
@ -1866,9 +1860,8 @@ add_new_user(From, Nick, Packet, StateData) ->
|
|||||||
{_, true, _, _} ->
|
{_, true, _, _} ->
|
||||||
ErrText = <<"That nickname is already in use by another occupant">>,
|
ErrText = <<"That nickname is already in use by another occupant">>,
|
||||||
Err = xmpp:err_conflict(ErrText, Lang),
|
Err = xmpp:err_conflict(ErrText, Lang),
|
||||||
ErrPacket = xmpp:make_error(Packet, Err),
|
|
||||||
if not IsSubscribeRequest ->
|
if not IsSubscribeRequest ->
|
||||||
ejabberd_router:route(UserRoomJID, From, ErrPacket),
|
ejabberd_router:route_error(UserRoomJID, From, Packet, Err),
|
||||||
StateData;
|
StateData;
|
||||||
true ->
|
true ->
|
||||||
{error, Err}
|
{error, Err}
|
||||||
@ -1876,9 +1869,8 @@ add_new_user(From, Nick, Packet, StateData) ->
|
|||||||
{_, _, false, _} ->
|
{_, _, false, _} ->
|
||||||
ErrText = <<"That nickname is registered by another person">>,
|
ErrText = <<"That nickname is registered by another person">>,
|
||||||
Err = xmpp:err_conflict(ErrText, Lang),
|
Err = xmpp:err_conflict(ErrText, Lang),
|
||||||
ErrPacket = xmpp:make_error(Packet, Err),
|
|
||||||
if not IsSubscribeRequest ->
|
if not IsSubscribeRequest ->
|
||||||
ejabberd_router:route(UserRoomJID, From, ErrPacket),
|
ejabberd_router:route_error(UserRoomJID, From, Packet, Err),
|
||||||
StateData;
|
StateData;
|
||||||
true ->
|
true ->
|
||||||
{error, Err}
|
{error, Err}
|
||||||
@ -1918,9 +1910,8 @@ add_new_user(From, Nick, Packet, StateData) ->
|
|||||||
nopass ->
|
nopass ->
|
||||||
ErrText = <<"A password is required to enter this room">>,
|
ErrText = <<"A password is required to enter this room">>,
|
||||||
Err = xmpp:err_not_authorized(ErrText, Lang),
|
Err = xmpp:err_not_authorized(ErrText, Lang),
|
||||||
ErrPacket = xmpp:make_error(Packet, Err),
|
|
||||||
if not IsSubscribeRequest ->
|
if not IsSubscribeRequest ->
|
||||||
ejabberd_router:route(UserRoomJID, From, ErrPacket),
|
ejabberd_router:route_error(UserRoomJID, From, Packet, Err),
|
||||||
StateData;
|
StateData;
|
||||||
true ->
|
true ->
|
||||||
{error, Err}
|
{error, Err}
|
||||||
@ -1948,9 +1939,9 @@ add_new_user(From, Nick, Packet, StateData) ->
|
|||||||
{error, limit} ->
|
{error, limit} ->
|
||||||
ErrText = <<"Too many CAPTCHA requests">>,
|
ErrText = <<"Too many CAPTCHA requests">>,
|
||||||
Err = xmpp:err_resource_constraint(ErrText, Lang),
|
Err = xmpp:err_resource_constraint(ErrText, Lang),
|
||||||
ErrPacket = xmpp:make_error(Packet, Err),
|
|
||||||
if not IsSubscribeRequest ->
|
if not IsSubscribeRequest ->
|
||||||
ejabberd_router:route(UserRoomJID, From, ErrPacket),
|
ejabberd_router:route_error(
|
||||||
|
UserRoomJID, From, Packet, Err),
|
||||||
StateData;
|
StateData;
|
||||||
true ->
|
true ->
|
||||||
{error, Err}
|
{error, Err}
|
||||||
@ -1958,9 +1949,9 @@ add_new_user(From, Nick, Packet, StateData) ->
|
|||||||
_ ->
|
_ ->
|
||||||
ErrText = <<"Unable to generate a CAPTCHA">>,
|
ErrText = <<"Unable to generate a CAPTCHA">>,
|
||||||
Err = xmpp:err_internal_server_error(ErrText, Lang),
|
Err = xmpp:err_internal_server_error(ErrText, Lang),
|
||||||
ErrPacket = xmpp:make_error(Packet, Err),
|
|
||||||
if not IsSubscribeRequest ->
|
if not IsSubscribeRequest ->
|
||||||
ejabberd_router:route(UserRoomJID, From, ErrPacket),
|
ejabberd_router:route_error(
|
||||||
|
UserRoomJID, From, Packet, Err),
|
||||||
StateData;
|
StateData;
|
||||||
true ->
|
true ->
|
||||||
{error, Err}
|
{error, Err}
|
||||||
@ -1969,9 +1960,9 @@ add_new_user(From, Nick, Packet, StateData) ->
|
|||||||
_ ->
|
_ ->
|
||||||
ErrText = <<"Incorrect password">>,
|
ErrText = <<"Incorrect password">>,
|
||||||
Err = xmpp:err_not_authorized(ErrText, Lang),
|
Err = xmpp:err_not_authorized(ErrText, Lang),
|
||||||
ErrPacket = xmpp:make_error(Packet, Err),
|
|
||||||
if not IsSubscribeRequest ->
|
if not IsSubscribeRequest ->
|
||||||
ejabberd_router:route(UserRoomJID, From, ErrPacket),
|
ejabberd_router:route_error(
|
||||||
|
UserRoomJID, From, Packet, Err),
|
||||||
StateData;
|
StateData;
|
||||||
true ->
|
true ->
|
||||||
{error, Err}
|
{error, Err}
|
||||||
|
@ -623,9 +623,8 @@ discard_warn_sender(Msgs) ->
|
|||||||
ErrText = <<"Your contact offline message queue is "
|
ErrText = <<"Your contact offline message queue is "
|
||||||
"full. The message has been discarded.">>,
|
"full. The message has been discarded.">>,
|
||||||
Lang = xmpp:get_lang(Packet),
|
Lang = xmpp:get_lang(Packet),
|
||||||
Err = xmpp:make_error(
|
Err = xmpp:err_resource_constraint(ErrText, Lang),
|
||||||
Packet, xmpp:err_resource_constraint(ErrText, Lang)),
|
ejabberd_router:route_error(To, From, Packet, Err)
|
||||||
ejabberd_router:route(To, From, Err)
|
|
||||||
end, Msgs).
|
end, Msgs).
|
||||||
|
|
||||||
webadmin_page(_, Host,
|
webadmin_page(_, Host,
|
||||||
|
Loading…
Reference in New Issue
Block a user