diff options
author | Christophe Romain <christophe.romain@process-one.net> | 2015-02-11 12:08:16 +0100 |
---|---|---|
committer | Christophe Romain <christophe.romain@process-one.net> | 2015-02-23 09:58:00 +0100 |
commit | 0c0947a24166bc2660fcc6dbc8d5a49d9a3a99a5 (patch) | |
tree | 1cfcc291ff1e30e0e3c1a359b0d994728f536f55 /include | |
parent | Update links (diff) |
Add compatibility macros for deprecated types (thanks to Alexey)
Diffstat (limited to 'include')
-rw-r--r-- | include/ejabberd.hrl | 23 | ||||
-rw-r--r-- | include/mod_muc_room.hrl | 18 | ||||
-rw-r--r-- | include/pubsub.hrl | 2 |
3 files changed, 33 insertions, 10 deletions
diff --git a/include/ejabberd.hrl b/include/ejabberd.hrl index 6e21836a..0e5ba1b2 100644 --- a/include/ejabberd.hrl +++ b/include/ejabberd.hrl @@ -18,8 +18,9 @@ %%% %%%---------------------------------------------------------------------- -%% This macro returns a string of the ejabberd version running, e.g. "2.3.4" -%% If the ejabberd application description isn't loaded, returns atom: undefined +-ifndef(EJABBERD_HRL). +-define(EJABBERD_HRL, true). + -define(VERSION, ejabberd_config:get_version()). -define(MYHOSTS, ejabberd_config:get_myhosts()). @@ -49,3 +50,21 @@ -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/mod_muc_room.hrl b/include/mod_muc_room.hrl index 9220da41..6f170269 100644 --- a/include/mod_muc_room.hrl +++ b/include/mod_muc_room.hrl @@ -18,6 +18,8 @@ %%% %%%---------------------------------------------------------------------- +-include("ejabberd.hrl"). + -define(MAX_USERS_DEFAULT, 200). -define(SETS, gb_sets). @@ -26,7 +28,7 @@ -record(lqueue, { - queue :: queue(), + queue :: ?TQUEUE, len :: integer(), max :: integer() }). @@ -58,8 +60,8 @@ voice_request_min_interval = 1800 :: non_neg_integer(), max_users = ?MAX_USERS_DEFAULT :: non_neg_integer() | none, logging = false :: boolean(), - vcard = <<"">> :: boolean(), - captcha_whitelist = (?SETS):empty() :: gb_set() + vcard = <<"">> :: binary(), + captcha_whitelist = (?SETS):empty() :: ?TGB_SET }). -type config() :: #config{}. @@ -92,18 +94,18 @@ access = {none,none,none,none} :: {atom(), atom(), atom(), atom()}, jid = #jid{} :: jid(), config = #config{} :: config(), - users = (?DICT):new() :: dict(), + users = (?DICT):new() :: ?TDICT, last_voice_request_time = treap:empty() :: treap:treap(), - robots = (?DICT):new() :: dict(), - nicks = (?DICT):new() :: dict(), - affiliations = (?DICT):new() :: dict(), + robots = (?DICT):new() :: ?TDICT, + nicks = (?DICT):new() :: ?TDICT, + affiliations = (?DICT):new() :: ?TDICT, 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() + room_queue = queue:new() :: ?TQUEUE }). -record(muc_online_users, {us = {<<>>, <<>>} :: {binary(), binary()}, diff --git a/include/pubsub.hrl b/include/pubsub.hrl index bfbba7c5..3be41e3f 100644 --- a/include/pubsub.hrl +++ b/include/pubsub.hrl @@ -23,6 +23,8 @@ %%% This file contains pubsub types definition. %%% ==================================================================== +-include("ejabberd.hrl"). + %% ------------------------------- %% Pubsub constants -define(ERR_EXTENDED(E, C), |