aboutsummaryrefslogtreecommitdiff
path: root/src/mod_pubsub/mod_pubsub_odbc.erl
diff options
context:
space:
mode:
authorChristophe Romain <christophe.romain@process-one.net>2009-08-25 16:35:43 +0000
committerChristophe Romain <christophe.romain@process-one.net>2009-08-25 16:35:43 +0000
commiteca4d9c963c805743ed99cb05429d94b14638e83 (patch)
tree5cad908e3f155d7935426203ac97042a39125064 /src/mod_pubsub/mod_pubsub_odbc.erl
parentAdd command to update PubSub table of ejabberd trunk SVN. (diff)
resolve EJAB-1025, send notification when owner changed entity subscription
SVN Revision: 2532
Diffstat (limited to 'src/mod_pubsub/mod_pubsub_odbc.erl')
-rw-r--r--src/mod_pubsub/mod_pubsub_odbc.erl11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mod_pubsub/mod_pubsub_odbc.erl b/src/mod_pubsub/mod_pubsub_odbc.erl
index 3bad02fb7..23c7daae0 100644
--- a/src/mod_pubsub/mod_pubsub_odbc.erl
+++ b/src/mod_pubsub/mod_pubsub_odbc.erl
@@ -2673,6 +2673,15 @@ set_subscriptions(Host, Node, From, EntitiesEls) ->
error ->
{error, ?ERR_BAD_REQUEST};
_ ->
+ Notify = fun(JID, Sub, _SubId) ->
+ Stanza = {xmlelement, "message", [],
+ [{xmlelement, "pubsub", [{"xmlns", ?NS_PUBSUB}],
+ [{xmlelement, "subscription",
+ [{"jid", jlib:jid_to_string(JID)},
+ %{"subid", SubId},
+ {"subscription", subscription_to_string(Sub)} | nodeAttr(Node)], []}]}]},
+ ejabberd_router ! {route, service_jid(Host), jlib:make_jid(JID), Stanza}
+ end,
Action = fun(#pubsub_node{type = Type, id = NodeId}) ->
case lists:member(Owner, node_owners_call(Type, NodeId)) of
true ->
@@ -2680,7 +2689,7 @@ set_subscriptions(Host, Node, From, EntitiesEls) ->
case node_call(Type, set_subscriptions, [NodeId, JID, Subscription, SubId]) of
{error, Err} -> [{error, Err} | Acc];
- _ -> Acc
+ _ -> Notify(JID, Subscription, SubId), Acc
end
end, [], Entities),
case Result of