2015-12-15 16:11:29 +01:00
|
|
|
%%%----------------------------------------------------------------------
|
|
|
|
%%% File : gen_pubsub_nodetree.erl
|
|
|
|
%%% Author : Christophe Romain <christophe.romain@process-one.net>
|
|
|
|
%%% Purpose : Define the pubsub node tree plugin behaviour
|
|
|
|
%%% Created : 1 Dec 2007 by Christophe Romain <christophe.romain@process-one.net>
|
2013-03-14 10:33:02 +01:00
|
|
|
%%%
|
|
|
|
%%%
|
2019-01-08 22:53:27 +01:00
|
|
|
%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
|
2007-12-01 06:16:30 +01:00
|
|
|
%%%
|
2015-12-15 16:11:29 +01:00
|
|
|
%%% This program is free software; you can redistribute it and/or
|
|
|
|
%%% modify it under the terms of the GNU General Public License as
|
|
|
|
%%% published by the Free Software Foundation; either version 2 of the
|
|
|
|
%%% License, or (at your option) any later version.
|
2007-12-01 06:16:30 +01:00
|
|
|
%%%
|
2015-12-15 16:11:29 +01:00
|
|
|
%%% This program is distributed in the hope that it will be useful,
|
|
|
|
%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
%%% General Public License for more details.
|
|
|
|
%%%
|
|
|
|
%%% You should have received a copy of the GNU General Public License along
|
|
|
|
%%% with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
%%% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
%%%
|
|
|
|
%%%----------------------------------------------------------------------
|
2007-12-01 06:16:30 +01:00
|
|
|
|
|
|
|
-module(gen_pubsub_nodetree).
|
|
|
|
|
2013-03-14 10:33:02 +01:00
|
|
|
|
2015-04-08 17:12:05 +02:00
|
|
|
-type(host() :: mod_pubsub:host()).
|
|
|
|
-type(nodeId() :: mod_pubsub:nodeId()).
|
|
|
|
-type(nodeIdx() :: mod_pubsub:nodeIdx()).
|
|
|
|
-type(pubsubNode() :: mod_pubsub:pubsubNode()).
|
|
|
|
-type(nodeOptions() :: mod_pubsub:nodeOptions()).
|
2013-03-14 10:33:02 +01:00
|
|
|
|
|
|
|
-callback init(Host :: host(),
|
2015-04-08 17:12:05 +02:00
|
|
|
ServerHost :: binary(),
|
|
|
|
Opts :: [any()]) -> atom().
|
2013-03-14 10:33:02 +01:00
|
|
|
|
2017-02-18 07:36:27 +01:00
|
|
|
-include("xmpp.hrl").
|
|
|
|
|
2013-03-14 10:33:02 +01:00
|
|
|
-callback terminate(Host :: host(), ServerHost :: binary()) -> atom().
|
|
|
|
|
|
|
|
-callback options() -> nodeOptions().
|
|
|
|
|
|
|
|
-callback set_node(PubsubNode :: pubsubNode()) ->
|
2017-02-18 07:36:27 +01:00
|
|
|
ok | {result, NodeIdx::nodeIdx()} | {error, stanza_error()}.
|
2013-03-14 10:33:02 +01:00
|
|
|
|
|
|
|
-callback get_node(Host :: host(),
|
2015-04-08 17:12:05 +02:00
|
|
|
NodeId :: nodeId(),
|
2016-07-30 17:37:57 +02:00
|
|
|
From :: jid:jid()) ->
|
2013-03-14 10:33:02 +01:00
|
|
|
pubsubNode() |
|
2017-02-18 07:36:27 +01:00
|
|
|
{error, stanza_error()}.
|
2013-03-14 10:33:02 +01:00
|
|
|
|
|
|
|
-callback get_node(Host :: host(),
|
2015-04-08 17:12:05 +02:00
|
|
|
NodeId :: nodeId()) ->
|
2013-03-14 10:33:02 +01:00
|
|
|
pubsubNode() |
|
2017-02-18 07:36:27 +01:00
|
|
|
{error, stanza_error()}.
|
2013-03-14 10:33:02 +01:00
|
|
|
|
|
|
|
-callback get_node(NodeIdx :: nodeIdx()) ->
|
|
|
|
pubsubNode() |
|
2017-02-18 07:36:27 +01:00
|
|
|
{error, stanza_error()}.
|
2013-03-14 10:33:02 +01:00
|
|
|
|
|
|
|
-callback get_nodes(Host :: host(),
|
2016-07-30 17:37:57 +02:00
|
|
|
From :: jid:jid())->
|
2013-03-14 10:33:02 +01:00
|
|
|
[pubsubNode()].
|
|
|
|
|
|
|
|
-callback get_nodes(Host :: host())->
|
|
|
|
[pubsubNode()].
|
|
|
|
|
|
|
|
-callback get_parentnodes(Host :: host(),
|
2015-04-08 17:12:05 +02:00
|
|
|
NodeId :: nodeId(),
|
2016-07-30 17:37:57 +02:00
|
|
|
From :: jid:jid()) ->
|
2013-03-14 10:33:02 +01:00
|
|
|
[pubsubNode()] |
|
2017-02-18 07:36:27 +01:00
|
|
|
{error, stanza_error()}.
|
2013-03-14 10:33:02 +01:00
|
|
|
|
|
|
|
-callback get_parentnodes_tree(Host :: host(),
|
2015-04-08 17:12:05 +02:00
|
|
|
NodeId :: nodeId(),
|
2016-07-30 17:37:57 +02:00
|
|
|
From :: jid:jid()) ->
|
2013-03-14 10:33:02 +01:00
|
|
|
[{0, [pubsubNode(),...]}].
|
|
|
|
|
|
|
|
-callback get_subnodes(Host :: host(),
|
2015-04-08 17:12:05 +02:00
|
|
|
NodeId :: nodeId(),
|
2016-07-30 17:37:57 +02:00
|
|
|
From :: jid:jid()) ->
|
2013-03-14 10:33:02 +01:00
|
|
|
[pubsubNode()].
|
|
|
|
|
|
|
|
-callback get_subnodes_tree(Host :: host(),
|
2015-04-08 17:12:05 +02:00
|
|
|
NodeId :: nodeId(),
|
2016-07-30 17:37:57 +02:00
|
|
|
From :: jid:jid()) ->
|
2013-03-14 10:33:02 +01:00
|
|
|
[pubsubNode()].
|
|
|
|
|
|
|
|
-callback create_node(Host :: host(),
|
2015-04-08 17:12:05 +02:00
|
|
|
NodeId :: nodeId(),
|
|
|
|
Type :: binary(),
|
2016-07-30 17:37:57 +02:00
|
|
|
Owner :: jid:jid(),
|
2015-04-08 17:12:05 +02:00
|
|
|
Options :: nodeOptions(),
|
|
|
|
Parents :: [nodeId()]) ->
|
2013-03-14 10:33:02 +01:00
|
|
|
{ok, NodeIdx::nodeIdx()} |
|
2017-02-18 07:36:27 +01:00
|
|
|
{error, stanza_error()} |
|
2019-06-14 11:33:26 +02:00
|
|
|
{error, {virtual, {host(), nodeId()} | nodeId()}}.
|
2013-03-14 10:33:02 +01:00
|
|
|
|
|
|
|
-callback delete_node(Host :: host(),
|
2015-04-08 17:12:05 +02:00
|
|
|
NodeId :: nodeId()) ->
|
2013-03-14 10:33:02 +01:00
|
|
|
[pubsubNode()].
|