Anope IRC Services  Version 2.0
Data Structures | Macros | Enumerations | Functions | Variables
db_old.cpp File Reference
#include "module.h"
#include "modules/os_session.h"
#include "modules/bs_kick.h"
#include "modules/cs_mode.h"
#include "modules/bs_badwords.h"
#include "modules/os_news.h"
#include "modules/suspend.h"
#include "modules/os_forbid.h"
#include "modules/cs_entrymsg.h"
Include dependency graph for db_old.cpp:

Go to the source code of this file.

Data Structures

struct  mlock_info
 
struct  dbFILE
 
class  DBOld
 

Macros

#define READ(x)
 
#define getc_db(f)   (fgetc((f)->fp))
 
#define read_db(f, buf, len)   (fread((buf), 1, (len), (f)->fp))
 
#define read_buffer(buf, f)   (read_db((f), (buf), sizeof(buf)) == sizeof(buf))
 
#define OLD_BI_PRIVATE   0x0001
 
#define OLD_NI_KILLPROTECT   0x00000001 /* Kill others who take this nick */
 
#define OLD_NI_SECURE   0x00000002 /* Don't recognize unless IDENTIFY'd */
 
#define OLD_NI_MSG   0x00000004 /* Use PRIVMSGs instead of NOTICEs */
 
#define OLD_NI_MEMO_HARDMAX   0x00000008 /* Don't allow user to change memo limit */
 
#define OLD_NI_MEMO_SIGNON   0x00000010 /* Notify of memos at signon and un-away */
 
#define OLD_NI_MEMO_RECEIVE   0x00000020 /* Notify of new memos when sent */
 
#define OLD_NI_PRIVATE   0x00000040 /* Don't show in LIST to non-servadmins */
 
#define OLD_NI_HIDE_EMAIL   0x00000080 /* Don't show E-mail in INFO */
 
#define OLD_NI_HIDE_MASK   0x00000100 /* Don't show last seen address in INFO */
 
#define OLD_NI_HIDE_QUIT   0x00000200 /* Don't show last quit message in INFO */
 
#define OLD_NI_KILL_QUICK   0x00000400 /* Kill in 20 seconds instead of 60 */
 
#define OLD_NI_KILL_IMMED   0x00000800 /* Kill immediately instead of in 60 sec */
 
#define OLD_NI_MEMO_MAIL   0x00010000 /* User gets email on memo */
 
#define OLD_NI_HIDE_STATUS   0x00020000 /* Don't show services access status */
 
#define OLD_NI_SUSPENDED   0x00040000 /* Nickname is suspended */
 
#define OLD_NI_AUTOOP   0x00080000 /* Autoop nickname in channels */
 
#define OLD_NS_NO_EXPIRE   0x0004 /* nick won't expire */
 
#define OLD_NS_VERBOTEN   0x0002
 
#define OLD_CI_KEEPTOPIC   0x00000001
 
#define OLD_CI_SECUREOPS   0x00000002
 
#define OLD_CI_PRIVATE   0x00000004
 
#define OLD_CI_TOPICLOCK   0x00000008
 
#define OLD_CI_RESTRICTED   0x00000010
 
#define OLD_CI_PEACE   0x00000020
 
#define OLD_CI_SECURE   0x00000040
 
#define OLD_CI_VERBOTEN   0x00000080
 
#define OLD_CI_ENCRYPTEDPW   0x00000100
 
#define OLD_CI_NO_EXPIRE   0x00000200
 
#define OLD_CI_MEMO_HARDMAX   0x00000400
 
#define OLD_CI_OPNOTICE   0x00000800
 
#define OLD_CI_SECUREFOUNDER   0x00001000
 
#define OLD_CI_SIGNKICK   0x00002000
 
#define OLD_CI_SIGNKICK_LEVEL   0x00004000
 
#define OLD_CI_XOP   0x00008000
 
#define OLD_CI_SUSPENDED   0x00010000
 
#define OLD_BS_DONTKICKOPS   0x00000001
 
#define OLD_BS_DONTKICKVOICES   0x00000002
 
#define OLD_BS_FANTASY   0x00000004
 
#define OLD_BS_SYMBIOSIS   0x00000008
 
