Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2005-04-25 03:36:05 UTC

Modified files:
     ChangeLog doc/example.conf include/s_conf.h ircd/ircd.c
     ircd/ircd_lexer.l ircd/ircd_parser.y ircd/m_invite.c
     ircd/s_user.c

Log message:

Add autoconnect option for Connect block.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.613 ircu2.10/ChangeLog:1.614
--- ircu2.10/ChangeLog:1.613    Sun Apr 24 10:27:02 2005
+++ ircu2.10/ChangeLog  Sun Apr 24 20:35:46 2005
@@ -1,5 +1,24 @@
 2005-04-24  Michael Poole <[EMAIL PROTECTED]>
 
+       * doc/example.conf: Document new autoconnect field of Connect.
+
+       * include/s_conf.h: Add CONF_AUTOCONNECT and field for it.
+
+       * ircd/ircd.c (try_connections): Skip non-autoconnect servers.
+
+       * ircd/ircd_lexer.l: Recognize autoconnect token.
+
+       * ircd/ircd_parser.y: Add autoconnect= option to Connect block.
+
+       * ircd/m_invite.c (m_invite): Avoid sending channel timestamp to
+       user being invited.
+       (ms_invite): Likewise.
+
+       * ircd/s_user.c (register_user): Show class name rather than
+       pointer-as-integer.
+
+2005-04-24  Michael Poole <[EMAIL PROTECTED]>
+
        * ircd/ircd_parser.y: Rewrite so each error condition gets its own
        error message, and so that invalid parameters are printed out.
 
Index: ircu2.10/doc/example.conf
diff -u ircu2.10/doc/example.conf:1.56 ircu2.10/doc/example.conf:1.57
--- ircu2.10/doc/example.conf:1.56      Sat Apr 23 06:49:41 2005
+++ ircu2.10/doc/example.conf   Sun Apr 24 20:35:54 2005
@@ -520,12 +520,15 @@
 #  class = "classname";
 #  maxhops = 2;
 #  hub = "*.eu.undernet.org";
+#  autoconnect = no;
 # };
 #
 # The "port" field defines the default port the server tries to connect
 # to if an operator uses /connect without specifying a port. This is also
 # the port used when the server attempts to auto-connect to the remote
 # server. (See Class blocks for more informationa about auto-connects).
+# You may tell ircu to not automatically connect to a server by adding
+# "autoconnect = no;"; the default is to autoconnect.
 #
 # The maxhops field causes an SQUIT if a hub tries to introduce
 # servers farther away than that; the element 'leaf;' is an alias for
Index: ircu2.10/include/s_conf.h
diff -u ircu2.10/include/s_conf.h:1.32 ircu2.10/include/s_conf.h:1.33
--- ircu2.10/include/s_conf.h:1.32      Sat Apr 16 19:57:57 2005
+++ ircu2.10/include/s_conf.h   Sun Apr 24 20:35:54 2005
@@ -1,6 +1,6 @@
 /** @file s_conf.h
  * @brief ircd configuration file API.
- * @version $Id: s_conf.h,v 1.32 2005/04/17 02:57:57 entrope Exp $
+ * @version $Id: s_conf.h,v 1.33 2005/04/25 03:35:54 entrope Exp $
  */
 #ifndef INCLUDED_s_conf_h
 #define INCLUDED_s_conf_h
@@ -32,6 +32,8 @@
 #define CONF_OPERATOR           0x0020     /**< ConfItem describes an Operator 
block */
 #define CONF_UWORLD             0x8000     /**< ConfItem describes a Uworld 
server */
 
+#define CONF_AUTOCONNECT        0x0001     /**< Autoconnect to a server */
+
 /** Indicates ConfItem types that count associated clients. */
 #define CONF_CLIENT_MASK        (CONF_CLIENT | CONF_OPERATOR | CONF_SERVER)
 
@@ -63,6 +65,7 @@
   time_t hold;        /**< Earliest time to attempt an outbound
                          connect on this ConfItem. */
   int dns_pending;    /**< A dns request is pending. */
+  int flags;          /**< Additional modifiers for item. */
   int addrbits;       /**< Number of bits valid in ConfItem::address. */
   struct Privs privs; /**< Privileges for opers. */
   /** Used to detect if a privilege has been set by this ConfItem. */
Index: ircu2.10/ircd/ircd.c
diff -u ircu2.10/ircd/ircd.c:1.86 ircu2.10/ircd/ircd.c:1.87
--- ircu2.10/ircd/ircd.c:1.86   Wed Apr 20 19:35:16 2005
+++ ircu2.10/ircd/ircd.c        Sun Apr 24 20:35:54 2005
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Entry point and other initialization functions for the daemon.
- * @version $Id: ircd.c,v 1.86 2005/04/21 02:35:16 entrope Exp $
+ * @version $Id: ircd.c,v 1.87 2005/04/25 03:35:54 entrope Exp $
  */
 #include "config.h"
 
