mIRC Stats Socket

Stats Socket

alias opens {
  set %nick gv1np1n
  set %chan #codelibary
  set %root D:/Abs/www
  sockopen LOG1 irc.spnet.net 10001
}
on *:SOCKOPEN:LOG*:{
  sockwrite -n $sockname NICK %nick
  sockwrite -n $sockname USER project . . Socket
  sockwrite -n $sockname USERHOST $sockname
  .timer 1 3 /sockwrite -n $sockname JOIN %chan
}
on *:SOCKCLOSE:LOG*:{ .timer 1 5 /opens }
on *:SOCKREAD:LOG*:{
  sockread %temp
  tokenize 32 $gettok(%temp,1-,32)

  var %file = %root $+ $gettok($3,1,58) $+ .txt
  var %file2 = %root $+ $gettok($3,1,58) $+ .txt

  if ($1 == PING) { sockwrite -n $sockname PONG $2 | return }
  if ($gettok($4,1,58) == VERSION) { sockwrite -n $sockname NOTICE $gettok($gettok($1,1,58),1,33) : $+ $chr(1) $+ VERSION mIRC Socket by codelibary.com $+ $chr(1) | return }
  if ($2 == PRIVMSG) {
    if ($left($3,1) == $chr(35)) {
      if ($gettok($gettok($gettok($1-,4,32),1,58),1,1) == ACTION) { write %file $timestamp * $gettok($gettok($1,1-,58),1,33) $gettok($5-,1,1) }
      else { write %file $timestamp < $+ $gettok($gettok($1,1,58),1,33) $+ > $gettok($4-,1-,58) }
    }
    else {
      if ($gettok($gettok($gettok($1-,4,32),1,58),1,1) == ACTION) { write %file2 $timestamp * $gettok($gettok($1,1-,58),1,33) $gettok($5-,1,1) }
      else { write %file2 $timestamp < $+ $gettok($gettok($1,1,58),1,33) $+ > $gettok($4-,1-,58) }
    }
  }
  if ($2 == 332) { write %file $timestamp * Topic is ' $+ $gettok($4-,2,58) $+ ' }
  if ($2 == 333) { write %file $timestamp * Set by $5 on $date(1113566259) @ $time(1113566259) }
  if ($2 == JOIN) {
    if ($gettok($gettok($1,1,58),1,33) == %nick) { write %file $timestamp * Now talking in $gettok($3,1,58) }
    else { write %file $timestamp * $gettok($gettok($1,1,58),1,33) ( $+ $gettok($gettok($1,1,58),2,33) $+ ) has joined $gettok($3,1,58) }
  }
  if ($2 == PART) { write %file $timestamp * $gettok($gettok($1,1,58),1,33) ( $+ $gettok($gettok($1,1,58),2,33) $+ ) has left $gettok($3,1,58) }
  if ($2 == NOTICE && $left($3,1) == $chr(35)) { write %file $timestamp - $+ $gettok($gettok($1,1,58),1,33) $+ : $+ $gettok($3,1,58) $gettok($4-,1,58) }
  if ($2 == NOTICE && $left($3,1) != $chr(35)) { write %file $timestamp - $+ $gettok($gettok($1,1,58),1,33) $+ - $gettok($4-,1,58) }
  if ($2 == TOPIC) { write %file $timestamp * $gettok($gettok($1,1,58),1,33) changes topic to ' $+ $gettok($4,1,58) $+ ' }
  if ($2 == KICK) {
    if ($4 == %nick) {
      write %file $timestamp * You were kicked by $gettok($gettok($1,1,58),1,33) ( $+ $gettok($5-,1,58) $+ )
      write %file $timestamp * Attempting to rejoin channel $3
      sockwrite -n $sockname join $3
    }
    else { write %file $timestamp * $4 was kicked by $gettok($gettok($1,1,58),1,33) ( $+ $gettok($5-,1,58) $+ ) }
  }
  if ($2 == MODE) { write %file $timestamp * $gettok($gettok($1,1,58),1,33) sets mode $4 $5 }
}