mirror of
https://github.com/EnergyMech/energymech.git
synced 2025-12-17 15:36:50 +00:00
2018 cleanup update
This commit is contained in:
parent
723ac1f91e
commit
e5ad9bb990
1
.gitignore
vendored
1
.gitignore
vendored
@ -18,3 +18,4 @@ mech.pid
|
||||
root.zone*
|
||||
trick.conf
|
||||
|
||||
conf
|
||||
|
||||
5
VERSIONS
5
VERSIONS
@ -1,3 +1,8 @@
|
||||
3.0.99p4 -- February, 2018.
|
||||
|
||||
* Fixed: Strlen/Strlen2 code cleanup.
|
||||
* Fixed: Various compiler warnings.
|
||||
|
||||
3.0.99p3 -- July 24th, 2009.
|
||||
|
||||
* Added: Python scripting support (supplied by S.Marquis)
|
||||
|
||||
@ -447,3 +447,9 @@ listcheck:
|
||||
}
|
||||
to_user(from,"You are now officially immortal");
|
||||
}
|
||||
|
||||
#ifdef MD5CRYPT
|
||||
void do_md5(COMMAND_ARGS)
|
||||
{
|
||||
}
|
||||
#endif /* MD5CRYPT */
|
||||
|
||||
@ -295,8 +295,7 @@ Ban *make_ban(Ban **banlist, char *from, char *banmask, time_t when)
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
sz = sizeof(Ban) + Strlen2(from,banmask);
|
||||
//sz = sizeof(Ban) + strlen(from) + strlen(banmask);
|
||||
sz = sizeof(Ban) + Strlen2(from,banmask); // banmask is never NULL
|
||||
|
||||
set_mallocdoer(make_ban);
|
||||
new = (Ban*)Calloc(sz);
|
||||
@ -478,7 +477,7 @@ void channel_massmode(Chan *chan, char *pattern, int filtmode, char mode, char t
|
||||
|
||||
if (i)
|
||||
{
|
||||
if ((Strlen2(deopstring,burst)) >= MSGLEN-2)
|
||||
if ((Strlen2(deopstring,burst)) >= MSGLEN-2) // burst is never NULL
|
||||
{
|
||||
write(current->sock,burst,strlen(burst));
|
||||
#ifdef DEBUG
|
||||
|
||||
@ -168,13 +168,13 @@ int write_session(void)
|
||||
varval = varval->proc_var;
|
||||
if (IsChar(j))
|
||||
{
|
||||
if ((int)VarName[j].setto != varval->char_var)
|
||||
if (VarName[j].v.num != varval->char_var)
|
||||
to_file(sf,"set %s %c\n",VarName[j].name,varval->char_var);
|
||||
}
|
||||
else
|
||||
if (IsNum(j))
|
||||
{
|
||||
if ((int)VarName[j].setto != varval->int_var)
|
||||
if (VarName[j].v.num != varval->int_var)
|
||||
to_file(sf,"set %s %i\n",VarName[j].name,varval->int_var);
|
||||
}
|
||||
else
|
||||
@ -200,7 +200,7 @@ int write_session(void)
|
||||
varval = &chan->setting[j];
|
||||
if (IsNum(j))
|
||||
{
|
||||
if ((int)VarName[j].setto != varval->int_var)
|
||||
if (VarName[j].v.num != varval->int_var)
|
||||
to_file(sf,"set %s %i\n",VarName[j].name,varval->int_var);
|
||||
}
|
||||
else
|
||||
|
||||
@ -156,7 +156,7 @@ int dcc_sendfile(char *target, char *filename)
|
||||
struct sockaddr_in sai;
|
||||
Client *client;
|
||||
int s,f,sz;
|
||||
char tempfile[Strlen2(filename,DCC_PUBLICFILES)+2];
|
||||
char tempfile[strlen(filename)+strlen(DCC_PUBLICFILES)+2]; // strlen(DCC_PUBLICFILES) evaluates at compile time to a constant.
|
||||
|
||||
Strcpy(tempfile,DCC_PUBLICFILES);
|
||||
Strcat(tempfile,filename);
|
||||
@ -177,7 +177,7 @@ int dcc_sendfile(char *target, char *filename)
|
||||
}
|
||||
|
||||
set_mallocdoer(dcc_sendfile);
|
||||
client = (Client*)Calloc(sizeof(Client) + Strlen2(filename,target));
|
||||
client = (Client*)Calloc(sizeof(Client) + Strlen2(filename,target)); // target is never NULL
|
||||
|
||||
client->fileno = f;
|
||||
client->sock = s;
|
||||
@ -608,7 +608,7 @@ void ctcp_dcc(char *from, char *to, char *rest)
|
||||
|
||||
if (1)
|
||||
{
|
||||
char tempname[Strlen2(filename,DCC_PUBLICINCOMING)+1];
|
||||
char tempname[strlen(filename)+strlen(DCC_PUBLICINCOMING)+1]; // strlen(DCC_PUBLICINCOMING) evaluates to a constant during compile.
|
||||
|
||||
Strcpy(Strcpy(tempname,DCC_PUBLICINCOMING),filename);
|
||||
|
||||
@ -620,7 +620,7 @@ void ctcp_dcc(char *from, char *to, char *rest)
|
||||
return;
|
||||
}
|
||||
set_mallocdoer(ctcp_dcc);
|
||||
client = (Client*)Calloc(sizeof(Client) + Strlen2(filename,from));
|
||||
client = (Client*)Calloc(sizeof(Client) + Strlen2(filename,from)); // from is never NULL
|
||||
client->fileno = f;
|
||||
client->fileend = filesz;
|
||||
client->sock = s;
|
||||
|
||||
30
src/debug.c
30
src/debug.c
@ -196,12 +196,12 @@ LS const DEFstruct SCRIPTdefs[] =
|
||||
{ HOOK_BOTNET, "HOOK_BOTNET" },
|
||||
{ HOOK_DCC_COMPLETE, "HOOK_DCC_COMPLETE" },
|
||||
#ifdef TCL
|
||||
{ (int)tcl_timer_jump, "tcl_timer_jump" },
|
||||
{ (int)tcl_parse_jump, "tcl_parse_jump" },
|
||||
{ .v.func=tcl_timer_jump, "tcl_timer_jump" },
|
||||
{ .v.func=tcl_parse_jump, "tcl_parse_jump" },
|
||||
#endif /* TCL */
|
||||
#ifdef PYTHON
|
||||
{ (int)python_timer_jump, "python_timer_jump" },
|
||||
{ (int)python_parse_jump, "python_parse_jump" },
|
||||
{ .v.func=python_timer_jump, "python_timer_jump" },
|
||||
{ .v.func=python_parse_jump, "python_parse_jump" },
|
||||
#endif /* PYTHON */
|
||||
{ 0, }};
|
||||
#endif /* SCRIPTING */
|
||||
@ -301,9 +301,9 @@ void strflags(char *dst, const DEFstruct *flagsstruct, int flags)
|
||||
int i;
|
||||
|
||||
*dst = 0;
|
||||
for(i=0;(flagsstruct[i].id);i++)
|
||||
for(i=0;(flagsstruct[i].v.id);i++)
|
||||
{
|
||||
if (flagsstruct[i].id & flags)
|
||||
if (flagsstruct[i].v.id & flags)
|
||||
{
|
||||
if (*dst)
|
||||
Strcat(dst,"|");
|
||||
@ -318,7 +318,19 @@ const char *strdef(const DEFstruct *dtab, int num)
|
||||
|
||||
for(i=0;(dtab[i].idstr);i++)
|
||||
{
|
||||
if (dtab[i].id == num)
|
||||
if (dtab[i].v.id == num)
|
||||
return(dtab[i].idstr);
|
||||
}
|
||||
return("UNKNOWN");
|
||||
}
|
||||
|
||||
const char *funcdef(const DEFstruct *dtab, void *func)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0;(dtab[i].idstr);i++)
|
||||
{
|
||||
if (dtab[i].v.func == func)
|
||||
return(dtab[i].idstr);
|
||||
}
|
||||
return("UNKNOWN");
|
||||
@ -468,7 +480,7 @@ void debug_settings(UniVar *setting, int type)
|
||||
}
|
||||
|
||||
tpad = STREND(tabs);
|
||||
n = 24 - (Strlen2(pad,VarName[i].name) + 2);
|
||||
n = 24 - (Strlen2(pad,VarName[i].name) + 2); // VarName[i].name is never NULL
|
||||
while(n >= 8)
|
||||
{
|
||||
n = n - 8;
|
||||
@ -1213,7 +1225,7 @@ void debug_scripthook(void)
|
||||
for(h=hooklist;h;h=h->next)
|
||||
{
|
||||
memtouch(h);
|
||||
debug(" ; func\t\t"mx_pfmt" %s\n",(mx_ptr)h->func,strdef(SCRIPTdefs,(int)h->func));
|
||||
debug(" ; func\t\t"mx_pfmt" %s\n",(mx_ptr)h->func,funcdef(SCRIPTdefs,h->func));
|
||||
debug(" ; guid\t\t%i\n",h->guid);
|
||||
debug(" ; flags\t\t%s (%i)\n",strdef(SCRIPTdefs,h->flags),h->flags);
|
||||
if (h->flags == HOOK_TIMER)
|
||||
|
||||
@ -176,7 +176,7 @@ void Free(char **mem)
|
||||
|
||||
#endif /* DEBUG */
|
||||
|
||||
int Strlen(const char *first, ...)
|
||||
const int Strlen(const char *first, ...)
|
||||
{
|
||||
const char *s,*o;
|
||||
int n;
|
||||
@ -200,7 +200,7 @@ int Strlen(const char *first, ...)
|
||||
}
|
||||
|
||||
__attr(CORE_SEG,__regparm(2))
|
||||
int Strlen2(const char *one, const char *two)
|
||||
const int Strlen2(const char *one, const char *two)
|
||||
{
|
||||
const char *s1,*s2;
|
||||
|
||||
|
||||
8
src/h.h
8
src/h.h
@ -23,7 +23,7 @@
|
||||
|
||||
#define ischannel(x) (*x == '#')
|
||||
|
||||
#define nullstr(x) (x) ? x : NULLSTR
|
||||
#define nullstr(x) ((x)) ? (x) : NULLSTR
|
||||
#define nullbuf(x) (x && *x) ? x : NULLSTR
|
||||
|
||||
#define chkhigh(x) if (x > hisock) { hisock = x; }
|
||||
@ -107,6 +107,7 @@
|
||||
|
||||
#endif /* DEBUG */
|
||||
|
||||
LS Chan *find_channel(char *, int) __attr(CORE_SEG, __regparm (2) );
|
||||
LS Chan *find_channel_ac(char *) __attr(CORE_SEG, __regparm (1) );
|
||||
LS Chan *find_channel_ny(char *) __attr(CORE_SEG, __regparm (1) );
|
||||
LS ChanUser *find_chanuser(Chan *, const char *) __attr(CORE_SEG, __regparm (2) );
|
||||
@ -208,8 +209,8 @@ LS ulong stringhash(char *) __page(CORE_SEG);
|
||||
*/
|
||||
LS void *Calloc(int) __attr(CORE_SEG, __regparm (1) );
|
||||
LS void Free(char **) __attr(CORE_SEG, __regparm (1) );
|
||||
LS int Strlen(const char *, ...) __page(CORE_SEG);
|
||||
LS int Strlen2(const char *, const char *) __attr(CORE_SEG, __regparm (2) );
|
||||
LS const int Strlen(const char *, ...) __page(CORE_SEG);
|
||||
LS const int Strlen2(const char *, const char *) __attr(CORE_SEG, __regparm (2) );
|
||||
LS int matches(const char *, const char *) __att2(CORE_SEG, const, __regparm (2) );
|
||||
LS int num_matches(const char *, const char *) __att2(CORE_SEG, const, __regparm (2) );
|
||||
LS int a2i(char *) __attr(CORE_SEG, __regparm (1) );
|
||||
@ -527,6 +528,7 @@ LS void select_bounce(void) __page(CORE_SEG);
|
||||
|
||||
LS void do_chanban(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS void process_chanbans(void) __page(CORE_SEG);
|
||||
LS void chanban_action(char *, char *, Shit *) __page(CORE_SEG);
|
||||
|
||||
#endif /* CHANBAN */
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ void make_ireq(int t, char *from, char *nick)
|
||||
char *pt;
|
||||
|
||||
set_mallocdoer(make_ireq);
|
||||
ir = (IReq*)Calloc(sizeof(IReq) + Strlen2(from,nick));
|
||||
ir = (IReq*)Calloc(sizeof(IReq) + Strlen(from,nick,NULL)); // can not use Strlen2() if 2nd arg might be NULL, Strlen() handles NULLs.
|
||||
|
||||
ir->t = t;
|
||||
ir->when = now;
|
||||
|
||||
@ -770,7 +770,7 @@ restart_die:
|
||||
LS char *bad_exe = "init: Error: Improper executable name\n";
|
||||
|
||||
#ifdef __GNUC__
|
||||
int main(int argc, char **argv, char **envp) __attribute__ ((__noreturn__, __sect(INIT_SEG)));
|
||||
int main(int argc, char **argv, char **envp) __attribute__ ((__sect(INIT_SEG)));
|
||||
#endif
|
||||
int main(int argc, char **argv, char **envp)
|
||||
{
|
||||
|
||||
@ -338,7 +338,7 @@ void basicAuth(BotNet *bn, char *rest)
|
||||
case BNAUTH_MD5:
|
||||
if (linkpass && *linkpass)
|
||||
{
|
||||
char *enc,temppass[24 + Strlen2(pass,linkpass)];
|
||||
char *enc,temppass[24 + Strlen2(pass,linkpass)]; // linkpass is never NULL
|
||||
|
||||
/* "mypass theirpass REMOTEsid LOCALsid" */
|
||||
sprintf(temppass,"%s %s %i %i",linkpass,pass,bn->rsid,bn->lsid);
|
||||
@ -546,7 +546,7 @@ void basicBanner(BotNet *bn, char *rest)
|
||||
if (cfg->pass && *cfg->pass)
|
||||
{
|
||||
char *enc,salt[8];
|
||||
char temppass[24 + Strlen2(cfg->pass,linkpass)];
|
||||
char temppass[24 + Strlen2(cfg->pass,linkpass)]; // linkpass(procvar) is not NULL
|
||||
|
||||
/* "theirpass mypass LOCALsid REMOTEsid" */
|
||||
sprintf(temppass,"%s %s %i %i",cfg->pass,linkpass,bn->lsid,bn->rsid);
|
||||
@ -1498,7 +1498,7 @@ usage:
|
||||
goto usage;
|
||||
|
||||
set_mallocdoer(do_link);
|
||||
cfg = (NetCfg*)Calloc(sizeof(NetCfg) + Strlen2(pass,host));
|
||||
cfg = (NetCfg*)Calloc(sizeof(NetCfg) + Strlen(pass,host,NULL)); // host might be NULL, Strlen() handles NULLs, Strlen2() does not.
|
||||
|
||||
cfg->guid = iguid;
|
||||
cfg->port = iport;
|
||||
|
||||
@ -244,7 +244,7 @@ void catch_whois(char *nick, char *userhost, char *realname)
|
||||
* put in a new log entry
|
||||
*/
|
||||
set_mallocdoer(catch_whois);
|
||||
nlog = (nfLog*)Calloc(sizeof(nfLog) + Strlen2(userhost,realname));
|
||||
nlog = (nfLog*)Calloc(sizeof(nfLog) + Strlen2(userhost,realname)); // realname is never NULL
|
||||
nlog->signon = now;
|
||||
nlog->next = nf->log;
|
||||
nf->log = nlog;
|
||||
@ -306,7 +306,7 @@ int notifylog_callback(char *rest)
|
||||
pp = &(*pp)->next;
|
||||
}
|
||||
set_mallocdoer(notifylog_callback);
|
||||
nlog = (nfLog*)Calloc(sizeof(nfLog) + Strlen2(userhost,rest));
|
||||
nlog = (nfLog*)Calloc(sizeof(nfLog) + Strlen2(userhost,rest)); // rest is never NULL
|
||||
nlog->signon = on;
|
||||
nlog->signoff = off;
|
||||
nlog->next = *pp;
|
||||
|
||||
@ -61,7 +61,6 @@ int perl_parse_jump(char *from, char *rest, Hook *hook)
|
||||
|
||||
SPAGAIN; /* Rehash stack, it's probably been clobbered */
|
||||
return(POPi); /* Pop an int */
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -100,7 +99,7 @@ XS(XS_perl_parse_hook)
|
||||
* make a Hook struct and link it into the parse hook list
|
||||
*/
|
||||
set_mallocdoer(perl_parse_hook);
|
||||
hook = (Hook*)Calloc(sizeof(Hook) + Strlen2(name,sub));
|
||||
hook = (Hook*)Calloc(sizeof(Hook) + Strlen2(name,sub)); // sub is never NULL
|
||||
hook->func = perl_parse_jump;
|
||||
hook->next = hooklist;
|
||||
hooklist = hook;
|
||||
|
||||
@ -51,7 +51,7 @@ void send_kick(Chan *chan, const char *nick, const char *format, ...)
|
||||
pp = &(*pp)->next;
|
||||
|
||||
set_mallocdoer(send_kick);
|
||||
*pp = new = (qKick*)Calloc(sizeof(qKick) + Strlen2(nick,gsockdata));
|
||||
*pp = new = (qKick*)Calloc(sizeof(qKick) + Strlen2(nick,gsockdata)); // gsockdata is never NULL
|
||||
/* Calloc sets to zero new->next = NULL; */
|
||||
|
||||
new->reason = Strcpy(new->nick,nick) + 1;
|
||||
|
||||
@ -25,8 +25,13 @@
|
||||
#define DEFAULTCMDCHAR '-'
|
||||
|
||||
#define ZERO 0
|
||||
#define INTCAST(x) (void*)((int)x)
|
||||
#define CHARCAST (void*)((int)DEFAULTCMDCHAR)
|
||||
#define INTCAST(x) .v.num=x
|
||||
#define CMDCHAR .v.chr=DEFAULTCMDCHAR
|
||||
#define VNULL .v.str=NULL
|
||||
#define TOGPROC(x) .v.numptr=&x
|
||||
#define CHRPROC(x) .v.str=&x
|
||||
#define INTPROC(x) .v.numptr=&x
|
||||
#define STRPROC(x) .v.strptr=&x
|
||||
|
||||
LS const Setting VarName[SIZE_VARS] =
|
||||
{
|
||||
@ -44,10 +49,10 @@ LS const Setting VarName[SIZE_VARS] =
|
||||
{ INT_VAR, 40, 0, ZERO, "CKL", 20 },
|
||||
{ TOG_VAR, 40, 0, ZERO, "CTL", 1 },
|
||||
#ifdef DYNAMODE
|
||||
{ STR_VAR, 40, 0, NULL, "DYNLIMIT", 1 }, /* settings for dynamode: `delay:window:minwin' */
|
||||
{ STR_VAR, 40, 0, VNULL, "DYNLIMIT", 1 }, /* settings for dynamode: `delay:window:minwin' */
|
||||
#endif /* DYNAMODE */
|
||||
{ TOG_VAR, 40, 0, ZERO, "ENFM", 1 },
|
||||
{ STR_VAR, 40, 0, NULL, "ENFMODES" }, /* modes to enforce, +ENFM to enable */
|
||||
{ STR_VAR, 40, 0, VNULL, "ENFMODES" }, /* modes to enforce, +ENFM to enable */
|
||||
{ INT_VAR, 40, 0, INTCAST(6), "FL", 20 }, /* number of lines that counts as a text flood */
|
||||
{ INT_VAR, 40, 0, ZERO, "FPL", 2 },
|
||||
{ INT_VAR, 40, 0, INTCAST(0), "IKT", 40320 }, /* idle-kick: minutes of idle-time (max 4 weeks) */
|
||||
@ -65,7 +70,7 @@ LS const Setting VarName[SIZE_VARS] =
|
||||
{ TOG_VAR, 40, 0, INTCAST(1), "SHIT", 1 }, /* shitlist enable */
|
||||
{ TOG_VAR, 40, 0, ZERO, "SO", 1 }, /* safe-op enable */
|
||||
#ifdef STATS
|
||||
{ STR_VAR, 80, 0, NULL, "STATS" }, /* statistics log file */
|
||||
{ STR_VAR, 80, 0, VNULL, "STATS" }, /* statistics log file */
|
||||
#endif /* STATS */
|
||||
{ TOG_VAR, 40, 0, ZERO, "TOP", 1 },
|
||||
/*
|
||||
@ -73,33 +78,33 @@ LS const Setting VarName[SIZE_VARS] =
|
||||
*/
|
||||
/* TYPE UACCES MIN DEFAULT NAME MAX */
|
||||
{ INT_GLOBAL, 40, 0, ZERO, "AAWAY", 1440 }, /* set auto-away after ___ minutes */
|
||||
{ STR_GLOBAL, 90, 0, NULL, "ALTNICK" }, /* alternative nick */
|
||||
{ STR_GLOBAL, 90, 0, VNULL, "ALTNICK" }, /* alternative nick */
|
||||
#ifdef BOTNET
|
||||
{ TOG_PROC, 90, 0, (&autolink), "AUTOLINK", 1 }, /* establish links automagically */
|
||||
{ TOG_PROC, 90, 0, TOGPROC(autolink), "AUTOLINK", 1 }, /* establish links automagically */
|
||||
#endif /* BOTNET */
|
||||
#ifdef BOUNCE
|
||||
{ INT_PROC, 100, 0, (&bounce_port), "BNCPORT", 65535, (&new_port_bounce) }, /* irc proxy port to listen on */
|
||||
{ INT_PROC, 100, 0, INTPROC(bounce_port), "BNCPORT", 65535, (&new_port_bounce) }, /* irc proxy port to listen on */
|
||||
#endif /* BOUNCE */
|
||||
{ TOG_GLOBAL, 90, 0, INTCAST(1), "CC", 1 }, /* require command char */
|
||||
{ CHR_GLOBAL, 90, 1, CHARCAST, "CMDCHAR", 255 }, /* command char */
|
||||
{ CHR_GLOBAL, 90, 1, CMDCHAR, "CMDCHAR", 255 }, /* command char */
|
||||
#ifdef CTCP
|
||||
{ TOG_GLOBAL, 90, 0, INTCAST(1), "CTCP", 1 }, /* ctcp replies enable */
|
||||
#endif /* CTCP */
|
||||
{ INT_PROC, 100, 10, (&ctimeout), "CTIMEOUT", 3600 }, /* how long to wait between connect attempts */
|
||||
{ INT_PROC, 100, 10, INTPROC(ctimeout), "CTIMEOUT", 3600 }, /* how long to wait between connect attempts */
|
||||
#ifdef DCC_FILE
|
||||
{ INT_GLOBAL, 80, 0, ZERO, "DCCANON", 100 }, /* anonymous (non user) DCC slots */
|
||||
{ STR_GLOBAL, 80, 0, NULL, "DCCFILES" }, /* string with space separated masks for auto-accepted filenames */
|
||||
{ STR_GLOBAL, 80, 0, VNULL, "DCCFILES" }, /* string with space separated masks for auto-accepted filenames */
|
||||
{ INT_GLOBAL, 80, 0, INTCAST(4), "DCCUSER", 100 }, /* user DCC slots */
|
||||
#endif /* DCC_FILE */
|
||||
{ TOG_GLOBAL, 80, 0, ZERO, "ENFPASS", 1 }, /* disallow users with no passwords */
|
||||
{ STR_GLOBAL, 90, 0, NULL, "IDENT" }, /* register with this in the `user' field */
|
||||
{ STR_GLOBAL, 90, 0, NULL, "IRCNAME" }, /* register with this in the `real name' field */
|
||||
{ STR_GLOBAL, 90, 0, VNULL, "IDENT" }, /* register with this in the `user' field */
|
||||
{ STR_GLOBAL, 90, 0, VNULL, "IRCNAME" }, /* register with this in the `real name' field */
|
||||
#ifdef NOTIFY
|
||||
{ INT_GLOBAL, 80, 10, INTCAST(30), "ISONDELAY", 600 }, /* seconds between each ISON */
|
||||
#endif /* NOTIFY */
|
||||
#ifdef BOTNET
|
||||
{ STR_PROC, 90, 0, (&linkpass), "LINKPASS" }, /* local process linkpass */
|
||||
{ INT_PROC, 100, 0, (&linkport), "LINKPORT", 65535 }, /* listen on <linkport> for botnet connections */
|
||||
{ STR_PROC, 90, 0, STRPROC(linkpass), "LINKPASS" }, /* local process linkpass */
|
||||
{ INT_PROC, 100, 0, INTPROC(linkport), "LINKPORT", 65535 }, /* listen on <linkport> for botnet connections */
|
||||
#endif /* BOTNET */
|
||||
{ INT_GLOBAL, 80, 1, INTCAST(3), "MODES", 20 }, /* max number of channel modes to send */
|
||||
#ifdef BOTNET
|
||||
@ -107,36 +112,36 @@ LS const Setting VarName[SIZE_VARS] =
|
||||
#endif /* BOTNET */
|
||||
{ TOG_GLOBAL, 80, 0, ZERO, "NOIDLE", 1 }, /* dont idle */
|
||||
#ifdef NOTIFY
|
||||
{ STR_GLOBAL, 80, 0, NULL, "NOTIFYFILE" }, /* read notify settings from <notifyfile> */
|
||||
{ STR_GLOBAL, 80, 0, VNULL, "NOTIFYFILE" }, /* read notify settings from <notifyfile> */
|
||||
#endif /* NOTIFY */
|
||||
{ TOG_GLOBAL, 90, 0, ZERO, "ONOTICE", 1 }, /* ircd has /notice @#channel */
|
||||
#ifdef TRIVIA
|
||||
{ CHR_PROC, 80, 0, (&triv_qchar), "QCHAR" }, /* use <qchar> as mask char when displaying answer */
|
||||
{ INT_PROC, 80, 1, (&triv_qdelay), "QDELAY", 3600 }, /* seconds between each question */
|
||||
{ STR_PROC, 80, 0, (&triv_qfile), "QFILE" }, /* load questions from <qfile> */
|
||||
{ CHR_PROC, 80, 0, CHRPROC(triv_qchar), "QCHAR" }, /* use <qchar> as mask char when displaying answer */
|
||||
{ INT_PROC, 80, 1, INTPROC(triv_qdelay), "QDELAY", 3600 }, /* seconds between each question */
|
||||
{ STR_PROC, 80, 0, STRPROC(triv_qfile), "QFILE" }, /* load questions from <qfile> */
|
||||
#endif /* TRIVIA */
|
||||
#ifdef CTCP
|
||||
{ TOG_GLOBAL, 80, 0, ZERO, "RF", 1 }, /* random ctcp finger reply */
|
||||
{ TOG_GLOBAL, 80, 0, ZERO, "RV", 1 }, /* random ctcp version reply */
|
||||
#endif /* CTCP */
|
||||
#ifdef SEEN
|
||||
{ STR_PROC, 90, 0, (&seenfile), "SEENFILE" }, /* load/save seen database from <seenfile> */
|
||||
{ STR_PROC, 90, 0, STRPROC(seenfile), "SEENFILE" }, /* load/save seen database from <seenfile> */
|
||||
#endif /* SEEN */
|
||||
{ STR_GLOBAL, 80, 0, NULL, "SERVERGROUP" }, /* connect bot to a certain group of servers */
|
||||
{ STR_GLOBAL, 80, 0, VNULL, "SERVERGROUP" }, /* connect bot to a certain group of servers */
|
||||
{ TOG_GLOBAL, 90, 0, ZERO, "SPY", 1 }, /* send info about executed commands to status channel */
|
||||
{ STR_GLOBAL, 90, 0, NULL, "UMODES" }, /* send these modes on connect */
|
||||
{ STR_GLOBAL, 90, 0, VNULL, "UMODES" }, /* send these modes on connect */
|
||||
#ifdef UPTIME
|
||||
{ STR_PROC, 100, 0, (&uptimehost), "UPHOST" }, /* send uptime packets to <uphost> */
|
||||
{ STR_PROC, 100, 0, (&uptimenick), "UPNICK" }, /* send <upnick> as identifier instead of bots nick */
|
||||
{ INT_PROC, 100, 0, (&uptimeport), "UPPORT", 65535 }, /* send packets to port <upport> */
|
||||
{ STR_PROC, 100, 0, STRPROC(uptimehost), "UPHOST" }, /* send uptime packets to <uphost> */
|
||||
{ STR_PROC, 100, 0, STRPROC(uptimenick), "UPNICK" }, /* send <upnick> as identifier instead of bots nick */
|
||||
{ INT_PROC, 100, 0, INTPROC(uptimeport), "UPPORT", 65535 }, /* send packets to port <upport> */
|
||||
#endif /* UPTIME */
|
||||
{ STR_GLOBAL, 90, 0, NULL, "USERFILE" }, /* what file to load/save userlist from/to */
|
||||
{ STR_GLOBAL, 90, 0, NULL, "VIRTUAL", 0, (&var_resolve_host) }, /* visual host */
|
||||
{ STR_GLOBAL, 90, 0, VNULL, "USERFILE" }, /* what file to load/save userlist from/to */
|
||||
{ STR_GLOBAL, 90, 0, VNULL, "VIRTUAL", 0, (&var_resolve_host) }, /* visual host */
|
||||
#ifdef WEB
|
||||
{ INT_PROC, 100, 0, (&webport), "WEBPORT", 65535 }, /* httpd should listen on... */
|
||||
{ INT_PROC, 100, 0, INTPROC(webport), "WEBPORT", 65535 }, /* httpd should listen on... */
|
||||
#endif /* WEB */
|
||||
#ifdef WINGATE
|
||||
{ STR_GLOBAL, 90, 0, NULL, "WINGATE", 0, (&var_resolve_host) }, /* wingate hostname */
|
||||
{ STR_GLOBAL, 90, 0, VNULL, "WINGATE", 0, (&var_resolve_host) }, /* wingate hostname */
|
||||
{ INT_GLOBAL, 90, 0, ZERO, "WINGPORT", 65535 }, /* wingate port */
|
||||
#endif /* WINGATE */
|
||||
{ 0, }};
|
||||
|
||||
@ -82,7 +82,12 @@ typedef struct
|
||||
|
||||
typedef struct DEFstruct
|
||||
{
|
||||
union
|
||||
{
|
||||
int id;
|
||||
void *func;
|
||||
|
||||
} v;
|
||||
char *idstr;
|
||||
|
||||
} DEFstruct;
|
||||
@ -168,7 +173,16 @@ typedef struct Setting
|
||||
uchar type;
|
||||
uchar uaccess; /* user access to touch/view this setting */
|
||||
short min;
|
||||
void *setto; /* type-casted to whatever */
|
||||
union
|
||||
{
|
||||
int num;
|
||||
int *numptr;
|
||||
char chr;
|
||||
char *str;
|
||||
char **strptr;
|
||||
|
||||
} v;
|
||||
//void *setto; /* type-casted to whatever */
|
||||
char *name;
|
||||
int max;
|
||||
void (*func)(const struct Setting *);
|
||||
|
||||
@ -173,8 +173,7 @@ int tcl_parse_jump(char *from, char *rest, Hook *hook)
|
||||
Tcl_GetIntFromObj(energymech_tcl,tcl_result,&i);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (energymech_tcl->result && *energymech_tcl->result)
|
||||
debug("(tcl_parse_jump) result = %s\n",nullstr(energymech_tcl->result));
|
||||
debug("(tcl_parse_jump) result = %i\n",i);
|
||||
#endif /* DEBUG */
|
||||
return(i);
|
||||
}
|
||||
@ -199,8 +198,7 @@ void tcl_dcc_complete(Client *client, int cps)
|
||||
Tcl_ObjSetVar2(energymech_tcl,vname,NULL,obj,TCL_GLOBAL_ONLY);
|
||||
Tcl_VarEval(energymech_tcl,hook->self," $_filetarget $_filename $_cps",NULL);
|
||||
#ifdef DEBUG
|
||||
if (energymech_tcl->result && *energymech_tcl->result)
|
||||
debug("(tcl_dcc_complete) result = %s\n",nullstr(energymech_tcl->result));
|
||||
debug("(tcl_dcc_complete) filetarget %s, filename %s\n",client->whom,client->filename);
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
}
|
||||
@ -476,8 +474,7 @@ int tcl_dns_jump(char *host, char *resolved, Hook *hook)
|
||||
Tcl_GetIntFromObj(energymech_tcl,tcl_result,&i);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (energymech_tcl->result && *energymech_tcl->result)
|
||||
debug("(tcl_dns_jump) result = %s\n",nullstr(energymech_tcl->result));
|
||||
debug("(tcl_dns_jump) result = %i\n",i);
|
||||
#endif /* DEBUG */
|
||||
return(i);
|
||||
}
|
||||
|
||||
@ -716,7 +716,7 @@ User *add_user(char *handle, char *pass, int axs)
|
||||
#endif /* DEBUG */
|
||||
|
||||
set_mallocdoer(add_user);
|
||||
user = (User*)Calloc(sizeof(User) + Strlen2(handle,pass));
|
||||
user = (User*)Calloc(sizeof(User) + Strlen(handle,pass,NULL)); // Strlen() tolerates pass being NULL, Strlen2() does not.
|
||||
user->x.x.access = axs;
|
||||
user->next = current->userlist;
|
||||
current->userlist = user;
|
||||
|
||||
@ -87,7 +87,7 @@ void set_binarydefault(UniVar *dst)
|
||||
int i;
|
||||
|
||||
for(i=0;VarName[i].name;i++)
|
||||
dst[i].str_var = VarName[i].setto;
|
||||
dst[i].str_var = VarName[i].v.str;
|
||||
}
|
||||
|
||||
void delete_vars(UniVar *vars, int which)
|
||||
@ -388,7 +388,7 @@ second_pass:
|
||||
|
||||
varval = (IsProc(i)) ? current->setting[i].proc_var : &univar[i];
|
||||
|
||||
sz = Strlen2(tmp,VarName[i].name);
|
||||
sz = Strlen2(tmp,VarName[i].name); // VarName[i].name is never NULL
|
||||
|
||||
if (IsStr(i))
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user