Applied colored-nicks diff
authorMatthew Mondor <mmondor@pulsar-zone.net>
Thu, 13 Jan 2005 06:21:18 +0000 (06:21 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Thu, 13 Jan 2005 06:21:18 +0000 (06:21 +0000)
include/config.h
include/struct.h
src/m_nick.c

index 821e77c..1b1bc5c 100644 (file)
@@ -18,7 +18,7 @@
  *
  */
 
-/* $Id: config.h,v 1.2 2005/01/13 06:20:44 mmondor Exp $ */
+/* $Id: config.h,v 1.3 2005/01/13 06:21:17 mmondor Exp $ */
 
 #ifndef        __config_include__
 #define        __config_include__
  */
 #undef DCCALLOW
 
+/* COLORED_NICKS
+ * Allow ^C character in nicks to facilitate IRC colors
+ */
+#define COLORED_NICKS
+
 /******************************************************************
  * STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP
  *
index 090efff..446936f 100644 (file)
@@ -20,7 +20,7 @@
  *
  */
 
-/* $Id: struct.h,v 1.3 2005/01/13 06:20:44 mmondor Exp $ */
+/* $Id: struct.h,v 1.4 2005/01/13 06:21:18 mmondor Exp $ */
 
 #ifndef        __struct_include__
 #define __struct_include__
@@ -1276,7 +1276,11 @@ struct Channel
 
 #define        BadPtr(x) (!(x) || (*(x) == '\0'))
 
+#ifdef COLORED_NICKS
+#define        isvalid(c) (((c) >= 'A' && (c) < '~') || (c) == '\003' ||  IsDigit(c) || (c) == '-')
+#else
 #define        isvalid(c) (((c) >= 'A' && (c) < '~') || IsDigit(c) || (c) == '-')
+#endif
 
 #define        MyConnect(x)                    ((x)->fd >= 0)
 #define        MyClient(x)                     (MyConnect(x) && IsClient(x))
index 19366a2..c71816d 100644 (file)
@@ -20,7 +20,7 @@
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-/* $Id: m_nick.c,v 1.1 2005/01/12 07:44:56 mmondor Exp $ */
+/* $Id: m_nick.c,v 1.2 2005/01/13 06:21:18 mmondor Exp $ */
 
 #include "struct.h"
 #include "common.h"
@@ -105,6 +105,17 @@ int m_nick(aClient *cptr, aClient *sptr, int parc, char *parv[])
                   me.name, parv[0]);
        return 0;
     }
+
+#ifdef COLORED_NICKS
+       {
+               char *p;
+               if ( (p = strrchr(parv[1], '\003')) && ((p[1] >= '0') && (p[1] <= '9')) ) 
+               {
+                       int n = strlen(parv[1]);
+                       parv[1][ (n < NICKLEN) ? n : NICKLEN ] = '\003';
+               }
+       }
+#endif
   
     if (!IsServer(sptr) && IsServer(cptr) && parc > 2)
        newts = atol(parv[2]);