Advertisement
SReject

/mIRC2JSON &json

Dec 31st, 2011
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 1.43 KB | None | 0 0
  1. alias mIRC2JSON {
  2.   var %b = bset -t &json $!calc($bvar(&json,0) +1)
  3.   $(,%b) [
  4.   var %sN = 1
  5.   while (%sN == 1 && $scon(%sN)) {
  6.     scid $v1
  7.     $(,%b) $iif(%sN != 1,$chr(44)) $+ {cid: $cid $+ $chr(44)
  8.     $(,%b) status: $+ $iif($status == disconnected,0,$iif($v1 == connecting,1,$iif($v1 == connected,2,3))) $+ ,
  9.     $(,%b) network: $+ $jqt($network) $+ ,server: $+ $jqt($server) $+ ,serverip: $+ $jqt($serverip) $+ ,port: $+ $port $+ , $+ chans:[
  10.     var %cN = 1, %c
  11.     while ($chan(%cN)) {
  12.       %c = $v1
  13.       $(,%b) $iif(%cN != 1,$chr(44)) $+ {name: $+ $jqt(%c) $+ ,mode: $+ $jqt($chan(%c).mode) $+ ,topic: $+ $jqt($chan(%c).topic) $+ ,users:[
  14.       var %nN = 1, %n
  15.       while ($nick(%c,%nN)) {
  16.         %n = $v1
  17.         $(,%b) $iif(%nN != 1,$chr(44)) $+ {nick: $+ $jqt(%n) $+ ,prefix: $+ $pfix(%c,%n) $+ ,address: $+ $jqt($address(%n,5)) $+ $chr(125)
  18.         inc %nN
  19.       }
  20.       $(,%b) ]}
  21.       inc %cN
  22.     }
  23.     $(,%b) ],queries:[
  24.     var %qN = 1
  25.     while ($query(%qN)) {
  26.       %n = $v1
  27.       $(,%b) $iif(%qN != 1,$chr(44)) $+ {nick: $+ $jqt(%n) $+ ,address: $+ $jqt($address(%n,5)) $+ ,comchans:[ $+ $left($regsubex($str(a,$comchan(%n,0)),/./g,$jqt($comchan(%n,\n)) $+ $chr(44)),-1) $+ ]}
  28.       inc %qN
  29.     }
  30.     $(,%b) ]}
  31.     inc %sN
  32.   }
  33.   $(,%b) ]
  34. }
  35. alias -l jqt return ' $+ $regsubex($1-,/([\\'[\]{}\x2C])/g,\\t) $+ '
  36. alias -l pfix return $jqt($regsubex($nick($1,$2).pnick,/\Q $+ $replacecs($2,\E,\E\\E\Q) $+ \E$/i,))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement