[NeoStats-Devel] [Commits] r2545 - in trunk: . include src/protocol
[email protected] Tue, 19 Apr 2005 07:53:25 +1000
Newsgroups
gmane.comp.neostats.devel
Message-ID
<[email protected] >
Author: Mark
Date: Tue Apr 19 05:53:21 2005
New Revision: 2545
Added:
trunk/src/protocol/asuka.c (contents, props changed)
trunk/src/protocol/asuka.vcproj (contents, props changed)
trunk/src/protocol/nefarious.c (contents, props changed)
trunk/src/protocol/nefarious.vcproj (contents, props changed)
Modified:
trunk/include/ircd.h
trunk/neostats.sln
trunk/src/protocol/Makefile.am
trunk/src/protocol/Makefile.in
trunk/src/protocol/ircup10.c
trunk/src/protocol/protocol.txt
Log:
split ircu support into seperate protocol files for each supported form
Modified: trunk/include/ircd.h
==============================================================================
--- trunk/include/ircd.h (original)
+++ trunk/include/ircd.h Tue Apr 19 05:53:21 2005
@@ -95,7 +95,7 @@
MODULEVAR extern mode_init user_umodes[];
MODULEVAR extern mode_init user_smodes[];
MODULEVAR extern ProtocolInfo protocol_info;
-#ifndef IGNORECOREMESSAGEDEFS
+#ifndef OVERRIDECOREMESSAGESUPPORT
MODULEVAR extern const char MSG_PRIVATE[];
MODULEVAR extern const char TOK_PRIVATE[];
MODULEVAR extern const char MSG_NOTICE[];
@@ -170,19 +170,11 @@
MODULEVAR extern const char TOK_SVSMODE[];
MODULEVAR extern const char MSG_SVSKILL[];
MODULEVAR extern const char TOK_SVSKILL[];
-#endif /* IGNORECOREMESSAGEDEFS */
+#endif /* OVERRIDECOREMESSAGESUPPORT */
#endif
EXPORTVAR extern ircd_server ircd_srv;
-extern const int proto_maxhost;
-extern const int proto_maxpass;
-extern const int proto_maxnick;
-extern const int proto_maxuser;
-extern const int proto_maxrealname;
-extern const int proto_chanlen;
-extern const int proto_topiclen;
-
EXPORTFUNC int ircsplitbuf( char *buf, char ***argv, int colon_special );
EXPORTFUNC void process_ircd_cmd( int cmdptr, char *cmd, char *origin, char **av, int ac );
Modified: trunk/neostats.sln
==============================================================================
--- trunk/neostats.sln (original)
+++ trunk/neostats.sln Tue Apr 19 05:53:21 2005
@@ -95,6 +95,14 @@
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asuka", "src\protocol\asuka.vcproj", "{B6701C0A-27E3-468D-8473-FBE671989E33}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nefarious", "src\protocol\nefarious.vcproj", "{B6701C0A-27E3-468D-8473-FBE671989E33}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
@@ -185,6 +193,14 @@
{B6701C0A-27E3-468D-8473-FBE671989E33}.Debug.Build.0 = Debug|Win32
{B6701C0A-27E3-468D-8473-FBE671989E33}.Release.ActiveCfg = Release|Win32
{B6701C0A-27E3-468D-8473-FBE671989E33}.Release.Build.0 = Release|Win32
+ {B6701C0A-27E3-468D-8473-FBE671989E33}.Debug.ActiveCfg = Debug|Win32
+ {B6701C0A-27E3-468D-8473-FBE671989E33}.Debug.Build.0 = Debug|Win32
+ {B6701C0A-27E3-468D-8473-FBE671989E33}.Release.ActiveCfg = Release|Win32
+ {B6701C0A-27E3-468D-8473-FBE671989E33}.Release.Build.0 = Release|Win32
+ {B6701C0A-27E3-468D-8473-FBE671989E33}.Debug.ActiveCfg = Debug|Win32
+ {B6701C0A-27E3-468D-8473-FBE671989E33}.Debug.Build.0 = Debug|Win32
+ {B6701C0A-27E3-468D-8473-FBE671989E33}.Release.ActiveCfg = Release|Win32
+ {B6701C0A-27E3-468D-8473-FBE671989E33}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
Modified: trunk/src/protocol/Makefile.am
==============================================================================
--- trunk/src/protocol/Makefile.am (original)
+++ trunk/src/protocol/Makefile.am Tue Apr 19 05:53:21 2005
@@ -1,11 +1,14 @@
pkglib_LTLIBRARIES = bahamut14.la bahamut18.la client.la hybrid7.la \
- ircup10.la plexus.la \
+ ircup10.la asuka.la nefarious.la \
+ plexus.la \
ultimate2.la ultimate3.la unreal31.la unreal32.la
bahamut14_la_SOURCES = bahamut14.c
bahamut18_la_SOURCES = bahamut18.c
client_la_SOURCES = client.c
hybrid7_la_SOURCES = hybrid7.c
ircup10_la_SOURCES = ircup10.c
+asuka_la_SOURCES = asuka.c
+nefarious_la_SOURCES = nefarious.c
plexus_la_SOURCES = plexus.c
ultimate2_la_SOURCES = ultimate2.c
ultimate3_la_SOURCES = ultimate3.c
Modified: trunk/src/protocol/Makefile.in
==============================================================================
--- trunk/src/protocol/Makefile.in (original)
+++ trunk/src/protocol/Makefile.in Tue Apr 19 05:53:21 2005
@@ -14,7 +14,7 @@
@SET_MAKE@
-SOURCES = $(bahamut14_la_SOURCES) $(bahamut18_la_SOURCES) $(client_la_SOURCES) $(hybrid7_la_SOURCES) $(ircup10_la_SOURCES) $(plexus_la_SOURCES) $(ultimate2_la_SOURCES) $(ultimate3_la_SOURCES) $(unreal31_la_SOURCES) $(unreal32_la_SOURCES)
+SOURCES = $(asuka_la_SOURCES) $(bahamut14_la_SOURCES) $(bahamut18_la_SOURCES) $(client_la_SOURCES) $(hybrid7_la_SOURCES) $(ircup10_la_SOURCES) $(nefarious_la_SOURCES) $(plexus_la_SOURCES) $(ultimate2_la_SOURCES) $(ultimate3_la_SOURCES) $(unreal31_la_SOURCES) $(unreal32_la_SOURCES)
srcdir = @srcdir@
top_srcdir = @top_srcdir@
@@ -61,6 +61,9 @@
am__installdirs = "$(DESTDIR)$(pkglibdir)"
pkglibLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(pkglib_LTLIBRARIES)
+asuka_la_LIBADD =
+am_asuka_la_OBJECTS = asuka.lo
+asuka_la_OBJECTS = $(am_asuka_la_OBJECTS)
bahamut14_la_LIBADD =
am_bahamut14_la_OBJECTS = bahamut14.lo
bahamut14_la_OBJECTS = $(am_bahamut14_la_OBJECTS)
@@ -76,6 +79,9 @@
ircup10_la_LIBADD =
am_ircup10_la_OBJECTS = ircup10.lo
ircup10_la_OBJECTS = $(am_ircup10_la_OBJECTS)
+nefarious_la_LIBADD =
+am_nefarious_la_OBJECTS = nefarious.lo
+nefarious_la_OBJECTS = $(am_nefarious_la_OBJECTS)
plexus_la_LIBADD =
am_plexus_la_OBJECTS = plexus.lo
plexus_la_OBJECTS = $(am_plexus_la_OBJECTS)
@@ -100,14 +106,16 @@
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-SOURCES = $(bahamut14_la_SOURCES) $(bahamut18_la_SOURCES) \
- $(client_la_SOURCES) $(hybrid7_la_SOURCES) \
- $(ircup10_la_SOURCES) $(plexus_la_SOURCES) \
+SOURCES = $(asuka_la_SOURCES) $(bahamut14_la_SOURCES) \
+ $(bahamut18_la_SOURCES) $(client_la_SOURCES) \
+ $(hybrid7_la_SOURCES) $(ircup10_la_SOURCES) \
+ $(nefarious_la_SOURCES) $(plexus_la_SOURCES) \
$(ultimate2_la_SOURCES) $(ultimate3_la_SOURCES) \
$(unreal31_la_SOURCES) $(unreal32_la_SOURCES)
-DIST_SOURCES = $(bahamut14_la_SOURCES) $(bahamut18_la_SOURCES) \
- $(client_la_SOURCES) $(hybrid7_la_SOURCES) \
- $(ircup10_la_SOURCES) $(plexus_la_SOURCES) \
+DIST_SOURCES = $(asuka_la_SOURCES) $(bahamut14_la_SOURCES) \
+ $(bahamut18_la_SOURCES) $(client_la_SOURCES) \
+ $(hybrid7_la_SOURCES) $(ircup10_la_SOURCES) \
+ $(nefarious_la_SOURCES) $(plexus_la_SOURCES) \
$(ultimate2_la_SOURCES) $(ultimate3_la_SOURCES) \
$(unreal31_la_SOURCES) $(unreal32_la_SOURCES)
ETAGS = etags
@@ -236,7 +244,8 @@
target_alias = @target_alias@
wi_PWD = @wi_PWD@
pkglib_LTLIBRARIES = bahamut14.la bahamut18.la client.la hybrid7.la \
- ircup10.la plexus.la \
+ ircup10.la asuka.la nefarious.la \
+ plexus.la \
ultimate2.la ultimate3.la unreal31.la unreal32.la
bahamut14_la_SOURCES = bahamut14.c
@@ -244,6 +253,8 @@
client_la_SOURCES = client.c
hybrid7_la_SOURCES = hybrid7.c
ircup10_la_SOURCES = ircup10.c
+asuka_la_SOURCES = asuka.c
+nefarious_la_SOURCES = nefarious.c
plexus_la_SOURCES = plexus.c
ultimate2_la_SOURCES = ultimate2.c
ultimate3_la_SOURCES = ultimate3.c
@@ -304,6 +315,8 @@
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
+asuka.la: $(asuka_la_OBJECTS) $(asuka_la_DEPENDENCIES)
+ $(LINK) -rpath $(pkglibdir) $(asuka_la_LDFLAGS) $(asuka_la_OBJECTS) $(asuka_la_LIBADD) $(LIBS)
bahamut14.la: $(bahamut14_la_OBJECTS) $(bahamut14_la_DEPENDENCIES)
$(LINK) -rpath $(pkglibdir) $(bahamut14_la_LDFLAGS) $(bahamut14_la_OBJECTS) $(bahamut14_la_LIBADD) $(LIBS)
bahamut18.la: $(bahamut18_la_OBJECTS) $(bahamut18_la_DEPENDENCIES)
@@ -314,6 +327,8 @@
$(LINK) -rpath $(pkglibdir) $(hybrid7_la_LDFLAGS) $(hybrid7_la_OBJECTS) $(hybrid7_la_LIBADD) $(LIBS)
ircup10.la: $(ircup10_la_OBJECTS) $(ircup10_la_DEPENDENCIES)
$(LINK) -rpath $(pkglibdir) $(ircup10_la_LDFLAGS) $(ircup10_la_OBJECTS) $(ircup10_la_LIBADD) $(LIBS)
+nefarious.la: $(nefarious_la_OBJECTS) $(nefarious_la_DEPENDENCIES)
+ $(LINK) -rpath $(pkglibdir) $(nefarious_la_LDFLAGS) $(nefarious_la_OBJECTS) $(nefarious_la_LIBADD) $(LIBS)
plexus.la: $(plexus_la_OBJECTS) $(plexus_la_DEPENDENCIES)
$(LINK) -rpath $(pkglibdir) $(plexus_la_LDFLAGS) $(plexus_la_OBJECTS) $(plexus_la_LIBADD) $(LIBS)
ultimate2.la: $(ultimate2_la_OBJECTS) $(ultimate2_la_DEPENDENCIES)
@@ -331,11 +346,13 @@
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asuka.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bahamut14.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bahamut18.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/client.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hybrid7.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ircup10.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nefarious.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plexus.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ultimate2.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ultimate3.Plo@am__quote@
Added: trunk/src/protocol/asuka.c
==============================================================================
--- (empty file)
+++ trunk/src/protocol/asuka.c Tue Apr 19 05:53:21 2005
@@ -0,0 +1,1368 @@
+/* NeoStats - IRC Statistical Services
+** Copyright (c) 1999-2005 Adam Rutter, Justin Hammond, Mark Hetherington
+** http://www.neostats.net/
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+** USA
+**
+** NeoStats CVS Identification
+** $Id$
+*/
+
+#include "neostats.h"
+#define OVERRIDECOREMESSAGESUPPORT
+#include "ircd.h"
+#include "base64.h"
+#include "numerics.h"
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+/* IRCu modification support
+ * Currently we only support modifications for Nefarious and Asuka
+ * To enable support uncomment the appropriate line below.
+ */
+/* Nefarious IRCu - http://evilnet.sourceforge.net */
+/* #define NEFARIOUS */
+/* ...... */
+/* Nefarious IRCu with F:HOST_HIDING_STYLE:2 */
+/* #define NEFARIOUS_CLOAKHOST */
+/* ...... */
+/* QuakeNet Asuka - http://dev.quakenet.org */
+/* #define ASUKA */
+
+/* Messages/Tokens */
+
+const char MSG_PRIVATE[] = "PRIVMSG";
+const char TOK_PRIVATE[] = "P";
+const char MSG_WHO[] = "WHO";
+const char TOK_WHO[] = "H";
+const char MSG_WHOIS[] = "WHOIS";
+const char TOK_WHOIS[] = "W";
+const char MSG_WHOWAS[] = "WHOWAS";
+const char TOK_WHOWAS[] = "X";
+const char MSG_USER[] = "USER";
+const char TOK_USER[] = "USER";
+const char MSG_NICK[] = "NICK";
+const char TOK_NICK[] = "N";
+const char MSG_SVSNICK[] = "SVSNICK";
+const char TOK_SVSNICK[] = "SN";
+const char MSG_SERVER[] = "SERVER";
+const char TOK_SERVER[] = "S";
+const char MSG_LIST[] = "LIST";
+const char TOK_LIST[] = "LIST";
+const char MSG_TOPIC[] = "TOPIC";
+const char TOK_TOPIC[] = "T";
+const char MSG_INVITE[] = "INVITE";
+const char TOK_INVITE[] = "I";
+const char MSG_VERSION[] = "VERSION";
+const char TOK_VERSION[] = "V";
+const char MSG_QUIT[] = "QUIT";
+const char TOK_QUIT[] = "Q";
+const char MSG_SQUIT[] = "SQUIT";
+const char TOK_SQUIT[] = "SQ";
+const char MSG_KILL[] = "KILL";
+const char TOK_KILL[] = "D";
+const char MSG_INFO[] = "INFO";
+const char TOK_INFO[] = "F";
+const char MSG_LINKS[] = "LINKS";
+const char TOK_LINKS[] = "LI";
+const char MSG_STATS[] = "STATS";
+const char TOK_STATS[] = "R";
+const char MSG_HELP[] = "HELP";
+const char TOK_HELP[] = "HELP";
+const char MSG_ERROR[] = "ERROR";
+const char TOK_ERROR[] = "Y";
+const char MSG_AWAY[] = "AWAY";
+const char TOK_AWAY[] = "A";
+const char MSG_CONNECT[] = "CONNECT";
+const char TOK_CONNECT[] = "CO";
+const char MSG_MAP[] = "MAP";
+const char TOK_MAP[] = "MAP";
+const char MSG_PING[] = "PING";
+const char TOK_PING[] = "G";
+const char MSG_PONG[] = "PONG";
+const char TOK_PONG[] = "Z";
+const char MSG_OPER[] = "OPER";
+const char TOK_OPER[] = "OPER";
+const char MSG_PASS[] = "PASS";
+const char TOK_PASS[] = "PA";
+const char MSG_WALLOPS[] = "WALLOPS";
+const char TOK_WALLOPS[] = "WA";
+const char MSG_WALLUSERS[] = "WALLUSERS";
+const char TOK_WALLUSERS[] = "WU";
+const char MSG_DESYNCH[] = "DESYNCH";
+const char TOK_DESYNCH[] = "DS";
+const char MSG_TIME[] = "TIME";
+const char TOK_TIME[] = "TI";
+const char MSG_SETTIME[] = "SETTIME";
+const char TOK_SETTIME[] = "SE";
+const char MSG_RPING[] = "RPING";
+const char TOK_RPING[] = "RI";
+const char MSG_RPONG[] = "RPONG";
+const char TOK_RPONG[] = "RO";
+const char MSG_NAMES[] = "NAMES";
+const char TOK_NAMES[] = "E";
+const char MSG_ADMIN[] = "ADMIN";
+const char TOK_ADMIN[] = "AD";
+const char MSG_TRACE[] = "TRACE";
+const char TOK_TRACE[] = "TR";
+const char MSG_NOTICE[] = "NOTICE";
+const char TOK_NOTICE[] = "O";
+const char MSG_WALLCHOPS[] = "WALLCHOPS";
+const char TOK_WALLCHOPS[] = "WC";
+const char MSG_WALLVOICES[] = "WALLVOICES";
+const char TOK_WALLVOICES[] = "WV";
+const char MSG_WALLHOPS[] = "WALLHOPS";
+const char TOK_WALLHOPS[] = "WH";
+const char MSG_CPRIVMSG[] = "CPRIVMSG";
+const char TOK_CPRIVMSG[] = "CP";
+const char MSG_CNOTICE[] = "CNOTICE";
+const char TOK_CNOTICE[] = "CN";
+const char MSG_JOIN[] = "JOIN";
+const char TOK_JOIN[] = "J";
+const char MSG_SVSJOIN[] = "SVSJOIN";
+const char TOK_SVSJOIN[] = "SJ";
+const char MSG_PART[] = "PART";
+const char TOK_PART[] = "L";
+const char MSG_SVSPART[] = "SVSPART";
+const char TOK_SVSPART[] = "SP";
+const char MSG_LUSERS[] = "LUSERS";
+const char TOK_LUSERS[] = "LU";
+const char MSG_MOTD[] = "MOTD";
+const char TOK_MOTD[] = "MO";
+const char MSG_MODE[] = "MODE";
+const char TOK_MODE[] = "M";
+const char MSG_KICK[] = "KICK";
+const char TOK_KICK[] = "K";
+const char MSG_USERHOST[] = "USERHOST";
+const char TOK_USERHOST[] = "USERHOST";
+const char MSG_USERIP[] = "USERIP";
+const char TOK_USERIP[] = "USERIP";
+const char MSG_ISON[] = "ISON";
+const char TOK_ISON[] = "ISON";
+const char MSG_SQUERY[] = "SQUERY";
+const char TOK_SQUERY[] = "SQUERY";
+const char MSG_SERVLIST[] = "SERVLIST";
+const char TOK_SERVLIST[] = "SERVSET";
+const char MSG_SERVSET[] = "SERVSET";
+const char TOK_SERVSET[] = "SERVSET";
+const char MSG_CHECK[] = "CHECK";
+const char TOK_CHECK[] = "CC";
+const char MSG_REHASH[] = "REHASH";
+const char TOK_REHASH[] = "REHASH";
+const char MSG_RESTART[] = "RESTART";
+const char TOK_RESTART[] = "RESTART";
+const char MSG_CLOSE[] = "CLOSE";
+const char TOK_CLOSE[] = "CLOSE";
+const char MSG_DIE[] = "DIE";
+const char TOK_DIE[] = "DIE";
+const char MSG_HASH[] = "HASH";
+const char TOK_HASH[] = "HASH";
+const char MSG_DNS[] = "DNS";
+const char TOK_DNS[] = "DNS";
+const char MSG_SILENCE[] = "SILENCE";
+const char TOK_SILENCE[] = "U";
+const char MSG_EXEMPT[] = "EXEMPT";
+const char TOK_EXEMPT[] = "EX";
+const char MSG_GLINE[] = "GLINE";
+const char TOK_GLINE[] = "GL";
+const char MSG_BURST[] = "BURST";
+const char TOK_BURST[] = "B";
+const char MSG_UPING[] = "UPING";
+const char TOK_UPING[] = "UP";
+const char MSG_CREATE[] = "CREATE";
+const char TOK_CREATE[] = "C";
+const char MSG_DESTRUCT[] = "DESTRUCT";
+const char TOK_DESTRUCT[] = "DE";
+const char MSG_END_OF_BURST[] = "END_OF_BURST";
+const char TOK_END_OF_BURST[] = "EB";
+const char MSG_END_OF_BURST_ACK[] = "EOB_ACK";
+const char TOK_END_OF_BURST_ACK[] = "EA";
+const char MSG_PROTO[] = "PROTO";
+const char TOK_PROTO[] = "PROTO";
+const char MSG_JUPE[] = "JUPE";
+const char TOK_JUPE[] = "JU";
+const char MSG_OPMODE[] = "OPMODE";
+const char TOK_OPMODE[] = "OM";
+const char MSG_CLEARMODE[] = "CLEARMODE";
+const char TOK_CLEARMODE[] = "CM";
+const char MSG_ACCOUNT[] = "ACCOUNT";
+const char TOK_ACCOUNT[] = "AC";
+const char MSG_ASLL[] = "ASLL";
+const char TOK_ASLL[] = "LL";
+const char MSG_MKPASSWD[] = "MKPASSWD";
+const char TOK_MKPASSWD[] = "MKPASSWD";
+const char MSG_POST[] = "POST";
+const char TOK_POST[] = "POST";
+const char MSG_SET[] = "SET";
+const char TOK_SET[] = "SET";
+const char MSG_RESET[] = "RESET";
+const char TOK_RESET[] = "RESET";
+const char MSG_GET[] = "GET";
+const char TOK_GET[] = "GET";
+const char MSG_PRIVS[] = "PRIVS";
+const char TOK_PRIVS[] = "PRIVS";
+const char MSG_SETHOST[] = "SETHOST";
+const char TOK_SETHOST[] = "SH";
+const char MSG_FAKEHOST[] = "FAKE";
+const char TOK_FAKEHOST[] = "FA";
+const char MSG_OPERMOTD[] = "OPERMOTD";
+const char TOK_OPERMOTD[] = "OPM";
+const char MSG_RULES[] = "RULES";
+const char TOK_RULES[] = "RL";
+const char MSG_SVSNOOP[] = "SVSNOOP";
+const char TOK_SVSNOOP[] = "SO";
+const char MSG_SWHOIS[] = "SWHOIS";
+const char TOK_SWHOIS[] = "SW";
+const char MSG_MARK[] = "MARK";
+const char TOK_MARK[] = "MK";
+
+ /* User modes: */
+#define UMODE_SERVNOTICE 0x00800000 /* See server notices */
+#define UMODE_DEBUG 0x01000000 /* See hack notices */
+#ifdef NEFARIOUS
+#define UMODE_FAKEHOST 0x02000000 /* */
+#define UMODE_WHOIS 0x04000000 /* */
+#endif
+#if ( defined NEFARIOUS ) || (defined ASUKA )
+#define UMODE_SETHOST 0x08000000 /* */
+#define UMODE_NOCHAN 0x10000000 /* */
+#define UMODE_NOIDLE 0x20000000 /* */
+#define UMODE_XTRAOP 0x40000000 /* */
+#endif
+
+/* Cmodes */
+#if ( defined NEFARIOUS ) || (defined ASUKA )
+#define CMODE_NOCTCP 0x02000000
+#define CMODE_NONOTICE 0x04000000
+#define CMODE_NOQUITPARTS 0x08000000
+#endif
+#ifdef ASUKA
+#define CMODE_DELJOINS 0x10000000
+#endif
+#ifdef NEFARIOUS
+#define CMODE_PERSIST 0x20000000
+#define CMODE_NOLISTMODES 0x40000000
+#define CMODE_MODREG 0x80000000
+#define CMODE_NOAMSG 0x100000000
+#define CMODE_ONLYSECURE 0x200000000
+#endif
+
+static void m_private( char *origin, char **argv, int argc, int srv );
+static void m_notice( char *origin, char **argv, int argc, int srv );
+static void m_version( char *origin, char **argv, int argc, int srv );
+static void m_motd( char *origin, char **argv, int argc, int srv );
+static void m_admin( char *origin, char **argv, int argc, int srv );
+static void m_server( char *origin, char **argv, int argc, int srv );
+static void m_squit( char *origin, char **argv, int argc, int srv );
+static void m_quit( char *origin, char **argv, int argc, int srv );
+static void m_mode( char *origin, char **argv, int argc, int srv );
+static void m_kill( char *origin, char **argv, int argc, int srv );
+static void m_pong( char *origin, char **argv, int argc, int srv );
+static void m_away( char *origin, char **argv, int argc, int srv );
+static void m_nick( char *origin, char **argv, int argc, int srv );
+static void m_topic( char *origin, char **argv, int argc, int srv );
+static void m_kick( char *origin, char **argv, int argc, int srv );
+static void m_join( char *origin, char **argv, int argc, int srv );
+static void m_create( char *origin, char **argv, int argc, int srv );
+static void m_part( char *origin, char **argv, int argc, int srv );
+static void m_stats( char *origin, char **argv, int argc, int srv );
+static void m_ping( char *origin, char **argv, int argc, int srv );
+static void m_burst( char *origin, char **argv, int argc, int srv );
+static void m_end_of_burst( char *origin, char **argv, int argc, int srv );
+static void m_end_of_burst_ack( char *origin, char **argv, int argc, int srv );
+static void m_wallusers( char *origin, char **argv, int argc, int srv );
+static void m_wallops( char *origin, char **argv, int argc, int srv );
+static void m_svsnick( char *origin, char **argv, int argc, int srv );
+static void m_svsjoin( char *origin, char **argv, int argc, int srv );
+static void m_svspart( char *origin, char **argv, int argc, int srv );
+static void m_whois( char *origin, char **argv, int argc, int srv );
+static void m_swhois( char *origin, char **argv, int argc, int srv );
+static void m_vhost( char *origin, char **argv, int argc, int srv );
+static void m_numeric242( char *origin, char **argv, int argc, int srv );
+static void m_numeric351( char *origin, char **argv, int argc, int srv );
+
+ProtocolInfo protocol_info =
+{
+ /* Protocol options required by this IRCd */
+ PROTOCOL_TOKEN|PROTOCOL_NOQUIT|PROTOCOL_B64SERVER|PROTOCOL_B64NICK|PROTOCOL_NICKIP|PROTOCOL_KICKPART,
+ /* Protocol options negotiated at link by this IRCd */
+ 0,
+ /* Features supported by this IRCd */
+#ifdef NEFARIOUS
+ FEATURE_SVSJOIN|FEATURE_SVSPART|FEATURE_SVSNICK|FEATURE_SVSHOST|FEATURE_SWHOIS|
+# ifdef NEFARIOUS_CLOAKHOST
+ FEATURE_UMODECLOAK|
+# endif /* NEFARIOUS_CLOAKHOST */
+#endif /* NEFARIOUS */
+ FEATURE_SVSTIME,
+ /* Max host length */
+ 63 ,
+ /* Max password length */
+ 32,
+ /* Max nick length */
+ 32,
+ /* Max user length */
+ 10,
+ /* Max real name length */
+ 50,
+ /* Max channel name length */
+ 200,
+ /* Max topic length */
+ 250,
+ /* Default operator modes for NeoStats service bots */
+ "+o",
+ /* Default channel mode for NeoStats service bots */
+};
+
+/* this is the command list and associated functions to run */
+ircd_cmd cmd_list[] =
+{
+ /* Command Token Function usage */
+ {MSG_PRIVATE, TOK_PRIVATE, m_private, 0},
+ {MSG_CPRIVMSG, TOK_CPRIVMSG, m_private, 0},
+ {MSG_NOTICE, TOK_NOTICE, m_notice, 0},
+ {MSG_CNOTICE, TOK_CNOTICE, m_notice, 0},
+ {MSG_STATS, TOK_STATS, m_stats, 0},
+ {MSG_VERSION, TOK_VERSION, m_version, 0},
+ {MSG_MOTD, TOK_MOTD, m_motd, 0},
+ {MSG_ADMIN, TOK_ADMIN, m_admin, 0},
+ {MSG_SERVER, TOK_SERVER, m_server, 0},
+ {MSG_SQUIT, TOK_SQUIT, m_squit, 0},
+ {MSG_QUIT, TOK_QUIT, m_quit, 0},
+ {MSG_MODE, TOK_MODE, m_mode, 0},
+ {MSG_KILL, TOK_KILL, m_kill, 0},
+ {MSG_PONG, TOK_PONG, m_pong, 0},
+ {MSG_AWAY, TOK_AWAY, m_away, 0},
+ {MSG_NICK, TOK_NICK, m_nick, 0},
+ {MSG_TOPIC, TOK_TOPIC, m_topic, 0},
+ {MSG_KICK, TOK_KICK, m_kick, 0},
+ {MSG_CREATE, TOK_CREATE, m_create, 0},
+ {MSG_JOIN, TOK_JOIN, m_join, 0},
+ {MSG_PART, TOK_PART, m_part, 0},
+ {MSG_PING, TOK_PING, m_ping, 0},
+ {MSG_PASS, TOK_PASS, _m_pass, 0},
+ {MSG_BURST, TOK_BURST, m_burst, 0},
+ {MSG_END_OF_BURST, TOK_END_OF_BURST, m_end_of_burst, 0},
+ {MSG_END_OF_BURST_ACK, TOK_END_OF_BURST_ACK, m_end_of_burst_ack, 0},
+ {MSG_WALLOPS, TOK_WALLOPS, m_wallops, 0},
+ {MSG_WALLUSERS, TOK_WALLUSERS, m_wallusers, 0},
+ {MSG_SVSNICK, TOK_SVSNICK, m_svsnick, 0},
+ {MSG_SVSJOIN, TOK_SVSJOIN, m_svsjoin, 0},
+ {MSG_SVSPART, TOK_SVSPART, m_svspart, 0},
+ {MSG_WHOIS, TOK_WHOIS, m_whois, 0},
+ {MSG_SWHOIS, TOK_SWHOIS, m_swhois, 0},
+ {MSG_FAKEHOST, TOK_FAKEHOST, m_vhost, 0},
+ {MSG_ERROR, TOK_ERROR, _m_error, 0},
+ {"242", "242", m_numeric242, 0},
+ {"351", "351", m_numeric351, 0},
+ {0, 0, 0, 0},
+};
+
+mode_init chan_umodes[] =
+{
+ {0, 0, 0},
+};
+
+mode_init chan_modes[] =
+{
+#if( defined NEFARIOUS ) ||( defined ASUKA )
+ {'c', CMODE_NOCOLOR, 0},
+ {'C', CMODE_NOCTCP, 0},
+ {'N', CMODE_NONOTICE, 0},
+#endif
+#ifdef ASUKA
+ {'D', CMODE_DELJOINS, 0},
+ {'u', CMODE_NOQUITPARTS, 0},
+#endif
+#ifdef NEFARIOUS
+ {'a', CMODE_ADMONLY, 0},
+ {'e', CMODE_EXCEPT, MODEPARAM},
+ {'z', CMODE_PERSIST, 0},
+ {'L', CMODE_NOLISTMODES, 0},
+ {'M', CMODE_MODREG, 0},
+ {'O', CMODE_OPERONLY, 0},
+ {'Q', CMODE_NOQUITPARTS, 0},
+ {'S', CMODE_STRIP, 0},
+ {'T', CMODE_NOAMSG, 0},
+ {'Z', CMODE_ONLYSECURE, 0},
+#endif
+ {'r', CMODE_RGSTRONLY, 0},
+ {0, 0, 0},
+};
+
+mode_init user_umodes[] =
+{
+ {'O', UMODE_LOCOP},
+ {'g', UMODE_DEBUG},
+ {'w', UMODE_WALLOP},
+ {'s', UMODE_SERVNOTICE},
+ {'d', UMODE_DEAF},
+ {'k', UMODE_SERVICES},
+ {'r', UMODE_REGNICK},
+ {'x', UMODE_HIDE},
+#ifdef NEFARIOUS
+ {'a', UMODE_ADMIN},
+ {'f', UMODE_FAKEHOST},
+ {'B', UMODE_BOT},
+ {'W', UMODE_WHOIS},
+#endif
+#if( defined NEFARIOUS ) ||( defined ASUKA )
+ {'h', UMODE_SETHOST},
+ {'n', UMODE_NOCHAN},
+ {'I', UMODE_NOIDLE},
+ {'R', UMODE_RGSTRONLY},
+ {'X', UMODE_XTRAOP},
+#endif
+ {0, 0},
+};
+
+/* Temporary buffers for numeric conversion */
+char neostatsbase64[3] = "\0";
+/* Flags for numeric usage; limits to 64 clients */
+char neonicknumerics[64];
+
+/*
+ * Numeric nicks are new as of version ircu2.10.00beta1.
+ *
+ * The idea is as follows:
+ * In most messages( for protocol 10+ ) the original nick will be
+ * replaced by a 3 character string: YXX
+ * Where 'Y' represents the server, and 'XX' the nick on that server.
+ *
+ * 'YXX' should not interfer with the input parser, and therefore is
+ * not allowed to contain spaces or a ':'.
+ * Also, 'Y' can't start with a '+' because of m_server( ).
+ *
+ * We keep the characters printable for debugging reasons too.
+ *
+ * The 'XX' value can be larger then the maximum number of clients
+ * per server, we use a mask( struct Server::nn_mask ) to get the real
+ * client numeric. The overhead is used to have some redundancy so
+ * just-disconnected-client aren't confused with just-connected ones.
+ */
+
+/* These must be the same on ALL servers ! Do not change ! */
+
+#define NUMNICKLOG 6
+#define NUMNICKBASE 64 /*( 2 << NUMNICKLOG ) */
+#define NUMNICKMASK 63 /*( NUMNICKBASE-1 ) */
+
+/*
+ * convert2y[] converts a numeric to the corresponding character.
+ * The following characters are currently known to be forbidden:
+ *
+ * '\0' : Because we use '\0' as end of line.
+ *
+ * ' ' : Because parse_*( ) uses this as parameter seperator.
+ * ':' : Because parse_server( ) uses this to detect if a prefix is a
+ * numeric or a name.
+ * '+' : Because m_nick( ) uses this to determine if parv[6] is a
+ * umode or not.
+ * '&', '#', '+', '$', '@' and '%' :
+ * Because m_message( ) matches these characters to detect special cases.
+ */
+static const char convert2y[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789[]";
+
+static const unsigned int convert2n[] =
+{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 52,53,54,55,56,57,58,59,60,61, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,
+ 15,16,17,18,19,20,21,22,23,24,25,62, 0,63, 0, 0,
+ 0,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,
+ 41,42,43,44,45,46,47,48,49,50,51, 0, 0, 0, 0, 0,
+
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+unsigned int base64toint( const char* s )
+{
+ int max = 0;
+ unsigned int i = convert2n[( unsigned char ) *s++];
+ max++;
+ while( *s ) {
+ i <<= NUMNICKLOG;
+ i += convert2n[( unsigned char ) *s++];
+ max++;
+ if( max>=5 )
+ break;
+ }
+ return i;
+}
+
+unsigned int base64toIP( const char* s )
+{
+ unsigned int i = convert2n[( unsigned char ) *s++];
+ while( *s ) {
+ i <<= NUMNICKLOG;
+ i += convert2n[( unsigned char ) *s++];
+ }
+ return i;
+}
+
+const char* inttobase64( char* buf, unsigned int v, unsigned int count )
+{
+ buf[count] = '\0';
+ while( count > 0 ) {
+ buf[--count] = convert2y[( v & NUMNICKMASK )];
+ v >>= NUMNICKLOG;
+ }
+ return buf;
+}
+
+/* server
+inttobase64( cli_yxx( c ), numeric, 2 ) */
+
+/* nick
+inttobase64( cli_yxx( cptr ), last_nn, 3 ) */
+/*
+DEBUG2 CORE - SENT: PASS password
+DEBUG2 CORE - SENT: SERVER stats.mark.net 1 1076012166 1076012166 P10 CD] :[stats.mark.net] NeoStats 2.5 IRC Statistical Server!
+DEBUG3 CORE - Sendings pings...
+DEBUG1 CORE - R: PASS :password
+DEBUG1 CORE - R: SERVER mark.local.org 1 1076002125 1076012166 J10 ABAP] + :me
+DEBUG1 CORE - New Server: mark.local.org
+DEBUG1 CORE - R: AB N Mark 1 1076011621 a 192.168.238.13 DAqO4N ABAAB :M
+DEBUG1 CORE - R: AB EB
+DEBUG1 CORE - R: AB G !1076012256.68240 stats.mark.net 1076012256.68240
+DEBUG3 CORE - Sendings pings...
+DEBUG2 CORE - SENT: :stats.mark.net PING stats.mark.net :mark.local.org
+DEBUG1 CORE - R: AB Z AB :stats.mark.net
+DEBUG1 CORE - R: AB SQ mark.local.org 0 :Ping timeout
+DEBUG3 CORE - Sendings pings...
+DEBUG2 CORE - SENT: :stats.mark.net PING stats.mark.net :mark.local.org
+*/
+
+void send_server( const char *source, const char *name, const int numeric, const char *infoline )
+{
+ send_cmd( "%s %s * +%s 604800 %lu :%s", neostatsbase64, TOK_JUPE, name, me.now, infoline );
+}
+
+/*
+1 <name of new server>
+2 <hops>
+3 <boot TS>
+4 <link TS>
+5 <protocol>
+6 <numeric of new server><max client numeric>
+7 <flags>
+-1 <description of new server>
+*/
+void send_server_connect( const char *name, const int numeric, const char *infoline, const char *pass, const unsigned long tsboot, const unsigned long tslink )
+{
+ /* Reset our numeric buffer */
+ os_memset( neonicknumerics, 0 , sizeof( neonicknumerics ) );
+ inttobase64( neostatsbase64, numeric, 2 );
+ send_cmd( "%s :%s", MSG_PASS, pass );
+ send_cmd( "%s %s 1 %lu %lu J10 %s]]] +s :%s", MSG_SERVER, name, tsboot, tslink, neostatsbase64, infoline );
+ set_server_base64( name, neostatsbase64 );
+}
+
+void send_squit( const char *server, const char *quitmsg )
+{
+ send_cmd( "%s %s %s 0 :%s", neostatsbase64, TOK_SQUIT, server, quitmsg );
+}
+
+void send_quit( const char *source, const char *quitmsg )
+{
+ char* num;
+
+ /* Clear numeric */
+ num = nick_to_base64( source );
+ send_cmd( "%s %s :%s", num, TOK_QUIT, quitmsg );
+ neonicknumerics[convert2n[( int )num[4]]] = 0;
+}
+
+void send_part( const char *source, const char *chan, const char *reason )
+{
+ send_cmd( "%s %s %s :%s", nick_to_base64( source ), TOK_PART, chan, reason );
+}
+
+void send_join( const char *source, const char *chan, const char *key, const unsigned long ts )
+{
+ send_cmd( "%s %s %s %lu", nick_to_base64( source ), TOK_JOIN, chan, ts );
+}
+
+/* R: ABAAH M #c3 +tn */
+void send_cmode( const char *source, const char *who, const char *chan, const char *mode, const char *args, const unsigned long ts )
+{
+ send_cmd( "%s %s %s %s %s %lu", neostatsbase64, TOK_MODE, chan, mode, args, ts );
+}
+
+void send_nick( const char *nick, const unsigned long ts, const char* newmode, const char *ident, const char *host, const char* server, const char *realname )
+{
+ int i;
+ char nicknumbuf[6];
+
+ for( i = 0; i < 64; i++ )
+ {
+ /* Reserve numeric */
+ if( neonicknumerics[i]==0 )
+ {
+ neonicknumerics[i] = 1;
+ break;
+ }
+ }
+ ircsnprintf( nicknumbuf, 6, "%sAA%c", neostatsbase64,( i+'A' ) );
+ send_cmd( "%s %s %s 1 %lu %s %s %s AAAAAA %s :%s", neostatsbase64, TOK_NICK, nick, ts, ident, host, newmode, nicknumbuf, realname );
+ set_nick_base64( nick, nicknumbuf );
+}
+
+void send_ping( const char *source, const char *reply, const char *target )
+{
+ send_cmd( "%s %s %s :%s", neostatsbase64, TOK_PING, reply, target );
+}
+
+void send_umode( const char *source, const char *target, const char *mode )
+{
+ send_cmd( "%s %s %s :%s", nick_to_base64( source ), TOK_MODE, target, mode );
+}
+
+void send_numeric( const char *source, const int numeric, const char *target, const char *buf )
+{
+ send_cmd( "%s %d %s :%s", neostatsbase64, numeric, nick_to_base64( target ), buf );
+}
+
+void send_pong( const char *reply )
+{
+ send_cmd( "%s %s %s :%s", neostatsbase64, TOK_PONG, neostatsbase64, reply );
+}
+
+void send_kill( const char *source, const char *target, const char *reason )
+{
+ send_cmd( "%s %s %s :%s", neostatsbase64, TOK_KILL, nick_to_base64( target ), reason );
+}
+
+void send_nickchange( const char *oldnick, const char *newnick, const unsigned long ts )
+{
+ send_cmd( "%s %s %s %lu", nick_to_base64( oldnick ), TOK_NICK, newnick, ts );
+}
+
+void send_invite( const char *source, const char *target, const char *chan )
+{
+ send_cmd( "%s %s %s %s", nick_to_base64( source ), TOK_INVITE, target, chan );
+}
+
+void send_kick( const char *source, const char *chan, const char *target, const char *reason )
+{
+ send_cmd( "%s %s %s %s :%s", nick_to_base64( source ), TOK_KICK, chan, nick_to_base64( target ),( reason ? reason : "No Reason Given" ) );
+}
+
+void send_swhois( const char *source, const char *target, const char *swhois )
+{
+ send_cmd( "%s %s %s :%s", neostatsbase64, TOK_SWHOIS, nick_to_base64( target ), swhois );
+}
+
+void send_svsnick( const char *source, const char *target, const char *newnick, const unsigned long ts )
+{
+ send_cmd( "%s %s %s %s :%lu", neostatsbase64, TOK_SVSNICK, nick_to_base64( target ), newnick, ts );
+}
+
+void send_svsjoin( const char *source, const char *target, const char *chan )
+{
+ send_cmd( "%s %s %s %s", neostatsbase64, TOK_SVSJOIN, nick_to_base64( target ), chan );
+}
+
+void send_svspart( const char *source, const char *target, const char *chan )
+{
+ send_cmd( "%s %s %s %s", neostatsbase64, TOK_SVSPART, nick_to_base64( target ), chan );
+}
+
+void send_svshost( const char *source, const char *who, const char *vhost )
+{
+ send_cmd( "%s %s %s %s", neostatsbase64, TOK_FAKEHOST, nick_to_base64( who ), vhost );
+}
+
+void send_wallops( const char *source, const char *buf )
+{
+ char* b64source;
+ if( !( b64source = server_to_base64( source ) ) ) {
+ b64source = nick_to_base64( source );
+ }
+ send_cmd( "%s %s :%s", b64source, TOK_WALLUSERS, buf );
+}
+
+void send_end_of_burst( void )
+{
+ send_cmd( "%s %s", neostatsbase64, TOK_END_OF_BURST );
+}
+
+void send_end_of_burst_ack( void )
+{
+ if( !is_synched ) {
+ do_synch_neostats( );
+ send_end_of_burst( );
+ }
+ send_cmd( "%s %s", neostatsbase64, TOK_END_OF_BURST_ACK );
+}
+
+void send_akill( const char *source, const char *host, const char *ident, const char *setby, const unsigned long length, const char *reason, const unsigned long ts )
+{
+ send_cmd( "%s %s * +%s@%s %lu :%s", neostatsbase64, TOK_GLINE, ident, host, length, reason );
+}
+
+void send_rakill( const char *source, const char *host, const char *ident )
+{
+ send_cmd( "%s %s * -%s@%s", neostatsbase64, TOK_GLINE, ident, host );
+}
+
+void send_privmsg( const char *source, const char *target, const char *buf )
+{
+ if( target[0] == '#' ) {
+ send_cmd( "%s %s %s :%s", nick_to_base64( source ), TOK_PRIVATE, target, buf );
+ } else {
+ send_cmd( "%s %s %s :%s", nick_to_base64( source ), TOK_PRIVATE, nick_to_base64( target ), buf );
+ }
+}
+
+void send_notice( const char *source, const char *target, const char *buf )
+{
+ if( target[0] == '#' ) {
+ send_cmd( "%s %s %s :%s", nick_to_base64( source ), TOK_NOTICE, target, buf );
+ } else {
+ send_cmd( "%s %s %s :%s", nick_to_base64( source ), TOK_NOTICE, nick_to_base64( target ), buf );
+ }
+}
+
+void send_globops( const char *source, const char *buf )
+{
+ char* b64source;
+ if( !( b64source = server_to_base64( source ) ) ) {
+ b64source = nick_to_base64( source );
+ }
+ send_cmd( "%s %s :%s", b64source, TOK_WALLOPS, buf );
+}
+
+void send_svstime( const char *source, const unsigned long ts )
+{
+ send_cmd( "%s %s %lu", server_to_base64( source ), TOK_SETTIME, ts );
+}
+
+void send_serverrequptime( const char *source, const char *target )
+{
+ send_cmd( "%s %s u :%s", nick_to_base64( source ), TOK_STATS, server_to_base64( target ) );
+}
+
+void send_serverreqversion( const char *source, const char *target )
+{
+ send_cmd( "%s %s %s", server_to_base64( source ), TOK_VERSION, server_to_base64( target ) );
+}
+
+static void m_stats( char *origin, char **argv, int argc, int srv )
+{
+ char* b64origin;
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
+ }
+ do_stats( b64origin, argv[0] );
+}
+
+/* ABAAB V :Bj */
+static void m_version( char *origin, char **argv, int argc, int srv )
+{
+ char* b64origin;
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
+ }
+ do_version( b64origin, base64_to_server( argv[0] ) );
+}
+
+static void m_motd( char *origin, char **argv, int argc, int srv )
+{
+ do_motd( base64_to_nick( origin ), base64_to_server( argv[0] ) );
+}
+
+static void m_admin( char *origin, char **argv, int argc, int srv )
+{
+ do_admin( base64_to_nick( origin ), base64_to_server( argv[0] ) );
+}
+
+/* m_server
+ *
+ * argv[0] = servername
+ * argv[1] = hopcount
+ * argv[2] = start timestamp
+ * argv[3] = link timestamp
+ * argv[4] = major protocol version: P10/P11
+ * argv[5] = YMM, YMMM or YYMMM; where 'YY' is the server numeric and
+ * "MMM" is the numeric nick mask of this server.
+ * argv[6] = 0( not used yet, mandatory unsigned int after u2.10.06 )
+ * argv[argc-1] = serverinfo
+ * NumServ( sptr ) SERVER name hop 0 TSL PROT YxxCap 0 :info
+ */
+/*
+SERVER srvname hop TSBoot TSLink Prot numcap modes :desc
+AB S srvname hop TSBoot TSLink Prot numcap modes :desc
+*/
+static void m_server( char *origin, char **argv, int argc, int srv )
+{
+ if( srv == 2 ) {
+ do_server( argv[0], NULL, argv[1], NULL, argv[argc-1], 0 );
+ } else {
+ do_server( argv[0], base64_to_server( origin ), argv[1], NULL, argv[argc-1], srv );
+ }
+ argv[5][2] = '\0';
+ set_server_base64( argv[0], argv[5] );
+}
+
+/* R: AB SQ mark.local.org 0 :Ping timeout */
+/* R: ABAAV SQ york.gose.org 1076280461 :relink */
+static void m_squit( char *origin, char **argv, int argc, int srv )
+{
+ char* b64arg0;
+ if( ( b64arg0 = base64_to_server( argv[0] ) ) ) {
+ do_squit( b64arg0, argv[2] );
+ } else {
+ do_squit( argv[0], argv[2] );
+ }
+}
+
+static void m_quit( char *origin, char **argv, int argc, int srv )
+{
+ do_quit( base64_to_nick( origin ), argv[0] );
+}
+
+/* R: ABAAE M Mark :+i */
+/* R: ABAAH M #c3 +tn */
+/* R: ABAAG M #chan1 +v ABAAH */
+static void m_mode( char *origin, char **argv, int argc, int srv )
+{
+ char* b64origin;
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
+ }
+ if( argv[0][0] == '#' ) {
+ char **av;
+ int ac = 0;
+ int j = 2;
+ int add = 0;
+ char *modes;
+
+ AddStringToList( &av, argv[0], &ac );
+ modes = argv[1];
+ AddStringToList( &av, argv[1], &ac );
+
+ while( *modes ) {
+ unsigned int mask;
+ unsigned int flags;
+
+ mask = CmodeCharToMask( *modes );
+ flags = CmodeCharToFlags( *modes );
+
+ switch( *modes ) {
+ case '+':
+ add = 1;
+ break;
+ case '-':
+ add = 0;
+ break;
+ default:
+ if( flags&NICKPARAM ) {
+ AddStringToList( &av, base64_to_nick( argv[j] ), &ac );
+ j++;
+ } else if( add ) {
+ if( mask == CMODE_LIMIT ) {
+ AddStringToList( &av, argv[j], &ac );
+ j++;
+ } else if( mask == CMODE_KEY ) {
+ AddStringToList( &av, argv[j], &ac );
+ j++;
+ } else if( flags ) {
+ AddStringToList( &av, argv[j], &ac );
+ j++;
+ }
+ } else {
+ if( mask == CMODE_KEY ) {
+ AddStringToList( &av, argv[j], &ac );
+ j++;
+ }
+ }
+ }
+ modes++;
+ }
+
+ do_mode_channel( b64origin, av, ac );
+ ns_free( av );
+ } else {
+ do_mode_user( argv[0], argv[1] );
+ }
+}
+static void m_kill( char *origin, char **argv, int argc, int srv )
+{
+ char* b64origin;
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
+ }
+ do_kill( b64origin, base64_to_nick( argv[0] ), argv[1] );
+}
+
+static void m_away( char *origin, char **argv, int argc, int srv )
+{
+ char *buf;
+
+ if( argc > 0 ) {
+ buf = joinbuf( argv, argc, 0 );
+ do_away( base64_to_nick( origin ), buf );
+ ns_free( buf );
+ } else {
+ do_away( base64_to_nick( origin ), NULL );
+ }
+}
+
+/*
+1 <nickname>
+2 <hops>
+3 <TS>
+4 <userid>
+5 <host>
+6 [<+modes>]
+7+ [<mode parameters>]
+-3 <base64 IP>
+-2 <numeric>
+-1 <fullname>
+*/
+/* R: AB N Mark 1 1076011621 a xxx.xxx.xxx.xxx DAqO4N ABAAB :M */
+/* R: AB N TheEggMan 1 1076104492 ~eggy 64.XX.XXX.XXX +oiwg BAFtnj ABAAA :eggy */
+/* R: ABAAH N m2 1076077934 */
+/*
+<reed> in a generated burst message, the users must be sorted by the modes: first users w/o modes, then users with voice, then with op, then with op+voice: num,num:v,num:o,num:ov
+*/
+
+static void m_nick( char *origin, char **argv, int argc, int srv )
+{
+ if( argc > 2 ) {
+ char IPAddress[32];
+ unsigned long IP;
+ const char *modes;
+ const char *modeptr;
+ const char *account = NULL;
+ const char *sethost = NULL;
+ const char *fakehost = NULL;
+ int param;
+
+ modes =( argv[5][0] == '+' ) ? argv[5]: NULL;
+ if( modes ) {
+ param = 6;
+ for( modeptr = modes; *modeptr; ++modeptr ) {
+ switch( *modeptr ) {
+ case 'r':
+ account = argv[param++];
+ break;
+ case 'h':
+ sethost = argv[param++];
+ break;
+ case 'f':
+ fakehost = argv[param++];
+ break;
+ default:
+ break;
+ } /* switch( *modeptr ) */
+ } /* for( ) */
+ } /* if( modes ) */
+
+ IP = htonl( base64toIP( argv[argc-3] ) );
+ ircsnprintf( IPAddress, 32, "%lu", IP );
+
+ /* nick, hopcount, TS, user, host, */
+ do_nick( argv[0], argv[1], argv[2], argv[3], argv[4],
+ /* server, ip, servicestamp, modes, */
+ base64_to_server( origin ), IPAddress, NULL, modes,
+ /* vhost, realname, numeric, smodes */
+ fakehost, argv[argc-1], argv[argc-2], NULL );
+ } else {
+ do_nickchange( base64_to_nick( origin ), argv[0], argv[1] );
+ }
+}
+
+static void m_topic( char *origin, char **argv, int argc, int srv )
+{
+ char* b64origin;
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
+ }
+ do_topic( argv[0], b64origin, NULL, argv[argc-1] );
+}
+
+static void m_kick( char *origin, char **argv, int argc, int srv )
+{
+ char* b64origin;
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
+ }
+ do_kick( b64origin, argv[0], base64_to_nick( argv[1] ), argv[2] );
+}
+
+/* R: ABAAE C #chan 1076069009 */
+static void m_create( char *origin, char **argv, int argc, int srv )
+{
+ do_join( base64_to_nick( origin ), argv[0], argv[1] );
+}
+
+static void m_join( char *origin, char **argv, int argc, int srv )
+{
+ do_join( base64_to_nick( origin ), argv[0], argv[1] );
+}
+
+static void m_part( char *origin, char **argv, int argc, int srv )
+{
+ do_part( base64_to_nick( origin ), argv[0], argv[1] );
+}
+
+static void m_ping( char *origin, char **argv, int argc, int srv )
+{
+ do_ping( base64_to_server( origin ), argv[1] );
+}
+
+/* R: AB G !1076065765.431368 stats.mark.net 1076065765.431368 */
+static void m_pong( char *origin, char **argv, int argc, int srv )
+{
+ do_pong( base64_to_server( origin ), argv[1] );
+}
+
+/*
+1 <channel>
+2 <timestamp>
+3+ [<modes> [<mode extra parameters>]] [<users>] [<bans>]
+*/
+/* R: AB B #chan 1076064445 ABAAA:o */
+/* R: AB B #c3 1076083205 +tn ABAAH:o */
+/*
+ * parv[0] = channel name
+ * parv[1] = channel timestamp
+ * The meaning of the following parv[]'s depend on their first character:
+ * If parv[n] starts with a '+':
+ * Net burst, additive modes
+ * parv[n] = <mode>
+ * parv[n+1] = <param>( optional )
+ * parv[n+2] = <param>( optional )
+ * If parv[n] starts with a '%', then n will be parc-1:
+ * parv[n] = %<ban> <ban> <ban> ...
+ * If parv[n] starts with another character:
+ * parv[n] = <nick>[:<mode>],<nick>[:<mode>],...
+ * where <mode> is the channel mode( ov ) of nick and all following nicks.
+ *
+ * Example:
+ * "S BURST #channel 87654321 +ntkl key 123 AAA,AAB:o,BAA,BAB:ov :%ban1 ban2"
+*/
+
+static char ircd_buf[BUFSIZE];
+
+static void m_burst( char *origin, char **argv, int argc, int srv )
+{
+ int param;
+
+ /* IRCu passes this information in a stupid order so we must first
+ * find and process clients and ignore modes to "create" the channel
+ * then process modes and ignore clients - look into better system for NS2.6
+ */
+ param = 2;
+ while( param < argc ) {
+ switch( argv[param][0] ) {
+ case '+': /* mode string */
+ {
+ char *modes;
+
+ modes = argv[param];
+ param++;
+ modes++;
+ while( *modes ) {
+ if( CmodeCharToFlags( *modes ) & MODEPARAM ) {
+ param ++;
+ }
+ modes++;
+ }
+ break;
+ }
+ case '%': /* bans */
+ /* ignored for now */
+ param++;
+ break;
+ case '~': /* ban exceptions */
+ /* ignored for now */
+ param++;
+ break;
+ default: /* clients */
+ {
+ char *s, *t;
+ char modechar = 0;
+
+ t =( char* )argv[param];
+ while( *( s = t ) ) {
+ t = s + strcspn( s, "," );
+ if( *t )
+ *t++ = 0;
+ do_join( base64_to_nick( s ), argv[0], NULL );
+ if( s[5] == ':' ) {
+ modechar = s[6];
+ }
+ if( modechar ) {
+ char **av;
+ int ac;
+ ircsnprintf( ircd_buf, BUFSIZE, "%s +%c %s", argv[0], modechar, base64_to_nick( s ) );
+ ac = split_buf( ircd_buf, &av, 0 );
+ do_mode_channel( me.name, av, ac );
+ ns_free( av );
+ }
+ }
+ param++;
+ break;
+ }
+ }
+ }
+
+ param = 2;
+ while( param < argc ) {
+ switch( argv[param][0] ) {
+ case '+': /* mode string */
+ {
+ char *modes;
+
+ modes = argv[param];
+ param++;
+ modes++;
+ while( *modes ) {
+ char **av;
+ int ac;
+
+ if( CmodeCharToFlags( *modes ) & MODEPARAM ) {
+ ircsnprintf( ircd_buf, BUFSIZE, "%s +%c %s", argv[0], *modes, argv[param] );
+ param ++;
+ } else {
+ ircsnprintf( ircd_buf, BUFSIZE, "%s +%c", argv[0], *modes );
+ }
+ ac = split_buf( ircd_buf, &av, 0 );
+ do_mode_channel( me.name, av, ac );
+ ns_free( av );
+ modes++;
+ }
+ break;
+ }
+ case '%': /* bans */
+ /* ignored for now */
+ param++;
+ break;
+ case '~': /* ban exceptions */
+ /* ignored for now */
+ param++;
+ break;
+ default: /* clients */
+ {
+ param++;
+ break;
+ }
+ }
+ }
+}
+
+static void m_end_of_burst( char *origin, char **argv, int argc, int srv )
+{
+ if( ircstrcasecmp( base64_to_server( origin ), me.uplink ) == 0 ) {
+ send_end_of_burst_ack( );
+ }
+}
+
+static void m_end_of_burst_ack( char *origin, char **argv, int argc, int srv )
+{
+ return;
+}
+
+static void m_wallusers( char *origin, char **argv, int argc, int srv )
+{
+ char* b64origin;
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
+ }
+ do_wallops( b64origin, argv[0] );
+}
+
+static void m_wallops( char *origin, char **argv, int argc, int srv )
+{
+ char* b64origin;
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
+ }
+ do_globops( b64origin, argv[0] );
+}
+
+/* m_svsnick
+ * argv[0] = old nickname
+ * argv[1] = new nickname
+ * argv[2] = timestamp
+ */
+static void m_svsnick( char *origin, char **argv, int argc, int srv )
+{
+ do_nickchange( base64_to_nick( argv[0] ), argv[1], argv[2] );
+}
+
+static void m_svsjoin( char *origin, char **argv, int argc, int srv )
+{
+ do_join( base64_to_nick( argv[0] ), argv[1], argv[2] );
+}
+
+static void m_svspart( char *origin, char **argv, int argc, int srv )
+{
+ do_part( base64_to_nick( argv[0] ), argv[1], argv[2] );
+}
+
+/* m_whois
+ * argv[0] = nickname masklist
+ */
+static void m_whois( char *origin, char **argv, int argc, int srv )
+{
+ /* TODO */
+}
+
+/* m_swhois
+ * argv[0] = nickname
+ * argv[1] = new swhois
+ */
+static void m_swhois( char *origin, char **argv, int argc, int srv )
+{
+ do_swhois( base64_to_nick( argv[0] ), argv[1] );
+}
+
+static void m_vhost( char *origin, char **argv, int argc, int srv )
+{
+ do_vhost( base64_to_nick( argv[0] ), argv[1] );
+}
+
+static void m_numeric242( char *origin, char **argv, int argc, int srv )
+{
+ _m_numeric242( base64_to_server( origin ), argv, argc, srv );
+}
+
+static void m_numeric351( char *origin, char **argv, int argc, int srv )
+{
+ _m_numeric351( base64_to_server( origin ), argv, argc, srv );
+}
+
+/* :<source> <command> <param1> <paramN> :<last parameter> */
+/* <source> <command> <param1> <paramN> :<last parameter> */
+int parse( void *notused, void *rline, size_t len )
+{
+ char origin[64], cmd[64], *coreLine;
+ char *line =( char * )rline;
+ int cmdptr = 0;
+ int ac = 0;
+ char **av = NULL;
+
+ SET_SEGV_LOCATION( );
+ if( !( *line ) )
+ return NS_FAILURE;
+ dlog( DEBUG1, "------------------------BEGIN PARSE-------------------------" );
+ dlog( DEBUGRX, "%s", line );
+ coreLine = strpbrk( line, " " );
+ if( coreLine ) {
+ *coreLine = 0;
+ while( isspace( *++coreLine ) );
+ } else
+ coreLine = line + strlen( line );
+ if( ( !ircstrcasecmp( line, "SERVER" ) ) ||( !ircstrcasecmp( line, "PASS" ) ) ) {
+ strlcpy( cmd, line, sizeof( cmd ) );
+ dlog( DEBUG1, "cmd : %s", cmd );
+ dlog( DEBUG1, "args : %s", coreLine );
+ ac = ircsplitbuf( coreLine, &av, 1 );
+ cmdptr = 2;
+ dlog( DEBUG1, "0 %d", ac );
+ /* really needs to be in AddServer since this is a NeoStats wide bug
+ if config uplink name does not match our uplinks server name we can
+ never find the uplink!
+ */
+ if( strcmp( cmd, "SERVER" ) == 0 ) {
+ strlcpy( me.uplink, av[0], MAXHOST );
+ }
+ } else {
+ strlcpy( origin, line, sizeof( origin ) );
+ cmdptr = 0;
+ line = strpbrk( coreLine, " " );
+ if( line ) {
+ *line = 0;
+ while( isspace( *++line ) );
+ } /*else
+ coreLine = line + strlen( line );*/
+ strlcpy( cmd, coreLine, sizeof( cmd ) );
+ dlog( DEBUG1, "origin: %s", origin );
+ dlog( DEBUG1, "cmd : %s", cmd );
+ dlog( DEBUG1, "args : %s", line );
+ if( line ) {
+ ac = ircsplitbuf( line, &av, 1 );
+ }
+ dlog( DEBUG1, "0 %d", ac );
+ }
+ process_ircd_cmd( cmdptr, cmd, origin, av, ac );
+ ns_free( av );
+ dlog( DEBUG1, "-------------------------END PARSE--------------------------" );
+ return NS_SUCCESS;
+}
+
+static void m_private( char *origin, char **argv, int argc, int srv )
+{
+ char **av;
+ int ac = 0;
+ int i;
+ char* av0;
+
+ if( argv[0][0] == '#' ) {
+ av0 = argv[0];
+ } else {
+ av0 = base64_to_nick( argv[0] );
+ /* In case a real nick came through*/
+ if( av0 == NULL ) {
+ av0 = argv[0];
+ }
+ }
+ AddStringToList( &av, av0, &ac );
+ for( i = 1; i < argc; i++ ) {
+ AddStringToList( &av, argv[i], &ac );
+ }
+ _m_private( base64_to_nick( origin ), av, ac, srv );
+ ns_free( av );
+}
+
+static void m_notice( char *origin, char **argv, int argc, int srv )
+{
+ char **av;
+ int ac = 0;
+ int i;
+ char* av0;
+
+ if( argv[0][0] == '#' ) {
+ av0 = argv[0];
+ } else {
+ av0 = base64_to_nick( argv[0] );
+ /* In case a real nick came through*/
+ if( av0 == NULL ) {
+ av0 = argv[0];
+ }
+ }
+ AddStringToList( &av, av0, &ac );
+ for( i = 1; i < argc; i++ ) {
+ AddStringToList( &av, argv[i], &ac );
+ }
+ _m_notice( base64_to_nick( origin ), av, ac, srv );
+ ns_free( av );
+}
Added: trunk/src/protocol/asuka.vcproj
==============================================================================
--- (empty file)
+++ trunk/src/protocol/asuka.vcproj Tue Apr 19 05:53:21 2005
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="asuka"
+ ProjectGUID="{B6701C0A-27E3-468D-8473-FBE671989E33}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\include;..\..\lib\curl;..\..\lib\pcre"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;asuka_EXPORTS"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Ws2_32.lib neostats.lib"
+ OutputFile="../../modules/asukad.dll"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="..\debug"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/asuka.pdb"
+ SubSystem="2"
+ ImportLibrary="$(OutDir)/asuka.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include;..\..\lib\curl;..\..\lib\pcre"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;asuka_EXPORTS"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Ws2_32.lib neostats.lib"
+ OutputFile="../../modules/asuka.dll"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../release"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ ImportLibrary="$(OutDir)/asuka.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath="asuka.c">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Modified: trunk/src/protocol/ircup10.c
==============================================================================
--- trunk/src/protocol/ircup10.c (original)
+++ trunk/src/protocol/ircup10.c Tue Apr 19 05:53:21 2005
@@ -22,7 +22,7 @@
*/
#include "neostats.h"
-#define IGNORECOREMESSAGEDEFS
+#define OVERRIDECOREMESSAGESUPPORT
#include "ircd.h"
#include "base64.h"
#include "numerics.h"
@@ -261,41 +261,42 @@
#define CMODE_ONLYSECURE 0x200000000
#endif
-static void m_private (char *origin, char **argv, int argc, int srv);
-static void m_notice (char *origin, char **argv, int argc, int srv);
-static void m_version (char *origin, char **argv, int argc, int srv);
-static void m_motd (char *origin, char **argv, int argc, int srv);
-static void m_admin (char *origin, char **argv, int argc, int srv);
-static void m_server (char *origin, char **argv, int argc, int srv);
-static void m_squit (char *origin, char **argv, int argc, int srv);
-static void m_quit (char *origin, char **argv, int argc, int srv);
-static void m_mode (char *origin, char **argv, int argc, int srv);
-static void m_kill (char *origin, char **argv, int argc, int srv);
-static void m_pong (char *origin, char **argv, int argc, int srv);
-static void m_away (char *origin, char **argv, int argc, int srv);
-static void m_nick (char *origin, char **argv, int argc, int srv);
-static void m_topic (char *origin, char **argv, int argc, int srv);
-static void m_kick (char *origin, char **argv, int argc, int srv);
-static void m_join (char *origin, char **argv, int argc, int srv);
-static void m_create (char *origin, char **argv, int argc, int srv);
-static void m_part (char *origin, char **argv, int argc, int srv);
-static void m_stats (char *origin, char **argv, int argc, int srv);
-static void m_ping (char *origin, char **argv, int argc, int srv);
-static void m_burst (char *origin, char **argv, int argc, int srv);
-static void m_end_of_burst (char *origin, char **argv, int argc, int srv);
-static void m_end_of_burst_ack (char *origin, char **argv, int argc, int srv);
-static void m_wallusers (char *origin, char **argv, int argc, int srv);
-static void m_wallops (char *origin, char **argv, int argc, int srv);
-static void m_svsnick (char *origin, char **argv, int argc, int srv);
-static void m_svsjoin (char *origin, char **argv, int argc, int srv);
-static void m_svspart (char *origin, char **argv, int argc, int srv);
-static void m_whois (char *origin, char **argv, int argc, int srv);
-static void m_swhois (char *origin, char **argv, int argc, int srv);
-static void m_vhost (char *origin, char **argv, int argc, int srv);
-static void m_numeric242 (char *origin, char **argv, int argc, int srv);
-static void m_numeric351 (char *origin, char **argv, int argc, int srv);
+static void m_private( char *origin, char **argv, int argc, int srv );
+static void m_notice( char *origin, char **argv, int argc, int srv );
+static void m_version( char *origin, char **argv, int argc, int srv );
+static void m_motd( char *origin, char **argv, int argc, int srv );
+static void m_admin( char *origin, char **argv, int argc, int srv );
+static void m_server( char *origin, char **argv, int argc, int srv );
+static void m_squit( char *origin, char **argv, int argc, int srv );
+static void m_quit( char *origin, char **argv, int argc, int srv );
+static void m_mode( char *origin, char **argv, int argc, int srv );
+static void m_kill( char *origin, char **argv, int argc, int srv );
+static void m_pong( char *origin, char **argv, int argc, int srv );
+static void m_away( char *origin, char **argv, int argc, int srv );
+static void m_nick( char *origin, char **argv, int argc, int srv );
+static void m_topic( char *origin, char **argv, int argc, int srv );
+static void m_kick( char *origin, char **argv, int argc, int srv );
+static void m_join( char *origin, char **argv, int argc, int srv );
+static void m_create( char *origin, char **argv, int argc, int srv );
+static void m_part( char *origin, char **argv, int argc, int srv );
+static void m_stats( char *origin, char **argv, int argc, int srv );
+static void m_ping( char *origin, char **argv, int argc, int srv );
+static void m_burst( char *origin, char **argv, int argc, int srv );
+static void m_end_of_burst( char *origin, char **argv, int argc, int srv );
+static void m_end_of_burst_ack( char *origin, char **argv, int argc, int srv );
+static void m_wallusers( char *origin, char **argv, int argc, int srv );
+static void m_wallops( char *origin, char **argv, int argc, int srv );
+static void m_svsnick( char *origin, char **argv, int argc, int srv );
+static void m_svsjoin( char *origin, char **argv, int argc, int srv );
+static void m_svspart( char *origin, char **argv, int argc, int srv );
+static void m_whois( char *origin, char **argv, int argc, int srv );
+static void m_swhois( char *origin, char **argv, int argc, int srv );
+static void m_vhost( char *origin, char **argv, int argc, int srv );
+static void m_numeric242( char *origin, char **argv, int argc, int srv );
+static void m_numeric351( char *origin, char **argv, int argc, int srv );
-ProtocolInfo protocol_info = {
+ProtocolInfo protocol_info =
+{
/* Protocol options required by this IRCd */
PROTOCOL_TOKEN|PROTOCOL_NOQUIT|PROTOCOL_B64SERVER|PROTOCOL_B64NICK|PROTOCOL_NICKIP|PROTOCOL_KICKPART,
/* Protocol options negotiated at link by this IRCd */
@@ -319,7 +320,7 @@
/* Max real name length */
50,
/* Max channel name length */
- 20,
+ 200,
/* Max topic length */
250,
/* Default operator modes for NeoStats service bots */
@@ -328,7 +329,8 @@
};
/* this is the command list and associated functions to run */
-ircd_cmd cmd_list[] = {
+ircd_cmd cmd_list[] =
+{
/* Command Token Function usage */
{MSG_PRIVATE, TOK_PRIVATE, m_private, 0},
{MSG_CPRIVMSG, TOK_CPRIVMSG, m_private, 0},
@@ -370,12 +372,14 @@
{0, 0, 0, 0},
};
-mode_init chan_umodes[] = {
+mode_init chan_umodes[] =
+{
{0, 0, 0},
};
-mode_init chan_modes[] = {
-#if ( defined NEFARIOUS ) || (defined ASUKA )
+mode_init chan_modes[] =
+{
+#if( defined NEFARIOUS ) ||( defined ASUKA )
{'c', CMODE_NOCOLOR, 0},
{'C', CMODE_NOCTCP, 0},
{'N', CMODE_NONOTICE, 0},
@@ -400,7 +404,8 @@
{0, 0, 0},
};
-mode_init user_umodes[] = {
+mode_init user_umodes[] =
+{
{'O', UMODE_LOCOP},
{'g', UMODE_DEBUG},
{'w', UMODE_WALLOP},
@@ -415,7 +420,7 @@
{'B', UMODE_BOT},
{'W', UMODE_WHOIS},
#endif
-#if ( defined NEFARIOUS ) || (defined ASUKA )
+#if( defined NEFARIOUS ) ||( defined ASUKA )
{'h', UMODE_SETHOST},
{'n', UMODE_NOCHAN},
{'I', UMODE_NOIDLE},
@@ -434,18 +439,18 @@
* Numeric nicks are new as of version ircu2.10.00beta1.
*
* The idea is as follows:
- * In most messages (for protocol 10+) the original nick will be
+ * In most messages( for protocol 10+ ) the original nick will be
* replaced by a 3 character string: YXX
* Where 'Y' represents the server, and 'XX' the nick on that server.
*
* 'YXX' should not interfer with the input parser, and therefore is
* not allowed to contain spaces or a ':'.
- * Also, 'Y' can't start with a '+' because of m_server().
+ * Also, 'Y' can't start with a '+' because of m_server( ).
*
* We keep the characters printable for debugging reasons too.
*
* The 'XX' value can be larger then the maximum number of clients
- * per server, we use a mask (struct Server::nn_mask) to get the real
+ * per server, we use a mask( struct Server::nn_mask ) to get the real
* client numeric. The overhead is used to have some redundancy so
* just-disconnected-client aren't confused with just-connected ones.
*/
@@ -453,8 +458,8 @@
/* These must be the same on ALL servers ! Do not change ! */
#define NUMNICKLOG 6
-#define NUMNICKBASE 64 /* (2 << NUMNICKLOG) */
-#define NUMNICKMASK 63 /* (NUMNICKBASE-1) */
+#define NUMNICKBASE 64 /*( 2 << NUMNICKLOG ) */
+#define NUMNICKMASK 63 /*( NUMNICKBASE-1 ) */
/*
* convert2y[] converts a numeric to the corresponding character.
@@ -462,18 +467,19 @@
*
* '\0' : Because we use '\0' as end of line.
*
- * ' ' : Because parse_*() uses this as parameter seperator.
- * ':' : Because parse_server() uses this to detect if a prefix is a
+ * ' ' : Because parse_*( ) uses this as parameter seperator.
+ * ':' : Because parse_server( ) uses this to detect if a prefix is a
* numeric or a name.
- * '+' : Because m_nick() uses this to determine if parv[6] is a
+ * '+' : Because m_nick( ) uses this to determine if parv[6] is a
* umode or not.
* '&', '#', '+', '$', '@' and '%' :
- * Because m_message() matches these characters to detect special cases.
+ * Because m_message( ) matches these characters to detect special cases.
*/
static const char convert2y[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789[]";
-static const unsigned int convert2n[] = {
+static const unsigned int convert2n[] =
+{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -493,46 +499,46 @@
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
-unsigned int base64toint(const char* s)
+unsigned int base64toint( const char* s )
{
int max = 0;
- unsigned int i = convert2n[(unsigned char) *s++];
+ unsigned int i = convert2n[( unsigned char ) *s++];
max++;
- while (*s) {
+ while( *s ) {
i <<= NUMNICKLOG;
- i += convert2n[(unsigned char) *s++];
+ i += convert2n[( unsigned char ) *s++];
max++;
- if (max>=5)
+ if( max>=5 )
break;
}
return i;
}
-unsigned int base64toIP(const char* s)
+unsigned int base64toIP( const char* s )
{
- unsigned int i = convert2n[(unsigned char) *s++];
- while (*s) {
+ unsigned int i = convert2n[( unsigned char ) *s++];
+ while( *s ) {
i <<= NUMNICKLOG;
- i += convert2n[(unsigned char) *s++];
+ i += convert2n[( unsigned char ) *s++];
}
return i;
}
-const char* inttobase64(char* buf, unsigned int v, unsigned int count)
+const char* inttobase64( char* buf, unsigned int v, unsigned int count )
{
buf[count] = '\0';
- while (count > 0) {
- buf[--count] = convert2y[(v & NUMNICKMASK)];
+ while( count > 0 ) {
+ buf[--count] = convert2y[( v & NUMNICKMASK )];
v >>= NUMNICKLOG;
}
return buf;
}
/* server
-inttobase64(cli_yxx(c), numeric, 2) */
+inttobase64( cli_yxx( c ), numeric, 2 ) */
/* nick
-inttobase64(cli_yxx(cptr), last_nn, 3) */
+inttobase64( cli_yxx( cptr ), last_nn, 3 ) */
/*
DEBUG2 CORE - SENT: PASS password
DEBUG2 CORE - SENT: SERVER stats.mark.net 1 1076012166 1076012166 P10 CD] :[stats.mark.net] NeoStats 2.5 IRC Statistical Server!
@@ -551,10 +557,9 @@
DEBUG2 CORE - SENT: :stats.mark.net PING stats.mark.net :mark.local.org
*/
-void
-send_server (const char *source, const char *name, const int numeric, const char *infoline)
+void send_server( const char *source, const char *name, const int numeric, const char *infoline )
{
- send_cmd ("%s %s * +%s 604800 %lu :%s", neostatsbase64, TOK_JUPE, name, me.now, infoline);
+ send_cmd( "%s %s * +%s 604800 %lu :%s", neostatsbase64, TOK_JUPE, name, me.now, infoline );
}
/*
@@ -567,268 +572,233 @@
7 <flags>
-1 <description of new server>
*/
-void
-send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, const unsigned long tsboot, const unsigned long tslink)
+void send_server_connect( const char *name, const int numeric, const char *infoline, const char *pass, const unsigned long tsboot, const unsigned long tslink )
{
/* Reset our numeric buffer */
os_memset( neonicknumerics, 0 , sizeof( neonicknumerics ) );
- inttobase64(neostatsbase64, numeric, 2);
- send_cmd ("%s :%s", MSG_PASS, pass);
- send_cmd ("%s %s 1 %lu %lu J10 %s]]] +s :%s", MSG_SERVER, name, tsboot, tslink, neostatsbase64, infoline);
- set_server_base64 (name, neostatsbase64);
+ inttobase64( neostatsbase64, numeric, 2 );
+ send_cmd( "%s :%s", MSG_PASS, pass );
+ send_cmd( "%s %s 1 %lu %lu J10 %s]]] +s :%s", MSG_SERVER, name, tsboot, tslink, neostatsbase64, infoline );
+ set_server_base64( name, neostatsbase64 );
}
-void
-send_squit (const char *server, const char *quitmsg)
+void send_squit( const char *server, const char *quitmsg )
{
- send_cmd ("%s %s %s 0 :%s", neostatsbase64, TOK_SQUIT, server, quitmsg);
+ send_cmd( "%s %s %s 0 :%s", neostatsbase64, TOK_SQUIT, server, quitmsg );
}
-void
-send_quit (const char *source, const char *quitmsg)
+void send_quit( const char *source, const char *quitmsg )
{
char* num;
/* Clear numeric */
- num = nick_to_base64 (source);
- send_cmd ("%s %s :%s", num, TOK_QUIT, quitmsg);
- neonicknumerics[convert2n[(int)num[4]]] = 0;
+ num = nick_to_base64( source );
+ send_cmd( "%s %s :%s", num, TOK_QUIT, quitmsg );
+ neonicknumerics[convert2n[( int )num[4]]] = 0;
}
-void
-send_part (const char *source, const char *chan, const char *reason)
+void send_part( const char *source, const char *chan, const char *reason )
{
- send_cmd ("%s %s %s :%s", nick_to_base64 (source), TOK_PART, chan, reason);
+ send_cmd( "%s %s %s :%s", nick_to_base64( source ), TOK_PART, chan, reason );
}
-void
-send_join (const char *source, const char *chan, const char *key, const unsigned long ts)
+void send_join( const char *source, const char *chan, const char *key, const unsigned long ts )
{
- send_cmd ("%s %s %s %lu", nick_to_base64 (source), TOK_JOIN, chan, ts);
+ send_cmd( "%s %s %s %lu", nick_to_base64( source ), TOK_JOIN, chan, ts );
}
/* R: ABAAH M #c3 +tn */
-void
-send_cmode (const char *source, const char *who, const char *chan, const char *mode, const char *args, const unsigned long ts)
+void send_cmode( const char *source, const char *who, const char *chan, const char *mode, const char *args, const unsigned long ts )
{
- send_cmd ("%s %s %s %s %s %lu", neostatsbase64, TOK_MODE, chan, mode, args, ts);
+ send_cmd( "%s %s %s %s %s %lu", neostatsbase64, TOK_MODE, chan, mode, args, ts );
}
-void
-send_nick (const char *nick, const unsigned long ts, const char* newmode, const char *ident, const char *host, const char* server, const char *realname)
+void send_nick( const char *nick, const unsigned long ts, const char* newmode, const char *ident, const char *host, const char* server, const char *realname )
{
int i;
char nicknumbuf[6];
- for(i = 0; i < 64; i++)
+ for( i = 0; i < 64; i++ )
{
/* Reserve numeric */
- if (neonicknumerics[i]==0)
+ if( neonicknumerics[i]==0 )
{
neonicknumerics[i] = 1;
break;
}
}
- ircsnprintf(nicknumbuf, 6, "%sAA%c", neostatsbase64, (i+'A'));
- send_cmd ("%s %s %s 1 %lu %s %s %s AAAAAA %s :%s", neostatsbase64, TOK_NICK, nick, ts, ident, host, newmode, nicknumbuf, realname);
- set_nick_base64 (nick, nicknumbuf);
+ ircsnprintf( nicknumbuf, 6, "%sAA%c", neostatsbase64,( i+'A' ) );
+ send_cmd( "%s %s %s 1 %lu %s %s %s AAAAAA %s :%s", neostatsbase64, TOK_NICK, nick, ts, ident, host, newmode, nicknumbuf, realname );
+ set_nick_base64( nick, nicknumbuf );
}
-void
-send_ping (const char *source, const char *reply, const char *target)
+void send_ping( const char *source, const char *reply, const char *target )
{
- send_cmd ("%s %s %s :%s", neostatsbase64, TOK_PING, reply, target);
+ send_cmd( "%s %s %s :%s", neostatsbase64, TOK_PING, reply, target );
}
-void
-send_umode (const char *source, const char *target, const char *mode)
+void send_umode( const char *source, const char *target, const char *mode )
{
- send_cmd ("%s %s %s :%s", nick_to_base64 (source), TOK_MODE, target, mode);
+ send_cmd( "%s %s %s :%s", nick_to_base64( source ), TOK_MODE, target, mode );
}
-void
-send_numeric (const char *source, const int numeric, const char *target, const char *buf)
+void send_numeric( const char *source, const int numeric, const char *target, const char *buf )
{
- send_cmd ("%s %d %s :%s", neostatsbase64, numeric, nick_to_base64 (target), buf);
+ send_cmd( "%s %d %s :%s", neostatsbase64, numeric, nick_to_base64( target ), buf );
}
-void
-send_pong (const char *reply)
+void send_pong( const char *reply )
{
- send_cmd ("%s %s %s :%s", neostatsbase64, TOK_PONG, neostatsbase64, reply);
+ send_cmd( "%s %s %s :%s", neostatsbase64, TOK_PONG, neostatsbase64, reply );
}
-void
-send_kill (const char *source, const char *target, const char *reason)
+void send_kill( const char *source, const char *target, const char *reason )
{
- send_cmd ("%s %s %s :%s", neostatsbase64, TOK_KILL, nick_to_base64 (target), reason);
+ send_cmd( "%s %s %s :%s", neostatsbase64, TOK_KILL, nick_to_base64( target ), reason );
}
-void
-send_nickchange (const char *oldnick, const char *newnick, const unsigned long ts)
+void send_nickchange( const char *oldnick, const char *newnick, const unsigned long ts )
{
- send_cmd ("%s %s %s %lu", nick_to_base64 (oldnick), TOK_NICK, newnick, ts);
+ send_cmd( "%s %s %s %lu", nick_to_base64( oldnick ), TOK_NICK, newnick, ts );
}
-void
-send_invite (const char *source, const char *target, const char *chan)
+void send_invite( const char *source, const char *target, const char *chan )
{
- send_cmd ("%s %s %s %s", nick_to_base64 (source), TOK_INVITE, target, chan);
+ send_cmd( "%s %s %s %s", nick_to_base64( source ), TOK_INVITE, target, chan );
}
-void
-send_kick (const char *source, const char *chan, const char *target, const char *reason)
+void send_kick( const char *source, const char *chan, const char *target, const char *reason )
{
- send_cmd ("%s %s %s %s :%s", nick_to_base64 (source), TOK_KICK, chan, nick_to_base64 (target), (reason ? reason : "No Reason Given"));
+ send_cmd( "%s %s %s %s :%s", nick_to_base64( source ), TOK_KICK, chan, nick_to_base64( target ),( reason ? reason : "No Reason Given" ) );
}
-void
-send_swhois (const char *source, const char *target, const char *swhois)
+void send_swhois( const char *source, const char *target, const char *swhois )
{
- send_cmd ("%s %s %s :%s", neostatsbase64, TOK_SWHOIS, nick_to_base64 (target), swhois);
+ send_cmd( "%s %s %s :%s", neostatsbase64, TOK_SWHOIS, nick_to_base64( target ), swhois );
}
-void
-send_svsnick (const char *source, const char *target, const char *newnick, const unsigned long ts)
+void send_svsnick( const char *source, const char *target, const char *newnick, const unsigned long ts )
{
- send_cmd ("%s %s %s %s :%lu", neostatsbase64, TOK_SVSNICK, nick_to_base64 (target), newnick, ts);
+ send_cmd( "%s %s %s %s :%lu", neostatsbase64, TOK_SVSNICK, nick_to_base64( target ), newnick, ts );
}
-void
-send_svsjoin (const char *source, const char *target, const char *chan)
+void send_svsjoin( const char *source, const char *target, const char *chan )
{
- send_cmd ("%s %s %s %s", neostatsbase64, TOK_SVSJOIN, nick_to_base64 (target), chan);
+ send_cmd( "%s %s %s %s", neostatsbase64, TOK_SVSJOIN, nick_to_base64( target ), chan );
}
-void
-send_svspart (const char *source, const char *target, const char *chan)
+void send_svspart( const char *source, const char *target, const char *chan )
{
- send_cmd ("%s %s %s %s", neostatsbase64, TOK_SVSPART, nick_to_base64 (target), chan);
+ send_cmd( "%s %s %s %s", neostatsbase64, TOK_SVSPART, nick_to_base64( target ), chan );
}
-void
-send_svshost (const char *source, const char *who, const char *vhost)
+void send_svshost( const char *source, const char *who, const char *vhost )
{
- send_cmd ("%s %s %s %s", neostatsbase64, TOK_FAKEHOST, nick_to_base64 (who), vhost);
+ send_cmd( "%s %s %s %s", neostatsbase64, TOK_FAKEHOST, nick_to_base64( who ), vhost );
}
-void
-send_wallops (const char *source, const char *buf)
+void send_wallops( const char *source, const char *buf )
{
char* b64source;
- if (!(b64source = server_to_base64(source))) {
- b64source = nick_to_base64(source);
+ if( !( b64source = server_to_base64( source ) ) ) {
+ b64source = nick_to_base64( source );
}
- send_cmd ("%s %s :%s", b64source, TOK_WALLUSERS, buf);
+ send_cmd( "%s %s :%s", b64source, TOK_WALLUSERS, buf );
}
-void
-send_end_of_burst(void)
+void send_end_of_burst( void )
{
- send_cmd ("%s %s", neostatsbase64, TOK_END_OF_BURST);
+ send_cmd( "%s %s", neostatsbase64, TOK_END_OF_BURST );
}
-void
-send_end_of_burst_ack(void)
+void send_end_of_burst_ack( void )
{
- if (!is_synched) {
- do_synch_neostats ();
- send_end_of_burst ();
+ if( !is_synched ) {
+ do_synch_neostats( );
+ send_end_of_burst( );
}
- send_cmd ("%s %s", neostatsbase64, TOK_END_OF_BURST_ACK);
+ send_cmd( "%s %s", neostatsbase64, TOK_END_OF_BURST_ACK );
}
-void
-send_akill (const char *source, const char *host, const char *ident, const char *setby, const unsigned long length, const char *reason, const unsigned long ts)
+void send_akill( const char *source, const char *host, const char *ident, const char *setby, const unsigned long length, const char *reason, const unsigned long ts )
{
- send_cmd ("%s %s * +%s@%s %lu :%s", neostatsbase64, TOK_GLINE, ident, host, length, reason);
+ send_cmd( "%s %s * +%s@%s %lu :%s", neostatsbase64, TOK_GLINE, ident, host, length, reason );
}
-void
-send_rakill (const char *source, const char *host, const char *ident)
+void send_rakill( const char *source, const char *host, const char *ident )
{
- send_cmd ("%s %s * -%s@%s", neostatsbase64, TOK_GLINE, ident, host);
+ send_cmd( "%s %s * -%s@%s", neostatsbase64, TOK_GLINE, ident, host );
}
-void
-send_privmsg (const char *source, const char *target, const char *buf)
+void send_privmsg( const char *source, const char *target, const char *buf )
{
- if (target[0] == '#') {
- send_cmd ("%s %s %s :%s", nick_to_base64 (source), TOK_PRIVATE, target, buf);
+ if( target[0] == '#' ) {
+ send_cmd( "%s %s %s :%s", nick_to_base64( source ), TOK_PRIVATE, target, buf );
} else {
- send_cmd ("%s %s %s :%s", nick_to_base64 (source), TOK_PRIVATE, nick_to_base64 (target), buf);
+ send_cmd( "%s %s %s :%s", nick_to_base64( source ), TOK_PRIVATE, nick_to_base64( target ), buf );
}
}
-void
-send_notice (const char *source, const char *target, const char *buf)
+void send_notice( const char *source, const char *target, const char *buf )
{
- if (target[0] == '#') {
- send_cmd ("%s %s %s :%s", nick_to_base64 (source), TOK_NOTICE, target, buf);
+ if( target[0] == '#' ) {
+ send_cmd( "%s %s %s :%s", nick_to_base64( source ), TOK_NOTICE, target, buf );
} else {
- send_cmd ("%s %s %s :%s", nick_to_base64 (source), TOK_NOTICE, nick_to_base64 (target), buf);
+ send_cmd( "%s %s %s :%s", nick_to_base64( source ), TOK_NOTICE, nick_to_base64( target ), buf );
}
}
-void
-send_globops (const char *source, const char *buf)
+void send_globops( const char *source, const char *buf )
{
char* b64source;
- if (!(b64source = server_to_base64(source))) {
- b64source = nick_to_base64(source);
+ if( !( b64source = server_to_base64( source ) ) ) {
+ b64source = nick_to_base64( source );
}
- send_cmd ("%s %s :%s", b64source, TOK_WALLOPS, buf);
+ send_cmd( "%s %s :%s", b64source, TOK_WALLOPS, buf );
}
-void
-send_svstime (const char *source, const unsigned long ts)
+void send_svstime( const char *source, const unsigned long ts )
{
- send_cmd ("%s %s %lu", server_to_base64 (source), TOK_SETTIME, ts);
+ send_cmd( "%s %s %lu", server_to_base64( source ), TOK_SETTIME, ts );
}
-void
-send_serverrequptime (const char *source, const char *target)
+void send_serverrequptime( const char *source, const char *target )
{
- send_cmd ("%s %s u :%s", nick_to_base64 (source), TOK_STATS, server_to_base64 (target));
+ send_cmd( "%s %s u :%s", nick_to_base64( source ), TOK_STATS, server_to_base64( target ) );
}
-void
-send_serverreqversion (const char *source, const char *target)
+void send_serverreqversion( const char *source, const char *target )
{
- send_cmd ("%s %s %s", server_to_base64 (source), TOK_VERSION, server_to_base64 (target));
+ send_cmd( "%s %s %s", server_to_base64( source ), TOK_VERSION, server_to_base64( target ) );
}
-static void
-m_stats (char *origin, char **argv, int argc, int srv)
+static void m_stats( char *origin, char **argv, int argc, int srv )
{
char* b64origin;
- if (!(b64origin = base64_to_nick(origin))) {
- b64origin = base64_to_server(origin);
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
}
- do_stats (b64origin, argv[0]);
+ do_stats( b64origin, argv[0] );
}
/* ABAAB V :Bj */
-static void
-m_version (char *origin, char **argv, int argc, int srv)
+static void m_version( char *origin, char **argv, int argc, int srv )
{
char* b64origin;
- if (!(b64origin = base64_to_nick(origin))) {
- b64origin = base64_to_server(origin);
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
}
- do_version (b64origin, base64_to_server (argv[0]));
+ do_version( b64origin, base64_to_server( argv[0] ) );
}
-static void
-m_motd (char *origin, char **argv, int argc, int srv)
+static void m_motd( char *origin, char **argv, int argc, int srv )
{
- do_motd (base64_to_nick (origin), base64_to_server (argv[0]));
+ do_motd( base64_to_nick( origin ), base64_to_server( argv[0] ) );
}
-static void
-m_admin (char *origin, char **argv, int argc, int srv)
+static void m_admin( char *origin, char **argv, int argc, int srv )
{
- do_admin (base64_to_nick (origin), base64_to_server (argv[0]));
+ do_admin( base64_to_nick( origin ), base64_to_server( argv[0] ) );
}
/* m_server
@@ -840,74 +810,70 @@
* argv[4] = major protocol version: P10/P11
* argv[5] = YMM, YMMM or YYMMM; where 'YY' is the server numeric and
* "MMM" is the numeric nick mask of this server.
- * argv[6] = 0 (not used yet, mandatory unsigned int after u2.10.06)
+ * argv[6] = 0( not used yet, mandatory unsigned int after u2.10.06 )
* argv[argc-1] = serverinfo
- * NumServ(sptr) SERVER name hop 0 TSL PROT YxxCap 0 :info
+ * NumServ( sptr ) SERVER name hop 0 TSL PROT YxxCap 0 :info
*/
/*
SERVER srvname hop TSBoot TSLink Prot numcap modes :desc
AB S srvname hop TSBoot TSLink Prot numcap modes :desc
*/
-static void
-m_server (char *origin, char **argv, int argc, int srv)
+static void m_server( char *origin, char **argv, int argc, int srv )
{
- if (srv == 2) {
- do_server (argv[0], NULL, argv[1], NULL, argv[argc-1], 0);
+ if( srv == 2 ) {
+ do_server( argv[0], NULL, argv[1], NULL, argv[argc-1], 0 );
} else {
- do_server (argv[0], base64_to_server (origin), argv[1], NULL, argv[argc-1], srv);
+ do_server( argv[0], base64_to_server( origin ), argv[1], NULL, argv[argc-1], srv );
}
argv[5][2] = '\0';
- set_server_base64 (argv[0], argv[5]);
+ set_server_base64( argv[0], argv[5] );
}
/* R: AB SQ mark.local.org 0 :Ping timeout */
/* R: ABAAV SQ york.gose.org 1076280461 :relink */
-static void
-m_squit (char *origin, char **argv, int argc, int srv)
+static void m_squit( char *origin, char **argv, int argc, int srv )
{
char* b64arg0;
- if ((b64arg0 = base64_to_server(argv[0]))) {
- do_squit (b64arg0, argv[2]);
+ if( ( b64arg0 = base64_to_server( argv[0] ) ) ) {
+ do_squit( b64arg0, argv[2] );
} else {
- do_squit (argv[0], argv[2]);
+ do_squit( argv[0], argv[2] );
}
}
-static void
-m_quit (char *origin, char **argv, int argc, int srv)
+static void m_quit( char *origin, char **argv, int argc, int srv )
{
- do_quit (base64_to_nick(origin), argv[0]);
+ do_quit( base64_to_nick( origin ), argv[0] );
}
/* R: ABAAE M Mark :+i */
/* R: ABAAH M #c3 +tn */
/* R: ABAAG M #chan1 +v ABAAH */
-static void
-m_mode (char *origin, char **argv, int argc, int srv)
+static void m_mode( char *origin, char **argv, int argc, int srv )
{
char* b64origin;
- if (!(b64origin = base64_to_nick(origin))) {
- b64origin = base64_to_server(origin);
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
}
- if (argv[0][0] == '#') {
+ if( argv[0][0] == '#' ) {
char **av;
int ac = 0;
int j = 2;
int add = 0;
char *modes;
- AddStringToList (&av, argv[0], &ac);
+ AddStringToList( &av, argv[0], &ac );
modes = argv[1];
- AddStringToList (&av, argv[1], &ac);
+ AddStringToList( &av, argv[1], &ac );
- while (*modes) {
+ while( *modes ) {
unsigned int mask;
unsigned int flags;
- mask = CmodeCharToMask (*modes);
- flags = CmodeCharToFlags (*modes);
+ mask = CmodeCharToMask( *modes );
+ flags = CmodeCharToFlags( *modes );
- switch (*modes) {
+ switch( *modes ) {
case '+':
add = 1;
break;
@@ -915,23 +881,23 @@
add = 0;
break;
default:
- if (flags&NICKPARAM) {
- AddStringToList (&av, base64_to_nick(argv[j]), &ac);
+ if( flags&NICKPARAM ) {
+ AddStringToList( &av, base64_to_nick( argv[j] ), &ac );
j++;
- } else if (add) {
- if (mask == CMODE_LIMIT) {
- AddStringToList (&av, argv[j], &ac);
+ } else if( add ) {
+ if( mask == CMODE_LIMIT ) {
+ AddStringToList( &av, argv[j], &ac );
j++;
- } else if (mask == CMODE_KEY) {
- AddStringToList (&av, argv[j], &ac);
+ } else if( mask == CMODE_KEY ) {
+ AddStringToList( &av, argv[j], &ac );
j++;
- } else if (flags) {
- AddStringToList (&av, argv[j], &ac);
+ } else if( flags ) {
+ AddStringToList( &av, argv[j], &ac );
j++;
}
} else {
- if (mask == CMODE_KEY) {
- AddStringToList (&av, argv[j], &ac);
+ if( mask == CMODE_KEY ) {
+ AddStringToList( &av, argv[j], &ac );
j++;
}
}
@@ -939,33 +905,31 @@
modes++;
}
- do_mode_channel (b64origin, av, ac);
- ns_free(av);
+ do_mode_channel( b64origin, av, ac );
+ ns_free( av );
} else {
- do_mode_user (argv[0], argv[1]);
+ do_mode_user( argv[0], argv[1] );
}
}
-static void
-m_kill (char *origin, char **argv, int argc, int srv)
+static void m_kill( char *origin, char **argv, int argc, int srv )
{
char* b64origin;
- if (!(b64origin = base64_to_nick(origin))) {
- b64origin = base64_to_server(origin);
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
}
- do_kill (b64origin, base64_to_nick(argv[0]), argv[1]);
+ do_kill( b64origin, base64_to_nick( argv[0] ), argv[1] );
}
-static void
-m_away (char *origin, char **argv, int argc, int srv)
+static void m_away( char *origin, char **argv, int argc, int srv )
{
char *buf;
- if (argc > 0) {
- buf = joinbuf (argv, argc, 0);
- do_away (base64_to_nick(origin), buf);
- ns_free (buf);
+ if( argc > 0 ) {
+ buf = joinbuf( argv, argc, 0 );
+ do_away( base64_to_nick( origin ), buf );
+ ns_free( buf );
} else {
- do_away (base64_to_nick(origin), NULL);
+ do_away( base64_to_nick( origin ), NULL );
}
}
@@ -988,10 +952,9 @@
<reed> in a generated burst message, the users must be sorted by the modes: first users w/o modes, then users with voice, then with op, then with op+voice: num,num:v,num:o,num:ov
*/
-static void
-m_nick (char *origin, char **argv, int argc, int srv)
+static void m_nick( char *origin, char **argv, int argc, int srv )
{
- if (argc > 2) {
+ if( argc > 2 ) {
char IPAddress[32];
unsigned long IP;
const char *modes;
@@ -1001,10 +964,10 @@
const char *fakehost = NULL;
int param;
- modes = (argv[5][0] == '+') ? argv[5]: NULL;
- if (modes) {
+ modes =( argv[5][0] == '+' ) ? argv[5]: NULL;
+ if( modes ) {
param = 6;
- for (modeptr = modes; *modeptr; ++modeptr) {
+ for( modeptr = modes; *modeptr; ++modeptr ) {
switch( *modeptr ) {
case 'r':
account = argv[param++];
@@ -1017,73 +980,67 @@
break;
default:
break;
- } /* switch(*modeptr) */
- } /* for() */
- } /* if (modes) */
+ } /* switch( *modeptr ) */
+ } /* for( ) */
+ } /* if( modes ) */
- IP = htonl(base64toIP(argv[argc-3]));
- ircsnprintf( IPAddress, 32, "%lu", IP);
+ IP = htonl( base64toIP( argv[argc-3] ) );
+ ircsnprintf( IPAddress, 32, "%lu", IP );
/* nick, hopcount, TS, user, host, */
- do_nick (argv[0], argv[1], argv[2], argv[3], argv[4],
+ do_nick( argv[0], argv[1], argv[2], argv[3], argv[4],
/* server, ip, servicestamp, modes, */
- base64_to_server(origin), IPAddress, NULL, modes,
+ base64_to_server( origin ), IPAddress, NULL, modes,
/* vhost, realname, numeric, smodes */
- fakehost, argv[argc-1], argv[argc-2], NULL);
+ fakehost, argv[argc-1], argv[argc-2], NULL );
} else {
- do_nickchange (base64_to_nick(origin), argv[0], argv[1]);
+ do_nickchange( base64_to_nick( origin ), argv[0], argv[1] );
}
}
-static void
-m_topic (char *origin, char **argv, int argc, int srv)
+
+static void m_topic( char *origin, char **argv, int argc, int srv )
{
char* b64origin;
- if (!(b64origin = base64_to_nick(origin))) {
- b64origin = base64_to_server(origin);
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
}
- do_topic (argv[0], b64origin, NULL, argv[argc-1]);
+ do_topic( argv[0], b64origin, NULL, argv[argc-1] );
}
-static void
-m_kick (char *origin, char **argv, int argc, int srv)
+static void m_kick( char *origin, char **argv, int argc, int srv )
{
char* b64origin;
- if (!(b64origin = base64_to_nick(origin))) {
- b64origin = base64_to_server(origin);
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
}
- do_kick (b64origin, argv[0], base64_to_nick(argv[1]), argv[2]);
+ do_kick( b64origin, argv[0], base64_to_nick( argv[1] ), argv[2] );
}
/* R: ABAAE C #chan 1076069009 */
-static void
-m_create (char *origin, char **argv, int argc, int srv)
+static void m_create( char *origin, char **argv, int argc, int srv )
{
- do_join (base64_to_nick(origin), argv[0], argv[1]);
+ do_join( base64_to_nick( origin ), argv[0], argv[1] );
}
-static void
-m_join (char *origin, char **argv, int argc, int srv)
+static void m_join( char *origin, char **argv, int argc, int srv )
{
- do_join (base64_to_nick(origin), argv[0], argv[1]);
+ do_join( base64_to_nick( origin ), argv[0], argv[1] );
}
-static void
-m_part (char *origin, char **argv, int argc, int srv)
+static void m_part( char *origin, char **argv, int argc, int srv )
{
- do_part (base64_to_nick(origin), argv[0], argv[1]);
+ do_part( base64_to_nick( origin ), argv[0], argv[1] );
}
-static void
-m_ping (char *origin, char **argv, int argc, int srv)
+static void m_ping( char *origin, char **argv, int argc, int srv )
{
- do_ping (base64_to_server(origin), argv[1]);
+ do_ping( base64_to_server( origin ), argv[1] );
}
/* R: AB G !1076065765.431368 stats.mark.net 1076065765.431368 */
-static void
-m_pong (char *origin, char **argv, int argc, int srv)
+static void m_pong( char *origin, char **argv, int argc, int srv )
{
- do_pong (base64_to_server(origin), argv[1]);
+ do_pong( base64_to_server( origin ), argv[1] );
}
/*
@@ -1100,13 +1057,13 @@
* If parv[n] starts with a '+':
* Net burst, additive modes
* parv[n] = <mode>
- * parv[n+1] = <param> (optional)
- * parv[n+2] = <param> (optional)
+ * parv[n+1] = <param>( optional )
+ * parv[n+2] = <param>( optional )
* If parv[n] starts with a '%', then n will be parc-1:
* parv[n] = %<ban> <ban> <ban> ...
* If parv[n] starts with another character:
* parv[n] = <nick>[:<mode>],<nick>[:<mode>],...
- * where <mode> is the channel mode (ov) of nick and all following nicks.
+ * where <mode> is the channel mode( ov ) of nick and all following nicks.
*
* Example:
* "S BURST #channel 87654321 +ntkl key 123 AAA,AAB:o,BAA,BAB:ov :%ban1 ban2"
@@ -1114,8 +1071,7 @@
static char ircd_buf[BUFSIZE];
-static void
-m_burst (char *origin, char **argv, int argc, int srv)
+static void m_burst( char *origin, char **argv, int argc, int srv )
{
int param;
@@ -1124,8 +1080,8 @@
* then process modes and ignore clients - look into better system for NS2.6
*/
param = 2;
- while (param < argc) {
- switch (argv[param][0]) {
+ while( param < argc ) {
+ switch( argv[param][0] ) {
case '+': /* mode string */
{
char *modes;
@@ -1133,8 +1089,8 @@
modes = argv[param];
param++;
modes++;
- while(*modes) {
- if (CmodeCharToFlags (*modes) & MODEPARAM) {
+ while( *modes ) {
+ if( CmodeCharToFlags( *modes ) & MODEPARAM ) {
param ++;
}
modes++;
@@ -1154,22 +1110,22 @@
char *s, *t;
char modechar = 0;
- t = (char*)argv[param];
- while (*(s = t)) {
- t = s + strcspn (s, ",");
- if (*t)
+ t =( char* )argv[param];
+ while( *( s = t ) ) {
+ t = s + strcspn( s, "," );
+ if( *t )
*t++ = 0;
- do_join (base64_to_nick(s), argv[0], NULL);
- if (s[5] == ':') {
+ do_join( base64_to_nick( s ), argv[0], NULL );
+ if( s[5] == ':' ) {
modechar = s[6];
}
- if (modechar) {
+ if( modechar ) {
char **av;
int ac;
- ircsnprintf (ircd_buf, BUFSIZE, "%s +%c %s", argv[0], modechar, base64_to_nick(s));
- ac = split_buf (ircd_buf, &av, 0);
- do_mode_channel (me.name, av, ac);
- ns_free (av);
+ ircsnprintf( ircd_buf, BUFSIZE, "%s +%c %s", argv[0], modechar, base64_to_nick( s ) );
+ ac = split_buf( ircd_buf, &av, 0 );
+ do_mode_channel( me.name, av, ac );
+ ns_free( av );
}
}
param++;
@@ -1179,8 +1135,8 @@
}
param = 2;
- while (param < argc) {
- switch (argv[param][0]) {
+ while( param < argc ) {
+ switch( argv[param][0] ) {
case '+': /* mode string */
{
char *modes;
@@ -1188,19 +1144,19 @@
modes = argv[param];
param++;
modes++;
- while(*modes) {
+ while( *modes ) {
char **av;
int ac;
- if (CmodeCharToFlags (*modes) & MODEPARAM) {
- ircsnprintf (ircd_buf, BUFSIZE, "%s +%c %s", argv[0], *modes, argv[param]);
+ if( CmodeCharToFlags( *modes ) & MODEPARAM ) {
+ ircsnprintf( ircd_buf, BUFSIZE, "%s +%c %s", argv[0], *modes, argv[param] );
param ++;
} else {
- ircsnprintf (ircd_buf, BUFSIZE, "%s +%c", argv[0], *modes);
+ ircsnprintf( ircd_buf, BUFSIZE, "%s +%c", argv[0], *modes );
}
- ac = split_buf (ircd_buf, &av, 0);
- do_mode_channel (me.name, av, ac);
- ns_free (av);
+ ac = split_buf( ircd_buf, &av, 0 );
+ do_mode_channel( me.name, av, ac );
+ ns_free( av );
modes++;
}
break;
@@ -1222,36 +1178,34 @@
}
}
-static void
-m_end_of_burst (char *origin, char **argv, int argc, int srv)
+static void m_end_of_burst( char *origin, char **argv, int argc, int srv )
{
- if (ircstrcasecmp(base64_to_server(origin), me.uplink) == 0) {
- send_end_of_burst_ack();
+ if( ircstrcasecmp( base64_to_server( origin ), me.uplink ) == 0 ) {
+ send_end_of_burst_ack( );
}
}
-static void
-m_end_of_burst_ack (char *origin, char **argv, int argc, int srv)
+static void m_end_of_burst_ack( char *origin, char **argv, int argc, int srv )
{
return;
}
-static void m_wallusers (char *origin, char **argv, int argc, int srv)
+static void m_wallusers( char *origin, char **argv, int argc, int srv )
{
char* b64origin;
- if (!(b64origin = base64_to_nick(origin))) {
- b64origin = base64_to_server(origin);
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
}
- do_wallops(b64origin, argv[0]);
+ do_wallops( b64origin, argv[0] );
}
-static void m_wallops (char *origin, char **argv, int argc, int srv)
+static void m_wallops( char *origin, char **argv, int argc, int srv )
{
char* b64origin;
- if (!(b64origin = base64_to_nick(origin))) {
- b64origin = base64_to_server(origin);
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
}
- do_globops(b64origin, argv[0]);
+ do_globops( b64origin, argv[0] );
}
/* m_svsnick
@@ -1259,29 +1213,25 @@
* argv[1] = new nickname
* argv[2] = timestamp
*/
-static void
-m_svsnick (char *origin, char **argv, int argc, int srv)
+static void m_svsnick( char *origin, char **argv, int argc, int srv )
{
- do_nickchange (base64_to_nick(argv[0]), argv[1], argv[2]);
+ do_nickchange( base64_to_nick( argv[0] ), argv[1], argv[2] );
}
-static void
-m_svsjoin (char *origin, char **argv, int argc, int srv)
+static void m_svsjoin( char *origin, char **argv, int argc, int srv )
{
- do_join (base64_to_nick(argv[0]), argv[1], argv[2]);
+ do_join( base64_to_nick( argv[0] ), argv[1], argv[2] );
}
-static void
-m_svspart (char *origin, char **argv, int argc, int srv)
+static void m_svspart( char *origin, char **argv, int argc, int srv )
{
- do_part (base64_to_nick(argv[0]), argv[1], argv[2]);
+ do_part( base64_to_nick( argv[0] ), argv[1], argv[2] );
}
/* m_whois
* argv[0] = nickname masklist
*/
-static void
-m_whois (char *origin, char **argv, int argc, int srv)
+static void m_whois( char *origin, char **argv, int argc, int srv )
{
/* TODO */
}
@@ -1290,136 +1240,129 @@
* argv[0] = nickname
* argv[1] = new swhois
*/
-static void
-m_swhois (char *origin, char **argv, int argc, int srv)
+static void m_swhois( char *origin, char **argv, int argc, int srv )
{
- do_swhois (base64_to_nick(argv[0]), argv[1]);
+ do_swhois( base64_to_nick( argv[0] ), argv[1] );
}
-static void
-m_vhost (char *origin, char **argv, int argc, int srv)
+static void m_vhost( char *origin, char **argv, int argc, int srv )
{
- do_vhost (base64_to_nick(argv[0]), argv[1]);
+ do_vhost( base64_to_nick( argv[0] ), argv[1] );
}
-static void
-m_numeric242 (char *origin, char **argv, int argc, int srv)
+static void m_numeric242( char *origin, char **argv, int argc, int srv )
{
- _m_numeric242(base64_to_server(origin), argv, argc, srv);
+ _m_numeric242( base64_to_server( origin ), argv, argc, srv );
}
-static void
-m_numeric351(char *origin, char **argv, int argc, int srv)
+static void m_numeric351( char *origin, char **argv, int argc, int srv )
{
- _m_numeric351(base64_to_server(origin), argv, argc, srv);
+ _m_numeric351( base64_to_server( origin ), argv, argc, srv );
}
/* :<source> <command> <param1> <paramN> :<last parameter> */
/* <source> <command> <param1> <paramN> :<last parameter> */
-int
-parse (void *notused, void *rline, size_t len)
+int parse( void *notused, void *rline, size_t len )
{
char origin[64], cmd[64], *coreLine;
- char *line = (char *)rline;
+ char *line =( char * )rline;
int cmdptr = 0;
int ac = 0;
char **av = NULL;
- SET_SEGV_LOCATION();
- if (!(*line))
+ SET_SEGV_LOCATION( );
+ if( !( *line ) )
return NS_FAILURE;
- dlog (DEBUG1, "------------------------BEGIN PARSE-------------------------");
- dlog (DEBUGRX, "%s", line);
- coreLine = strpbrk (line, " ");
- if (coreLine) {
+ dlog( DEBUG1, "------------------------BEGIN PARSE-------------------------" );
+ dlog( DEBUGRX, "%s", line );
+ coreLine = strpbrk( line, " " );
+ if( coreLine ) {
*coreLine = 0;
- while (isspace (*++coreLine));
+ while( isspace( *++coreLine ) );
} else
- coreLine = line + strlen (line);
- if ((!ircstrcasecmp (line, "SERVER")) || (!ircstrcasecmp (line, "PASS"))) {
- strlcpy (cmd, line, sizeof(cmd));
- dlog (DEBUG1, "cmd : %s", cmd);
- dlog (DEBUG1, "args : %s", coreLine);
- ac = ircsplitbuf (coreLine, &av, 1);
+ coreLine = line + strlen( line );
+ if( ( !ircstrcasecmp( line, "SERVER" ) ) ||( !ircstrcasecmp( line, "PASS" ) ) ) {
+ strlcpy( cmd, line, sizeof( cmd ) );
+ dlog( DEBUG1, "cmd : %s", cmd );
+ dlog( DEBUG1, "args : %s", coreLine );
+ ac = ircsplitbuf( coreLine, &av, 1 );
cmdptr = 2;
- dlog (DEBUG1, "0 %d", ac);
+ dlog( DEBUG1, "0 %d", ac );
/* really needs to be in AddServer since this is a NeoStats wide bug
if config uplink name does not match our uplinks server name we can
never find the uplink!
*/
- if (strcmp(cmd, "SERVER") == 0) {
- strlcpy (me.uplink, av[0], MAXHOST);
+ if( strcmp( cmd, "SERVER" ) == 0 ) {
+ strlcpy( me.uplink, av[0], MAXHOST );
}
} else {
- strlcpy (origin, line, sizeof(origin));
+ strlcpy( origin, line, sizeof( origin ) );
cmdptr = 0;
- line = strpbrk (coreLine, " ");
- if (line) {
+ line = strpbrk( coreLine, " " );
+ if( line ) {
*line = 0;
- while (isspace (*++line));
+ while( isspace( *++line ) );
} /*else
- coreLine = line + strlen (line);*/
- strlcpy (cmd, coreLine, sizeof(cmd));
- dlog (DEBUG1, "origin: %s", origin);
- dlog (DEBUG1, "cmd : %s", cmd);
- dlog (DEBUG1, "args : %s", line);
- if (line) {
- ac = ircsplitbuf (line, &av, 1);
+ coreLine = line + strlen( line );*/
+ strlcpy( cmd, coreLine, sizeof( cmd ) );
+ dlog( DEBUG1, "origin: %s", origin );
+ dlog( DEBUG1, "cmd : %s", cmd );
+ dlog( DEBUG1, "args : %s", line );
+ if( line ) {
+ ac = ircsplitbuf( line, &av, 1 );
}
- dlog (DEBUG1, "0 %d", ac);
+ dlog( DEBUG1, "0 %d", ac );
}
- process_ircd_cmd (cmdptr, cmd, origin, av, ac);
- ns_free (av);
- dlog (DEBUG1, "-------------------------END PARSE--------------------------");
+ process_ircd_cmd( cmdptr, cmd, origin, av, ac );
+ ns_free( av );
+ dlog( DEBUG1, "-------------------------END PARSE--------------------------" );
return NS_SUCCESS;
}
-static void
-m_private (char *origin, char **argv, int argc, int srv)
+static void m_private( char *origin, char **argv, int argc, int srv )
{
char **av;
int ac = 0;
int i;
char* av0;
- if (argv[0][0] == '#') {
+ if( argv[0][0] == '#' ) {
av0 = argv[0];
} else {
- av0 = base64_to_nick(argv[0]);
+ av0 = base64_to_nick( argv[0] );
/* In case a real nick came through*/
- if (av0 == NULL) {
+ if( av0 == NULL ) {
av0 = argv[0];
}
}
- AddStringToList (&av, av0, &ac);
- for(i = 1; i < argc; i++) {
- AddStringToList (&av, argv[i], &ac);
+ AddStringToList( &av, av0, &ac );
+ for( i = 1; i < argc; i++ ) {
+ AddStringToList( &av, argv[i], &ac );
}
- _m_private (base64_to_nick(origin), av, ac, srv);
- ns_free (av);
+ _m_private( base64_to_nick( origin ), av, ac, srv );
+ ns_free( av );
}
-static void
-m_notice (char *origin, char **argv, int argc, int srv)
+static void m_notice( char *origin, char **argv, int argc, int srv )
{
char **av;
int ac = 0;
int i;
char* av0;
- if (argv[0][0] == '#') {
+ if( argv[0][0] == '#' ) {
av0 = argv[0];
} else {
- av0 = base64_to_nick(argv[0]);
+ av0 = base64_to_nick( argv[0] );
/* In case a real nick came through*/
- if (av0 == NULL) {
+ if( av0 == NULL ) {
av0 = argv[0];
}
}
- AddStringToList (&av, av0, &ac);
- for(i = 1; i < argc; i++) {
- AddStringToList (&av, argv[i], &ac);
+ AddStringToList( &av, av0, &ac );
+ for( i = 1; i < argc; i++ ) {
+ AddStringToList( &av, argv[i], &ac );
}
- _m_notice (base64_to_nick(origin), av, ac, srv);
- ns_free (av);
+ _m_notice( base64_to_nick( origin ), av, ac, srv );
+ ns_free( av );
}
Added: trunk/src/protocol/nefarious.c
==============================================================================
--- (empty file)
+++ trunk/src/protocol/nefarious.c Tue Apr 19 05:53:21 2005
@@ -0,0 +1,1368 @@
+/* NeoStats - IRC Statistical Services
+** Copyright (c) 1999-2005 Adam Rutter, Justin Hammond, Mark Hetherington
+** http://www.neostats.net/
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+** USA
+**
+** NeoStats CVS Identification
+** $Id$
+*/
+
+#include "neostats.h"
+#define OVERRIDECOREMESSAGESUPPORT
+#include "ircd.h"
+#include "base64.h"
+#include "numerics.h"
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+/* IRCu modification support
+ * Currently we only support modifications for Nefarious and Asuka
+ * To enable support uncomment the appropriate line below.
+ */
+/* Nefarious IRCu - http://evilnet.sourceforge.net */
+/* #define NEFARIOUS */
+/* ...... */
+/* Nefarious IRCu with F:HOST_HIDING_STYLE:2 */
+/* #define NEFARIOUS_CLOAKHOST */
+/* ...... */
+/* QuakeNet Asuka - http://dev.quakenet.org */
+/* #define ASUKA */
+
+/* Messages/Tokens */
+
+const char MSG_PRIVATE[] = "PRIVMSG";
+const char TOK_PRIVATE[] = "P";
+const char MSG_WHO[] = "WHO";
+const char TOK_WHO[] = "H";
+const char MSG_WHOIS[] = "WHOIS";
+const char TOK_WHOIS[] = "W";
+const char MSG_WHOWAS[] = "WHOWAS";
+const char TOK_WHOWAS[] = "X";
+const char MSG_USER[] = "USER";
+const char TOK_USER[] = "USER";
+const char MSG_NICK[] = "NICK";
+const char TOK_NICK[] = "N";
+const char MSG_SVSNICK[] = "SVSNICK";
+const char TOK_SVSNICK[] = "SN";
+const char MSG_SERVER[] = "SERVER";
+const char TOK_SERVER[] = "S";
+const char MSG_LIST[] = "LIST";
+const char TOK_LIST[] = "LIST";
+const char MSG_TOPIC[] = "TOPIC";
+const char TOK_TOPIC[] = "T";
+const char MSG_INVITE[] = "INVITE";
+const char TOK_INVITE[] = "I";
+const char MSG_VERSION[] = "VERSION";
+const char TOK_VERSION[] = "V";
+const char MSG_QUIT[] = "QUIT";
+const char TOK_QUIT[] = "Q";
+const char MSG_SQUIT[] = "SQUIT";
+const char TOK_SQUIT[] = "SQ";
+const char MSG_KILL[] = "KILL";
+const char TOK_KILL[] = "D";
+const char MSG_INFO[] = "INFO";
+const char TOK_INFO[] = "F";
+const char MSG_LINKS[] = "LINKS";
+const char TOK_LINKS[] = "LI";
+const char MSG_STATS[] = "STATS";
+const char TOK_STATS[] = "R";
+const char MSG_HELP[] = "HELP";
+const char TOK_HELP[] = "HELP";
+const char MSG_ERROR[] = "ERROR";
+const char TOK_ERROR[] = "Y";
+const char MSG_AWAY[] = "AWAY";
+const char TOK_AWAY[] = "A";
+const char MSG_CONNECT[] = "CONNECT";
+const char TOK_CONNECT[] = "CO";
+const char MSG_MAP[] = "MAP";
+const char TOK_MAP[] = "MAP";
+const char MSG_PING[] = "PING";
+const char TOK_PING[] = "G";
+const char MSG_PONG[] = "PONG";
+const char TOK_PONG[] = "Z";
+const char MSG_OPER[] = "OPER";
+const char TOK_OPER[] = "OPER";
+const char MSG_PASS[] = "PASS";
+const char TOK_PASS[] = "PA";
+const char MSG_WALLOPS[] = "WALLOPS";
+const char TOK_WALLOPS[] = "WA";
+const char MSG_WALLUSERS[] = "WALLUSERS";
+const char TOK_WALLUSERS[] = "WU";
+const char MSG_DESYNCH[] = "DESYNCH";
+const char TOK_DESYNCH[] = "DS";
+const char MSG_TIME[] = "TIME";
+const char TOK_TIME[] = "TI";
+const char MSG_SETTIME[] = "SETTIME";
+const char TOK_SETTIME[] = "SE";
+const char MSG_RPING[] = "RPING";
+const char TOK_RPING[] = "RI";
+const char MSG_RPONG[] = "RPONG";
+const char TOK_RPONG[] = "RO";
+const char MSG_NAMES[] = "NAMES";
+const char TOK_NAMES[] = "E";
+const char MSG_ADMIN[] = "ADMIN";
+const char TOK_ADMIN[] = "AD";
+const char MSG_TRACE[] = "TRACE";
+const char TOK_TRACE[] = "TR";
+const char MSG_NOTICE[] = "NOTICE";
+const char TOK_NOTICE[] = "O";
+const char MSG_WALLCHOPS[] = "WALLCHOPS";
+const char TOK_WALLCHOPS[] = "WC";
+const char MSG_WALLVOICES[] = "WALLVOICES";
+const char TOK_WALLVOICES[] = "WV";
+const char MSG_WALLHOPS[] = "WALLHOPS";
+const char TOK_WALLHOPS[] = "WH";
+const char MSG_CPRIVMSG[] = "CPRIVMSG";
+const char TOK_CPRIVMSG[] = "CP";
+const char MSG_CNOTICE[] = "CNOTICE";
+const char TOK_CNOTICE[] = "CN";
+const char MSG_JOIN[] = "JOIN";
+const char TOK_JOIN[] = "J";
+const char MSG_SVSJOIN[] = "SVSJOIN";
+const char TOK_SVSJOIN[] = "SJ";
+const char MSG_PART[] = "PART";
+const char TOK_PART[] = "L";
+const char MSG_SVSPART[] = "SVSPART";
+const char TOK_SVSPART[] = "SP";
+const char MSG_LUSERS[] = "LUSERS";
+const char TOK_LUSERS[] = "LU";
+const char MSG_MOTD[] = "MOTD";
+const char TOK_MOTD[] = "MO";
+const char MSG_MODE[] = "MODE";
+const char TOK_MODE[] = "M";
+const char MSG_KICK[] = "KICK";
+const char TOK_KICK[] = "K";
+const char MSG_USERHOST[] = "USERHOST";
+const char TOK_USERHOST[] = "USERHOST";
+const char MSG_USERIP[] = "USERIP";
+const char TOK_USERIP[] = "USERIP";
+const char MSG_ISON[] = "ISON";
+const char TOK_ISON[] = "ISON";
+const char MSG_SQUERY[] = "SQUERY";
+const char TOK_SQUERY[] = "SQUERY";
+const char MSG_SERVLIST[] = "SERVLIST";
+const char TOK_SERVLIST[] = "SERVSET";
+const char MSG_SERVSET[] = "SERVSET";
+const char TOK_SERVSET[] = "SERVSET";
+const char MSG_CHECK[] = "CHECK";
+const char TOK_CHECK[] = "CC";
+const char MSG_REHASH[] = "REHASH";
+const char TOK_REHASH[] = "REHASH";
+const char MSG_RESTART[] = "RESTART";
+const char TOK_RESTART[] = "RESTART";
+const char MSG_CLOSE[] = "CLOSE";
+const char TOK_CLOSE[] = "CLOSE";
+const char MSG_DIE[] = "DIE";
+const char TOK_DIE[] = "DIE";
+const char MSG_HASH[] = "HASH";
+const char TOK_HASH[] = "HASH";
+const char MSG_DNS[] = "DNS";
+const char TOK_DNS[] = "DNS";
+const char MSG_SILENCE[] = "SILENCE";
+const char TOK_SILENCE[] = "U";
+const char MSG_EXEMPT[] = "EXEMPT";
+const char TOK_EXEMPT[] = "EX";
+const char MSG_GLINE[] = "GLINE";
+const char TOK_GLINE[] = "GL";
+const char MSG_BURST[] = "BURST";
+const char TOK_BURST[] = "B";
+const char MSG_UPING[] = "UPING";
+const char TOK_UPING[] = "UP";
+const char MSG_CREATE[] = "CREATE";
+const char TOK_CREATE[] = "C";
+const char MSG_DESTRUCT[] = "DESTRUCT";
+const char TOK_DESTRUCT[] = "DE";
+const char MSG_END_OF_BURST[] = "END_OF_BURST";
+const char TOK_END_OF_BURST[] = "EB";
+const char MSG_END_OF_BURST_ACK[] = "EOB_ACK";
+const char TOK_END_OF_BURST_ACK[] = "EA";
+const char MSG_PROTO[] = "PROTO";
+const char TOK_PROTO[] = "PROTO";
+const char MSG_JUPE[] = "JUPE";
+const char TOK_JUPE[] = "JU";
+const char MSG_OPMODE[] = "OPMODE";
+const char TOK_OPMODE[] = "OM";
+const char MSG_CLEARMODE[] = "CLEARMODE";
+const char TOK_CLEARMODE[] = "CM";
+const char MSG_ACCOUNT[] = "ACCOUNT";
+const char TOK_ACCOUNT[] = "AC";
+const char MSG_ASLL[] = "ASLL";
+const char TOK_ASLL[] = "LL";
+const char MSG_MKPASSWD[] = "MKPASSWD";
+const char TOK_MKPASSWD[] = "MKPASSWD";
+const char MSG_POST[] = "POST";
+const char TOK_POST[] = "POST";
+const char MSG_SET[] = "SET";
+const char TOK_SET[] = "SET";
+const char MSG_RESET[] = "RESET";
+const char TOK_RESET[] = "RESET";
+const char MSG_GET[] = "GET";
+const char TOK_GET[] = "GET";
+const char MSG_PRIVS[] = "PRIVS";
+const char TOK_PRIVS[] = "PRIVS";
+const char MSG_SETHOST[] = "SETHOST";
+const char TOK_SETHOST[] = "SH";
+const char MSG_FAKEHOST[] = "FAKE";
+const char TOK_FAKEHOST[] = "FA";
+const char MSG_OPERMOTD[] = "OPERMOTD";
+const char TOK_OPERMOTD[] = "OPM";
+const char MSG_RULES[] = "RULES";
+const char TOK_RULES[] = "RL";
+const char MSG_SVSNOOP[] = "SVSNOOP";
+const char TOK_SVSNOOP[] = "SO";
+const char MSG_SWHOIS[] = "SWHOIS";
+const char TOK_SWHOIS[] = "SW";
+const char MSG_MARK[] = "MARK";
+const char TOK_MARK[] = "MK";
+
+ /* User modes: */
+#define UMODE_SERVNOTICE 0x00800000 /* See server notices */
+#define UMODE_DEBUG 0x01000000 /* See hack notices */
+#ifdef NEFARIOUS
+#define UMODE_FAKEHOST 0x02000000 /* */
+#define UMODE_WHOIS 0x04000000 /* */
+#endif
+#if ( defined NEFARIOUS ) || (defined ASUKA )
+#define UMODE_SETHOST 0x08000000 /* */
+#define UMODE_NOCHAN 0x10000000 /* */
+#define UMODE_NOIDLE 0x20000000 /* */
+#define UMODE_XTRAOP 0x40000000 /* */
+#endif
+
+/* Cmodes */
+#if ( defined NEFARIOUS ) || (defined ASUKA )
+#define CMODE_NOCTCP 0x02000000
+#define CMODE_NONOTICE 0x04000000
+#define CMODE_NOQUITPARTS 0x08000000
+#endif
+#ifdef ASUKA
+#define CMODE_DELJOINS 0x10000000
+#endif
+#ifdef NEFARIOUS
+#define CMODE_PERSIST 0x20000000
+#define CMODE_NOLISTMODES 0x40000000
+#define CMODE_MODREG 0x80000000
+#define CMODE_NOAMSG 0x100000000
+#define CMODE_ONLYSECURE 0x200000000
+#endif
+
+static void m_private( char *origin, char **argv, int argc, int srv );
+static void m_notice( char *origin, char **argv, int argc, int srv );
+static void m_version( char *origin, char **argv, int argc, int srv );
+static void m_motd( char *origin, char **argv, int argc, int srv );
+static void m_admin( char *origin, char **argv, int argc, int srv );
+static void m_server( char *origin, char **argv, int argc, int srv );
+static void m_squit( char *origin, char **argv, int argc, int srv );
+static void m_quit( char *origin, char **argv, int argc, int srv );
+static void m_mode( char *origin, char **argv, int argc, int srv );
+static void m_kill( char *origin, char **argv, int argc, int srv );
+static void m_pong( char *origin, char **argv, int argc, int srv );
+static void m_away( char *origin, char **argv, int argc, int srv );
+static void m_nick( char *origin, char **argv, int argc, int srv );
+static void m_topic( char *origin, char **argv, int argc, int srv );
+static void m_kick( char *origin, char **argv, int argc, int srv );
+static void m_join( char *origin, char **argv, int argc, int srv );
+static void m_create( char *origin, char **argv, int argc, int srv );
+static void m_part( char *origin, char **argv, int argc, int srv );
+static void m_stats( char *origin, char **argv, int argc, int srv );
+static void m_ping( char *origin, char **argv, int argc, int srv );
+static void m_burst( char *origin, char **argv, int argc, int srv );
+static void m_end_of_burst( char *origin, char **argv, int argc, int srv );
+static void m_end_of_burst_ack( char *origin, char **argv, int argc, int srv );
+static void m_wallusers( char *origin, char **argv, int argc, int srv );
+static void m_wallops( char *origin, char **argv, int argc, int srv );
+static void m_svsnick( char *origin, char **argv, int argc, int srv );
+static void m_svsjoin( char *origin, char **argv, int argc, int srv );
+static void m_svspart( char *origin, char **argv, int argc, int srv );
+static void m_whois( char *origin, char **argv, int argc, int srv );
+static void m_swhois( char *origin, char **argv, int argc, int srv );
+static void m_vhost( char *origin, char **argv, int argc, int srv );
+static void m_numeric242( char *origin, char **argv, int argc, int srv );
+static void m_numeric351( char *origin, char **argv, int argc, int srv );
+
+ProtocolInfo protocol_info =
+{
+ /* Protocol options required by this IRCd */
+ PROTOCOL_TOKEN|PROTOCOL_NOQUIT|PROTOCOL_B64SERVER|PROTOCOL_B64NICK|PROTOCOL_NICKIP|PROTOCOL_KICKPART,
+ /* Protocol options negotiated at link by this IRCd */
+ 0,
+ /* Features supported by this IRCd */
+#ifdef NEFARIOUS
+ FEATURE_SVSJOIN|FEATURE_SVSPART|FEATURE_SVSNICK|FEATURE_SVSHOST|FEATURE_SWHOIS|
+# ifdef NEFARIOUS_CLOAKHOST
+ FEATURE_UMODECLOAK|
+# endif /* NEFARIOUS_CLOAKHOST */
+#endif /* NEFARIOUS */
+ FEATURE_SVSTIME,
+ /* Max host length */
+ 63 ,
+ /* Max password length */
+ 32,
+ /* Max nick length */
+ 32,
+ /* Max user length */
+ 10,
+ /* Max real name length */
+ 50,
+ /* Max channel name length */
+ 200,
+ /* Max topic length */
+ 250,
+ /* Default operator modes for NeoStats service bots */
+ "+o",
+ /* Default channel mode for NeoStats service bots */
+};
+
+/* this is the command list and associated functions to run */
+ircd_cmd cmd_list[] =
+{
+ /* Command Token Function usage */
+ {MSG_PRIVATE, TOK_PRIVATE, m_private, 0},
+ {MSG_CPRIVMSG, TOK_CPRIVMSG, m_private, 0},
+ {MSG_NOTICE, TOK_NOTICE, m_notice, 0},
+ {MSG_CNOTICE, TOK_CNOTICE, m_notice, 0},
+ {MSG_STATS, TOK_STATS, m_stats, 0},
+ {MSG_VERSION, TOK_VERSION, m_version, 0},
+ {MSG_MOTD, TOK_MOTD, m_motd, 0},
+ {MSG_ADMIN, TOK_ADMIN, m_admin, 0},
+ {MSG_SERVER, TOK_SERVER, m_server, 0},
+ {MSG_SQUIT, TOK_SQUIT, m_squit, 0},
+ {MSG_QUIT, TOK_QUIT, m_quit, 0},
+ {MSG_MODE, TOK_MODE, m_mode, 0},
+ {MSG_KILL, TOK_KILL, m_kill, 0},
+ {MSG_PONG, TOK_PONG, m_pong, 0},
+ {MSG_AWAY, TOK_AWAY, m_away, 0},
+ {MSG_NICK, TOK_NICK, m_nick, 0},
+ {MSG_TOPIC, TOK_TOPIC, m_topic, 0},
+ {MSG_KICK, TOK_KICK, m_kick, 0},
+ {MSG_CREATE, TOK_CREATE, m_create, 0},
+ {MSG_JOIN, TOK_JOIN, m_join, 0},
+ {MSG_PART, TOK_PART, m_part, 0},
+ {MSG_PING, TOK_PING, m_ping, 0},
+ {MSG_PASS, TOK_PASS, _m_pass, 0},
+ {MSG_BURST, TOK_BURST, m_burst, 0},
+ {MSG_END_OF_BURST, TOK_END_OF_BURST, m_end_of_burst, 0},
+ {MSG_END_OF_BURST_ACK, TOK_END_OF_BURST_ACK, m_end_of_burst_ack, 0},
+ {MSG_WALLOPS, TOK_WALLOPS, m_wallops, 0},
+ {MSG_WALLUSERS, TOK_WALLUSERS, m_wallusers, 0},
+ {MSG_SVSNICK, TOK_SVSNICK, m_svsnick, 0},
+ {MSG_SVSJOIN, TOK_SVSJOIN, m_svsjoin, 0},
+ {MSG_SVSPART, TOK_SVSPART, m_svspart, 0},
+ {MSG_WHOIS, TOK_WHOIS, m_whois, 0},
+ {MSG_SWHOIS, TOK_SWHOIS, m_swhois, 0},
+ {MSG_FAKEHOST, TOK_FAKEHOST, m_vhost, 0},
+ {MSG_ERROR, TOK_ERROR, _m_error, 0},
+ {"242", "242", m_numeric242, 0},
+ {"351", "351", m_numeric351, 0},
+ {0, 0, 0, 0},
+};
+
+mode_init chan_umodes[] =
+{
+ {0, 0, 0},
+};
+
+mode_init chan_modes[] =
+{
+#if( defined NEFARIOUS ) ||( defined ASUKA )
+ {'c', CMODE_NOCOLOR, 0},
+ {'C', CMODE_NOCTCP, 0},
+ {'N', CMODE_NONOTICE, 0},
+#endif
+#ifdef ASUKA
+ {'D', CMODE_DELJOINS, 0},
+ {'u', CMODE_NOQUITPARTS, 0},
+#endif
+#ifdef NEFARIOUS
+ {'a', CMODE_ADMONLY, 0},
+ {'e', CMODE_EXCEPT, MODEPARAM},
+ {'z', CMODE_PERSIST, 0},
+ {'L', CMODE_NOLISTMODES, 0},
+ {'M', CMODE_MODREG, 0},
+ {'O', CMODE_OPERONLY, 0},
+ {'Q', CMODE_NOQUITPARTS, 0},
+ {'S', CMODE_STRIP, 0},
+ {'T', CMODE_NOAMSG, 0},
+ {'Z', CMODE_ONLYSECURE, 0},
+#endif
+ {'r', CMODE_RGSTRONLY, 0},
+ {0, 0, 0},
+};
+
+mode_init user_umodes[] =
+{
+ {'O', UMODE_LOCOP},
+ {'g', UMODE_DEBUG},
+ {'w', UMODE_WALLOP},
+ {'s', UMODE_SERVNOTICE},
+ {'d', UMODE_DEAF},
+ {'k', UMODE_SERVICES},
+ {'r', UMODE_REGNICK},
+ {'x', UMODE_HIDE},
+#ifdef NEFARIOUS
+ {'a', UMODE_ADMIN},
+ {'f', UMODE_FAKEHOST},
+ {'B', UMODE_BOT},
+ {'W', UMODE_WHOIS},
+#endif
+#if( defined NEFARIOUS ) ||( defined ASUKA )
+ {'h', UMODE_SETHOST},
+ {'n', UMODE_NOCHAN},
+ {'I', UMODE_NOIDLE},
+ {'R', UMODE_RGSTRONLY},
+ {'X', UMODE_XTRAOP},
+#endif
+ {0, 0},
+};
+
+/* Temporary buffers for numeric conversion */
+char neostatsbase64[3] = "\0";
+/* Flags for numeric usage; limits to 64 clients */
+char neonicknumerics[64];
+
+/*
+ * Numeric nicks are new as of version ircu2.10.00beta1.
+ *
+ * The idea is as follows:
+ * In most messages( for protocol 10+ ) the original nick will be
+ * replaced by a 3 character string: YXX
+ * Where 'Y' represents the server, and 'XX' the nick on that server.
+ *
+ * 'YXX' should not interfer with the input parser, and therefore is
+ * not allowed to contain spaces or a ':'.
+ * Also, 'Y' can't start with a '+' because of m_server( ).
+ *
+ * We keep the characters printable for debugging reasons too.
+ *
+ * The 'XX' value can be larger then the maximum number of clients
+ * per server, we use a mask( struct Server::nn_mask ) to get the real
+ * client numeric. The overhead is used to have some redundancy so
+ * just-disconnected-client aren't confused with just-connected ones.
+ */
+
+/* These must be the same on ALL servers ! Do not change ! */
+
+#define NUMNICKLOG 6
+#define NUMNICKBASE 64 /*( 2 << NUMNICKLOG ) */
+#define NUMNICKMASK 63 /*( NUMNICKBASE-1 ) */
+
+/*
+ * convert2y[] converts a numeric to the corresponding character.
+ * The following characters are currently known to be forbidden:
+ *
+ * '\0' : Because we use '\0' as end of line.
+ *
+ * ' ' : Because parse_*( ) uses this as parameter seperator.
+ * ':' : Because parse_server( ) uses this to detect if a prefix is a
+ * numeric or a name.
+ * '+' : Because m_nick( ) uses this to determine if parv[6] is a
+ * umode or not.
+ * '&', '#', '+', '$', '@' and '%' :
+ * Because m_message( ) matches these characters to detect special cases.
+ */
+static const char convert2y[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789[]";
+
+static const unsigned int convert2n[] =
+{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 52,53,54,55,56,57,58,59,60,61, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,
+ 15,16,17,18,19,20,21,22,23,24,25,62, 0,63, 0, 0,
+ 0,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,
+ 41,42,43,44,45,46,47,48,49,50,51, 0, 0, 0, 0, 0,
+
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+unsigned int base64toint( const char* s )
+{
+ int max = 0;
+ unsigned int i = convert2n[( unsigned char ) *s++];
+ max++;
+ while( *s ) {
+ i <<= NUMNICKLOG;
+ i += convert2n[( unsigned char ) *s++];
+ max++;
+ if( max>=5 )
+ break;
+ }
+ return i;
+}
+
+unsigned int base64toIP( const char* s )
+{
+ unsigned int i = convert2n[( unsigned char ) *s++];
+ while( *s ) {
+ i <<= NUMNICKLOG;
+ i += convert2n[( unsigned char ) *s++];
+ }
+ return i;
+}
+
+const char* inttobase64( char* buf, unsigned int v, unsigned int count )
+{
+ buf[count] = '\0';
+ while( count > 0 ) {
+ buf[--count] = convert2y[( v & NUMNICKMASK )];
+ v >>= NUMNICKLOG;
+ }
+ return buf;
+}
+
+/* server
+inttobase64( cli_yxx( c ), numeric, 2 ) */
+
+/* nick
+inttobase64( cli_yxx( cptr ), last_nn, 3 ) */
+/*
+DEBUG2 CORE - SENT: PASS password
+DEBUG2 CORE - SENT: SERVER stats.mark.net 1 1076012166 1076012166 P10 CD] :[stats.mark.net] NeoStats 2.5 IRC Statistical Server!
+DEBUG3 CORE - Sendings pings...
+DEBUG1 CORE - R: PASS :password
+DEBUG1 CORE - R: SERVER mark.local.org 1 1076002125 1076012166 J10 ABAP] + :me
+DEBUG1 CORE - New Server: mark.local.org
+DEBUG1 CORE - R: AB N Mark 1 1076011621 a 192.168.238.13 DAqO4N ABAAB :M
+DEBUG1 CORE - R: AB EB
+DEBUG1 CORE - R: AB G !1076012256.68240 stats.mark.net 1076012256.68240
+DEBUG3 CORE - Sendings pings...
+DEBUG2 CORE - SENT: :stats.mark.net PING stats.mark.net :mark.local.org
+DEBUG1 CORE - R: AB Z AB :stats.mark.net
+DEBUG1 CORE - R: AB SQ mark.local.org 0 :Ping timeout
+DEBUG3 CORE - Sendings pings...
+DEBUG2 CORE - SENT: :stats.mark.net PING stats.mark.net :mark.local.org
+*/
+
+void send_server( const char *source, const char *name, const int numeric, const char *infoline )
+{
+ send_cmd( "%s %s * +%s 604800 %lu :%s", neostatsbase64, TOK_JUPE, name, me.now, infoline );
+}
+
+/*
+1 <name of new server>
+2 <hops>
+3 <boot TS>
+4 <link TS>
+5 <protocol>
+6 <numeric of new server><max client numeric>
+7 <flags>
+-1 <description of new server>
+*/
+void send_server_connect( const char *name, const int numeric, const char *infoline, const char *pass, const unsigned long tsboot, const unsigned long tslink )
+{
+ /* Reset our numeric buffer */
+ os_memset( neonicknumerics, 0 , sizeof( neonicknumerics ) );
+ inttobase64( neostatsbase64, numeric, 2 );
+ send_cmd( "%s :%s", MSG_PASS, pass );
+ send_cmd( "%s %s 1 %lu %lu J10 %s]]] +s :%s", MSG_SERVER, name, tsboot, tslink, neostatsbase64, infoline );
+ set_server_base64( name, neostatsbase64 );
+}
+
+void send_squit( const char *server, const char *quitmsg )
+{
+ send_cmd( "%s %s %s 0 :%s", neostatsbase64, TOK_SQUIT, server, quitmsg );
+}
+
+void send_quit( const char *source, const char *quitmsg )
+{
+ char* num;
+
+ /* Clear numeric */
+ num = nick_to_base64( source );
+ send_cmd( "%s %s :%s", num, TOK_QUIT, quitmsg );
+ neonicknumerics[convert2n[( int )num[4]]] = 0;
+}
+
+void send_part( const char *source, const char *chan, const char *reason )
+{
+ send_cmd( "%s %s %s :%s", nick_to_base64( source ), TOK_PART, chan, reason );
+}
+
+void send_join( const char *source, const char *chan, const char *key, const unsigned long ts )
+{
+ send_cmd( "%s %s %s %lu", nick_to_base64( source ), TOK_JOIN, chan, ts );
+}
+
+/* R: ABAAH M #c3 +tn */
+void send_cmode( const char *source, const char *who, const char *chan, const char *mode, const char *args, const unsigned long ts )
+{
+ send_cmd( "%s %s %s %s %s %lu", neostatsbase64, TOK_MODE, chan, mode, args, ts );
+}
+
+void send_nick( const char *nick, const unsigned long ts, const char* newmode, const char *ident, const char *host, const char* server, const char *realname )
+{
+ int i;
+ char nicknumbuf[6];
+
+ for( i = 0; i < 64; i++ )
+ {
+ /* Reserve numeric */
+ if( neonicknumerics[i]==0 )
+ {
+ neonicknumerics[i] = 1;
+ break;
+ }
+ }
+ ircsnprintf( nicknumbuf, 6, "%sAA%c", neostatsbase64,( i+'A' ) );
+ send_cmd( "%s %s %s 1 %lu %s %s %s AAAAAA %s :%s", neostatsbase64, TOK_NICK, nick, ts, ident, host, newmode, nicknumbuf, realname );
+ set_nick_base64( nick, nicknumbuf );
+}
+
+void send_ping( const char *source, const char *reply, const char *target )
+{
+ send_cmd( "%s %s %s :%s", neostatsbase64, TOK_PING, reply, target );
+}
+
+void send_umode( const char *source, const char *target, const char *mode )
+{
+ send_cmd( "%s %s %s :%s", nick_to_base64( source ), TOK_MODE, target, mode );
+}
+
+void send_numeric( const char *source, const int numeric, const char *target, const char *buf )
+{
+ send_cmd( "%s %d %s :%s", neostatsbase64, numeric, nick_to_base64( target ), buf );
+}
+
+void send_pong( const char *reply )
+{
+ send_cmd( "%s %s %s :%s", neostatsbase64, TOK_PONG, neostatsbase64, reply );
+}
+
+void send_kill( const char *source, const char *target, const char *reason )
+{
+ send_cmd( "%s %s %s :%s", neostatsbase64, TOK_KILL, nick_to_base64( target ), reason );
+}
+
+void send_nickchange( const char *oldnick, const char *newnick, const unsigned long ts )
+{
+ send_cmd( "%s %s %s %lu", nick_to_base64( oldnick ), TOK_NICK, newnick, ts );
+}
+
+void send_invite( const char *source, const char *target, const char *chan )
+{
+ send_cmd( "%s %s %s %s", nick_to_base64( source ), TOK_INVITE, target, chan );
+}
+
+void send_kick( const char *source, const char *chan, const char *target, const char *reason )
+{
+ send_cmd( "%s %s %s %s :%s", nick_to_base64( source ), TOK_KICK, chan, nick_to_base64( target ),( reason ? reason : "No Reason Given" ) );
+}
+
+void send_swhois( const char *source, const char *target, const char *swhois )
+{
+ send_cmd( "%s %s %s :%s", neostatsbase64, TOK_SWHOIS, nick_to_base64( target ), swhois );
+}
+
+void send_svsnick( const char *source, const char *target, const char *newnick, const unsigned long ts )
+{
+ send_cmd( "%s %s %s %s :%lu", neostatsbase64, TOK_SVSNICK, nick_to_base64( target ), newnick, ts );
+}
+
+void send_svsjoin( const char *source, const char *target, const char *chan )
+{
+ send_cmd( "%s %s %s %s", neostatsbase64, TOK_SVSJOIN, nick_to_base64( target ), chan );
+}
+
+void send_svspart( const char *source, const char *target, const char *chan )
+{
+ send_cmd( "%s %s %s %s", neostatsbase64, TOK_SVSPART, nick_to_base64( target ), chan );
+}
+
+void send_svshost( const char *source, const char *who, const char *vhost )
+{
+ send_cmd( "%s %s %s %s", neostatsbase64, TOK_FAKEHOST, nick_to_base64( who ), vhost );
+}
+
+void send_wallops( const char *source, const char *buf )
+{
+ char* b64source;
+ if( !( b64source = server_to_base64( source ) ) ) {
+ b64source = nick_to_base64( source );
+ }
+ send_cmd( "%s %s :%s", b64source, TOK_WALLUSERS, buf );
+}
+
+void send_end_of_burst( void )
+{
+ send_cmd( "%s %s", neostatsbase64, TOK_END_OF_BURST );
+}
+
+void send_end_of_burst_ack( void )
+{
+ if( !is_synched ) {
+ do_synch_neostats( );
+ send_end_of_burst( );
+ }
+ send_cmd( "%s %s", neostatsbase64, TOK_END_OF_BURST_ACK );
+}
+
+void send_akill( const char *source, const char *host, const char *ident, const char *setby, const unsigned long length, const char *reason, const unsigned long ts )
+{
+ send_cmd( "%s %s * +%s@%s %lu :%s", neostatsbase64, TOK_GLINE, ident, host, length, reason );
+}
+
+void send_rakill( const char *source, const char *host, const char *ident )
+{
+ send_cmd( "%s %s * -%s@%s", neostatsbase64, TOK_GLINE, ident, host );
+}
+
+void send_privmsg( const char *source, const char *target, const char *buf )
+{
+ if( target[0] == '#' ) {
+ send_cmd( "%s %s %s :%s", nick_to_base64( source ), TOK_PRIVATE, target, buf );
+ } else {
+ send_cmd( "%s %s %s :%s", nick_to_base64( source ), TOK_PRIVATE, nick_to_base64( target ), buf );
+ }
+}
+
+void send_notice( const char *source, const char *target, const char *buf )
+{
+ if( target[0] == '#' ) {
+ send_cmd( "%s %s %s :%s", nick_to_base64( source ), TOK_NOTICE, target, buf );
+ } else {
+ send_cmd( "%s %s %s :%s", nick_to_base64( source ), TOK_NOTICE, nick_to_base64( target ), buf );
+ }
+}
+
+void send_globops( const char *source, const char *buf )
+{
+ char* b64source;
+ if( !( b64source = server_to_base64( source ) ) ) {
+ b64source = nick_to_base64( source );
+ }
+ send_cmd( "%s %s :%s", b64source, TOK_WALLOPS, buf );
+}
+
+void send_svstime( const char *source, const unsigned long ts )
+{
+ send_cmd( "%s %s %lu", server_to_base64( source ), TOK_SETTIME, ts );
+}
+
+void send_serverrequptime( const char *source, const char *target )
+{
+ send_cmd( "%s %s u :%s", nick_to_base64( source ), TOK_STATS, server_to_base64( target ) );
+}
+
+void send_serverreqversion( const char *source, const char *target )
+{
+ send_cmd( "%s %s %s", server_to_base64( source ), TOK_VERSION, server_to_base64( target ) );
+}
+
+static void m_stats( char *origin, char **argv, int argc, int srv )
+{
+ char* b64origin;
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
+ }
+ do_stats( b64origin, argv[0] );
+}
+
+/* ABAAB V :Bj */
+static void m_version( char *origin, char **argv, int argc, int srv )
+{
+ char* b64origin;
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
+ }
+ do_version( b64origin, base64_to_server( argv[0] ) );
+}
+
+static void m_motd( char *origin, char **argv, int argc, int srv )
+{
+ do_motd( base64_to_nick( origin ), base64_to_server( argv[0] ) );
+}
+
+static void m_admin( char *origin, char **argv, int argc, int srv )
+{
+ do_admin( base64_to_nick( origin ), base64_to_server( argv[0] ) );
+}
+
+/* m_server
+ *
+ * argv[0] = servername
+ * argv[1] = hopcount
+ * argv[2] = start timestamp
+ * argv[3] = link timestamp
+ * argv[4] = major protocol version: P10/P11
+ * argv[5] = YMM, YMMM or YYMMM; where 'YY' is the server numeric and
+ * "MMM" is the numeric nick mask of this server.
+ * argv[6] = 0( not used yet, mandatory unsigned int after u2.10.06 )
+ * argv[argc-1] = serverinfo
+ * NumServ( sptr ) SERVER name hop 0 TSL PROT YxxCap 0 :info
+ */
+/*
+SERVER srvname hop TSBoot TSLink Prot numcap modes :desc
+AB S srvname hop TSBoot TSLink Prot numcap modes :desc
+*/
+static void m_server( char *origin, char **argv, int argc, int srv )
+{
+ if( srv == 2 ) {
+ do_server( argv[0], NULL, argv[1], NULL, argv[argc-1], 0 );
+ } else {
+ do_server( argv[0], base64_to_server( origin ), argv[1], NULL, argv[argc-1], srv );
+ }
+ argv[5][2] = '\0';
+ set_server_base64( argv[0], argv[5] );
+}
+
+/* R: AB SQ mark.local.org 0 :Ping timeout */
+/* R: ABAAV SQ york.gose.org 1076280461 :relink */
+static void m_squit( char *origin, char **argv, int argc, int srv )
+{
+ char* b64arg0;
+ if( ( b64arg0 = base64_to_server( argv[0] ) ) ) {
+ do_squit( b64arg0, argv[2] );
+ } else {
+ do_squit( argv[0], argv[2] );
+ }
+}
+
+static void m_quit( char *origin, char **argv, int argc, int srv )
+{
+ do_quit( base64_to_nick( origin ), argv[0] );
+}
+
+/* R: ABAAE M Mark :+i */
+/* R: ABAAH M #c3 +tn */
+/* R: ABAAG M #chan1 +v ABAAH */
+static void m_mode( char *origin, char **argv, int argc, int srv )
+{
+ char* b64origin;
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
+ }
+ if( argv[0][0] == '#' ) {
+ char **av;
+ int ac = 0;
+ int j = 2;
+ int add = 0;
+ char *modes;
+
+ AddStringToList( &av, argv[0], &ac );
+ modes = argv[1];
+ AddStringToList( &av, argv[1], &ac );
+
+ while( *modes ) {
+ unsigned int mask;
+ unsigned int flags;
+
+ mask = CmodeCharToMask( *modes );
+ flags = CmodeCharToFlags( *modes );
+
+ switch( *modes ) {
+ case '+':
+ add = 1;
+ break;
+ case '-':
+ add = 0;
+ break;
+ default:
+ if( flags&NICKPARAM ) {
+ AddStringToList( &av, base64_to_nick( argv[j] ), &ac );
+ j++;
+ } else if( add ) {
+ if( mask == CMODE_LIMIT ) {
+ AddStringToList( &av, argv[j], &ac );
+ j++;
+ } else if( mask == CMODE_KEY ) {
+ AddStringToList( &av, argv[j], &ac );
+ j++;
+ } else if( flags ) {
+ AddStringToList( &av, argv[j], &ac );
+ j++;
+ }
+ } else {
+ if( mask == CMODE_KEY ) {
+ AddStringToList( &av, argv[j], &ac );
+ j++;
+ }
+ }
+ }
+ modes++;
+ }
+
+ do_mode_channel( b64origin, av, ac );
+ ns_free( av );
+ } else {
+ do_mode_user( argv[0], argv[1] );
+ }
+}
+static void m_kill( char *origin, char **argv, int argc, int srv )
+{
+ char* b64origin;
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
+ }
+ do_kill( b64origin, base64_to_nick( argv[0] ), argv[1] );
+}
+
+static void m_away( char *origin, char **argv, int argc, int srv )
+{
+ char *buf;
+
+ if( argc > 0 ) {
+ buf = joinbuf( argv, argc, 0 );
+ do_away( base64_to_nick( origin ), buf );
+ ns_free( buf );
+ } else {
+ do_away( base64_to_nick( origin ), NULL );
+ }
+}
+
+/*
+1 <nickname>
+2 <hops>
+3 <TS>
+4 <userid>
+5 <host>
+6 [<+modes>]
+7+ [<mode parameters>]
+-3 <base64 IP>
+-2 <numeric>
+-1 <fullname>
+*/
+/* R: AB N Mark 1 1076011621 a xxx.xxx.xxx.xxx DAqO4N ABAAB :M */
+/* R: AB N TheEggMan 1 1076104492 ~eggy 64.XX.XXX.XXX +oiwg BAFtnj ABAAA :eggy */
+/* R: ABAAH N m2 1076077934 */
+/*
+<reed> in a generated burst message, the users must be sorted by the modes: first users w/o modes, then users with voice, then with op, then with op+voice: num,num:v,num:o,num:ov
+*/
+
+static void m_nick( char *origin, char **argv, int argc, int srv )
+{
+ if( argc > 2 ) {
+ char IPAddress[32];
+ unsigned long IP;
+ const char *modes;
+ const char *modeptr;
+ const char *account = NULL;
+ const char *sethost = NULL;
+ const char *fakehost = NULL;
+ int param;
+
+ modes =( argv[5][0] == '+' ) ? argv[5]: NULL;
+ if( modes ) {
+ param = 6;
+ for( modeptr = modes; *modeptr; ++modeptr ) {
+ switch( *modeptr ) {
+ case 'r':
+ account = argv[param++];
+ break;
+ case 'h':
+ sethost = argv[param++];
+ break;
+ case 'f':
+ fakehost = argv[param++];
+ break;
+ default:
+ break;
+ } /* switch( *modeptr ) */
+ } /* for( ) */
+ } /* if( modes ) */
+
+ IP = htonl( base64toIP( argv[argc-3] ) );
+ ircsnprintf( IPAddress, 32, "%lu", IP );
+
+ /* nick, hopcount, TS, user, host, */
+ do_nick( argv[0], argv[1], argv[2], argv[3], argv[4],
+ /* server, ip, servicestamp, modes, */
+ base64_to_server( origin ), IPAddress, NULL, modes,
+ /* vhost, realname, numeric, smodes */
+ fakehost, argv[argc-1], argv[argc-2], NULL );
+ } else {
+ do_nickchange( base64_to_nick( origin ), argv[0], argv[1] );
+ }
+}
+
+static void m_topic( char *origin, char **argv, int argc, int srv )
+{
+ char* b64origin;
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
+ }
+ do_topic( argv[0], b64origin, NULL, argv[argc-1] );
+}
+
+static void m_kick( char *origin, char **argv, int argc, int srv )
+{
+ char* b64origin;
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
+ }
+ do_kick( b64origin, argv[0], base64_to_nick( argv[1] ), argv[2] );
+}
+
+/* R: ABAAE C #chan 1076069009 */
+static void m_create( char *origin, char **argv, int argc, int srv )
+{
+ do_join( base64_to_nick( origin ), argv[0], argv[1] );
+}
+
+static void m_join( char *origin, char **argv, int argc, int srv )
+{
+ do_join( base64_to_nick( origin ), argv[0], argv[1] );
+}
+
+static void m_part( char *origin, char **argv, int argc, int srv )
+{
+ do_part( base64_to_nick( origin ), argv[0], argv[1] );
+}
+
+static void m_ping( char *origin, char **argv, int argc, int srv )
+{
+ do_ping( base64_to_server( origin ), argv[1] );
+}
+
+/* R: AB G !1076065765.431368 stats.mark.net 1076065765.431368 */
+static void m_pong( char *origin, char **argv, int argc, int srv )
+{
+ do_pong( base64_to_server( origin ), argv[1] );
+}
+
+/*
+1 <channel>
+2 <timestamp>
+3+ [<modes> [<mode extra parameters>]] [<users>] [<bans>]
+*/
+/* R: AB B #chan 1076064445 ABAAA:o */
+/* R: AB B #c3 1076083205 +tn ABAAH:o */
+/*
+ * parv[0] = channel name
+ * parv[1] = channel timestamp
+ * The meaning of the following parv[]'s depend on their first character:
+ * If parv[n] starts with a '+':
+ * Net burst, additive modes
+ * parv[n] = <mode>
+ * parv[n+1] = <param>( optional )
+ * parv[n+2] = <param>( optional )
+ * If parv[n] starts with a '%', then n will be parc-1:
+ * parv[n] = %<ban> <ban> <ban> ...
+ * If parv[n] starts with another character:
+ * parv[n] = <nick>[:<mode>],<nick>[:<mode>],...
+ * where <mode> is the channel mode( ov ) of nick and all following nicks.
+ *
+ * Example:
+ * "S BURST #channel 87654321 +ntkl key 123 AAA,AAB:o,BAA,BAB:ov :%ban1 ban2"
+*/
+
+static char ircd_buf[BUFSIZE];
+
+static void m_burst( char *origin, char **argv, int argc, int srv )
+{
+ int param;
+
+ /* IRCu passes this information in a stupid order so we must first
+ * find and process clients and ignore modes to "create" the channel
+ * then process modes and ignore clients - look into better system for NS2.6
+ */
+ param = 2;
+ while( param < argc ) {
+ switch( argv[param][0] ) {
+ case '+': /* mode string */
+ {
+ char *modes;
+
+ modes = argv[param];
+ param++;
+ modes++;
+ while( *modes ) {
+ if( CmodeCharToFlags( *modes ) & MODEPARAM ) {
+ param ++;
+ }
+ modes++;
+ }
+ break;
+ }
+ case '%': /* bans */
+ /* ignored for now */
+ param++;
+ break;
+ case '~': /* ban exceptions */
+ /* ignored for now */
+ param++;
+ break;
+ default: /* clients */
+ {
+ char *s, *t;
+ char modechar = 0;
+
+ t =( char* )argv[param];
+ while( *( s = t ) ) {
+ t = s + strcspn( s, "," );
+ if( *t )
+ *t++ = 0;
+ do_join( base64_to_nick( s ), argv[0], NULL );
+ if( s[5] == ':' ) {
+ modechar = s[6];
+ }
+ if( modechar ) {
+ char **av;
+ int ac;
+ ircsnprintf( ircd_buf, BUFSIZE, "%s +%c %s", argv[0], modechar, base64_to_nick( s ) );
+ ac = split_buf( ircd_buf, &av, 0 );
+ do_mode_channel( me.name, av, ac );
+ ns_free( av );
+ }
+ }
+ param++;
+ break;
+ }
+ }
+ }
+
+ param = 2;
+ while( param < argc ) {
+ switch( argv[param][0] ) {
+ case '+': /* mode string */
+ {
+ char *modes;
+
+ modes = argv[param];
+ param++;
+ modes++;
+ while( *modes ) {
+ char **av;
+ int ac;
+
+ if( CmodeCharToFlags( *modes ) & MODEPARAM ) {
+ ircsnprintf( ircd_buf, BUFSIZE, "%s +%c %s", argv[0], *modes, argv[param] );
+ param ++;
+ } else {
+ ircsnprintf( ircd_buf, BUFSIZE, "%s +%c", argv[0], *modes );
+ }
+ ac = split_buf( ircd_buf, &av, 0 );
+ do_mode_channel( me.name, av, ac );
+ ns_free( av );
+ modes++;
+ }
+ break;
+ }
+ case '%': /* bans */
+ /* ignored for now */
+ param++;
+ break;
+ case '~': /* ban exceptions */
+ /* ignored for now */
+ param++;
+ break;
+ default: /* clients */
+ {
+ param++;
+ break;
+ }
+ }
+ }
+}
+
+static void m_end_of_burst( char *origin, char **argv, int argc, int srv )
+{
+ if( ircstrcasecmp( base64_to_server( origin ), me.uplink ) == 0 ) {
+ send_end_of_burst_ack( );
+ }
+}
+
+static void m_end_of_burst_ack( char *origin, char **argv, int argc, int srv )
+{
+ return;
+}
+
+static void m_wallusers( char *origin, char **argv, int argc, int srv )
+{
+ char* b64origin;
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
+ }
+ do_wallops( b64origin, argv[0] );
+}
+
+static void m_wallops( char *origin, char **argv, int argc, int srv )
+{
+ char* b64origin;
+ if( !( b64origin = base64_to_nick( origin ) ) ) {
+ b64origin = base64_to_server( origin );
+ }
+ do_globops( b64origin, argv[0] );
+}
+
+/* m_svsnick
+ * argv[0] = old nickname
+ * argv[1] = new nickname
+ * argv[2] = timestamp
+ */
+static void m_svsnick( char *origin, char **argv, int argc, int srv )
+{
+ do_nickchange( base64_to_nick( argv[0] ), argv[1], argv[2] );
+}
+
+static void m_svsjoin( char *origin, char **argv, int argc, int srv )
+{
+ do_join( base64_to_nick( argv[0] ), argv[1], argv[2] );
+}
+
+static void m_svspart( char *origin, char **argv, int argc, int srv )
+{
+ do_part( base64_to_nick( argv[0] ), argv[1], argv[2] );
+}
+
+/* m_whois
+ * argv[0] = nickname masklist
+ */
+static void m_whois( char *origin, char **argv, int argc, int srv )
+{
+ /* TODO */
+}
+
+/* m_swhois
+ * argv[0] = nickname
+ * argv[1] = new swhois
+ */
+static void m_swhois( char *origin, char **argv, int argc, int srv )
+{
+ do_swhois( base64_to_nick( argv[0] ), argv[1] );
+}
+
+static void m_vhost( char *origin, char **argv, int argc, int srv )
+{
+ do_vhost( base64_to_nick( argv[0] ), argv[1] );
+}
+
+static void m_numeric242( char *origin, char **argv, int argc, int srv )
+{
+ _m_numeric242( base64_to_server( origin ), argv, argc, srv );
+}
+
+static void m_numeric351( char *origin, char **argv, int argc, int srv )
+{
+ _m_numeric351( base64_to_server( origin ), argv, argc, srv );
+}
+
+/* :<source> <command> <param1> <paramN> :<last parameter> */
+/* <source> <command> <param1> <paramN> :<last parameter> */
+int parse( void *notused, void *rline, size_t len )
+{
+ char origin[64], cmd[64], *coreLine;
+ char *line =( char * )rline;
+ int cmdptr = 0;
+ int ac = 0;
+ char **av = NULL;
+
+ SET_SEGV_LOCATION( );
+ if( !( *line ) )
+ return NS_FAILURE;
+ dlog( DEBUG1, "------------------------BEGIN PARSE-------------------------" );
+ dlog( DEBUGRX, "%s", line );
+ coreLine = strpbrk( line, " " );
+ if( coreLine ) {
+ *coreLine = 0;
+ while( isspace( *++coreLine ) );
+ } else
+ coreLine = line + strlen( line );
+ if( ( !ircstrcasecmp( line, "SERVER" ) ) ||( !ircstrcasecmp( line, "PASS" ) ) ) {
+ strlcpy( cmd, line, sizeof( cmd ) );
+ dlog( DEBUG1, "cmd : %s", cmd );
+ dlog( DEBUG1, "args : %s", coreLine );
+ ac = ircsplitbuf( coreLine, &av, 1 );
+ cmdptr = 2;
+ dlog( DEBUG1, "0 %d", ac );
+ /* really needs to be in AddServer since this is a NeoStats wide bug
+ if config uplink name does not match our uplinks server name we can
+ never find the uplink!
+ */
+ if( strcmp( cmd, "SERVER" ) == 0 ) {
+ strlcpy( me.uplink, av[0], MAXHOST );
+ }
+ } else {
+ strlcpy( origin, line, sizeof( origin ) );
+ cmdptr = 0;
+ line = strpbrk( coreLine, " " );
+ if( line ) {
+ *line = 0;
+ while( isspace( *++line ) );
+ } /*else
+ coreLine = line + strlen( line );*/
+ strlcpy( cmd, coreLine, sizeof( cmd ) );
+ dlog( DEBUG1, "origin: %s", origin );
+ dlog( DEBUG1, "cmd : %s", cmd );
+ dlog( DEBUG1, "args : %s", line );
+ if( line ) {
+ ac = ircsplitbuf( line, &av, 1 );
+ }
+ dlog( DEBUG1, "0 %d", ac );
+ }
+ process_ircd_cmd( cmdptr, cmd, origin, av, ac );
+ ns_free( av );
+ dlog( DEBUG1, "-------------------------END PARSE--------------------------" );
+ return NS_SUCCESS;
+}
+
+static void m_private( char *origin, char **argv, int argc, int srv )
+{
+ char **av;
+ int ac = 0;
+ int i;
+ char* av0;
+
+ if( argv[0][0] == '#' ) {
+ av0 = argv[0];
+ } else {
+ av0 = base64_to_nick( argv[0] );
+ /* In case a real nick came through*/
+ if( av0 == NULL ) {
+ av0 = argv[0];
+ }
+ }
+ AddStringToList( &av, av0, &ac );
+ for( i = 1; i < argc; i++ ) {
+ AddStringToList( &av, argv[i], &ac );
+ }
+ _m_private( base64_to_nick( origin ), av, ac, srv );
+ ns_free( av );
+}
+
+static void m_notice( char *origin, char **argv, int argc, int srv )
+{
+ char **av;
+ int ac = 0;
+ int i;
+ char* av0;
+
+ if( argv[0][0] == '#' ) {
+ av0 = argv[0];
+ } else {
+ av0 = base64_to_nick( argv[0] );
+ /* In case a real nick came through*/
+ if( av0 == NULL ) {
+ av0 = argv[0];
+ }
+ }
+ AddStringToList( &av, av0, &ac );
+ for( i = 1; i < argc; i++ ) {
+ AddStringToList( &av, argv[i], &ac );
+ }
+ _m_notice( base64_to_nick( origin ), av, ac, srv );
+ ns_free( av );
+}
Added: trunk/src/protocol/nefarious.vcproj
==============================================================================
--- (empty file)
+++ trunk/src/protocol/nefarious.vcproj Tue Apr 19 05:53:21 2005
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="nefarious"
+ ProjectGUID="{B6701C0A-27E3-468D-8473-FBE671989E33}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\include;..\..\lib\curl;..\..\lib\pcre"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;nefarious_EXPORTS"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Ws2_32.lib neostats.lib"
+ OutputFile="../../modules/nefariousd.dll"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="..\debug"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/nefarious.pdb"
+ SubSystem="2"
+ ImportLibrary="$(OutDir)/nefarious.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include;..\..\lib\curl;..\..\lib\pcre"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;nefarious_EXPORTS"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Ws2_32.lib neostats.lib"
+ OutputFile="../../modules/nefarious.dll"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../release"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ ImportLibrary="$(OutDir)/nefarious.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath="nefarious.c">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Modified: trunk/src/protocol/protocol.txt
==============================================================================
--- trunk/src/protocol/protocol.txt (original)
+++ trunk/src/protocol/protocol.txt Tue Apr 19 05:53:21 2005
@@ -74,7 +74,8 @@
This is required to instruct NeoStats how to use certain elements of the
protocol module. An example follows:
-ProtocolInfo protocol_info = {
+ProtocolInfo protocol_info =
+{
/* Required protocol options */
PROTOCOL_SJOIN,
/* Protocol options negotiated at link */
@@ -107,7 +108,8 @@
This is parsed by NeoStats when we receive a message from an IRC server
in order to handle the message and is formatted as follows.
-ircd_cmd cmd_list[] = {
+ircd_cmd cmd_list[] =
+{
/*Message Token Function usage */
{MSG_PRIVATE, TOK_PRIVATE, _m_private, 0},
{0, 0, 0, 0},
@@ -133,22 +135,26 @@
Mode tables are defined as follows:
-mode_init chan_umodes[] = {
+mode_init chan_umodes[] =
+{
{'v', CUMODE_VOICE, 0, '+'},
{0, 0, 0},
};
-mode_init chan_modes[] = {
+mode_init chan_modes[] =
+{
{'p', CMODE_PRIVATE, 0},
{0, 0, 0},
};
-mode_init user_umodes[] = {
+mode_init user_umodes[] =
+{
{'r', UMODE_REGNICK},
{0, 0, 0},
};
-mode_init user_smodes[] = {
+mode_init user_smodes[] =
+{
{'s', SMODE_SSL},
{0, 0, 0},
};