mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
- pass jid into feature_check_packet hook;
- bounce messages when closing c2s session; - implemented treap:to_list/1 and treap:from_list/1
This commit is contained in:
parent
6d9094ceca
commit
d11a715eda
@ -1232,7 +1232,7 @@ handle_info({route, From, To, Packet}, StateName, StateData) ->
|
|||||||
case ejabberd_hooks:run_fold(
|
case ejabberd_hooks:run_fold(
|
||||||
feature_check_packet, StateData#state.server,
|
feature_check_packet, StateData#state.server,
|
||||||
allow,
|
allow,
|
||||||
[StateData#state.user,
|
[StateData#state.jid,
|
||||||
StateData#state.server,
|
StateData#state.server,
|
||||||
StateData#state.pres_last,
|
StateData#state.pres_last,
|
||||||
{From, To, Packet},
|
{From, To, Packet},
|
||||||
@ -1340,7 +1340,8 @@ terminate(_Reason, StateName, StateData) ->
|
|||||||
presence_broadcast(
|
presence_broadcast(
|
||||||
StateData, From, StateData#state.pres_i, Packet)
|
StateData, From, StateData#state.pres_i, Packet)
|
||||||
end
|
end
|
||||||
end;
|
end,
|
||||||
|
bounce_messages();
|
||||||
_ ->
|
_ ->
|
||||||
ok
|
ok
|
||||||
end,
|
end,
|
||||||
@ -2111,3 +2112,12 @@ fsm_limit_opts(Opts) ->
|
|||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
bounce_messages() ->
|
||||||
|
receive
|
||||||
|
{route, From, To, El} ->
|
||||||
|
ejabberd_router:route(From, To, El),
|
||||||
|
bounce_messages()
|
||||||
|
after 0 ->
|
||||||
|
ok
|
||||||
|
end.
|
||||||
|
@ -33,7 +33,9 @@
|
|||||||
get_root/1,
|
get_root/1,
|
||||||
lookup/2,
|
lookup/2,
|
||||||
is_empty/1,
|
is_empty/1,
|
||||||
fold/3]).
|
fold/3,
|
||||||
|
from_list/1,
|
||||||
|
to_list/1]).
|
||||||
|
|
||||||
empty() ->
|
empty() ->
|
||||||
nil.
|
nil.
|
||||||
@ -173,3 +175,20 @@ fold(F, Acc, {{_Hash, Key}, Priority, Value, Left, Right}) ->
|
|||||||
Acc1 = F({Key, Priority, Value}, Acc),
|
Acc1 = F({Key, Priority, Value}, Acc),
|
||||||
Acc2 = fold(F, Acc1, Left),
|
Acc2 = fold(F, Acc1, Left),
|
||||||
fold(F, Acc2, Right).
|
fold(F, Acc2, Right).
|
||||||
|
|
||||||
|
to_list(Tree) ->
|
||||||
|
to_list(Tree, []).
|
||||||
|
|
||||||
|
to_list(nil, Acc) ->
|
||||||
|
Acc;
|
||||||
|
to_list(Tree, Acc) ->
|
||||||
|
Root = get_root(Tree),
|
||||||
|
to_list(delete_root(Tree), [Root|Acc]).
|
||||||
|
|
||||||
|
from_list(List) ->
|
||||||
|
from_list(List, nil).
|
||||||
|
|
||||||
|
from_list([{Key, Priority, Value}|Tail], Tree) ->
|
||||||
|
from_list(Tail, insert(Key, Priority, Value, Tree));
|
||||||
|
from_list([], Tree) ->
|
||||||
|
Tree.
|
||||||
|
Loading…
Reference in New Issue
Block a user