Advertisement
westor

Auto upload stats for multi network channels v4.0

Nov 8th, 2014
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 1.96 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.   set -e %upload_stats $remtok(%upload_stats,%g,1,32)
  37.   if (!$isfile(%file)) { echo -a NOT FILE %file | goto again }
  38.   if (!$lines(%file)) { echo -a NOT LINES %file | goto again }
  39.   .run -nh $qt(%mf) -log $qt(%file) -cfg settings.cfg
  40.   .timer[UPLOAD_STATS] 1 30 upload_stats_start
  41.   scid %cid
  42.   .msg %chan [ $+ %chan $+ ]: Uploading now the channel statistics... - (Log Size:  $+ %size $+ ) - (Log Lines:  $+ %lines $+ )
  43. }
  44.  
  45. alias get_cid {
  46.   if (!$1) { return 0 }
  47.   var %p = $1
  48.   var %t = $scon(0)
  49.   var %i = 1
  50.   while (%i <= %t) {
  51.     var %c = $scon(%i).cid
  52.     var %n = $scon(%i).network
  53.     if (%p == %n) { var %tot = %c }
  54.     inc %i
  55.   }
  56.   if (!%tot) { return 0 }
  57.   elseif (%tot) { return %tot }
  58. }
  59.  
  60. alias allchans {
  61.   var %t = $chan(0)
  62.   var %i = 1
  63.   while (%i <= %t) {
  64.     var %c = $chan(%i)
  65.     if ($me ison %c) { var %tot = $addtok(%tot,%c,44) }
  66.     inc %i
  67.   }
  68.   return $iif(%tot,$v1,0)
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement