Anope IRC Services  Version 1.8
Data Structures | Macros | Typedefs | Functions | Variables
os_ignore_db.c File Reference
#include "module.h"
Include dependency graph for os_ignore_db.c:

Go to the source code of this file.

Data Structures

struct  db_file_
 

Macros

#define AUTHOR   "Viper"
 
#define VERSION   VERSION_STRING
 
#define DefIgnoreDB   "os_ignore.db"
 
#define IGNOREDBVERSION   1
 
#define SEPARATOR   '^' /* End of a key, seperates keys from values */
 
#define BLOCKEND   '\n' /* End of a block, e.g. a whole ignore */
 
#define VALUEEND   '\000' /* End of a value */
 
#define SUBSTART   '\010' /* Beginning of a new subblock, closed by a BLOCKEND */
 
#define DB_READ_SUCCESS   0
 
#define DB_READ_ERROR   1
 
#define DB_EOF_ERROR   2
 
#define DB_VERSION_ERROR   3
 
#define DB_READ_BLOCKEND   4
 
#define DB_READ_SUBSTART   5
 
#define DB_WRITE_SUCCESS   0
 
#define DB_WRITE_ERROR   1
 
#define DB_WRITE_NOVAL   2
 
#define MAXKEYLEN   128
 
#define MAXVALLEN   1024
 

Typedefs

typedef struct db_file_ DBFile
 

Functions

static int new_open_db_read (DBFile *dbptr, char **key, char **value)
 
static int new_open_db_write (DBFile *dbptr)
 
static void new_close_db (FILE *fptr, char **key, char **value)
 
static int new_read_db_entry (char **key, char **value, FILE *fptr)
 
static int new_write_db_entry (const char *key, DBFile *dbptr, const char *fmt,...)
 
static int new_write_db_endofblock (DBFile *dbptr)
 
static void fill_db_ptr (DBFile *dbptr, int version, int core_version, char service[256], char filename[256])
 
static int save_ignoredb (int argc, char **argv)
 
static int backup_ignoredb (int argc, char **argv)
 
static void load_ignore_db (void)
 
static void save_ignore_db (void)
 
static void load_config (void)
 
static int reload_config (int argc, char **argv)
 
int AnopeInit (int argc, char **argv)
 
void AnopeFini (void)
 

Variables

char * IgnoreDB
 

Macro Definition Documentation

#define AUTHOR   "Viper"

Definition at line 16 of file os_ignore_db.c.

Referenced by AnopeInit().

#define BLOCKEND   '\n' /* End of a block, e.g. a whole ignore */

Definition at line 25 of file os_ignore_db.c.

Referenced by new_read_db_entry(), and new_write_db_endofblock().

#define DB_EOF_ERROR   2

Definition at line 32 of file os_ignore_db.c.

Referenced by load_ignore_db(), new_open_db_read(), and new_read_db_entry().

#define DB_READ_BLOCKEND   4

Definition at line 34 of file os_ignore_db.c.

Referenced by load_ignore_db(), and new_read_db_entry().

#define DB_READ_ERROR   1

Definition at line 31 of file os_ignore_db.c.

Referenced by load_ignore_db(), new_open_db_read(), and new_read_db_entry().

#define DB_READ_SUBSTART   5

Definition at line 35 of file os_ignore_db.c.

#define DB_READ_SUCCESS   0

Definition at line 30 of file os_ignore_db.c.

Referenced by new_open_db_read(), and new_read_db_entry().

#define DB_VERSION_ERROR   3

Definition at line 33 of file os_ignore_db.c.

Referenced by new_open_db_read().

#define DB_WRITE_ERROR   1

Definition at line 38 of file os_ignore_db.c.

Referenced by new_open_db_write(), new_write_db_endofblock(), and new_write_db_entry().

#define DB_WRITE_NOVAL   2

Definition at line 39 of file os_ignore_db.c.

Referenced by new_write_db_entry().

#define DB_WRITE_SUCCESS   0

Definition at line 37 of file os_ignore_db.c.

