Fixed up Bot_Nick_Change, made s_Services check for all required options for

commands!
This commit is contained in:
fishwaldo 2000-02-05 00:22:59 +00:00
parent 082fe630f4
commit 5e52341218
5 changed files with 58 additions and 28 deletions

2
dl.c
View file

@ -146,7 +146,7 @@ int bot_nick_change(char *oldnick, char *newnick)
}
u = finduser(newnick);
if (!u) {
mod_ptr = module_bot_lists->next;
mod_ptr = module_bot_lists;
while(mod_ptr != NULL ) {
if (!strcasecmp(mod_ptr->nick, oldnick)) {
/* Ok, found the nick, change it */

View file

@ -4,9 +4,9 @@ CC=gcc
CFLAGS=-O2 -Wall -ggdb
echo $CC -o version.lo -c version.c -Wall -fPIC -I../
$CC -o version.lo -c version.c -Wall -fPIC -I../
$CC -o version.lo -c version.c -Wall -fPIC -I../ -ggdb
echo $CC -o spam.lo -c spam.c -Wall -fPIC -I../
$CC -o spam.lo -c spam.c -Wall -fPIC -I../
$CC -o spam.lo -c spam.c -Wall -fPIC -I../ -ggdb
echo ld -shared -o version.so version.lo
ld -shared -o version.so version.lo

View file

@ -4,7 +4,7 @@
** Based from GeoStats 1.1.0 by Johnathan George net@lite.net
*
** NetStats CVS Identification
** $Id: spam.c,v 1.1 2000/02/03 23:45:59 fishwaldo Exp $
** $Id: spam.c,v 1.2 2000/02/05 00:22:59 fishwaldo Exp $
*/
@ -37,31 +37,27 @@ void TimerSpam()
{
register char c;
register int i;
char *t;
char temp[5];
srand(time(NULL));
t = sstrdup(s_Spam);
bzero(s_Spam, sizeof(s_Spam));
for (i = 0; i < sizeof(s_Spam-1); i++) {
c = (((u_short)rand())%26)+97;
s_Spam[i] = c;
}
bzero(temp, sizeof(temp));
for (i = 0; i < sizeof(temp)-1; i++) {
c = (((u_short)rand())%26)+97;
temp[i] = c;
}
if (servsock > 0) {
if (bot_nick_change(t,s_Spam) == 1) {
notice(s_Spam, "Spam Users Nick is now: %s",s_Spam);
if (bot_nick_change(s_Spam, temp) == 1) {
s_Spam = sstrdup(temp);
notice(s_Spam, "Spam Users Nick is now: %s",temp);
} else {
/* The newnick already existed on the network */
log("ehh, couldn't change my nick!");
notice(t, "Attempted to change nick to %s but its already in use",s_Spam);
for (i = 0; i < sizeof(t-1); i++) {
s_Spam[i] = t[i];
}
/* ToDo: Add routine if nick is in use, to find another nick */
return;
}
}
free(t);
}
int __Bot_Message(char *origin, char *coreLine, int type)
@ -122,7 +118,6 @@ void _init() {
void _fini() {
log("unloading Spam");
sts(":%s GLOBOPS :Spam Module Unloaded",me.name);
};

View file

@ -4,7 +4,7 @@
** Based from GeoStats 1.1.0 by Johnathan George net@lite.net
*
** NetStats CVS Identification
** $Id: services.c,v 1.2 2000/02/04 02:54:12 fishwaldo Exp $
** $Id: services.c,v 1.3 2000/02/05 00:22:59 fishwaldo Exp $
*/
#include "stats.h"
@ -96,6 +96,10 @@ void servicesbot(char *nick, char *line) {
return;
}
cmd = strtok(NULL, " ");
if (cmd == NULL) {
privmsg(nick,s_Services,"Please Specify a Module");
return;
}
rval = load_module(cmd,u);
if (!rval) {
notice(s_Services,"%s Loaded Module %s",u->nick,cmd);
@ -104,6 +108,11 @@ void servicesbot(char *nick, char *line) {
notice(s_Services,"%s Tried to Load Module %s, but Failed",u->nick,cmd);
}
} else if (!strcasecmp(cmd,"MODLIST")) {
if (!u->is_tecmin) {
privmsg(nick,s_Services,"Permission Denied");
notice(s_Services,"%s Tried to MODLIST, but is not a Techadmin",nick);
return;
}
list_module(u);
} else if (!strcasecmp(cmd,"UNLOAD")) {
if (!u->is_tecmin) {
@ -112,6 +121,10 @@ void servicesbot(char *nick, char *line) {
return;
}
cmd = strtok(NULL, " ");
if (cmd == NULL) {
privmsg(nick,s_Services," Please Specify a Module Name");
return;
}
rval = unload_module(cmd,u);
if (!rval) {
notice(s_Services,"%s Unloaded Module %s", u->nick, cmd);
@ -119,10 +132,22 @@ void servicesbot(char *nick, char *line) {
notice(s_Services,"%s Tried to Unload the Module %s, but that does not exist", u->nick, cmd);
}
} else if (!strcasecmp(cmd, "MODBOTLIST")) {
if (!u->is_coder) {
privmsg(nick,s_Services,"Permission Denied");
notice(s_Services,"%s Tried to MODBOTLIST, but is not a Coder",nick);
return;
}
list_module_bots(u);
} else if (!strcasecmp(cmd, "MODTIMERLIST")) {
if (!u->is_coder) {
privmsg(nick,s_Services,"Permission Denied");
notice(s_Services,"%s Tried to MODTIMERLIST, but is not a Coder",nick);
return;
}
list_module_timer(u);
} else if (!strcasecmp(cmd, "UPTIME")) {
notice(s_Services,"Broken atm :(");
return;
ns_uptime(u);
notice(s_Services,"%s Wanted to see %s's Uptime ",u->nick,me.name);
} else if (!strcasecmp(cmd, "SHUTDOWN")) {
@ -249,12 +274,21 @@ static void ns_reload(User *u, char *reason)
privmsg(u->nick, s_Services, "Access Denied.");
return;
}
globops(s_Services, "%s requested \2RELOAD\2 for %s", u->nick, reason);
log("%s requested RELOAD.", u->nick);
if (reason != NULL) {
globops(s_Services, "%s requested \2RELOAD\2 for %s", u->nick, reason);
log("%s requested RELOAD.", u->nick);
sts("SQUIT %s :Reload", me.name);
sts("SQUIT %s :Reload", me.name);
sts(":%s QUIT :%s Sent RELOAD: %s",s_Services,u->nick,reason);
sts(":%s QUIT :%s Sent RELOAD: %s",s_Services,u->nick,reason);
} else {
globops(s_Services, "%s requested \2RELOAD\2 for no Reason!", u->nick, reason);
log("%s requested RELOAD.", u->nick);
sts("SQUIT %s :Reload", me.name);
sts(":%s QUIT :%s Sent RELOAD",s_Services,u->nick,reason);
}
sleep(1);
close(servsock);
init_server_hash();

View file

@ -5,7 +5,7 @@
** Based from GeoStats 1.1.0 by Johnathan George net@lite.net
*
** NetStats CVS Identification
** $Id: timer.c,v 1.1 2000/02/03 23:45:56 fishwaldo Exp $
** $Id: timer.c,v 1.2 2000/02/05 00:22:59 fishwaldo Exp $
*/
#include "stats.h"
@ -20,7 +20,7 @@ void chk()
{
Mod_Timer *mod_ptr = NULL;
time_t current = time(NULL);
segv_location = "chk";
/* First, lets see if any modules have a function that is due to run..... */
mod_ptr = module_timer_lists->next;
while(mod_ptr != NULL) {
@ -28,6 +28,7 @@ void chk()
log("timer: Running Module %s Timers",mod_ptr->modname);
mod_ptr->function();
mod_ptr->lastrun = time(NULL);
log("Finished Timer");
}
mod_ptr = mod_ptr->next;
}