From 363a540f2233a72f1dccd300f93514d009e2053b Mon Sep 17 00:00:00 2001 From: Antoine Jacquet Date: Sun, 7 Dec 2003 00:00:00 +0100 Subject: [PATCH] version 0.5 * configuration file * it is now possible to build multiple stats in one run * customizable header and footer * now produces XHTML with CSS templates as suggested by some users * "grayscale" and "pisg" theme were added * italian support (thank you Coviello Giuseppe) * dutch support and BSD include patch (thank you Jeroen Ubbink) * patch nickmode (thank you Philipp Haegi) --- COPYING | 0 Makefile | 13 +- README | 14 +- data/blue.css | 133 ++++ data/dark.css | 135 ++++ data/default.css | 125 ++++ data/grayscale.css | 118 +++ {pix => data}/h1.png | Bin {pix => data}/h2.png | Bin {pix => data}/h3.png | Bin {pix => data}/h4.png | Bin {pix => data}/hm.png | Bin {pix => data}/irssistats_black.png | Bin {pix => data}/irssistats_white.png | Bin data/namour.css | 133 ++++ data/pisg.css | 170 +++++ data/pisg_blue-h.png | Bin 0 -> 112 bytes data/pisg_blue-v.png | Bin 0 -> 106 bytes data/pisg_green-h.png | Bin 0 -> 114 bytes data/pisg_green-v.png | Bin 0 -> 107 bytes data/pisg_red-h.png | Bin 0 -> 110 bytes data/pisg_red-v.png | Bin 0 -> 104 bytes data/pisg_yellow-h.png | Bin 0 -> 110 bytes data/pisg_yellow-v.png | Bin 0 -> 105 bytes {pix => data}/v1.png | Bin {pix => data}/v2.png | Bin {pix => data}/v3.png | Bin {pix => data}/v4.png | Bin data/valid-css.png | Bin 0 -> 1134 bytes data/valid-xhtml10.png | Bin 0 -> 2414 bytes {pix => data}/vm.png | Bin data/zeduel.css | 133 ++++ data/zerezo.css | 135 ++++ irssistats.1 | 84 --- irssistats.c | 955 +++++++++++++++---------- pix/valid-html401.gif | Bin 2328 -> 0 bytes sample.configfile | 79 ++ sample.nickfile.txt => sample.nickfile | 0 38 files changed, 1746 insertions(+), 481 deletions(-) mode change 100755 => 100644 COPYING mode change 100755 => 100644 Makefile mode change 100755 => 100644 README create mode 100644 data/blue.css create mode 100644 data/dark.css create mode 100644 data/default.css create mode 100644 data/grayscale.css rename {pix => data}/h1.png (100%) mode change 100755 => 100644 rename {pix => data}/h2.png (100%) mode change 100755 => 100644 rename {pix => data}/h3.png (100%) mode change 100755 => 100644 rename {pix => data}/h4.png (100%) mode change 100755 => 100644 rename {pix => data}/hm.png (100%) mode change 100755 => 100644 rename {pix => data}/irssistats_black.png (100%) mode change 100755 => 100644 rename {pix => data}/irssistats_white.png (100%) mode change 100755 => 100644 create mode 100644 data/namour.css create mode 100644 data/pisg.css create mode 100644 data/pisg_blue-h.png create mode 100644 data/pisg_blue-v.png create mode 100644 data/pisg_green-h.png create mode 100644 data/pisg_green-v.png create mode 100644 data/pisg_red-h.png create mode 100644 data/pisg_red-v.png create mode 100644 data/pisg_yellow-h.png create mode 100644 data/pisg_yellow-v.png rename {pix => data}/v1.png (100%) mode change 100755 => 100644 rename {pix => data}/v2.png (100%) mode change 100755 => 100644 rename {pix => data}/v3.png (100%) mode change 100755 => 100644 rename {pix => data}/v4.png (100%) mode change 100755 => 100644 create mode 100644 data/valid-css.png create mode 100644 data/valid-xhtml10.png rename {pix => data}/vm.png (100%) mode change 100755 => 100644 create mode 100644 data/zeduel.css create mode 100644 data/zerezo.css delete mode 100755 irssistats.1 mode change 100755 => 100644 irssistats.c delete mode 100755 pix/valid-html401.gif create mode 100644 sample.configfile rename sample.nickfile.txt => sample.nickfile (100%) mode change 100755 => 100644 diff --git a/COPYING b/COPYING old mode 100755 new mode 100644 diff --git a/Makefile b/Makefile old mode 100755 new mode 100644 index e6e091b..aae279c --- a/Makefile +++ b/Makefile @@ -1,8 +1,7 @@ PRE = /usr/local BIN = $(PRE)/bin -PIX = $(PRE)/share/irssistats/pix +DAT = $(PRE)/share/irssistats/data DOC = $(PRE)/doc/irssistats -MAN = $(PRE)/man/man1 irssistats:irssistats.c gcc -o irssistats irssistats.c @@ -11,13 +10,11 @@ clean: rm -f irssistats install:irssistats - mkdir -p $(BIN) $(PIX) $(DOC) $(MAN) + mkdir -p $(BIN) $(DAT) $(DOC) cp -f irssistats $(BIN) - cp -f pix/* $(PIX) - cp -f COPYING README sample.nickfile.txt $(DOC) - cp -f irssistats.1 $(MAN) + cp -f data/* $(DAT) + cp -f COPYING README sample.nickfile sample.configfile $(DOC) uninstall: rm -f $(BIN)/irssistats - rm -rf $(PIX) $(DOC) - rm -f $(MAN)/irssistats.1 + rm -rf $(DAT) $(DOC) diff --git a/README b/README old mode 100755 new mode 100644 index 1f4c63d..ebba4e7 --- a/README +++ b/README @@ -1,14 +1,18 @@ -irssistats 0.44 +irssistats 0.5 site: http://royale.zerezo.com/irssistats/ mail: royale@zerezo.com install: make -cp pix/* /path/to/webdir/ +cp data/* /path/to/webdir/ usage: -cat /path/to/file.log | ./irssistats \#channel maintainer language theme [nickfile] > /path/to/webdir/index.html -(don't forget to escape the '#' in the channel name) +irssistats [/path/to/file.conf] + +configfile: +Since version 0.5 of irssistats, all the options are located in a config file. +This allow you to specify multiple channels to parse. +Take a look at the "sample.configfile" in this package to know more about the options and their usage. nickfile: Since version 0.4 of irssistats, you can use a nickfile to specify nicks to join. @@ -20,7 +24,7 @@ Examples : ^bot\|royale$ : remove "bot|royale" from statistics The nickfile must not contain any comments. The final nick will remove matching nicks from all statistics, except from "Some URLs" and "Some topics"... -You can also take a look at the "sample.nickfile.txt" in this package. +You can also take a look at the "sample.nickfile" in this package. links: http://torus.lnet.lut.fi/ircstats/ diff --git a/data/blue.css b/data/blue.css new file mode 100644 index 0000000..17166ee --- /dev/null +++ b/data/blue.css @@ -0,0 +1,133 @@ +/* Blue theme... */ + +body { + background: #FFFFFF; +} + +#irssistats * { + font-family: Verdana, Arial, Helvetica, sans-serif; + color: #000000; + margin: 0; +} + +#irssistats A { + color: #4444FF; +} + +#irssistats A:hover { + color: #CCCCFF; +} + +#irssistats img { + border: 0; +} + +#irssistats h1 { + font-size: 20pt; + margin-bottom: 10px; + color: #8888FF; +} + +#irssistats h2 { + font-size: 15pt; + margin-bottom: 5px; + color: #AAAAFF; +} + +#irssitats p { + font-size: 10pt; +} + +#irssistats th { + font-size: 9pt; + background: #CCCCFF; +} + +#irssistats td { + font-size: 9pt; + background: #EEEEFF; +} + +#irssistats td.oneline { + width: 100px; +} + +#irssistats small { + font-size: 7pt; +} + +#irssistats table { + margin-left: auto; + margin-right: auto; +} + +#irssistats div { + padding: 10px; + margin: 10px; + text-align: center; +} + +#irssistats div.h1, #irssistats div.h2, #irssistats div.h3, #irssistats div.h4, #irssistats div.hm { + float: left; + height: 15px; + margin: 0; + padding: 0; + border: 0; +} + +#irssistats div.v1, #irssistats div.v2, #irssistats div.v3, #irssistats div.v4, #irssistats div.vm { + width: 15px; + margin: 0; + padding: 0; + border: 0; +} + +#irssistats div.h1 { + background: #0000ff; + background: url('h1.png'); +} + +#irssistats div.h2 { + background: #00ff00; + background: url('h2.png'); +} + +#irssistats div.h3 { + background: #ffff00; + background: url('h3.png'); +} + +#irssistats div.h4 { + background: #ff0000; + background: url('h4.png'); +} + +#irssistats div.hm { + background: #ff00ff; + background: url('hm.png'); +} + +#irssistats div.v1 { + background: #0000ff; + background: url('v1.png'); +} + +#irssistats div.v2 { + background: #00ff00; + background: url('v2.png'); +} + +#irssistats div.v3 { + background: #ffff00; + background: url('v3.png'); +} + +#irssistats div.v4 { + background: #ff0000; + background: url('v4.png'); +} + +#irssistats div.vm { + background: #ff00ff; + background: url('vm.png'); +} \ No newline at end of file diff --git a/data/dark.css b/data/dark.css new file mode 100644 index 0000000..eac24ba --- /dev/null +++ b/data/dark.css @@ -0,0 +1,135 @@ +/* Black background */ + +body { + background: #000000; +} + +#irssistats * { + font-family: Verdana, Arial, Helvetica, sans-serif; + color: #FFFFFF; + margin: 0; +} + +#irssistats A { + color: #AAAAFF; +} + +#irssistats A:hover { + color: #FFAAAA; +} + +#irssistats img { + border: 0; +} + +#irssistats h1 { + color: #AAAAFF; + font-size: 20pt; + margin-bottom: 10px; +} + +#irssistats h2 { + color: #FFAAAA; + font-size: 15pt; + margin-bottom: 5px; +} + +#irssitats p { + font-size: 10pt; +} + +#irssistats th { + font-size: 9pt; + background: #552222; + border: 1px #774444 solid; +} + +#irssistats td { + font-size: 9pt; + background: #225522; + border: 1px #447744 solid; +} + +#irssistats td.oneline { + width: 100px; +} + +#irssistats small { + font-size: 7pt; +} + +#irssistats table { + margin-left: auto; + margin-right: auto; +} + +#irssistats div { + padding: 10px; + margin: 10px; + text-align: center; +} + +#irssistats div.h1, #irssistats div.h2, #irssistats div.h3, #irssistats div.h4, #irssistats div.hm { + float: left; + height: 15px; + margin: 0; + padding: 0; + border: 0; +} + +#irssistats div.v1, #irssistats div.v2, #irssistats div.v3, #irssistats div.v4, #irssistats div.vm { + width: 15px; + margin: 0; + padding: 0; + border: 0; +} + +#irssistats div.h1 { + background: #0000ff; + background: url('h1.png'); +} + +#irssistats div.h2 { + background: #00ff00; + background: url('h2.png'); +} + +#irssistats div.h3 { + background: #ffff00; + background: url('h3.png'); +} + +#irssistats div.h4 { + background: #ff0000; + background: url('h4.png'); +} + +#irssistats div.hm { + background: #ff00ff; + background: url('hm.png'); +} + +#irssistats div.v1 { + background: #0000ff; + background: url('v1.png'); +} + +#irssistats div.v2 { + background: #00ff00; + background: url('v2.png'); +} + +#irssistats div.v3 { + background: #ffff00; + background: url('v3.png'); +} + +#irssistats div.v4 { + background: #ff0000; + background: url('v4.png'); +} + +#irssistats div.vm { + background: #ff00ff; + background: url('vm.png'); +} \ No newline at end of file diff --git a/data/default.css b/data/default.css new file mode 100644 index 0000000..88a2b0d --- /dev/null +++ b/data/default.css @@ -0,0 +1,125 @@ +/* White background (default theme) */ + +body { + background: #FFFFFF; +} + +#irssistats * { + font-family: Verdana, Arial, Helvetica, sans-serif; + color: #000000; + margin: 0; +} + +#irssistats img { + border: 0; +} + +#irssistats h1 { + font-size: 20pt; + margin-bottom: 10px; +} + +#irssistats h2 { + font-size: 15pt; + margin-bottom: 5px; +} + +#irssitats p { + font-size: 10pt; +} + +#irssistats th { + font-size: 9pt; + background: #FFEEEE; + border: 1px #FFCCCC solid; +} + +#irssistats td { + font-size: 9pt; + background: #EEEEEE; + border: 1px #CCCCCC solid; +} + +#irssistats td.oneline { + width: 100px; +} + +#irssistats small { + font-size: 7pt; +} + +#irssistats table { + margin-left: auto; + margin-right: auto; +} + +#irssistats div { + padding: 10px; + margin: 10px; + text-align: center; +} + +#irssistats div.h1, #irssistats div.h2, #irssistats div.h3, #irssistats div.h4, #irssistats div.hm { + float: left; + height: 15px; + margin: 0; + padding: 0; + border: 0; +} + +#irssistats div.v1, #irssistats div.v2, #irssistats div.v3, #irssistats div.v4, #irssistats div.vm { + width: 15px; + margin: 0; + padding: 0; + border: 0; +} + +#irssistats div.h1 { + background: #0000ff; + background: url('h1.png'); +} + +#irssistats div.h2 { + background: #00ff00; + background: url('h2.png'); +} + +#irssistats div.h3 { + background: #ffff00; + background: url('h3.png'); +} + +#irssistats div.h4 { + background: #ff0000; + background: url('h4.png'); +} + +#irssistats div.hm { + background: #ff00ff; + background: url('hm.png'); +} + +#irssistats div.v1 { + background: #0000ff; + background: url('v1.png'); +} + +#irssistats div.v2 { + background: #00ff00; + background: url('v2.png'); +} + +#irssistats div.v3 { + background: #ffff00; + background: url('v3.png'); +} + +#irssistats div.v4 { + background: #ff0000; + background: url('v4.png'); +} + +#irssistats div.vm { + background: #ff00ff; + background: url('vm.png'); +} \ No newline at end of file diff --git a/data/grayscale.css b/data/grayscale.css new file mode 100644 index 0000000..7131eaa --- /dev/null +++ b/data/grayscale.css @@ -0,0 +1,118 @@ +/* Grayscale theme */ + +body { + background: #bbbbbb; + text-align: center; +} + +#irssistats { + background: #dddddd; + border: 3px #777777 double; + margin: 20px 100px 20px 100px; +} + +#irssistats_header, #irssistats_legend, #irssistats_lastdays, #irssistats_tophours, #irssistats_topusers, #irssistats_topuserstime, #irssistats_randtopics, #irssistats_randurls, #irssistats_topwords, #irssistats_bignumbers, #irssistats_footer { + background: #ffffff; + border: 1px #777777 dotted; +} + +#irssistats * { + font-family: Verdana, Arial, Helvetica, sans-serif; + color: #000000; + margin: 0; +} + +#irssistats A { + color: #000000; +} + +#irssistats A:hover { + color: #666666; + text-decoration: none; +} + +#irssistats img { + border: 0; +} + +#irssistats h1 { + font-size: 20pt; + margin-bottom: 10px; + color: #000000; +} + +#irssistats h2 { + font-size: 15pt; + margin-bottom: 5px; + color: #555555; +} + +#irssitats p { + font-size: 10pt; +} + +#irssistats th { + font-size: 9pt; + color: #ffffff; + background: #555555; +} + +#irssistats td { + font-size: 8pt; + background: #ffffff; + border: 1px #cccccc dotted; +} + +#irssistats td.oneline { + width: 100px; +} + +#irssistats small { + font-size: 6pt; +} + +#irssistats table { + margin-left: auto; + margin-right: auto; +} + +#irssistats div { + padding: 10px; + margin: 10px; + text-align: center; +} + +#irssistats div.h1, #irssistats div.h2, #irssistats div.h3, #irssistats div.h4, #irssistats div.hm { + float: left; + height: 15px; + margin: 0; + padding: 0; + border: 0; +} + +#irssistats div.v1, #irssistats div.v2, #irssistats div.v3, #irssistats div.v4, #irssistats div.vm { + width: 15px; + margin: 0; + padding: 0; + border: 0; +} + +#irssistats div.h1, #irssistats div.v1 { + background: #000000; +} + +#irssistats div.h2, #irssistats div.v2 { + background: #777777; +} + +#irssistats div.h3, #irssistats div.v3 { + background: #aaaaaa; +} + +#irssistats div.h4, #irssistats div.v4 { + background: #dddddd; +} + +#irssistats div.hm, #irssistats div.vm { + background: #888888; +} diff --git a/pix/h1.png b/data/h1.png old mode 100755 new mode 100644 similarity index 100% rename from pix/h1.png rename to data/h1.png diff --git a/pix/h2.png b/data/h2.png old mode 100755 new mode 100644 similarity index 100% rename from pix/h2.png rename to data/h2.png diff --git a/pix/h3.png b/data/h3.png old mode 100755 new mode 100644 similarity index 100% rename from pix/h3.png rename to data/h3.png diff --git a/pix/h4.png b/data/h4.png old mode 100755 new mode 100644 similarity index 100% rename from pix/h4.png rename to data/h4.png diff --git a/pix/hm.png b/data/hm.png old mode 100755 new mode 100644 similarity index 100% rename from pix/hm.png rename to data/hm.png diff --git a/pix/irssistats_black.png b/data/irssistats_black.png old mode 100755 new mode 100644 similarity index 100% rename from pix/irssistats_black.png rename to data/irssistats_black.png diff --git a/pix/irssistats_white.png b/data/irssistats_white.png old mode 100755 new mode 100644 similarity index 100% rename from pix/irssistats_white.png rename to data/irssistats_white.png diff --git a/data/namour.css b/data/namour.css new file mode 100644 index 0000000..b19ebcc --- /dev/null +++ b/data/namour.css @@ -0,0 +1,133 @@ +/* Purple and Pink */ + +body { + background: #9933CC; +} + +#irssistats * { + font-family: Verdana, Arial, Helvetica, sans-serif; + color: #DDAAFF; + margin: 0; +} + +#irssistats A { + color: #CC99FF; +} + +#irssistats A:hover { + color: #FFC8C8; +} + +#irssistats img { + border: 0; +} + +#irssistats h1 { + font-size: 20pt; + margin-bottom: 10px; + color: #FFC8C8; +} + +#irssistats h2 { + font-size: 15pt; + margin-bottom: 5px; + color: #FFC8C8; +} + +#irssitats p { + font-size: 10pt; +} + +#irssistats th { + font-size: 9pt; + background: #550088; +} + +#irssistats td { + font-size: 9pt; + background: #7711AA; +} + +#irssistats td.oneline { + width: 100px; +} + +#irssistats small { + font-size: 7pt; +} + +#irssistats table { + margin-left: auto; + margin-right: auto; +} + +#irssistats div { + padding: 10px; + margin: 10px; + text-align: center; +} + +#irssistats div.h1, #irssistats div.h2, #irssistats div.h3, #irssistats div.h4, #irssistats div.hm { + float: left; + height: 15px; + margin: 0; + padding: 0; + border: 0; +} + +#irssistats div.v1, #irssistats div.v2, #irssistats div.v3, #irssistats div.v4, #irssistats div.vm { + width: 15px; + margin: 0; + padding: 0; + border: 0; +} + +#irssistats div.h1 { + background: #0000ff; + background: url('h1.png'); +} + +#irssistats div.h2 { + background: #00ff00; + background: url('h2.png'); +} + +#irssistats div.h3 { + background: #ffff00; + background: url('h3.png'); +} + +#irssistats div.h4 { + background: #ff0000; + background: url('h4.png'); +} + +#irssistats div.hm { + background: #ff00ff; + background: url('hm.png'); +} + +#irssistats div.v1 { + background: #0000ff; + background: url('v1.png'); +} + +#irssistats div.v2 { + background: #00ff00; + background: url('v2.png'); +} + +#irssistats div.v3 { + background: #ffff00; + background: url('v3.png'); +} + +#irssistats div.v4 { + background: #ff0000; + background: url('v4.png'); +} + +#irssistats div.vm { + background: #ff00ff; + background: url('vm.png'); +} \ No newline at end of file diff --git a/data/pisg.css b/data/pisg.css new file mode 100644 index 0000000..211ab04 --- /dev/null +++ b/data/pisg.css @@ -0,0 +1,170 @@ +/* "pisg like" theme */ + +body { + background: #dedeee; + text-align: center; +} + +#irssistats { + width: 650px; + margin-left: auto; + margin-right: auto; +} + +#irssistats * { + font-family: Verdana, Arial, sans-serif; + font-size: 13px; + color: black; + margin: 0; +} + +#irssistats a { + text-decoration: none; +} + +#irssistats a:link { + color: #0b407a; +} + +#irssistats a:visited { + color: #0b407a; +} + +#irssistats a:hover { + text-decoration: underline; + color: #0b407a; +} + +#irssistats img { + border: 0; +} + +#irssistats h1 { + font-family: Tahoma, Arial, sans-serif; + font-size: 16px; + font-weight: bold; + margin-bottom: 10px; +} + +#irssistats h2 { + color: white; + font-weight: bold; + text-align: center; + background-color: #666699; + border: 1px #000000 solid; + padding: 2px; +} + +#irssitats p { + font-size: 10pt; +} + +#irssistats th { + background-color: #C8C8DD; + text-align: left; +} + +#irssistats_lastdays th, #irssistats_tophours th { + font-weight: normal; + color: #000000; + background-color: #CCCCCC; + font-size: 10px; + text-align: center; +} + +#irssistats td { + font-family: Verdana, Arial, sans-serif; + font-size: 13px; + color: black; + text-align: left; + background: #bcbcda; +} + +#irssistats_legend td, #irssistats_lastdays td, #irssistats_tophours td { + text-align: center; + background: inherit; +} + +#irssistats td.oneline { + width: 100px; +} + +#irssistats small { + font-family: "Arial narrow", Arial, sans-serif; + font-size: 9px; + color: black; + text-align: center; +} + +#irssistats table { + margin-left: auto; + margin-right: auto; +} + +#irssistats_topusers table, #irssistats_topuserstime table, #irssistats_randtopics table, #irssistats_randurls table, #irssistats_topwords table , #irssistats_bignumbers table { + width: 650px; +} + +#irssistats div { + margin-bottom: 20px; + text-align: center; +} + +#irssistats div.h1, #irssistats div.h2, #irssistats div.h3, #irssistats div.h4, #irssistats div.hm { + float: left; + height: 15px; + margin: 0; + padding: 0; + border: 0; +} + +#irssistats div.v1, #irssistats div.v2, #irssistats div.v3, #irssistats div.v4, #irssistats div.vm { + width: 15px; + margin: 0; + padding: 0; + border: 0; +} + +#irssistats div.h1 { + background: #0000ff; + background: url('pisg_blue-h.png'); +} + +#irssistats div.h2 { + background: #00ff00; + background: url('pisg_green-h.png'); +} + +#irssistats div.h3 { + background: #ffff00; + background: url('pisg_yellow-h.png'); +} + +#irssistats div.h4 { + background: #ff0000; + background: url('pisg_red-h.png'); +} + +#irssistats div.hm { + background: #dd00dd; +} + +#irssistats div.v1 { + background: #0000ff; + background: url('pisg_blue-v.png'); +} + +#irssistats div.v2 { + background: #00ff00; + background: url('pisg_green-v.png'); +} + +#irssistats div.v3 { + background: #ffff00; + background: url('pisg_yellow-v.png'); +} + +#irssistats div.v4 { + background: #ff0000; + background: url('pisg_red-v.png'); +} \ No newline at end of file diff --git a/data/pisg_blue-h.png b/data/pisg_blue-h.png new file mode 100644 index 0000000000000000000000000000000000000000..fdad6b540864d935e0e9cc3d5a99f738fe1569b8 GIT binary patch literal 112 zcmeAS@N?(olHy`uVBq!ia0vp^j6lrK!2~2%)f%k>Qs$m6jv*3~tOqUm8XS0799RCA zpZM8Dsb-C>vWw{TzY4W;Ol_A%rObZwbggQTOXmw!?<+Ix(yrNm{;T!dyv05SXas|& LtDnm{r-UW|KrACu literal 0 HcmV?d00001 diff --git a/data/pisg_blue-v.png b/data/pisg_blue-v.png new file mode 100644 index 0000000000000000000000000000000000000000..62877a7658436b634389dd1712f9948c07de8543 GIT binary patch literal 106 zcmeAS@N?(olHy`uVBq!ia0vp^{6Nge!2~4x_9f>6DML>e#}J9jtOpJG4jAw-Ieh&e z{mpJ;aBc^q>(1(Hzi*~%&uPe8wo-mo*+Ey+9?o*NohKJ+-TS_yItQqk!PC{xWt~$( F69DVQBOd?& literal 0 HcmV?d00001 diff --git a/data/pisg_green-h.png b/data/pisg_green-h.png new file mode 100644 index 0000000000000000000000000000000000000000..1fe92243594323ec0778ddacb18f41fee6affc7c GIT binary patch literal 114 zcmeAS@N?(olHy`uVBq!ia0vp^j6lrK!2~2%)f%k>QkI@Bjv*3~tOpIn8VopG4nDiT z|AU>}$)+8gEC%N#-#t&7f9Q4~`>UhT!rF6DI-r8#}Elg*+Y(e3<5kX2Y&oN zTW@o6p^olumn5T=SN7<|^0As&w+n8oUzBUYTi_(8E_Yf->*!zJ&69z;89ZJ6T-G@y GGywom4;~x< literal 0 HcmV?d00001 diff --git a/data/pisg_red-h.png b/data/pisg_red-h.png new file mode 100644 index 0000000000000000000000000000000000000000..2f52f4a6205731df8dcc00458d71793df0beda17 GIT binary patch literal 110 zcmeAS@N?(olHy`uVBq!ia0vp^j6lrK!2~2%)f%k>Ql_3Rjv*4^s$HI33<^9)68_b{ zvbVi?RIg*I98)7pH-|aX(>^2Tl}a-OwN9LU?0ahY>=QM|#T^C_&3I!U#;OXk; Jvd$@?2>{t?Aou_P literal 0 HcmV?d00001 diff --git a/data/pisg_red-v.png b/data/pisg_red-v.png new file mode 100644 index 0000000000000000000000000000000000000000..cfe6c3bc75d694c6f15d712ba456520f230689f1 GIT binary patch literal 104 zcmeAS@N?(olHy`uVBq!ia0vp^{6Nge!2~4x_9f>6DSb~D#}J9jtOp(W7!){|H~jc7 z{r}4ownJjcyUUKuF5JF)j%LCnD*=NB4nx;nr?%T4SJv9KWX`q(pjHM?S3j3^P6Ql_3Rjv*3~yhk_kGAQsc8%+7H zZuf-2>`K?9kdzHJ-)6ng^AHbdlC9wBI4(aW@Eg<9qb;{e?0Ft&_urR|SOzqJ!PC{x JWt~$(69CV0Aus>{ literal 0 HcmV?d00001 diff --git a/data/pisg_yellow-v.png b/data/pisg_yellow-v.png new file mode 100644 index 0000000000000000000000000000000000000000..87bbde350081400c893c0ca5292260ef91934d5e GIT binary patch literal 105 zcmeAS@N?(olHy`uVBq!ia0vp^{6Nge!2~4x_9f>6DFaUz#}J9jtOpPBGAMAc9K7-W zJfH4?`>aZLgwn6sRxf)n^NWl1hFe;vPsp|w7;(O5zH6mjQd;@#B2X`br>mdKI;Vst E0I~!s#T`6W<+- zt4%e$w+9&~i2E*D*W)T9Bhx(p?A&_0|7X(X^Ya7IW>?MPDaUzu zczTO0wr<^e|Jf%QG42CClNSR6E4d`dFZlmw6q^`8Jh0FrC=HPY3SEXN1j@jH0f@DT z;lF?am<8g&3^agg*jyz(n}LC8qNj^vNX4zUQ)`1SI|v-Rel?4G(T!h0t6h3r9Tx_% z{GPN=z+e1GN8qGw>eHn5|8FmNua|o1m5;W_zoO+QbMz<2znfQG#(ynM{=I#{0V!X> zqF)tO-~TK+p#QH~U+~Uxw*7OC?@4lzU=MuwAfY=*I-PyJf}6|jF4ry6#nK@bObtKJ z{jpr)a7XQvK=_v<_kY&OUtDf7N2Y`!=sAP5DASo0{WX7G;uf&=`Gs|Enroa;cP#bwBZgT0Vk8}Ij!pi@+JzOex~wA_|LQI>iZ4KOPMZj@RJmq z{=ckJgo`sg=^ee+rLf!@|1r#|1Qou-tz zozY_28jcOAqH_ZHT>9G+6r2tD{%tx^c*pF4-nNSOH_A#)UvDaE^>6pwzeB^b1utmshBn2mW1YZ#q&(r+Ne9lLHSPV z;lJMu*6nF1eX&Vu#au@n)2h{;1^hB;>x|=8`0r4N5Dq`3W>NpNuIHfS-r}72x2dtZ z|1vypS3P_!s?6%3q3f=mrP_V^@twUAXY`EwoTZxX&st-k^Kye`&fdVV(2iA`qSwCa zO3SD?y)^LM2F^-1=1_^hVN1d%c)e7=87<81^0{cK;`g>k^UAjGxu$SW%#%-OqR3cMOS7CD$Nw90jSF7TjZ+3b%7?`))PKP%lew!LZ} z9@4ntXMQ2~DY0cQL^+Gz9jsW~FI2w%Uw?1i^C{7@K5}j{esbPgg&e IbxsLQ074N#oB#j- literal 0 HcmV?d00001 diff --git a/data/valid-xhtml10.png b/data/valid-xhtml10.png new file mode 100644 index 0000000000000000000000000000000000000000..2275ee6ea17da3a4c67a5d90c2f2105bc0d6c5a0 GIT binary patch literal 2414 zcmbVNX;2f{7H-8QAWIODU~n`nVqipj2Gj;bX`?`kfGr|4qYzsVCn7@Qf~~j^Hfd)> zn-Mi2E>Q=K8%9xVQNW<`XaTj|FfKSoRA>apxQ%(Kd9SAC*VLg_1e7?aP$)DM%n^`I zg_w9A$8lBxvN)(w;HXlopcx24R9a3Y0CWn43IKF!jMlPRNCZKU8kLGf0-A(K925x! zGy#Di$fyvFM5x#60gz;9L?{3#1qet}A{3}pA|x=-#3^7qv_CIi8!Fd<575s6SJWLQ1J zFc6^@AQXxskU}jG2v7u(m=m;Gy%q;xCB1R#LGv!&%S0pQ{$~nPfoWNo$&~qD@1Mc? zuW;61?EfSS{-F-|TTEaw$^Pd44>UcfED-<(GGVgd=rs>YVu})m&2SmjRP#nY^TC#i zIRoMfEMK{Kdzfkq@ z<=3+8?`u|{6TNTco7rwQ+gMZkaZ0kSBk{(5+SN0p>)Si@M!zT1ug0B9qEFh-bQcXi zxo3XCfDZdh;@_j}Dtpw|V&2Tm^i(@iVE=UyCq!br;TflQw2%$PgTVHmx}UN`Cmh4P>C+b$TT>%9`kEIZNJu1_`{p73S$s^MM6&4OFC*OOzFXH#e2A1Vrx z-8=0f+Or%|e0h$2w}Oz!JGZ;wF3FW+a>6LNzkT%SU!N4E6B$!}+saw^MlS!CO|0G5 z@Vs^0?Snr$oi7z%yDHCUUv~kAx{549x_MKqnpn)x;?yU~q zcEv5k#WytJtY7z*-NDvVYS%O@vWHGyZWWF4+Lsx4I^j2(OyVxS56@>aXAVI61sLC06LqmCfTT^sdd; z39l!Khb39WchxuF$g^0Q+q~o&(iEU-XR3}JKXEMm?2^Ni{DbF2uFdEXJ8%Brus8AN zoJr+T^1Je)l<|FRUb@wj-8peFGoe+*&a|vMG@0TyR_0d>Km2$rzUA z-!N{_*{i3|ywA38AWmk818OsE1p(70jl8R$+D;v@wtIQ2A?>iZZoOUHJU{;J^nrp6 zf?n@b+8=Nb1r2>Om+v)xF=c z*&`?HVk-h~T~-LX8Z*9wKW_SwrX*`4#pAxVgI0gU+yq}XrN-IVq?bSG%k1Go3O!FO z9N)%ywo}-IISUHv)xu{X^|9>qqT%Oux9q1EFDMNk>eIRFN!`4}r1kJgrH(v)W$jw@ z7<19pTLen(o>ZiJpE@+Q)FaMub9_sZPy6n?s0UKoCAKiHx3~9-UO8X}tTQap7I1ILGop zxuz!TapO_#@ms@Z&0<=gAkc zaC^GD<7O~+W>MH8@vCP+FPy#7ZnWl>>@j~N~=^S=R$XZ5)N literal 0 HcmV?d00001 diff --git a/pix/vm.png b/data/vm.png old mode 100755 new mode 100644 similarity index 100% rename from pix/vm.png rename to data/vm.png diff --git a/data/zeduel.css b/data/zeduel.css new file mode 100644 index 0000000..941b36e --- /dev/null +++ b/data/zeduel.css @@ -0,0 +1,133 @@ +/* Orange theme... */ + +body { + background: #FFFFFF; +} + +#irssistats * { + font-family: Verdana, Arial, Helvetica, sans-serif; + color: #000000; + margin: 0; +} + +#irssistats A { + color: #FF7700; +} + +#irssistats A:hover { + color: #FF9A41; +} + +#irssistats img { + border: 0; +} + +#irssistats h1 { + font-size: 20pt; + margin-bottom: 10px; + color: #C05A00; +} + +#irssistats h2 { + font-size: 15pt; + margin-bottom: 5px; + color: #FF7700; +} + +#irssitats p { + font-size: 10pt; +} + +#irssistats th { + font-size: 9pt; + background: #FF7700; +} + +#irssistats td { + font-size: 9pt; + background: #FFEEEE; +} + +#irssistats td.oneline { + width: 100px; +} + +#irssistats small { + font-size: 7pt; +} + +#irssistats table { + margin-left: auto; + margin-right: auto; +} + +#irssistats div { + padding: 10px; + margin: 10px; + text-align: center; +} + +#irssistats div.h1, #irssistats div.h2, #irssistats div.h3, #irssistats div.h4, #irssistats div.hm { + float: left; + height: 15px; + margin: 0; + padding: 0; + border: 0; +} + +#irssistats div.v1, #irssistats div.v2, #irssistats div.v3, #irssistats div.v4, #irssistats div.vm { + width: 15px; + margin: 0; + padding: 0; + border: 0; +} + +#irssistats div.h1 { + background: #0000ff; + background: url('h1.png'); +} + +#irssistats div.h2 { + background: #00ff00; + background: url('h2.png'); +} + +#irssistats div.h3 { + background: #ffff00; + background: url('h3.png'); +} + +#irssistats div.h4 { + background: #ff0000; + background: url('h4.png'); +} + +#irssistats div.hm { + background: #ff00ff; + background: url('hm.png'); +} + +#irssistats div.v1 { + background: #0000ff; + background: url('v1.png'); +} + +#irssistats div.v2 { + background: #00ff00; + background: url('v2.png'); +} + +#irssistats div.v3 { + background: #ffff00; + background: url('v3.png'); +} + +#irssistats div.v4 { + background: #ff0000; + background: url('v4.png'); +} + +#irssistats div.vm { + background: #ff00ff; + background: url('vm.png'); +} \ No newline at end of file diff --git a/data/zerezo.css b/data/zerezo.css new file mode 100644 index 0000000..d8d47a4 --- /dev/null +++ b/data/zerezo.css @@ -0,0 +1,135 @@ +/* Green theme... */ + +body { + background: #000000; +} + +#irssistats * { + font-family: Verdana, Arial, Helvetica, sans-serif; + color: #FFFFFF; + margin: 0; +} + +#irssistats A { + color: #14F024; +} + +#irssistats A:hover { + color: #FFFFFF; +} + +#irssistats img { + border: 0; +} + +#irssistats h1 { + font-size: 20pt; + margin-bottom: 10px; + color: #0CBA18; +} + +#irssistats h2 { + font-size: 15pt; + margin-bottom: 5px; + color: #84DB8C; +} + +#irssitats p { + font-size: 10pt; +} + +#irssistats th { + font-size: 9pt; + background: #0B810B; + border: 1px #006600 solid; +} + +#irssistats td { + font-size: 9pt; + background: #085D10; + border: 1px #003300 solid; +} + +#irssistats td.oneline { + width: 100px; +} + +#irssistats small { + font-size: 7pt; +} + +#irssistats table { + margin-left: auto; + margin-right: auto; +} + +#irssistats div { + padding: 10px; + margin: 10px; + text-align: center; +} + +#irssistats div.h1, #irssistats div.h2, #irssistats div.h3, #irssistats div.h4, #irssistats div.hm { + float: left; + height: 15px; + margin: 0; + padding: 0; + border: 0; +} + +#irssistats div.v1, #irssistats div.v2, #irssistats div.v3, #irssistats div.v4, #irssistats div.vm { + width: 15px; + margin: 0; + padding: 0; + border: 0; +} + +#irssistats div.h1 { + background: #0000ff; + background: url('h1.png'); +} + +#irssistats div.h2 { + background: #00ff00; + background: url('h2.png'); +} + +#irssistats div.h3 { + background: #ffff00; + background: url('h3.png'); +} + +#irssistats div.h4 { + background: #ff0000; + background: url('h4.png'); +} + +#irssistats div.hm { + background: #ff00ff; + background: url('hm.png'); +} + +#irssistats div.v1 { + background: #0000ff; + background: url('v1.png'); +} + +#irssistats div.v2 { + background: #00ff00; + background: url('v2.png'); +} + +#irssistats div.v3 { + background: #ffff00; + background: url('v3.png'); +} + +#irssistats div.v4 { + background: #ff0000; + background: url('v4.png'); +} + +#irssistats div.vm { + background: #ff00ff; + background: url('vm.png'); +} \ No newline at end of file diff --git a/irssistats.1 b/irssistats.1 deleted file mode 100755 index 2e7495c..0000000 --- a/irssistats.1 +++ /dev/null @@ -1,84 +0,0 @@ -.TH irssistats 1 23-Nov-2002 "version 0.44" irssistats - -.SH NAME -irssistats - A tool to generate HTML IRC stats based on irssi logs. - -.SH SYNOPSIS -cat /path/to/file.log | \fBirssistats\fP \fI\\#channel\fP \fImaintainer\fP \fIlanguage\fP \fItheme\fP \fI[nickfile]\fP > /path/to/webdir/index.html - -.SH DESCRIPTION -\fBirssistats\fP is a tool that make HTML stats from \fIirssi\fP logfiles. -.PP -It works like a filter (it reads data in input and produces the HTML page on the output). -.PP -The statistics generated display many useful and funny informations about the channel. - -.SH USING IT -First you need to copy the images needed for the HTML page : -.PP -.B cp /usr/share/irssistats/pix/* /path/to/webdir/ -.PP -Now you can generate the statistics for your channel : -.PP -.B cat /path/to/file.log | irssistats \\\\#channel maintainer language theme [nickfile] > /path/to/webdir/index.html -.PP -The logfiles for \fIirssi\fP are usually located in "~/irclogs/network/channel.log" - -.SH COMMAND LINE OPTIONS -All the options (except the nickfile) are mandatory and have to be set at the good place on the command line. -.PP -If you make any mistake on the command line, \fBirssistats\fP will remind you the usage. -.PP -Launching \fBirssistats\fP without any parameters is a good way to show the available options. -.PP -.TP 8 -.B \\\\#channel -Specifies the name of the channel you are parsing. Don't forget to escape the '#' character in the channel name. -.TP 8 -.B maintainer -Nickname of the person generating the statistics (you !). -.TP 8 -.B language -Language you want to use to display the statistics (example : "en" for english). -.TP 8 -.B theme -Theme (colors) to use for the statistics (example : "default" for the default theme). -.TP 8 -.B nickfile -This is the only optional argument. Specifies an alias file for nicks. See Below. - -.SH NICKFILE -Since version 0.4 of \fBirssistats\fP, you can use a nickfile to specify nicks to join. -.PP -Each line of the nickfile contains the final nick and a regular expression. -.PP -Examples : -.TP 8 -.B royale ^[Rr]oyale -join nicks starting with "Royale" or "royale" to the final nick "royale" -.TP 8 -.B royale ^antoine$ -also join the nick "antoine" to the final nick "royale" -.TP 8 -.B djakette [Dd]ja -join any nick that contains "Dja" or "dja" to final nick "djakette" -.TP 8 -.B ^bot\\\\|royale$ -remove "bot|royale" from statistics -.PP -The nickfile must not contain any comments. -.PP -The final nick will remove matching nicks from all statistics, except from "Some URLs" and "Some topics"... -.PP -You can also take a look at the "sample.nickfile.txt" in this package (in "/usr/share/doc/irssistats/"). - -.SH SEE ALSO -irssi(1) - -.SH INFORMATIONS -You can find informations and updates of \fBirssistats\fP at \fIhttp://royale.zerezo.com/irssistats/\fP. -.PP -Report bugs to \fIroyale@zerezo.com\fP. - -.SH AUTHOR -Antoine Jacquet <\fIroyale@zerezo.com\fP> diff --git a/irssistats.c b/irssistats.c old mode 100755 new mode 100644 index 832b239..ae6b2a8 --- a/irssistats.c +++ b/irssistats.c @@ -1,15 +1,12 @@ -/* Usage: cat /path/to/file.log | ./irssistats \#channel maintainer language theme [nickfile] > /path/to/file.html */ +/* Usage: irssistats [/path/to/file.conf] */ +#include #include #include #include #include #include -/* Options */ -#define REFRESH_TIME 3600 -#define W3C_LINK - /* Config */ #define MAXUSERS 10000 #define MAXNICKLENGTH 50 @@ -23,7 +20,7 @@ #define MINWORDLENGTH 5 /* irssistats */ -#define VERSION "0.44" +#define VERSION "0.5" #define URL "http://royale.zerezo.com/irssistats/" /* Counters */ @@ -44,7 +41,7 @@ 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 6 +#define NBLANGUAGES 8 #define NBKEYS 38 char *keys[NBLANGUAGES][NBKEYS+1][2]= /* first key used for language name and abbreviation */ { @@ -90,7 +87,7 @@ char *keys[NBLANGUAGES][NBKEYS+1][2]= /* first key used for language name and ab { "C_MONOLOGUE", "speaks a lot of monologues" } }, { /* French language */ - { "French", "fr" }, + { "French", "fr" }, { "HEADER", "Statistiques de %s par %s" }, { "LEGEND", "Légende" }, { "LASTDAYS", "Statistiques des derniers jours" }, @@ -297,10 +294,94 @@ char *keys[NBLANGUAGES][NBKEYS+1][2]= /* first key used for language name and ab { "C_JOIN", "ei tiedä ollakko vai eikö olla" }, { "C_NICK", "kärsii identiteettiongelmista" }, { "C_MONOLOGUE", "höpöttää paljon itsekseen" } - } + }, + { /* Italian language */ + /* contributed by Coviello Giuseppe */ + { "Italian", "it" }, + { "HEADER", "Statistiche per il canale %s di %s" }, + { "LEGEND", "Legenda" }, + { "LASTDAYS", "Statistiche degli ultimi giorni" }, + { "TOPHOURS", "Statistiche in ore" }, + { "TOPUSERS", "Utenti più attivi" }, + { "OTHERS", "Ci sono %d utenti non classificati..." }, + { "NBLINES", "righe" }, + { "NICK", "nick" }, + { "AVGLETTERS", "lettere/righe" }, + { "HOURS", "ore" }, + { "QUOTE", "messaggio casuale" }, + { "TOPUSERSTIME", "Utenti più attivi del giorno (divisi per fasce orarie)" }, + { "RANDTOPICS", "Alcuni topic" }, + { "CHANGEDBY", "cambiato da" }, + { "NEWTOPIC", "nuovo topic" }, + { "RANDURLS", "ALcuni URL" }, + { "POSTEDBY", "postato da" }, + { "POSTEDURL", "URL" }, + { "TOPWORDS", "Le parole più usate" }, + { "WORD", "parola" }, + { "OCCURRENCES", "usata" }, + { "BIGNUMBERS", "Alcuni numeri ..." }, + { "NUMBERS", "numeri" }, + { "TIME", "%d righe (%d giorni) esaminate in %d secondi" }, + { "FOOTER", "Statistiche generate da" }, + { "C_SMILE", "è spesso felice :)" }, + { "C_FROWN", "è spesso triste :(" }, + { "C_EXCLAM", "esclama molto !" }, + { "C_QUESTION", "fa molte domande ?" }, + { "C_ME", "ama il comando /me" }, + { "C_TOPIC", "cambia spesso il topic" }, + { "C_MODE", "cambia spesso i mode" }, + { "C_KICK", "ama /kick(are)" }, + { "C_KICKED", "è kickato spesso" }, + { "C_URL", "posta molti URL" }, + { "C_JOIN", "non sa se è ora di andare o restare" }, + { "C_NICK", "cambia spesso il nick" }, + { "C_MONOLOGUE", "fa molti monologhi" } + }, + { /* Dutch language */ + /* contributed by Jeroen Ubbink */ + { "Dutch", "nl" }, + { "HEADER", "Statistieken voor %s door %s" }, + { "LEGEND", "Legenda" }, + { "LASTDAYS", "Statistieken van de laatste dagen" }, + { "TOPHOURS", "Statistieken per uur" }, + { "TOPUSERS", "Meest actieve mensen" }, + { "OTHERS", "Er zijn nog %d niet in de top..." }, + { "NBLINES", "regels" }, + { "NICK", "nick" }, + { "AVGLETTERS", "letters/lijn" }, + { "HOURS", "uren" }, + { "QUOTE", "Willekeurige regel" }, + { "TOPUSERSTIME", "Meest actieve mensen per tijdstip per dag" }, + { "RANDTOPICS", "Enkele topics" }, + { "CHANGEDBY", "gewijzigd door" }, + { "NEWTOPIC", "nieuwe topic" }, + { "RANDURLS", "Enkele URLs" }, + { "POSTEDBY", "Geplaatst door" }, + { "POSTEDURL", "URL" }, + { "TOPWORDS", "Meest gebruikte woorden" }, + { "WORD", "woord" }, + { "OCCURRENCES", "aantal" }, + { "BIGNUMBERS", "Enkele grote aantallen..." }, + { "NUMBERS", "numbers" }, + { "TIME", "%d regels (%d dagen) verwerkt in %d seconden" }, + { "FOOTER", "Statistieken gegenereert door" }, + { "C_SMILE", "is vaak vrolijk :)" }, + { "C_FROWN", "is vaak droevig :(" }, + { "C_EXCLAM", "schreeuwt veel !" }, + { "C_QUESTION", "stelt veel vragen ?" }, + { "C_ME", "vindt /me een leuk commando" }, + { "C_TOPIC", "verandert vaak de topic" }, + { "C_MODE", "verandert vaak de modes" }, + { "C_KICK", "vindt /kick erg leuk" }, + { "C_KICKED", "wordt vaak gekickt" }, + { "C_URL", "plaatst veel URLs" }, + { "C_JOIN", "twijfelt tussen blijven of gaan" }, + { "C_NICK", "verandert vaak van nick" }, + { "C_MONOLOGUE", "spreekt veel monologen" } + } }; -int language; +int language=0; /* default to english */ char *L(char *key) { @@ -310,99 +391,18 @@ char *L(char *key) return(""); } -/* Themes */ -#define NBTHEMES 6 -#define NBCOLORS 9 -char *colors[NBTHEMES][NBCOLORS+1][2]= /* first key used for theme name/description and abbreviation */ -{ - { /* Default theme */ - { "White background", "default" }, - { "BGCOLOR", "#FFFFFF" }, - { "TEXT", "#000000" }, - { "LINK", "#0000EE" }, - { "VLINK", "#551A8B" }, - { "ALINK", "#FF0000" }, - { "TITLE1", "#000000" }, - { "TITLE2", "#000000" }, - { "BGTABLE", "#EEEEEE" }, - { "BGTITLE", "#FFEEEE" } - }, - { /* Dark theme */ - { "Black background", "dark" }, - { "BGCOLOR", "#000000" }, - { "TEXT", "#FFFFFF" }, - { "LINK", "#AAAAFF" }, - { "VLINK", "#CCCCDD" }, - { "ALINK", "#FFAAAA" }, - { "TITLE1", "#AAAAFF" }, - { "TITLE2", "#FFAAAA" }, - { "BGTABLE", "#225522" }, - { "BGTITLE", "#552222" } - }, - { /* zeRezo theme */ - { "Green theme...", "zerezo" }, - { "BGCOLOR", "#000000" }, - { "TEXT", "#FFFFFF" }, - { "LINK", "#14F024" }, - { "VLINK", "#0CBA18" }, - { "ALINK", "#FFFFFF" }, - { "TITLE1", "#0CBA18" }, - { "TITLE2", "#84DB8C" }, - { "BGTABLE", "#085D10" }, - { "BGTITLE", "#0B810B" } - }, - { /* tit-namour theme */ - { "Purple and Pink", "namour" }, - { "BGCOLOR", "#9933CC" }, - { "TEXT", "#DDAAFF" }, - { "LINK", "#CC99FF" }, - { "VLINK", "#999999" }, - { "ALINK", "#FFC8C8" }, - { "TITLE1", "#FFC8C8" }, - { "TITLE2", "#FFC8C8" }, - { "BGTABLE", "#7711AA" }, - { "BGTITLE", "#550088" } - }, - { /* zeDuel theme */ - { "Orange theme...", "zeduel" }, - { "BGCOLOR", "#FFFFFF" }, - { "TEXT", "#000000" }, - { "LINK", "#FF7700" }, - { "VLINK", "#C05A00" }, - { "ALINK", "#FF9A41" }, - { "TITLE1", "#C05A00" }, - { "TITLE2", "#FF7700" }, - { "BGTABLE", "#FFEEEE" }, - { "BGTITLE", "#FF7700" } - }, - { /* Blue theme */ - { "Blue theme...", "blue" }, - { "BGCOLOR", "#FFFFFF" }, - { "TEXT", "#000000" }, - { "LINK", "#4444FF" }, - { "VLINK", "#8888FF" }, - { "ALINK", "#CCCCFF" }, - { "TITLE1", "#8888FF" }, - { "TITLE2", "#AAAAFF" }, - { "BGTABLE", "#EEEEFF" }, - { "BGTITLE", "#CCCCFF" } - } -}; - -int theme; - -char *T(char *color) -{ - int i; - for (i=1;i<=NBCOLORS;i++) if (strcmp(color,colors[theme][i][0])==0) return(colors[theme][i][1]); - fprintf(stderr,"unknown theme color: %s\n",color); - return(""); -} - /* Variables */ -char *channel; -char *maintainer; +int debug=1; /* 0 = none ; 1 = normal ; 2 = verbose */ +char channel[MAXLINELENGTH]="set_channel_in_config_file"; +char maintainer[MAXLINELENGTH]="set_maintainer_in_config_file"; +char theme[MAXLINELENGTH]="default"; +int refresh_time=0; /* 0 = disabled */ +int w3c_link=1; /* 0 = disabled */ +char header[MAXLINELENGTH]="none"; +char footer[MAXLINELENGTH]="none"; +int totallines=0; +time_t debut; struct { @@ -504,16 +504,27 @@ void bestwords(struct letter pos,int cur) tempword[cur]='\0'; } -void printhtml(char *string) /* replace < and > by < and > */ +void freewords(struct letter *pos) +{ + int i; + for (i=0;i<26;i++) if (pos->next[i]!=NULL) + { + freewords(pos->next[i]); + free(pos->next[i]); + (*pos).next[i]=NULL; + } +} + +void printhtml(FILE *fic,char *string) /* replace < and > by < and > */ { while (*string!='\0') { switch (*string) { - case '<':printf("<"); break; - case '>':printf(">"); break; - case '&':printf("&"); break; - default:printf("%c",*string); break; + case '<':fprintf(fic,"<"); break; + case '>':fprintf(fic,">"); break; + case '&':fprintf(fic,"&"); break; + default:fprintf(fic,"%c",*string); break; } string++; } @@ -553,288 +564,287 @@ int dichotomic(char *nick) return(start); } -int main(int argc,char *argv[]) +void parse_log(char *logfile) { - int i,j,k; - int max,user,temp,hour; - int mononick,monolines; - time_t debut; - int totallines=0; - int pos=0; - char c; - char *nick,*message; - char line[MAXLINELENGTH]; FILE *fic; - regex_t preg; - - /*** INIT ***/ - - if ((argc<5) || (argc>6)) - { - fprintf(stderr,"Usage: cat /path/to/file.log | ./irssistats \\#channel maintainer language theme [nickfile] > /path/to/file.html\n\n"); - fprintf(stderr,"Version :\nirssistats %s\n\n",VERSION); - fprintf(stderr,"Supported languages :\n"); - for (i=0;i=MAXLINELENGTH) { fprintf(stderr,"line %d is too long\n",totallines); exit(1); } - if (c=='\n') + /* remove \n */ + for (i=0;line[i]!=0;i++); + if (i>=MAXLINELENGTH-1) { fprintf(stderr,"line %d is too long\n",totallines); exit(1); } + line[i-1]='\0'; + pos=0; + totallines++; + if (totallines%10000==0 && debug) { printf("."); fflush(stdout); } + if (strncmp("--- Day changed",line,15)==0) /* --- Day changed Wed May 01 2002 */ + { + for (i=30;i>0;i--) + { + lastdays[i].lines=lastdays[i-1].lines; + for (j=0;j<4;j++) lastdays[i].hours[j]=lastdays[i-1].hours[j]; + } + lastdays[0].lines=0; + for (j=0;j<4;j++) lastdays[0].hours[j]=0; + days++; + } + else if (strncmp("-!- mode/",&line[6],9)==0) /* 00:00 -!- mode/#channel [...] by (Nick, Nick2, )Nick3 */ + { + for (i=strlen(line);line[i]!=' ';i--); + nick=&line[i+1]; + users[dichotomic(nick)].counters[D_MODE]++; + } + else if (strncmp("-!-",&line[6],3)==0) /* 00:00 -!- Nick something... */ { - line[pos-1]='\0'; - totallines++; - if (totallines%10000==0) { fprintf(stderr,"."); fflush(stderr); } - if (strncmp("--- Day changed",line,15)==0) /* --- Day changed Wed May 01 2002 */ + for (i=10;line[i]!=' ';i++); + line[i]='\0'; + nick=&line[10]; + message=&line[i+1]; + if (strncmp("changed the topic of",message,20)==0) /* 00:00 -!- Nick changed the topic of #channel to: new topic */ { - for (i=30;i>0;i--) + users[dichotomic(nick)].counters[D_TOPIC]++; + for (i=21;message[i]!=':';i++); + message=&message[i+2]; + nbtopics++; + if ((nbtopics<=NBTOPICS) || (rand()%(nbtopics/NBTOPICS)==0)) { - lastdays[i].lines=lastdays[i-1].lines; - for (j=0;j<4;j++) lastdays[i].hours[j]=lastdays[i-1].hours[j]; + temp=nbtopics<=NBTOPICS?nbtopics-1:rand()%NBTOPICS; + strcpy(topics[temp].nick,nick); + strncpy(topics[temp].topic,message,MAXQUOTELENGTH); } - lastdays[0].lines=0; - for (j=0;j<4;j++) lastdays[0].hours[j]=0; - days++; } - else if (strncmp("-!- mode/",&line[6],9)==0) /* 00:00 -!- mode/#channel [...] by (Nick, Nick2, )Nick3 */ + else if (strncmp("was kicked from",message,15)==0) /* 00:00 -!- Nick was kicked from #channel by Nick [Reason] */ { - for (i=strlen(line);line[i]!=' ';i--); - nick=&line[i+1]; - users[dichotomic(nick)].counters[D_MODE]++; + users[dichotomic(nick)].counters[D_KICKED]++; + for (i=16;message[i]!=' ';i++); + message=&message[i+4]; + for (i=0;message[i]!=' ';i++); + message[i]='\0'; + users[dichotomic(message)].counters[D_KICK]++; } - else if (strncmp("-!-",&line[6],3)==0) /* 00:00 -!- Nick something... */ + else if (strncmp("is now known as",message,15)==0) /* 00:00 -!- Nick is now known as Nick */ + users[dichotomic(nick)].counters[D_NICK]++; + else if (message[0]=='[') /* 00:00 -!- Nick [user@host] something... */ { - for (i=10;line[i]!=' ';i++); - line[i]='\0'; - nick=&line[10]; + for (i=0;message[i]!=']';i++); + message=&message[i+2]; + if (strncmp("has joined",message,10)==0) /* 00:00 -!- Nick [user@host] has joined #channel */ + users[dichotomic(nick)].counters[D_JOIN]++; + else if (strncmp("has quit",message,8)==0); /* 00:00 -!- Nick [user@host] has quit [Reason] */ + else if (strncmp("has left",message,8)==0); /* 00:00 -!- Nick [user@host] has left #channel [Reason] */ + else; + } + } + else if ((line[6]=='<') || (line[7]=='*')) + { + line[2]='\0'; + hour=atoi(line); + if (line[7]=='*') /* 00:00 * Nick the message */ + { + for (i=9;line[i]!=' ';i++); + nick=&line[9]; message=&line[i+1]; - if (strncmp("changed the topic of",message,20)==0) /* 00:00 -!- Nick changed the topic of #channel to: new topic */ - { - users[dichotomic(nick)].counters[D_TOPIC]++; - for (i=21;message[i]!=':';i++); - message=&message[i+2]; - nbtopics++; - if ((nbtopics<=NBTOPICS) || (rand()%(nbtopics/NBTOPICS)==0)) - { - 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] */ - { - users[dichotomic(nick)].counters[D_KICKED]++; - for (i=16;message[i]!=' ';i++); - message=&message[i+4]; - for (i=0;message[i]!=' ';i++); - message[i]='\0'; - users[dichotomic(message)].counters[D_KICK]++; - } - else if (strncmp("is now known as",message,15)==0) /* 00:00 -!- Nick is now known as Nick */ - users[dichotomic(nick)].counters[D_NICK]++; - else if (message[0]=='[') /* 00:00 -!- Nick [user@host] something... */ - { - for (i=0;message[i]!=']';i++); - message=&message[i+2]; - if (strncmp("has joined",message,10)==0) /* 00:00 -!- Nick [user@host] has joined #channel */ - users[dichotomic(nick)].counters[D_JOIN]++; - else if (strncmp("has quit",message,8)==0); /* 00:00 -!- Nick [user@host] has quit [Reason] */ - else if (strncmp("has left",message,8)==0); /* 00:00 -!- Nick [user@host] has left #channel [Reason] */ - else; - } } - else if ((line[6]=='<') || (line[7]=='*')) + else if (line[7]=='>') /* 00:00 <>>>?Nick<<<> the personal message */ + /* 00:00 <>>?Nick<<> the personal message */ { - line[2]='\0'; - hour=atoi(line); - if (line[7]=='*') /* 00:00 * Nick the message */ - { - for (i=9;line[i]!=' ';i++); - nick=&line[9]; - message=&line[i+1]; - } - else if (line[7]=='>') /* 00:00 <>>>?Nick<<<> the personal message */ - /* 00:00 <>>?Nick<<> the personal message */ - { - for (i=10;line[i]!='<';i++); - nick=&line[10]; - if (line[9]=='>') nick++; - message=&line[i+5]; - } - else /* 00:00 the message */ - { - for (i=8;line[i]!='>';i++); - nick=&line[8]; - message=&line[i+2]; - } - line[i]='\0'; - i=dichotomic(nick); - if (line[7]=='*') users[i].counters[D_ME]++; - if (i==mononick) - { - monolines++; - if (monolines==5) users[i].counters[D_MONOLOGUE]++; - } - else - { - mononick=i; - monolines=1; - } - j=strlen(message); - users[i].lines++; - users[i].letters+=j; - users[i].hours[hour/6]++; - lastdays[0].lines++; - lastdays[0].hours[hour/6]++; - lines++; - hours[hour]++; - if (message[j-1]=='?') users[i].counters[D_QUESTION]++; - else if (message[j-1]=='!') users[i].counters[D_EXCLAM]++; - else if ((message[j-3]==' ')&&(message[j-2]==':')) - { - if (message[j-1]==')') users[i].counters[D_SMILE]++; - else if (message[j-1]=='(') users[i].counters[D_FROWN]++; + for (i=10;line[i]!='<';i++); + nick=&line[10]; + if (line[9]=='>') nick++; + message=&line[i+5]; + } + else /* 00:00 the message */ + { + + /* + * Irssi doesn't log channel mode with show_nickmode = OFF + * the following covers op, half-op, voice and show_nickmode_empty + */ + if (line[7]=='@' || line[7]=='%' || line[7]=='+' || line[7]==' ') { + nickstart = 8; + } else { + nickstart = 7; } - if (rand()%users[i].lines==0) strncpy(users[i].quote,message,MAXQUOTELENGTH); - if (strncmp("http://",message,7)==0) + + for (i=nickstart;line[i]!='>';i++); + nick=&line[nickstart]; + message=&line[i+2]; + } + line[i]='\0'; + i=dichotomic(nick); + if (line[7]=='*') users[i].counters[D_ME]++; + if (i==mononick) + { + monolines++; + if (monolines==5) users[i].counters[D_MONOLOGUE]++; + } + else + { + mononick=i; + monolines=1; + } + j=strlen(message); + users[i].lines++; + users[i].letters+=j; + users[i].hours[hour/6]++; + lastdays[0].lines++; + lastdays[0].hours[hour/6]++; + lines++; + hours[hour]++; + if (message[j-1]=='?') users[i].counters[D_QUESTION]++; + else if (message[j-1]=='!') users[i].counters[D_EXCLAM]++; + else if ((message[j-3]==' ')&&(message[j-2]==':')) + { + if (message[j-1]==')') users[i].counters[D_SMILE]++; + else if (message[j-1]=='(') users[i].counters[D_FROWN]++; + } + if (rand()%users[i].lines==0) strncpy(users[i].quote,message,MAXQUOTELENGTH); + if (strncmp("http://",message,7)==0) + { + users[i].counters[D_URL]++; + for (i=0;(message[i]!=' ') && (i=0)) { - user=dichotomic(line); - fscanf(fic,"%s",line); - if (regcomp(&preg,line,0)!=0) { fprintf(stderr,"error in nick file"); exit(1); } - for (i=0;i=0)) + if (users[i].temp>users[user].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); - users[user].temp=users[i].temp; - } - users[user].lines+=users[i].lines; - users[user].letters+=users[i].letters; - for (j=0;j<4;j++) users[user].hours[j]+=users[i].hours[j]; - for (j=0;j"); - users[i].lines=-1; - users[i].letters=-1; - for (j=0;j<4;j++) users[i].hours[j]=-1; - for (j=0;j"); + users[i].lines=-1; + users[i].letters=-1; + for (j=0;j<4;j++) users[i].hours[j]=-1; + for (j=0;j\n\n"); - printf("\n\n",VERSION,URL); - printf("\n\n\n"); - printf(L("HEADER"),channel,maintainer); - 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)); + if (strcmp("none",header)==0) + { + fprintf(fic,"\n\n"); + fprintf(fic,"\n\n",VERSION,URL); + fprintf(fic,"\n\n\n"); + fprintf(fic,L("HEADER"),channel,maintainer); + fprintf(fic,"\n\n"); + if (refresh_time) + fprintf(fic,"\n",refresh_time); + fprintf(fic,"\n",theme); + fprintf(fic,"\n\n"); + fprintf(fic,"\n\n"); + } + else + { + if ((sfic=fopen(header,"rt"))==NULL) { fprintf(stderr,"can't open header file \"%s\"\n",header); exit(1); } + while ((temp=fread(line,1,MAXLINELENGTH,sfic))) fwrite(line,temp,1,fic); + fclose(sfic); + } + fprintf(fic,"
\n\n
\n

"); + fprintf(fic,L("HEADER"),channel,maintainer); + fprintf(fic,"

\n

\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("\n
\"\" : %s %d-%d
\n

\n\n"); + fprintf(fic,"
\n

%s

\n\n\n",L("LEGEND")); + for (i=0;i<4;i++) fprintf(fic,"\n",i+1,L("HOURS"),i*6,i*6+5); + fprintf(fic,"\n
%s %d-%d
\n
\n\n"); /* last days */ - printf("%s

\n\n\n",T("TITLE2"),L("LASTDAYS")); + fprintf(fic,"
\n

%s

\n
\n\n",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"); + fprintf(fic,"\n"); } - printf("\n\n"); + fprintf(fic,"\n\n"); for (i=30;i>=0;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); - printf("
%d",lastdays[i].lines); /* width=\"15\" */ + for (j=0;j<4;j++) if (lastdays[i].hours[j]!=0) fprintf(fic,"
",j+1,150*lastdays[i].hours[j]/max); + fprintf(fic,"
%d
\n

\n\n"); + fprintf(fic,"%d\n",i); + fprintf(fic,"\n\n
\n\n"); /* top hours */ - printf("%s

\n\n\n",T("TITLE2"),L("TOPHOURS")); + fprintf(fic,"
\n

%s

\n
\n\n",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"); + fprintf(fic,"\n"); } - printf("\n\n"); + fprintf(fic,"\n\n"); for (i=0;i<24;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); - printf("
%.1f%%",lines!=0?(float)100*hours[i]/lines:0); /* width=\"15\" */ + if (hours[i]!=0) fprintf(fic,"
",i/6+1,150*hours[i]/max); + fprintf(fic,"
%d
\n

\n\n"); + fprintf(fic,"%d\n",i); + fprintf(fic,"\n\n\n\n"); /* top users */ - 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")); + fprintf(fic,"
\n

%s

\n",L("TOPUSERS")); + fprintf(fic,"
%s%s%s%s%s
\n\n",L("NICK"),L("NBLINES"),L("HOURS"),L("AVGLETTERS"),L("QUOTE")); for (i=1;i<=NBUSERS;i++) { user=-1; @@ -842,33 +852,33 @@ int main(int argc,char *argv[]) for (j=0;jmax) max=users[user=j].lines; if (user!=-1) { - printf("\n"); + fprintf(fic,"\n"); users[user].lines=-1; } } - 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")); - printhtml(users[user].quote); - printf("\"
%d%s%d",i,users[user].nick,users[user].lines); + for (j=0;j<4;j++) if (users[user].hours[j]!=0) fprintf(fic,"
",j+1,100*users[user].hours[j]/users[user].lines); + fprintf(fic,"
%d
\"",users[user].lines!=0?users[user].letters/users[user].lines:0,users[user].lines!=0?users[user].letters/users[user].lines:0); + printhtml(fic,users[user].quote); + fprintf(fic,"\"
\n"); + fprintf(fic,"\n"); temp=0; for (i=0;i<=nbusers;i++) if (users[i].lines>=0) temp++; if (temp>0) { - printf("
"); - printf(L("OTHERS"),temp); - printf("
\n"); + fprintf(fic,"

"); + fprintf(fic,L("OTHERS"),temp); + fprintf(fic,"

\n"); } - printf("

\n\n"); + fprintf(fic,"\n\n"); /* top users by time */ - printf("%s

\n",T("TITLE2"),L("TOPUSERSTIME")); - printf("\n"); - for (i=0;i<4;i++) printf("",T("BGTITLE"),L("HOURS"),i*6,i*6+5); - printf("\n"); + fprintf(fic,"
\n

%s

\n",L("TOPUSERSTIME")); + fprintf(fic,"
%s %d-%d
\n"); + for (i=0;i<4;i++) fprintf(fic,"",L("HOURS"),i*6,i*6+5); + fprintf(fic,"\n"); for (i=1;i<=NBUSERSTIME;i++) { - printf("",T("BGTABLE"),i); + fprintf(fic,"",i); for (j=0;j<4;j++) { user=-1; @@ -876,65 +886,242 @@ int main(int argc,char *argv[]) for (k=0;kmax) max=users[user=k].hours[j]; if (user!=-1) { - printf("",T("BGTABLE"),users[user].nick,T("BGTABLE"),users[user].hours[j]); + fprintf(fic,"",users[user].nick,users[user].hours[j]); users[user].hours[j]=-1; } - else printf(""); + else fprintf(fic,""); } - printf("\n"); + fprintf(fic,"\n"); } - printf("
%s %d-%d
%d
%d%s%d%s%d
\n

\n\n"); + fprintf(fic,"\n\n\n"); /* random topics */ - printf("%s

\n",T("TITLE2"),L("RANDTOPICS")); - printf("\n\n",T("BGTITLE"),L("CHANGEDBY"),T("BGTITLE"),L("NEWTOPIC")); + fprintf(fic,"
\n

%s

\n",L("RANDTOPICS")); + fprintf(fic,"
%s%s
\n\n",L("CHANGEDBY"),L("NEWTOPIC")); for (i=nbtopics=0;i--) { - printf("\n"); + fprintf(fic,"\n"); } - printf("
%s%s
%s\"",T("BGTABLE"),topics[i].nick,T("BGTABLE")); - printhtml(topics[i].topic); - printf("\"
%s\"",topics[i].nick); + printhtml(fic,topics[i].topic); + fprintf(fic,"\"
\n

\n\n"); + fprintf(fic,"\n\n\n"); /* random urls */ - printf("%s

\n",T("TITLE2"),L("RANDURLS")); - printf("\n\n",T("BGTITLE"),L("POSTEDBY"),T("BGTITLE"),L("POSTEDURL")); + fprintf(fic,"
\n

%s

\n",L("RANDURLS")); + fprintf(fic,"
%s%s
\n\n",L("POSTEDBY"),L("POSTEDURL")); for (i=nburls=0;i--) { - printf("\n"); + fprintf(fic,"\n"); } - printf("
%s%s
%s\""); - printhtml(urls[i].shorturl); - printf("\"
%s\""); + printhtml(fic,urls[i].shorturl); + fprintf(fic,"\"
\n

\n\n"); + fprintf(fic,"\n\n\n"); /* top words */ - printf("%s

\n",T("TITLE2"),L("TOPWORDS")); - printf("\n\n",T("BGTITLE"),L("WORD"),T("BGTITLE"),L("OCCURRENCES")); + fprintf(fic,"
\n

%s

\n",L("TOPWORDS")); + fprintf(fic,"
%s%s
\n\n",L("WORD"),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"); + if (topwords[i].nb!=0) fprintf(fic,"%d\"%s\"%d\n",i+1,topwords[i].word,topwords[i].nb); + fprintf(fic,"\n\n\n"); /* big numbers */ - printf("%s

\n",T("TITLE2"),L("BIGNUMBERS")); - printf("\n\n",T("BGTITLE"),L("NICK"),T("BGTITLE"),L("NUMBERS"),T("BGTITLE"),L("NBLINES")); + fprintf(fic,"
\n

%s

\n",L("BIGNUMBERS")); + fprintf(fic,"
%s%s%s
\n\n",L("NICK"),L("NUMBERS"),L("NBLINES")); for (i=0;imax) max=users[user=j].counters[i]; - if (user!=-1) printf("",T("BGTABLE"),users[user].nick,T("BGTABLE"),L(counters[i]),T("BGTABLE"),users[user].counters[i]); + if (user!=-1) fprintf(fic,"",users[user].nick,L(counters[i]),users[user].counters[i]); } - printf("
%s%s%s
%s%s%d
%s%s%d
\n

\n\n"); + fprintf(fic,"\n\n\n"); /* footer */ - printf(L("TIME"),totallines,days,(int)(time(NULL)-debut)); - printf("
\n%s irssistats %s",L("FOOTER"),URL,VERSION); -#ifdef W3C_LINK - printf("

\n\n"); -#endif - printf("\n\n
\n\n\n\n\n"); + fprintf(fic,"
\n

"); + fprintf(fic,L("TIME"),totallines,days,(int)(time(NULL)-debut)); + fprintf(fic,"

\n

%s irssistats %s

\n",L("FOOTER"),URL,VERSION); + if (w3c_link) + { + fprintf(fic,"

\n\"Valid\n"); + fprintf(fic,"\"Valid\n

\n"); + } + fprintf(fic,"
\n\n"); + if (strcmp("none",header)==0) + { + fprintf(fic,"\n\n\n\n\n"); + } + else + { + if ((sfic=fopen(footer,"rt"))==NULL) { fprintf(stderr,"can't open footer file \"%s\"\n",footer); exit(1); } + while ((temp=fread(line,1,MAXLINELENGTH,sfic))) fwrite(line,temp,1,fic); + fclose(sfic); + } + fclose(fic); +} + +void parse_config(char *configfile) +{ + FILE *fic; + char line[MAXLINELENGTH]; + char keyword[MAXLINELENGTH]; + char value[MAXLINELENGTH]; + int configlines=0; + int i; + + if (configfile!=NULL) + { + if ((fic=fopen(configfile,"rt"))==NULL) + { + fprintf(stderr,"can't open config file : \"%s\"\n",configfile); + exit(1); + } + } + else + { + sprintf(line,"%s/.irssistats",getenv("HOME")); + if ((fic=fopen(line,"rt"))==NULL) + if ((fic=fopen("/etc/irssistats.conf","rt"))==NULL) + { + fprintf(stderr,"can't find config file : \"%s\" nor \"/etc/irssistats.conf\"\n",line); + fprintf(stderr,"please give the path to the config file in argument\n"); + exit(1); + } + } + + while (fgets(line,MAXLINELENGTH,fic)) + { + configlines++; + if (*line!=';' && *line!='#' && *line!='/' && *line!='-' && *line!='\n') + { + if ((sscanf(line,"%s : %s\n",(char *)&keyword,(char *)&value))!=2) { fprintf(stderr,"error in config file : each line must have the format \"keyword : value\" (line %d)\n",configlines); exit(1); } + + if (strcmp("debug",keyword)==0) + { + if (strcmp("none",value)==0) debug=0; + else + if (strcmp("normal",value)==0) debug=1; + else + if (strcmp("verbose",value)==0) { debug=2; fprintf(stderr,"switching to verbose output\n"); } + else { fprintf(stderr,"unknown value for \"debug\" option, must be \"normal\", \"verbose\" or \"none\"\n"); exit(1); } + } else + + if (strcmp("channel",keyword)==0) + { + if (debug==2) fprintf(stderr,"setting channel name to \"%s\"\n",value); + strcpy(channel,value); + } + else + + if (strcmp("maintainer",keyword)==0) + { + if (debug==2) fprintf(stderr,"setting maintainer to \"%s\"\n",value); + strcpy(maintainer,value); + } + else + + if (strcmp("language",keyword)==0) + { + if (debug==2) fprintf(stderr,"setting language to \"%s\"\n",value); + for (i=0;iC}Lq?6RjW#97SNcOe7M5BnqJliIqiI8l^Bu z0g3EZBZ(sni4Z7c(P6m5M2oPLVw6KMSi;~k4Tb6$)W~AI7By%PD~E9mY|){11I7?? z6N^YhAVnZr8s#*oNrxF()Xw9GLZWq;7%&opc&$U_(83y0PM|V|fMB@@MUBEo$K~nvm-p%sNyi5n4Eh560383WsPC(P>bl4zn8_3Ypb_jq(_$ff-Vc!V(Ro zup2QPm2o&AWQ=a3Z-;%Tq{8}LYM|&22jwX#(>eB zf?zc|qXc09IR!u@08xO9G@7iugXV8O$3e;EF!29Zl5v3(089p=KA?U0iFnWs%mM>a znj5=zgR@f5-sa<%D}3o!PQVN(B12tGn82eFIW^ z$FQ^@X}{mj@$P5C{wXD$3u10d7YBv)7p2$xgaiB5{Uc;&$=a}fjXbM4|3Ry3TD`(A zQWbCkA3UdO1;CiBk--!|zjxTV@zIOk2DD{U%l5628D}%v^1XI!EzIc3{!K6R4iP*N z241=QP3nc$S)F*pxfMi;uP~ydDelWdJ$u_?^9R0fEt@O!TNnTC<<_pT7SLbGm3e(? zY_&ezH<5U-z3%L0uHvBoVm|x)%jU`3U8HYtA0X}0mht(@*F#Z2ZN9I4(UGNzr5?=g zLZ>HK>akgAJHBdpcjZRyrA;>$yy{k_91D4!Fi1-!aPgF zoa#pOZAqv{%y&bo)Tn9E>Xk`8g7}1_u3@TtT|ummAh)z#>M|ptud#31iu=dEh}kbS z)`4_sw2PN+aF28N&4r`)4sFv)uLdlJB}0eHeAlj7Rg!Sw>f!QN+CicdlAX#a&fW05 ze*LM_5gA2cE%%f`IdcZWx7<})zWM51#+N}V^Ud8$mzbm7L~+t((n;u@(#s)>N0iEd zxKyXA>2aM2nMBUcBPWxaL@w3IEu!D5lG_8Gz)2@WF>sR5^FTt9hsbWebu7-irN=L6 z>`t%W#syC!>VX0>>I!7ob}b_1(DK0ZA)v0B%W>8zJ> zf2io_n)N`!nz`Yb;hRgA{oGWrJmQn&P$+I~Avj&y*EjQO-Q$gOI-YLvh%7w*+GBQI zYKA|s=59L`!4Ez9(XSwN;6~V)FufsQu{n1_!SZJ<3NU;`m>Cpv=eY&o@EIx9#XscUk}xh!ZCB1 ze_HXwUDs_DLDiq|V^8)aPa1!EDEY6R8QIau?sir6`0mY(6|>*{bh6eoIF%|gjUVzl z|MRdVjhT7)%P@)6;|U+tn4AF2?+h4pEVlPI&@(!GNGh@8lM&_LeIqJ|?T&j;omHv6+!2Hxt8uv3bsK z-cNmAzxS^Jrt{gYeZFT`y8|hk>5-i7sU5+Yb9O<^bbvWKNPKI^J|{(x5?eN@zqhOD zsm)WVUNWJ-(m8mgvs>P?_!V#aoPt~L_@581+6D++=iGOuvn$u7x7G=P)w%St-tH`M zioUy7aQ>ojPj%(+BD`JDE$BNHIjiHx2`6HvEHZabWyf4)HJf|CSi67rXYXu8FQ{<`dlgj#5*`ibV5z0q>Xjf`cRFN6+QG(PrsV z|MN%p@{*E;E7e!`-XDpmTOjS%`d(1GMa7pI=D%$@@b$U8z@t^Ep3W0@>Z8`i{C9=4 d_-$LG*Nb&A*N6En8J?=2y2ZlxYBd0S`ajKZ<>UYW diff --git a/sample.configfile b/sample.configfile new file mode 100644 index 0000000..d618512 --- /dev/null +++ b/sample.configfile @@ -0,0 +1,79 @@ +# This is the configuration file for irssistats. +# The path to this file can be given on the command line : irssistats /path/to/irssistats.conf +# If no configuration file is given, irssistats looks for files ~/.irssistats.conf or then /etc/irssistats.conf +# Lines starting by ; # -- or // are ignored (comments). +# This file is read sequencially, so it acts like a script. +# Each option keyword is case sensitive, and you must put separators around the ':' character. +# Blank lines must not contain any spaces ! +# Each option keeps its value until erased by another value. +# IMPORTANT : the order of options to parse a channel must allways be "input" THEN "nickfile" THEN "output". + +# Allows you to display debugging informations. +# Values : normal / verbose / none +# Default : normal +debug : verbose + +# Specifies the name of the channel you are parsing. +channel : #zerezo + +# Nickname of the person generating the statistics (you !). +maintainer : royale + +# Language you want to use to display the statistics +# Values : fr en de du es it fi +# Default : en +language : fr + +# Theme (colors) to use for the statistics +# In fact this is the name of the CSS file to include. +# This option has no effect if you use a custom header : you'll have to include the CSS yourself. +theme : orange + +# Specifies the refresh time in seconds (0 to disable) +# This option has no effect if you use a custom header : you'll have to include the refresh code yourself. +# Default : 3600 +refresh_time : 0 + +# Set this to "no" if you don't want the W3C logo. +# Default : yes +w3c_link : no + +# Use your custom header file (HTML code between included) +header : /path/to/header.html + +# Use your custom footer file (HTML code between and included) +footer : /path/to/footer.html + +# This allow you to parse a file. +# Note that irssistats will really parse the file as soon as it reads this option. +input : /path/to/#channel1.log + +# Let's parse another log. +# Note that this will merge "#channel and "#channel2" statistics... +# This is usefull if you splitted your channel file +input : /path/to/#newchannel1.log + +# This allow you to group nick using a nickfile. +# Note that irssistats will really merge the nicks as soon as it reads this option. +nickfile : /path/to/nickfile1.txt + +# This allow you to generate the HTML file. +# Note that irssistats will really generate the HTML file as soon as it reads this option. +output : /path/to/channel1.html + +# Change some options +language : en +debug : none + +# Do not use custom header and footer anymore +header : none +footer : none + +# Another chan without nickfile +input : /path/to/#channel2.log +output : /path/to/channel2.html + +# Another chan with nickfile +input : /path/to/#channel3.log +nickfile : /path/to/nickfile3.txt +output : /path/to/channel3.html diff --git a/sample.nickfile.txt b/sample.nickfile old mode 100755 new mode 100644 similarity index 100% rename from sample.nickfile.txt rename to sample.nickfile -- 2.20.1