mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-20 16:15:59 +01:00
send last published events now supports PEP events from unavailable users nodes (EJAB-698)
SVN Revision: 1550
This commit is contained in:
parent
dfc62ca5be
commit
11788b2953
@ -1,3 +1,9 @@
|
||||
2008-08-27 Christophe Romain <christophe.romain@process-one.net>
|
||||
|
||||
* src/mod_pubsub/mod_pubsub.erl: send last published events now
|
||||
supports PEP events from unavailable users nodes (EJAB-698)
|
||||
* src/ejabberd_c2s.erl: Likewise
|
||||
|
||||
2008-08-26 Badlop <badlop@process-one.net>
|
||||
|
||||
* doc/release_notes_2.0.2.txt: Update for final release
|
||||
|
@ -37,6 +37,7 @@
|
||||
send_element/2,
|
||||
socket_type/0,
|
||||
get_presence/1,
|
||||
get_subscribed/1,
|
||||
get_subscribed_and_online/1]).
|
||||
|
||||
%% gen_fsm callbacks
|
||||
@ -208,6 +209,9 @@ init([{SockMod, Socket}, Opts]) ->
|
||||
|
||||
%% Return list of all available resources of contacts,
|
||||
%% in form [{JID, Caps}].
|
||||
get_subscribed(FsmRef) ->
|
||||
gen_fsm:sync_send_all_state_event(
|
||||
FsmRef, get_subscribed, 1000).
|
||||
get_subscribed_and_online(FsmRef) ->
|
||||
gen_fsm:sync_send_all_state_event(
|
||||
FsmRef, get_subscribed_and_online, 1000).
|
||||
@ -1010,6 +1014,20 @@ handle_sync_event({get_presence}, _From, StateName, StateData) ->
|
||||
Reply = {User, Resource, Show, Status},
|
||||
fsm_reply(Reply, StateName, StateData);
|
||||
|
||||
handle_sync_event(get_subscribed, _From, StateName, StateData) ->
|
||||
Subscribed = StateData#state.pres_f,
|
||||
Online = StateData#state.pres_available,
|
||||
Pred = fun(User, _Caps) ->
|
||||
?SETS:is_element(jlib:jid_remove_resource(User),
|
||||
Subscribed) orelse
|
||||
?SETS:is_element(User, Subscribed)
|
||||
end,
|
||||
SubscribedAndOnline = ?DICT:filter(Pred, Online),
|
||||
SubscribedWithCaps = ?SETS:fold(fun(User, Acc) ->
|
||||
[{User, undefined}|Acc]
|
||||
end, ?DICT:to_list(SubscribedAndOnline), Subscribed),
|
||||
{reply, SubscribedWithCaps, StateName, StateData};
|
||||
|
||||
handle_sync_event(get_subscribed_and_online, _From, StateName, StateData) ->
|
||||
Subscribed = StateData#state.pres_f,
|
||||
Online = StateData#state.pres_available,
|
||||
|
@ -469,7 +469,7 @@ handle_cast({presence, JID, Pid}, State) ->
|
||||
end, Subscriptions)
|
||||
end, State#state.plugins),
|
||||
%% and send to From last PEP events published by its contacts
|
||||
case catch ejabberd_c2s:get_subscribed_and_online(Pid) of
|
||||
case catch ejabberd_c2s:get_subscribed(Pid) of
|
||||
ContactsWithCaps when is_list(ContactsWithCaps) ->
|
||||
Caps = proplists:get_value(LJID, ContactsWithCaps),
|
||||
ContactsUsers = lists:usort(lists:map(
|
||||
|
Loading…
Reference in New Issue
Block a user