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:
parent
de3e1c3508
commit
8efae1f05b
|
@ -2986,7 +2986,7 @@ get_allowed_items_call(Host, NodeIdx, From, Type, Options, Owners, RSM) ->
|
||||||
%% Number = last | integer()
|
%% Number = last | integer()
|
||||||
%% @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, {U, S, R} = LJID, last) ->
|
||||||
Stanza = case get_cached_item(Host, NodeId) of
|
Stanza = case get_cached_item(Host, NodeId) of
|
||||||
undefined ->
|
undefined ->
|
||||||
% special ODBC optimization, works only with node_hometree_odbc, node_flat_odbc and node_pep_odbc
|
% 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])}],
|
itemsEls([LastItem])}],
|
||||||
ModifNow, ModifUSR)
|
ModifNow, ModifUSR)
|
||||||
end,
|
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) ->
|
send_items(Host, Node, NodeId, Type, {U, S, R} = LJID, Number) ->
|
||||||
ToSend = case node_action(Host, Type, get_items,
|
ToSend = case node_action(Host, Type, get_items,
|
||||||
[NodeId, LJID])
|
[NodeId, LJID])
|
||||||
|
|
Loading…
Reference in New Issue