diff options
author | Badlop <badlop@process-one.net> | 2013-03-14 10:33:02 +0100 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2013-03-14 10:33:02 +0100 |
commit | 9deb294328bb3f9eb6bd2c0e7cd500732e9b5830 (patch) | |
tree | 7e1066c130250627ee0abab44a135f583a28d07f /src/mod_pubsub/gen_pubsub_nodetree.erl | |
parent | list_to_integer/2 only works in OTP R14 and newer (diff) |
Accumulated patch to binarize and indent code
Diffstat (limited to 'src/mod_pubsub/gen_pubsub_nodetree.erl')
-rw-r--r-- | src/mod_pubsub/gen_pubsub_nodetree.erl | 124 |
1 files changed, 95 insertions, 29 deletions
diff --git a/src/mod_pubsub/gen_pubsub_nodetree.erl b/src/mod_pubsub/gen_pubsub_nodetree.erl index 81daeb08e..8acba659c 100644 --- a/src/mod_pubsub/gen_pubsub_nodetree.erl +++ b/src/mod_pubsub/gen_pubsub_nodetree.erl @@ -4,12 +4,12 @@ %%% compliance with the License. You should have received a copy of the %%% Erlang Public License along with this software. If not, it can be %%% retrieved via the world wide web at http://www.erlang.org/. -%%% +%%% %%% Software distributed under the License is distributed on an "AS IS" %%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %%% the License for the specific language governing rights and limitations %%% under the License. -%%% +%%% %%% The Initial Developer of the Original Code is ProcessOne. %%% Portions created by ProcessOne are Copyright 2006-2013, ProcessOne %%% All Rights Reserved.'' @@ -25,34 +25,100 @@ %%% @private %%% @doc <p>The module <strong>{@module}</strong> defines the PubSub node -%%% tree plugin behaviour. This behaviour is used to check that a PubSub +%%% tree plugin behaviour. This behaviour is used to check that a PubSub %%% node tree plugin respects the current ejabberd PubSub plugin API.</p> -module(gen_pubsub_nodetree). --export([behaviour_info/1]). - -%% @spec (Query::atom()) -> Callbacks | atom() -%% Callbacks = [{Function,Arity}] -%% Function = atom() -%% Arity = integer() -%% @doc Behaviour definition -behaviour_info(callbacks) -> - [{init, 3}, - {terminate, 2}, - {options, 0}, - {set_node, 1}, - {get_node, 3}, - {get_node, 2}, - {get_node, 1}, - {get_nodes, 2}, - {get_nodes, 1}, - {get_parentnodes, 3}, - {get_parentnodes_tree, 3}, - {get_subnodes, 3}, - {get_subnodes_tree, 3}, - {create_node, 6}, - {delete_node, 2} - ]; -behaviour_info(_Other) -> - undefined. +-include("jlib.hrl"). + +-type(host() :: mod_pubsub:host() + | mod_pubsub_odbc:host() +). + +-type(nodeId() :: mod_pubsub:nodeId() + | mod_pubsub_odbc:nodeId() +). + +-type(nodeIdx() :: mod_pubsub:nodeIdx() + | mod_pubsub_odbc:nodeIdx() +). + +-type(itemId() :: mod_pubsub:itemId() + | mod_pubsub_odbc:itemId() +). + +-type(pubsubNode() :: mod_pubsub:pubsubNode() + | mod_pubsub_odbc:pubsubNode() +). + +-type(nodeOptions() :: mod_pubsub:nodeOptions() + | mod_pubsub_odbc:nodeOptions() +). + +-callback init(Host :: host(), + ServerHost :: binary(), + Opts :: [any()]) -> atom(). + +-callback terminate(Host :: host(), ServerHost :: binary()) -> atom(). + +-callback options() -> nodeOptions(). + +-callback set_node(PubsubNode :: pubsubNode()) -> + ok | {result, NodeIdx::mod_pubsub_odbc:nodeIdx()} | {error, xmlel()}. + +-callback get_node(Host :: host(), + NodeId :: nodeId(), + From :: jid()) -> + pubsubNode() | + {error, xmlel()}. + +-callback get_node(Host :: host(), + NodeId :: nodeId()) -> + pubsubNode() | + {error, xmlel()}. + +-callback get_node(NodeIdx :: nodeIdx()) -> + pubsubNode() | + {error, xmlel()}. + +-callback get_nodes(Host :: host(), + From :: jid())-> + [pubsubNode()]. + +-callback get_nodes(Host :: host())-> + [pubsubNode()]. + +-callback get_parentnodes(Host :: host(), + NodeId :: nodeId(), + From :: jid()) -> + [pubsubNode()] | + {error, xmlel()}. + +-callback get_parentnodes_tree(Host :: host(), + NodeId :: nodeId(), + From :: jid()) -> + [{0, [pubsubNode(),...]}]. + +-callback get_subnodes(Host :: host(), + NodeId :: nodeId(), + From :: ljid()) -> + [pubsubNode()]. + +-callback get_subnodes_tree(Host :: host(), + NodeId :: nodeId(), + From :: ljid()) -> + [pubsubNode()]. + +-callback create_node(Host :: host(), + NodeId :: nodeId(), + Type :: binary(), + Owner :: jid(), + Options :: nodeOptions(), + Parents :: [nodeId()]) -> + {ok, NodeIdx::nodeIdx()} | + {error, xmlel()}. + +-callback delete_node(Host :: host(), + NodeId :: nodeId()) -> + [pubsubNode()]. |