mirror of
https://github.com/EnergyMech/energymech.git
synced 2025-12-17 15:36:50 +00:00
servergroup changes
This commit is contained in:
parent
ba0429bd14
commit
2e0d50d4f0
2
Makefile
2
Makefile
@ -62,7 +62,7 @@ SRCFILES = src/alias.c src/auth.c src/bounce.c src/calc.c src/channel.c src/core
|
|||||||
src/irc.c src/main.c src/net.c src/note.c src/ons.c src/parse.c src/partyline.c \
|
src/irc.c src/main.c src/net.c src/note.c src/ons.c src/parse.c src/partyline.c \
|
||||||
src/perl.c src/prot.c src/python.c src/reset.c src/seen.c src/shit.c src/io.c \
|
src/perl.c src/prot.c src/python.c src/reset.c src/seen.c src/shit.c src/io.c \
|
||||||
src/spy.c src/tcl.c src/toybox.c src/uptime.c src/user.c src/vars.c src/web.c \
|
src/spy.c src/tcl.c src/toybox.c src/uptime.c src/user.c src/vars.c src/web.c \
|
||||||
src/lib/md5.c src/lib/md5.h src/lib/string.c
|
src/lib/md5.c src/lib/md5.h src/string.c
|
||||||
|
|
||||||
HDRFILES = src/commands.h src/defines.h src/global.h src/h.h src/onhash.h src/settings.h \
|
HDRFILES = src/commands.h src/defines.h src/global.h src/h.h src/onhash.h src/settings.h \
|
||||||
src/structs.h src/text.h src/usage.h
|
src/structs.h src/text.h src/usage.h
|
||||||
|
|||||||
4
VERSIONS
4
VERSIONS
@ -1,5 +1,9 @@
|
|||||||
3.5(.dev) --
|
3.5(.dev) --
|
||||||
|
|
||||||
|
* Changed: Rewrote how SERVERGROUP works. Config files might need changes.
|
||||||
|
* Removed: SERVERGROUP command.
|
||||||
|
* Changed: Nicks/Wantnick/Userhost dynamically allocated only for 'too long' strings.
|
||||||
|
* Removed: IDWRAP code. It was my personal thing.
|
||||||
* Changed: on_msg now matches commands using a hash function instead
|
* Changed: on_msg now matches commands using a hash function instead
|
||||||
of iterating through the list of commands using strcasecmp.
|
of iterating through the list of commands using strcasecmp.
|
||||||
* Changed: Bumped version because of undocumented changes.
|
* Changed: Bumped version because of undocumented changes.
|
||||||
|
|||||||
63
sample.conf
63
sample.conf
@ -9,35 +9,40 @@ set ctimeout 60
|
|||||||
; We don't currently support SSL or ipv6 but there's an easy workaround
|
; We don't currently support SSL or ipv6 but there's an easy workaround
|
||||||
; see socat.sh
|
; see socat.sh
|
||||||
|
|
||||||
servergroup undernet
|
; Use only undernet servers
|
||||||
server amsterdam.nl.eu.undernet.org 6663
|
set servergroup undernet
|
||||||
server amsterdam2.nl.eu.undernet.org 6663
|
|
||||||
server bucharest.ro.eu.undernet.org 6663
|
; Our list of servers
|
||||||
server carouge.ch.eu.undernet.org 6663
|
; server <host> [port] [@group] ["password"]
|
||||||
server ede.nl.eu.undernet.org 6669
|
;
|
||||||
server elsene.be.eu.undernet.org 6669
|
server amsterdam.nl.eu.undernet.org 6663 @undernet
|
||||||
server fulda.de.eu.undernet.org 6663
|
server amsterdam2.nl.eu.undernet.org 6663 @undernet
|
||||||
server geneva.ch.eu.undernet.org 6663
|
server bucharest.ro.eu.undernet.org 6663 @undernet
|
||||||
server graz.at.eu.undernet.org 6663
|
server carouge.ch.eu.undernet.org 6663 @undernet
|
||||||
server graz2.at.eu.undernet.org 6663
|
server ede.nl.eu.undernet.org 6669 @undernet
|
||||||
server helsinki.fi.eu.undernet.org 6669
|
server elsene.be.eu.undernet.org 6669 @undernet
|
||||||
server lelystad.nl.eu.undernet.org 6668
|
server fulda.de.eu.undernet.org 6663 @undernet
|
||||||
server london.uk.eu.undernet.org 6666
|
server geneva.ch.eu.undernet.org 6663 @undernet
|
||||||
server london2.uk.eu.undernet.org 6663
|
server graz.at.eu.undernet.org 6663 @undernet
|
||||||
server milan.it.eu.undernet.org 6663
|
server graz2.at.eu.undernet.org 6663 @undernet
|
||||||
server oslo1.no.eu.undernet.org 6663
|
server helsinki.fi.eu.undernet.org 6669 @undernet
|
||||||
server oslo2.no.eu.undernet.org 6663
|
server lelystad.nl.eu.undernet.org 6668 @undernet
|
||||||
server stockholm.se.eu.undernet.org 6669
|
server london.uk.eu.undernet.org 6666 @undernet
|
||||||
server surrey.uk.eu.undernet.org 6669
|
server london2.uk.eu.undernet.org 6663 @undernet
|
||||||
server zagreb.hr.eu.undernet.org 6666
|
server milan.it.eu.undernet.org 6663 @undernet
|
||||||
server panamacity.pa.undernet.org 6663
|
server oslo1.no.eu.undernet.org 6663 @undernet
|
||||||
server ashburn.va.us.undernet.org 6663
|
server oslo2.no.eu.undernet.org 6663 @undernet
|
||||||
server fairfax.va.us.undernet.org 6666
|
server stockholm.se.eu.undernet.org 6669 @undernet
|
||||||
server mesa.az.us.undernet.org 6666
|
server surrey.uk.eu.undernet.org 6669 @undernet
|
||||||
server miami.fl.us.undernet.org 6669
|
server zagreb.hr.eu.undernet.org 6666 @undernet
|
||||||
server princeton.nj.us.undernet.org 6663
|
server panamacity.pa.undernet.org 6663 @undernet
|
||||||
server sanjose.ca.us.undernet.org 6663
|
server ashburn.va.us.undernet.org 6663 @undernet
|
||||||
server sterling.va.us.undernet.org 6669
|
server fairfax.va.us.undernet.org 6666 @undernet
|
||||||
|
server mesa.az.us.undernet.org 6666 @undernet
|
||||||
|
server miami.fl.us.undernet.org 6669 @undernet
|
||||||
|
server princeton.nj.us.undernet.org 6663 @undernet
|
||||||
|
server sanjose.ca.us.undernet.org 6663 @undernet
|
||||||
|
server sterling.va.us.undernet.org 6669 @undernet
|
||||||
|
|
||||||
;
|
;
|
||||||
; this is sorta how a botnet configuration would look like...
|
; this is sorta how a botnet configuration would look like...
|
||||||
|
|||||||
@ -49,13 +49,13 @@ TESTFILES = aliastest calctest safepathtest
|
|||||||
|
|
||||||
OFILES = alias.o auth.o bounce.o calc.o channel.o core.o ctcp.o debug.o dns.o function.o greet.o \
|
OFILES = alias.o auth.o bounce.o calc.o channel.o core.o ctcp.o debug.o dns.o function.o greet.o \
|
||||||
help.o hostinfo.o io.o irc.o main.o net.o note.o ons.o parse.o partyline.o \
|
help.o hostinfo.o io.o irc.o main.o net.o note.o ons.o parse.o partyline.o \
|
||||||
perl.o prot.o python.o reset.o seen.o shit.o spy.o tcl.o toybox.o \
|
perl.o prot.o python.o reset.o seen.o shit.o spy.o string.o tcl.o toybox.o \
|
||||||
uptime.o user.o vars.o web.o lib/string.o @MD5_O@ @SHA_O@
|
uptime.o user.o vars.o web.o @MD5_O@ @SHA_O@
|
||||||
|
|
||||||
SRCFILES = alias.c auth.c bounce.c calc.c channel.c core.c ctcp.c debug.c dns.c function.c greet.c \
|
SRCFILES = alias.c auth.c bounce.c calc.c channel.c core.c ctcp.c debug.c dns.c function.c greet.c \
|
||||||
help.c hostinfo.c io.c irc.c main.c net.c note.c ons.c parse.c partyline.c \
|
help.c hostinfo.c io.c irc.c main.c net.c note.c ons.c parse.c partyline.c \
|
||||||
perl.c prot.c python.c reset.c seen.c shit.c spy.c tcl.c toybox.c \
|
perl.c prot.c python.c reset.c seen.c shit.c spy.c string.c tcl.c toybox.c \
|
||||||
uptime.c user.c vars.c web.c lib/string.c @MD5_C@ @SHA_C@
|
uptime.c user.c vars.c web.c @MD5_C@ @SHA_C@
|
||||||
|
|
||||||
.PHONY: all clean mega-install mega mega-static test commands
|
.PHONY: all clean mega-install mega mega-static test commands
|
||||||
|
|
||||||
@ -152,9 +152,6 @@ lib/sha1.o: lib/sha1.c $(INCS)
|
|||||||
lib/sha512.o: lib/sha512.c $(INCS)
|
lib/sha512.o: lib/sha512.c $(INCS)
|
||||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< -o $@ -Ilib $(CPROF)
|
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< -o $@ -Ilib $(CPROF)
|
||||||
|
|
||||||
lib/string.o: lib/string.c $(BASEINCLUDES)
|
|
||||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< -o $@ -I. $(CPROF)
|
|
||||||
|
|
||||||
alias.o: alias.c $(INCS)
|
alias.o: alias.c $(INCS)
|
||||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
||||||
|
|
||||||
@ -239,6 +236,9 @@ shit.o: shit.c $(INCS)
|
|||||||
spy.o: spy.c $(INCS)
|
spy.o: spy.c $(INCS)
|
||||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
||||||
|
|
||||||
|
string.o: string.c $(BASEINCLUDES)
|
||||||
|
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
||||||
|
|
||||||
tcl.o: tcl.c $(INCS)
|
tcl.o: tcl.c $(INCS)
|
||||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF) $(TCLINCLUDE)
|
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF) $(TCLINCLUDE)
|
||||||
|
|
||||||
|
|||||||
36
src/auth.c
36
src/auth.c
@ -418,6 +418,25 @@ int make_auth(const char *userhost, const User *user)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void do_auth_noargs(const char *from)
|
||||||
|
{
|
||||||
|
Auth *au;
|
||||||
|
|
||||||
|
if (get_authaccess(from,MATCH_ALL) < 100)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* no args + owner: List active auths */
|
||||||
|
table_buffer("\037Active Auths\037");
|
||||||
|
if (current->authlist == NULL)
|
||||||
|
table_buffer("(none)");
|
||||||
|
for(au=current->authlist;au;au=au->next)
|
||||||
|
{
|
||||||
|
table_buffer("%s\t%i\t%s\t%s",au->user->name,au->user->x.x.access,au->nuh,
|
||||||
|
idle2str(au->active,TRUE));
|
||||||
|
}
|
||||||
|
table_send(from,3);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
help:AUTH
|
help:AUTH
|
||||||
help:VERIFY
|
help:VERIFY
|
||||||
@ -443,22 +462,7 @@ void do_auth(COMMAND_ARGS)
|
|||||||
char *pass;
|
char *pass;
|
||||||
int hostmatch;
|
int hostmatch;
|
||||||
|
|
||||||
if ((pass = chop(&rest)) == NULL)
|
pass = chop(&rest);
|
||||||
{
|
|
||||||
if (get_authaccess(from,MATCH_ALL) == 100)
|
|
||||||
{
|
|
||||||
/* empty pass + owner: List active auths */
|
|
||||||
table_buffer("\037Active Auths\037");
|
|
||||||
if (current->authlist == NULL)
|
|
||||||
table_buffer("(none)");
|
|
||||||
for(au=current->authlist;au;au=au->next)
|
|
||||||
{
|
|
||||||
table_buffer("%s\t%i\t%s\t%s",au->user->name,au->user->x.x.access,au->nuh,idle2str(now - au->active,TRUE));
|
|
||||||
}
|
|
||||||
table_send(from,3);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* chop chop
|
* chop chop
|
||||||
|
|||||||
@ -181,7 +181,10 @@ void bounce_parse(ircLink *irc, char *message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void new_port_bounce(const struct Setting *no_op)
|
/*
|
||||||
|
* any time setting is changed
|
||||||
|
*/
|
||||||
|
void new_port_bounce(const struct Setting *dontcare)
|
||||||
{
|
{
|
||||||
if (bounce_sock != -1)
|
if (bounce_sock != -1)
|
||||||
close(bounce_sock);
|
close(bounce_sock);
|
||||||
|
|||||||
@ -40,13 +40,15 @@ void check_idlekick(void)
|
|||||||
|
|
||||||
for(chan=current->chanlist;chan;chan=chan->next)
|
for(chan=current->chanlist;chan;chan=chan->next)
|
||||||
{
|
{
|
||||||
|
if (!chan->bot_is_op)
|
||||||
|
continue;
|
||||||
limit = chan->setting[INT_IKT].int_var;
|
limit = chan->setting[INT_IKT].int_var;
|
||||||
|
if (limit == 0)
|
||||||
|
continue;
|
||||||
timeout = (now - (60 * limit));
|
timeout = (now - (60 * limit));
|
||||||
for(cu=chan->users;cu;cu=cu->next)
|
for(cu=chan->users;cu;cu=cu->next)
|
||||||
{
|
{
|
||||||
cu->flags &= ~CU_KSWARN; /* remove KS warnings */
|
cu->flags &= ~CU_KSWARN; /* remove KS warnings */
|
||||||
if (!chan->bot_is_op || limit == 0)
|
|
||||||
continue;
|
|
||||||
if (cu->flags & CU_CHANOP)
|
if (cu->flags & CU_CHANOP)
|
||||||
continue;
|
continue;
|
||||||
if (timeout < cu->idletime)
|
if (timeout < cu->idletime)
|
||||||
@ -1188,7 +1190,7 @@ void do_showidle(COMMAND_ARGS)
|
|||||||
{
|
{
|
||||||
if (n >= (now - cu->idletime))
|
if (n >= (now - cu->idletime))
|
||||||
continue;
|
continue;
|
||||||
table_buffer("%s\r %s\t%s",idle2str((now - cu->idletime),TRUE),cu->nick,cu->userhost);
|
table_buffer("%s\r %s\t%s",idle2str(cu->idletime,TRUE),cu->nick,cu->userhost);
|
||||||
}
|
}
|
||||||
table_send(from,1);
|
table_send(from,1);
|
||||||
}
|
}
|
||||||
@ -1219,5 +1221,5 @@ void do_idle(COMMAND_ARGS)
|
|||||||
to_user(from,TEXT_UNKNOWNUSER,rest);
|
to_user(from,TEXT_UNKNOWNUSER,rest);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
to_user(from,"%s has been idle for %s",rest,idle2str(now - cu2->idletime,TRUE));
|
to_user(from,"%s has been idle for %s",rest,idle2str(cu2->idletime,TRUE));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,6 +36,7 @@
|
|||||||
CBANG 0x040000 command may be prefixed with a bang (!)
|
CBANG 0x040000 command may be prefixed with a bang (!)
|
||||||
ACCHAN 0x080000 needs an active channel
|
ACCHAN 0x080000 needs an active channel
|
||||||
SUPRES 0x100000 command is not suitable to run on many bots at once, try to suppress it
|
SUPRES 0x100000 command is not suitable to run on many bots at once, try to suppress it
|
||||||
|
NOARGF 0x200000 run a special function if no arguments are supplied
|
||||||
|
|
||||||
CLEVEL 0x000ff
|
CLEVEL 0x000ff
|
||||||
|
|
||||||
@ -56,8 +57,8 @@ struct
|
|||||||
/*
|
/*
|
||||||
* public access commands
|
* public access commands
|
||||||
*/
|
*/
|
||||||
{ 0, "AUTH", "do_auth", 0 | NOPUB | CBANG }, // double up on AUTH/VERIFY to better
|
{ 0, "AUTH", "do_auth", 0 | NOPUB | CBANG | NOARGF }, // double up on AUTH/VERIFY to better
|
||||||
{ 0, "VERIFY", "do_auth", 0 | NOPUB | CBANG }, // catch login attempts
|
{ 0, "VERIFY", "do_auth", 0 | NOPUB | CBANG | NOARGF }, // catch login attempts
|
||||||
#ifdef TOYBOX
|
#ifdef TOYBOX
|
||||||
{ 0, "8BALL", "do_8ball", 0 | CBANG | SUPRES },
|
{ 0, "8BALL", "do_8ball", 0 | CBANG | SUPRES },
|
||||||
{ 0, "RAND", "do_rand", 0 | CBANG | SUPRES },
|
{ 0, "RAND", "do_rand", 0 | CBANG | SUPRES },
|
||||||
@ -199,8 +200,7 @@ struct
|
|||||||
{ 0, "MSG", "do_msg", 80 | CCPW | CARGS },
|
{ 0, "MSG", "do_msg", 80 | CCPW | CARGS },
|
||||||
{ 0, "NEXTSERVER", "do_server", 80 | CCPW | GAXS },
|
{ 0, "NEXTSERVER", "do_server", 80 | CCPW | GAXS },
|
||||||
{ 0, "SAVE", "do_save", 80 | CCPW | GAXS },
|
{ 0, "SAVE", "do_save", 80 | CCPW | GAXS },
|
||||||
{ 0, "SERVER", "do_server", 80 | CCPW | GAXS | REDIR | LBUF },
|
{ 0, "SERVER", "do_server", 80 | CCPW | GAXS | REDIR | NOPUB | NOARGF },
|
||||||
{ 0, "SERVERGROUP", "do_servergroup", 80 | CCPW | GAXS | REDIR | LBUF },
|
|
||||||
{ 0, "STATS", "do_ircstats", 80 | CCPW | DCC | CARGS },
|
{ 0, "STATS", "do_ircstats", 80 | CCPW | DCC | CARGS },
|
||||||
#ifdef ALIAS
|
#ifdef ALIAS
|
||||||
{ 0, "ALIAS", "do_alias", 80 | CCPW | GAXS },
|
{ 0, "ALIAS", "do_alias", 80 | CCPW | GAXS },
|
||||||
@ -219,7 +219,7 @@ struct
|
|||||||
{ 0, "RSPY", "do_rspy", 90 | CCPW | CARGS },
|
{ 0, "RSPY", "do_rspy", 90 | CCPW | CARGS },
|
||||||
{ 0, "SPY", "do_spy", 90 | CCPW },
|
{ 0, "SPY", "do_spy", 90 | CCPW },
|
||||||
#ifdef BOTNET
|
#ifdef BOTNET
|
||||||
{ 0, "LINK", "do_link", 90 | CCPW | GAXS },
|
{ 0, "LINK", "do_link", 90 | CCPW | GAXS | NOPUB | NOARGF },
|
||||||
#endif /* BOTNET */
|
#endif /* BOTNET */
|
||||||
#ifdef DYNCMD
|
#ifdef DYNCMD
|
||||||
{ 0, "CHACCESS", "do_chaccess", 90 | CCPW | GAXS | CARGS },
|
{ 0, "CHACCESS", "do_chaccess", 90 | CCPW | GAXS | CARGS },
|
||||||
|
|||||||
@ -355,6 +355,9 @@
|
|||||||
#define NAMELEN 79
|
#define NAMELEN 79
|
||||||
#define NAMEBUF NAMELEN+1
|
#define NAMEBUF NAMELEN+1
|
||||||
|
|
||||||
|
#define SERVERGROUPBUF 16
|
||||||
|
#define SERVERGROUPLEN SERVERGROUPBUF-1
|
||||||
|
|
||||||
#define MINPASSCHARS 4
|
#define MINPASSCHARS 4
|
||||||
#define MAXPASSCHARS 50
|
#define MAXPASSCHARS 50
|
||||||
|
|
||||||
@ -394,6 +397,7 @@
|
|||||||
#define CBANG 0x040000 /* command may be prefixed with a bang (!) */
|
#define CBANG 0x040000 /* command may be prefixed with a bang (!) */
|
||||||
#define ACCHAN 0x080000 /* needs an active channel */
|
#define ACCHAN 0x080000 /* needs an active channel */
|
||||||
#define SUPRES 0x100000 /* command is not suitable to run on many bots at once, try to suppress it */
|
#define SUPRES 0x100000 /* command is not suitable to run on many bots at once, try to suppress it */
|
||||||
|
#define NOARGF 0x200000 /* run a special function if no arguments are supplied */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* integer only version of RANDOM()
|
* integer only version of RANDOM()
|
||||||
|
|||||||
414
src/core.c
414
src/core.c
@ -107,7 +107,7 @@ void readcfgfile(void)
|
|||||||
to_file(1,", ...");
|
to_file(1,", ...");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
to_file(1,"%s%s",(oc > 0) ? ", " : "",getbotnick(bot));
|
to_file(1,"%s%s",(oc > 0) ? ", " : EMPTYSTR,getbotnick(bot));
|
||||||
oc += getbotnicklen(bot);
|
oc += getbotnicklen(bot);
|
||||||
}
|
}
|
||||||
to_file(1," ]\n");
|
to_file(1," ]\n");
|
||||||
@ -152,7 +152,7 @@ int write_session(void)
|
|||||||
for(sp=serverlist;sp;sp=sp->next)
|
for(sp=serverlist;sp;sp=sp->next)
|
||||||
{
|
{
|
||||||
to_file(sf,"server %s %i %s\n",sp->name,(sp->port) ? sp->port : 6667,
|
to_file(sf,"server %s %i %s\n",sp->name,(sp->port) ? sp->port : 6667,
|
||||||
(sp->pass[0]) ? sp->pass : "");
|
(sp->pass[0]) ? sp->pass : EMPTYSTR);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BOTNET
|
#ifdef BOTNET
|
||||||
@ -261,7 +261,7 @@ int write_session(void)
|
|||||||
{
|
{
|
||||||
if (!chan->active && !chan->rejoin)
|
if (!chan->active && !chan->rejoin)
|
||||||
continue;
|
continue;
|
||||||
to_file(sf,"join %s %s\n",chan->name,(chan->key) ? chan->key : "");
|
to_file(sf,"join %s %s\n",chan->name,(chan->key) ? chan->key : EMPTYSTR);
|
||||||
/*
|
/*
|
||||||
* using CHANSET_SIZE: only the first settings contain stuff
|
* using CHANSET_SIZE: only the first settings contain stuff
|
||||||
*/
|
*/
|
||||||
@ -387,7 +387,7 @@ void signoff(char *from, char *reason)
|
|||||||
{
|
{
|
||||||
if (!reason)
|
if (!reason)
|
||||||
reason = randstring(SIGNOFFSFILE);
|
reason = randstring(SIGNOFFSFILE);
|
||||||
to_server("QUIT :%s\n",(reason) ? reason : "");
|
to_server("QUIT :%s\n",(reason) ? reason : EMPTYSTR);
|
||||||
killsock(current->sock);
|
killsock(current->sock);
|
||||||
current->sock = -1;
|
current->sock = -1;
|
||||||
}
|
}
|
||||||
@ -473,10 +473,13 @@ void kill_all_bots(char *reason)
|
|||||||
/*
|
/*
|
||||||
* Server lists, connects, etc...
|
* Server lists, connects, etc...
|
||||||
*/
|
*/
|
||||||
Server *add_server(char *host, int port, char *pass)
|
Server *add_server(const char *host, const int port, const char *pass, const char *group)
|
||||||
{
|
{
|
||||||
Server *sp,**pp;
|
Server *sp,**pp;
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
debug("(add_server) host = %s, port = %i, group = %s, pass = '%s'.\n",host,port,group,pass);
|
||||||
|
#endif /* DEBUG */
|
||||||
pp = &serverlist;
|
pp = &serverlist;
|
||||||
while(*pp)
|
while(*pp)
|
||||||
{
|
{
|
||||||
@ -485,42 +488,21 @@ Server *add_server(char *host, int port, char *pass)
|
|||||||
return(sp);
|
return(sp);
|
||||||
pp = &sp->next;
|
pp = &sp->next;
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
|
debug("(add_server) creating new entry: id %i.\n",serverident+1);
|
||||||
|
#endif /* DEBUG */
|
||||||
set_mallocdoer(add_server);
|
set_mallocdoer(add_server);
|
||||||
*pp = sp = (Server*)Calloc(sizeof(Server));
|
*pp = sp = (Server*)Calloc(sizeof(Server));
|
||||||
sp->ident = serverident++;
|
sp->ident = serverident++;
|
||||||
|
sp->maxontime = -1;
|
||||||
|
/* caller must make sure host, pass, port and group is all valid */
|
||||||
stringcpy_n(sp->name,host,NAMELEN);
|
stringcpy_n(sp->name,host,NAMELEN);
|
||||||
if (pass && *pass)
|
|
||||||
stringcpy_n(sp->pass,pass,PASSLEN);
|
stringcpy_n(sp->pass,pass,PASSLEN);
|
||||||
sp->port = (port) ? port : DEFAULT_IRC_PORT;
|
stringcpy_n(sp->group,group,SERVERGROUPLEN);
|
||||||
if (currentservergroup)
|
sp->port = port;
|
||||||
sp->servergroup = currentservergroup->servergroup;
|
|
||||||
return(sp);
|
return(sp);
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerGroup *getservergroup(const char *name)
|
|
||||||
{
|
|
||||||
ServerGroup *sg;
|
|
||||||
|
|
||||||
for(sg=servergrouplist;sg;sg=sg->next)
|
|
||||||
{
|
|
||||||
if (!stringcasecmp(sg->name,name))
|
|
||||||
return(sg);
|
|
||||||
}
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
ServerGroup *getservergroupid(int id)
|
|
||||||
{
|
|
||||||
ServerGroup *sg;
|
|
||||||
|
|
||||||
for(sg=servergrouplist;sg;sg=sg->next)
|
|
||||||
{
|
|
||||||
if (sg->servergroup == id)
|
|
||||||
return(sg);
|
|
||||||
}
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
Server *find_server(int id)
|
Server *find_server(int id)
|
||||||
{
|
{
|
||||||
Server *sp;
|
Server *sp;
|
||||||
@ -582,11 +564,9 @@ int try_server(Server *sp, char *hostname)
|
|||||||
|
|
||||||
void connect_to_server(void)
|
void connect_to_server(void)
|
||||||
{
|
{
|
||||||
ServerGroup *sg;
|
|
||||||
Server *sp,*sptry;
|
Server *sp,*sptry;
|
||||||
Chan *chan;
|
Chan *chan;
|
||||||
char *s;
|
char *sgroup;
|
||||||
int sgi;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This should prevent the bot from chewing up too
|
* This should prevent the bot from chewing up too
|
||||||
@ -634,64 +614,54 @@ void connect_to_server(void)
|
|||||||
* The purpose of this kludge is to find the least used server
|
* The purpose of this kludge is to find the least used server
|
||||||
* July 7th: added logic for servergroup
|
* July 7th: added logic for servergroup
|
||||||
*/
|
*/
|
||||||
sptry = NULL;
|
if ((sgroup = current->setting[STR_SERVERGROUP].str_var))
|
||||||
if ((s = current->setting[STR_SERVERGROUP].str_var))
|
|
||||||
{
|
{
|
||||||
if ((sg = getservergroup(s)))
|
|
||||||
sgi = sg->servergroup;
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (sg)
|
debug("[CtS] servergroup set to \"%s\"\n",sgroup);
|
||||||
debug("[CtS] trying servergroup \"%s\" (%i)\n",s,sg->servergroup);
|
|
||||||
else
|
|
||||||
debug("[CtS] trying servergroup \"%s\" (not found)\n",s);
|
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
}
|
}
|
||||||
else
|
sptry = NULL;
|
||||||
{
|
|
||||||
sgi = 0;
|
|
||||||
}
|
|
||||||
for(sp=serverlist;sp;sp=sp->next)
|
for(sp=serverlist;sp;sp=sp->next)
|
||||||
{
|
{
|
||||||
if ((sgi == 0 || sp->servergroup == sgi || sp->servergroup == 0) && sp->lastattempt != now)
|
if (sp->lastattempt == now)
|
||||||
{
|
continue;
|
||||||
if ((!sptry) || (sp->usenum < sptry->usenum))
|
if (sgroup && (stringcasecmp(sgroup,sp->group) != 0))
|
||||||
{
|
continue;
|
||||||
|
if (sptry && (sp->usenum > sptry->usenum))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (sp->err == 0 || sp->err == SP_ERRCONN)
|
if (sp->err == 0 || sp->err == SP_ERRCONN)
|
||||||
sptry = sp;
|
sptry = sp;
|
||||||
else
|
else
|
||||||
if (
|
if ((sp->err == SP_THROTTLED && (sp->lastattempt + 45) < now) || /* retry throttled after 45 seconds */
|
||||||
(sp->err == SP_THROTTLED && (sp->lastattempt + 45) < now) || /* retry throttled after 45 seconds */
|
(sp->err == SP_KLINED && (sp->lastattempt + 86400) < now)) /* retry Klined after a day */
|
||||||
(sp->err == SP_KLINED && (sp->lastattempt + 86400) < now) /* retry Klined after a day */
|
|
||||||
)
|
|
||||||
sptry = sp;
|
sptry = sp;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* Connect...
|
* Connect...
|
||||||
*/
|
*/
|
||||||
if (sptry)
|
if (sptry)
|
||||||
try_server(sptry,NULL);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
try_server(sptry,NULL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
const char *errtxt;
|
|
||||||
|
|
||||||
if (current->connect != CN_SPINNING)
|
if (current->connect != CN_SPINNING)
|
||||||
{
|
{
|
||||||
|
const char *errtxt;
|
||||||
debug("[CtS] Serverlist Exhausted:\n");
|
debug("[CtS] Serverlist Exhausted:\n");
|
||||||
for(sp=serverlist;sp;sp=sp->next)
|
for(sp=serverlist;sp;sp=sp->next)
|
||||||
{
|
{
|
||||||
errtxt = (const char *[]){"No error","SP_NOAUTH","SP_KLINED","SP_FULLCLASS",
|
errtxt = (const char *[]){"No error","SP_NOAUTH","SP_KLINED","SP_FULLCLASS",
|
||||||
"SP_TIMEOUT","SP_ERRCONN","SP_DIFFPORT","SP_NO_DNS","SP_THROTTLED"}[sp->err];
|
"SP_TIMEOUT","SP_ERRCONN","SP_DIFFPORT","SP_NO_DNS","SP_THROTTLED"}[sp->err];
|
||||||
debug("[CtS] (%i) %s[%i]: %s(%i) / servergroup %i\n",sp->ident,(sp->realname[0]) ? sp->realname : sp->name,
|
debug("[CtS] (%i) %s[%i]: %s(%i) / servergroup %i\n",sp->ident,
|
||||||
sp->port,errtxt,sp->err,sp->servergroup);
|
(*sp->realname) ? sp->realname : sp->name,
|
||||||
|
sp->port,errtxt,sp->err,sp->group);
|
||||||
}
|
}
|
||||||
debug("[CtS] Server connection is spinning...\n");
|
debug("[CtS] Server connection is spinning...\n");
|
||||||
}
|
}
|
||||||
current->connect = CN_SPINNING;
|
current->connect = CN_SPINNING;
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -714,7 +684,7 @@ void register_with_server(void)
|
|||||||
sendpass = (sp && *sp->pass);
|
sendpass = (sp && *sp->pass);
|
||||||
to_server((sendpass) ? "PASS :%s\nNICK %s\nUSER %s " MECHUSERLOGIN " 0 :%s\n" :
|
to_server((sendpass) ? "PASS :%s\nNICK %s\nUSER %s " MECHUSERLOGIN " 0 :%s\n" :
|
||||||
"%sNICK %s\nUSER %s " MECHUSERLOGIN " 0 :%s\n",
|
"%sNICK %s\nUSER %s " MECHUSERLOGIN " 0 :%s\n",
|
||||||
(sendpass) ? sp->pass : "",
|
(sendpass) ? sp->pass : EMPTYSTR,
|
||||||
getbotwantnick(current),
|
getbotwantnick(current),
|
||||||
(ident) ? ident : BOTLOGIN,
|
(ident) ? ident : BOTLOGIN,
|
||||||
(ircname) ? ircname : VERSION);
|
(ircname) ? ircname : VERSION);
|
||||||
@ -935,7 +905,7 @@ void update(SequenceTime *this)
|
|||||||
debug("\n");
|
debug("\n");
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
short_tv &= ~TV_REJOIN;
|
cx.short_tv &= ~TV_REJOIN;
|
||||||
for(current=botlist;current;current=current->next)
|
for(current=botlist;current;current=current->next)
|
||||||
{
|
{
|
||||||
if (current->reset || current->connect != CN_ONLINE)
|
if (current->reset || current->connect != CN_ONLINE)
|
||||||
@ -948,7 +918,7 @@ void update(SequenceTime *this)
|
|||||||
current->rejoin = FALSE;
|
current->rejoin = FALSE;
|
||||||
current->lastrejoin = now;
|
current->lastrejoin = now;
|
||||||
}
|
}
|
||||||
short_tv |= TV_REJOIN;
|
cx.short_tv |= TV_REJOIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NOTIFY
|
#ifdef NOTIFY
|
||||||
@ -1029,10 +999,8 @@ void update(SequenceTime *this)
|
|||||||
temp = TEXT_NOTINSERVLIST;
|
temp = TEXT_NOTINSERVLIST;
|
||||||
if ((sp = find_server(current->server)))
|
if ((sp = find_server(current->server)))
|
||||||
{
|
{
|
||||||
int ot = (uint32_t)(now - current->ontime);
|
if (sp->maxontime > current->ontime)
|
||||||
|
sp->maxontime = current->ontime;
|
||||||
if (sp->maxontime < ot)
|
|
||||||
sp->maxontime = ot;
|
|
||||||
sprintf(globaldata,"%s:%i",(*sp->realname) ? sp->realname : sp->name,sp->port);
|
sprintf(globaldata,"%s:%i",(*sp->realname) ? sp->realname : sp->name,sp->port);
|
||||||
temp = globaldata;
|
temp = globaldata;
|
||||||
}
|
}
|
||||||
@ -1219,6 +1187,7 @@ void do_core(COMMAND_ARGS)
|
|||||||
char *h,hostname[256];
|
char *h,hostname[256];
|
||||||
struct utsname un;
|
struct utsname un;
|
||||||
#endif /* HOSTINFO */
|
#endif /* HOSTINFO */
|
||||||
|
const char *extra;
|
||||||
char tmp[MSGLEN]; /* big buffers at the top */
|
char tmp[MSGLEN]; /* big buffers at the top */
|
||||||
Server *sp;
|
Server *sp;
|
||||||
Chan *chan;
|
Chan *chan;
|
||||||
@ -1274,20 +1243,20 @@ void do_core(COMMAND_ARGS)
|
|||||||
if (current->setting[STR_VIRTUAL].str_var)
|
if (current->setting[STR_VIRTUAL].str_var)
|
||||||
{
|
{
|
||||||
if ((current->vhost_type & VH_IPALIAS_FAIL) == 0)
|
if ((current->vhost_type & VH_IPALIAS_FAIL) == 0)
|
||||||
pt = "";
|
extra = EMPTYSTR;
|
||||||
else
|
else
|
||||||
pt = TEXT_VHINACTIVE;
|
extra = TEXT_VHINACTIVE;
|
||||||
table_buffer(TEXT_VIRTHOST,current->setting[STR_VIRTUAL].str_var,pt);
|
table_buffer(TEXT_VIRTHOST,current->setting[STR_VIRTUAL].str_var,extra);
|
||||||
}
|
}
|
||||||
#ifdef WINGATE
|
#ifdef WINGATE
|
||||||
if (current->setting[STR_WINGATE].str_var && current->setting[INT_WINGPORT].int_var)
|
if (current->setting[STR_WINGATE].str_var && current->setting[INT_WINGPORT].int_var)
|
||||||
{
|
{
|
||||||
if ((current->vhost_type & VH_WINGATE_FAIL) == 0)
|
if ((current->vhost_type & VH_WINGATE_FAIL) == 0)
|
||||||
pt = "";
|
extra = EMPTYSTR;
|
||||||
else
|
else
|
||||||
pt = TEXT_VHINACTIVE;
|
extra = TEXT_VHINACTIVE;
|
||||||
table_buffer(TEXT_VIRTHOSTWINGATE,current->setting[STR_WINGATE].str_var,
|
table_buffer(TEXT_VIRTHOSTWINGATE,current->setting[STR_WINGATE].str_var,
|
||||||
current->setting[INT_WINGPORT].int_var,pt);
|
current->setting[INT_WINGPORT].int_var,extra);
|
||||||
}
|
}
|
||||||
#endif /* WINGATE */
|
#endif /* WINGATE */
|
||||||
sp = find_server(current->server);
|
sp = find_server(current->server);
|
||||||
@ -1296,7 +1265,7 @@ void do_core(COMMAND_ARGS)
|
|||||||
(sp->realname[0]) ? sp->realname : sp->name,sp->port);
|
(sp->realname[0]) ? sp->realname : sp->name,sp->port);
|
||||||
else
|
else
|
||||||
table_buffer(TEXT_CURRSERVERNOT);
|
table_buffer(TEXT_CURRSERVERNOT);
|
||||||
table_buffer(TEXT_SERVERONTIME,idle2str(now - current->ontime,FALSE));
|
table_buffer(TEXT_SERVERONTIME,idle2str(current->ontime,FALSE));
|
||||||
table_buffer(TEXT_BOTMODES,(*current->modes) ? current->modes : TEXT_NONE);
|
table_buffer(TEXT_BOTMODES,(*current->modes) ? current->modes : TEXT_NONE);
|
||||||
#ifdef HOSTINFO
|
#ifdef HOSTINFO
|
||||||
hostname[255] = 0;
|
hostname[255] = 0;
|
||||||
@ -1310,12 +1279,17 @@ void do_core(COMMAND_ARGS)
|
|||||||
#endif /* HOSTINFO */
|
#endif /* HOSTINFO */
|
||||||
table_buffer(TEXT_CURRENTTIME,time2str(now));
|
table_buffer(TEXT_CURRENTTIME,time2str(now));
|
||||||
table_buffer(TEXT_BOTSTARTED,time2str(uptime));
|
table_buffer(TEXT_BOTSTARTED,time2str(uptime));
|
||||||
table_buffer(TEXT_BOTUPTIME,idle2str(now - uptime,FALSE));
|
table_buffer(TEXT_BOTUPTIME,idle2str(uptime,FALSE));
|
||||||
table_buffer(TEXT_BOTVERSION,VERSION,SRCDATE);
|
table_buffer(TEXT_BOTVERSION,VERSION,SRCDATE);
|
||||||
table_buffer(TEXT_BOTFEATURES,__mx_opts);
|
table_buffer(TEXT_BOTFEATURES,__mx_opts);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
table_buffer("Debug\t%s%s%s",(const char *[]){"Off","On, Output = "}[dodebug],
|
#ifdef __profiling__
|
||||||
(debugfile==NULL) ? ((dodebug==TRUE) ? "Stdout" : "") : debugfile);
|
table_buffer("Debug\t%s%s%s, Compiled with Profiling",
|
||||||
|
#else
|
||||||
|
table_buffer("Debug\t%s%s%s",
|
||||||
|
#endif
|
||||||
|
(const char *[]){"Off","On, Output = "}[dodebug],
|
||||||
|
(debugfile==NULL) ? ((dodebug==TRUE) ? "Stdout" : EMPTYSTR) : debugfile);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
table_send(from,2);
|
table_send(from,2);
|
||||||
}
|
}
|
||||||
@ -1366,196 +1340,143 @@ void do_shutdown(COMMAND_ARGS)
|
|||||||
/* NOT REACHED */
|
/* NOT REACHED */
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_servergroup(COMMAND_ARGS)
|
void do_server_noargs(const char *from)
|
||||||
{
|
{
|
||||||
ServerGroup *sg,*new,**sgp;
|
Server *sp;
|
||||||
char *name;
|
const char *str_currentserver,*str_ago;
|
||||||
|
char maxontimebuf[36],*maxontime,*lastconnect;
|
||||||
|
|
||||||
name = chop(&rest);
|
if (partyline_only_command(from))
|
||||||
|
return;
|
||||||
|
table_buffer(str_underline("server") "\t" str_underline("last connect") "\t"
|
||||||
|
str_underline("maxontime") "\t" str_underline("group"));
|
||||||
|
|
||||||
/*
|
for(sp=serverlist;sp;sp=sp->next)
|
||||||
* no args, list servergroups
|
|
||||||
*/
|
|
||||||
if (!name)
|
|
||||||
{
|
{
|
||||||
table_buffer(str_underline("id") "\t" str_underline("name"));
|
str_ago = str_currentserver = EMPTYSTR;
|
||||||
for(sg=servergrouplist;sg;sg=sg->next)
|
if (sp->ident == current->server)
|
||||||
{
|
{
|
||||||
table_buffer("%i\t%s%s",sg->servergroup,sg->name,(sg == currentservergroup) ? " (current)" : "");
|
if (sp->maxontime == -1 || sp->maxontime > current->ontime)
|
||||||
|
sp->maxontime = current->ontime;
|
||||||
|
str_currentserver = TEXT_CURRENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sp->maxontime == -1)
|
||||||
|
maxontime = TEXT_NEVER;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
maxontime = maxontimebuf;
|
||||||
|
stringcpy(maxontimebuf,idle2str(sp->maxontime,FALSE));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sp->lastconnect)
|
||||||
|
{
|
||||||
|
str_ago = TEXT_AGO;
|
||||||
|
lastconnect = idle2str(sp->lastconnect,FALSE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
switch(sp->err)
|
||||||
|
{
|
||||||
|
case SP_NOAUTH:
|
||||||
|
lastconnect = TEXT_SP_NOAUTH;
|
||||||
|
break;
|
||||||
|
case SP_KLINED:
|
||||||
|
lastconnect = TEXT_SP_KLINED;
|
||||||
|
break;
|
||||||
|
case SP_FULLCLASS:
|
||||||
|
lastconnect = TEXT_SP_FULLCLASS;
|
||||||
|
break;
|
||||||
|
case SP_TIMEOUT:
|
||||||
|
lastconnect = TEXT_SP_TIMEOUT;
|
||||||
|
break;
|
||||||
|
case SP_ERRCONN:
|
||||||
|
lastconnect = TEXT_SP_ERRCONN;
|
||||||
|
break;
|
||||||
|
case SP_DIFFPORT:
|
||||||
|
lastconnect = TEXT_SP_DIFFPORT;
|
||||||
|
break;
|
||||||
|
case SP_NO_DNS:
|
||||||
|
lastconnect = TEXT_SP_NO_DNS;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
lastconnect = TEXT_NEVER;
|
||||||
|
}
|
||||||
|
table_buffer("%s:%i%s\t%s%s\t%s\t%s",(*sp->realname) ? sp->realname : sp->name,sp->port,
|
||||||
|
str_currentserver,lastconnect,str_ago,maxontime,sp->group);
|
||||||
}
|
}
|
||||||
table_send(from,2);
|
table_send(from,2);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* find pre-existing severgroup by the same name (case-insensitive)
|
|
||||||
*/
|
|
||||||
sg = getservergroup(name);
|
|
||||||
if (!sg)
|
|
||||||
{
|
|
||||||
#ifdef DEBUG
|
|
||||||
debug("(do_servergroup) creating new servergroup: %s\n",name);
|
|
||||||
#endif /* DEBUG */
|
|
||||||
set_mallocdoer(do_servergroup);
|
|
||||||
new = (ServerGroup*)Calloc(sizeof(ServerGroup) + strlen(name));
|
|
||||||
servergroupid++;
|
|
||||||
new->servergroup = servergroupid;
|
|
||||||
stringcpy(new->name,name);
|
|
||||||
sgp = &servergrouplist;
|
|
||||||
while(*sgp)
|
|
||||||
sgp = &(*sgp)->next;
|
|
||||||
sg = *sgp = new;
|
|
||||||
#ifdef DEBUG
|
|
||||||
{
|
|
||||||
ServerGroup *g;
|
|
||||||
|
|
||||||
for (g=servergrouplist;g;g=g->next)
|
|
||||||
{
|
|
||||||
debug("(do_servergroup) %s (%i)\n",g->name,g->servergroup);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* DEBUG */
|
|
||||||
}
|
|
||||||
currentservergroup = sg;
|
|
||||||
#ifdef DEBUG
|
|
||||||
debug("(do_servergroup) current servergroup set to \"%s\" (%i)\n",sg->name,sg->servergroup);
|
|
||||||
#endif /* DEBUG */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_server(COMMAND_ARGS)
|
void do_server(COMMAND_ARGS)
|
||||||
{
|
{
|
||||||
ServerGroup *sg;
|
|
||||||
Server *sp,*dp,**spp;
|
Server *sp,*dp,**spp;
|
||||||
char *server,*aport,*pass;
|
char *server,*aport,*temp;
|
||||||
char addc,*last,*quitmsg = TEXT_TRYNEWSERVER;
|
const char *pass,*group;
|
||||||
int n,iport,sgi;
|
char add_or_sub,*quitmsg = TEXT_TRYNEWSERVER;
|
||||||
|
int n,iport;
|
||||||
|
|
||||||
if (CurrentCmd->name == C_NEXTSERVER)
|
if (CurrentCmd->name == C_NEXTSERVER)
|
||||||
{
|
{
|
||||||
quitmsg = TEXT_SWITCHSERVER;
|
to_user(from,FMT_PLAIN,TEXT_SWITCHSERVER);
|
||||||
to_user(from,FMT_PLAIN,quitmsg);
|
|
||||||
goto do_server_jump;
|
goto do_server_jump;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
add_or_sub = *rest;
|
||||||
|
if (*rest == '-' || *rest == '+')
|
||||||
|
rest++;
|
||||||
|
|
||||||
|
if (*rest == 0)
|
||||||
|
goto do_server_einval;
|
||||||
|
|
||||||
server = chop(&rest);
|
server = chop(&rest);
|
||||||
|
if ((cx.chop_end - server) >= MAXHOSTLEN)
|
||||||
/*
|
|
||||||
* no args, list all known servers
|
|
||||||
*/
|
|
||||||
if (!server)
|
|
||||||
{
|
|
||||||
char maxontime[36],*cuur;
|
|
||||||
int ot;
|
|
||||||
|
|
||||||
if (partyline_only_command(from))
|
|
||||||
return;
|
|
||||||
if (servergrouplist->next)
|
|
||||||
table_buffer(str_underline("server") "\t" str_underline("last connect") "\t"
|
|
||||||
str_underline("maxontime") "\t" str_underline("group"));
|
|
||||||
else
|
|
||||||
table_buffer(str_underline("server") "\t" str_underline("last connect") "\t" str_underline("maxontime"));
|
|
||||||
sgi = -1;
|
|
||||||
for(sp=serverlist;sp;sp=sp->next)
|
|
||||||
{
|
|
||||||
cuur = "";
|
|
||||||
if (sp->ident == current->server)
|
|
||||||
{
|
|
||||||
cuur = TEXT_CURRENT;
|
|
||||||
ot = now - current->ontime;
|
|
||||||
if (sp->maxontime < ot)
|
|
||||||
sp->maxontime = ot;
|
|
||||||
}
|
|
||||||
stringcpy(maxontime,(sp->maxontime == 0) ? TEXT_NEVER : idle2str(sp->maxontime,FALSE));
|
|
||||||
if (sp->lastconnect)
|
|
||||||
last = idle2str(now - sp->lastconnect,FALSE);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch(sp->err)
|
|
||||||
{
|
|
||||||
case SP_NOAUTH:
|
|
||||||
last = TEXT_SP_NOAUTH;
|
|
||||||
break;
|
|
||||||
case SP_KLINED:
|
|
||||||
last = TEXT_SP_KLINED;
|
|
||||||
break;
|
|
||||||
case SP_FULLCLASS:
|
|
||||||
last = TEXT_SP_FULLCLASS;
|
|
||||||
break;
|
|
||||||
case SP_TIMEOUT:
|
|
||||||
last = TEXT_SP_TIMEOUT;
|
|
||||||
break;
|
|
||||||
case SP_ERRCONN:
|
|
||||||
last = TEXT_SP_ERRCONN;
|
|
||||||
break;
|
|
||||||
case SP_DIFFPORT:
|
|
||||||
last = TEXT_SP_DIFFPORT;
|
|
||||||
break;
|
|
||||||
case SP_NO_DNS:
|
|
||||||
last = TEXT_SP_NO_DNS;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
last = TEXT_NEVER;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (servergrouplist->next)
|
|
||||||
{
|
|
||||||
if (sgi != sp->servergroup)
|
|
||||||
{
|
|
||||||
sg = getservergroupid(sp->servergroup);
|
|
||||||
if (sg)
|
|
||||||
sgi = sg->servergroup;
|
|
||||||
}
|
|
||||||
table_buffer("%s:%i\t%s%s%s\t%s\t%s",(*sp->realname) ? sp->realname : sp->name,sp->port,
|
|
||||||
last,(sp->lastconnect) ? TEXT_AGO : "",cuur,maxontime,(sg) ? sg->name : "(unknown)");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
table_buffer("%s:%i\t%s%s%s\t%s",(*sp->realname) ? sp->realname : sp->name,sp->port,
|
|
||||||
last,(sp->lastconnect) ? TEXT_AGO : "",cuur,maxontime);
|
|
||||||
}
|
|
||||||
table_send(from,2);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
addc = *server;
|
|
||||||
if (addc == '-' || addc == '+')
|
|
||||||
{
|
|
||||||
server++;
|
|
||||||
if (!*server)
|
|
||||||
{
|
|
||||||
usage(from);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (strlen(server) >= MAXHOSTLEN)
|
|
||||||
{
|
{
|
||||||
to_user(from,TEXT_NAMETOOLONG);
|
to_user(from,TEXT_NAMETOOLONG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
aport = chop(&rest);
|
aport = "6667";
|
||||||
pass = chop(&rest);
|
group = DEFAULTSTR;
|
||||||
iport = asc2int(aport);
|
pass = EMPTYSTR;
|
||||||
|
do
|
||||||
if (aport && *aport == COMMENT_CHAR)
|
|
||||||
{
|
{
|
||||||
aport = pass = NULL;
|
if (*rest == COMMENT_CHAR)
|
||||||
|
break;
|
||||||
|
temp = chop(&rest);
|
||||||
|
if (temp == NULL)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (*temp >= '1' && *temp <= '9')
|
||||||
|
aport = temp;
|
||||||
|
else
|
||||||
|
if (*temp == '@' && ((cx.chop_end - temp) <= SERVERGROUPLEN))
|
||||||
|
group = temp + 1;
|
||||||
|
else
|
||||||
|
if (*temp == '"')
|
||||||
|
{
|
||||||
|
char *c;
|
||||||
|
|
||||||
|
temp++;
|
||||||
|
c = stringchr(temp,'"');
|
||||||
|
if (c && ((c - temp) <= PASSLEN))
|
||||||
|
pass = temp, *c = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (pass && *pass == COMMENT_CHAR)
|
goto do_server_einval;
|
||||||
{
|
|
||||||
pass = NULL;
|
|
||||||
}
|
}
|
||||||
|
while(*rest);
|
||||||
|
|
||||||
if (aport && (errno || iport < 1 || iport > 65534))
|
iport = asc2int(aport);
|
||||||
|
|
||||||
|
if (errno || iport < 1 || iport > 65534)
|
||||||
{
|
{
|
||||||
|
do_server_einval:
|
||||||
usage(from);
|
usage(from);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!aport)
|
|
||||||
{
|
|
||||||
iport = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (addc == '-')
|
if (add_or_sub == '-')
|
||||||
{
|
{
|
||||||
if (!serverlist)
|
if (!serverlist)
|
||||||
{
|
{
|
||||||
@ -1597,13 +1518,8 @@ void do_server(COMMAND_ARGS)
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sp = add_server(server,iport,pass);
|
sp = add_server(server,iport,pass,group); /* add_server has no failure mode */
|
||||||
if (!sp)
|
if (add_or_sub == '+' || from == CoreUser.name)
|
||||||
{
|
|
||||||
to_user(from,"Problem adding server: %s",server);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (addc || from == CoreUser.name)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
current->nextserver = sp->ident;
|
current->nextserver = sp->ident;
|
||||||
@ -1721,8 +1637,10 @@ void do_time(COMMAND_ARGS)
|
|||||||
|
|
||||||
void do_upontime(COMMAND_ARGS)
|
void do_upontime(COMMAND_ARGS)
|
||||||
{
|
{
|
||||||
to_user_q(from,CurrentCmd->cmdarg,
|
time_t temp;
|
||||||
idle2str(now - ((CurrentCmd->name == C_UPTIME) ? uptime : current->ontime),FALSE));
|
|
||||||
|
temp = ((CurrentCmd->name == C_UPTIME) ? uptime : current->ontime);
|
||||||
|
to_user_q(from,CurrentCmd->cmdarg,idle2str(temp,FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_msg(COMMAND_ARGS)
|
void do_msg(COMMAND_ARGS)
|
||||||
|
|||||||
41
src/debug.c
41
src/debug.c
@ -92,7 +92,6 @@ LS const struct
|
|||||||
{ "Seen", sizeof(Seen) },
|
{ "Seen", sizeof(Seen) },
|
||||||
#endif /* SEEN */
|
#endif /* SEEN */
|
||||||
{ "Server", sizeof(Server) },
|
{ "Server", sizeof(Server) },
|
||||||
{ "ServerGroup", sizeof(ServerGroup) },
|
|
||||||
{ "Setting", sizeof(Setting) },
|
{ "Setting", sizeof(Setting) },
|
||||||
{ "Shit", sizeof(Shit) },
|
{ "Shit", sizeof(Shit) },
|
||||||
{ "Spy\t", sizeof(Spy) },
|
{ "Spy\t", sizeof(Spy) },
|
||||||
@ -142,7 +141,6 @@ LS struct
|
|||||||
{ do_die, "do_die" RARE_SE },
|
{ do_die, "do_die" RARE_SE },
|
||||||
{ do_nick, "do_nick" CMD1_SE },
|
{ do_nick, "do_nick" CMD1_SE },
|
||||||
{ do_kicksay, "do_kicksay" CMD1_SE },
|
{ do_kicksay, "do_kicksay" CMD1_SE },
|
||||||
{ do_servergroup, "do_servergroup" CMD1_SE },
|
|
||||||
{ do_set, "do_set" CMD1_SE },
|
{ do_set, "do_set" CMD1_SE },
|
||||||
{ do_spy, "do_spy" CMD1_SE },
|
{ do_spy, "do_spy" CMD1_SE },
|
||||||
{ join_channel, "join_channel" CFG1_SE },
|
{ join_channel, "join_channel" CFG1_SE },
|
||||||
@ -169,6 +167,7 @@ LS struct
|
|||||||
{ send_mode, "send_mode" },
|
{ send_mode, "send_mode" },
|
||||||
{ set_str_varc, "set_str_varc" CFG1_SE },
|
{ set_str_varc, "set_str_varc" CFG1_SE },
|
||||||
{ set_mix16, "set_mix16" CORE_SE },
|
{ set_mix16, "set_mix16" CORE_SE },
|
||||||
|
{ set_mix64, "set_mix64" CORE_SE },
|
||||||
{ sig_hup, "sig_hup" RARE_SE },
|
{ sig_hup, "sig_hup" RARE_SE },
|
||||||
{ table_buffer, "table_buffer" },
|
{ table_buffer, "table_buffer" },
|
||||||
#ifdef ALIAS
|
#ifdef ALIAS
|
||||||
@ -502,7 +501,6 @@ char *atime(time_t when)
|
|||||||
|
|
||||||
void debug_server(Server *sp, char *pad)
|
void debug_server(Server *sp, char *pad)
|
||||||
{
|
{
|
||||||
ServerGroup *sg;
|
|
||||||
char *pl;
|
char *pl;
|
||||||
|
|
||||||
if (!sp)
|
if (!sp)
|
||||||
@ -516,17 +514,9 @@ void debug_server(Server *sp, char *pad)
|
|||||||
debug("%s; ident\t\t%i\n",pad,sp->ident);
|
debug("%s; ident\t\t%i\n",pad,sp->ident);
|
||||||
debug("%s; name\t\t\"%s\"\n",pad,nullbuf(sp->name));
|
debug("%s; name\t\t\"%s\"\n",pad,nullbuf(sp->name));
|
||||||
debug("%s; pass\t\t\"%s\"\n",pad,nullbuf(sp->pass));
|
debug("%s; pass\t\t\"%s\"\n",pad,nullbuf(sp->pass));
|
||||||
|
debug("%s; group\t\t\"%s\"\n",pad,nullbuf(sp->group));
|
||||||
debug("%s; realname\t\t\"%s\"\n",pad,nullbuf(sp->realname));
|
debug("%s; realname\t\t\"%s\"\n",pad,nullbuf(sp->realname));
|
||||||
debug("%s; usenum\t\t%i\n",pad,sp->usenum);
|
debug("%s; usenum\t\t%i\n",pad,sp->usenum);
|
||||||
sg = getservergroupid(sp->servergroup);
|
|
||||||
if (sg)
|
|
||||||
{
|
|
||||||
debug("%s; servergroup\t%s%i \"%s\"\n",pad,pl,sp->servergroup,sg->name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
debug("%s; servergroup\t%s%i (unknown)\n",pad,pl,sp->servergroup);
|
|
||||||
}
|
|
||||||
debug("%s; port\t\t%i\n",pad,sp->port);
|
debug("%s; port\t\t%i\n",pad,sp->port);
|
||||||
debug("%s; err\t\t%s%s (%i)\n",pad,pl,strdef(SPdefs,sp->err),sp->err);
|
debug("%s; err\t\t%s%s (%i)\n",pad,pl,strdef(SPdefs,sp->err),sp->err);
|
||||||
debug("%s; lastconnect\t%s%s (%lu)\n",pad,pl,atime(sp->lastconnect),sp->lastconnect);
|
debug("%s; lastconnect\t%s%s (%lu)\n",pad,pl,atime(sp->lastconnect),sp->lastconnect);
|
||||||
@ -825,7 +815,6 @@ void debug_core(void)
|
|||||||
Seen *seen;
|
Seen *seen;
|
||||||
#endif /* SEEN */
|
#endif /* SEEN */
|
||||||
Server *sp;
|
Server *sp;
|
||||||
ServerGroup *sg;
|
|
||||||
Spy *spy;
|
Spy *spy;
|
||||||
Strp *st;
|
Strp *st;
|
||||||
Shit *shit;
|
Shit *shit;
|
||||||
@ -856,25 +845,7 @@ void debug_core(void)
|
|||||||
debug("; executable\t\t\"%s\"\n",executable);
|
debug("; executable\t\t\"%s\"\n",executable);
|
||||||
debug("; configfile\t\t\"%s\"\n",configfile);
|
debug("; configfile\t\t\"%s\"\n",configfile);
|
||||||
debug("; uptime\t\t%s (%lu)\n",atime(uptime),uptime);
|
debug("; uptime\t\t%s (%lu)\n",atime(uptime),uptime);
|
||||||
debug("; short_tv\t\t%s (%is wait)\n",boolstr(short_tv),(short_tv) ? 1 : 30);
|
debug("; short_tv\t\t%s (%is wait)\n",boolstr(cx.short_tv),(cx.short_tv) ? 1 : 30);
|
||||||
debug("> currentservergroup\t"mx_pfmt"\n",(mx_ptr)currentservergroup);
|
|
||||||
if (currentservergroup)
|
|
||||||
{
|
|
||||||
sg = currentservergroup;
|
|
||||||
debug(" ; next\t\t"mx_pfmt"\n",(mx_ptr)sg->next);
|
|
||||||
debug(" ; servergroup\t\t%i\n",sg->servergroup);
|
|
||||||
debug(" ; name\t\t\"%s\"\n",nullbuf(sg->name));
|
|
||||||
debug(" ; ---\n");
|
|
||||||
}
|
|
||||||
debug("> servergrouplist\t"mx_pfmt"\n",(mx_ptr)servergrouplist);
|
|
||||||
for(sg=servergrouplist;sg;sg=sg->next)
|
|
||||||
{
|
|
||||||
memtouch(sg);
|
|
||||||
debug(" ; next\t\t"mx_pfmt"\n",(mx_ptr)sg->next);
|
|
||||||
debug(" ; servergroup\t\t%i\n",sg->servergroup);
|
|
||||||
debug(" ; name\t\t\"%s\"\n",nullbuf(sg->name));
|
|
||||||
debug(" ; ---\n");
|
|
||||||
}
|
|
||||||
debug("> serverlist\t\t"mx_pfmt"\n",(mx_ptr)serverlist);
|
debug("> serverlist\t\t"mx_pfmt"\n",(mx_ptr)serverlist);
|
||||||
for(sp=serverlist;sp;sp=sp->next)
|
for(sp=serverlist;sp;sp=sp->next)
|
||||||
{
|
{
|
||||||
@ -1448,7 +1419,7 @@ void do_debug(COMMAND_ARGS)
|
|||||||
int m;
|
int m;
|
||||||
|
|
||||||
arg = chop(&rest);
|
arg = chop(&rest);
|
||||||
if (strcasecmp(arg,"off") == 0)
|
if (arg && strcasecmp(arg,"off") == 0)
|
||||||
{
|
{
|
||||||
if (debugfile && debugfilemalloc == TRUE)
|
if (debugfile && debugfilemalloc == TRUE)
|
||||||
Free(&debugfile);
|
Free(&debugfile);
|
||||||
@ -1458,7 +1429,7 @@ void do_debug(COMMAND_ARGS)
|
|||||||
to_user(from,"Debug output turned off");
|
to_user(from,"Debug output turned off");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (strcasecmp(arg,"on") == 0)
|
if (arg && strcasecmp(arg,"on") == 0)
|
||||||
{
|
{
|
||||||
m = is_safepath(rest,FILE_MAY_EXIST);
|
m = is_safepath(rest,FILE_MAY_EXIST);
|
||||||
debug("(do_debug) turn on, rest = '%s', %i\n",rest,m);
|
debug("(do_debug) turn on, rest = '%s', %i\n",rest,m);
|
||||||
@ -1468,7 +1439,7 @@ void do_debug(COMMAND_ARGS)
|
|||||||
Free(&debugfile);
|
Free(&debugfile);
|
||||||
debugfilemalloc = TRUE;
|
debugfilemalloc = TRUE;
|
||||||
set_mallocdoer(do_debug);
|
set_mallocdoer(do_debug);
|
||||||
debugfile = strdup(rest);
|
debugfile = stringdup(rest);
|
||||||
dodebug = TRUE;
|
dodebug = TRUE;
|
||||||
to_user(from,"Debug output turned on, Output = %s",rest);
|
to_user(from,"Debug output turned on, Output = %s",rest);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,9 +59,6 @@ typedef struct dnsRType
|
|||||||
|
|
||||||
#define MAX_QUESTIONS 16
|
#define MAX_QUESTIONS 16
|
||||||
|
|
||||||
LS int dnssock = -1;
|
|
||||||
LS int dnsserver = 0;
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
char *type_textlist[] =
|
char *type_textlist[] =
|
||||||
{ NULL, "A", "NS", "MD", "MF", "CNAME", "SOA", "MB", "MG", "MR", "NULL", "WKS", "PTR", "HINFO", "MINFO", "MX", "TXT", };
|
{ NULL, "A", "NS", "MD", "MF", "CNAME", "SOA", "MB", "MG", "MR", "NULL", "WKS", "PTR", "HINFO", "MINFO", "MX", "TXT", };
|
||||||
@ -643,8 +640,6 @@ void process_rawdns(void)
|
|||||||
char packet[512];
|
char packet[512];
|
||||||
int sz,n;
|
int sz,n;
|
||||||
|
|
||||||
if (dnssock == -1)
|
|
||||||
return;
|
|
||||||
if (FD_ISSET(dnssock,&read_fds))
|
if (FD_ISSET(dnssock,&read_fds))
|
||||||
{
|
{
|
||||||
sz = sizeof(sai);
|
sz = sizeof(sai);
|
||||||
|
|||||||
@ -511,6 +511,8 @@ char *idle2str(time_t when, int small)
|
|||||||
char *dst;
|
char *dst;
|
||||||
int n,z[4];
|
int n,z[4];
|
||||||
|
|
||||||
|
when = now - when;
|
||||||
|
|
||||||
z[0] = when / 86400;
|
z[0] = when / 86400;
|
||||||
z[1] = (when -= z[0] * 86400) / 3600;
|
z[1] = (when -= z[0] * 86400) / 3600;
|
||||||
z[2] = (when -= z[1] * 3600) / 60;
|
z[2] = (when -= z[1] * 3600) / 60;
|
||||||
@ -522,7 +524,7 @@ char *idle2str(time_t when, int small)
|
|||||||
/* xx : "59 seconds" */
|
/* xx : "59 seconds" */
|
||||||
if (small)
|
if (small)
|
||||||
{
|
{
|
||||||
char *f[] = {"day","hour","minute","second"};
|
const char *f[] = {"day","hour","minute","second"};
|
||||||
|
|
||||||
*idlestr = 0;
|
*idlestr = 0;
|
||||||
for(n=0;n<4;n++)
|
for(n=0;n<4;n++)
|
||||||
|
|||||||
20
src/gencmd.c
20
src/gencmd.c
@ -176,11 +176,11 @@ void make_mcmd(int mode)
|
|||||||
}
|
}
|
||||||
if (pass == __struct_acces_2)
|
if (pass == __struct_acces_2)
|
||||||
{
|
{
|
||||||
to_file(fd,"LS OnMsg_access acmd[] =\n{\n");
|
to_file(fd,"OnMsg_access acmd[] =\n{\n");
|
||||||
}
|
}
|
||||||
if (pass == __struct_print_1)
|
if (pass == __struct_print_1)
|
||||||
{
|
{
|
||||||
to_file(fd,"LS const OnMsg mcmd[] =\n{\n");
|
to_file(fd,"const OnMsg mcmd[] =\n{\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HEATMAP
|
#ifdef HEATMAP
|
||||||
@ -229,6 +229,7 @@ void make_mcmd(int mode)
|
|||||||
}
|
}
|
||||||
if (pass == __struct_print_1)
|
if (pass == __struct_print_1)
|
||||||
{
|
{
|
||||||
|
char noargfunc[64];
|
||||||
h = mkhash(cmdstr);
|
h = mkhash(cmdstr);
|
||||||
hashmap[h] = i;
|
hashmap[h] = i;
|
||||||
|
|
||||||
@ -249,8 +250,9 @@ void make_mcmd(int mode)
|
|||||||
v.cbang = (pre_mcmd[cmdidx].flags & CBANG) ? 1 : 0;
|
v.cbang = (pre_mcmd[cmdidx].flags & CBANG) ? 1 : 0;
|
||||||
v.acchan = (pre_mcmd[cmdidx].flags & ACCHAN) ? 1 : 0;
|
v.acchan = (pre_mcmd[cmdidx].flags & ACCHAN) ? 1 : 0;
|
||||||
v.supres = (pre_mcmd[cmdidx].flags & SUPRES) ? 1 : 0;
|
v.supres = (pre_mcmd[cmdidx].flags & SUPRES) ? 1 : 0;
|
||||||
|
v.noargf = (pre_mcmd[cmdidx].flags & NOARGF) ? 1 : 0;
|
||||||
|
|
||||||
sprintf(tmp,"%3i,%2i,%2i,%2i,%2i,%2i,%2i,%2i,%2i,%2i,%2i,%2i,%2i,%2i",
|
sprintf(tmp,"%3i,%2i,%2i,%2i,%2i,%2i,%2i,%2i,%2i,%2i,%2i,%2i,%2i,%2i,%2i",
|
||||||
v.defaultaccess,
|
v.defaultaccess,
|
||||||
v.dcc,
|
v.dcc,
|
||||||
v.cc,
|
v.cc,
|
||||||
@ -264,7 +266,8 @@ void make_mcmd(int mode)
|
|||||||
v.lbuf,
|
v.lbuf,
|
||||||
v.cbang,
|
v.cbang,
|
||||||
v.acchan,
|
v.acchan,
|
||||||
v.supres
|
v.supres,
|
||||||
|
v.noargf
|
||||||
);
|
);
|
||||||
|
|
||||||
tabs = "\t\t\t";
|
tabs = "\t\t\t";
|
||||||
@ -278,14 +281,21 @@ void make_mcmd(int mode)
|
|||||||
else
|
else
|
||||||
tabx = tabs + 3;
|
tabx = tabs + 3;
|
||||||
|
|
||||||
|
if (v.noargf)
|
||||||
|
sprintf(noargfunc,"%s_noargs",pre_mcmd[cmdidx].func);
|
||||||
|
else
|
||||||
|
strcpy(noargfunc,"0");
|
||||||
adj = strlen(pre_mcmd[cmdidx].func);
|
adj = strlen(pre_mcmd[cmdidx].func);
|
||||||
tabs += 1 + ((adj > 6));
|
tabs += 1 + ((adj > 6));
|
||||||
|
|
||||||
//to_file(fd,"/""* %3i=%3i *""/",h,i);
|
//to_file(fd,"/""* %3i=%3i *""/",h,i);
|
||||||
to_file(fd,(pre_mcmd[cmdidx].cmdarg) ? "{ C_%s,%s\t%s,%s%s\t, \"%s\"\t},\n" : "{ C_%s,%s\t%s,%s%s\t},\n",
|
to_file(fd,(pre_mcmd[cmdidx].cmdarg) ?
|
||||||
|
"{ C_%s,%s\t%s,%s,%s%s\t, \"%s\"\t},\n" :
|
||||||
|
"{ C_%s,%s\t%s,%s,%s%s\t},\n",
|
||||||
cmdstr,
|
cmdstr,
|
||||||
tabx,
|
tabx,
|
||||||
pre_mcmd[cmdidx].func,
|
pre_mcmd[cmdidx].func,
|
||||||
|
noargfunc,
|
||||||
tabs,
|
tabs,
|
||||||
tmp,
|
tmp,
|
||||||
pre_mcmd[cmdidx].cmdarg
|
pre_mcmd[cmdidx].cmdarg
|
||||||
|
|||||||
70
src/global.h
70
src/global.h
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
EnergyMech, IRC bot software
|
EnergyMech, IRC bot software
|
||||||
Copyright (c) 1997-2024 proton
|
Copyright (c) 1997-2025 proton
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -24,7 +24,7 @@
|
|||||||
#ifdef MAIN_C
|
#ifdef MAIN_C
|
||||||
|
|
||||||
#define MDEF(x) = x
|
#define MDEF(x) = x
|
||||||
#define BEG LS
|
#define BEG
|
||||||
|
|
||||||
#else /* MAIN_C */
|
#else /* MAIN_C */
|
||||||
|
|
||||||
@ -39,6 +39,22 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
struct CoreData /* Collect core data all in one place */
|
||||||
|
{
|
||||||
|
time_t now;
|
||||||
|
Mech *current;
|
||||||
|
char *rest_end;
|
||||||
|
char *chop_end;
|
||||||
|
int socksmodified;
|
||||||
|
int hisock;
|
||||||
|
int short_tv;
|
||||||
|
};
|
||||||
|
|
||||||
|
BEG struct CoreData cx;
|
||||||
|
|
||||||
|
#define now cx.now
|
||||||
|
#define current cx.current
|
||||||
|
|
||||||
#define DEFAULTCMDCHAR '-'
|
#define DEFAULTCMDCHAR '-'
|
||||||
#define MECHUSERLOGIN "v3.energymech.net"
|
#define MECHUSERLOGIN "v3.energymech.net"
|
||||||
|
|
||||||
@ -52,6 +68,10 @@ BEG const char BOTCLASS[] MDEF("EnergyMech");
|
|||||||
BEG const char BOTLOGIN[] MDEF("emech");
|
BEG const char BOTLOGIN[] MDEF("emech");
|
||||||
|
|
||||||
BEG const char NULLSTR[] MDEF("<NULL>");
|
BEG const char NULLSTR[] MDEF("<NULL>");
|
||||||
|
#define EMPTYSTR (&NULLSTR[6])
|
||||||
|
BEG const char DEFAULTSTR[] MDEF("default");
|
||||||
|
BEG const char UNKNOWNATUNKNOWN[] MDEF("unknown@unknown");
|
||||||
|
#define UNKNOWN (&UNKNOWNATUNKNOWN[8])
|
||||||
|
|
||||||
BEG const char ERR_CHAN[] MDEF("I'm not on %s");
|
BEG const char ERR_CHAN[] MDEF("I'm not on %s");
|
||||||
BEG const char ERR_FILEOPEN[] MDEF("Couldn't open the file %s");
|
BEG const char ERR_FILEOPEN[] MDEF("Couldn't open the file %s");
|
||||||
@ -80,7 +100,6 @@ BEG const char FMT_6XSTRTAB[] MDEF("%s\t%s\t%s\t%s\t%s\t%s");
|
|||||||
#define FMT_PLAIN &FMT_6XSTRTAB[15]
|
#define FMT_PLAIN &FMT_6XSTRTAB[15]
|
||||||
|
|
||||||
BEG Mech *botlist MDEF(NULL);
|
BEG Mech *botlist MDEF(NULL);
|
||||||
BEG Mech *current;
|
|
||||||
|
|
||||||
BEG char *executable;
|
BEG char *executable;
|
||||||
BEG char *configfile MDEF(CFGFILE);
|
BEG char *configfile MDEF(CFGFILE);
|
||||||
@ -98,9 +117,6 @@ BEG ino_t parent_inode;
|
|||||||
BEG KillSock *killsocks MDEF(NULL);
|
BEG KillSock *killsocks MDEF(NULL);
|
||||||
|
|
||||||
BEG Server *serverlist MDEF(NULL);
|
BEG Server *serverlist MDEF(NULL);
|
||||||
BEG ServerGroup *servergrouplist MDEF(NULL);
|
|
||||||
BEG ServerGroup *currentservergroup MDEF(NULL);
|
|
||||||
BEG int servergroupid MDEF(0);
|
|
||||||
BEG int serverident MDEF(1);
|
BEG int serverident MDEF(1);
|
||||||
|
|
||||||
BEG char CurrentNick[NUHLEN];
|
BEG char CurrentNick[NUHLEN];
|
||||||
@ -130,14 +146,6 @@ BEG char nuh_buf[NUHLEN];
|
|||||||
|
|
||||||
BEG fd_set read_fds;
|
BEG fd_set read_fds;
|
||||||
BEG fd_set write_fds;
|
BEG fd_set write_fds;
|
||||||
BEG int hisock;
|
|
||||||
BEG int short_tv;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* current UNIX timestamp
|
|
||||||
*/
|
|
||||||
|
|
||||||
BEG time_t now;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* defined features
|
* defined features
|
||||||
@ -151,9 +159,6 @@ BEG Alias *aliaslist MDEF(NULL);
|
|||||||
|
|
||||||
#ifdef BOTNET
|
#ifdef BOTNET
|
||||||
|
|
||||||
BEG const char UNKNOWNATUNKNOWN[] MDEF("unknown@unknown");
|
|
||||||
#define UNKNOWN (&UNKNOWNATUNKNOWN[8])
|
|
||||||
|
|
||||||
BEG BotNet *botnetlist MDEF(NULL);
|
BEG BotNet *botnetlist MDEF(NULL);
|
||||||
BEG NetCfg *netcfglist MDEF(NULL);
|
BEG NetCfg *netcfglist MDEF(NULL);
|
||||||
BEG char *linkpass MDEF(NULL); /* proc var */
|
BEG char *linkpass MDEF(NULL); /* proc var */
|
||||||
@ -204,6 +209,8 @@ BEG Note *notelist MDEF(NULL);
|
|||||||
|
|
||||||
#ifdef RAWDNS
|
#ifdef RAWDNS
|
||||||
|
|
||||||
|
BEG int dnssock MDEF(-1);
|
||||||
|
BEG int dnsserver MDEF(0);
|
||||||
BEG dnsList *dnslist MDEF(NULL);
|
BEG dnsList *dnslist MDEF(NULL);
|
||||||
BEG dnsAuthority *dnsroot MDEF(NULL);
|
BEG dnsAuthority *dnsroot MDEF(NULL);
|
||||||
BEG struct in_addr ia_ns[MAX_NAMESERVERS];
|
BEG struct in_addr ia_ns[MAX_NAMESERVERS];
|
||||||
@ -308,7 +315,7 @@ BEG int spawning_lamer MDEF(0);
|
|||||||
/*
|
/*
|
||||||
* tolowertab blatantly ripped from ircu2.9.32
|
* tolowertab blatantly ripped from ircu2.9.32
|
||||||
*/
|
*/
|
||||||
LS const uchar tolowertab[256] =
|
const uchar tolowertab[256] =
|
||||||
{
|
{
|
||||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||||
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||||
@ -347,7 +354,7 @@ LS const uchar tolowertab[256] =
|
|||||||
/*
|
/*
|
||||||
* be wary, this is not a normal upper-to-lower table...
|
* be wary, this is not a normal upper-to-lower table...
|
||||||
*/
|
*/
|
||||||
LS const uchar nickcmptab[256] =
|
const uchar nickcmptab[256] =
|
||||||
{
|
{
|
||||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||||
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||||
@ -383,7 +390,7 @@ LS const uchar nickcmptab[256] =
|
|||||||
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
|
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
|
||||||
};
|
};
|
||||||
|
|
||||||
LS const uchar attrtab[256] =
|
const uchar attrtab[256] =
|
||||||
{
|
{
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 - 0x07 */
|
0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 - 0x07 */
|
||||||
0, 0, CRLF, 0, 0, CRLF, 0, 0, /* 0x08 - 0x0F */
|
0, 0, CRLF, 0, 0, CRLF, 0, 0, /* 0x08 - 0x0F */
|
||||||
@ -426,7 +433,7 @@ LS const uchar attrtab[256] =
|
|||||||
/*
|
/*
|
||||||
* user struct for the core client
|
* user struct for the core client
|
||||||
*/
|
*/
|
||||||
LS const Strp CMA =
|
const Strp CMA =
|
||||||
{
|
{
|
||||||
NULL,
|
NULL,
|
||||||
"*"
|
"*"
|
||||||
@ -435,7 +442,7 @@ LS const Strp CMA =
|
|||||||
/*
|
/*
|
||||||
* client struct for the core client
|
* client struct for the core client
|
||||||
*/
|
*/
|
||||||
LS ShortClient CoreClient =
|
ShortClient CoreClient =
|
||||||
{
|
{
|
||||||
NULL, /* next */
|
NULL, /* next */
|
||||||
(User*)&CoreUser, /* user */
|
(User*)&CoreUser, /* user */
|
||||||
@ -445,27 +452,13 @@ LS ShortClient CoreClient =
|
|||||||
0 /* lasttime */
|
0 /* lasttime */
|
||||||
};
|
};
|
||||||
|
|
||||||
LS ShortChan CoreChan =
|
ShortChan CoreChan =
|
||||||
{
|
{
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct coreServerGroup
|
struct
|
||||||
{
|
|
||||||
ServerGroup *next;
|
|
||||||
int servergroup;
|
|
||||||
char name[8];
|
|
||||||
} coreServerGroup;
|
|
||||||
|
|
||||||
LS coreServerGroup defaultServerGroup =
|
|
||||||
{
|
|
||||||
NULL, /* next */
|
|
||||||
0, /* servergroup */
|
|
||||||
"default" /* name */
|
|
||||||
};
|
|
||||||
|
|
||||||
LS struct
|
|
||||||
{
|
{
|
||||||
const char *string;
|
const char *string;
|
||||||
const int id;
|
const int id;
|
||||||
@ -487,7 +480,6 @@ extern const User xxCoreUser;
|
|||||||
extern const User xxLocalBot;
|
extern const User xxLocalBot;
|
||||||
extern ShortClient CoreClient;
|
extern ShortClient CoreClient;
|
||||||
extern ShortChan CoreChan;
|
extern ShortChan CoreChan;
|
||||||
extern ServerGroup defaultServerGroup;
|
|
||||||
|
|
||||||
#endif /* MAIN_C */
|
#endif /* MAIN_C */
|
||||||
|
|
||||||
|
|||||||
169
src/h.h
169
src/h.h
@ -21,12 +21,18 @@
|
|||||||
#ifndef H_H
|
#ifndef H_H
|
||||||
#define H_H 1
|
#define H_H 1
|
||||||
|
|
||||||
|
#if !defined(__STRICT_ANSI__)
|
||||||
|
#define __INLINE__ inline
|
||||||
|
#else
|
||||||
|
#define __INLINE__
|
||||||
|
#endif
|
||||||
|
|
||||||
#define ischannel(x) (*x == '#')
|
#define ischannel(x) (*x == '#')
|
||||||
|
|
||||||
#define nullstr(x) ((x)) ? (x) : NULLSTR
|
#define nullstr(x) ((x) ? x : NULLSTR)
|
||||||
#define nullbuf(x) (x && *x) ? x : NULLSTR
|
#define nullbuf(x) (x && *x) ? x : NULLSTR
|
||||||
|
|
||||||
#define chkhigh(x) if (x > hisock) { hisock = x; }
|
#define chkhigh(x) if (x > cx.hisock) { cx.hisock = x; }
|
||||||
|
|
||||||
#define COMMAND_ARGS char *from, const char *to, char *rest, const int cmdaccess
|
#define COMMAND_ARGS char *from, const char *to, char *rest, const int cmdaccess
|
||||||
|
|
||||||
@ -110,23 +116,24 @@
|
|||||||
|
|
||||||
/* alias.c */
|
/* alias.c */
|
||||||
|
|
||||||
LS void afmt(char *, const char *, const char *) __page(CORE_SEG);
|
void afmt(char *, const char *, const char *) __page(CORE_SEG);
|
||||||
LS void do_alias(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_alias(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_unalias(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_unalias(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
|
|
||||||
/* auth.c */
|
/* auth.c */
|
||||||
|
|
||||||
LS char *cipher(char *) __page(CMD1_SEG);
|
char *cipher(char *) __page(CMD1_SEG);
|
||||||
LS char *makepass(char *) __page(CMD1_SEG);
|
char *makepass(char *) __page(CMD1_SEG);
|
||||||
LS int passmatch(char *, char *) __page(CMD1_SEG);
|
int passmatch(char *, char *) __page(CMD1_SEG);
|
||||||
LS void delete_auth(char *) __page(CMD1_SEG);
|
void delete_auth(char *) __page(CMD1_SEG);
|
||||||
LS void remove_auth(Auth *) __page(CMD1_SEG);
|
void remove_auth(Auth *) __page(CMD1_SEG);
|
||||||
LS void change_authnick(char *, char *) __page(CORE_SEG);
|
void change_authnick(char *, char *) __page(CORE_SEG);
|
||||||
LS void aucheck(User *) __page(CORE_SEG);
|
void aucheck(User *) __page(CORE_SEG);
|
||||||
LS User *get_authuser(const char *, const char *) __page(CORE_SEG);
|
User *get_authuser(const char *, const char *) __page(CORE_SEG);
|
||||||
LS int get_authaccess(const char *, const char *) __page(CORE_SEG);
|
int get_authaccess(const char *, const char *) __page(CORE_SEG);
|
||||||
LS int make_auth(const char *, const User *) __page(CMD1_SEG);
|
int make_auth(const char *, const User *) __page(CMD1_SEG);
|
||||||
LS void do_auth(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_auth_noargs(const char *) __page(CMD1_SEG);
|
||||||
|
void do_auth(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
|
|
||||||
/* bounce.c */
|
/* bounce.c */
|
||||||
|
|
||||||
@ -138,15 +145,15 @@ void process_bounce(void) __page(CORE_SEG);
|
|||||||
|
|
||||||
/* calc.c */
|
/* calc.c */
|
||||||
|
|
||||||
LS void do_convert(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_convert(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_calc(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_calc(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
|
|
||||||
/* channel.c */
|
/* channel.c */
|
||||||
|
|
||||||
void check_idlekick(void);
|
void check_idlekick(void);
|
||||||
LS Chan *find_channel(const char *, int) __attr(CORE_SEG, __regparm(2));
|
Chan *find_channel(const char *, int) __attr(CORE_SEG, __regparm(2));
|
||||||
LS Chan *find_channel_ac(const char *) __attr(CORE_SEG, __regparm(1));
|
Chan *find_channel_ac(const char *) __attr(CORE_SEG, __regparm(1));
|
||||||
LS Chan *find_channel_ny(const char *) __attr(CORE_SEG, __regparm(1));
|
Chan *find_channel_ny(const char *) __attr(CORE_SEG, __regparm(1));
|
||||||
void remove_chan(Chan *) __page(CMD1_SEG);
|
void remove_chan(Chan *) __page(CMD1_SEG);
|
||||||
void join_channel(char *, char *) __page(CFG1_SEG);
|
void join_channel(char *, char *) __page(CFG1_SEG);
|
||||||
void reverse_topic(Chan *, char *, char *) __page(CORE_SEG);
|
void reverse_topic(Chan *, char *, char *) __page(CORE_SEG);
|
||||||
@ -159,23 +166,23 @@ void delete_ban(Chan *, char *);
|
|||||||
void delete_modemask(Chan *, char *, int);
|
void delete_modemask(Chan *, char *, int);
|
||||||
void channel_massmode(const Chan *, char *, int, char, char);
|
void channel_massmode(const Chan *, char *, int, char, char);
|
||||||
void channel_massunban(Chan *, char *, time_t);
|
void channel_massunban(Chan *, char *, time_t);
|
||||||
LS ChanUser *find_chanuser(Chan *, const char *) __page(CORE_SEG);
|
ChanUser *find_chanuser(Chan *, const char *) __page(CORE_SEG);
|
||||||
LS ChanUser *find_chanbot(Chan *, const char *) __page(CORE_SEG);
|
ChanUser *find_chanbot(Chan *, const char *) __page(CORE_SEG);
|
||||||
LS void remove_chanuser(Chan *, const char *) __page(CORE_SEG);
|
void remove_chanuser(Chan *, const char *) __page(CORE_SEG);
|
||||||
LS void make_chanuser(char *, char *) __page(CORE_SEG);
|
void make_chanuser(char *, char *) __page(CORE_SEG);
|
||||||
LS void purge_chanusers(Chan *) __page(CMD1_SEG);
|
void purge_chanusers(Chan *) __page(CMD1_SEG);
|
||||||
LS char *get_nuh(const ChanUser *) __page(CORE_SEG);
|
char *get_nuh(const ChanUser *) __page(CORE_SEG);
|
||||||
LS void do_join(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_join(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_part(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_part(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_cycle(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_cycle(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_forget(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_forget(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_channels(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_channels(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_wall(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_wall(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_mode(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_mode(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_names(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_names(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_cchan(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_cchan(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_invite(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_invite(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_sayme(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_sayme(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_who(COMMAND_ARGS) __page(CMD1_SEG);
|
LS void do_who(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_topic(COMMAND_ARGS) __page(CMD1_SEG);
|
LS void do_topic(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_showidle(COMMAND_ARGS) __page(CMD1_SEG);
|
LS void do_showidle(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
@ -196,14 +203,12 @@ void set_mix16(Mix16 *, const char *) __page(CORE_SEG);
|
|||||||
void set_mix64(Mix64 *, const char *) __page(CORE_SEG);
|
void set_mix64(Mix64 *, const char *) __page(CORE_SEG);
|
||||||
|
|
||||||
int conf_callback(char *line) __page(CFG1_SEG);
|
int conf_callback(char *line) __page(CFG1_SEG);
|
||||||
void readcfgfile(void) __page(CFG1_SEG);
|
void readcfgfile(void) __page(INIT_SEG);
|
||||||
int write_session(void) __page(CORE_SEG);
|
int write_session(void) __page(CORE_SEG);
|
||||||
Mech *add_bot(int guid, char *nick) __page(CFG1_SEG);
|
Mech *add_bot(int guid, char *nick) __page(CFG1_SEG);
|
||||||
void signoff(char *from, char *reason) __page(RARE_SEG);
|
void signoff(char *from, char *reason) __page(RARE_SEG);
|
||||||
void kill_all_bots(char *reason) __attr(RARE_SEG, __noreturn__);;
|
void kill_all_bots(char *reason) __attr(RARE_SEG, __noreturn__);;
|
||||||
Server *add_server(char *host, int port, char *pass) __page(CFG1_SEG);
|
Server *add_server(const char *host, const int port, const char *pass, const char *group) __page(CFG1_SEG);
|
||||||
ServerGroup *getservergroup(const char *name);
|
|
||||||
ServerGroup *getservergroupid(int id);
|
|
||||||
Server *find_server(int id) __page(CORE_SEG);
|
Server *find_server(int id) __page(CORE_SEG);
|
||||||
int try_server(Server *sp, char *hostname) __page(CORE_SEG);
|
int try_server(Server *sp, char *hostname) __page(CORE_SEG);
|
||||||
void connect_to_server(void) __page(CORE_SEG);
|
void connect_to_server(void) __page(CORE_SEG);
|
||||||
@ -216,7 +221,7 @@ void do_version(COMMAND_ARGS) __page(CMD1_SEG);
|
|||||||
void do_core(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_core(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
void do_die(COMMAND_ARGS) __page(RARE_SEG);
|
void do_die(COMMAND_ARGS) __page(RARE_SEG);
|
||||||
void do_shutdown(COMMAND_ARGS) __page(RARE_SEG);
|
void do_shutdown(COMMAND_ARGS) __page(RARE_SEG);
|
||||||
void do_servergroup(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_server_noargs(const char *from) __page(CMD1_SEG);
|
||||||
void do_server(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_server(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
void do_cserv(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_cserv(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
void do_away(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_away(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
@ -428,8 +433,9 @@ LS void sig_segv(int, siginfo_t *, void *) __attr(RARE_SEG, __noreturn__);
|
|||||||
LS void sig_segv(int) __attr(RARE_SEG, __noreturn__);
|
LS void sig_segv(int) __attr(RARE_SEG, __noreturn__);
|
||||||
#endif
|
#endif
|
||||||
LS void sig_term(int) __attr(RARE_SEG, __noreturn__); /* rare */
|
LS void sig_term(int) __attr(RARE_SEG, __noreturn__); /* rare */
|
||||||
LS void doit(void) __page(CORE_SEG);
|
int main(int argc, char **argv, char **envp) __page(INIT_SEG);
|
||||||
LS int main(int argc, char **argv, char **envp) __page(INIT_SEG);
|
int parse_commandline(int argc, char **argv, char **envp) __page(INIT_SEG);
|
||||||
|
void mainloop(void) __attr(CORE_SEG, __noreturn__);
|
||||||
|
|
||||||
/* net.c */
|
/* net.c */
|
||||||
|
|
||||||
@ -444,15 +450,15 @@ void botnet_binfo_relay(BotNet *source, BotInfo *binfo);
|
|||||||
void botnet_binfo_tofile(int sock, BotInfo *binfo);
|
void botnet_binfo_tofile(int sock, BotInfo *binfo);
|
||||||
void botnet_dumplinklist(BotNet *bn);
|
void botnet_dumplinklist(BotNet *bn);
|
||||||
int connect_to_bot(NetCfg *cfg);
|
int connect_to_bot(NetCfg *cfg);
|
||||||
LS void check_botjoin(Chan *chan, ChanUser *cu);
|
void check_botjoin(Chan *chan, ChanUser *cu);
|
||||||
LS void check_botinfo(BotInfo *binfo, const char *channel);
|
void check_botinfo(BotInfo *binfo, const char *channel);
|
||||||
void basicAuth(BotNet *bn, char *rest);
|
void basicAuth(BotNet *bn, char *rest);
|
||||||
void basicAuthOK(BotNet *bn, char *rest);
|
void basicAuthOK(BotNet *bn, char *rest);
|
||||||
void basicBanner(BotNet *bn, char *rest);
|
void basicBanner(BotNet *bn, char *rest);
|
||||||
void basicLink(BotNet *bn, char *version);
|
void basicLink(BotNet *bn, char *version);
|
||||||
void basicQuit(BotNet *bn, char *rest);
|
void basicQuit(BotNet *bn, char *rest);
|
||||||
LS void netchanNeedop(BotNet *source, char *rest);
|
void netchanNeedop(BotNet *source, char *rest);
|
||||||
LS void netchanSuppress(BotNet *, char *) __page(CORE_SEG);
|
void netchanSuppress(BotNet *, char *) __page(CORE_SEG);
|
||||||
void partyAuth(BotNet *bn, char *rest);
|
void partyAuth(BotNet *bn, char *rest);
|
||||||
int commandlocal(int dg, int sg, char *from, char *command);
|
int commandlocal(int dg, int sg, char *from, char *command);
|
||||||
void partyCommand(BotNet *bn, char *rest);
|
void partyCommand(BotNet *bn, char *rest);
|
||||||
@ -464,12 +470,13 @@ void parse_botnet(BotNet *bn, char *rest);
|
|||||||
void botnet_newsock(void);
|
void botnet_newsock(void);
|
||||||
void select_botnet(void) __page(CORE_SEG);
|
void select_botnet(void) __page(CORE_SEG);
|
||||||
void process_botnet(void) __page(CORE_SEG);
|
void process_botnet(void) __page(CORE_SEG);
|
||||||
|
void do_link_noargs(const char *) __page(CMD1_SEG);
|
||||||
void do_link(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_link(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
void do_cmd(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_cmd(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
|
|
||||||
/* note.c */
|
/* note.c */
|
||||||
|
|
||||||
int catch_note(char *from, char *to, char *rest);
|
int catch_note(char *from, char *to, char *rest) __page(CMD1_SEG);
|
||||||
void do_note(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_note(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
void do_read(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_read(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
|
|
||||||
@ -519,37 +526,37 @@ LS void parse_privmsg(char *from, char *rest) __page(CORE_SEG);
|
|||||||
LS void parse_quit(char *from, char *rest) __page(CORE_SEG);
|
LS void parse_quit(char *from, char *rest) __page(CORE_SEG);
|
||||||
LS void parse_topic(char *from, char *rest) __page(CORE_SEG);
|
LS void parse_topic(char *from, char *rest) __page(CORE_SEG);
|
||||||
LS void parse_wallops(char *from, char *rest) __page(CORE_SEG);
|
LS void parse_wallops(char *from, char *rest) __page(CORE_SEG);
|
||||||
LS void parse_213(char *from, char *rest);
|
void parse_213(char *from, char *rest);
|
||||||
LS void parse_219(char *from, char *rest);
|
void parse_219(char *from, char *rest);
|
||||||
LS void parse_251(char *from, char *rest);
|
void parse_251(char *from, char *rest);
|
||||||
LS void parse_252(char *from, char *rest);
|
void parse_252(char *from, char *rest);
|
||||||
LS void parse_253(char *from, char *rest);
|
void parse_253(char *from, char *rest);
|
||||||
LS void parse_254(char *from, char *rest);
|
void parse_254(char *from, char *rest);
|
||||||
LS void parse_255(char *from, char *rest);
|
void parse_255(char *from, char *rest);
|
||||||
LS void parse_301(char *from, char *rest);
|
void parse_301(char *from, char *rest);
|
||||||
LS void parse_303(char *from, char *rest);
|
void parse_303(char *from, char *rest);
|
||||||
LS void parse_311(char *from, char *rest);
|
void parse_311(char *from, char *rest);
|
||||||
LS void parse_312(char *from, char *rest);
|
void parse_312(char *from, char *rest);
|
||||||
LS void parse_313(char *from, char *rest);
|
void parse_313(char *from, char *rest);
|
||||||
LS void parse_315(char *from, char *rest);
|
void parse_315(char *from, char *rest);
|
||||||
LS void parse_317(char *from, char *rest);
|
void parse_317(char *from, char *rest);
|
||||||
LS void parse_318(char *from, char *rest);
|
void parse_318(char *from, char *rest);
|
||||||
LS void parse_319(char *from, char *rest);
|
void parse_319(char *from, char *rest);
|
||||||
LS void parse_324(char *from, char *rest);
|
void parse_324(char *from, char *rest);
|
||||||
LS void parse_352(char *from, char *rest);
|
void parse_352(char *from, char *rest);
|
||||||
LS void parse_367(char *from, char *rest);
|
void parse_367(char *from, char *rest);
|
||||||
LS void parse_376(char *from, char *rest);
|
void parse_376(char *from, char *rest);
|
||||||
LS void parse_401(char *from, char *rest);
|
void parse_401(char *from, char *rest);
|
||||||
LS void parse_433(char *from, char *rest);
|
void parse_433(char *from, char *rest);
|
||||||
LS void parse_451(char *from, char *rest);
|
void parse_451(char *from, char *rest);
|
||||||
LS void parse_471(char *from, char *rest);
|
void parse_471(char *from, char *rest);
|
||||||
LS void parse_473(char *from, char *rest);
|
void parse_473(char *from, char *rest);
|
||||||
LS void parse_346(char *from, char *rest);
|
void parse_346(char *from, char *rest);
|
||||||
LS void parse_348(char *from, char *rest);
|
void parse_348(char *from, char *rest);
|
||||||
LS void parse_368(char *from, char *rest);
|
void parse_368(char *from, char *rest);
|
||||||
LS void parse_005(char *from, char *rest);
|
void parse_005(char *from, char *rest);
|
||||||
LS uint32_t stringhash(char *s) __page(CORE_SEG);
|
static __INLINE__ uint32_t stringhash(char *) __page(CORE_SEG);
|
||||||
LS void parse_server_input(char *rest) __page(CORE_SEG);
|
void parse_server_input(char *) __page(CORE_SEG);
|
||||||
|
|
||||||
/* partyline.c */
|
/* partyline.c */
|
||||||
|
|
||||||
|
|||||||
23
src/io.c
23
src/io.c
@ -458,7 +458,7 @@ void to_user(const char *target, const char *format, ...)
|
|||||||
* 2: If <rest> data is insufficient, try to read in more
|
* 2: If <rest> data is insufficient, try to read in more
|
||||||
* 3: Try again to make a whole line
|
* 3: Try again to make a whole line
|
||||||
*/
|
*/
|
||||||
char *sockread(int s, char *rest, char *line)
|
char *sockread(int socket, char *rest, char *output)
|
||||||
{
|
{
|
||||||
char *src,*dst,*rdst;
|
char *src,*dst,*rdst;
|
||||||
int n;
|
int n;
|
||||||
@ -466,7 +466,7 @@ char *sockread(int s, char *rest, char *line)
|
|||||||
errno = EAGAIN;
|
errno = EAGAIN;
|
||||||
|
|
||||||
src = rest;
|
src = rest;
|
||||||
dst = line;
|
dst = output;
|
||||||
|
|
||||||
while(*src)
|
while(*src)
|
||||||
{
|
{
|
||||||
@ -476,20 +476,26 @@ char *sockread(int s, char *rest, char *line)
|
|||||||
while(*src == '\n' || *src == '\r')
|
while(*src == '\n' || *src == '\r')
|
||||||
src++;
|
src++;
|
||||||
*dst = 0;
|
*dst = 0;
|
||||||
|
#if !defined(GENCMD_C)
|
||||||
|
cx.rest_end = dst;
|
||||||
|
#endif /* !defined(GENCMD_C) */
|
||||||
|
|
||||||
|
/* move remainder of rest to the beginning of the buffer */
|
||||||
|
/* src can be end of rest or globaldata */
|
||||||
dst = rest;
|
dst = rest;
|
||||||
while(*src)
|
while(*src)
|
||||||
*(dst++) = *(src++);
|
*(dst++) = *(src++);
|
||||||
*dst = 0;
|
*dst = 0;
|
||||||
|
|
||||||
#if defined(DEBUG) && !defined(GENCMD_C)
|
#if defined(DEBUG) && !defined(GENCMD_C)
|
||||||
debug("(in) {%i} %s\n",s,line);
|
debug("(in) {%i} %s\n",socket,output);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
return((*line) ? line : NULL);
|
return((*output) ? output : NULL);
|
||||||
}
|
}
|
||||||
*(dst++) = *(src++);
|
*(dst++) = *(src++);
|
||||||
}
|
}
|
||||||
rdst = src;
|
|
||||||
|
|
||||||
n = read(s,globaldata,MSGLEN-2);
|
n = read(socket,globaldata,MSGLEN-2);
|
||||||
switch(n)
|
switch(n)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@ -498,14 +504,15 @@ char *sockread(int s, char *rest, char *line)
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rdst = src;
|
||||||
globaldata[n] = 0;
|
globaldata[n] = 0;
|
||||||
src = globaldata;
|
src = globaldata;
|
||||||
|
|
||||||
while(*src)
|
while(*src)
|
||||||
{
|
{
|
||||||
if (*src == '\r' || *src == '\n')
|
if (*src == '\r' || *src == '\n')
|
||||||
goto gotline;
|
goto gotline; /* gotline will move the rest of globaldata to rest */
|
||||||
if ((dst - line) >= (MSGLEN-2))
|
if ((dst - output) >= (MSGLEN-2))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* line is longer than buffer, let the wheel spin
|
* line is longer than buffer, let the wheel spin
|
||||||
|
|||||||
64
src/main.c
64
src/main.c
@ -51,7 +51,6 @@
|
|||||||
#include "hostinfo.c"
|
#include "hostinfo.c"
|
||||||
#include "io.c"
|
#include "io.c"
|
||||||
#include "irc.c"
|
#include "irc.c"
|
||||||
#include "lib/string.c"
|
|
||||||
#include "net.c"
|
#include "net.c"
|
||||||
#include "note.c"
|
#include "note.c"
|
||||||
#include "ons.c"
|
#include "ons.c"
|
||||||
@ -67,6 +66,7 @@
|
|||||||
#include "seen.c"
|
#include "seen.c"
|
||||||
#include "shit.c"
|
#include "shit.c"
|
||||||
#include "spy.c"
|
#include "spy.c"
|
||||||
|
#include "string.c"
|
||||||
#include "tcl.c"
|
#include "tcl.c"
|
||||||
#include "toybox.c"
|
#include "toybox.c"
|
||||||
#include "uptime.c"
|
#include "uptime.c"
|
||||||
@ -522,18 +522,16 @@ void sig_term(int signum)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __GNUC__
|
void mainloop(void)
|
||||||
LS void doit(void) __attribute__ ((__noreturn__, __sect(CORE_SEG)));
|
|
||||||
#endif
|
|
||||||
void doit(void)
|
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
SequenceTime this;
|
||||||
Chan *chan;
|
Chan *chan;
|
||||||
Client *client;
|
Client *client;
|
||||||
SequenceTime this;
|
|
||||||
Strp *qm;
|
Strp *qm;
|
||||||
|
struct timeval tv;
|
||||||
time_t last_update;
|
time_t last_update;
|
||||||
|
|
||||||
|
|
||||||
last_update = now;
|
last_update = now;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -574,7 +572,7 @@ mainloop:
|
|||||||
|
|
||||||
FD_ZERO(&read_fds);
|
FD_ZERO(&read_fds);
|
||||||
FD_ZERO(&write_fds);
|
FD_ZERO(&write_fds);
|
||||||
hisock = -1;
|
cx.hisock = -1;
|
||||||
|
|
||||||
#ifdef BOTNET
|
#ifdef BOTNET
|
||||||
select_botnet();
|
select_botnet();
|
||||||
@ -599,7 +597,7 @@ mainloop:
|
|||||||
/*
|
/*
|
||||||
* unset here, reset if needed in bot loop
|
* unset here, reset if needed in bot loop
|
||||||
*/
|
*/
|
||||||
short_tv &= ~(TV_SERVCONNECT|TV_LINEBUF);
|
cx.short_tv &= ~(TV_SERVCONNECT|TV_LINEBUF);
|
||||||
for(current=botlist;current;current=current->next)
|
for(current=botlist;current;current=current->next)
|
||||||
{
|
{
|
||||||
if (current->sock == -1)
|
if (current->sock == -1)
|
||||||
@ -644,7 +642,7 @@ mainloop:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
doit_jumptonext:
|
doit_jumptonext:
|
||||||
short_tv |= TV_SERVCONNECT;
|
cx.short_tv |= TV_SERVCONNECT;
|
||||||
if ((now - current->conntry) >= 2)
|
if ((now - current->conntry) >= 2)
|
||||||
connect_to_server();
|
connect_to_server();
|
||||||
}
|
}
|
||||||
@ -657,7 +655,7 @@ doit_jumptonext:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
short_tv |= TV_SERVCONNECT;
|
cx.short_tv |= TV_SERVCONNECT;
|
||||||
if ((now - current->conntry) >= 2)
|
if ((now - current->conntry) >= 2)
|
||||||
connect_to_server();
|
connect_to_server();
|
||||||
}
|
}
|
||||||
@ -677,7 +675,7 @@ doit_jumptonext:
|
|||||||
}
|
}
|
||||||
if ((current->connect == CN_TRYING) || (current->connect == CN_CONNECTED))
|
if ((current->connect == CN_TRYING) || (current->connect == CN_CONNECTED))
|
||||||
{
|
{
|
||||||
short_tv |= TV_SERVCONNECT;
|
cx.short_tv |= TV_SERVCONNECT;
|
||||||
if ((now - current->conntry) > ctimeout)
|
if ((now - current->conntry) > ctimeout)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -692,7 +690,7 @@ doit_jumptonext:
|
|||||||
}
|
}
|
||||||
if (current->sendq)
|
if (current->sendq)
|
||||||
{
|
{
|
||||||
short_tv |= TV_LINEBUF;
|
cx.short_tv |= TV_LINEBUF;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -700,7 +698,7 @@ doit_jumptonext:
|
|||||||
{
|
{
|
||||||
if (chan->kicklist || chan->modelist)
|
if (chan->kicklist || chan->modelist)
|
||||||
{
|
{
|
||||||
short_tv |= TV_LINEBUF;
|
cx.short_tv |= TV_LINEBUF;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -746,13 +744,13 @@ restart_dcc:
|
|||||||
* Longer delay saves CPU but some features require shorter delays
|
* Longer delay saves CPU but some features require shorter delays
|
||||||
*/
|
*/
|
||||||
#ifdef NOTIFY
|
#ifdef NOTIFY
|
||||||
tv.tv_sec = (short_tv) ? 1 : 5;
|
tv.tv_sec = (cx.short_tv) ? 1 : 5;
|
||||||
#else /* NOTIFY */
|
#else /* NOTIFY */
|
||||||
tv.tv_sec = (short_tv) ? 1 : 30;
|
tv.tv_sec = (cx.short_tv) ? 1 : 30;
|
||||||
#endif /* NOTIFY */
|
#endif /* NOTIFY */
|
||||||
tv.tv_usec = 0;
|
tv.tv_usec = 0;
|
||||||
|
|
||||||
if ((select(hisock+1,&read_fds,&write_fds,0,&tv) == -1) && (errno == EINTR))
|
if ((select(cx.hisock+1,&read_fds,&write_fds,0,&tv) == -1) && (errno == EINTR))
|
||||||
goto mainloop;
|
goto mainloop;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -851,6 +849,7 @@ restart_die:
|
|||||||
#endif /* BOTNET */
|
#endif /* BOTNET */
|
||||||
|
|
||||||
#ifdef BOUNCE
|
#ifdef BOUNCE
|
||||||
|
if (bounce_sock != -1 || bnclist)
|
||||||
process_bounce();
|
process_bounce();
|
||||||
#endif /* BOUNCE */
|
#endif /* BOUNCE */
|
||||||
|
|
||||||
@ -859,6 +858,7 @@ restart_die:
|
|||||||
#endif /* CHANBAN */
|
#endif /* CHANBAN */
|
||||||
|
|
||||||
#ifdef RAWDNS
|
#ifdef RAWDNS
|
||||||
|
if (dnssock != -1)
|
||||||
process_rawdns();
|
process_rawdns();
|
||||||
#endif /* RAWDNS */
|
#endif /* RAWDNS */
|
||||||
|
|
||||||
@ -889,15 +889,12 @@ restart_die:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* main(), we love it and cant live without it
|
* parse commandline
|
||||||
*/
|
*/
|
||||||
|
|
||||||
LS char *bad_exe = "init: Error: Improper executable name\n";
|
const char *bad_exe = "init: Error: Improper executable name\n";
|
||||||
|
|
||||||
#ifdef __GNUC__
|
int parse_commandline(int argc, char **argv, char **envp)
|
||||||
int main(int argc, char **argv, char **envp) __attribute__ ((__sect(INIT_SEG)));
|
|
||||||
#endif
|
|
||||||
int main(int argc, char **argv, char **envp)
|
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char *opt;
|
char *opt;
|
||||||
@ -1084,9 +1081,6 @@ int main(int argc, char **argv, char **envp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
servergrouplist = (ServerGroup*)&defaultServerGroup;
|
|
||||||
currentservergroup = (ServerGroup*)&defaultServerGroup;
|
|
||||||
|
|
||||||
if (!mechresetenv)
|
if (!mechresetenv)
|
||||||
{
|
{
|
||||||
to_file(1,TEXT_HDR_VERS,VERSION,SRCDATE);
|
to_file(1,TEXT_HDR_VERS,VERSION,SRCDATE);
|
||||||
@ -1191,7 +1185,10 @@ int main(int argc, char **argv, char **envp)
|
|||||||
}
|
}
|
||||||
if (current->userlist == NULL)
|
if (current->userlist == NULL)
|
||||||
{
|
{
|
||||||
to_file(1,"init: No userlist loaded for %s\n",nullstr(current->nick));
|
char *nick;
|
||||||
|
|
||||||
|
nick = getbotnick(current);
|
||||||
|
to_file(1,"init: No userlist loaded for %s\n",nullstr(nick));
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1291,7 +1288,16 @@ int main(int argc, char **argv, char **envp)
|
|||||||
}
|
}
|
||||||
startup = STARTUP_RUNNING;
|
startup = STARTUP_RUNNING;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(main) entering doit()...\n");
|
debug("(main) entering main loop...\n");
|
||||||
#endif
|
#endif
|
||||||
doit();
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Make main short and sweet, reduce stack data
|
||||||
|
* Main(), we love it and cant live without it
|
||||||
|
*/
|
||||||
|
int main(int argc, char **argv, char **envp)
|
||||||
|
{
|
||||||
|
parse_commandline(argc, argv, envp);
|
||||||
|
mainloop();
|
||||||
}
|
}
|
||||||
|
|||||||
44
src/net.c
44
src/net.c
@ -409,7 +409,7 @@ void basicAuth(BotNet *bn, char *rest)
|
|||||||
{
|
{
|
||||||
case BNAUTH_PLAINTEXT:
|
case BNAUTH_PLAINTEXT:
|
||||||
/*
|
/*
|
||||||
>> plain text given: "DomoOmiGato" stored "kooplook0988"
|
>> plain text given: "DomoOmiGato" stored "........."
|
||||||
(reset_linkable) guid 1337 reset to linkable
|
(reset_linkable) guid 1337 reset to linkable
|
||||||
(basicAuth) bad password [ guid = 1337 ]
|
(basicAuth) bad password [ guid = 1337 ]
|
||||||
*/
|
*/
|
||||||
@ -420,6 +420,12 @@ void basicAuth(BotNet *bn, char *rest)
|
|||||||
goto badpass;
|
goto badpass;
|
||||||
break;
|
break;
|
||||||
#ifdef SHACRYPT
|
#ifdef SHACRYPT
|
||||||
|
/*
|
||||||
|
(in) {6} BB1881 634704033 PTA SHA
|
||||||
|
(out) {6} BB9344 1233037145 PTA SHA
|
||||||
|
>> sha pass exchange: "........ ......... 634704033 1233037145"
|
||||||
|
(out) {2} BASHA $6$5525$mZLr762......
|
||||||
|
*/
|
||||||
case BNAUTH_SHA:
|
case BNAUTH_SHA:
|
||||||
{
|
{
|
||||||
char *enc,temppass[24 + Strlen2(pass,linkpass)]; /* linkpass is never NULL */
|
char *enc,temppass[24 + Strlen2(pass,linkpass)]; /* linkpass is never NULL */
|
||||||
@ -1474,14 +1480,14 @@ void select_botnet(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
short_tv &= ~TV_BOTNET;
|
cx.short_tv &= ~TV_BOTNET;
|
||||||
for(bn=botnetlist;bn;bn=bn->next)
|
for(bn=botnetlist;bn;bn=bn->next)
|
||||||
{
|
{
|
||||||
chkhigh(bn->sock);
|
chkhigh(bn->sock);
|
||||||
if (bn->status == BN_CONNECT)
|
if (bn->status == BN_CONNECT)
|
||||||
{
|
{
|
||||||
FD_SET(bn->sock,&write_fds);
|
FD_SET(bn->sock,&write_fds);
|
||||||
short_tv |= TV_BOTNET;
|
cx.short_tv |= TV_BOTNET;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1639,6 +1645,22 @@ clean:
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void do_link_noargs(const char *from)
|
||||||
|
{
|
||||||
|
NetCfg *cfg;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* list all the known links
|
||||||
|
*/
|
||||||
|
table_buffer("guid\tpass\thost\tport");
|
||||||
|
for(cfg=netcfglist;cfg;cfg=cfg->next)
|
||||||
|
{
|
||||||
|
table_buffer("%i\t%s\t%s\t%i",cfg->guid,(cfg->pass) ? cfg->pass : EMPTYSTR,
|
||||||
|
(cfg->host) ? cfg->host : EMPTYSTR,cfg->port);
|
||||||
|
}
|
||||||
|
table_send(from,2);
|
||||||
|
}
|
||||||
|
|
||||||
void do_link(COMMAND_ARGS)
|
void do_link(COMMAND_ARGS)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -1649,21 +1671,6 @@ void do_link(COMMAND_ARGS)
|
|||||||
int iguid,iport;
|
int iguid,iport;
|
||||||
int mode;
|
int mode;
|
||||||
|
|
||||||
/*
|
|
||||||
* list all the known links
|
|
||||||
*/
|
|
||||||
if (!*rest)
|
|
||||||
{
|
|
||||||
table_buffer("guid\tpass\thost\tport");
|
|
||||||
for(cfg=netcfglist;cfg;cfg=cfg->next)
|
|
||||||
{
|
|
||||||
table_buffer("%i\t%s\t%s\t%i",cfg->guid,(cfg->pass) ? cfg->pass : "",
|
|
||||||
(cfg->host) ? cfg->host : "",cfg->port);
|
|
||||||
}
|
|
||||||
table_send(from,2);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
guid = chop(&rest);
|
guid = chop(&rest);
|
||||||
if (*guid == '+' || *guid == '-')
|
if (*guid == '+' || *guid == '-')
|
||||||
mode = *guid++;
|
mode = *guid++;
|
||||||
@ -1726,6 +1733,7 @@ usage:
|
|||||||
|
|
||||||
if (mode == '-')
|
if (mode == '-')
|
||||||
{
|
{
|
||||||
|
to_user(from,"removing link guid: %i",iguid);
|
||||||
*pp = cfg->next;
|
*pp = cfg->next;
|
||||||
Free((char**)&cfg);
|
Free((char**)&cfg);
|
||||||
return;
|
return;
|
||||||
|
|||||||
28
src/ons.c
28
src/ons.c
@ -402,6 +402,11 @@ void on_msg(char *from, char *to, char *rest)
|
|||||||
* non-NULL and non-zerolength
|
* non-NULL and non-zerolength
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* remember where the string started
|
||||||
|
*/
|
||||||
|
origstart = rest;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Are we recording a note?
|
* Are we recording a note?
|
||||||
*/
|
*/
|
||||||
@ -415,10 +420,7 @@ void on_msg(char *from, char *to, char *rest)
|
|||||||
* public commands, we can go directly to common_public()
|
* public commands, we can go directly to common_public()
|
||||||
*/
|
*/
|
||||||
if (CurrentChan && !CurrentChan->setting[TOG_PUB].int_var)
|
if (CurrentChan && !CurrentChan->setting[TOG_PUB].int_var)
|
||||||
{
|
goto public_msg_unchopped;
|
||||||
common_public(CurrentChan,from,"<%s> %s",rest);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CurrentDCC)
|
if (CurrentDCC)
|
||||||
{
|
{
|
||||||
@ -433,10 +435,6 @@ void on_msg(char *from, char *to, char *rest)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* remember where the string started
|
|
||||||
*/
|
|
||||||
origstart = rest;
|
|
||||||
|
|
||||||
if (from == CoreUser.name)
|
if (from == CoreUser.name)
|
||||||
{
|
{
|
||||||
@ -688,11 +686,14 @@ recheck_alias:
|
|||||||
if (mcmd[i].dcc && partyline_only_command(from))
|
if (mcmd[i].dcc && partyline_only_command(from))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Run command function
|
||||||
|
*/
|
||||||
|
if (mcmd[i].noargfunc && *rest == 0)
|
||||||
|
mcmd[i].noargfunc(from);
|
||||||
|
else
|
||||||
mcmd[i].func(from,to,rest,acmd[i]);
|
mcmd[i].func(from,to,rest,acmd[i]);
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
CurrentCmd = NULL;
|
|
||||||
#endif /* DEBUG */
|
|
||||||
#ifdef REDIRECT
|
#ifdef REDIRECT
|
||||||
end_redirect();
|
end_redirect();
|
||||||
#endif /* REDIRECT */
|
#endif /* REDIRECT */
|
||||||
@ -701,15 +702,11 @@ recheck_alias:
|
|||||||
* be quick to exit afterwards, there are "dangerous" commands like DIE and USER -...
|
* be quick to exit afterwards, there are "dangerous" commands like DIE and USER -...
|
||||||
*/
|
*/
|
||||||
return;
|
return;
|
||||||
/* todo: delete - hash
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the input isnt a command or the sender lacks access
|
* If the input isnt a command or the sender lacks access
|
||||||
*/
|
*/
|
||||||
public_msg:
|
public_msg:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* un-chop() the message string
|
* un-chop() the message string
|
||||||
*/
|
*/
|
||||||
@ -717,6 +714,7 @@ public_msg:
|
|||||||
|
|
||||||
if (CurrentChan)
|
if (CurrentChan)
|
||||||
{
|
{
|
||||||
|
public_msg_unchopped:
|
||||||
common_public(CurrentChan,from,"<%s> %s",origstart);
|
common_public(CurrentChan,from,"<%s> %s",origstart);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
18
src/parse.c
18
src/parse.c
@ -367,7 +367,7 @@ void parse_pong(char *from, char *rest)
|
|||||||
ot = (ot * 10) + (*src++ - '0');
|
ot = (ot * 10) + (*src++ - '0');
|
||||||
current->ontime = ot;
|
current->ontime = ot;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(parse_pong) recovering ontime = %lu (%s)\n",ot,idle2str(now - ot,TRUE));
|
debug("(parse_pong) recovering ontime = %lu (%s)\n",ot,idle2str(ot,TRUE));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1444,7 +1444,7 @@ LS const struct
|
|||||||
{ 0, 0, NULL }
|
{ 0, 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t stringhash(char *s)
|
static __INLINE__ uint32_t stringhash(char *s)
|
||||||
{
|
{
|
||||||
uint32_t hash;
|
uint32_t hash;
|
||||||
int i;
|
int i;
|
||||||
@ -1459,6 +1459,7 @@ void parse_server_input(char *rest)
|
|||||||
{
|
{
|
||||||
#ifdef SCRIPTING
|
#ifdef SCRIPTING
|
||||||
Hook *hook;
|
Hook *hook;
|
||||||
|
int skip;
|
||||||
#endif /* SCRIPTING */
|
#endif /* SCRIPTING */
|
||||||
char *from,*command;
|
char *from,*command;
|
||||||
uint32_t cmdhash;
|
uint32_t cmdhash;
|
||||||
@ -1467,8 +1468,8 @@ void parse_server_input(char *rest)
|
|||||||
if (current->spy & (SPYF_RAWIRC|SPYF_RANDSRC))
|
if (current->spy & (SPYF_RAWIRC|SPYF_RANDSRC))
|
||||||
send_spy(SPYSTR_RAWIRC,rest);
|
send_spy(SPYSTR_RAWIRC,rest);
|
||||||
|
|
||||||
/*new undernet amusements */
|
/* New undernet amusements */
|
||||||
/*(in) {5} NOTICE AUTH :*** You have identd disabled (or broken), to continue to connect you must type /QUOTE PASS 17071 */
|
/* NOTICE AUTH :*** You have identd disabled (or broken), to continue to connect you must type /QUOTE PASS 17071 */
|
||||||
if (current->connect == CN_CONNECTED && *rest == 'N' && !matches("NOTICE AUTH * /QUOTE PASS *",rest))
|
if (current->connect == CN_CONNECTED && *rest == 'N' && !matches("NOTICE AUTH * /QUOTE PASS *",rest))
|
||||||
{
|
{
|
||||||
from = STREND(rest);
|
from = STREND(rest);
|
||||||
@ -1498,7 +1499,7 @@ void parse_server_input(char *rest)
|
|||||||
rest++;
|
rest++;
|
||||||
|
|
||||||
#ifdef SCRIPTING
|
#ifdef SCRIPTING
|
||||||
cmdhash = 1;
|
skip = 0;
|
||||||
for(hook=hooklist;hook;hook=hook->next)
|
for(hook=hooklist;hook;hook=hook->next)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -1511,18 +1512,16 @@ void parse_server_input(char *rest)
|
|||||||
*/
|
*/
|
||||||
if (hook->flags == MEV_PARSE && !stringcasecmp(command,hook->type.command))
|
if (hook->flags == MEV_PARSE && !stringcasecmp(command,hook->type.command))
|
||||||
{
|
{
|
||||||
if (hook->func(from,rest,hook))
|
|
||||||
/* if the hook returns non-zero, the input should not be parsed internally */
|
/* if the hook returns non-zero, the input should not be parsed internally */
|
||||||
cmdhash = 0;
|
skip += hook->func(from,rest,hook);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cmdhash == 0)
|
if (skip)
|
||||||
return;
|
return;
|
||||||
#endif /* SCRIPTING */
|
#endif /* SCRIPTING */
|
||||||
|
|
||||||
cmdhash = stringhash(command);
|
cmdhash = stringhash(command);
|
||||||
|
|
||||||
/*debug("cmdhash = %08X\n",cmdhash); */
|
|
||||||
for(i=0;pFuncs[i].hash;i++)
|
for(i=0;pFuncs[i].hash;i++)
|
||||||
{
|
{
|
||||||
if (cmdhash == pFuncs[i].hash)
|
if (cmdhash == pFuncs[i].hash)
|
||||||
@ -1535,5 +1534,4 @@ void parse_server_input(char *rest)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*debug("unmatched cmdhash %08X\n",cmdhash); */
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -498,14 +498,14 @@ void process_chanbans(void)
|
|||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(process_chanbans) skipping %s (%i), (lastchanban (%lu) > now - 10 (%lu)\n",
|
debug("(process_chanbans) skipping %s (%i), (lastchanban (%lu) > now - 10 (%lu)\n",
|
||||||
current->nick,current->guid,current->lastchanban,(now - 10));
|
getbotnick(current),current->guid,current->lastchanban,(now - 10));
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (current->sendq) /* only do chanbans on empty queue */
|
if (current->sendq) /* only do chanbans on empty queue */
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(process_chanbans) skipping %s (%i), sendq not empty\n",current->nick,current->guid);
|
debug("(process_chanbans) skipping %s (%i), sendq not empty\n",getbotnick(current),current->guid);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -88,11 +88,11 @@ static PyObject *python_getvar(PyObject *self, PyObject *args)
|
|||||||
case PYVAR_currentnick:
|
case PYVAR_currentnick:
|
||||||
return Py_BuildValue("s", CurrentNick);
|
return Py_BuildValue("s", CurrentNick);
|
||||||
case PYVAR_botnick:
|
case PYVAR_botnick:
|
||||||
return Py_BuildValue("s", current && current->nick ? current->nick : "");
|
return Py_BuildValue("s", current && getbotnick(current));
|
||||||
case PYVAR_wantnick:
|
case PYVAR_wantnick:
|
||||||
return Py_BuildValue("s", current && current->wantnick ? current->wantnick : "");
|
return Py_BuildValue("s", current && getbotwantnick(current));
|
||||||
case PYVAR_userhost:
|
case PYVAR_userhost:
|
||||||
return Py_BuildValue("s", current && current->userhost ? current->userhost : "");
|
return Py_BuildValue("s", current && getbotuserhost(current));
|
||||||
case PYVAR_server:
|
case PYVAR_server:
|
||||||
return Py_BuildValue("i", current && current->server ? current->server : -1);
|
return Py_BuildValue("i", current && current->server ? current->server : -1);
|
||||||
case PYVAR_nextserver:
|
case PYVAR_nextserver:
|
||||||
|
|||||||
@ -847,7 +847,7 @@ void do_seen(COMMAND_ARGS)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nickcmp(n,current->nick))
|
if (!nickcmp(n,getbotnick(current)))
|
||||||
{
|
{
|
||||||
fmt = "%s is me you dweeb!";
|
fmt = "%s is me you dweeb!";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,24 +34,25 @@ char *chop(char **src)
|
|||||||
{
|
{
|
||||||
char *tok,*cut = *src;
|
char *tok,*cut = *src;
|
||||||
|
|
||||||
while(*cut && *cut == ' ')
|
/* skip leading spaces */
|
||||||
|
while(*cut == ' ')
|
||||||
cut++;
|
cut++;
|
||||||
|
|
||||||
if (*cut)
|
if (*cut == 0)
|
||||||
{
|
return(NULL);
|
||||||
|
|
||||||
tok = cut;
|
tok = cut;
|
||||||
while(*cut && *cut != ' ')
|
while(*cut && *cut != ' ')
|
||||||
cut++;
|
cut++;
|
||||||
*src = cut;
|
*src = cut;
|
||||||
while(*cut && *cut == ' ')
|
|
||||||
|
/* skip more spaces */
|
||||||
|
while(*cut == ' ')
|
||||||
cut++;
|
cut++;
|
||||||
|
|
||||||
**src = 0;
|
**src = 0;
|
||||||
*src = cut;
|
cx.chop_end = *src = cut;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tok = NULL;
|
|
||||||
}
|
|
||||||
return(tok);
|
return(tok);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,6 +79,7 @@ typedef struct OnMsg
|
|||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
void (*func)(char *, const char *, char *, const int);
|
void (*func)(char *, const char *, char *, const int);
|
||||||
|
void (*noargfunc)(const char *);
|
||||||
uint32_t defaultaccess:8, /* defaultaccess */
|
uint32_t defaultaccess:8, /* defaultaccess */
|
||||||
dcc:1,
|
dcc:1,
|
||||||
cc:1,
|
cc:1,
|
||||||
@ -92,7 +93,8 @@ typedef struct OnMsg
|
|||||||
lbuf:1,
|
lbuf:1,
|
||||||
cbang:1,
|
cbang:1,
|
||||||
acchan:1,
|
acchan:1,
|
||||||
supres:1; /* -- 21 bits */
|
supres:1, /* -- 21 bits */
|
||||||
|
noargf:1; /* -- 22 bits */
|
||||||
const char *cmdarg;
|
const char *cmdarg;
|
||||||
|
|
||||||
} OnMsg;
|
} OnMsg;
|
||||||
@ -233,7 +235,7 @@ typedef struct Setting
|
|||||||
} v;
|
} v;
|
||||||
char *name;
|
char *name;
|
||||||
int max;
|
int max;
|
||||||
void (*func)(const struct Setting *);
|
void (*onchangefunc)(const struct Setting *);
|
||||||
|
|
||||||
} Setting;
|
} Setting;
|
||||||
|
|
||||||
@ -515,7 +517,6 @@ typedef struct Server
|
|||||||
|
|
||||||
int ident;
|
int ident;
|
||||||
int usenum;
|
int usenum;
|
||||||
int servergroup;
|
|
||||||
int port;
|
int port;
|
||||||
int err;
|
int err;
|
||||||
time_t lastconnect;
|
time_t lastconnect;
|
||||||
@ -524,19 +525,11 @@ typedef struct Server
|
|||||||
|
|
||||||
char realname[NAMEBUF];
|
char realname[NAMEBUF];
|
||||||
char name[NAMEBUF];
|
char name[NAMEBUF];
|
||||||
char pass[PASSLEN];
|
char pass[PASSBUF];
|
||||||
|
char group[SERVERGROUPBUF];
|
||||||
|
|
||||||
} Server;
|
} Server;
|
||||||
|
|
||||||
typedef struct ServerGroup
|
|
||||||
{
|
|
||||||
struct ServerGroup *next;
|
|
||||||
|
|
||||||
int servergroup;
|
|
||||||
char name[1];
|
|
||||||
|
|
||||||
} ServerGroup;
|
|
||||||
|
|
||||||
typedef struct FileMon
|
typedef struct FileMon
|
||||||
{
|
{
|
||||||
struct FileMon *next;
|
struct FileMon *next;
|
||||||
|
|||||||
@ -99,7 +99,7 @@ char *tcl_var_read(Tcl_TVInfo *vinfo, Tcl_Interp *I, char *n1, char *n2, int fla
|
|||||||
rdata.i = (current) ? current->guid : -1;
|
rdata.i = (current) ? current->guid : -1;
|
||||||
break;
|
break;
|
||||||
case TVINFO_nick:
|
case TVINFO_nick:
|
||||||
rdata.c = (current) ? current->nick : "(undefined variable)";
|
rdata.c = (current) ? getbotnick(current) : "(undefined variable)";
|
||||||
break;
|
break;
|
||||||
case TVINFO_wantnick:
|
case TVINFO_wantnick:
|
||||||
rdata.c = (current) ? current->wantnick : "(undefined variable)";
|
rdata.c = (current) ? current->wantnick : "(undefined variable)";
|
||||||
|
|||||||
@ -58,7 +58,7 @@ LS int triv_halt_flag;
|
|||||||
|
|
||||||
#endif /* TRIVIA */
|
#endif /* TRIVIA */
|
||||||
|
|
||||||
#define BIGSAY_DEFAULTFONT "default"
|
#define BIGSAY_DEFAULTFONT DEFAULTSTR
|
||||||
#define FONT_EXTENSION ".bigchars"
|
#define FONT_EXTENSION ".bigchars"
|
||||||
|
|
||||||
BigC *newchar;
|
BigC *newchar;
|
||||||
@ -544,7 +544,7 @@ stop_trivia:
|
|||||||
triv_chan = NULL;
|
triv_chan = NULL;
|
||||||
triv_next_time = 0;
|
triv_next_time = 0;
|
||||||
triv_halt_flag = FALSE;
|
triv_halt_flag = FALSE;
|
||||||
short_tv &= ~TV_TRIVIA;
|
cx.short_tv &= ~TV_TRIVIA;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1068,7 +1068,7 @@ void do_trivia(COMMAND_ARGS)
|
|||||||
triv_next_time = now + triv_qdelay;
|
triv_next_time = now + triv_qdelay;
|
||||||
triv_weektop10 = now;
|
triv_weektop10 = now;
|
||||||
lastwinner = NULL;
|
lastwinner = NULL;
|
||||||
short_tv |= TV_TRIVIA;
|
cx.short_tv |= TV_TRIVIA;
|
||||||
if (!scorelist)
|
if (!scorelist)
|
||||||
{
|
{
|
||||||
read_triviascore();
|
read_triviascore();
|
||||||
|
|||||||
@ -41,7 +41,7 @@ typedef struct
|
|||||||
uint32_t cookie;
|
uint32_t cookie;
|
||||||
uint32_t uptime;
|
uint32_t uptime;
|
||||||
uint32_t ontime;
|
uint32_t ontime;
|
||||||
uint32_t now;
|
uint32_t mytime;
|
||||||
uint32_t sysup;
|
uint32_t sysup;
|
||||||
|
|
||||||
} PackStub;
|
} PackStub;
|
||||||
@ -54,7 +54,7 @@ typedef struct
|
|||||||
uint32_t cookie;
|
uint32_t cookie;
|
||||||
uint32_t uptime;
|
uint32_t uptime;
|
||||||
uint32_t ontime;
|
uint32_t ontime;
|
||||||
uint32_t now;
|
uint32_t mytime;
|
||||||
uint32_t sysup;
|
uint32_t sysup;
|
||||||
char string[512];
|
char string[512];
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ void send_uptime(int type)
|
|||||||
uptimecookie = (uptimecookie + 1) * 18457;
|
uptimecookie = (uptimecookie + 1) * 18457;
|
||||||
upPack.cookie = htonl(uptimecookie);
|
upPack.cookie = htonl(uptimecookie);
|
||||||
|
|
||||||
upPack.now = htonl(now);
|
upPack.mytime = htonl(now);
|
||||||
upPack.regnr = uptimeregnr;
|
upPack.regnr = uptimeregnr;
|
||||||
upPack.type = htonl(type);
|
upPack.type = htonl(type);
|
||||||
upPack.uptime = htonl(uptime);
|
upPack.uptime = htonl(uptime);
|
||||||
|
|||||||
@ -115,6 +115,9 @@ LS const UsageList ulist[] =
|
|||||||
#endif /* CTCP */
|
#endif /* CTCP */
|
||||||
{ C_QSHIT, "<nick> [reason]" },
|
{ C_QSHIT, "<nick> [reason]" },
|
||||||
#ifdef NOTE
|
#ifdef NOTE
|
||||||
|
#ifdef TOYBOX
|
||||||
|
{ C_RAND, "[#|#-#|# #|\"nick\"|\"luser\"]" },
|
||||||
|
#endif /* TOYBOX */
|
||||||
{ C_READ, "[-]<number>" },
|
{ C_READ, "[-]<number>" },
|
||||||
#endif /* NOTE */
|
#endif /* NOTE */
|
||||||
{ C_RESET, NULL },
|
{ C_RESET, NULL },
|
||||||
@ -137,7 +140,6 @@ LS const UsageList ulist[] =
|
|||||||
{ C_SEND, "[to] <filename>" },
|
{ C_SEND, "[to] <filename>" },
|
||||||
#endif /* DCC_FILE */
|
#endif /* DCC_FILE */
|
||||||
{ C_SERVER, "[[+|-]servername] [port] [pass]" },
|
{ C_SERVER, "[[+|-]servername] [port] [pass]" },
|
||||||
{ C_SERVERGROUP,"[identifier]" },
|
|
||||||
{ C_SET, "[channel|*] [setting [value]]" },
|
{ C_SET, "[channel|*] [setting [value]]" },
|
||||||
{ C_SETPASS, "<handle> <password>" },
|
{ C_SETPASS, "<handle> <password>" },
|
||||||
{ C_SHIT, "<channel|*> <nick|mask> <action> [expire] <reason>" },
|
{ C_SHIT, "<channel|*> <nick|mask> <action> [expire] <reason>" },
|
||||||
|
|||||||
11
src/vars.c
11
src/vars.c
@ -257,7 +257,7 @@ void ec_set(char *from, const char *to)
|
|||||||
|
|
||||||
void ec_on(char *from, const char *to)
|
void ec_on(char *from, const char *to)
|
||||||
{
|
{
|
||||||
nobo_strcpy(idle2str(now - current->ontime,FALSE));
|
nobo_strcpy(idle2str(current->ontime,FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ec_server(char *from, const char *to)
|
void ec_server(char *from, const char *to)
|
||||||
@ -274,7 +274,7 @@ void ec_server(char *from, const char *to)
|
|||||||
|
|
||||||
void ec_up(char *from, const char *to)
|
void ec_up(char *from, const char *to)
|
||||||
{
|
{
|
||||||
nobo_strcpy(idle2str(now - uptime,FALSE));
|
nobo_strcpy(idle2str(uptime,FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ec_ver(char *from, const char *to)
|
void ec_ver(char *from, const char *to)
|
||||||
@ -594,6 +594,9 @@ num_data_ok:
|
|||||||
}
|
}
|
||||||
to_user(from,"Var: %s On: %s Set to: %s",VarName[which].name,
|
to_user(from,"Var: %s On: %s Set to: %s",VarName[which].name,
|
||||||
(which >= CHANSET_SIZE) ? "(global)" : channel,(*rest) ? rest : NULLSTR);
|
(which >= CHANSET_SIZE) ? "(global)" : channel,(*rest) ? rest : NULLSTR);
|
||||||
if (VarName[which].func)
|
/*
|
||||||
VarName[which].func(&VarName[which]);
|
* if there is an onchange function
|
||||||
|
*/
|
||||||
|
if (VarName[which].onchangefunc)
|
||||||
|
VarName[which].onchangefunc(&VarName[which]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -165,7 +165,7 @@ restart:
|
|||||||
client->echan = (client->ebot) ? client->ebot->chanlist : NULL;
|
client->echan = (client->ebot) ? client->ebot->chanlist : NULL;
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
src = (client->ebot) ? client->ebot->nick : (char*)NULLSTR;
|
src = (client->ebot) ? getbotnick(client->ebot) : (char*)NULLSTR;
|
||||||
while(*src)
|
while(*src)
|
||||||
{
|
{
|
||||||
NOBO;
|
NOBO;
|
||||||
@ -328,7 +328,7 @@ void web_botstatus(WebSock *client, char *url)
|
|||||||
"<h1>EnergyMech Status</h1>\r\n"
|
"<h1>EnergyMech Status</h1>\r\n"
|
||||||
"Uptime: %s<br><br>\r\n"
|
"Uptime: %s<br><br>\r\n"
|
||||||
"<u>Current bots</u>:<br>\r\n",
|
"<u>Current bots</u>:<br>\r\n",
|
||||||
idle2str(now - uptime,FALSE));
|
idle2str(uptime,FALSE));
|
||||||
|
|
||||||
for(;bot;bot=bot->next)
|
for(;bot;bot=bot->next)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user