#define MINWORDLENGTH 5
/* irssistats */
-#define VERSION "0.3"
+#define VERSION "0.31"
#define URL "http://royale.zerezo.com/programmation/irssistats/"
/* Counters */
char *counters[NBCOUNTERS]={"C_SMILE","C_FROWN","C_EXCLAM","C_QUESTION","C_ME","C_TOPIC","C_MODE","C_KICK","C_KICKED","C_URL","C_JOIN","C_NICK","C_MONOLOGUE"};
/* Languages */
-#define NBLANGUAGES 2
+#define NBLANGUAGES 3
#define NBKEYS 38
char *keys[NBLANGUAGES][NBKEYS+1][2]= /* first key used for language name and abbreviation */
{
{ "C_JOIN", "ne sait pas s'il doit rester ou partir" },
{ "C_NICK", "change souvent de nick" },
{ "C_MONOLOGUE", "parle beaucoup de monologues" }
+ },
+ { /* Spanish language */
+ /* Submitted by Alex <ainaker@gmx.net> */
+ { "Spanish", "es" },
+ { "HEADER", "Estadísticas de #%s por %s" },
+ { "LEGEND", "Leyenda" },
+ { "LASTDAYS", "Estadísticas de los últimos días" },
+ { "TOPHOURS", "Estadísticas por horas" },
+ { "TOPUSERS", "Los que más escriben" },
+ { "OTHERS", "Hay %d más que no llegaron..." },
+ { "NBLINES", "líneas" },
+ { "NICK", "nick" },
+ { "AVGLETTERS", "letras por línea" },
+ { "HOURS", "horas" },
+ { "QUOTE", "Frase aleatoria" },
+ { "TOPUSERSTIME", "Los que más escriben según la hora" },
+ { "RANDTOPICS", "Algunos topics" },
+ { "CHANGEDBY", "Puestos por" },
+ { "NEWTOPIC", "topic" },
+ { "RANDURLS", "Algunas URLs" },
+ { "POSTEDBY", "puestas por" },
+ { "POSTEDURL", "URL" },
+ { "TOPWORDS", "Palabras más usadas" },
+ { "WORD", "Palabra" },
+ { "OCCURRENCES", "Frecuencia" },
+ { "BIGNUMBERS", "Algunos datos..." },
+ { "NUMBERS", "Número de veces" },
+ { "TIME", "%d lineas procesadas en %d segundos" },
+ { "FOOTER", "Estadísticas generadas por" },
+ { "C_SMILE", "Suele estar felíz :)" },
+ { "C_FROWN", "Suele estar triste :(" },
+ { "C_EXCLAM", "Grita mucho !" },
+ { "C_QUESTION", "Hace muchas preguntas ?" },
+ { "C_ME", "Abusa del comando /me" },
+ { "C_TOPIC", "Suele cambiar el topic" },
+ { "C_MODE", "Cambia a veces los modos del canal" },
+ { "C_KICK", "Le gusta patear" },
+ { "C_KICKED", "Es pateado con frecuencia" },
+ { "C_URL", "Pone muchas URLs" },
+ { "C_JOIN", "No sabe si irse o quedarse" },
+ { "C_NICK", "Cambia mucho de nick" },
+ { "C_MONOLOGUE", "Habla solo" }
}
};
char *channel;
char *maintainer;
-struct
+struct
{
char nick[MAXNICKLENGTH];
int lines;
while (isletter(*message))
{
c=lowercase(*message)-'a';
- if ((*pos).next[(int)c]==NULL)
+ if (pos->next[(int)c]==NULL)
{
tmp=malloc(sizeof(struct letter));
- (*tmp).nb=0;
- for (i=0;i<26;i++) (*tmp).next[i]=NULL;
- (*pos).next[(int)c]=tmp;
+ tmp->nb=0;
+ for (i=0;i<26;i++) tmp->next[i]=NULL;
+ pos->next[(int)c]=tmp;
}
- pos=(*pos).next[(int)c];
+ pos=pos->next[(int)c];
message++;
}
- (*pos).nb++;
+ pos->nb++;
}
return;
}
int main(int argc,char *argv[])
{
int i,j,k;
- int max,user,hour;
+ int max,user,temp,hour;
int mononick,monolines;
time_t debut;
int totallines=0;
for (i=21;message[i]!=':';i++);
message=&message[i+2];
nbtopics++;
- if ((nbtopics<=5) || (rand()%nbtopics==0))
+ if ((nbtopics<=NBTOPICS) || (rand()%(nbtopics/NBTOPICS)==0))
{
- for (i=4;i>0;i--)
- {
- strcpy(topics[i].nick,topics[i-1].nick);
- strcpy(topics[i].topic,topics[i-1].topic);
- }
- strcpy(topics[0].nick,nick);
- strncpy(topics[0].topic,message,MAXQUOTELENGTH);
+ temp=nbtopics<=NBTOPICS?nbtopics-1:rand()%NBTOPICS;
+ strcpy(topics[temp].nick,nick);
+ strncpy(topics[temp].topic,message,MAXQUOTELENGTH);
}
}
else if (strncmp("was kicked from",message,15)==0) /* 00:00 -!- Nick was kicked from #channel by Nick [Reason] */
for (i=0;(message[i]!=' ') && (i<strlen(message));i++);
message[i]='\0';
nburls++;
- if ((nburls<=5) || (rand()%nburls==0))
+ if ((nburls<=NBURLS) || (rand()%(nburls/NBURLS)==0))
{
- for (i=4;i>0;i--)
- {
- strcpy(urls[i].nick,urls[i-1].nick);
- strcpy(urls[i].url,urls[i-1].url);
- strcpy(urls[i].shorturl,urls[i-1].shorturl);
- }
- strcpy(urls[0].nick,nick);
- strcpy(urls[0].url,message);
- strncpy(urls[0].shorturl,message,MAXQUOTELENGTH);
+ temp=nburls<=NBURLS?nburls-1:rand()%NBURLS;
+ strcpy(urls[temp].nick,nick);
+ strcpy(urls[temp].url,message);
+ strncpy(urls[temp].shorturl,message,MAXQUOTELENGTH);
}
}
findwords(message);
{
printf("<tr><td bgcolor=\"%s\" align=\"right\">%d</td><td bgcolor=\"%s\">%s</td><td bgcolor=\"%s\">%d</td><td bgcolor=\"%s\">",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("<img src=\"h%d.png\" width=\"%d\" height=\"15\">",j+1,100*users[user].hours[j]/users[user].lines);
- printf("</td><td bgcolor=\"%s\">%d</td><td bgcolor=\"%s\"><img src=\"hm.png\" width=\"%d\" height=\"15\"></td><td bgcolor=\"%s\">\"",T("BGTABLE"),users[user].letters/users[user].lines,T("BGTABLE"),users[user].letters/users[user].lines,T("BGTABLE"));
+ printf("</td><td bgcolor=\"%s\">%d</td><td bgcolor=\"%s\"><img src=\"hm.png\" width=\"%d\" height=\"15\"></td><td bgcolor=\"%s\">\"",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("\"</td></tr>\n");
users[user].lines=-1;