mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
make last_item_cache feature cluster aware (EJAB-1234)
This commit is contained in:
parent
a5f8aeb6da
commit
07e870271e
@ -183,9 +183,8 @@ init([ServerHost, Opts]) ->
|
|||||||
pubsub_index:init(Host, ServerHost, Opts),
|
pubsub_index:init(Host, ServerHost, Opts),
|
||||||
ets:new(gen_mod:get_module_proc(Host, config), [set, named_table]),
|
ets:new(gen_mod:get_module_proc(Host, config), [set, named_table]),
|
||||||
ets:new(gen_mod:get_module_proc(ServerHost, config), [set, named_table]),
|
ets:new(gen_mod:get_module_proc(ServerHost, config), [set, named_table]),
|
||||||
ets:new(gen_mod:get_module_proc(Host, last_items), [set, named_table]),
|
|
||||||
ets:new(gen_mod:get_module_proc(ServerHost, last_items), [set, named_table]),
|
|
||||||
{Plugins, NodeTree, PepMapping} = init_plugins(Host, ServerHost, Opts),
|
{Plugins, NodeTree, PepMapping} = init_plugins(Host, ServerHost, Opts),
|
||||||
|
mnesia:create_table(pubsub_last_item, [{ram_copies, [node()]}, {attributes, record_info(fields, pubsub_last_item)}]),
|
||||||
mod_disco:register_feature(ServerHost, ?NS_PUBSUB),
|
mod_disco:register_feature(ServerHost, ?NS_PUBSUB),
|
||||||
ets:insert(gen_mod:get_module_proc(Host, config), {nodetree, NodeTree}),
|
ets:insert(gen_mod:get_module_proc(Host, config), {nodetree, NodeTree}),
|
||||||
ets:insert(gen_mod:get_module_proc(Host, config), {plugins, Plugins}),
|
ets:insert(gen_mod:get_module_proc(Host, config), {plugins, Plugins}),
|
||||||
@ -2054,7 +2053,7 @@ publish_item(Host, ServerHost, Node, Publisher, ItemId, Payload) ->
|
|||||||
PluginPayload -> PluginPayload
|
PluginPayload -> PluginPayload
|
||||||
end,
|
end,
|
||||||
broadcast_publish_item(Host, Node, NodeId, Type, Options, Removed, ItemId, jlib:jid_tolower(Publisher), BroadcastPayload),
|
broadcast_publish_item(Host, Node, NodeId, Type, Options, Removed, ItemId, jlib:jid_tolower(Publisher), BroadcastPayload),
|
||||||
set_cached_item(Host, NodeId, ItemId, Payload),
|
set_cached_item(Host, NodeId, ItemId, Publisher, Payload),
|
||||||
case Result of
|
case Result of
|
||||||
default -> {result, Reply};
|
default -> {result, Reply};
|
||||||
_ -> {result, Result}
|
_ -> {result, Result}
|
||||||
@ -2064,14 +2063,14 @@ publish_item(Host, ServerHost, Node, Publisher, ItemId, Payload) ->
|
|||||||
Type = TNode#pubsub_node.type,
|
Type = TNode#pubsub_node.type,
|
||||||
Options = TNode#pubsub_node.options,
|
Options = TNode#pubsub_node.options,
|
||||||
broadcast_retract_items(Host, Node, NodeId, Type, Options, Removed),
|
broadcast_retract_items(Host, Node, NodeId, Type, Options, Removed),
|
||||||
set_cached_item(Host, NodeId, ItemId, Payload),
|
set_cached_item(Host, NodeId, ItemId, Publisher, Payload),
|
||||||
{result, Reply};
|
{result, Reply};
|
||||||
{result, {TNode, {Result, Removed}}} ->
|
{result, {TNode, {Result, Removed}}} ->
|
||||||
NodeId = TNode#pubsub_node.id,
|
NodeId = TNode#pubsub_node.id,
|
||||||
Type = TNode#pubsub_node.type,
|
Type = TNode#pubsub_node.type,
|
||||||
Options = TNode#pubsub_node.options,
|
Options = TNode#pubsub_node.options,
|
||||||
broadcast_retract_items(Host, Node, NodeId, Type, Options, Removed),
|
broadcast_retract_items(Host, Node, NodeId, Type, Options, Removed),
|
||||||
set_cached_item(Host, NodeId, ItemId, Payload),
|
set_cached_item(Host, NodeId, ItemId, Publisher, Payload),
|
||||||
{result, Result};
|
{result, Result};
|
||||||
{result, {_, default}} ->
|
{result, {_, default}} ->
|
||||||
{result, Reply};
|
{result, Reply};
|
||||||
@ -2310,10 +2309,10 @@ send_items(Host, Node, NodeId, Type, LJID, last) ->
|
|||||||
undefined ->
|
undefined ->
|
||||||
send_items(Host, Node, NodeId, Type, LJID, 1);
|
send_items(Host, Node, NodeId, Type, LJID, 1);
|
||||||
LastItem ->
|
LastItem ->
|
||||||
{ModifNow, ModifLjid} = LastItem#pubsub_item.modification,
|
{ModifNow, ModifUSR} = LastItem#pubsub_item.modification,
|
||||||
Stanza = event_stanza_with_delay(
|
Stanza = event_stanza_with_delay(
|
||||||
[{xmlelement, "items", nodeAttr(Node),
|
[{xmlelement, "items", nodeAttr(Node),
|
||||||
itemsEls([LastItem])}], ModifNow, ModifLjid),
|
itemsEls([LastItem])}], ModifNow, ModifUSR),
|
||||||
ejabberd_router:route(service_jid(Host), jlib:make_jid(LJID), Stanza)
|
ejabberd_router:route(service_jid(Host), jlib:make_jid(LJID), Stanza)
|
||||||
end;
|
end;
|
||||||
send_items(Host, Node, NodeId, Type, LJID, Number) ->
|
send_items(Host, Node, NodeId, Type, LJID, Number) ->
|
||||||
@ -2330,10 +2329,10 @@ send_items(Host, Node, NodeId, Type, LJID, Number) ->
|
|||||||
end,
|
end,
|
||||||
Stanza = case ToSend of
|
Stanza = case ToSend of
|
||||||
[LastItem] ->
|
[LastItem] ->
|
||||||
{ModifNow, ModifLjid} = LastItem#pubsub_item.modification,
|
{ModifNow, ModifUSR} = LastItem#pubsub_item.modification,
|
||||||
event_stanza_with_delay(
|
event_stanza_with_delay(
|
||||||
[{xmlelement, "items", nodeAttr(Node),
|
[{xmlelement, "items", nodeAttr(Node),
|
||||||
itemsEls(ToSend)}], ModifNow, ModifLjid);
|
itemsEls(ToSend)}], ModifNow, ModifUSR);
|
||||||
_ ->
|
_ ->
|
||||||
event_stanza(
|
event_stanza(
|
||||||
[{xmlelement, "items", nodeAttr(Node),
|
[{xmlelement, "items", nodeAttr(Node),
|
||||||
@ -2947,9 +2946,9 @@ payload_xmlelements([_|Tail], Count) -> payload_xmlelements(Tail, Count).
|
|||||||
event_stanza(Els) ->
|
event_stanza(Els) ->
|
||||||
event_stanza_withmoreels(Els, []).
|
event_stanza_withmoreels(Els, []).
|
||||||
|
|
||||||
event_stanza_with_delay(Els, ModifNow, ModifLjid) ->
|
event_stanza_with_delay(Els, ModifNow, ModifUSR) ->
|
||||||
DateTime = calendar:now_to_datetime(ModifNow),
|
DateTime = calendar:now_to_datetime(ModifNow),
|
||||||
MoreEls = [jlib:timestamp_to_xml(DateTime, utc, ModifLjid, "")],
|
MoreEls = [jlib:timestamp_to_xml(DateTime, utc, ModifUSR, "")],
|
||||||
event_stanza_withmoreels(Els, MoreEls).
|
event_stanza_withmoreels(Els, MoreEls).
|
||||||
|
|
||||||
event_stanza_withmoreels(Els, MoreEls) ->
|
event_stanza_withmoreels(Els, MoreEls) ->
|
||||||
@ -3557,18 +3556,18 @@ is_last_item_cache_enabled(Host) ->
|
|||||||
_ -> false
|
_ -> false
|
||||||
end.
|
end.
|
||||||
|
|
||||||
set_cached_item({_, ServerHost, _}, NodeId, ItemId, Payload) ->
|
set_cached_item({_, ServerHost, _}, NodeId, ItemId, Publisher, Payload) ->
|
||||||
set_cached_item(ServerHost, NodeId, ItemId, Payload);
|
set_cached_item(ServerHost, NodeId, ItemId, Publisher, Payload);
|
||||||
set_cached_item(Host, NodeId, ItemId, Payload) ->
|
set_cached_item(Host, NodeId, ItemId, Publisher, Payload) ->
|
||||||
case is_last_item_cache_enabled(Host) of
|
case is_last_item_cache_enabled(Host) of
|
||||||
true -> ets:insert(gen_mod:get_module_proc(Host, last_items), {NodeId, {ItemId, Payload}});
|
true -> mnesia:dirty_write({pubsub_last_item, NodeId, ItemId, {now(), jlib:short_prepd_bare_jid(Publisher)}, Payload});
|
||||||
_ -> ok
|
_ -> ok
|
||||||
end.
|
end.
|
||||||
unset_cached_item({_, ServerHost, _}, NodeId) ->
|
unset_cached_item({_, ServerHost, _}, NodeId) ->
|
||||||
unset_cached_item(ServerHost, NodeId);
|
unset_cached_item(ServerHost, NodeId);
|
||||||
unset_cached_item(Host, NodeId) ->
|
unset_cached_item(Host, NodeId) ->
|
||||||
case is_last_item_cache_enabled(Host) of
|
case is_last_item_cache_enabled(Host) of
|
||||||
true -> ets:delete(gen_mod:get_module_proc(Host, last_items), NodeId);
|
true -> mnesia:dirty_delete({pubsub_last_item, NodeId});
|
||||||
_ -> ok
|
_ -> ok
|
||||||
end.
|
end.
|
||||||
get_cached_item({_, ServerHost, _}, NodeId) ->
|
get_cached_item({_, ServerHost, _}, NodeId) ->
|
||||||
@ -3576,9 +3575,10 @@ get_cached_item({_, ServerHost, _}, NodeId) ->
|
|||||||
get_cached_item(Host, NodeId) ->
|
get_cached_item(Host, NodeId) ->
|
||||||
case is_last_item_cache_enabled(Host) of
|
case is_last_item_cache_enabled(Host) of
|
||||||
true ->
|
true ->
|
||||||
case catch ets:lookup(gen_mod:get_module_proc(Host, last_items), NodeId) of
|
case mnesia:dirty_read({pubsub_last_item, NodeId}) of
|
||||||
[{NodeId, {ItemId, Payload}}] ->
|
[{pubsub_last_item, NodeId, ItemId, Creation, Payload}] ->
|
||||||
#pubsub_item{itemid = {ItemId, NodeId}, payload = Payload};
|
#pubsub_item{itemid = {ItemId, NodeId}, payload = Payload,
|
||||||
|
creation = Creation, modification = Creation};
|
||||||
_ ->
|
_ ->
|
||||||
undefined
|
undefined
|
||||||
end;
|
end;
|
||||||
|
@ -183,9 +183,8 @@ init([ServerHost, Opts]) ->
|
|||||||
pubsub_index:init(Host, ServerHost, Opts),
|
pubsub_index:init(Host, ServerHost, Opts),
|
||||||
ets:new(gen_mod:get_module_proc(Host, config), [set, named_table]),
|
ets:new(gen_mod:get_module_proc(Host, config), [set, named_table]),
|
||||||
ets:new(gen_mod:get_module_proc(ServerHost, config), [set, named_table]),
|
ets:new(gen_mod:get_module_proc(ServerHost, config), [set, named_table]),
|
||||||
ets:new(gen_mod:get_module_proc(Host, last_items), [set, named_table]),
|
|
||||||
ets:new(gen_mod:get_module_proc(ServerHost, last_items), [set, named_table]),
|
|
||||||
{Plugins, NodeTree, PepMapping} = init_plugins(Host, ServerHost, Opts),
|
{Plugins, NodeTree, PepMapping} = init_plugins(Host, ServerHost, Opts),
|
||||||
|
mnesia:create_table(pubsub_last_item, [{ram_copies, [node()]}, {attributes, record_info(fields, pubsub_last_item)}]),
|
||||||
mod_disco:register_feature(ServerHost, ?NS_PUBSUB),
|
mod_disco:register_feature(ServerHost, ?NS_PUBSUB),
|
||||||
ets:insert(gen_mod:get_module_proc(Host, config), {nodetree, NodeTree}),
|
ets:insert(gen_mod:get_module_proc(Host, config), {nodetree, NodeTree}),
|
||||||
ets:insert(gen_mod:get_module_proc(Host, config), {plugins, Plugins}),
|
ets:insert(gen_mod:get_module_proc(Host, config), {plugins, Plugins}),
|
||||||
@ -1868,7 +1867,7 @@ publish_item(Host, ServerHost, Node, Publisher, ItemId, Payload) ->
|
|||||||
PluginPayload -> PluginPayload
|
PluginPayload -> PluginPayload
|
||||||
end,
|
end,
|
||||||
broadcast_publish_item(Host, Node, NodeId, Type, Options, Removed, ItemId, jlib:jid_tolower(Publisher), BroadcastPayload),
|
broadcast_publish_item(Host, Node, NodeId, Type, Options, Removed, ItemId, jlib:jid_tolower(Publisher), BroadcastPayload),
|
||||||
set_cached_item(Host, NodeId, ItemId, Payload),
|
set_cached_item(Host, NodeId, ItemId, Publisher, Payload),
|
||||||
case Result of
|
case Result of
|
||||||
default -> {result, Reply};
|
default -> {result, Reply};
|
||||||
_ -> {result, Result}
|
_ -> {result, Result}
|
||||||
@ -1878,14 +1877,14 @@ publish_item(Host, ServerHost, Node, Publisher, ItemId, Payload) ->
|
|||||||
Type = TNode#pubsub_node.type,
|
Type = TNode#pubsub_node.type,
|
||||||
Options = TNode#pubsub_node.options,
|
Options = TNode#pubsub_node.options,
|
||||||
broadcast_retract_items(Host, Node, NodeId, Type, Options, Removed),
|
broadcast_retract_items(Host, Node, NodeId, Type, Options, Removed),
|
||||||
set_cached_item(Host, NodeId, ItemId, Payload),
|
set_cached_item(Host, NodeId, ItemId, Publisher, Payload),
|
||||||
{result, Reply};
|
{result, Reply};
|
||||||
{result, {TNode, {Result, Removed}}} ->
|
{result, {TNode, {Result, Removed}}} ->
|
||||||
NodeId = TNode#pubsub_node.id,
|
NodeId = TNode#pubsub_node.id,
|
||||||
Type = TNode#pubsub_node.type,
|
Type = TNode#pubsub_node.type,
|
||||||
Options = TNode#pubsub_node.options,
|
Options = TNode#pubsub_node.options,
|
||||||
broadcast_retract_items(Host, Node, NodeId, Type, Options, Removed),
|
broadcast_retract_items(Host, Node, NodeId, Type, Options, Removed),
|
||||||
set_cached_item(Host, NodeId, ItemId, Payload),
|
set_cached_item(Host, NodeId, ItemId, Publisher, Payload),
|
||||||
{result, Result};
|
{result, Result};
|
||||||
{result, {_, default}} ->
|
{result, {_, default}} ->
|
||||||
{result, Reply};
|
{result, Reply};
|
||||||
@ -2126,20 +2125,20 @@ send_items(Host, Node, NodeId, Type, LJID, last) ->
|
|||||||
% special ODBC optimization, works only with node_hometree_odbc, node_flat_odbc and node_pep_odbc
|
% special ODBC optimization, works only with node_hometree_odbc, node_flat_odbc and node_pep_odbc
|
||||||
case node_action(Host, Type, get_last_items, [NodeId, LJID, 1]) of
|
case node_action(Host, Type, get_last_items, [NodeId, LJID, 1]) of
|
||||||
{result, [LastItem]} ->
|
{result, [LastItem]} ->
|
||||||
{ModifNow, ModifLjid} = LastItem#pubsub_item.modification,
|
{ModifNow, ModifUSR} = LastItem#pubsub_item.modification,
|
||||||
event_stanza_with_delay(
|
event_stanza_with_delay(
|
||||||
[{xmlelement, "items", nodeAttr(Node),
|
[{xmlelement, "items", nodeAttr(Node),
|
||||||
itemsEls([LastItem])}], ModifNow, ModifLjid);
|
itemsEls([LastItem])}], ModifNow, ModifUSR);
|
||||||
_ ->
|
_ ->
|
||||||
event_stanza(
|
event_stanza(
|
||||||
[{xmlelement, "items", nodeAttr(Node),
|
[{xmlelement, "items", nodeAttr(Node),
|
||||||
itemsEls([])}])
|
itemsEls([])}])
|
||||||
end;
|
end;
|
||||||
LastItem ->
|
LastItem ->
|
||||||
{ModifNow, ModifLjid} = LastItem#pubsub_item.modification,
|
{ModifNow, ModifUSR} = LastItem#pubsub_item.modification,
|
||||||
event_stanza_with_delay(
|
event_stanza_with_delay(
|
||||||
[{xmlelement, "items", nodeAttr(Node),
|
[{xmlelement, "items", nodeAttr(Node),
|
||||||
itemsEls([LastItem])}], ModifNow, ModifLjid)
|
itemsEls([LastItem])}], ModifNow, ModifUSR)
|
||||||
end,
|
end,
|
||||||
ejabberd_router:route(service_jid(Host), jlib:make_jid(LJID), Stanza);
|
ejabberd_router:route(service_jid(Host), jlib:make_jid(LJID), Stanza);
|
||||||
send_items(Host, Node, NodeId, Type, LJID, Number) ->
|
send_items(Host, Node, NodeId, Type, LJID, Number) ->
|
||||||
@ -2156,10 +2155,10 @@ send_items(Host, Node, NodeId, Type, LJID, Number) ->
|
|||||||
end,
|
end,
|
||||||
Stanza = case ToSend of
|
Stanza = case ToSend of
|
||||||
[LastItem] ->
|
[LastItem] ->
|
||||||
{ModifNow, ModifLjid} = LastItem#pubsub_item.modification,
|
{ModifNow, ModifUSR} = LastItem#pubsub_item.modification,
|
||||||
event_stanza_with_delay(
|
event_stanza_with_delay(
|
||||||
[{xmlelement, "items", nodeAttr(Node),
|
[{xmlelement, "items", nodeAttr(Node),
|
||||||
itemsEls(ToSend)}], ModifNow, ModifLjid);
|
itemsEls(ToSend)}], ModifNow, ModifUSR);
|
||||||
_ ->
|
_ ->
|
||||||
event_stanza(
|
event_stanza(
|
||||||
[{xmlelement, "items", nodeAttr(Node),
|
[{xmlelement, "items", nodeAttr(Node),
|
||||||
@ -2757,9 +2756,9 @@ payload_xmlelements([_|Tail], Count) -> payload_xmlelements(Tail, Count).
|
|||||||
event_stanza(Els) ->
|
event_stanza(Els) ->
|
||||||
event_stanza_withmoreels(Els, []).
|
event_stanza_withmoreels(Els, []).
|
||||||
|
|
||||||
event_stanza_with_delay(Els, ModifNow, ModifLjid) ->
|
event_stanza_with_delay(Els, ModifNow, ModifUSR) ->
|
||||||
DateTime = calendar:now_to_datetime(ModifNow),
|
DateTime = calendar:now_to_datetime(ModifNow),
|
||||||
MoreEls = [jlib:timestamp_to_xml(DateTime, utc, ModifLjid, "")],
|
MoreEls = [jlib:timestamp_to_xml(DateTime, utc, ModifUSR, "")],
|
||||||
event_stanza_withmoreels(Els, MoreEls).
|
event_stanza_withmoreels(Els, MoreEls).
|
||||||
|
|
||||||
event_stanza_withmoreels(Els, MoreEls) ->
|
event_stanza_withmoreels(Els, MoreEls) ->
|
||||||
@ -3391,18 +3390,18 @@ is_last_item_cache_enabled(Host) ->
|
|||||||
_ -> false
|
_ -> false
|
||||||
end.
|
end.
|
||||||
|
|
||||||
set_cached_item({_, ServerHost, _}, NodeId, ItemId, Payload) ->
|
set_cached_item({_, ServerHost, _}, NodeId, ItemId, Publisher, Payload) ->
|
||||||
set_cached_item(ServerHost, NodeId, ItemId, Payload);
|
set_cached_item(ServerHost, NodeId, ItemId, Publisher, Payload);
|
||||||
set_cached_item(Host, NodeId, ItemId, Payload) ->
|
set_cached_item(Host, NodeId, ItemId, Publisher, Payload) ->
|
||||||
case is_last_item_cache_enabled(Host) of
|
case is_last_item_cache_enabled(Host) of
|
||||||
true -> ets:insert(gen_mod:get_module_proc(Host, last_items), {NodeId, {ItemId, Payload}});
|
true -> mnesia:dirty_write({pubsub_last_item, NodeId, ItemId, {now(), jlib:short_prepd_bare_jid(Publisher)}, Payload});
|
||||||
_ -> ok
|
_ -> ok
|
||||||
end.
|
end.
|
||||||
unset_cached_item({_, ServerHost, _}, NodeId) ->
|
unset_cached_item({_, ServerHost, _}, NodeId) ->
|
||||||
unset_cached_item(ServerHost, NodeId);
|
unset_cached_item(ServerHost, NodeId);
|
||||||
unset_cached_item(Host, NodeId) ->
|
unset_cached_item(Host, NodeId) ->
|
||||||
case is_last_item_cache_enabled(Host) of
|
case is_last_item_cache_enabled(Host) of
|
||||||
true -> ets:delete(gen_mod:get_module_proc(Host, last_items), NodeId);
|
true -> mnesia:dirty_delete({pubsub_last_item, NodeId});
|
||||||
_ -> ok
|
_ -> ok
|
||||||
end.
|
end.
|
||||||
get_cached_item({_, ServerHost, _}, NodeId) ->
|
get_cached_item({_, ServerHost, _}, NodeId) ->
|
||||||
@ -3410,9 +3409,10 @@ get_cached_item({_, ServerHost, _}, NodeId) ->
|
|||||||
get_cached_item(Host, NodeId) ->
|
get_cached_item(Host, NodeId) ->
|
||||||
case is_last_item_cache_enabled(Host) of
|
case is_last_item_cache_enabled(Host) of
|
||||||
true ->
|
true ->
|
||||||
case catch ets:lookup(gen_mod:get_module_proc(Host, last_items), NodeId) of
|
case mnesia:dirty_read({pubsub_last_item, NodeId}) of
|
||||||
[{NodeId, {ItemId, Payload}}] ->
|
[{pubsub_last_item, NodeId, ItemId, Creation, Payload}] ->
|
||||||
#pubsub_item{itemid = {ItemId, NodeId}, payload = Payload};
|
#pubsub_item{itemid = {ItemId, NodeId}, payload = Payload,
|
||||||
|
creation = Creation, modification = Creation};
|
||||||
_ ->
|
_ ->
|
||||||
undefined
|
undefined
|
||||||
end;
|
end;
|
||||||
|
@ -135,3 +135,12 @@
|
|||||||
%% <p>This is the format of the <tt>subscriptions</tt> table. The type of the
|
%% <p>This is the format of the <tt>subscriptions</tt> table. The type of the
|
||||||
%% table is: <tt>set</tt>,<tt>ram/disc</tt>.</p>
|
%% table is: <tt>set</tt>,<tt>ram/disc</tt>.</p>
|
||||||
-record(pubsub_subscription, {subid, options}).
|
-record(pubsub_subscription, {subid, options}).
|
||||||
|
|
||||||
|
%% @type pubsubLastItem() = #pubsub_last_item{
|
||||||
|
%% nodeid = nodeidx(),
|
||||||
|
%% itemid = string(),
|
||||||
|
%% payload = XMLContent::string()}.
|
||||||
|
%% <p>This is the format of the <tt>last items</tt> table. it stores last item payload
|
||||||
|
%% for every node</p>
|
||||||
|
-record(pubsub_last_item, {nodeid, itemid, creation, payload}).
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
--- mod_pubsub.erl 2010-05-19 11:03:27.000000000 +0200
|
--- mod_pubsub.erl 2010-05-28 11:46:24.000000000 +0200
|
||||||
+++ mod_pubsub_odbc.erl 2010-05-19 11:04:11.000000000 +0200
|
+++ mod_pubsub_odbc.erl 2010-05-28 11:55:17.000000000 +0200
|
||||||
@@ -42,7 +42,7 @@
|
@@ -42,7 +42,7 @@
|
||||||
%%% 6.2.3.1, 6.2.3.5, and 6.3. For information on subscription leases see
|
%%% 6.2.3.1, 6.2.3.5, and 6.3. For information on subscription leases see
|
||||||
%%% XEP-0060 section 12.18.
|
%%% XEP-0060 section 12.18.
|
||||||
@ -40,7 +40,7 @@
|
|||||||
-define(LOOPNAME, ejabberd_mod_pubsub_loop).
|
-define(LOOPNAME, ejabberd_mod_pubsub_loop).
|
||||||
-define(PLUGIN_PREFIX, "node_").
|
-define(PLUGIN_PREFIX, "node_").
|
||||||
-define(TREE_PREFIX, "nodetree_").
|
-define(TREE_PREFIX, "nodetree_").
|
||||||
@@ -221,8 +221,6 @@
|
@@ -220,8 +220,6 @@
|
||||||
ok
|
ok
|
||||||
end,
|
end,
|
||||||
ejabberd_router:register_route(Host),
|
ejabberd_router:register_route(Host),
|
||||||
@ -49,7 +49,7 @@
|
|||||||
init_nodes(Host, ServerHost, NodeTree, Plugins),
|
init_nodes(Host, ServerHost, NodeTree, Plugins),
|
||||||
State = #state{host = Host,
|
State = #state{host = Host,
|
||||||
server_host = ServerHost,
|
server_host = ServerHost,
|
||||||
@@ -281,207 +279,14 @@
|
@@ -280,207 +278,14 @@
|
||||||
|
|
||||||
init_nodes(Host, ServerHost, _NodeTree, Plugins) ->
|
init_nodes(Host, ServerHost, _NodeTree, Plugins) ->
|
||||||
%% TODO, this call should be done plugin side
|
%% TODO, this call should be done plugin side
|
||||||
@ -260,7 +260,7 @@
|
|||||||
send_loop(State) ->
|
send_loop(State) ->
|
||||||
receive
|
receive
|
||||||
{presence, JID, Pid} ->
|
{presence, JID, Pid} ->
|
||||||
@@ -492,17 +297,15 @@
|
@@ -491,17 +296,15 @@
|
||||||
%% for each node From is subscribed to
|
%% for each node From is subscribed to
|
||||||
%% 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) ->
|
||||||
@ -284,7 +284,7 @@
|
|||||||
true ->
|
true ->
|
||||||
% resource not concerned about that subscription
|
% resource not concerned about that subscription
|
||||||
ok
|
ok
|
||||||
@@ -748,10 +551,10 @@
|
@@ -747,10 +550,10 @@
|
||||||
lists:foreach(fun(PType) ->
|
lists:foreach(fun(PType) ->
|
||||||
{result, Subscriptions} = node_action(Host, PType, get_entity_subscriptions, [Host, Entity]),
|
{result, Subscriptions} = node_action(Host, PType, get_entity_subscriptions, [Host, Entity]),
|
||||||
lists:foreach(fun
|
lists:foreach(fun
|
||||||
@ -297,7 +297,7 @@
|
|||||||
true ->
|
true ->
|
||||||
node_action(Host, PType, unsubscribe_node, [NodeId, Entity, JID, all]);
|
node_action(Host, PType, unsubscribe_node, [NodeId, Entity, JID, all]);
|
||||||
false ->
|
false ->
|
||||||
@@ -921,7 +724,8 @@
|
@@ -920,7 +723,8 @@
|
||||||
sub_el = SubEl} = IQ ->
|
sub_el = SubEl} = IQ ->
|
||||||
{xmlelement, _, QAttrs, _} = SubEl,
|
{xmlelement, _, QAttrs, _} = SubEl,
|
||||||
Node = xml:get_attr_s("node", QAttrs),
|
Node = xml:get_attr_s("node", QAttrs),
|
||||||
@ -307,7 +307,7 @@
|
|||||||
{result, IQRes} ->
|
{result, IQRes} ->
|
||||||
jlib:iq_to_xml(
|
jlib:iq_to_xml(
|
||||||
IQ#iq{type = result,
|
IQ#iq{type = result,
|
||||||
@@ -1034,7 +838,7 @@
|
@@ -1033,7 +837,7 @@
|
||||||
[] ->
|
[] ->
|
||||||
["leaf"]; %% No sub-nodes: it's a leaf node
|
["leaf"]; %% No sub-nodes: it's a leaf node
|
||||||
_ ->
|
_ ->
|
||||||
@ -316,7 +316,7 @@
|
|||||||
{result, []} -> ["collection"];
|
{result, []} -> ["collection"];
|
||||||
{result, _} -> ["leaf", "collection"];
|
{result, _} -> ["leaf", "collection"];
|
||||||
_ -> []
|
_ -> []
|
||||||
@@ -1050,8 +854,9 @@
|
@@ -1049,8 +853,9 @@
|
||||||
[];
|
[];
|
||||||
true ->
|
true ->
|
||||||
[{xmlelement, "feature", [{"var", ?NS_PUBSUB}], []} |
|
[{xmlelement, "feature", [{"var", ?NS_PUBSUB}], []} |
|
||||||
@ -328,7 +328,7 @@
|
|||||||
end, features(Type))]
|
end, features(Type))]
|
||||||
end,
|
end,
|
||||||
%% TODO: add meta-data info (spec section 5.4)
|
%% TODO: add meta-data info (spec section 5.4)
|
||||||
@@ -1080,8 +885,9 @@
|
@@ -1079,8 +884,9 @@
|
||||||
{xmlelement, "feature", [{"var", ?NS_PUBSUB}], []},
|
{xmlelement, "feature", [{"var", ?NS_PUBSUB}], []},
|
||||||
{xmlelement, "feature", [{"var", ?NS_COMMANDS}], []},
|
{xmlelement, "feature", [{"var", ?NS_COMMANDS}], []},
|
||||||
{xmlelement, "feature", [{"var", ?NS_VCARD}], []}] ++
|
{xmlelement, "feature", [{"var", ?NS_VCARD}], []}] ++
|
||||||
@ -340,7 +340,7 @@
|
|||||||
end, features(Host, Node))};
|
end, features(Host, Node))};
|
||||||
<<?NS_COMMANDS>> ->
|
<<?NS_COMMANDS>> ->
|
||||||
command_disco_info(Host, Node, From);
|
command_disco_info(Host, Node, From);
|
||||||
@@ -1091,7 +897,7 @@
|
@@ -1090,7 +896,7 @@
|
||||||
node_disco_info(Host, Node, From)
|
node_disco_info(Host, Node, From)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@ -349,7 +349,7 @@
|
|||||||
case tree_action(Host, get_subnodes, [Host, <<>>, From]) of
|
case tree_action(Host, get_subnodes, [Host, <<>>, From]) of
|
||||||
Nodes when is_list(Nodes) ->
|
Nodes when is_list(Nodes) ->
|
||||||
{result, lists:map(
|
{result, lists:map(
|
||||||
@@ -1108,14 +914,14 @@
|
@@ -1107,14 +913,14 @@
|
||||||
Other ->
|
Other ->
|
||||||
Other
|
Other
|
||||||
end;
|
end;
|
||||||
@ -367,7 +367,7 @@
|
|||||||
case string:tokens(Item, "!") of
|
case string:tokens(Item, "!") of
|
||||||
[_SNode, _ItemID] ->
|
[_SNode, _ItemID] ->
|
||||||
{result, []};
|
{result, []};
|
||||||
@@ -1123,10 +929,10 @@
|
@@ -1122,10 +928,10 @@
|
||||||
Node = string_to_node(SNode),
|
Node = string_to_node(SNode),
|
||||||
Action =
|
Action =
|
||||||
fun(#pubsub_node{type = Type, id = NodeId}) ->
|
fun(#pubsub_node{type = Type, id = NodeId}) ->
|
||||||
@ -381,7 +381,7 @@
|
|||||||
end,
|
end,
|
||||||
Nodes = lists:map(
|
Nodes = lists:map(
|
||||||
fun(#pubsub_node{nodeid = {_, SubNode}, options = Options}) ->
|
fun(#pubsub_node{nodeid = {_, SubNode}, options = Options}) ->
|
||||||
@@ -1144,7 +950,7 @@
|
@@ -1143,7 +949,7 @@
|
||||||
{result, Name} = node_call(Type, get_item_name, [Host, Node, RN]),
|
{result, Name} = node_call(Type, get_item_name, [Host, Node, RN]),
|
||||||
{xmlelement, "item", [{"jid", Host}, {"name", Name}], []}
|
{xmlelement, "item", [{"jid", Host}, {"name", Name}], []}
|
||||||
end, NodeItems),
|
end, NodeItems),
|
||||||
@ -390,7 +390,7 @@
|
|||||||
end,
|
end,
|
||||||
case transaction(Host, Node, Action, sync_dirty) of
|
case transaction(Host, Node, Action, sync_dirty) of
|
||||||
{result, {_, Result}} -> {result, Result};
|
{result, {_, Result}} -> {result, Result};
|
||||||
@@ -1273,7 +1079,8 @@
|
@@ -1272,7 +1078,8 @@
|
||||||
(_, Acc) ->
|
(_, Acc) ->
|
||||||
Acc
|
Acc
|
||||||
end, [], xml:remove_cdata(Els)),
|
end, [], xml:remove_cdata(Els)),
|
||||||
@ -400,7 +400,7 @@
|
|||||||
{get, "subscriptions"} ->
|
{get, "subscriptions"} ->
|
||||||
get_subscriptions(Host, Node, From, Plugins);
|
get_subscriptions(Host, Node, From, Plugins);
|
||||||
{get, "affiliations"} ->
|
{get, "affiliations"} ->
|
||||||
@@ -1296,7 +1103,9 @@
|
@@ -1295,7 +1102,9 @@
|
||||||
|
|
||||||
iq_pubsub_owner(Host, ServerHost, From, IQType, SubEl, Lang) ->
|
iq_pubsub_owner(Host, ServerHost, From, IQType, SubEl, Lang) ->
|
||||||
{xmlelement, _, _, SubEls} = SubEl,
|
{xmlelement, _, _, SubEls} = SubEl,
|
||||||
@ -411,7 +411,7 @@
|
|||||||
case Action of
|
case Action of
|
||||||
[{xmlelement, Name, Attrs, Els}] ->
|
[{xmlelement, Name, Attrs, Els}] ->
|
||||||
Node = string_to_node(xml:get_attr_s("node", Attrs)),
|
Node = string_to_node(xml:get_attr_s("node", Attrs)),
|
||||||
@@ -1426,7 +1235,8 @@
|
@@ -1425,7 +1234,8 @@
|
||||||
_ -> []
|
_ -> []
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -421,7 +421,7 @@
|
|||||||
sync_dirty) of
|
sync_dirty) of
|
||||||
{result, Res} -> Res;
|
{result, Res} -> Res;
|
||||||
Err -> Err
|
Err -> Err
|
||||||
@@ -1465,7 +1275,7 @@
|
@@ -1464,7 +1274,7 @@
|
||||||
|
|
||||||
%%% authorization handling
|
%%% authorization handling
|
||||||
|
|
||||||
@ -430,7 +430,7 @@
|
|||||||
Lang = "en", %% TODO fix
|
Lang = "en", %% TODO fix
|
||||||
Stanza = {xmlelement, "message",
|
Stanza = {xmlelement, "message",
|
||||||
[],
|
[],
|
||||||
@@ -1494,7 +1304,7 @@
|
@@ -1493,7 +1303,7 @@
|
||||||
[{xmlelement, "value", [], [{xmlcdata, "false"}]}]}]}]},
|
[{xmlelement, "value", [], [{xmlcdata, "false"}]}]}]}]},
|
||||||
lists:foreach(fun(Owner) ->
|
lists:foreach(fun(Owner) ->
|
||||||
ejabberd_router:route(service_jid(Host), jlib:make_jid(Owner), Stanza)
|
ejabberd_router:route(service_jid(Host), jlib:make_jid(Owner), Stanza)
|
||||||
@ -439,7 +439,7 @@
|
|||||||
|
|
||||||
find_authorization_response(Packet) ->
|
find_authorization_response(Packet) ->
|
||||||
{xmlelement, _Name, _Attrs, Els} = Packet,
|
{xmlelement, _Name, _Attrs, Els} = Packet,
|
||||||
@@ -1558,8 +1368,8 @@
|
@@ -1557,8 +1367,8 @@
|
||||||
"true" -> true;
|
"true" -> true;
|
||||||
_ -> false
|
_ -> false
|
||||||
end,
|
end,
|
||||||
@ -450,7 +450,7 @@
|
|||||||
{result, Subscriptions} = node_call(Type, get_subscriptions, [NodeId, Subscriber]),
|
{result, Subscriptions} = node_call(Type, get_subscriptions, [NodeId, Subscriber]),
|
||||||
if
|
if
|
||||||
not IsApprover ->
|
not IsApprover ->
|
||||||
@@ -1750,7 +1560,7 @@
|
@@ -1749,7 +1559,7 @@
|
||||||
Reply = [{xmlelement, "pubsub", [{"xmlns", ?NS_PUBSUB}],
|
Reply = [{xmlelement, "pubsub", [{"xmlns", ?NS_PUBSUB}],
|
||||||
[{xmlelement, "create", nodeAttr(Node),
|
[{xmlelement, "create", nodeAttr(Node),
|
||||||
[]}]}],
|
[]}]}],
|
||||||
@ -459,7 +459,7 @@
|
|||||||
{result, {Result, broadcast}} ->
|
{result, {Result, broadcast}} ->
|
||||||
%%Lang = "en", %% TODO: fix
|
%%Lang = "en", %% TODO: fix
|
||||||
%%OwnerKey = jlib:jid_tolower(jlib:jid_remove_resource(Owner)),
|
%%OwnerKey = jlib:jid_tolower(jlib:jid_remove_resource(Owner)),
|
||||||
@@ -1858,7 +1668,7 @@
|
@@ -1857,7 +1667,7 @@
|
||||||
%%<li>The node does not exist.</li>
|
%%<li>The node does not exist.</li>
|
||||||
%%</ul>
|
%%</ul>
|
||||||
subscribe_node(Host, Node, From, JID, Configuration) ->
|
subscribe_node(Host, Node, From, JID, Configuration) ->
|
||||||
@ -468,7 +468,7 @@
|
|||||||
{result, GoodSubOpts} -> GoodSubOpts;
|
{result, GoodSubOpts} -> GoodSubOpts;
|
||||||
_ -> invalid
|
_ -> invalid
|
||||||
end,
|
end,
|
||||||
@@ -1866,7 +1676,7 @@
|
@@ -1865,7 +1675,7 @@
|
||||||
error -> {"", "", ""};
|
error -> {"", "", ""};
|
||||||
J -> jlib:jid_tolower(J)
|
J -> jlib:jid_tolower(J)
|
||||||
end,
|
end,
|
||||||
@ -477,7 +477,7 @@
|
|||||||
Features = features(Type),
|
Features = features(Type),
|
||||||
SubscribeFeature = lists:member("subscribe", Features),
|
SubscribeFeature = lists:member("subscribe", Features),
|
||||||
OptionsFeature = lists:member("subscription-options", Features),
|
OptionsFeature = lists:member("subscription-options", Features),
|
||||||
@@ -1885,9 +1695,13 @@
|
@@ -1884,9 +1694,13 @@
|
||||||
{"", "", ""} ->
|
{"", "", ""} ->
|
||||||
{false, false};
|
{false, false};
|
||||||
_ ->
|
_ ->
|
||||||
@ -494,7 +494,7 @@
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
if
|
if
|
||||||
@@ -2218,7 +2032,7 @@
|
@@ -2217,7 +2031,7 @@
|
||||||
%% <p>The permission are not checked in this function.</p>
|
%% <p>The permission are not checked in this function.</p>
|
||||||
%% @todo We probably need to check that the user doing the query has the right
|
%% @todo We probably need to check that the user doing the query has the right
|
||||||
%% to read the items.
|
%% to read the items.
|
||||||
@ -503,7 +503,7 @@
|
|||||||
MaxItems =
|
MaxItems =
|
||||||
if
|
if
|
||||||
SMaxItems == "" -> get_max_items_node(Host);
|
SMaxItems == "" -> get_max_items_node(Host);
|
||||||
@@ -2257,11 +2071,11 @@
|
@@ -2256,11 +2070,11 @@
|
||||||
node_call(Type, get_items,
|
node_call(Type, get_items,
|
||||||
[NodeId, From,
|
[NodeId, From,
|
||||||
AccessModel, PresenceSubscription, RosterGroup,
|
AccessModel, PresenceSubscription, RosterGroup,
|
||||||
@ -517,7 +517,7 @@
|
|||||||
SendItems = case ItemIDs of
|
SendItems = case ItemIDs of
|
||||||
[] ->
|
[] ->
|
||||||
Items;
|
Items;
|
||||||
@@ -2274,7 +2088,8 @@
|
@@ -2273,7 +2087,8 @@
|
||||||
%% number of items sent to MaxItems:
|
%% number of items sent to MaxItems:
|
||||||
{result, [{xmlelement, "pubsub", [{"xmlns", ?NS_PUBSUB}],
|
{result, [{xmlelement, "pubsub", [{"xmlns", ?NS_PUBSUB}],
|
||||||
[{xmlelement, "items", nodeAttr(Node),
|
[{xmlelement, "items", nodeAttr(Node),
|
||||||
@ -527,7 +527,7 @@
|
|||||||
Error ->
|
Error ->
|
||||||
Error
|
Error
|
||||||
end
|
end
|
||||||
@@ -2306,16 +2121,27 @@
|
@@ -2305,16 +2120,27 @@
|
||||||
%% @doc <p>Resend the items of a node to the user.</p>
|
%% @doc <p>Resend the items of a node to the user.</p>
|
||||||
%% @todo use cache-last-item feature
|
%% @todo use cache-last-item feature
|
||||||
send_items(Host, Node, NodeId, Type, LJID, last) ->
|
send_items(Host, Node, NodeId, Type, LJID, last) ->
|
||||||
@ -538,30 +538,30 @@
|
|||||||
+ % special ODBC optimization, works only with node_hometree_odbc, node_flat_odbc and node_pep_odbc
|
+ % special ODBC optimization, works only with node_hometree_odbc, node_flat_odbc and node_pep_odbc
|
||||||
+ case node_action(Host, Type, get_last_items, [NodeId, LJID, 1]) of
|
+ case node_action(Host, Type, get_last_items, [NodeId, LJID, 1]) of
|
||||||
+ {result, [LastItem]} ->
|
+ {result, [LastItem]} ->
|
||||||
+ {ModifNow, ModifLjid} = LastItem#pubsub_item.modification,
|
+ {ModifNow, ModifUSR} = LastItem#pubsub_item.modification,
|
||||||
+ event_stanza_with_delay(
|
+ event_stanza_with_delay(
|
||||||
+ [{xmlelement, "items", nodeAttr(Node),
|
+ [{xmlelement, "items", nodeAttr(Node),
|
||||||
+ itemsEls([LastItem])}], ModifNow, ModifLjid);
|
+ itemsEls([LastItem])}], ModifNow, ModifUSR);
|
||||||
+ _ ->
|
+ _ ->
|
||||||
+ event_stanza(
|
+ event_stanza(
|
||||||
+ [{xmlelement, "items", nodeAttr(Node),
|
+ [{xmlelement, "items", nodeAttr(Node),
|
||||||
+ itemsEls([])}])
|
+ itemsEls([])}])
|
||||||
+ end;
|
+ end;
|
||||||
LastItem ->
|
LastItem ->
|
||||||
{ModifNow, ModifLjid} = LastItem#pubsub_item.modification,
|
{ModifNow, ModifUSR} = LastItem#pubsub_item.modification,
|
||||||
- Stanza = event_stanza_with_delay(
|
- Stanza = event_stanza_with_delay(
|
||||||
+ event_stanza_with_delay(
|
+ event_stanza_with_delay(
|
||||||
[{xmlelement, "items", nodeAttr(Node),
|
[{xmlelement, "items", nodeAttr(Node),
|
||||||
- itemsEls([LastItem])}], ModifNow, ModifLjid),
|
- itemsEls([LastItem])}], ModifNow, ModifUSR),
|
||||||
- ejabberd_router:route(service_jid(Host), jlib:make_jid(LJID), Stanza)
|
- ejabberd_router:route(service_jid(Host), jlib:make_jid(LJID), Stanza)
|
||||||
- end;
|
- end;
|
||||||
+ itemsEls([LastItem])}], ModifNow, ModifLjid)
|
+ itemsEls([LastItem])}], ModifNow, ModifUSR)
|
||||||
+ end,
|
+ end,
|
||||||
+ ejabberd_router:route(service_jid(Host), jlib:make_jid(LJID), Stanza);
|
+ ejabberd_router:route(service_jid(Host), jlib:make_jid(LJID), Stanza);
|
||||||
send_items(Host, Node, NodeId, Type, LJID, Number) ->
|
send_items(Host, Node, NodeId, Type, LJID, Number) ->
|
||||||
ToSend = case node_action(Host, Type, get_items, [NodeId, LJID]) of
|
ToSend = case node_action(Host, Type, get_items, [NodeId, LJID]) of
|
||||||
{result, []} ->
|
{result, []} ->
|
||||||
@@ -2441,7 +2267,8 @@
|
@@ -2440,7 +2266,8 @@
|
||||||
error ->
|
error ->
|
||||||
{error, ?ERR_BAD_REQUEST};
|
{error, ?ERR_BAD_REQUEST};
|
||||||
_ ->
|
_ ->
|
||||||
@ -571,7 +571,7 @@
|
|||||||
case lists:member(Owner, Owners) of
|
case lists:member(Owner, Owners) of
|
||||||
true ->
|
true ->
|
||||||
OwnerJID = exmpp_jid:make(Owner),
|
OwnerJID = exmpp_jid:make(Owner),
|
||||||
@@ -2451,24 +2278,7 @@
|
@@ -2450,24 +2277,7 @@
|
||||||
end,
|
end,
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun({JID, Affiliation}) ->
|
fun({JID, Affiliation}) ->
|
||||||
@ -597,7 +597,7 @@
|
|||||||
end, FilteredEntities),
|
end, FilteredEntities),
|
||||||
{result, []};
|
{result, []};
|
||||||
_ ->
|
_ ->
|
||||||
@@ -2521,11 +2331,11 @@
|
@@ -2520,11 +2330,11 @@
|
||||||
end.
|
end.
|
||||||
|
|
||||||
read_sub(Subscriber, Node, NodeID, SubID, Lang) ->
|
read_sub(Subscriber, Node, NodeID, SubID, Lang) ->
|
||||||
@ -611,7 +611,7 @@
|
|||||||
OptionsEl = {xmlelement, "options", [{"jid", jlib:jid_to_string(Subscriber)},
|
OptionsEl = {xmlelement, "options", [{"jid", jlib:jid_to_string(Subscriber)},
|
||||||
{"subid", SubID}|nodeAttr(Node)],
|
{"subid", SubID}|nodeAttr(Node)],
|
||||||
[XdataEl]},
|
[XdataEl]},
|
||||||
@@ -2551,7 +2361,7 @@
|
@@ -2550,7 +2360,7 @@
|
||||||
end.
|
end.
|
||||||
|
|
||||||
set_options_helper(Configuration, JID, NodeID, SubID, Type) ->
|
set_options_helper(Configuration, JID, NodeID, SubID, Type) ->
|
||||||
@ -620,7 +620,7 @@
|
|||||||
{result, GoodSubOpts} -> GoodSubOpts;
|
{result, GoodSubOpts} -> GoodSubOpts;
|
||||||
_ -> invalid
|
_ -> invalid
|
||||||
end,
|
end,
|
||||||
@@ -2580,7 +2390,7 @@
|
@@ -2579,7 +2389,7 @@
|
||||||
write_sub(_Subscriber, _NodeID, _SubID, invalid) ->
|
write_sub(_Subscriber, _NodeID, _SubID, invalid) ->
|
||||||
{error, extended_error(?ERR_BAD_REQUEST, "invalid-options")};
|
{error, extended_error(?ERR_BAD_REQUEST, "invalid-options")};
|
||||||
write_sub(Subscriber, NodeID, SubID, Options) ->
|
write_sub(Subscriber, NodeID, SubID, Options) ->
|
||||||
@ -629,7 +629,7 @@
|
|||||||
{error, notfound} ->
|
{error, notfound} ->
|
||||||
{error, extended_error(?ERR_NOT_ACCEPTABLE, "invalid-subid")};
|
{error, extended_error(?ERR_NOT_ACCEPTABLE, "invalid-subid")};
|
||||||
{result, _} ->
|
{result, _} ->
|
||||||
@@ -2748,8 +2558,8 @@
|
@@ -2747,8 +2557,8 @@
|
||||||
{"subscription", subscription_to_string(Sub)} | nodeAttr(Node)], []}]}]},
|
{"subscription", subscription_to_string(Sub)} | nodeAttr(Node)], []}]}]},
|
||||||
ejabberd_router:route(service_jid(Host), jlib:make_jid(JID), Stanza)
|
ejabberd_router:route(service_jid(Host), jlib:make_jid(JID), Stanza)
|
||||||
end,
|
end,
|
||||||
@ -640,7 +640,7 @@
|
|||||||
true ->
|
true ->
|
||||||
Result = lists:foldl(fun({JID, Subscription, SubId}, Acc) ->
|
Result = lists:foldl(fun({JID, Subscription, SubId}, Acc) ->
|
||||||
|
|
||||||
@@ -3079,7 +2889,7 @@
|
@@ -3078,7 +2888,7 @@
|
||||||
{Depth, [{N, get_node_subs(N)} || N <- Nodes]}
|
{Depth, [{N, get_node_subs(N)} || N <- Nodes]}
|
||||||
end, tree_call(Host, get_parentnodes_tree, [Host, Node, service_jid(Host)]))}
|
end, tree_call(Host, get_parentnodes_tree, [Host, Node, service_jid(Host)]))}
|
||||||
end,
|
end,
|
||||||
@ -649,7 +649,7 @@
|
|||||||
{result, CollSubs} -> CollSubs;
|
{result, CollSubs} -> CollSubs;
|
||||||
_ -> []
|
_ -> []
|
||||||
end.
|
end.
|
||||||
@@ -3093,9 +2903,9 @@
|
@@ -3092,9 +2902,9 @@
|
||||||
|
|
||||||
get_options_for_subs(NodeID, Subs) ->
|
get_options_for_subs(NodeID, Subs) ->
|
||||||
lists:foldl(fun({JID, subscribed, SubID}, Acc) ->
|
lists:foldl(fun({JID, subscribed, SubID}, Acc) ->
|
||||||
@ -661,7 +661,7 @@
|
|||||||
_ -> Acc
|
_ -> Acc
|
||||||
end;
|
end;
|
||||||
(_, Acc) ->
|
(_, Acc) ->
|
||||||
@@ -3299,6 +3109,30 @@
|
@@ -3298,6 +3108,30 @@
|
||||||
Result
|
Result
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user