]> granicus.if.org Git - ejabberd/commitdiff
Revert "Fix getting of subscribed rooms: consider also temporary ones (#1242)"
authorBadlop <badlop@process-one.net>
Mon, 19 Sep 2016 10:54:19 +0000 (12:54 +0200)
committerBadlop <badlop@process-one.net>
Mon, 19 Sep 2016 10:54:19 +0000 (12:54 +0200)
This reverts commit f2cc81dfead352d4e8c4b3f546d1c2d734076c5c.

src/mod_muc.erl
src/mod_muc_room.erl

index ad2be4cce48e3626ad5ab4e9bbdcc8541208beed..4eb129a8785e4e0d14ea8c80f19c9e9d3c564075 100644 (file)
@@ -718,12 +718,13 @@ get_vh_rooms(Host, #rsm_in{max=M, direction=Direction, id=I, index=Index})->
                     index = NewIndex}}
     end.
 
-get_subscribed_rooms(_ServerHost, Host1, From) ->
-    Rooms = get_vh_rooms(Host1),
+get_subscribed_rooms(ServerHost, Host, From) ->
+    Rooms = get_rooms(ServerHost, Host),
     BareFrom = jid:remove_resource(From),
     lists:flatmap(
-      fun(#muc_online_room{name_host = {Name, Host}, pid = Pid}) ->
-             case gen_fsm:sync_send_all_state_event(Pid, {is_subscribed, BareFrom}) of
+      fun(#muc_room{name_host = {Name, _}, opts = Opts}) ->
+             Subscribers = proplists:get_value(subscribers, Opts, []),
+             case lists:keymember(BareFrom, 1, Subscribers) of
                  true -> [jid:make(Name, Host, <<>>)];
                  false -> []
              end;
index 8e338b6765894d21292cbebc87e278a6281654ce..5aceb94c17c31d7a8d9763aa44fcb8f32697ae30 100644 (file)
@@ -800,14 +800,6 @@ handle_sync_event({muc_unsubscribe, From}, _From, StateName, StateData) ->
        {error, Err} ->
            {reply, {error, get_error_text(Err)}, StateName, StateData}
     end;
-handle_sync_event({is_subscribed, From}, _From, StateName, StateData) ->
-    Subscribers = (?DICT):fold(
-                   fun(_LJID, #user{is_subscriber = true} = User, Acc) ->
-                           [User#user.jid | Acc];
-                      (_, _, Acc) ->
-                           Acc
-                   end, [], StateData#state.users),
-    {reply, lists:member(From, Subscribers), StateName, StateData};
 handle_sync_event(_Event, _From, StateName,
                  StateData) ->
     Reply = ok, {reply, Reply, StateName, StateData}.