[cvslog] [CVS] Module eggdrop1.8: Change committed

cvs at eggheads.org cvs at eggheads.org
Mon Nov 1 16:38:49 CST 2010


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.8
Commit time: 2010-11-01 22:38:44 UTC
Committer  : Rumen Stoyanov <pseudo at egg6.net>

Modified files:
     eggdrop.conf doc/Changes1.8 doc/IPV6 doc/html/botnet.html
     doc/html/mod-server.html doc/settings/mod.server help/cmds1.help
     src/botnet.c src/cmds.c src/patch.h src/userent.c src/users.h
     src/mod/server.mod/cmdsserv.c src/mod/server.mod/server.c
     src/mod/server.mod/help/set/server.help

Log message:

Made it possible to specify ssl independently for telnet and user ports when modifying bot addresses.
Changed the syntax of .chaddr and .+bot to use space as a port separator instead of ':'.
Changed the syntax of server list entries to enclose literal IPv6 addresses in square brackets, instead of using a comma to separate the port.

---------------------- diff included ----------------------
Index: eggdrop1.8/doc/Changes1.8
diff -u eggdrop1.8/doc/Changes1.8:1.33 eggdrop1.8/doc/Changes1.8:1.34
--- eggdrop1.8/doc/Changes1.8:1.33	Sun Oct 31 08:40:38 2010
+++ eggdrop1.8/doc/Changes1.8	Mon Nov  1 16:38:33 2010
@@ -1,4 +1,4 @@
-$Id: Changes1.8,v 1.33 2010/10/31 14:40:38 pseudo Exp $
+$Id: Changes1.8,v 1.34 2010/11/01 22:38:33 pseudo Exp $
 
 Eggdrop Changes (since version 1.8.0)
 
@@ -6,6 +6,14 @@
 
 1.8.0 (CVS):
 
+  - Made it possible to specify ssl independently for telnet and user ports
+    when modifying bot addresses.
+  - Changed the syntax of .chaddr and .+bot to use space as a port separator
+    instead of ':'.
+  - Changed the syntax of server list entries to enclose IPv6 addresses in
+    square brackets, instead of using a comma to separate the port.
+    Patch by: pseudo
+
   - Fixed dcc_telnet_pass() to not use a constant string with fingerprint
     authentication, because strip_telnet() may attempt to write to it later.
     Found by: grawity / Patch by: pseudo
Index: eggdrop1.8/doc/IPV6
diff -u eggdrop1.8/doc/IPV6:1.1 eggdrop1.8/doc/IPV6:1.2
--- eggdrop1.8/doc/IPV6:1.1	Thu Aug  5 12:12:04 2010
+++ eggdrop1.8/doc/IPV6	Mon Nov  1 16:38:33 2010
@@ -1,4 +1,4 @@
-$Id: IPV6,v 1.1 2010/08/05 18:12:04 pseudo Exp $
+$Id: IPV6,v 1.2 2010/11/01 22:38:33 pseudo Exp $
 
 IPv6 support
 Last revised: Jul 29, 2010
@@ -45,9 +45,10 @@
 
     You can use IPv6 addresses wherever you could specify IPv4 ones. IPs and
     hostnames are interchangeable everywhere. For certain settings and
-    commands, you can use a comma ',' instead of the colon character ':' as a
-    port separator. These are documented in the help files and the html
-    documentation, so you can consult them when in doubt.
+    commands, you can enclose IPv6 addresses in square brackets to prevent
+    the colon character (:) from being interpreted as a port separator. These
+    are documented in the help files and the html documentation, so you can
+    consult them when in doubt.
 
   4. Settings
  
Index: eggdrop1.8/doc/html/botnet.html
diff -u eggdrop1.8/doc/html/botnet.html:1.1.1.1 eggdrop1.8/doc/html/botnet.html:1.2
--- eggdrop1.8/doc/html/botnet.html:1.1.1.1	Mon Jul 26 15:11:06 2010
+++ eggdrop1.8/doc/html/botnet.html	Mon Nov  1 16:38:33 2010
@@ -1,5 +1,5 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<!-- $Id: botnet.html,v 1.1.1.1 2010/07/26 21:11:06 simple Exp $ -->
+<!-- $Id: botnet.html,v 1.2 2010/11/01 22:38:33 pseudo Exp $ -->
 
 <html>
   <head>
@@ -184,7 +184,7 @@
         <dd>
           <p>The physical address, containing the address and port of the
           bot. For example: lame.org:3333. You can change a bot&#39;s
-          address with &#39;.chaddr &lt;botname&gt; &lt;hostaddress:botport
+          address with &#39;.chaddr &lt;botname&gt; &lt;hostaddress botport
           &#91;/userport&#93;&gt;&#39;.</p>
         </dd>
 
@@ -232,11 +232,11 @@
     <blockquote>
       <p>BotA is on lame.org listening on port 3333, and BotB is on irc.org
       listening on port 4444. First, you have to add each Bot to the other&#39;s
