From: Antoine Jacquet Date: Fri, 15 Nov 2002 23:00:00 +0000 (+0100) Subject: version 0.42 X-Git-Tag: v0.42 X-Git-Url: http://royale.zerezo.com/git/?a=commitdiff_plain;h=22a4230dfc105e0160ba50e737a430ad60fb2cad;p=irssistats version 0.42 * W3C validated HTML * better quote selection during nick alias * auto refresh (suggested by Charles Blackburn) --- diff --git a/README b/README index 0a2c7be..67ca6e8 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -irssistats 0.41 +irssistats 0.42 site: http://royale.zerezo.com/programmation/irssistats/ mail: royale@zerezo.com diff --git a/irssistats.c b/irssistats.c index 1ddd0cc..b5792b1 100644 --- a/irssistats.c +++ b/irssistats.c @@ -6,6 +6,10 @@ #include #include +/* Options */ +#define REFRESH_TIME 3600 +#define W3C_LINK + /* Config */ #define MAXUSERS 5000 #define MAXNICKLENGTH 50 @@ -19,7 +23,7 @@ #define MINWORDLENGTH 5 /* irssistats */ -#define VERSION "0.41" +#define VERSION "0.42" #define URL "http://royale.zerezo.com/programmation/irssistats/" /* Counters */ @@ -98,7 +102,7 @@ char *keys[NBLANGUAGES][NBKEYS+1][2]= /* first key used for language name and ab { "AVGLETTERS", "lettres/lignes" }, { "HOURS", "heures" }, { "QUOTE", "message aléatoire" }, - { "TOPUSERSTIME", "Personnes les plus actives par période de la journée" }, + { "TOPUSERSTIME", "Personnes les plus actives par période de la journée" }, { "RANDTOPICS", "Quelques topics" }, { "CHANGEDBY", "changé par" }, { "NEWTOPIC", "nouveau topic" }, @@ -354,6 +358,7 @@ struct int hours[4]; char quote[MAXQUOTELENGTH+1]; int counters[NBCOUNTERS]; + int temp; } users[MAXUSERS]; int nbusers=0; @@ -481,6 +486,7 @@ int dichotomic(char *nick) for (j=0;j<4;j++) users[i].hours[j]=users[i-1].hours[j]; strcpy(users[i].quote,users[i-1].quote); for (j=0;j=0)) { - if (users[i].lines>temp) /* for nick alias, keep the random quote of the most used nick */ + if (users[i].temp>users[user].temp) /* for nick alias, keep the random quote of the most used nick */ { strcpy(users[user].quote,users[i].quote); - temp=users[i].lines; + users[user].temp=users[i].temp; } users[user].lines+=users[i].lines; users[user].letters+=users[i].letters; @@ -723,51 +730,56 @@ int main(int argc,char *argv[]) /*** HTML ***/ /* header */ + printf("\n\n"); printf("\n\n",VERSION,URL); - printf("\n\n\n\n"); + printf("<html>\n\n<head>\n<title>"); printf(L("HEADER"),channel,maintainer); - printf("\n\n\n"); - printf("\n\n
\n\n

",T("BGCOLOR"),T("TEXT"),T("LINK"),T("VLINK"),T("ALINK"),T("TITLE1")); + printf("\n\n"); +#ifdef REFRESH_TIME + printf("\n",REFRESH_TIME); +#endif + printf("\n\n\n"); + printf("\n\n
\n\n",T("BGCOLOR"),T("TEXT"),T("LINK"),T("VLINK"),T("ALINK"),T("TITLE1")); printf(L("HEADER"),channel,maintainer); - printf("

\n%s
\n

\n\n",ctime(&debut)); + printf("


\n%s
\n

\n\n",ctime(&debut)); /* legend */ - printf("

%s

\n\n\n",T("TITLE2"),L("LEGEND"),T("BGTABLE")); - for (i=0;i<4;i++) printf("\n",i+1,L("HOURS"),i*6,i*6+5); + printf("%s

\n
: %s %d-%d
\n\n",T("TITLE2"),L("LEGEND"),T("BGTABLE")); + for (i=0;i<4;i++) printf("\n",i+1,L("HOURS"),i*6,i*6+5); printf("\n
\"\" : %s %d-%d
\n

\n\n"); /* last days */ - printf("

%s

\n\n\n",T("TITLE2"),L("LASTDAYS")); + printf("%s

\n
\n\n",T("TITLE2"),L("LASTDAYS")); max=-1; for (i=30;i>=0;i--) if (lastdays[i].lines>max) max=lastdays[i].lines; for (i=30;i>=0;i--) { printf("\n"); } printf("\n\n"); for (i=30;i>=0;i--) - printf("\n",T("BGTABLE"),i); + printf("\n",T("BGTABLE"),i); printf("\n
%d
",lastdays[i].lines); - for (j=0;j<4;j++) if (lastdays[i].hours[j]!=0) printf("
",j+1,150*lastdays[i].hours[j]/max); + for (j=0;j<4;j++) if (lastdays[i].hours[j]!=0) printf("\"\"
",j+1,150*lastdays[i].hours[j]/max); printf("
%d%d
\n

\n\n"); /* top hours */ - printf("

%s

