mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-20 17:27:00 +01:00
Call ejabberd_router:route/3 instead of sending a message (EJAB-1114)
SVN Revision: 2782
This commit is contained in:
parent
5a006b977d
commit
bd97c40f92
@ -1509,7 +1509,7 @@ send_authorization_request(#pubsub_node{owners = Owners, nodeid = {Host, Node}},
|
|||||||
{"label", translate:translate(Lang, "Allow this Jabber ID to subscribe to this pubsub node?")}],
|
{"label", translate:translate(Lang, "Allow this Jabber ID to subscribe to this pubsub node?")}],
|
||||||
[{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)
|
||||||
end, Owners).
|
end, Owners).
|
||||||
|
|
||||||
find_authorization_response(Packet) ->
|
find_authorization_response(Packet) ->
|
||||||
@ -1559,7 +1559,7 @@ send_authorization_approval(Host, JID, SNode, Subscription) ->
|
|||||||
[{xmlelement, "subscription",
|
[{xmlelement, "subscription",
|
||||||
[{"jid", jlib:jid_to_string(JID)}|nodeAttr(SNode)] ++ SubAttrs,
|
[{"jid", jlib:jid_to_string(JID)}|nodeAttr(SNode)] ++ SubAttrs,
|
||||||
[]}]),
|
[]}]),
|
||||||
ejabberd_router ! {route, service_jid(Host), JID, Stanza}.
|
ejabberd_router:route(service_jid(Host), JID, Stanza).
|
||||||
|
|
||||||
handle_authorization_response(Host, From, To, Packet, XFields) ->
|
handle_authorization_response(Host, From, To, Packet, XFields) ->
|
||||||
case {lists:keysearch("pubsub#node", 1, XFields),
|
case {lists:keysearch("pubsub#node", 1, XFields),
|
||||||
@ -2330,7 +2330,7 @@ send_items(Host, Node, NodeId, Type, LJID, last) ->
|
|||||||
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, ModifLjid),
|
||||||
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) ->
|
||||||
ToSend = case node_action(Host, Type, get_items, [NodeId, LJID]) of
|
ToSend = case node_action(Host, Type, get_items, [NodeId, LJID]) of
|
||||||
@ -2355,7 +2355,7 @@ send_items(Host, Node, NodeId, Type, LJID, Number) ->
|
|||||||
[{xmlelement, "items", nodeAttr(Node),
|
[{xmlelement, "items", nodeAttr(Node),
|
||||||
itemsEls(ToSend)}])
|
itemsEls(ToSend)}])
|
||||||
end,
|
end,
|
||||||
ejabberd_router ! {route, service_jid(Host), jlib:make_jid(LJID), Stanza}.
|
ejabberd_router:route(service_jid(Host), jlib:make_jid(LJID), Stanza).
|
||||||
|
|
||||||
%% @spec (Host, JID, Plugins) -> {error, Reason} | {result, Response}
|
%% @spec (Host, JID, Plugins) -> {error, Reason} | {result, Response}
|
||||||
%% Host = host()
|
%% Host = host()
|
||||||
@ -2757,7 +2757,7 @@ set_subscriptions(Host, Node, From, EntitiesEls) ->
|
|||||||
[{"jid", jlib:jid_to_string(JID)},
|
[{"jid", jlib:jid_to_string(JID)},
|
||||||
%{"subid", SubId},
|
%{"subid", SubId},
|
||||||
{"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,
|
||||||
Action = fun(#pubsub_node{owners = Owners, type = Type, id = NodeId}) ->
|
Action = fun(#pubsub_node{owners = Owners, type = Type, id = NodeId}) ->
|
||||||
case lists:member(Owner, Owners) of
|
case lists:member(Owner, Owners) of
|
||||||
@ -3105,7 +3105,7 @@ broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyTyp
|
|||||||
end,
|
end,
|
||||||
SHIMStanza = add_headers(Stanza, collection_shim(Node, Nodes)),
|
SHIMStanza = add_headers(Stanza, collection_shim(Node, Nodes)),
|
||||||
lists:foreach(fun(To) ->
|
lists:foreach(fun(To) ->
|
||||||
ejabberd_router ! {route, From, jlib:make_jid(To), SHIMStanza}
|
ejabberd_router:route(From, jlib:make_jid(To), SHIMStanza)
|
||||||
end, LJIDs)
|
end, LJIDs)
|
||||||
end, NodesByJID),
|
end, NodesByJID),
|
||||||
%% Handles implicit presence subscriptions
|
%% Handles implicit presence subscriptions
|
||||||
@ -3139,7 +3139,7 @@ broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyTyp
|
|||||||
end
|
end
|
||||||
end, [], user_resources(U, S)),
|
end, [], user_resources(U, S)),
|
||||||
lists:foreach(fun(To) ->
|
lists:foreach(fun(To) ->
|
||||||
ejabberd_router ! {route, Sender, jlib:make_jid(To), Stanza}
|
ejabberd_router:route(Sender, jlib:make_jid(To), Stanza)
|
||||||
end, LJIDs)
|
end, LJIDs)
|
||||||
end)
|
end)
|
||||||
end, Contacts);
|
end, Contacts);
|
||||||
|
@ -1319,7 +1319,7 @@ send_authorization_request(#pubsub_node{nodeid = {Host, Node}, type = Type, id =
|
|||||||
{"label", translate:translate(Lang, "Allow this Jabber ID to subscribe to this pubsub node?")}],
|
{"label", translate:translate(Lang, "Allow this Jabber ID to subscribe to this pubsub node?")}],
|
||||||
[{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)
|
||||||
end, node_owners(Host, Type, NodeId)).
|
end, node_owners(Host, Type, NodeId)).
|
||||||
|
|
||||||
find_authorization_response(Packet) ->
|
find_authorization_response(Packet) ->
|
||||||
@ -1369,7 +1369,7 @@ send_authorization_approval(Host, JID, SNode, Subscription) ->
|
|||||||
[{xmlelement, "subscription",
|
[{xmlelement, "subscription",
|
||||||
[{"jid", jlib:jid_to_string(JID)}|nodeAttr(SNode)] ++ SubAttrs,
|
[{"jid", jlib:jid_to_string(JID)}|nodeAttr(SNode)] ++ SubAttrs,
|
||||||
[]}]),
|
[]}]),
|
||||||
ejabberd_router ! {route, service_jid(Host), JID, Stanza}.
|
ejabberd_router:route(service_jid(Host), JID, Stanza).
|
||||||
|
|
||||||
handle_authorization_response(Host, From, To, Packet, XFields) ->
|
handle_authorization_response(Host, From, To, Packet, XFields) ->
|
||||||
case {lists:keysearch("pubsub#node", 1, XFields),
|
case {lists:keysearch("pubsub#node", 1, XFields),
|
||||||
@ -2157,7 +2157,7 @@ send_items(Host, Node, NodeId, Type, LJID, last) ->
|
|||||||
[{xmlelement, "items", nodeAttr(Node),
|
[{xmlelement, "items", nodeAttr(Node),
|
||||||
itemsEls([LastItem])}], ModifNow, ModifLjid)
|
itemsEls([LastItem])}], ModifNow, ModifLjid)
|
||||||
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, []} ->
|
||||||
@ -2181,7 +2181,7 @@ send_items(Host, Node, NodeId, Type, LJID, Number) ->
|
|||||||
[{xmlelement, "items", nodeAttr(Node),
|
[{xmlelement, "items", nodeAttr(Node),
|
||||||
itemsEls(ToSend)}])
|
itemsEls(ToSend)}])
|
||||||
end,
|
end,
|
||||||
ejabberd_router ! {route, service_jid(Host), jlib:make_jid(LJID), Stanza}.
|
ejabberd_router:route(service_jid(Host), jlib:make_jid(LJID), Stanza).
|
||||||
|
|
||||||
%% @spec (Host, JID, Plugins) -> {error, Reason} | {result, Response}
|
%% @spec (Host, JID, Plugins) -> {error, Reason} | {result, Response}
|
||||||
%% Host = host()
|
%% Host = host()
|
||||||
@ -2566,7 +2566,7 @@ set_subscriptions(Host, Node, From, EntitiesEls) ->
|
|||||||
[{"jid", jlib:jid_to_string(JID)},
|
[{"jid", jlib:jid_to_string(JID)},
|
||||||
%{"subid", SubId},
|
%{"subid", SubId},
|
||||||
{"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,
|
||||||
Action = fun(#pubsub_node{type = Type, id = NodeId}) ->
|
Action = fun(#pubsub_node{type = Type, id = NodeId}) ->
|
||||||
case lists:member(Owner, node_owners_call(Type, NodeId)) of
|
case lists:member(Owner, node_owners_call(Type, NodeId)) of
|
||||||
@ -2914,7 +2914,7 @@ broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyTyp
|
|||||||
end,
|
end,
|
||||||
SHIMStanza = add_headers(Stanza, collection_shim(Node, Nodes)),
|
SHIMStanza = add_headers(Stanza, collection_shim(Node, Nodes)),
|
||||||
lists:foreach(fun(To) ->
|
lists:foreach(fun(To) ->
|
||||||
ejabberd_router ! {route, From, jlib:make_jid(To), SHIMStanza}
|
ejabberd_router:route(From, jlib:make_jid(To), SHIMStanza)
|
||||||
end, LJIDs)
|
end, LJIDs)
|
||||||
end, NodesByJID),
|
end, NodesByJID),
|
||||||
%% Handles implicit presence subscriptions
|
%% Handles implicit presence subscriptions
|
||||||
@ -2948,7 +2948,7 @@ broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyTyp
|
|||||||
end
|
end
|
||||||
end, [], user_resources(U, S)),
|
end, [], user_resources(U, S)),
|
||||||
lists:foreach(fun(To) ->
|
lists:foreach(fun(To) ->
|
||||||
ejabberd_router ! {route, Sender, jlib:make_jid(To), Stanza}
|
ejabberd_router:route(Sender, jlib:make_jid(To), Stanza)
|
||||||
end, LJIDs)
|
end, LJIDs)
|
||||||
end)
|
end)
|
||||||
end, Contacts);
|
end, Contacts);
|
||||||
|
@ -433,7 +433,7 @@
|
|||||||
@@ -1510,7 +1320,7 @@
|
@@ -1510,7 +1320,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)
|
||||||
- end, Owners).
|
- end, Owners).
|
||||||
+ end, node_owners(Host, Type, NodeId)).
|
+ end, node_owners(Host, Type, NodeId)).
|
||||||
|
|
||||||
@ -553,11 +553,11 @@
|
|||||||
+ event_stanza_with_delay(
|
+ event_stanza_with_delay(
|
||||||
[{xmlelement, "items", nodeAttr(Node),
|
[{xmlelement, "items", nodeAttr(Node),
|
||||||
- itemsEls([LastItem])}], ModifNow, ModifLjid),
|
- itemsEls([LastItem])}], ModifNow, ModifLjid),
|
||||||
- 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, ModifLjid)
|
||||||
+ 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, []} ->
|
||||||
@ -628,7 +628,7 @@
|
|||||||
{result, _} ->
|
{result, _} ->
|
||||||
@@ -2759,8 +2568,8 @@
|
@@ -2759,8 +2568,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,
|
||||||
- Action = fun(#pubsub_node{owners = Owners, type = Type, id = NodeId}) ->
|
- Action = fun(#pubsub_node{owners = Owners, type = Type, id = NodeId}) ->
|
||||||
- case lists:member(Owner, Owners) of
|
- case lists:member(Owner, Owners) of
|
||||||
|
@ -310,7 +310,7 @@ do_route(ServerHost, From, To, Packet) ->
|
|||||||
if
|
if
|
||||||
(User /= "") or (Resource /= "") ->
|
(User /= "") or (Resource /= "") ->
|
||||||
Err = jlib:make_error_reply(Packet, ?ERR_SERVICE_UNAVAILABLE),
|
Err = jlib:make_error_reply(Packet, ?ERR_SERVICE_UNAVAILABLE),
|
||||||
ejabberd_router ! {route, To, From, Err};
|
ejabberd_router:route(To, From, Err);
|
||||||
true ->
|
true ->
|
||||||
IQ = jlib:iq_query_info(Packet),
|
IQ = jlib:iq_query_info(Packet),
|
||||||
case IQ of
|
case IQ of
|
||||||
|
Loading…
Reference in New Issue
Block a user