From 392ea78acf362dae6ced3554508894a7eaa2bd15 Mon Sep 17 00:00:00 2001 From: Christophe Romain Date: Tue, 12 Jan 2010 13:27:04 +0000 Subject: [PATCH] fix NodeName issue from r2880 (thanks to Karim Gemayel) SVN Revision: 2882 --- src/mod_pubsub/mod_pubsub.erl | 18 +++++++++--------- src/mod_pubsub/mod_pubsub_odbc.erl | 18 +++++++++--------- src/mod_pubsub/pubsub_odbc.patch | 4 ++-- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/mod_pubsub/mod_pubsub.erl b/src/mod_pubsub/mod_pubsub.erl index 7f32a5732..56dcf3e33 100644 --- a/src/mod_pubsub/mod_pubsub.erl +++ b/src/mod_pubsub/mod_pubsub.erl @@ -3101,7 +3101,7 @@ broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyTyp end, %% Handles explicit subscriptions SubIDsByJID = subscribed_nodes_by_jid(NotifyType, SubsByDepth), - lists:foreach(fun ({LJID, SubIDs}) -> + lists:foreach(fun ({LJID, NodeName, SubIDs}) -> LJIDs = case BroadcastAll of true -> {U, S, _} = LJID, @@ -3112,7 +3112,7 @@ broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyTyp %% Determine if the stanza should have SHIM ('SubID' and 'name') headers StanzaToSend = case SHIM of true -> - Headers = lists:append(collection_shim(Node), subid_shim(SubIDs)), + Headers = lists:append(collection_shim(NodeName), subid_shim(SubIDs)), add_headers(Stanza, Headers); false -> Stanza @@ -3170,10 +3170,10 @@ 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, + NodeName = 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 @@ -3186,11 +3186,11 @@ subscribed_nodes_by_jid(NotifyType, SubsByDepth) -> %% - 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]}; + {[LJID | JIDs], [{LJID, NodeName, [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), + {_, {LJID, NodeName1, 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]}), @@ -3199,7 +3199,7 @@ subscribed_nodes_by_jid(NotifyType, SubsByDepth) -> % 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]})} + {JIDs, lists:keyreplace(LJID, 1, Recipients, {LJID, NodeName1, [SubID | SubIDs]})} end; false -> {JIDs, Recipients} diff --git a/src/mod_pubsub/mod_pubsub_odbc.erl b/src/mod_pubsub/mod_pubsub_odbc.erl index 20b0c9fde..7d13bded3 100644 --- a/src/mod_pubsub/mod_pubsub_odbc.erl +++ b/src/mod_pubsub/mod_pubsub_odbc.erl @@ -2910,7 +2910,7 @@ broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyTyp end, %% Handles explicit subscriptions SubIDsByJID = subscribed_nodes_by_jid(NotifyType, SubsByDepth), - lists:foreach(fun ({LJID, SubIDs}) -> + lists:foreach(fun ({LJID, NodeName, SubIDs}) -> LJIDs = case BroadcastAll of true -> {U, S, _} = LJID, @@ -2921,7 +2921,7 @@ broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyTyp %% Determine if the stanza should have SHIM ('SubID' and 'name') headers StanzaToSend = case SHIM of true -> - Headers = lists:append(collection_shim(Node), subid_shim(SubIDs)), + Headers = lists:append(collection_shim(NodeName), subid_shim(SubIDs)), add_headers(Stanza, Headers); false -> Stanza @@ -2979,10 +2979,10 @@ 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, + NodeName = 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 @@ -2995,11 +2995,11 @@ subscribed_nodes_by_jid(NotifyType, SubsByDepth) -> %% - 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]}; + {[LJID | JIDs], [{LJID, NodeName, [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), + {_, {LJID, NodeName1, 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]}), @@ -3008,7 +3008,7 @@ subscribed_nodes_by_jid(NotifyType, SubsByDepth) -> % 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]})} + {JIDs, lists:keyreplace(LJID, 1, Recipients, {LJID, NodeName1, [SubID | SubIDs]})} end; false -> {JIDs, Recipients} diff --git a/src/mod_pubsub/pubsub_odbc.patch b/src/mod_pubsub/pubsub_odbc.patch index e8a630b0d..79518b72c 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 13:29:25.458216046 +0100 -+++ mod_pubsub_odbc.erl 2010-01-12 13:30:14.538046934 +0100 +--- mod_pubsub.erl 2010-01-12 14:25:24.809994066 +0100 ++++ mod_pubsub_odbc.erl 2010-01-12 14:26:04.098050300 +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.