24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-02 21:17:12 +02:00

fix r2876 compilation warning

SVN Revision: 2880
This commit is contained in:
Christophe Romain 2010-01-12 12:31:08 +00:00
parent 276f890c50
commit 024b688c1d
3 changed files with 82 additions and 82 deletions

View File

@ -3170,49 +3170,49 @@ broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyTyp
subscribed_nodes_by_jid(NotifyType, SubsByDepth) -> subscribed_nodes_by_jid(NotifyType, SubsByDepth) ->
NodesToDeliver = fun(Depth, Node, Subs, Acc) -> NodesToDeliver = fun(Depth, Node, Subs, Acc) ->
NodeId = case Node#pubsub_node.nodeid of % NodeId = case Node#pubsub_node.nodeid of
{_, N} -> N; % {_, N} -> N;
Other -> Other % Other -> Other
end, % end,
NodeOptions = Node#pubsub_node.options, NodeOptions = Node#pubsub_node.options,
lists:foldl( lists:foldl(fun({LJID, SubID, SubOptions}, {JIDs, Recipients}) ->
fun({LJID, SubID, SubOptions}, {JIDs, Recipients} = Acc) -> case is_to_deliver(LJID, NotifyType, Depth, NodeOptions, SubOptions) of
case is_to_deliver(LJID, NotifyType, Depth, NodeOptions, SubOptions) of true ->
true -> %% If is to deliver :
%% If is to deliver : case lists:member(LJID, JIDs) of
case lists:member(LJID, JIDs) of %% check if the JIDs co-accumulator contains the Subscription Jid,
%% check if the JIDs co-accumulator contains the Subscription Jid, false ->
false -> %% - if not,
%% - if not, %% - add the Jid to JIDs list co-accumulator ;
%% - add the Jid to JIDs list co-accumulator ; %% - create a tuple of the Jid, NodeId, and SubID (as list),
%% - create a tuple of the Jid, NodeId, and SubID (as list), %% and add the tuple to the Recipients list co-accumulator
%% and add the tuple to the Recipients list co-accumulator {[LJID | JIDs], [{LJID, [SubID]} | Recipients]};
{[LJID | JIDs], [{LJID, [SubID]} | Recipients]}; true ->
true -> %% - if the JIDs co-accumulator contains the Jid
%% - if the JIDs co-accumulator contains the Jid %% get the tuple containing the Jid from the Recipient list co-accumulator
%% get the tuple containing the Jid from the Recipient list co-accumulator {_, {LJID, SubIDs}} = lists:keysearch(LJID, 1, Recipients),
{_, {LJID, SubIDs}} = lists:keysearch(LJID, 1, Recipients), %% delete the tuple from the Recipients list
%% delete the tuple from the Recipients list % v1 : Recipients1 = lists:keydelete(LJID, 1, Recipients),
% v1 : Recipients1 = lists:keydelete(LJID, 1, Recipients), % v2 : Recipients1 = lists:keyreplace(LJID, 1, Recipients, {LJID, NodeId1, [SubID | SubIDs]}),
% v2 : Recipients1 = lists:keyreplace(LJID, 1, Recipients, {LJID, NodeId1, [SubID | SubIDs]}), %% add the SubID to the SubIDs list in the tuple,
%% add the SubID to the SubIDs list in the tuple, %% and add the tuple back to the Recipients list co-accumulator
%% and add the tuple back to the Recipients list co-accumulator % v1.1 : {JIDs, lists:append(Recipients1, [{LJID, NodeId1, lists:append(SubIDs, [SubID])}])}
% v1.1 : {JIDs, lists:append(Recipients1, [{LJID, NodeId1, lists:append(SubIDs, [SubID])}])} % v1.2 : {JIDs, [{LJID, NodeId1, [SubID | SubIDs]} | Recipients1]}
% v1.2 : {JIDs, [{LJID, NodeId1, [SubID | SubIDs]} | Recipients1]} % v2: {JIDs, Recipients1}
% v2: {JIDs, Recipients1} {JIDs, lists:keyreplace(LJID, 1, Recipients, {LJID, [SubID | SubIDs]})}
{JIDs, lists:keyreplace(LJID, 1, Recipients, {LJID, [SubID | SubIDs]})} end;
end; false ->
false -> {JIDs, Recipients} {JIDs, Recipients}
end end
end, Acc, Subs) end, Acc, Subs)
end, end,
DepthsToDeliver = fun({Depth, SubsByNode}, Acc) -> DepthsToDeliver = fun({Depth, SubsByNode}, Acc) ->
lists:foldl(fun({Node, Subs}, Acc2) -> lists:foldl(fun({Node, Subs}, Acc2) ->
NodesToDeliver(Depth, Node, Subs, Acc2) NodesToDeliver(Depth, Node, Subs, Acc2)
end, Acc, SubsByNode) end, Acc, SubsByNode)
end, end,
{_, JIDSubs} = lists:foldl(DepthsToDeliver, {[], []}, SubsByDepth), {_, JIDSubs} = lists:foldl(DepthsToDeliver, {[], []}, SubsByDepth),
JIDSubs. JIDSubs.
%% If we don't know the resource, just pick first if any %% If we don't know the resource, just pick first if any
%% If no resource available, check if caps anyway (remote online) %% If no resource available, check if caps anyway (remote online)

View File

