[NeoStats-Devel] [Commits] r2747 - in trunk: include modules/extauth modules/ircdauth modules/protocol modules/template modules/templateauth src

[email protected] Fri, 19 Aug 2005 07:01:31 +1000
Newsgroups gmane.comp.neostats.devel
Message-ID <[email protected]>
Author: Mark
Date: Fri Aug 19 05:01:25 2005
New Revision: 2747

Modified:
   trunk/include/commands.h
   trunk/include/exclude.h
   trunk/include/neostats.h
   trunk/include/settings.h
   trunk/modules/extauth/extauth.c
   trunk/modules/ircdauth/ircdauth.c
   trunk/modules/protocol/unreal32.c
   trunk/modules/template/main.c
   trunk/modules/templateauth/main.c
   trunk/src/commands.c
   trunk/src/exclude.c
Log:
const fixes and some include tidy ups

Modified: trunk/include/commands.h
==============================================================================
--- trunk/include/commands.h	(original)
+++ trunk/include/commands.h	Fri Aug 19 05:01:25 2005
@@ -24,14 +24,12 @@
 #ifndef _COMMANDS_H_
 #define _COMMANDS_H_
 
-int add_bot_cmd_list( Bot *bot_ptr, bot_cmd *bot_cmd_list );
-int del_bot_cmd_list( Bot *bot_ptr, bot_cmd *bot_cmd_list );
 int del_all_bot_cmds( Bot* bot_ptr );
 int add_bot_cmd( hash_t *cmd_hash, bot_cmd *cmd_ptr );
 bot_cmd *find_bot_cmd( Bot *bot_ptr, char *cmd);
 int del_bot_cmd( hash_t *cmd_hash, bot_cmd *cmd_ptr );
 int run_bot_cmd( CmdParams * cmdparams, int ischancmd );
-int getuserlevel( CmdParams *cmdparams );
+int getuserlevel( const CmdParams *cmdparams );
 void msg_permission_denied( CmdParams *cmdparams, char *subcommand );
 void msg_error_need_more_params( CmdParams *cmdparams );
 void msg_error_param_out_of_range( CmdParams *cmdparams );

Modified: trunk/include/exclude.h
==============================================================================
--- trunk/include/exclude.h	(original)
+++ trunk/include/exclude.h	Fri Aug 19 05:01:25 2005
@@ -33,6 +33,6 @@
 void ns_do_exclude_chan( Channel *c );
 void ns_do_exclude_server( Client *s );
 void ns_do_exclude_user( Client *u );
-int ns_cmd_exclude( CmdParams* cmdparams );
+int ns_cmd_exclude( const CmdParams *cmdparams );
 
 #endif /* _EXCLUDE_H_ */

Modified: trunk/include/neostats.h
==============================================================================
--- trunk/include/neostats.h	(original)
+++ trunk/include/neostats.h	Fri Aug 19 05:01:25 2005
@@ -1340,7 +1340,7 @@
 EXPORTFUNC int add_bot_setting_list( Bot *bot_ptr, bot_setting *bot_setting_list );
 EXPORTFUNC int del_bot_setting_list( Bot *bot_ptr, bot_setting *bot_setting_list );
 
-EXPORTFUNC Client *FindValidUser( Bot *botptr, Client *u, const char *target_nick );
+EXPORTFUNC Client *FindValidUser( const Bot *botptr, const Client *u, const char *target_nick );
 
 /* transfer.c stuff */
 typedef void (transfer_callback) ( void *data, int returncode, char *body, int bodysize );
@@ -1384,7 +1384,7 @@
 EXPORTFUNC int DBAStore( const char *table, char *key, void *data, int size );
 EXPORTFUNC int DBAFetch( const char *table, char *key, void *data, int size );
 EXPORTFUNC int DBADelete( const char *table, char * key );
-EXPORTFUNC int DBAFetchRows( const char * table, DBRowHandler handler );
+EXPORTFUNC int DBAFetchRows( const char *table, DBRowHandler handler );
 /* DB API Macros to wrap common types */
 #define DBAStoreBool( table, key, data ) DBAStore( table, key, ( void* )data, sizeof ( int ) )
 #define DBAStoreInt( table, key, data ) DBAStore( table, key, ( void* )data, sizeof ( int ) )
@@ -1534,20 +1534,20 @@
 /* Socket functions */
 EXPORTFUNC int os_sock_close( OS_SOCKET sock );
 EXPORTFUNC int os_sock_write( OS_SOCKET s, const char *buf, int len );
-EXPORTFUNC int os_sock_sendto( OS_SOCKET s, const char* buf, int len, int flags, const struct sockaddr* to, int tolen );
+EXPORTFUNC int os_sock_sendto( OS_SOCKET s, const char *buf, int len, int flags, const struct sockaddr* to, int tolen );
 EXPORTFUNC int os_sock_read( OS_SOCKET s, char *buf, int len );
-EXPORTFUNC int os_sock_recvfrom( OS_SOCKET s, char* buf, int len, int flags, struct sockaddr* from, int *fromlen );
+EXPORTFUNC int os_sock_recvfrom( OS_SOCKET s, char* buf, int len, int flags, struct sockaddr *from, int *fromlen );
 EXPORTFUNC int os_sock_set_nonblocking( OS_SOCKET s );
 EXPORTFUNC int os_sock_connect( OS_SOCKET s, const struct sockaddr* name, int namelen );
 EXPORTFUNC OS_SOCKET os_sock_socket( int socket_family, int socket_type, int protocol );
 EXPORTFUNC int os_sock_bind( OS_SOCKET s, const struct sockaddr* name, int namelen );
 EXPORTFUNC int os_sock_listen( OS_SOCKET s, int backlog );
-EXPORTFUNC int os_sock_setsockopt( OS_SOCKET s, int level, int optname, const char* optval, int optlen );
-EXPORTFUNC int os_sock_ioctl( OS_SOCKET s, int cmd, void* argp );
+EXPORTFUNC int os_sock_setsockopt( OS_SOCKET s, int level, int optname, const char *optval, int optlen );
+EXPORTFUNC int os_sock_ioctl( OS_SOCKET s, int cmd, void *argp );
 EXPORTVAR int os_sock_errno;
 EXPORTFUNC char *os_sock_getlasterrorstring( void );
 EXPORTFUNC char *os_sock_strerror( const int sockerrno );
-EXPORTFUNC int os_sock_select( int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, struct timeval* timeout );
+EXPORTFUNC int os_sock_select( int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout );
 
 /* Memory functions */
 EXPORTFUNC void *os_memset( void *dest, int c, size_t count );
@@ -1582,11 +1582,11 @@
 /* Module event interface */
 MODULEVAR extern ModuleEvent module_events[];  
 /* Module auth interface */
-MODULEFUNC int ModAuthUser( Client *u );
+MODULEFUNC int ModAuthUser( const Client *u );
 /* Module exclude interface */
-EXPORTFUNC int ModIsServerExcluded( Client *s );
-EXPORTFUNC int ModIsUserExcluded( Client *u );
-EXPORTFUNC int ModIsChannelExcluded( Channel *c );
+EXPORTFUNC int ModIsServerExcluded( const Client *s );
+EXPORTFUNC int ModIsUserExcluded( const Client *u );
+EXPORTFUNC int ModIsChannelExcluded( const Channel *c );
 
 /* Module data pointer interface */
 /* Module data pointer interface channel */

Modified: trunk/include/settings.h
==============================================================================
--- trunk/include/settings.h	(original)
+++ trunk/include/settings.h	Fri Aug 19 05:01:25 2005
@@ -24,9 +24,7 @@
 #ifndef _SETTINGS_H_
 #define _SETTINGS_H_
 
