{fast_tls, ".*", {git, "https://github.com/processone/fast_tls", {tag, "1.0.23"}}},
{stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.12"}}},
{fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.32"}}},
- {xmpp, ".*", {git, "https://github.com/processone/xmpp", "8bf26b9e208bd0059cd8fd4e6593d88548c136cf"}},
+ {xmpp, ".*", {git, "https://github.com/processone/xmpp", "305e9c3"}},
{fast_yaml, ".*", {git, "https://github.com/processone/fast_yaml", {tag, "1.0.15"}}},
{jiffy, ".*", {git, "https://github.com/davisp/jiffy", {tag, "0.14.8"}}},
{p1_oauth2, ".*", {git, "https://github.com/processone/p1_oauth2", {tag, "0.6.3"}}},
-callback unregister_online_user(binary(), ljid(), binary(), binary()) -> any().
-callback count_online_rooms_by_user(binary(), binary(), binary()) -> non_neg_integer().
-callback get_online_rooms_by_user(binary(), binary(), binary()) -> [{binary(), binary()}].
--callback get_subscribed_rooms(binary(), binary(), jid()) -> [ljid()] | [].
+-callback get_subscribed_rooms(binary(), binary(), jid()) -> [{ljid(), [binary()]}] | [].
%%====================================================================
%% API
sub_els = [#muc_subscriptions{}]} = IQ) ->
Host = To#jid.lserver,
ServerHost = ejabberd_router:host_of_route(Host),
- RoomJIDs = get_subscribed_rooms(ServerHost, Host, From),
- xmpp:make_iq_result(IQ, #muc_subscriptions{list = RoomJIDs});
+ Subs = get_subscribed_rooms(ServerHost, Host, From),
+ xmpp:make_iq_result(IQ, #muc_subscriptions{list = Subs});
process_mucsub(#iq{lang = Lang} = IQ) ->
Txt = <<"No module is handling this query">>,
xmpp:make_error(IQ, xmpp:err_service_unavailable(Txt, Lang)).
lists:flatmap(
fun({Name, _, Pid}) ->
case p1_fsm:sync_send_all_state_event(Pid, {is_subscribed, BareFrom}) of
- true -> [jid:make(Name, Host)];
+ {true, Nodes} ->
+ [#muc_subscription{jid = jid:make(Name, Host), events = Nodes}];
false -> []
end;
(_) ->
[]
end, Rooms);
V ->
- V
+ [#muc_subscription{jid = Jid, events = Nodes} || {Jid, Nodes} <- V]
end.
get_nick(ServerHost, Host, From) ->
{reply, {error, get_error_text(Err)}, StateName, StateData}
end;
handle_sync_event({is_subscribed, From}, _From, StateName, StateData) ->
- IsSubs = ?DICT:is_key(jid:split(From), StateData#state.subscribers),
+ IsSubs = case (?DICT):find(jid:split(From), StateData#state.subscribers) of
+ {ok, #subscriber{nodes = Nodes}} ->
+ {true, Nodes};
+ error ->
+ false
+ end,
{reply, IsSubs, StateName, StateData};
handle_sync_event(_Event, _From, StateName,
StateData) ->
FAffiliation = get_affiliation(From, StateData),
FRole = get_role(From, StateData),
if FRole == moderator; FAffiliation == owner; FAffiliation == admin ->
- JIDs = dict:fold(
- fun(_, #subscriber{jid = J}, Acc) ->
- [J|Acc]
+ Subs = dict:fold(
+ fun(_, #subscriber{jid = J, nodes = Nodes}, Acc) ->
+ [#muc_subscription{jid = J, events = Nodes}|Acc]
end, [], StateData#state.subscribers),
- {result, #muc_subscriptions{list = JIDs}, StateData};
+ {result, #muc_subscriptions{list = Subs}, StateData};
true ->
Txt = <<"Moderator privileges required">>,
{error, xmpp:err_forbidden(Txt, Lang)}
JidS = jid:encode(Jid),
case catch ejabberd_sql:sql_query(
LServer,
- ?SQL("select @(room)s from muc_room_subscribers where jid=%(JidS)s"
+ ?SQL("select @(room)s, @(nodes)s from muc_room_subscribers where jid=%(JidS)s"
" and host=%(Host)s")) of
{selected, Subs} ->
- [jid:make(Room, Host, <<>>) || {Room} <- Subs];
+ [{jid:make(Room, Host, <<>>), ejabberd_sql:decode_term(Nodes)} || {Room, Nodes} <- Subs];
_Error ->
[]
end.