فهرست منبع

* irc.mod is now independant

svn: 784
Bryan Drewery 22 سال پیش
والد
کامیت
f26bfa3268

+ 14 - 24
src/cmds.c

@@ -33,6 +33,7 @@
 #include "src/mod/console.mod/console.h"
 #ifdef LEAF
 #include "src/mod/server.mod/server.h"
+#include "src/mod/irc.mod/irc.h"
 #endif /* LEAF */
 
 #include <ctype.h>
@@ -2170,7 +2171,6 @@ static void cmd_chattr(struct userrec *u, int idx, char *par)
   		     mns = {0, 0, 0, 0, 0, 0},
 		     user = {0, 0, 0, 0, 0, 0},
 		     ouser = {0, 0, 0, 0, 0, 0};
-  module_entry *me = NULL;
   int fl = -1, of = 0, ocf = 0;
 
   if (!par[0]) {
@@ -2369,11 +2369,10 @@ static void cmd_chattr(struct userrec *u, int idx, char *par)
     else
       dprintf(idx, STR("No flags for %s on %s.\n"), hand, chan->dname);
   }
-  if (chg && (me = module_find("irc", 0, 0))) {
-    Function *func = me->funcs;
-
-    (func[IRC_CHECK_THIS_USER]) (hand, 0, NULL);
-  }
+#ifdef LEAF
+  if (chg)
+    check_this_user(hand, 0, NULL);
+#endif /* LEAF */
   if (tmpchg)
     free(tmpchg);
 #ifdef HUB
@@ -3140,7 +3139,6 @@ static void cmd_mns_user(struct userrec *u, int idx, char *par)
   int idx2;
   char *handle = NULL;
   struct userrec *u2 = NULL;
-  module_entry *me = NULL;
 
   putlog(LOG_CMDS, "*", STR("#%s# -user %s"), dcc[idx].nick, par);
 
@@ -3185,11 +3183,9 @@ static void cmd_mns_user(struct userrec *u, int idx, char *par)
     dprintf(idx, STR("You can't remove users who aren't bots!\n"));
     return;
   }
-  if ((me = module_find("irc", 0, 0))) {
-    Function *func = me->funcs;
-
-   (func[IRC_CHECK_THIS_USER]) (handle, 1, NULL);
-  }
+#ifdef LEAF
+  check_this_user(handle, 1, NULL);
+#endif /* LEAF */
   if (deluser(handle)) {
     dprintf(idx, STR("Deleted %s.\n"), handle);
 #ifdef HUB
@@ -3206,7 +3202,6 @@ static void cmd_pls_host(struct userrec *u, int idx, char *par)
   struct list_type *q = NULL;
   struct flag_record fr2 = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0},
                      fr  = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0};
-  module_entry *me = NULL;
 
   putlog(LOG_CMDS, "*", STR("#%s# +host %s"), dcc[idx].nick, par);
 
@@ -3271,11 +3266,9 @@ static void cmd_pls_host(struct userrec *u, int idx, char *par)
   addhost_by_handle(handle, host);
   update_mod(handle, dcc[idx].nick, "+host", host);
   dprintf(idx, STR("Added '%s' to %s.\n"), host, handle);
-  if ((me = module_find("irc", 0, 0))) {
-    Function *func = me->funcs;
-
-   (func[IRC_CHECK_THIS_USER]) (handle, 0, NULL);
-  }
+#ifdef LEAF
+  check_this_user(handle, 0, NULL);
+#endif /* LEAF */
 #ifdef HUB
   write_userfile(idx);
 #endif /* HUB */
@@ -3287,7 +3280,6 @@ static void cmd_mns_host(struct userrec *u, int idx, char *par)
   struct userrec *u2 = NULL;
   struct flag_record fr2 = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0},
                      fr  = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0};
