aboutsummaryrefslogtreecommitdiff
path: root/src/mod_muc/mod_muc_room.hrl
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2013-03-14 10:33:02 +0100
committerBadlop <badlop@process-one.net>2013-03-14 10:33:02 +0100
commit9deb294328bb3f9eb6bd2c0e7cd500732e9b5830 (patch)
tree7e1066c130250627ee0abab44a135f583a28d07f /src/mod_muc/mod_muc_room.hrl
parentlist_to_integer/2 only works in OTP R14 and newer (diff)
Accumulated patch to binarize and indent code
Diffstat (limited to '')
-rw-r--r--src/mod_muc/mod_muc_room.hrl144
1 files changed, 85 insertions, 59 deletions
diff --git a/src/mod_muc/mod_muc_room.hrl b/src/mod_muc/mod_muc_room.hrl
index 523df3463..3bbc9318e 100644
--- a/src/mod_muc/mod_muc_room.hrl
+++ b/src/mod_muc/mod_muc_room.hrl
@@ -22,69 +22,95 @@
-define(MAX_USERS_DEFAULT, 200).
-define(SETS, gb_sets).
+
-define(DICT, dict).
--record(lqueue, {queue, len, max}).
+-record(lqueue,
+{
+ queue :: queue(),
+ 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(),
+ password_protected = false :: boolean(),
+ password = <<"">> :: binary(),
+ anonymous = true :: boolean(),
+ 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(),
+ captcha_whitelist = (?SETS):empty() :: gb_set()
+}).
+
+-type config() :: #config{}.
+
+-type role() :: moderator | participant | visitor | none.
+
+-record(user,
+{
+ jid :: jid(),
+ nick :: binary(),
+ role :: role(),
+ last_presence :: xmlel()
+}).
--record(config, {title = "",
- description = "",
- allow_change_subj = true,
- allow_query_users = true,
- allow_private_messages = true,
- allow_private_messages_from_visitors = anyone,
- allow_visitor_status = true,
- allow_visitor_nickchange = true,
- public = true,
- public_list = true,
- persistent = false,
- moderated = true,
- captcha_protected = false,
- members_by_default = true,
- members_only = false,
- allow_user_invites = false,
- password_protected = false,
- password = "",
- anonymous = true,
- allow_voice_requests = true,
- voice_request_min_interval = 1800,
- max_users = ?MAX_USERS_DEFAULT,
- logging = false,
- captcha_whitelist = ?SETS:empty()
- }).
+-record(activity,
+{
+ message_time = 0 :: integer(),
+ presence_time = 0 :: integer(),
+ message_shaper :: shaper:shaper(),
+ presence_shaper :: shaper:shaper(),
+ message :: xmlel(),
+ presence :: {binary(), xmlel()}
+}).
--record(user, {jid,
- nick,
- role,
- last_presence}).
+-record(state,
+{
+ room = <<"">> :: binary(),
+ host = <<"">> :: binary(),
+ server_host = <<"">> :: binary(),
+ access = {none,none,none,none} :: {atom(), atom(), atom(), atom()},
+ jid = #jid{} :: jid(),
+ config = #config{} :: config(),
+ users = (?DICT):new() :: dict(),
+ last_voice_request_time = treap:empty() :: treap:treap(),
+ robots = (?DICT):new() :: dict(),
+ nicks = (?DICT):new() :: dict(),
+ affiliations = (?DICT):new() :: dict(),
+ history :: lqueue(),
+ subject = <<"">> :: binary(),
+ subject_author = <<"">> :: binary(),
+ just_created = false :: boolean(),
+ activity = treap:empty() :: treap:treap(),
+ room_shaper = none :: shaper:shaper(),
+ room_queue = queue:new() :: queue()
+}).
--record(activity, {message_time = 0,
- presence_time = 0,
- message_shaper,
- presence_shaper,
- message,
- presence}).
+-record(muc_online_users, {us = {<<>>, <<>>} :: {binary(), binary()},
+ resource = <<>> :: binary() | '_',
+ room = <<>> :: binary() | '_',
+ host = <<>> :: binary() | '_'}).
--record(state, {room,
- host,
- server_host,
- mod,
- access,
- jid,
- config = #config{},
- users = ?DICT:new(),
- last_voice_request_time = treap:empty(),
- robots = ?DICT:new(),
- nicks = ?DICT:new(),
- affiliations = ?DICT:new(),
- history,
- subject = "",
- subject_author = "",
- just_created = false,
- activity = treap:empty(),
- room_shaper,
- room_queue = queue:new()}).
+-type muc_online_users() :: #muc_online_users{}.
--record(muc_online_users, {us,
- resource,
- room,
- host}).
+-type muc_room_state() :: #state{}.