From: Matthew Mondor Date: Thu, 13 Jan 2005 06:21:18 +0000 (+0000) Subject: Applied colored-nicks diff X-Git-Tag: rubiks-ircd-1-0-6~47 X-Git-Url: http://git.pulsar-zone.net/?a=commitdiff_plain;h=a90c27b3f6668948ee34fd76e49e8ff2d215ceb0;p=rubiks-ircd.git Applied colored-nicks diff --- diff --git a/include/config.h b/include/config.h index 821e77c..1b1bc5c 100644 --- a/include/config.h +++ b/include/config.h @@ -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__ @@ -560,6 +560,11 @@ */ #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 * diff --git a/include/struct.h b/include/struct.h index 090efff..446936f 100644 --- a/include/struct.h +++ b/include/struct.h @@ -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)) diff --git a/src/m_nick.c b/src/m_nick.c index 19366a2..c71816d 100644 --- a/src/m_nick.c +++ b/src/m_nick.c @@ -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]);