mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-26 17:38:45 +01:00
Fix conference disco#items when running multiple virtual hosts
This commit is contained in:
parent
507e756b69
commit
274303f248
@ -639,26 +639,26 @@ iq_disco_items(_Host, _From, Lang, _MaxRoomsDiscoItems, _Node, _RSM) ->
|
|||||||
get_vh_rooms(Host, Query,
|
get_vh_rooms(Host, Query,
|
||||||
#rsm_set{max = Max, 'after' = After, before = undefined})
|
#rsm_set{max = Max, 'after' = After, before = undefined})
|
||||||
when is_binary(After), After /= <<"">> ->
|
when is_binary(After), After /= <<"">> ->
|
||||||
lists:reverse(get_vh_rooms(next, {After, Host}, Query, 0, Max, []));
|
lists:reverse(get_vh_rooms(next, {After, Host}, Host, Query, 0, Max, []));
|
||||||
get_vh_rooms(Host, Query,
|
get_vh_rooms(Host, Query,
|
||||||
#rsm_set{max = Max, 'after' = undefined, before = Before})
|
#rsm_set{max = Max, 'after' = undefined, before = Before})
|
||||||
when is_binary(Before), Before /= <<"">> ->
|
when is_binary(Before), Before /= <<"">> ->
|
||||||
get_vh_rooms(prev, {Before, Host}, Query, 0, Max, []);
|
get_vh_rooms(prev, {Before, Host}, Host, Query, 0, Max, []);
|
||||||
get_vh_rooms(Host, Query,
|
get_vh_rooms(Host, Query,
|
||||||
#rsm_set{max = Max, 'after' = undefined, before = <<"">>}) ->
|
#rsm_set{max = Max, 'after' = undefined, before = <<"">>}) ->
|
||||||
get_vh_rooms(last, {<<"">>, Host}, Query, 0, Max, []);
|
get_vh_rooms(last, {<<"">>, Host}, Host, Query, 0, Max, []);
|
||||||
get_vh_rooms(Host, Query, #rsm_set{max = Max}) ->
|
get_vh_rooms(Host, Query, #rsm_set{max = Max}) ->
|
||||||
lists:reverse(get_vh_rooms(first, {<<"">>, Host}, Query, 0, Max, []));
|
lists:reverse(get_vh_rooms(first, {<<"">>, Host}, Host, Query, 0, Max, []));
|
||||||
get_vh_rooms(Host, Query, undefined) ->
|
get_vh_rooms(Host, Query, undefined) ->
|
||||||
lists:reverse(get_vh_rooms(first, {<<"">>, Host}, Query, 0, undefined, [])).
|
lists:reverse(get_vh_rooms(first, {<<"">>, Host}, Host, Query, 0, undefined, [])).
|
||||||
|
|
||||||
-spec get_vh_rooms(prev | next | last | first,
|
-spec get_vh_rooms(prev | next | last | first,
|
||||||
{binary(), binary()}, term(),
|
{binary(), binary()}, binary(), term(),
|
||||||
non_neg_integer(), non_neg_integer() | undefined,
|
non_neg_integer(), non_neg_integer() | undefined,
|
||||||
[disco_item()]) -> [disco_item()].
|
[disco_item()]) -> [disco_item()].
|
||||||
get_vh_rooms(_Action, _Key, _Query, Count, Max, Items) when Count >= Max ->
|
get_vh_rooms(_Action, _Key, _Host, _Query, Count, Max, Items) when Count >= Max ->
|
||||||
Items;
|
Items;
|
||||||
get_vh_rooms(Action, {_, Host} = Key, Query, Count, Max, Items) ->
|
get_vh_rooms(Action, Key, Host, Query, Count, Max, Items) ->
|
||||||
Call = fun() ->
|
Call = fun() ->
|
||||||
case Action of
|
case Action of
|
||||||
prev -> mnesia:dirty_prev(muc_online_room, Key);
|
prev -> mnesia:dirty_prev(muc_online_room, Key);
|
||||||
@ -678,14 +678,14 @@ get_vh_rooms(Action, {_, Host} = Key, Query, Count, Max, Items) ->
|
|||||||
{_, Host} = NewKey ->
|
{_, Host} = NewKey ->
|
||||||
case get_room_disco_item(NewKey, Query) of
|
case get_room_disco_item(NewKey, Query) of
|
||||||
{ok, Item} ->
|
{ok, Item} ->
|
||||||
get_vh_rooms(NewAction, NewKey, Query,
|
get_vh_rooms(NewAction, NewKey, Host, Query,
|
||||||
Count + 1, Max, [Item|Items]);
|
Count + 1, Max, [Item|Items]);
|
||||||
{error, _} ->
|
{error, _} ->
|
||||||
get_vh_rooms(NewAction, NewKey, Query,
|
get_vh_rooms(NewAction, NewKey, Host, Query,
|
||||||
Count, Max, Items)
|
Count, Max, Items)
|
||||||
end;
|
end;
|
||||||
NewKey ->
|
NewKey ->
|
||||||
get_vh_rooms(NewAction, NewKey, Query, Count, Max, Items)
|
get_vh_rooms(NewAction, NewKey, Host, Query, Count, Max, Items)
|
||||||
catch _:{aborted, {badarg, _}} ->
|
catch _:{aborted, {badarg, _}} ->
|
||||||
Items
|
Items
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user