Przeglądaj źródła

* Eliminated proto.h. All .c files now have their own header file.
* Still need to clean up and strip out eggmain.h/eggdrop.h


svn: 629

Bryan Drewery 22 lat temu
rodzic
commit
a08346a247
66 zmienionych plików z 770 dodań i 526 usunięć
  1. 3 2
      src/Makefile.in
  2. 4 0
      src/auth.c
  3. 11 0
      src/auth.h
  4. 2 0
      src/bg.c
  5. 9 0
      src/bg.h
  6. 10 0
      src/botcmd.c
  7. 13 0
      src/botcmd.h
  8. 10 0
      src/botmsg.c
  9. 21 0
      src/botmsg.h
  10. 9 0
      src/botnet.c
  11. 42 0
      src/botnet.h
  12. 6 0
      src/cfg.c
  13. 34 0
      src/cfg.h
  14. 10 0
      src/chanprog.c
  15. 27 0
      src/chanprog.h
  16. 13 0
      src/cmds.c
  17. 26 0
      src/cmds.h
  18. 0 23
      src/cmdt.h
  19. 4 0
      src/core_binds.c
  20. 2 1
      src/core_binds.h
  21. 2 0
      src/crypt.c
  22. 16 0
      src/crypt.h
  23. 15 0
      src/dcc.c
  24. 10 0
      src/dcc.h
  25. 4 0
      src/dccutil.c
  26. 34 0
      src/dccutil.h
  27. 6 0
      src/debug.c
  28. 9 0
      src/debug.h
  29. 3 0
      src/dns.c
  30. 10 0
      src/dns.h
  31. 4 55
      src/eggdrop.h
  32. 2 8
      src/eggmain.h
  33. 6 0
      src/flags.c
  34. 3 33
      src/garble.c
  35. 13 0
      src/garble.h
  36. 15 0
      src/main.c
  37. 13 0
      src/main.h
  38. 4 3
      src/makesettings.c
  39. 2 0
      src/match.c
  40. 10 0
      src/match.h
  41. 13 0
      src/misc.c
  42. 71 0
      src/misc.h
  43. 2 0
      src/misc_file.h
  44. 1 0
      src/mod/ctcp.mod/ctcp.c
  45. 4 0
      src/mod/module.h
  46. 1 0
      src/mod/server.mod/server.c
  47. 1 0
      src/mod/share.mod/share.c
  48. 1 0
      src/mod/transfer.mod/transfer.c
  49. 3 0
      src/mod/update.mod/update.c
  50. 20 0
      src/modules.c
  51. 6 1
      src/net.c
  52. 60 0
      src/net.h
  53. 0 395
      src/proto.h
  54. 1 0
      src/rfc1459.c
  55. 18 0
      src/rfc1459.h
  56. 2 0
      src/tcl.c
  57. 0 4
      src/tclegg.h
  58. 1 1
      src/tclhash.c
  59. 1 0
      src/tclhash.h
  60. 38 0
      src/types.h
  61. 5 0
      src/userent.c
  62. 12 0
      src/userent.h
  63. 8 0
      src/userrec.c
  64. 27 0
      src/userrec.h
  65. 13 0
      src/users.c
  66. 24 0
      src/users.h

+ 3 - 2
src/Makefile.in

@@ -18,7 +18,7 @@ OBJS = auth.o \
 	botnet.o \
 	chanprog.o \
 	cmds.o \
-	config.o \
+	cfg.o \
 	core_binds.o \
 	crypt.o \
 	dcc.o \
@@ -27,8 +27,9 @@ OBJS = auth.o \
 	dns.o \
 	egg_timer.o \
 	flags.o \
+	garble.o \
 	main.o \
-	mem.o \
+	match.o \
 	misc.o \
 	misc_file.o \
 	modules.o \

+ 4 - 0
src/auth.c

@@ -5,6 +5,10 @@
  */
 
 #include "eggmain.h"
+#include "auth.h"
+#include "misc.h"
+#include "users.h"
+#include "crypt.h"
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/wait.h>

+ 11 - 0
src/auth.h

@@ -0,0 +1,11 @@
+#ifndef _AUTH_H
+#define _AUTH_H
+
+#ifndef MAKING_MODS
+int new_auth();
+int findauth(char *);
+void removeauth(int);
+char *makehash(struct userrec *, char *);
+#endif /* !MAKING_MODS */
+
+#endif /* !_AUTH_H */

+ 2 - 0
src/bg.c

@@ -6,6 +6,8 @@
  */
 
 #include "eggmain.h"
+#include "bg.h"
+#include "main.h"
 #include <signal.h>
 
 

+ 9 - 0
src/bg.h

@@ -0,0 +1,9 @@
+#ifndef _BG_H
+#define _BG_H
+
+#ifndef MAKING_MODS
+void do_fork();
+void bg_do_split();
+#endif /* !MAKING_MODS */
+
+#endif /* !_BG_H */

+ 10 - 0
src/botcmd.c

@@ -6,6 +6,16 @@
  */
 
 #include "eggmain.h"
+#include "botcmd.h"
+#include "net.h"
+#include "misc.h"
+#include "userrec.h"
+#include "cfg.h"
+#include "dccutil.h"
+#include "cmds.h"
+#include "chanprog.h"
+#include "botmsg.h"
+#include "botnet.h"
 #include "tandem.h"
 #include "users.h"
 #include "chan.h"

+ 13 - 0
src/botcmd.h

@@ -0,0 +1,13 @@
+#ifndef _BOTCMD_H
+#define _BOTCMD_H
+
+
+#ifndef MAKING_MODS
+void bounce_simul(int, char *);
+void send_remote_simul(int, char *, char *, char *);
+void bot_share(int, char *);
+void bot_shareupdate(int, char *);
+int base64_to_int(char *);
+#endif /* !MAKING_MODS */
+
+#endif /* !_BOTCMD_H */

+ 10 - 0
src/botmsg.c

@@ -8,6 +8,15 @@
  */
 
 #include "eggmain.h"
+#include "misc.h"
+#include "net.h"
+#include "users.h"
+#include "cfg.h"
+#include "botmsg.h"
+#include "dccutil.h"
+#include "cmds.h"
+#include "chanprog.h"
+#include "botnet.h"
 #include "tandem.h"
 #include "core_binds.h"
 
@@ -550,6 +559,7 @@ void botnet_send_nkch_part(int butidx, int useridx, char *oldnick)
 /* This part of add_note is more relevant to the botnet than
  * to the notes file
  */
+extern int (*storenote)(char *from, char *to, char *msg, int idx, char *who, int bufsize);
 int add_note(char *to, char *from, char *msg, int idx, int echo)
 {
   int status, i, iaway, sock;

+ 21 - 0
src/botmsg.h

@@ -0,0 +1,21 @@
+#ifndef _BOTMSG_H
+#define _BOTMSG_H
+
+#include "eggmain.h"
+#include "cfg.h"
+
+#ifndef MAKING_MODS
+void botnet_send_cfg(int idx, struct cfg_entry *entry);
+void botnet_send_cfg_broad(int idx, struct cfg_entry *entry);
+void putbot(char *, char *);
+void putallbots(char *);
+int add_note(char *, char *, char *, int, int);
+int simple_sprintf EGG_VARARGS(char *, arg1);
+void tandout_but EGG_VARARGS(int, arg1);
+char *int_to_base10(int);
+char *unsigned_int_to_base10(unsigned int);
+char *int_to_base64(unsigned int);
+#endif /* !MAKING_MODS */
+
+#endif /* !_BOTMSG_H */
+

+ 9 - 0
src/botnet.c

@@ -10,6 +10,15 @@
  */
 
 #include "eggmain.h"
+#include "botnet.h"
+#include "net.h"
+#include "users.h"
+#include "misc.h"
+#include "userrec.h"
+#include "main.h"
+#include "dccutil.h"
+#include "dcc.h"
+#include "botmsg.h"
 #include "tandem.h"
 #include "core_binds.h"
 

+ 42 - 0
src/botnet.h

@@ -0,0 +1,42 @@
+#ifndef _BOTNET_H
+#define _BOTNET_H
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#ifndef MAKING_MODS
+void lower_bot_linked(int idx);
+void higher_bot_linked(int idx);
+void answer_local_whom(int, int);
+char *lastbot(char *);
+int nextbot(char *);
+int in_chain(char *);
+void tell_bots(int);
+void tell_bottree(int, int);
+int botlink(char *, int, char *);
+int botunlink(int, char *, char *);
+void dump_links(int);
+void addbot(char *, char *, char *, char, int);
+void updatebot(int, char *, char, int);
+void rembot(char *);
+struct tand_t_struct *findbot(char *);
+void unvia(int, struct tand_t_struct *);
+void check_botnet_pings();
+int partysock(char *, char *);
+int addparty(char *, char *, int, char, int, char *, int *);
+void remparty(char *, int);
+void partystat(char *, int, int, int);
+int partynick(char *, int, char *);
+int partyidle(char *, char *);
+void partysetidle(char *, int, int);
+void partyaway(char *, int, char *);
+#ifdef S_DCCPASS
+void botnet_send_cmdpass(int, char *, char *);
+#endif /* S_DCCPASS */
+void zapfbot(int);
+void tandem_relay(int, char *, int);
+int getparty(char *, int);
+#endif /* !MAKING_MODS */
+
+#endif /* !_BOTNET_H */

+ 6 - 0
src/config.c → src/cfg.c

@@ -5,6 +5,12 @@
  */
 
 #include "eggmain.h"
+#include "cfg.h"
+#include "userrec.h"
+#include "misc.h"
+#include "users.h"
+#include "dccutil.h"
+#include "botmsg.h"
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>

+ 34 - 0
src/cfg.h

@@ -0,0 +1,34 @@
+#ifndef _CFG_H
+#define _CFG_H
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#define CFGF_GLOBAL  1          /* Accessible as .config */
+#define CFGF_LOCAL   2          /* Accessible as .botconfig */
+
+typedef struct cfg_entry {
+  char *name;
+  int flags;
+  char *gdata;
+  char *ldata;
+  void (*globalchanged) (struct cfg_entry *, char *oldval, int *valid);
+  void (*localchanged) (struct cfg_entry *, char *oldval, int *valid);
+  void (*describe) (struct cfg_entry *, int idx);
+} cfg_entry_T;
+
+#ifndef MAKING_MODS
+void set_cfg_str(char *target, char *entryname, char *data);
+void add_cfg(struct cfg_entry *);
+void got_config_share(int idx, char * ln);
+void userfile_cfg_line(char *ln);
+void trigger_cfg_changed();
+#ifdef S_DCCPASS
+int check_cmd_pass(char *,char *);
+int has_cmd_pass(char *);
+void set_cmd_pass(char *, int);
+#endif /* S_DCCPASS */
+#endif /* MAKING_MODS */
+
+#endif /* !_CFG_H */

+ 10 - 0
src/chanprog.c

@@ -10,6 +10,16 @@
  */
 
 #include "eggmain.h"
+#include "chanprog.h"
+#include "rfc1459.h"
+#include "net.h"
+#include "misc.h"
+#include "users.h"
+#include "userrec.h"
+#include "main.h"
+#include "debug.h"
+#include "dccutil.h"
+#include "botmsg.h"
 #if HAVE_GETRUSAGE
 #include <sys/resource.h>
 #if HAVE_SYS_RUSAGE_H

+ 27 - 0
src/chanprog.h

@@ -0,0 +1,27 @@
+#ifndef _CHANPROG_H
+#define _CHANPROG_H
+
+#ifndef MAKING_MODS
+void do_chanset(struct chanset_t *, char *, int);
+void checkchans(int);
+void tell_verbose_uptime(int);
+void tell_verbose_status(int);
+void tell_settings(int);
+int logmodes(char *);
+int isowner(char *);
+char *masktype(int);
+char *maskname(int);
+void reaffirm_owners();
+void rehash();
+void reload();
+void chanprog();
+void check_timers();
+void check_utimers();
+void rmspace(char *s);
+void set_chanlist(const char *host, struct userrec *rec);
+void clear_chanlist(void);
+void clear_chanlist_member(const char *nick);
+int shouldjoin(struct chanset_t *);
+#endif /* !MAKING_MODS */
+
+#endif /* !_CHANPROG_H */

+ 13 - 0
src/cmds.c

@@ -6,6 +6,19 @@
  */
 
 #include "eggmain.h"
+#include "cmds.h"
+#include "misc.h"
+#include "net.h"
+#include "userrec.h"
+#include "users.h"
+#include "userent.h"
+#include "match.h"
+#include "main.h"
+#include "dccutil.h"
+#include "chanprog.h"
+#include "botmsg.h"
+#include "botcmd.h"	
+#include "botnet.h"
 #include "tandem.h"
 #include "modules.h"
 #include "help.h"

+ 26 - 0
src/cmds.h

@@ -0,0 +1,26 @@
+#ifndef _CMDS_H
+#define _CMDS_H
+
+typedef struct {
+  char          *name;
+  char          *flags;
+  Function      func;
+  char          *funcname;
+  int           nohelp;
+} cmd_t;
+
+typedef struct {
+  char *name;
+  Function func;
+} botcmd_t;
+
+#ifndef MAKING_MODS
+int check_dcc_attrs(struct userrec *, int);
+int check_dcc_chanattrs(struct userrec *, char *, int, int);
+int stripmodes(char *);
+char *stripmasktype(int);
+void gotremotecmd(char * forbot, char * frombot, char * fromhand, char * fromidx, char * cmd);
+void gotremotereply(char * frombot, char * tohand, char * toidx, char * ln);
+#endif /* !MAKING_MODS */
+
+#endif /* !_CMDS_H */

+ 0 - 23
src/cmdt.h

@@ -1,23 +0,0 @@
-/*
- * cmdt.h
- *   stuff for builtin commands
- *
- */
-
-#ifndef _EGG_CMDT_H
-#define _EGG_CMDT_H
-
-typedef struct {
-  char 		*name;
-  char 		*flags;
-  Function 	func;
-  char 		*funcname;
-  int		nohelp;
-} cmd_t;
-
-typedef struct {
-  char *name;
-  Function func;
-} botcmd_t;
-
-#endif				/* _EGG_CMDT_H */

+ 4 - 0
src/core_binds.c

@@ -1,4 +1,8 @@
 #include "eggmain.h"
+#include "dccutil.h"
+#include "userrec.h"
+#include "users.h"
+#include "misc.h"
 
 extern cmd_t C_dcc[];
 extern struct dcc_t *dcc;

+ 2 - 1
src/core_binds.h

@@ -1,6 +1,7 @@
 #ifndef _CORE_BINDS_H_
 #define _CORE_BINDS_H_
 
+#ifndef MAKING_MODS
 void core_binds_init();
 void check_bind_time(struct tm *tm);
 void check_bind_event(char *event);
@@ -18,5 +19,5 @@ void check_bind_act(const char *, int, const char *);
 void check_bind_bcst(const char *, int, const char *);
 void check_bind_chon(char *, int);
 void check_bind_chof(char *, int);
-
+#endif /* !MAKING_MODS */
 #endif /* !_CORE_BINDS_H */

+ 2 - 0
src/crypt.c

@@ -7,6 +7,8 @@
 
 
 #include "eggmain.h"
+#include "crypt.h"
+#include "misc.h"
 
 #define CRYPT_BLOCKSIZE AES_BLOCK_SIZE
 #define CRYPT_KEYBITS 256

+ 16 - 0
src/crypt.h

@@ -0,0 +1,16 @@
+#ifndef _CRYPT_H
+#define _CRYPT_H
+
+#ifndef MAKING_MODS
+char *md5(const char *);
+char *encrypt_string(const char *, char *);
+char *decrypt_string(const char *, char *);
+void encrypt_pass(char *, char *);
+char *cryptit (char *);
+char *decryptit (char *);
+int lfprintf EGG_VARARGS(FILE *, arg1);
+void EncryptFile(char *, char *);
+void DecryptFile(char *, char *);
+#endif /* !MAKING_MODS */
+
+#endif /* !_CRYPT_H */

+ 15 - 0
src/dcc.c

@@ -7,6 +7,21 @@
  */
 
 #include "eggmain.h"
+#include "dcc.h"
+#include "net.h"
+#include "misc.h"
+#include "users.h"
+#include "userrec.h"
+#include "userent.h"
+#include "match.h"
+#include "dns.h"
+#include "auth.h"
+#include "dccutil.h"
+#include "crypt.h"
+#include "chanprog.h"
+#include "botmsg.h"
+#include "botcmd.h"
+#include "botnet.h"
 #include <ctype.h>
 #include <errno.h>
 #include "modules.h"

+ 10 - 0
src/dcc.h

@@ -0,0 +1,10 @@
+#ifndef _DCC_H
+#define _DCC_H
+
+#ifndef MAKING_MODS
+void failed_link(int);
+void dupwait_notify(char *);
+char *rand_dccresp();
+#endif /* !MAKING_MODS */
+
+#endif /* !_DCC_H */

+ 4 - 0
src/dccutil.c

@@ -10,6 +10,10 @@
 
 #include <sys/stat.h>
 #include "eggmain.h"
+#include "net.h"
+#include "dccutil.h"
+#include "misc.h"
+#include "botcmd.h"
 #include <errno.h>
 #include "chan.h"
 #include "modules.h"

+ 34 - 0
src/dccutil.h

@@ -0,0 +1,34 @@
+#ifndef _DCCUTIL_H
+#define _DCCUTIL_H
+
+#include "eggmain.h"
+
+#ifdef HAVE_DPRINTF
+#  define dprintf dprintf_eggdrop
+#endif
+
+#ifndef MAKING_MODS
+void dprintf EGG_VARARGS(int, arg1);
+void chatout EGG_VARARGS(char *, arg1);
+extern void (*shareout) ();
+extern void (*sharein) (int, char *);
+extern void (*shareupdatein) (int, char *);
+void chanout_but EGG_VARARGS(int, arg1);
+void dcc_chatter(int);
+void lostdcc(int);
+void makepass(char *);
+void tell_dcc(int);
+void not_away(int);
+void set_away(int, char *);
+void dcc_remove_lost(void);
+void flush_lines(int, struct chat_info *);
+struct dcc_t *find_idx(int);
+int new_dcc(struct dcc_table *, int);
+void del_dcc(int);
+char *add_cr(char *);
+void changeover_dcc(int, struct dcc_table *, int);
+void do_boot(int, char *, char *);
+int detect_dcc_flood(time_t *, struct chat_info *, int);
+#endif /* !MAKING_MODS */
+
+#endif /* !_DCCUTIL_H */

+ 6 - 0
src/debug.c

@@ -8,6 +8,12 @@
 
 
 #include "eggmain.h"
+#include "debug.h"
+#include "net.h"
+#include "misc.h"
+#include "userrec.h"
+#include "main.h"
+#include "dccutil.h"
 #include <setjmp.h>
 #include <signal.h>
 #include <sys/types.h>

+ 9 - 0
src/debug.h

@@ -0,0 +1,9 @@
+#ifndef _DEBUG_H
+#define _DEBUG_H
+
+#ifndef MAKING_MODS
+void sdprintf EGG_VARARGS(char *, arg1);
+void init_signals();
+#endif /* !MAKING_MODS */
+
+#endif /* !_DEBUG_H */

+ 3 - 0
src/dns.c

@@ -7,6 +7,9 @@
  */
 
 #include "eggmain.h"
+#include "dccutil.h"
+#include "net.h"
+#include "misc.h"
 #include <netdb.h>
 #include <setjmp.h>
 #include <sys/socket.h>

+ 10 - 0
src/dns.h

@@ -28,4 +28,14 @@ typedef struct devent_str {
   void		*other;		/* Data specific to the event type */
 } devent_t;
 
+extern void (*dns_hostbyip) (IP);
+extern void (*dns_ipbyhost) (char *);
+void block_dns_hostbyip(IP);
+void block_dns_ipbyhost(char *);
+void call_hostbyip(IP, char *, int);
+void call_ipbyhost(char *, IP, int);
+void dcc_dnshostbyip(IP);
+void dcc_dnsipbyhost(char *);
+
+
 #endif	/* _EGG_DNS_H */

+ 4 - 55
src/eggdrop.h

@@ -212,10 +212,6 @@
 #  define sigemptyset(x) ((*(int *)(x))=0)
 #endif
 
-#if !HAVE_SOCKLEN_T
-typedef int socklen_t;
-#endif
-
 
 /*
  *    Handy aliases for memory tracking and core dumps
@@ -224,7 +220,9 @@ typedef int socklen_t;
 #define my_bzero(a, b) { char *x = (char *) a; int y = (int) b; while (y--) *x++ = 0; }
 #define killsock(x)	real_killsock((x),__FILE__,__LINE__)
 
+
 #ifdef DEBUG_CONTEXT
+#  include "main.h"
 #  define Context		eggContext(__FILE__, __LINE__, NULL)
 #  define ContextNote(note)	eggContextNote(__FILE__, __LINE__, NULL, note)
 #else
@@ -241,25 +239,6 @@ typedef int socklen_t;
 #  define Assert(expr)	do {	} while (0)
 #endif
 
-/* 32 bit type */
-#if (SIZEOF_INT == 4)
-typedef unsigned int		u_32bit_t;
-#else
-#  if (SIZEOF_LONG == 4)
-typedef unsigned long		u_32bit_t;
-#  else
-#    include "cant/find/32bit/type"
-#  endif
-#endif
-
-typedef unsigned short int	u_16bit_t;
-typedef unsigned char		u_8bit_t;
-
-/* IP type */
-typedef u_32bit_t		IP;
-
-typedef u_32bit_t dword;
-
 #define debug0(x)		putlog(LOG_DEBUG,"*",x)
 #define debug1(x,a1)		putlog(LOG_DEBUG,"*",x,a1)
 #define debug2(x,a1,a2)		putlog(LOG_DEBUG,"*",x,a1,a2)
@@ -276,9 +255,6 @@ typedef u_32bit_t dword;
 
 /***********************************************************************/
 
-/* It's used in so many places, let's put it here */
-typedef int (*Function) ();
-
 /* Public structure for the listening port map */
 struct portmap {
   int realport;
@@ -317,6 +293,8 @@ struct auth_t {
   time_t atime;	         /* when they last were active */
 };
 
+#include "types.h"
+
 struct dcc_t {
   long sock;			/* This should be a long to keep 64-bit
 				   machines sane			 */
@@ -368,18 +346,6 @@ struct chat_info {
   int current_lines;		/* number of lines total stored		*/
   char *su_nick;
 };
-#define CFGF_GLOBAL  1          /* Accessible as .config */
-#define CFGF_LOCAL   2          /* Accessible as .botconfig */
-
-typedef struct cfg_entry {
-  char *name;
-  int flags;
-  char *gdata;
-  char *ldata;
-  void (*globalchanged) (struct cfg_entry *, char *oldval, int *valid);
-  void (*localchanged) (struct cfg_entry *, char *oldval, int *valid);
-  void (*describe) (struct cfg_entry *, int idx);
-} cfg_entry_T;
 
 struct file_info {
   struct chat_info *chat;
@@ -571,11 +537,6 @@ struct dupwait_info {
 #define FLOOD_CHAN_MAX   7
 #define FLOOD_GLOBAL_MAX 3
 
-/* For local console: */
-#define STDIN      0
-#define STDOUT     1
-#define STDERR     2
-
 #ifdef S_LASTCHECK
 #define DETECT_LOGIN 1
 #endif
@@ -601,18 +562,6 @@ struct dupwait_info {
 #define CONNECT_SSL 1
 #define ACCEPT_SSL 2
 
-/* Structure for internal logs */
-typedef struct {
-  char *filename;
-  unsigned int mask;		/* what to send to this log		    */
-  char *chname;			/* which channel			    */
-  char szlast[LOGLINELEN];	/* for 'Last message repeated n times'
-				   stuff in misc.c/putlog() <cybah>	    */
-  int repeats;			/* number of times szLast has been repeated */
-  unsigned int flags;		/* other flags <rtc>			    */
-  FILE *f;			/* existing file			    */
-} log_t;
-
 /* Logfile display flags
  */
 #define LOG_MSGS     0x000001	/* m   msgs/notice/ctcps		*/

+ 2 - 8
src/eggmain.h

@@ -15,8 +15,9 @@
 #include "conf.h"
 #include "salt.h"
 #include "color.h"
+#include "garble.h"
 
-#include "lush.h" /* We seem to need this everywhere... */
+#include "lush.h"
 
 #if (((TCL_MAJOR_VERSION == 7) && (TCL_MINOR_VERSION >= 5)) || (TCL_MAJOR_VERSION > 7))
 #  define USE_TCL_EVENTS
@@ -79,14 +80,9 @@
 #  include <zlib.h>
 #endif /* HAVE_ZLIB_H */
 
-#ifndef MAKING_MODS
-#  include "proto.h"
-#endif
-#include "cmdt.h"
 #include "tclegg.h"
 #include "tclhash.h"
 #include "chan.h"
-#include "users.h"
 #include "compat/compat.h"
 
 /* For pre Tcl7.5p1 versions */
@@ -107,8 +103,6 @@ extern struct dcc_table DCC_CHAT, DCC_BOT, DCC_LOST, DCC_BOT_NEW,
 
 #endif
 
-#define iptolong(a)		(0xffffffff & 				\
-				 (long) (htonl((unsigned long) a)))
 #define fixcolon(x)		do {					\
 	if ((x)[0] == ':')			 			\
 		(x)++;							\

+ 6 - 0
src/flags.c

@@ -5,6 +5,12 @@
  */
 
 #include "eggmain.h"
+#include "crypt.h"
+#include "rfc1459.h"
+#include "misc.h"
+#include "dccutil.h"
+#include "userent.h"
+#include "users.h"
 
 extern int		 use_console_r, debug_output, noshare,
 			 allow_dk_cmds;

+ 3 - 33
src/mem.c → src/garble.c

@@ -1,45 +1,15 @@
 /*
- * mem.c -- handles:
- *   memory allocation and deallocation
+ * garble.c -- handles:
  *   garble strings
  *
  */
 
 #include "eggmain.h"
-
+#include "garble.h"
+#include "main.h"
 
 #define STR(x) x
 
-void *my_malloc(int size)
-{
-  void *x;
-
-  x = (void *) malloc(size);
-  if (x == NULL) 
-    fatal("Memory allocation failed", 0);
-  return x;
-}
-
-void *my_realloc(void *ptr, int size)
-{
-  void *x;
-
-  if (!ptr)
-    return my_malloc(size);
-
-  x = (void *) realloc(ptr, size);
-  if (x == NULL && size > 0)
-    return NULL;
-  return x;
-}
-
-void my_free(void *ptr)
-{
-  if (ptr == NULL)
-    return;
-  free(ptr);
-}
-
 #ifdef S_GARBLESTRINGS
 #define GARBLE_BUFFERS 40
 unsigned char *garble_buffer[GARBLE_BUFFERS] = {

+ 13 - 0
src/garble.h

@@ -0,0 +1,13 @@
+#ifndef _GARBLE_H
+#define _GARBLE_H
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#ifdef S_GARBLESTRINGS
+char *degarble(int, char *);
+#endif /* S_GARBLESTRINGS */
+
+
+#endif /* !_GARBLE_H */

+ 15 - 0
src/main.c

@@ -7,6 +7,19 @@
  */
 
 #include "eggmain.h"
+#include "main.h"
+#include "misc_file.h"
+#include "net.h"
+#include "users.h"
+#include "misc.h"
+#include "userrec.h"
+#include "cfg.h"
+#include "dccutil.h"
+#include "crypt.h"
+#include "debug.h"
+#include "chanprog.h"
+#include "bg.h"	
+#include "botnet.h"
 #include "build.h"
 #include <libgen.h>
 #include <time.h>
@@ -52,6 +65,8 @@ int hub = 0;
 int leaf = 1;
 #endif
 
+char *progname();		/* from settings.c */
+
 
 extern char		 origbotname[], userfile[], botnetnick[], packname[],
                          shellhash[], myip6[], myip[], hostname[],

+ 13 - 0
src/main.h

@@ -0,0 +1,13 @@
+#ifndef _MAIN_H
+#define _MAIN_H
+
+#ifndef MAKING_MODS
+int crontab_exists();
+void crontab_create(int);
+void fatal(const char *, int);
+void eggContext(const char *, int, const char *);
+void eggContextNote(const char *, int, const char *, const char *);
+void eggAssert(const char *, int, const char *);
+#endif /* !MAKING_MODS */
+
+#endif /* !_MAIN_H */

+ 4 - 3
src/makesettings.c

@@ -420,6 +420,7 @@ fprintf(f, " \
 #include <stdlib.h> \n\
 #include <string.h> \n\
 #include \"eggmain.h\"\n\
+#include \"debug.h\"\n\
 \n\
 char packname[512], shellhash[33], bdhash[33], dcc_prefix[2], *owners, *hubs, *owneremail;\n\n\
 char *progname() {\n\
@@ -448,9 +449,9 @@ fprintf(f, " \
 fprintf(f, " \n\n\
 int init_settings()\n\
 {\n\
-  owners = my_malloc(strlen(_OWNERS) + 1);\n\
-  hubs = my_malloc(strlen(_HUBS) + 1);\n\
-  owneremail = my_malloc(strlen(_OWNEREMAIL) + 1);\n\
+  owners = malloc(strlen(_OWNERS) + 1);\n\
+  hubs = malloc(strlen(_HUBS) + 1);\n\
+  owneremail = malloc(strlen(_OWNEREMAIL) + 1);\n\
 \n\
   sprintf(owners, _OWNERS);\n\
   sprintf(hubs, _HUBS);\n\

+ 2 - 0
src/match.c

@@ -22,6 +22,8 @@
  *
  */
 #include "eggmain.h"
+#include "match.h"
+#include "rfc1459.h"
 
 #define QUOTE '\\' /* quoting character (overrides wildcards) */
 #define WILDS '*'  /* matches 0 or more characters (including spaces) */

+ 10 - 0
src/match.h

@@ -0,0 +1,10 @@
+#ifndef _MATCH_H
+#define _MATCH_H
+
+int _wild_match(register unsigned char *, register unsigned char *);
+int _wild_match_per(register unsigned char *, register unsigned char *);
+
+#define wild_match(a,b) _wild_match((unsigned char *)(a),(unsigned char *)(b))
+#define wild_match_per(a,b) _wild_match_per((unsigned char *)(a),(unsigned char *)(b))
+
+#endif /* !_MATCH_H */

+ 13 - 0
src/misc.c

@@ -8,6 +8,19 @@
  */
 
 #include "eggmain.h"
+#include "misc.h"
+#include "rfc1459.h"
+#ifdef HUB
+#include "userrec.h"
+#endif
+#include "misc_file.h"
+#include "users.h"
+#include "main.h"
+#include "debug.h"
+#include "dccutil.h"
+#include "chanprog.h"
+#include "botmsg.h"
+#include "bg.h"	
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/wait.h>

+ 71 - 0
src/misc.h

@@ -0,0 +1,71 @@
+#ifndef _MISC_H
+#define _MISC_H
+
+#include "eggmain.h"
+
+#ifndef MAKING_MODS
+char *homedir();
+char *my_uname();
+char *confdir();
+void baduname(char *, char *);
+int email(char *, char *, int);
+char *color(int, int, int);
+void shuffle(char *, char *);
+void showhelp(int, struct flag_record *, char *);
+char *btoh(const unsigned char *, int);
+void local_check_should_lock();
+void werr(int);
+char *werr_tostr(int);
+int listen_all(int, int);
+char *getfullbinname(char *);
+char *replace(char *, char *, char *);
+void detected(int, char *);
+int goodpass(char *, int, char *);
+void check_last();
+void check_promisc();
+void check_trace();
+void check_processes();
+void makeplaincookie(char *, char *, char *);
+int isupdatehub();
+int getting_users();
+char *kickreason(int);
+int bot_aggressive_to(struct userrec *);
+int updatebin(int, char *, int);
+int shell_exec(char * cmdline, char * input, char ** output, char ** erroutput);
+int egg_strcatn(char *dst, const char *src, size_t max);
+int my_strcpy(char *, char *);
+void putlog EGG_VARARGS(int, arg1);
+int ischanhub();
+int dovoice(struct chanset_t *);
+int dolimit(struct chanset_t *);
+void maskhost(const char *, char *);
+char *stristr(char *, char *);
+void splitc(char *, char *, char);
+void splitcn(char *, char *, char, size_t);
+void remove_crlf(char **);
+char *newsplit(char **);
+char *splitnick(char **);
+void stridx(char *, char *, int);
+void dumplots(int, const char *, char *);
+void daysago(time_t, time_t, char *);
+void days(time_t, time_t, char *);
+void daysdur(time_t, time_t, char *);
+void show_motd(int);
+void show_channels(int, char *);
+void show_banner(int);
+char *extracthostname(char *);
+void make_rand_str(char *, int);
+int oatoi(const char *);
+char *str_escape(const char *, const char, const char);
+char *strchr_unescape(char *, const char, register const char);
+void str_unescape(char *, register const char);
+int str_isdigit(const char *);
+void kill_bot(char *, char *);
+int private(struct flag_record, struct chanset_t *, int);
+int chk_op(struct flag_record, struct chanset_t *);
+int chk_deop(struct flag_record, struct chanset_t *);
+int chk_voice(struct flag_record, struct chanset_t *);
+int chk_devoice(struct flag_record, struct chanset_t *);
+#endif /* !MAKING_MODS */
+
+#endif /* !_MISC_H_ */

+ 2 - 0
src/misc_file.h

@@ -7,6 +7,7 @@
 #ifndef _EGG_MISC_FILE_H
 #define _EGG_MISC_FILE_H
 
+#ifndef MAKING_MODS
 int copyfile(char *, char *);
 int movefile(char *, char *);
 int is_file(const char *);
@@ -15,5 +16,6 @@ int can_lstat(const char *);
 int is_symlink(const char *);
 int is_dir(const char *);
 int fixmod(const char *);
+#endif /* !MAKING_MODS */
 
 #endif				/* _EGG_MISC_FILE_H */

+ 1 - 0
src/mod/ctcp.mod/ctcp.c

@@ -8,6 +8,7 @@
 #define MAKING_CTCP
 #include "ctcp.h"
 #include "src/mod/module.h"
+#include "src/net.h"
 
 #ifdef LEAF
 #include "server.mod/server.h"

+ 4 - 0
src/mod/module.h

@@ -26,6 +26,10 @@
 
 /* Just include *all* the include files...it's slower but EASIER */
 #include "src/eggmain.h"
+#include "src/users.h"
+#include "src/types.h"
+#include "src/cfg.h"
+#include "src/cmds.h"
 #include "modvals.h"
 #include "src/tandem.h"
 

+ 1 - 0
src/mod/server.mod/server.c

@@ -8,6 +8,7 @@
 #define MODULE_NAME "server"
 #define MAKING_SERVER
 #include "src/mod/module.h"
+#include "src/net.h"
 #include "server.h"
 
 static Function *global = NULL;

+ 1 - 0
src/mod/share.mod/share.c

@@ -13,6 +13,7 @@
 #include <sys/stat.h>
 
 #include "src/chan.h"
+#include "src/net.h"
 #include "src/users.h"
 #include "src/mod/transfer.mod/transfer.h"
 #include "src/mod/channels.mod/channels.h"

+ 1 - 0
src/mod/transfer.mod/transfer.c

@@ -16,6 +16,7 @@
 #include "src/mod/module.h"
 #include "src/mod/update.mod/update.h"
 #include "src/tandem.h"
+#include "src/net.h"
 
 #include "src/users.h"
 #include "transfer.h"

+ 3 - 0
src/mod/update.mod/update.c

@@ -17,6 +17,9 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
+#ifdef HUB
+#include "src/net.h"
+#endif
 
 #include "src/mod/transfer.mod/transfer.h"
 #include "src/mod/compress.mod/compress.h"

+ 20 - 0
src/modules.c

@@ -8,6 +8,26 @@
 
 #include "eggmain.h"
 #include "modules.h"
+#include "misc_file.h"
+#include "rfc1459.h"
+#include "net.h"
+#include "misc.h"
+#include "userent.h"
+#include "userrec.h"
+#include "cfg.h"
+#include "match.h"
+#include "auth.h"
+#include "main.h"
+#include "dccutil.h"
+#include "debug.h"
+#include "dcc.h"
+#include "dns.h"
+#include "cmds.h"
+#include "crypt.h"
+#include "chanprog.h"
+#include "botmsg.h"
+#include "botcmd.h"
+#include "botnet.h"
 #include "tandem.h"
 #include <ctype.h>
 #include "core_binds.h"

+ 6 - 1
src/net.c

@@ -6,7 +6,12 @@
 
 #include <fcntl.h>
 #include "eggmain.h"
-#include "proto.h"
+#include "net.h"
+#include "misc.h"
+#include "main.h"
+#include "debug.h"
+#include "dccutil.h"
+#include "crypt.h"
 #include "traffic.h" /* egg_traffic_t */
 #include <limits.h>
 #include <string.h>

+ 60 - 0
src/net.h

@@ -0,0 +1,60 @@
+#ifndef _NET_H
+#define _NET_H
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include "types.h"
+
+#define iptolong(a)             (0xffffffff &                           \
+                                 (long) (htonl((unsigned long) a)))
+
+#ifndef MAKING_MODS
+IP my_atoul(char *);
+#ifdef HAVE_SSL
+int ssl_cleanup();
+#endif /* HAVE_SSL */
+int ssl_link(int, int);
+char *myipstr(int);
+IP getmyip();
+void cache_my_ip();
+void neterror(char *);
+void setsock(int, int);
+int allocsock(int, int);
+#ifdef USE_IPV6
+int getsock(int, int);
+#else
+int getsock(int);
+#endif /* USE_IPV6 */
+int sockprotocol(int);
+int hostprotocol(char *);
+char *hostnamefromip(unsigned long);
+void dropssl(int);
+void real_killsock(int, const char *, int);
+int answer(int, char *, unsigned long *, unsigned short *, int);
+inline int open_listen(int *);
+inline int open_listen_by_af(int *, int);
+#ifdef USE_IPV6
+int open_address_listen(IP, int, int *);
+#else
+int open_address_listen(IP, int *);
+#endif /* USE_IPV6 */
+int open_telnet(char *, int);
+int open_telnet_dcc(int, char *, char *);
+int open_telnet_raw(int, char *, int);
+void tputs(int, char *, unsigned int);
+void dequeue_sockets();
+int sockgets(char *, int *);
+void tell_netdebug(int);
+int sanitycheck_dcc(char *, char *, char *, char *);
+void send_timesync(int);
+int hostsanitycheck_dcc(char *, char *, IP, char *, char *);
+char *iptostr(IP);
+int sock_has_data(int, int);
+int sockoptions(int sock, int operation, int sock_options);
+int flush_inbuf(int idx);
+
+#endif /* !MAKING_MODS */
+
+#endif /* !_NET_H */

+ 0 - 395
src/proto.h

@@ -1,395 +0,0 @@
-/*
- * proto.h
- *   prototypes for every function used outside its own module
- *
- * (i guess i'm not very modular, cuz there are a LOT of these.)
- * with full prototyping, some have been moved to other .h files
- * because they use structures in those
- * (saves including those .h files EVERY time) - Beldin
- *
- */
-
-#ifndef _EGG_PROTO_H
-#define _EGG_PROTO_H
-
-#include "lush.h"
-#include "misc_file.h"
-
-#ifdef HAVE_DPRINTF
-#define dprintf dprintf_eggdrop
-#endif
-
-#define STR(x) x
-
-struct chanset_t;		/* keeps the compiler warnings down :) */
-struct userrec;
-struct maskrec;
-struct igrec;
-struct flag_record;
-struct list_type;
-struct tand_t_struct;
-
-#if !defined(MAKING_MODS)
-extern int (*rfc_casecmp) (const char *, const char *);
-extern int (*rfc_ncasecmp) (const char *, const char *, int);
-extern int (*rfc_toupper) (int);
-extern int (*rfc_tolower) (int);
-extern int (*storenote)(char *from, char *to, char *msg, int idx, char *who, int bufsize);
-#endif /* !MAKING_MODS */
-
-/* bg.c */
-void do_fork();
-void bg_do_split();
-
-/* botcmd.c */
-void bounce_simul(int, char *);
-void send_remote_simul(int, char *, char *, char *);
-void bot_share(int, char *);
-void bot_shareupdate(int, char *);
-int base64_to_int(char *);
-
-/* botnet.c */
-void lower_bot_linked(int idx);
-void higher_bot_linked(int idx);
-void answer_local_whom(int, int);
-char *lastbot(char *);
-int nextbot(char *);
-int in_chain(char *);
-void tell_bots(int);
-void tell_bottree(int, int);
-int botlink(char *, int, char *);
-int botunlink(int, char *, char *);
-void dump_links(int);
-void addbot(char *, char *, char *, char, int);
-void updatebot(int, char *, char, int);
-void rembot(char *);
-struct tand_t_struct *findbot(char *);
-void unvia(int, struct tand_t_struct *);
-void check_botnet_pings();
-int partysock(char *, char *);
-int addparty(char *, char *, int, char, int, char *, int *);
-void remparty(char *, int);
-void partystat(char *, int, int, int);
-int partynick(char *, int, char *);
-int partyidle(char *, char *);
-void partysetidle(char *, int, int);
-void partyaway(char *, int, char *);
-#ifdef S_DCCPASS
-void botnet_send_cmdpass(int, char *, char *);
-#endif /* S_DCCPASS */
-void zapfbot(int);
-void tandem_relay(int, char *, int);
-int getparty(char *, int);
-
-/* botmsg.c */
-void botnet_send_cfg(int idx, struct cfg_entry *entry);
-void botnet_send_cfg_broad(int idx, struct cfg_entry *entry);
-void putbot(char *, char *);
-void putallbots(char *);
-int add_note(char *, char *, char *, int, int);
-int simple_sprintf EGG_VARARGS(char *, arg1);
-void tandout_but EGG_VARARGS(int, arg1);
-char *int_to_base10(int);
-char *unsigned_int_to_base10(unsigned int);
-char *int_to_base64(unsigned int);
-
-/* chanprog.c */
-void do_chanset(struct chanset_t *, char *, int);
-void checkchans(int);
-void tell_verbose_uptime(int);
-void tell_verbose_status(int);
-void tell_settings(int);
-int logmodes(char *);
-int isowner(char *);
-char *masktype(int);
-char *maskname(int);
-void reaffirm_owners();
-void rehash();
-void reload();
-void chanprog();
-void check_timers();
-void check_utimers();
-void rmspace(char *s);
-void set_chanlist(const char *host, struct userrec *rec);
-void clear_chanlist(void);
-void clear_chanlist_member(const char *nick);
-int shouldjoin(struct chanset_t *);
-
-/* cmds.c */
-int check_dcc_attrs(struct userrec *, int);
-int check_dcc_chanattrs(struct userrec *, char *, int, int);
-int stripmodes(char *);
-char *stripmasktype(int);
-void gotremotecmd(char * forbot, char * frombot, char * fromhand, char * fromidx, char * cmd);
-void gotremotereply(char * frombot, char * tohand, char * toidx, char * ln);
-
-/* crypt.c */
-char *md5(const char *);
-char *encrypt_string(const char *, char *);
-char *decrypt_string(const char *, char *);
-void encrypt_pass(char *, char *);
-char *cryptit (char *);
-char *decryptit (char *);
-int lfprintf EGG_VARARGS(FILE *, arg1);
-void EncryptFile(char *, char *);
-void DecryptFile(char *, char *);
-
-/* dcc.c */
-void failed_link(int);
-void dupwait_notify(char *);
-char *rand_dccresp();
-
-/* dccutil.c */
-void dprintf EGG_VARARGS(int, arg1);
-void chatout EGG_VARARGS(char *, arg1);
-extern void (*shareout) ();
-extern void (*sharein) (int, char *);
-extern void (*shareupdatein) (int, char *);
-void chanout_but EGG_VARARGS(int, arg1);
-void dcc_chatter(int);
-void lostdcc(int);
-void makepass(char *);
-void tell_dcc(int);
-void not_away(int);
-void set_away(int, char *);
-void dcc_remove_lost(void);
-
-void flush_lines(int, struct chat_info *);
-struct dcc_t *find_idx(int);
-int new_dcc(struct dcc_table *, int);
-void del_dcc(int);
-char *add_cr(char *);
-void changeover_dcc(int, struct dcc_table *, int);
-
-/* dns.c */
-extern void (*dns_hostbyip) (IP);
-extern void (*dns_ipbyhost) (char *);
-void block_dns_hostbyip(IP);
-void block_dns_ipbyhost(char *);
-void call_hostbyip(IP, char *, int);
-void call_ipbyhost(char *, IP, int);
-void dcc_dnshostbyip(IP);
-void dcc_dnsipbyhost(char *);
-
-/* debug.c */
-void sdprintf EGG_VARARGS(char *, arg1);
-void init_signals();
-
-/* gotdcc.c */
-void gotdcc(char *, char *, struct userrec *, char *);
-void do_boot(int, char *, char *);
-int detect_dcc_flood(time_t *, struct chat_info *, int);
-
-/* main.c */
-void do_fork();
-int crontab_exists();
-void crontab_create(int);
-void fatal(const char *, int);
-void eggContext(const char *, int, const char *);
-void eggContextNote(const char *, int, const char *, const char *);
-void eggAssert(const char *, int, const char *);
-
-
-/* match.c */
-int _wild_match(register unsigned char *, register unsigned char *);
-int _wild_match_per(register unsigned char *, register unsigned char *);
-
-#define wild_match(a,b) _wild_match((unsigned char *)(a),(unsigned char *)(b))
-#define wild_match_per(a,b) _wild_match_per((unsigned char *)(a),(unsigned char *)(b))
-
-/* mem.c */
-void *my_malloc(int);
-void *my_realloc(void *, int);
-void my_free(void *);
-#ifdef S_GARBLESTRINGS
-char *degarble(int, char *);
-#endif /* S_GARBLESTRINGS */
-
-/* settings.c */
-char *progname();
-
-/* auth.c */
-int new_auth();
-int findauth(char *);
-void removeauth(int);
-char *makehash(struct userrec *, char *);
-
-/* config.c */
-void set_cfg_str(char *target, char *entryname, char *data);
-void add_cfg(struct cfg_entry *);
-void got_config_share(int idx, char * ln);
-void userfile_cfg_line(char *ln);
-void trigger_cfg_changed();
-#ifdef S_DCCPASS
-int check_cmd_pass(char *,char *);
-int has_cmd_pass(char *);
-void set_cmd_pass(char *, int);
-#endif /* S_DCCPASS */
-
-/* misc.c */
-char *homedir();
-char *my_uname();
-char *confdir();
-void baduname(char *, char *);
-int email(char *, char *, int);
-char *color(int, int, int);
-void shuffle(char *, char *);
-void showhelp(int, struct flag_record *, char *);
-char *btoh(const unsigned char *, int);
-void local_check_should_lock();
-void werr(int);
-char *werr_tostr(int);
-int listen_all(int, int);
-char *getfullbinname(char *);
-char *replace(char *, char *, char *);
-void detected(int, char *);
-int goodpass(char *, int, char *);
-void check_last();
-void check_promisc();
-void check_trace();
-void check_processes();
-void makeplaincookie(char *, char *, char *);
-int isupdatehub();
-int getting_users();
-char *kickreason(int);
-int bot_aggressive_to(struct userrec *);
-int updatebin(int, char *, int);
-int shell_exec(char * cmdline, char * input, char ** output, char ** erroutput);
-int egg_strcatn(char *dst, const char *src, size_t max);
-int my_strcpy(char *, char *);
-void putlog EGG_VARARGS(int, arg1);
-int ischanhub();
-int dovoice(struct chanset_t *);
-int dolimit(struct chanset_t *);
-void maskhost(const char *, char *);
-char *stristr(char *, char *);
-void splitc(char *, char *, char);
-void splitcn(char *, char *, char, size_t);
-void remove_crlf(char **);
-char *newsplit(char **);
-char *splitnick(char **);
-void stridx(char *, char *, int);
-void dumplots(int, const char *, char *);
-void daysago(time_t, time_t, char *);
-void days(time_t, time_t, char *);
-void daysdur(time_t, time_t, char *);
-void show_motd(int);
-void show_channels(int, char *);
-void show_banner(int);
-char *extracthostname(char *);
-void make_rand_str(char *, int);
-int oatoi(const char *);
-char *str_escape(const char *, const char, const char);
-char *strchr_unescape(char *, const char, register const char);
-void str_unescape(char *, register const char);
-int str_isdigit(const char *);
-void kill_bot(char *, char *);
-int private(struct flag_record, struct chanset_t *, int);
-int chk_op(struct flag_record, struct chanset_t *);
-int chk_deop(struct flag_record, struct chanset_t *);
-int chk_voice(struct flag_record, struct chanset_t *);
-int chk_devoice(struct flag_record, struct chanset_t *);
-
-/* net.c */
-#ifdef HAVE_SSL
-int ssl_cleanup();
-#endif /* HAVE_SSL */
-int ssl_link(int, int);
-IP my_atoul(char *);
-unsigned long iptolong(IP);
-char *myipstr(int);
-IP getmyip();
-void cache_my_ip();
-void neterror(char *);
-void setsock(int, int);
-int allocsock(int, int);
-#ifdef USE_IPV6
-int getsock(int, int);
-#else
-int getsock(int);
-#endif /* USE_IPV6 */
-int sockprotocol(int);
-int hostprotocol(char *);
-char *hostnamefromip(unsigned long);
-void dropssl(int);
-void real_killsock(int, const char *, int);
-int answer(int, char *, unsigned long *, unsigned short *, int);
-inline int open_listen(int *);
-inline int open_listen_by_af(int *, int);
-#ifdef USE_IPV6
-int open_address_listen(IP addr, int af_def, int *);
-#else
-int open_address_listen(IP addr, int *);
-#endif /* USE_IPV6 */
-int open_telnet(char *, int);
-int open_telnet_dcc(int, char *, char *);
-int open_telnet_raw(int, char *, int);
-void tputs(int, char *, unsigned int);
-void dequeue_sockets();
-int sockgets(char *, int *);
-void tell_netdebug(int);
-int sanitycheck_dcc(char *, char *, char *, char *);
-void send_timesync(int);
-int hostsanitycheck_dcc(char *, char *, IP, char *, char *);
-char *iptostr(IP);
-int sock_has_data(int, int);
-int sockoptions(int sock, int operation, int sock_options);
-int flush_inbuf(int idx);
-
-/* tcl.c */
-
-/* userent.c */
-void update_mod(char *, char *, char *, char *);
-void list_type_kill(struct list_type *);
-void stats_add(struct userrec *, int, int);
-
-
-/* userrec.c */
-void deflag_user(struct userrec *, int, char *, struct chanset_t *);
-struct userrec *adduser(struct userrec *, char *, char *, char *, int);
-void addhost_by_handle(char *, char *);
-void clear_masks(struct maskrec *);
-void clear_userlist(struct userrec *);
-int u_pass_match(struct userrec *, char *);
-int delhost_by_handle(char *, char *);
-int ishost_for_handle(char *, char *);
-int count_users(struct userrec *);
-int deluser(char *);
-void freeuser(struct userrec *);
-int change_handle(struct userrec *, char *);
-void correct_handle(char *);
-int write_user(struct userrec *u, FILE * f, int shr);
-int write_userfile(int);
-struct userrec *check_dcclist_hand(char *);
-void touch_laston(struct userrec *, char *, time_t);
-void user_del_chan(char *);
-char *fixfrom(char *);
-
-/* users.c */
-int whois_access(struct userrec *, struct userrec *);
-#ifdef HUB
-void backup_userfile();
-#endif /* HUB */
-void addignore(char *, char *, char *, time_t);
-int delignore(char *);
-void tell_ignores(int, char *);
-int match_ignore(char *);
-void check_expired_ignores();
-void autolink_cycle(char *);
-void tell_file_stats(int, char *);
-void tell_user_ident(int, char *, int);
-void tell_users_match(int, char *, int, int, int, char *);
-int readuserfile(char *, struct userrec **);
-void check_pmode();
-void link_pref_val(struct userrec *u, char *lval);
-
-/* rfc1459.c */
-int _rfc_casecmp(const char *, const char *);
-int _rfc_ncasecmp(const char *, const char *, int);
-int _rfc_toupper(int);
-int _rfc_tolower(int);
-
-/* sort.h */
-void strsort(char **, unsigned);
-
-#endif				/* _EGG_PROTO_H */

+ 1 - 0
src/rfc1459.c

@@ -25,6 +25,7 @@
  */
 
 #include "eggmain.h"
+#include "rfc1459.h"
 
 int _rfc_casecmp(const char *s1, const char *s2)
 {

+ 18 - 0
src/rfc1459.h

@@ -0,0 +1,18 @@
+#ifndef _RFC1459_H
+#define _RFC1459_H
+
+#ifndef MAKING_MODS
+extern int (*rfc_casecmp) (const char *, const char *);
+extern int (*rfc_ncasecmp) (const char *, const char *, int);
+extern int (*rfc_toupper) (int);
+extern int (*rfc_tolower) (int);
+
+int _rfc_casecmp(const char *, const char *);
+int _rfc_ncasecmp(const char *, const char *, int);
+int _rfc_toupper(int);
+int _rfc_tolower(int);
+
+#endif /* !MAKING_MODS */
+
+
+#endif /* !_RFC1459_H */

+ 2 - 0
src/tcl.c

@@ -9,6 +9,8 @@
 #include <stdlib.h>		/* getenv()				*/
 #include <locale.h>		/* setlocale()				*/
 #include "eggmain.h"
+#include "misc.h"
+#include "chanprog.h"
 #include <sys/stat.h>
 
 

+ 0 - 4
src/tclegg.h

@@ -9,10 +9,6 @@
 
 #include "lush.h"		/* Include this here, since it's needed
 				   in this file */
-#ifndef MAKING_MODS
-#  include "proto.h"		/* This file needs this */
-#endif
-
 typedef struct _tcl_coups {
   char *name;
   int *lptr;

+ 1 - 1
src/tclhash.c

@@ -12,7 +12,7 @@
 #include "eggmain.h"
 #include "chan.h"
 #include "users.h"
-#include "match.c"
+#include "match.h"
 #include "egg_timer.h"
 
 extern struct dcc_t *dcc;

+ 1 - 0
src/tclhash.h

@@ -6,6 +6,7 @@
 #ifndef _EGG_TCLHASH_H
 #define _EGG_TCLHASH_H
 
+#include "cmds.h"
 
 #define TC_DELETED	0x0001	/* This command/trigger was deleted.	*/
 

+ 38 - 0
src/types.h

@@ -0,0 +1,38 @@
+#ifndef _TYPES_H
+#define _TYPES_H
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+/* For local console: */
+#define STDIN      0
+#define STDOUT     1
+#define STDERR     2
+
+/* It's used in so many places, let's put it here */
+typedef int (*Function) ();
+
+#if !HAVE_SOCKLEN_T
+typedef int socklen_t;
+#endif
+
+/* 32 bit type */
+#if (SIZEOF_INT == 4)
+typedef unsigned int            u_32bit_t;
+#else
+#  if (SIZEOF_LONG == 4)
+typedef unsigned long           u_32bit_t;
+#  else
+#    include "cant/find/32bit/type"
+#  endif
+#endif
+
+typedef unsigned short int      u_16bit_t;
+typedef unsigned char           u_8bit_t;
+
+/* IP type */
+typedef u_32bit_t		IP;
+typedef u_32bit_t 		dword;
+
+#endif /* !_TYPES_H */

+ 5 - 0
src/userent.c

@@ -6,6 +6,11 @@
 
 #include "eggmain.h"
 #include "users.h"
+#include "misc.h"
+#include "match.h"
+#include "dccutil.h"
+#include "crypt.h"
+#include "botmsg.h"
 
 extern int		 noshare, cfg_noshare, cfg_count;
 extern struct cfg_entry **cfg;

+ 12 - 0
src/userent.h

@@ -0,0 +1,12 @@
+#ifndef _USERENT_H
+#define _USERENT_H
+
+#include "users.h"
+
+#ifndef MAKING_MODS
+void update_mod(char *, char *, char *, char *);
+void list_type_kill(struct list_type *);
+void stats_add(struct userrec *, int, int);
+#endif /* !MAKING_MODS */
+
+#endif /* !_USERENT_H */

+ 8 - 0
src/userrec.c

@@ -8,10 +8,18 @@
 
 #include <sys/stat.h>
 #include "eggmain.h"
+#include "misc_file.h"
+#include "rfc1459.h"
+#include "userrec.h"
+#include "misc.h"
 #include "users.h"
 #include "chan.h"
+#include "match.h"
+#include "dccutil.h"
 #include "modules.h"
 #include "tandem.h"
+#include "chanprog.h"
+#include "crypt.h"
 #include "core_binds.h"
 
 extern struct dcc_t	*dcc;

+ 27 - 0
src/userrec.h

@@ -0,0 +1,27 @@
+#ifndef _USERREC_H
+#define _USERREC_H
+
+
+#ifndef MAKING_MODS
+void deflag_user(struct userrec *, int, char *, struct chanset_t *);
+struct userrec *adduser(struct userrec *, char *, char *, char *, int);
+void addhost_by_handle(char *, char *);
+void clear_masks(struct maskrec *);
+void clear_userlist(struct userrec *);
+int u_pass_match(struct userrec *, char *);
+int delhost_by_handle(char *, char *);
+int ishost_for_handle(char *, char *);
+int count_users(struct userrec *);
+int deluser(char *);
+void freeuser(struct userrec *);
+int change_handle(struct userrec *, char *);
+void correct_handle(char *);
+int write_user(struct userrec *u, FILE * f, int shr);
+int write_userfile(int);
+struct userrec *check_dcclist_hand(char *);
+void touch_laston(struct userrec *, char *, time_t);
+void user_del_chan(char *);
+char *fixfrom(char *);
+#endif /* !MAKING_MODS */
+
+#endif /* !_USERREC_H */

+ 13 - 0
src/users.c

@@ -13,7 +13,20 @@
  */
 
 #include "eggmain.h"
+#ifdef HUB
+#include "misc_file.h"
+#endif
 #include "users.h"
+#include "rfc1459.h"
+#include "userrec.h"
+#include "misc.h"
+#include "cfg.h"
+#include "match.h"
+#include "main.h"
+#include "chanprog.h"
+#include "dccutil.h"
+#include "crypt.h"
+#include "botnet.h"
 #include "chan.h"
 #include "modules.h"
 #include "tandem.h"

+ 24 - 0
src/users.h

@@ -7,6 +7,10 @@
 #ifndef _EGG_USERS_H
 #define _EGG_USERS_H
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 /* List functions :) , next *must* be the 1st item in the struct */
 struct list_type {
   struct list_type *next;
@@ -177,4 +181,24 @@ void def_display(int idx, struct user_entry *e, struct userrec *u);
 int def_dupuser(struct userrec *new, struct userrec *old,
 		struct user_entry *e);
 
+
+#ifndef MAKING_MODS
+int whois_access(struct userrec *, struct userrec *);
+#ifdef HUB
+void backup_userfile();
+#endif /* HUB */
+void addignore(char *, char *, char *, time_t);
+int delignore(char *);
+void tell_ignores(int, char *);
+int match_ignore(char *);
+void check_expired_ignores();
+void autolink_cycle(char *);
+void tell_file_stats(int, char *);
+void tell_user_ident(int, char *, int);
+void tell_users_match(int, char *, int, int, int, char *);
+int readuserfile(char *, struct userrec **);
+void check_pmode();
+void link_pref_val(struct userrec *u, char *lval);
+#endif /* !MAKING_MODS */
+
 #endif				/* _EGG_USERS_H */