Advertisement
westor

Auto upload stats for multi network channels v8.0

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