-int add_bot_setting_list( Bot *bot_ptr, bot_setting *bot_setting_list );
-int del_bot_setting_list( Bot *bot_ptr, bot_setting *bot_setting_list );
-int del_all_bot_settings( Bot* bot_ptr );
+int del_all_bot_settings( Bot *bot_ptr );
 int bot_cmd_set( CmdParams *cmdparams );
 
 #endif /* _SETTINGS_H_ */

Modified: trunk/modules/extauth/extauth.c
==============================================================================
--- trunk/modules/extauth/extauth.c	(original)
+++ trunk/modules/extauth/extauth.c	Fri Aug 19 05:01:25 2005
@@ -28,7 +28,7 @@
  *  User authentication based on nick!user@host masking
  */
 
-static int ea_cmd_access( CmdParams* cmdparams );
+static int ea_cmd_access( const CmdParams *cmdparams );
 
 /** Access list struct */
 typedef struct AccessEntry
@@ -136,7 +136,7 @@
  *  @return NS_SUCCESS if suceeds else result of command
  */
 
-static int AccessAdd( CmdParams* cmdparams )
+static int AccessAdd( const CmdParams *cmdparams )
 {
 	int level = 0;
 	AccessEntry *access;
@@ -182,7 +182,7 @@
  *  @return NS_SUCCESS if suceeds else result of command
  */
 
-static int AccessDel( CmdParams *cmdparams )
+static int AccessDel( const CmdParams *cmdparams )
 {
 	hnode_t *node;
 
@@ -217,7 +217,7 @@
  *  @return NS_SUCCESS if suceeds else result of command
  */
 
-static int AccessList( CmdParams *cmdparams )
+static int AccessList( const CmdParams *cmdparams )
 {
 	hscan_t accessscan;
 	hnode_t *node;
@@ -244,7 +244,7 @@
  *  @return NS_SUCCESS if suceeds else result of command
  */
 
-static int ea_cmd_access( CmdParams *cmdparams )
+static int ea_cmd_access( const CmdParams *cmdparams )
 {
 	SET_SEGV_LOCATION();
 	if( !ircstrcasecmp( cmdparams->av[0], "ADD" ) ) 
@@ -304,7 +304,7 @@
  *  @return NS_SUCCESS if suceeds else NS_FAILURE
  */
 
-int ModFini( void)
+int ModFini( void )
 {
 	del_services_cmd_list( extauth_commands );
 	return NS_SUCCESS;
@@ -319,7 +319,7 @@
  *  @return authentication level for user
  */
 
-int ModAuthUser( Client *u )
+int ModAuthUser( const Client *u )
 {
 	static char hostmask[USERHOSTLEN];
 	AccessEntry *access;

Modified: trunk/modules/ircdauth/ircdauth.c
==============================================================================
--- trunk/modules/ircdauth/ircdauth.c	(original)
+++ trunk/modules/ircdauth/ircdauth.c	Fri Aug 19 05:01:25 2005
@@ -90,7 +90,7 @@
 	{UMODE_REGNICK,		NS_ULEVEL_REG},
 };
 
-const int user_auth_mode_count =( ( sizeof( user_auth_modes ) / sizeof( user_auth_modes[0] ) ) );
+const int user_auth_mode_count = ( ( sizeof( user_auth_modes ) / sizeof( user_auth_modes[0] ) ) );
 
 static UserAuthModes user_auth_smodes[] = 
 {
@@ -103,7 +103,7 @@
 	{SMODE_COADMIN,		NS_ULEVEL_OPER},
 };
 
-const int user_auth_smode_count =( ( sizeof( user_auth_smodes ) / sizeof( user_auth_smodes[0] ) ) );
+const int user_auth_smode_count = ( ( sizeof( user_auth_smodes ) / sizeof( user_auth_smodes[0] ) ) );
 
 /** @brief auth_cmd_authmodelist
  *
@@ -114,7 +114,7 @@
  *  @return NS_SUCCESS if suceeds else result of command
  */
 
-static int auth_cmd_authmodelist( CmdParams* cmdparams )
+static int auth_cmd_authmodelist( const CmdParams *cmdparams )
 {
 	int i;
 
@@ -183,7 +183,7 @@
  *  @return NS_SUCCESS if suceeds else NS_FAILURE
  */
 
-int ModFini (void)
+int ModFini( void )
 {
 	del_services_cmd_list( ircdauth_commands );
 	return NS_SUCCESS;
@@ -198,7 +198,7 @@
  *  @return authentication level for user
  */
 
-int ModAuthUser( Client * u )
+int ModAuthUser( const Client *u )
 {
 	int i, authlevel;
 

Modified: trunk/modules/protocol/unreal32.c
==============================================================================
--- trunk/modules/protocol/unreal32.c	(original)
+++ trunk/modules/protocol/unreal32.c	Fri Aug 19 05:01:25 2005
@@ -559,7 +559,7 @@
 	return( tarindex );
 }
 
-int decode_ip( char *buf )
+int decode_ip( const char *buf )
 {
 	int len = strlen( buf );
 	char targ[25];

Modified: trunk/modules/template/main.c
==============================================================================
--- trunk/modules/template/main.c	(original)
+++ trunk/modules/template/main.c	Fri Aug 19 05:01:25 2005
@@ -138,7 +138,7 @@
  *  example command
  *  Just sends "Hello World!" to the services channel
  */
-static int template_hello_world( CmdParams* cmdparams )
+static int template_hello_world( const CmdParams *cmdparams )
 {
 	SET_SEGV_LOCATION();
 	irc_chanalert( template_bot, "%s says \"Hello World!\"",
@@ -253,6 +253,7 @@
  *
  *  @return NS_SUCCESS if suceeds else NS_FAILURE
  */
+
 int ModInit( void )
 {
 	return NS_SUCCESS;
@@ -288,8 +289,7 @@
  *  @return NS_SUCCESS if suceeds else NS_FAILURE
  */
 
-int ModFini (void)
+int ModFini( void )
 {
 	return NS_SUCCESS;
 }
-

Modified: trunk/modules/templateauth/main.c
==============================================================================
--- trunk/modules/templateauth/main.c	(original)
+++ trunk/modules/templateauth/main.c	Fri Aug 19 05:01:25 2005
@@ -121,7 +121,7 @@
  *  @return authentication level for user
  */
 
-int ModAuthUser( Client * u )
+int ModAuthUser( const Client *u )
 {
 	return 0;
 }

Modified: trunk/src/commands.c
==============================================================================
--- trunk/src/commands.c	(original)
+++ trunk/src/commands.c	Fri Aug 19 05:01:25 2005
@@ -75,7 +75,7 @@
  *  @param pointer to command structure
  *  @return command user level requires
  */
-static int calc_cmd_ulevel( bot_cmd *cmd_ptr )
+static int calc_cmd_ulevel( const bot_cmd *cmd_ptr )
 {
 	if( cmd_ptr->ulevel > NS_ULEVEL_ROOT ) {
 		/* int pointer rather than value */
@@ -93,7 +93,7 @@
  *  @return command user level requires
  */
 
-int getuserlevel( CmdParams *cmdparams )
+int getuserlevel( const CmdParams *cmdparams )
 {
 	int ulevel = 0;
 	int modlevel = 0;
@@ -296,7 +296,7 @@
  *
  * @return NS_SUCCESS if succeeds, NS_FAILURE if not 
  */
-int add_bot_cmd_list( Bot* bot_ptr, bot_cmd *bot_cmd_list ) 
+int add_bot_cmd_list( Bot *bot_ptr, bot_cmd *bot_cmd_list ) 
 {
 	if( !bot_cmd_list ) {
 		return NS_FAILURE;
@@ -550,8 +550,7 @@
  *
  * @return NS_SUCCESS if succeeds, NS_FAILURE if not 
  */
-static int 
-bot_cmd_help_set( CmdParams *cmdparams, int userlevel )
+static int bot_cmd_help_set( CmdParams *cmdparams, int userlevel )
 {
 	hnode_t *setnode;
 	hscan_t hs;
@@ -594,8 +593,7 @@
  *
  * @return NS_SUCCESS if succeeds, NS_FAILURE if not 
  */
-static int 
-bot_cmd_help( CmdParams *cmdparams )
+static int bot_cmd_help( CmdParams *cmdparams )
 {
 	char *curlevelmsg=NULL;
 	int donemsg=0;
@@ -733,9 +731,9 @@
 /**	Support function for command handlers to call to check that target nick 
  *	is not the bot and is on IRC. Done in core to avoid module code bloat.
  */ 
-Client * FindValidUser( Bot* botptr, Client * sourceuser, const char *target_nick )
+Client *FindValidUser( const Bot *botptr, const Client *sourceuser, const char *target_nick )
 {
-	Client * target;
+	Client *target;
 	
 	/* Check target user is on IRC */
 	target = FindUser( target_nick );

Modified: trunk/src/exclude.c
==============================================================================
--- trunk/src/exclude.c	(original)
+++ trunk/src/exclude.c	Fri Aug 19 05:01:25 2005
@@ -38,7 +38,7 @@
 #include "helpstrings.h"
 
 /* Prototype for module exclude command handler */
-static int mod_cmd_exclude( CmdParams *cmdparams );
+static int mod_cmd_exclude( const CmdParams *cmdparams );
 
 /* Exclude types */
 typedef enum NS_EXCLUDE
@@ -97,7 +97,7 @@
  *  @return none
  */
 
-static void new_exclude( list_t *exclude_list, void *data )
+static void new_exclude( list_t *exclude_list, const void *data )
 {
 	Exclude *exclude;
 
@@ -118,7 +118,7 @@
  *  @return none
  */
 
-static int new_global_exclude( void *data, int size )
+static int new_global_exclude( const void *data, int size )
 {
 	new_exclude( exclude_list, data );
 	return NS_FALSE;
@@ -135,7 +135,7 @@
  *  @return none
  */
 
-static int new_mod_exclude( void *data, int size )
+static int new_mod_exclude( const void *data, int size )
 {
 	new_exclude( excludelists[GET_CUR_MODNUM()], data );
 	return NS_FALSE;
@@ -242,7 +242,7 @@
  *  @return NS_SUCCESS if succeeds, NS_FAILURE if not 
  */
 
-static int do_exclude_add( list_t *exclude_list, CmdParams* cmdparams )
+static int do_exclude_add( list_t *exclude_list, const CmdParams *cmdparams )
 {
 	NS_EXCLUDE type;
 	char *buf;
@@ -340,7 +340,7 @@
  *  @return NS_SUCCESS if succeeds, NS_FAILURE if not 
  */
 
-static int ns_cmd_exclude_add( CmdParams* cmdparams ) 
+static int ns_cmd_exclude_add( const CmdParams *cmdparams ) 
 {
 	return do_exclude_add( exclude_list, cmdparams );
 } 
@@ -356,7 +356,7 @@
  *  @return NS_SUCCESS if succeeds, NS_FAILURE if not 
  */
 
-static int mod_cmd_exclude_add( CmdParams *cmdparams )
+static int mod_cmd_exclude_add( const CmdParams *cmdparams )
 {
 	return do_exclude_add( excludelists[cmdparams->bot->moduleptr->modnum], cmdparams );
 }
@@ -374,7 +374,7 @@
  *  @return NS_SUCCESS if succeeds, NS_FAILURE if not 
  */
 
-static int do_exclude_del( list_t *exclude_list, CmdParams* cmdparams ) 
+static int do_exclude_del( list_t *exclude_list, const CmdParams *cmdparams ) 
 {
 	lnode_t *node;
 	Exclude *exclude;
@@ -412,7 +412,7 @@
  *  @return NS_SUCCESS if succeeds, NS_FAILURE if not 
  */
 
-static int ns_cmd_exclude_del( CmdParams* cmdparams ) 
+static int ns_cmd_exclude_del( const CmdParams *cmdparams ) 
 {
 	return do_exclude_del( exclude_list, cmdparams );
 } 
@@ -428,7 +428,7 @@
  *  @return NS_SUCCESS if succeeds, NS_FAILURE if not 
  */
 
-static int mod_cmd_exclude_del( CmdParams *cmdparams )
+static int mod_cmd_exclude_del( const CmdParams *cmdparams )
 {
 	return do_exclude_del( excludelists[cmdparams->bot->moduleptr->modnum], cmdparams );
 }
@@ -445,7 +445,7 @@
  *  @return NS_SUCCESS if succeeds, NS_FAILURE if not 
  */
 
-static int do_exclude_list( list_t *exclude_list, CmdParams* cmdparams ) 
+static int do_exclude_list( list_t *exclude_list, const CmdParams *cmdparams ) 
 {
 	lnode_t *node;
 	Exclude *exclude;
@@ -473,7 +473,7 @@
  *  @return NS_SUCCESS if succeeds, NS_FAILURE if not 
  */
 
-static int ns_cmd_exclude_list( CmdParams* cmdparams ) 
+static int ns_cmd_exclude_list( const CmdParams *cmdparams ) 
 {
 	return do_exclude_list( exclude_list, cmdparams );
 } 
@@ -489,7 +489,7 @@
  *  @return NS_SUCCESS if succeeds, NS_FAILURE if not 
  */
 
-static int mod_cmd_exclude_list( CmdParams *cmdparams )
+static int mod_cmd_exclude_list( const CmdParams *cmdparams )
 {
 	return do_exclude_list( excludelists[cmdparams->bot->moduleptr->modnum], cmdparams );
 }
@@ -506,7 +506,7 @@
  *  @return NS_SUCCESS if succeeds, NS_FAILURE if not 
  */
 
-int ns_cmd_exclude( CmdParams* cmdparams ) 
+int ns_cmd_exclude( const CmdParams *cmdparams ) 
 {
 	SET_SEGV_LOCATION();
 	if( !ircstrcasecmp( cmdparams->av[0], "ADD" ) )
@@ -530,7 +530,7 @@
  *  @return NS_SUCCESS if succeeds, NS_FAILURE if not 
  */
 
-static int mod_cmd_exclude( CmdParams *cmdparams )
+static int mod_cmd_exclude( const CmdParams *cmdparams )
 {
 	SET_SEGV_LOCATION();
 	if( !ircstrcasecmp( cmdparams->av[0], "ADD" ) )
@@ -669,7 +669,7 @@
  *  @return NS_TRUE if excluded else NS_FALSE if not
  */
 
-int ModIsServerExcluded( Client *s )
+int ModIsServerExcluded( const Client *s )
 {
 	lnode_t *node;
 	Exclude *exclude;
@@ -701,7 +701,7 @@
  *  @return NS_TRUE if excluded else NS_FALSE if not
  */
 
-int ModIsUserExcluded( Client *u ) 
+int ModIsUserExcluded( const Client *u ) 
 {
 	lnode_t *node;
 	Exclude *exclude;
@@ -759,7 +759,7 @@
  *  @return NS_TRUE if excluded else NS_FALSE if not
  */
 
-int ModIsChannelExcluded( Channel *c ) 
+int ModIsChannelExcluded( const Channel *c ) 
 {
 	lnode_t *node;
 	Exclude *exclude;