Anope IRC Services  Version 1.8
Macros | Functions | Variables
operserv.c File Reference
#include "services.h"
#include "pseudo.h"
Include dependency graph for operserv.c:

Go to the source code of this file.

Macros

#define SAFE(x)
 
#define SAFE(x)
 
#define SAFE(x)
 

Functions

static int compare_adminlist_entries (SList *slist, void *item1, void *item2)
 
static int compare_operlist_entries (SList *slist, void *item1, void *item2)
 
static void free_adminlist_entry (SList *slist, void *item)
 
static void free_operlist_entry (SList *slist, void *item)
 
static int is_akill_entry_equal (SList *slist, void *item1, void *item2)
 
static void free_akill_entry (SList *slist, void *item)
 
static int is_sgline_entry_equal (SList *slist, void *item1, void *item2)
 
static void free_sgline_entry (SList *slist, void *item)
 
static int is_sqline_entry_equal (SList *slist, void *item1, void *item2)
 
static void free_sqline_entry (SList *slist, void *item)
 
static int is_szline_entry_equal (SList *slist, void *item1, void *item2)
 
static void free_szline_entry (SList *slist, void *item)
 
char * defconReverseModes (const char *modes)
 
void moduleAddOperServCmds (void)
 
void os_init (void)
 
void operserv (User *u, char *buf)
 
static void load_old_akill (void)
 
void load_os_dbase (void)
 
void save_os_dbase (void)
 
void save_os_rdb_dbase (void)
 
void os_remove_nick (NickCore *nc)
 
int is_services_root (User *u)
 
int is_services_admin (User *u)
 
int is_services_oper (User *u)
 
int nick_is_services_root (NickCore *nc)
 
int nick_is_services_admin (NickCore *nc)
 
int nick_is_services_oper (NickCore *nc)
 
Serverserver_global (Server *s, char *msg)
 
void oper_global (char *nick, char *fmt,...)
 
int add_akill (User *u, char *mask, const char *by, const time_t expires, const char *reason)
 
int check_akill (char *nick, const char *username, const char *host, const char *vhost, const char *ip)
 
void expire_akills (void)
 
int add_sgline (User *u, char *mask, const char *by, const time_t expires, const char *reason)
 
int check_sgline (char *nick, const char *realname)
 
void expire_sglines (void)
 
int add_sqline (User *u, char *mask, const char *by, const time_t expires, const char *reason)
 
int check_sqline (char *nick, int nick_change)
 
int check_chan_sqline (const char *chan)
 
void expire_sqlines (void)
 
int add_szline (User *u, char *mask, const char *by, const time_t expires, const char *reason)
 
int check_szline (char *nick, char *ip)
 
void expire_szlines (void)
 
int checkDefCon (int level)
 
void resetDefCon (int level)
 
void runDefCon (void)
 
int defconParseModeString (const char *str)
 

Variables

SList servadmins
 
SList servopers
 
SList akills
 
SList sglines
 
SList sqlines
 
SList szlines
 
time_t DefContimer
 
int DefConModesSet = 0
 
uint32 DefConModesOn
 
uint32 DefConModesOff
 
ChannelInfo DefConModesCI
 
SListOpts akopts = { 0, NULL, &is_akill_entry_equal, &free_akill_entry }
 
SListOpts saopts
 
SListOpts sgopts = { 0, NULL, &is_sgline_entry_equal, &free_sgline_entry }
 
SListOpts soopts
 
SListOpts sqopts
 
SListOpts szopts = { 0, NULL, &is_szline_entry_equal, &free_szline_entry }
 

Macro Definition Documentation