#define OLD_BS_GREET   0x00000010
 
#define OLD_BS_NOBOT   0x00000020
 
#define OLD_BS_KICK_BOLDS   0x80000000
 
#define OLD_BS_KICK_COLORS   0x40000000
 
#define OLD_BS_KICK_REVERSES   0x20000000
 
#define OLD_BS_KICK_UNDERLINES   0x10000000
 
#define OLD_BS_KICK_BADWORDS   0x08000000
 
#define OLD_BS_KICK_CAPS   0x04000000
 
#define OLD_BS_KICK_FLOOD   0x02000000
 
#define OLD_BS_KICK_REPEAT   0x01000000
 
#define OLD_NEWS_LOGON   0
 
#define OLD_NEWS_OPER   1
 
#define OLD_NEWS_RANDOM   2
 

Enumerations

enum  {
  LANG_EN_US, LANG_JA_JIS, LANG_JA_EUC, LANG_JA_SJIS,
  LANG_ES, LANG_PT, LANG_FR, LANG_TR,
  LANG_IT, LANG_DE, LANG_CAT, LANG_GR,
  LANG_NL, LANG_RU, LANG_HUN, LANG_PL
}
 

Functions

static void process_mlock (ChannelInfo *ci, uint32_t lock, bool status, uint32_t *limit, Anope::string *key)
 
static void my_b64_encode (const Anope::string &src, Anope::string &target)
 
static Anope::string Hex (const char *data, size_t l)
 
static Anope::string GetLevelName (int level)
 
static char * strscpy (char *d, const char *s, size_t len)
 
static dbFILEopen_db_read (const char *service, const char *filename, int version)
 
void close_db (dbFILE *f)
 
static int read_int16 (int16_t *ret, dbFILE *f)
 
static int read_uint16 (uint16_t *ret, dbFILE *f)
 
static int read_string (Anope::string &str, dbFILE *f)
 
static int read_uint32 (uint32_t *ret, dbFILE *f)
 
int read_int32 (int32_t *ret, dbFILE *f)
 
static void LoadNicks ()
 
static void LoadVHosts ()
 
static void LoadBots ()
 
static void LoadChannels ()
 
static void LoadOper ()
 
static void LoadExceptions ()
 
static void LoadNews ()
 

Variables

static struct mlock_info mlock_infos []
 
static Anope::string hashm
 
