25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

Fixed broadcast messages handling

This commit is contained in:
Alexey Shchepin 2013-06-17 16:41:02 +03:00
parent 862a08e9eb
commit 62fb432e3e
2 changed files with 33 additions and 12 deletions

View File

@ -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]),

View File

@ -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,
#userlist{name = Name,
list = []},
Name}]}),
{broadcast,
{privacy_list,
#userlist{name = Name,
list = []},
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,
#userlist{name = Name,
list = List,
needdb = NeedDb},
Name}]}),
{broadcast,
{privacy_list,
#userlist{name = Name,
list = List,
needdb = NeedDb},
Name}}),
{result, []};
_ -> {error, ?ERR_INTERNAL_SERVER_ERROR}
end