| CODENOTIFIER | HelpYou are not signed inSign in |
Project: ejabberd
Revision: 1550
Author: cromain
Date: 27 Aug 2008 05:28:47
Changes:send last published events now supports PEP events from unavailable users nodes (EJAB-698)
Files:| ... | ...@@ -37,6 +37,7 @@ | |
| 37 | 37 | send_element/2, |
| 38 | 38 | socket_type/0, |
| 39 | 39 | get_presence/1, |
| 40 | get_subscribed/1, | |
| 40 | 41 | get_subscribed_and_online/1]). |
| 41 | 42 | |
| 42 | 43 | %% gen_fsm callbacks |
| ... | ...@@ -208,6 +209,9 @@ | |
| 208 | 209 | |
| 209 | 210 | %% Return list of all available resources of contacts, |
| 210 | 211 | %% in form [{JID, Caps}]. |
| 212 | get_subscribed(FsmRef) -> | |
| 213 | gen_fsm:sync_send_all_state_event( | |
| 214 | FsmRef, get_subscribed, 1000). | |
| 211 | 215 | get_subscribed_and_online(FsmRef) -> |
| 212 | 216 | gen_fsm:sync_send_all_state_event( |
| 213 | 217 | FsmRef, get_subscribed_and_online, 1000). |
| ... | ...@@ -1010,6 +1014,20 @@ | |
| 1010 | 1014 | Reply = {User, Resource, Show, Status}, |
| 1011 | 1015 | fsm_reply(Reply, StateName, StateData); |
| 1012 | 1016 | |
| 1017 | handle_sync_event(get_subscribed, _From, StateName, StateData) -> | |
| 1018 | Subscribed = StateData#state.pres_f, | |
| 1019 | Online = StateData#state.pres_available, | |
| 1020 | Pred = fun(User, _Caps) -> | |
| 1021 | ?SETS:is_element(jlib:jid_remove_resource(User), | |
| 1022 | Subscribed) orelse | |
| 1023 | ?SETS:is_element(User, Subscribed) | |
| 1024 | end, | |
| 1025 | SubscribedAndOnline = ?DICT:filter(Pred, Online), | |
| 1026 | SubscribedWithCaps = ?SETS:fold(fun(User, Acc) -> | |
| 1027 | [{User, undefined}|Acc] | |
| 1028 | end, ?DICT:to_list(SubscribedAndOnline), Subscribed), | |
| 1029 | {reply, SubscribedWithCaps, StateName, StateData}; | |
| 1030 | ||
| 1013 | 1031 | handle_sync_event(get_subscribed_and_online, _From, StateName, StateData) -> |
| 1014 | 1032 | Subscribed = StateData#state.pres_f, |
| 1015 | 1033 | Online = StateData#state.pres_available, |
| ... | ...@@ -469,7 +469,7 @@ | |
| 469 | 469 | end, Subscriptions) |
| 470 | 470 | end, State#state.plugins), |
| 471 | 471 | %% and send to From last PEP events published by its contacts |
| 472 | case catch ejabberd_c2s:get_subscribed_and_online(Pid) of | |
| 472 | case catch ejabberd_c2s:get_subscribed(Pid) of | |
| 473 | 473 | ContactsWithCaps when is_list(ContactsWithCaps) -> |
| 474 | 474 | Caps = proplists:get_value(LJID, ContactsWithCaps), |
| 475 | 475 | ContactsUsers = lists:usort(lists:map( |
| ... | ...@@ -1,3 +1,9 @@ | |
| 1 | 2008-08-27 Christophe Romain <christophe.romain@process-one.net> | |
| 2 | ||
| 3 | * src/mod_pubsub/mod_pubsub.erl: send last published events now | |
| 4 | supports PEP events from unavailable users nodes (EJAB-698) | |
| 5 | * src/ejabberd_c2s.erl: Likewise | |
| 6 | ||
| 1 | 7 | 2008-08-26 Badlop <badlop@process-one.net> |
| 2 | 8 | |
| 3 | 9 | * doc/release_notes_2.0.2.txt: Update for final release |