diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2014-11-14 00:02:59 +0100 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2014-11-14 00:02:59 +0100 |
commit | 8efae1f05ba39e2fa5bc8e105191fe1e7af36f56 (patch) | |
tree | bdb69199b37045eaf4961ef87ec4d9678ae3eb07 /src | |
parent | Merge pull request #341 from sezuan/fix-kick-user-command (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/mod_pubsub_odbc.erl | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/mod_pubsub_odbc.erl b/src/mod_pubsub_odbc.erl index 53329d332..87d553523 100644 --- a/src/mod_pubsub_odbc.erl +++ b/src/mod_pubsub_odbc.erl @@ -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]) |