mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
improve type specification
This commit is contained in:
parent
9bde1dc9af
commit
2e75faefae
@ -49,8 +49,6 @@
|
|||||||
-behaviour(gen_server).
|
-behaviour(gen_server).
|
||||||
-behaviour(gen_mod).
|
-behaviour(gen_mod).
|
||||||
|
|
||||||
-include_lib("exmpp/include/exmpp.hrl").
|
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("ejabberd.hrl").
|
||||||
-include("adhoc.hrl").
|
-include("adhoc.hrl").
|
||||||
-include("pubsub.hrl").
|
-include("pubsub.hrl").
|
||||||
@ -2219,7 +2217,7 @@ delete_item(Host, Node, Publisher, ItemId, ForceNotify) ->
|
|||||||
Options = TNode#pubsub_node.options,
|
Options = TNode#pubsub_node.options,
|
||||||
broadcast_retract_items(Host, Node, Nidx, Type, Options, [ItemId], ForceNotify),
|
broadcast_retract_items(Host, Node, Nidx, Type, Options, [ItemId], ForceNotify),
|
||||||
case get_cached_item(Host, Nidx) of
|
case get_cached_item(Host, Nidx) of
|
||||||
#pubsub_item{id = {ItemId, Nidx}, _ = '_'} -> unset_cached_item(Host, Nidx);
|
#pubsub_item{id = {ItemId, Nidx}} -> unset_cached_item(Host, Nidx);
|
||||||
_ -> ok
|
_ -> ok
|
||||||
end,
|
end,
|
||||||
case Result of
|
case Result of
|
||||||
|
@ -49,8 +49,6 @@
|
|||||||
-behaviour(gen_server).
|
-behaviour(gen_server).
|
||||||
-behaviour(gen_mod).
|
-behaviour(gen_mod).
|
||||||
|
|
||||||
-include_lib("exmpp/include/exmpp.hrl").
|
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("ejabberd.hrl").
|
||||||
-include("adhoc.hrl").
|
-include("adhoc.hrl").
|
||||||
-include("pubsub.hrl").
|
-include("pubsub.hrl").
|
||||||
@ -2029,7 +2027,7 @@ delete_item(Host, Node, Publisher, ItemId, ForceNotify) ->
|
|||||||
Options = TNode#pubsub_node.options,
|
Options = TNode#pubsub_node.options,
|
||||||
broadcast_retract_items(Host, Node, Nidx, Type, Options, [ItemId], ForceNotify),
|
broadcast_retract_items(Host, Node, Nidx, Type, Options, [ItemId], ForceNotify),
|
||||||
case get_cached_item(Host, Nidx) of
|
case get_cached_item(Host, Nidx) of
|
||||||
#pubsub_item{id = {ItemId, Nidx}, _ = '_'} -> unset_cached_item(Host, Nidx);
|
#pubsub_item{id = {ItemId, Nidx}} -> unset_cached_item(Host, Nidx);
|
||||||
_ -> ok
|
_ -> ok
|
||||||
end,
|
end,
|
||||||
case Result of
|
case Result of
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
-module(node_buddy).
|
-module(node_buddy).
|
||||||
-author('christophe.romain@process-one.net').
|
-author('christophe.romain@process-one.net').
|
||||||
|
|
||||||
-include_lib("exmpp/include/exmpp.hrl").
|
|
||||||
|
|
||||||
-include("pubsub.hrl").
|
-include("pubsub.hrl").
|
||||||
|
|
||||||
-behaviour(gen_pubsub_node).
|
-behaviour(gen_pubsub_node).
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
-author('christophe.romain@process-one.net').
|
-author('christophe.romain@process-one.net').
|
||||||
|
|
||||||
-include("pubsub.hrl").
|
-include("pubsub.hrl").
|
||||||
-include_lib("exmpp/include/exmpp.hrl").
|
|
||||||
|
|
||||||
-behaviour(gen_pubsub_node).
|
-behaviour(gen_pubsub_node).
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
-author('christophe.romain@process-one.net').
|
-author('christophe.romain@process-one.net').
|
||||||
|
|
||||||
-include("pubsub.hrl").
|
-include("pubsub.hrl").
|
||||||
-include_lib("exmpp/include/exmpp.hrl").
|
|
||||||
|
|
||||||
-behaviour(gen_pubsub_node).
|
-behaviour(gen_pubsub_node).
|
||||||
|
|
||||||
|
@ -42,7 +42,6 @@
|
|||||||
-author('christophe.romain@process-one.net').
|
-author('christophe.romain@process-one.net').
|
||||||
|
|
||||||
-include("pubsub.hrl").
|
-include("pubsub.hrl").
|
||||||
-include_lib("exmpp/include/exmpp.hrl").
|
|
||||||
|
|
||||||
-behaviour(gen_pubsub_node).
|
-behaviour(gen_pubsub_node).
|
||||||
|
|
||||||
|
@ -42,7 +42,6 @@
|
|||||||
-author('christophe.romain@process-one.net').
|
-author('christophe.romain@process-one.net').
|
||||||
|
|
||||||
-include("pubsub.hrl").
|
-include("pubsub.hrl").
|
||||||
-include_lib("exmpp/include/exmpp.hrl").
|
|
||||||
-include("jlib.hrl"). %% for rsm_in and rsm_out records definitions
|
-include("jlib.hrl"). %% for rsm_in and rsm_out records definitions
|
||||||
|
|
||||||
-define(PUBSUB, mod_pubsub_odbc).
|
-define(PUBSUB, mod_pubsub_odbc).
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
-author('christophe.romain@process-one.net').
|
-author('christophe.romain@process-one.net').
|
||||||
|
|
||||||
-include("pubsub.hrl").
|
-include("pubsub.hrl").
|
||||||
-include_lib("exmpp/include/exmpp.hrl").
|
|
||||||
|
|
||||||
-behaviour(gen_pubsub_node).
|
-behaviour(gen_pubsub_node).
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
-author('christophe.romain@process-one.net').
|
-author('christophe.romain@process-one.net').
|
||||||
|
|
||||||
-include("pubsub.hrl").
|
-include("pubsub.hrl").
|
||||||
-include_lib("exmpp/include/exmpp.hrl").
|
|
||||||
|
|
||||||
-behaviour(gen_pubsub_node).
|
-behaviour(gen_pubsub_node).
|
||||||
|
|
||||||
|
@ -36,8 +36,6 @@
|
|||||||
-module(node_mb).
|
-module(node_mb).
|
||||||
-author('eric@ohmforce.com').
|
-author('eric@ohmforce.com').
|
||||||
|
|
||||||
-include_lib("exmpp/include/exmpp.hrl").
|
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("ejabberd.hrl").
|
||||||
-include("pubsub.hrl").
|
-include("pubsub.hrl").
|
||||||
|
|
||||||
|
@ -29,8 +29,6 @@
|
|||||||
-module(node_pep).
|
-module(node_pep).
|
||||||
-author('christophe.romain@process-one.net').
|
-author('christophe.romain@process-one.net').
|
||||||
|
|
||||||
-include_lib("exmpp/include/exmpp.hrl").
|
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("ejabberd.hrl").
|
||||||
-include("pubsub.hrl").
|
-include("pubsub.hrl").
|
||||||
|
|
||||||
|
@ -29,8 +29,6 @@
|
|||||||
-module(node_pep_odbc).
|
-module(node_pep_odbc).
|
||||||
-author('christophe.romain@process-one.net').
|
-author('christophe.romain@process-one.net').
|
||||||
|
|
||||||
-include_lib("exmpp/include/exmpp.hrl").
|
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("ejabberd.hrl").
|
||||||
-include("pubsub.hrl").
|
-include("pubsub.hrl").
|
||||||
|
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
-module(node_private).
|
-module(node_private).
|
||||||
-author('christophe.romain@process-one.net').
|
-author('christophe.romain@process-one.net').
|
||||||
|
|
||||||
-include_lib("exmpp/include/exmpp.hrl").
|
|
||||||
|
|
||||||
-include("pubsub.hrl").
|
-include("pubsub.hrl").
|
||||||
|
|
||||||
-behaviour(gen_pubsub_node).
|
-behaviour(gen_pubsub_node).
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
-module(node_public).
|
-module(node_public).
|
||||||
-author('christophe.romain@process-one.net').
|
-author('christophe.romain@process-one.net').
|
||||||
|
|
||||||
-include_lib("exmpp/include/exmpp.hrl").
|
|
||||||
|
|
||||||
-include("pubsub.hrl").
|
-include("pubsub.hrl").
|
||||||
|
|
||||||
-behaviour(gen_pubsub_node).
|
-behaviour(gen_pubsub_node).
|
||||||
|
@ -39,7 +39,6 @@
|
|||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("ejabberd.hrl").
|
||||||
-include("pubsub.hrl").
|
-include("pubsub.hrl").
|
||||||
-include_lib("exmpp/include/exmpp.hrl").
|
|
||||||
|
|
||||||
-behaviour(gen_pubsub_nodetree).
|
-behaviour(gen_pubsub_nodetree).
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
-author('christophe.romain@process-one.net').
|
-author('christophe.romain@process-one.net').
|
||||||
|
|
||||||
-include_lib("stdlib/include/qlc.hrl").
|
-include_lib("stdlib/include/qlc.hrl").
|
||||||
-include_lib("exmpp/include/exmpp.hrl").
|
|
||||||
|
|
||||||
-include("pubsub.hrl").
|
-include("pubsub.hrl").
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
-author('christophe.romain@process-one.net').
|
-author('christophe.romain@process-one.net').
|
||||||
|
|
||||||
-include_lib("stdlib/include/qlc.hrl").
|
-include_lib("stdlib/include/qlc.hrl").
|
||||||
-include_lib("exmpp/include/exmpp.hrl").
|
|
||||||
|
|
||||||
-include("pubsub.hrl").
|
-include("pubsub.hrl").
|
||||||
|
|
||||||
|
@ -33,8 +33,6 @@
|
|||||||
-module(nodetree_virtual).
|
-module(nodetree_virtual).
|
||||||
-author('christophe.romain@process-one.net').
|
-author('christophe.romain@process-one.net').
|
||||||
|
|
||||||
-include_lib("exmpp/include/exmpp.hrl").
|
|
||||||
|
|
||||||
-include("pubsub.hrl").
|
-include("pubsub.hrl").
|
||||||
|
|
||||||
-behaviour(gen_pubsub_nodetree).
|
-behaviour(gen_pubsub_nodetree).
|
||||||
|
@ -21,6 +21,11 @@
|
|||||||
%%% This file contains pubsub types definition.
|
%%% This file contains pubsub types definition.
|
||||||
%%% ====================================================================
|
%%% ====================================================================
|
||||||
|
|
||||||
|
|
||||||
|
-include_lib("exmpp/include/exmpp.hrl").
|
||||||
|
-include_lib("exmpp/include/exmpp_jid.hrl").
|
||||||
|
|
||||||
|
|
||||||
%% -------------------------------
|
%% -------------------------------
|
||||||
%% Pubsub constants
|
%% Pubsub constants
|
||||||
-define(ERR_EXTENDED(E,C), mod_pubsub:extended_error(E,C)).
|
-define(ERR_EXTENDED(E,C), mod_pubsub:extended_error(E,C)).
|
||||||
@ -32,15 +37,22 @@
|
|||||||
%% Would be nice to have it configurable.
|
%% Would be nice to have it configurable.
|
||||||
-define(MAX_PAYLOAD_SIZE, 60000).
|
-define(MAX_PAYLOAD_SIZE, 60000).
|
||||||
|
|
||||||
%% -------------------------------
|
|
||||||
|
%% ------------
|
||||||
%% Pubsub types
|
%% Pubsub types
|
||||||
|
%% ------------
|
||||||
|
|
||||||
%%% @type host() = binary().
|
%%% @type host() = binary().
|
||||||
|
%%%
|
||||||
%%% <p><tt>host</tt> is the name of the PubSub service. For example, it can be
|
%%% <p><tt>host</tt> is the name of the PubSub service. For example, it can be
|
||||||
%%% <tt>pubsub.localhost</tt>.</p>
|
%%% <tt>pubsub.localhost</tt>.</p>
|
||||||
|
|
||||||
%%% @type node() = binary().
|
-type(host() :: binary()).
|
||||||
%%% <p>A <tt>node</tt> is the name of a Node. It can be anything and may represent
|
|
||||||
|
|
||||||
|
%%% @type nodeId() = binary().
|
||||||
|
%%%
|
||||||
|
%%% <p>A <tt>nodeId</tt> is the name of a Node. It can be anything and may represent
|
||||||
%%% some hierarchical tree depending of the node type.
|
%%% some hierarchical tree depending of the node type.
|
||||||
%%% For example:
|
%%% For example:
|
||||||
%%% /home/localhost/user/node
|
%%% /home/localhost/user/node
|
||||||
@ -48,14 +60,66 @@
|
|||||||
%%% http://jabber.org/protocol/tune
|
%%% http://jabber.org/protocol/tune
|
||||||
%%% My-Own_Node</p>
|
%%% My-Own_Node</p>
|
||||||
|
|
||||||
%%% @type item() = binary().
|
-type(nodeId() :: binary()).
|
||||||
%%% <p>An <tt>item</tt> is the name of an Item. It can be anything.
|
|
||||||
|
|
||||||
|
%%% @type itemId() = binary().
|
||||||
|
%%%
|
||||||
|
%%% <p>An <tt>itemId</tt> is the name of an Item. It can be anything.
|
||||||
%%% For example:
|
%%% For example:
|
||||||
%%% 38964
|
%%% 38964
|
||||||
%%% my-tune
|
%%% my-tune
|
||||||
%%% FD6SBE6a27d</p>
|
%%% FD6SBE6a27d</p>
|
||||||
|
|
||||||
|
-type(itemId() :: binary()).
|
||||||
|
|
||||||
|
|
||||||
|
%%% @type subId() = binary().
|
||||||
|
|
||||||
|
-type(subId() :: binary()).
|
||||||
|
|
||||||
|
|
||||||
|
%%% @type nodeType() = string().
|
||||||
|
%%%
|
||||||
|
%%% <p>The <tt>nodeType</tt> is a string containing the name of the PubSub
|
||||||
|
%%% plugin to use to manage a given node. For example, it can be
|
||||||
|
%%% <tt>"flat"</tt>, <tt>"hometree"</tt> or <tt>"blog"</tt>.</p>
|
||||||
|
|
||||||
|
-type(nodeType() :: string()).
|
||||||
|
|
||||||
|
|
||||||
|
%%% @type ljid() = {User::binary(), Server::binary(), Resource::binary()}.
|
||||||
|
|
||||||
|
-type(ljid() :: {User::binary(), Server::binary(), Resource::binary()}).
|
||||||
|
|
||||||
|
|
||||||
|
%%% @type nodeIdx() = integer().
|
||||||
|
|
||||||
|
-type(nodeIdx() :: integer()).
|
||||||
|
|
||||||
|
|
||||||
|
%%% @type now() = {Megaseconds::integer(), Seconds::integer(), Microseconds::integer()}.
|
||||||
|
|
||||||
|
-type(now() :: {Megaseconds::integer(), Seconds::integer(), Microseconds::integer()}).
|
||||||
|
|
||||||
|
|
||||||
|
%%% @type affiliation() = none | owner | publisher | member | outcast.
|
||||||
|
|
||||||
|
-type(affiliation() :: none | owner | publisher | member | outcast).
|
||||||
|
|
||||||
|
|
||||||
|
%%% @type subscription() = none | pending | unconfigured | subscribed.
|
||||||
|
|
||||||
|
-type(subscription() :: none | pending | unconfigured | subscribed).
|
||||||
|
|
||||||
|
|
||||||
|
%%% @type payload() = string().
|
||||||
|
|
||||||
|
-type(payload() :: string()).
|
||||||
|
|
||||||
|
|
||||||
%%% @type stanzaError() = #xmlel{}.
|
%%% @type stanzaError() = #xmlel{}.
|
||||||
|
%%%
|
||||||
%%% Example:
|
%%% Example:
|
||||||
%%% ```#xmlel{name = 'error'
|
%%% ```#xmlel{name = 'error'
|
||||||
%%% ns = ?NS_STANZAS,
|
%%% ns = ?NS_STANZAS,
|
||||||
@ -73,7 +137,11 @@
|
|||||||
%%% }
|
%%% }
|
||||||
%%% ]}'''
|
%%% ]}'''
|
||||||
|
|
||||||
|
-type(stanzaError() :: #xmlel{}).
|
||||||
|
|
||||||
|
|
||||||
%%% @type pubsubIQResponse() = #xmlel{}.
|
%%% @type pubsubIQResponse() = #xmlel{}.
|
||||||
|
%%%
|
||||||
%%% Example:
|
%%% Example:
|
||||||
%%% ```#xmlel{name = 'pubsub',
|
%%% ```#xmlel{name = 'pubsub',
|
||||||
%%% ns = ?NS_PUBSUB,
|
%%% ns = ?NS_PUBSUB,
|
||||||
@ -84,84 +152,139 @@
|
|||||||
%%% ]
|
%%% ]
|
||||||
%%% }'''
|
%%% }'''
|
||||||
|
|
||||||
%%% @type nodeOption() = {Option::atom(), Value::term()}.
|
-type(pubsubIQResponse() :: #xmlel{}).
|
||||||
|
|
||||||
|
|
||||||
|
%%% @type nodeOption() = {Option, Value}.
|
||||||
|
%%% Option = atom()
|
||||||
|
%%% Value = term().
|
||||||
|
%%%
|
||||||
%%% Example:
|
%%% Example:
|
||||||
%%% ```{deliver_payloads, true}'''
|
%%% ```{deliver_payloads, true}'''
|
||||||
|
|
||||||
%%% @type nodeType() = string().
|
-type(nodeOption() :: {Option::atom(), Value::term()}).
|
||||||
%%% <p>The <tt>nodeType</tt> is a string containing the name of the PubSub
|
|
||||||
%%% plugin to use to manage a given node. For example, it can be
|
|
||||||
%%% <tt>"flat"</tt>, <tt>"hometree"</tt> or <tt>"blog"</tt>.</p>
|
|
||||||
|
|
||||||
%%% @type ljid() = {User::binary(), Server::binary(), Resource::binary()}.
|
%%% @type subOption() = {Option, Value}.
|
||||||
|
%%% Option = atom()
|
||||||
|
%%% Value = term().
|
||||||
|
|
||||||
%%% @type nodeidx() = int()
|
-type(subOption() :: {Option::atom(), Value::term()}).
|
||||||
|
|
||||||
%%% @type affiliation() = none | owner | publisher | member | outcast.
|
|
||||||
%%% @type subscription() = none | pending | unconfigured | subscribed.
|
|
||||||
|
|
||||||
%%% internal pubsub index table
|
%%% @type pubsubIndex() = {pubsub_index, Index, Last, Free}.
|
||||||
-record(pubsub_index, {index, last, free}).
|
%%% Index = atom()
|
||||||
|
%%% Last = nodeIdx()
|
||||||
|
%%% Free = [nodeIdx()].
|
||||||
|
%%%
|
||||||
|
%%% Internal pubsub index table.
|
||||||
|
|
||||||
%%% @type pubsubNode() = #pubsub_node{
|
-record(pubsub_index,
|
||||||
%%% id = {host(), node()},
|
{
|
||||||
%%% idx = nodeidx(),
|
index :: atom(),
|
||||||
%%% parents = [Node::pubsubNode()],
|
last :: integer(),
|
||||||
%%% type = nodeType(),
|
free :: [integer()]
|
||||||
%%% owners = [ljid()],
|
}).
|
||||||
%%% options = [nodeOption()]}.
|
|
||||||
|
-type(pubsubIndex() :: #pubsub_index{}).
|
||||||
|
|
||||||
|
|
||||||
|
%%% @type pubsubNode() = {pubsub_node, Id, Idx, Parents, Type, Owners, Options}
|
||||||
|
%%% Id = {host(), nodeId()}
|
||||||
|
%%% Idx = nodeIdx()
|
||||||
|
%%% Parents = [nodeId()]
|
||||||
|
%%% Type = nodeType()
|
||||||
|
%%% Owners = [ljid()]
|
||||||
|
%%% Options = [nodeOption()].
|
||||||
|
%%%
|
||||||
%%% <p>This is the format of the <tt>nodes</tt> table. The type of the table
|
%%% <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>
|
%%% is: <tt>set</tt>,<tt>ram/disc</tt>.</p>
|
||||||
%%% <p>The <tt>parents</tt> and <tt>type</tt> fields are indexed.</p>
|
%%% <p>The <tt>parents</tt> and <tt>type</tt> fields are indexed.</p>
|
||||||
%%% <p><tt>nodeidx</tt> is an integer.</p>
|
%%% <p><tt>idx</tt> is an integer.</p>
|
||||||
-record(pubsub_node, {id,
|
|
||||||
idx,
|
|
||||||
parents = [],
|
|
||||||
type = "flat",
|
|
||||||
owners = [],
|
|
||||||
options = []
|
|
||||||
}).
|
|
||||||
|
|
||||||
%%% @type pubsubState() = #pubsub_state{
|
-record(pubsub_node,
|
||||||
%%% id = {ljid(), nodeidx()},
|
{
|
||||||
%%% items = [item()],
|
id :: {host(), nodeId()},
|
||||||
%%% affiliation = affiliation(),
|
idx :: nodeIdx(),
|
||||||
%%% subscriptions = [subscription()]}.
|
parents = [] :: [nodeId()],
|
||||||
%%% <p>This is the format of the <tt>affiliations</tt> table. The type of the
|
type = "flat" :: nodeType(),
|
||||||
%%% table is: <tt>set</tt>,<tt>ram/disc</tt>.</p>
|
owners = [] :: [ljid()],
|
||||||
-record(pubsub_state, {id,
|
options = [] :: [nodeOption()]
|
||||||
items = [],
|
|
||||||
affiliation = none,
|
|
||||||
subscriptions = []
|
|
||||||
}).
|
}).
|
||||||
|
|
||||||
%%% @type pubsubItem() = #pubsub_item{
|
-type(pubsubNode() :: #pubsub_node{}).
|
||||||
%%% id = {item(), nodeidx()},
|
|
||||||
%%% creation = {now(), ljid()},
|
|
||||||
%%% modification = {now(), ljid()},
|
%%% @type pubsubState() = {pubsub_state, Id, Items, Affiliation, Subscriptions}
|
||||||
%%% payload = XMLContent::string()}.
|
%%% Id = {ljid(), nodeIdx()}
|
||||||
|
%%% Items = [itemId()]
|
||||||
|
%%% Affiliation = affiliation()
|
||||||
|
%%% Subscriptions = [subscription()].
|
||||||
|
%%%
|
||||||
|
%%% <p>This is the format of the <tt>affiliations</tt> table. The type of the
|
||||||
|
%%% table is: <tt>set</tt>,<tt>ram/disc</tt>.</p>
|
||||||
|
|
||||||
|
-record(pubsub_state,
|
||||||
|
{
|
||||||
|
id :: {ljid(), nodeIdx()},
|
||||||
|
items = [] :: [itemId()],
|
||||||
|
affiliation = none :: affiliation(),
|
||||||
|
subscriptions = [] :: [subscription()]
|
||||||
|
}).
|
||||||
|
|
||||||
|
-type(pubsubState() :: #pubsub_state{}).
|
||||||
|
|
||||||
|
|
||||||
|
%%% @type pubsubItem() = {pubsub_item, Id, Creation, Modification, Payload}
|
||||||
|
%%% Id = {itemId(), nodeIdx()}
|
||||||
|
%%% Creation = {now(), ljid()}
|
||||||
|
%%% Modification = {now(), ljid()}
|
||||||
|
%%% Payload = payload().
|
||||||
|
%%%
|
||||||
%%% <p>This is the format of the <tt>published items</tt> table. The type of the
|
%%% <p>This is the format of the <tt>published items</tt> table. The type of the
|
||||||
%%% table is: <tt>set</tt>,<tt>disc</tt>,<tt>fragmented</tt>.</p>
|
%%% table is: <tt>set</tt>,<tt>disc</tt>,<tt>fragmented</tt>.</p>
|
||||||
-record(pubsub_item, {id,
|
|
||||||
creation = {unknown,unknown},
|
|
||||||
modification = {unknown,unknown},
|
|
||||||
payload = []
|
|
||||||
}).
|
|
||||||
|
|
||||||
%% @type pubsubSubscription() = #pubsub_subscription{
|
-record(pubsub_item,
|
||||||
%% subid = string(),
|
{
|
||||||
%% state_key = {ljid(), nodeidx()},
|
id :: {itemId(), nodeIdx()},
|
||||||
%% options = [{atom(), term()}]
|
creation = {unknown,unknown} :: {now(), ljid()},
|
||||||
%% }.
|
modification = {unknown,unknown} :: {now(), ljid()},
|
||||||
|
payload = [] :: payload()
|
||||||
|
}).
|
||||||
|
|
||||||
|
-type(pubsubItem() :: #pubsub_item{}).
|
||||||
|
|
||||||
|
|
||||||
|
%%% @type pubsubSubscription() = {pubsub_subscription, SubId, Options}
|
||||||
|
%%% SubId = subId()
|
||||||
|
%%% Options = [nodeOption()].
|
||||||
|
%%%
|
||||||
%% <p>This is the format of the <tt>subscriptions</tt> table. The type of the
|
%% <p>This is the format of the <tt>subscriptions</tt> table. The type of the
|
||||||
%% table is: <tt>set</tt>,<tt>ram/disc</tt>.</p>
|
%% table is: <tt>set</tt>,<tt>ram/disc</tt>.</p>
|
||||||
-record(pubsub_subscription, {subid, options}).
|
|
||||||
|
|
||||||
%% @type pubsubLastItem() = #pubsub_last_item{
|
-record(pubsub_subscription,
|
||||||
%% nodeid = nodeidx(),
|
{
|
||||||
%% itemid = item(),
|
subid :: subId(),
|
||||||
%% creation = {now(), ljid()},
|
options :: [subOption()]
|
||||||
%% payload = XMLContent::string()}.
|
}).
|
||||||
|
|
||||||
|
-type(pubsubSubscription() :: #pubsub_subscription{}).
|
||||||
|
|
||||||
|
|
||||||
|
%%% @type pubsubLastItem() = {pubsub_last_item, NodeId, ItemId, Creation, Payload}
|
||||||
|
%%% NodeId = nodeIdx()
|
||||||
|
%%% ItemId = itemId()
|
||||||
|
%%% Creation = {now(), ljid()}()
|
||||||
|
%%% Payload = payload().
|
||||||
|
%%%
|
||||||
%% <p>This is the format of the <tt>last items</tt> table. it stores last item payload
|
%% <p>This is the format of the <tt>last items</tt> table. it stores last item payload
|
||||||
%% for every node</p>
|
%% for every node</p>
|
||||||
-record(pubsub_last_item, {nodeid, itemid, creation, payload}).
|
|
||||||
|
-record(pubsub_last_item,
|
||||||
|
{
|
||||||
|
nodeid :: nodeIdx(),
|
||||||
|
itemid :: itemId(),
|
||||||
|
creation :: {now(), ljid()},
|
||||||
|
payload :: payload()
|
||||||
|
}).
|
||||||
|
|
||||||
|
-type(pubsubLastItem() :: #pubsub_last_item{}).
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
--- mod_pubsub.erl 2010-09-10 18:04:47.000000000 +0200
|
--- mod_pubsub.erl 2010-09-20 15:56:56.000000000 +0200
|
||||||
+++ mod_pubsub_odbc.erl 2010-09-10 19:43:53.000000000 +0200
|
+++ mod_pubsub_odbc.erl 2010-09-20 16:50:49.000000000 +0200
|
||||||
@@ -42,7 +42,7 @@
|
@@ -42,7 +42,7 @@
|
||||||
%%% 6.2.3.1, 6.2.3.5, and 6.3. For information on subscription leases see
|
%%% 6.2.3.1, 6.2.3.5, and 6.3. For information on subscription leases see
|
||||||
%%% XEP-0060 section 12.18.
|
%%% XEP-0060 section 12.18.
|
||||||
@ -9,7 +9,7 @@
|
|||||||
-author('christophe.romain@process-one.net').
|
-author('christophe.romain@process-one.net').
|
||||||
-version('1.13-0').
|
-version('1.13-0').
|
||||||
|
|
||||||
@@ -55,9 +55,9 @@
|
@@ -53,9 +53,9 @@
|
||||||
-include("adhoc.hrl").
|
-include("adhoc.hrl").
|
||||||
-include("pubsub.hrl").
|
-include("pubsub.hrl").
|
||||||
|
|
||||||
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
%% exports for hooks
|
%% exports for hooks
|
||||||
-export([presence_probe/3,
|
-export([presence_probe/3,
|
||||||
@@ -104,7 +104,7 @@
|
@@ -102,7 +102,7 @@
|
||||||
string_to_affiliation/1,
|
string_to_affiliation/1,
|
||||||
extended_error/2,
|
extended_error/2,
|
||||||
extended_error/3,
|
extended_error/3,
|
||||||
@ -31,7 +31,7 @@
|
|||||||
]).
|
]).
|
||||||
|
|
||||||
%% API and gen_server callbacks
|
%% API and gen_server callbacks
|
||||||
@@ -123,7 +123,7 @@
|
@@ -121,7 +121,7 @@
|
||||||
-export([send_loop/1
|
-export([send_loop/1
|
||||||
]).
|
]).
|
||||||
|
|
||||||
@ -40,7 +40,7 @@
|
|||||||
-define(LOOPNAME, ejabberd_mod_pubsub_loop).
|
-define(LOOPNAME, ejabberd_mod_pubsub_loop).
|
||||||
-define(PLUGIN_PREFIX, "node_").
|
-define(PLUGIN_PREFIX, "node_").
|
||||||
-define(TREE_PREFIX, "nodetree_").
|
-define(TREE_PREFIX, "nodetree_").
|
||||||
@@ -220,8 +220,6 @@
|
@@ -218,8 +218,6 @@
|
||||||
ok
|
ok
|
||||||
end,
|
end,
|
||||||
ejabberd_router:register_route(Host),
|
ejabberd_router:register_route(Host),
|
||||||
@ -49,7 +49,7 @@
|
|||||||
init_nodes(Host, ServerHost, NodeTree, Plugins),
|
init_nodes(Host, ServerHost, NodeTree, Plugins),
|
||||||
State = #state{host = Host,
|
State = #state{host = Host,
|
||||||
server_host = ServerHost,
|
server_host = ServerHost,
|
||||||
@@ -280,209 +278,14 @@
|
@@ -278,209 +276,14 @@
|
||||||
|
|
||||||
init_nodes(Host, ServerHost, _NodeTree, Plugins) ->
|
init_nodes(Host, ServerHost, _NodeTree, Plugins) ->
|
||||||
%% TODO, this call should be done plugin side
|
%% TODO, this call should be done plugin side
|
||||||
@ -262,7 +262,7 @@
|
|||||||
send_loop(State) ->
|
send_loop(State) ->
|
||||||
receive
|
receive
|
||||||
{presence, JID, Pid} ->
|
{presence, JID, Pid} ->
|
||||||
@@ -493,7 +296,10 @@
|
@@ -491,7 +294,10 @@
|
||||||
%% for each node From is subscribed to
|
%% for each node From is subscribed to
|
||||||
%% and if the node is so configured, send the last published item to From
|
%% and if the node is so configured, send the last published item to From
|
||||||
lists:foreach(fun(PType) ->
|
lists:foreach(fun(PType) ->
|
||||||
@ -274,7 +274,7 @@
|
|||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun({Node, subscribed, _, SubJID}) ->
|
fun({Node, subscribed, _, SubJID}) ->
|
||||||
if (SubJID == LJID) or (SubJID == BJID) ->
|
if (SubJID == LJID) or (SubJID == BJID) ->
|
||||||
@@ -618,7 +424,8 @@
|
@@ -616,7 +422,8 @@
|
||||||
[#xmlel{name = 'identity', ns = ?NS_DISCO_INFO,
|
[#xmlel{name = 'identity', ns = ?NS_DISCO_INFO,
|
||||||
attrs = [?XMLATTR('category', <<"pubsub">>), ?XMLATTR('type', <<"pep">>)]}];
|
attrs = [?XMLATTR('category', <<"pubsub">>), ?XMLATTR('type', <<"pep">>)]}];
|
||||||
disco_identity(Host, Node, From) ->
|
disco_identity(Host, Node, From) ->
|
||||||
@ -284,7 +284,7 @@
|
|||||||
case get_allowed_items_call(Host, Nidx, From, Type, Options, Owners) of
|
case get_allowed_items_call(Host, Nidx, From, Type, Options, Owners) of
|
||||||
{result, _} ->
|
{result, _} ->
|
||||||
{result,
|
{result,
|
||||||
@@ -649,7 +456,8 @@
|
@@ -647,7 +454,8 @@
|
||||||
[?NS_PUBSUB_s
|
[?NS_PUBSUB_s
|
||||||
| [?NS_PUBSUB_s++"#"++Feature || Feature <- features("pep")]];
|
| [?NS_PUBSUB_s++"#"++Feature || Feature <- features("pep")]];
|
||||||
disco_features(Host, Node, From) ->
|
disco_features(Host, Node, From) ->
|
||||||
@ -294,7 +294,7 @@
|
|||||||
case get_allowed_items_call(Host, Nidx, From, Type, Options, Owners) of
|
case get_allowed_items_call(Host, Nidx, From, Type, Options, Owners) of
|
||||||
{result, _} ->
|
{result, _} ->
|
||||||
{result, [?NS_PUBSUB_s
|
{result, [?NS_PUBSUB_s
|
||||||
@@ -668,7 +476,8 @@
|
@@ -666,7 +474,8 @@
|
||||||
{result, disco_items(To, Node, From) ++ OtherItems}.
|
{result, disco_items(To, Node, From) ++ OtherItems}.
|
||||||
|
|
||||||
disco_items(Host, <<>>, From) ->
|
disco_items(Host, <<>>, From) ->
|
||||||
@ -304,7 +304,7 @@
|
|||||||
case get_allowed_items_call(Host, Nidx, From, Type, Options, Owners) of
|
case get_allowed_items_call(Host, Nidx, From, Type, Options, Owners) of
|
||||||
{result, _} ->
|
{result, _} ->
|
||||||
[#xmlel{name = 'item', ns = ?NS_DISCO_INFO,
|
[#xmlel{name = 'item', ns = ?NS_DISCO_INFO,
|
||||||
@@ -682,13 +491,14 @@
|
@@ -680,13 +489,14 @@
|
||||||
_ -> Acc
|
_ -> Acc
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -321,7 +321,7 @@
|
|||||||
case get_allowed_items_call(Host, Nidx, From, Type, Options, Owners) of
|
case get_allowed_items_call(Host, Nidx, From, Type, Options, Owners) of
|
||||||
{result, Items} ->
|
{result, Items} ->
|
||||||
{result,
|
{result,
|
||||||
@@ -774,10 +584,10 @@
|
@@ -772,10 +582,10 @@
|
||||||
lists:foreach(fun(PType) ->
|
lists:foreach(fun(PType) ->
|
||||||
{result, Subscriptions} = node_action(Host, PType, get_entity_subscriptions, [Host, Entity]),
|
{result, Subscriptions} = node_action(Host, PType, get_entity_subscriptions, [Host, Entity]),
|
||||||
lists:foreach(fun
|
lists:foreach(fun
|
||||||
@ -334,7 +334,7 @@
|
|||||||
true ->
|
true ->
|
||||||
node_action(Host, PType, unsubscribe_node, [Nidx, Entity, JID, all]);
|
node_action(Host, PType, unsubscribe_node, [Nidx, Entity, JID, all]);
|
||||||
false ->
|
false ->
|
||||||
@@ -952,10 +762,11 @@
|
@@ -950,10 +760,11 @@
|
||||||
end,
|
end,
|
||||||
ejabberd_router:route(To, From, Res);
|
ejabberd_router:route(To, From, Res);
|
||||||
#iq{type = get, ns = ?NS_DISCO_ITEMS,
|
#iq{type = get, ns = ?NS_DISCO_ITEMS,
|
||||||
@ -348,7 +348,7 @@
|
|||||||
{result, IQRes} ->
|
{result, IQRes} ->
|
||||||
Result = #xmlel{ns = ?NS_DISCO_ITEMS,
|
Result = #xmlel{ns = ?NS_DISCO_ITEMS,
|
||||||
name = 'query', attrs = QAttrs,
|
name = 'query', attrs = QAttrs,
|
||||||
@@ -1092,7 +903,7 @@
|
@@ -1090,7 +901,7 @@
|
||||||
[] ->
|
[] ->
|
||||||
["leaf"]; %% No sub-nodes: it's a leaf node
|
["leaf"]; %% No sub-nodes: it's a leaf node
|
||||||
_ ->
|
_ ->
|
||||||
@ -357,7 +357,7 @@
|
|||||||
{result, []} -> ["collection"];
|
{result, []} -> ["collection"];
|
||||||
{result, _} -> ["leaf", "collection"];
|
{result, _} -> ["leaf", "collection"];
|
||||||
_ -> []
|
_ -> []
|
||||||
@@ -1108,8 +919,9 @@
|
@@ -1106,8 +917,9 @@
|
||||||
[];
|
[];
|
||||||
true ->
|
true ->
|
||||||
[#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s)]} |
|
[#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s)]} |
|
||||||
@ -369,7 +369,7 @@
|
|||||||
end, features(Type))]
|
end, features(Type))]
|
||||||
end,
|
end,
|
||||||
%% TODO: add meta-data info (spec section 5.4)
|
%% TODO: add meta-data info (spec section 5.4)
|
||||||
@@ -1138,8 +950,9 @@
|
@@ -1136,8 +948,9 @@
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s)]},
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_ADHOC_s)]},
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_ADHOC_s)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_VCARD_s)]}] ++
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_VCARD_s)]}] ++
|
||||||
@ -381,7 +381,7 @@
|
|||||||
end, features(Host, Node))};
|
end, features(Host, Node))};
|
||||||
?NS_ADHOC_b ->
|
?NS_ADHOC_b ->
|
||||||
command_disco_info(Host, Node, From);
|
command_disco_info(Host, Node, From);
|
||||||
@@ -1149,7 +962,7 @@
|
@@ -1147,7 +960,7 @@
|
||||||
node_disco_info(Host, Node, From)
|
node_disco_info(Host, Node, From)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@ -390,7 +390,7 @@
|
|||||||
case tree_action(Host, get_subnodes, [Host, <<>>, From]) of
|
case tree_action(Host, get_subnodes, [Host, <<>>, From]) of
|
||||||
Nodes when is_list(Nodes) ->
|
Nodes when is_list(Nodes) ->
|
||||||
{result, lists:map(
|
{result, lists:map(
|
||||||
@@ -1166,7 +979,7 @@
|
@@ -1164,7 +977,7 @@
|
||||||
Other ->
|
Other ->
|
||||||
Other
|
Other
|
||||||
end;
|
end;
|
||||||
@ -399,7 +399,7 @@
|
|||||||
%% TODO: support localization of this string
|
%% TODO: support localization of this string
|
||||||
CommandItems = [
|
CommandItems = [
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item',
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item',
|
||||||
@@ -1175,19 +988,20 @@
|
@@ -1173,19 +986,20 @@
|
||||||
?XMLATTR('name', "Get Pending")
|
?XMLATTR('name', "Get Pending")
|
||||||
]}],
|
]}],
|
||||||
{result, CommandItems};
|
{result, CommandItems};
|
||||||
@ -425,7 +425,7 @@
|
|||||||
end,
|
end,
|
||||||
Nodes = lists:map(
|
Nodes = lists:map(
|
||||||
fun(#pubsub_node{id = {_, SubNode}, options = SubOptions}) ->
|
fun(#pubsub_node{id = {_, SubNode}, options = SubOptions}) ->
|
||||||
@@ -1205,7 +1019,7 @@
|
@@ -1203,7 +1017,7 @@
|
||||||
{result, Name} = node_call(Type, get_item_name, [Host, Node, RN]),
|
{result, Name} = node_call(Type, get_item_name, [Host, Node, RN]),
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = [?XMLATTR('jid', Host), ?XMLATTR('name', Name)]}
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = [?XMLATTR('jid', Host), ?XMLATTR('name', Name)]}
|
||||||
end, NodeItems),
|
end, NodeItems),
|
||||||
@ -434,7 +434,7 @@
|
|||||||
end,
|
end,
|
||||||
case transaction(Host, Node, Action, sync_dirty) of
|
case transaction(Host, Node, Action, sync_dirty) of
|
||||||
{result, {_, Result}} -> {result, Result};
|
{result, {_, Result}} -> {result, Result};
|
||||||
@@ -1213,12 +1027,6 @@
|
@@ -1211,12 +1025,6 @@
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@ -447,7 +447,7 @@
|
|||||||
get_presence_and_roster_permissions(Host, From, Owners, AccessModel, AllowedGroups) ->
|
get_presence_and_roster_permissions(Host, From, Owners, AccessModel, AllowedGroups) ->
|
||||||
if (AccessModel == presence) or (AccessModel == roster) ->
|
if (AccessModel == presence) or (AccessModel == roster) ->
|
||||||
case Host of
|
case Host of
|
||||||
@@ -1336,7 +1144,7 @@
|
@@ -1334,7 +1142,7 @@
|
||||||
(_, Acc) ->
|
(_, Acc) ->
|
||||||
Acc
|
Acc
|
||||||
end, [], exmpp_xml:remove_cdata_from_list(Els)),
|
end, [], exmpp_xml:remove_cdata_from_list(Els)),
|
||||||
@ -456,7 +456,7 @@
|
|||||||
{get, 'subscriptions'} ->
|
{get, 'subscriptions'} ->
|
||||||
get_subscriptions(Host, Node, From, Plugins);
|
get_subscriptions(Host, Node, From, Plugins);
|
||||||
{get, 'affiliations'} ->
|
{get, 'affiliations'} ->
|
||||||
@@ -1493,7 +1301,8 @@
|
@@ -1491,7 +1299,8 @@
|
||||||
_ -> []
|
_ -> []
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -466,7 +466,7 @@
|
|||||||
sync_dirty) of
|
sync_dirty) of
|
||||||
{result, Res} -> Res;
|
{result, Res} -> Res;
|
||||||
Err -> Err
|
Err -> Err
|
||||||
@@ -1537,7 +1346,7 @@
|
@@ -1535,7 +1344,7 @@
|
||||||
|
|
||||||
%%% authorization handling
|
%%% authorization handling
|
||||||
|
|
||||||
@ -475,7 +475,7 @@
|
|||||||
Lang = <<"en">>, %% TODO fix
|
Lang = <<"en">>, %% TODO fix
|
||||||
{U, S, R} = Subscriber,
|
{U, S, R} = Subscriber,
|
||||||
Stanza = #xmlel{ns = ?NS_JABBER_CLIENT, name = 'message', children =
|
Stanza = #xmlel{ns = ?NS_JABBER_CLIENT, name = 'message', children =
|
||||||
@@ -1567,7 +1376,7 @@
|
@@ -1565,7 +1374,7 @@
|
||||||
lists:foreach(fun(Owner) ->
|
lists:foreach(fun(Owner) ->
|
||||||
{U, S, R} = Owner,
|
{U, S, R} = Owner,
|
||||||
ejabberd_router:route(service_jid(Host), exmpp_jid:make(U, S, R), Stanza)
|
ejabberd_router:route(service_jid(Host), exmpp_jid:make(U, S, R), Stanza)
|
||||||
@ -484,7 +484,7 @@
|
|||||||
|
|
||||||
find_authorization_response(Packet) ->
|
find_authorization_response(Packet) ->
|
||||||
Els = Packet#xmlel.children,
|
Els = Packet#xmlel.children,
|
||||||
@@ -1626,8 +1435,8 @@
|
@@ -1624,8 +1433,8 @@
|
||||||
"true" -> true;
|
"true" -> true;
|
||||||
_ -> false
|
_ -> false
|
||||||
end,
|
end,
|
||||||
@ -495,7 +495,7 @@
|
|||||||
{result, Subscriptions} = node_call(Type, get_subscriptions, [Nidx, Subscriber]),
|
{result, Subscriptions} = node_call(Type, get_subscriptions, [Nidx, Subscriber]),
|
||||||
if
|
if
|
||||||
not IsApprover ->
|
not IsApprover ->
|
||||||
@@ -1826,7 +1635,7 @@
|
@@ -1824,7 +1633,7 @@
|
||||||
end,
|
end,
|
||||||
Reply = #xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children =
|
Reply = #xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children =
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'create', attrs = nodeAttr(Node)}]},
|
[#xmlel{ns = ?NS_PUBSUB, name = 'create', attrs = nodeAttr(Node)}]},
|
||||||
@ -504,7 +504,7 @@
|
|||||||
{result, {NodeId, SubsByDepth, {Result, broadcast}}} ->
|
{result, {NodeId, SubsByDepth, {Result, broadcast}}} ->
|
||||||
broadcast_created_node(Host, Node, NodeId, Type, NodeOptions, SubsByDepth),
|
broadcast_created_node(Host, Node, NodeId, Type, NodeOptions, SubsByDepth),
|
||||||
case Result of
|
case Result of
|
||||||
@@ -1930,7 +1739,7 @@
|
@@ -1928,7 +1737,7 @@
|
||||||
%%<li>The node does not exist.</li>
|
%%<li>The node does not exist.</li>
|
||||||
%%</ul>
|
%%</ul>
|
||||||
subscribe_node(Host, Node, From, JID, Configuration) ->
|
subscribe_node(Host, Node, From, JID, Configuration) ->
|
||||||
@ -513,7 +513,7 @@
|
|||||||
{result, GoodSubOpts} -> GoodSubOpts;
|
{result, GoodSubOpts} -> GoodSubOpts;
|
||||||
_ -> invalid
|
_ -> invalid
|
||||||
end,
|
end,
|
||||||
@@ -1940,7 +1749,7 @@
|
@@ -1938,7 +1747,7 @@
|
||||||
_:_ ->
|
_:_ ->
|
||||||
{undefined, undefined, undefined}
|
{undefined, undefined, undefined}
|
||||||
end,
|
end,
|
||||||
@ -522,7 +522,7 @@
|
|||||||
Features = features(Type),
|
Features = features(Type),
|
||||||
SubscribeFeature = lists:member("subscribe", Features),
|
SubscribeFeature = lists:member("subscribe", Features),
|
||||||
OptionsFeature = lists:member("subscription-options", Features),
|
OptionsFeature = lists:member("subscription-options", Features),
|
||||||
@@ -1949,6 +1758,7 @@
|
@@ -1947,6 +1756,7 @@
|
||||||
AccessModel = get_option(Options, access_model),
|
AccessModel = get_option(Options, access_model),
|
||||||
SendLast = get_option(Options, send_last_published_item),
|
SendLast = get_option(Options, send_last_published_item),
|
||||||
AllowedGroups = get_option(Options, roster_groups_allowed, []),
|
AllowedGroups = get_option(Options, roster_groups_allowed, []),
|
||||||
@ -530,7 +530,7 @@
|
|||||||
{PresenceSubscription, RosterGroup} = get_presence_and_roster_permissions(Host, Subscriber, Owners, AccessModel, AllowedGroups),
|
{PresenceSubscription, RosterGroup} = get_presence_and_roster_permissions(Host, Subscriber, Owners, AccessModel, AllowedGroups),
|
||||||
if
|
if
|
||||||
not SubscribeFeature ->
|
not SubscribeFeature ->
|
||||||
@@ -2293,7 +2103,7 @@
|
@@ -2291,7 +2101,7 @@
|
||||||
%% <p>The permission are not checked in this function.</p>
|
%% <p>The permission are not checked in this function.</p>
|
||||||
%% @todo We probably need to check that the user doing the query has the right
|
%% @todo We probably need to check that the user doing the query has the right
|
||||||
%% to read the items.
|
%% to read the items.
|
||||||
@ -539,7 +539,7 @@
|
|||||||
MaxItems =
|
MaxItems =
|
||||||
if
|
if
|
||||||
SMaxItems == "" -> get_max_items_node(Host);
|
SMaxItems == "" -> get_max_items_node(Host);
|
||||||
@@ -2307,12 +2117,13 @@
|
@@ -2305,12 +2115,13 @@
|
||||||
{error, Error} ->
|
{error, Error} ->
|
||||||
{error, Error};
|
{error, Error};
|
||||||
_ ->
|
_ ->
|
||||||
@ -554,7 +554,7 @@
|
|||||||
{PresenceSubscription, RosterGroup} = get_presence_and_roster_permissions(Host, From, Owners, AccessModel, AllowedGroups),
|
{PresenceSubscription, RosterGroup} = get_presence_and_roster_permissions(Host, From, Owners, AccessModel, AllowedGroups),
|
||||||
if
|
if
|
||||||
not RetreiveFeature ->
|
not RetreiveFeature ->
|
||||||
@@ -2325,11 +2136,11 @@
|
@@ -2323,11 +2134,11 @@
|
||||||
node_call(Type, get_items,
|
node_call(Type, get_items,
|
||||||
[Nidx, From,
|
[Nidx, From,
|
||||||
AccessModel, PresenceSubscription, RosterGroup,
|
AccessModel, PresenceSubscription, RosterGroup,
|
||||||
@ -568,7 +568,7 @@
|
|||||||
SendItems = case ItemIds of
|
SendItems = case ItemIds of
|
||||||
[] ->
|
[] ->
|
||||||
Items;
|
Items;
|
||||||
@@ -2342,7 +2153,7 @@
|
@@ -2340,7 +2151,7 @@
|
||||||
%% number of items sent to MaxItems:
|
%% number of items sent to MaxItems:
|
||||||
{result, #xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children =
|
{result, #xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children =
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'items', attrs = nodeAttr(Node), children =
|
[#xmlel{ns = ?NS_PUBSUB, name = 'items', attrs = nodeAttr(Node), children =
|
||||||
@ -577,7 +577,7 @@
|
|||||||
Error ->
|
Error ->
|
||||||
Error
|
Error
|
||||||
end
|
end
|
||||||
@@ -2365,6 +2176,17 @@
|
@@ -2363,6 +2174,17 @@
|
||||||
{result, {_, Items}} -> Items;
|
{result, {_, Items}} -> Items;
|
||||||
Error -> Error
|
Error -> Error
|
||||||
end.
|
end.
|
||||||
@ -595,7 +595,7 @@
|
|||||||
|
|
||||||
%% @spec (Host, Node, NodeId, Type, LJID, Number) -> any()
|
%% @spec (Host, Node, NodeId, Type, LJID, Number) -> any()
|
||||||
%% Host = pubsubHost()
|
%% Host = pubsubHost()
|
||||||
@@ -2376,16 +2198,29 @@
|
@@ -2374,16 +2196,29 @@
|
||||||
%% @doc <p>Resend the items of a node to the user.</p>
|
%% @doc <p>Resend the items of a node to the user.</p>
|
||||||
%% @todo use cache-last-item feature
|
%% @todo use cache-last-item feature
|
||||||
send_items(Host, Node, NodeId, Type, LJID, last) ->
|
send_items(Host, Node, NodeId, Type, LJID, last) ->
|
||||||
@ -631,7 +631,7 @@
|
|||||||
send_items(Host, Node, NodeId, Type, {LU, LS, LR} = LJID, Number) ->
|
send_items(Host, Node, NodeId, Type, {LU, LS, LR} = LJID, Number) ->
|
||||||
ToSend = case node_action(Host, Type, get_items, [NodeId, LJID]) of
|
ToSend = case node_action(Host, Type, get_items, [NodeId, LJID]) of
|
||||||
{result, []} ->
|
{result, []} ->
|
||||||
@@ -2512,7 +2347,8 @@
|
@@ -2510,7 +2345,8 @@
|
||||||
error ->
|
error ->
|
||||||
{error, 'bad-request'};
|
{error, 'bad-request'};
|
||||||
_ ->
|
_ ->
|
||||||
@ -641,7 +641,7 @@
|
|||||||
case lists:member(Owner, Owners) of
|
case lists:member(Owner, Owners) of
|
||||||
true ->
|
true ->
|
||||||
OwnerJID = exmpp_jid:make(Owner),
|
OwnerJID = exmpp_jid:make(Owner),
|
||||||
@@ -2522,24 +2358,8 @@
|
@@ -2520,24 +2356,8 @@
|
||||||
end,
|
end,
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun({JID, Affiliation}) ->
|
fun({JID, Affiliation}) ->
|
||||||
@ -668,7 +668,7 @@
|
|||||||
end, FilteredEntities),
|
end, FilteredEntities),
|
||||||
{result, []};
|
{result, []};
|
||||||
_ ->
|
_ ->
|
||||||
@@ -2594,11 +2414,11 @@
|
@@ -2592,11 +2412,11 @@
|
||||||
end.
|
end.
|
||||||
|
|
||||||
read_sub(Subscriber, Node, NodeId, SubId, Lang) ->
|
read_sub(Subscriber, Node, NodeId, SubId, Lang) ->
|
||||||
@ -682,7 +682,7 @@
|
|||||||
OptionsEl = #xmlel{ns = ?NS_PUBSUB, name = 'options',
|
OptionsEl = #xmlel{ns = ?NS_PUBSUB, name = 'options',
|
||||||
attrs = [ ?XMLATTR('jid', exmpp_jid:to_binary(Subscriber)),
|
attrs = [ ?XMLATTR('jid', exmpp_jid:to_binary(Subscriber)),
|
||||||
?XMLATTR('subid', SubId) | nodeAttr(Node)],
|
?XMLATTR('subid', SubId) | nodeAttr(Node)],
|
||||||
@@ -2625,7 +2445,7 @@
|
@@ -2623,7 +2443,7 @@
|
||||||
end.
|
end.
|
||||||
|
|
||||||
set_options_helper(Configuration, JID, NodeId, SubId, Type) ->
|
set_options_helper(Configuration, JID, NodeId, SubId, Type) ->
|
||||||
@ -691,7 +691,7 @@
|
|||||||
{result, GoodSubOpts} -> GoodSubOpts;
|
{result, GoodSubOpts} -> GoodSubOpts;
|
||||||
_ -> invalid
|
_ -> invalid
|
||||||
end,
|
end,
|
||||||
@@ -2655,7 +2475,7 @@
|
@@ -2653,7 +2473,7 @@
|
||||||
write_sub(_Subscriber, _NodeId, _SubId, invalid) ->
|
write_sub(_Subscriber, _NodeId, _SubId, invalid) ->
|
||||||
{error, extended_error('bad-request', "invalid-options")};
|
{error, extended_error('bad-request', "invalid-options")};
|
||||||
write_sub(Subscriber, NodeId, SubId, Options) ->
|
write_sub(Subscriber, NodeId, SubId, Options) ->
|
||||||
@ -700,7 +700,7 @@
|
|||||||
{error, notfound} ->
|
{error, notfound} ->
|
||||||
{error, extended_error('not-acceptable', "invalid-subid")};
|
{error, extended_error('not-acceptable', "invalid-subid")};
|
||||||
{result, _} ->
|
{result, _} ->
|
||||||
@@ -2829,8 +2649,8 @@
|
@@ -2827,8 +2647,8 @@
|
||||||
?XMLATTR('subsription', subscription_to_string(Sub)) | nodeAttr(Node)]}]}]},
|
?XMLATTR('subsription', subscription_to_string(Sub)) | nodeAttr(Node)]}]}]},
|
||||||
ejabberd_router:route(service_jid(Host), JID, Stanza)
|
ejabberd_router:route(service_jid(Host), JID, Stanza)
|
||||||
end,
|
end,
|
||||||
@ -711,7 +711,7 @@
|
|||||||
true ->
|
true ->
|
||||||
Result = lists:foldl(fun({JID, Subscription, SubId}, Acc) ->
|
Result = lists:foldl(fun({JID, Subscription, SubId}, Acc) ->
|
||||||
|
|
||||||
@@ -3179,7 +2999,7 @@
|
@@ -3177,7 +2997,7 @@
|
||||||
{Depth, [{N, get_node_subs(N)} || N <- Nodes]}
|
{Depth, [{N, get_node_subs(N)} || N <- Nodes]}
|
||||||
end, tree_call(Host, get_parentnodes_tree, [Host, Node, service_jid(Host)]))}
|
end, tree_call(Host, get_parentnodes_tree, [Host, Node, service_jid(Host)]))}
|
||||||
end,
|
end,
|
||||||
@ -720,7 +720,7 @@
|
|||||||
{result, CollSubs} -> CollSubs;
|
{result, CollSubs} -> CollSubs;
|
||||||
_ -> []
|
_ -> []
|
||||||
end.
|
end.
|
||||||
@@ -3192,7 +3012,7 @@
|
@@ -3190,7 +3010,7 @@
|
||||||
|
|
||||||
get_options_for_subs(Nidx, Subs) ->
|
get_options_for_subs(Nidx, Subs) ->
|
||||||
lists:foldl(fun({JID, subscribed, SubId}, Acc) ->
|
lists:foldl(fun({JID, subscribed, SubId}, Acc) ->
|
||||||
@ -729,7 +729,7 @@
|
|||||||
{error, notfound} -> [{JID, SubId, []} | Acc];
|
{error, notfound} -> [{JID, SubId, []} | Acc];
|
||||||
#pubsub_subscription{options = Options} -> [{JID, SubId, Options} | Acc];
|
#pubsub_subscription{options = Options} -> [{JID, SubId, Options} | Acc];
|
||||||
_ -> Acc
|
_ -> Acc
|
||||||
@@ -3416,6 +3236,30 @@
|
@@ -3414,6 +3234,30 @@
|
||||||
Result
|
Result
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@ -760,7 +760,7 @@
|
|||||||
%% @spec (Host, Options) -> MaxItems
|
%% @spec (Host, Options) -> MaxItems
|
||||||
%% Host = host()
|
%% Host = host()
|
||||||
%% Options = [Option]
|
%% Options = [Option]
|
||||||
@@ -3819,7 +3663,13 @@
|
@@ -3817,7 +3661,13 @@
|
||||||
tree_action(Host, Function, Args) ->
|
tree_action(Host, Function, Args) ->
|
||||||
?DEBUG("tree_action ~p ~p ~p",[Host,Function,Args]),
|
?DEBUG("tree_action ~p ~p ~p",[Host,Function,Args]),
|
||||||
Fun = fun() -> tree_call(Host, Function, Args) end,
|
Fun = fun() -> tree_call(Host, Function, Args) end,
|
||||||
@ -775,7 +775,7 @@
|
|||||||
|
|
||||||
%% @doc <p>node plugin call.</p>
|
%% @doc <p>node plugin call.</p>
|
||||||
node_call(Type, Function, Args) ->
|
node_call(Type, Function, Args) ->
|
||||||
@@ -3839,13 +3689,13 @@
|
@@ -3837,13 +3687,13 @@
|
||||||
|
|
||||||
node_action(Host, Type, Function, Args) ->
|
node_action(Host, Type, Function, Args) ->
|
||||||
?DEBUG("node_action ~p ~p ~p ~p",[Host,Type,Function,Args]),
|
?DEBUG("node_action ~p ~p ~p ~p",[Host,Type,Function,Args]),
|
||||||
@ -791,7 +791,7 @@
|
|||||||
case tree_call(Host, get_node, [Host, Node]) of
|
case tree_call(Host, get_node, [Host, Node]) of
|
||||||
N when is_record(N, pubsub_node) ->
|
N when is_record(N, pubsub_node) ->
|
||||||
case Action(N) of
|
case Action(N) of
|
||||||
@@ -3858,13 +3708,20 @@
|
@@ -3856,13 +3706,20 @@
|
||||||
end
|
end
|
||||||
end, Trans).
|
end, Trans).
|
||||||
|
|
||||||
@ -816,7 +816,7 @@
|
|||||||
{result, Result} -> {result, Result};
|
{result, Result} -> {result, Result};
|
||||||
{error, Error} -> {error, Error};
|
{error, Error} -> {error, Error};
|
||||||
{atomic, {result, Result}} -> {result, Result};
|
{atomic, {result, Result}} -> {result, Result};
|
||||||
@@ -3872,6 +3729,15 @@
|
@@ -3870,6 +3727,15 @@
|
||||||
{aborted, Reason} ->
|
{aborted, Reason} ->
|
||||||
?ERROR_MSG("transaction return internal error: ~p~n", [{aborted, Reason}]),
|
?ERROR_MSG("transaction return internal error: ~p~n", [{aborted, Reason}]),
|
||||||
{error, 'internal-server-error'};
|
{error, 'internal-server-error'};
|
||||||
@ -832,7 +832,7 @@
|
|||||||
{'EXIT', Reason} ->
|
{'EXIT', Reason} ->
|
||||||
?ERROR_MSG("transaction return internal error: ~p~n", [{'EXIT', Reason}]),
|
?ERROR_MSG("transaction return internal error: ~p~n", [{'EXIT', Reason}]),
|
||||||
{error, 'internal-server-error'};
|
{error, 'internal-server-error'};
|
||||||
@@ -3880,6 +3746,16 @@
|
@@ -3878,6 +3744,16 @@
|
||||||
{error, 'internal-server-error'}
|
{error, 'internal-server-error'}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -39,7 +39,6 @@
|
|||||||
write_subscription/4]).
|
write_subscription/4]).
|
||||||
|
|
||||||
-include("pubsub.hrl").
|
-include("pubsub.hrl").
|
||||||
-include_lib("exmpp/include/exmpp.hrl").
|
|
||||||
|
|
||||||
-define(PUBSUB_DELIVER, "pubsub#deliver").
|
-define(PUBSUB_DELIVER, "pubsub#deliver").
|
||||||
-define(PUBSUB_DIGEST, "pubsub#digest").
|
-define(PUBSUB_DIGEST, "pubsub#digest").
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
-include_lib("stdlib/include/qlc.hrl").
|
-include_lib("stdlib/include/qlc.hrl").
|
||||||
|
|
||||||
-include("pubsub.hrl").
|
-include("pubsub.hrl").
|
||||||
-include_lib("exmpp/include/exmpp.hrl").
|
|
||||||
|
|
||||||
-define(PUBSUB_DELIVER, "pubsub#deliver").
|
-define(PUBSUB_DELIVER, "pubsub#deliver").
|
||||||
-define(PUBSUB_DIGEST, "pubsub#digest").
|
-define(PUBSUB_DIGEST, "pubsub#digest").
|
||||||
|
Loading…
Reference in New Issue
Block a user