mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
fix r2876 compilation warning
SVN Revision: 2880
This commit is contained in:
parent
276f890c50
commit
024b688c1d
@ -3170,49 +3170,49 @@ broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyTyp
|
||||
|
||||
subscribed_nodes_by_jid(NotifyType, SubsByDepth) ->
|
||||
NodesToDeliver = fun(Depth, Node, Subs, Acc) ->
|
||||
NodeId = case Node#pubsub_node.nodeid of
|
||||
{_, N} -> N;
|
||||
Other -> Other
|
||||
end,
|
||||
NodeOptions = Node#pubsub_node.options,
|
||||
lists:foldl(
|
||||
fun({LJID, SubID, SubOptions}, {JIDs, Recipients} = Acc) ->
|
||||
case is_to_deliver(LJID, NotifyType, Depth, NodeOptions, SubOptions) of
|
||||
true ->
|
||||
%% If is to deliver :
|
||||
case lists:member(LJID, JIDs) of
|
||||
%% check if the JIDs co-accumulator contains the Subscription Jid,
|
||||
false ->
|
||||
%% - if not,
|
||||
%% - add the Jid to JIDs list co-accumulator ;
|
||||
%% - create a tuple of the Jid, NodeId, and SubID (as list),
|
||||
%% and add the tuple to the Recipients list co-accumulator
|
||||
{[LJID | JIDs], [{LJID, [SubID]} | Recipients]};
|
||||
true ->
|
||||
%% - if the JIDs co-accumulator contains the Jid
|
||||
%% get the tuple containing the Jid from the Recipient list co-accumulator
|
||||
{_, {LJID, SubIDs}} = lists:keysearch(LJID, 1, Recipients),
|
||||
%% delete the tuple from the Recipients list
|
||||
% v1 : Recipients1 = lists:keydelete(LJID, 1, Recipients),
|
||||
% v2 : Recipients1 = lists:keyreplace(LJID, 1, Recipients, {LJID, NodeId1, [SubID | SubIDs]}),
|
||||
%% add the SubID to the SubIDs list in the tuple,
|
||||
%% and add the tuple back to the Recipients list co-accumulator
|
||||
% v1.1 : {JIDs, lists:append(Recipients1, [{LJID, NodeId1, lists:append(SubIDs, [SubID])}])}
|
||||
% v1.2 : {JIDs, [{LJID, NodeId1, [SubID | SubIDs]} | Recipients1]}
|
||||
% v2: {JIDs, Recipients1}
|
||||
{JIDs, lists:keyreplace(LJID, 1, Recipients, {LJID, [SubID | SubIDs]})}
|
||||
end;
|
||||
false -> {JIDs, Recipients}
|
||||
end
|
||||
end, Acc, Subs)
|
||||
% NodeId = case Node#pubsub_node.nodeid of
|
||||
% {_, N} -> N;
|
||||
% Other -> Other
|
||||
% end,
|
||||
NodeOptions = Node#pubsub_node.options,
|
||||
lists:foldl(fun({LJID, SubID, SubOptions}, {JIDs, Recipients}) ->
|
||||
case is_to_deliver(LJID, NotifyType, Depth, NodeOptions, SubOptions) of
|
||||
true ->
|
||||
%% If is to deliver :
|
||||
case lists:member(LJID, JIDs) of
|
||||
%% check if the JIDs co-accumulator contains the Subscription Jid,
|
||||
false ->
|
||||
%% - if not,
|
||||
%% - add the Jid to JIDs list co-accumulator ;
|
||||
%% - create a tuple of the Jid, NodeId, and SubID (as list),
|
||||
%% and add the tuple to the Recipients list co-accumulator
|
||||
{[LJID | JIDs], [{LJID, [SubID]} | Recipients]};
|
||||
true ->
|
||||
%% - if the JIDs co-accumulator contains the Jid
|
||||
%% get the tuple containing the Jid from the Recipient list co-accumulator
|
||||
{_, {LJID, SubIDs}} = lists:keysearch(LJID, 1, Recipients),
|
||||
%% delete the tuple from the Recipients list
|
||||
% v1 : Recipients1 = lists:keydelete(LJID, 1, Recipients),
|
||||
% v2 : Recipients1 = lists:keyreplace(LJID, 1, Recipients, {LJID, NodeId1, [SubID | SubIDs]}),
|
||||
%% add the SubID to the SubIDs list in the tuple,
|
||||
%% and add the tuple back to the Recipients list co-accumulator
|
||||
% v1.1 : {JIDs, lists:append(Recipients1, [{LJID, NodeId1, lists:append(SubIDs, [SubID])}])}
|
||||
% v1.2 : {JIDs, [{LJID, NodeId1, [SubID | SubIDs]} | Recipients1]}
|
||||
% v2: {JIDs, Recipients1}
|
||||
{JIDs, lists:keyreplace(LJID, 1, Recipients, {LJID, [SubID | SubIDs]})}
|
||||
end;
|
||||
false ->
|
||||
{JIDs, Recipients}
|
||||
end
|
||||
end, Acc, Subs)
|
||||
end,
|
||||
DepthsToDeliver = fun({Depth, SubsByNode}, Acc) ->
|
||||
lists:foldl(fun({Node, Subs}, Acc2) ->
|
||||
NodesToDeliver(Depth, Node, Subs, Acc2)
|
||||
end, Acc, SubsByNode)
|
||||
lists:foldl(fun({Node, Subs}, Acc2) ->
|
||||
NodesToDeliver(Depth, Node, Subs, Acc2)
|
||||
end, Acc, SubsByNode)
|
||||
end,
|
||||
{_, JIDSubs} = lists:foldl(DepthsToDeliver, {[], []}, SubsByDepth),
|
||||
JIDSubs.
|
||||
{_, JIDSubs} = lists:foldl(DepthsToDeliver, {[], []}, SubsByDepth),
|
||||
JIDSubs.
|
||||
|
||||
%% If we don't know the resource, just pick first if any
|
||||
%% If no resource available, check if caps anyway (remote online)
|
||||
|
@ -2979,49 +2979,49 @@ broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyTyp
|
||||
|
||||
subscribed_nodes_by_jid(NotifyType, SubsByDepth) ->
|
||||
NodesToDeliver = fun(Depth, Node, Subs, Acc) ->
|
||||
NodeId = case Node#pubsub_node.nodeid of
|
||||
{_, N} -> N;
|
||||
Other -> Other
|
||||
end,
|
||||
NodeOptions = Node#pubsub_node.options,
|
||||
lists:foldl(
|
||||
fun({LJID, SubID, SubOptions}, {JIDs, Recipients} = Acc) ->
|
||||
case is_to_deliver(LJID, NotifyType, Depth, NodeOptions, SubOptions) of
|
||||
true ->
|
||||
%% If is to deliver :
|
||||
case lists:member(LJID, JIDs) of
|
||||
%% check if the JIDs co-accumulator contains the Subscription Jid,
|
||||
false ->
|
||||
%% - if not,
|
||||
%% - add the Jid to JIDs list co-accumulator ;
|
||||
%% - create a tuple of the Jid, NodeId, and SubID (as list),
|
||||
%% and add the tuple to the Recipients list co-accumulator
|
||||
{[LJID | JIDs], [{LJID, [SubID]} | Recipients]};
|
||||
true ->
|
||||
%% - if the JIDs co-accumulator contains the Jid
|
||||
%% get the tuple containing the Jid from the Recipient list co-accumulator
|
||||
{_, {LJID, SubIDs}} = lists:keysearch(LJID, 1, Recipients),
|
||||
%% delete the tuple from the Recipients list
|
||||
% v1 : Recipients1 = lists:keydelete(LJID, 1, Recipients),
|
||||
% v2 : Recipients1 = lists:keyreplace(LJID, 1, Recipients, {LJID, NodeId1, [SubID | SubIDs]}),
|
||||
%% add the SubID to the SubIDs list in the tuple,
|
||||
%% and add the tuple back to the Recipients list co-accumulator
|
||||
% v1.1 : {JIDs, lists:append(Recipients1, [{LJID, NodeId1, lists:append(SubIDs, [SubID])}])}
|
||||
% v1.2 : {JIDs, [{LJID, NodeId1, [SubID | SubIDs]} | Recipients1]}
|
||||
% v2: {JIDs, Recipients1}
|
||||
{JIDs, lists:keyreplace(LJID, 1, Recipients, {LJID, [SubID | SubIDs]})}
|
||||
end;
|
||||
false -> {JIDs, Recipients}
|
||||
end
|
||||
end, Acc, Subs)
|
||||
% NodeId = case Node#pubsub_node.nodeid of
|
||||
% {_, N} -> N;
|
||||
% Other -> Other
|
||||
% end,
|
||||
NodeOptions = Node#pubsub_node.options,
|
||||
lists:foldl(fun({LJID, SubID, SubOptions}, {JIDs, Recipients}) ->
|
||||
case is_to_deliver(LJID, NotifyType, Depth, NodeOptions, SubOptions) of
|
||||
true ->
|
||||
%% If is to deliver :
|
||||
case lists:member(LJID, JIDs) of
|
||||
%% check if the JIDs co-accumulator contains the Subscription Jid,
|
||||
false ->
|
||||
%% - if not,
|
||||
%% - add the Jid to JIDs list co-accumulator ;
|
||||
%% - create a tuple of the Jid, NodeId, and SubID (as list),
|
||||
%% and add the tuple to the Recipients list co-accumulator
|
||||
{[LJID | JIDs], [{LJID, [SubID]} | Recipients]};
|
||||
true ->
|
||||
%% - if the JIDs co-accumulator contains the Jid
|
||||
%% get the tuple containing the Jid from the Recipient list co-accumulator
|
||||
{_, {LJID, SubIDs}} = lists:keysearch(LJID, 1, Recipients),
|
||||
%% delete the tuple from the Recipients list
|
||||
% v1 : Recipients1 = lists:keydelete(LJID, 1, Recipients),
|
||||
% v2 : Recipients1 = lists:keyreplace(LJID, 1, Recipients, {LJID, NodeId1, [SubID | SubIDs]}),
|
||||
%% add the SubID to the SubIDs list in the tuple,
|
||||
%% and add the tuple back to the Recipients list co-accumulator
|
||||
% v1.1 : {JIDs, lists:append(Recipients1, [{LJID, NodeId1, lists:append(SubIDs, [SubID])}])}
|
||||
% v1.2 : {JIDs, [{LJID, NodeId1, [SubID | SubIDs]} | Recipients1]}
|
||||
% v2: {JIDs, Recipients1}
|
||||
{JIDs, lists:keyreplace(LJID, 1, Recipients, {LJID, [SubID | SubIDs]})}
|
||||
end;
|
||||
false ->
|
||||
{JIDs, Recipients}
|
||||
end
|
||||
end, Acc, Subs)
|
||||
end,
|
||||
DepthsToDeliver = fun({Depth, SubsByNode}, Acc) ->
|
||||
lists:foldl(fun({Node, Subs}, Acc2) ->
|
||||
NodesToDeliver(Depth, Node, Subs, Acc2)
|
||||
end, Acc, SubsByNode)
|
||||
lists:foldl(fun({Node, Subs}, Acc2) ->
|
||||
NodesToDeliver(Depth, Node, Subs, Acc2)
|
||||
end, Acc, SubsByNode)
|
||||
end,
|
||||
{_, JIDSubs} = lists:foldl(DepthsToDeliver, {[], []}, SubsByDepth),
|
||||
JIDSubs.
|
||||
{_, JIDSubs} = lists:foldl(DepthsToDeliver, {[], []}, SubsByDepth),
|
||||
JIDSubs.
|
||||
|
||||
%% If we don't know the resource, just pick first if any
|
||||
%% If no resource available, check if caps anyway (remote online)
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- mod_pubsub.erl 2010-01-12 11:24:41.169047172 +0100
|
||||
+++ mod_pubsub_odbc.erl 2010-01-12 13:11:52.450026878 +0100
|
||||
--- mod_pubsub.erl 2010-01-12 13:29:25.458216046 +0100
|
||||
+++ mod_pubsub_odbc.erl 2010-01-12 13:30:14.538046934 +0100
|
||||
@@ -42,7 +42,7 @@
|
||||
%%% 6.2.3.1, 6.2.3.5, and 6.3. For information on subscription leases see
|
||||
%%% XEP-0060 section 12.18.
|
||||
|
Loading…
Reference in New Issue
Block a user