Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2006-06-27 02:05:30 UTC

Modified files:
     ChangeLog ircd/ircd.c ircd/ircd_features.c ircd/motd.c

Log message:

Call notifiers (e.g. to set ISUPPORT) for defaulted features.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.777 ircu2.10/ChangeLog:1.778
--- ircu2.10/ChangeLog:1.777    Mon Jun 26 17:11:17 2006
+++ ircu2.10/ChangeLog  Mon Jun 26 19:05:19 2006
@@ -1,3 +1,15 @@
+2006-06-26  Michael Poole <[EMAIL PROTECTED]>
+
+       * ircd/ircd.c (main): Remove now-redundant call to motd_init() and
+       #include "motd.h".
+
+       * ircd/ircd_features.c (FEAT_NOINIT): New feature flag.
+       (features): Use it on FEAT_RPATH.
+       (feature_init): Make notify callbacks automatically.
+
+       * ircd/motd.c (motd_init): Safely handle case where FEAT_MPATH
+       and/or FEAT_RPATH have not yet been set.
+
 2006-06-17  Michael Poole <[EMAIL PROTECTED]>
 
        * ircd/m_pass.c (mr_pass): Only back 'len' up when it's safe.
Index: ircu2.10/ircd/ircd.c
diff -u ircu2.10/ircd/ircd.c:1.99 ircu2.10/ircd/ircd.c:1.100
--- ircu2.10/ircd/ircd.c:1.99   Sun May 14 12:31:30 2006
+++ ircu2.10/ircd/ircd.c        Mon Jun 26 19:05:20 2006
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Entry point and other initialization functions for the daemon.
- * @version $Id: ircd.c,v 1.99 2006/05/14 19:31:30 entrope Exp $
+ * @version $Id: ircd.c,v 1.100 2006/06/27 02:05:20 entrope Exp $
  */
 #include "config.h"
 
@@ -41,7 +41,6 @@
 #include "jupe.h"
 #include "list.h"
 #include "match.h"
-#include "motd.h"
 #include "msg.h"
 #include "numeric.h"
 #include "numnicks.h"
@@ -704,8 +703,6 @@
      should be removed -- hikari */
   ircd_crypt_init();
 
-  motd_init();
-
   if (!init_conf()) {
     log_write(LS_SYSTEM, L_CRIT, 0, "Failed to read configuration file %s",
              configfile);
Index: ircu2.10/ircd/ircd_features.c
diff -u ircu2.10/ircd/ircd_features.c:1.57 ircu2.10/ircd/ircd_features.c:1.58
--- ircu2.10/ircd/ircd_features.c:1.57  Thu Jun  1 08:59:19 2006
+++ ircu2.10/ircd/ircd_features.c       Mon Jun 26 19:05:20 2006
@@ -18,7 +18,7 @@
  */
 /** @file
  * @brief Implementation of configurable feature support.
- * @version $Id: ircd_features.c,v 1.57 2006/06/01 15:59:19 klmitch Exp $
+ * @version $Id: ircd_features.c,v 1.58 2006/06/27 02:05:20 entrope Exp $
  */
 #include "config.h"
 
@@ -300,6 +300,7 @@
 #define FEAT_OPER   0x0100     /**< set to display only to opers */
 #define FEAT_MYOPER 0x0200     /**< set to display only to local opers */
 #define FEAT_NODISP 0x0400     /**< feature must never be displayed */
+#define FEAT_NOINIT 0x0800      /**< notifier should not be called at init */
 
 #define FEAT_READ   0x1000     /**< feature is read-only (for now, perhaps?) */
 
@@ -398,7 +399,7 @@
 
   /* Some misc. default paths */
   F_S(MPATH, FEAT_CASE | FEAT_MYOPER, "ircd.motd", motd_init),
-  F_S(RPATH, FEAT_CASE | FEAT_MYOPER, "remote.motd", motd_init),
+  F_S(RPATH, FEAT_CASE | FEAT_MYOPER | FEAT_NOINIT, "remote.motd", motd_init),
   F_S(PPATH, FEAT_CASE | FEAT_MYOPER | FEAT_READ, "ircd.pid", 0),
 
   /* Networking features */
@@ -879,26 +880,29 @@
   int i;
 
   for (i = 0; features[i].type; i++) {
-    switch (feat_type(&features[i])) {
+    struct FeatureDesc *feat = &features[i];
+
+    switch (feat_type(feat)) {
     case FEAT_NONE: /* you're on your own */
       break;
 
     case FEAT_INT:  /* Integers or Booleans... */
     case FEAT_BOOL:
-      features[i].v_int = features[i].def_int;
+      feat->v_int = feat->def_int;
       break;
 
     case FEAT_STR:  /* Strings */
-      features[i].v_str = features[i].def_str;
-      assert(features[i].def_str || (features[i].flags & FEAT_NULL));
+      feat->v_str = feat->def_str;
+      assert(feat->def_str || (feat->flags & FEAT_NULL));
       break;
     }
+
+    if (feat->notify && !(feat->flags & FEAT_NOINIT))
+      (*feat->notify)();
   }
 
   cli_magic(&his) = CLIENT_MAGIC;
   cli_status(&his) = STAT_SERVER;
-  feature_notify_servername();
-  feature_notify_serverinfo();
 }
 
 /** Report all F-lines to a user.
Index: ircu2.10/ircd/motd.c
diff -u ircu2.10/ircd/motd.c:1.23 ircu2.10/ircd/motd.c:1.24
--- ircu2.10/ircd/motd.c:1.23   Fri Jan  6 03:39:04 2006
+++ ircu2.10/ircd/motd.c        Mon Jun 26 19:05:20 2006
@@ -23,7 +23,7 @@
  */
 /** @file
  * @brief Message-of-the-day manipulation implementation.
- * @version $Id: motd.c,v 1.23 2006/01/06 11:39:04 isomer Exp $
+ * @version $Id: motd.c,v 1.24 2006/06/27 02:05:20 entrope Exp $
  */
 #include "config.h"
 
@@ -371,14 +371,20 @@
   if (MotdList.local) /* destroy old local... */
     motd_destroy(MotdList.local);
 
-  MotdList.local = motd_create(0, feature_str(FEAT_MPATH), MOTD_MAXLINES);
-  motd_cache(MotdList.local); /* init local and cache it */
+  if (!EmptyString(feature_str(FEAT_MPATH)))
+  {
+    MotdList.local = motd_create(0, feature_str(FEAT_MPATH), MOTD_MAXLINES);
+    motd_cache(MotdList.local); /* init local and cache it */
+  }
 
   if (MotdList.remote) /* destroy old remote... */
     motd_destroy(MotdList.remote);
 
-  MotdList.remote = motd_create(0, feature_str(FEAT_RPATH), MOTD_MAXREMOTE);
-  motd_cache(MotdList.remote); /* init remote and cache it */
+  if (!EmptyString(feature_str(FEAT_RPATH)))
+  {
+    MotdList.remote = motd_create(0, feature_str(FEAT_RPATH), MOTD_MAXREMOTE);
+    motd_cache(MotdList.remote); /* init remote and cache it */
+  }
 }
 
 /** Add a new MOTD.
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to