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

Go to the source code of this file.

Macros

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

Functions

void moduleAddChanServCmds (void)
 
char * get_mlock_modes (ChannelInfo *ci, int complete)
 
void listchans (int count_only, const char *chan)
 
void get_chanserv_stats (long *nrec, long *memuse)
 
void cs_init (void)
 
void chanserv (User *u, char *buf)
 
void load_cs_dbase (void)
 
void save_cs_dbase (void)
 
void save_cs_rdb_dbase (void)
 
void check_modes (Channel *c)
 
int check_valid_admin (User *user, Channel *chan, int servermode)
 
int check_valid_op (User *user, Channel *chan, int servermode)
 
int check_should_op (User *user, char *chan)
 
int check_should_voice (User *user, char *chan)
 
int check_should_halfop (User *user, char *chan)
 
int check_should_owner (User *user, char *chan)
 
int check_should_protect (User *user, char *chan)
 
static void timeout_leave (Timeout *to)
 
int check_kick (User *user, char *chan, time_t chants)
 
void record_topic (const char *chan)
 
void restore_topic (char *chan)
 
int check_topiclock (Channel *c, time_t topic_time)
 
void expire_chans ()
 
void cs_remove_nick (const NickCore *nc)
 
void cs_remove_bot (const BotInfo *bi)
 
ChannelInfocs_findchan (const char *chan)
 
int check_access (User *user, ChannelInfo *ci, int what)
 
void alpha_insert_chan (ChannelInfo *ci)
 
ChannelInfomakechan (const char *chan)
 
int delchan (ChannelInfo *ci)
 
void reset_levels (ChannelInfo *ci)
 
int is_founder (User *user, ChannelInfo *ci)
 
int is_real_founder (User *user, ChannelInfo *ci)
 
int is_identified (User *user, ChannelInfo *ci)
 
ChanAccessget_access_entry (NickCore *nc, ChannelInfo *ci)
 
int get_access (User *user, ChannelInfo *ci)
 
void update_cs_lastseen (User *user, ChannelInfo *ci)
 
int get_idealban (ChannelInfo *ci, User *u, char *ret, int retlen)
 
char * cs_get_flood (ChannelInfo *ci)
 
char * cs_get_throttle (ChannelInfo *ci)
 
char * cs_get_key (ChannelInfo *ci)
 
char * cs_get_limit (ChannelInfo *ci)
 
char * cs_get_redirect (ChannelInfo *ci)
 
char * cs_get_unkwn (ChannelInfo *ci)
 
void cs_set_flood (ChannelInfo *ci, char *value)
 
void cs_set_throttle (ChannelInfo *ci, char *value)
 
void cs_set_key (ChannelInfo *ci, char *value)
 
void cs_set_limit (ChannelInfo *ci, char *value)
 
void cs_set_redirect (ChannelInfo *ci, char *value)
 
void cs_set_unkwn (ChannelInfo *ci, char *value)
 
int get_access_level (ChannelInfo *ci, NickAlias *na)
 
const char * get_xop_level (int level)
 
AutoKickis_stuck (ChannelInfo *ci, char *mask)
 
void stick_mask (ChannelInfo *ci, AutoKick *akick)
 
void stick_all (ChannelInfo *ci)
 
void CleanAccess (ChannelInfo *ci)
 

Variables

ChannelInfochanlists [256]
 
static int def_levels [][2]
 
LevelInfo levelinfo []
 
int levelinfo_maxwidth = 0
 
CSModeUtil csmodeutils []
 

Macro Definition Documentation

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

Definition at line 837 of file chanserv.c.

Referenced by load_cs_dbase(), and save_cs_dbase().

#define SAFE (   x)
Value:
do { \
if ((x) < 0) { \
log_perror("Write error on %s", ChanDBName); \
if (time(NULL) - lastwarn > WarningTimeout) { \
anope_cmd_global(NULL, "Write error on %s: %s", ChanDBName, \
strerror(errno)); \
lastwarn = time(NULL); \
} \
return; \
} \
} while (0)
E int WarningTimeout
Definition: extern.h:347
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 char * ChanDBName
Definition: extern.h:334
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 837 of file chanserv.c.

Function Documentation

void alpha_insert_chan ( ChannelInfo ci)

Definition at line 2009 of file chanserv.c.

References alog(), debug, chaninfo_::name, chaninfo_::next, chaninfo_::prev, stricmp(), and tolower.

Referenced by makechan().

void chanserv ( User u,
char *  buf 
)

Definition at line 389 of file chanserv.c.

References anope_cmd_ctcp(), CHANSERV, mod_run_cmd(), user_::nick, notice_lang(), s_ChanServ, skeleton, and stricmp().

Referenced by m_privmsg().

int check_access ( User user,
ChannelInfo ci,
int  what 
)
int check_kick ( User user,
char *  chan,
time_t  chants 
)
void check_modes ( Channel c)
int check_should_halfop ( User user,
char *  chan 
)
int check_should_op ( User user,
char *  chan 
)
int check_should_owner ( User user,
char *  chan 
)
int check_should_protect ( User user,
char *  chan 
)
int check_should_voice ( User user,
char *  chan 
)
int check_topiclock ( Channel c,
time_t  topic_time 
)
int check_valid_admin ( User user,
Channel chan,
int  servermode 
)
int check_valid_op ( User user,
Channel chan,
int  servermode 
)
void CleanAccess ( ChannelInfo ci)

Reorder the access list to get rid of unused entries

Parameters
ciThe channel to reorder the access of

Definition at line 2755 of file chanserv.c.

References chaninfo_::access, chaninfo_::accesscount, ChanAccess::in_use, ChanAccess::last_seen, ChanAccess::level, ChanAccess::nc, and srealloc().

Referenced by cs_remove_nick(), do_access(), do_set_xop(), and do_xop().

ChannelInfo* cs_findchan ( const char *  chan)
char* cs_get_flood ( ChannelInfo ci)

Definition at line 2417 of file chanserv.c.

References ircdvars_::fmode, ircd, and chaninfo_::mlock_flood.

Referenced by anope_event_capab().

char* cs_get_key ( ChannelInfo ci)

Definition at line 2447 of file chanserv.c.

References chaninfo_::mlock_key.

char* cs_get_limit ( ChannelInfo ci)

Definition at line 2458 of file chanserv.c.

References chaninfo_::mlock_limit, and snprintf().

char* cs_get_redirect ( ChannelInfo ci)

Definition at line 2476 of file chanserv.c.

References ircd, ircdvars_::Lmode, and chaninfo_::mlock_redirect.

Referenced by anope_event_capab().

char* cs_get_throttle ( ChannelInfo ci)

Definition at line 2432 of file chanserv.c.

References ircd, ircdvars_::jmode, and chaninfo_::mlock_throttle.

Referenced by anope_event_capab().

char* cs_get_unkwn ( ChannelInfo ci)

Definition at line 2493 of file chanserv.c.

Referenced by anope_event_capab().

void cs_init ( void  )

Definition at line 380 of file chanserv.c.

References moduleAddChanServCmds().

Referenced by init_secondary().

void cs_remove_bot ( const BotInfo bi)

Definition at line 1931 of file chanserv.c.

References chaninfo_::bi, and chaninfo_::next.

Referenced by delbot().

void cs_remove_nick ( const NickCore nc)
void cs_set_flood ( ChannelInfo ci,
char *  value 
)
void cs_set_key ( ChannelInfo ci,
char *  value 
)
void cs_set_limit ( ChannelInfo ci,
char *  value 
)

Definition at line 2558 of file chanserv.c.

References anope_get_limit_mode(), chaninfo_::mlock_limit, and chaninfo_::mlock_on.

void cs_set_redirect ( ChannelInfo ci,
char *  value 
)
void cs_set_throttle ( ChannelInfo ci,
char *  value 
)
void cs_set_unkwn ( ChannelInfo ci,
char *  value 
)

Definition at line 2594 of file chanserv.c.

Referenced by anope_event_capab().

int delchan ( ChannelInfo ci)
void expire_chans ( void  )
int get_access ( User user,
ChannelInfo ci 
)
ChanAccess* get_access_entry ( NickCore nc,
ChannelInfo ci 
)
int get_access_level ( ChannelInfo ci,
NickAlias na 
)
void get_chanserv_stats ( long *  nrec,
long *  memuse 
)
int get_idealban ( ChannelInfo ci,
User u,
char *  ret,
int  retlen 
)
char* get_mlock_modes ( ChannelInfo ci,
int  complete 
)
const char* get_xop_level ( int  level)

Definition at line 2628 of file chanserv.c.

References ACCESS_AOP, ACCESS_FOUNDER, ACCESS_HOP, ACCESS_SOP, ACCESS_VOP, ircdvars_::halfop, and ircd.

Referenced by access_list(), and do_alist().

int is_founder ( User user,
ChannelInfo ci 
)
int is_identified ( User user,
ChannelInfo ci 
)

Definition at line 2295 of file chanserv.c.

References c, user_::founder_chans, and user_::u_chaninfolist::next.

Referenced by do_identify(), and is_founder().

int is_real_founder ( User user,
ChannelInfo ci 
)
AutoKick* is_stuck ( ChannelInfo ci,
char *  mask 
)
void listchans ( int  count_only,
const char *  chan 
)
void load_cs_dbase ( void  )

Definition at line 423 of file chanserv.c.

References chaninfo_::access, ACCESS_INVALID, chaninfo_::accesscount, AutoKick::addtime, AK_ISNICK, AK_USED, chaninfo_::akick, chaninfo_::akickcount, alog(), chaninfo_::badwords, chaninfo_::bantype, chaninfo_::bi, chaninfo_::botflags, chaninfo_::bwcount, c, chaninfo_::c, CA_AUTOPROTECT, CA_BAN, CA_BANME, CA_KICK, CA_KICKME, CA_OPDEOP, CA_OPDEOPME, CA_PROTECT, CA_PROTECTME, CA_SIZE, CA_TOPIC, chaninfo_::capsmin, chaninfo_::capspercent, CHAN_VERSION, ChanDBName, nickcore_::channelcount, CI_INHABIT, CI_VERBOTEN, close_db(), AutoKick::creator, CSDefBantype, delchan(), chaninfo_::desc, nickcore_::display, chaninfo_::email, chaninfo_::entry_message, fatal(), findbot(), findcore(), findnick(), memo_::flags, AutoKick::flags, chaninfo_::flags, chaninfo_::floodlines, chaninfo_::floodsecs, chaninfo_::forbidby, chaninfo_::forbidreason, chaninfo_::founder, chaninfo_::founderpass, get_file_version(), getc_db, ChanAccess::in_use, badword_::in_use, ChanAccess::last_seen, chaninfo_::last_topic, chaninfo_::last_topic_setter, chaninfo_::last_topic_time, chaninfo_::last_used, ChanAccess::level, chaninfo_::levels, AutoKick::mask, MemoInfo::memocount, MemoInfo::memomax, MemoInfo::memos, chaninfo_::memos, chaninfo_::mlock_flood, chaninfo_::mlock_key, chaninfo_::mlock_limit, chaninfo_::mlock_off, chaninfo_::mlock_on, chaninfo_::mlock_redirect, memo_::moduleData, chaninfo_::name, nickalias_::nc, ChanAccess::nc, AutoKick::nc, chaninfo_::next, memo_::number, open_db(), chaninfo_::prev, read_buffer, read_int16(), read_int32(), read_string(), AutoKick::reason, chaninfo_::repeattimes, reset_levels(), s_ChanServ, SAFE, scalloc(), memo_::sender, sstrdup(), chaninfo_::successor, memo_::text, memo_::time, chaninfo_::time_registered, chaninfo_::ttb, TTB_SIZE, badword_::type, AutoKick::u, chaninfo_::url, and badword_::word.

Referenced by do_listchans(), and init_secondary().

ChannelInfo* makechan ( const char *  chan)
void moduleAddChanServCmds ( void  )

Definition at line 120 of file chanserv.c.

References ChanServCoreModules, ChanServCoreNumber, and modules_core_init().

Referenced by cs_init().

void record_topic ( const char *  chan)
void reset_levels ( ChannelInfo ci)
void restore_topic ( char *  chan)
void save_cs_dbase ( void  )

Definition at line 850 of file chanserv.c.

References chaninfo_::access, chaninfo_::accesscount, AutoKick::addtime, AK_ISNICK, AK_USED, chaninfo_::akick, chaninfo_::akickcount, chaninfo_::badwords, chaninfo_::bantype, chaninfo_::bi, chaninfo_::botflags, chaninfo_::bwcount, CA_SIZE, chaninfo_::capsmin, chaninfo_::capspercent, CHAN_VERSION, ChanDBName, close_db(), AutoKick::creator, chaninfo_::desc, nickcore_::display, chaninfo_::email, chaninfo_::entry_message, memo_::flags, AutoKick::flags, chaninfo_::flags, chaninfo_::floodlines, chaninfo_::floodsecs, chaninfo_::forbidby, chaninfo_::forbidreason, chaninfo_::founder, chaninfo_::founderpass, ChanAccess::in_use, badword_::in_use, ChanAccess::last_seen, chaninfo_::last_topic, chaninfo_::last_topic_setter, chaninfo_::last_topic_time, chaninfo_::last_used, lastwarn, ChanAccess::level, chaninfo_::levels, AutoKick::mask, MemoInfo::memocount, MemoInfo::memomax, MemoInfo::memos, chaninfo_::memos, chaninfo_::mlock_flood, chaninfo_::mlock_key, chaninfo_::mlock_limit, chaninfo_::mlock_off, chaninfo_::mlock_on, chaninfo_::mlock_redirect, chaninfo_::name, ChanAccess::nc, AutoKick::nc, chaninfo_::next, botinfo_::nick, memo_::number, open_db(), AutoKick::reason, chaninfo_::repeattimes, s_ChanServ, SAFE, memo_::sender, chaninfo_::successor, memo_::text, memo_::time, chaninfo_::time_registered, chaninfo_::ttb, TTB_SIZE, badword_::type, AutoKick::u, chaninfo_::url, badword_::word, write_buffer, write_int16(), write_int32(), write_int8, and write_string().

Referenced by save_databases().

void save_cs_rdb_dbase ( void  )
void stick_all ( ChannelInfo ci)
void stick_mask ( ChannelInfo ci,
AutoKick akick 
)
static void timeout_leave ( Timeout to)
static

Definition at line 1480 of file chanserv.c.

References anope_cmd_part(), CI_INHABIT, cs_findchan(), timeout_::data, chaninfo_::flags, and s_ChanServ.

Referenced by check_kick().

void update_cs_lastseen ( User user,
ChannelInfo ci 
)

Variable Documentation

ChannelInfo* chanlists[256]

Definition at line 22 of file chanserv.c.

CSModeUtil csmodeutils[]
Initial value:
= {
{ "DEOP", "deop", "-o", CI_OPNOTICE, CA_OPDEOP, CA_OPDEOPME },
{ "OP", "op", "+o", CI_OPNOTICE, CA_OPDEOP, CA_OPDEOPME },
{ "DEVOICE", "devoice", "-v", 0, CA_VOICE, CA_VOICEME },
{ "VOICE", "voice", "+v", 0, CA_VOICE, CA_VOICEME },
{ "DEHALFOP", "dehalfop", "-h", 0, CA_HALFOP, CA_HALFOPME },
{ "HALFOP", "halfop", "+h", 0, CA_HALFOP, CA_HALFOPME },
{ "DEPROTECT", "", "", 0, CA_PROTECT, CA_PROTECTME },
{ "PROTECT", "", "", 0, CA_PROTECT, CA_PROTECTME },
{ NULL }
}
#define CI_OPNOTICE
Definition: services.h:733
#define CA_PROTECTME
Definition: services.h:776
#define CA_OPDEOP
Definition: services.h:756
#define CA_PROTECT
Definition: services.h:777
#define CA_VOICE
Definition: services.h:769
#define CA_VOICEME
Definition: services.h:768
#define CA_OPDEOPME
Definition: services.h:773
#define CA_HALFOPME
Definition: services.h:774
#define CA_HALFOP
Definition: services.h:775

Definition at line 106 of file chanserv.c.

int def_levels[][2]
static

Definition at line 24 of file chanserv.c.

Referenced by reset_levels().

LevelInfo levelinfo[]

Definition at line 65 of file chanserv.c.

int levelinfo_maxwidth = 0

Definition at line 104 of file chanserv.c.