[NeoStats-Devel] [Commits] r2706 - trunk/modules/quoteserv

[email protected] Sat, 13 Aug 2005 01:41:33 +1000
Newsgroups gmane.comp.neostats.devel
Message-ID <[email protected]>
Author: Fish
Date: Fri Aug 12 23:41:26 2005
New Revision: 2706

Modified:
   trunk/modules/quoteserv/help.c
   trunk/modules/quoteserv/main.c
Log:
make quoteserv optionally take a database target

Modified: trunk/modules/quoteserv/help.c
==============================================================================
--- trunk/modules/quoteserv/help.c	(original)
+++ trunk/modules/quoteserv/help.c	Fri Aug 12 23:41:26 2005
@@ -56,7 +56,7 @@
 
 const char *qs_help_quote[] = {
 	"Fetch quote",
-	"Syntax: \2QUOTE\2",
+	"Syntax: \2QUOTE <optional database>\2",
 	"",
 	"Get quote.",
 	NULL

Modified: trunk/modules/quoteserv/main.c
==============================================================================
--- trunk/modules/quoteserv/main.c	(original)
+++ trunk/modules/quoteserv/main.c	Fri Aug 12 23:41:26 2005
@@ -87,7 +87,7 @@
 	{"ADD",		qs_cmd_add,	1,	NS_ULEVEL_ADMIN,	qs_help_add},
 	{"DEL",		qs_cmd_del,	1, 	NS_ULEVEL_ADMIN,	qs_help_del},
 	{"LIST",		qs_cmd_list,	0, 	NS_ULEVEL_ADMIN,	qs_help_list},
-	{"QUOTE",	qs_cmd_quote,	1, 	0,		qs_help_quote},
+	{"QUOTE",	qs_cmd_quote,	0, 	0,		qs_help_quote},
 	{NULL,		NULL,		0, 	0,		NULL}
 };
 
@@ -375,7 +375,7 @@
 	int randno;
 	
 	SET_SEGV_LOCATION();
-	if( ircstrcasecmp( which, "random" ) == 0 )
+	if((which) && ( ircstrcasecmp( which, "random" ) == 0 ))
 	{
 		hnode_t *hn;
 		hscan_t hs;
@@ -444,7 +444,7 @@
 
 static int qs_cmd_quote( CmdParams* cmdparams )
 {
-	return do_quote( cmdparams->source, cmdparams->av[0], 1 );
+	return do_quote( cmdparams->source, cmdparams->ac >= 1 ? cmdparams->av[0] : NULL, 1 );
 }
 
 /** @brief event_signon