-      userfile. On BotA, you would type &#39;.+bot BotB irc.org:4444&#39;.
+      userfile. On BotA, you would type &#39;.+bot BotB irc.org 4444&#39;.
       If BotB is on a common channel with BotA, BotB&#39;s hostmask is
       automatically added. Otherwise, you have to add the hostmask manually
       with the &#39;.+host&#39; command. On BotB, you would type &#39;.+bot
-      BotA lame.org:3333&#39;.</p>
+      BotA lame.org 3333&#39;.</p>
 
       <p>At this point, you can link the two bots by typing &#39;.link
       BotA&#39; on BotB (or &#39;.link BotB&#39; on BotA). The bots will
@@ -342,7 +342,7 @@
     <p>On Lamestbot:</p>
 
     <blockquote>
-      <p>.+bot Lameshare eggdrop.com:3333 (This command adds a user record to
+      <p>.+bot Lameshare eggdrop.com 3333 (This command adds a user record to
       Lamestbot for Lameshare. Lameshare is running from eggdrop.com and is
       on port 3333. If Lameshare were to have a separate port for
       users/relays we would just add a &#39;/&#39; and the port number, i.e.
@@ -359,7 +359,7 @@
     <p>On Lameshare:</p>
 
     <blockquote>
-      <p>.+bot Lamestbot best.com:3333/5555 (Again this will add a user on
+      <p>.+bot Lamestbot best.com 3333/5555 (Again this will add a user on
       Lameshare called Lamestbot with the domain of best.com. The bot has two
       ports, 3333 for bot communications and 5555 for users/relays.)</p>
 
@@ -383,7 +383,7 @@
     <p>On Lamestbot:</p>
 
     <blockquote>
-      .+bot beldin llama.com:3333
+      .+bot beldin llama.com 3333
 
       <p>.botattr beldin s|s #eggdrop (Notice how i piped (the | character)
       the channel flag also saving time.)</p>
Index: eggdrop1.8/doc/html/mod-server.html
diff -u eggdrop1.8/doc/html/mod-server.html:1.3 eggdrop1.8/doc/html/mod-server.html:1.4
--- eggdrop1.8/doc/html/mod-server.html:1.3	Sun Oct 24 07:22:39 2010
+++ eggdrop1.8/doc/html/mod-server.html	Mon Nov  1 16:38:33 2010
@@ -1,5 +1,5 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<!-- $Id: mod-server.html,v 1.3 2010/10/24 13:22:39 pseudo Exp $ -->
+<!-- $Id: mod-server.html,v 1.4 2010/11/01 22:38:33 pseudo Exp $ -->
 
 <html>
   <head>
@@ -127,6 +127,7 @@
 <pre>
         you.need.to.change.this:6667
         another.example.com:7000:password
+        [2001:db8:618:5c0:263::]:6669:password
         ssl.example.net:+6697
 </pre>
         <p><strong>}</strong></p>
@@ -150,8 +151,8 @@
            server:+port[:password]</p>
 
            <p>Both the port and password fields are optional; however, if you
-           want to set a password you must also set a port. If a port isn&#39;t
-           specified it will default to  your default-port setting..</p>
+           want to set a password or use SSL you must also set a port. If a port
+           isn&#39;t specified it will default to  your default-port setting..</p>
         </dd>
 
         <dt><strong>set default-port 6667</strong></dt>
Index: eggdrop1.8/doc/settings/mod.server
diff -u eggdrop1.8/doc/settings/mod.server:1.4 eggdrop1.8/doc/settings/mod.server:1.5
--- eggdrop1.8/doc/settings/mod.server:1.4	Mon Oct 25 09:56:38 2010
+++ eggdrop1.8/doc/settings/mod.server	Mon Nov  1 16:38:34 2010
@@ -1,4 +1,4 @@
-$Id: mod.server,v 1.4 2010/10/25 15:56:38 pseudo Exp $
+$Id: mod.server,v 1.5 2010/11/01 22:38:34 pseudo Exp $
 
 Server Module
 Last revised: October 25, 2010
@@ -78,6 +78,7 @@
     set servers {
       you.need.to.change.this:6667
       another.example.com:7000:password
+      [2001:db8:618:5c0:263::]:6669:password
       ssl.example.net:+6697
     }
       This is the bot's server list. The bot will start at the first server
@@ -90,8 +91,8 @@
         server:+port[:password]
 
       Both the port and password fields are optional; however, if you want to
-      set a password you must also set a port. If a port isn't specified it
-      will default to your default-port setting.
+      set a password or use SSL you must also set a port. If a port isn't
+      specified it will default to your default-port setting.
 
 
     set default-port 6667
Index: eggdrop1.8/eggdrop.conf
diff -u eggdrop1.8/eggdrop.conf:1.9 eggdrop1.8/eggdrop.conf:1.10
--- eggdrop1.8/eggdrop.conf:1.9	Mon Oct 25 09:56:36 2010
+++ eggdrop1.8/eggdrop.conf	Mon Nov  1 16:38:32 2010
@@ -1,7 +1,7 @@
 #! /path/to/executable/eggdrop
 # ^- This should contain a fully qualified path to your Eggdrop executable.
 #
-# $Id: eggdrop.conf,v 1.9 2010/10/25 15:56:36 pseudo Exp $
+# $Id: eggdrop.conf,v 1.10 2010/11/01 22:38:32 pseudo Exp $
 #
 # This is a sample Eggdrop configuration file which includes all possible
 # settings that can be used to configure your bot.
@@ -972,16 +972,16 @@
 #   server[:port[:password]]
 # Prefix the port with a plus sign to attempt a SSL connection:
 #   server:+port[:password]
-# If you need to specify a numeric server IPv6 address, use following format:
-#   ip,[port[:password]]
+# If you need to specify a numeric server IPv6 address, enclose it in square
+# brackets.
 #
 # Both the port and password fields are optional; however, if you want to set a
-# password you must also set a port. If a port isn't specified it will default to
-# your default-port setting.
+# password or use SSL you must also set a port. If a port isn't specified it
+# will default to your default-port setting.
 set servers {
   you.need.to.change.this:6667
   another.example.com:7000:password
-  2001:db8:618:5c0:263::,6669:password
+  [2001:db8:618:5c0:263::]:6669:password
   ssl.example.net:+6697
 }
 
Index: eggdrop1.8/help/cmds1.help
diff -u eggdrop1.8/help/cmds1.help:1.3 eggdrop1.8/help/cmds1.help:1.4
--- eggdrop1.8/help/cmds1.help:1.3	Tue Oct 19 06:13:32 2010
+++ eggdrop1.8/help/cmds1.help	Mon Nov  1 16:38:34 2010
@@ -1,6 +1,5 @@
 %{help=+bot}%{+t}
-###  %b+bot%b <handle> [address[:[+]bot port[/[+]user port]]] [host]
-###  %b+bot%b <handle> [IPv6 address[,[+]bot port[/[+]user port]]] [host]
+###  %b+bot%b <handle> [address [[+]bot port[/[+]user port]]] [host]
    Creates a user record for a new bot with the handle given. If no hostmask
    is specified, the bot will try to automatically add a host from the channel.
    The bot's address will be used in linking. If the bot has a separate port
@@ -152,8 +151,7 @@
 
 See also: bots, botinfo, vbottree
 %{help=chaddr}%{+t}
-###  %bchaddr%b <bot> <address[:[+]bot port[/[+]user port]]>
-###  %bchaddr%b <bot> <IPv6 address[,[+]bot port[/[+]user port]]>
+###  %bchaddr%b <bot> <address> [[+]bot port[/[+]user port]]
    Changes the address for a bot. This is the address your bot will try to
    connect to when linking. If the bot has a separate port for bots and users,
    they should be separated  by a slash (/). Prefixing the port with a plus
Index: eggdrop1.8/src/botnet.c
diff -u eggdrop1.8/src/botnet.c:1.3 eggdrop1.8/src/botnet.c:1.4
--- eggdrop1.8/src/botnet.c:1.3	Tue Oct 19 06:13:33 2010
+++ eggdrop1.8/src/botnet.c	Mon Nov  1 16:38:34 2010
@@ -7,7 +7,7 @@
  *   linking, unlinking, and relaying to another bot
  *   pinging the bots periodically and checking leaf status
  *
- * $Id: botnet.c,v 1.3 2010/10/19 12:13:33 pseudo Exp $
+ * $Id: botnet.c,v 1.4 2010/11/01 22:38:34 pseudo Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -1034,7 +1034,7 @@
       dcc[i].timeval = now;
       dcc[i].port = bi->telnet_port;
 #ifdef TLS
-      dcc[i].ssl = bi->ssl;
+      dcc[i].ssl = (bi->ssl & TLS_BOT);
 #endif
       dcc[i].user = u;
       strcpy(dcc[i].nick, nick);
@@ -1178,7 +1178,7 @@
 
   dcc[i].port = bi->relay_port;
 #ifdef TLS
-  dcc[i].ssl = bi->ssl;
+  dcc[i].ssl = (bi->ssl & TLS_RELAY);
 #endif
   dcc[i].addr = 0L;
   strcpy(dcc[i].nick, nick);
Index: eggdrop1.8/src/cmds.c
diff -u eggdrop1.8/src/cmds.c:1.3 eggdrop1.8/src/cmds.c:1.4
--- eggdrop1.8/src/cmds.c:1.3	Tue Oct 19 06:13:33 2010
+++ eggdrop1.8/src/cmds.c	Mon Nov  1 16:38:34 2010
@@ -3,7 +3,7 @@
  *   commands from a user via dcc
  *   (split in 2, this portion contains no-irc commands)
  *
- * $Id: cmds.c,v 1.3 2010/10/19 12:13:33 pseudo Exp $
+ * $Id: cmds.c,v 1.4 2010/11/01 22:38:34 pseudo Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -746,22 +746,19 @@
 
 static void cmd_pls_bot(struct userrec *u, int idx, char *par)
 {
-  char *handle, *addr, *p, *q, *host;
+  char *handle, *addr, *port, *relay, *host;
   struct userrec *u1;
   struct bot_addr *bi;
 
   if (!par[0]) {
-    dprintf(idx, "Usage: +bot <handle> [address[:telnet-port[/relay-port]]] "
+    dprintf(idx, "Usage: +bot <handle> [address [telnet-port[/relay-port]]] "
             "[host]\n");
-#ifdef IPV6
-    dprintf(idx, "IPv6: +bot <handle> [IPv6-address,[telnet-port[/relay-port]]]"
-            " [host]\n");
-#endif
     return;
   }
 
   handle = newsplit(&par);
   addr = newsplit(&par);
+  port = newsplit(&par);
   host = newsplit(&par);
 
   if (strlen(handle) > HANDLEN)
@@ -780,54 +777,55 @@
   if (strlen(addr) > 60)
     addr[60] = 0;
 
-  putlog(LOG_CMDS, "*", "#%s# +bot %s%s%s%s%s", dcc[idx].nick, handle,
-         addr[0] ? " " : "", addr, host[0] ? " " : "", host);
   userlist = adduser(userlist, handle, "none", "-", USER_BOT);
   u1 = get_user_by_handle(userlist, handle);
   bi = user_malloc(sizeof(struct bot_addr));
+  bi->address = user_malloc(strlen(addr) + 1);
+  strcpy(bi->address, addr);
 
-#ifdef IPV6
-  if ((q = strchr(addr, ','))) {
-    if (!q[1]) {
-      *q = 0;
-      q = 0;
-    }
-  } else
-#endif
-  q = strchr(addr, ':');
-  if (!q) {
-    bi->address = user_malloc(strlen(addr) + 1);
-    strcpy(bi->address, addr);
+  if (!port[0]) {
     bi->telnet_port = 3333;
     bi->relay_port = 3333;
   } else {
-    bi->address = user_malloc(q - addr + 1);
-    strncpy(bi->address, addr, q - addr);
-    bi->address[q - addr] = 0;
-    p = q + 1;
 #ifdef TLS
-    if (*p == '+')
-      bi->ssl = 1;
+    if (*port == '+')
+      bi->ssl |= TLS_BOT;
 #endif
-    bi->telnet_port = atoi(p);
-    q = strchr(p, '/');
-    if (!q) {
+    bi->telnet_port = atoi(port);
+    relay = strchr(port, '/');
+    if (!relay) {
       bi->relay_port = bi->telnet_port;
+#ifdef TLS
+      bi->ssl *= TLS_BOT + TLS_RELAY;
+#endif
     } else  {
 #ifdef TLS
-      if (q[1] == '+')
-        bi->ssl = 1;
+      if (relay[1] == '+')
+        bi->ssl |= TLS_RELAY;
 #endif
-      bi->relay_port = atoi(q + 1);
+      bi->relay_port = atoi(relay + 1);
     }
   }
 
   set_user(&USERENTRY_BOTADDR, u1, bi);
   if (addr[0]) {
-    dprintf(idx, "Added bot '%s' with address '%s' and %s%s%s.\n", handle,
-            addr, host[0] ? "hostmask '" : "no hostmask", host[0] ? host : "",
+    putlog(LOG_CMDS, "*", "#%s# +bot %s %s%s%s %s%s", dcc[idx].nick, handle,
+           addr, port[0] ? " " : "", port[0] ? port : "", host[0] ? " " : "",
+           host);
+#ifdef TLS
+    dprintf(idx, "Added bot '%s' with address [%s]:%s%d/%s%d and %s%s%s.\n",
+            handle, addr, (bi->ssl & TLS_BOT) ? "+" : "", bi->telnet_port,
+            (bi->ssl & TLS_RELAY) ? "+" : "", bi->relay_port, host[0] ?
+            "hostmask '" : "no hostmask", host[0] ? host : "",
             host[0] ? "'" : "");
+#else
+    dprintf(idx, "Added bot '%s' with address [%s]:%d/%d and %s%s%s.\n", handle,
+            addr, bi->telnet_port, bi->relay_port, host[0] ? "hostmask '" :
+            "no hostmask", host[0] ? host : "", host[0] ? "'" : "");
+#endif
   } else {
+    putlog(LOG_CMDS, "*", "#%s# +bot %s %s%s", dcc[idx].nick, handle,
+           host[0] ? " " : "", host);
     dprintf(idx, "Added bot '%s' with no address and %s%s%s.\n", handle,
             host[0] ? "hostmask '" : "no hostmask", host[0] ? host : "",
             host[0] ? "'" : "");
@@ -1030,22 +1028,22 @@
 
 static void cmd_chaddr(struct userrec *u, int idx, char *par)
 {
+#ifdef TLS
+  int use_ssl = 0;
+#endif
   int telnet_port = 3333, relay_port = 3333;
-  char *handle, *addr, *p, *q;
+  char *handle, *addr, *port, *relay;
   struct bot_addr *bi;
   struct userrec *u1;
 
   handle = newsplit(&par);
   if (!par[0]) {
-    dprintf(idx, "Usage: chaddr <botname> "
-            "<address[:telnet-port[/relay-port]]>\n");
-#ifdef IPV6
-    dprintf(idx, "IPv6: chaddr <botname> "
-            "<IPv6-address,[telnet-port[/relay-port]]>\n");
-#endif
+    dprintf(idx, "Usage: chaddr <botname> <address> "
+            "[telnet-port[/relay-port]]>\n");
     return;
   }
   addr = newsplit(&par);
+  port = newsplit(&par);
   if (strlen(addr) > UHOSTMAX)
     addr[UHOSTMAX] = 0;
   u1 = get_user_by_handle(userlist, handle);
@@ -1057,52 +1055,51 @@
     dprintf(idx, "You can't change a share bot's address.\n");
     return;
   }
-  putlog(LOG_CMDS, "*", "#%s# chaddr %s %s", dcc[idx].nick, handle, addr);
+  putlog(LOG_CMDS, "*", "#%s# chaddr %s %s%s%s", dcc[idx].nick, handle,
+         addr, *port ? " " : "", port);
   dprintf(idx, "Changed bot's address.\n");
 
   bi = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, u1);
   if (bi) {
     telnet_port = bi->telnet_port;
     relay_port = bi->relay_port;
+#ifdef TLS
+    use_ssl = bi->ssl;
+#endif
   }
 
   bi = user_malloc(sizeof(struct bot_addr));
-#ifdef TLS
-  bi->ssl = 0;
-#endif
+  bi->address = user_malloc(strlen(addr) + 1);
+  strcpy(bi->address, addr);
 
-#ifdef IPV6
-  if ((q = strchr(addr, ','))) {
-    if (!q[1]) {
-      *q = 0;
-      q = 0;
-    }
-  } else
-#endif
-  q = strchr(addr, ':');
-  if (!q) {
-    bi->address = user_malloc(strlen(addr) + 1);
-    strcpy(bi->address, addr);
+  if (!port[0]) {
     bi->telnet_port = telnet_port;
     bi->relay_port = relay_port;
-  } else {
-    bi->address = user_malloc(q - addr + 1);
-    strncpyz(bi->address, addr, q - addr + 1);
-    p = q + 1;
 #ifdef TLS
-    if (*p == '+')
-      bi->ssl = 1;
-#endif
-    bi->telnet_port = atoi(p);
-    q = strchr(p, '/');
-    if (!q) {
+    bi->ssl = use_ssl;
+  } else {
+    bi->ssl = 0;
+    if (*port == '+')
+      bi->ssl |= TLS_BOT;
+    bi->telnet_port = atoi(port);
+    relay = strchr(port, '/');
+    if (!relay) {
       bi->relay_port = bi->telnet_port;
+      bi->ssl *= TLS_BOT + TLS_RELAY;
     } else {
-#ifdef TLS
-    if (q[1] == '+')
-      bi->ssl = 1;
+      relay++;
+      if (*relay == '+')
+        bi->ssl |= TLS_RELAY;
+#else
+  } else {
+    bi->telnet_port = atoi(port);
+    relay = strchr(port, '/');
+    if (!relay)
+      bi->relay_port = bi->telnet_port;
+    else {
+      relay++;
 #endif
-      bi->relay_port = atoi(q + 1);
+      bi->relay_port = atoi(relay);
     }
   }
   set_user(&USERENTRY_BOTADDR, u1, bi);
Index: eggdrop1.8/src/mod/server.mod/cmdsserv.c
diff -u eggdrop1.8/src/mod/server.mod/cmdsserv.c:1.2 eggdrop1.8/src/mod/server.mod/cmdsserv.c:1.3
--- eggdrop1.8/src/mod/server.mod/cmdsserv.c:1.2	Tue Oct 19 06:13:33 2010
+++ eggdrop1.8/src/mod/server.mod/cmdsserv.c	Mon Nov  1 16:38:34 2010
@@ -2,7 +2,7 @@
  * cmdsserv.c -- part of server.mod
  *   handles commands from a user via dcc that cause server interaction
  *
- * $Id: cmdsserv.c,v 1.2 2010/10/19 12:13:33 pseudo Exp $
+ * $Id: cmdsserv.c,v 1.3 2010/11/01 22:38:34 pseudo Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -38,18 +38,18 @@
     for (; x; x = x->next) {
       if ((i == curserv) && realservername)
 #ifdef TLS
-        egg_snprintf(s, sizeof s, "  %s:%s%d (%s) <- I am here", x->name,
+        egg_snprintf(s, sizeof s, "  [%s]:%s%d (%s) <- I am here", x->name,
                      x->ssl ? "+" : "", x->port ? x->port : default_port,
                      realservername);
       else
-        egg_snprintf(s, sizeof s, "  %s:%s%d %s", x->name, x->ssl ? "+" : "",
+        egg_snprintf(s, sizeof s, "  [%s]:%s%d %s", x->name, x->ssl ? "+" : "",
                      x->port ? x->port : default_port,
                      (i == curserv) ? "<- I am here" : "");
 #else
-        egg_snprintf(s, sizeof s, "  %s:%d (%s) <- I am here", x->name,
+        egg_snprintf(s, sizeof s, "  [%s]:%d (%s) <- I am here", x->name,
                      x->port ? x->port : default_port, realservername);
       else
-        egg_snprintf(s, sizeof s, "  %s:%d %s", x->name,
+        egg_snprintf(s, sizeof s, "  [%s]:%d %s", x->name,
                      x->port ? x->port : default_port,
                      (i == curserv) ? "<- I am here" : "");
 #endif
Index: eggdrop1.8/src/mod/server.mod/help/set/server.help
diff -u eggdrop1.8/src/mod/server.mod/help/set/server.help:1.3 eggdrop1.8/src/mod/server.mod/help/set/server.help:1.4
--- eggdrop1.8/src/mod/server.mod/help/set/server.help:1.3	Sun Oct 24 07:22:40 2010
+++ eggdrop1.8/src/mod/server.mod/help/set/server.help	Mon Nov  1 16:38:34 2010
@@ -134,16 +134,18 @@
 see also: set flood-ctcp
 %{help=set servers}%{+n}
 ###  %bset servers%b <server-list>
-   gives the bot a list of servers to use for IRC.  you can change
+   gives the bot a list of servers to use for IRC. You can change
    this at any time on the fly, but if the bot's current IRC server
    (the one it's on right now) isn't in your new list, it will be
-   added, to maintain coherency.  here's an example:
+   added, to maintain coherency. Here's an example:
       set servers {
-        goblin.irc.com:6667
         dragon.irc.org
+        goblin.irc.com:6668:password
+        [2001:db8:618:5c0:263::]:6669
       }
    note that if you omit the port, it will assume the value of the
-   %bdefault-port%b setting.
+   %bdefault-port%b setting. Prefix the port with a plus sign to
+   attempt a SSL connection.
 
 see also: default-port
 %{help=set msg-rate}%{+n}
Index: eggdrop1.8/src/mod/server.mod/server.c
diff -u eggdrop1.8/src/mod/server.mod/server.c:1.5 eggdrop1.8/src/mod/server.mod/server.c:1.6
--- eggdrop1.8/src/mod/server.mod/server.c:1.5	Sun Oct 24 07:22:40 2010
+++ eggdrop1.8/src/mod/server.mod/server.c	Mon Nov  1 16:38:34 2010
@@ -2,7 +2,7 @@
  * server.c -- part of server.mod
  *   basic irc server support
  *
- * $Id: server.c,v 1.5 2010/10/24 13:22:40 pseudo Exp $
+ * $Id: server.c,v 1.6 2010/11/01 22:38:34 pseudo Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -957,64 +957,37 @@
 static void add_server(const char *ss)
 {
   struct server_list *x, *z;
-  char *p, *q;
-
+  char name[256] = "", port[11] = "", pass[121] = "";
+  
   for (z = serverlist; z && z->next; z = z->next);
-  while (ss) {
-/*    p = strchr(ss, ',');
-    if (p)
-      *p++ = 0; */
-    x = nmalloc(sizeof(struct server_list));
 
-    x->next = 0;
-    x->realname = 0;
-    x->port = 0;
-    if (z)
-      z->next = x;
-    else
-      serverlist = x;
-    z = x;
-#ifdef IPV6
-    p = 0;
-    if ((q = strchr(ss, ','))) {
-      if (!q[1]) {
-        *q = 0;
-        q = 0;
-      }
-    } else
-#endif
-    q = strchr(ss, ':');
-    if (!q) {
-      x->port = default_port;
-      x->pass = 0;
-      x->name = nmalloc(strlen(ss) + 1);
-      strcpy(x->name, ss);
-#ifdef TLS
-      x->ssl = 0;
-#endif
-    } else {
-      *q++ = 0;
-      x->name = nmalloc(q - ss);
-      strcpy(x->name, ss);
-      ss = q;
-      q = strchr(ss, ':');
-      if (!q) {
-        x->pass = 0;
-      } else {
-        *q++ = 0;
-        x->pass = nmalloc(strlen(q) + 1);
-        strcpy(x->pass, q);
-      }
+  /* Allow IPv6 and IPv4-mapped addresses in [] */
+  if (!sscanf(ss, "[%255[0-9.A-F:a-f]]:%10[+0-9]:%120s", name, port, pass) &&
+      !sscanf(ss, "%255[^:]:%10[+0-9]:%120s", name, port, pass))
+    return;
+
+  x = nmalloc(sizeof(struct server_list));
+  x->next = 0;
+  x->realname = 0;
+  x->port = default_port;
+  if (z)
+    z->next = x;
+  else
+    serverlist = x;
+  z = x;
+
+  x->name = nmalloc(strlen(name) + 1);
+  strcpy(x->name, name);
+  if (pass[0]) {
+    x->pass = nmalloc(strlen(pass) + 1);
+    strcpy(x->pass, pass);
+  } else
+    x->pass = NULL;
+  if (port[0])
+    x->port = atoi(port);
 #ifdef TLS
-      if (*ss == '+')
-        x->ssl = 1;
-      else
-        x->ssl = 0;
+  x->ssl = (port[0] == '+') ? 1 : 0;
 #endif
-      x->port = atoi(ss);
-    }
-    ss = p;
-  }
 }
 
 
@@ -1452,12 +1425,14 @@
     Tcl_DStringInit(&ds);
     for (q = serverlist; q; q = q->next) {
 #ifdef TLS
-      egg_snprintf(x, sizeof x, "%s:%s%d%s%s %s", q->name,
+      egg_snprintf(x, sizeof x, "%s%s%s:%s%d%s%s %s", strchr(q->name, ':') ?
+                   "[" : "", q->name, strchr(q->name, ':') ? "]" : "",
                    q->ssl ? "+" : "", q->port ? q->port : default_port,
                    q->pass ? ":" : "", q->pass ? q->pass : "",
                    q->realname ? q->realname : "");
 #else
-      egg_snprintf(x, sizeof x, "%s:%d%s%s %s", q->name,
+      egg_snprintf(x, sizeof x, "%s%s%s:%d%s%s %s", strchr(q->name, ':') ?
+                   "[" : "", q->name, strchr(q->name, ':') ? "]" : "",
                    q->port ? q->port : default_port, q->pass ? ":" : "",
                    q->pass ? q->pass : "", q->realname ? q->realname : "");
 #endif
Index: eggdrop1.8/src/patch.h
diff -u eggdrop1.8/src/patch.h:1.22 eggdrop1.8/src/patch.h:1.23
--- eggdrop1.8/src/patch.h:1.22	Sun Oct 31 08:40:38 2010
+++ eggdrop1.8/src/patch.h	Mon Nov  1 16:38:34 2010
@@ -10,7 +10,7 @@
  * statement, leave the rest of the file alone, this allows better
  * overlapping patches.
  *
- * $Id: patch.h,v 1.22 2010/10/31 14:40:38 pseudo Exp $
+ * $Id: patch.h,v 1.23 2010/11/01 22:38:34 pseudo Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -41,12 +41,12 @@
  *
  *
  */
-patch("1288535360");            /* current unixtime */
+patch("1288651016");            /* current unixtime */
 /*
  *
  *
  */
-patch("fakepass");
+patch("v6syntax");
 /*
  *
  *
Index: eggdrop1.8/src/userent.c
diff -u eggdrop1.8/src/userent.c:1.3 eggdrop1.8/src/userent.c:1.4
--- eggdrop1.8/src/userent.c:1.3	Tue Oct 19 06:13:33 2010
+++ eggdrop1.8/src/userent.c	Mon Nov  1 16:38:34 2010
@@ -2,7 +2,7 @@
  * userent.c -- handles:
  *   user-entry handling, new style more versatile.
  *
- * $Id: userent.c,v 1.3 2010/10/19 12:13:33 pseudo Exp $
+ * $Id: userent.c,v 1.4 2010/11/01 22:38:34 pseudo Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -479,14 +479,14 @@
     q++;
 #ifdef TLS
     if (*q == '+')
-      bi->ssl = 1;
+      bi->ssl |= TLS_BOT;
 #endif
     bi->telnet_port = atoi(q);
     if ((q = strchr(q, '/')))
 #ifdef TLS
     {
       if (q[1] == '+')
-        bi->ssl = 1;
+        bi->ssl |= TLS_RELAY;
       bi->relay_port = atoi(q + 1);
     }
 #else
@@ -520,11 +520,12 @@
     else
       *q++ = *p;
 #ifdef TLS
-  if (bi->ssl)
-    l = simple_sprintf(q, ":+%u/+%u", bi->telnet_port, bi->relay_port);
-  else
-#endif
+  l = simple_sprintf(q, ":%s%u/%s%u", (bi->ssl & TLS_BOT) ? "+" : "",
+                     bi->telnet_port, (bi->ssl & TLS_RELAY) ? "+" : "",
+                     bi->relay_port);
+#else
   l = simple_sprintf(q, ":%u/%u", bi->telnet_port, bi->relay_port);
+#endif
   e->u.list = user_malloc(sizeof(struct list_type));
   e->u.list->next = NULL;
   e->u.list->extra = user_malloc(l + 1);
@@ -558,14 +559,13 @@
       *q++ = *p;
     *q = 0;
 #ifdef TLS
-  if (bi->ssl) {
-    if (fprintf(f, "--%s %s:+%u/+%u\n", e->type->name, addr,
-                bi->telnet_port, bi->relay_port) == EOF)
-      ret = 0;
-  } else
-#endif
+  if (fprintf(f, "--%s %s:%s%u/%s%u\n", e->type->name, addr,
+      (bi->ssl & TLS_BOT) ? "+" : "", bi->telnet_port, (bi->ssl & TLS_RELAY) ?
+      "+" : "", bi->relay_port) == EOF)
+#else
   if (fprintf(f, "--%s %s:%u/%u\n", e->type->name, addr,
       bi->telnet_port, bi->relay_port) == EOF)
+#endif
     ret = 0;
   nfree(addr);
   return ret;
@@ -586,13 +586,13 @@
   }
   if (bi && !noshare && !(u->flags & USER_UNSHARED)) {
 #ifdef TLS
-    if (bi->ssl)
-      shareout(NULL, "c BOTADDR %s %s +%d +%d\n", u->handle,
-               bi->address, bi->telnet_port, bi->relay_port);
-    else
-#endif
+    shareout(NULL, "c BOTADDR %s %s %s%d %s%d\n", u->handle, bi->address,
+             (bi->ssl & TLS_BOT) ? "+" : "", bi->telnet_port,
+             (bi->ssl & TLS_RELAY) ? "+" : "", bi->relay_port);
+#else
     shareout(NULL, "c BOTADDR %s %s %d %d\n", u->handle,
              bi->address, bi->telnet_port, bi->relay_port);
+#endif
   }
   return 1;
 }
@@ -604,14 +604,14 @@
   char number[20];
 
 #ifdef TLS
-  if (bi->ssl)
+  if (bi->ssl & TLS_BOT)
     sprintf(number, " +%d", bi->telnet_port);
   else
 #endif
   sprintf(number, " %d", bi->telnet_port);
   Tcl_AppendResult(interp, bi->address, number, NULL);
 #ifdef TLS
-  if (bi->ssl)
+  if (bi->ssl & TLS_RELAY)
     sprintf(number, " +%d", bi->relay_port);
   else
 #endif
@@ -640,7 +640,7 @@
 #ifdef TLS
     {
       if (*argv[4] == '+')
-        bi->ssl = 1;
+        bi->ssl |= TLS_BOT;
       bi->telnet_port = atoi(argv[4]);
     }
 #else
@@ -650,7 +650,7 @@
 #ifdef TLS
     {
       if (*argv[5] == '+')
-        bi->ssl = 1;
+        bi->ssl |= TLS_RELAY;
       bi->relay_port = atoi(argv[5]);
     }
 #else
@@ -678,12 +678,11 @@
 
   dprintf(idx, "  ADDRESS: %.70s\n", bi->address);
 #ifdef TLS
-  if (bi->ssl)
-    dprintf(idx, "     users: +%d, bots: +%d\n", bi->relay_port,
-            bi->telnet_port);
-  else
-#endif
+  dprintf(idx, "     users: %s%d, bots: %s%d\n", (bi->ssl & TLS_RELAY) ? "+" : "",
+          bi->relay_port, (bi->ssl & TLS_BOT) ? "+" : "", bi->telnet_port);
+#else
   dprintf(idx, "     users: %d, bots: %d\n", bi->relay_port, bi->telnet_port);
+#endif
 }
 
 static int botaddr_gotshare(struct userrec *u, struct user_entry *e,
@@ -698,8 +697,10 @@
   strcpy(bi->address, arg);
   arg = newsplit(&buf);
 #ifdef TLS
-  if (*arg == '+' || *buf == '+')
-    bi->ssl = 1;
+  if (*arg == '+')
+    bi->ssl |= TLS_BOT;
+  if (*buf == '+')
+    bi->ssl |= TLS_RELAY;
 #endif
   bi->telnet_port = atoi(arg);
   bi->relay_port = atoi(buf);
Index: eggdrop1.8/src/users.h
diff -u eggdrop1.8/src/users.h:1.2 eggdrop1.8/src/users.h:1.3
--- eggdrop1.8/src/users.h:1.2	Tue Oct 19 06:13:33 2010
+++ eggdrop1.8/src/users.h	Mon Nov  1 16:38:34 2010
@@ -2,7 +2,7 @@
  * users.h
  *   structures and definitions used by users.c and userrec.c
  *
- * $Id: users.h,v 1.2 2010/10/19 12:13:33 pseudo Exp $
+ * $Id: users.h,v 1.3 2010/11/01 22:38:34 pseudo Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -85,6 +85,8 @@
   int relay_port;
   char *address;
 #ifdef TLS
+#  define TLS_BOT 1
+#  define TLS_RELAY 2
   int ssl;
 #endif
 };
----------------------- End of diff -----------------------


More information about the Changes mailing list