/* NickServ functions.
*
* (C) 2003-2008 Anope Team
* Contact us at info@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
* $Id$
*
*/
#include "services.h"
#include "pseudo.h"
/*************************************************************************/
#define HASH(nick) ((tolower((nick)[0])&31)<<5 | (tolower((nick)[1])&31))
NickAlias *nalists[1024];
NickCore *nclists[1024];
NickRequest *nrlists[1024];
unsigned int guestnum; /* Current guest number */
#define TO_COLLIDE 0 /* Collide the user with this nick */
#define TO_RELEASE 1 /* Release a collided nick */
/*************************************************************************/
static void add_ns_timeout(NickAlias * na, int type, time_t delay);
/*************************************************************************/
/* *INDENT-OFF* */
void moduleAddNickServCmds(void) {
ModuleManager::LoadModuleList(NickServCoreNumber, NickServCoreModules);
}
/* *INDENT-ON* */
/*************************************************************************/
/* Return information on memory use. Assumes pointers are valid. */
void get_aliases_stats(long *nrec, long *memuse)
{
long count = 0, mem = 0;
int i;
NickAlias *na;
for (i = 0; i < 1024; i++) {
for (na = nalists[i]; na; na = na->next) {
count++;
mem += sizeof(*na);
if (na->nick)
mem += strlen(na->nick) + 1;
if (na->last_usermask)
mem += strlen(na->last_usermask) + 1;
if (na->last_realname)
mem += strlen(na->last_realname) + 1;
if (na->last_quit)
mem += strlen(na->last_quit) + 1;
}
}
*nrec = count;
*memuse = mem;
}
/*************************************************************************/
/* Return information on memory use. Assumes pointers are valid. */
void get_core_stats(long *nrec, long *memuse)
{
long count = 0, mem = 0;
int i, j;
NickCore *nc;
char **accptr;
for (i = 0; i < 1024; i++) {
for (nc = nclists[i]; nc; nc = nc->next) {
count++;
mem += sizeof(*nc);
if (nc->display)
mem += strlen(nc->display) + 1;
if (nc->pass)
mem += strlen(nc->pass) + 1;
if (nc->url)
mem += strlen(nc-&
|