diff options
author | Christophe Romain <christophe.romain@process-one.net> | 2016-04-28 15:57:55 +0200 |
---|---|---|
committer | Christophe Romain <christophe.romain@process-one.net> | 2016-04-28 15:57:55 +0200 |
commit | 639c2fb6401391663206c0e4c946d1a699689ac7 (patch) | |
tree | fa20ae023254a9cb4a21321722501a8852c45377 | |
parent | Better formatting of configuration problem log message (diff) |
Add pubsub subscribe/unsubscribe hook16.04
-rw-r--r-- | src/mod_pubsub.erl | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl index a801fa984..7ec2fe57c 100644 --- a/src/mod_pubsub.erl +++ b/src/mod_pubsub.erl @@ -2103,6 +2103,9 @@ subscribe_node(Host, Node, From, JID, Configuration) -> Type = TNode#pubsub_node.type, Options = TNode#pubsub_node.options, send_items(Host, Node, Nidx, Type, Options, Subscriber, last), + ServerHost = serverhost(Host), + ejabberd_hooks:run(pubsub_subscribe_node, ServerHost, + [ServerHost, Host, Node, Subscriber, SubId]), case Result of default -> {result, Reply({subscribed, SubId})}; _ -> {result, Result} @@ -2149,7 +2152,11 @@ unsubscribe_node(Host, Node, From, Subscriber, SubId) -> node_call(Host, Type, unsubscribe_node, [Nidx, From, Subscriber, SubId]) end, case transaction(Host, Node, Action, sync_dirty) of - {result, {_, default}} -> {result, []}; + {result, {_, default}} -> + ServerHost = serverhost(Host), + ejabberd_hooks:run(pubsub_unsubscribe_node, ServerHost, + [ServerHost, Host, Node, Subscriber, SubId]), + {result, []}; % {result, {_, Result}} -> {result, Result}; Error -> Error end. |