#define SAFE (   x)
Value:
do { \
if ((x) < 0) { \
if (!forceload) \
fatal("Read error on %s", AutokillDBName); \
break; \
} \
} while (0)
E void E void E void fatal(const char *fmt,...) FORMAT(printf
E char * AutokillDBName
Definition: extern.h:337
E int forceload
Definition: extern.h:780

Definition at line 420 of file operserv.c.

Referenced by load_old_akill(), load_os_dbase(), and save_os_dbase().

#define SAFE (   x)
Value:
do { \
if ((x) < 0) { \
if (!forceload) \
fatal("Read error on %s", OperDBName); \
failed = 1; \
break; \
} \
} while (0)
E char * OperDBName
Definition: extern.h:336
E void E void E void fatal(const char *fmt,...) FORMAT(printf
E int forceload
Definition: extern.h:780

Definition at line 420 of file operserv.c.

#define SAFE (   x)
Value:
do { \
if ((x) < 0) { \
log_perror("Write error on %s", OperDBName); \
if (time(NULL) - lastwarn > WarningTimeout) { \
anope_cmd_global(NULL, "Write error on %s: %s", OperDBName, \
strerror(errno)); \
lastwarn = time(NULL); \
} \
return; \
} \
} while (0)
E int WarningTimeout
Definition: extern.h:347
E char * OperDBName
Definition: extern.h:336
E void restore_db(dbFILE *f)
Definition: datafiles.c:318
E char * strerror(int errnum)
Definition: compat.c:123
static time_t lastwarn
Definition: datafiles.c:19
E void E void log_perror(const char *fmt,...) FORMAT(printf
E void anope_cmd_global(char *source, const char *fmt,...)
Definition: ircd.c:506

Definition at line 420 of file operserv.c.

Function Documentation

int add_akill ( User u,
char *  mask,
const char *  by,
const time_t  expires,
const char *  reason 
)
int add_sgline ( User u,
char *  mask,
const char *  by,
const time_t  expires,
const char *  reason 
)
int add_sqline ( User u,
char *  mask,
const char *  by,
const time_t  expires,
const char *  reason 
)
int add_szline ( User u,
char *  mask,
const char *  by,
const time_t  expires,
const char *  reason 
)
int check_akill ( char *  nick,
const char *  username,
const char *  host,
const char *  vhost,
const char *  ip 
)
int check_chan_sqline ( const char *  chan)

Definition at line 1296 of file operserv.c.

References slist_::count, slist_::list, sxline_::mask, match_wild_nocase(), sxline_::reason, and sqline().

Referenced by do_sjoin().

int check_sgline ( char *  nick,
const char *  realname 
)
int check_sqline ( char *  nick,
int  nick_change 
)
int check_szline ( char *  nick,
char *  ip 
)
int checkDefCon ( int  level)

Returns 1 if the passed level is part of the CURRENT defcon, else 0 is returned

Definition at line 1608 of file operserv.c.

References DefCon, and DefConLevel.

Referenced by add_session(), check_akill(), defcon_sendlvls(), do_group(), do_nick(), do_register(), do_run_cmd(), do_sendall(), do_set_mlock(), do_staff(), memo_send_from(), req_send_memos(), rsend_notify(), and runDefCon().

static int compare_adminlist_entries ( SList slist,
void *  item1,
void *  item2 
)
static

Definition at line 1549 of file operserv.c.

References nickcore_::display, and stricmp().

static int compare_operlist_entries ( SList slist,
void *  item1,
void *  item2 
)
static

Definition at line 1570 of file operserv.c.

References nickcore_::display, and stricmp().

int defconParseModeString ( const char *  str)
char * defconReverseModes ( const char *  modes)

Reverse the mode string, used for remove DEFCON chan modes.

Definition at line 1676 of file operserv.c.

Referenced by runDefCon().

void expire_akills ( void  )
void expire_sglines ( void  )
void expire_sqlines ( void  )
void expire_szlines ( void  )
static void free_adminlist_entry ( SList slist,
void *  item 
)
static

Definition at line 1560 of file operserv.c.

References nickcore_::flags, and NI_SERVICES_ADMIN.

static void free_akill_entry ( SList slist,
void *  item 
)
static
static void free_operlist_entry ( SList slist,
void *  item 
)
static

Definition at line 1581 of file operserv.c.

References nickcore_::flags, and NI_SERVICES_OPER.

static void free_sgline_entry ( SList slist,
void *  item 
)
static

Definition at line 1122 of file operserv.c.

References anope_cmd_unsgline(), sxline_::by, sxline_::mask, and sxline_::reason.

static void free_sqline_entry ( SList slist,
void *  item 
)
static

Definition at line 1343 of file operserv.c.

References anope_cmd_unsqline(), sxline_::by, sxline_::mask, and sxline_::reason.

static void free_szline_entry ( SList slist,
void *  item 
)
static

Definition at line 1514 of file operserv.c.

References anope_cmd_unszline(), sxline_::by, sxline_::mask, and sxline_::reason.

static int is_akill_entry_equal ( SList slist,
void *  item1,
void *  item2 
)
static

Definition at line 949 of file operserv.c.

References BUFSIZE, akill_::host, snprintf(), stricmp(), and akill_::user.

int is_services_admin ( User u)
int is_services_oper ( User u)
int is_services_root ( User u)
static int is_sgline_entry_equal ( SList slist,
void *  item1,
void *  item2 
)
static

Definition at line 1138 of file operserv.c.

References sxline_::mask, and stricmp().

static int is_sqline_entry_equal ( SList slist,
void *  item1,
void *  item2 
)
static

Definition at line 1359 of file operserv.c.

References sxline_::mask, and stricmp().

static int is_szline_entry_equal ( SList slist,
void *  item1,
void *  item2 
)
static

Definition at line 1531 of file operserv.c.

References sxline_::mask, and stricmp().

static void load_old_akill ( void  )
static
void load_os_dbase ( void  )
void moduleAddOperServCmds ( void  )
int nick_is_services_admin ( NickCore nc)
int nick_is_services_oper ( NickCore nc)

Definition at line 649 of file operserv.c.

References NI_SERVICES_ADMIN, NI_SERVICES_OPER, and NI_SERVICES_ROOT.

Referenced by do_info(), and do_staff().

int nick_is_services_root ( NickCore nc)

Definition at line 623 of file operserv.c.

References nickcore_::flags, and NI_SERVICES_ROOT.

Referenced by do_info().

void oper_global ( char *  nick,
char *  fmt,
  ... 
)
void operserv ( User u,
char *  buf 
)

Definition at line 129 of file operserv.c.

References alog(), anope_cmd_ctcp(), mod_run_cmd(), user_::nick, OPERSERV, s_OperServ, and stricmp().

Referenced by m_privmsg().

void os_init ( void  )
void os_remove_nick ( NickCore nc)

Definition at line 566 of file operserv.c.

References slist_remove().

Referenced by delcore().

void resetDefCon ( int  level)

Automaticaly re-set the DefCon level if the time limit has expired.

Definition at line 1616 of file operserv.c.

References alog(), anope_cmd_global(), DefConLevel, DefconMessage, DefConOffMessage, DefConTimeOut, DefContimer, dotime(), EVENT_DEFCON_LEVEL, getstring, getstring2, GlobalOnDefcon, GlobalOnDefconMore, oper_global(), runDefCon(), s_OperServ, send_event(), and snprintf().

Referenced by main().

void runDefCon ( void  )

Run DefCon level specific Functions.

Definition at line 1648 of file operserv.c.

References alog(), checkDefCon(), DEFCON_FORCE_CHAN_MODES, DefConChanModes, DefConModesSet, defconReverseModes(), and do_mass_mode().

Referenced by do_defcon(), and resetDefCon().

void save_os_dbase ( void  )
void save_os_rdb_dbase ( void  )
Server* server_global ( Server s,
char *  msg 
)

Variable Documentation

SList akills

Definition at line 24 of file operserv.c.

Definition at line 65 of file operserv.c.

Referenced by os_init().

ChannelInfo DefConModesCI

Definition at line 50 of file operserv.c.

uint32 DefConModesOff

Definition at line 49 of file operserv.c.

Referenced by defconParseModeString().

uint32 DefConModesOn

Definition at line 48 of file operserv.c.

Referenced by defconParseModeString().

int DefConModesSet = 0

Definition at line 45 of file operserv.c.

Referenced by runDefCon().

time_t DefContimer

Definition at line 44 of file operserv.c.

Referenced by resetDefCon().

SListOpts saopts
Initial value:
}
static int compare_adminlist_entries(SList *slist, void *item1, void *item2)
Definition: operserv.c:1549
static void free_adminlist_entry(SList *slist, void *item)
Definition: operserv.c:1560
#define SLISTF_SORT
Definition: slist.h:41

Definition at line 66 of file operserv.c.

Referenced by os_init().

SList servadmins

Definition at line 20 of file operserv.c.

SList servopers

Definition at line 22 of file operserv.c.

SList sglines

Definition at line 24 of file operserv.c.

Definition at line 70 of file operserv.c.

Referenced by os_init().

SListOpts soopts
Initial value:
=
static void free_operlist_entry(SList *slist, void *item)
Definition: operserv.c:1581
static int compare_operlist_entries(SList *slist, void *item1, void *item2)
Definition: operserv.c:1570
#define SLISTF_SORT
Definition: slist.h:41

Definition at line 71 of file operserv.c.

Referenced by os_init().

SList sqlines

Definition at line 24 of file operserv.c.

SListOpts sqopts
Initial value:
=
static void free_sqline_entry(SList *slist, void *item)
Definition: operserv.c:1343
static int is_sqline_entry_equal(SList *slist, void *item1, void *item2)
Definition: operserv.c:1359
#define SLISTF_SORT
Definition: slist.h:41

Definition at line 73 of file operserv.c.

Referenced by os_init().

SList szlines

Definition at line 24 of file operserv.c.

Definition at line 75 of file operserv.c.

Referenced by os_init().