forked from erszcz/ejabberd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpubsub.hrl
137 lines (118 loc) · 4.79 KB
/
pubsub.hrl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
%%% ====================================================================
%%% ``The contents of this file are subject to the Erlang Public License,
%%% Version 1.1, (the "License"); you may not use this file except in
%%% 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-2010, ProcessOne
%%% All Rights Reserved.''
%%% This software is copyright 2006-2010, ProcessOne.
%%%
%%%
%%% copyright 2006-2010 ProcessOne
%%%
%%% This file contains pubsub types definition.
%%% ====================================================================
%% -------------------------------
%% Pubsub constants
-define(ERR_EXTENDED(E,C), mod_pubsub:extended_error(E,C)).
%% The actual limit can be configured with mod_pubsub's option max_items_node
-define(MAXITEMS, 10).
%% this is currently a hard limit.
%% Would be nice to have it configurable.
-define(MAX_PAYLOAD_SIZE, 60000).
%% -------------------------------
%% Pubsub types
%%% @type host() = string().
%%% <p><tt>host</tt> is the name of the PubSub service. For example, it can be
%%% <tt>"pubsub.localhost"</tt>.</p>
%%% @type pubsubNode() = [string()].
%%% <p>A node is defined by a list of its ancestors. The last element is the name
%%% of the current node. For example:
%%% ```["home", "localhost", "cromain", "node1"]'''</p>
%%% @type stanzaError() = #xmlelement{}.
%%% Example:
%%% ```{xmlelement, "error",
%%% [{"code", Code}, {"type", Type}],
%%% [{xmlelement, Condition, [{"xmlns", ?NS_STANZAS}], []}]}'''
%%% @type pubsubIQResponse() = #xmlelement{}.
%%% Example:
%%% ```{xmlelement, "pubsub",
%%% [{"xmlns", ?NS_PUBSUB_EVENT}],
%%% [{xmlelement, "affiliations", [],
%%% []}]}'''
%%% @type nodeOption() = {Option::atom(), Value::term()}.
%%% Example:
%%% ```{deliver_payloads, true}'''
%%% @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 jid() = #jid{
%%% user = string(),
%%% server = string(),
%%% resource = string(),
%%% luser = string(),
%%% lserver = string(),
%%% lresource = string()}.
%%% @type ljid() = {User::string(), Server::string(), Resource::string()}.
%%% @type affiliation() = none | owner | publisher | outcast.
%%% @type subscription() = none | pending | unconfigured | subscribed.
%%% internal pubsub index table
-record(pubsub_index, {index, last, free}).
%%% @type pubsubNode() = #pubsub_node{
%%% nodeid = {Host::host(), Node::pubsubNode()},
%%% parentid = Node::pubsubNode(),
%%% nodeidx = int(),
%%% type = nodeType(),
%%% 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 = [],
type = "flat",
owners = [],
options = []
}).
%%% @type pubsubState() = #pubsub_state{
%%% stateid = {ljid(), nodeidx()},
%%% items = [ItemId::string()],
%%% 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, {stateid,
items = [],
affiliation = none,
subscriptions = []
}).
%%% @type pubsubItem() = #pubsub_item{
%%% itemid = {ItemId::string(), nodeidx()},
%%% creation = {now(), ljid()},
%%% modification = {now(), ljid()},
%%% payload = XMLContent::string()}.
%%% <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>
-record(pubsub_item, {itemid,
creation = {unknown,unknown},
modification = {unknown,unknown},
payload = []
}).
%% @type pubsubSubscription() = #pubsub_subscription{
%% subid = string(),
%% state_key = {ljid(), pubsubNodeId()},
%% options = [{atom(), term()}]
%% }.
%% <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>
-record(pubsub_subscription, {subid, options}).