mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-24 17:29:28 +01:00
upgrade to lattest pubsub schema
This commit is contained in:
parent
179a0cf255
commit
c576f340f9
@ -2,7 +2,7 @@
|
||||
|
||||
-define(TIMEOUT, 1000*600). % 1 minute
|
||||
|
||||
-export([start/0, loop/0, subscribed/1, offline/1]).
|
||||
-export([start/0, loop/0, offline/1]).
|
||||
|
||||
start() ->
|
||||
Pid = spawn(?MODULE, loop, []),
|
||||
@ -24,17 +24,12 @@ purge() ->
|
||||
I=element(3,N),
|
||||
lists:foreach(fun(JID) ->
|
||||
mnesia:dirty_delete({pubsub_state, {JID, I}})
|
||||
end, offline(subscribed(I)))
|
||||
end, offline(pubsub_debug:subscribed(I)))
|
||||
end, mnesia:dirty_all_keys(pubsub_node));
|
||||
true ->
|
||||
ok
|
||||
end.
|
||||
|
||||
subscribed(NodeId) ->
|
||||
lists:map(fun(S) ->
|
||||
element(1,element(2,S))
|
||||
end, mnesia:dirty_match_object({pubsub_state, {'_',NodeId},'_',none,subscribed})).
|
||||
|
||||
offline(Jids) ->
|
||||
lists:filter(fun({U,S,""}) -> ejabberd_sm:get_user_resources(U,S) == [];
|
||||
({U,S,R}) -> not lists:member(R,ejabberd_sm:get_user_resources(U,S))
|
||||
|
Loading…
Reference in New Issue
Block a user