@@ -265,6 +265,7 @@
      */
     if (!(aconf->status & CONF_SERVER)
         || aconf->address.port == 0
+        || !(aconf->flags & CONF_AUTOCONNECT)
         || ((ajupe = jupe_find(aconf->name)) && JupeIsActive(ajupe)))
       continue;
 
Index: ircu2.10/ircd/ircd_lexer.l
diff -u ircu2.10/ircd/ircd_lexer.l:1.19 ircu2.10/ircd/ircd_lexer.l:1.20
--- ircu2.10/ircd/ircd_lexer.l:1.19     Sat Apr 23 17:17:39 2005
+++ ircu2.10/ircd/ircd_lexer.l  Sun Apr 24 20:35:54 2005
@@ -17,7 +17,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  *  USA.
- * $Id: ircd_lexer.l,v 1.19 2005/04/24 00:17:39 entrope Exp $
+ * $Id: ircd_lexer.l,v 1.20 2005/04/25 03:35:54 entrope Exp $
  */
 
 %{
@@ -100,9 +100,11 @@
   TOKEN(PREPEND),
   TOKEN(USERMODE),
   TOKEN(FAST),
+  TOKEN(AUTOCONNECT),
 #undef TOKEN
   { "administrator", ADMIN },
   { "apass_opmode", TPRIV_APASS_OPMODE },
+  { "auto", AUTOCONNECT },
   { "b", BYTES },
   { "badchan", TPRIV_BADCHAN },
   { "chan_limit", TPRIV_CHAN_LIMIT },
Index: ircu2.10/ircd/ircd_parser.y
diff -u ircu2.10/ircd/ircd_parser.y:1.51 ircu2.10/ircd/ircd_parser.y:1.52
--- ircu2.10/ircd/ircd_parser.y:1.51    Sun Apr 24 10:27:04 2005
+++ ircu2.10/ircd/ircd_parser.y Sun Apr 24 20:35:54 2005
@@ -17,7 +17,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  *  USA.
- * $Id: ircd_parser.y,v 1.51 2005/04/24 17:27:04 entrope Exp $
+ * $Id: ircd_parser.y,v 1.52 2005/04/25 03:35:54 entrope Exp $
  */
 %{
 
@@ -68,7 +68,7 @@
 
   int yylex(void);
   /* Now all the globals we need :/... */
-  int tping, tconn, maxlinks, sendq, port, invert, stringno;
+  int tping, tconn, maxlinks, sendq, port, invert, stringno, flags;
   char *name, *pass, *host, *ip, *username, *origin, *hub_limit;
   char *stringlist[MAX_STRINGS];
   struct ConnectionClass *c_class;
@@ -155,6 +155,7 @@
 %token IAUTH
 %token TIMEOUT
 %token FAST
+%token AUTOCONNECT
 /* and now a lot of privileges... */
 %token TPRIV_CHAN_LIMIT TPRIV_MODE_LCHAN TPRIV_DEOP_LCHAN TPRIV_WALK_LCHAN
 %token TPRIV_LOCAL_KILL TPRIV_REHASH TPRIV_RESTART TPRIV_DIE
@@ -395,6 +396,7 @@
 connectblock: CONNECT
 {
  maxlinks = 65535;
+ flags = CONF_AUTOCONNECT;
 } '{' connectitems '}'
 {
  struct ConfItem *aconf = NULL;
@@ -418,6 +420,7 @@
    aconf->host = host;
    aconf->maximum = maxlinks;
    aconf->hub_limit = hub_limit;
+   aconf->flags = flags;
    lookup_confhost(aconf);
  }
  if (!aconf) {
@@ -429,12 +432,12 @@
  }
  name = pass = host = origin = hub_limit = NULL;
  c_class = NULL;
- port = 0;
+ port = flags = 0;
 }';';
 connectitems: connectitem connectitems | connectitem;
 connectitem: connectname | connectpass | connectclass | connecthost
               | connectport | connectvhost | connectleaf | connecthub
-              | connecthublimit | connectmaxhops | error;
+              | connecthublimit | connectmaxhops | connectauto | error;
 connectname: NAME '=' QSTRING ';'
 {
  MyFree(name);
@@ -482,6 +485,8 @@
 {
   maxlinks = $3;
 };
+connectauto: AUTOCONNECT '=' YES ';' { flags |= CONF_AUTOCONNECT; }
+ | AUTOCONNECT '=' NO ';' { flags &= ~CONF_AUTOCONNECT; };
 
 uworldblock: UWORLD '{' uworlditems '}' ';';
 uworlditems: uworlditem uworlditems | uworlditem;
Index: ircu2.10/ircd/m_invite.c
diff -u ircu2.10/ircd/m_invite.c:1.19 ircu2.10/ircd/m_invite.c:1.20
--- ircu2.10/ircd/m_invite.c:1.19       Sun Mar 20 08:06:18 2005
+++ ircu2.10/ircd/m_invite.c    Sun Apr 24 20:35:54 2005
@@ -20,7 +20,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: m_invite.c,v 1.19 2005/03/20 16:06:18 entrope Exp $
+ * $Id: m_invite.c,v 1.20 2005/04/25 03:35:54 entrope Exp $
  */
 
 /*
@@ -177,24 +177,23 @@
   if (cli_user(acptr)->away)
     send_reply(sptr, RPL_AWAY, cli_name(acptr), cli_user(acptr)->away);
 
-  if (MyConnect(acptr))
+  if (MyConnect(acptr)) {
     add_invite(acptr, chptr);
+    sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H", cli_name(acptr), chptr);
+  }
 
   if (!IsLocalChannel(chptr->chname) || MyConnect(acptr)) {
     if (feature_bool(FEAT_ANNOUNCE_INVITES)) {
       /* Announce to channel operators. */
       sendcmdto_channel_butserv_butone(&me, 
get_error_numeric(RPL_ISSUEDINVITE)->str,
-                                       NULL, chptr, sptr, SKIP_NONOPS, 
+                                       NULL, chptr, sptr, SKIP_NONOPS,
                                        "%H %C %C :%C has been invited by %C",
                                        chptr, acptr, sptr, acptr, sptr);
-      /* Announce to servers with channel operators, but skip acptr,
-       * since they will be notified below. */
-      sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, acptr, 
SKIP_NONOPS,
+      /* Announce to servers with channel operators. */
+      sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, NULL, 
SKIP_NONOPS,
                                        "%s %H %Tu", cli_name(acptr),
                                        chptr, chptr->creationtime);
     }