Referenced by new_open_db_write(), new_write_db_endofblock(), and new_write_db_entry().

#define DefIgnoreDB   "os_ignore.db"

Definition at line 20 of file os_ignore_db.c.

Referenced by load_config().

#define IGNOREDBVERSION   1

Definition at line 21 of file os_ignore_db.c.

Referenced by load_ignore_db(), and save_ignore_db().

#define MAXKEYLEN   128

Definition at line 42 of file os_ignore_db.c.

Referenced by new_open_db_read(), new_read_db_entry(), and new_write_db_entry().

#define MAXVALLEN   1024

Definition at line 43 of file os_ignore_db.c.

Referenced by new_open_db_read(), new_read_db_entry(), and new_write_db_entry().

#define SEPARATOR   '^' /* End of a key, seperates keys from values */

Definition at line 24 of file os_ignore_db.c.

Referenced by new_read_db_entry(), and new_write_db_entry().

#define SUBSTART   '\010' /* Beginning of a new subblock, closed by a BLOCKEND */

Definition at line 27 of file os_ignore_db.c.

#define VALUEEND   '\000' /* End of a value */

Definition at line 26 of file os_ignore_db.c.

Referenced by new_read_db_entry(), and new_write_db_entry().

#define VERSION   VERSION_STRING

Definition at line 17 of file os_ignore_db.c.

Referenced by AnopeInit().

Typedef Documentation

typedef struct db_file_ DBFile

Definition at line 46 of file os_ignore_db.c.

Function Documentation

void AnopeFini ( void  )

Unload the module

Definition at line 121 of file os_ignore_db.c.

References IgnoreDB, and save_ignore_db().

int AnopeInit ( int  argc,
char **  argv 
)

AnopeInit is called when the module is loaded

Parameters
argcArgument count
argvArgument list
Returns
MOD_CONT to allow the module, MOD_STOP to stop it

Definition at line 85 of file os_ignore_db.c.

References alog(), AUTHOR, backup_ignoredb(), createEventHook(), EVENT_DB_BACKUP, EVENT_DB_SAVING, EVENT_RELOAD, IgnoreDB, load_config(), load_ignore_db(), MOD_CONT, MOD_ERR_OK, MOD_STOP, moduleAddAuthor(), moduleAddEventHook(), moduleAddVersion(), moduleSetType(), reload_config(), save_ignoredb(), SUPPORTED, and VERSION.

static int backup_ignoredb ( int  argc,
char **  argv 
)
static

When anope backs her databases up, we do the same.

Definition at line 178 of file os_ignore_db.c.

References alog(), debug, EVENT_STOP, IgnoreDB, MOD_CONT, ModuleDatabaseBackup(), and stricmp().

Referenced by AnopeInit().

static void fill_db_ptr ( DBFile dbptr,
int  version,
int  core_version,
char  service[256],
char  filename[256] 
)
static
static void load_config ( void  )
static
static void load_ignore_db ( void  )
static
static void new_close_db ( FILE *  fptr,
char **  key,
char **  value 
)
static
static int new_open_db_read ( DBFile dbptr,
char **  key,
char **  value 
)
static
static int new_open_db_write ( DBFile dbptr)
static
static int new_read_db_entry ( char **  key,
char **  value,
FILE *  fptr 
)
static
static int new_write_db_endofblock ( DBFile dbptr)
static
static int new_write_db_entry ( const char *  key,
DBFile dbptr,
const char *  fmt,
  ... 
)
static
static int reload_config ( int  argc,
char **  argv 
)
static

Upon /os reload call the routines for reloading the configuration directives

Definition at line 155 of file os_ignore_db.c.

References EVENT_START, load_config(), MOD_CONT, and stricmp().

Referenced by AnopeInit().

static void save_ignore_db ( void  )
static
static int save_ignoredb ( int  argc,
char **  argv 
)
static

When anope saves her databases, we do the same.

Definition at line 167 of file os_ignore_db.c.

References EVENT_STOP, MOD_CONT, save_ignore_db(), and stricmp().

Referenced by AnopeInit().

Variable Documentation

char* IgnoreDB