瀏覽代碼

* Removed server.mod from the 'modules'
* All headers now extern their variables
- No more mass externs in files
- Now we just have mass includes!
* Added settings.h


svn: 773

Bryan Drewery 22 年之前
父節點
當前提交
2b3124b4ba
共有 55 個文件被更改,包括 324 次插入443 次删除
  1. 6 10
      src/auth.c
  2. 10 0
      src/auth.h
  3. 1 2
      src/bg.c
  4. 2 0
      src/bg.h
  5. 3 9
      src/botcmd.c
  6. 2 0
      src/botcmd.h
  7. 2 6
      src/botmsg.c
  8. 4 11
      src/botnet.c
  9. 7 0
      src/botnet.h
  10. 72 99
      src/cfg.c
  11. 40 0
      src/cfg.h
  12. 1 12
      src/chanprog.c
  13. 10 0
      src/chanprog.h
  14. 3 19
      src/cmds.c
  15. 10 0
      src/cmds.h
  16. 1 6
      src/conf.c
  17. 1 1
      src/conf.h
  18. 2 6
      src/core_binds.c
  19. 13 25
      src/dcc.c
  20. 4 2
      src/dcc.h
  21. 4 12
      src/dccutil.c
  22. 2 0
      src/dccutil.h
  23. 3 6
      src/debug.c
  24. 2 0
      src/debug.h
  25. 1 6
      src/dns.c
  26. 2 5
      src/flags.c
  27. 2 9
      src/log.c
  28. 2 0
      src/log.h
  29. 14 33
      src/main.c
  30. 9 2
      src/main.h
  31. 4 24
      src/misc.c
  32. 3 0
      src/misc.h
  33. 0 2
      src/mod/console.mod/console.c
  34. 0 4
      src/mod/ctcp.mod/ctcp.c
  35. 3 1
      src/mod/irc.mod/irc.c
  36. 2 2
      src/mod/module.h
  37. 1 4
      src/mod/notes.mod/notes.c
  38. 16 24
      src/mod/server.mod/server.c
  39. 1 0
      src/mod/server.mod/server.h
  40. 2 0
      src/mod/server.mod/servmsg.c
  41. 3 2
      src/mod/static.h
  42. 0 5
      src/mod/update.mod/update.c
  43. 3 36
      src/modules.c
  44. 1 0
      src/modules.h
  45. 10 13
      src/net.c
  46. 13 0
      src/net.h
  47. 10 0
      src/settings.h
  48. 2 9
      src/shell.c
  49. 1 5
      src/tclhash.c
  50. 0 5
      src/tclhash.h
  51. 2 6
      src/userent.c
  52. 5 13
      src/userrec.c
  53. 4 0
      src/userrec.h
  54. 0 7
      src/users.c
  55. 3 0
      src/users.h

+ 6 - 10
src/auth.c

@@ -7,6 +7,7 @@
 #include "common.h"
 #include "auth.h"
 #include "misc.h"
+#include "main.h"
 #include "types.h"
 #include "egg_timer.h"
 #include "users.h"
@@ -30,21 +31,16 @@
 
 #include "stat.h"
 
-extern struct userrec 		*userlist;
-extern struct dcc_t		*dcc;
-extern struct chanset_t		*chanset;
-extern time_t			 now;
-
-
-#if defined(S_AUTHHASH) || defined(S_DCCAUTH)
-extern char 			authkey[];
-#endif /* S_AUTHHASH || S_DCCAUTH */
 #ifdef S_AUTHCMDS
 int 				auth_total = 0;
-int 				max_auth = 100;
+static int 			max_auth = 100;
 struct auth_t 			*auth = NULL;
 #endif /* S_AUTHCMDS */
 
+#if defined(S_AUTHHASH) || defined(S_DCCAUTH)
+char                            authkey[121] = "";      /* This is one of the keys used in the auth hash */
+#endif /* S_AUTHHASH || S_DCCAUTH */
+
 #ifdef S_AUTHCMDS
 void init_auth_max()
 {

+ 10 - 0
src/auth.h

@@ -27,6 +27,16 @@ void removeauth(int);
 # if defined(S_AUTHHASH) || defined(S_DCCAUTH)
 char *makehash(struct userrec *, char *);
 # endif /* S_AUTHHASH || S_DCCAUTH */
+
+
+#ifdef S_AUTHCMDS
+extern int			auth_total;
+extern struct auth_t		*auth;
+#endif /* S_AUTHCMDS */
+#if defined(S_AUTHHASH) || defined(S_DCCAUTH)
+extern char                     authkey[121];
+#endif /* S_AUTHHASH || S_DCCAUTH */
+
 #endif /* !MAKING_MODS */
 
 #endif /* !_AUTH_H */

+ 1 - 2
src/bg.c

@@ -13,8 +13,7 @@
 #include <sys/ptrace.h>
 #endif
 
-extern time_t	lastfork, now;
-extern conf_t	conf;
+time_t  lastfork = 0;
 
 /* Do everything we normally do after we have split off a new
  * process to the background. This includes writing a PID file

+ 2 - 0
src/bg.h

@@ -2,6 +2,8 @@
 #define _BG_H
 
 #ifndef MAKING_MODS
+extern time_t 		lastfork;
+
 void do_fork();
 void bg_do_split();
 #endif /* !MAKING_MODS */

+ 3 - 9
src/botcmd.c

@@ -7,6 +7,7 @@
 
 #include "common.h"
 #include "botcmd.h"
+#include "main.h"
 #include "src/mod/share.mod/share.h"
 #include "src/mod/update.mod/update.h"
 #include "net.h"
@@ -26,14 +27,7 @@
 #include "modules.h"
 #include "core_binds.h"
 
-extern char		 ver[], admin[], network[], motdfile[];
-extern int		 dcc_total, remote_boots, noshare, timesync, conmask;
-extern struct dcc_t	*dcc;
-extern struct chanset_t	*chanset;
-extern struct userrec	*userlist;
-extern time_t		 now, online_since;
-extern party_t		*party;
-extern module_entry	*module_list;
+int remote_boots = 2;
 
 static char TBUF[1024] = "";		/* Static buffer for goofy bot stuff */
 
@@ -1408,7 +1402,7 @@ static void bot_rsim(char *botnick, char *code, char *msg)
     strcpy(dcc[idx].nick, nick);
     egg_snprintf(buf, sizeof buf, "%s@%s", nick, botnick);
     strcpy(dcc[idx].host, buf);
-    dcc[idx].addr = 0;
+    dcc[idx].addr = 0L;
     dcc[idx].user = get_user_by_handle(userlist, nick);
   }
   rmspace(par);

+ 2 - 0
src/botcmd.h

@@ -3,6 +3,8 @@
 
 
 #ifndef MAKING_MODS
+extern int		remote_boots;
+
 void bounce_simul(int, char *);
 void send_remote_simul(int, char *, char *, char *);
 void bot_share(int, char *);

+ 2 - 6
src/botmsg.c

@@ -10,6 +10,8 @@
 #include "common.h"
 #include "misc.h"
 #include "dcc.h"
+#include "userrec.h"
+#include "main.h"
 #include "net.h"
 #include "users.h"
 #include "cfg.h"
@@ -23,12 +25,6 @@
 #include "src/mod/notes.mod/notes.h"
 #include <stdarg.h>
 
-extern struct dcc_t	*dcc;
-extern int		 dcc_total, tands;
-extern time_t now;
-extern party_t		*party;
-extern struct userrec	*userlist;
-
 static char	OBUF[SGRAB - 110] = "";
 
 

+ 4 - 11
src/botnet.c

@@ -28,22 +28,15 @@
 # endif /* S_AUTOLOCK */
 #endif /* HUB */
 
-extern int			dcc_total, backgrd, connect_timeout, max_dcc,
-				cfg_count;
-extern struct userrec		*userlist;
-extern struct dcc_t		*dcc;
-extern time_t 			now, buildts;
-extern struct cfg_entry 	**cfg;
-
-
 tand_t			*tandbot = NULL;		/* Keep track of tandem bots on the
 							   botnet */
 party_t			*party = NULL;			/* Keep track of people on the botnet */
+int			tands = 0;			/* Number of bots on the botnet */
+
 static int 		maxparty = 100;			/* Maximum space for party line members
 							   currently */
-int			tands = 0;			/* Number of bots on the botnet */
-int			parties = 0;			/* Number of people on the botnet */
-int			share_unlinks = 1;		/* Allow remote unlinks of my
+static int		parties = 0;			/* Number of people on the botnet */
+static int		share_unlinks = 1;		/* Allow remote unlinks of my
 							   sharebots? */
 
 void init_bots()

+ 7 - 0
src/botnet.h

@@ -5,7 +5,14 @@
 #  include "config.h"
 #endif
 
+#include "tandem.h"
+
 #ifndef MAKING_MODS
+
+extern tand_t		*tandbot;
+extern party_t		*party;
+extern int		tands;
+
 void restart_chons();
 void lower_bot_linked(int idx);
 void higher_bot_linked(int idx);

+ 72 - 99
src/cfg.c

@@ -8,6 +8,7 @@
 #include "cmds.h"
 #include "cfg.h"
 #include "userrec.h"
+#include "auth.h"
 #include "misc.h"
 #include "users.h"
 #include "dccutil.h"
@@ -26,26 +27,22 @@
 
 #include "stat.h"
 
-extern struct userrec 		*userlist;
-extern time_t		 	now;
-
 int 				cfg_count = 0, cfg_noshare = 0;
 struct cfg_entry 		**cfg = NULL;
-
-#if defined(S_AUTHHASH) || defined(S_DCCAUTH)
-char 				authkey[121] = "";	/* This is one of the keys used in the auth hash */
-#endif /* S_AUTHHASH || S_DCCAUTH */
-
 char 				cmdprefix[1] = "+";	/* This is the prefix for msg/channel cmds */
+#ifdef S_DCCPASS
+struct cmd_pass 		*cmdpass = NULL;
+#endif /* S_DCCPASS */
 
-struct cfg_entry CFG_MOTD = {
-  "motd", CFGF_GLOBAL, NULL, NULL,
-  NULL, NULL, NULL
+struct cfg_entry CFG_MOTD = { 
+	"motd", CFGF_GLOBAL, NULL, NULL, 
+	NULL, NULL, NULL 
 };
 
 #if defined(S_AUTHHASH) || defined(S_DCCAUTH)
 void authkey_describe(struct cfg_entry * entry, int idx) {
-  dprintf(idx, STR("authkey is used for authing, give to your users if they are to use DCC chat or IRC cmds. (can be bot specific)\n"));
+  dprintf(idx, 
+  STR("authkey is used for authing, give to your users if they are to use DCC chat or IRC cmds. (can be bot specific)\n"));
 }
 
 void authkey_changed(struct cfg_entry * entry, char * olddata, int * valid) {
@@ -57,13 +54,12 @@ void authkey_changed(struct cfg_entry * entry, char * olddata, int * valid) {
 }
 
 struct cfg_entry CFG_AUTHKEY = {
-  "authkey", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
-  authkey_changed, authkey_changed, authkey_describe
+	"authkey", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL, 
+	authkey_changed, authkey_changed, authkey_describe
 };
 #endif /* S_AUTHHASH || S_DCCAUTH */
 
 #ifdef S_MSGCMDS
-struct cfg_entry CFG_MSGOP, CFG_MSGPASS, CFG_MSGINVITE, CFG_MSGIDENT;
 void msgcmds_describe(struct cfg_entry *entry, int idx) {
   if (entry == &CFG_MSGOP)
     dprintf(idx, STR("msgop defines the cmd for opping via msging the bot (leave blank to disable)\n"));
@@ -75,27 +71,24 @@ void msgcmds_describe(struct cfg_entry *entry, int idx) {
     dprintf(idx, STR("msgident defines the cmd for identing via msging the bot (leave blank to disable)\n"));
 }
 
-void msgcmds_changed(struct cfg_entry * entry, char * olddata, int * valid) {
-}
-
 struct cfg_entry CFG_MSGOP = {
-  "msgop", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
-  msgcmds_changed, msgcmds_changed, msgcmds_describe
+	"msgop", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
+	NULL, NULL, msgcmds_describe
 };
 
 struct cfg_entry CFG_MSGPASS = {
-  "msgpass", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
-  msgcmds_changed, msgcmds_changed, msgcmds_describe
+	"msgpass", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
+	NULL, NULL, msgcmds_describe
 };
 
 struct cfg_entry CFG_MSGINVITE = {
-  "msginvite", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
-  msgcmds_changed, msgcmds_changed, msgcmds_describe
+	"msginvite", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
+	NULL, NULL, msgcmds_describe
 };
 
 struct cfg_entry CFG_MSGIDENT = {
-  "msgident", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
-  msgcmds_changed, msgcmds_changed, msgcmds_describe
+	"msgident", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
+	NULL, NULL, msgcmds_describe
 };
 #endif /* S_MSGCMDS */
 
@@ -112,23 +105,11 @@ void cmdprefix_changed(struct cfg_entry * entry, char * olddata, int * valid) {
 }
 
 struct cfg_entry CFG_CMDPREFIX = {
-  "cmdprefix", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
-  cmdprefix_changed, cmdprefix_changed, cmdprefix_describe
+	"cmdprefix", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
+	cmdprefix_changed, cmdprefix_changed, cmdprefix_describe
 };
 
 
-struct cfg_entry
-  CFG_BADCOOKIE,
-  CFG_MANUALOP,
-#ifdef G_MEAN
-  CFG_MEANDEOP,
-  CFG_MEANKICK,
-  CFG_MEANBAN,
-#endif /* G_MEAN */
-  CFG_MDOP,
-  CFG_MOP;
-
-
 void deflag_describe(struct cfg_entry *cfgent, int idx)
 {
   if (cfgent == &CFG_BADCOOKIE)
@@ -162,41 +143,41 @@ void deflag_changed(struct cfg_entry *entry, char *oldval, int *valid)
 }
 
 struct cfg_entry CFG_BADCOOKIE = {
-  "bad-cookie", CFGF_GLOBAL, NULL, NULL,
-  deflag_changed, NULL, deflag_describe
+	"bad-cookie", CFGF_GLOBAL, NULL, NULL,
+	deflag_changed, NULL, deflag_describe
 };
 
 struct cfg_entry CFG_MANUALOP = {
-  "manop", CFGF_GLOBAL, NULL, NULL,
-  deflag_changed, NULL, deflag_describe
+	"manop", CFGF_GLOBAL, NULL, NULL,
+	deflag_changed, NULL, deflag_describe
 };
 
 #ifdef G_MEAN
 struct cfg_entry CFG_MEANDEOP = {
-  "mean-deop", CFGF_GLOBAL, NULL, NULL,
-  deflag_changed, NULL, deflag_describe
+	"mean-deop", CFGF_GLOBAL, NULL, NULL,
+	deflag_changed, NULL, deflag_describe
 };
 
 
 struct cfg_entry CFG_MEANKICK = {
-  "mean-kick", CFGF_GLOBAL, NULL, NULL,
-  deflag_changed, NULL, deflag_describe
+	"mean-kick", CFGF_GLOBAL, NULL, NULL,
+	deflag_changed, NULL, deflag_describe
 };
 
 struct cfg_entry CFG_MEANBAN = {
-  "mean-ban", CFGF_GLOBAL, NULL, NULL,
-  deflag_changed, NULL, deflag_describe
+	"mean-ban", CFGF_GLOBAL, NULL, NULL,
+	deflag_changed, NULL, deflag_describe
 };
 #endif /* G_MEAN */
 
 struct cfg_entry CFG_MDOP = {
-  "mdop", CFGF_GLOBAL, NULL, NULL,
-  deflag_changed, NULL, deflag_describe
+	"mdop", CFGF_GLOBAL, NULL, NULL,
+	deflag_changed, NULL, deflag_describe
 };
 
 struct cfg_entry CFG_MOP = {
-  "mop", CFGF_GLOBAL, NULL, NULL,
-  deflag_changed, NULL, deflag_describe
+	"mop", CFGF_GLOBAL, NULL, NULL,
+	deflag_changed, NULL, deflag_describe
 };
 
 void deflag_user(struct userrec *u, int why, char *msg, struct chanset_t *chan)
@@ -323,8 +304,8 @@ void fork_describe(struct cfg_entry * cfgent, int idx) {
 }
 
 struct cfg_entry CFG_FORKINTERVAL = {
-  "fork-interval", CFGF_GLOBAL | CFGF_LOCAL, NULL, NULL,
-  fork_gchanged, fork_lchanged, fork_describe
+	"fork-interval", CFGF_GLOBAL | CFGF_LOCAL, NULL, NULL,
+	fork_gchanged, fork_lchanged, fork_describe
 };
 
 void detect_lchanged(struct cfg_entry * cfgent, char * oldval, int * valid) {
@@ -348,43 +329,40 @@ void detect_gchanged(struct cfg_entry * cfgent, char * oldval, int * valid) {
 
 #ifdef S_LASTCHECK
 struct cfg_entry CFG_LOGIN = {
-  "login", CFGF_GLOBAL | CFGF_LOCAL, NULL, NULL,
-  detect_gchanged, detect_lchanged, misc_describe
+	"login", CFGF_GLOBAL | CFGF_LOCAL, NULL, NULL,
+	detect_gchanged, detect_lchanged, misc_describe
 };
 #endif /* S_LASTCHECK */
 #ifdef S_HIJACKCHECK
 struct cfg_entry CFG_HIJACK = {
-  "hijack", CFGF_GLOBAL | CFGF_LOCAL, NULL, NULL,
-  detect_gchanged, detect_lchanged, misc_describe
+	"hijack", CFGF_GLOBAL | CFGF_LOCAL, NULL, NULL,
+	detect_gchanged, detect_lchanged, misc_describe
 };
 #endif /* S_HIJACKCHECK */
 #ifdef S_ANTITRACE
 struct cfg_entry CFG_TRACE = {
-  "trace", CFGF_GLOBAL | CFGF_LOCAL, NULL, NULL,
-  detect_gchanged, detect_lchanged, misc_describe
+	"trace", CFGF_GLOBAL | CFGF_LOCAL, NULL, NULL,
+	detect_gchanged, detect_lchanged, misc_describe
 };
 #endif /* S_ANTITRACE */
 #ifdef S_PROMISC
 struct cfg_entry CFG_PROMISC = {
-  "promisc", CFGF_GLOBAL | CFGF_LOCAL, NULL, NULL,
-  detect_gchanged, detect_lchanged, misc_describe
+	"promisc", CFGF_GLOBAL | CFGF_LOCAL, NULL, NULL,
+	detect_gchanged, detect_lchanged, misc_describe
 };
 #endif /* S_PROMISC */
 #ifdef S_PROCESSCHECK
 struct cfg_entry CFG_BADPROCESS = {
-  "bad-process", CFGF_GLOBAL | CFGF_LOCAL, NULL, NULL,
-  detect_gchanged, detect_lchanged, misc_describe
+	"bad-process", CFGF_GLOBAL | CFGF_LOCAL, NULL, NULL,
+	detect_gchanged, detect_lchanged, misc_describe
 };
 
 struct cfg_entry CFG_PROCESSLIST = {
-  "process-list", CFGF_GLOBAL | CFGF_LOCAL, NULL, NULL,
-  NULL, NULL, misc_describe
+	"process-list", CFGF_GLOBAL | CFGF_LOCAL, NULL, NULL,
+	NULL, NULL, misc_describe
 };
 #endif /* S_PROCESSCHECK */
 
-#ifdef S_DCCPASS
-struct cmd_pass *cmdpass = NULL;
-#endif /* S_DCCPASS */
 
 /* this is cfg shit from servers/irc/ctcp because hub doesnt load
  * these mods */
@@ -392,41 +370,36 @@ struct cmd_pass *cmdpass = NULL;
 void servers_describe(struct cfg_entry * entry, int idx) {
   dprintf(idx, STR("servers is a comma-separated list of servers the bot will use\n"));
 }
-void servers_changed(struct cfg_entry * entry, char * olddata, int * valid) {
-}
+
 void servers6_describe(struct cfg_entry * entry, int idx) {
   dprintf(idx, STR("servers6 is a comma-separated list of servers the bot will use (FOR IPv6)\n"));
 }
-void servers6_changed(struct cfg_entry * entry, char * olddata, int * valid) {
-}
+
 void nick_describe(struct cfg_entry * entry, int idx) {
   dprintf(idx, STR("nick is the bots preferred nick when connecting/using .resetnick\n"));
 }
-void nick_changed(struct cfg_entry * entry, char * olddata, int * valid) {
-}
+
 void realname_describe(struct cfg_entry * entry, int idx) {
   dprintf(idx, STR("realname is the bots \"real name\" when connecting\n"));
 }
 
-void realname_changed(struct cfg_entry * entry, char * olddata, int * valid) {
-}
 struct cfg_entry CFG_SERVERS = {
-  "servers", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
-  servers_changed, servers_changed, servers_describe
+	"servers", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
+	NULL, NULL, servers_describe
 };
 struct cfg_entry CFG_SERVERS6 = {
-  "servers6", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
-  servers6_changed, servers6_changed, servers6_describe
+	"servers6", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
+	NULL, NULL, servers6_describe
 };
 
 struct cfg_entry CFG_NICK = {
-  "nick", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
-  nick_changed, nick_changed, nick_describe
+	"nick", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
+	NULL, NULL, nick_describe
 };
 
 struct cfg_entry CFG_REALNAME = {
-  "realname", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
-  realname_changed, realname_changed, realname_describe
+	"realname", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
+	NULL, NULL, realname_describe
 };
 
 void getin_describe(struct cfg_entry *cfgent, int idx)
@@ -527,35 +500,35 @@ void getin_changed(struct cfg_entry *cfgent, char *oldval, int *valid)
 }
 
 struct cfg_entry CFG_OPBOTS = {
-  "op-bots", CFGF_GLOBAL, NULL, NULL,
-  getin_changed, NULL, getin_describe
+	"op-bots", CFGF_GLOBAL, NULL, NULL,
+	getin_changed, NULL, getin_describe
 };
 
 #ifdef S_AUTOLOCK
 struct cfg_entry CFG_FIGHTTHRESHOLD = {
-  "fight-threshold", CFGF_GLOBAL, NULL, NULL,
-  getin_changed, NULL, getin_describe
+	"fight-threshold", CFGF_GLOBAL, NULL, NULL,
+	getin_changed, NULL, getin_describe
 };
 #endif /* S_AUTOLOCK */
 
 struct cfg_entry CFG_INBOTS = {
-  "in-bots", CFGF_GLOBAL, NULL, NULL,
-  getin_changed, NULL, getin_describe
+	"in-bots", CFGF_GLOBAL, NULL, NULL,
+	getin_changed, NULL, getin_describe
 };
 
 struct cfg_entry CFG_LAGTHRESHOLD = {
-  "lag-threshold", CFGF_GLOBAL, NULL, NULL,
-  getin_changed, NULL, getin_describe
+	"lag-threshold", CFGF_GLOBAL, NULL, NULL,
+	getin_changed, NULL, getin_describe
 };
 
 struct cfg_entry CFG_OPREQUESTS = {
-  "op-requests", CFGF_GLOBAL, NULL, NULL,
-  getin_changed, NULL, getin_describe
+	"op-requests", CFGF_GLOBAL, NULL, NULL,
+	getin_changed, NULL, getin_describe
 };
 
 struct cfg_entry CFG_OPTIMESLACK = {
-  "op-time-slack", CFGF_GLOBAL, NULL, NULL,
-  getin_changed, NULL, getin_describe
+	"op-time-slack", CFGF_GLOBAL, NULL, NULL,
+	getin_changed, NULL, getin_describe
 };
 #endif /* HUB */
 

+ 40 - 0
src/cfg.h

@@ -18,6 +18,40 @@ typedef struct cfg_entry {
   void (*describe) (struct cfg_entry *, int idx);
 } cfg_entry_T;
 
+extern struct cfg_entry CFG_MOTD, CFG_CMDPREFIX, CFG_BADCOOKIE, CFG_MANUALOP, CFG_MDOP, CFG_MOP, CFG_FORKINTERVAL;
+#if defined(S_AUTHHASH) || defined(S_DCCAUTH)
+extern struct cfg_entry CFG_AUTHKEY;
+#endif /* S_AUTHHASH || S_DCCAUTH */
+#ifdef S_MSGCMDS
+extern struct cfg_entry CFG_MSGOP, CFG_MSGPASS, CFG_MSGINVITE, CFG_MSGIDENT;
+#endif /* S_MSGCMDS */
+#ifdef G_MEAN
+extern struct cfg_entry CFG_MEANDEOP, CFG_MEANKICK, CFG_MEANBAN;
+#endif /* G_MEAN */
+#ifdef S_LASTCHECK
+extern struct cfg_entry CFG_LOGIN;
+#endif /* S_LASTCHECK */
+#ifdef S_HIJACKCHECK
+extern struct cfg_entry CFG_HIJACK;
+#endif /* S_HIJACKCHECK */
+#ifdef S_ANTITRACE
+extern struct cfg_entry CFG_TRACE;
+#endif /* S_ANTITRACE */
+#ifdef S_PROMISC
+extern struct cfg_entry CFG_PROMISC;
+#endif /* S_PROMISC */
+#ifdef S_PROCESSCHECK
+extern struct cfg_entry CFG_BADPROCESS, CFG_PROCESSLIST;
+#endif /* S_PROCESSCHECK */
+
+#ifdef HUB
+extern struct cfg_entry CFG_SERVERS, CFG_SERVERS6, CFG_NICK, CFG_REALNAME,
+	CFG_INBOTS, CFG_LAGTHRESHOLD, CFG_OPREQUESTS, CFG_OPTIMESLACK;
+#ifdef S_AUTOLOCK
+struct cfg_entry CFG_FIGHTTHRESHOLD;
+#endif /* S_AUTOLOCK */
+#endif /* HUB */
+
 #ifndef MAKING_MODS
 void set_cfg_str(char *, char *, char *);
 void add_cfg(struct cfg_entry *);
@@ -28,7 +62,13 @@ void trigger_cfg_changed();
 int check_cmd_pass(const char *, char *);
 int has_cmd_pass(const char *);
 void set_cmd_pass(char *, int);
+
+extern struct cmd_pass            *cmdpass;
 #endif /* S_DCCPASS */
+
+extern char			cmdprefix[];
+extern int			cfg_count, cfg_noshare;
+extern struct cfg_entry		**cfg;
 #endif /* MAKING_MODS */
 
 #endif /* !_CFG_H */

+ 1 - 12
src/chanprog.c

@@ -11,6 +11,7 @@
 
 #include "common.h"
 #include "chanprog.h"
+#include "settings.h"
 #include "src/mod/channels.mod/channels.h"
 #include "rfc1459.h"
 #include "net.h"
@@ -30,18 +31,6 @@
 #include <sys/utsname.h>
 #include "modules.h"
 
-extern struct userrec	*userlist;
-extern char		 ver[], firewall[],  
-			 motdfile[], userfile[], tempdir[],
-			 owner[], 
-                         botuser[], *owners, *hubs;
-
-extern time_t		 now, online_since;
-extern int		 backgrd, term_z, cache_hit, cache_miss,
-			 firewallport, default_flags, conmask,
-			 noshare, localhub,
-			 ignore_time, loading;
-
 struct chanset_t 	*chanset = NULL;	/* Channel list			*/
 char 			admin[121] = "";	/* Admin info			*/
 char 			origbotname[NICKLEN + 1] = "";

+ 10 - 0
src/chanprog.h

@@ -1,6 +1,8 @@
 #ifndef _CHANPROG_H
 #define _CHANPROG_H
 
+#include "src/chan.h"
+
 #define DO_LOCAL	1
 #define DO_NET		2
 
@@ -25,6 +27,14 @@ 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 *);
+
+
+extern struct chanset_t		*chanset;
+extern char			admin[], origbotname[], botname[];
+#ifdef HUB
+extern int			my_port;
+#endif /* HUB */
+
 #endif /* !MAKING_MODS */
 
 #endif /* !_CHANPROG_H */

+ 3 - 19
src/cmds.c

@@ -7,6 +7,7 @@
 
 #include "common.h"
 #include "cmds.h"
+#include "settings.h"
 #include "debug.h"
 #include "dcc.h"
 #include "shell.h"
@@ -39,29 +40,12 @@
 #include <sys/types.h>
 #include <sys/utsname.h>
 
-extern struct chanset_t	 *chanset;
-extern struct dcc_t	 *dcc;
-extern struct userrec	 *userlist;
-extern int		 dcc_total, backgrd, 
-			 do_restart, conmask, 
-			 strict_host, cfg_count,
-			 server_lag, localhub;
-
-extern egg_traffic_t traffic;
-extern char		 origbotname[], ver[], network[],
-			 owner[], quit_msg[], dcc_prefix[], 
-                         botname[], *binname, version[], egg_version[];
-extern time_t		 now, online_since, buildts;
-extern module_entry	*module_list;
-extern struct cfg_entry	CFG_MOTD, **cfg;
-extern tand_t		*tandbot;
-extern conf_t		conf;
+extern egg_traffic_t 	traffic;
 
-static char		 *btos(unsigned long);
 mycmds 			 cmdlist[500]; /* the list of dcc cmds for help system */
 int    			 cmdi = 0;
-int         		remote_boots = 2;
 
+static char		 *btos(unsigned long);
 
 #ifdef HUB
 static void tell_who(struct userrec *u, int idx, int chan)

+ 10 - 0
src/cmds.h

@@ -10,6 +10,11 @@ typedef struct {
   char          *funcname;
 } cmd_t;
 
+typedef struct {
+        char *name;
+        struct flag_record     flags;
+} mycmds;
+
 typedef struct {
   char *name;
   Function func;
@@ -25,6 +30,11 @@ typedef struct cmd_pass {
 
 
 #ifndef MAKING_MODS
+
+extern mycmds 		cmdlist[]; 
+extern int		cmdi;
+
+
 int check_dcc_attrs(struct userrec *, int);
 int check_dcc_chanattrs(struct userrec *, char *, int, int);
 int stripmodes(char *);

+ 1 - 6
src/conf.c

@@ -8,6 +8,7 @@
 #include "conf.h"
 #include "shell.h"
 #include "debug.h"
+#include "chanprog.h"
 #include "crypt.h"
 #include "main.h"
 #include "salt.h"
@@ -23,12 +24,6 @@
 #include <sys/stat.h>
 #include <signal.h>
 
-extern char             origbotname[], tempdir[],
-                        userfile[], natip[], *binname;
-extern int              localhub, updating;
-extern uid_t		myuid;
-extern conf_t           conf;
-
 conf_t		conf;		/* global conf struct */
 conf_t 		conffile;	/* just some config options only avail during loading */
 

+ 1 - 1
src/conf.h

@@ -36,7 +36,7 @@ typedef struct conf_b {
   conf_bot *bot;        /* single bot (me) */
 } conf_t;
 
-extern conf_t		conf;
+extern conf_t		conf, conffile;
 
 enum {
   CONF_ENC = 1,

+ 2 - 6
src/core_binds.c

@@ -8,6 +8,8 @@
 #include "common.h"
 #include "dccutil.h"
 #include "userrec.h"
+#include "main.h"
+#include "settings.h"
 #include "users.h"
 #include "misc.h"
 #include "tclhash.h"
@@ -16,12 +18,6 @@
 #endif /* S_DCCPASS */
 
 extern cmd_t 		C_dcc[];
-extern struct dcc_t 	*dcc;
-extern struct userrec 	*userlist;
-extern time_t 		now;
-extern char             dcc_prefix[];
-
-
 
 static bind_table_t *BT_link = NULL, *BT_disc = NULL, *BT_away = NULL, *BT_dcc = NULL;
 static bind_table_t *BT_chat = NULL, *BT_act = NULL, *BT_bcst = NULL, *BT_note = NULL;

+ 13 - 25
src/dcc.c

@@ -8,7 +8,9 @@
 
 #include "common.h"
 #include "dcc.h"
+#include "settings.h"
 #include "tclhash.h"
+#include "main.h"
 #include "cmds.h"
 #include "color.h"
 #include "salt.h"
@@ -38,38 +40,24 @@
 #include "core_binds.h"
 
 
-extern struct userrec	*userlist;
-extern struct chanset_t	*chanset;
-extern time_t		 now, buildts;
-extern int		 connect_timeout, conmask, backgrd,
-			 max_dcc, default_flags, debug_output,
-			 ignore_time;
-extern char		 ver[], origbotname[], bdhash[],
-                         dcc_prefix[];
-
-extern sock_list 	*socklist;
-extern int 		MAXSOCKS;
-
 struct dcc_t *dcc = NULL;	/* DCC list				   */
 int	timesync = 0;
 int	dcc_total = 0;		/* Total dcc's				   */
-int	allow_new_telnets = 0;	/* Allow people to introduce themselves
-				   via telnet				   */
-int	use_telnet_banner = 0;	/* Display telnet banner?		   */
 char	network[41] = "EFnet"; /* Name of the IRC network you're on  */
-int	password_timeout = 20;	/* Time to wait for a password from a user */
-int     auth_timeout = 40;
-int	bot_timeout = 15;	/* Bot timeout value			   */
-int	identtimeout = 15;	/* Timeout value for ident lookups	   */
-int	dupwait_timeout = 5;	/* Timeout for rejecting duplicate entries */
+
+static int	password_timeout = 20;	/* Time to wait for a password from a user */
+static int     auth_timeout = 40;
+static int	bot_timeout = 15;	/* Bot timeout value			   */
+static int	identtimeout = 15;	/* Timeout value for ident lookups	   */
+static int	dupwait_timeout = 5;	/* Timeout for rejecting duplicate entries */
 #ifdef LEAF
-int	protect_telnet = 0;	/* Even bother with ident lookups :)	   */
+static int	protect_telnet = 0;	/* Even bother with ident lookups :)	   */
 #else /* !LEAF */
-int     protect_telnet = 1;
+static int     protect_telnet = 1;
 #endif /* LEAF */
-int	flood_telnet_thr = 10;	/* Number of telnet connections to be
-				   considered a flood			   */
-int	flood_telnet_time = 5;	/* In how many seconds?			   */
+static int	flood_telnet_thr = 10;	/* Number of telnet connections to be
+					   considered a flood			   */
+static int	flood_telnet_time = 5;	/* In how many seconds?			   */
 
 static void dcc_telnet_hostresolved(int);
 static void dcc_telnet_got_ident(int, char *);

+ 4 - 2
src/dcc.h

@@ -207,8 +207,10 @@ struct dupwait_info {
 
 #ifndef MAKING_MODS
 
-extern struct dcc_t *dcc;
-extern int dcc_total;
+extern struct dcc_t 		*dcc;
+extern int 			dcc_total, timesync;
+extern char			network[];
+
 extern struct dcc_table DCC_CHAT, DCC_BOT, DCC_LOST, DCC_BOT_NEW,
  DCC_RELAY, DCC_RELAYING, DCC_FORK_RELAY, DCC_PRE_RELAY, DCC_CHAT_PASS,
  DCC_FORK_BOT, DCC_SOCKET, DCC_TELNET_ID, DCC_TELNET_NEW, DCC_TELNET_PW,

+ 4 - 12
src/dccutil.c

@@ -12,7 +12,9 @@
 #include "common.h"
 #include "color.h"
 #include "dcc.h"
+#include "botnet.h"
 #include "net.h"
+#include "main.h"
 #include "dccutil.h"
 #include "misc.h"
 #include "botcmd.h"
@@ -24,23 +26,13 @@
 #include "src/mod/server.mod/server.h"
 #include <stdarg.h>
 
-extern struct dcc_t	*dcc;
-extern int		 dcc_total, backgrd, MAXSOCKS, tands;
-#ifdef USE_IPV6
-extern unsigned long     notalloc;
-#endif /* USE_IPV6 */
-extern char		 version[];
-extern time_t		 now;
-extern sock_list	*socklist;
-
 static struct portmap 	*root = NULL;
 
-char	motdfile[121] = "text/motd";	/* File where the motd is stored */
 int	connect_timeout = 15;		/* How long to wait before a telnet
 					   connection times out */
 int         max_dcc = 200;              /* needs at least 4 or 5 just to
                                            get started. 20 should be enough   */
-int         dcc_flood_thr = 3;
+static int         dcc_flood_thr = 3;
 
 void init_dcc_max()
 {
@@ -649,7 +641,7 @@ int listen_all(int lport, int off)
                i6 == -1 ? "it's taken." : "couldn't assign ip.");
       } else {
         idx = new_dcc(&DCC_TELNET, 0);
-        dcc[idx].addr = notalloc;
+        dcc[idx].addr = 0L;
         strcpy(dcc[idx].addr6, myipstr(6));
         dcc[idx].port = port;
         dcc[idx].sock = i6;

+ 2 - 0
src/dccutil.h

@@ -45,6 +45,8 @@ 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);
+
+extern int		max_dcc, connect_timeout;
 #endif /* !MAKING_MODS */
 
 #endif /* !_DCCUTIL_H */

+ 3 - 6
src/debug.c

@@ -9,6 +9,7 @@
 
 #include "common.h"
 #include "debug.h"
+#include "chanprog.h"
 #include "net.h"
 #include "shell.h"
 #include "color.h"
@@ -25,10 +26,8 @@
 #include <unistd.h>
 #include <stdarg.h>
 
-extern int 		 sdebug, backgrd, do_restart;
-extern char		 tempdir[], origbotname[], ver[];
-extern time_t		 now, buildts;
-extern jmp_buf           alarmret;
+int		sdebug = 0;             /* enable debug output? */
+
 
 #ifdef DEBUG_CONTEXT
 /* Context storage for fatal crashes */
@@ -80,8 +79,6 @@ void init_debug()
 #endif /* DEBUG_CONTEXT */
 }
 
-int		sdebug = 0;             /* enable debug output? */
-
 void sdprintf (char *format, ...)
 {
   if (sdebug) {

+ 2 - 0
src/debug.h

@@ -54,6 +54,8 @@
 
 
 #ifndef MAKING_MODS
+extern int		sdebug;
+
 void sdprintf (char *, ...);
 void init_signals();
 void init_debug();

+ 1 - 6
src/dns.c

@@ -8,6 +8,7 @@
 
 #include "common.h"
 #include "dccutil.h"
+#include "main.h"
 #include "net.h"
 #include "misc.h"
 #include "src/mod/dns.mod/dns.h"
@@ -19,12 +20,6 @@
 
 #include "dns.h"
 
-extern struct dcc_t	*dcc;
-extern int		 dcc_total;
-extern int		 resolve_timeout;
-extern time_t		 now;
-extern jmp_buf		 alarmret;
-
 devent_t	*dns_events = NULL;
 
 

+ 2 - 5
src/flags.c

@@ -8,16 +8,13 @@
 #include "crypt.h"
 #include "src/mod/share.mod/share.h"
 #include "rfc1459.h"
+#include "userrec.h"
 #include "misc.h"
 #include "dccutil.h"
 #include "userent.h"
 #include "users.h"
 
-extern int		 noshare;
-extern struct dcc_t	*dcc;
-extern struct userrec   *userlist;
-
-int                     allow_dk_cmds = 1;
+static int                     allow_dk_cmds = 1;
 
 /* Some flags are mutually exclusive -- this roots them out
  */

+ 2 - 9
src/log.c

@@ -8,6 +8,8 @@
 #include "common.h"
 #include "log.h"
 #include "tandem.h"
+#include "userrec.h"
+#include "botnet.h"
 #include "botmsg.h"
 #include "dcc.h"
 #include "dccutil.h"
@@ -19,15 +21,6 @@
 #include <ctype.h>
 #include <stdarg.h>
 
-extern struct userrec   *userlist;
-extern tand_t           *tandbot;
-extern struct dcc_t     *dcc;
-extern int               debug_output, backgrd, term_z, 
-			 dcc_total, loading;
-extern struct dcc_t     *dcc;
-extern time_t		now;
-
-
 int	conmask = LOG_MODES | LOG_CMDS | LOG_MISC; /* Console mask */
 int	debug_output = 1;      /* Disply output to server to LOG_SERVEROUT */
 int 	use_console_r = 1;      /* Allow users to set their console +r  */

+ 2 - 0
src/log.h

@@ -42,6 +42,8 @@ void putlog (int, char *, char *, ...);
 int logmodes(char *);
 char *masktype(int);
 char *maskname(int);
+
+extern int		conmask, debug_output, use_console_r;
 #endif /* !MAKING_MODS */
 
 #endif /* !_LOG_H */

+ 14 - 33
src/main.c

@@ -10,6 +10,7 @@
 #include "main.h"
 #include "dcc.h"
 #include "misc.h"
+#include "settings.h"
 #include "salt.h"
 #include "misc_file.h"
 #include "net.h"
@@ -22,7 +23,7 @@
 #include "crypt.h"
 #include "debug.h"
 #include "chanprog.h"
-#include "traffic.h" /* egg_traffic_t */
+#include "traffic.h"
 #include "bg.h"	
 #include "botnet.h"
 #include "build.h"
@@ -34,7 +35,7 @@
 #include <unistd.h>
 #ifdef STOP_UAC				/* osf/1 complains a lot */
 # include <sys/sysinfo.h>
-# define UAC_NOPRINT    0x00000001	/* Don't report unaligned fixups */
+# define UAC_NOPRINT			/* Don't report unaligned fixups */
 #endif /* STOP_UAC */
 #include <sys/file.h>
 #include <sys/stat.h>
@@ -51,31 +52,14 @@
 
 #ifndef _POSIX_SOURCE
 /* Solaris needs this */
-#define _POSIX_SOURCE 1
+#define _POSIX_SOURCE
 #endif
 
-extern char *progname();		/* from settings.c */
-
-extern char		 origbotname[], userfile[], packname[],
-                         shellhash[];
-extern int		 dcc_total, conmask, cache_hit, cache_miss,
-			 fork_interval, optind, local_fork_interval,
-			 sdebug;
-extern struct dcc_t	*dcc;
-extern struct userrec	*userlist;
-extern struct chanset_t	*chanset;
-extern conf_t		conffile;
-
+extern int		optind;
 
 const time_t 	buildts = CVSBUILD;		/* build timestamp (UTC) */
 const char	egg_version[1024] = "1.1.2";
 
-#ifdef S_CONFEDIT
-int	do_confedit = 0;		/* show conf menu if -C */
-#endif /* S_CONFEDIT */
-#ifdef LEAF
-char    do_killbot[21] = "";
-#endif /* LEAF */
 int 	localhub = 1; 		/* we set this to 0 if we get a -B */
 int 	role;
 int 	loading = 0;
@@ -83,20 +67,14 @@ int	default_flags = 0;	/* Default user flags and */
 int	default_uflags = 0;	/* Default userdefinied flags for people
 				   who say 'hello' or for .adduser */
 int	backgrd = 1;		/* Run in the background? */
-time_t 	lastfork = 0;
 uid_t   myuid;
 int	term_z = 0;		/* Foreground: use the terminal as a party line? */
-int 	checktrace = 1;		/* Check for trace when starting up? */
 int 	updating = 0; 		/* this is set when the binary is called from itself. */
 char 	tempdir[DIRMAX] = "";
 char 	*binname = NULL;
 time_t	online_since;		/* Unix-time that the bot loaded up */
 
 char	owner[121] = "";	/* Permanent owner(s) of the bot */
-int	save_users_at = 0;	/* How many minutes past the hour to
-				   save the userfile? */
-int	notify_users_at = 0;	/* How many minutes past the hour to
-				   notify users of notes? */
 char	version[81] = "";	/* Version info (long form) */
 char	ver[41] = "";		/* Version info (short form) */
 int	use_stderr = 1;		/* Send stuff to stderr instead of logfiles? */
@@ -104,9 +82,14 @@ int	do_restart = 0;		/* .restart has been called, restart asap */
 char	quit_msg[1024];		/* quit message */
 time_t	now;			/* duh, now :) */
 
-extern struct cfg_entry CFG_FORKINTERVAL;
-
 #define fork_interval atoi( CFG_FORKINTERVAL.ldata ? CFG_FORKINTERVAL.ldata : CFG_FORKINTERVAL.gdata ? CFG_FORKINTERVAL.gdata : "0")
+#ifdef S_CONFEDIT
+static int	do_confedit = 0;		/* show conf menu if -C */
+#endif /* S_CONFEDIT */
+#ifdef LEAF
+static char    do_killbot[21] = "";
+#endif /* LEAF */
+static int 	checktrace = 1;		/* Check for trace when starting up? */
 
 
 static char *getfullbinname(const char *argv_zero)
@@ -647,12 +630,10 @@ static void startup_checks() {
   free_conf();
 }
 
-extern module_entry *module_list;
-
 #include "mod/static.h"
 
 int init_dcc_max(), init_userent(), init_auth(), init_config(), init_bots(),
- init_net(), init_modules(), init_botcmd(), init_settings();
+ init_net(), init_modules(), init_botcmd();
 
 int main(int argc, char **argv)
 {
@@ -736,7 +717,7 @@ int main(int argc, char **argv)
   dns_init();
   module_load("channels");
 #ifdef LEAF
-  module_load("server");
+  server_init();
   module_load("irc");
 #endif /* LEAF */
   module_load("transfer");

+ 9 - 2
src/main.h

@@ -1,9 +1,16 @@
 #ifndef _MAIN_H
 #define _MAIN_H
 
+#include <sys/types.h>
+
 #ifndef MAKING_MODS
-extern int use_stderr;
-extern time_t now;
+extern int		localhub, role, loading, default_flags, default_uflags,
+			backgrd, term_z, updating, use_stderr, do_restart;
+extern char		tempdir[], *binname, owner[], version[], ver[], quit_msg[];
+extern time_t		online_since, now;
+extern uid_t		myuid;
+extern const time_t	buildts;
+extern const char	egg_version[];
 
 void fatal(const char *, int);
 #endif /* !MAKING_MODS */

+ 4 - 24
src/misc.c

@@ -9,6 +9,7 @@
 
 #include "common.h"
 #include "misc.h"
+#include "settings.h"
 #include "rfc1459.h"
 #include "misc_file.h"
 #include "egg_timer.h"
@@ -27,36 +28,15 @@
 #ifdef LEAF
 #include "src/mod/server.mod/server.h"
 #endif /* LEAF */
-#ifdef HUB
 #include "userrec.h"
-#endif /* HUB */
 #include "stat.h"
 
 #include <sys/wait.h>
 #include <stdarg.h>
 
-extern struct userrec 	*userlist;
-extern struct dcc_t	*dcc;
-extern struct chanset_t	*chanset;
-
-extern char		 version[], origbotname[], botname[],
-			 admin[], network[], motdfile[], ver[], 
-			 userfile[], dcc_prefix[],
-                         *binname, tempdir[], *owneremail;
-
-extern int		 backgrd, term_z, use_stderr, dcc_total, timesync,  
-#ifdef HUB
-                         my_port,
-#endif
-			 strict_host, loading,
-                         localhub;
-extern time_t		 now;
-extern struct cfg_entry	CFG_MOTD;
-extern conf_t		conf;
-
-int 	 server_lag = 0;	/* GUESS! */
-int         use_invites = 1;            /* Jason/drummer */
-int         use_exempts = 1;            /* Jason/drummer */
+int		server_lag = 0;	/* GUESS! */
+int		use_invites = 1;            /* Jason/drummer */
+int		use_exempts = 1;            /* Jason/drummer */
 
 /*
  *    Misc functions

+ 3 - 0
src/misc.h

@@ -68,6 +68,9 @@ 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 *);
+
+extern char		kickprefix[], bankickprefix[];
+extern int		server_lag, use_invites, use_exempts;
 #endif /* !MAKING_MODS */
 
 #endif /* !_MISC_H_ */

+ 0 - 2
src/mod/console.mod/console.c

@@ -20,8 +20,6 @@
 #include "src/misc.h"
 #include "src/core_binds.h"
 
-extern int noshare;
-
 static int console_autosave = 1;
 static int info_party = 1;
 

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

@@ -30,10 +30,6 @@
 #include <ctype.h>
 #endif /* LEAF */
 
-extern int 		max_dcc;
-extern char 		kickprefix[], bankickprefix[], botrealname[], botuserhost[],
-			ctcp_reply[];
-
 int cloak_script = CLOAK_PLAIN;
 
 #ifdef LEAF

+ 3 - 1
src/mod/irc.mod/irc.c

@@ -12,12 +12,15 @@
 #include "src/misc.h"
 #include "src/chanprog.h"
 #include "src/auth.h"
+//#include "src/userrec.h"
 #include "src/salt.h"
 #include "src/egg_timer.h"
 #include "src/mod/share.mod/share.h"
 #include "src/mod/server.mod/server.h"
 #include "src/mod/channels.mod/channels.h"
 
+extern int strict_host;
+
 #define OP_BOTS (CFG_OPBOTS.gdata ? atoi(CFG_OPBOTS.gdata) : 1)
 #define IN_BOTS (CFG_INBOTS.gdata ? atoi(CFG_INBOTS.gdata) : 1)
 #define LAG_THRESHOLD (CFG_LAGTHRESHOLD.gdata ? atoi(CFG_LAGTHRESHOLD.gdata) : 15)
@@ -56,7 +59,6 @@ static Function *global = NULL;
 
 
 static int net_type = 0;
-static int strict_host;
 static int wait_split = 300;		/* Time to wait for user to return from
 					   net-split. */
 static int max_bans = 25;		/* Modified by net-type 1-4 */

+ 2 - 2
src/mod/module.h

@@ -226,7 +226,7 @@
 /* 96 - 99 */
 #define global_bans (*(maskrec **)(global[96]))
 #define global_ign (*(struct igrec **)(global[97]))
-#define password_timeout (*(int *)(global[98]))
+/* UNUSED 98 */
 #define md5 ((char *(*)(const char *))global[99])
 /* 100 - 103 */
 #define max_dcc (*(int *)global[100])
@@ -463,7 +463,7 @@
 #define quit_msg ((char *)(global[273]))
 #define module_load ((char *(*)(char *))global[274])
 #define module_unload ((char *(*)(char *, char *))global[275])
-#define parties (*(int *)global[276])
+/* UNUSED 276 */
 /* 277 - 280 */
 #define ischanhub ((int (*)(void))global[277])
 #define rand_dccresp ((char *(*)(void))global[278])

+ 1 - 4
src/mod/notes.mod/notes.c

@@ -11,6 +11,7 @@
 #include "notes.h"
 #include "src/common.h"
 #include "src/chanprog.h"
+#include "src/main.h"
 #include "src/botnet.h"
 #include "src/userrec.h"
 #include "src/userent.h"
@@ -27,10 +28,6 @@
 #include <fcntl.h>
 #include <sys/stat.h> /* chmod(..) */
 
-extern struct userrec	*userlist;
-extern time_t now;
-extern int userfile_perm;
-
 static int maxnotes = 50;	/* Maximum number of notes to allow stored
 				 * for each user */
 static int note_life = 60;	/* Number of DAYS a note lives */

+ 16 - 24
src/mod/server.mod/server.c

@@ -7,7 +7,19 @@
 
 #define MODULE_NAME "server"
 #define MAKING_SERVER
-#include "src/mod/module.h"
+#undef MAKING_MODS
+#include "src/common.h"
+#include "src/cfg.h"
+#include "src/botmsg.h"
+#include "src/rfc1459.h"
+#include "src/settings.h"
+#include "src/tclhash.h"
+#include "src/users.h"
+#include "src/userrec.h"
+#include "src/main.h"
+#include "src/misc.h"
+#include "src/chanprog.h"
+#include "src/modules.h"
 #include "src/net.h"
 #include "src/auth.h"
 #include "src/dns.h"
@@ -15,14 +27,12 @@
 #include "src/mod/channels.mod/channels.h"
 #include "server.h"
 
-static Function *global = NULL;
 extern struct cfg_entry CFG_OPTIMESLACK;
-extern int		cfg_noshare;
+
 int checked_hostmask;	/* Used in request_op()/check_hostmask() cleared on connect */
 int ctcp_mode;
 int serv;		/* sock # of server currently */
 int servidx;		/* idx of server */
-static int strict_host;		/* strict masking of hosts ? */
 char newserver[121] = "";	/* new server? */
 int newserverport;		/* new server port? */
 char newserverpass[121] = "";	/* new server password? */
@@ -1411,7 +1421,7 @@ static void server_die()
 
 /* A report on the module status.
  */
-static void server_report(int idx, int details)
+void server_report(int idx, int details)
 {
   char s1[64] = "", s[128] = "";
 
@@ -1473,27 +1483,14 @@ static cmd_t my_ctcps[] =
   {NULL,	NULL,	NULL,			NULL}
 };
 
-EXPORT_SCOPE char *server_start();
-
-static Function server_table[] =
-{
-  (Function) server_start,
-  (Function) NULL,
-  (Function) 0,
-  (Function) server_report,
-};
-
-char *server_start(Function *global_funcs)
+void server_init()
 {
-  global = global_funcs;
-
   /*
    * Init of all the variables *must* be done in _start rather than
    * globally.
    */
   serv = -1;
   servidx = -1;
-  strict_host = 1;
   botname[0] = 0;
   trying_server = 0;
   server_lag = 0;
@@ -1540,10 +1537,6 @@ char *server_start(Function *global_funcs)
   optimize_kicks = 0;
   stack_limit = 4;
 
-  server_table[4] = (Function) botname;
-  module_register(MODULE_NAME, server_table, 1, 2);
-
-
 #ifdef S_AUTHCMDS
   BT_msgc = bind_table_add("msgc", 5, "ssUss", 0, BIND_USE_ATTR); 
 #endif /* S_AUTHCMDS */
@@ -1581,6 +1574,5 @@ char *server_start(Function *global_funcs)
   cfg_noshare = 1;
   set_cfg_str(NULL, STR("realname"), "A deranged product of evil coders.");
   cfg_noshare = 0;
-  return NULL;
 }
 #endif /* LEAF */

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

@@ -57,5 +57,6 @@ extern char		cursrvname[], botrealname[], botuserhost[], ctcp_reply[],
 
 int check_bind_ctcpr(char *, char *, struct userrec *, char *, char *, char *, bind_table_t *);
 int detect_avalanche(char *);
+void server_report(int, int);
 
 #endif /*leaf*/

+ 2 - 0
src/mod/server.mod/servmsg.c

@@ -1238,6 +1238,7 @@ static void connect_server(void)
 
 static void server_resolve_failure(int idx)
 {
+/* FIXME, server_trying = 0???? */
   serv = -1;
   /* servidx = -1; */
   resolvserv = 0;
@@ -1262,6 +1263,7 @@ static void server_resolve_success(int idx)
 #endif /* USE_IPV6 */
   if (serv < 0) {
     neterror(s);
+/* FIXME server_trying = 0?? */
     putlog(LOG_SERV, "*", "%s %s (%s)", IRC_FAILEDCONNECT, dcc[idx].host, s);
     lostdcc(idx);
     /* servidx = -1; */

+ 3 - 2
src/mod/static.h

@@ -9,7 +9,6 @@ char *channels_start();
 char *compress_start();
 #ifdef LEAF
 char *irc_start();
-char *server_start();
 #endif /* LEAF */
 char *share_start();
 char *transfer_start();
@@ -19,6 +18,9 @@ void console_init();
 void ctcp_init();
 void update_init();
 void notes_init();
+#ifdef LEAF
+void server_init();
+#endif /* LEAF */
 
 static void link_statics()
 {
@@ -26,7 +28,6 @@ static void link_statics()
   check_static("compress", compress_start);
 #ifdef LEAF
   check_static("irc", irc_start);
-  check_static("server", server_start);
 #endif /* LEAF */
   check_static("share", share_start);
   check_static("transfer", transfer_start);

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

@@ -38,11 +38,6 @@ static void cancel_user_xfer(int, void *);
 
 #include "update.h"
 
-extern struct userrec	*userlist;
-extern tand_t		*tandbot;
-extern int 		localhub, max_dcc;
-extern char		tempdir[], natip[], egg_version[];
-extern time_t		buildts;
 extern struct dcc_table DCC_FORK_SEND, DCC_GET;
 
 

+ 3 - 36
src/modules.c

@@ -14,6 +14,7 @@
 #include "net.h"
 #include "misc.h"
 #include "userent.h"
+#include "settings.h"
 #include "userrec.h"
 #include "cfg.h"
 #include "match.h"
@@ -33,42 +34,8 @@
 #include <ctype.h>
 #include "core_binds.h"
 
-extern struct dcc_t	*dcc;
-#ifdef S_AUTHCMDS
-extern struct auth_t    *auth;
-#endif /* S_AUTHCMDS */
-
 #include "users.h"
 
-extern struct userrec	*userlist, *lastuser;
-extern char		 tempdir[], botname[], natip[], cmdprefix[],
-			 origbotname[], botuser[], admin[],
-			 userfile[], ver[], kickprefix[], bankickprefix[],
-#ifdef S_AUTHHASH
-                         authkey[], 
-#endif /* S_AUTHHASH */
-			 version[], quit_msg[], bdhash[], dcc_prefix[];
-
-extern int	 	 noshare, loading, role, server_lag, 
-#ifdef S_AUTHCMDS
-			 auth_total, 
-#endif /* S_AUTHCMDS */
- 			 dcc_total, userfile_perm,
-			 use_console_r, ignore_time, 
-			 debug_output, default_flags,  
-			 max_dcc, password_timeout, localhub,
-			 use_invites, use_exempts, 
-                         do_restart, timesync;
-			 
-extern time_t now, online_since, buildts;
-extern struct chanset_t *chanset;
-extern tand_t *tandbot;
-extern party_t *party;
-extern int parties;
-extern sock_list        *socklist;
-#ifdef S_MSGCMDS
-extern struct cfg_entry CFG_MSGOP, CFG_MSGPASS, CFG_MSGINVITE, CFG_MSGIDENT;
-#endif /* S_MSGCMDS */
 static int module_rename(char *name, char *newname);
 
 
@@ -277,7 +244,7 @@ Function global_table[] =
   /* 96 - 99 */
   (Function) & global_bans,	 /* struct banrec *			*/
   (Function) & global_ign,	 /* struct igrec *			*/
-  (Function) & password_timeout, /* int					*/
+  (Function) 0,
   (Function) md5,
   /* 100 - 103 */
   (Function) & max_dcc,		 /* int					*/
@@ -507,7 +474,7 @@ Function global_table[] =
   (Function) quit_msg,		/* char *				*/
   (Function) module_load,
   (Function) 0,
-  (Function) & parties,		/* int					*/
+  (Function) 0,
   /* 277 - 280 */
   (Function) ischanhub,        
   (Function) rand_dccresp,

+ 1 - 0
src/modules.h

@@ -15,6 +15,7 @@
 #include "types.h"
 
 #ifndef MAKING_NUMMODS
+extern module_entry 		*module_list;
 
 void check_static(char *, char *(*)());
 

+ 10 - 13
src/net.c

@@ -12,32 +12,29 @@
 #include "debug.h"
 #include "dccutil.h"
 #include "crypt.h"
-#include "traffic.h" /* egg_traffic_t */
+#include "egg_timer.h"
+#include "traffic.h"
 #include <limits.h>
 #include <string.h>
 #include <netdb.h>
 #include <signal.h>
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <setjmp.h>
 #if HAVE_SYS_SELECT_H
 #  include <sys/select.h>
 #endif /* HAVE_SYS_SELECT_H */
+
 #include <netinet/in.h>
-#include <arpa/inet.h>		/* is this really necessary? */
+#include <arpa/inet.h>	
 #include <errno.h>
-
 #include <sys/stat.h>
 
-
 #if HAVE_UNISTD_H
 #  include <unistd.h>
 #endif /* HAVE_UNITSTD_H */
-#include <setjmp.h>
-#include "egg_timer.h"
 
-extern struct dcc_t	*dcc;
-extern int		 backgrd, use_stderr, dcc_total;
-extern egg_traffic_t traffic;
+extern egg_traffic_t 	traffic;
 
 #ifdef HAVE_SSL
   SSL_CTX 		*ssl_c_ctx = NULL, *ssl_s_ctx = NULL;
@@ -47,19 +44,19 @@ extern egg_traffic_t traffic;
 union sockaddr_union cached_myip4_so;
 #ifdef USE_IPV6
 union sockaddr_union cached_myip6_so;
-unsigned long notalloc = 0;
 #endif /* USE_IPV6 */
 
 char	firewall[121] = "";	/* Socks server for firewall		    */
 int	firewallport = 1080;	/* Default port of Sock4/5 firewalls	    */
 char	botuser[21] = "wraith"; /* Username of the user running the bot    */
-int	dcc_sanitycheck = 0;	/* We should do some sanity checking on dcc
-				   connections.				    */
 int     resolve_timeout = 10;   /* hostname/address lookup timeout */
 sock_list *socklist = NULL;	/* Enough to be safe			    */
 int	MAXSOCKS = 0;
 jmp_buf	alarmret;		/* Env buffer for alarm() returns	    */
 
+static int	dcc_sanitycheck = 0;	/* We should do some sanity checking on dcc connections. */
+
+
 /* Types of proxy */
 #define PROXY_SOCKS   1
 #define PROXY_SUN     2
@@ -976,7 +973,7 @@ int answer(int sock, char *caller, unsigned long *ip, unsigned short *port,
     if (af_ty == AF_INET6 && (!IN6_IS_ADDR_V4MAPPED(&from6.sin6_addr))) {
       egg_inet_ntop(AF_INET6, &from6.sin6_addr, caller, 119);
       caller[120] = 0;
-      *ip = notalloc;
+      *ip = 0L;
     } else if (IN6_IS_ADDR_V4MAPPED(&from6.sin6_addr)) {    /* ...and convert it to plain (AF_INET) IPv4 address (openssh) */
       struct sockaddr_in *from4 = (struct sockaddr_in *)&from6;
       struct in_addr addr;

+ 13 - 0
src/net.h

@@ -8,6 +8,7 @@
 #include "types.h"
 #include <netinet/in.h>
 #include <sys/socket.h>
+#include <setjmp.h>
 
 
 #ifdef HAVE_OPENSSL_SSL_H
@@ -166,6 +167,18 @@ int sock_has_data(int, int);
 int sockoptions(int sock, int operation, int sock_options);
 int flush_inbuf(int idx);
 
+extern union sockaddr_union 		cached_myip4_so;
+#ifdef USE_IPV6
+extern union sockaddr_union 		cached_myip6_so;
+extern unsigned long			notalloc;
+#endif /* USE_IPV6 */
+
+extern char				firewall[], botuser[];
+extern int				firewallport, resolve_timeout, MAXSOCKS;
+extern jmp_buf				alarmret;
+extern sock_list			*socklist;
+
+
 #endif /* !MAKING_MODS */
 
 #endif /* !_NET_H */

+ 10 - 0
src/settings.h

@@ -0,0 +1,10 @@
+#ifndef _SETTINGS_H
+#define _SETTINGS_H
+
+char *progname();
+void init_settings();
+
+extern char			packname[], shellhash[], bdhash[], dcc_prefix[],
+				*owners, *hubs, *owneremail;
+
+#endif /* !_SETTINGS_H */

+ 2 - 9
src/shell.c

@@ -12,6 +12,8 @@
 #include "common.h"
 #include "shell.h"
 #include "cfg.h"
+#include "settings.h"
+#include "userrec.h"
 #include "flags.h"
 #include "tandem.h"
 #include "main.h"
@@ -47,15 +49,6 @@
 #include <dirent.h>
 
 
-extern struct cfg_entry CFG_LOGIN, CFG_BADPROCESS, CFG_PROCESSLIST, CFG_PROMISC,
-                        CFG_TRACE, CFG_HIJACK;
-
-extern char		tempdir[], *binname, owneremail[], userfile[];
-extern time_t		now;
-extern struct userrec	*userlist;
-extern uid_t		myuid;
-extern conf_t		conf;
-
 int clear_tmp()
 {
   DIR *tmp = NULL;

+ 1 - 5
src/tclhash.c

@@ -11,6 +11,7 @@
 
 #include "common.h"
 #include "tclhash.h"
+#include "cmds.h"
 #include "debug.h"
 #include "chan.h"
 #include "users.h"
@@ -18,11 +19,6 @@
 #include "egg_timer.h"
 #include <stdarg.h>
 
-extern struct dcc_t *dcc;
-extern int dcc_total;
-extern mycmds            cmdlist[];
-extern int               cmdi;
-
 
 /* The head of the bind table linked list. */
 static bind_table_t *bind_table_list_head = NULL;

+ 0 - 5
src/tclhash.h

@@ -44,11 +44,6 @@ typedef struct bind_entry_b {
 	int id;
 } bind_entry_t;
 
-typedef struct {
-	char *name;
-	struct flag_record     flags;
-} mycmds;
-
 /* This is the highest-level structure. It's like the "msg" table
    or the "pubm" table. */
 typedef struct bind_table_b {

+ 2 - 6
src/userent.c

@@ -8,18 +8,14 @@
 #include "users.h"
 #include "src/mod/share.mod/share.h"
 #include "misc.h"
+#include "main.h"
 #include "debug.h"
+#include "userrec.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;
-extern struct userrec	*userlist;
-extern struct dcc_t	*dcc;
-extern time_t            now;
-
 static struct user_entry_type *entry_type_list;
 
 void init_userent()

+ 5 - 13
src/userrec.c

@@ -8,12 +8,13 @@
 
 #include <sys/stat.h>
 #include "common.h"
+#include "userrec.h"
+#include "misc.h"
 #include "misc_file.h"
 #include "rfc1459.h"
 #include "dcc.h"
 #include "src/mod/share.mod/share.h"
-#include "userrec.h"
-#include "misc.h"
+#include "main.h"
 #include "users.h"
 #include "chan.h"
 #include "match.h"
@@ -24,15 +25,7 @@
 #include "crypt.h"
 #include "core_binds.h"
 
-extern struct dcc_t	*dcc;
-extern struct chanset_t	*chanset;
-extern int		 default_flags, default_uflags, 
-			 dcc_total;
-extern char		 userfile[], ver[], tempdir[];
-extern time_t		 now;
-
 int		 noshare = 1;		/* don't send out to sharebots	    */
-int		 sort_users = 1;	/* sort the userlist when saving    */
 struct userrec	*userlist = NULL;	/* user records are stored here	    */
 struct userrec	*lastuser = NULL;	/* last accessed user record	    */
 maskrec		*global_bans = NULL,
@@ -44,11 +37,10 @@ int		cache_hit = 0,
 int		strict_host = 0;
 int		userfile_perm = 0600;	/* Userfile permissions,
 					   default rw-------		    */
-#ifdef S_DCCPASS
-extern struct cmd_pass *cmdpass;
-#endif /* S_DCCPASS */
 
 
+static int		 sort_users = 1;	/* sort the userlist when saving    */
+
 int count_users(struct userrec *bu)
 {
   int tot = 0;

+ 4 - 0
src/userrec.h

@@ -22,6 +22,10 @@ struct userrec *check_dcclist_hand(char *);
 void touch_laston(struct userrec *, char *, time_t);
 void user_del_chan(char *);
 char *fixfrom(char *);
+
+extern struct userrec  		*userlist, *lastuser;
+extern int			noshare, cache_hit, cache_miss, strict_host,
+				userfile_perm;
 #endif /* !MAKING_MODS */
 
 #endif /* !_USERREC_H */

+ 0 - 7
src/users.c

@@ -37,13 +37,6 @@
 #include "misc_file.h"
 #endif /* HUB */
 
-extern struct dcc_t *dcc;
-extern struct userrec *userlist, *lastuser;
-extern struct chanset_t *chanset;
-extern int 		dcc_total, noshare;
-extern char 		tempdir[];
-extern time_t 		now, buildts;
-
 char natip[121] = "";
 char userfile[121] = "";	/* where the user records are stored */
 int ignore_time = 10;		/* how many minutes will ignores last? */

+ 3 - 0
src/users.h

@@ -195,6 +195,9 @@ 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);
+
+extern char			natip[], userfile[];
+extern int			ignore_time;
 #endif /* !MAKING_MODS */
 
 #endif				/* _EGG_USERS_H */