aboutsummaryrefslogtreecommitdiff
path: root/src/mod_pubsub_odbc.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/mod_pubsub_odbc.erl')
-rw-r--r--src/mod_pubsub_odbc.erl21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/mod_pubsub_odbc.erl b/src/mod_pubsub_odbc.erl
index 8236447d0..498c81bd3 100644
--- a/src/mod_pubsub_odbc.erl
+++ b/src/mod_pubsub_odbc.erl
@@ -3013,7 +3013,7 @@ send_items(Host, Node, NodeId, Type, LJID, last) ->
ModifNow, ModifUSR)
end,
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, {U, S, R} = LJID, Number) ->
ToSend = case node_action(Host, Type, get_items,
[NodeId, LJID])
of
@@ -3026,6 +3026,8 @@ send_items(Host, Node, NodeId, Type, LJID, Number) ->
_ -> []
end,
Stanza = case ToSend of
+ [] ->
+ undefined;
[LastItem] ->
{ModifNow, ModifUSR} =
LastItem#pubsub_item.modification,
@@ -3039,7 +3041,22 @@ send_items(Host, Node, NodeId, Type, LJID, Number) ->
attrs = nodeAttr(Node),
children = itemsEls(ToSend)}])
end,
- ejabberd_router:route(service_jid(Host), jlib:make_jid(LJID), Stanza).
+ case {is_tuple(Host), Stanza} of
+ {_, undefined} ->
+ ok;
+ {false, _} ->
+ ejabberd_router:route(service_jid(Host),
+ jlib:make_jid(LJID), Stanza);
+ {true, _} ->
+ case ejabberd_sm:get_session_pid(U, S, R) of
+ C2SPid when is_pid(C2SPid) ->
+ ejabberd_c2s:broadcast(C2SPid,
+ {pep_message,
+ <<((Node))/binary, "+notify">>},
+ _Sender = service_jid(Host), Stanza);
+ _ -> ok
+ end
+ end.
%% @spec (Host, JID, Plugins) -> {error, Reason} | {result, Response}
%% Host = host()