mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Remove usage of #jid record introduced in 2787.
Replace explicit references to #jid with exmpp_jid API calls. SVN Revision: 2794
This commit is contained in:
parent
929022bc0f
commit
573ff2564b
@ -727,22 +727,27 @@ disco_sm_items(Acc, From, To, NodeB, _Lang) ->
|
|||||||
%% -------
|
%% -------
|
||||||
%% presence hooks handling functions
|
%% presence hooks handling functions
|
||||||
%%
|
%%
|
||||||
|
presence_probe(Peer, JID, Pid) ->
|
||||||
presence_probe(JID, JID, Pid) ->
|
case exmpp_jid:full_compare(Peer, JID) of
|
||||||
{User, Server, Resource} = jlib:short_prepd_jid(JID),
|
true -> %% JID are equals
|
||||||
Host = exmpp_jid:prep_domain_as_list(JID),
|
{User, Server, Resource} = jlib:short_prepd_jid(Peer),
|
||||||
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
Host = exmpp_jid:prep_domain_as_list(JID),
|
||||||
gen_server:cast(Proc, {presence, JID, Pid}),
|
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
||||||
gen_server:cast(Proc, {presence, User, Server, [Resource], JID});
|
gen_server:cast(Proc, {presence, JID, Pid}),
|
||||||
presence_probe(#jid{luser = User, lserver = Server}, #jid{luser = User, lserver = Server}, _Pid) ->
|
gen_server:cast(Proc, {presence, User, Server, [Resource], JID});
|
||||||
%% ignore presence_probe from other ressources for the current user
|
false ->
|
||||||
%% this way, we do not send duplicated last items if user already connected with other clients
|
case exmpp_jid:bare_compare(Peer, JID) of
|
||||||
ok;
|
true ->
|
||||||
presence_probe(Peer, JID, _Pid) ->
|
%% ignore presence_probe from other ressources for the current user
|
||||||
{User, Server, Resource} = jlib:short_prepd_jid(Peer),
|
%% this way, we do not send duplicated last items if user already connected with other clients
|
||||||
Host = exmpp_jid:prep_domain_as_list(JID),
|
ok;
|
||||||
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
false ->
|
||||||
gen_server:cast(Proc, {presence, User, Server, [Resource], JID}).
|
{User, Server, Resource} = jlib:short_prepd_jid(Peer),
|
||||||
|
Host = exmpp_jid:prep_domain_as_list(JID),
|
||||||
|
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
||||||
|
gen_server:cast(Proc, {presence, User, Server, [Resource], JID})
|
||||||
|
end
|
||||||
|
end.
|
||||||
|
|
||||||
%% -------
|
%% -------
|
||||||
%% subscription hooks handling functions
|
%% subscription hooks handling functions
|
||||||
|
@ -532,21 +532,27 @@ disco_sm_items(Acc, From, To, NodeB, _Lang) ->
|
|||||||
%% presence hooks handling functions
|
%% presence hooks handling functions
|
||||||
%%
|
%%
|
||||||
|
|
||||||
presence_probe(JID, JID, Pid) ->
|
presence_probe(Peer, JID, Pid) ->
|
||||||
{User, Server, Resource} = jlib:short_prepd_jid(JID),
|
case exmpp_jid:full_compare(Peer, JID) of
|
||||||
Host = exmpp_jid:prep_domain_as_list(JID),
|
true -> %% JID are equals
|
||||||
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
{User, Server, Resource} = jlib:short_prepd_jid(Peer),
|
||||||
gen_server:cast(Proc, {presence, JID, Pid}),
|
Host = exmpp_jid:prep_domain_as_list(JID),
|
||||||
gen_server:cast(Proc, {presence, User, Server, [Resource], JID});
|
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
||||||
presence_probe(#jid{luser = User, lserver = Server}, #jid{luser = User, lserver = Server}, _Pid) ->
|
gen_server:cast(Proc, {presence, JID, Pid}),
|
||||||
%% ignore presence_probe from other ressources for the current user
|
gen_server:cast(Proc, {presence, User, Server, [Resource], JID});
|
||||||
%% this way, we do not send duplicated last items if user already connected with other clients
|
false ->
|
||||||
ok;
|
case exmpp_jid:bare_compare(Peer, JID) of
|
||||||
presence_probe(Peer, JID, _Pid) ->
|
true ->
|
||||||
{User, Server, Resource} = jlib:short_prepd_jid(Peer),
|
%% ignore presence_probe from other ressources for the current user
|
||||||
Host = exmpp_jid:prep_domain_as_list(JID),
|
%% this way, we do not send duplicated last items if user already connected with other clients
|
||||||
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
ok;
|
||||||
gen_server:cast(Proc, {presence, User, Server, [Resource], JID}).
|
false ->
|
||||||
|
{User, Server, Resource} = jlib:short_prepd_jid(Peer),
|
||||||
|
Host = exmpp_jid:prep_domain_as_list(JID),
|
||||||
|
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
||||||
|
gen_server:cast(Proc, {presence, User, Server, [Resource], JID})
|
||||||
|
end
|
||||||
|
end.
|
||||||
|
|
||||||
%% -------
|
%% -------
|
||||||
%% subscription hooks handling functions
|
%% subscription hooks handling functions
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
--- mod_pubsub.erl 2009-12-07 00:21:33.000000000 +0100
|
--- mod_pubsub.erl 2009-12-08 15:52:01.000000000 -0300
|
||||||
+++ mod_pubsub_odbc.erl 2009-12-07 00:21:40.000000000 +0100
|
+++ mod_pubsub_odbc.erl 2009-12-08 15:53:12.000000000 -0300
|
||||||
@@ -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.
|
||||||
@ -294,7 +294,15 @@
|
|||||||
%% TODO, use iq_disco_items(Host, Node, From)
|
%% TODO, use iq_disco_items(Host, Node, From)
|
||||||
Host = exmpp_jid:prep_domain_as_list(To),
|
Host = exmpp_jid:prep_domain_as_list(To),
|
||||||
LJID = jlib:short_prepd_bare_jid(To),
|
LJID = jlib:short_prepd_bare_jid(To),
|
||||||
@@ -845,10 +649,10 @@
|
@@ -727,6 +531,7 @@
|
||||||
|
%% -------
|
||||||
|
%% presence hooks handling functions
|
||||||
|
%%
|
||||||
|
+
|
||||||
|
presence_probe(Peer, JID, Pid) ->
|
||||||
|
case exmpp_jid:full_compare(Peer, JID) of
|
||||||
|
true -> %% JID are equals
|
||||||
|
@@ -850,10 +655,10 @@
|
||||||
{result, Subscriptions} = node_action(Host, PType, get_entity_subscriptions, [Host, Subscriber]),
|
{result, Subscriptions} = node_action(Host, PType, get_entity_subscriptions, [Host, Subscriber]),
|
||||||
lists:foreach(fun
|
lists:foreach(fun
|
||||||
({Node, subscribed, _, JID}) ->
|
({Node, subscribed, _, JID}) ->
|
||||||
@ -307,7 +315,7 @@
|
|||||||
true ->
|
true ->
|
||||||
node_action(Host, Type, unsubscribe_node, [NodeId, Subscriber, JID, all]);
|
node_action(Host, Type, unsubscribe_node, [NodeId, Subscriber, JID, all]);
|
||||||
false ->
|
false ->
|
||||||
@@ -967,11 +771,12 @@
|
@@ -972,11 +777,12 @@
|
||||||
end,
|
end,
|
||||||
ejabberd_router:route(To, From, Res);
|
ejabberd_router:route(To, From, Res);
|
||||||
#iq{type = get, ns = ?NS_DISCO_ITEMS,
|
#iq{type = get, ns = ?NS_DISCO_ITEMS,
|
||||||
@ -322,7 +330,7 @@
|
|||||||
{result, IQRes} ->
|
{result, IQRes} ->
|
||||||
Result = #xmlel{ns = ?NS_DISCO_ITEMS,
|
Result = #xmlel{ns = ?NS_DISCO_ITEMS,
|
||||||
name = 'query', attrs = QAttrs,
|
name = 'query', attrs = QAttrs,
|
||||||
@@ -1089,7 +894,7 @@
|
@@ -1094,7 +900,7 @@
|
||||||
[] ->
|
[] ->
|
||||||
["leaf"]; %% No sub-nodes: it's a leaf node
|
["leaf"]; %% No sub-nodes: it's a leaf node
|
||||||
_ ->
|
_ ->
|
||||||
@ -331,7 +339,7 @@
|
|||||||
{result, []} -> ["collection"];
|
{result, []} -> ["collection"];
|
||||||
{result, _} -> ["leaf", "collection"];
|
{result, _} -> ["leaf", "collection"];
|
||||||
_ -> []
|
_ -> []
|
||||||
@@ -1105,8 +910,9 @@
|
@@ -1110,8 +916,9 @@
|
||||||
[];
|
[];
|
||||||
true ->
|
true ->
|
||||||
[#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s)]} |
|
[#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s)]} |
|
||||||
@ -343,7 +351,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)
|
||||||
@@ -1135,8 +941,9 @@
|
@@ -1140,8 +947,9 @@
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s)]},
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_ADHOC_s)]},
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_ADHOC_s)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_VCARD_s)]}] ++
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_VCARD_s)]}] ++
|
||||||
@ -355,7 +363,7 @@
|
|||||||
end, features(Host, Node))};
|
end, features(Host, Node))};
|
||||||
?NS_ADHOC_b ->
|
?NS_ADHOC_b ->
|
||||||
command_disco_info(Host, Node, From);
|
command_disco_info(Host, Node, From);
|
||||||
@@ -1146,7 +953,7 @@
|
@@ -1151,7 +959,7 @@
|
||||||
node_disco_info(Host, Node, From)
|
node_disco_info(Host, Node, From)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@ -364,7 +372,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(
|
||||||
@@ -1159,7 +966,7 @@
|
@@ -1164,7 +972,7 @@
|
||||||
Other ->
|
Other ->
|
||||||
Other
|
Other
|
||||||
end;
|
end;
|
||||||
@ -373,7 +381,7 @@
|
|||||||
%% TODO: support localization of this string
|
%% TODO: support localization of this string
|
||||||
CommandItems = [
|
CommandItems = [
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item',
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item',
|
||||||
@@ -1168,10 +975,10 @@
|
@@ -1173,10 +981,10 @@
|
||||||
?XMLATTR('name', "Get Pending")
|
?XMLATTR('name', "Get Pending")
|
||||||
]}],
|
]}],
|
||||||
{result, CommandItems};
|
{result, CommandItems};
|
||||||
@ -386,7 +394,7 @@
|
|||||||
case string:tokens(Item, "!") of
|
case string:tokens(Item, "!") of
|
||||||
[_SNode, _ItemID] ->
|
[_SNode, _ItemID] ->
|
||||||
{result, []};
|
{result, []};
|
||||||
@@ -1179,10 +986,10 @@
|
@@ -1184,10 +992,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}) ->
|
||||||
@ -400,7 +408,7 @@
|
|||||||
end,
|
end,
|
||||||
Nodes = lists:map(
|
Nodes = lists:map(
|
||||||
fun(#pubsub_node{nodeid = {_, SubNode}}) ->
|
fun(#pubsub_node{nodeid = {_, SubNode}}) ->
|
||||||
@@ -1193,9 +1000,10 @@
|
@@ -1198,9 +1006,10 @@
|
||||||
Items = lists:map(
|
Items = lists:map(
|
||||||
fun(#pubsub_item{itemid = {RN, _}}) ->
|
fun(#pubsub_item{itemid = {RN, _}}) ->
|
||||||
{result, Name} = node_call(Type, get_item_name, [Host, Node, RN]),
|
{result, Name} = node_call(Type, get_item_name, [Host, Node, RN]),
|
||||||
@ -413,7 +421,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};
|
||||||
@@ -1326,7 +1134,8 @@
|
@@ -1331,7 +1140,8 @@
|
||||||
(_, Acc) ->
|
(_, Acc) ->
|
||||||
Acc
|
Acc
|
||||||
end, [], exmpp_xml:remove_cdata_from_list(Els)),
|
end, [], exmpp_xml:remove_cdata_from_list(Els)),
|
||||||
@ -423,7 +431,7 @@
|
|||||||
{get, 'subscriptions'} ->
|
{get, 'subscriptions'} ->
|
||||||
get_subscriptions(Host, Node, From, Plugins);
|
get_subscriptions(Host, Node, From, Plugins);
|
||||||
{get, 'affiliations'} ->
|
{get, 'affiliations'} ->
|
||||||
@@ -1348,8 +1157,9 @@
|
@@ -1353,8 +1163,9 @@
|
||||||
end.
|
end.
|
||||||
|
|
||||||
iq_pubsub_owner(Host, ServerHost, From, IQType, SubEl, Lang) ->
|
iq_pubsub_owner(Host, ServerHost, From, IQType, SubEl, Lang) ->
|
||||||
@ -435,7 +443,7 @@
|
|||||||
case Action of
|
case Action of
|
||||||
[#xmlel{name = Name, attrs = Attrs, children = Els}] ->
|
[#xmlel{name = Name, attrs = Attrs, children = Els}] ->
|
||||||
Node = string_to_node(exmpp_xml:get_attribute_from_list_as_list(Attrs, 'node', "")),
|
Node = string_to_node(exmpp_xml:get_attribute_from_list_as_list(Attrs, 'node', "")),
|
||||||
@@ -1483,7 +1293,8 @@
|
@@ -1488,7 +1299,8 @@
|
||||||
_ -> []
|
_ -> []
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -445,7 +453,7 @@
|
|||||||
sync_dirty) of
|
sync_dirty) of
|
||||||
{result, Res} -> Res;
|
{result, Res} -> Res;
|
||||||
Err -> Err
|
Err -> Err
|
||||||
@@ -1527,7 +1338,7 @@
|
@@ -1532,7 +1344,7 @@
|
||||||
|
|
||||||
%%% authorization handling
|
%%% authorization handling
|
||||||
|
|
||||||
@ -454,7 +462,7 @@
|
|||||||
Lang = "en", %% TODO fix
|
Lang = "en", %% TODO fix
|
||||||
{U, S, R} = Subscriber,
|
{U, S, R} = Subscriber,
|
||||||
Stanza = #xmlel{ns = ?NS_JABBER_CLIENT, name = 'message', children =
|
Stanza = #xmlel{ns = ?NS_JABBER_CLIENT, name = 'message', children =
|
||||||
@@ -1557,7 +1368,7 @@
|
@@ -1562,7 +1374,7 @@
|
||||||
lists:foreach(fun(Owner) ->
|
lists:foreach(fun(Owner) ->
|
||||||
{U, S, R} = Owner,
|
{U, S, R} = Owner,
|
||||||
ejabberd_router:route(service_jid(Host), exmpp_jid:make(U, S, R), Stanza)
|
ejabberd_router:route(service_jid(Host), exmpp_jid:make(U, S, R), Stanza)
|
||||||
@ -463,7 +471,7 @@
|
|||||||
|
|
||||||
find_authorization_response(Packet) ->
|
find_authorization_response(Packet) ->
|
||||||
Els = Packet#xmlel.children,
|
Els = Packet#xmlel.children,
|
||||||
@@ -1599,7 +1410,7 @@
|
@@ -1604,7 +1416,7 @@
|
||||||
end,
|
end,
|
||||||
Stanza = event_stanza(
|
Stanza = event_stanza(
|
||||||
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'subscription', attrs =
|
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'subscription', attrs =
|
||||||
@ -472,7 +480,7 @@
|
|||||||
}]),
|
}]),
|
||||||
ejabberd_router:route(service_jid(Host), JID, Stanza).
|
ejabberd_router:route(service_jid(Host), JID, Stanza).
|
||||||
|
|
||||||
@@ -1610,14 +1421,14 @@
|
@@ -1615,14 +1427,14 @@
|
||||||
{{value, {_, [SNode]}}, {value, {_, [SSubscriber]}},
|
{{value, {_, [SNode]}}, {value, {_, [SSubscriber]}},
|
||||||
{value, {_, [SAllow]}}} ->
|
{value, {_, [SAllow]}}} ->
|
||||||
Node = string_to_node(SNode),
|
Node = string_to_node(SNode),
|
||||||
@ -490,7 +498,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 ->
|
||||||
@@ -1812,7 +1623,7 @@
|
@@ -1817,7 +1629,7 @@
|
||||||
end,
|
end,
|
||||||
Reply = #xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children =
|
Reply = #xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children =
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'create', attrs = nodeAttr(Node)}]},
|
[#xmlel{ns = ?NS_PUBSUB, name = 'create', attrs = nodeAttr(Node)}]},
|
||||||
@ -499,7 +507,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)),
|
||||||
@@ -1921,7 +1732,7 @@
|
@@ -1926,7 +1738,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) ->
|
||||||
@ -508,7 +516,7 @@
|
|||||||
{result, GoodSubOpts} -> GoodSubOpts;
|
{result, GoodSubOpts} -> GoodSubOpts;
|
||||||
_ -> invalid
|
_ -> invalid
|
||||||
end,
|
end,
|
||||||
@@ -1932,7 +1743,7 @@
|
@@ -1937,7 +1749,7 @@
|
||||||
{undefined, undefined, undefined}
|
{undefined, undefined, undefined}
|
||||||
end,
|
end,
|
||||||
SubId = uniqid(),
|
SubId = uniqid(),
|
||||||
@ -517,7 +525,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),
|
||||||
@@ -1951,9 +1762,13 @@
|
@@ -1956,9 +1768,13 @@
|
||||||
{"", "", ""} ->
|
{"", "", ""} ->
|
||||||
{false, false};
|
{false, false};
|
||||||
_ ->
|
_ ->
|
||||||
@ -534,7 +542,7 @@
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
if
|
if
|
||||||
@@ -2286,7 +2101,7 @@
|
@@ -2291,7 +2107,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.
|
||||||
@ -543,7 +551,7 @@
|
|||||||
MaxItems =
|
MaxItems =
|
||||||
if
|
if
|
||||||
SMaxItems == "" -> get_max_items_node(Host);
|
SMaxItems == "" -> get_max_items_node(Host);
|
||||||
@@ -2325,11 +2140,11 @@
|
@@ -2330,11 +2146,11 @@
|
||||||
node_call(Type, get_items,
|
node_call(Type, get_items,
|
||||||
[NodeId, From,
|
[NodeId, From,
|
||||||
AccessModel, PresenceSubscription, RosterGroup,
|
AccessModel, PresenceSubscription, RosterGroup,
|
||||||
@ -557,7 +565,7 @@
|
|||||||
SendItems = case ItemIDs of
|
SendItems = case ItemIDs of
|
||||||
[] ->
|
[] ->
|
||||||
Items;
|
Items;
|
||||||
@@ -2342,7 +2157,7 @@
|
@@ -2347,7 +2163,7 @@
|
||||||
%% number of items sent to MaxItems:
|
%% number of items sent to MaxItems:
|
||||||
{result, #xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children =
|
{result, #xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children =
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'items', attrs = nodeAttr(Node), children =
|
[#xmlel{ns = ?NS_PUBSUB, name = 'items', attrs = nodeAttr(Node), children =
|
||||||
@ -566,7 +574,7 @@
|
|||||||
Error ->
|
Error ->
|
||||||
Error
|
Error
|
||||||
end
|
end
|
||||||
@@ -2374,17 +2189,29 @@
|
@@ -2379,17 +2195,29 @@
|
||||||
%% @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) ->
|
||||||
@ -603,7 +611,7 @@
|
|||||||
send_items(Host, Node, NodeId, Type, {LU, LS, LR} = LJID, Number) ->
|
send_items(Host, Node, NodeId, Type, {LU, LS, LR} = 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, []} ->
|
||||||
@@ -2513,29 +2340,12 @@
|
@@ -2518,29 +2346,12 @@
|
||||||
error ->
|
error ->
|
||||||
{error, 'bad-request'};
|
{error, 'bad-request'};
|
||||||
_ ->
|
_ ->
|
||||||
@ -636,7 +644,7 @@
|
|||||||
end, Entities),
|
end, Entities),
|
||||||
{result, []};
|
{result, []};
|
||||||
_ ->
|
_ ->
|
||||||
@@ -2590,11 +2400,11 @@
|
@@ -2595,11 +2406,11 @@
|
||||||
end.
|
end.
|
||||||
|
|
||||||
read_sub(Subscriber, Node, NodeID, SubID, Lang) ->
|
read_sub(Subscriber, Node, NodeID, SubID, Lang) ->
|
||||||
@ -650,7 +658,7 @@
|
|||||||
OptionsEl = #xmlel{ns = ?NS_PUBSUB, name = 'options',
|
OptionsEl = #xmlel{ns = ?NS_PUBSUB, name = 'options',
|
||||||
attrs = [ ?XMLATTR('jid', exmpp_jid:to_binary(Subscriber)),
|
attrs = [ ?XMLATTR('jid', exmpp_jid:to_binary(Subscriber)),
|
||||||
?XMLATTR('Subid', SubID) | nodeAttr(Node)],
|
?XMLATTR('Subid', SubID) | nodeAttr(Node)],
|
||||||
@@ -2621,7 +2431,7 @@
|
@@ -2626,7 +2437,7 @@
|
||||||
end.
|
end.
|
||||||
|
|
||||||
set_options_helper(Configuration, JID, NodeID, SubID, Type) ->
|
set_options_helper(Configuration, JID, NodeID, SubID, Type) ->
|
||||||
@ -659,7 +667,7 @@
|
|||||||
{result, GoodSubOpts} -> GoodSubOpts;
|
{result, GoodSubOpts} -> GoodSubOpts;
|
||||||
_ -> invalid
|
_ -> invalid
|
||||||
end,
|
end,
|
||||||
@@ -2651,7 +2461,7 @@
|
@@ -2656,7 +2467,7 @@
|
||||||
write_sub(_Subscriber, _NodeID, _SubID, invalid) ->
|
write_sub(_Subscriber, _NodeID, _SubID, invalid) ->
|
||||||
{error, extended_error('bad-request', "invalid-options")};
|
{error, extended_error('bad-request', "invalid-options")};
|
||||||
write_sub(Subscriber, NodeID, SubID, Options) ->
|
write_sub(Subscriber, NodeID, SubID, Options) ->
|
||||||
@ -668,7 +676,7 @@
|
|||||||
{error, notfound} ->
|
{error, notfound} ->
|
||||||
{error, extended_error('not-acceptable', "invalid-subid")};
|
{error, extended_error('not-acceptable', "invalid-subid")};
|
||||||
{result, _} ->
|
{result, _} ->
|
||||||
@@ -2824,8 +2634,8 @@
|
@@ -2829,8 +2640,8 @@
|
||||||
?XMLATTR('subsription', subscription_to_string(Sub)) | nodeAttr(Node)]}]}]},
|
?XMLATTR('subsription', subscription_to_string(Sub)) | nodeAttr(Node)]}]}]},
|
||||||
ejabberd_router:route(service_jid(Host), JID, Stanza)
|
ejabberd_router:route(service_jid(Host), JID, Stanza)
|
||||||
end,
|
end,
|
||||||
@ -679,7 +687,7 @@
|
|||||||
true ->
|
true ->
|
||||||
Result = lists:foldl(fun({JID, Subscription, SubId}, Acc) ->
|
Result = lists:foldl(fun({JID, Subscription, SubId}, Acc) ->
|
||||||
|
|
||||||
@@ -3114,7 +2924,7 @@
|
@@ -3119,7 +2930,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,
|
||||||
@ -688,7 +696,7 @@
|
|||||||
{result, CollSubs} -> CollSubs;
|
{result, CollSubs} -> CollSubs;
|
||||||
_ -> []
|
_ -> []
|
||||||
end.
|
end.
|
||||||
@@ -3128,9 +2938,9 @@
|
@@ -3133,9 +2944,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) ->
|
||||||
@ -700,7 +708,7 @@
|
|||||||
_ -> Acc
|
_ -> Acc
|
||||||
end;
|
end;
|
||||||
(_, Acc) ->
|
(_, Acc) ->
|
||||||
@@ -3138,7 +2948,7 @@
|
@@ -3143,7 +2954,7 @@
|
||||||
end, [], Subs).
|
end, [], Subs).
|
||||||
|
|
||||||
% TODO: merge broadcast code that way
|
% TODO: merge broadcast code that way
|
||||||
@ -709,7 +717,7 @@
|
|||||||
%broadcast(Host, Node, NodeId, Type, NodeOptions, Feature, Force, ElName, SubEls) ->
|
%broadcast(Host, Node, NodeId, Type, NodeOptions, Feature, Force, ElName, SubEls) ->
|
||||||
% case (get_option(NodeOptions, Feature) or Force) of
|
% case (get_option(NodeOptions, Feature) or Force) of
|
||||||
% true ->
|
% true ->
|
||||||
@@ -3330,6 +3140,30 @@
|
@@ -3335,6 +3146,30 @@
|
||||||
Result
|
Result
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@ -740,7 +748,7 @@
|
|||||||
%% @spec (Host, Options) -> MaxItems
|
%% @spec (Host, Options) -> MaxItems
|
||||||
%% Host = host()
|
%% Host = host()
|
||||||
%% Options = [Option]
|
%% Options = [Option]
|
||||||
@@ -3719,7 +3553,13 @@
|
@@ -3724,7 +3559,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,
|
||||||
@ -755,7 +763,7 @@
|
|||||||
|
|
||||||
%% @doc <p>node plugin call.</p>
|
%% @doc <p>node plugin call.</p>
|
||||||
node_call(Type, Function, Args) ->
|
node_call(Type, Function, Args) ->
|
||||||
@@ -3739,13 +3579,13 @@
|
@@ -3744,13 +3585,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]),
|
||||||
@ -771,7 +779,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
|
||||||
@@ -3758,8 +3598,15 @@
|
@@ -3763,8 +3604,15 @@
|
||||||
end
|
end
|
||||||
end, Trans).
|
end, Trans).
|
||||||
|
|
||||||
@ -789,7 +797,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};
|
||||||
@@ -3767,6 +3614,15 @@
|
@@ -3772,6 +3620,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'};
|
||||||
@ -805,7 +813,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'};
|
||||||
@@ -3775,6 +3631,16 @@
|
@@ -3780,6 +3637,16 @@
|
||||||
{error, 'internal-server-error'}
|
{error, 'internal-server-error'}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user