mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
fix NodeName issue from r2880 (thanks to Karim Gemayel)
SVN Revision: 2883
This commit is contained in:
parent
67af2908f9
commit
f8886ee36c
@ -3171,7 +3171,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,
|
||||
@ -3182,7 +3182,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
|
||||
@ -3239,10 +3239,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
|
||||
@ -3255,11 +3255,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]}),
|
||||
@ -3268,7 +3268,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}
|
||||
|
@ -2982,7 +2982,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,
|
||||
@ -2993,7 +2993,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
|
||||
@ -3050,10 +3050,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
|
||||
@ -3066,11 +3066,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]}),
|
||||
@ -3079,7 +3079,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}
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- mod_pubsub.erl 2010-01-12 13:31:40.000000000 +0100
|
||||
+++ mod_pubsub_odbc.erl 2010-01-12 13:32:06.000000000 +0100
|
||||
--- mod_pubsub.erl 2010-01-12 14:30:14.000000000 +0100
|
||||
+++ mod_pubsub_odbc.erl 2010-01-12 14:30:31.000000000 +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