Merge pull request #34 from joonicks/joonix-dev

reorganizing3
This commit is contained in:
joonicks
2018-04-04 08:57:40 +02:00
committed by GitHub
24 changed files with 182 additions and 142 deletions

4
configure vendored
View File

@@ -1247,7 +1247,7 @@ fi
# #
def_perl='#undef PERL' def_perl='#undef PERL'
unset ans unset ans
$out $ac_n "[ ALPHA] Perl scripting support? .................... [y/N] "$ac_c $out $ac_n "[ ALPHA] Scripting with Perl? ....................... [y/N] "$ac_c
if [ "$has_perl" = no ]; then if [ "$has_perl" = no ]; then
$out 'no (unsupported)' $out 'no (unsupported)'
else else
@@ -1375,6 +1375,8 @@ s%@gdbflag@%$cc_g_flag%;
/@L_PERL@/ { s,@L_PERL@,$L_PERL,; }; /@L_PERL@/ { s,@L_PERL@,$L_PERL,; };
/@PYINCLUDE@/ { s,@PYINCLUDE@,$incpython,; }; /@PYINCLUDE@/ { s,@PYINCLUDE@,$incpython,; };
/@TCLINCLUDE@/ { s,@TCLINCLUDE@,$inctcl,; }; /@TCLINCLUDE@/ { s,@TCLINCLUDE@,$inctcl,; };
s|@MD5_C@|$MD5_C|;
s|@SHA_C@|$SHA_C|;
s|@MD5_O@|$MD5_O|; s|@MD5_O@|$MD5_O|;
s|@SHA_O@|$SHA_O|; s|@SHA_O@|$SHA_O|;
s%@oc@%$objcomment%; s%@oc@%$objcomment%;

View File

@@ -84,12 +84,12 @@ clean:
$(INSTALLNAME): $(OFILES) $(INSTALLNAME): $(OFILES)
$(CROSS_COMPILE)$(CC) $(LFLAGS) -o $(INSTALLNAME) $(OFILES) $(LPROF) $(LIBS) $(LDSCRIPT) $(L_PERL) $(CROSS_COMPILE)$(CC) $(LFLAGS) -o $(INSTALLNAME) $(OFILES) $(LPROF) $(LIBS) $(LDSCRIPT) $(L_PERL)
@oc@ $(CROSS_COMPILE)objcopy -R .note -R .comment $(INSTALLNAME) @oc@ $(CROSS_COMPILE)objcopy -R .note -R .comment -R .got -R .got.plt $(INSTALLNAME)
@sz@ size $(INSTALLNAME) @sz@ size $(INSTALLNAME)
$(INSTALLNAME)-static: $(OFILES) $(INSTALLNAME)-static: $(OFILES)
$(CROSS_COMPILE)$(CC) $(LFLAGS) -o $(INSTALLNAME) $(OFILES) $(LPROF) $(LIBS) $(LDSCRIPT) $(L_PERL) -static $(CROSS_COMPILE)$(CC) $(LFLAGS) -o $(INSTALLNAME) $(OFILES) $(LPROF) $(LIBS) $(LDSCRIPT) $(L_PERL) -static
@oc@ $(CROSS_COMPILE)objcopy -R .note -R .comment $(INSTALLNAME) @oc@ $(CROSS_COMPILE)objcopy -R .note -R .comment -R .got -R .got.plt $(INSTALLNAME)
@sz@ size $(INSTALLNAME) @sz@ size $(INSTALLNAME)
@@ -104,12 +104,12 @@ mega-install: mega $(SRCFILES) $(INCS) usage.h
$(MV) $(INSTALLNAME) $(INSTALLDIR) $(MV) $(INSTALLNAME) $(INSTALLDIR)
mega: $(SRCFILES) $(INCS) usage.h mega: $(SRCFILES) $(INCS) usage.h
$(CROSS_COMPILE)$(CC) $(CFLAGS) -o $(INSTALLNAME) mega.c $(LPROF) $(LIBS) $(LDSCRIPT) $(PYINCLUDE) $(TCLINCLUDE) $(I_PERL) $(L_PERL) $(CROSS_COMPILE)$(CC) $(CFLAGS) -o $(INSTALLNAME) mega.c -DGENDATE="`./gencmd date`" -I. $(LPROF) $(LIBS) $(LDSCRIPT) $(PYINCLUDE) $(TCLINCLUDE) $(I_PERL) $(L_PERL)
@oc@ $(CROSS_COMPILE)objcopy -R .note -R .comment $(INSTALLNAME) @oc@ $(CROSS_COMPILE)objcopy -R .note -R .comment $(INSTALLNAME)
@sz@ size $(INSTALLNAME) @sz@ size $(INSTALLNAME)
mega-static: $(SRCFILES) $(INCS) usage.h mega-static: $(SRCFILES) $(INCS) usage.h
$(CROSS_COMPILE)$(CC) $(CFLAGS) -o $(INSTALLNAME) mega.c $(LPROF) $(LIBS) $(LDSCRIPT) $(PYINCLUDE) $(TCLINCLUDE) $(I_PERL) $(L_PERL) -static $(CROSS_COMPILE)$(CC) $(CFLAGS) -o $(INSTALLNAME) mega.c -DGENDATE="`./gencmd date`" -I. $(LPROF) $(LIBS) $(LDSCRIPT) $(PYINCLUDE) $(TCLINCLUDE) $(I_PERL) $(L_PERL) -static
@oc@ $(CROSS_COMPILE)objcopy -R .note -R .comment $(INSTALLNAME) @oc@ $(CROSS_COMPILE)objcopy -R .note -R .comment $(INSTALLNAME)
@sz@ size $(INSTALLNAME) @sz@ size $(INSTALLNAME)
@@ -189,7 +189,7 @@ kicksay.o: kicksay.c $(INCS)
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF) $(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
main.o: main.c $(INCS) main.o: main.c $(INCS)
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF) $(PYINCLUDE) $(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< -DGENDATE="`./gencmd date`" $(CPROF) $(PYINCLUDE)
net.o: net.c $(INCS) net.o: net.c $(INCS)
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF) $(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)

View File

@@ -61,10 +61,10 @@ char pctab[] =
char *cipher(char *arg) char *cipher(char *arg)
{ {
static char res[40]; static char res[40];
ulong B1a,B2a,B3a,B4a; uint32_t B1a,B2a,B3a,B4a;
ulong B1b,B2b,B3b,B4b; uint32_t B1b,B2b,B3b,B4b;
uchar *ptr; uchar *ptr;
ulong R1; uint32_t R1;
int i; int i;
if (!arg || !*arg) if (!arg || !*arg)

View File

@@ -574,7 +574,7 @@ ChanUser *find_chanuser(Chan *chan, const char *nick)
return(NULL); return(NULL);
} }
void remove_chanuser(Chan *chan, char *nick) void remove_chanuser(Chan *chan, const char *nick)
{ {
ChanUser *cu,**pp; ChanUser *cu,**pp;
uchar ni; uchar ni;
@@ -786,7 +786,7 @@ void do_channels(COMMAND_ARGS)
to_user(from,ERR_NOCHANNELS); to_user(from,ERR_NOCHANNELS);
return; return;
} }
table_buffer("\037channel\037\t \037@\037\t\037users\037\t\037ops\037\t\037voiced\037\t\037modes\037"); table_buffer(str_underline("channel") "\t" str_underline("@") "\t" str_underline("users") "\t" str_underline("ops") "\t" str_underline("voiced") "\t" str_underline("modes"));
for(chan=current->chanlist;chan;chan=chan->next) for(chan=current->chanlist;chan;chan=chan->next)
{ {
p = stringcpy(text,chan->name); p = stringcpy(text,chan->name);

View File

@@ -589,10 +589,6 @@ extern char __mx_opts[];
#endif /* MAIN_C */ #endif /* MAIN_C */
#ifndef ulong
#define ulong unsigned long
#endif
#ifndef uchar #ifndef uchar
#define uchar unsigned char #define uchar unsigned char
#endif #endif

View File

@@ -566,7 +566,7 @@ int try_server(Server *sp, char *hostname)
#ifdef RAWDNS #ifdef RAWDNS
char temphost[NAMEBUF]; char temphost[NAMEBUF];
char *host; char *host;
ulong ip; uint32_t ip;
#endif /* RAWDNS */ #endif /* RAWDNS */
if (!hostname) if (!hostname)
@@ -758,10 +758,10 @@ void register_with_server(void)
#ifdef SCRIPTING #ifdef SCRIPTING
int sub_compile_timer(int limit, ulong *flags1, ulong *flags2, char *args) int sub_compile_timer(int limit, uint32_t *flags1, uint32_t *flags2, char *args)
{ {
char *s,*dash; char *s,*dash;
ulong f; uint32_t f;
int n,hi,lo; int n,hi,lo;
*flags1 = 0; *flags1 = 0;
@@ -855,12 +855,12 @@ typedef struct
{ {
time_t last; time_t last;
time_t next; time_t next;
ulong second1:30; uint32_t second1:30;
ulong second2:30; uint32_t second2:30;
ulong minute1:30; uint32_t minute1:30;
ulong minute2:30; uint32_t minute2:30;
ulong hour:24; uint32_t hour:24;
ulong weekday:7; uint32_t weekday:7;
} HookTimer; } HookTimer;

View File

@@ -229,7 +229,7 @@ void parse_dcc(Client *client)
if (client->flags & DCC_RECV) if (client->flags & DCC_RECV)
{ {
char bigtemp[4096]; char bigtemp[4096];
ulong where; uint32_t where;
do do
{ {
@@ -259,7 +259,7 @@ void parse_dcc(Client *client)
} }
if (client->flags & DCC_SEND) if (client->flags & DCC_SEND)
{ {
ulong where; uint32_t where;
client->lasttime = now; client->lasttime = now;
s = client->inputcount; s = client->inputcount;
@@ -421,7 +421,7 @@ void ctcp_dcc(char *from, char *to, char *rest)
Client *client; Client *client;
User *user; User *user;
char *addr,*port,ip_addr[20]; char *addr,*port,ip_addr[20];
ulong longip; uint32_t longip;
int x; int x;
#ifdef DCC_FILE #ifdef DCC_FILE
char *filename; char *filename;

View File

@@ -389,10 +389,10 @@ void memreset(void)
} }
} }
LS void *mem_lowptr; LS const void *mem_lowptr;
LS void *mem_hiptr; LS const void *mem_hiptr;
void memtouch(void *addr) void memtouch(const void *addr)
{ {
aMEA *mp; aMEA *mp;
int i; int i;
@@ -1245,19 +1245,19 @@ typedef struct
{ {
time_t last; time_t last;
time_t next; time_t next;
ulong second1; //:30; uint32_t second1; //:30;
ulong second2; //:30; uint32_t second2; //:30;
ulong minute1; //:30; uint32_t minute1; //:30;
ulong minute2; //:30; uint32_t minute2; //:30;
ulong hour; //:24; uint32_t hour; //:24;
ulong weekday; //:7; uint32_t weekday; //:7;
} HookTimer; } HookTimer;
#endif /* 0 */ #endif /* 0 */
char binstr[33]; char binstr[33];
char *ulong2bin(int limit, ulong x) char *uint32tobin(int limit, uint32_t x)
{ {
char *dst = binstr; char *dst = binstr;
int n; int n;
@@ -1296,12 +1296,12 @@ void debug_scripthook(void)
if (h->flags == HOOK_TIMER) if (h->flags == HOOK_TIMER)
{ {
debug(" ; timer\t\t"mx_pfmt"\n",(mx_ptr)h->type.timer); debug(" ; timer\t\t"mx_pfmt"\n",(mx_ptr)h->type.timer);
debug(" ; timer.second1\t%s ( 0..29)\n",ulong2bin(30,h->type.timer->second1)); debug(" ; timer.second1\t%s ( 0..29)\n",uint32tobin(30,h->type.timer->second1));
debug(" ; timer.second2\t%s (30..59)\n",ulong2bin(30,h->type.timer->second2)); debug(" ; timer.second2\t%s (30..59)\n",uint32tobin(30,h->type.timer->second2));
debug(" ; timer.minute1\t%s ( 0..29)\n",ulong2bin(30,h->type.timer->minute1)); debug(" ; timer.minute1\t%s ( 0..29)\n",uint32tobin(30,h->type.timer->minute1));
debug(" ; timer.minute2\t%s (30..59)\n",ulong2bin(30,h->type.timer->minute2)); debug(" ; timer.minute2\t%s (30..59)\n",uint32tobin(30,h->type.timer->minute2));
debug(" ; timer.hour\t\t%s (0..23)\n",ulong2bin(24,h->type.timer->hour)); debug(" ; timer.hour\t\t%s (0..23)\n",uint32tobin(24,h->type.timer->hour));
debug(" ; timer.weekday\t%s (0..6)\n",ulong2bin(7,h->type.timer->weekday)); debug(" ; timer.weekday\t%s (0..6)\n",uint32tobin(7,h->type.timer->weekday));
} }
debug(" ; self\t\t\"%s\"\n",nullstr(h->self)); debug(" ; self\t\t\"%s\"\n",nullstr(h->self));
if (h->next) if (h->next)

View File

@@ -30,22 +30,22 @@
#include "text.h" #include "text.h"
#include "mcmd.h" #include "mcmd.h"
#define unpack_ushort(x) (((x)[0] << 8) | ((x)[1])) #define unpack_uint16_t(x) (((x)[0] << 8) | ((x)[1]))
#define unpack_ulong(x) (((x)[0] << 24) | ((x)[1] << 16) | ((x)[2] << 8) | ((x)[3])) #define unpack_uint32_t(x) (((x)[0] << 24) | ((x)[1] << 16) | ((x)[2] << 8) | ((x)[3]))
typedef struct dnsType typedef struct dnsType
{ {
ushort type; uint16_t type;
ushort class; uint16_t class;
} dnsType; } dnsType;
typedef struct dnsRType typedef struct dnsRType
{ {
ushort type; /* &0 */ uint16_t type; /* &0 */
ushort class; /* &2 */ uint16_t class; /* &2 */
ulong ttl; /* &4 */ uint32_t ttl; /* &4 */
ushort rdlength; /* &8 */ uint16_t rdlength; /* &8 */
} dnsRType; } dnsRType;
@@ -112,7 +112,7 @@ struct in_addr dnsroot_lookup(const char *hostname)
const char *get_dns_token(const char *src, const char *packet, char *dst, int sz) const char *get_dns_token(const char *src, const char *packet, char *dst, int sz)
{ {
const char *endsrc = NULL; const char *endsrc = NULL;
ushort offptr; uint16_t offptr;
int tsz; int tsz;
int dot = 0; int dot = 0;
@@ -268,7 +268,7 @@ void parse_query(int psz, dnsQuery *query)
{ {
/* skip QNAME */ /* skip QNAME */
src = get_dns_token(src,(const char *)query,token,psz); src = get_dns_token(src,(const char *)query,token,psz);
/* skip (ushort)QTYPE and (ushort)QCLASS */ /* skip (uint16_t)QTYPE and (uint16_t)QCLASS */
src += 4; src += 4;
} }
@@ -283,8 +283,8 @@ void parse_query(int psz, dnsQuery *query)
debug("(parse_query) %i: answer = %s\n",dns->id,token); debug("(parse_query) %i: answer = %s\n",dns->id,token);
#endif /* DEBUG */ #endif /* DEBUG */
if ((unpack_ushort(&rtyp[0]) == DNS_TYPE_CNAME) && if ((unpack_uint16_t(&rtyp[0]) == DNS_TYPE_CNAME) &&
(unpack_ushort(&rtyp[2]) == DNS_CLASS_IN)) (unpack_uint16_t(&rtyp[2]) == DNS_CLASS_IN))
{ {
get_dns_token(src,(const char *)query,token2,psz); get_dns_token(src,(const char *)query,token2,psz);
#ifdef DEBUG #ifdef DEBUG
@@ -297,9 +297,9 @@ void parse_query(int psz, dnsQuery *query)
dns->cname = stringdup(token2); dns->cname = stringdup(token2);
} }
if ((unpack_ushort(&rtyp[0]) == DNS_TYPE_A) && if ((unpack_uint16_t(&rtyp[0]) == DNS_TYPE_A) &&
(unpack_ushort(&rtyp[2]) == DNS_CLASS_IN) && (unpack_uint16_t(&rtyp[2]) == DNS_CLASS_IN) &&
(unpack_ushort(&rtyp[8]) == 4)) (unpack_uint16_t(&rtyp[8]) == 4))
{ {
ip = get_stored_ip(src); ip = get_stored_ip(src);
if (dns->auth && !stringcasecmp(dns->auth->hostname,token)) if (dns->auth && !stringcasecmp(dns->auth->hostname,token))
@@ -331,7 +331,7 @@ void parse_query(int psz, dnsQuery *query)
return; return;
} }
} }
src += unpack_ushort(&rtyp[8]); src += unpack_uint16_t(&rtyp[8]);
n--; n--;
} }
@@ -346,8 +346,8 @@ void parse_query(int psz, dnsQuery *query)
src = get_dns_token(src,(const char*)query,token,psz); src = get_dns_token(src,(const char*)query,token,psz);
rtyp = src; rtyp = src;
src += 10; src += 10;
if ((unpack_ushort(&rtyp[0]) == DNS_TYPE_NS) && if ((unpack_uint16_t(&rtyp[0]) == DNS_TYPE_NS) &&
(unpack_ushort(&rtyp[2]) == DNS_CLASS_IN)) (unpack_uint16_t(&rtyp[2]) == DNS_CLASS_IN))
{ {
dnsAuthority *da; dnsAuthority *da;
@@ -384,11 +384,11 @@ void parse_query(int psz, dnsQuery *query)
else else
{ {
debug("(parse_query) DNS TYPE %s(%i), CLASS %i, size %i\n", debug("(parse_query) DNS TYPE %s(%i), CLASS %i, size %i\n",
type_textlist[unpack_ushort(&rtyp[0])],unpack_ushort(&rtyp[0]), type_textlist[unpack_uint16_t(&rtyp[0])],unpack_uint16_t(&rtyp[0]),
unpack_ushort(&rtyp[2]),unpack_ushort(&rtyp[8])); unpack_uint16_t(&rtyp[2]),unpack_uint16_t(&rtyp[8]));
} }
#endif /* DEBUG */ #endif /* DEBUG */
src += unpack_ushort(&rtyp[8]); src += unpack_uint16_t(&rtyp[8]);
n--; n--;
} }
@@ -402,9 +402,9 @@ void parse_query(int psz, dnsQuery *query)
rtyp = src; rtyp = src;
src += 10; src += 10;
if ( (unpack_ushort(&rtyp[0]) == DNS_TYPE_A) && if ( (unpack_uint16_t(&rtyp[0]) == DNS_TYPE_A) &&
(unpack_ushort(&rtyp[2]) == DNS_CLASS_IN) && (unpack_uint16_t(&rtyp[2]) == DNS_CLASS_IN) &&
(unpack_ushort(&rtyp[8]) == 4)) (unpack_uint16_t(&rtyp[8]) == 4))
{ {
ip = get_stored_ip(src); ip = get_stored_ip(src);
if (dns->auth && !stringcasecmp(dns->auth->hostname,token)) if (dns->auth && !stringcasecmp(dns->auth->hostname,token))
@@ -415,7 +415,7 @@ void parse_query(int psz, dnsQuery *query)
debug("(parse_query) resources: %s = %s\n",token,inet_ntoa(*ip)); debug("(parse_query) resources: %s = %s\n",token,inet_ntoa(*ip));
#endif /* DEBUG */ #endif /* DEBUG */
} }
src += unpack_ushort(&rtyp[8]); src += unpack_uint16_t(&rtyp[8]);
n--; n--;
} }
@@ -717,9 +717,9 @@ int read_dnsroot(char *line)
/* /*
* find the IP quickly * find the IP quickly
*/ */
ulong rawdns_get_ip(const char *host) uint32_t rawdns_get_ip(const char *host)
{ {
ulong ip; uint32_t ip;
if ((ip = inet_addr(host)) == INADDR_NONE) if ((ip = inet_addr(host)) == INADDR_NONE)
{ {
@@ -852,7 +852,7 @@ void do_dns(COMMAND_ARGS)
* on_msg checks: CARGS and GAXS * on_msg checks: CARGS and GAXS
*/ */
char *host,*res,*src,*dst,*dot; char *host,*res,*src,*dst,*dot;
ulong ip; uint32_t ip;
/* to date, all hostnames contain atleast one dot */ /* to date, all hostnames contain atleast one dot */
if ((STRCHR(rest,'.'))) if ((STRCHR(rest,'.')))

View File

@@ -55,7 +55,7 @@ struct
int pass; int pass;
const char *name; const char *name;
const char *func; const char *func;
ulong flags; uint32_t flags;
char *cmdarg; char *cmdarg;
} pre_mcmd[] = } pre_mcmd[] =
@@ -303,7 +303,7 @@ void make_mcmd(void)
} }
if (pass == __struct_acces) if (pass == __struct_acces)
{ {
to_file(fd,"LS OnMsg_access acmd[] = \n{\n"); to_file(fd,"LS OnMsg_access acmd[] =\n{\n");
} }
for(i=0;pre_mcmd[i].name;i++) for(i=0;pre_mcmd[i].name;i++)
{ {
@@ -482,6 +482,33 @@ void test_help(void)
exit(0); exit(0);
} }
const char *month[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
int hourampm[24] = { 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
void datestamp(void)
{
char str[100],*th;
struct tm *t;
time_t now;
time(&now);
t = localtime(&now);
switch(t->tm_mday)
{
case 31:
case 21:
case 1:th="st";break;
case 22:
case 2:th="nd";break;
case 23:
case 3:th="rd";break;
default:th="th";
}
to_file(1,"\"%s %i%s, %i at %i:%02i%s\"",month[t->tm_mon],t->tm_mday,th,
t->tm_year + 1900,hourampm[t->tm_hour],t->tm_min,(t->tm_hour <= 11) ? "am" : "pm");
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
@@ -494,5 +521,8 @@ int main(int argc, char **argv)
if (argv[1] && strcmp(argv[1],"testhelp") == 0) if (argv[1] && strcmp(argv[1],"testhelp") == 0)
test_help(); test_help();
if (argv[1] && strcmp(argv[1],"date") == 0)
datestamp();
return(0); return(0);
} }

View File

@@ -69,6 +69,11 @@ BEG const char SPYSTR_URL[] MDEF("url");
BEG const char STR_MECHRESET[] MDEF("MECHRESET="); BEG const char STR_MECHRESET[] MDEF("MECHRESET=");
BEG const char FMT_6XSTRTAB[] MDEF("%s\t%s\t%s\t%s\t%s\t%s");
#define FMT_4XSTRTAB &FMT_6XSTRTAB[6]
#define FMT_3XSTRTAB &FMT_6XSTRTAB[9]
#define FMT_PLAIN &FMT_6XSTRTAB[15]
BEG Mech *botlist MDEF(NULL); BEG Mech *botlist MDEF(NULL);
BEG Mech *current; BEG Mech *current;
@@ -247,9 +252,9 @@ BEG int uptimeport MDEF(9969); /* proc var */
BEG char *uptimehost MDEF(NULL); /* proc var */ BEG char *uptimehost MDEF(NULL); /* proc var */
BEG char *uptimenick MDEF(NULL); /* proc var */ BEG char *uptimenick MDEF(NULL); /* proc var */
BEG int uptimesock; BEG int uptimesock;
BEG ulong uptimeip MDEF((ulong)-1); BEG uint32_t uptimeip MDEF((uint32_t)-1);
BEG ulong uptimecookie; BEG uint32_t uptimecookie;
BEG ulong uptimeregnr MDEF(0); BEG uint32_t uptimeregnr MDEF(0);
BEG time_t uptimelast MDEF(0); BEG time_t uptimelast MDEF(0);
BEG const char *defaultuptimehost MDEF("uptime.energymech.net"); BEG const char *defaultuptimehost MDEF("uptime.energymech.net");

16
src/h.h
View File

@@ -161,7 +161,7 @@ void purge_banlist(Chan *);
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);
ChanUser *find_chanuser(Chan *, const char *); ChanUser *find_chanuser(Chan *, const char *);
void remove_chanuser(Chan *, char *); void remove_chanuser(Chan *, const char *);
void make_chanuser(char *, char *); void make_chanuser(char *, char *);
void purge_chanusers(Chan *); void purge_chanusers(Chan *);
char *get_nuh(ChanUser *); char *get_nuh(ChanUser *);
@@ -198,8 +198,8 @@ Server *find_server(int id);
int try_server(Server *sp, char *hostname); int try_server(Server *sp, char *hostname);
void connect_to_server(void); void connect_to_server(void);
void register_with_server(void); void register_with_server(void);
int sub_compile_timer(int limit, ulong *flags1, ulong *flags2, char *args); int sub_compile_timer(int, uint32_t *, uint32_t *, char *);
int compile_timer(HookTimer *timer, char *rest); int compile_timer(HookTimer *, char *);
void update(SequenceTime *this); void update(SequenceTime *this);
void parse_server_input(void); void parse_server_input(void);
void do_version(COMMAND_ARGS) __page(CMD1_SEG); void do_version(COMMAND_ARGS) __page(CMD1_SEG);
@@ -239,7 +239,7 @@ void strflags(char *dst, const DEFstruct *flagsstruct, int flags);
const char *strdef(const DEFstruct *dtab, int num); const char *strdef(const DEFstruct *dtab, int num);
const char *funcdef(const DEFstruct *dtab, void *func); const char *funcdef(const DEFstruct *dtab, void *func);
void memreset(void); void memreset(void);
void memtouch(void *addr); void memtouch(const void *addr);
const char *proc_lookup(void *addr, int size); const char *proc_lookup(void *addr, int size);
char *atime(time_t when); char *atime(time_t when);
void debug_server(Server *sp, char *pad); void debug_server(Server *sp, char *pad);
@@ -249,7 +249,7 @@ void debug_botinfo(BotInfo *binfo);
void debug_botnet(void); void debug_botnet(void);
void debug_core(void); void debug_core(void);
void debug_rawdns(void); void debug_rawdns(void);
char *ulong2bin(int limit, ulong x); char *uint32tobin(int limit, uint32_t x);
void debug_scripthook(void); void debug_scripthook(void);
void run_debug(void); void run_debug(void);
int wrap_debug(void); int wrap_debug(void);
@@ -271,7 +271,7 @@ void select_rawdns(void);
void process_rawdns(void); void process_rawdns(void);
char *poll_rawdns(char *hostname); char *poll_rawdns(char *hostname);
int read_dnsroot(char *line); int read_dnsroot(char *line);
ulong rawdns_get_ip(const char *host); uint32_t rawdns_get_ip(const char *host);
void do_dnsroot(COMMAND_ARGS) __page(CMD1_SEG); void do_dnsroot(COMMAND_ARGS) __page(CMD1_SEG);
void do_dnsserver(COMMAND_ARGS) __page(CMD1_SEG); void do_dnsserver(COMMAND_ARGS) __page(CMD1_SEG);
void do_dns(COMMAND_ARGS) __page(CMD1_SEG); void do_dns(COMMAND_ARGS) __page(CMD1_SEG);
@@ -517,7 +517,7 @@ void parse_346(char *from, char *rest);
void parse_348(char *from, char *rest); void parse_348(char *from, char *rest);
void parse_368(char *from, char *rest); void parse_368(char *from, char *rest);
void parse_005(char *from, char *rest); void parse_005(char *from, char *rest);
ulong stringhash(char *s); uint32_t stringhash(char *s);
void parseline(char *rest); void parseline(char *rest);
/* partyline.c */ /* partyline.c */
@@ -620,7 +620,7 @@ void do_clearshit(COMMAND_ARGS) __page(CMD1_SEG);
/* socket.c */ /* socket.c */
LS ulong get_ip(const char *) __page(CORE_SEG); LS uint32_t get_ip(const char *) __page(CORE_SEG);
LS void SockFlags(int) __page(CORE_SEG); LS void SockFlags(int) __page(CORE_SEG);
LS int SockOpts(void) __page(CORE_SEG); LS int SockOpts(void) __page(CORE_SEG);
LS int SockListener(int) __page(CORE_SEG); LS int SockListener(int) __page(CORE_SEG);

View File

@@ -164,7 +164,7 @@ void do_kicksay(COMMAND_ARGS)
table_buffer("\037channel\037\t\037action\037\t\037string\037\t\037kick reason\037"); table_buffer("\037channel\037\t\037action\037\t\037string\037\t\037kick reason\037");
for(kick=current->kicklist;kick;kick=kick->next) for(kick=current->kicklist;kick;kick=kick->next)
{ {
table_buffer("%s\t%s\t%s\t%s",kick->chan,ks_actions[kick->action],kick->mask,kick->reason); table_buffer(FMT_4XSTRTAB,kick->chan,ks_actions[kick->action],kick->mask,kick->reason);
} }
table_send(from,2); table_send(from,2);
return; return;

View File

@@ -142,7 +142,7 @@ char *randstring(const char *file)
LS struct LS struct
{ {
ulong sighup:1, uint32_t sighup:1,
sigint:1, sigint:1,
sigusr1:1; sigusr1:1;
@@ -985,7 +985,7 @@ int main(int argc, char **argv, char **envp)
if (!mechresetenv) if (!mechresetenv)
{ {
to_file(1,TEXT_HDR_VERS,VERSION,SRCDATE); to_file(1,TEXT_HDR_VERS,VERSION,SRCDATE);
to_file(1,TEXT_HDR_DATE); to_file(1,"Compiled on " GENDATE "\n");
to_file(1,TEXT_HDR_FEAT,__mx_opts); to_file(1,TEXT_HDR_FEAT,__mx_opts);
} }

View File

@@ -20,13 +20,13 @@
#include "ctcp.c" #include "ctcp.c"
#include "debug.c" #include "debug.c"
#include "dns.c" #include "dns.c"
#include "dynamode.c"
#include "function.c" #include "function.c"
#include "greet.c" #include "greet.c"
#include "help.c" #include "help.c"
#include "hostinfo.c" #include "hostinfo.c"
#include "irc.c" #include "irc.c"
#include "kicksay.c" #include "kicksay.c"
#include "lib/string.c"
#include "main.c" #include "main.c"
#include "net.c" #include "net.c"
#include "net_chan.c" #include "net_chan.c"

View File

@@ -243,7 +243,7 @@ void parse_mode(char *from, char *rest)
void parse_notice(char *from, char *rest) void parse_notice(char *from, char *rest)
{ {
char *ctcp,*to; char *ctcp,*to;
ulong pingtime; uint32_t pingtime;
to = chop(&rest); to = chop(&rest);
if (*rest == ':') if (*rest == ':')
@@ -1375,7 +1375,7 @@ void parse_005(char *from, char *rest)
LS const struct LS const struct
{ {
ulong hash; uint32_t hash;
short flags; short flags;
void (*func)(char *, char *); void (*func)(char *, char *);
@@ -1448,9 +1448,9 @@ LS const struct
{ 0, 0, NULL } { 0, 0, NULL }
}; };
ulong stringhash(char *s) uint32_t stringhash(char *s)
{ {
ulong hash; uint32_t hash;
int i; int i;
hash = 0; hash = 0;
@@ -1465,7 +1465,7 @@ void parseline(char *rest)
Hook *hook; Hook *hook;
#endif /* SCRIPTING */ #endif /* SCRIPTING */
char *from,*command; char *from,*command;
ulong cmdhash; uint32_t cmdhash;
int i; int i;
if (current->spy & SPYF_RAWIRC) if (current->spy & SPYF_RAWIRC)

View File

@@ -184,8 +184,9 @@ int mode_effect(Chan *chan, qMode *mode)
void push_modes(Chan *chan, int lowpri) void push_modes(Chan *chan, int lowpri)
{ {
qMode *mode; qMode *mode;
const char *srcparm;
char flaglist[32],parmlist[MSGLEN]; char flaglist[32],parmlist[MSGLEN];
char *dstflag,*dstparm,*srcparm,lastmode; char *dstflag,*dstparm,lastmode;
int n,maxmodes; int n,maxmodes;
n = (current->sendq_time - now); n = (current->sendq_time - now);
@@ -650,7 +651,7 @@ void do_banlist(COMMAND_ARGS)
s = "b"; s = "b";
#endif /* NEWBIE */ #endif /* NEWBIE */
table_buffer("%s\t%s\t%s\t%s",to,s,ban->banstring,ban->bannedby); table_buffer(FMT_4XSTRTAB,to,s,ban->banstring,ban->bannedby);
} }
table_send(from,2); table_send(from,2);
} }
@@ -661,7 +662,7 @@ void do_banlist(COMMAND_ARGS)
{ {
table_buffer(str_underline("channel") "\t" str_underline("ban mask") "\t" str_underline("set by")); table_buffer(str_underline("channel") "\t" str_underline("ban mask") "\t" str_underline("set by"));
for(ban=chan->banlist;ban;ban=ban->next) for(ban=chan->banlist;ban;ban=ban->next)
table_buffer("%s\t%s\t%s",to,ban->banstring,ban->bannedby); table_buffer(FMT_3XSTRTAB,to,ban->banstring,ban->bannedby);
table_send(from,2); table_send(from,2);
} }
else else

View File

@@ -37,7 +37,8 @@
void shit_action(Chan *chan, ChanUser *cu) void shit_action(Chan *chan, ChanUser *cu)
{ {
Shit *shit; Shit *shit;
char *nick,*fromnick; const char *nick;
char *fromnick;
char *userhost; char *userhost;
if (!chan->setting[TOG_SHIT].int_var || !chan->bot_is_op || cu->user) if (!chan->setting[TOG_SHIT].int_var || !chan->bot_is_op || cu->user)
@@ -388,7 +389,7 @@ void do_shitlist(COMMAND_ARGS)
table_buffer("\037channel\037\t\037mask\037\t\037action\037\t\037set by\037\t\037reason\037\t\037expires\037"); table_buffer("\037channel\037\t\037mask\037\t\037action\037\t\037set by\037\t\037reason\037\t\037expires\037");
for(shit=current->shitlist;shit;shit=shit->next) for(shit=current->shitlist;shit;shit=shit->next)
{ {
table_buffer("%s\t%s\t%s\t%s\t%s\t%s",shit->chan,shit->mask,shit_actions[shit->action], table_buffer(FMT_6XSTRTAB,shit->chan,shit->mask,shit_actions[shit->action],
nickcpy(NULL,shit->from),shit->reason,time2away(shit->expire)); nickcpy(NULL,shit->from),shit->reason,time2away(shit->expire));
} }
table_send(from,2); table_send(from,2);

View File

@@ -32,10 +32,10 @@
/* /*
* only include this hack if rawdns isnt compiled in * only include this hack if rawdns isnt compiled in
*/ */
ulong get_ip(const char *host) uint32_t get_ip(const char *host)
{ {
struct hostent *he; struct hostent *he;
ulong ip; uint32_t ip;
if ((ip = inet_addr(host)) == INADDR_NONE) if ((ip = inet_addr(host)) == INADDR_NONE)
{ {
@@ -46,7 +46,7 @@ ulong get_ip(const char *host)
#endif /* DEBUG */ #endif /* DEBUG */
return(-1); return(-1);
} }
ip = (ulong)((struct in_addr*)he->h_addr)->s_addr; ip = (uint32_t)((struct in_addr*)he->h_addr)->s_addr;
} }
#ifdef DEBUG #ifdef DEBUG
debug("(get_ip) %s -> %s\n",host,inet_ntoa(*((struct in_addr*)&ip))); debug("(get_ip) %s -> %s\n",host,inet_ntoa(*((struct in_addr*)&ip)));

View File

@@ -163,7 +163,7 @@ void spy_typecount(Mech *bot)
struct struct
{ {
const char *idstring; const char *idstring;
int typenum; int typenum;
} spy_source_list[] = } spy_source_list[] =
{ {
@@ -206,7 +206,8 @@ int spy_source(char *from, int *t_src, const char **src)
* *
*/ */
/*---Help:SPY:[STATUS|MESSAGE|RAWIRC|URL|[guid:|botnick:] [channel|> filename] /*
help:SPY:[STATUS|MESSAGE|RAWIRC|URL|[guid:|botnick:] [channel|> filename]
Spy on a certain source of messages. When you join DCC chat, Spy on a certain source of messages. When you join DCC chat,
the STATUS source is added by default as a spy source for you. the STATUS source is added by default as a spy source for you.
@@ -253,7 +254,7 @@ void do_spy(COMMAND_ARGS)
if (partyline_only_command(from)) if (partyline_only_command(from))
return; return;
table_buffer("\037source\037\t\037target\037"); table_buffer(str_underline("source") "\t" str_underline("target"));
for(spy=current->spylist;spy;spy=spy->next) for(spy=current->spylist;spy;spy=spy->next)
{ {
switch(spy->t_src) switch(spy->t_src)

View File

@@ -99,7 +99,7 @@ void do_info(COMMAND_ARGS)
Chan *chan; Chan *chan;
char *p; char *p;
char text[MSGLEN]; char text[MSGLEN];
ulong avg; uint32_t avg;
if (current->chanlist == NULL) if (current->chanlist == NULL)
{ {

View File

@@ -25,7 +25,7 @@ typedef union usercombo
{ {
struct struct
{ {
ulong access:8, /* access level (0-200) [0-255] */ uint32_t access:8, /* access level (0-200) [0-255] */
prot:3, /* protlevel (0-4) [0-7] */ prot:3, /* protlevel (0-4) [0-7] */
#ifdef BOTNET #ifdef BOTNET
noshare:1, /* dont share this user over botnet */ noshare:1, /* dont share this user over botnet */
@@ -42,7 +42,7 @@ typedef union usercombo
aop:1, /* auto-opping */ aop:1, /* auto-opping */
avoice:1; /* auto-voicing */ avoice:1; /* auto-voicing */
} x; } x;
ulong comboflags; uint32_t comboflags;
} usercombo; } usercombo;
@@ -50,7 +50,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);
ulong defaultaccess:8, /* defaultaccess */ uint32_t defaultaccess:8, /* defaultaccess */
dcc:1, dcc:1,
cc:1, cc:1,
pass:1, pass:1,
@@ -385,7 +385,7 @@ typedef struct Ban
time_t time; time_t time;
#ifdef IRCD_EXTENSIONS #ifdef IRCD_EXTENSIONS
ulong imode:1, uint32_t imode:1,
emode:1; emode:1;
#endif /* IRCD_EXTENSIONS */ #endif /* IRCD_EXTENSIONS */
@@ -440,8 +440,8 @@ typedef struct Chan
ChanUser *cacheuser; /* cache for find_chanuser() */ ChanUser *cacheuser; /* cache for find_chanuser() */
int limit; /* channel limit */ int limit; /* channel limit */
ulong
bot_is_op:1, /* set if the bot is opped */ uint32_t bot_is_op:1, /* set if the bot is opped */
private:1, /* channel mode: +p */ private:1, /* channel mode: +p */
secret:1, /* channel mode: +s */ secret:1, /* channel mode: +s */
moderated:1, /* channel mode: +m */ moderated:1, /* channel mode: +m */
@@ -545,7 +545,7 @@ typedef struct Mech
char *userhost; char *userhost;
int vhost_type; int vhost_type;
ulong reset:1, uint32_t reset:1,
rejoin:1, rejoin:1,
away:1; away:1;
@@ -684,7 +684,7 @@ typedef struct BotNet
struct struct
{ {
ulong pta:1, /* plain text auth */ uint32_t pta:1, /* plain text auth */
sha:1, /* SHA */ sha:1, /* SHA */
md5:1; /* MD5 */ md5:1; /* MD5 */
@@ -710,9 +710,8 @@ typedef struct NetCfg
struct NetCfg *next; struct NetCfg *next;
int guid; int guid;
ushort port; uint16_t port;
uint16_t linked; //:1;
ushort linked:1;
char *host; char *host;
char pass[2]; char pass[2];
@@ -749,12 +748,12 @@ typedef struct
{ {
time_t last; time_t last;
time_t next; time_t next;
ulong second1; //:30; uint32_t second1; //:30;
ulong second2; //:30; uint32_t second2; //:30;
ulong minute1; //:30; uint32_t minute1; //:30;
ulong minute2; //:30; uint32_t minute2; //:30;
ulong hour; //:24; uint32_t hour; //:24;
ulong weekday; //:7; uint32_t weekday; //:7;
} HookTimer; } HookTimer;
@@ -805,7 +804,7 @@ typedef struct dnsList
struct dnsList *next; struct dnsList *next;
time_t when; time_t when;
struct in_addr ip; struct in_addr ip;
ushort id; uint16_t id;
int findauth; int findauth;
dnsAuthority *auth; dnsAuthority *auth;
dnsAuthority *auth2; dnsAuthority *auth2;
@@ -816,12 +815,12 @@ typedef struct dnsList
typedef struct dnsQuery typedef struct dnsQuery
{ {
ushort qid; /* query id */ uint16_t qid; /* query id */
ushort flags; uint16_t flags;
ushort questions; uint16_t questions;
ushort answers; uint16_t answers;
ushort authorities; uint16_t authorities;
ushort resources; uint16_t resources;
} dnsQuery; } dnsQuery;

View File

@@ -25,7 +25,13 @@
* These are more or less globally used.. * These are more or less globally used..
*/ */
/*
#define FMT_PLAIN "%s" #define FMT_PLAIN "%s"
#define FMT_6XSTRTAB "%s\t%s\t%s\t%s\t%s\t%s"
#define FMT_4XSTRTAB "%s\t%s\t%s\t%s"
#define FMT_3XSTRTAB "%s\t%s\t%s"
*/
#define FMT_PLAINLINE "%s\n" #define FMT_PLAINLINE "%s\n"
#define MATCH_ALL "*" #define MATCH_ALL "*"
@@ -62,7 +68,7 @@
#define TEXT_NOTCONNECTED "(not connected)" #define TEXT_NOTCONNECTED "(not connected)"
#define TEXT_WHOMUSERLINE "%s\tu%i\t%s (idle %i min, %i sec)" #define TEXT_WHOMUSERLINE "%s\tu%i\t%s (idle %i min, %i sec)"
#define TEXT_WHOMSELFLINE "\037%s\037\t%s\t%s" #define TEXT_WHOMSELFLINE "\037%s\037\t%s\t%s"
#define TEXT_WHOMBOTLINE "%s\t%s\t%s" #define TEXT_WHOMBOTLINE FMT_3XSTRTAB
#define TEXT_WHOMBOTGUID "%s\t%s\t%s [%s] [%i]" #define TEXT_WHOMBOTGUID "%s\t%s\t%s [%s] [%i]"
/* /*
@@ -142,7 +148,6 @@
#define TEXT_XSWITCH " -X write a debug file before exit\n" #define TEXT_XSWITCH " -X write a debug file before exit\n"
#define TEXT_HDR_VERS "EnergyMech %s, %s\n" #define TEXT_HDR_VERS "EnergyMech %s, %s\n"
#define TEXT_HDR_DATE "Compiled on " __DATE__ " " __TIME__ "\n"
#define TEXT_HDR_FEAT "Features: %s\n" #define TEXT_HDR_FEAT "Features: %s\n"
#define ERR_MISSINGCONF "init: No configfile specified\n" #define ERR_MISSINGCONF "init: No configfile specified\n"

View File

@@ -38,11 +38,11 @@ typedef struct
int regnr; int regnr;
int pid; int pid;
int type; int type;
ulong cookie; uint32_t cookie;
ulong uptime; uint32_t uptime;
ulong ontime; uint32_t ontime;
ulong now; uint32_t now;
ulong sysup; uint32_t sysup;
} PackStub; } PackStub;
@@ -51,11 +51,11 @@ typedef struct
int regnr; int regnr;
int pid; int pid;
int type; int type;
ulong cookie; uint32_t cookie;
ulong uptime; uint32_t uptime;
ulong ontime; uint32_t ontime;
ulong now; uint32_t now;
ulong sysup; uint32_t sysup;
char string[512]; char string[512];
} PackUp; } PackUp;
@@ -225,7 +225,7 @@ void process_uptime(void)
struct struct
{ {
int regnr; int regnr;
ulong cookie; uint32_t cookie;
} regPack; } regPack;