25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

ODBC: Sync last item notifications with mod_pubsub

A while back, mod_pubsub was modified to address EJAB-1456.  However,
the change was only partially applied to mod_pubsub_odbc.  This commit
adds the remaining part.
This commit is contained in:
Holger Weiss 2014-11-14 00:02:59 +01:00
parent de3e1c3508
commit 8efae1f05b

View File

@ -2986,7 +2986,7 @@ get_allowed_items_call(Host, NodeIdx, From, Type, Options, Owners, RSM) ->
%% Number = last | integer()
%% @doc <p>Resend the items of a node to the user.</p>
%% @todo use cache-last-item feature
send_items(Host, Node, NodeId, Type, LJID, last) ->
send_items(Host, Node, NodeId, Type, {U, S, R} = LJID, last) ->
Stanza = case get_cached_item(Host, NodeId) of
undefined ->
% special ODBC optimization, works only with node_hometree_odbc, node_flat_odbc and node_pep_odbc
@ -3011,7 +3011,19 @@ send_items(Host, Node, NodeId, Type, LJID, last) ->
itemsEls([LastItem])}],
ModifNow, ModifUSR)
end,
ejabberd_router:route(service_jid(Host), jlib:make_jid(LJID), Stanza);
case is_tuple(Host) of
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;
send_items(Host, Node, NodeId, Type, {U, S, R} = LJID, Number) ->
ToSend = case node_action(Host, Type, get_items,
[NodeId, LJID])