mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
fix EJAB-1044 and EJAB-1055
SVN Revision: 2628
This commit is contained in:
parent
667fc07ec6
commit
b168cd7cf2
@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
-module(mod_pubsub).
|
-module(mod_pubsub).
|
||||||
-author('christophe.romain@process-one.net').
|
-author('christophe.romain@process-one.net').
|
||||||
-version('1.12-06').
|
-version('1.13-0').
|
||||||
|
|
||||||
-behaviour(gen_server).
|
-behaviour(gen_server).
|
||||||
-behaviour(gen_mod).
|
-behaviour(gen_mod).
|
||||||
@ -483,7 +483,7 @@ send_loop(State) ->
|
|||||||
#pubsub_node{nodeid = {H, N}, type = Type, id = NodeId, options = Options} = Node,
|
#pubsub_node{nodeid = {H, N}, type = Type, id = NodeId, options = Options} = Node,
|
||||||
case get_option(Options, send_last_published_item) of
|
case get_option(Options, send_last_published_item) of
|
||||||
on_sub_and_presence ->
|
on_sub_and_presence ->
|
||||||
send_items(H, N, NodeId, Type, SubJID, last);
|
send_items(H, N, NodeId, Type, LJID, last);
|
||||||
_ ->
|
_ ->
|
||||||
ok
|
ok
|
||||||
end;
|
end;
|
||||||
@ -3087,10 +3087,14 @@ get_options_for_subs(NodeID, Subs) ->
|
|||||||
% {result, false}
|
% {result, false}
|
||||||
% end
|
% end
|
||||||
|
|
||||||
broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyType, Stanza) ->
|
broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyType, BaseStanza) ->
|
||||||
%AccessModel = get_option(NodeOptions, access_model),
|
NotificationType = get_option(NodeOptions, notification_type),
|
||||||
BroadcastAll = get_option(NodeOptions, broadcast_all_resources), %% XXX this is not standard, but usefull
|
BroadcastAll = get_option(NodeOptions, broadcast_all_resources), %% XXX this is not standard, but usefull
|
||||||
From = service_jid(Host),
|
From = service_jid(Host),
|
||||||
|
Stanza = case NotificationType of
|
||||||
|
normal -> BaseStanza;
|
||||||
|
MsgType -> add_message_type(BaseStanza, atom_to_list(MsgType))
|
||||||
|
end,
|
||||||
%% Handles explicit subscriptions
|
%% Handles explicit subscriptions
|
||||||
NodesByJID = subscribed_nodes_by_jid(NotifyType, SubsByDepth),
|
NodesByJID = subscribed_nodes_by_jid(NotifyType, SubsByDepth),
|
||||||
lists:foreach(fun ({LJID, Nodes}) ->
|
lists:foreach(fun ({LJID, Nodes}) ->
|
||||||
@ -3335,6 +3339,8 @@ get_configure_xfields(_Type, Options, Lang, Groups) ->
|
|||||||
?LISTM_CONFIG_FIELD("Roster groups allowed to subscribe", roster_groups_allowed, Groups),
|
?LISTM_CONFIG_FIELD("Roster groups allowed to subscribe", roster_groups_allowed, Groups),
|
||||||
?ALIST_CONFIG_FIELD("Specify the publisher model", publish_model,
|
?ALIST_CONFIG_FIELD("Specify the publisher model", publish_model,
|
||||||
[publishers, subscribers, open]),
|
[publishers, subscribers, open]),
|
||||||
|
?ALIST_CONFIG_FIELD("Specify the event message type", notification_type,
|
||||||
|
[headline, normal]),
|
||||||
?INTEGER_CONFIG_FIELD("Max payload size in bytes", max_payload_size),
|
?INTEGER_CONFIG_FIELD("Max payload size in bytes", max_payload_size),
|
||||||
?ALIST_CONFIG_FIELD("When to send the last published item", send_last_published_item,
|
?ALIST_CONFIG_FIELD("When to send the last published item", send_last_published_item,
|
||||||
[never, on_sub, on_sub_and_presence]),
|
[never, on_sub, on_sub_and_presence]),
|
||||||
@ -3466,6 +3472,8 @@ set_xoption(Host, [{"pubsub#access_model", [Val]} | Opts], NewOpts) ->
|
|||||||
?SET_ALIST_XOPT(access_model, Val, [open, authorize, presence, roster, whitelist]);
|
?SET_ALIST_XOPT(access_model, Val, [open, authorize, presence, roster, whitelist]);
|
||||||
set_xoption(Host, [{"pubsub#publish_model", [Val]} | Opts], NewOpts) ->
|
set_xoption(Host, [{"pubsub#publish_model", [Val]} | Opts], NewOpts) ->
|
||||||
?SET_ALIST_XOPT(publish_model, Val, [publishers, subscribers, open]);
|
?SET_ALIST_XOPT(publish_model, Val, [publishers, subscribers, open]);
|
||||||
|
set_xoption(Host, [{"pubsub#notification_type", [Val]} | Opts], NewOpts) ->
|
||||||
|
?SET_ALIST_XOPT(notification_type, Val, [headline, normal]);
|
||||||
set_xoption(Host, [{"pubsub#node_type", [Val]} | Opts], NewOpts) ->
|
set_xoption(Host, [{"pubsub#node_type", [Val]} | Opts], NewOpts) ->
|
||||||
?SET_ALIST_XOPT(node_type, Val, [leaf, collection]);
|
?SET_ALIST_XOPT(node_type, Val, [leaf, collection]);
|
||||||
set_xoption(Host, [{"pubsub#max_payload_size", [Val]} | Opts], NewOpts) ->
|
set_xoption(Host, [{"pubsub#max_payload_size", [Val]} | Opts], NewOpts) ->
|
||||||
@ -3730,6 +3738,9 @@ itemsEls(Items) ->
|
|||||||
#xmlel{ns = ?NS_PUBSUB, name = 'item', attrs = itemAttr(ItemId), children = Payload}
|
#xmlel{ns = ?NS_PUBSUB, name = 'item', attrs = itemAttr(ItemId), children = Payload}
|
||||||
end, Items).
|
end, Items).
|
||||||
|
|
||||||
|
add_message_type(#xmlel{name='message'} = El, Type) -> exmpp_stanza:set_type(El, Type);
|
||||||
|
add_message_type(El, _Type) -> El.
|
||||||
|
|
||||||
add_headers(#xmlel{} = El, HeaderEls) ->
|
add_headers(#xmlel{} = El, HeaderEls) ->
|
||||||
HeaderEl = #xmlel{ns = ?NS_SHIM, name = 'headers', children = HeaderEls},
|
HeaderEl = #xmlel{ns = ?NS_SHIM, name = 'headers', children = HeaderEls},
|
||||||
exmpp_xml:prepend_child(El, HeaderEl).
|
exmpp_xml:prepend_child(El, HeaderEl).
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
-module(mod_pubsub_odbc).
|
-module(mod_pubsub_odbc).
|
||||||
-author('christophe.romain@process-one.net').
|
-author('christophe.romain@process-one.net').
|
||||||
-version('1.12-06').
|
-version('1.13-0').
|
||||||
|
|
||||||
-behaviour(gen_server).
|
-behaviour(gen_server).
|
||||||
-behaviour(gen_mod).
|
-behaviour(gen_mod).
|
||||||
@ -305,14 +305,14 @@ send_loop(State) ->
|
|||||||
%% and if the node is so configured, send the last published item to From
|
%% and if the node is so configured, send the last published item to From
|
||||||
lists:foreach(fun(PType) ->
|
lists:foreach(fun(PType) ->
|
||||||
Subscriptions = case catch node_action(Host, PType, get_entity_subscriptions_for_send_last, [Host, JID]) of
|
Subscriptions = case catch node_action(Host, PType, get_entity_subscriptions_for_send_last, [Host, JID]) of
|
||||||
{result, S} -> S;
|
{result, S} -> S;
|
||||||
_ -> []
|
_ -> []
|
||||||
end,
|
end,
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun({Node, subscribed, _, SubJID}) ->
|
fun({Node, subscribed, _, SubJID}) ->
|
||||||
if (SubJID == LJID) or (SubJID == BJID) ->
|
if (SubJID == LJID) or (SubJID == BJID) ->
|
||||||
#pubsub_node{nodeid = {H, N}, type = Type, id = NodeId} = Node,
|
#pubsub_node{nodeid = {H, N}, type = Type, id = NodeId} = Node,
|
||||||
send_items(H, N, NodeId, Type, SubJID, last);
|
send_items(H, N, NodeId, Type, LJID, last);
|
||||||
true ->
|
true ->
|
||||||
% resource not concerned about that subscription
|
% resource not concerned about that subscription
|
||||||
ok
|
ok
|
||||||
@ -2918,10 +2918,14 @@ get_options_for_subs(NodeID, Subs) ->
|
|||||||
% {result, false}
|
% {result, false}
|
||||||
% end
|
% end
|
||||||
|
|
||||||
broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyType, Stanza) ->
|
broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyType, BaseStanza) ->
|
||||||
%AccessModel = get_option(NodeOptions, access_model),
|
NotificationType = get_option(NodeOptions, notification_type),
|
||||||
BroadcastAll = get_option(NodeOptions, broadcast_all_resources), %% XXX this is not standard, but usefull
|
BroadcastAll = get_option(NodeOptions, broadcast_all_resources), %% XXX this is not standard, but usefull
|
||||||
From = service_jid(Host),
|
From = service_jid(Host),
|
||||||
|
Stanza = case NotificationType of
|
||||||
|
normal -> BaseStanza;
|
||||||
|
MsgType -> add_message_type(BaseStanza, atom_to_list(MsgType))
|
||||||
|
end,
|
||||||
%% Handles explicit subscriptions
|
%% Handles explicit subscriptions
|
||||||
NodesByJID = subscribed_nodes_by_jid(NotifyType, SubsByDepth),
|
NodesByJID = subscribed_nodes_by_jid(NotifyType, SubsByDepth),
|
||||||
lists:foreach(fun ({LJID, Nodes}) ->
|
lists:foreach(fun ({LJID, Nodes}) ->
|
||||||
@ -3190,6 +3194,8 @@ get_configure_xfields(_Type, Options, Lang, Groups) ->
|
|||||||
?LISTM_CONFIG_FIELD("Roster groups allowed to subscribe", roster_groups_allowed, Groups),
|
?LISTM_CONFIG_FIELD("Roster groups allowed to subscribe", roster_groups_allowed, Groups),
|
||||||
?ALIST_CONFIG_FIELD("Specify the publisher model", publish_model,
|
?ALIST_CONFIG_FIELD("Specify the publisher model", publish_model,
|
||||||
[publishers, subscribers, open]),
|
[publishers, subscribers, open]),
|
||||||
|
?ALIST_CONFIG_FIELD("Specify the event message type", notification_type,
|
||||||
|
[headline, normal]),
|
||||||
?INTEGER_CONFIG_FIELD("Max payload size in bytes", max_payload_size),
|
?INTEGER_CONFIG_FIELD("Max payload size in bytes", max_payload_size),
|
||||||
?ALIST_CONFIG_FIELD("When to send the last published item", send_last_published_item,
|
?ALIST_CONFIG_FIELD("When to send the last published item", send_last_published_item,
|
||||||
[never, on_sub, on_sub_and_presence]),
|
[never, on_sub, on_sub_and_presence]),
|
||||||
@ -3321,6 +3327,8 @@ set_xoption(Host, [{"pubsub#access_model", [Val]} | Opts], NewOpts) ->
|
|||||||
?SET_ALIST_XOPT(access_model, Val, [open, authorize, presence, roster, whitelist]);
|
?SET_ALIST_XOPT(access_model, Val, [open, authorize, presence, roster, whitelist]);
|
||||||
set_xoption(Host, [{"pubsub#publish_model", [Val]} | Opts], NewOpts) ->
|
set_xoption(Host, [{"pubsub#publish_model", [Val]} | Opts], NewOpts) ->
|
||||||
?SET_ALIST_XOPT(publish_model, Val, [publishers, subscribers, open]);
|
?SET_ALIST_XOPT(publish_model, Val, [publishers, subscribers, open]);
|
||||||
|
set_xoption(Host, [{"pubsub#notification_type", [Val]} | Opts], NewOpts) ->
|
||||||
|
?SET_ALIST_XOPT(notification_type, Val, [headline, normal]);
|
||||||
set_xoption(Host, [{"pubsub#node_type", [Val]} | Opts], NewOpts) ->
|
set_xoption(Host, [{"pubsub#node_type", [Val]} | Opts], NewOpts) ->
|
||||||
?SET_ALIST_XOPT(node_type, Val, [leaf, collection]);
|
?SET_ALIST_XOPT(node_type, Val, [leaf, collection]);
|
||||||
set_xoption(Host, [{"pubsub#max_payload_size", [Val]} | Opts], NewOpts) ->
|
set_xoption(Host, [{"pubsub#max_payload_size", [Val]} | Opts], NewOpts) ->
|
||||||
@ -3617,6 +3625,9 @@ itemsEls(Items) ->
|
|||||||
#xmlel{ns = ?NS_PUBSUB, name = 'item', attrs = itemAttr(ItemId), children = Payload}
|
#xmlel{ns = ?NS_PUBSUB, name = 'item', attrs = itemAttr(ItemId), children = Payload}
|
||||||
end, Items).
|
end, Items).
|
||||||
|
|
||||||
|
add_message_type(#xmlel{name='message'} = El, Type) -> exmpp_stanza:set_type(El, Type);
|
||||||
|
add_message_type(El, _Type) -> El.
|
||||||
|
|
||||||
add_headers(#xmlel{} = El, HeaderEls) ->
|
add_headers(#xmlel{} = El, HeaderEls) ->
|
||||||
HeaderEl = #xmlel{ns = ?NS_SHIM, name = 'headers', children = HeaderEls},
|
HeaderEl = #xmlel{ns = ?NS_SHIM, name = 'headers', children = HeaderEls},
|
||||||
exmpp_xml:prepend_child(El, HeaderEl).
|
exmpp_xml:prepend_child(El, HeaderEl).
|
||||||
|
@ -86,6 +86,7 @@ options() ->
|
|||||||
{access_model, open},
|
{access_model, open},
|
||||||
{roster_groups_allowed, []},
|
{roster_groups_allowed, []},
|
||||||
{publish_model, publishers},
|
{publish_model, publishers},
|
||||||
|
{notification_type, headline},
|
||||||
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
||||||
{send_last_published_item, on_sub_and_presence},
|
{send_last_published_item, on_sub_and_presence},
|
||||||
{deliver_notifications, true},
|
{deliver_notifications, true},
|
||||||
|
@ -90,6 +90,7 @@ options() ->
|
|||||||
{access_model, presence},
|
{access_model, presence},
|
||||||
{roster_groups_allowed, []},
|
{roster_groups_allowed, []},
|
||||||
{publish_model, publishers},
|
{publish_model, publishers},
|
||||||
|
{notification_type, headline},
|
||||||
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
||||||
{send_last_published_item, never},
|
{send_last_published_item, never},
|
||||||
{deliver_notifications, true},
|
{deliver_notifications, true},
|
||||||
|
@ -89,6 +89,7 @@ options() ->
|
|||||||
{access_model, authorize},
|
{access_model, authorize},
|
||||||
{roster_groups_allowed, []},
|
{roster_groups_allowed, []},
|
||||||
{publish_model, publishers},
|
{publish_model, publishers},
|
||||||
|
{notification_type, headline},
|
||||||
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
||||||
{send_last_published_item, never},
|
{send_last_published_item, never},
|
||||||
{deliver_notifications, true},
|
{deliver_notifications, true},
|
||||||
|
@ -87,6 +87,7 @@ options() ->
|
|||||||
{access_model, open},
|
{access_model, open},
|
||||||
{roster_groups_allowed, []},
|
{roster_groups_allowed, []},
|
||||||
{publish_model, publishers},
|
{publish_model, publishers},
|
||||||
|
{notification_type, headline},
|
||||||
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
||||||
{send_last_published_item, never},
|
{send_last_published_item, never},
|
||||||
{deliver_notifications, true},
|
{deliver_notifications, true},
|
||||||
|
@ -80,6 +80,7 @@ options() ->
|
|||||||
{access_model, open},
|
{access_model, open},
|
||||||
{roster_groups_allowed, []},
|
{roster_groups_allowed, []},
|
||||||
{publish_model, publishers},
|
{publish_model, publishers},
|
||||||
|
{notification_type, headline},
|
||||||
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
||||||
{send_last_published_item, on_sub_and_presence},
|
{send_last_published_item, on_sub_and_presence},
|
||||||
{deliver_notifications, true},
|
{deliver_notifications, true},
|
||||||
|
@ -81,6 +81,7 @@ options() ->
|
|||||||
{access_model, open},
|
{access_model, open},
|
||||||
{roster_groups_allowed, []},
|
{roster_groups_allowed, []},
|
||||||
{publish_model, publishers},
|
{publish_model, publishers},
|
||||||
|
{notification_type, headline},
|
||||||
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
||||||
{send_last_published_item, on_sub_and_presence},
|
{send_last_published_item, on_sub_and_presence},
|
||||||
{deliver_notifications, true},
|
{deliver_notifications, true},
|
||||||
|
@ -143,6 +143,7 @@ options() ->
|
|||||||
{access_model, open},
|
{access_model, open},
|
||||||
{roster_groups_allowed, []},
|
{roster_groups_allowed, []},
|
||||||
{publish_model, publishers},
|
{publish_model, publishers},
|
||||||
|
{notification_type, headline},
|
||||||
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
||||||
{send_last_published_item, on_sub_and_presence},
|
{send_last_published_item, on_sub_and_presence},
|
||||||
{deliver_notifications, true},
|
{deliver_notifications, true},
|
||||||
|
@ -145,6 +145,7 @@ options() ->
|
|||||||
{access_model, open},
|
{access_model, open},
|
||||||
{roster_groups_allowed, []},
|
{roster_groups_allowed, []},
|
||||||
{publish_model, publishers},
|
{publish_model, publishers},
|
||||||
|
{notification_type, headline},
|
||||||
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
||||||
{send_last_published_item, on_sub_and_presence},
|
{send_last_published_item, on_sub_and_presence},
|
||||||
{deliver_notifications, true},
|
{deliver_notifications, true},
|
||||||
|
@ -93,6 +93,7 @@ options() ->
|
|||||||
{access_model, presence},
|
{access_model, presence},
|
||||||
{roster_groups_allowed, []},
|
{roster_groups_allowed, []},
|
||||||
{publish_model, publishers},
|
{publish_model, publishers},
|
||||||
|
{notification_type, headline},
|
||||||
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
||||||
{send_last_published_item, on_sub_and_presence},
|
{send_last_published_item, on_sub_and_presence},
|
||||||
{deliver_notifications, true},
|
{deliver_notifications, true},
|
||||||
|
@ -88,6 +88,7 @@ options() ->
|
|||||||
{access_model, presence},
|
{access_model, presence},
|
||||||
{roster_groups_allowed, []},
|
{roster_groups_allowed, []},
|
||||||
{publish_model, publishers},
|
{publish_model, publishers},
|
||||||
|
{notification_type, headline},
|
||||||
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
||||||
{send_last_published_item, on_sub_and_presence},
|
{send_last_published_item, on_sub_and_presence},
|
||||||
{deliver_notifications, true},
|
{deliver_notifications, true},
|
||||||
|
@ -95,6 +95,7 @@ options() ->
|
|||||||
{access_model, presence},
|
{access_model, presence},
|
||||||
{roster_groups_allowed, []},
|
{roster_groups_allowed, []},
|
||||||
{publish_model, publishers},
|
{publish_model, publishers},
|
||||||
|
{notification_type, headline},
|
||||||
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
||||||
{send_last_published_item, on_sub_and_presence},
|
{send_last_published_item, on_sub_and_presence},
|
||||||
{deliver_notifications, true},
|
{deliver_notifications, true},
|
||||||
|
@ -90,6 +90,7 @@ options() ->
|
|||||||
{access_model, whitelist},
|
{access_model, whitelist},
|
||||||
{roster_groups_allowed, []},
|
{roster_groups_allowed, []},
|
||||||
{publish_model, publishers},
|
{publish_model, publishers},
|
||||||
|
{notification_type, headline},
|
||||||
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
||||||
{send_last_published_item, never},
|
{send_last_published_item, never},
|
||||||
{deliver_notifications, false},
|
{deliver_notifications, false},
|
||||||
|
@ -91,6 +91,7 @@ options() ->
|
|||||||
{access_model, open},
|
{access_model, open},
|
||||||
{roster_groups_allowed, []},
|
{roster_groups_allowed, []},
|
||||||
{publish_model, publishers},
|
{publish_model, publishers},
|
||||||
|
{notification_type, headline},
|
||||||
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
{max_payload_size, ?MAX_PAYLOAD_SIZE},
|
||||||
{send_last_published_item, never},
|
{send_last_published_item, never},
|
||||||
{deliver_notifications, true},
|
{deliver_notifications, true},
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
--- mod_pubsub.erl 2009-09-23 18:18:35.000000000 +0200
|
--- mod_pubsub.erl 2009-09-24 21:40:32.000000000 +0200
|
||||||
+++ mod_pubsub_odbc.erl 2009-09-23 18:26:41.000000000 +0200
|
+++ mod_pubsub_odbc.erl 2009-09-24 21:46:01.000000000 +0200
|
||||||
@@ -45,7 +45,7 @@
|
@@ -45,7 +45,7 @@
|
||||||
%%% TODO
|
%%% TODO
|
||||||
%%% plugin: generate Reply (do not use broadcast atom anymore)
|
%%% plugin: generate Reply (do not use broadcast atom anymore)
|
||||||
@ -7,7 +7,7 @@
|
|||||||
--module(mod_pubsub).
|
--module(mod_pubsub).
|
||||||
+-module(mod_pubsub_odbc).
|
+-module(mod_pubsub_odbc).
|
||||||
-author('christophe.romain@process-one.net').
|
-author('christophe.romain@process-one.net').
|
||||||
-version('1.12-06').
|
-version('1.13-0').
|
||||||
|
|
||||||
@@ -58,9 +58,9 @@
|
@@ -58,9 +58,9 @@
|
||||||
-include("adhoc.hrl").
|
-include("adhoc.hrl").
|
||||||
@ -233,21 +233,21 @@
|
|||||||
lists:foreach(fun(PType) ->
|
lists:foreach(fun(PType) ->
|
||||||
- {result, Subscriptions} = node_action(Host, PType, get_entity_subscriptions, [Host, JID]),
|
- {result, Subscriptions} = node_action(Host, PType, get_entity_subscriptions, [Host, JID]),
|
||||||
+ Subscriptions = case catch node_action(Host, PType, get_entity_subscriptions_for_send_last, [Host, JID]) of
|
+ Subscriptions = case catch node_action(Host, PType, get_entity_subscriptions_for_send_last, [Host, JID]) of
|
||||||
+ {result, S} -> S;
|
+ {result, S} -> S;
|
||||||
+ _ -> []
|
+ _ -> []
|
||||||
+ end,
|
+ end,
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun({Node, subscribed, _, SubJID}) ->
|
fun({Node, subscribed, _, SubJID}) ->
|
||||||
if (SubJID == LJID) or (SubJID == BJID) ->
|
if (SubJID == LJID) or (SubJID == BJID) ->
|
||||||
- #pubsub_node{nodeid = {H, N}, type = Type, id = NodeId, options = Options} = Node,
|
- #pubsub_node{nodeid = {H, N}, type = Type, id = NodeId, options = Options} = Node,
|
||||||
- case get_option(Options, send_last_published_item) of
|
- case get_option(Options, send_last_published_item) of
|
||||||
- on_sub_and_presence ->
|
- on_sub_and_presence ->
|
||||||
- send_items(H, N, NodeId, Type, SubJID, last);
|
- send_items(H, N, NodeId, Type, LJID, last);
|
||||||
- _ ->
|
- _ ->
|
||||||
- ok
|
- ok
|
||||||
- end;
|
- end;
|
||||||
+ #pubsub_node{nodeid = {H, N}, type = Type, id = NodeId} = Node,
|
+ #pubsub_node{nodeid = {H, N}, type = Type, id = NodeId} = Node,
|
||||||
+ send_items(H, N, NodeId, Type, SubJID, last);
|
+ send_items(H, N, NodeId, Type, LJID, last);
|
||||||
true ->
|
true ->
|
||||||
% resource not concerned about that subscription
|
% resource not concerned about that subscription
|
||||||
ok
|
ok
|
||||||
@ -622,7 +622,7 @@
|
|||||||
_ -> Acc
|
_ -> Acc
|
||||||
end;
|
end;
|
||||||
(_, Acc) ->
|
(_, Acc) ->
|
||||||
@@ -3257,6 +3088,30 @@
|
@@ -3261,6 +3092,30 @@
|
||||||
Result
|
Result
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@ -653,7 +653,7 @@
|
|||||||
%% @spec (Host, Options) -> MaxItems
|
%% @spec (Host, Options) -> MaxItems
|
||||||
%% Host = host()
|
%% Host = host()
|
||||||
%% Options = [Option]
|
%% Options = [Option]
|
||||||
@@ -3642,7 +3497,13 @@
|
@@ -3650,7 +3505,13 @@
|
||||||
tree_action(Host, Function, Args) ->
|
tree_action(Host, Function, Args) ->
|
||||||
?DEBUG("tree_action ~p ~p ~p",[Host,Function,Args]),
|
?DEBUG("tree_action ~p ~p ~p",[Host,Function,Args]),
|
||||||
Fun = fun() -> tree_call(Host, Function, Args) end,
|
Fun = fun() -> tree_call(Host, Function, Args) end,
|
||||||
@ -668,7 +668,7 @@
|
|||||||
|
|
||||||
%% @doc <p>node plugin call.</p>
|
%% @doc <p>node plugin call.</p>
|
||||||
node_call(Type, Function, Args) ->
|
node_call(Type, Function, Args) ->
|
||||||
@@ -3662,13 +3523,13 @@
|
@@ -3670,13 +3531,13 @@
|
||||||
|
|
||||||
node_action(Host, Type, Function, Args) ->
|
node_action(Host, Type, Function, Args) ->
|
||||||
?DEBUG("node_action ~p ~p ~p ~p",[Host,Type,Function,Args]),
|
?DEBUG("node_action ~p ~p ~p ~p",[Host,Type,Function,Args]),
|
||||||
@ -684,7 +684,7 @@
|
|||||||
case tree_call(Host, get_node, [Host, Node]) of
|
case tree_call(Host, get_node, [Host, Node]) of
|
||||||
N when is_record(N, pubsub_node) ->
|
N when is_record(N, pubsub_node) ->
|
||||||
case Action(N) of
|
case Action(N) of
|
||||||
@@ -3681,8 +3542,15 @@
|
@@ -3689,8 +3550,15 @@
|
||||||
end
|
end
|
||||||
end, Trans).
|
end, Trans).
|
||||||
|
|
||||||
@ -702,7 +702,7 @@
|
|||||||
{result, Result} -> {result, Result};
|
{result, Result} -> {result, Result};
|
||||||
{error, Error} -> {error, Error};
|
{error, Error} -> {error, Error};
|
||||||
{atomic, {result, Result}} -> {result, Result};
|
{atomic, {result, Result}} -> {result, Result};
|
||||||
@@ -3690,6 +3558,15 @@
|
@@ -3698,6 +3566,15 @@
|
||||||
{aborted, Reason} ->
|
{aborted, Reason} ->
|
||||||
?ERROR_MSG("transaction return internal error: ~p~n", [{aborted, Reason}]),
|
?ERROR_MSG("transaction return internal error: ~p~n", [{aborted, Reason}]),
|
||||||
{error, 'internal-server-error'};
|
{error, 'internal-server-error'};
|
||||||
@ -718,7 +718,7 @@
|
|||||||
{'EXIT', Reason} ->
|
{'EXIT', Reason} ->
|
||||||
?ERROR_MSG("transaction return internal error: ~p~n", [{'EXIT', Reason}]),
|
?ERROR_MSG("transaction return internal error: ~p~n", [{'EXIT', Reason}]),
|
||||||
{error, 'internal-server-error'};
|
{error, 'internal-server-error'};
|
||||||
@@ -3698,6 +3575,16 @@
|
@@ -3706,6 +3583,16 @@
|
||||||
{error, 'internal-server-error'}
|
{error, 'internal-server-error'}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user