[NeoStats-Devel] NeoStats [Commits] r3062 - in /trunk/modules/statserv: htmlstats.h stats.c stats.h tld.c version.c
[email protected] Fri, 22 Dec 2006 22:34:10 -0000
| Newsgroups | gmane.comp.neostats.devel |
|---|---|
| Message-ID | <[email protected]> |
Author: Mark
Date: Sat Dec 23 06:34:09 2006
New Revision: 3062
URL: http://svn.neostats.net/cgi-bin/viewvc.cgi?rev=3062&root=NeoStats&view=rev
Log:
StatServ consts
Modified:
trunk/modules/statserv/htmlstats.h
trunk/modules/statserv/stats.c
trunk/modules/statserv/stats.h
trunk/modules/statserv/tld.c
trunk/modules/statserv/version.c
Modified: trunk/modules/statserv/htmlstats.h
URL: http://svn.neostats.net/cgi-bin/viewvc.cgi/trunk/modules/statserv/htmlstats.h?rev=3062&root=NeoStats&r1=3061&r2=3062&view=diff
==============================================================================
--- trunk/modules/statserv/htmlstats.h (original)
+++ trunk/modules/statserv/htmlstats.h Sat Dec 23 06:34:09 2006
@@ -24,7 +24,7 @@
#ifndef _HTMLSTATS_H_
#define _HTMLSTATS_H_
-int ss_cmd_forcehtml( const CmdParams *cmdparams );
+int ss_cmd_forcehtml( CmdParams *cmdparams );
int HTMLOutputTimer( void *v );
void HTMLOutput( void );
Modified: trunk/modules/statserv/stats.c
URL: http://svn.neostats.net/cgi-bin/viewvc.cgi/trunk/modules/statserv/stats.c?rev=3062&root=NeoStats&r1=3061&r2=3062&view=diff
==============================================================================
--- trunk/modules/statserv/stats.c (original)
+++ trunk/modules/statserv/stats.c Sat Dec 23 06:34:09 2006
@@ -440,7 +440,7 @@
* @return percent
*/
-int GetAllTimePercent( statistic *stat )
+int GetAllTimePercent( const statistic *stat )
{
return( int )( ( ( float ) stat->current / ( float ) stat->alltime.max ) * 100 );
}
@@ -454,7 +454,7 @@
* @return percent
*/
-int GetDailyPercent( statistic *stat )
+int GetDailyPercent( const statistic *stat )
{
return( int )( ( ( float ) stat->current / ( float ) stat->daily.max ) * 100 );
}
@@ -468,7 +468,7 @@
* @return percent
*/
-int GetWeeklyPercent( statistic *stat )
+int GetWeeklyPercent( const statistic *stat )
{
return( int )( ( ( float ) stat->current / ( float ) stat->weekly.max ) * 100 );
}
@@ -482,7 +482,7 @@
* @return percent
*/
-int GetMonthlyPercent( statistic *stat )
+int GetMonthlyPercent( const statistic *stat )
{
return( int )( ( ( float ) stat->current / ( float ) stat->monthly.max ) * 100 );
}
Modified: trunk/modules/statserv/stats.h
URL: http://svn.neostats.net/cgi-bin/viewvc.cgi/trunk/modules/statserv/stats.h?rev=3062&root=NeoStats&r1=3061&r2=3062&view=diff
==============================================================================
--- trunk/modules/statserv/stats.h (original)
+++ trunk/modules/statserv/stats.h Sat Dec 23 06:34:09 2006
@@ -58,9 +58,9 @@
void PreSaveStatistic( statistic *stat );
void PostLoadStatistic( statistic *stat );
-int GetAllTimePercent( statistic *stat );
-int GetDailyPercent( statistic *stat );
-int GetWeeklyPercent( statistic *stat );
-int GetMonthlyPercent( statistic *stat );
+int GetAllTimePercent( const statistic *stat );
+int GetDailyPercent( const statistic *stat );
+int GetWeeklyPercent( const statistic *stat );
+int GetMonthlyPercent( const statistic *stat );
#endif /* _STATS_H_ */
Modified: trunk/modules/statserv/tld.c
URL: http://svn.neostats.net/cgi-bin/viewvc.cgi/trunk/modules/statserv/tld.c?rev=3062&root=NeoStats&r1=3061&r2=3062&view=diff
==============================================================================
--- trunk/modules/statserv/tld.c (original)
+++ trunk/modules/statserv/tld.c Sat Dec 23 06:34:09 2006
@@ -266,7 +266,7 @@
/** @brief SaveTLDStat
*
- * Save TLD stat
+ * Save TLD statistic
*
* @param none
*
Modified: trunk/modules/statserv/version.c
URL: http://svn.neostats.net/cgi-bin/viewvc.cgi/trunk/modules/statserv/version.c?rev=3062&root=NeoStats&r1=3061&r2=3062&view=diff
==============================================================================
--- trunk/modules/statserv/version.c (original)
+++ trunk/modules/statserv/version.c Sat Dec 23 06:34:09 2006
@@ -55,7 +55,7 @@
*
* @param name ctcp version to search for
*
- * @return pointer to stat found or NULL if none
+ * @return pointer to statistic found or NULL if none
*/
static ss_ctcp_version *findctcpversion( const char *name )
@@ -64,15 +64,19 @@
cv = lnode_find( ctcp_version_list, name, comparef );
if( cv )
- dlog( DEBUG2, "findctcpversion: found version: %s", name );
+ {
+ dlog( DEBUG7, "findctcpversion: found version: %s", name );
+ }
else
- dlog( DEBUG2, "findctcpversion: %s not found", name );
+ {
+ dlog( DEBUG7, "findctcpversion: %s not found", name );
+ }
return cv;
}
/** @brief SaveClientVersion
*
- * Save client version stat
+ * Save client version statistic
*
* @param none
*
@@ -80,13 +84,13 @@
*/
static void SaveClientVersion( const ss_ctcp_version *cv, const void *v )
{
- DBAStore( CTCPVERSION_TABLE, cv->name, ( void *)cv, sizeof( ss_ctcp_version));
- dlog( DEBUG2, "Save version %s", cv->name );
+ DBAStore( CTCPVERSION_TABLE, cv->name, ( void *)cv, sizeof( ss_ctcp_version) );
+ dlog( DEBUG7, "Save version %s", cv->name );
}
/** @brief SaveClientVersions
*
- * Save client version stats
+ * Save client version statistics
*
* @param none
*
@@ -118,7 +122,7 @@
return NS_FALSE;
}
cv = ns_calloc( sizeof( ss_ctcp_version ) );
- os_memcpy( cv, data, sizeof( ss_ctcp_version ));
+ os_memcpy( cv, data, sizeof( ss_ctcp_version ) );
lnode_create_append( ctcp_version_list, cv );
return NS_FALSE;
}
@@ -149,7 +153,7 @@
static void ClientVersionReport( const ss_ctcp_version *cv, const void *v )
{
- irc_prefmsg( ss_bot, ( Client * ) v, "%d -> %s", cv->users.current, cv->name );
+ irc_prefmsg( ss_bot, ( Client * ) v, "%d -> %s", cv->users.current, cv->name );
}
/** @brief GetClientStats
@@ -170,7 +174,9 @@
int count = 0;
if( !list_is_sorted( ctcp_version_list, topcurrentversions ) )
+ {
list_sort( ctcp_version_list, topcurrentversions );
+ }
cn = list_first( ctcp_version_list );
while( cn != NULL )
{
@@ -179,7 +185,9 @@
cn = list_next( ctcp_version_list, cn );
count++;
if( limit != -1 && count >= limit )
+ {
break;
+ }
}
}
@@ -201,7 +209,9 @@
limit = cmdparams->ac > 0 ? atoi( cmdparams->av[0] ) : 10;
if( limit < 10 )
+ {
limit = 10;
+ }
if( list_count( ctcp_version_list ) == 0 )
{
irc_prefmsg( ss_bot, cmdparams->source, "No Stats Available." );
@@ -230,16 +240,18 @@
/* drop multiple replies and additional lines in multi line replies */
if( cmdparams->source->flags & CLIENT_FLAG_GOTVERSION )
+ {
return NS_SUCCESS;
+ }
strlcpy( nocols, cmdparams->param, BUFSIZE );
strip_mirc_codes( nocols );
cv = findctcpversion( nocols );
- if( !cv )
+ if( cv == NULL )
{
cv = ns_calloc( sizeof( ss_ctcp_version ) );
strlcpy( cv->name, nocols, BUFSIZE );
lnode_create_append( ctcp_version_list, cv );
- dlog( DEBUG2, "Added version: %s", cv->name );
+ dlog( DEBUG7, "Added version: %s", cv->name );
}
IncStatistic( &cv->users );
return NS_SUCCESS;
@@ -257,9 +269,9 @@
int InitVersionStats( void )
{
ctcp_version_list = list_create( LISTCOUNT_T_MAX );
- if( !ctcp_version_list )
- {
- nlog( LOG_CRITICAL, "Unable to create version stat list" );
+ if( ctcp_version_list == NULL )
+ {
+ nlog( LOG_CRITICAL, "Unable to create version statistic list" );
return NS_FAILURE;
}
DBAOpenTable( CTCPVERSION_TABLE );