udpated services with new variables for 2.5 code and started

moving lists and hash's
This commit is contained in:
fishwaldo 2002-03-31 08:37:14 +00:00
parent 7e62d64b70
commit 07282abebb
8 changed files with 272 additions and 172 deletions

View file

@ -8,11 +8,11 @@ INSTALL_DATA = @INSTALL_DATA@
DIRECTORY=@DIRINST@/dl/
INCLUDES=-I@DIRINST@/include/ -I.
SOURCES= match.c hash.c servicescore.c nickserv.c language.c
OBJECTS= match.o hash.o servicescore.o nickserv.o
SOURCES= match.c hash.c servicescore.c nickserv.c language.c svc_help.c
OBJECTS= match.o hash.o servicescore.o nickserv.o language.o svc_help.o
TARGET= services.so
DOCS=README.services
DATA= lang/en_us
all: module
@ -35,12 +35,13 @@ clean:
install: module
$(INSTALL) -m 644 $(TARGET) $(DIRECTORY)
$(INSTALL) -m 644 $(DOCS) @DIRINST@/docs/
# $(INSTALL) -m 644 $(DOCS) @DIRINST@/docs/
$(INSTALL) -m 644 $(DATA) $(DIRECTORY)../data/
$(OBJECTS): Makefile
match.o: match.c
hash.o: hash.c
servicescore.o: hash.c match.c language.c nickserv.c
nickserv.o: match.c hash.c servicescore.c
langauges.o: servicescore.c nickserv.c
match.o: match.c services.h
hash.o: hash.c services.h
servicescore.o: hash.c match.c language.c nickserv.c services.h
nickserv.o: match.c hash.c servicescore.c services.h
langauges.o: servicescore.c nickserv.c services.h

97
configure vendored
View file

@ -779,6 +779,11 @@ if test -n "$ac_init_help"; then
cat <<\_ACEOF
Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-debug - Enable Debuging
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
@ -2049,6 +2054,98 @@ fi
echo "$as_me:$LINENO: checking for db_create in -ldb" >&5
echo $ECHO_N "checking for db_create in -ldb... $ECHO_C" >&6
if test "${ac_cv_lib_db_db_create+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldb $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char db_create ();
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
extern "C"
# endif
int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
db_create ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_db_db_create=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
ac_cv_lib_db_db_create=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_db_db_create" >&5
echo "${ECHO_T}$ac_cv_lib_db_db_create" >&6
if test $ac_cv_lib_db_db_create = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBDB 1
_ACEOF
LIBS="-ldb $LIBS"
fi
echo "$as_me:$LINENO: checking Whether to Enable Debuging..." >&5
echo $ECHO_N "checking Whether to Enable Debuging...... $ECHO_C" >&6
# Check whether --enable-debug or --disable-debug was given.
if test "${enable_debug+set}" = set; then
enableval="$enable_debug"
case "$enableval" in
yes)
CFLAGS="$CFLAGS -ggdb"
echo "$as_me:$LINENO: result: yes - Watch your Log Files" >&5
echo "${ECHO_T}yes - Watch your Log Files" >&6
;;
*)
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
;;
esac
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi;
ac_config_files="$ac_config_files Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure

View file

