25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

fix NodeName issue from r2880 (thanks to Karim Gemayel)

SVN Revision: 2882
This commit is contained in:
Christophe Romain 2010-01-12 13:27:04 +00:00
parent 024b688c1d
commit 392ea78acf
3 changed files with 20 additions and 20 deletions

View File

@ -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}

View File

@ -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}

View File

@ -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.