[NeoStats-Devel] [Commits] r2496 - in trunk: . include src

[email protected]
Newsgroups gmane.comp.neostats.devel
Message-ID <[email protected]>
Author: Mark
Date: Sun Apr 10 03:20:25 2005
New Revision: 2496

Modified:
   trunk/ChangeLog
   trunk/include/ircd.h
   trunk/include/numerics.h
   trunk/src/ircd.c
   trunk/src/numerics.c
Log:
Add support for IRCd protocol modules to make server version requests

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	(original)
+++ trunk/ChangeLog	Sun Apr 10 03:20:25 2005
@@ -4,9 +4,10 @@
 Fish (F), Mark (M), DeadNotBuried (D)
 ===============================================================================
 * NeoStats * Version 3.0.a3-dev
+ - Add support for IRCd protocol modules to make server version requests. (M)
  - Add support for IRCd protocol modules to call core numeric reply 
    handlers. (M)
- - Add support for IRCd protocol modules to control server uptime requests. (M)
+ - Add support for IRCd protocol modules to make server uptime requests. (M)
  - Merge ADNS lib into core. (M)
  - add random channel member funtion (D)
  - Fix Win32 text output for log files. (M)

Modified: trunk/include/ircd.h
==============================================================================
--- trunk/include/ircd.h	(original)
+++ trunk/include/ircd.h	Sun Apr 10 03:20:25 2005
@@ -226,6 +226,7 @@
 MODULEFUNC void send_sethost( const char *nick, const char *host );
 MODULEFUNC void send_setident( const char *nick, const char *ident );
 MODULEFUNC void send_serverrequptime( const char *source, const char *target );
+MODULEFUNC void send_serverreqversion( const char *source, const char *target );
 
 MODULEFUNC void cloakhost(  char *host  );
 

Modified: trunk/include/numerics.h
==============================================================================
--- trunk/include/numerics.h	(original)
+++ trunk/include/numerics.h	Sun Apr 10 03:20:25 2005
@@ -28,5 +28,6 @@
 
 void m_numeric242( char *origin, char **argv, int argc, int srv );
 void m_numeric351( char *origin, char **argv, int argc, int srv );
+void m_numericdefault( char *origin, char **argv, int argc, int srv );
 
 #endif /* _NUMERICS_H_ */

Modified: trunk/src/ircd.c
==============================================================================
--- trunk/src/ircd.c	(original)
+++ trunk/src/ircd.c	Sun Apr 10 03:20:25 2005
@@ -120,6 +120,7 @@
 static void( *irc_send_sethost )( const char* nick, const char* host );
 static void( *irc_send_setident )( const char* nick, const char* ident );
 static void( *irc_send_serverrequptime )( const char *source, const char *target );
+static void( *irc_send_serverreqversion )( const char *source, const char *target );
 
 static void( *irc_send_cloakhost )( char* host );
 
@@ -183,6 +184,7 @@
 	{( void * )&irc_send_setident, "send_setident", 0, 0},
 	{( void * )&irc_send_cloakhost, "cloakhost", 0, 0},
 	{( void * )&irc_send_serverrequptime, "send_serverrequptime", 0, 0},
+	{( void * )&irc_send_serverreqversion, "send_serverreqversion", 0, 0},
 	{NULL, NULL, 0, 0},
 };
 
@@ -1857,6 +1859,19 @@
 	return NS_SUCCESS;
 }
 
+/** @brief irc_serverreqversion
+ *
+ *  @return NS_SUCCESS if succeeds, NS_FAILURE if not 
+ */
+
+int irc_serverreqversion( const char *source, const char *target )
+{
+	if( irc_send_serverreqversion )
+		irc_send_serverreqversion( source, target );
+	else
+		send_cmd( ":%s VERSION %s", source, target );
+	return NS_SUCCESS;
+}
 
 /** @brief irc_squit
  *
@@ -2662,7 +2677,7 @@
 	} else {
 		AddServer( name, uplink, hops, numeric, infoline );
 	}
-	send_cmd( ":%s VERSION %s", me.name, name );
+	irc_serverreqversion( me.name, name );
 }
 
 /** @brief 

Modified: trunk/src/numerics.c
==============================================================================
--- trunk/src/numerics.c	(original)
+++ trunk/src/numerics.c	Sun Apr 10 03:20:25 2005
@@ -29,11 +29,12 @@
 	/*Message	Token	handler	usage */
 	{"351", "351", m_numeric351, 0},
 	{"242", "242", m_numeric242, 0},
+/*  RX: :irc.foo.com 219 NeoStats u :End of /STATS report */
+	{"219", "219", m_numericdefault, 0},
 	{0, 0, 0, 0},
 };
 
 /*  RX: :irc.foo.com 250 NeoStats :Highest connection count: 3( 2 clients )
- *  RX: :irc.foo.com 219 NeoStats u :End of /STATS report
  */
 
 /** @brief m_numeric351
@@ -78,28 +79,28 @@
 
 	s = FindServer( origin );
 	if( s ) {
-		/* Convert "Server Up 6 days, 23:52:55" to seconds*/
+		/* Convert "Server Up d days, hh:mm:ss" to seconds*/
 		char *ptr;
 		time_t secs;
 
-		/* Server Up 6 days, 23:52:55 */
+		/* current string: "Server Up d days, hh:mm:ss" */
 		strtok( argv[argc-1], " " );
-		/* Up 6 days, 23:52:55 */
+		/* current string: "Up d days, hh:mm:ss" */
 		strtok( NULL, " " );
-		/* 6 days, 23:52:55 */
+		/* current string: "d days, hh:mm:ss" */
 		ptr = strtok( NULL, " " );
 		secs = atoi( ptr ) * 86400;
-		/* days, 23:52:55 */
+		/* current string: "days, hh:mm:ss" */
 		strtok( NULL, " " );
-		/* , 23:52:55 */
+		/* current string: ", hh:mm:ss" */
 		ptr = strtok( NULL, "" );
-		/* 23:52:55 */
+		/* current string: "hh:mm:ss" */
 		ptr = strtok( ptr , ":" );
 		secs += atoi( ptr )*3600;
-		/* 52:55 */
+		/* current string: "mm:ss" */
 		ptr = strtok( NULL, ":" );
 		secs += atoi( ptr )*60;
-		/* 55 */
+		/* current string: "ss" */
 		ptr = strtok( NULL, "" );
 		secs += atoi( ptr );
 
@@ -107,3 +108,21 @@
 	}
 }
 
+/** @brief m_numericdefault
+ *
+ *  dummy routine to "process" a numeric and avoid warnings for 
+ *  unprocessed numerics. This mainly allows us to ignore end
+ *  of list type numerics without having to specficially code them
+ *  RX: :irc.foo.com nnn to :message
+ *
+ *  @param origin source of message (user/server)
+ *  @param av list of message parameters
+ *  @param ac parameter count
+ *  @param cmdptr command flag
+ *
+ *  @return none
+ */
+
+void m_numericdefault( char *origin, char **argv, int argc, int srv )
+{
+}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.