25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-26 16:26:24 +01:00

fix headers (EJAB-1091), (EJAB-1092), (EJAB-1093) (thanks to Karim Gemayel)

SVN Revision: 2881
This commit is contained in:
Christophe Romain 2010-01-12 12:34:02 +00:00
parent 9df6e1fe0a
commit 67af2908f9
3 changed files with 202 additions and 100 deletions

View File

@ -87,7 +87,7 @@
get_items/2,
get_item/3,
get_cached_item/2,
broadcast_stanza/8,
broadcast_stanza/9,
get_configure/5,
set_configure/5,
tree_action/3,
@ -3004,7 +3004,7 @@ broadcast_publish_item(Host, Node, NodeId, Type, Options, Removed, ItemId, _From
Stanza = event_stanza(
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'items', attrs = nodeAttr(Node), children =
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'item', attrs = itemAttr(ItemId), children = Content}]}]),
broadcast_stanza(Host, Node, NodeId, Type, Options, SubsByDepth, items, Stanza),
broadcast_stanza(Host, Node, NodeId, Type, Options, SubsByDepth, items, Stanza, true),
case Removed of
[] ->
ok;
@ -3014,7 +3014,7 @@ broadcast_publish_item(Host, Node, NodeId, Type, Options, Removed, ItemId, _From
RetractStanza = event_stanza(
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'items', attrs = nodeAttr(Node), children =
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'retract', attrs = itemAttr(RId)} || RId <- Removed]}]),
broadcast_stanza(Host, Node, NodeId, Type, Options, SubsByDepth, items, RetractStanza);
broadcast_stanza(Host, Node, NodeId, Type, Options, SubsByDepth, items, RetractStanza, true);
_ ->
ok
end
@ -3040,7 +3040,7 @@ broadcast_retract_items(Host, Node, NodeId, Type, NodeOptions, ItemIds, ForceNot
Stanza = event_stanza(
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'items', attrs = nodeAttr(Node), children =
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'retract', attrs = itemAttr(ItemId)} || ItemId <- ItemIds]}]),
broadcast_stanza(Host, Node, NodeId, Type, NodeOptions, SubsByDepth, items, Stanza),
broadcast_stanza(Host, Node, NodeId, Type, NodeOptions, SubsByDepth, items, Stanza, true),
{result, true};
_ ->
{result, false}
@ -3059,7 +3059,7 @@ broadcast_purge_node(Host, Node, NodeId, Type, NodeOptions) ->
SubsByDepth when is_list(SubsByDepth) ->
Stanza = event_stanza(
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'purge', attrs = nodeAttr(Node)}]),
broadcast_stanza(Host, Node, NodeId, Type, NodeOptions, SubsByDepth, nodes, Stanza),
broadcast_stanza(Host, Node, NodeId, Type, NodeOptions, SubsByDepth, nodes, Stanza, false),
{result, true};
_ ->
{result, false}
@ -3078,7 +3078,7 @@ broadcast_removed_node(Host, Node, NodeId, Type, NodeOptions, SubsByDepth) ->
_ ->
Stanza = event_stanza(
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'delete', attrs = nodeAttr(Node)}]),
broadcast_stanza(Host, Node, NodeId, Type, NodeOptions, SubsByDepth, nodes, Stanza),
broadcast_stanza(Host, Node, NodeId, Type, NodeOptions, SubsByDepth, nodes, Stanza, false),
{result, true}
end;
_ ->
@ -3104,7 +3104,7 @@ broadcast_config_notification(Host, Node, NodeId, Type, NodeOptions, Lang) ->
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'items', attrs = nodeAttr(Node), children =
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'item', attrs = [?XMLATTR('id', <<"configuration">>)], children =
Content}]}]),
broadcast_stanza(Host, Node, NodeId, Type, NodeOptions, SubsByDepth, nodes, Stanza),
broadcast_stanza(Host, Node, NodeId, Type, NodeOptions, SubsByDepth, nodes, Stanza, false),
{result, true};
_ ->
{result, false}
@ -3161,7 +3161,7 @@ get_options_for_subs(NodeID, Subs) ->
% {result, false}
% end
broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyType, BaseStanza) ->
broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyType, BaseStanza, SHIM) ->
NotificationType = get_option(NodeOptions, notification_type, headline),
BroadcastAll = get_option(NodeOptions, broadcast_all_resources), %% XXX this is not standard, but usefull
From = service_jid(Host),
@ -3170,21 +3170,27 @@ broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyTyp
MsgType -> add_message_type(BaseStanza, atom_to_list(MsgType))
end,
%% Handles explicit subscriptions
NodesByJID = subscribed_nodes_by_jid(NotifyType, SubsByDepth),
lists:foreach(fun ({LJID, Nodes}) ->
LJIDs = case BroadcastAll of
true ->
{U, S, _} = LJID,
[{U, S, R} || R <- user_resources(U, S)];
false ->
[LJID]
end,
SHIMStanza = add_headers(Stanza, collection_shim(Node, Nodes)),
lists:foreach(fun(To) ->
{TU, TS, TR} = To,
ejabberd_router:route(From, exmpp_jid:make(TU, TS, TR), SHIMStanza)
end, LJIDs)
end, NodesByJID),
SubIDsByJID = subscribed_nodes_by_jid(NotifyType, SubsByDepth),
lists:foreach(fun ({LJID, SubIDs}) ->
LJIDs = case BroadcastAll of
true ->
{U, S, _} = LJID,
[{U, S, R} || R <- user_resources(U, S)];
false ->
[LJID]
end,
%% 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)),
add_headers(Stanza, Headers);
false ->
Stanza
end,
lists:foreach(fun({TU, TS, TR}) ->
ejabberd_router:route(From, exmpp_jid:make(TU, TS, TR), StanzaToSend)
end, LJIDs)
end, SubIDsByJID),
%% Handles implicit presence subscriptions
case Host of
{LUser, LServer, LResource} ->
@ -3233,26 +3239,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}, Acc2) ->
case is_to_deliver(LJID, NotifyType, Depth,
NodeOptions, SubOptions) of
true -> [{LJID, NodeId}|Acc2];
false -> Acc2
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),
[{LJID, proplists:append_values(LJID, JIDSubs)} || LJID <- proplists:get_keys(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)
@ -3817,12 +3846,34 @@ itemsEls(Items) ->
add_message_type(#xmlel{name='message'} = El, Type) -> exmpp_stanza:set_type(El, Type);
add_message_type(El, _Type) -> El.
%% Place of <headers/> changed at the bottom of the stanza
%% cf. http://xmpp.org/extensions/xep-0060.html#publisher-publish-success-subid
%%
%% "[SHIM Headers] SHOULD be included after the event notification information
%% (i.e., as the last child of the <message/> stanza)".
add_headers(#xmlel{} = El, HeaderEls) ->
HeaderEl = #xmlel{ns = ?NS_SHIM, name = 'headers', children = HeaderEls},
exmpp_xml:prepend_child(El, HeaderEl).
exmpp_xml:append_child(El, HeaderEl).
collection_shim(Node, Nodes) ->
[#xmlel{ns = ?NS_PUBSUB, name ='header',
attrs = [?XMLATTR('name', <<"Collection">>)],
children = [ ?XMLCDATA(node_to_string(N))]
} || N <- Nodes -- [Node]].
%% Removed multiple <header name=Collection>Foo</header/> elements
%% Didn't seem compliant, but not sure. Confirmation required.
%% cf. http://xmpp.org/extensions/xep-0248.html#notify
%%
%% "If an item is published to a node which is also included by a collection,
%% and an entity is subscribed to that collection with a subscription type of
%% "items" (Is there a way to check that currently ?), then the notifications
%% generated by the service MUST contain additional information. The <items/>
%% element contained in the notification message MUST specify the node
%% identifier of the node that generated the notification (not the collection)
%% and the <item/> element MUST contain a SHIM header that specifies the node
%% identifier of the collection".
collection_shim(Node) ->
[#xmlel{ns = ?NS_PUBSUB, name ='header',
attrs = [?XMLATTR('name', <<"Collection">>)],
children = [?XMLCDATA(node_to_string(Node))]}].
subid_shim(SubIDs) ->
[#xmlel{ns = ?NS_PUBSUB, name ='header',
attrs = [?XMLATTR('name', <<"SubID">>)],
children = [?XMLCDATA(SubID)]}
|| SubID <- SubIDs].

