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?")}],
|
||||
[{xmlelement, "value", [], [{xmlcdata, "false"}]}]}]}]},
|
||||
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).
|
||||
|
||||
find_authorization_response(Packet) ->
|
||||
@ -1559,7 +1559,7 @@ send_authorization_approval(Host, JID, SNode, Subscription) ->
|
||||
[{xmlelement, "subscription",
|
||||
[{"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) ->
|
||||
case {lists:keysearch("pubsub#node", 1, XFields),
|
||||
@ -2330,7 +2330,7 @@ send_items(Host, Node, NodeId, Type, LJID, last) ->
|
||||
Stanza = event_stanza_with_delay(
|
||||
[{xmlelement, "items", nodeAttr(Node),
|
||||
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;
|
||||
send_items(Host, Node, NodeId, Type, LJID, Number) ->
|
||||
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),
|
||||
itemsEls(ToSend)}])
|
||||
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}
|
||||
%% Host = host()
|
||||
@ -2757,7 +2757,7 @@ set_subscriptions(Host, Node, From, EntitiesEls) ->
|
||||
[{"jid", jlib:jid_to_string(JID)},
|
||||
%{"subid", SubId},
|
||||
{"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,
|
||||
Action = fun(#pubsub_node{owners = Owners, type = Type, id = NodeId}) ->
|
||||
case lists:member(Owner, Owners) of
|
||||
@ -3105,7 +3105,7 @@ broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyTyp
|
||||
end,
|
||||
SHIMStanza = add_headers(Stanza, collection_shim(Node, Nodes)),
|
||||
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, NodesByJID),
|
||||
%% Handles implicit presence subscriptions
|
||||
@ -3139,7 +3139,7 @@ broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyTyp
|
||||
end
|
||||
end, [], user_resources(U, S)),
|
||||
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)
|
||||
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?")}],
|
||||
[{xmlelement, "value", [], [{xmlcdata, "false"}]}]}]}]},
|
||||
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)).
|
||||
|
||||
find_authorization_response(Packet) ->
|
||||
@ -1369,7 +1369,7 @@ send_authorization_approval(Host, JID, SNode, Subscription) ->
|
||||
[{xmlelement, "subscription",
|
||||
[{"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) ->
|
||||
case {lists:keysearch("pubsub#node", 1, XFields),
|
||||
@ -2157,7 +2157,7 @@ send_items(Host, Node, NodeId, Type, LJID, last) ->
|
||||
[{xmlelement, "items", nodeAttr(Node),
|
||||
itemsEls([LastItem])}], ModifNow, ModifLjid)
|
||||
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) ->
|
||||
ToSend = case node_action(Host, Type, get_items, [NodeId, LJID]) of
|
||||
{result, []} ->
|
||||
@ -2181,7 +2181,7 @@ send_items(Host, Node, NodeId, Type, LJID, Number) ->
|
||||
[{xmlelement, "items", nodeAttr(Node),
|
||||
itemsEls(ToSend)}])
|
||||
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}
|
||||
%% Host = host()
|
||||
@ -2566,7 +2566,7 @@ set_subscriptions(Host, Node, From, EntitiesEls) ->
|
||||
[{"jid", jlib:jid_to_string(JID)},
|
||||
%{"subid", SubId},
|
||||
{"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,
|
||||
Action = fun(#pubsub_node{type = Type, id = NodeId}) ->
|
||||
case lists:member(Owner, node_owners_call(Type, NodeId)) of
|
||||
@ -2914,7 +2914,7 @@ broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyTyp
|
||||
end,
|
||||
SHIMStanza = add_headers(Stanza, collection_shim(Node, Nodes)),
|
||||
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, NodesByJID),
|
||||
%% Handles implicit presence subscriptions
|
||||
@ -2948,7 +2948,7 @@ broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyTyp
|
||||
end
|
||||
end, [], user_resources(U, S)),
|
||||
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)
|
||||
end, Contacts);
|
||||
|
@ -433,7 +433,7 @@
|
||||
@@ -1510,7 +1320,7 @@
|
||||
[{xmlelement, "value", [], [{xmlcdata, "false"}]}]}]}]},
|
||||
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, node_owners(Host, Type, NodeId)).
|
||||
|
||||
@ -553,11 +553,11 @@
|
||||
+ event_stanza_with_delay(
|
||||
[{xmlelement, "items", nodeAttr(Node),
|
||||
- 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;
|
||||
+ itemsEls([LastItem])}], ModifNow, ModifLjid)
|
||||
+ 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) ->
|
||||
ToSend = case node_action(Host, Type, get_items, [NodeId, LJID]) of
|
||||
{result, []} ->
|
||||
@ -628,7 +628,7 @@
|
||||
{result, _} ->
|
||||
@@ -2759,8 +2568,8 @@
|
||||
{"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,
|
||||
- Action = fun(#pubsub_node{owners = Owners, type = Type, id = NodeId}) ->
|
||||
- case lists:member(Owner, Owners) of
|
||||
|
@ -310,7 +310,7 @@ do_route(ServerHost, From, To, Packet) ->
|
||||
if
|
||||
(User /= "") or (Resource /= "") ->
|
||||
Err = jlib:make_error_reply(Packet, ?ERR_SERVICE_UNAVAILABLE),
|
||||
ejabberd_router ! {route, To, From, Err};
|
||||
ejabberd_router:route(To, From, Err);
|
||||
true ->
|
||||
IQ = jlib:iq_query_info(Packet),
|
||||
case IQ of
|
||||
|
Loading…
Reference in New Issue
Block a user