-    sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H %Tu", cli_name(acptr),
-                  chptr, chptr->creationtime);
   }
 
   return 0;
@@ -280,8 +279,10 @@
   if (is_silenced(sptr, acptr))
     return 0;
 
-  if (MyConnect(acptr))
+  if (MyConnect(acptr)) {
       add_invite(acptr, chptr);
+      sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H", cli_name(acptr), chptr);
+  }
 
   if (feature_bool(FEAT_ANNOUNCE_INVITES)) {
     /* Announce to channel operators. */
@@ -289,16 +290,12 @@
                                      NULL, chptr, sptr, SKIP_NONOPS,
                                      "%H %C %C :%C has been invited by %C",
                                      chptr, acptr, sptr, acptr, sptr);
-    /* Announce to servers with channel operators, but skip acptr,
-     * since they will be notified below. */
-    sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, acptr, 
SKIP_NONOPS,
+    /* Announce to servers with channel operators. */
+    sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, NULL, 
SKIP_NONOPS,
                                      "%s %H %Tu", cli_name(acptr), chptr,
                                      chptr->creationtime);
   }
 
-  sendcmdto_one(sptr, CMD_INVITE, acptr,
-                "%s %H %Tu",
-                cli_name(acptr), chptr, chptr->creationtime);
   return 0;
 }
 
Index: ircu2.10/ircd/s_user.c
diff -u ircu2.10/ircd/s_user.c:1.91 ircu2.10/ircd/s_user.c:1.92
--- ircu2.10/ircd/s_user.c:1.91 Sun Apr 17 09:59:48 2005
+++ ircu2.10/ircd/s_user.c      Sun Apr 24 20:35:54 2005
@@ -22,7 +22,7 @@
  */
 /** @file
  * @brief Miscellaneous user-related helper functions.
- * @version $Id: s_user.c,v 1.91 2005/04/17 16:59:48 entrope Exp $
+ * @version $Id: s_user.c,v 1.92 2005/04/25 03:35:54 entrope Exp $
  */
 #include "config.h"
 
@@ -430,7 +430,7 @@
         {
           last_too_many1 = CurrentTime;
           sendto_opmask_butone(0, SNO_TOOMANY, "Too many connections in "
-                               "class %i for %s.", get_client_class(sptr),
+                               "class %s for %s.", get_client_class(sptr),
                                get_client_name(sptr, SHOW_IP));
         }
         ++ServerStats->is_ref;
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to