aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/adhoc.hrl2
-rw-r--r--include/bosh.hrl51
-rw-r--r--include/ejabberd.hrl72
-rw-r--r--include/ejabberd_auth.hrl22
-rw-r--r--include/ejabberd_commands.hrl10
-rw-r--r--include/ejabberd_config.hrl2
-rw-r--r--include/ejabberd_ctl.hrl2
-rw-r--r--include/ejabberd_http.hrl11
-rw-r--r--include/ejabberd_oauth.hrl11
-rw-r--r--include/ejabberd_router.hrl8
-rw-r--r--include/ejabberd_sm.hrl25
-rw-r--r--include/ejabberd_sql.hrl41
-rw-r--r--include/ejabberd_sql_pt.hrl18
-rw-r--r--include/ejabberd_stacktrace.hrl27
-rw-r--r--include/ejabberd_web_admin.hrl20
-rw-r--r--include/eldap.hrl20
-rw-r--r--include/http_bind.hrl2
-rw-r--r--include/jlib.hrl505
-rw-r--r--include/logger.hrl35
-rw-r--r--include/mod_announce.hrl20
-rw-r--r--include/mod_caps.hrl20
-rw-r--r--include/mod_carboncopy.hrl4
-rw-r--r--include/mod_irc.hrl15
-rw-r--r--include/mod_last.hrl20
-rw-r--r--include/mod_mam.hrl32
-rw-r--r--include/mod_muc.hrl17
-rw-r--r--include/mod_muc_room.hrl76
-rw-r--r--include/mod_offline.hrl26
-rw-r--r--include/mod_privacy.hrl21
-rw-r--r--include/mod_private.hrl20
-rw-r--r--include/mod_proxy65.hrl2
-rw-r--r--include/mod_push.hrl24
-rw-r--r--include/mod_roster.hrl8
-rw-r--r--include/mod_shared_roster.hrl20
-rw-r--r--include/mod_vcard.hrl20
-rw-r--r--include/mod_vcard_xupdate.hrl20
-rw-r--r--include/mqtt.hrl209
-rw-r--r--include/ns.hrl174
-rw-r--r--include/pubsub.hrl70
-rw-r--r--include/translate.hrl1
40 files changed, 778 insertions, 925 deletions
diff --git a/include/adhoc.hrl b/include/adhoc.hrl
index bd1bfaa6f..9471557d0 100644
--- a/include/adhoc.hrl
+++ b/include/adhoc.hrl
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
-%%% ejabberd, Copyright (C) 2002-2016 ProcessOne
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/include/bosh.hrl b/include/bosh.hrl
new file mode 100644
index 000000000..57fd644a5
--- /dev/null
+++ b/include/bosh.hrl
@@ -0,0 +1,51 @@
+%%%----------------------------------------------------------------------
+%%%
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
+%%%
+%%% 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.
+%%%
+%%% 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.
+%%%
+%%%----------------------------------------------------------------------
+
+-define(CT_XML,
+ {<<"Content-Type">>, <<"text/xml; charset=utf-8">>}).
+
+-define(CT_PLAIN,
+ {<<"Content-Type">>, <<"text/plain">>}).
+
+-define(CT_JSON,
+ {<<"Content-Type">>, <<"application/json">>}).
+
+-define(AC_ALLOW_ORIGIN,
+ {<<"Access-Control-Allow-Origin">>, <<"*">>}).
+
+-define(AC_ALLOW_METHODS,
+ {<<"Access-Control-Allow-Methods">>,
+ <<"GET, POST, OPTIONS">>}).
+
+-define(AC_ALLOW_HEADERS,
+ {<<"Access-Control-Allow-Headers">>,
+ <<"Content-Type">>}).
+
+-define(AC_MAX_AGE,
+ {<<"Access-Control-Max-Age">>, <<"86400">>}).
+
+-define(OPTIONS_HEADER,
+ [?CT_PLAIN, ?AC_ALLOW_ORIGIN, ?AC_ALLOW_METHODS,
+ ?AC_ALLOW_HEADERS, ?AC_MAX_AGE]).
+
+-define(HEADER(CType),
+ [CType, ?AC_ALLOW_ORIGIN, ?AC_ALLOW_HEADERS]).
+
+-define(BOSH_CACHE, bosh_cache).
diff --git a/include/ejabberd.hrl b/include/ejabberd.hrl
deleted file mode 100644
index 6316d7813..000000000
--- a/include/ejabberd.hrl
+++ /dev/null
@@ -1,72 +0,0 @@
-%%%----------------------------------------------------------------------
-%%%
-%%% ejabberd, Copyright (C) 2002-2016 ProcessOne
-%%%
-%%% 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.
-%%%
-%%% 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.
-%%%
-%%%----------------------------------------------------------------------
-
--ifndef(EJABBERD_HRL).
--define(EJABBERD_HRL, true).
-
--define(VERSION, ejabberd_config:get_version()).
-
--define(MYHOSTS, ejabberd_config:get_myhosts()).
-
--define(MYNAME, hd(ejabberd_config:get_myhosts())).
-
--define(MYLANG, ejabberd_config:get_mylang()).
-
--define(MSGS_DIR, filename:join(["priv", "msgs"])).
-
--define(SQL_DIR, filename:join(["priv", "sql"])).
-
--define(CONFIG_PATH, <<"ejabberd.cfg">>).
-
--define(LOG_PATH, <<"ejabberd.log">>).
-
--define(EJABBERD_URI, <<"http://www.process-one.net/en/ejabberd/">>).
-
--define(S2STIMEOUT, 600000).
-
-%%-define(DBGFSM, true).
-
--record(scram,
- {storedkey = <<"">>,
- serverkey = <<"">>,
- salt = <<"">>,
- iterationcount = 0 :: integer()}).
-
--type scram() :: #scram{}.
-
--define(SCRAM_DEFAULT_ITERATION_COUNT, 4096).
-
--ifdef(ERL_DEPRECATED_TYPES).
-
--define(TDICT, dict()).
--define(TGB_TREE, gb_tree()).
--define(TGB_SET, gb_set()).
--define(TQUEUE, queue()).
-
--else.
-
--define(TDICT, dict:dict()).
--define(TGB_TREE, gb_trees:tree()).
--define(TGB_SET, gb_set:set()).
--define(TQUEUE, queue:queue()).
-
--endif.
-
--endif.
diff --git a/include/ejabberd_auth.hrl b/include/ejabberd_auth.hrl
new file mode 100644
index 000000000..8b9cb47fe
--- /dev/null
+++ b/include/ejabberd_auth.hrl
@@ -0,0 +1,22 @@
+%%%----------------------------------------------------------------------
+%%%
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
+%%%
+%%% 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.
+%%%
+%%% 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.
+%%%
+%%%----------------------------------------------------------------------
+
+-record(passwd, {us = {<<"">>, <<"">>} :: {binary(), binary()} | '$1',
+ password = <<"">> :: binary() | scram() | '_'}).
diff --git a/include/ejabberd_commands.hrl b/include/ejabberd_commands.hrl
index c5c34b743..e3c498ca6 100644
--- a/include/ejabberd_commands.hrl
+++ b/include/ejabberd_commands.hrl
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
-%%% ejabberd, Copyright (C) 2002-2016 ProcessOne
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -46,18 +46,20 @@
%% to command, so that the command can perform additional check.
-record(ejabberd_commands,
- {name :: atom(),
+ {name :: atom(),
tags = [] :: [atom()] | '_' | '$2',
desc = "" :: string() | '_' | '$3',
longdesc = "" :: string() | '_',
- version = 0 :: integer(),
- module :: atom() | '_',
+ version = 0 :: integer(),
+ weight = 1 :: integer(),
+ module :: atom() | '_',
function :: atom() | '_',
args = [] :: [aterm()] | '_' | '$1' | '$2',
policy = restricted :: open | restricted | admin | user,
%% access is: [accessRuleName] or [{Module, AccessOption, DefaultAccessRuleName}]
access = [] :: [{atom(),atom(),atom()}|atom()],
result = {res, rescode} :: rterm() | '_' | '$2',
+ args_rename = [] :: [{atom(),atom()}],
args_desc = none :: none | [string()] | '_',
result_desc = none :: none | string() | '_',
args_example = none :: none | [any()] | '_',
diff --git a/include/ejabberd_config.hrl b/include/ejabberd_config.hrl
index 2d6889313..d83e07b3c 100644
--- a/include/ejabberd_config.hrl
+++ b/include/ejabberd_config.hrl
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
-%%% ejabberd, Copyright (C) 2002-2016 ProcessOne
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/include/ejabberd_ctl.hrl b/include/ejabberd_ctl.hrl
index 3951129e7..f11e22f3b 100644
--- a/include/ejabberd_ctl.hrl
+++ b/include/ejabberd_ctl.hrl
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
-%%% ejabberd, Copyright (C) 2002-2016 ProcessOne
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/include/ejabberd_http.hrl b/include/ejabberd_http.hrl
index 25209f76c..7c237a223 100644
--- a/include/ejabberd_http.hrl
+++ b/include/ejabberd_http.hrl
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
-%%% ejabberd, Copyright (C) 2002-2016 ProcessOne
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -23,7 +23,7 @@
path = [] :: [binary()],
q = [] :: [{binary() | nokey, binary()}],
us = {<<>>, <<>>} :: {binary(), binary()},
- auth :: {binary(), binary()} | {oauth, binary(), []} | undefined,
+ auth :: {binary(), binary()} | {oauth, binary(), []} | undefined | invalid,
lang = <<"">> :: binary(),
data = <<"">> :: binary(),
ip :: {inet:ip_address(), inet:port_number()},
@@ -31,7 +31,10 @@
port = 5280 :: inet:port_number(),
opts = [] :: list(),
tp = http :: protocol(),
- headers = [] :: [{atom() | binary(), binary()}]}).
+ headers = [] :: [{atom() | binary(), binary()}],
+ length = 0 :: non_neg_integer(),
+ sockmod :: gen_tcp | fast_tls,
+ socket :: inet:socket() | fast_tls:tls_socket()}).
-record(ws,
{socket :: inet:socket() | fast_tls:tls_socket(),
@@ -46,6 +49,6 @@
buf :: binary(),
http_opts = [] :: list()}).
--type method() :: 'GET' | 'HEAD' | 'DELETE' | 'OPTIONS' | 'PUT' | 'POST' | 'TRACE'.
+-type method() :: 'GET' | 'HEAD' | 'DELETE' | 'OPTIONS' | 'PUT' | 'POST' | 'TRACE' | 'PATCH'.
-type protocol() :: http | https.
-type http_request() :: #request{}.
diff --git a/include/ejabberd_oauth.hrl b/include/ejabberd_oauth.hrl
index 6b5a9bcc8..2daee39d9 100644
--- a/include/ejabberd_oauth.hrl
+++ b/include/ejabberd_oauth.hrl
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
-%%% ejabberd, Copyright (C) 2002-2016 ProcessOne
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -22,5 +22,12 @@
token = <<"">> :: binary() | '_',
us = {<<"">>, <<"">>} :: {binary(), binary()} | '_',
scope = [] :: [binary()] | '_',
- expire :: integer() | '$1'
+ expire :: integer() | '$1' | '_'
+ }).
+
+-record(oauth_client, {
+ client_id = <<"">> :: binary() | '_',
+ client_name = <<"">> :: binary() | '_',
+ grant_type :: password | implicit | '_',
+ options :: [any()] | '_'
}).
diff --git a/include/ejabberd_router.hrl b/include/ejabberd_router.hrl
new file mode 100644
index 000000000..060ab79a1
--- /dev/null
+++ b/include/ejabberd_router.hrl
@@ -0,0 +1,8 @@
+-define(ROUTES_CACHE, routes_cache).
+
+-type local_hint() :: integer() | {apply, atom(), atom()}.
+
+-record(route, {domain :: binary(),
+ server_host :: binary(),
+ pid :: undefined | pid(),
+ local_hint :: local_hint() | undefined}).
diff --git a/include/ejabberd_sm.hrl b/include/ejabberd_sm.hrl
index f86ab1c15..8e7b6c7f4 100644
--- a/include/ejabberd_sm.hrl
+++ b/include/ejabberd_sm.hrl
@@ -1,13 +1,36 @@
+%%%----------------------------------------------------------------------
+%%%
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
+%%%
+%%% 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.
+%%%
+%%% 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.
+%%%
+%%%----------------------------------------------------------------------
+
-ifndef(EJABBERD_SM_HRL).
-define(EJABBERD_SM_HRL, true).
+-define(SM_CACHE, sm_cache).
+
-record(session, {sid, usr, us, priority, info = []}).
-record(session_counter, {vhost, count}).
-type sid() :: {erlang:timestamp(), pid()}.
-type ip() :: {inet:ip_address(), inet:port_number()} | undefined.
-type info() :: [{conn, atom()} | {ip, ip()} | {node, atom()}
| {oor, boolean()} | {auth_module, atom()}
- | {num_stanzas_in, non_neg_integer()}].
+ | {num_stanzas_in, non_neg_integer()}
+ | {atom(), term()}].
-type prio() :: undefined | integer().
-endif.
diff --git a/include/ejabberd_sql.hrl b/include/ejabberd_sql.hrl
new file mode 100644
index 000000000..c3c618758
--- /dev/null
+++ b/include/ejabberd_sql.hrl
@@ -0,0 +1,41 @@
+%%%----------------------------------------------------------------------
+%%%
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
+%%%
+%%% 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.
+%%%
+%%% 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.
+%%%
+%%%----------------------------------------------------------------------
+-define(SQL_MARK, sql__mark_).
+-define(SQL(SQL), ?SQL_MARK(SQL)).
+
+-define(SQL_UPSERT_MARK, sql_upsert__mark_).
+-define(SQL_UPSERT(Host, Table, Fields),
+ ejabberd_sql:sql_query(Host, ?SQL_UPSERT_MARK(Table, Fields))).
+-define(SQL_UPSERT_T(Table, Fields),
+ ejabberd_sql:sql_query_t(?SQL_UPSERT_MARK(Table, Fields))).
+
+-define(SQL_INSERT_MARK, sql_insert__mark_).
+-define(SQL_INSERT(Table, Fields), ?SQL_INSERT_MARK(Table, Fields)).
+
+-record(sql_query, {hash :: binary(),
+ format_query :: fun(),
+ format_res :: fun(),
+ args :: fun(),
+ loc :: {module(), pos_integer()}}).
+
+-record(sql_escape, {string :: fun((binary()) -> binary()),
+ integer :: fun((integer()) -> binary()),
+ boolean :: fun((boolean()) -> binary()),
+ in_array_string :: fun((binary()) -> binary())}).
diff --git a/include/ejabberd_sql_pt.hrl b/include/ejabberd_sql_pt.hrl
index f1a3dba3f..54330bc46 100644
--- a/include/ejabberd_sql_pt.hrl
+++ b/include/ejabberd_sql_pt.hrl
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
-%%% ejabberd, Copyright (C) 2002-2016 ProcessOne
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -17,17 +17,5 @@
%%% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
%%%
%%%----------------------------------------------------------------------
-
--define(SQL_MARK, sql__mark_).
--define(SQL(SQL), ?SQL_MARK(SQL)).
-
--define(SQL_UPSERT_MARK, sql_upsert__mark_).
--define(SQL_UPSERT(Host, Table, Fields),
- ejabberd_sql:sql_query(Host, ?SQL_UPSERT_MARK(Table, Fields))).
--define(SQL_UPSERT_T(Table, Fields),
- ejabberd_sql:sql_query_t(?SQL_UPSERT_MARK(Table, Fields))).
-
--record(sql_query, {hash, format_query, format_res, args, loc}).
-
--record(sql_escape, {string, integer, boolean}).
-
+-compile([{parse_transform, ejabberd_sql_pt}]).
+-include("ejabberd_sql.hrl").
diff --git a/include/ejabberd_stacktrace.hrl b/include/ejabberd_stacktrace.hrl
new file mode 100644
index 000000000..4fdec33ea
--- /dev/null
+++ b/include/ejabberd_stacktrace.hrl
@@ -0,0 +1,27 @@
+%%%----------------------------------------------------------------------
+%%%
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
+%%%
+%%% 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.
+%%%
+%%% 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.
+%%%
+%%%----------------------------------------------------------------------
+
+-ifdef(DEPRECATED_GET_STACKTRACE).
+-define(EX_RULE(Class, Reason, Stack), Class:Reason:Stack).
+-define(EX_STACK(Stack), Stack).
+-else.
+-define(EX_RULE(Class, Reason, _), Class:Reason).
+-define(EX_STACK(_), erlang:get_stacktrace()).
+-endif.
diff --git a/include/ejabberd_web_admin.hrl b/include/ejabberd_web_admin.hrl
index 33ff3a451..731087054 100644
--- a/include/ejabberd_web_admin.hrl
+++ b/include/ejabberd_web_admin.hrl
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
-%%% ejabberd, Copyright (C) 2002-2016 ProcessOne
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -37,14 +37,12 @@
-define(XAC(Name, Attrs, Text),
?XAE(Name, Attrs, [?C(Text)])).
--define(T(Text), translate:translate(Lang, Text)).
+-define(CT(Text), ?C((translate:translate(Lang, Text)))).
--define(CT(Text), ?C((?T(Text)))).
-
--define(XCT(Name, Text), ?XC(Name, (?T(Text)))).
+-define(XCT(Name, Text), ?XC(Name, (translate:translate(Lang, Text)))).
-define(XACT(Name, Attrs, Text),
- ?XAC(Name, Attrs, (?T(Text)))).
+ ?XAC(Name, Attrs, (translate:translate(Lang, Text)))).
-define(LI(Els), ?XE(<<"li">>, Els)).
@@ -53,7 +51,7 @@
-define(AC(URL, Text), ?A(URL, [?C(Text)])).
--define(ACT(URL, Text), ?AC(URL, (?T(Text)))).
+-define(ACT(URL, Text), ?AC(URL, (translate:translate(Lang, Text)))).
-define(P, ?X(<<"p">>)).
@@ -65,7 +63,7 @@
{<<"value">>, Value}])).
-define(INPUTT(Type, Name, Value),
- ?INPUT(Type, Name, (?T(Value)))).
+ ?INPUT(Type, Name, (translate:translate(Lang, Value)))).
-define(INPUTS(Type, Name, Value, Size),
?XA(<<"input">>,
@@ -73,7 +71,7 @@
{<<"value">>, Value}, {<<"size">>, Size}])).
-define(INPUTST(Type, Name, Value, Size),
- ?INPUT(Type, Name, (?T(Value)), Size)).
+ ?INPUT(Type, Name, (translate:translate(Lang, Value)), Size)).
-define(ACLINPUT(Text),
?XE(<<"td">>,
@@ -90,12 +88,12 @@
?XAC(<<"p">>, [{<<"class">>, <<"result">>}], Text)).
%% Guide Link
--define(XREST(Text), ?XRES((?T(Text)))).
+-define(XREST(Text), ?XRES((translate:translate(Lang, Text)))).
-define(GL(Ref, Title),
?XAE(<<"div">>, [{<<"class">>, <<"guidelink">>}],
[?XAE(<<"a">>,
- [{<<"href">>, <<"/admin/doc/guide.html#", Ref/binary>>},
+ [{<<"href">>, <<"https://docs.ejabberd.im/admin/configuration/#", Ref/binary>>},
{<<"target">>, <<"_blank">>}],
[?C(<<"[Guide: ", Title/binary, "]">>)])])).
diff --git a/include/eldap.hrl b/include/eldap.hrl
index 6dfc894a8..be1d53d6b 100644
--- a/include/eldap.hrl
+++ b/include/eldap.hrl
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
-%%% ejabberd, Copyright (C) 2002-2016 ProcessOne
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -27,7 +27,7 @@
-record(eldap_search,
{scope = wholeSubtree :: scope(),
base = <<"">> :: binary(),
- filter :: eldap:filter(),
+ filter :: eldap:filter() | undefined,
limit = 0 :: non_neg_integer(),
attributes = [] :: [binary()],
types_only = false :: boolean(),
@@ -44,6 +44,7 @@
attributes = [] :: [{binary(), [binary()]}]}).
-type tlsopts() :: [{encrypt, tls | starttls | none} |
+ {tls_certfile, binary() | undefined} |
{tls_cacertfile, binary() | undefined} |
{tls_depth, non_neg_integer() | undefined} |
{tls_verify, hard | soft | false}].
@@ -61,3 +62,18 @@
-type eldap_config() :: #eldap_config{}.
-type eldap_search() :: #eldap_search{}.
-type eldap_entry() :: #eldap_entry{}.
+
+-define(eldap_config(M, H),
+ #eldap_config{
+ servers = M:ldap_servers(H),
+ backups = M:ldap_backups(H),
+ tls_options = [{encrypt, M:ldap_encrypt(H)},
+ {tls_verify, M:ldap_tls_verify(H)},
+ {tls_certfile, M:ldap_tls_certfile(H)},
+ {tls_cacertfile, M:ldap_tls_cacertfile(H)},
+ {tls_depth, M:ldap_tls_depth(H)}],
+ port = M:ldap_port(H),
+ dn = M:ldap_rootdn(H),
+ password = M:ldap_password(H),
+ base = M:ldap_base(H),
+ deref_aliases = M:ldap_deref_aliases(H)}).
diff --git a/include/http_bind.hrl b/include/http_bind.hrl
index cd8512f0e..457480c22 100644
--- a/include/http_bind.hrl
+++ b/include/http_bind.hrl
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
-%%% ejabberd, Copyright (C) 2002-2016 ProcessOne
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/include/jlib.hrl b/include/jlib.hrl
deleted file mode 100644
index 50a031334..000000000
--- a/include/jlib.hrl
+++ /dev/null
@@ -1,505 +0,0 @@
-%%%----------------------------------------------------------------------
-%%%
-%%% ejabberd, Copyright (C) 2002-2016 ProcessOne
-%%%
-%%% 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.
-%%%
-%%% 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.
-%%%
-%%%----------------------------------------------------------------------
-
--include("ns.hrl").
--ifdef(NO_EXT_LIB).
--include("fxml.hrl").
--else.
--include_lib("fast_xml/include/fxml.hrl").
--endif.
-
--define(STANZA_ERROR(Code, Type, Condition),
- #xmlel{name = <<"error">>,
- attrs = [{<<"code">>, Code}, {<<"type">>, Type}],
- children =
- [#xmlel{name = Condition,
- attrs = [{<<"xmlns">>, ?NS_STANZAS}],
- children = []}]}).
-
--define(ERR_BAD_FORMAT,
- ?STANZA_ERROR(<<"406">>, <<"modify">>,
- <<"bad-format">>)).
-
--define(ERR_BAD_REQUEST,
- ?STANZA_ERROR(<<"400">>, <<"modify">>,
- <<"bad-request">>)).
-
--define(ERR_CONFLICT,
- ?STANZA_ERROR(<<"409">>, <<"cancel">>, <<"conflict">>)).
-
--define(ERR_FEATURE_NOT_IMPLEMENTED,
- ?STANZA_ERROR(<<"501">>, <<"cancel">>,
- <<"feature-not-implemented">>)).
-
--define(ERR_FORBIDDEN,
- ?STANZA_ERROR(<<"403">>, <<"auth">>, <<"forbidden">>)).
-
--define(ERR_GONE,
- ?STANZA_ERROR(<<"302">>, <<"modify">>, <<"gone">>)).
-
--define(ERR_INTERNAL_SERVER_ERROR,
- ?STANZA_ERROR(<<"500">>, <<"wait">>,
- <<"internal-server-error">>)).
-
--define(ERR_ITEM_NOT_FOUND,
- ?STANZA_ERROR(<<"404">>, <<"cancel">>,
- <<"item-not-found">>)).
-
--define(ERR_JID_MALFORMED,
- ?STANZA_ERROR(<<"400">>, <<"modify">>,
- <<"jid-malformed">>)).
-
--define(ERR_NOT_ACCEPTABLE,
- ?STANZA_ERROR(<<"406">>, <<"modify">>,
- <<"not-acceptable">>)).
-
--define(ERR_NOT_ALLOWED,
- ?STANZA_ERROR(<<"405">>, <<"cancel">>,
- <<"not-allowed">>)).
-
--define(ERR_NOT_AUTHORIZED,
- ?STANZA_ERROR(<<"401">>, <<"auth">>,
- <<"not-authorized">>)).
-
--define(ERR_PAYMENT_REQUIRED,
- ?STANZA_ERROR(<<"402">>, <<"auth">>,
- <<"payment-required">>)).
-
--define(ERR_RECIPIENT_UNAVAILABLE,
- ?STANZA_ERROR(<<"404">>, <<"wait">>,
- <<"recipient-unavailable">>)).
-
--define(ERR_REDIRECT,
- ?STANZA_ERROR(<<"302">>, <<"modify">>, <<"redirect">>)).
-
--define(ERR_REGISTRATION_REQUIRED,
- ?STANZA_ERROR(<<"407">>, <<"auth">>,
- <<"registration-required">>)).
-
--define(ERR_REMOTE_SERVER_NOT_FOUND,
- ?STANZA_ERROR(<<"404">>, <<"cancel">>,
- <<"remote-server-not-found">>)).
-
--define(ERR_REMOTE_SERVER_TIMEOUT,
- ?STANZA_ERROR(<<"504">>, <<"wait">>,
- <<"remote-server-timeout">>)).
-
--define(ERR_RESOURCE_CONSTRAINT,
- ?STANZA_ERROR(<<"500">>, <<"wait">>,
- <<"resource-constraint">>)).
-
--define(ERR_SERVICE_UNAVAILABLE,
- ?STANZA_ERROR(<<"503">>, <<"cancel">>,
- <<"service-unavailable">>)).
-
--define(ERR_SUBSCRIPTION_REQUIRED,
- ?STANZA_ERROR(<<"407">>, <<"auth">>,
- <<"subscription-required">>)).
-
--define(ERR_UNEXPECTED_REQUEST,
- ?STANZA_ERROR(<<"400">>, <<"wait">>,
- <<"unexpected-request">>)).
-
--define(ERR_UNEXPECTED_REQUEST_CANCEL,
- ?STANZA_ERROR(<<"401">>, <<"cancel">>,
- <<"unexpected-request">>)).
-
-%-define(ERR_,
-% ?STANZA_ERROR("", "", "")).
-
--define(STANZA_ERRORT(Code, Type, Condition, Lang,
- Text),
- #xmlel{name = <<"error">>,
- attrs = [{<<"code">>, Code}, {<<"type">>, Type}],
- children =
- [#xmlel{name = Condition,
- attrs = [{<<"xmlns">>, ?NS_STANZAS}], children = []},
- #xmlel{name = <<"text">>,
- attrs = [{<<"xmlns">>, ?NS_STANZAS}],
- children =
- [{xmlcdata,
- translate:translate(Lang, Text)}]}]}).
-
--define(ERRT_BAD_FORMAT(Lang, Text),
- ?STANZA_ERRORT(<<"406">>, <<"modify">>,
- <<"bad-format">>, Lang, Text)).
-
--define(ERRT_BAD_REQUEST(Lang, Text),
- ?STANZA_ERRORT(<<"400">>, <<"modify">>,
- <<"bad-request">>, Lang, Text)).
-
--define(ERRT_CONFLICT(Lang, Text),
- ?STANZA_ERRORT(<<"409">>, <<"cancel">>, <<"conflict">>,
- Lang, Text)).
-
--define(ERRT_FEATURE_NOT_IMPLEMENTED(Lang, Text),
- ?STANZA_ERRORT(<<"501">>, <<"cancel">>,
- <<"feature-not-implemented">>, Lang, Text)).
-
--define(ERRT_FORBIDDEN(Lang, Text),
- ?STANZA_ERRORT(<<"403">>, <<"auth">>, <<"forbidden">>,
- Lang, Text)).
-
--define(ERRT_GONE(Lang, Text),
- ?STANZA_ERRORT(<<"302">>, <<"modify">>, <<"gone">>,
- Lang, Text)).
-
--define(ERRT_INTERNAL_SERVER_ERROR(Lang, Text),
- ?STANZA_ERRORT(<<"500">>, <<"wait">>,
- <<"internal-server-error">>, Lang, Text)).
-
--define(ERRT_ITEM_NOT_FOUND(Lang, Text),
- ?STANZA_ERRORT(<<"404">>, <<"cancel">>,
- <<"item-not-found">>, Lang, Text)).
-
--define(ERRT_JID_MALFORMED(Lang, Text),
- ?STANZA_ERRORT(<<"400">>, <<"modify">>,
- <<"jid-malformed">>, Lang, Text)).
-
--define(ERRT_NOT_ACCEPTABLE(Lang, Text),
- ?STANZA_ERRORT(<<"406">>, <<"modify">>,
- <<"not-acceptable">>, Lang, Text)).
-
--define(ERRT_NOT_ALLOWED(Lang, Text),
- ?STANZA_ERRORT(<<"405">>, <<"cancel">>,
- <<"not-allowed">>, Lang, Text)).
-
--define(ERRT_NOT_AUTHORIZED(Lang, Text),
- ?STANZA_ERRORT(<<"401">>, <<"auth">>,
- <<"not-authorized">>, Lang, Text)).
-
--define(ERRT_PAYMENT_REQUIRED(Lang, Text),
- ?STANZA_ERRORT(<<"402">>, <<"auth">>,
- <<"payment-required">>, Lang, Text)).
-
--define(ERRT_RECIPIENT_UNAVAILABLE(Lang, Text),
- ?STANZA_ERRORT(<<"404">>, <<"wait">>,
- <<"recipient-unavailable">>, Lang, Text)).
-
--define(ERRT_REDIRECT(Lang, Text),
- ?STANZA_ERRORT(<<"302">>, <<"modify">>, <<"redirect">>,
- Lang, Text)).
-
--define(ERRT_REGISTRATION_REQUIRED(Lang, Text),
- ?STANZA_ERRORT(<<"407">>, <<"auth">>,
- <<"registration-required">>, Lang, Text)).
-
--define(ERRT_REMOTE_SERVER_NOT_FOUND(Lang, Text),
- ?STANZA_ERRORT(<<"404">>, <<"cancel">>,
- <<"remote-server-not-found">>, Lang, Text)).
-
--define(ERRT_REMOTE_SERVER_TIMEOUT(Lang, Text),
- ?STANZA_ERRORT(<<"504">>, <<"wait">>,
- <<"remote-server-timeout">>, Lang, Text)).
-
--define(ERRT_RESOURCE_CONSTRAINT(Lang, Text),
- ?STANZA_ERRORT(<<"500">>, <<"wait">>,
- <<"resource-constraint">>, Lang, Text)).
-
--define(ERRT_SERVICE_UNAVAILABLE(Lang, Text),
- ?STANZA_ERRORT(<<"503">>, <<"cancel">>,
- <<"service-unavailable">>, Lang, Text)).
-
--define(ERRT_SUBSCRIPTION_REQUIRED(Lang, Text),
- ?STANZA_ERRORT(<<"407">>, <<"auth">>,
- <<"subscription-required">>, Lang, Text)).
-
--define(ERRT_UNEXPECTED_REQUEST(Lang, Text),
- ?STANZA_ERRORT(<<"400">>, <<"wait">>,
- <<"unexpected-request">>, Lang, Text)).
-
--define(ERR_AUTH_NO_RESOURCE_PROVIDED(Lang),
- ?ERRT_NOT_ACCEPTABLE(Lang, <<"No resource provided">>)).
-
--define(ERR_AUTH_BAD_RESOURCE_FORMAT(Lang),
- ?ERRT_NOT_ACCEPTABLE(Lang,
- <<"Illegal resource format">>)).
-
--define(ERR_AUTH_RESOURCE_CONFLICT(Lang),
- ?ERRT_CONFLICT(Lang, <<"Resource conflict">>)).
-
--define(STREAM_ERROR(Condition, Cdata),
- #xmlel{name = <<"stream:error">>, attrs = [],
- children =
- [#xmlel{name = Condition,
- attrs = [{<<"xmlns">>, ?NS_STREAMS}],
- children = [{xmlcdata, Cdata}]}]}).
-
--define(SERR_BAD_FORMAT,
- ?STREAM_ERROR(<<"bad-format">>, <<"">>)).
-
--define(SERR_BAD_NAMESPACE_PREFIX,
- ?STREAM_ERROR(<<"bad-namespace-prefix">>, <<"">>)).
-
--define(SERR_CONFLICT,
- ?STREAM_ERROR(<<"conflict">>, <<"">>)).
-
--define(SERR_CONNECTION_TIMEOUT,
- ?STREAM_ERROR(<<"connection-timeout">>, <<"">>)).
-
--define(SERR_HOST_GONE,
- ?STREAM_ERROR(<<"host-gone">>, <<"">>)).
-
--define(SERR_HOST_UNKNOWN,
- ?STREAM_ERROR(<<"host-unknown">>, <<"">>)).
-
--define(SERR_IMPROPER_ADDRESSING,
- ?STREAM_ERROR(<<"improper-addressing">>, <<"">>)).
-
--define(SERR_INTERNAL_SERVER_ERROR,
- ?STREAM_ERROR(<<"internal-server-error">>, <<"">>)).
-
--define(SERR_INVALID_FROM,
- ?STREAM_ERROR(<<"invalid-from">>, <<"">>)).
-
--define(SERR_INVALID_ID,
- ?STREAM_ERROR(<<"invalid-id">>, <<"">>)).
-
--define(SERR_INVALID_NAMESPACE,
- ?STREAM_ERROR(<<"invalid-namespace">>, <<"">>)).
-
--define(SERR_INVALID_XML,
- ?STREAM_ERROR(<<"invalid-xml">>, <<"">>)).
-
--define(SERR_NOT_AUTHORIZED,
- ?STREAM_ERROR(<<"not-authorized">>, <<"">>)).
-
--define(SERR_POLICY_VIOLATION,
- ?STREAM_ERROR(<<"policy-violation">>, <<"">>)).
-
--define(SERR_REMOTE_CONNECTION_FAILED,
- ?STREAM_ERROR(<<"remote-connection-failed">>, <<"">>)).
-
--define(SERR_RESOURSE_CONSTRAINT,
- ?STREAM_ERROR(<<"resource-constraint">>, <<"">>)).
-
--define(SERR_RESTRICTED_XML,
- ?STREAM_ERROR(<<"restricted-xml">>, <<"">>)).
-
--define(SERR_SEE_OTHER_HOST(Host),
- ?STREAM_ERROR(<<"see-other-host">>, Host)).
-
--define(SERR_SYSTEM_SHUTDOWN,
- ?STREAM_ERROR(<<"system-shutdown">>, <<"">>)).
-
--define(SERR_UNSUPPORTED_ENCODING,
- ?STREAM_ERROR(<<"unsupported-encoding">>, <<"">>)).
-
--define(SERR_UNSUPPORTED_STANZA_TYPE,
- ?STREAM_ERROR(<<"unsupported-stanza-type">>, <<"">>)).
-
--define(SERR_UNSUPPORTED_VERSION,
- ?STREAM_ERROR(<<"unsupported-version">>, <<"">>)).
-
--define(SERR_XML_NOT_WELL_FORMED,
- ?STREAM_ERROR(<<"xml-not-well-formed">>, <<"">>)).
-
-%-define(SERR_,
-% ?STREAM_ERROR("", "")).
-
--define(STREAM_ERRORT(Condition, Cdata, Lang, Text),
- #xmlel{name = <<"stream:error">>, attrs = [],
- children =
- [#xmlel{name = Condition,
- attrs = [{<<"xmlns">>, ?NS_STREAMS}],
- children = [{xmlcdata, Cdata}]},
- #xmlel{name = <<"text">>,
- attrs =
- [{<<"xml:lang">>, Lang},
- {<<"xmlns">>, ?NS_STREAMS}],
- children =
- [{xmlcdata,
- translate:translate(Lang, Text)}]}]}).
-
--define(SERRT_BAD_FORMAT(Lang, Text),
- ?STREAM_ERRORT(<<"bad-format">>, <<"">>, Lang, Text)).
-
--define(SERRT_BAD_NAMESPACE_PREFIX(Lang, Text),
- ?STREAM_ERRORT(<<"bad-namespace-prefix">>, <<"">>, Lang,
- Text)).
-
--define(SERRT_CONFLICT(Lang, Text),
- ?STREAM_ERRORT(<<"conflict">>, <<"">>, Lang, Text)).
-
--define(SERRT_CONNECTION_TIMEOUT(Lang, Text),
- ?STREAM_ERRORT(<<"connection-timeout">>, <<"">>, Lang,
- Text)).
-
--define(SERRT_HOST_GONE(Lang, Text),
- ?STREAM_ERRORT(<<"host-gone">>, <<"">>, Lang, Text)).
-
--define(SERRT_HOST_UNKNOWN(Lang, Text),
- ?STREAM_ERRORT(<<"host-unknown">>, <<"">>, Lang, Text)).
-
--define(SERRT_IMPROPER_ADDRESSING(Lang, Text),
- ?STREAM_ERRORT(<<"improper-addressing">>, <<"">>, Lang,
- Text)).
-
--define(SERRT_INTERNAL_SERVER_ERROR(Lang, Text),
- ?STREAM_ERRORT(<<"internal-server-error">>, <<"">>,
- Lang, Text)).
-
--define(SERRT_INVALID_FROM(Lang, Text),
- ?STREAM_ERRORT(<<"invalid-from">>, <<"">>, Lang, Text)).
-
--define(SERRT_INVALID_ID(Lang, Text),
- ?STREAM_ERRORT(<<"invalid-id">>, <<"">>, Lang, Text)).
-
--define(SERRT_INVALID_NAMESPACE(Lang, Text),
- ?STREAM_ERRORT(<<"invalid-namespace">>, <<"">>, Lang,
- Text)).
-
--define(SERRT_INVALID_XML(Lang, Text),
- ?STREAM_ERRORT(<<"invalid-xml">>, <<"">>, Lang, Text)).
-
--define(SERRT_NOT_AUTHORIZED(Lang, Text),
- ?STREAM_ERRORT(<<"not-authorized">>, <<"">>, Lang,
- Text)).
-
--define(SERRT_POLICY_VIOLATION(Lang, Text),
- ?STREAM_ERRORT(<<"policy-violation">>, <<"">>, Lang,
- Text)).
-
--define(SERRT_REMOTE_CONNECTION_FAILED(Lang, Text),
- ?STREAM_ERRORT(<<"remote-connection-failed">>, <<"">>,
- Lang, Text)).
-
--define(SERRT_RESOURSE_CONSTRAINT(Lang, Text),
- ?STREAM_ERRORT(<<"resource-constraint">>, <<"">>, Lang,
- Text)).
-
--define(SERRT_RESTRICTED_XML(Lang, Text),
- ?STREAM_ERRORT(<<"restricted-xml">>, <<"">>, Lang,
- Text)).
-
--define(SERRT_SEE_OTHER_HOST(Host, Lang, Text),
- ?STREAM_ERRORT(<<"see-other-host">>, Host, Lang, Text)).
-
--define(SERRT_SYSTEM_SHUTDOWN(Lang, Text),
- ?STREAM_ERRORT(<<"system-shutdown">>, <<"">>, Lang,
- Text)).
-
--define(SERRT_UNSUPPORTED_ENCODING(Lang, Text),
- ?STREAM_ERRORT(<<"unsupported-encoding">>, <<"">>, Lang,
- Text)).
-
--define(SERRT_UNSUPPORTED_STANZA_TYPE(Lang, Text),
- ?STREAM_ERRORT(<<"unsupported-stanza-type">>, <<"">>,
- Lang, Text)).
-
--define(SERRT_UNSUPPORTED_VERSION(Lang, Text),
- ?STREAM_ERRORT(<<"unsupported-version">>, <<"">>, Lang,
- Text)).
-
--define(SERRT_XML_NOT_WELL_FORMED(Lang, Text),
- ?STREAM_ERRORT(<<"xml-not-well-formed">>, <<"">>, Lang,
- Text)).
-
--record(jid, {user = <<"">> :: binary(),
- server = <<"">> :: binary(),
- resource = <<"">> :: binary(),
- luser = <<"">> :: binary(),
- lserver = <<"">> :: binary(),
- lresource = <<"">> :: binary()}).
-
--type(jid() :: #jid{}).
-
--type(ljid() :: {binary(), binary(), binary()}).
-
--record(iq, {id = <<"">> :: binary(),
- type = get :: get | set | result | error,
- xmlns = <<"">> :: binary(),
- lang = <<"">> :: binary(),
- sub_el = #xmlel{} :: xmlel() | [xmlel()]}).
-
--type(iq_get()
- :: #iq{
- id :: binary(),
- type :: get,
- xmlns :: binary(),
- lang :: binary(),
- sub_el :: xmlel()
- }
-).
-
--type(iq_set()
- :: #iq{
- id :: binary(),
- type :: set,
- xmlns :: binary(),
- lang :: binary(),
- sub_el :: xmlel()
- }
-).
-
--type iq_request() :: iq_get() | iq_set().
-
--type(iq_result()
- :: #iq{
- id :: binary(),
- type :: result,
- xmlns :: binary(),
- lang :: binary(),
- sub_el :: [xmlel()]
- }
-).
-
--type(iq_error()
- :: #iq{
- id :: binary(),
- type :: error,
- xmlns :: binary(),
- lang :: binary(),
- sub_el :: [xmlel()]
- }
-).
-
--type iq_reply() :: iq_result() | iq_error() .
-
--type(iq() :: iq_request() | iq_reply()).
-
--record(rsm_in, {max :: integer() | error,
- direction :: before | aft,
- id :: binary(),
- index :: integer() | error}).
-
--record(rsm_out, {count :: integer(),
- index :: integer(),
- first :: binary(),
- last :: binary()}).
-
--type(rsm_in() :: #rsm_in{}).
-
--type(rsm_out() :: #rsm_out{}).
-
--type broadcast() :: {broadcast, broadcast_data()}.
-
--type broadcast_data() ::
- {rebind, pid(), binary()} | %% ejabberd_c2s
- {item, ljid(), mod_roster:subscription()} | %% mod_roster/mod_shared_roster
- {exit, binary()} | %% mod_roster/mod_shared_roster
- {privacy_list, mod_privacy:userlist(), binary()} | %% mod_privacy
- {blocking, unblock_all | {block | unblock, [ljid()]}}. %% mod_blocking
-
--record(xmlelement, {name = "" :: string(),
- attrs = [] :: [{string(), string()}],
- children = [] :: [{xmlcdata, iodata()} | xmlelement()]}).
-
--type xmlelement() :: #xmlelement{}.
diff --git a/include/logger.hrl b/include/logger.hrl
index df0776863..eace910dd 100644
--- a/include/logger.hrl
+++ b/include/logger.hrl
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
-%%% ejabberd, Copyright (C) 2002-2016 ProcessOne
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -18,22 +18,42 @@
%%%
%%%----------------------------------------------------------------------
-define(PRINT(Format, Args), io:format(Format, Args)).
+
+-ifdef(LAGER).
-compile([{parse_transform, lager_transform}]).
-define(DEBUG(Format, Args),
- lager:debug(Format, Args)).
+ begin lager:debug(Format, Args), ok end).
+
+-define(INFO_MSG(Format, Args),
+ begin lager:info(Format, Args), ok end).
+
+-define(WARNING_MSG(Format, Args),
+ begin lager:warning(Format, Args), ok end).
+
+-define(ERROR_MSG(Format, Args),
+ begin lager:error(Format, Args), ok end).
+
+-define(CRITICAL_MSG(Format, Args),
+ begin lager:critical(Format, Args), ok end).
+-else.
+-include_lib("kernel/include/logger.hrl").
+
+-define(DEBUG(Format, Args),
+ begin ?LOG_DEBUG(Format, Args), ok end).
-define(INFO_MSG(Format, Args),
- lager:info(Format, Args)).
+ begin ?LOG_INFO(Format, Args), ok end).
-define(WARNING_MSG(Format, Args),
- lager:warning(Format, Args)).
+ begin ?LOG_WARNING(Format, Args), ok end).
-define(ERROR_MSG(Format, Args),
- lager:error(Format, Args)).
+ begin ?LOG_ERROR(Format, Args), ok end).
-define(CRITICAL_MSG(Format, Args),
- lager:critical(Format, Args)).
+ begin ?LOG_CRITICAL(Format, Args), ok end).
+-endif.
%% Use only when trying to troubleshoot test problem with ExUnit
-define(EXUNIT_LOG(Format, Args),
@@ -41,3 +61,6 @@
false -> ok;
_ -> 'Elixir.Logger':bare_log(error, io_lib:format(Format, Args), [?MODULE])
end).
+
+%% Uncomment if you want to debug p1_fsm/gen_fsm
+%%-define(DBGFSM, true).
diff --git a/include/mod_announce.hrl b/include/mod_announce.hrl
index 83d72aaf1..5f716655d 100644
--- a/include/mod_announce.hrl
+++ b/include/mod_announce.hrl
@@ -1,3 +1,23 @@
+%%%----------------------------------------------------------------------
+%%%
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
+%%%
+%%% 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.
+%%%
+%%% 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.
+%%%
+%%%----------------------------------------------------------------------
+
-record(motd, {server = <<"">> :: binary(),
packet = #xmlel{} :: xmlel()}).
diff --git a/include/mod_caps.hrl b/include/mod_caps.hrl
index 067df9490..22dd23b7e 100644
--- a/include/mod_caps.hrl
+++ b/include/mod_caps.hrl
@@ -1,3 +1,23 @@
+%%%----------------------------------------------------------------------
+%%%
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
+%%%
+%%% 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.
+%%%
+%%% 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.
+%%%
+%%%----------------------------------------------------------------------
+
-record(caps_features,
{node_pair = {<<"">>, <<"">>} :: {binary(), binary()},
features = [] :: [binary()] | pos_integer()
diff --git a/include/mod_carboncopy.hrl b/include/mod_carboncopy.hrl
deleted file mode 100644
index df69938e8..000000000
--- a/include/mod_carboncopy.hrl
+++ /dev/null
@@ -1,4 +0,0 @@
--type matchspec_atom() :: '_' | '$1' | '$2' | '$3'.
--record(carboncopy, {us :: {binary(), binary()} | matchspec_atom(),
- resource :: binary() | matchspec_atom(),
- version :: binary() | matchspec_atom()}).
diff --git a/include/mod_irc.hrl b/include/mod_irc.hrl
deleted file mode 100644
index b9696a88b..000000000
--- a/include/mod_irc.hrl
+++ /dev/null
@@ -1,15 +0,0 @@
--type conn_param() :: {binary(), binary(), inet:port_number(), binary()} |
- {binary(), binary(), inet:port_number()} |
- {binary(), binary()} |
- {binary()}.
-
--type irc_data() :: [{username, binary()} | {connections_params, [conn_param()]}].
-
--record(irc_connection,
- {jid_server_host = {#jid{}, <<"">>, <<"">>} :: {jid(), binary(), binary()},
- pid = self() :: pid()}).
-
--record(irc_custom,
- {us_host = {{<<"">>, <<"">>}, <<"">>} :: {{binary(), binary()},
- binary()},
- data = [] :: irc_data()}).
diff --git a/include/mod_last.hrl b/include/mod_last.hrl
index 494bf7b0c..8bfec3edd 100644
--- a/include/mod_last.hrl
+++ b/include/mod_last.hrl
@@ -1,3 +1,23 @@
+%%%----------------------------------------------------------------------
+%%%
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
+%%%
+%%% 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.
+%%%
+%%% 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.
+%%%
+%%%----------------------------------------------------------------------
+
-record(last_activity, {us = {<<"">>, <<"">>} :: {binary(), binary()},
timestamp = 0 :: non_neg_integer(),
status = <<"">> :: binary()}).
diff --git a/include/mod_mam.hrl b/include/mod_mam.hrl
index 463db4cff..6ed6f84bf 100644
--- a/include/mod_mam.hrl
+++ b/include/mod_mam.hrl
@@ -1,10 +1,30 @@
+%%%----------------------------------------------------------------------
+%%%
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
+%%%
+%%% 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.
+%%%
+%%% 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.
+%%%
+%%%----------------------------------------------------------------------
+
-record(archive_msg,
- {us = {<<"">>, <<"">>} :: {binary(), binary()} | '$2',
- id = <<>> :: binary() | '_',
- timestamp = p1_time_compat:timestamp() :: erlang:timestamp() | '_' | '$1',
- peer = {<<"">>, <<"">>, <<"">>} :: ljid() | '_' | '$3' | undefined,
- bare_peer = {<<"">>, <<"">>, <<"">>} :: ljid() | '_' | '$3',
- packet = #xmlel{} :: xmlel() | '_',
+ {us = {<<"">>, <<"">>} :: {binary(), binary()},
+ id = <<>> :: binary(),
+ timestamp = erlang:timestamp() :: erlang:timestamp(),
+ peer = {<<"">>, <<"">>, <<"">>} :: ljid() | undefined,
+ bare_peer = {<<"">>, <<"">>, <<"">>} :: ljid(),
+ packet = #xmlel{} :: xmlel() | message(),
nick = <<"">> :: binary(),
type = chat :: chat | groupchat}).
diff --git a/include/mod_muc.hrl b/include/mod_muc.hrl
index 8d0c1b09d..028662fe0 100644
--- a/include/mod_muc.hrl
+++ b/include/mod_muc.hrl
@@ -1,7 +1,6 @@
%%%----------------------------------------------------------------------
-%%% File : mod_muc.hrl
%%%
-%%% ejabberd, Copyright (C) 2002-2016 ProcessOne
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -23,11 +22,15 @@
{'_', binary()},
opts = [] :: list() | '_'}).
--record(muc_online_room,
- {name_host = {<<"">>, <<"">>} :: {binary(), binary()} | '$1' |
- {'_', binary()} | '_',
- pid = self() :: pid() | '$2' | '_' | '$1'}).
-
-record(muc_registered,
{us_host = {{<<"">>, <<"">>}, <<"">>} :: {{binary(), binary()}, binary()} | '$1',
nick = <<"">> :: binary()}).
+
+-record(muc_online_room,
+ {name_host :: {binary(), binary()} | '$1' | {'_', binary()} | '_',
+ pid :: pid() | '$2' | '_' | '$1'}).
+
+-record(muc_online_users, {us :: {binary(), binary()},
+ resource :: binary() | '_',
+ room :: binary() | '_' | '$1',
+ host :: binary() | '_' | '$2'}).
diff --git a/include/mod_muc_room.hrl b/include/mod_muc_room.hrl
index d985f3f3b..c987b9e2a 100644
--- a/include/mod_muc_room.hrl
+++ b/include/mod_muc_room.hrl
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
-%%% ejabberd, Copyright (C) 2002-2016 ProcessOne
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -18,22 +18,19 @@
%%%
%%%----------------------------------------------------------------------
--include("ejabberd.hrl").
-
-define(MAX_USERS_DEFAULT, 200).
-define(SETS, gb_sets).
--define(DICT, dict).
-
-record(lqueue,
{
- queue :: ?TQUEUE,
- len :: integer(),
- max :: integer()
+ queue = p1_queue:new() :: p1_queue:queue(lqueue_elem()),
+ max = 0 :: integer()
}).
-type lqueue() :: #lqueue{}.
+-type lqueue_elem() :: {binary(), message(), boolean(),
+ erlang:timestamp(), non_neg_integer()}.
-record(config,
{
@@ -64,32 +61,40 @@
max_users = ?MAX_USERS_DEFAULT :: non_neg_integer() | none,
logging = false :: boolean(),
vcard = <<"">> :: binary(),
- captcha_whitelist = (?SETS):empty() :: ?TGB_SET,
- mam = false :: boolean()
+ vcard_xupdate = undefined :: undefined | external | binary(),
+ captcha_whitelist = (?SETS):empty() :: gb_sets:set(),
+ mam = false :: boolean(),
+ pubsub = <<"">> :: binary(),
+ lang = ejabberd_option:language() :: binary()
}).
-type config() :: #config{}.
-type role() :: moderator | participant | visitor | none.
+-type affiliation() :: admin | member | outcast | owner | none.
-record(user,
{
jid :: jid(),
nick :: binary(),
role :: role(),
- is_subscriber = false :: boolean(),
- subscriptions = [] :: [binary()],
- last_presence :: xmlel()
+ %%is_subscriber = false :: boolean(),
+ %%subscriptions = [] :: [binary()],
+ last_presence :: presence() | undefined
}).
+-record(subscriber, {jid :: jid(),
+ nick = <<>> :: binary(),
+ nodes = [] :: [binary()]}).
+
-record(activity,
{
message_time = 0 :: integer(),
presence_time = 0 :: integer(),
- message_shaper :: shaper:shaper(),
- presence_shaper :: shaper:shaper(),
- message :: xmlel(),
- presence :: {binary(), xmlel()}
+ message_shaper = none :: ejabberd_shaper:shaper(),
+ presence_shaper = none :: ejabberd_shaper:shaper(),
+ message :: message() | undefined,
+ presence :: {binary(), presence()} | undefined
}).
-record(state,
@@ -97,28 +102,29 @@
room = <<"">> :: binary(),
host = <<"">> :: binary(),
server_host = <<"">> :: binary(),
- access = {none,none,none,none} :: {atom(), atom(), atom(), atom()},
+ access = {none,none,none,none,none} :: {atom(), atom(), atom(), atom(), atom()},
jid = #jid{} :: jid(),
config = #config{} :: config(),
- users = (?DICT):new() :: ?TDICT,
+ users = #{} :: users(),
+ subscribers = #{} :: subscribers(),
+ subscriber_nicks = #{} :: subscriber_nicks(),
last_voice_request_time = treap:empty() :: treap:treap(),
- robots = (?DICT):new() :: ?TDICT,
- nicks = (?DICT):new() :: ?TDICT,
- affiliations = (?DICT):new() :: ?TDICT,
- history :: lqueue(),
- subject = <<"">> :: binary(),
+ robots = #{} :: robots(),
+ nicks = #{} :: nicks(),
+ affiliations = #{} :: affiliations(),
+ history = #lqueue{} :: lqueue(),
+ subject = [] :: [text()],
subject_author = <<"">> :: binary(),
- just_created = false :: boolean(),
+ just_created = erlang:system_time(microsecond) :: true | integer(),
activity = treap:empty() :: treap:treap(),
- room_shaper = none :: shaper:shaper(),
- room_queue = queue:new() :: ?TQUEUE
+ room_shaper = none :: ejabberd_shaper:shaper(),
+ room_queue :: p1_queue:queue({message | presence, jid()}) | undefined,
+ hibernate_timer = none :: reference() | none | hibernating
}).
--record(muc_online_users, {us = {<<>>, <<>>} :: {binary(), binary()},
- resource = <<>> :: binary() | '_',
- room = <<>> :: binary() | '_' | '$1',
- host = <<>> :: binary() | '_' | '$2'}).
-
--type muc_online_users() :: #muc_online_users{}.
-
--type muc_room_state() :: #state{}.
+-type users() :: #{ljid() => #user{}}.
+-type robots() :: #{jid() => {binary(), stanza()}}.
+-type nicks() :: #{binary() => [ljid()]}.
+-type affiliations() :: #{ljid() => affiliation() | {affiliation(), binary()}}.
+-type subscribers() :: #{ljid() => #subscriber{}}.
+-type subscriber_nicks() :: #{binary() => [ljid()]}.
diff --git a/include/mod_offline.hrl b/include/mod_offline.hrl
index c4c70604a..a705aabe2 100644
--- a/include/mod_offline.hrl
+++ b/include/mod_offline.hrl
@@ -1,10 +1,30 @@
+%%%----------------------------------------------------------------------
+%%%
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
+%%%
+%%% 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.
+%%%
+%%% 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.
+%%%
+%%%----------------------------------------------------------------------
+
-record(offline_msg,
{us = {<<"">>, <<"">>} :: {binary(), binary()},
- timestamp = now() :: erlang:timestamp() | '_',
- expire = now() :: erlang:timestamp() | never | '_',
+ timestamp :: erlang:timestamp() | '_' | undefined,
+ expire :: erlang:timestamp() | never | undefined | '_',
from = #jid{} :: jid() | '_',
to = #jid{} :: jid() | '_',
- packet = #xmlel{} :: xmlel() | '_'}).
+ packet = #xmlel{} :: xmlel() | message() | '_'}).
-record(state,
{host = <<"">> :: binary(),
diff --git a/include/mod_privacy.hrl b/include/mod_privacy.hrl
index 8fe5abcca..291970cce 100644
--- a/include/mod_privacy.hrl
+++ b/include/mod_privacy.hrl
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
-%%% ejabberd, Copyright (C) 2002-2016 ProcessOne
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -22,9 +22,11 @@
default = none :: none | binary(),
lists = [] :: [{binary(), [listitem()]}]}).
--record(listitem, {type = none :: none | jid | group | subscription,
- value = none :: none | both | from | to | ljid() | binary(),
- action = allow :: allow | deny,
+-type privacy() :: #privacy{}.
+
+-record(listitem, {type = none :: listitem_type(),
+ value = none :: listitem_value(),
+ action = allow :: listitem_action(),
order = 0 :: integer(),
match_all = false :: boolean(),
match_iq = false :: boolean(),
@@ -33,11 +35,6 @@
match_presence_out = false :: boolean()}).
-type listitem() :: #listitem{}.
-
--record(userlist, {name = none :: none | binary(),
- list = [] :: [listitem()],
- needdb = false :: boolean()}).
-
--type userlist() :: #userlist{}.
-
--export_type([userlist/0]).
+-type listitem_type() :: none | jid | group | subscription.
+-type listitem_value() :: none | both | from | to | jid:ljid() | binary().
+-type listitem_action() :: allow | deny.
diff --git a/include/mod_private.hrl b/include/mod_private.hrl
index d833af35f..4dddd29ed 100644
--- a/include/mod_private.hrl
+++ b/include/mod_private.hrl
@@ -1,3 +1,23 @@
+%%%----------------------------------------------------------------------
+%%%
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
+%%%
+%%% 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.
+%%%
+%%% 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.
+%%%
+%%%----------------------------------------------------------------------
+
-record(private_storage,
{usns = {<<"">>, <<"">>, <<"">>} :: {binary(), binary(), binary() |
'$1' | '_'},
diff --git a/include/mod_proxy65.hrl b/include/mod_proxy65.hrl
index 1d8ceb3c6..197d97d7f 100644
--- a/include/mod_proxy65.hrl
+++ b/include/mod_proxy65.hrl
@@ -2,7 +2,7 @@
%%% RFC 1928 constants.
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2016 ProcessOne
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/include/mod_push.hrl b/include/mod_push.hrl
new file mode 100644
index 000000000..cdd5b0cf6
--- /dev/null
+++ b/include/mod_push.hrl
@@ -0,0 +1,24 @@
+%%%----------------------------------------------------------------------
+%%% ejabberd, Copyright (C) 2017-2019 ProcessOne
+%%%
+%%% 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.
+%%%
+%%% 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.
+%%%
+%%%----------------------------------------------------------------------
+-record(push_session,
+ {us = {<<"">>, <<"">>} :: {binary(), binary()},
+ timestamp = erlang:timestamp() :: erlang:timestamp(),
+ service = {<<"">>, <<"">>, <<"">>} :: ljid(),
+ node = <<"">> :: binary(),
+ xml :: undefined | xmlel()}).
diff --git a/include/mod_roster.hrl b/include/mod_roster.hrl
index b05114e3e..c795aabc7 100644
--- a/include/mod_roster.hrl
+++ b/include/mod_roster.hrl
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
-%%% ejabberd, Copyright (C) 2002-2016 ProcessOne
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -20,15 +20,15 @@
-record(roster,
{
- usj = {<<>>, <<>>, {<<>>, <<>>, <<>>}} :: {binary(), binary(), ljid()} | '_',
+ usj = {<<>>, <<>>, {<<>>, <<>>, <<>>}} :: {binary(), binary(), jid:ljid()} | '_',
us = {<<>>, <<>>} :: {binary(), binary()} | '_',
- jid = {<<>>, <<>>, <<>>} :: ljid(),
+ jid = {<<>>, <<>>, <<>>} :: jid:ljid(),
name = <<>> :: binary() | '_',
subscription = none :: subscription() | '_',
ask = none :: ask() | '_',
groups = [] :: [binary()] | '_',
askmessage = <<"">> :: binary() | '_',
- xs = [] :: [xmlel()] | '_'
+ xs = [] :: [fxml:xmlel()] | '_'
}).
-record(roster_version,
diff --git a/include/mod_shared_roster.hrl b/include/mod_shared_roster.hrl
index 1f96b3034..d0fbeaa56 100644
--- a/include/mod_shared_roster.hrl
+++ b/include/mod_shared_roster.hrl
@@ -1,3 +1,23 @@
+%%%----------------------------------------------------------------------
+%%%
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
+%%%
+%%% 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.
+%%%
+%%% 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.
+%%%
+%%%----------------------------------------------------------------------
+
-record(sr_group, {group_host = {<<"">>, <<"">>} :: {'$1' | binary(), '$2' | binary()},
opts = [] :: list() | '_' | '$2'}).
diff --git a/include/mod_vcard.hrl b/include/mod_vcard.hrl
index 3bd62b2eb..94f286bfc 100644
--- a/include/mod_vcard.hrl
+++ b/include/mod_vcard.hrl
@@ -1,3 +1,23 @@
+%%%----------------------------------------------------------------------
+%%%
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
+%%%
+%%% 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.
+%%%
+%%% 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.
+%%%
+%%%----------------------------------------------------------------------
+
-record(vcard_search,
{us, user, luser, fn, lfn, family, lfamily, given,
lgiven, middle, lmiddle, nickname, lnickname, bday,
diff --git a/include/mod_vcard_xupdate.hrl b/include/mod_vcard_xupdate.hrl
index 8634597aa..25b73adef 100644
--- a/include/mod_vcard_xupdate.hrl
+++ b/include/mod_vcard_xupdate.hrl
@@ -1,2 +1,22 @@
+%%%----------------------------------------------------------------------
+%%%
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
+%%%
+%%% 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.
+%%%
+%%% 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.
+%%%
+%%%----------------------------------------------------------------------
+
-record(vcard_xupdate, {us = {<<>>, <<>>} :: {binary(), binary()},
hash = <<>> :: binary()}).
diff --git a/include/mqtt.hrl b/include/mqtt.hrl
new file mode 100644
index 000000000..1e78d3922
--- /dev/null
+++ b/include/mqtt.hrl
@@ -0,0 +1,209 @@
+%%%-------------------------------------------------------------------
+%%% @author Evgeny Khramtsov <ekhramtsov@process-one.net>
+%%% @copyright (C) 2002-2019 ProcessOne, SARL. All Rights Reserved.
+%%%
+%%% Licensed under the Apache License, Version 2.0 (the "License");
+%%% you may not use this file except in compliance with the License.
+%%% You may obtain a copy of the License at
+%%%
+%%% http://www.apache.org/licenses/LICENSE-2.0
+%%%
+%%% Unless required by applicable law or agreed to in writing, software
+%%% distributed under the License is distributed on an "AS IS" BASIS,
+%%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+%%% See the License for the specific language governing permissions and
+%%% limitations under the License.
+%%%
+%%%-------------------------------------------------------------------
+-define(MQTT_VERSION_4, 4).
+-define(MQTT_VERSION_5, 5).
+
+-record(connect, {proto_level = 4 :: non_neg_integer(),
+ will :: undefined | publish(),
+ clean_start = true :: boolean(),
+ keep_alive = 0 :: non_neg_integer(),
+ client_id = <<>> :: binary(),
+ username = <<>> :: binary(),
+ password = <<>> :: binary(),
+ will_properties = #{} :: properties(),
+ properties = #{} :: properties()}).
+-record(connack, {session_present = false :: boolean(),
+ code = success :: reason_code(),
+ properties = #{} :: properties()}).
+
+-record(publish, {id :: undefined | non_neg_integer(),
+ dup = false :: boolean(),
+ qos = 0 :: qos(),
+ retain = false :: boolean(),
+ topic :: binary(),
+ payload :: binary(),
+ properties = #{} :: properties(),
+ meta = #{} :: map()}).
+-record(puback, {id :: non_neg_integer(),
+ code = success :: reason_code(),
+ properties = #{} :: properties()}).
+-record(pubrec, {id :: non_neg_integer(),
+ code = success :: reason_code(),
+ properties = #{} :: properties()}).
+-record(pubrel, {id :: non_neg_integer(),
+ code = success :: reason_code(),
+ properties = #{} :: properties(),
+ meta = #{} :: map()}).
+-record(pubcomp, {id :: non_neg_integer(),
+ code = success :: reason_code(),
+ properties = #{} :: properties()}).
+
+-record(subscribe, {id :: non_neg_integer(),
+ filters :: [{binary(), sub_opts()}],
+ properties = #{} :: properties(),
+ meta = #{} :: map()}).
+-record(suback, {id :: non_neg_integer(),
+ codes = [] :: [char() | reason_code()],
+ properties = #{} :: properties()}).
+
+-record(unsubscribe, {id :: non_neg_integer(),
+ filters :: [binary()],
+ properties = #{} :: properties(),
+ meta = #{} :: map()}).
+-record(unsuback, {id :: non_neg_integer(),
+ codes = [] :: [reason_code()],
+ properties = #{} :: properties()}).
+
+-record(pingreq, {meta = #{} :: map()}).
+-record(pingresp, {}).
+
+-record(disconnect, {code = 'normal-disconnection' :: reason_code(),
+ properties = #{} :: properties()}).
+
+-record(auth, {code = success :: reason_code(),
+ properties = #{} :: properties()}).
+
+-record(sub_opts, {qos = 0 :: qos(),
+ no_local = false :: boolean(),
+ retain_as_published = false :: boolean(),
+ retain_handling = 0 :: 0..2}).
+
+-type qos() :: 0|1|2.
+-type sub_opts() :: #sub_opts{}.
+-type utf8_pair() :: {binary(), binary()}.
+-type properties() :: #{assigned_client_identifier => binary(),
+ authentication_data => binary(),
+ authentication_method => binary(),
+ content_type => binary(),
+ correlation_data => binary(),
+ maximum_packet_size => pos_integer(),
+ maximum_qos => 0|1,
+ message_expiry_interval => non_neg_integer(),
+ payload_format_indicator => binary | utf8,
+ reason_string => binary(),
+ receive_maximum => pos_integer(),
+ request_problem_information => boolean(),
+ request_response_information => boolean(),
+ response_information => binary(),
+ response_topic => binary(),
+ retain_available => boolean(),
+ server_keep_alive => non_neg_integer(),
+ server_reference => binary(),
+ session_expiry_interval => non_neg_integer(),
+ shared_subscription_available => boolean(),
+ subscription_identifier => [non_neg_integer()] | non_neg_integer(),
+ subscription_identifiers_available => boolean(),
+ topic_alias => pos_integer(),
+ topic_alias_maximum => non_neg_integer(),
+ user_property => [utf8_pair()],
+ wildcard_subscription_available => boolean(),
+ will_delay_interval => non_neg_integer()}.
+-type property() :: assigned_client_identifier |
+ authentication_data |
+ authentication_method |
+ content_type |
+ correlation_data |
+ maximum_packet_size |
+ maximum_qos |
+ message_expiry_interval |
+ payload_format_indicator |
+ reason_string |
+ receive_maximum |
+ request_problem_information |
+ request_response_information |
+ response_information |
+ response_topic |
+ retain_available |
+ server_keep_alive |
+ server_reference |
+ session_expiry_interval |
+ shared_subscription_available |
+ subscription_identifier |
+ subscription_identifiers_available |
+ topic_alias |
+ topic_alias_maximum |
+ user_property |
+ wildcard_subscription_available |
+ will_delay_interval.
+-type reason_code() :: 'success' |
+ 'normal-disconnection' |
+ 'granted-qos-0' |
+ 'granted-qos-1' |
+ 'granted-qos-2' |
+ 'disconnect-with-will-message' |
+ 'no-matching-subscribers' |
+ 'no-subscription-existed' |
+ 'continue-authentication' |
+ 're-authenticate' |
+ 'unspecified-error' |
+ 'malformed-packet' |
+ 'protocol-error' |
+ 'implementation-specific-error' |
+ 'unsupported-protocol-version' |
+ 'client-identifier-not-valid' |
+ 'bad-user-name-or-password' |
+ 'not-authorized' |
+ 'server-unavailable' |
+ 'server-busy' |
+ 'banned' |
+ 'server-shutting-down' |
+ 'bad-authentication-method' |
+ 'keep-alive-timeout' |
+ 'session-taken-over' |
+ 'topic-filter-invalid' |
+ 'topic-name-invalid' |
+ 'packet-identifier-in-use' |
+ 'packet-identifier-not-found' |
+ 'receive-maximum-exceeded' |
+ 'topic-alias-invalid' |
+ 'packet-too-large' |
+ 'message-rate-too-high' |
+ 'quota-exceeded' |
+ 'administrative-action' |
+ 'payload-format-invalid' |
+ 'retain-not-supported' |
+ 'qos-not-supported' |
+ 'use-another-server' |
+ 'server-moved' |
+ 'shared-subscriptions-not-supported' |
+ 'connection-rate-exceeded' |
+ 'maximum-connect-time' |
+ 'subscription-identifiers-not-supported' |
+ 'wildcard-subscriptions-not-supported'.
+
+-type connect() :: #connect{}.
+-type connack() :: #connack{}.
+-type publish() :: #publish{}.
+-type puback() :: #puback{}.
+-type pubrel() :: #pubrel{}.
+-type pubrec() :: #pubrec{}.
+-type pubcomp() :: #pubcomp{}.
+-type subscribe() :: #subscribe{}.
+-type suback() :: #suback{}.
+-type unsubscribe() :: #unsubscribe{}.
+-type unsuback() :: #unsuback{}.
+-type pingreq() :: #pingreq{}.
+-type pingresp() :: #pingresp{}.
+-type disconnect() :: #disconnect{}.
+-type auth() :: #auth{}.
+
+-type mqtt_packet() :: connect() | connack() | publish() | puback() |
+ pubrel() | pubrec() | pubcomp() | subscribe() |
+ suback() | unsubscribe() | unsuback() | pingreq() |
+ pingresp() | disconnect() | auth().
+-type mqtt_version() :: ?MQTT_VERSION_4 | ?MQTT_VERSION_5.
diff --git a/include/ns.hrl b/include/ns.hrl
deleted file mode 100644
index a150746e7..000000000
--- a/include/ns.hrl
+++ /dev/null
@@ -1,174 +0,0 @@
-%%%----------------------------------------------------------------------
-%%%
-%%% ejabberd, Copyright (C) 2002-2016 ProcessOne
-%%%
-%%% 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.
-%%%
-%%% 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.
-%%%
-%%%----------------------------------------------------------------------
-
--define(NS_DISCO_ITEMS,
- <<"http://jabber.org/protocol/disco#items">>).
--define(NS_DISCO_INFO,
- <<"http://jabber.org/protocol/disco#info">>).
--define(NS_VCARD, <<"vcard-temp">>).
--define(NS_VCARD_UPDATE, <<"vcard-temp:x:update">>).
--define(NS_AUTH, <<"jabber:iq:auth">>).
--define(NS_AUTH_ERROR, <<"jabber:iq:auth:error">>).
--define(NS_REGISTER, <<"jabber:iq:register">>).
--define(NS_SEARCH, <<"jabber:iq:search">>).
--define(NS_ROSTER, <<"jabber:iq:roster">>).
--define(NS_ROSTER_VER,
- <<"urn:xmpp:features:rosterver">>).
--define(NS_PRIVACY, <<"jabber:iq:privacy">>).
--define(NS_BLOCKING, <<"urn:xmpp:blocking">>).
--define(NS_PRIVATE, <<"jabber:iq:private">>).
--define(NS_VERSION, <<"jabber:iq:version">>).
--define(NS_TIME, <<"urn:xmpp:time">>).
--define(NS_LAST, <<"jabber:iq:last">>).
--define(NS_XDATA, <<"jabber:x:data">>).
--define(NS_IQDATA, <<"jabber:iq:data">>).
--define(NS_DELAY, <<"urn:xmpp:delay">>).
--define(NS_HINTS, <<"urn:xmpp:hints">>).
--define(NS_EXPIRE, <<"jabber:x:expire">>).
--define(NS_EVENT, <<"jabber:x:event">>).
--define(NS_CHATSTATES,
- <<"http://jabber.org/protocol/chatstates">>).
--define(NS_XCONFERENCE, <<"jabber:x:conference">>).
--define(NS_STATS,
- <<"http://jabber.org/protocol/stats">>).
--define(NS_MUC, <<"http://jabber.org/protocol/muc">>).
--define(NS_MUC_USER,
- <<"http://jabber.org/protocol/muc#user">>).
--define(NS_MUC_ADMIN,
- <<"http://jabber.org/protocol/muc#admin">>).
--define(NS_MUC_OWNER,
- <<"http://jabber.org/protocol/muc#owner">>).
--define(NS_MUC_UNIQUE,
- <<"http://jabber.org/protocol/muc#unique">>).
--define(NS_PUBSUB,
- <<"http://jabber.org/protocol/pubsub">>).
--define(NS_PUBSUB_EVENT,
- <<"http://jabber.org/protocol/pubsub#event">>).
--define(NS_PUBSUB_META_DATA,
- <<"http://jabber.org/protocol/pubsub#meta-data">>).
--define(NS_PUBSUB_OWNER,
- <<"http://jabber.org/protocol/pubsub#owner">>).
--define(NS_PUBSUB_NMI,
- <<"http://jabber.org/protocol/pubsub#node-meta-info">>).
--define(NS_PUBSUB_ERRORS,
- <<"http://jabber.org/protocol/pubsub#errors">>).
--define(NS_PUBSUB_NODE_CONFIG,
- <<"http://jabber.org/protocol/pubsub#node_config">>).
--define(NS_PUBSUB_SUB_OPTIONS,
- <<"http://jabber.org/protocol/pubsub#subscribe_options">>).
--define(NS_PUBSUB_SUBSCRIBE_OPTIONS,
- <<"http://jabber.org/protocol/pubsub#subscribe_options">>).
--define(NS_PUBSUB_PUBLISH_OPTIONS,
- <<"http://jabber.org/protocol/pubsub#publish_options">>).
--define(NS_PUBSUB_SUB_AUTH,
- <<"http://jabber.org/protocol/pubsub#subscribe_authorization">>).
--define(NS_PUBSUB_GET_PENDING,
- <<"http://jabber.org/protocol/pubsub#get-pending">>).
--define(NS_COMMANDS,
- <<"http://jabber.org/protocol/commands">>).
--define(NS_BYTESTREAMS,
- <<"http://jabber.org/protocol/bytestreams">>).
--define(NS_ADMIN,
- <<"http://jabber.org/protocol/admin">>).
--define(NS_ADMIN_ANNOUNCE,
- <<"http://jabber.org/protocol/admin#announce">>).
--define(NS_ADMIN_ANNOUNCE_ALL,
- <<"http://jabber.org/protocol/admin#announce-all">>).
--define(NS_ADMIN_SET_MOTD,
- <<"http://jabber.org/protocol/admin#set-motd">>).
--define(NS_ADMIN_EDIT_MOTD,
- <<"http://jabber.org/protocol/admin#edit-motd">>).
--define(NS_ADMIN_DELETE_MOTD,
- <<"http://jabber.org/protocol/admin#delete-motd">>).
--define(NS_ADMIN_ANNOUNCE_ALLHOSTS,
- <<"http://jabber.org/protocol/admin#announce-allhosts">>).
--define(NS_ADMIN_ANNOUNCE_ALL_ALLHOSTS,
- <<"http://jabber.org/protocol/admin#announce-all-allhosts">>).
--define(NS_ADMIN_SET_MOTD_ALLHOSTS,
- <<"http://jabber.org/protocol/admin#set-motd-allhosts">>).
--define(NS_ADMIN_EDIT_MOTD_ALLHOSTS,
- <<"http://jabber.org/protocol/admin#edit-motd-allhosts">>).
--define(NS_ADMIN_DELETE_MOTD_ALLHOSTS,
- <<"http://jabber.org/protocol/admin#delete-motd-allhosts">>).
--define(NS_SERVERINFO,
- <<"http://jabber.org/network/serverinfo">>).
--define(NS_RSM, <<"http://jabber.org/protocol/rsm">>).
--define(NS_EJABBERD_CONFIG, <<"ejabberd:config">>).
--define(NS_STREAM,
- <<"http://etherx.jabber.org/streams">>).
--define(NS_STANZAS,
- <<"urn:ietf:params:xml:ns:xmpp-stanzas">>).
--define(NS_STREAMS,
- <<"urn:ietf:params:xml:ns:xmpp-streams">>).
--define(NS_TLS, <<"urn:ietf:params:xml:ns:xmpp-tls">>).
--define(NS_SASL,
- <<"urn:ietf:params:xml:ns:xmpp-sasl">>).
--define(NS_SESSION,
- <<"urn:ietf:params:xml:ns:xmpp-session">>).
--define(NS_BIND,
- <<"urn:ietf:params:xml:ns:xmpp-bind">>).
--define(NS_FEATURE_IQAUTH,
- <<"http://jabber.org/features/iq-auth">>).
--define(NS_FEATURE_IQREGISTER,
- <<"http://jabber.org/features/iq-register">>).
--define(NS_FEATURE_COMPRESS,
- <<"http://jabber.org/features/compress">>).
--define(NS_FEATURE_MSGOFFLINE, <<"msgoffline">>).
--define(NS_FLEX_OFFLINE, <<"http://jabber.org/protocol/offline">>).
--define(NS_COMPRESS,
- <<"http://jabber.org/protocol/compress">>).
--define(NS_CAPS, <<"http://jabber.org/protocol/caps">>).
--define(NS_SHIM, <<"http://jabber.org/protocol/shim">>).
--define(NS_ADDRESS,
- <<"http://jabber.org/protocol/address">>).
--define(NS_OOB, <<"jabber:x:oob">>).
--define(NS_CAPTCHA, <<"urn:xmpp:captcha">>).
--define(NS_MEDIA, <<"urn:xmpp:media-element">>).
--define(NS_BOB, <<"urn:xmpp:bob">>).
--define(NS_MAM_TMP, <<"urn:xmpp:mam:tmp">>).
--define(NS_MAM_0, <<"urn:xmpp:mam:0">>).
--define(NS_MAM_1, <<"urn:xmpp:mam:1">>).
--define(NS_SID_0, <<"urn:xmpp:sid:0">>).
--define(NS_PING, <<"urn:xmpp:ping">>).
--define(NS_CARBONS_2, <<"urn:xmpp:carbons:2">>).
--define(NS_CARBONS_1, <<"urn:xmpp:carbons:1">>).
--define(NS_FORWARD, <<"urn:xmpp:forward:0">>).
--define(NS_CLIENT_STATE, <<"urn:xmpp:csi:0">>).
--define(NS_STREAM_MGMT_2, <<"urn:xmpp:sm:2">>).
--define(NS_STREAM_MGMT_3, <<"urn:xmpp:sm:3">>).
--define(NS_HTTP_UPLOAD, <<"urn:xmpp:http:upload">>).
--define(NS_HTTP_UPLOAD_OLD, <<"eu:siacs:conversations:http:upload">>).
--define(NS_THUMBS_1, <<"urn:xmpp:thumbs:1">>).
--define(NS_NICK, <<"http://jabber.org/protocol/nick">>).
--define(NS_MIX_0, <<"urn:xmpp:mix:0">>).
--define(NS_MIX_SERVICEINFO_0, <<"urn:xmpp:mix:0#serviceinfo">>).
--define(NS_MIX_NODES_MESSAGES, <<"urn:xmpp:mix:nodes:messages">>).
--define(NS_MIX_NODES_PRESENCE, <<"urn:xmpp:mix:nodes:presence">>).
--define(NS_MIX_NODES_PARTICIPANTS, <<"urn:xmpp:mix:nodes:participants">>).
--define(NS_MIX_NODES_SUBJECT, <<"urn:xmpp:mix:nodes:subject">>).
--define(NS_MIX_NODES_CONFIG, <<"urn:xmpp:mix:nodes:config">>).
--define(NS_MUCSUB, <<"urn:xmpp:mucsub:0">>).
--define(NS_MUCSUB_NODES_PRESENCE, <<"urn:xmpp:mucsub:nodes:presence">>).
--define(NS_MUCSUB_NODES_MESSAGES, <<"urn:xmpp:mucsub:nodes:messages">>).
--define(NS_MUCSUB_NODES_PARTICIPANTS, <<"urn:xmpp:mucsub:nodes:participants">>).
--define(NS_MUCSUB_NODES_AFFILIATIONS, <<"urn:xmpp:mucsub:nodes:affiliations">>).
--define(NS_MUCSUB_NODES_SUBJECT, <<"urn:xmpp:mucsub:nodes:subject">>).
--define(NS_MUCSUB_NODES_CONFIG, <<"urn:xmpp:mucsub:nodes:config">>).
--define(NS_MUCSUB_NODES_SYSTEM, <<"urn:xmpp:mucsub:nodes:system">>).
diff --git a/include/pubsub.hrl b/include/pubsub.hrl
index a05807247..666a09fa3 100644
--- a/include/pubsub.hrl
+++ b/include/pubsub.hrl
@@ -1,29 +1,22 @@
-%%% ====================================================================
-%%% ``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.
-%%%
+%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
%%%
-%%% The Initial Developer of the Original Code is ProcessOne.
-%%% Portions created by ProcessOne are Copyright 2006-2016, ProcessOne
-%%% All Rights Reserved.''
-%%% This software is copyright 2006-2016, ProcessOne.
+%%% 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.
%%%
+%%% 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.
%%%
-%%% copyright 2006-2016 ProcessOne
+%%% 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.
%%%
-%%% This file contains pubsub types definition.
-%%% ====================================================================
-
--include("ejabberd.hrl").
+%%%----------------------------------------------------------------------
%% -------------------------------
%% Pubsub constants
@@ -33,8 +26,8 @@
-define(MAXITEMS, 10).
%% this is currently a hard limit.
-%% Would be nice to have it configurable.
--define(MAX_PAYLOAD_SIZE, 60000).
+%% Would be nice to have it configurable.
+-define(MAX_PAYLOAD_SIZE, 250000).
%% -------------------------------
%% Pubsub types
@@ -65,7 +58,7 @@
%% note: pos_integer() should always be used, but we allow anything else coded
%% as binary, so one can have a custom implementation of nodetree with custom
%% indexing (see nodetree_virtual). this also allows to use any kind of key for
-%% indexing nodes, as this can be usefull with external backends such as sql.
+%% indexing nodes, as this can be useful with external backends such as sql.
-type(itemId() :: binary()).
%% @type itemId() = string().
@@ -91,7 +84,7 @@
Value::binary() | [binary()] | boolean()
}).
--type(subOptions() :: [mod_pubsub:subOption(),...]).
+-type(subOptions() :: [mod_pubsub:subOption()]).
-type(pubOption() ::
{Option::binary(),
@@ -109,13 +102,6 @@
).
%% @type affiliation() = 'none' | 'owner' | 'publisher' | 'publish-only' | 'member' | 'outcast'.
--type(subscription() :: 'none'
- | 'pending'
- | 'unconfigured'
- | 'subscribed'
-).
-%% @type subscription() = 'none' | 'pending' | 'unconfigured' | 'subscribed'.
-
-type(accessModel() :: 'open'
| 'presence'
| 'roster'
@@ -143,13 +129,14 @@
id ,% :: mod_pubsub:nodeIdx(),
parents = [] ,% :: [mod_pubsub:nodeId(),...],
type = <<"flat">>,% :: binary(),
- owners = [] ,% :: [jlib:ljid(),...],
+ owners = [] ,% :: [jid:ljid(),...],
options = [] % :: mod_pubsub:nodeOptions()
}).
-record(pubsub_state,
{
- stateid ,% :: {jlib:ljid(), mod_pubsub:nodeIdx()},
+ stateid ,% :: {jid:ljid(), mod_pubsub:nodeIdx()},
+ nodeidx ,% :: mod_pubsub:nodeIdx(),
items = [] ,% :: [mod_pubsub:itemId(),...],
affiliation = 'none',% :: mod_pubsub:affiliation(),
subscriptions = [] % :: [{mod_pubsub:subscription(), mod_pubsub:subId()}]
@@ -158,8 +145,9 @@
-record(pubsub_item,
{
itemid ,% :: {mod_pubsub:itemId(), mod_pubsub:nodeIdx()},
- creation = {unknown, unknown},% :: {erlang:timestamp(), jlib:ljid()},
- modification = {unknown, unknown},% :: {erlang:timestamp(), jlib:ljid()},
+ nodeidx ,% :: mod_pubsub:nodeIdx(),
+ creation = {unknown, unknown},% :: {erlang:timestamp(), jid:ljid()},
+ modification = {unknown, unknown},% :: {erlang:timestamp(), jid:ljid()},
payload = [] % :: mod_pubsub:payload()
}).
@@ -171,8 +159,14 @@
-record(pubsub_last_item,
{
- nodeid ,% :: mod_pubsub:nodeIdx(),
+ nodeid ,% :: {binary(), mod_pubsub:nodeIdx()},
itemid ,% :: mod_pubsub:itemId(),
- creation ,% :: {erlang:timestamp(), jlib:ljid()},
+ creation ,% :: {erlang:timestamp(), jid:ljid()},
payload % :: mod_pubsub:payload()
}).
+
+-record(pubsub_orphan,
+{
+ nodeid ,% :: mod_pubsub:nodeIdx(),
+ items = [] % :: list()
+}).
diff --git a/include/translate.hrl b/include/translate.hrl
new file mode 100644
index 000000000..b0e50e7d6
--- /dev/null
+++ b/include/translate.hrl
@@ -0,0 +1 @@
+-define(T(S), <<S>>).