mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
Store muc_subscribers in process dict if get_subscribed_rooms not available
This commit is contained in:
parent
8b300d734b
commit
7b35690bc9
@ -540,7 +540,13 @@ handle_sync_event({change_config, Config}, _From,
|
|||||||
{reply, {ok, NSD#state.config}, StateName, NSD};
|
{reply, {ok, NSD#state.config}, StateName, NSD};
|
||||||
handle_sync_event({change_state, NewStateData}, _From,
|
handle_sync_event({change_state, NewStateData}, _From,
|
||||||
StateName, _StateData) ->
|
StateName, _StateData) ->
|
||||||
erlang:put(muc_subscribers, NewStateData#state.subscribers),
|
Mod = gen_mod:db_mod(NewStateData#state.server_host, mod_muc),
|
||||||
|
case erlang:function_exported(Mod, get_subscribed_rooms, 3) of
|
||||||
|
true ->
|
||||||
|
ok;
|
||||||
|
_ ->
|
||||||
|
erlang:put(muc_subscribers, NewStateData#state.subscribers)
|
||||||
|
end,
|
||||||
{reply, {ok, NewStateData}, StateName, NewStateData};
|
{reply, {ok, NewStateData}, StateName, NewStateData};
|
||||||
handle_sync_event({process_item_change, Item, UJID}, _From, StateName, StateData) ->
|
handle_sync_event({process_item_change, Item, UJID}, _From, StateName, StateData) ->
|
||||||
case process_item_change(Item, StateData, UJID) of
|
case process_item_change(Item, StateData, UJID) of
|
||||||
@ -4367,7 +4373,14 @@ store_room(StateData) ->
|
|||||||
store_room(StateData, []).
|
store_room(StateData, []).
|
||||||
store_room(StateData, ChangesHints) ->
|
store_room(StateData, ChangesHints) ->
|
||||||
% Let store persistent rooms or on those backends that have get_subscribed_rooms
|
% Let store persistent rooms or on those backends that have get_subscribed_rooms
|
||||||
erlang:put(muc_subscribers, StateData#state.subscribers),
|
Mod = gen_mod:db_mod(StateData#state.server_host, mod_muc),
|
||||||
|
HasGSR = erlang:function_exported(Mod, get_subscribed_rooms, 3),
|
||||||
|
case HasGSR of
|
||||||
|
true ->
|
||||||
|
ok;
|
||||||
|
_ ->
|
||||||
|
erlang:put(muc_subscribers, StateData#state.subscribers)
|
||||||
|
end,
|
||||||
ShouldStore = case (StateData#state.config)#config.persistent of
|
ShouldStore = case (StateData#state.config)#config.persistent of
|
||||||
true ->
|
true ->
|
||||||
true;
|
true;
|
||||||
@ -4376,8 +4389,7 @@ store_room(StateData, ChangesHints) ->
|
|||||||
[] ->
|
[] ->
|
||||||
false;
|
false;
|
||||||
_ ->
|
_ ->
|
||||||
Mod = gen_mod:db_mod(StateData#state.server_host, mod_muc),
|
HasGSR
|
||||||
erlang:function_exported(Mod, get_subscribed_rooms, 3)
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
if ShouldStore ->
|
if ShouldStore ->
|
||||||
|
Loading…
Reference in New Issue
Block a user