Advertisement
westor

Auto upload stats for multi network channels v7.0

Nov 9th, 2014
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 2.20 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 %stats = $scid(%cid).status
  33.   var %chan = $gettok(%g,1,46)
  34.   var %file = $logdir $+ %g
  35.   var %size = $bytes($file(%file).size).suf
  36.   var %lines = $lines(%file)
  37.   var %link = http://stats.3-a.net/irc/ $+ $remove(%chan,$chr(35)) $+ . $+ %network $+ .html
  38.   set -e %upload_stats $remtok(%upload_stats,%g,1,32)
  39.   if (!$isfile(%file)) { echo -a Error, NOT ANY FILE $qt($longfn(%file)) | goto again }
  40.   if (!$lines(%file)) { echo -a Error, NOT ANY LINES $qt($longfn(%file)) | goto again }
  41.   .run -nh $qt(%mf) -log $qt(%file) -cfg settings.cfg
  42.   .timer[UPLOAD_STATS] 1 30 upload_stats_start
  43.   if (%status == connected) {
  44.     scid %cid
  45.     .msg %chan [ $+ %chan $+ ]: Generating the channel statistics... - (Log Size:  $+ %size $+ ) - (Log Lines:  $+ %lines $+ ) - (Link:  $+ %link $+ )
  46.   }
  47. }
  48.  
  49. alias get_cid {
  50.   if (!$1) { return 0 }
  51.   var %p = $1
  52.   var %t = $scon(0)
  53.   var %i = 1
  54.   while (%i <= %t) {
  55.     var %c = $scon(%i).cid
  56.     var %n = $scon(%i).network
  57.     if (%p == %n) { var %tot = %c }
  58.     inc %i
  59.   }
  60.   if (!%tot) { return 0 }
  61.   elseif (%tot) { return %tot }
  62. }
  63.  
  64. alias allchans {
  65.   var %t = $chan(0)
  66.   var %i = 1
  67.   while (%i <= %t) {
  68.     var %c = $chan(%i)
  69.     if ($me ison %c) { var %tot = $addtok(%tot,%c,44) }
  70.     inc %i
  71.   }
  72.   return $iif(%tot,$v1,0)
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement