Przeglądaj źródła

* readconf() did not account for '.' in some fields
* Hub had several bugs associated with it, fixed them all.
* Made sharein/out/updatein() all be called directly
* chanprog() was being called too early


svn: 699

Bryan Drewery 22 lat temu
rodzic
commit
3155ce6458

+ 5 - 3
src/botcmd.c

@@ -7,6 +7,8 @@
 
 #include "common.h"
 #include "botcmd.h"
+#include "src/mod/share.mod/share.h"
+#include "src/mod/update.mod/update.h"
 #include "net.h"
 #include "tclhash.h"
 #include "misc.h"
@@ -1258,7 +1260,7 @@ void bot_share(int idx, char *par)
 
 void bot_shareupdate(int idx, char *par)
 {
-  shareupdatein(idx, par);
+  updatein(idx, par);
 }
 
 /* v <frombot> <tobot> <idx:nick>
@@ -1277,8 +1279,8 @@ static void bot_versions(int sock, char *par)
     from = newsplit(&par);
     botnet_send_priv(sock, conf.bot->nick, from, frombot, "Modules loaded:\n");
     for (me = module_list; me; me = me->next)
-      botnet_send_priv(sock, conf.bot->nick, from, frombot, "  Module: %s (v%d.%d)\n",
-		       me->name, me->major, me->minor);
+      botnet_send_priv(sock, conf.bot->nick, from, frombot, "  Module: %s\n",
+		       me->name);
     botnet_send_priv(sock, conf.bot->nick, from, frombot, "End of module list.\n");
   }
 }

+ 1 - 1
src/chanprog.c

@@ -571,7 +571,7 @@ void chanprog()
     bi->telnet_port = bi->relay_port = 3333;
 #ifdef HUB
     bi->hublevel = 99;
-#else
+#else /* !HUB */
     bi->hublevel = 0;
 #endif /* HUB */
     bi->uplink = calloc(1, 1);

+ 101 - 100
src/cmds.c

@@ -54,7 +54,7 @@ extern tand_t		*tandbot;
 extern conf_t		conf;
 
 static char		 *btos(unsigned long);
-mycmds 			 cmdlist[500]; //the list of dcc cmds for help system
+mycmds 			 cmdlist[500]; /* the list of dcc cmds for help system */
 int    			 cmdi = 0;
 int         		remote_boots = 2;
 
@@ -812,8 +812,9 @@ static void cmd_help(struct userrec *u, int idx, char *par)
   }
   if (!nowild)
     dprintf(idx, STR("Showing help topics matching '%s' for flags: (%s)\n"), match, flg);
+
   qsort(cmdlist, cmdi, sizeof(mycmds), (int (*)()) &my_cmp);
-  buf[0] = 0;
+
   /* even if we have nowild, we loop to conserve code/space */
   while (!done) {
     int i = 0, end = 0, first = 1, n, hi;
@@ -4016,134 +4017,134 @@ static void cmd_quit(struct userrec *u, int idx, char *text)
  */
 cmd_t C_dcc[] =
 {
-  {"+host",		"m|m",	(Function) cmd_pls_host,	NULL,	0},
-  {"+ignore",		"m",	(Function) cmd_pls_ignore,	NULL,   0},
-  {"+user",		"m",	(Function) cmd_pls_user,	NULL,   0},
+  {"+host",		"m|m",	(Function) cmd_pls_host,	NULL},
+  {"+ignore",		"m",	(Function) cmd_pls_ignore,	NULL},
+  {"+user",		"m",	(Function) cmd_pls_user,	NULL},
 #ifdef HUB
-  {"-bot",		"a",	(Function) cmd_mns_user,	NULL,   0},
+  {"-bot",		"a",	(Function) cmd_mns_user,	NULL},
 #endif /* HUB */
-  {"-host",		"",	(Function) cmd_mns_host,	NULL,   0},
-  {"-ignore",		"m",	(Function) cmd_mns_ignore,	NULL,   0},
-  {"-user",		"m",	(Function) cmd_mns_user,	NULL,   0},
-  {"addlog",		"mo|o",	(Function) cmd_addlog,		NULL,   0},
-/*  {"putlog",		"mo|o",	(Function) cmd_addlog,		NULL,   0}, */
-  {"about",		"",	(Function) cmd_about,		NULL,   0},
-  {"away",		"",	(Function) cmd_away,		NULL,   0},
-  {"back",		"",	(Function) cmd_back,		NULL,   0},
+  {"-host",		"",	(Function) cmd_mns_host,	NULL},
+  {"-ignore",		"m",	(Function) cmd_mns_ignore,	NULL},
+  {"-user",		"m",	(Function) cmd_mns_user,	NULL},
+  {"addlog",		"mo|o",	(Function) cmd_addlog,		NULL},
+/*  {"putlog",		"mo|o",	(Function) cmd_addlog,		NULL}, */
+  {"about",		"",	(Function) cmd_about,		NULL},
+  {"away",		"",	(Function) cmd_away,		NULL},
+  {"back",		"",	(Function) cmd_back,		NULL},
 #ifdef HUB
-  {"backup",		"m|m",	(Function) cmd_backup,		NULL,   0},
-  {"boot",		"m",	(Function) cmd_boot,		NULL,   0},
-  {"botconfig",		"n",	(Function) cmd_botconfig,	NULL,   0},
-  {"botinfo",		"",	(Function) cmd_botinfo,		NULL,   0},
-  {"bots",		"m",	(Function) cmd_bots,		NULL,   0},
-  {"downbots",		"m",	(Function) cmd_downbots,	NULL,   0},
-  {"bottree",		"n",	(Function) cmd_bottree,		NULL,   0},
-  {"chaddr",		"a",	(Function) cmd_chaddr,		NULL,   0},
+  {"backup",		"m|m",	(Function) cmd_backup,		NULL},
+  {"boot",		"m",	(Function) cmd_boot,		NULL},
+  {"botconfig",		"n",	(Function) cmd_botconfig,	NULL},
+  {"botinfo",		"",	(Function) cmd_botinfo,		NULL},
+  {"bots",		"m",	(Function) cmd_bots,		NULL},
+  {"downbots",		"m",	(Function) cmd_downbots,	NULL},
+  {"bottree",		"n",	(Function) cmd_bottree,		NULL},
+  {"chaddr",		"a",	(Function) cmd_chaddr,		NULL},
 #endif /* HUB */
-  {"chat",		"",	(Function) cmd_chat,		NULL,   0},
-  {"chattr",		"m|m",	(Function) cmd_chattr,		NULL,   0},
+  {"chat",		"",	(Function) cmd_chat,		NULL},
+  {"chattr",		"m|m",	(Function) cmd_chattr,		NULL},
 #ifdef HUB
-  {"chhandle",		"m",	(Function) cmd_chhandle,	NULL,   0},
-  {"chnick",		"m",	(Function) cmd_chhandle,	NULL,	1},
-  {"chpass",		"m",	(Function) cmd_chpass,		NULL,   0},
-  {"chsecpass",		"n",	(Function) cmd_chsecpass,	NULL,   0},
+  {"chhandle",		"m",	(Function) cmd_chhandle,	NULL},
+/*  {"chnick",		"m",	(Function) cmd_chhandle,	NULL}, */
+  {"chpass",		"m",	(Function) cmd_chpass,		NULL},
+  {"chsecpass",		"n",	(Function) cmd_chsecpass,	NULL},
 #ifdef S_DCCPASS
-  {"cmdpass",           "a",    (Function) cmd_cmdpass,         NULL,   0},
+  {"cmdpass",           "a",    (Function) cmd_cmdpass,         NULL},
 #endif /* S_DCCPASS */
 #endif /* HUB */
-  {"color",		"",     (Function) cmd_color,           NULL,   0},
-  {"comment",		"m|m",	(Function) cmd_comment,		NULL,   0},
+  {"color",		"",     (Function) cmd_color,           NULL},
+  {"comment",		"m|m",	(Function) cmd_comment,		NULL},
 #ifdef HUB
-  {"config",		"n",	(Function) cmd_config,		NULL,   0},
+  {"config",		"n",	(Function) cmd_config,		NULL},
 #endif /* HUB */
-  {"console",		"-|-",	(Function) cmd_console,		NULL,   0},
-  {"date",		"",	(Function) cmd_date,		NULL,   0},
+  {"console",		"-|-",	(Function) cmd_console,		NULL},
+  {"date",		"",	(Function) cmd_date,		NULL},
 #ifdef HUB
-  {"dccstat",		"a",	(Function) cmd_dccstat,		NULL,   0},
+  {"dccstat",		"a",	(Function) cmd_dccstat,		NULL},
 #endif /* HUB */
-  {"debug",		"a",	(Function) cmd_debug,		NULL,   0},
-  {"die",		"n",	(Function) cmd_die,		NULL,   0},
-  {"echo",		"",	(Function) cmd_echo,		NULL,   0},
-  {"fixcodes",		"",	(Function) cmd_fixcodes,	NULL,   0},
-  {"handle",		"",	(Function) cmd_handle,		NULL,   0},
-  {"nohelp",		"-|-",	(Function) cmd_nohelp,		NULL, 	1},
-  {"help",		"-|-",	(Function) cmd_help,		NULL,   0},
-  {"ignores",		"m",	(Function) cmd_ignores,		NULL,   0},
+  {"debug",		"a",	(Function) cmd_debug,		NULL},
+  {"die",		"n",	(Function) cmd_die,		NULL},
+  {"echo",		"",	(Function) cmd_echo,		NULL},
+  {"fixcodes",		"",	(Function) cmd_fixcodes,	NULL},
+  {"handle",		"",	(Function) cmd_handle,		NULL},
+  {"nohelp",		"-|-",	(Function) cmd_nohelp,		NULL},
+  {"help",		"-|-",	(Function) cmd_help,		NULL},
+  {"ignores",		"m",	(Function) cmd_ignores,		NULL},
 #ifdef HUB
-  {"link",		"n",	(Function) cmd_link,		NULL,   0},
+  {"link",		"n",	(Function) cmd_link,		NULL},
 #endif /* HUB */
-  {"match",		"m|m",	(Function) cmd_match,		NULL,   0},
-  {"me",		"",	(Function) cmd_me,		NULL,   0},
-  {"motd",		"",	(Function) cmd_motd,		NULL,   0},
+  {"match",		"m|m",	(Function) cmd_match,		NULL},
+  {"me",		"",	(Function) cmd_me,		NULL},
+  {"motd",		"",	(Function) cmd_motd,		NULL},
 #ifdef HUB
-  {"newleaf",		"n",	(Function) cmd_newleaf,		NULL,   0},
-  {"nopass",		"m",	(Function) cmd_nopass,		NULL,   0},
+  {"newleaf",		"n",	(Function) cmd_newleaf,		NULL},
+  {"nopass",		"m",	(Function) cmd_nopass,		NULL},
 #endif /* HUB */
-  {"newpass",		"",	(Function) cmd_newpass,		NULL,   0},
-  {"secpass",		"",	(Function) cmd_secpass,		NULL,   0},
-  {"nick",		"",	(Function) cmd_handle,		NULL,	1},
-  {"page",		"",	(Function) cmd_page,		NULL,   0},
-  {"quit",		"",	(Function) cmd_quit,		NULL,   0},
-  {"relay",		"i",	(Function) cmd_relay,		NULL,   0},
+  {"newpass",		"",	(Function) cmd_newpass,		NULL},
+  {"secpass",		"",	(Function) cmd_secpass,		NULL},
+/*  {"nick",		"",	(Function) cmd_handle,		NULL}, */
+  {"page",		"",	(Function) cmd_page,		NULL},
+  {"quit",		"",	(Function) cmd_quit,		NULL},
+  {"relay",		"i",	(Function) cmd_relay,		NULL},
 #ifdef HUB
-  {"reload",		"m|m",	(Function) cmd_reload,		NULL,   0},
+  {"reload",		"m|m",	(Function) cmd_reload,		NULL},
 #endif /* HUB */
-  {"restart",		"m",	(Function) cmd_restart,		NULL,   0},
+  {"restart",		"m",	(Function) cmd_restart,		NULL},
 #ifdef HUB
-  {"save",		"m|m",	(Function) cmd_save,		NULL,   0},
+  {"save",		"m|m",	(Function) cmd_save,		NULL},
 #endif /* HUB */
-  {"simul",		"a",	(Function) cmd_simul,		NULL,   0},
-  {"status",		"m|m",	(Function) cmd_status,		NULL,   0},
-  {"strip",		"",	(Function) cmd_strip,		NULL,   0},
-  {"su",		"a",	(Function) cmd_su,		NULL,   0},
+  {"simul",		"a",	(Function) cmd_simul,		NULL},
+  {"status",		"m|m",	(Function) cmd_status,		NULL},
+  {"strip",		"",	(Function) cmd_strip,		NULL},
+  {"su",		"a",	(Function) cmd_su,		NULL},
 #ifdef HUB
-  {"trace",		"n",	(Function) cmd_trace,		NULL,   0},
+  {"trace",		"n",	(Function) cmd_trace,		NULL},
 #endif /* HUB */
-  {"traffic",		"m",	(Function) cmd_traffic,		NULL,   0},
-  {"unlink",		"m",	(Function) cmd_unlink,		NULL,   0},
-  {"update",		"a",	(Function) cmd_update,		NULL,   0},
+  {"traffic",		"m",	(Function) cmd_traffic,		NULL},
+  {"unlink",		"m",	(Function) cmd_unlink,		NULL},
+  {"update",		"a",	(Function) cmd_update,		NULL},
 #ifdef HUB
-  {"netcrontab",	"a",	(Function) cmd_netcrontab,	NULL,   0},
+  {"netcrontab",	"a",	(Function) cmd_netcrontab,	NULL},
 #endif /* HUB */
-  {"uptime",		"m|m",	(Function) cmd_uptime,		NULL,   0},
-  {"crontab",		"a",	(Function) cmd_crontab,		NULL,   0},
+  {"uptime",		"m|m",	(Function) cmd_uptime,		NULL},
+  {"crontab",		"a",	(Function) cmd_crontab,		NULL},
 #ifdef HUB
-  {"vbottree",		"n",	(Function) cmd_vbottree,	NULL,   0},
-  {"who",		"n",	(Function) cmd_who,		NULL,   0},
+  {"vbottree",		"n",	(Function) cmd_vbottree,	NULL},
+  {"who",		"n",	(Function) cmd_who,		NULL},
 #endif /* HUB */
-  {"whois",		"",	(Function) cmd_whois,		NULL,   0},
-  {"whom",		"",	(Function) cmd_whom,		NULL,   0},
-  {"whoami",		"",	(Function) cmd_whoami,		NULL,   0},
-  {"botjump",           "m",    (Function) cmd_botjump,         NULL,   0},
-  {"botmsg",		"o",    (Function) cmd_botmsg,          NULL,   0},
-  {"netmsg", 		"n", 	(Function) cmd_netmsg, 		NULL,   0},
-  {"botnick", 		"m", 	(Function) cmd_botnick, 	NULL,   0},
-  {"netnick", 		"m", 	(Function) cmd_netnick, 	NULL,   0},
+  {"whois",		"",	(Function) cmd_whois,		NULL},
+  {"whom",		"",	(Function) cmd_whom,		NULL},
+  {"whoami",		"",	(Function) cmd_whoami,		NULL},
+  {"botjump",           "m",    (Function) cmd_botjump,         NULL},
+  {"botmsg",		"o",    (Function) cmd_botmsg,          NULL},
+  {"netmsg", 		"n", 	(Function) cmd_netmsg, 		NULL},
+  {"botnick", 		"m", 	(Function) cmd_botnick, 	NULL},
+  {"netnick", 		"m", 	(Function) cmd_netnick, 	NULL},
 #ifdef HUB
-  {"netw", 		"n", 	(Function) cmd_netw, 		NULL,   0},
-  {"netps", 		"n", 	(Function) cmd_netps, 		NULL,   0},
-  {"netlast", 		"n", 	(Function) cmd_netlast, 	NULL,   0},
-  {"netlag", 		"m", 	(Function) cmd_netlag, 		NULL,   0},
+  {"netw", 		"n", 	(Function) cmd_netw, 		NULL},
+  {"netps", 		"n", 	(Function) cmd_netps, 		NULL},
+  {"netlast", 		"n", 	(Function) cmd_netlast, 	NULL},
+  {"netlag", 		"m", 	(Function) cmd_netlag, 		NULL},
 #endif /* HUB */
-  {"botserver",		"m",	(Function) cmd_botserver,	NULL,   0},
-  {"netserver", 	"m", 	(Function) cmd_netserver, 	NULL,   0},
+  {"botserver",		"m",	(Function) cmd_botserver,	NULL},
+  {"netserver", 	"m", 	(Function) cmd_netserver, 	NULL},
 #ifdef HUB
-  {"botversion", 	"o", 	(Function) cmd_botversion, 	NULL,   0},
-  {"netversion", 	"o", 	(Function) cmd_netversion, 	NULL,   0},
+  {"botversion", 	"o", 	(Function) cmd_botversion, 	NULL},
+  {"netversion", 	"o", 	(Function) cmd_netversion, 	NULL},
 #endif /* HUB */
-  {"userlist", 		"m", 	(Function) cmd_userlist, 	NULL,   0},
-  {"ps", 		"n", 	(Function) cmd_ps, 		NULL,   0},
-  {"last", 		"n", 	(Function) cmd_last, 		NULL,   0},
-  {"exec", 		"a", 	(Function) cmd_exec, 		NULL,   0},
-  {"w", 		"n", 	(Function) cmd_w, 		NULL,   0},
-  {"channels", 		"", 	(Function) cmd_channels, 	NULL,   0},
-  {"randstring", 	"", 	(Function) cmd_randstring, 	NULL,   0},
+  {"userlist", 		"m", 	(Function) cmd_userlist, 	NULL},
+  {"ps", 		"n", 	(Function) cmd_ps, 		NULL},
+  {"last", 		"n", 	(Function) cmd_last, 		NULL},
+  {"exec", 		"a", 	(Function) cmd_exec, 		NULL},
+  {"w", 		"n", 	(Function) cmd_w, 		NULL},
+  {"channels", 		"", 	(Function) cmd_channels, 	NULL},
+  {"randstring", 	"", 	(Function) cmd_randstring, 	NULL},
 #ifdef HUB
-  {"botcmd",		"i",	(Function) cmd_botcmd, 		NULL,   0},
-  {"bc",		"i",	(Function) cmd_botcmd, 		NULL,   0},
-  {"hublevel", 		"a", 	(Function) cmd_hublevel, 	NULL,   0},
-  {"lagged", 		"m", 	(Function) cmd_lagged, 		NULL,   0},
-  {"uplink", 		"a", 	(Function) cmd_uplink, 		NULL,   0},
+  {"botcmd",		"i",	(Function) cmd_botcmd, 		NULL},
+  {"bc",		"i",	(Function) cmd_botcmd, 		NULL},
+  {"hublevel", 		"a", 	(Function) cmd_hublevel, 	NULL},
+  {"lagged", 		"m", 	(Function) cmd_lagged, 		NULL},
+  {"uplink", 		"a", 	(Function) cmd_uplink, 		NULL},
 #endif /* HUB */
-  {NULL,		NULL,	NULL,				NULL,   0}
+  {NULL,		NULL,	NULL,				NULL}
 };

+ 0 - 1
src/cmds.h

@@ -8,7 +8,6 @@ typedef struct {
   char          *flags;
   Function      func;
   char          *funcname;
-  int           nohelp;
 } cmd_t;
 
 typedef struct {

+ 3 - 3
src/conf.c

@@ -105,12 +105,12 @@ static void conf_addbot(char *nick, char *ip, char *host, char *ip6) {
   if (host && host[0] == '+') {
     host++;
     bot->host6 = strdup(host);
-  } else if (host) {
+  } else if (host && strcmp(host, ".")) {
     bot->host = strdup(host);
   }
 
-  if (ip)    bot->ip = strdup(ip);
-  if (ip6)   bot->ip6 = strdup(ip6);
+  if (ip && strcmp(ip, "."))    bot->ip = strdup(ip);
+  if (ip6 && strcmp(ip, "."))   bot->ip6 = strdup(ip6);
 
   bot->u = NULL;
   bot->pid = checkpid(nick, bot);

+ 0 - 3
src/dccutil.h

@@ -31,9 +31,6 @@ struct portmap {
 #ifndef MAKING_MODS
 void dprintf (int, ...);
 void chatout (char *, ...);
-extern void (*shareout) ();
-extern void (*sharein) (int, char *);
-extern void (*shareupdatein) (int, char *);
 void chanout_but (int, ...);
 void dcc_chatter(int);
 void lostdcc(int);

+ 1 - 0
src/flags.c

@@ -6,6 +6,7 @@
 
 #include "common.h"
 #include "crypt.h"
+#include "src/mod/share.mod/share.h"
 #include "rfc1459.h"
 #include "misc.h"
 #include "dccutil.h"

+ 1 - 3
src/main.c

@@ -668,9 +668,6 @@ printf("bleh..ip: %s host: %s ip6: %s host6: %s\n", conf.bot->ip, conf.bot->host
     }
   }
 
-  chanprog();
-//fatal("WOOT", 0);
-
   dns_init();
   module_load("channels");
 #ifdef LEAF
@@ -684,6 +681,7 @@ printf("bleh..ip: %s host: %s ip6: %s host6: %s\n", conf.bot->ip, conf.bot->host
   console_init();
   ctcp_init();
   module_load("compress");
+  chanprog();
 
 
 #ifdef LEAF

+ 7 - 1
src/mod/channels.mod/channels.c

@@ -9,9 +9,13 @@
 #include <sys/stat.h>
 #include "src/mod/module.h"
 #include "src/mod/irc.mod/irc.h"
+#include "src/mod/share.mod/share.h"
 #include "src/chanprog.h"
 
-static Function *global = NULL, *irc_funcs = NULL;
+static Function *global = NULL;
+#ifdef LEAF
+static Function *irc_funcs = NULL;
+#endif /* LEAF */
 
 static int 			use_info;
 static char 			glob_chanmode[64];		/* Default chanmode (drummer,990731) */
@@ -1001,10 +1005,12 @@ char *channels_start(Function * global_funcs)
          "-private "
 	 "-fastop ");
   module_register(MODULE_NAME, channels_table, 1, 0);
+#ifdef LEAF
   if (!(irc_funcs = module_depend(MODULE_NAME, "irc", 1, 0))) {
     module_undepend(MODULE_NAME);
     return "This module requires irc module 1.0 or later.";
   }
+#endif /* LEAF */
 
 #ifdef LEAF
   add_hook(HOOK_MINUTELY, (Function) check_limitraise);

+ 9 - 8
src/mod/channels.mod/userchan.c

@@ -1278,14 +1278,15 @@ static int write_chans(FILE *f, int idx)
 
      get_mode_protect(chan, w);
 
-     if (lfprintf(f, "+ channel add %s { chanmode %s addedby %s addedts %lu idle-kick %d \
-                      limit %d stopnethack-mode %d revenge-mode %d flood-chan %d:%d \
-                      flood-ctcp %d:%d flood-join %d:%d flood-kick %d:%d flood-deop %d:%d \
-                      flood-nick %d:%d closed-ban %d ban-time %d exempt-time %d invite-time %d \
-                      %cenforcebans %cdynamicbans %cuserbans %cbitch %cprotectops %crevenge \
-                      %crevengebot %cprivate %ccycle %cinactive %cdynamicexempts %cuserexempts \
-                      %cdynamicinvites %cuserinvites %cnodesynch %cclosed %ctake %cmanop %cvoice \
-                      %cfastop }\n",
+     if (lfprintf(f, "\
++ channel add %s { chanmode %s addedby %s addedts %lu idle-kick %d \
+limit %d stopnethack-mode %d revenge-mode %d flood-chan %d:%d \
+flood-ctcp %d:%d flood-join %d:%d flood-kick %d:%d flood-deop %d:%d \
+flood-nick %d:%d closed-ban %d ban-time %d exempt-time %d invite-time %d \
+%cenforcebans %cdynamicbans %cuserbans %cbitch %cprotectops %crevenge \
+%crevengebot %cprivate %ccycle %cinactive %cdynamicexempts %cuserexempts \
+%cdynamicinvites %cuserinvites %cnodesynch %cclosed %ctake %cmanop %cvoice \
+%cfastop }\n",
 	chan->dname,
 	w,
         chan->added_by,

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

@@ -8,6 +8,7 @@
 #undef MAKING_MODS
 #include "console.h"
 #include "src/common.h"
+#include "src/mod/share.mod/share.h"
 #include "src/tclhash.h"
 #include "src/tandem.h"
 #include "src/cmds.h"

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

@@ -13,6 +13,7 @@
 #include "src/chanprog.h"
 #include "src/auth.h"
 #include "src/salt.h"
+#include "src/mod/share.mod/share.h"
 #include "src/mod/server.mod/server.h"
 #undef serv
 #include "src/mod/channels.mod/channels.h"

+ 1 - 1
src/mod/module.h

@@ -185,7 +185,7 @@
 #define flagrec_eq ((int(*)(struct flag_record*,struct flag_record *))global[66])
 #define flagrec_ok ((int(*)(struct flag_record*,struct flag_record *))global[67])
 /* 68 - 71 */
-#define shareout (*(Function *)(global[68]))
+/* UNUSED 68 */
 #define dprintf (global[69])
 #define chatout (global[70])
 #define chanout_but ((void(*)())global[71])

+ 1 - 8
src/mod/modvals.h

@@ -48,17 +48,10 @@
 #define HOOK_5SECONDLY           18
 #define HOOK_HALFHOURLY		 19
 #define REAL_HOOKS		 20
-/* #define HOOK_CHANFILE            17 */
-#define HOOK_SHAREOUT		105
-#define HOOK_SHAREIN		106
+
 #define HOOK_QSERV		108
 #define HOOK_ADD_MODE		109
-#define HOOK_MATCH_NOTEREJ	110
 #define HOOK_RFC_CASECMP	111
-#define HOOK_DNS_HOSTBYIP	112
-#define HOOK_DNS_IPBYHOST	113
-#define HOOK_SHAREUPDATEIN	117
-#define HOOK_STORENOTE		116
 
 /* These are FIXED once they are in a release they STAY
  */

+ 3 - 6
src/mod/share.mod/share.c

@@ -1196,8 +1196,7 @@ static void share_version(int idx, char *par)
   dcc[idx].status &= ~(STAT_SHARE | STAT_GETTING | STAT_SENDING |
 		       STAT_OFFERED | STAT_AGGRESSIVE);
   dcc[idx].u.bot->uff_flags = 0;
-  if (1 && //only share with same VER bots.
-      (bot_aggressive_to(dcc[idx].user))) {
+  if (bot_aggressive_to(dcc[idx].user)) {
     if (can_resync(dcc[idx].nick))
       dprintf(idx, "s r?\n");
     else
@@ -1293,7 +1292,7 @@ static botcmd_t C_share[] =
 };
 
 
-static void sharein_mod(int idx, char *msg)
+void sharein(int idx, char *msg)
 {
   char *code = NULL;
   int f, i;
@@ -1310,7 +1309,7 @@ static void sharein_mod(int idx, char *msg)
   }
 }
 
-static void shareout_mod (struct chanset_t *chan, ...)
+void shareout(struct chanset_t *chan, ...)
 {
   int i, l;
   char *format = NULL, s[601] = "";
@@ -2138,8 +2137,6 @@ char *share_start(Function *global_funcs)
     return "This module requires channels module 1.0 or later.";
   }
 #endif /* LEAF */
-  add_hook(HOOK_SHAREOUT, (Function) shareout_mod);
-  add_hook(HOOK_SHAREIN, (Function) sharein_mod);
   add_hook(HOOK_MINUTELY, (Function) check_expired_tbufs);
   add_hook(HOOK_READ_USERFILE, (Function) hook_read_userfile);
   add_hook(HOOK_SECONDLY, (Function) check_delay);

+ 4 - 0
src/mod/share.mod/share.h

@@ -46,6 +46,10 @@ typedef struct {
 #define uff_addtable ((void (*) (uff_table_t *))share_funcs[6])
 #define uff_deltable ((void (*) (uff_table_t *))share_funcs[7])
 /* 8 - 11 */
+
+void sharein(int, char *);
+void shareout(struct chanset_t *, ...);
+
 #endif				/* !MAKING_SHARE */
 
 #endif				/* _EGG_MOD_SHARE_SHARE_H */

+ 2 - 2
src/mod/static.h

@@ -10,7 +10,7 @@ char *compress_start();
 #ifdef LEAF
 char *irc_start();
 char *server_start();
-#endif
+#endif /* LEAF */
 char *share_start();
 char *transfer_start();
 
@@ -27,7 +27,7 @@ static void link_statics()
 #ifdef LEAF
   check_static("irc", irc_start);
   check_static("server", server_start);
-#endif
+#endif /* LEAF */
   check_static("share", share_start);
   check_static("transfer", transfer_start);
 }

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

@@ -15,6 +15,7 @@
 #include <sys/stat.h>
 #include "src/mod/module.h"
 #include "src/tandem.h"
+#include "src/mod/share.mod/share.h"
 #include "src/net.h"
 
 #include "src/users.h"

+ 1 - 2
src/mod/update.mod/update.c

@@ -213,7 +213,7 @@ static cmd_t update_bot[] = {
 };
 
 
-static void updatein_mod(int idx, char *msg)
+void updatein(int idx, char *msg)
 {
   char *code = NULL;
   int f, i;
@@ -488,7 +488,6 @@ void update_init()
 #ifdef HUB
   add_hook(HOOK_30SECONDLY, (Function) check_updates);
 #endif /* HUB */
-  add_hook(HOOK_SHAREUPDATEIN, (Function) updatein_mod);
   def_dcc_bot_kill = DCC_BOT.kill;
   DCC_BOT.kill = cancel_user_xfer;
 }

+ 1 - 24
src/mod/update.mod/update.h

@@ -6,33 +6,10 @@
 #ifndef _EGG_MOD_update_update_H
 #define _EGG_MOD_update_update_H
 
-/* Currently reserved flags for other modules:
- *      UFF_COMPRESS    0x000008	   Compress the user file
- *      UFF_ENCRYPT	0x000010	   Encrypt the user file
- */
-
-/* Currently used priorities:
- *       90		UFF_ENCRYPT
- *      100             UFF_COMPRESS
- */
-
-typedef struct {
-  char	 *feature;		/* Name of the feature			*/
-  int	  flag;			/* Flag representing the feature	*/
-  int	(*ask_func)(int);	/* Pointer to the function that tells
-				   us wether the feature should be
-				   considered as on.			*/
-  int	  priority;		/* Priority with which this entry gets
-				   called.				*/
-  int	(*snd)(int, char *);	/* Called before sending. Handled
-				   according to `priority'.		*/
-  int	(*rcv)(int, char *);	/* Called on receive. Handled according
-				   to `priority'.			*/
-} uff_table_t;
-
 extern int bupdating;
 
 void finish_update(int);
 void update_report(int, int);
+void updatein(int, char *);
 
 #endif				/* _EGG_MOD_update_update_H */

+ 11 - 57
src/modules.c

@@ -132,22 +132,6 @@ int false_func()
  */
 struct hook_entry *hook_list[REAL_HOOKS];
 
-static void null_share(int idx, char *x)
-{
-  if ((x[0] == 'u') && (x[1] == 'n')) {
-    putlog(LOG_BOTS, "*", "User file rejected by %s: %s",
-	   dcc[idx].nick, x + 3);
-    dcc[idx].status &= ~STAT_OFFERED;
-    if (!(dcc[idx].status & STAT_GETTING)) {
-      dcc[idx].status &= ~STAT_SHARE;
-    }
-  } else if ((x[0] != 'v') && (x[0] != 'e'))
-    dprintf(idx, "s un Not sharing userfile.\n");
-}
-
-void (*shareout) () = null_func;
-void (*sharein) (int, char *) = null_share;
-void (*shareupdatein) (int, char *) = null_share;
 void (*qserver) (int, char *, int) = (void (*)(int, char *, int)) null_func;
 void (*add_mode) () = null_func;
 int (*rfc_casecmp) (const char *, const char *) = _rfc_casecmp;
@@ -256,7 +240,7 @@ Function global_table[] =
   (Function) flagrec_eq,
   (Function) flagrec_ok,
   /* 68 - 71 */
-  (Function) & shareout,
+  (Function) 0,
   (Function) dprintf,
   (Function) chatout,
   (Function) chanout_but,
@@ -630,7 +614,7 @@ Function global_table[] =
 
 };
 
-static bind_table_t *BT_load;
+static bind_table_t *BT_load = NULL;
 
 void init_modules(void)
 {
@@ -640,23 +624,18 @@ void init_modules(void)
 
   module_list = calloc(1, sizeof(module_entry));
   module_list->name = strdup("eggdrop");
-  module_list->major = 100;
-  module_list->minor = 15;
   module_list->next = NULL;
   module_list->funcs = NULL;
   for (i = 0; i < REAL_HOOKS; i++)
     hook_list[i] = NULL;
 }
 
-int module_register(char *name, Function * funcs,
-		    int major, int minor)
+int module_register(char *name, Function * funcs, int major, int minor)
 {
   module_entry *p = NULL;
 
   for (p = module_list; p && p->name; p = p->next)
     if (!egg_strcasecmp(name, p->name)) {
-      p->major = major;
-      p->minor = minor;
       p->funcs = funcs;
       return 1;
     }
@@ -673,15 +652,15 @@ const char *module_load(char *name)
   sdprintf("module_load(\"%s\")", name);
 
   if (module_find(name, 0, 0) != NULL)
-    return MOD_ALREADYLOAD;
+    return "Already loaded";
+
   for (sl = static_modules; sl && egg_strcasecmp(sl->name, name); sl = sl->next);
   if (!sl)
-    return "Unknown module.";
+    fatal("Unknown module.", 0);
+
   f = (Function) sl->func;
   p = calloc(1, sizeof(module_entry));
   p->name = strdup(name);
-  p->major = 0;
-  p->minor = 0;
   p->funcs = 0;
   p->next = module_list;
   module_list = p;
@@ -701,8 +680,7 @@ module_entry *module_find(char *name, int major, int minor)
   module_entry *p;
 
   for (p = module_list; p && p->name; p = p->next) 
-    if ((major == p->major || !major) && minor <= p->minor && 
-	!egg_strcasecmp(name, p->name))
+    if (!egg_strcasecmp(name, p->name))
       return p;
   return NULL;
 }
@@ -742,8 +720,6 @@ Function *module_depend(char *name1, char *name2, int major, int minor)
   d->needed = p;
   d->needing = o;
   d->next = dependancy_list;
-  d->major = major;
-  d->minor = minor;
   dependancy_list = d;
   return p->funcs ? p->funcs : (Function *) 1;
 }
@@ -794,15 +770,6 @@ void add_hook(int hook_num, Function func)
     p->func = func;
   } else
     switch (hook_num) {
-    case HOOK_SHAREOUT:
-      shareout = (void (*)()) func;
-      break;
-    case HOOK_SHAREIN:
-      sharein = (void (*)(int, char *)) func;
-      break;
-    case HOOK_SHAREUPDATEIN:
-      shareupdatein = (void (*)(int, char *)) func;
-      break;
     case HOOK_QSERV:
       if (qserver == (void (*)(int, char *, int)) null_func)
 	qserver = (void (*)(int, char *, int)) func;
@@ -847,18 +814,6 @@ void del_hook(int hook_num, Function func)
     }
   } else
     switch (hook_num) {
-    case HOOK_SHAREOUT:
-      if (shareout == (void (*)()) func)
-	shareout = null_func;
-      break;
-    case HOOK_SHAREIN:
-      if (sharein == (void (*)(int, char *)) func)
-	sharein = null_share;
-      break;
-    case HOOK_SHAREUPDATEIN:
-      if (shareupdatein == (void (*)(int, char *)) func)
-	shareupdatein = null_share;
-      break;
     case HOOK_QSERV:
       if (qserver == (void (*)(int, char *, int)) func)
 	qserver = null_func;
@@ -896,13 +851,12 @@ void do_module_report(int idx, int details, char *which)
       dependancy *d;
 
       if (details)
-	dprintf(idx, "Module: %s, v %d.%d\n", p->name ? p->name : "CORE",
-		p->major, p->minor);
+	dprintf(idx, "Module: %s\n", p->name ? p->name : "CORE");
+
       if (details > 1) {
 	for (d = dependancy_list; d; d = d->next) 
 	  if (d->needing == p)
-	    dprintf(idx, "    requires: %s, v %d.%d\n", d->needed->name,
-		    d->major, d->minor);
+	    dprintf(idx, "    requires: %s\n", d->needed->name);
       }
       if (p->funcs) {
 	Function f = p->funcs[MODCALL_REPORT];

+ 0 - 2
src/modules.h

@@ -52,8 +52,6 @@ typedef struct _dependancy {
   struct _module_entry *needed;
   struct _module_entry *needing;
   struct _dependancy *next;
-  int major;
-  int minor;
 } dependancy;
 extern dependancy *dependancy_list;
 #endif				/* _EGG_MODULE_H */

+ 3 - 3
src/tclhash.c

@@ -387,13 +387,13 @@ void add_builtins(const char *table_name, cmd_t *cmds)
 
 	for (; cmds->name; cmds++) {
                 /* add BT_dcc cmds to cmdlist[] :: add to the help system.. */
-                if (!strcmp(table->name, "dcc") && !(cmds->nohelp)) {
+                if (!strcmp(table->name, "dcc")) {
 		  cmdlist[cmdi].name = cmds->name;
                   cmdlist[cmdi].flags.match = FR_GLOBAL | FR_CHAN;
                   break_down_flags(cmds->flags, &(cmdlist[cmdi].flags), NULL);
                   cmdi++;
-                }
-		egg_snprintf(name, 50, "*%s:%s", table->name, cmds->funcname ? cmds->funcname : cmds->name);
+                } 
+		egg_snprintf(name, sizeof name, "*%s:%s", table->name, cmds->funcname ? cmds->funcname : cmds->name);
 		bind_entry_add(table, cmds->flags, cmds->name, name, 0, cmds->func, NULL);
 	}
 }

+ 1 - 0
src/userent.c

@@ -6,6 +6,7 @@
 
 #include "common.h"
 #include "users.h"
+#include "src/mod/share.mod/share.h"
 #include "misc.h"
 #include "debug.h"
 #include "match.h"

+ 2 - 1
src/userrec.c

@@ -11,6 +11,7 @@
 #include "misc_file.h"
 #include "rfc1459.h"
 #include "dcc.h"
+#include "src/mod/share.mod/share.h"
 #include "userrec.h"
 #include "misc.h"
 #include "users.h"
@@ -425,7 +426,7 @@ int write_userfile(int idx)
     return 2;
   }
   if (idx >= 0)
-    dprintf(idx, USERF_WRITING);
+    dprintf(idx, "Saving userfile...\n");
   if (sort_users)
     sort_userlist();
   tt = now;

+ 8 - 10
src/users.c

@@ -15,6 +15,7 @@
 #include "common.h"
 #include "users.h"
 #include "rfc1459.h"
+#include "src/mod/share.mod/share.h"
 #include "dcc.h"
 #include "salt.h"
 #include "userrec.h"
@@ -1045,11 +1046,6 @@ printf("BUF: %s\n", resultbuf);
   return 1;
 }
 
-/* New methodology - cycle through list 3 times
- * 1st time scan for +sh bots and link if none connected
- * 2nd time scan for +h bots
- * 3rd time scan for +a/+h bots */
-
 void link_pref_val(struct userrec *u, char *val)
 {
 
@@ -1058,17 +1054,19 @@ void link_pref_val(struct userrec *u, char *val)
 
   val[0] = 'Z';
   val[1] = 0;
+  
   if (!u)
     return;
+
   if (!(u->flags & USER_BOT))
     return;
-  ba = get_user(&USERENTRY_BOTADDR, u);
-  if (!ba)
+  if (!(ba = get_user(&USERENTRY_BOTADDR, u))) {
     return;
-  if (!ba->hublevel)
+  }
+  if (!ba->hublevel) {
     return;
-  sprintf(val, STR("%02d%s"), ba->hublevel, u->handle);
-
+  }
+  sprintf(val, "%02d%s", ba->hublevel, u->handle);
 }
 
 /*