summaryrefslogtreecommitdiff
path: root/src/mod_pubsub
diff options
context:
space:
mode:
Diffstat (limited to 'src/mod_pubsub')
-rw-r--r--src/mod_pubsub/mod_pubsub.erl12
-rw-r--r--src/mod_pubsub/mod_pubsub_odbc.erl14
-rw-r--r--src/mod_pubsub/node_hometree.erl7
-rw-r--r--src/mod_pubsub/node_hometree_odbc.erl11
-rw-r--r--src/mod_pubsub/nodetree_tree.erl15
-rw-r--r--src/mod_pubsub/nodetree_tree_odbc.erl19
-rw-r--r--src/mod_pubsub/nodetree_virtual.erl11
-rw-r--r--src/mod_pubsub/pubsub.hrl9
-rw-r--r--src/mod_pubsub/pubsub_subscription_odbc.erl4
9 files changed, 56 insertions, 46 deletions
diff --git a/src/mod_pubsub/mod_pubsub.erl b/src/mod_pubsub/mod_pubsub.erl
index 119f5e45..2f606d4d 100644
--- a/src/mod_pubsub/mod_pubsub.erl
+++ b/src/mod_pubsub/mod_pubsub.erl
@@ -35,7 +35,7 @@
%%% Functions concerning configuration should be rewritten.
%%%
%%% Support for subscription-options and multi-subscribe features was
-%%% added by Brian Cully <bjc@kublai.com>. Subscriptions and options are
+%%% added by Brian Cully (bjc AT kublai.com). Subscriptions and options are
%%% stored in the pubsub_subscription table, with a link to them provided
%%% by the subscriptions field of pubsub_state. For information on
%%% subscription-options and mulit-subscribe see XEP-0060 sections 6.1.6,
@@ -1350,7 +1350,7 @@ adhoc_request(_Host, _ServerHost, _Owner, Other, _Access, _Plugins) ->
?DEBUG("Couldn't process ad hoc command:~n~p", [Other]),
{error, ?ERR_ITEM_NOT_FOUND}.
-%% @spec (Host, Owner) -> iqRes()
+%% @spec (Host, Owner, Lang, Plugins) -> iqRes()
%% @doc <p>Sends the process pending subscriptions XForm for Host to
%% Owner.</p>
send_pending_node_form(Host, Owner, _Lang, Plugins) ->
@@ -1795,7 +1795,7 @@ delete_node(Host, Node, Owner) ->
Error
end.
-%% @spec (Host, Node, From, JID) ->
+%% @spec (Host, Node, From, JID, Configuration) ->
%% {error, Reason::stanzaError()} |
%% {result, []}
%% Host = host()
@@ -2245,7 +2245,7 @@ get_item(Host, Node, ItemId) ->
Error -> Error
end.
-%% @spec (Host, Node, NodeId, Type LJID, Number) -> any()
+%% @spec (Host, Node, NodeId, Type, LJID, Number) -> any()
%% Host = pubsubHost()
%% Node = pubsubNode()
%% NodeId = pubsubNodeId()
@@ -2759,7 +2759,7 @@ service_jid(Host) ->
_ -> {jid, "", Host, "", "", Host, ""}
end.
-%% @spec (LJID, PresenceDelivery) -> boolean()
+%% @spec (LJID, NotifyType, Depth, NodeOptions, SubOptions) -> boolean()
%% LJID = jid()
%% NotifyType = items | nodes
%% Depth = integer()
@@ -3154,7 +3154,7 @@ node_options(Type) ->
Result
end.
-%% @spec (Options) -> MaxItems
+%% @spec (Host, Options) -> MaxItems
%% Host = host()
%% Options = [Option]
%% Option = {Key::atom(), Value::term()}
diff --git a/src/mod_pubsub/mod_pubsub_odbc.erl b/src/mod_pubsub/mod_pubsub_odbc.erl
index c3e539e1..bab0e373 100644
--- a/src/mod_pubsub/mod_pubsub_odbc.erl
+++ b/src/mod_pubsub/mod_pubsub_odbc.erl
@@ -35,7 +35,7 @@
%%% Functions concerning configuration should be rewritten.
%%%
%%% Support for subscription-options and multi-subscribe features was
-%%% added by Brian Cully <bjc@kublai.com>. Subscriptions and options are
+%%% added by Brian Cully (bjc AT kublai.com). Subscriptions and options are
%%% stored in the pubsub_subscription table, with a link to them provided
%%% by the subscriptions field of pubsub_state. For information on
%%% subscription-options and mulit-subscribe see XEP-0060 sections 6.1.6,
@@ -1354,7 +1354,7 @@ adhoc_request(_Host, _ServerHost, _Owner, Other, _Access, _Plugins) ->
?DEBUG("Couldn't process ad hoc command:~n~p", [Other]),
{error, ?ERR_ITEM_NOT_FOUND}.
-%% @spec (Host, Owner) -> iqRes()
+%% @spec (Host, Owner, Lang, Plugins) -> iqRes()
%% @doc <p>Sends the process pending subscriptions XForm for Host to
%% Owner.</p>
send_pending_node_form(Host, Owner, _Lang, Plugins) ->
@@ -1800,7 +1800,7 @@ delete_node(Host, Node, Owner) ->
Error
end.
-%% @spec (Host, Node, From, JID) ->
+%% @spec (Host, Node, From, JID, Configuration) ->
%% {error, Reason::stanzaError()} |
%% {result, []}
%% Host = host()
@@ -2255,7 +2255,7 @@ get_item(Host, Node, ItemId) ->
Error -> Error
end.
-%% @spec (Host, Node, NodeId, Type LJID, Number) -> any()
+%% @spec (Host, Node, NodeId, Type, LJID, Number) -> any()
%% Host = pubsubHost()
%% Node = pubsubNode()
%% NodeId = pubsubNodeId()
@@ -2759,7 +2759,7 @@ service_jid(Host) ->
_ -> {jid, "", Host, "", "", Host, ""}
end.
-%% @spec (LJID, PresenceDelivery) -> boolean()
+%% @spec (LJID, NotifyType, Depth, NodeOptions, SubOptions) -> boolean()
%% LJID = jid()
%% NotifyType = items | nodes
%% Depth = integer()
@@ -3154,7 +3154,7 @@ node_options(Type) ->
Result
end.
-%% @spec (NodeId) -> [ljid()]
+%% @spec (Host, Type, NodeId) -> [ljid()]
%% NodeId = pubsubNodeId()
%% @doc <p>Return list of node owners.</p>
node_owners(Host, Type, NodeId) ->
@@ -3178,7 +3178,7 @@ node_owners_call(Type, NodeId) ->
[]
end.
-%% @spec (Options) -> MaxItems
+%% @spec (Host, Options) -> MaxItems
%% Host = host()
%% Options = [Option]
%% Option = {Key::atom(), Value::term()}
diff --git a/src/mod_pubsub/node_hometree.erl b/src/mod_pubsub/node_hometree.erl
index 595796aa..011ea428 100644
--- a/src/mod_pubsub/node_hometree.erl
+++ b/src/mod_pubsub/node_hometree.erl
@@ -243,7 +243,7 @@ delete_node(Removed) ->
end, Removed),
{result, {default, broadcast, Reply}}.
-%% @spec (NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup) ->
+%% @spec (NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup, Options) ->
%% {error, Reason} | {result, Result}
%% @doc <p>Accepts or rejects subcription requests on a PubSub node.</p>
%% <p>The mechanism works as follow:
@@ -825,8 +825,9 @@ set_state(State) when is_record(State, pubsub_state) ->
set_state(_) ->
{error, ?ERR_INTERNAL_SERVER_ERROR}.
-%% @spec (StateId) -> ok | {error, Reason::stanzaError()}
-%% StateId = mod_pubsub:pubsubStateId()
+%% @spec (NodeId, JID) -> ok | {error, Reason::stanzaError()}
+%% NodeId = mod_pubsub:pubsubNodeId()
+%% JID = mod_pubsub:jid()
%% @doc <p>Delete a state from database.</p>
del_state(NodeId, JID) ->
mnesia:delete({pubsub_state, {JID, NodeId}}).
diff --git a/src/mod_pubsub/node_hometree_odbc.erl b/src/mod_pubsub/node_hometree_odbc.erl
index 01a21d5b..d4ffeca9 100644
--- a/src/mod_pubsub/node_hometree_odbc.erl
+++ b/src/mod_pubsub/node_hometree_odbc.erl
@@ -256,7 +256,7 @@ delete_node(Removed) ->
end, Removed),
{result, {default, broadcast, Reply}}.
-%% @spec (NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup) ->
+%% @spec (NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup, Options) ->
%% {error, Reason} | {result, Result}
%% @doc <p>Accepts or rejects subcription requests on a PubSub node.</p>
%% <p>The mechanism works as follow:
@@ -905,8 +905,9 @@ set_state(NodeId, State) ->
end,
{result, []}.
-%% @spec (StateId) -> ok | {error, Reason::stanzaError()}
-%% StateId = mod_pubsub:pubsubStateId()
+%% @spec (NodeId, JID) -> ok | {error, Reason::stanzaError()}
+%% NodeId = mod_pubsub:pubsubNodeId()
+%% JID = mod_pubsub:jid()
%% @doc <p>Delete a state from database.</p>
del_state(NodeId, JID) ->
J = encode_jid(JID),
@@ -916,11 +917,9 @@ del_state(NodeId, JID) ->
"and nodeid='", NodeId, "';"]),
ok.
-%% @spec (NodeId, From, Rsm) -> {[Items],RsmOut} | []
+%% @spec (NodeId, From) -> {[Items],RsmOut} | []
%% NodeId = mod_pubsub:pubsubNodeId()
%% Items = mod_pubsub:pubsubItems()
-%% Rsm = jlib:rsm_in() | none
-%% RsmOut=jlib:rsm_out() | none
%% @doc Returns the list of stored items for a given node.
%% <p>For the default PubSub module, items are stored in Mnesia database.</p>
%% <p>We can consider that the pubsub_item table have been created by the main
diff --git a/src/mod_pubsub/nodetree_tree.erl b/src/mod_pubsub/nodetree_tree.erl
index 3bd7bba4..39724db4 100644
--- a/src/mod_pubsub/nodetree_tree.erl
+++ b/src/mod_pubsub/nodetree_tree.erl
@@ -103,11 +103,12 @@ set_node(Record) when is_record(Record, pubsub_node) ->
set_node(_) ->
{error, ?ERR_INTERNAL_SERVER_ERROR}.
+get_node(Host, Node, _From) ->
+ get_node(Host, Node).
+
%% @spec (Host, Node) -> pubsubNode() | {error, Reason}
%% Host = mod_pubsub:host()
%% Node = mod_pubsub:pubsubNode()
-get_node(Host, Node, _From) ->
- get_node(Host, Node).
get_node(Host, Node) ->
case catch mnesia:read({pubsub_node, {Host, Node}}) of
[Record] when is_record(Record, pubsub_node) -> Record;
@@ -121,10 +122,11 @@ get_node(NodeId) ->
Error -> Error
end.
-%% @spec (Host) -> [pubsubNode()] | {error, Reason}
-%% Host = mod_pubsub:host() | mod_pubsub:jid()
get_nodes(Host, _From) ->
get_nodes(Host).
+
+%% @spec (Host) -> [pubsubNode()] | {error, Reason}
+%% Host = mod_pubsub:host() | mod_pubsub:jid()
get_nodes(Host) ->
mnesia:match_object(#pubsub_node{nodeid = {Host, '_'}, _ = '_'}).
@@ -165,12 +167,13 @@ get_subnodes(Host, Node) ->
lists:member(Node, Parents)]),
qlc:e(Q).
+get_subnodes_tree(Host, Node, _From) ->
+ get_subnodes_tree(Host, Node).
+
%% @spec (Host, Index) -> [pubsubNodeIdx()] | {error, Reason}
%% Host = mod_pubsub:host()
%% Node = mod_pubsub:pubsubNode()
%% From = mod_pubsub:jid()
-get_subnodes_tree(Host, Node, _From) ->
- get_subnodes_tree(Host, Node).
get_subnodes_tree(Host, Node) ->
mnesia:foldl(fun(#pubsub_node{nodeid = {H, N}} = R, Acc) ->
case lists:prefix(Node, N) and (H == Host) of
diff --git a/src/mod_pubsub/nodetree_tree_odbc.erl b/src/mod_pubsub/nodetree_tree_odbc.erl
index 97833f64..95f9b34e 100644
--- a/src/mod_pubsub/nodetree_tree_odbc.erl
+++ b/src/mod_pubsub/nodetree_tree_odbc.erl
@@ -89,11 +89,12 @@ options() ->
{odbc, true}].
+get_node(Host, Node, _From) ->
+ get_node(Host, Node).
+
%% @spec (Host, Node) -> pubsubNode() | {error, Reason}
%% Host = mod_pubsub:host()
%% Node = mod_pubsub:pubsubNode()
-get_node(Host, Node, _From) ->
- get_node(Host, Node).
get_node(Host, Node) ->
H = ?PUBSUB:escape(Host),
N = ?PUBSUB:escape(?PUBSUB:node_to_string(Node)),
@@ -123,10 +124,10 @@ get_node(NodeId) ->
{error, ?ERR_ITEM_NOT_FOUND}
end.
-%% @spec (Host) -> [pubsubNode()] | {error, Reason}
-%% Host = mod_pubsub:host() | mod_pubsub:jid()
get_nodes(Host, _From) ->
get_nodes(Host).
+%% @spec (Host) -> [pubsubNode()] | {error, Reason}
+%% Host = mod_pubsub:host() | mod_pubsub:jid()
get_nodes(Host) ->
H = ?PUBSUB:escape(Host),
case catch ejabberd_odbc:sql_query_t(
@@ -164,11 +165,12 @@ get_parentnodes_tree(Host, Node, From) ->
Error -> Error
end.
+get_subnodes(Host, Node, _From) ->
+ get_subnodes(Host, Node).
+
%% @spec (Host, Index) -> [pubsubNode()] | {error, Reason}
%% Host = mod_pubsub:host()
%% Node = mod_pubsub:pubsubNode()
-get_subnodes(Host, Node, _From) ->
- get_subnodes(Host, Node).
get_subnodes(Host, Node) ->
H = ?PUBSUB:escape(Host),
N = ?PUBSUB:escape(?PUBSUB:node_to_string(Node)),
@@ -183,11 +185,12 @@ get_subnodes(Host, Node) ->
[]
end.
+get_subnodes_tree(Host, Node, _From) ->
+ get_subnodes_tree(Host, Node).
+
%% @spec (Host, Index) -> [pubsubNode()] | {error, Reason}
%% Host = mod_pubsub:host()
%% Node = mod_pubsub:pubsubNode()
-get_subnodes_tree(Host, Node, _From) ->
- get_subnodes_tree(Host, Node).
get_subnodes_tree(Host, Node) ->
H = ?PUBSUB:escape(Host),
N = ?PUBSUB:escape(?PUBSUB:node_to_string(Node)),
diff --git a/src/mod_pubsub/nodetree_virtual.erl b/src/mod_pubsub/nodetree_virtual.erl
index 51b686ce..24330e50 100644
--- a/src/mod_pubsub/nodetree_virtual.erl
+++ b/src/mod_pubsub/nodetree_virtual.erl
@@ -26,7 +26,7 @@
%%% @doc The module <strong>{@module}</strong> is the PubSub node tree plugin that
%%% allow virtual nodes handling.
%%% <p>PubSub node tree plugins are using the {@link gen_nodetree} behaviour.</p>
-%%% This plugin development is still a work in progress. Due to optimizations in
+%%% <p>This plugin development is still a work in progress. Due to optimizations in
%%% mod_pubsub, this plugin can not work anymore without altering functioning.
%%% Please, send us comments, feedback and improvements.</p>
@@ -85,9 +85,10 @@ options() ->
set_node(_NodeRecord) ->
ok.
-%% @spec (Host, Node) -> pubsubNode()
+%% @spec (Host, Node, From) -> pubsubNode()
%% Host = mod_pubsub:host()
%% Node = mod_pubsub:pubsubNode()
+%% From = mod_pubsub:jid()
%% @doc <p>Virtual node tree does not handle a node database. Any node is considered
%% as existing. Node record contains default values.</p>
get_node(Host, Node, _From) ->
@@ -101,8 +102,9 @@ get_node({Host, _} = NodeId) ->
Owners = [{"", Host, ""}],
Record#pubsub_node{owners = Owners, options = Options}.
-%% @spec (Host) -> [pubsubNode()]
+%% @spec (Host, From) -> [pubsubNode()]
%% Host = mod_pubsub:host() | mod_pubsub:jid()
+%% From = mod_pubsub:jid()
%% @doc <p>Virtual node tree does not handle a node database. Any node is considered
%% as existing. Nodes list can not be determined.</p>
get_nodes(Host, _From) ->
@@ -136,9 +138,10 @@ get_subnodes(Host, Node, _From) ->
get_subnodes(_Host, _Node) ->
[].
-%% @spec (Host, Index) -> [pubsubNode()]
+%% @spec (Host, Node, From) -> [pubsubNode()]
%% Host = mod_pubsub:host()
%% Node = mod_pubsub:pubsubNode()
+%% From = mod_pubsub:jid()
%% @doc <p>Virtual node tree does not handle parent/child. Child list is empty.</p>
get_subnodes_tree(Host, Node, _From) ->
get_subnodes_tree(Host, Node).
diff --git a/src/mod_pubsub/pubsub.hrl b/src/mod_pubsub/pubsub.hrl
index f406a05c..c92587e2 100644
--- a/src/mod_pubsub/pubsub.hrl
+++ b/src/mod_pubsub/pubsub.hrl
@@ -83,12 +83,13 @@
%%% @type pubsubNode() = #pubsub_node{
%%% nodeid = {Host::host(), Node::pubsubNode()},
%%% parentid = Node::pubsubNode(),
-%%% nodeidx = int(). % can be anything you want
+%%% nodeidx = int(),
%%% type = nodeType(),
-%%% options = [nodeOption()]}
+%%% options = [nodeOption()]}.
%%% <p>This is the format of the <tt>nodes</tt> table. The type of the table
%%% is: <tt>set</tt>,<tt>ram/disc</tt>.</p>
%%% <p>The <tt>parentid</tt> and <tt>type</tt> fields are indexed.</p>
+%%% nodeidx can be anything you want.
-record(pubsub_node, {nodeid,
id,
parents = [],
@@ -98,7 +99,7 @@
}).
%%% @type pubsubState() = #pubsub_state{
-%%% stateid = {ljid(), nodeidx()}},
+%%% stateid = {ljid(), nodeidx()},
%%% items = [ItemId::string()],
%%% affiliation = affiliation(),
%%% subscriptions = [subscription()]}.
@@ -111,7 +112,7 @@
}).
%%% @type pubsubItem() = #pubsub_item{
-%%% itemid = {ItemId::string(), nodeidx()}},
+%%% itemid = {ItemId::string(), nodeidx()},
%%% creation = {now(), ljid()},
%%% modification = {now(), ljid()},
%%% payload = XMLContent::string()}.
diff --git a/src/mod_pubsub/pubsub_subscription_odbc.erl b/src/mod_pubsub/pubsub_subscription_odbc.erl
index 9ea535a1..56ddf6d4 100644
--- a/src/mod_pubsub/pubsub_subscription_odbc.erl
+++ b/src/mod_pubsub/pubsub_subscription_odbc.erl
@@ -15,8 +15,8 @@
%%% All Rights Reserved.''
%%% This software is copyright 2006-2009, ProcessOne.
%%%
-%%% @author Pablo Polvorin <pablo.polvorin@process-one.net>, based on
-%% pubsub_subscription.erl by Brian Cully <bjc@kublai.com>
+%%% @author Pablo Polvorin <pablo.polvorin@process-one.net>
+%%% @author based on pubsub_subscription.erl by Brian Cully <bjc@kublai.com>
%%% @version {@vsn}, {@date} {@time}
%%% @end
%%% ====================================================================