mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-26 17:38:45 +01:00
Merge pull request #540 from weiss/queue-error-stanza
Add privacy error stanza to XEP-0198 queue
This commit is contained in:
commit
28090a3958
@ -1292,15 +1292,13 @@ session_established2(El, StateData) ->
|
|||||||
ejabberd_hooks:run(user_send_packet, Server,
|
ejabberd_hooks:run(user_send_packet, Server,
|
||||||
[FromJID, ToJID, NewEl]),
|
[FromJID, ToJID, NewEl]),
|
||||||
check_privacy_route(FromJID, NewStateData,
|
check_privacy_route(FromJID, NewStateData,
|
||||||
FromJID, ToJID, NewEl),
|
FromJID, ToJID, NewEl)
|
||||||
NewStateData
|
|
||||||
end;
|
end;
|
||||||
<<"message">> ->
|
<<"message">> ->
|
||||||
ejabberd_hooks:run(user_send_packet, Server,
|
ejabberd_hooks:run(user_send_packet, Server,
|
||||||
[FromJID, ToJID, NewEl]),
|
[FromJID, ToJID, NewEl]),
|
||||||
check_privacy_route(FromJID, NewStateData, FromJID,
|
check_privacy_route(FromJID, NewStateData, FromJID,
|
||||||
ToJID, NewEl),
|
ToJID, NewEl);
|
||||||
NewStateData;
|
|
||||||
_ -> NewStateData
|
_ -> NewStateData
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -2138,37 +2136,29 @@ presence_track(From, To, Packet, StateData) ->
|
|||||||
Server = StateData#state.server,
|
Server = StateData#state.server,
|
||||||
case xml:get_attr_s(<<"type">>, Attrs) of
|
case xml:get_attr_s(<<"type">>, Attrs) of
|
||||||
<<"unavailable">> ->
|
<<"unavailable">> ->
|
||||||
check_privacy_route(From, StateData, From, To, Packet),
|
|
||||||
A = remove_element(LTo, StateData#state.pres_a),
|
A = remove_element(LTo, StateData#state.pres_a),
|
||||||
StateData#state{pres_a = A};
|
check_privacy_route(From, StateData#state{pres_a = A}, From, To, Packet);
|
||||||
<<"subscribe">> ->
|
<<"subscribe">> ->
|
||||||
try_roster_subscribe(subscribe, User, Server, From, To, Packet, StateData),
|
try_roster_subscribe(subscribe, User, Server, From, To, Packet, StateData);
|
||||||
StateData;
|
|
||||||
<<"subscribed">> ->
|
<<"subscribed">> ->
|
||||||
ejabberd_hooks:run(roster_out_subscription, Server,
|
ejabberd_hooks:run(roster_out_subscription, Server,
|
||||||
[User, Server, To, subscribed]),
|
[User, Server, To, subscribed]),
|
||||||
check_privacy_route(From, StateData,
|
check_privacy_route(From, StateData,
|
||||||
jlib:jid_remove_resource(From), To, Packet),
|
jlib:jid_remove_resource(From), To, Packet);
|
||||||
StateData;
|
|
||||||
<<"unsubscribe">> ->
|
<<"unsubscribe">> ->
|
||||||
try_roster_subscribe(unsubscribe, User, Server, From, To, Packet, StateData),
|
try_roster_subscribe(unsubscribe, User, Server, From, To, Packet, StateData);
|
||||||
StateData;
|
|
||||||
<<"unsubscribed">> ->
|
<<"unsubscribed">> ->
|
||||||
ejabberd_hooks:run(roster_out_subscription, Server,
|
ejabberd_hooks:run(roster_out_subscription, Server,
|
||||||
[User, Server, To, unsubscribed]),
|
[User, Server, To, unsubscribed]),
|
||||||
check_privacy_route(From, StateData,
|
check_privacy_route(From, StateData,
|
||||||
jlib:jid_remove_resource(From), To, Packet),
|
jlib:jid_remove_resource(From), To, Packet);
|
||||||
StateData;
|
|
||||||
<<"error">> ->
|
<<"error">> ->
|
||||||
check_privacy_route(From, StateData, From, To, Packet),
|
check_privacy_route(From, StateData, From, To, Packet);
|
||||||
StateData;
|
|
||||||
<<"probe">> ->
|
<<"probe">> ->
|
||||||
check_privacy_route(From, StateData, From, To, Packet),
|
check_privacy_route(From, StateData, From, To, Packet);
|
||||||
StateData;
|
|
||||||
_ ->
|
_ ->
|
||||||
check_privacy_route(From, StateData, From, To, Packet),
|
|
||||||
A = (?SETS):add_element(LTo, StateData#state.pres_a),
|
A = (?SETS):add_element(LTo, StateData#state.pres_a),
|
||||||
StateData#state{pres_a = A}
|
check_privacy_route(From, StateData#state{pres_a = A}, From, To, Packet)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
check_privacy_route(From, StateData, FromRoute, To,
|
check_privacy_route(From, StateData, FromRoute, To,
|
||||||
@ -2183,9 +2173,10 @@ check_privacy_route(From, StateData, FromRoute, To,
|
|||||||
Err = jlib:make_error_reply(Packet,
|
Err = jlib:make_error_reply(Packet,
|
||||||
?ERRT_NOT_ACCEPTABLE(Lang, ErrText)),
|
?ERRT_NOT_ACCEPTABLE(Lang, ErrText)),
|
||||||
Err2 = jlib:replace_from_to(To, From, Err),
|
Err2 = jlib:replace_from_to(To, From, Err),
|
||||||
send_element(StateData, Err2),
|
send_stanza(StateData, Err2);
|
||||||
ok;
|
allow ->
|
||||||
allow -> ejabberd_router:route(FromRoute, To, Packet)
|
ejabberd_router:route(FromRoute, To, Packet),
|
||||||
|
StateData
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% Check if privacy rules allow this delivery
|
%% Check if privacy rules allow this delivery
|
||||||
@ -2208,7 +2199,7 @@ try_roster_subscribe(Type, User, Server, From, To, Packet, StateData) ->
|
|||||||
case acl:match_rule(Server, Access, JID1) of
|
case acl:match_rule(Server, Access, JID1) of
|
||||||
deny ->
|
deny ->
|
||||||
%% Silently drop this (un)subscription request
|
%% Silently drop this (un)subscription request
|
||||||
ok;
|
StateData;
|
||||||
allow ->
|
allow ->
|
||||||
ejabberd_hooks:run(roster_out_subscription,
|
ejabberd_hooks:run(roster_out_subscription,
|
||||||
Server,
|
Server,
|
||||||
|
Loading…
Reference in New Issue
Block a user