hostserv.c File Reference

#include "services.h"
#include "pseudo.h"

Go to the source code of this file.

Defines

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

Functions

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

Variables

HostCorehead = NULL


Define Documentation

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

Definition at line 19 of file hostserv.c.

#define SAFE (  ) 

Value:

do {                        \
    if ((x) < 0) {                      \
    restore_db(f);                      \
    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)

Definition at line 463 of file hostserv.c.

#define SAFE (  ) 

Value:

do {                    \
    if ((x) < 0) {                  \
    if (!forceload)                 \
        fatal("Read error on %s", HostDBName);  \
    failed = 1;                 \
    break;                      \
    }                           \
} while (0)

Definition at line 463 of file hostserv.c.


Function Documentation

void addHostCore ( char *  nick,
char *  vIdent,
char *  vhost,
char *  creator,
int32  tmp_time 
)

Definition at line 263 of file hostserv.c.

References addHostCore(), createHostCorelist(), deleteHostCore(), findHostCore(), head, and insertHostCore().

Referenced by addHostCore(), db_mysql_load_hs_dbase(), do_hs_sync(), hs_do_activate(), load_hs_dbase_v1(), load_hs_dbase_v2(), load_hs_dbase_v3(), and myDoSet().

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

Create HostCore list member

Parameters:
next HostCore next slot
nick Nick to add
vIdent Virtual Ident
vHost Virtual Host
creator Person whom set the vhost
time Time the vhost was Set
Returns:
HostCore

Definition at line 103 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 
)

Definition at line 240 of file hostserv.c.

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

Referenced by addHostCore(), AnopeFini(), delHostCore(), hs_do_activate(), hs_do_reject(), my_add_host_request(), and ns_do_drop().

void delHostCore ( char *  nick  ) 

Definition at line 317 of file hostserv.c.

References alog(), deleteHostCore(), findHostCore(), head, rdb_close(), rdb_open(), rdb_quote(), rdb_scrub_table(), and snprintf().

Referenced by delnick(), do_del(), and do_delall().

E int do_hs_sync ( NickCore nc,
char *  vIdent,
char *  hostmask,
char *  creator,
time_t  time 
)

int do_on_id ( User u  ) 

Definition at line 554 of file hostserv.c.

References anope_cmd_vhost_on(), getvHost(), getvIdent(), ircd, MOD_CONT, user_::nick, notice_lang(), s_HostServ, set_lastmask(), sstrdup(), user_::vhost, ircdvars_::vhost, user_::vident, and ircdvars_::vident.

Referenced by do_nickupdate().

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:
head HostCore head
nick Nick to find
found If found
Returns:
HostCore

Definition at line 152 of file hostserv.c.

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

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

char* getvHost ( char *  nick  ) 

Definition at line 287 of file hostserv.c.

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

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

char* getvIdent ( char *  nick  ) 

Definition at line 302 of file hostserv.c.

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

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

HostCore* hostCoreListHead (  ) 

Definition at line 88 of file hostserv.c.

References head.

Referenced by do_group(), and listOut().

void hostserv ( User u,
char *  buf 
)

Main HostServ routine.

Parameters:
u User Struct
buf Buffer holding the message
Returns:
void

Definition at line 60 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 45 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 
)

Definition at line 184 of file hostserv.c.

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

Referenced by addHostCore(), and my_add_host_request().

int is_host_remover ( User u  ) 

Definition at line 606 of file hostserv.c.

References is_host_setter().

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

int is_host_setter ( User u  ) 

Definition at line 581 of file hostserv.c.

References nickcore_::aliases, slist_::count, HostNumber, HostSetters, is_services_oper(), slist_::list, user_::na, nickalias_::nc, nickalias_::nick, nick_identified(), and stricmp().

Referenced by AnopeInit(), do_help_limited(), hs_help(), hs_help_activate(), hs_help_reject(), hs_help_waiting(), and is_host_remover().

void load_hs_dbase ( void   ) 

Definition at line 360 of file hostserv.c.

References close_db(), get_file_version(), HOST_VERSION, HostDBName, load_hs_dbase_v1(), load_hs_dbase_v2(), load_hs_dbase_v3(), open_db(), and s_HostServ.

Referenced by init_secondary().

void load_hs_dbase_v1 ( dbFILE f  ) 

Definition at line 380 of file hostserv.c.

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

Referenced by load_hs_dbase().

void load_hs_dbase_v2 ( dbFILE f  ) 

Definition at line 405 of file hostserv.c.

References addHostCore(), 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 432 of file hostserv.c.

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

Referenced by load_hs_dbase().

void moduleAddHostServCmds ( void   ) 

Definition at line 34 of file hostserv.c.

References HostServCoreModules, HostServCoreNumber, and modules_core_init().

Referenced by hostserv_init().

void save_hs_dbase ( void   ) 

Definition at line 476 of file hostserv.c.

References close_db(), hostcore_::creator, head, HOST_VERSION, HostDBName, hostcore_::next, hostcore_::nick, open_db(), s_HostServ, SAFE, hostcore_::time, hostcore_::vHost, hostcore_::vIdent, write_int32(), write_int8, and write_string().

Referenced by save_databases().

void save_hs_rdb_dbase ( void   ) 

Definition at line 502 of file hostserv.c.

References alog(), head, rdb_clean_table(), rdb_close(), rdb_open(), rdb_save_hs_core(), and rdb_tag_table().

Referenced by save_databases().

void set_lastmask ( User u  ) 

Definition at line 614 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

Definition at line 25 of file hostserv.c.

Referenced by addHostCore(), deleteHostCore(), delHostCore(), do_group(), findHostCore(), getvHost(), getvIdent(), hostCoreListHead(), insertHostCore(), listOut(), save_hs_dbase(), save_hs_rdb_dbase(), smtp_add_header(), and smtp_send_email().


Generated on Sun Dec 30 09:26:56 2007 for Anope by  doxygen 1.5.1-20070107