static const char Base64 [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
 
static const char Pad64 = '='
 

Macro Definition Documentation

#define getc_db (   f)    (fgetc((f)->fp))

Definition at line 30 of file db_old.cpp.

Referenced by LoadBots(), LoadChannels(), LoadNicks(), and LoadVHosts().

#define OLD_BI_PRIVATE   0x0001

Definition at line 34 of file db_old.cpp.

Referenced by LoadBots().

#define OLD_BS_DONTKICKOPS   0x00000001

Definition at line 75 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_BS_DONTKICKVOICES   0x00000002

Definition at line 76 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_BS_FANTASY   0x00000004

Definition at line 77 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_BS_GREET   0x00000010

Definition at line 79 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_BS_KICK_BADWORDS   0x08000000

Definition at line 87 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_BS_KICK_BOLDS   0x80000000

Definition at line 83 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_BS_KICK_CAPS   0x04000000

Definition at line 88 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_BS_KICK_COLORS   0x40000000

Definition at line 84 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_BS_KICK_FLOOD   0x02000000

Definition at line 89 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_BS_KICK_REPEAT   0x01000000

Definition at line 90 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_BS_KICK_REVERSES   0x20000000

Definition at line 85 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_BS_KICK_UNDERLINES   0x10000000

Definition at line 86 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_BS_NOBOT   0x00000020

Definition at line 80 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_BS_SYMBIOSIS   0x00000008

Definition at line 78 of file db_old.cpp.

#define OLD_CI_ENCRYPTEDPW   0x00000100

Definition at line 64 of file db_old.cpp.

#define OLD_CI_KEEPTOPIC   0x00000001

Definition at line 56 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_CI_MEMO_HARDMAX   0x00000400

Definition at line 66 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_CI_NO_EXPIRE   0x00000200

Definition at line 65 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_CI_OPNOTICE   0x00000800

Definition at line 67 of file db_old.cpp.

#define OLD_CI_PEACE   0x00000020

Definition at line 61 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_CI_PRIVATE   0x00000004

Definition at line 58 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_CI_RESTRICTED   0x00000010

Definition at line 60 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_CI_SECURE   0x00000040

Definition at line 62 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_CI_SECUREFOUNDER   0x00001000

Definition at line 68 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_CI_SECUREOPS   0x00000002

Definition at line 57 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_CI_SIGNKICK   0x00002000

Definition at line 69 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_CI_SIGNKICK_LEVEL   0x00004000

Definition at line 70 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_CI_SUSPENDED   0x00010000

Definition at line 72 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_CI_TOPICLOCK   0x00000008

Definition at line 59 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_CI_VERBOTEN   0x00000080

Definition at line 63 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_CI_XOP   0x00008000

Definition at line 71 of file db_old.cpp.

Referenced by LoadChannels().

#define OLD_NEWS_LOGON   0

Definition at line 92 of file db_old.cpp.

Referenced by LoadNews().

#define OLD_NEWS_OPER   1

Definition at line 93 of file db_old.cpp.

Referenced by LoadNews().

#define OLD_NEWS_RANDOM   2

Definition at line 94 of file db_old.cpp.

Referenced by LoadNews().

#define OLD_NI_AUTOOP   0x00080000 /* Autoop nickname in channels */

Definition at line 51 of file db_old.cpp.

Referenced by LoadNicks().

#define OLD_NI_HIDE_EMAIL   0x00000080 /* Don't show E-mail in INFO */

Definition at line 43 of file db_old.cpp.

Referenced by LoadNicks().

#define OLD_NI_HIDE_MASK   0x00000100 /* Don't show last seen address in INFO */

Definition at line 44 of file db_old.cpp.

Referenced by LoadNicks().

#define OLD_NI_HIDE_QUIT   0x00000200 /* Don't show last quit message in INFO */

Definition at line 45 of file db_old.cpp.

Referenced by LoadNicks().

#define OLD_NI_HIDE_STATUS   0x00020000 /* Don't show services access status */

Definition at line 49 of file db_old.cpp.

Referenced by LoadNicks().

#define OLD_NI_KILL_IMMED   0x00000800 /* Kill immediately instead of in 60 sec */

Definition at line 47 of file db_old.cpp.

Referenced by LoadNicks().

#define OLD_NI_KILL_QUICK   0x00000400 /* Kill in 20 seconds instead of 60 */

Definition at line 46 of file db_old.cpp.

Referenced by LoadNicks().

#define OLD_NI_KILLPROTECT   0x00000001 /* Kill others who take this nick */

Definition at line 36 of file db_old.cpp.

Referenced by LoadNicks().

#define OLD_NI_MEMO_HARDMAX   0x00000008 /* Don't allow user to change memo limit */

Definition at line 39 of file db_old.cpp.

Referenced by LoadNicks().

#define OLD_NI_MEMO_MAIL   0x00010000 /* User gets email on memo */

Definition at line 48 of file db_old.cpp.

Referenced by LoadNicks().

#define OLD_NI_MEMO_RECEIVE   0x00000020 /* Notify of new memos when sent */

Definition at line 41 of file db_old.cpp.

Referenced by LoadNicks().

#define OLD_NI_MEMO_SIGNON   0x00000010 /* Notify of memos at signon and un-away */

Definition at line 40 of file db_old.cpp.

Referenced by LoadNicks().

#define OLD_NI_MSG   0x00000004 /* Use PRIVMSGs instead of NOTICEs */

Definition at line 38 of file db_old.cpp.

Referenced by LoadNicks().

#define OLD_NI_PRIVATE   0x00000040 /* Don't show in LIST to non-servadmins */

Definition at line 42 of file db_old.cpp.

Referenced by LoadNicks().

#define OLD_NI_SECURE   0x00000002 /* Don't recognize unless IDENTIFY'd */

Definition at line 37 of file db_old.cpp.

Referenced by LoadNicks().

#define OLD_NI_SUSPENDED   0x00040000 /* Nickname is suspended */

Definition at line 50 of file db_old.cpp.

Referenced by LoadNicks().

#define OLD_NS_NO_EXPIRE   0x0004 /* nick won't expire */

Definition at line 53 of file db_old.cpp.

Referenced by LoadNicks().

#define OLD_NS_VERBOTEN   0x0002

Definition at line 54 of file db_old.cpp.

Referenced by LoadNicks().

#define READ (   x)
Value:
if (true) \
{ \
if ((x) < 0) \
printf("Error, the database is broken, line %d, trying to continue... no guarantee.\n", __LINE__); \
} \
else \
static_cast<void>(0)
CoreExport string printf(const char *fmt,...)
Definition: misc.cpp:536

Definition at line 21 of file db_old.cpp.

Referenced by LoadBots(), LoadChannels(), LoadExceptions(), LoadNews(), LoadNicks(), LoadOper(), and LoadVHosts().

#define read_buffer (   buf,
 
)    (read_db((f), (buf), sizeof(buf)) == sizeof(buf))

