2008-12-02 20:23:12 +01:00
|
|
|
%%%----------------------------------------------------------------------
|
|
|
|
%%%
|
2017-01-02 21:41:53 +01:00
|
|
|
%%% ejabberd, Copyright (C) 2002-2017 ProcessOne
|
2008-12-02 20:23:12 +01:00
|
|
|
%%%
|
|
|
|
%%% This program is free software; you can redistribute it and/or
|
|
|
|
%%% modify it under the terms of the GNU General Public License as
|
|
|
|
%%% published by the Free Software Foundation; either version 2 of the
|
|
|
|
%%% License, or (at your option) any later version.
|
|
|
|
%%%
|
|
|
|
%%% 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.
|
2009-01-12 15:44:42 +01:00
|
|
|
%%%
|
2014-02-22 11:27:40 +01:00
|
|
|
%%% 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.
|
2008-12-02 20:23:12 +01:00
|
|
|
%%%
|
|
|
|
%%%----------------------------------------------------------------------
|
|
|
|
|
2015-02-11 12:08:16 +01:00
|
|
|
-include("ejabberd.hrl").
|
|
|
|
|
2008-12-02 20:23:12 +01:00
|
|
|
-define(MAX_USERS_DEFAULT, 200).
|
|
|
|
|
|
|
|
-define(SETS, gb_sets).
|
2013-03-14 10:33:02 +01:00
|
|
|
|
2008-12-02 20:23:12 +01:00
|
|
|
-define(DICT, dict).
|
|
|
|
|
2013-03-14 10:33:02 +01:00
|
|
|
-record(lqueue,
|
|
|
|
{
|
2015-02-11 12:08:16 +01:00
|
|
|
queue :: ?TQUEUE,
|
2013-03-14 10:33:02 +01:00
|
|
|
len :: integer(),
|
|
|
|
max :: integer()
|
|
|
|
}).
|
|
|
|
|
|
|
|
-type lqueue() :: #lqueue{}.
|
|
|
|
|
|
|
|
-record(config,
|
|
|
|
{
|
|
|
|
title = <<"">> :: binary(),
|
|
|
|
description = <<"">> :: binary(),
|
|
|
|
allow_change_subj = true :: boolean(),
|
|
|
|
allow_query_users = true :: boolean(),
|
|
|
|
allow_private_messages = true :: boolean(),
|
|
|
|
allow_private_messages_from_visitors = anyone :: anyone | moderators | nobody ,
|
|
|
|
allow_visitor_status = true :: boolean(),
|
|
|
|
allow_visitor_nickchange = true :: boolean(),
|
|
|
|
public = true :: boolean(),
|
|
|
|
public_list = true :: boolean(),
|
|
|
|
persistent = false :: boolean(),
|
|
|
|
moderated = true :: boolean(),
|
|
|
|
captcha_protected = false :: boolean(),
|
|
|
|
members_by_default = true :: boolean(),
|
|
|
|
members_only = false :: boolean(),
|
|
|
|
allow_user_invites = false :: boolean(),
|
2016-06-26 08:08:37 +02:00
|
|
|
allow_subscription = false :: boolean(),
|
2013-03-14 10:33:02 +01:00
|
|
|
password_protected = false :: boolean(),
|
|
|
|
password = <<"">> :: binary(),
|
|
|
|
anonymous = true :: boolean(),
|
2015-11-12 17:51:20 +01:00
|
|
|
presence_broadcast = [moderator, participant, visitor] ::
|
|
|
|
[moderator | participant | visitor],
|
2013-03-14 10:33:02 +01:00
|
|
|
allow_voice_requests = true :: boolean(),
|
|
|
|
voice_request_min_interval = 1800 :: non_neg_integer(),
|
|
|
|
max_users = ?MAX_USERS_DEFAULT :: non_neg_integer() | none,
|
|
|
|
logging = false :: boolean(),
|
2015-02-11 12:08:16 +01:00
|
|
|
vcard = <<"">> :: binary(),
|
2015-08-06 12:33:39 +02:00
|
|
|
captcha_whitelist = (?SETS):empty() :: ?TGB_SET,
|
|
|
|
mam = false :: boolean()
|
2013-03-14 10:33:02 +01:00
|
|
|
}).
|
|
|
|
|
|
|
|
-type config() :: #config{}.
|
|
|
|
|
|
|
|
-type role() :: moderator | participant | visitor | none.
|
2016-07-25 12:50:30 +02:00
|
|
|
-type affiliation() :: admin | member | outcast | owner | none.
|
2013-03-14 10:33:02 +01:00
|
|
|
|
|
|
|
-record(user,
|
|
|
|
{
|
|
|
|
jid :: jid(),
|
|
|
|
nick :: binary(),
|
|
|
|
role :: role(),
|
2016-09-07 09:33:37 +02:00
|
|
|
%%is_subscriber = false :: boolean(),
|
|
|
|
%%subscriptions = [] :: [binary()],
|
2013-03-14 10:33:02 +01:00
|
|
|
last_presence :: xmlel()
|
|
|
|
}).
|
2008-12-02 20:23:12 +01:00
|
|
|
|
2016-09-07 09:33:37 +02:00
|
|
|
-record(subscriber, {jid :: jid(),
|
|
|
|
nick = <<>> :: binary(),
|
|
|
|
nodes = [] :: [binary()]}).
|
|
|
|
|
2013-03-14 10:33:02 +01:00
|
|
|
-record(activity,
|
|
|
|
{
|
|
|
|
message_time = 0 :: integer(),
|
|
|
|
presence_time = 0 :: integer(),
|
|
|
|
message_shaper :: shaper:shaper(),
|
|
|
|
presence_shaper :: shaper:shaper(),
|
|
|
|
message :: xmlel(),
|
|
|
|
presence :: {binary(), xmlel()}
|
|
|
|
}).
|
2008-12-02 20:23:12 +01:00
|
|
|
|
2013-03-14 10:33:02 +01:00
|
|
|
-record(state,
|
|
|
|
{
|
|
|
|
room = <<"">> :: binary(),
|
|
|
|
host = <<"">> :: binary(),
|
|
|
|
server_host = <<"">> :: binary(),
|
|
|
|
access = {none,none,none,none} :: {atom(), atom(), atom(), atom()},
|
|
|
|
jid = #jid{} :: jid(),
|
|
|
|
config = #config{} :: config(),
|
2015-02-11 12:08:16 +01:00
|
|
|
users = (?DICT):new() :: ?TDICT,
|
2016-09-07 09:33:37 +02:00
|
|
|
subscribers = (?DICT):new() :: ?TDICT,
|
2016-09-12 13:41:33 +02:00
|
|
|
subscriber_nicks = (?DICT):new() :: ?TDICT,
|
2013-03-14 10:33:02 +01:00
|
|
|
last_voice_request_time = treap:empty() :: treap:treap(),
|
2015-02-11 12:08:16 +01:00
|
|
|
robots = (?DICT):new() :: ?TDICT,
|
|
|
|
nicks = (?DICT):new() :: ?TDICT,
|
|
|
|
affiliations = (?DICT):new() :: ?TDICT,
|
2013-03-14 10:33:02 +01:00
|
|
|
history :: lqueue(),
|
|
|
|
subject = <<"">> :: binary(),
|
|
|
|
subject_author = <<"">> :: binary(),
|
|
|
|
just_created = false :: boolean(),
|
|
|
|
activity = treap:empty() :: treap:treap(),
|
|
|
|
room_shaper = none :: shaper:shaper(),
|
2015-02-11 12:08:16 +01:00
|
|
|
room_queue = queue:new() :: ?TQUEUE
|
2013-03-14 10:33:02 +01:00
|
|
|
}).
|