View File

@ -87,7 +87,7 @@
get_items/2,
get_item/3,
get_cached_item/2,
broadcast_stanza/8,
broadcast_stanza/9,
get_configure/5,
set_configure/5,
tree_action/3,
@ -2815,7 +2815,7 @@ broadcast_publish_item(Host, Node, NodeId, Type, Options, Removed, ItemId, _From
Stanza = event_stanza(
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'items', attrs = nodeAttr(Node), children =
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'item', attrs = itemAttr(ItemId), children = Content}]}]),
broadcast_stanza(Host, Node, NodeId, Type, Options, SubsByDepth, items, Stanza),
broadcast_stanza(Host, Node, NodeId, Type, Options, SubsByDepth, items, Stanza, true),
case Removed of
[] ->
ok;
@ -2825,7 +2825,7 @@ broadcast_publish_item(Host, Node, NodeId, Type, Options, Removed, ItemId, _From
RetractStanza = event_stanza(
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'items', attrs = nodeAttr(Node), children =
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'retract', attrs = itemAttr(RId)} || RId <- Removed]}]),
broadcast_stanza(Host, Node, NodeId, Type, Options, SubsByDepth, items, RetractStanza);
broadcast_stanza(Host, Node, NodeId, Type, Options, SubsByDepth, items, RetractStanza, true);
_ ->
ok
end
@ -2851,7 +2851,7 @@ broadcast_retract_items(Host, Node, NodeId, Type, NodeOptions, ItemIds, ForceNot
Stanza = event_stanza(
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'items', attrs = nodeAttr(Node), children =
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'retract', attrs = itemAttr(ItemId)} || ItemId <- ItemIds]}]),
broadcast_stanza(Host, Node, NodeId, Type, NodeOptions, SubsByDepth, items, Stanza),
broadcast_stanza(Host, Node, NodeId, Type, NodeOptions, SubsByDepth, items, Stanza, true),
{result, true};
_ ->
{result, false}
@ -2870,7 +2870,7 @@ broadcast_purge_node(Host, Node, NodeId, Type, NodeOptions) ->
SubsByDepth when is_list(SubsByDepth) ->
Stanza = event_stanza(
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'purge', attrs = nodeAttr(Node)}]),
broadcast_stanza(Host, Node, NodeId, Type, NodeOptions, SubsByDepth, nodes, Stanza),
broadcast_stanza(Host, Node, NodeId, Type, NodeOptions, SubsByDepth, nodes, Stanza, false),
{result, true};
_ ->
{result, false}
@ -2889,7 +2889,7 @@ broadcast_removed_node(Host, Node, NodeId, Type, NodeOptions, SubsByDepth) ->
_ ->
Stanza = event_stanza(
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'delete', attrs = nodeAttr(Node)}]),
broadcast_stanza(Host, Node, NodeId, Type, NodeOptions, SubsByDepth, nodes, Stanza),
broadcast_stanza(Host, Node, NodeId, Type, NodeOptions, SubsByDepth, nodes, Stanza, false),
{result, true}
end;
_ ->
@ -2915,7 +2915,7 @@ broadcast_config_notification(Host, Node, NodeId, Type, NodeOptions, Lang) ->
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'items', attrs = nodeAttr(Node), children =
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'item', attrs = [?XMLATTR('id', <<"configuration">>)], children =
Content}]}]),
broadcast_stanza(Host, Node, NodeId, Type, NodeOptions, SubsByDepth, nodes, Stanza),
broadcast_stanza(Host, Node, NodeId, Type, NodeOptions, SubsByDepth, nodes, Stanza, false),
{result, true};
_ ->
{result, false}
@ -2972,7 +2972,7 @@ get_options_for_subs(NodeID, Subs) ->
% {result, false}
% end
broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyType, BaseStanza) ->
broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyType, BaseStanza, SHIM) ->
NotificationType = get_option(NodeOptions, notification_type, headline),
BroadcastAll = get_option(NodeOptions, broadcast_all_resources), %% XXX this is not standard, but usefull
From = service_jid(Host),
@ -2981,21 +2981,27 @@ broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyTyp
MsgType -> add_message_type(BaseStanza, atom_to_list(MsgType))
end,
%% Handles explicit subscriptions
NodesByJID = subscribed_nodes_by_jid(NotifyType, SubsByDepth),
lists:foreach(fun ({LJID, Nodes}) ->
LJIDs = case BroadcastAll of
true ->
{U, S, _} = LJID,
[{U, S, R} || R <- user_resources(U, S)];
false ->
[LJID]
end,
SHIMStanza = add_headers(Stanza, collection_shim(Node, Nodes)),
lists:foreach(fun(To) ->
{TU, TS, TR} = To,
ejabberd_router:route(From, exmpp_jid:make(TU, TS, TR), SHIMStanza)
end, LJIDs)
end, NodesByJID),
SubIDsByJID = subscribed_nodes_by_jid(NotifyType, SubsByDepth),
lists:foreach(fun ({LJID, SubIDs}) ->
LJIDs = case BroadcastAll of
true ->
{U, S, _} = LJID,
[{U, S, R} || R <- user_resources(U, S)];
false ->
[LJID]
end,
%% 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)),
add_headers(Stanza, Headers);
false ->
Stanza
end,
lists:foreach(fun({TU, TS, TR}) ->
ejabberd_router:route(From, exmpp_jid:make(TU, TS, TR), StanzaToSend)
end, LJIDs)
end, SubIDsByJID),
%% Handles implicit presence subscriptions
case Host of
{LUser, LServer, LResource} ->
@ -3044,26 +3050,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}, Acc2) ->
case is_to_deliver(LJID, NotifyType, Depth,
NodeOptions, SubOptions) of
true -> [{LJID, NodeId}|Acc2];
false -> Acc2
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),
[{LJID, proplists:append_values(LJID, JIDSubs)} || LJID <- proplists:get_keys(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)
@ -3684,12 +3713,34 @@ itemsEls(Items) ->
add_message_type(#xmlel{name='message'} = El, Type) -> exmpp_stanza:set_type(El, Type);
add_message_type(El, _Type) -> El.
%% Place of <headers/> changed at the bottom of the stanza
%% cf. http://xmpp.org/extensions/xep-0060.html#publisher-publish-success-subid
%%
%% "[SHIM Headers] SHOULD be included after the event notification information
%% (i.e., as the last child of the <message/> stanza)".
add_headers(#xmlel{} = El, HeaderEls) ->
HeaderEl = #xmlel{ns = ?NS_SHIM, name = 'headers', children = HeaderEls},
exmpp_xml:prepend_child(El, HeaderEl).
exmpp_xml:append_child(El, HeaderEl).
collection_shim(Node, Nodes) ->
[#xmlel{ns = ?NS_PUBSUB, name ='header',
attrs = [?XMLATTR('name', <<"Collection">>)],
children = [ ?XMLCDATA(node_to_string(N))]
} || N <- Nodes -- [Node]].
%% Removed multiple <header name=Collection>Foo</header/> elements
%% Didn't seem compliant, but not sure. Confirmation required.
%% cf. http://xmpp.org/extensions/xep-0248.html#notify
%%
%% "If an item is published to a node which is also included by a collection,
%% and an entity is subscribed to that collection with a subscription type of
%% "items" (Is there a way to check that currently ?), then the notifications
%% generated by the service MUST contain additional information. The <items/>
%% element contained in the notification message MUST specify the node
%% identifier of the node that generated the notification (not the collection)
%% and the <item/> element MUST contain a SHIM header that specifies the node
%% identifier of the collection".
collection_shim(Node) ->
[#xmlel{ns = ?NS_PUBSUB, name ='header',
attrs = [?XMLATTR('name', <<"Collection">>)],
children = [?XMLCDATA(node_to_string(Node))]}].
subid_shim(SubIDs) ->
[#xmlel{ns = ?NS_PUBSUB, name ='header',
attrs = [?XMLATTR('name', <<"SubID">>)],
children = [?XMLCDATA(SubID)]}
|| SubID <- SubIDs].