\n\n\n",T("TITLE2"),L("TOPHOURS")); + printf("%s

\n
\n\n",T("TITLE2"),L("TOPHOURS")); max=-1; for (i=0;i<24;i++) if (hours[i]>max) max=hours[i]; for (i=0;i<24;i++) { printf("\n"); } printf("\n\n"); for (i=0;i<24;i++) - printf("\n",T("BGTABLE"),i); + printf("\n",T("BGTABLE"),i); printf("\n
%.1f%%
",lines!=0?(float)100*hours[i]/lines:0); - if (hours[i]!=0) printf("
",i/6+1,150*hours[i]/max); + if (hours[i]!=0) printf("\"\"
",i/6+1,150*hours[i]/max); printf("
%d%d
\n

\n\n"); /* top users */ - printf("

%s

\n",T("TITLE2"),L("TOPUSERS")); + printf("%s

\n",T("TITLE2"),L("TOPUSERS")); printf("\n\n",T("BGTITLE"),L("NICK"),T("BGTITLE"),L("NBLINES"),T("BGTITLE"),L("HOURS"),T("BGTITLE"),L("AVGLETTERS"),T("BGTITLE"),L("QUOTE")); for (i=1;i<=NBUSERS;i++) { @@ -777,8 +789,8 @@ int main(int argc,char *argv[]) if (user!=-1) { printf("\n"); users[user].lines=-1; @@ -796,7 +808,7 @@ int main(int argc,char *argv[]) printf("

\n\n"); /* top users by time */ - printf("

%s

\n",T("TITLE2"),L("TOPUSERSTIME")); + printf("%s

\n",T("TITLE2"),L("TOPUSERSTIME")); printf("
%s%s%s%s%s
%d%s%d",T("BGTABLE"),i,T("BGTABLE"),users[user].nick,T("BGTABLE"),users[user].lines,T("BGTABLE")); - for (j=0;j<4;j++) if (users[user].hours[j]!=0) printf("",j+1,100*users[user].hours[j]/users[user].lines); - printf("%d\"",T("BGTABLE"),users[user].lines!=0?users[user].letters/users[user].lines:0,T("BGTABLE"),users[user].lines!=0?users[user].letters/users[user].lines:0,T("BGTABLE")); + for (j=0;j<4;j++) if (users[user].hours[j]!=0) printf("\"\"",j+1,100*users[user].hours[j]/users[user].lines); + printf("%d\"\"\"",T("BGTABLE"),users[user].lines!=0?users[user].letters/users[user].lines:0,T("BGTABLE"),users[user].lines!=0?users[user].letters/users[user].lines:0,T("BGTABLE")); printhtml(users[user].quote); printf("\"
\n"); for (i=0;i<4;i++) printf("",T("BGTITLE"),L("HOURS"),i*6,i*6+5); printf("\n"); @@ -820,7 +832,7 @@ int main(int argc,char *argv[]) printf("
%s %d-%d
\n

\n\n"); /* random topics */ - printf("

%s

\n",T("TITLE2"),L("RANDTOPICS")); + printf("%s

\n",T("TITLE2"),L("RANDTOPICS")); printf("\n\n",T("BGTITLE"),L("CHANGEDBY"),T("BGTITLE"),L("NEWTOPIC")); for (i=nbtopics=0;i--) { @@ -831,25 +843,27 @@ int main(int argc,char *argv[]) printf("
%s%s
\n

\n\n"); /* random urls */ - printf("

%s

\n",T("TITLE2"),L("RANDURLS")); + printf("%s

\n",T("TITLE2"),L("RANDURLS")); printf("\n\n",T("BGTITLE"),L("POSTEDBY"),T("BGTITLE"),L("POSTEDURL")); for (i=nburls=0;i--) { - printf("\n"); } printf("
%s%s
%s\"",T("BGTABLE"),urls[i].nick,T("BGTABLE"),urls[i].url); + printf("
%s\""); printhtml(urls[i].shorturl); printf("\"
\n

\n\n"); /* top words */ - printf("

%s

\n",T("TITLE2"),L("TOPWORDS")); + printf("%s

\n",T("TITLE2"),L("TOPWORDS")); printf("\n\n",T("BGTITLE"),L("WORD"),T("BGTITLE"),L("OCCURRENCES")); for (i=0;i\n",T("BGTABLE"),i+1,T("BGTABLE"),topwords[i].word,T("BGTABLE"),topwords[i].nb); printf("
%s%s
%d\"%s\"%d
\n

\n\n"); /* big numbers */ - printf("

%s

\n",T("TITLE2"),L("BIGNUMBERS")); + printf("%s

\n",T("TITLE2"),L("BIGNUMBERS")); printf("\n\n",T("BGTITLE"),L("NICK"),T("BGTITLE"),L("NUMBERS"),T("BGTITLE"),L("NBLINES")); for (i=0;i\n%s irssistats %s",L("FOOTER"),URL,VERSION); +#ifdef W3C_LINK + printf("

\n\n"); +#endif printf("\n\n\n\n\n\n\n"); return(0); diff --git a/pix/valid-html401.gif b/pix/valid-html401.gif new file mode 100644 index 0000000..1270561 Binary files /dev/null and b/pix/valid-html401.gif differ
%s%s%s