mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-20 16:15:59 +01:00
Fixed broadcast messages handling
This commit is contained in:
parent
862a08e9eb
commit
62fb432e3e
@ -455,7 +455,28 @@ recount_session_table(Node) ->
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
do_route(From, To, Packet) ->
|
||||
do_route(From, To, {broadcast, _} = Packet) ->
|
||||
case To#jid.lresource of
|
||||
<<"">> ->
|
||||
lists:foreach(fun(R) ->
|
||||
do_route(From,
|
||||
jlib:jid_replace_resource(To, R),
|
||||
Packet)
|
||||
end,
|
||||
get_user_resources(To#jid.user, To#jid.server));
|
||||
_ ->
|
||||
USR = jlib:jid_tolower(To),
|
||||
case mnesia:dirty_index_read(session, USR, #session.usr) of
|
||||
[] ->
|
||||
?DEBUG("packet dropped~n", []);
|
||||
Ss ->
|
||||
Session = lists:max(Ss),
|
||||
Pid = element(2, Session#session.sid),
|
||||
?DEBUG("sending to process ~p~n", [Pid]),
|
||||
Pid ! {route, From, To, Packet}
|
||||
end
|
||||
end;
|
||||
do_route(From, To, #xmlel{} = Packet) ->
|
||||
?DEBUG("session manager~n\tfrom ~p~n\tto ~p~n\tpacket "
|
||||
"~P~n",
|
||||
[From, To, Packet, 8]),
|
||||
|
@ -494,11 +494,11 @@ process_list_set(LUser, LServer, {value, Name}, Els) ->
|
||||
ejabberd_sm:route(jlib:make_jid(LUser, LServer,
|
||||
<<"">>),
|
||||
jlib:make_jid(LUser, LServer, <<"">>),
|
||||
#xmlel{name = <<"broadcast">>, children =
|
||||
[{privacy_list,
|
||||
{broadcast,
|
||||
{privacy_list,
|
||||
#userlist{name = Name,
|
||||
list = []},
|
||||
Name}]}),
|
||||
Name}}),
|
||||
{result, []};
|
||||
_ -> {error, ?ERR_INTERNAL_SERVER_ERROR}
|
||||
end;
|
||||
@ -511,12 +511,12 @@ process_list_set(LUser, LServer, {value, Name}, Els) ->
|
||||
ejabberd_sm:route(jlib:make_jid(LUser, LServer,
|
||||
<<"">>),
|
||||
jlib:make_jid(LUser, LServer, <<"">>),
|
||||
#xmlel{name = <<"broadcast">>, children =
|
||||
[{privacy_list,
|
||||
{broadcast,
|
||||
{privacy_list,
|
||||
#userlist{name = Name,
|
||||
list = List,
|
||||
needdb = NeedDb},
|
||||
Name}]}),
|
||||
Name}}),
|
||||
{result, []};
|
||||
_ -> {error, ?ERR_INTERNAL_SERVER_ERROR}
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user