@ -2979,49 +2979,49 @@ broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyTyp
subscribed_nodes_by_jid(NotifyType, SubsByDepth) -> subscribed_nodes_by_jid(NotifyType, SubsByDepth) ->
NodesToDeliver = fun(Depth, Node, Subs, Acc) -> NodesToDeliver = fun(Depth, Node, Subs, Acc) ->
NodeId = case Node#pubsub_node.nodeid of % NodeId = case Node#pubsub_node.nodeid of
{_, N} -> N; % {_, N} -> N;
Other -> Other % Other -> Other
end, % end,
NodeOptions = Node#pubsub_node.options, NodeOptions = Node#pubsub_node.options,
lists:foldl( lists:foldl(fun({LJID, SubID, SubOptions}, {JIDs, Recipients}) ->
fun({LJID, SubID, SubOptions}, {JIDs, Recipients} = Acc) -> case is_to_deliver(LJID, NotifyType, Depth, NodeOptions, SubOptions) of
case is_to_deliver(LJID, NotifyType, Depth, NodeOptions, SubOptions) of true ->
true -> %% If is to deliver :
%% If is to deliver : case lists:member(LJID, JIDs) of
case lists:member(LJID, JIDs) of %% check if the JIDs co-accumulator contains the Subscription Jid,
%% check if the JIDs co-accumulator contains the Subscription Jid, false ->
false -> %% - if not,
%% - if not, %% - add the Jid to JIDs list co-accumulator ;
%% - add the Jid to JIDs list co-accumulator ; %% - create a tuple of the Jid, NodeId, and SubID (as list),
%% - create a tuple of the Jid, NodeId, and SubID (as list), %% and add the tuple to the Recipients list co-accumulator
%% and add the tuple to the Recipients list co-accumulator {[LJID | JIDs], [{LJID, [SubID]} | Recipients]};
{[LJID | JIDs], [{LJID, [SubID]} | Recipients]}; true ->
true -> %% - if the JIDs co-accumulator contains the Jid
%% - if the JIDs co-accumulator contains the Jid %% get the tuple containing the Jid from the Recipient list co-accumulator
%% get the tuple containing the Jid from the Recipient list co-accumulator {_, {LJID, SubIDs}} = lists:keysearch(LJID, 1, Recipients),
{_, {LJID, SubIDs}} = lists:keysearch(LJID, 1, Recipients), %% delete the tuple from the Recipients list
%% delete the tuple from the Recipients list % v1 : Recipients1 = lists:keydelete(LJID, 1, Recipients),
% v1 : Recipients1 = lists:keydelete(LJID, 1, Recipients), % v2 : Recipients1 = lists:keyreplace(LJID, 1, Recipients, {LJID, NodeId1, [SubID | SubIDs]}),
% v2 : Recipients1 = lists:keyreplace(LJID, 1, Recipients, {LJID, NodeId1, [SubID | SubIDs]}), %% add the SubID to the SubIDs list in the tuple,
%% add the SubID to the SubIDs list in the tuple, %% and add the tuple back to the Recipients list co-accumulator
%% and add the tuple back to the Recipients list co-accumulator % v1.1 : {JIDs, lists:append(Recipients1, [{LJID, NodeId1, lists:append(SubIDs, [SubID])}])}
% v1.1 : {JIDs, lists:append(Recipients1, [{LJID, NodeId1, lists:append(SubIDs, [SubID])}])} % v1.2 : {JIDs, [{LJID, NodeId1, [SubID | SubIDs]} | Recipients1]}
% v1.2 : {JIDs, [{LJID, NodeId1, [SubID | SubIDs]} | Recipients1]} % v2: {JIDs, Recipients1}
% v2: {JIDs, Recipients1} {JIDs, lists:keyreplace(LJID, 1, Recipients, {LJID, [SubID | SubIDs]})}
{JIDs, lists:keyreplace(LJID, 1, Recipients, {LJID, [SubID | SubIDs]})} end;
end; false ->
false -> {JIDs, Recipients} {JIDs, Recipients}
end end
end, Acc, Subs) end, Acc, Subs)
end, end,
DepthsToDeliver = fun({Depth, SubsByNode}, Acc) -> DepthsToDeliver = fun({Depth, SubsByNode}, Acc) ->
lists:foldl(fun({Node, Subs}, Acc2) -> lists:foldl(fun({Node, Subs}, Acc2) ->
NodesToDeliver(Depth, Node, Subs, Acc2) NodesToDeliver(Depth, Node, Subs, Acc2)
end, Acc, SubsByNode) end, Acc, SubsByNode)
end, end,
{_, JIDSubs} = lists:foldl(DepthsToDeliver, {[], []}, SubsByDepth), {_, JIDSubs} = lists:foldl(DepthsToDeliver, {[], []}, SubsByDepth),
JIDSubs. JIDSubs.
%% If we don't know the resource, just pick first if any %% If we don't know the resource, just pick first if any
%% If no resource available, check if caps anyway (remote online) %% If no resource available, check if caps anyway (remote online)

View File

@ -1,5 +1,5 @@
--- mod_pubsub.erl 2010-01-12 11:24:41.169047172 +0100 --- mod_pubsub.erl 2010-01-12 13:29:25.458216046 +0100
+++ mod_pubsub_odbc.erl 2010-01-12 13:11:52.450026878 +0100 +++ mod_pubsub_odbc.erl 2010-01-12 13:30:14.538046934 +0100
@@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
%%% 6.2.3.1, 6.2.3.5, and 6.3. For information on subscription leases see %%% 6.2.3.1, 6.2.3.5, and 6.3. For information on subscription leases see
%%% XEP-0060 section 12.18. %%% XEP-0060 section 12.18.