Advertisement
westor

Auto upload stats for multi network channels v6.0

Nov 8th, 2014
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 2.08 KB | None | 0 0
  1. alias update_stats {
  2.   var %mf = C:\mircstats\mircstats.exe
  3.   if (!$isfile(%mf)) { return }
  4.   if (%upload_stats) { return }
  5.   var %t = $scon(0)
  6.   var %i = 1
  7.   while (%i <= %t) {
  8.     var %n = $scon(%i).network
  9.     var %c = $scon(%i).allchans
  10.     var %ii = 1
  11.     var %tt = $numtok(%c,44)
  12.     while (%ii <= %tt) {
  13.       var %chan = $gettok(%c,%ii,44)
  14.       var %f = %chan $+ . $+ %n $+ .log
  15.       var %f = $mkfn(%f)
  16.       set -e %upload_stats $addtok(%upload_stats,%f,32)
  17.       inc %ii
  18.     }
  19.     inc %i
  20.   }
  21.   if (%upload_stats) { upload_stats_start }
  22. }
  23.  
  24. alias upload_stats_start {
  25.   :again
  26.   var %mf = C:\mircstats\mircstats.exe
  27.   if (!$isfile(%mf)) { .timer[UPLOAD_STATS] off | return }
  28.   if (!%upload_stats) { .timer[UPLOAD_STATS] off | return }
  29.   var %g = $gettok(%upload_stats,$rand(1,$numtok(%upload_stats,32)),32)
  30.   var %network = $gettok(%g,$calc($numtok(%g,46) -1),46)
  31.   var %cid = $get_cid(%network)
  32.   var %chan = $gettok(%g,1,46)
  33.   var %file = $logdir $+ %g
  34.   var %size = $bytes($file(%file).size).suf
  35.   var %lines = $lines(%file)
  36.   var %link = http://stats.3-a.net/irc/ $+ $remove(%chan,$chr(35)) $+ . $+ %network $+ .html
  37.   set -e %upload_stats $remtok(%upload_stats,%g,1,32)
  38.   if (!$isfile(%file)) { echo -a NOT FILE %file | goto again }
  39.   if (!$lines(%file)) { echo -a NOT LINES %file | goto again }
  40.   .run -nh $qt(%mf) -log $qt(%file) -cfg settings.cfg
  41.   .timer[UPLOAD_STATS] 1 30 upload_stats_start
  42.   scid %cid
  43.   .msg %chan [ $+ %chan $+ ]: Generating the channel statistics... - (Log Size:  $+ %size $+ ) - (Log Lines:  $+ %lines $+ ) - (Link:  $+ %link $+ )
  44. }
  45.  
  46. alias get_cid {
  47.   if (!$1) { return 0 }
  48.   var %p = $1
  49.   var %t = $scon(0)
  50.   var %i = 1
  51.   while (%i <= %t) {
  52.     var %c = $scon(%i).cid
  53.     var %n = $scon(%i).network
  54.     if (%p == %n) { var %tot = %c }
  55.     inc %i
  56.   }
  57.   if (!%tot) { return 0 }
  58.   elseif (%tot) { return %tot }
  59. }
  60.  
  61. alias allchans {
  62.   var %t = $chan(0)
  63.   var %i = 1
  64.   while (%i <= %t) {
  65.     var %c = $chan(%i)
  66.     if ($me ison %c) { var %tot = $addtok(%tot,%c,44) }
  67.     inc %i
  68.   }
  69.   return $iif(%tot,$v1,0)
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement