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

Go to the source code of this file.

Macros

#define HASH(nick)   ((tolower((nick)[0])&31)<<5 | (tolower((nick)[1])&31))
 
#define SAFE(x)
 
#define SAFE(x)
 

Functions

void load_hs_dbase_v1 (dbFILE *f)
 
void load_hs_dbase_v2 (dbFILE *f)
 
void load_hs_dbase_v3 (dbFILE *f)
 
E int do_hs_sync (NickCore *nc, char *vIdent, char *hostmask, char *creator, time_t time)
 
E void moduleAddHostServCmds (void)
 
void get_hostserv_stats (long *nrec, long *memuse)
 
void hostserv_init (void)
 
void hostserv (User *u, char *buf)
 
HostCorehostCoreListHead ()
 
HostCorecreateHostCorelist (HostCore *next, char *nick, char *vIdent, char *vHost, char *creator, int32 tmp_time)
 
HostCorefindHostCore (HostCore *head, char *nick, boolean *found)
 
HostCoreinsertHostCore (HostCore *head, HostCore *prev, char *nick, char *vIdent, char *vHost, char *creator, int32 tmp_time)
 
HostCoredeleteHostCore (HostCore *head, HostCore *prev)
 
void addHostCore (char *nick, char *vIdent, char *vhost, char *creator, int32 tmp_time)
 
char * getvHost (char *nick)
 
char * getvIdent (char *nick)
 
void delHostCore (char *nick)
 
void load_hs_dbase (void)
 
void save_hs_dbase (void)
 
void save_hs_rdb_dbase (void)
 
int do_on_id (User *u)
 
int is_host_setter (User *u)
 
int is_host_remover (User *u)
 
void set_lastmask (User *u)
 

Variables

HostCorehead = NULL
 

Macro Definition Documentation

#define HASH (   nick)    ((tolower((nick)[0])&31)<<5 | (tolower((nick)[1])&31))

Definition at line 18 of file hostserv.c.

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

Definition at line 491 of file hostserv.c.

Referenced by load_hs_dbase_v1(), load_hs_dbase_v2(), load_hs_dbase_v3(), and save_hs_dbase().

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

Function Documentation

void addHostCore ( char *  nick,
char *  vIdent,
char *  vhost,
char *  creator,
int32  tmp_time 
)
HostCore* createHostCorelist ( HostCore next,
char *  nick,
char *  vIdent,
char *  vHost,
char *  creator,
int32  tmp_time 
)

Create HostCore list member

Parameters
nextHostCore next slot
nickNick to add
vIdentVirtual Ident
vHostVirtual Host
creatorPerson whom set the vhost
timeTime the vhost was Set
Returns
HostCore

Definition at line 131 of file hostserv.c.

References anope_cmd_global(), hostcore_::creator, hostcore_::next, hostcore_::nick, s_HostServ, hostcore_::time, hostcore_::vHost, and hostcore_::vIdent.

Referenced by addHostCore(), and my_add_host_request().

HostCore* deleteHostCore ( HostCore head,
HostCore prev 
)
void delHostCore ( char *  nick)
E int do_hs_sync ( NickCore nc,
char *  vIdent,
char *  hostmask,
char *  creator,
time_t  time 
)

Definition at line 568 of file hostserv.c.

References addHostCore(), nickcore_::aliases, slist_::count, slist_::list, MOD_CONT, and nickalias_::nick.

Referenced by do_group(), and do_setall().

int do_on_id ( User u)
HostCore* findHostCore ( HostCore head,
char *  nick,
boolean found 
)

Returns either NULL for the head, or the location of the PREVIOUS record, this is where we need to insert etc..

Parameters
headHostCore head
nickNick to find
foundIf found
Returns
HostCore

Definition at line 180 of file hostserv.c.

References current, head, hostcore_::next, hostcore_::nick, and stricmp().

Referenced by addHostCore(), delHostCore(), do_group(), getvHost(), getvIdent(), hs_do_activate(), hs_do_reject(), hsreqevt_nick_dropped(), and my_add_host_request().

void get_hostserv_stats ( long *  nrec,
long *  memuse 
)

Return information on memory use. Assumes pointers are valid.

Definition at line 45 of file hostserv.c.

References hostcore_::creator, hostcore_::next, hostcore_::nick, hostcore_::vHost, and hostcore_::vIdent.

Referenced by do_stats().

char* getvHost ( char *  nick)

Definition at line 315 of file hostserv.c.

References findHostCore(), hostcore_::next, and hostcore_::vHost.

Referenced by do_info(), do_off(), do_on(), and do_on_id().

char* getvIdent ( char *  nick)

Definition at line 330 of file hostserv.c.

References findHostCore(), hostcore_::next, and hostcore_::vIdent.

Referenced by do_info(), do_off(), do_on(), and do_on_id().

HostCore* hostCoreListHead ( )

Definition at line 116 of file hostserv.c.

References head.

Referenced by do_group(), and listOut().

void hostserv ( User u,
char *  buf 
)

Main HostServ routine.

Parameters
uUser Struct
bufBuffer holding the message
Returns
void

Definition at line 88 of file hostserv.c.

References anope_cmd_ctcp(), HOSTSERV, ircd, mod_run_cmd(), user_::nick, notice_lang(), s_HostServ, skeleton, stricmp(), and ircdvars_::vhost.

Referenced by m_privmsg().

void hostserv_init ( void  )

HostServ initialization.

Returns
void

Definition at line 73 of file hostserv.c.

References moduleAddHostServCmds(), and s_HostServ.

Referenced by init_secondary().

HostCore* insertHostCore ( HostCore head,
HostCore prev,
char *  nick,
char *  vIdent,
char *  vHost,
char *  creator,
int32  tmp_time 
)
int is_host_remover ( User u)

Definition at line 639 of file hostserv.c.

References is_host_setter().

Referenced by AnopeInit(), do_help_limited(), and myHostServHelp().

int is_host_setter ( User u)
void load_hs_dbase ( void  )
void load_hs_dbase_v1 ( dbFILE f)

Definition at line 408 of file hostserv.c.

References addHostCore(), c, fatal(), getc_db, HostDBName, read_string(), and SAFE.

Referenced by load_hs_dbase().

void load_hs_dbase_v2 ( dbFILE f)

Definition at line 433 of file hostserv.c.

References addHostCore(), c, fatal(), getc_db, HostDBName, read_int32(), read_string(), and SAFE.

Referenced by load_hs_dbase().

void load_hs_dbase_v3 ( dbFILE f)

Definition at line 460 of file hostserv.c.

References addHostCore(), c, fatal(), getc_db, HostDBName, read_int32(), read_string(), and SAFE.

Referenced by load_hs_dbase().

void moduleAddHostServCmds ( void  )

Definition at line 33 of file hostserv.c.

References HostServCoreModules, HostServCoreNumber, and modules_core_init().

Referenced by hostserv_init().

void save_hs_dbase ( void  )
void save_hs_rdb_dbase ( void  )
void set_lastmask ( User u)

Definition at line 647 of file hostserv.c.

References common_get_vhost(), common_get_vident(), nickalias_::last_usermask, user_::na, and smalloc().

Referenced by do_on(), and do_on_id().

Variable Documentation

HostCore* head = NULL