From 024b688c1d41ac7902052c41119f9c1dffa970b0 Mon Sep 17 00:00:00 2001 From: Christophe Romain Date: Tue, 12 Jan 2010 12:31:08 +0000 Subject: [PATCH] fix r2876 compilation warning SVN Revision: 2880 --- src/mod_pubsub/mod_pubsub.erl | 80 +++++++++++++++--------------- src/mod_pubsub/mod_pubsub_odbc.erl | 80 +++++++++++++++--------------- src/mod_pubsub/pubsub_odbc.patch | 4 +- 3 files changed, 82 insertions(+), 82 deletions(-) diff --git a/src/mod_pubsub/mod_pubsub.erl b/src/mod_pubsub/mod_pubsub.erl index c9621b74b..7f32a5732 100644 --- a/src/mod_pubsub/mod_pubsub.erl +++ b/src/mod_pubsub/mod_pubsub.erl @@ -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) diff --git a/src/mod_pubsub/mod_pubsub_odbc.erl b/src/mod_pubsub/mod_pubsub_odbc.erl index 6e3037874..20b0c9fde 100644 --- a/src/mod_pubsub/mod_pubsub_odbc.erl +++ b/src/mod_pubsub/mod_pubsub_odbc.erl @@ -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) diff --git a/src/mod_pubsub/pubsub_odbc.patch b/src/mod_pubsub/pubsub_odbc.patch index 619c9b9ae..e8a630b0d 100644 --- a/src/mod_pubsub/pubsub_odbc.patch +++ b/src/mod_pubsub/pubsub_odbc.patch @@ -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.