Definition at line 32 of file db_old.cpp.

Referenced by LoadChannels(), LoadExceptions(), LoadNews(), and LoadNicks().

#define read_db (   f,
  buf,
  len 
)    (fread((buf), 1, (len), (f)->fp))

Definition at line 31 of file db_old.cpp.

Enumeration Type Documentation

anonymous enum
Enumerator
LANG_EN_US 
LANG_JA_JIS 
LANG_JA_EUC 
LANG_JA_SJIS 
LANG_ES 
LANG_PT 
LANG_FR 
LANG_TR 
LANG_IT 
LANG_DE 
LANG_CAT 
LANG_GR 
LANG_NL 
LANG_RU 
LANG_HUN 
LANG_PL 

Definition at line 125 of file db_old.cpp.

Function Documentation

void close_db ( dbFILE f)

Definition at line 349 of file db_old.cpp.

References dbFILE::fp.

Referenced by LoadBots(), LoadChannels(), LoadExceptions(), LoadNews(), LoadNicks(), LoadOper(), and LoadVHosts().

static Anope::string GetLevelName ( int  level)
static

Definition at line 217 of file db_old.cpp.

Referenced by LoadChannels().

static Anope::string Hex ( const char *  data,
size_t  l 
)
static

Definition at line 203 of file db_old.cpp.

Referenced by LoadNicks().

static void LoadBots ( )
static
static void LoadChannels ( )
static

Definition at line 736 of file db_old.cpp.

References ACCESS_FOUNDER, ACCESS_INVALID, ChanAccess::AccessUnserialize(), ChannelInfo::AddAccess(), ChannelInfo::AddAkick(), BadWords::AddBadWord(), ChannelInfo::bantype, ChannelInfo::bi, KickerData::bolds, BW_ANY, BW_END, BW_SINGLE, BW_START, SuspendInfo::by, EntryMsg::chan, ChanAccess::ci, close_db(), EntryMessageList::Create(), AccessProvider::Create(), ForbidData::created, ChanAccess::created, EntryMsg::creator, ForbidData::creator, ChanAccess::creator, Anope::CurTime, ChannelInfo::desc, Anope::string::empty(), SuspendInfo::expires, ForbidData::expires, Extensible::Extend(), BotInfo::Find(), NickCore::Find(), Anope::string::find_first_of(), FT_CHAN, getc_db, GetLevelName(), ChanAccess::last_seen, ChannelInfo::last_topic, ChannelInfo::last_topic_setter, ChannelInfo::last_topic_time, ChannelInfo::last_used, LOG_DEBUG, ForbidData::mask, MemoInfo::memomax, MemoInfo::memos, ChannelInfo::memos, EntryMsg::message, ChannelInfo::name, Anope::string::npos, OLD_BS_DONTKICKOPS, OLD_BS_DONTKICKVOICES, OLD_BS_FANTASY, OLD_BS_GREET, OLD_BS_KICK_BADWORDS, OLD_BS_KICK_BOLDS, OLD_BS_KICK_CAPS, OLD_BS_KICK_COLORS, OLD_BS_KICK_FLOOD, OLD_BS_KICK_REPEAT, OLD_BS_KICK_REVERSES, OLD_BS_KICK_UNDERLINES, OLD_BS_NOBOT, OLD_CI_KEEPTOPIC, OLD_CI_MEMO_HARDMAX, OLD_CI_NO_EXPIRE, OLD_CI_PEACE, OLD_CI_PRIVATE, OLD_CI_RESTRICTED, OLD_CI_SECURE, OLD_CI_SECUREFOUNDER, OLD_CI_SECUREOPS, OLD_CI_SIGNKICK, OLD_CI_SIGNKICK_LEVEL, OLD_CI_SUSPENDED, OLD_CI_TOPICLOCK, OLD_CI_VERBOTEN, OLD_CI_XOP, open_db_read(), Memo::owner, READ, read_buffer, read_int16(), read_int32(), read_string(), read_uint16(), read_uint32(), SuspendInfo::reason, ForbidData::reason, Extensible::Require(), Memo::sender, ChannelInfo::SetFounder(), ChannelInfo::SetLevel(), ChanAccess::SetMask(), ChannelInfo::SetSuccessor(), Extensible::Shrink(), stringify(), Memo::text, Memo::time, ChannelInfo::time_registered, TTB_SIZE, ForbidData::type, Anope::string::upper(), SuspendInfo::what, SuspendInfo::when, and EntryMsg::when.

