aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/bosh.hrl51
-rw-r--r--include/ejabberd.hrl6
-rw-r--r--include/ejabberd_commands.hrl7
-rw-r--r--include/ejabberd_service.hrl20
-rw-r--r--include/jlib.hrl4
-rw-r--r--include/mod_mam.hrl2
-rw-r--r--include/mod_muc_room.hrl3
-rw-r--r--include/mod_offline.hrl4
-rw-r--r--include/mod_privacy.hrl11
-rw-r--r--include/mod_roster.hrl6
-rw-r--r--include/ns.hrl176
11 files changed, 74 insertions, 216 deletions
diff --git a/include/bosh.hrl b/include/bosh.hrl
new file mode 100644
index 000000000..9cdfd98d8
--- /dev/null
+++ b/include/bosh.hrl
@@ -0,0 +1,51 @@
+%%%----------------------------------------------------------------------
+%%%
+%%% 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(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(PROCNAME, ejabberd_mod_bosh).
diff --git a/include/ejabberd.hrl b/include/ejabberd.hrl
index 6316d7813..391089a0e 100644
--- a/include/ejabberd.hrl
+++ b/include/ejabberd.hrl
@@ -39,7 +39,9 @@
-define(EJABBERD_URI, <<"http://www.process-one.net/en/ejabberd/">>).
--define(S2STIMEOUT, 600000).
+-define(COPYRIGHT, "Copyright (c) 2002-2016 ProcessOne").
+
+-define(S2STIMEOUT, timer:minutes(10)).
%%-define(DBGFSM, true).
@@ -64,7 +66,7 @@
-define(TDICT, dict:dict()).
-define(TGB_TREE, gb_trees:tree()).
--define(TGB_SET, gb_set:set()).
+-define(TGB_SET, gb_sets:set()).
-define(TQUEUE, queue:queue()).
-endif.
diff --git a/include/ejabberd_commands.hrl b/include/ejabberd_commands.hrl
index c5c34b743..199be890e 100644
--- a/include/ejabberd_commands.hrl
+++ b/include/ejabberd_commands.hrl
@@ -46,12 +46,13 @@
%% 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,
diff --git a/include/ejabberd_service.hrl b/include/ejabberd_service.hrl
deleted file mode 100644
index 7cd3b6943..000000000
--- a/include/ejabberd_service.hrl
+++ /dev/null
@@ -1,20 +0,0 @@
--include("ejabberd.hrl").
--include("logger.hrl").
--include("jlib.hrl").
-
--type filter_attr() :: {binary(), [binary()]}.
-
--record(state,
- {socket :: ejabberd_socket:socket_state(),
- sockmod = ejabberd_socket :: ejabberd_socket | ejabberd_frontend_socket,
- streamid = <<"">> :: binary(),
- host_opts = dict:new() :: ?TDICT,
- host = <<"">> :: binary(),
- access :: atom(),
- check_from = true :: boolean(),
- server_hosts = ?MYHOSTS :: [binary()],
- privilege_access :: [attr()],
- delegations :: [filter_attr()],
- last_pres = dict:new() :: ?TDICT}).
-
--type(state() :: #state{} ).
diff --git a/include/jlib.hrl b/include/jlib.hrl
index 50a031334..5a3c1634e 100644
--- a/include/jlib.hrl
+++ b/include/jlib.hrl
@@ -19,11 +19,7 @@
%%%----------------------------------------------------------------------
-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">>,
diff --git a/include/mod_mam.hrl b/include/mod_mam.hrl
index 463db4cff..a2b92fca5 100644
--- a/include/mod_mam.hrl
+++ b/include/mod_mam.hrl
@@ -4,7 +4,7 @@
timestamp = p1_time_compat:timestamp() :: erlang:timestamp() | '_' | '$1',
peer = {<<"">>, <<"">>, <<"">>} :: ljid() | '_' | '$3' | undefined,
bare_peer = {<<"">>, <<"">>, <<"">>} :: ljid() | '_' | '$3',
- packet = #xmlel{} :: xmlel() | '_',
+ packet = #xmlel{} :: xmlel() | message() | '_',
nick = <<"">> :: binary(),
type = chat :: chat | groupchat}).
diff --git a/include/mod_muc_room.hrl b/include/mod_muc_room.hrl
index 551da7285..dd414a8d8 100644
--- a/include/mod_muc_room.hrl
+++ b/include/mod_muc_room.hrl
@@ -71,6 +71,7 @@
-type config() :: #config{}.
-type role() :: moderator | participant | visitor | none.
+-type affiliation() :: admin | member | outcast | owner | none.
-record(user,
{
@@ -126,5 +127,3 @@
host = <<>> :: binary() | '_' | '$2'}).
-type muc_online_users() :: #muc_online_users{}.
-
--type muc_room_state() :: #state{}.
diff --git a/include/mod_offline.hrl b/include/mod_offline.hrl
index c4c70604a..cc644c4c2 100644
--- a/include/mod_offline.hrl
+++ b/include/mod_offline.hrl
@@ -1,7 +1,7 @@
-record(offline_msg,
{us = {<<"">>, <<"">>} :: {binary(), binary()},
- timestamp = now() :: erlang:timestamp() | '_',
- expire = now() :: erlang:timestamp() | never | '_',
+ timestamp = p1_time_compat:timestamp() :: erlang:timestamp() | '_',
+ expire = p1_time_compat:timestamp() :: erlang:timestamp() | never | '_',
from = #jid{} :: jid() | '_',
to = #jid{} :: jid() | '_',
packet = #xmlel{} :: xmlel() | '_'}).
diff --git a/include/mod_privacy.hrl b/include/mod_privacy.hrl
index 8fe5abcca..dbd19a081 100644
--- a/include/mod_privacy.hrl
+++ b/include/mod_privacy.hrl
@@ -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,6 +35,9 @@
match_presence_out = false :: boolean()}).
-type listitem() :: #listitem{}.
+-type listitem_type() :: none | jid | group | subscription.
+-type listitem_value() :: none | both | from | to | jid:ljid() | binary().
+-type listitem_action() :: allow | deny.
-record(userlist, {name = none :: none | binary(),
list = [] :: [listitem()],
diff --git a/include/mod_roster.hrl b/include/mod_roster.hrl
index b05114e3e..818508703 100644
--- a/include/mod_roster.hrl
+++ b/include/mod_roster.hrl
@@ -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/ns.hrl b/include/ns.hrl
deleted file mode 100644
index 3dbc765b0..000000000
--- a/include/ns.hrl
+++ /dev/null
@@ -1,176 +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_PRIVILEGE, <<"urn:xmpp:privilege:1">>).
--define(NS_DELEGATION, <<"urn:xmpp:delegation:1">>).
--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">>).