-  module_entry *me = NULL;
 
   putlog(LOG_CMDS, "*", STR("#%s# -host %s"), dcc[idx].nick, par);
   if (!par[0]) {
@@ -3346,11 +3338,9 @@ static void cmd_mns_host(struct userrec *u, int idx, char *par)
   if (delhost_by_handle(handle, host)) {
     dprintf(idx, STR("Removed '%s' from %s.\n"), host, handle);
     update_mod(handle, dcc[idx].nick, "-host", host);
-    if ((me = module_find("irc", 0, 0))) {
-      Function *func = me->funcs;
-
-     (func[IRC_CHECK_THIS_USER]) (handle, 2, host);
-    }
+#ifdef LEAF
+    check_this_user(handle, 2, host);
+#endif /* LEAF */
 #ifdef HUB
     write_userfile(idx);
 #endif /* HUB */

+ 1 - 1
src/main.c

@@ -718,7 +718,7 @@ int main(int argc, char **argv)
   module_load("channels");
 #ifdef LEAF
   server_init();
-  module_load("irc");
+  irc_init();
 #endif /* LEAF */
   module_load("transfer");
   module_load("share");

+ 4 - 7
src/misc.c

@@ -27,6 +27,7 @@
 #include "modules.h"
 #ifdef LEAF
 #include "src/mod/server.mod/server.h"
+#include "src/mod/irc.mod/irc.h"
 #endif /* LEAF */
 #include "userrec.h"
 #include "stat.h"
@@ -467,10 +468,6 @@ void show_channels(int idx, char *handle)
   struct userrec *u = NULL;
   int first = 0, l = 0, total = 0;
   char format[120] = "";
-#ifdef LEAF
-  module_entry *me = module_find("irc", 0, 0);
-  Function *func = me->funcs;
-#endif /* LEAF */
 
   if (handle)
     u = get_user_by_handle(userlist, handle);
@@ -489,10 +486,10 @@ void show_channels(int idx, char *handle)
   egg_snprintf(format, sizeof format, "  %%c%%-%us %%-s%%-s%%-s%%-s%%-s\n", (l+2));
 
   for (chan = chanset;chan;chan = chan->next) {
-#ifdef LEAF
-    int opped = (func[16] (chan));
-#else /* !LEAF */
     int opped = 0;
+
+#ifdef LEAF
+    opped = me_op(chan);
 #endif /* LEAF */
     get_user_flagrec(u, &fr, chan->dname);
     if (chk_op(fr, chan)) {

+ 9 - 28
src/mod/channels.mod/channels.c

@@ -17,9 +17,6 @@
 #include "src/egg_timer.h"
 
 static Function *global = NULL;
-#ifdef LEAF
-static Function *irc_funcs = NULL;
-#endif /* LEAF */
 
 int 			use_info;
 static char 			glob_chanmode[64];		/* Default chanmode (drummer,990731) */
@@ -141,11 +138,10 @@ static void got_cset(char *botnick, char *code, char *par)
   while (chan) {
     chname = chan->dname;
     do_chanset(NULL, chan, par, DO_LOCAL);
-    if (chan->status & CHAN_BITCH) {
-      module_entry *me = NULL;
-      if ((me = module_find("irc", 0, 0)))
-        (me->funcs[IRC_RECHECK_CHANNEL])(chan, 0);
-    }
+#ifdef LEAF
+    if (chan->status & CHAN_BITCH)
+      recheck_channel(chan, 0);
+#endif /* LEAF */
     if (!all)
       chan = NULL;
     else
@@ -586,13 +582,13 @@ inline static int chanset_unlink(struct chanset_t *chan)
 void remove_channel(struct chanset_t *chan)
 {
    int		 i;
-   module_entry	*me = NULL;
    /* Remove the channel from the list, so that noone can pull it
       away from under our feet during the check_part() call. */
    (void) chanset_unlink(chan);
 
-   if ((me = module_find("irc", 0, 0)) != NULL)
-     (me->funcs[IRC_DO_CHANNEL_PART])(chan);
+#ifdef LEAF
+   do_channel_part(chan);
+#endif /* LEAF */
 
    clear_channel(chan, 0);
    noshare = 1;
@@ -886,16 +882,8 @@ static void check_limitraise() {
   struct chanset_t *chan = NULL;
 
   for (chan = chanset; chan; chan = chan->next, i++) {
-    if (i % 2 == checklimit) {
-      if (chan->limitraise) {
-        if (dolimit(chan)) {
-          module_entry *me = NULL;
-
-          if ((me = module_find("irc", 0, 0)))
-            (me->funcs[23])(chan);             /* raise_limit(chan) */
-        }
-      }
-    }
+    if (i % 2 == checklimit && chan->limitraise && dolimit(chan))
+          raise_limit(chan);
   }
   if (checklimit)
     checklimit = 0;
@@ -952,13 +940,6 @@ 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
   timer_create_secs(60, "check_limitraise", (Function) check_limitraise);
 #endif /* LEAF */

+ 19 - 13
src/mod/channels.mod/cmdschan.c

@@ -16,7 +16,6 @@ static void cmd_pls_ban(struct userrec *u, int idx, char *par)
   unsigned long int expire_time = 0, expire_foo;
   int sticky = 0;
   struct chanset_t *chan = NULL;
-  module_entry *me = NULL;
 
   if (!par[0]) {
     dprintf(idx, "Usage: +ban <hostmask> [channel] [%%<XdXhXm>] [reason]\n");
@@ -123,8 +122,9 @@ static void cmd_pls_ban(struct userrec *u, int idx, char *par)
 	/* Avoid unnesessary modes if you got +dynamicbans, and there is
 	 * no reason to set mode if irc.mod aint loaded. (dw 001120)
 	 */
-	if ((me = module_find("irc", 0, 0)))
-	  (me->funcs[IRC_CHECK_THIS_BAN])(chan, s, sticky);
+#ifdef LEAF
+        check_this_ban(chan, s, sticky);
+#endif /* LEAF */
         
       } else {
 	u_addban(NULL, s, dcc[idx].nick, par, expire_time ? now + expire_time : 0, 0);
@@ -137,9 +137,10 @@ static void cmd_pls_ban(struct userrec *u, int idx, char *par)
 	  putlog(LOG_CMDS, "*", "#%s# (GLOBAL) +ban %s (%s)", dcc[idx].nick, s, par);
 	  dprintf(idx, "New ban: %s (%s)\n", s, par);
 	}
-	if ((me = module_find("irc", 0, 0)))
-	  for (chan = chanset; chan != NULL; chan = chan->next)
-	    (me->funcs[IRC_CHECK_THIS_BAN])(chan, s, sticky);
+#ifdef LEAF
+        for (chan = chanset; chan != NULL; chan = chan->next)
+          check_this_ban(chan, s, sticky);
+#endif /* LEAF */
       }
     }
   }
@@ -1072,9 +1073,8 @@ static void cmd_slowpart(struct userrec *u, int idx, char *par)
 static void cmd_stick_yn(int idx, char *par, int yn)
 {
   int i = 0, j;
-  struct chanset_t *chan = NULL, *achan = NULL;
+  struct chanset_t *chan = NULL;
   char *stick_type = NULL, s[UHOSTLEN] = "", chname[81] = "";
-  module_entry *me = NULL;
 
   stick_type = newsplit(&par);
   strncpyz(s, newsplit(&par), sizeof s);
@@ -1179,9 +1179,14 @@ static void cmd_stick_yn(int idx, char *par, int yn)
     if (i > 0) {
       putlog(LOG_CMDS, "*", "#%s# %sstick ban %s", dcc[idx].nick, yn ? "" : "un", s);
       dprintf(idx, "%stuck ban: %s\n", yn ? "S" : "Uns", s);
-      if ((me = module_find("irc", 0, 0)))
-	for (achan = chanset; achan != NULL; achan = achan->next)
-	  (me->funcs[IRC_CHECK_THIS_BAN])(achan, s, yn);
+#ifdef LEAF
+    {
+      struct chanset_t *achan = NULL;
+ 
+      for (achan = chanset; achan != NULL; achan = achan->next)
+        check_this_ban(achan, s, yn);
+    }
+#endif /* LEAF */
       return;
     }
     strncpyz(chname, dcc[idx].u.chat->con_chan, sizeof chname);
@@ -1206,8 +1211,9 @@ static void cmd_stick_yn(int idx, char *par, int yn)
   if (j > 0) {
     putlog(LOG_CMDS, "*", "#%s# %sstick ban %s %s", dcc[idx].nick, yn ? "" : "un", s, chname);
     dprintf(idx, "%stuck %s ban: %s\n", yn ? "S" : "Uns", chname, s);
-    if ((me = module_find("irc", 0, 0)))
-      (me->funcs[IRC_CHECK_THIS_BAN])(chan, s, yn);
+#ifdef LEAF
+    check_this_ban(chan, s, yn);
+#endif /* LEAF */
     return;
   }
   dprintf(idx, "No such ban.\n");

+ 6 - 9
src/mod/channels.mod/tclchan.c

@@ -290,7 +290,6 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
   int old_status = chan->status,
       old_mode_mns_prot = chan->mode_mns_prot,
       old_mode_pls_prot = chan->mode_pls_prot;
-  module_entry *me = NULL;
 #endif /* LEAF */
   struct udef_struct *ul = udef;
   char s[121] = "";
@@ -531,7 +530,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
     else if (!strcmp(item[i], "-seen"))  ;
     else if (!strcmp(item[i], "+secret"))  ;
     else if (!strcmp(item[i], "-secret"))  ;
-      else if (!strcmp(item[i], "-stopnethack"))  ;
+    else if (!strcmp(item[i], "-stopnethack"))  ;
     else if (!strcmp(item[i], "+stopnethack"))  ;
     else if (!strcmp(item[i], "-wasoptest"))  ;
     else if (!strcmp(item[i], "+wasoptest"))  ;  /* Eule 01.2000 */
@@ -626,7 +625,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
   }
 #ifdef LEAF
   if (1 || loading) {
-    if (((old_status ^ chan->status) & CHAN_INACTIVE) && module_find("irc", 0, 0)) {
+    if ((old_status ^ chan->status) & CHAN_INACTIVE) {
       if (!shouldjoin(chan) && (chan->status & (CHAN_ACTIVE | CHAN_PEND)))
         dprintf(DP_SERVER, "PART %s\n", chan->name);
       if (shouldjoin(chan) && !(chan->status & (CHAN_ACTIVE | CHAN_PEND)))
@@ -636,11 +635,9 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
 					   chan->channel.key : chan->key_prot);
     }
     if ((old_status ^ chan->status) & (CHAN_ENFORCEBANS | CHAN_BITCH)) {
-      if ((me = module_find("irc", 0, 0)))
-        (me->funcs[IRC_RECHECK_CHANNEL])(chan, 1);
+      recheck_channel(chan, 1);
     } else if (old_mode_pls_prot != chan->mode_pls_prot || old_mode_mns_prot != chan->mode_mns_prot) {
-      if ((me = module_find("irc", 0, 0)))
-        (me->funcs[IRC_RECHECK_CHANNEL_MODES])(chan);
+      recheck_channel_modes(chan);
     }
   }
 #endif /* LEAF */
@@ -816,8 +813,8 @@ int channel_add(char *result, char *newname, char *options)
 
   free(item);
 #ifdef LEAF
-  if (join && shouldjoin(chan) && module_find("irc", 0, 0))
-    dprintf(DP_SERVER, "JOIN %s %s\n", chan->dname, chan->key_prot);
+  if (join && shouldjoin(chan))
+    dprintf(DP_SERVER, "JOIN %s %s\n", chan->name, chan->key_prot);
 #endif /* LEAF */
   return ret;
 }

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

@@ -4,8 +4,6 @@
  *
  */
 
-#define MODULE_NAME "ctcp"
-#define MAKING_CTCP
 #undef MAKING_MODS /* TEMP HACK */
 #include "ctcp.h"
 #include "src/common.h"

+ 6 - 5
src/mod/irc.mod/chan.c

@@ -804,7 +804,8 @@ static void resetmasks(struct chanset_t *chan, masklist *m, maskrec *mrec, maskr
       break;
   }
 }
-static void check_this_ban(struct chanset_t *chan, char *banmask, int sticky)
+
+void check_this_ban(struct chanset_t *chan, char *banmask, int sticky)
 {
   memberlist *m = NULL;
   char user[UHOSTLEN] = "";
@@ -824,7 +825,7 @@ static void check_this_ban(struct chanset_t *chan, char *banmask, int sticky)
     add_mode(chan, '+', 'b', banmask);
 }
 
-static void recheck_channel_modes(struct chanset_t *chan)
+void recheck_channel_modes(struct chanset_t *chan)
 {
   int cur = chan->channel.mode,
       mns = chan->mode_mns_prot,
@@ -959,7 +960,7 @@ static void check_this_member(struct chanset_t *chan, char *nick, struct flag_re
   }
 }
 
-static void check_this_user(char *hand, int delete, char *host)
+void check_this_user(char *hand, int delete, char *host)
 {
   char s[UHOSTLEN] = "";
   memberlist *m = NULL;
@@ -1005,7 +1006,7 @@ time_t last_eI; /* this will stop +e and +I from being checked over and over if
 
 /* Things to do when i just became a chanop:
  */
-static void recheck_channel(struct chanset_t *chan, int dobans)
+void recheck_channel(struct chanset_t *chan, int dobans)
 {
   memberlist *m = NULL;
   char s[UHOSTLEN] = "";
@@ -1235,7 +1236,7 @@ static int got324(char *from, char *msg)
   return 0;
 }
 
-void memberlist_reposition(struct chanset_t * chan, memberlist * target) {
+static void memberlist_reposition(struct chanset_t * chan, memberlist * target) {
   /* Move target from it's current position to it's correct sorted position */
   memberlist *old = NULL, *m = NULL;
   if (chan->channel.member == target) {

+ 36 - 75
src/mod/irc.mod/irc.c

@@ -5,22 +5,33 @@
  *
  */
 
-#define MODULE_NAME "irc"
+#undef MAKING_MODS
+#include "src/common.h"
 #define MAKING_IRC
-#include "src/mod/module.h"
 #include "irc.h"
+#include "src/modules.h"
+#include "src/match.h"
+#include "src/settings.h"
+#include "src/tandem.h"
+#include "src/net.h"
+#include "src/botnet.h"
+#include "src/botmsg.h"
+#include "src/main.h"
+#include "src/cfg.h"
+#include "src/userrec.h"
 #include "src/misc.h"
+#include "src/rfc1459.h"
 #include "src/chanprog.h"
 #include "src/auth.h"
-//#include "src/userrec.h"
+#include "src/userrec.h"
 #include "src/salt.h"
+#include "src/tclhash.h"
+#include "src/userent.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)
@@ -49,9 +60,6 @@ struct cfg_entry CFG_OPBOTS,
 
 
 
-static Function *global = NULL;
-
-
 static int net_type = 0;
 static int wait_split = 300;		/* Time to wait for user to return from
 					   net-split. */
@@ -887,7 +895,7 @@ static int real_killmember(struct chanset_t *chan, char *nick, const char *file,
 
 /* Check if I am a chanop. Returns boolean 1 or 0.
  */
-static int me_op(struct chanset_t *chan)
+int me_op(struct chanset_t *chan)
 {
   memberlist *mx = NULL;
 
@@ -976,7 +984,7 @@ static void reset_chan_info(struct chanset_t *chan)
 /* Leave the specified channel and notify registered Tcl procs. This
  * should not be called by itsself.
  */
-static void do_channel_part(struct chanset_t *chan)
+void do_channel_part(struct chanset_t *chan)
 {
   if (shouldjoin(chan) && chan->name[0]) {
     /* Using chan->name is important here, especially for !chans <cybah> */
@@ -1308,7 +1316,7 @@ static void flush_modes()
   }
 }
 
-static void irc_report(int idx, int details)
+void irc_report(int idx, int details)
 {
   struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
   char ch[1024] = "", q[160] = "", *p = NULL;
@@ -1416,9 +1424,9 @@ static void do_nettype()
 }
 
 static cmd_t irc_bot[] = {
-  {"dp", "", (Function) mdop_request, NULL},
-  {"gi", "", (Function) getin_request, NULL},
-  {0, 0, 0, 0}
+  {"dp", 	"", 	(Function) mdop_request, 	NULL},
+  {"gi", 	"", 	(Function) getin_request, 	NULL},
+  {NULL, 	NULL, 	NULL, 				NULL}
 };
 
 static void getin_5secondly()
@@ -1433,48 +1441,6 @@ static void getin_5secondly()
   }
 }
 
-EXPORT_SCOPE char *irc_start();
-
-static Function irc_table[] =
-{
-  /* 0 - 3 */
-  (Function) irc_start,
-  (Function) NULL,
-  (Function) 0,
-  (Function) irc_report,
-  /* 4 - 7 */
-  (Function) 0,		
-  (Function) 0,		
-  (Function) 0,
-  (Function) 0,
-  /* 8 - 11 */
-  (Function) 0,		
-  (Function) 0,		
-  (Function) 0,		
-  (Function) 0,		
-  /* 12 - 15 */
-  (Function) 0,
-  (Function) 0,
-  (Function) 0,
-  (Function) recheck_channel,
-  /* 16 - 19 */
-  (Function) me_op,
-  (Function) recheck_channel_modes,
-  (Function) 0,
-  (Function) do_channel_part,
-  /* 20 - 23 */
-  (Function) check_this_ban,
-  (Function) check_this_user,
-  (Function) me_voice,
-  (Function) raise_limit,
-  /* 24 - 27 */
-  (Function) enforce_closed,
-};
-
-void irc_describe(struct cfg_entry *cfgent, int idx)
-{
-}
-
 void irc_changed(struct cfg_entry *cfgent, char *oldval, int *valid)
 {
   int i;
@@ -1529,45 +1495,41 @@ void irc_changed(struct cfg_entry *cfgent, char *oldval, int *valid)
 
 
 struct cfg_entry CFG_OPBOTS = {
-  "op-bots", CFGF_GLOBAL, NULL, NULL,
-  irc_changed, NULL, irc_describe
+	"op-bots", CFGF_GLOBAL, NULL, NULL,
+	irc_changed, NULL, NULL
 };
 
 struct cfg_entry CFG_INBOTS = {
-  "in-bots", CFGF_GLOBAL, NULL, NULL,
-  irc_changed, NULL, irc_describe
+	"in-bots", CFGF_GLOBAL, NULL, NULL,
+	irc_changed, NULL, NULL
 };
 
 struct cfg_entry CFG_LAGTHRESHOLD = {
-  "lag-threshold", CFGF_GLOBAL, NULL, NULL,
-  irc_changed, NULL, irc_describe
+	"lag-threshold", CFGF_GLOBAL, NULL, NULL,
+	irc_changed, NULL, NULL
 };
 
 struct cfg_entry CFG_OPREQUESTS = {
-  "op-requests", CFGF_GLOBAL, NULL, NULL,
-  irc_changed, NULL, irc_describe
+	"op-requests", CFGF_GLOBAL, NULL, NULL,
+	irc_changed, NULL, NULL
 };
 
 struct cfg_entry CFG_OPTIMESLACK = {
-  "op-time-slack", CFGF_GLOBAL, NULL, NULL,
-  irc_changed, NULL, irc_describe
+	"op-time-slack", CFGF_GLOBAL, NULL, NULL,
+	irc_changed, NULL, NULL
 };
 
 #ifdef S_AUTOLOCK
 struct cfg_entry CFG_FIGHTTHRESHOLD = {
-  "fight-threshold", CFGF_GLOBAL, NULL, NULL,
-  irc_changed, NULL, irc_describe
+	"fight-threshold", CFGF_GLOBAL, NULL, NULL,
+	irc_changed, NULL, NULL
 };
 #endif /* S_AUTOLOCK */
 
-char *irc_start(Function * global_funcs)
+void irc_init()
 {
   struct chanset_t *chan = NULL;
 
-  global = global_funcs;
-
-  module_register(MODULE_NAME, irc_table, 1, 3);
-
   add_cfg(&CFG_OPBOTS);
   add_cfg(&CFG_INBOTS);
   add_cfg(&CFG_LAGTHRESHOLD);
@@ -1603,6 +1565,5 @@ char *irc_start(Function * global_funcs)
 #endif /* S_AUTHCMDS */
 
   do_nettype();
-  return NULL;
 }
-#endif
+#endif /* LEAF */

+ 20 - 29
src/mod/irc.mod/irc.h

@@ -18,11 +18,15 @@
 #define QUICK           1
 
 #ifdef MAKING_IRC
+
 #ifdef S_AUTHCMDS
+
+#define add_mode real_add_mode
+static void real_add_mode(struct chanset_t *, char, char, char *);
+
 static int check_bind_pubc(char *, char *, char *, struct userrec *, char *, char *);
 #endif /* S_AUTHCMDS */
 static void makeopline(struct chanset_t *, char *, char *);
-static int me_op(struct chanset_t *);
 static int me_voice(struct chanset_t *);
 static int any_ops(struct chanset_t *);
 static char *getchanmode(struct chanset_t *);
@@ -31,12 +35,9 @@ static void flush_mode(struct chanset_t *, int);
 /* reset(bans|exempts|invites) are now just macros that call resetmasks
  * in order to reduce the code duplication. <cybah>
  */
-#define resetbans(chan)	    resetmasks((chan), (chan)->channel.ban,	\
-				       (chan)->bans, global_bans, 'b')
-#define resetexempts(chan)  resetmasks((chan), (chan)->channel.exempt,	\
-				       (chan)->exempts, global_exempts, 'e')
-#define resetinvites(chan)  resetmasks((chan), (chan)->channel.invite,	\
-				       (chan)->invites, global_invites, 'I')
+#define resetbans(chan)	    resetmasks((chan), (chan)->channel.ban, (chan)->bans, global_bans, 'b')
+#define resetexempts(chan)  resetmasks((chan), (chan)->channel.exempt, (chan)->exempts, global_exempts, 'e')
+#define resetinvites(chan)  resetmasks((chan), (chan)->channel.invite, (chan)->invites, global_invites, 'I')
 
 static void detect_autokick(char *, char *, struct chanset_t *, char *);
 /* static int target_priority(struct chanset_t *, memberlist *, int); */
@@ -44,7 +45,6 @@ static int do_op(char *, struct chanset_t *, int);
 static void request_op(struct chanset_t *);
 static void request_in(struct chanset_t *);
 static void reset_chan_info(struct chanset_t *);
-static void recheck_channel(struct chanset_t *, int);
 static void my_setkey(struct chanset_t *, char *);
 static void maybe_revenge(struct chanset_t *, char *, char *, int);
 static int detect_chan_flood(char *, char *, char *, struct chanset_t *, int,
@@ -58,30 +58,21 @@ static int real_killmember(struct chanset_t *chan, char *nick, const char *file,
 #define killmember(chan, nick)        real_killmember((chan), (nick), __FILE__,__LINE__)
 static void check_lonely_channel(struct chanset_t *chan);
 static int gotmode(char *, char *);
-void raise_limit(struct chanset_t *);
 #define newban(chan, mask, who)         newmask((chan)->channel.ban, mask, who)
-#define newexempt(chan, mask, who)      newmask((chan)->channel.exempt, mask, \
-						who)
-#define newinvite(chan, mask, who)      newmask((chan)->channel.invite, mask, \
-						who)
+#define newexempt(chan, mask, who)      newmask((chan)->channel.exempt, mask, who)
+#define newinvite(chan, mask, who)      newmask((chan)->channel.invite, mask, who)
 
-#else
-/* 4 - 7 */
-/* 8 - 11 */
-/* 12 - 15 */
-/* recheck_channel is here */
-/* 16 - 19 */
-#define me_op ((int(*)(struct chanset_t *))irc_funcs[16])
-/* recheck_channel_modes is here */
-/* do_channel_part is here. */
-/* 20 - 23 */
-#define check_this_ban ((void (*)(struct chanset_t *, char *, int))irc_funcs[20])
-#define check_this_user ((void(*)(char *, int, char *))irc_funcs[21])
-#define me_voice ((int(*)(struct chanset_t *))irc_funcs[22])
-#define raise_limit ((void (*)(struct chanset_t *))irc_funcs[23])
-#define enforce_closed ((void (*)(struct chanset_t *))irc_funcs[24])
+#endif /* MAKING_IRC */
 
-#endif				/* MAKING_IRC */
+int me_op(struct chanset_t *);
+void check_this_ban(struct chanset_t *, char *, int);
+void check_this_user(char *, int, char *);
+void raise_limit(struct chanset_t *);
+void enforce_closed(struct chanset_t *);
+void recheck_channel(struct chanset_t *, int);
+void recheck_channel_modes(struct chanset_t *);
+void do_channel_part(struct chanset_t *);
+void irc_report(int, int);
 
 #endif				/* _EGG_MOD_IRC_IRC_H */
 

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

@@ -5,8 +5,6 @@
  *
  */
 
-#define MODULE_NAME "server"
-#define MAKING_SERVER
 #undef MAKING_MODS
 #include "src/common.h"
 #include "src/cfg.h"

+ 6 - 8
src/mod/server.mod/servmsg.c

@@ -186,14 +186,12 @@ static int got001(char *from, char *msg)
   if (x == NULL)
     return 0;			/* Uh, no server list */
   /* Only join if the IRC module is loaded. */
-  if (module_find("irc", 0, 0))
-    for (chan = chanset; chan; chan = chan->next) {
-      chan->status &= ~(CHAN_ACTIVE | CHAN_PEND);
-      if (shouldjoin(chan))
-	dprintf(DP_SERVER, "JOIN %s %s\n",
-	        (chan->name[0]) ? chan->name : chan->dname,
-	        chan->channel.key[0] ? chan->channel.key : chan->key_prot);
-    }
+  for (chan = chanset; chan; chan = chan->next) {
+    chan->status &= ~(CHAN_ACTIVE | CHAN_PEND);
+    if (shouldjoin(chan))
+      dprintf(DP_SERVER, "JOIN %s %s\n", (chan->name[0]) ? chan->name : chan->dname,
+                                         chan->channel.key[0] ? chan->channel.key : chan->key_prot);
+  }
   if (egg_strcasecmp(from, dcc[servidx].host)) {
     putlog(LOG_MISC, "*", "(%s claims to be %s; updating server list)", dcc[servidx].host, from);
     for (i = curserv; i > 0 && x != NULL; i--)

+ 10 - 25
src/mod/share.mod/share.c

@@ -20,7 +20,7 @@
 #include "src/mod/transfer.mod/transfer.h"
 #include "src/mod/channels.mod/channels.h"
 #ifdef LEAF
-#  include "irc.mod/irc.h"
+#include "src/mod/irc.mod/irc.h"
 #endif /* LEAF */
 
 /* Minimum version I will share with. */
@@ -31,9 +31,6 @@ static const int min_exemptinvite	= 1000000;
 static const int min_uffeature		= 1000000;
 
 static Function *global = NULL, *transfer_funcs = NULL;
-#ifdef LEAF
-static Function *irc_funcs = NULL;
-#endif /* LEAF */
 
 static int private_global = 0;
 static int private_user = 0;
@@ -286,7 +283,6 @@ static void share_chattr(int idx, char *par)
   struct userrec *u = NULL;
   struct flag_record fr2;
   int bfl, ofl;
-  module_entry *me = NULL;
 
   if ((dcc[idx].status & STAT_SHARE) && !private_user) {
     hand = newsplit(&par);
@@ -313,13 +309,10 @@ static void share_chattr(int idx, char *par)
 	    noshare = 0;
 	    build_flags(s, &fr, 0);
 	    if (!(dcc[idx].status & STAT_GETTING))
-	      putlog(LOG_CMDS, "@", "%s: chattr %s %s %s",
-		     dcc[idx].nick, hand, s, par);
-	    if ((me = module_find("irc", 0, 0))) {
-	      Function *func = me->funcs;
-
-	      (func[IRC_RECHECK_CHANNEL]) (cst, 0);
-	    }
+	      putlog(LOG_CMDS, "@", "%s: chattr %s %s %s", dcc[idx].nick, hand, s, par);
+#ifdef LEAF
+            recheck_channel(cst, 0);
+#endif /* LEAF */
 	  } else
 	    putlog(LOG_CMDS, "*",
 		   "Rejected flags for unshared channel %s from %s",
@@ -344,16 +337,14 @@ static void share_chattr(int idx, char *par)
 	  noshare = 0;
 	  build_flags(s, &fr, 0);
 	  fr.match = FR_CHAN;
-#ifndef LEAF
+#ifdef HUB
 	  if (!(dcc[idx].status & STAT_GETTING))
 	    putlog(LOG_CMDS, "@", "%s: chattr %s %s", dcc[idx].nick, hand, s);
+#endif /* HUB */
+#ifdef LEAF
+          for (cst = chanset; cst; cst = cst->next)
+            recheck_channel(cst, 0);
 #endif /* LEAF */
-	  if ((me = module_find("irc", 0, 0))) {
-	    Function *func = me->funcs;
-
-	    for (cst = chanset; cst; cst = cst->next)
-	      (func[IRC_RECHECK_CHANNEL]) (cst, 0);
-	  }
 	} else
 	  putlog(LOG_CMDS, "@", "Rejected global flags for %s from %s",
 		 hand, dcc[idx].nick);
@@ -2139,12 +2130,6 @@ char *share_start(Function *global_funcs)
     return "This module requires transfer module 2.0 or later.";
   }
 
-#ifdef LEAF
-  if (!(irc_funcs = module_depend(MODULE_NAME, "irc", 0, 0))) {
-    module_undepend(MODULE_NAME);
-    return "This module requires channels module 1.0 or later.";
-  }
-#endif /* LEAF */
   timer_create_secs(60, "check_expired_tbufs", (Function) check_expired_tbufs);
   timer_create_secs(1, "check_delay", (Function) check_delay);
   add_hook(HOOK_READ_USERFILE, (Function) hook_read_userfile);

+ 1 - 3
src/mod/static.h

@@ -20,15 +20,13 @@ void update_init();
 void notes_init();
 #ifdef LEAF
 void server_init();
+void irc_init();
 #endif /* LEAF */
 
 static void link_statics()
 {
   check_static("channels", channels_start);
   check_static("compress", compress_start);
-#ifdef LEAF
-  check_static("irc", irc_start);
-#endif /* LEAF */
   check_static("share", share_start);
   check_static("transfer", transfer_start);
 }