Referenced by DBOld::OnLoadDatabase().

static void LoadExceptions ( )
static
static void LoadNews ( )
static
static void LoadNicks ( )
static
static void LoadOper ( )
static
static void LoadVHosts ( )
static
static void my_b64_encode ( const Anope::string src,
Anope::string target 
)
static

Definition at line 167 of file db_old.cpp.

References Base64, Anope::string::clear(), Anope::string::length(), and Pad64.

Referenced by LoadNicks().

static dbFILE* open_db_read ( const char *  service,
const char *  filename,
int  version 
)
static
static void process_mlock ( ChannelInfo ci,
uint32_t  lock,
bool  status,
uint32_t *  limit,
Anope::string key 
)
static
static int read_int16 ( int16_t *  ret,
dbFILE f 
)
static

Definition at line 355 of file db_old.cpp.

References dbFILE::fp.

Referenced by LoadBots(), LoadChannels(), LoadExceptions(), LoadNews(), LoadNicks(), and LoadOper().

int read_int32 ( int32_t *  ret,
dbFILE f 
)

Definition at line 419 of file db_old.cpp.

References dbFILE::fp.

Referenced by LoadBots(), LoadChannels(), LoadExceptions(), LoadNews(), LoadNicks(), LoadOper(), and LoadVHosts().

static int read_string ( Anope::string str,
dbFILE f 
)
static
static int read_uint16 ( uint16_t *  ret,
dbFILE f 
)
static

Definition at line 369 of file db_old.cpp.

References dbFILE::fp.

Referenced by LoadChannels(), LoadNicks(), and read_string().

static int read_uint32 ( uint32_t *  ret,
dbFILE f 
)
static

Definition at line 403 of file db_old.cpp.

References dbFILE::fp.

Referenced by LoadChannels(), and LoadNicks().

static char* strscpy ( char *  d,
const char *  s,
size_t  len 
)
static

Definition at line 298 of file db_old.cpp.

Referenced by open_db_read().

Variable Documentation

const char Base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
static

Definition at line 164 of file db_old.cpp.

Referenced by my_b64_encode().

Anope::string hashm
static

Definition at line 123 of file db_old.cpp.

Referenced by Anope::Decrypt(), and ENone::OnDecrypt().

struct mlock_info mlock_infos[]
static
Initial value:
= {
{'i', 0x00000001},
{'m', 0x00000002},
{'n', 0x00000004},
{'p', 0x00000008},
{'s', 0x00000010},
{'t', 0x00000020},
{'R', 0x00000100},
{'r', 0x00000200},
{'c', 0x00000400},
{'A', 0x00000800},
{'K', 0x00002000},
{'O', 0x00008000},
{'Q', 0x00010000},
{'S', 0x00020000},
{'G', 0x00100000},
{'C', 0x00200000},
{'u', 0x00400000},
{'z', 0x00800000},
{'N', 0x01000000},
{'M', 0x04000000}
}

Referenced by process_mlock().

const char Pad64 = '='
static

Definition at line 165 of file db_old.cpp.

Referenced by my_b64_encode().