[NeoStats-Devel] [Commits] r2727 - trunk/src

[email protected] Sun, 14 Aug 2005 08:01:43 +1000
Newsgroups gmane.comp.neostats.devel
Message-ID <[email protected]>
Author: Mark
Date: Sun Aug 14 06:01:41 2005
New Revision: 2727

Modified:
   trunk/src/conf.c
   trunk/src/ctcp.c
Log:
Tidy up config error messages and restore CTCP module API

Modified: trunk/src/conf.c
==============================================================================
--- trunk/src/conf.c	(original)
+++ trunk/src/conf.c	Sun Aug 14 06:01:41 2005
@@ -144,7 +144,7 @@
 	int i, ret;
 
 	/* Read in the Config File */
-	printf ("Reading the Config File. Please wait.....\n");
+	printf ("Reading the Config File. Please wait ...\n");
 	cfg = cfg_init (fileconfig, CFGF_NOCASE);
 	for (i = 0; i < ARRAYLEN (arg_validate); i++) {
 		cfg_set_validate_func (cfg, arg_validate[i].name, arg_validate[i].cb);
@@ -170,7 +170,6 @@
 		cfg_free (cfg);
 		return NS_FAILURE;
 	}
-	printf ("-----------------------------------------------\n");
 	set_config_values (cfg);
 	cfg_free (cfg);
 	printf ("Sucessfully loaded config file, booting NeoStats\n");
@@ -392,26 +391,26 @@
 int cb_verify_file( cfg_t *cfg, cfg_opt_t *opt )
 {
 	char *file = opt->values[0]->string;
-	char buf2[MAXPATH];
-	struct stat buf;
+	static char buf[MAXPATH];
+	struct stat fileinfo;
 
-	ircsnprintf( buf2, MAXPATH, "%s/%s%s", MOD_PATH, file, MOD_STDEXT );
-	if( stat( buf2, &buf ) == -1 )
+	ircsnprintf( buf, MAXPATH, "%s/%s%s", MOD_PATH, file, MOD_STDEXT );
+	if( stat( buf, &fileinfo ) == -1 )
 	{
 #ifdef USE_PERL
-		ircsnprintf( buf2, MAXPATH, "%s/%s%s", MOD_PATH, file, MOD_PERLEXT );
-		if( stat( buf2, &buf ) == -1 )
+		ircsnprintf( buf, MAXPATH, "%s/%s%s", MOD_PATH, file, MOD_PERLEXT );
+		if( stat( buf, &fileinfo ) == -1 )
 		{
 #endif
-			cfg_error( cfg, "File %s Specified in Option %s is Invalid: %s", buf2, opt->name, strerror( errno ) );
+			cfg_error( cfg, "Unable to find file %s specified in option %s: %s", buf, opt->name, strerror( errno ) );
 			return CFG_PARSE_ERROR;
 #ifdef USE_PERL
 		}
 #endif
 	}
-	if( !S_ISREG( buf.st_mode ) )
+	if( !S_ISREG( fileinfo.st_mode ) )
 	{
-		cfg_error( cfg, "File %s Specified in Option %s is Invalid: Not a Regular File", buf2, opt->name );
+		cfg_error( cfg, "File %s specified in option %s is not a regular file", buf, opt->name );
 		return CFG_PARSE_ERROR;
 	}
 	return CFG_SUCCESS;

Modified: trunk/src/ctcp.c
==============================================================================
--- trunk/src/ctcp.c	(original)
+++ trunk/src/ctcp.c	Sun Aug 14 06:01:41 2005
@@ -141,8 +141,8 @@
 static int ctcp_rpl_version( CmdParams* cmdparams )
 {
 	dlog( DEBUG5, "RX: CTCP VERSION reply from %s to %s", cmdparams->source->name, cmdparams->bot->name );
-	/* because all modules might be interested */
-	SendAllModuleEvent( EVENT_CTCPVERSIONRPL, cmdparams);
+	/*SendAllModuleEvent( EVENT_CTCPVERSIONRPL, cmdparams);*/
+	SendModuleEvent( EVENT_CTCPVERSIONRPL, cmdparams, cmdparams->bot->moduleptr );
 	return NS_SUCCESS;
 }
 
@@ -163,7 +163,8 @@
 static int ctcp_rpl_finger( CmdParams* cmdparams )
 {
 	dlog( DEBUG5, "RX: CTCP FINGER reply from %s to %s", cmdparams->source->name, cmdparams->bot->name );
-	SendAllModuleEvent( EVENT_CTCPFINGERRPL, cmdparams);
+	/*SendAllModuleEvent( EVENT_CTCPFINGERRPL, cmdparams);*/
+	SendModuleEvent( EVENT_CTCPFINGERRPL, cmdparams, cmdparams->bot->moduleptr );
 	return NS_SUCCESS;
 }
 
@@ -219,7 +220,8 @@
 static int ctcp_rpl_time( CmdParams* cmdparams )
 {
 	dlog( DEBUG5, "RX: CTCP TIME reply from %s to %s", cmdparams->source->name, cmdparams->bot->name );
-	SendAllModuleEvent( EVENT_CTCPTIMERPL, cmdparams);
+	/*SendAllModuleEvent( EVENT_CTCPTIMERPL, cmdparams);*/
+	SendModuleEvent( EVENT_CTCPTIMERPL, cmdparams, cmdparams->bot->moduleptr );
 	return NS_SUCCESS;
 }
 
@@ -240,7 +242,8 @@
 static int ctcp_rpl_ping( CmdParams* cmdparams )
 {
 	dlog( DEBUG5, "RX: CTCP PING reply from %s to %s", cmdparams->source->name, cmdparams->bot->name );
-	SendAllModuleEvent( EVENT_CTCPPINGRPL, cmdparams);
+	/*SendAllModuleEvent( EVENT_CTCPPINGRPL, cmdparams);*/
+	SendModuleEvent( EVENT_CTCPPINGRPL, cmdparams, cmdparams->bot->moduleptr );
 	return NS_SUCCESS;
 }