mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
When getting list of subscribed rooms, check all including temporary ones (#1242)
This commit is contained in:
parent
9fa92092bf
commit
5bcfcf4c5e
@ -718,13 +718,12 @@ get_vh_rooms(Host, #rsm_in{max=M, direction=Direction, id=I, index=Index})->
|
|||||||
index = NewIndex}}
|
index = NewIndex}}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
get_subscribed_rooms(ServerHost, Host, From) ->
|
get_subscribed_rooms(_ServerHost, Host1, From) ->
|
||||||
Rooms = get_rooms(ServerHost, Host),
|
Rooms = get_vh_rooms(Host1),
|
||||||
BareFrom = jid:remove_resource(From),
|
BareFrom = jid:remove_resource(From),
|
||||||
lists:flatmap(
|
lists:flatmap(
|
||||||
fun(#muc_room{name_host = {Name, _}, opts = Opts}) ->
|
fun(#muc_online_room{name_host = {Name, Host}, pid = Pid}) ->
|
||||||
Subscribers = proplists:get_value(subscribers, Opts, []),
|
case gen_fsm:sync_send_all_state_event(Pid, {is_subscribed, BareFrom}) of
|
||||||
case lists:keymember(BareFrom, 1, Subscribers) of
|
|
||||||
true -> [jid:make(Name, Host, <<>>)];
|
true -> [jid:make(Name, Host, <<>>)];
|
||||||
false -> []
|
false -> []
|
||||||
end;
|
end;
|
||||||
|
@ -800,6 +800,9 @@ handle_sync_event({muc_unsubscribe, From}, _From, StateName, StateData) ->
|
|||||||
{error, Err} ->
|
{error, Err} ->
|
||||||
{reply, {error, get_error_text(Err)}, StateName, StateData}
|
{reply, {error, get_error_text(Err)}, StateName, StateData}
|
||||||
end;
|
end;
|
||||||
|
handle_sync_event({is_subscribed, From}, _From, StateName, StateData) ->
|
||||||
|
IsSubs = ?DICT:is_key(jid:split(From), StateData#state.subscribers),
|
||||||
|
{reply, IsSubs, StateName, StateData};
|
||||||
handle_sync_event(_Event, _From, StateName,
|
handle_sync_event(_Event, _From, StateName,
|
||||||
StateData) ->
|
StateData) ->
|
||||||
Reply = ok, {reply, Reply, StateName, StateData}.
|
Reply = ok, {reply, Reply, StateName, StateData}.
|
||||||
|
Loading…
Reference in New Issue
Block a user