@ -22,7 +22,28 @@ AC_CHECK_FILE($DIRINST/include/dl.h,
[INCLUDEDIR="$DIRINST/include/"],
[AC_MSG_ERROR(Can't find existing NeoStats Installation please supply with --with-neostats option)])
AC_CHECK_LIB(db, db_create)
dnl check if we are running with Debug....
AC_MSG_CHECKING(Whether to Enable Debuging...)
AC_ARG_ENABLE(debug,
[ --enable-debug - Enable Debuging],
[ case "$enableval" in
yes)
CFLAGS="$CFLAGS -ggdb"
AC_MSG_RESULT(yes - Watch your Log Files)
;;
*)
AC_MSG_RESULT(no)
;;
esac],
AC_MSG_RESULT(no)
)
AC_SUBST(DIRINST)
AC_SUBST(CFLAGS)
AC_OUTPUT(Makefile)
echo "(*----------------------------------------------------------*)"
echo "(| Important Instructions |)"

95
hash.c
View file

@ -5,7 +5,7 @@
** Based from GeoStats 1.1.0 by Johnathan George net@lite.net
*
** NetStats CVS Identification
** $Id: hash.c,v 1.2 2002/03/28 08:58:16 fishwaldo Exp $
** $Id: hash.c,v 1.3 2002/03/31 08:37:14 fishwaldo Exp $
*/
@ -18,48 +18,24 @@ void del_svs_dead_timers();
static void add_regnick_to_hash_table(char *name, NS_User *ns)
{
ns->hash = HASH(name, NS_USER_LIST);
ns->next = nsuserlist[ns->hash];
nsuserlist[ns->hash] = (void *)ns;
}
static void del_regnick_from_hash_table(char *name, NS_User *ns)
{
NS_User *tmp, *prev = NULL;
for (tmp = nsuserlist[ns->hash]; tmp; tmp = tmp->next) {
if (tmp == ns) {
if (prev)
prev->next = tmp->next;
else
nsuserlist[ns->hash] = tmp->next;
tmp->next = NULL;
return;
}
prev = tmp;
}
}
void sync_changed_nicks_to_db() {
NS_User *tmp;
int i, j = 0;
hnode_t *nsn;
hscan_t nss;
int j = 0;
int starttime;
starttime = time(NULL);
for (i = 0; i < NS_USER_LIST; i++) {
tmp = nsuserlist[i];
while (tmp) {
if (tmp->lastchange > last_db_sync) {
tmp->lastchange = time(NULL);
hash_scan_begin(&nss, nsuserlist);
while ((nsn = hash_scan_next(&nss))) {
tmp = hnode_get(nsn);
if (tmp->lastchange > last_db_sync) {
tmp->lastchange = time(NULL);
#ifdef DEBUG
log("Syncing Nick %s", tmp->nick);
log("Syncing Nick %s", tmp->nick);
#endif
sync_nick_to_db(tmp);
j++;
}
tmp = tmp->next;
sync_nick_to_db(tmp);
j++;
}
}
last_db_sync = time(NULL);
@ -173,20 +149,7 @@ int is_forbidden(char *nick) {
void init_regnick_hash()
{
int i;
NS_User *ns, *prev;
for (i = 0; i < NS_USER_LIST; i++) {
ns = nsuserlist[i];
while (ns) {
prev = ns->next;
free(ns);
ns = prev;
}
nsuserlist[i] = NULL;
}
bzero((char *)nsuserlist, sizeof(nsuserlist));
nsuserlist = hash_create(NS_USER_LIST, 0, 0);
}
NS_User *lookup_regnick(char *name)
@ -222,6 +185,7 @@ NS_User *lookup_regnick(char *name)
NS_User *new_regnick(char *name, int create)
{
NS_User *ns, *ns2;
hnode_t *nsn;
DBT key, data;
int i;
@ -268,19 +232,24 @@ NS_User *new_regnick(char *name, int create)
}
memcpy(ns->nick, name, strlen(name)+1);
add_regnick_to_hash_table(name, ns);
nsn = hnode_create(ns);
if (!hash_isfull(nsuserlist)) {
hash_insert(nsuserlist, nsn, name);
} else {
log("eeek, NickServ User list hash is full");
}
return ns;
}
NS_User *findregnick(char *name)
{
NS_User *ns;
ns = nsuserlist[HASH(name, NS_USER_LIST)];
while (ns && strcasecmp(ns->nick, name) != 0)
ns = ns->next;
NS_User *ns = NULL;
hnode_t *nsn;
nsn = hash_lookup(nsuserlist, name);
if (nsn) {
ns = hnode_get(nsn);
}
#ifdef DEBUG
log("findregnick(%s) -> %s", name, (ns) ? ns->nick : "NOTFOUND");
#endif
@ -289,18 +258,20 @@ NS_User *findregnick(char *name)
}
void del_regnick(char *name)
{
NS_User *ns = findregnick(name);
NS_User *ns;
hnode_t *nsn = hash_lookup(nsuserlist, name);
#ifdef DEBUG
log("DelRegnick(%s)", name);
#endif
if (!ns) {
if (!nsn) {
log("Delregnick(%s) failed!", name);
return;
}
del_regnick_from_hash_table(name, ns);
ns = hnode_get(nsn);
hnode_destroy(nsn);
free(ns);
}

View file

@ -54,10 +54,10 @@ static void load_lang(int index, const char *filename)
int num, i;
#ifdef DEBUG
log("debug: Loading language %d from file `dl/services/lang/%s'",
log("debug: Loading language %d from file `data/%s'",
index, filename);
#endif
snprintf(buf, sizeof(buf), "dl/services/lang/%s", filename);
snprintf(buf, sizeof(buf), "data/%s", filename);
if (!(f = fopen(buf, "r"))) {
log("Failed to load language %d (%s)", index, filename);
return;
@ -264,7 +264,7 @@ void notice_lang(const char *source, char *dest, int message, ...)
s += strcspn(s, "\n");
if (*s)
*s++ = 0;
sts(":%s %s %s :%s", source, "NOTICE", nick, *t ? t : " ");
privmsg(nick, source, *t ? t : " ");
}
}
@ -315,6 +315,6 @@ void notice_help(const char *source, char *dest, int message, ...)
*s++ = 0;
strncpy(outbuf, t, sizeof(outbuf));
strnrepl(outbuf, sizeof(outbuf), "\1\1", source);
sts(":%s %s %s :%s", source, "NOTICE", nick, *outbuf ? outbuf : " ");
privmsg(nick, source, *outbuf ? outbuf : " ");
}
}

View file

@ -40,8 +40,8 @@
#include <stdio.h>
#include <db.h>
#include "dl.h"
#include "stats.h"
#include <dl.h>
#include <stats.h>
#include "services.h"
#include "language.h"
@ -70,119 +70,112 @@ void lslog(char *, ...);
int guest_num = 1000;
int __Bot_Message(char *origin, char *coreLine, int type)
int __Bot_Message(char *origin, char **av, int ac)
{
char *buf;
User *u;
char *cmd, *tok1, *tok2;
u = finduser(origin);
if (!u) {
log("Unable to find user %s (nickserv)", origin);
return -1;
}
if (coreLine == NULL) return -1;
cmd = strtok(coreLine, " ");
if (!strcasecmp(cmd, "HELP")) {
send_help(u, strtok(NULL,""));
log("%s", av[1]);
if (!strcasecmp(av[1], "HELP")) {
if (ac > 2) {
send_help(u, av[2]);
} else {
send_help(u, NULL);
}
return 1;
} else if (!strcasecmp(cmd, "REGISTER")) {
tok1 = strtok(NULL, " ");
if (tok1 == NULL) {
privmsg(u->nick, s_NickServ, "Error, Incorrect Syntax, please type /msg nickserv help register");
} else if (!strcasecmp(av[1], "REGISTER")) {
if (ac <= 3) {
privmsg(u->nick, s_NickServ, "Error, Incorrect Syntax, please type /msg %s help register", s_NickServ);
return -1;
}
if (strpbrk("@", tok1) == NULL) {
if (strpbrk("@", av[2]) == NULL) {
privmsg(u->nick, s_NickServ, "Your Email address is invalid (No @)");
return -1;
}
if (strpbrk(".", tok1) == NULL) {
if (strpbrk(".", av[2]) == NULL) {
privmsg(u->nick, s_NickServ, "Your Email address is invalid (No .)");
return -1;
}
tok2 = strtok(NULL, " ");
if (tok2 == NULL) {
privmsg(u->nick, s_NickServ, "Error, Incorrect Syntax, please type /msg nickserv help register");
return -1;
}
ns_register(u, tok1, tok2);
ns_register(u, av[2], av[3]);
return 1;
} else if (!strcasecmp(cmd, "IDENTIFY")) {
tok1 = strtok(NULL, " ");
if (tok1 == NULL) {
} else if (!strcasecmp(av[1], "IDENTIFY")) {
if (ac <= 2) {
privmsg(u->nick, s_NickServ, "Error, You must Supply a Password");
return -1;
}
ns_identify(u, tok1);
ns_identify(u, av[2]);
return 1;
} else if (!strcasecmp(cmd, "INFO")) {
tok1 = strtok(NULL, " ");
if (tok1 == NULL) {
} else if (!strcasecmp(av[1], "INFO")) {
if (ac <= 2) {
privmsg(u->nick, s_NickServ, "Error, you Must supply a Nickname");
return -1;
}
ns_info(u, tok1);
ns_info(u, av[2]);
return 1;
} else if (!strcasecmp(cmd, "GHOST")) {
tok1 = strtok(NULL, " ");
if (tok1 == NULL) {
privmsg(u->nick, s_NickServ, "Error, You must supply a nickname");
} else if (!strcasecmp(av[1], "GHOST")) {
if (ac <= 3) {
privmsg(u->nick, s_NickServ, "Error, Incorrect Syntax, Please type /msg %s help ghost", s_NickServ);
return -1;
}
tok2 = strtok(NULL, " ");
if (tok2 == NULL) {
privmsg(u->nick, s_NickServ, "Error, You must supply a Password");
ns_ghost(u, av[2], av[3]);
return 1;
} else if (!strcasecmp(av[1], "RECOVER")) {
if (ac <= 3) {
privmsg(u->nick, s_NickServ, "Error, Incorrect Syntax, Please type /msg %s help recover", s_NickServ);
return -1;
}
ns_ghost(u, tok1, tok2);
ns_recover(u, av[2], av[3]);
return 1;
} else if (!strcasecmp(cmd, "RECOVER")) {
tok1 = strtok(NULL, " ");
if (tok1 == NULL) {
privmsg(u->nick, s_NickServ, "Error, You must supply a nickname");
} else if (!strcasecmp(av[1], "DROP")) {
if (ac <= 2) {
privmsg(u->nick, s_NickServ, "Error, Incorrect Syntax, Please type /msg %s help drop", s_NickServ);
return -1;
}
tok2 = strtok(NULL, " ");
if (tok2 == NULL) {
privmsg(u->nick, s_NickServ, "Error, you must supply your password");
return -1;
}
ns_recover(u, tok1, tok2);
ns_drop(u, av[2]);
return 1;
} else if (!strcasecmp(cmd, "DROP")) {
ns_drop(u, strtok(NULL, " "));
return 1;
} else if (!strcasecmp(cmd, "LOGOUT")) {
} else if (!strcasecmp(av[1], "LOGOUT")) {
ns_logout(u);
return 1;
} else if (!strcasecmp(cmd, "\001VERSION\001")) {
sts(":%s NOTICE %s :\001VERSION NickServ Version %s", s_NickServ, u->nick, NS_Version);
} else if (!strcasecmp(av[1], "\001VERSION\001")) {
privmsg(u->nick, s_NickServ, ":\001VERSION NickServ Version %s", NS_Version);
return 1;
} else if (!strcasecmp(cmd, "SET")) {
ns_set(u, strtok(NULL, ""));
} else if (!strcasecmp(av[1], "SET")) {
buf = joinbuf(av, ac, 2);
ns_set(u, buf);
free(buf);
return 1;
} else if (!strcasecmp(cmd, "OPERCOMMENT")) {
} else if (!strcasecmp(av[1], "OPERCOMMENT")) {
/* if the user doesn't have the access rights, just return the normal what? message! */
if (UserLevel(u) < OPERCOMMENT_SET_ACCESS_LEVEL) {
goto unknown;
}
ns_opercomment(u, strtok(NULL, ""));
buf = joinbuf(av, ac, 2);
ns_opercomment(u, buf);
free(buf);
return 1;
} else if (!strcasecmp(cmd, "SUSPEND")) {
} else if (!strcasecmp(av[1], "SUSPEND")) {
/* if the user doesn't have access, then return the normal unknown message */
if (UserLevel(u) < OPERSUSPEND_SET_ACCESS_LEVEL) {
goto unknown;
}
ns_suspend(u, strtok(NULL, ""));
buf = joinbuf(av, ac, 2);
ns_suspend(u, buf);
free(buf);
return 1;
} else if (!strcasecmp(cmd, "FORBID")) {
} else if (!strcasecmp(av[1], "FORBID")) {
/* if the user doesn't have the access, return the normal unknown list */
if (UserLevel(u) < OPERFORBID_SET_ACCESS_LEVEL) {
goto unknown;
}
ns_forbid(u, strtok(NULL, ""));
buf = joinbuf(av, ac, 2);
ns_forbid(u, buf);
free(buf);
return 1;
} else if (!strcasecmp(cmd, "GETPASS")) {
} else if (!strcasecmp(av[1], "GETPASS")) {
/* check its enabled */
if (!ENABLE_GETPASS) {
goto unknown;
@ -190,9 +183,13 @@ int __Bot_Message(char *origin, char *coreLine, int type)
if (UserLevel(u) < GETPASS_ACCESS_LEVEL) {
goto unknown;
}
ns_getpass(u, strtok(NULL, " "));
if (ac <= 2) {
privmsg(u->nick, s_NickServ, "Error, Incorrect Syntax, Please type /msg %s help getpass", s_NickServ);
return -1;
}
ns_getpass(u, av[2]);
return 1;
} else if (!strcasecmp(cmd, "SETPASS")) {
} else if (!strcasecmp(av[1], "SETPASS")) {
/* check its enabled */
if (!ENABLE_SETPASS) {
goto unknown;
@ -200,23 +197,39 @@ int __Bot_Message(char *origin, char *coreLine, int type)
if (UserLevel(u) < SETPASS_ACCESS_LEVEL) {
goto unknown;
}
ns_setpass(u, strtok(NULL, ""));
if (ac <= 2) {
privmsg(u->nick, s_NickServ, "Error, Incorrect Syntax, Please type /msg %s help setpass", s_NickServ);
return -1;
}
ns_setpass(u, av[2]);
return 1;
} else if (!strcasecmp(cmd, "VHOST")) {
} else if (!strcasecmp(av[1], "VHOST")) {
if (!((ENABLE_VHOST >= 1) && (UserLevel(u) >= SETVHOST_ACCESS_LEVEL))) {
privmsg(u->nick, s_NickServ, "Access Denied");
return 1;
}
ns_setvhost(u, strtok(NULL, ""));
if (ac <= 2) {
privmsg(u->nick, s_NickServ, "Error, Incorrect Syntax, Please type /msg %s help vhost", s_NickServ);
return -1;
}
buf = joinbuf(av, ac, 2);
ns_setvhost(u, buf);
free(buf);
return 1;
} else if (!strcasecmp(cmd, "ACCESS")) {
ns_accesslist(u, strtok(NULL, ""));
} else if (!strcasecmp(av[1], "ACCESS")) {
if (ac <= 2) {
ns_accesslist(u, NULL);
} else {
buf = joinbuf(av,ac, 2);
ns_accesslist(u, buf);
free(buf);
}
return 1;
}
unknown:
privmsg(u->nick, s_NickServ, "Unknown Command: \2%s\2, maybe you need help?", cmd);
privmsg(u->nick, s_NickServ, "Unknown Command: \2%s\2, maybe you need help?", av[1]);
return -1;
@ -658,6 +671,7 @@ static void ns_logout(User *u) {
} else {
ns->onlineflags &= ~NSFL_IDENTIFED;
}
ssvsmode_cmd(u->nick, "-r");
privmsg(u->nick, s_NickServ, "You have been Logged out of Services");
if (ns->secure > 0) privmsg(u->nick, s_NickServ, "You will have to identify again to gain access to Services");
}
@ -898,8 +912,7 @@ int ns_nickchange_user(char *line) {
/* this function is called after NeoStats has updated the Internal Tables, so finduser will work */
ns_new_user(finduser(targetnick));
sts(":%s SVSMODE %s :-r", me.name, targetnick);
UserMode(targetnick, "-r");
ssvsmode_cmd(targetnick, "-r");
return 1;
}
int ns_new_user( User *u) {
@ -954,7 +967,7 @@ int ns_new_user( User *u) {
privmsg(u->nick, s_NickServ, "This Nickname is Registered and Protected");
privmsg(u->nick, s_NickServ, "You have been matched against your accesslist");
privmsg(u->nick, s_NickServ, "but you may still have to identify to access certian functions");
if (strlen(temp_user->vhost) > 0) sts(":%s CHGHOST %s %s", s_NickServ, u->nick, temp_user->vhost);
if (strlen(temp_user->vhost) > 0) ssvshost_cmd(u->nick, temp_user->vhost);
temp_user->onlineflags = NSFL_ACCESSMATCH;
#ifdef DEBUG
log("flags: %d", temp_user->onlineflags);
@ -985,8 +998,7 @@ int ns_new_user( User *u) {
if (temp_user->kill > 1) temp_user->kill = 1;
privmsg(u->nick, s_NickServ, "Otherwise your nick will be changed");
sts(":%s SVSMODE %s :-r", me.name, u->nick);
UserMode(u->nick, "-r");
ssvsmode_cmd(u->nick, "-r");
/* create a new Svc's Timer to change the nick if they do not identify
** We Don't delete the timer if they do change, but when ns_ident_timeout gets called
@ -1032,7 +1044,7 @@ int ns_ident_timeout(char *nick) {
snprintf(tmpnick, 32, "Guest%i", guest_num++);
privmsg(u->nick, s_NickServ, "Your Nickname has been changed to \002%s\002 as you did not identify", tmpnick);
sts(":%s SVSNICK %s %s :Identify Timeout for Protected Nick", s_NickServ, u->nick, tmpnick);
ssvsnick_cmd(u->nick, tmpnick);
free(tmpnick);
/* now we need to signon a new user to take this nick, so that if the clients script
@ -1108,7 +1120,7 @@ int ns_quit_enforced_nick(char *nick) {
return 1;
}
sts(":%s QUIT :Enforcer Timeout", nick);
squit_cmd(nick, "Enforcer Timeout");
/* TODO: its this user is added to any list, then remove it */
@ -1187,10 +1199,8 @@ static void ns_recover(User *u, char *nick, char *pass) {
snprintf(tmp, 10, "Guest%i", guest_num++);
}
privmsg(nick, s_NickServ, "The Nick \002%s\002 was recovered by %s, your Nickname has been changed to %s", nick, u->nick, tmp);
sts(":%s SVSMODE %s :-r", me.name, nick);
UserMode(nick, "-r");
sts(":%s SVSNICK %s %s :Recovery", s_NickServ, nick, tmp);
Usr_Nick(nick, tmp);
ssvsmode_cmd(nick, "-r");
ssvsnick_cmd(nick, tmp);
privmsg(u->nick, s_NickServ, "The Nick \002%s\002 was Recovered", nick);
notice(s_NickServ, "The Nick \002%s(%s@%s)\002 was recovered by %s(%s@%s)", nick, target->username, target->hostname, u->nick, u->username, u->hostname);
free(tmp);
@ -1222,11 +1232,10 @@ static void ns_ghost(User *u, char *nick, char *pass) {
return;
}
privmsg(u->nick, s_NickServ, "Success. the Nickname %s has been killed", target->nick);
sts(":%s SVSKILL %s :Ghost Command Used by %s(%s@%s)", s_NickServ, target->nick, u->nick, u->username, u->vhost);
ssvskill_cmd(target->nick, ":KILLED: Ghost Command Used by %s(%s@%s)");
notice(s_NickServ, "%s(%s@%s) Used Ghost Comand on %s(%s@%s)", u->nick, u->username, u->hostname, target->nick, target->username, target->hostname);
tmp = smalloc(255);
snprintf(tmp, 255, "%s", target->nick);
Usr_Kill(s_NickServ, tmp);
free(tmp);
free(temp_user);
return;
@ -1322,8 +1331,7 @@ static void ns_identify(User *u, char *pass) {
log("%s %s", temp_user->pass, pass);
if (!strcasecmp(temp_user->pass, pass)) {
privmsg(u->nick, s_NickServ, "You are Now Identified");
sts(":%s SVSMODE %s :+r", me.name, u->nick);
UserMode(u->nick, "+r");
ssvsmode_cmd(u->nick, "+r");
temp = malloc(sizeof(u->username) + sizeof(u->vhost) + 2);
strcpy(temp, u->username);
strcat(temp, "@");
@ -1337,11 +1345,10 @@ static void ns_identify(User *u, char *pass) {
return;
} else {
privmsg(u->nick, s_NickServ, "Invalid Password");
sts(":%s SVSMODE %s :-r", me.name, u->nick);
UserMode(u->nick, "-r");
ssvsmode_cmd(u->nick, "-r");
temp_user->kill++;
if ((temp_user->kill -1) >= NO_BAD_PASS) {
sts(":%s SVSKILL %s :%d Bad Passwords for nick %s", s_NickServ, u->nick, NO_BAD_PASS, u->nick);
ssvskill_cmd(u->nick, "KILLED: %d Bad Passwords for nick %s",NO_BAD_PASS, u->nick);
Usr_Kill(s_NickServ, u->nick);
}
return;
@ -1418,8 +1425,7 @@ static void ns_register(User *u, char *email, char *pass) {
dbp->sync(dbp, 0);
privmsg(u->nick, s_NickServ, "Nickname \002%s\002 Registered under your account %s", u->nick, new_user->acl);
privmsg(u->nick, s_NickServ, "Your Password is \002%s\002 - Remember this for Later use.", new_user->pass);
UserMode(u->nick, "+r");
sts(":%s SVSMODE %s :+r", me.name, u->nick);
ssvsmode_cmd(u->nick, "+r");
return;
}

View file

@ -5,7 +5,7 @@
** Based from GeoStats 1.1.0 by Johnathan George net@lite.net
*
** NetStats CVS Identification
** $Id: services.h,v 1.2 2002/03/28 08:58:16 fishwaldo Exp $
** $Id: services.h,v 1.3 2002/03/31 08:37:14 fishwaldo Exp $
*/
#ifndef M_SERVICES
@ -29,6 +29,7 @@
#include <db.h>
#include "stats.h"
#include <hash.h>
#include "options.h"
@ -41,7 +42,7 @@ int last_db_sync;
char ns_forbid_list[4096];
typedef struct ns_user NS_User;
NS_User *nsuserlist[NS_USER_LIST];
hash_t *nsuserlist;
struct ns_user {
@ -128,6 +129,8 @@ void save_nick_forbid_list();
int is_forbidden(char *);
char *strnrepl(char *s, int size, const char *old, const char *new);
void lang_init();
extern void send_help(User *u, char *line);
void notice_help(const char *source, char *dest, int message, ...);
/* these functions are in the core neostats, and are needed for internal functions */

View file

@ -28,13 +28,14 @@ Module_Info my_info[] = { {
} };
int new_m_version(char *av, char *tmp) {
sts(":%s 351 %s :Module NickServ Loaded, Version %s %s %s",me.name, av,my_info[0].module_version,servicesversion_date,servicesversion_time);
int new_m_version(char *origin, char **av, char *tmp) {
snumeric_cmd(351, origin, "Module NickServ Loaded, Version %s %s %s",my_info[0].module_version,servicesversion_date,servicesversion_time);
return 0;
}
Functions my_fn_list[] = {
{ "VERSION", new_m_version, 1 },
{ "MSG_VERSION", new_m_version, 1 },
{ "TOK_VERSION", new_m_version, 1 },
{ NULL, NULL, 0 }
};
@ -108,7 +109,7 @@ void _fini() {
int ret;
if (dbp != NULL) {
if ((ret = dbp->close(dbp, 0) != 0)) {
sts(":%s GLOBOPS :NickServ DB Close Error: %s", me.name, db_strerror(ret));
globops("NickServ DB Close Error: %s", db_strerror(ret));
};
}
log("NickServ Unloaded");