View File

@ -1,5 +1,5 @@
--- mod_pubsub.erl 2009-12-08 15:52:01.000000000 -0300
+++ mod_pubsub_odbc.erl 2009-12-08 15:53:12.000000000 -0300
--- mod_pubsub.erl 2010-01-12 13:31:40.000000000 +0100
+++ mod_pubsub_odbc.erl 2010-01-12 13:32:06.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.
@ -717,7 +717,7 @@
%broadcast(Host, Node, NodeId, Type, NodeOptions, Feature, Force, ElName, SubEls) ->
% case (get_option(NodeOptions, Feature) or Force) of
% true ->
@@ -3335,6 +3146,30 @@
@@ -3364,6 +3175,30 @@
Result
end.
@ -748,7 +748,7 @@
%% @spec (Host, Options) -> MaxItems
%% Host = host()
%% Options = [Option]
@@ -3724,7 +3559,13 @@
@@ -3753,7 +3588,13 @@
tree_action(Host, Function, Args) ->
?DEBUG("tree_action ~p ~p ~p",[Host,Function,Args]),
Fun = fun() -> tree_call(Host, Function, Args) end,
@ -763,7 +763,7 @@
%% @doc <p>node plugin call.</p>
node_call(Type, Function, Args) ->
@@ -3744,13 +3585,13 @@
@@ -3773,13 +3614,13 @@
node_action(Host, Type, Function, Args) ->
?DEBUG("node_action ~p ~p ~p ~p",[Host,Type,Function,Args]),
@ -779,7 +779,7 @@
case tree_call(Host, get_node, [Host, Node]) of
N when is_record(N, pubsub_node) ->
case Action(N) of
@@ -3763,8 +3604,15 @@
@@ -3792,8 +3633,15 @@
end
end, Trans).
@ -797,7 +797,7 @@
{result, Result} -> {result, Result};
{error, Error} -> {error, Error};
{atomic, {result, Result}} -> {result, Result};
@@ -3772,6 +3620,15 @@
@@ -3801,6 +3649,15 @@
{aborted, Reason} ->
?ERROR_MSG("transaction return internal error: ~p~n", [{aborted, Reason}]),
{error, 'internal-server-error'};
@ -813,7 +813,7 @@
{'EXIT', Reason} ->
?ERROR_MSG("transaction return internal error: ~p~n", [{'EXIT', Reason}]),
{error, 'internal-server-error'};
@@ -3780,6 +3637,16 @@
@@ -3809,6 +3666,16 @@
{error, 'internal-server-error'}
end.