Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias update_stats {
- var %mf = C:\mircstats\mircstats.exe
- if (!$isfile(%mf)) { return }
- if (%upload_stats) { return }
- var %t = $scon(0)
- var %i = 1
- while (%i <= %t) {
- var %n = $scon(%i).network
- var %c = $scon(%i).allchans
- var %ii = 1
- var %tt = $numtok(%c,44)
- while (%ii <= %tt) {
- var %chan = $gettok(%c,%ii,44)
- var %f = %chan $+ . $+ %n $+ .log
- var %f = $mkfn(%f)
- set -e %upload_stats $addtok(%upload_stats,%f,32)
- inc %ii
- }
- inc %i
- }
- if (%upload_stats) { upload_stats_start }
- }
- alias upload_stats_start {
- :again
- var %mf = C:\mircstats\mircstats.exe
- if (!$isfile(%mf)) { .timer[UPLOAD_STATS] off | return }
- if (!%upload_stats) { .timer[UPLOAD_STATS] off | return }
- var %g = $gettok(%upload_stats,$rand(1,$numtok(%upload_stats,32)),32)
- var %network = $gettok(%g,$calc($numtok(%g,46) -1),46)
- var %cid = $get_cid(%network)
- var %stats = $scid(%cid).status
- var %chan = $gettok(%g,1,46)
- var %file = $logdir $+ %g
- var %size = $bytes($file(%file).size).suf
- var %lines = $lines(%file)
- var %link = http://stats.3-a.net/irc/ $+ $remove(%chan,$chr(35)) $+ . $+ %network $+ .html
- set -e %upload_stats $remtok(%upload_stats,%g,1,32)
- if (!$isfile(%file)) { echo -a Error, NOT ANY FILE $qt($longfn(%file)) | goto again }
- if (!$lines(%file)) { echo -a Error, NOT ANY LINES $qt($longfn(%file)) | goto again }
- .run -nh $qt(%mf) -log $qt(%file) -cfg settings.cfg
- .timer[UPLOAD_STATS] 1 30 upload_stats_start
- if (%status == connected) {
- scid %cid
- .msg %chan [ $+ %chan $+ ]: Generating the channel statistics... - (Log Size: $+ %size $+ ) - (Log Lines: $+ %lines $+ ) - (Link: $+ %link $+ )
- }
- }
- alias get_cid {
- if (!$1) { return 0 }
- var %p = $1
- var %t = $scon(0)
- var %i = 1
- while (%i <= %t) {
- var %c = $scon(%i).cid
- var %n = $scon(%i).network
- if (%p == %n) { var %tot = %c }
- inc %i
- }
- if (!%tot) { return 0 }
- elseif (%tot) { return %tot }
- }
- alias allchans {
- var %t = $chan(0)
- var %i = 1
- while (%i <= %t) {
- var %c = $chan(%i)
- if ($me ison %c) { var %tot = $addtok(%tot,%c,44) }
- inc %i
- }
- return $iif(%tot,$v1,0)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement