Online user lister (non-oper)

By horstefan on Apr 04, 2009

i made this script out of other pieces, and gived it a touch of myself...

this is a joins window for mirc
it registers users who get online and put them in a window
if it runs for over a week or soo, you'll start to see more and more info,

preview:
[12:20] LadyTjuh !jeugd@CW-2432DFCD.chello.nl has joined #Chatfun
[12:20] LadyTjuh joined #Chatfun 9 times, last: 1day 2hrs 8mins 34secs ago
[12:20]
LadyTjuh`s previous nicks: sweet_girly, Sweety-girl, cool-girly, Cool-lady, chat-girly, LadyTjuh
[12:20] * comchans with LadyTjuh: #Chatfun.

it also shows clones if any...

i know the script is messy, but im not into organised coding
if you want to steal, grab, copy it, i dont care.. as long as it brings you fun

im not planning to update this,

screenshot:
Image

on *:LOAD: {
  ; since this script is not designed for multi-server use, this is neccesary
  set %joins.network $$?="Please enter the name of the network you want this script to work for..."
}

on *:start: {
  nicktracker
  window -Sikzl15 @joins
  window -ikz @whois
  ;clean the joinswindow every hour
  .timerclean 0 3600 /clean_joins
  ;update (fill) the joinswindow every 10 seconds
  ;PLEASE NOTE THAT THIS IS SET TO SCON 1 
  ;CHANGE THIS IF YOU WANT TO USE ANOTHER SERVER CONNECTION
  .timerupdate 0 10 .scon 1 /update_joins
  if (!%joins.network) { set %joins.network $$?="Please enter the name of the network you want this script to work for..." }
}

on *:QUIT: {
  if ($fline(@joins,$nick,1,1)) { /dline -l @joins $fline(@joins,$nick,1,1) }
}

on *:PART:#: {
  if ($fline(@joins,$nick,1,1)) { /dline -l @joins $fline(@joins,$nick,1,1) }
}

on *:TEXT:*:#: {
  .joins_user
  if ($network != %joins.network) { halt }
  if ($fline(@joins,$nick,1,1)) { halt }
  aline -l @joins $nick
}

on *:KICK:#: {
  if ($fline(@joins,$knick,1,1)) { /dline -l @joins $fline(@joins,$knick,1,1) }
}

on *:nick: {
  if ($fline(@joins,$nick,1,1)) { /rline -l @joins $fline(@joins,$nick,1,1) $newnick }
  else { if ($network == %joins.network) { aline -l @joins $newnick } }
  if (!$hget(join)) nicktracker
  var %a = 1,%n = 0
  while $hget(join,$address($newnick,2) $+ .nicknum. $+ %a) {
    if ($v1 == $newnick) %n = 1 
    inc %a
  }
  if (%n == 0) hadd join $address($newnick,2) $+ .nicknum. $+ %a $newnick

}

on ^*:join:#: {
  if ($nick == $me) { halt }
  if (!$fline(@joins,$nick,1,1)) { if ($network == %joins.network) { aline -l @joins $nick } }
  if (!$hget(join)) nicktracker
  hinc join $address($nick,2) $+ $chan $+ .num

  ; fill the messages in @joins window
  if ($hget(join,$address($nick,2) $+ $chan $+ .last)) echo # 03 $+ $timestamp * $nick 01 $+ $address($nick,2) 03has joined # - Joined $hget(join,$address($nick,2) $+ $chan $+ .num) times - Last as $hget(join,$address($nick,2) $+ $chan) $duration($calc($ctime - $hget(join,$address($nick,2) $+ $chan $+ .last))) ago
  else echo # 03 $+ $timestamp * $nick 01 $+ $address($nick,2) 03has joined # - First join
  aline @joins 03 $+ $timestamp * $nick 01 $+ $address($nick,0) 03has joined #
  if ($hget(join,$address($nick,2) $+ $chan $+ .last)) { aline @joins 03 $+ $timestamp * $nick joined # 01 $+ $hget(join,$address($nick,2) $+ $chan $+ .num) 03times, last:01 $duration($calc($ctime - $hget(join,$address($nick,2) $+ $chan $+ .last))) 03ago }
  else { aline @joins 03 $+ $timestamp * $nick never joined # before }

  ; add new data to database
  hadd join $address($nick,2) $+ $chan $nick
  hadd join $address($nick,2) $+ $chan $+ .last $ctime
  var %a = 1,%n = 0,%b = 1
  while $hget(join,$address($nick,2) $+ .nicknum. $+ %a) {
    if ($v1 == $nick) %n = 1 
    inc %a
  }
  if (%n == 0) hadd join $address($nick,2) $+ .nicknum. $+ %a $nick

  ;output some more data
  aline -p @joins 03 $+ $timestamp * $nick $+ `s previous nicks:01 $checknick($nick)
  if ($file($logdir $+ $nick $+ . $+ $network $+ .log)) { aline @joins 03 $+ $timestamp * You have Query logs from01 $nick }
  aline -p @joins 03 $+ $timestamp * comchans with $nick $+ : 01 $+ $comchans($nick) $+ .

  ; clonescanner
  while $nick(#,%b) {
    if ($nick(#,%b) != $nick) && ($address($nick(#,%b),2) == $address($nick,2)) aline @joins 4 $+ $timestamp * $nick(#,%b) is a clone from $nick $+ !
    inc %b
  }

  ; add an empty line and halt other defaults
  aline @joins 
  haltdef
}

;tracks nicks
alias nicktracker {
  hmake join 1000
  hload join join.hsh
  .timer 0 600 hsave join join.hsh
}

;search previous nicks
alias prevnicks {
  if (!$hget(join)) nicktracker
  var %a = 1,%s
  while $hget(join,$address($1,2) $+ .nicknum. $+ %a) {
    %s = %s $v1
    inc %a
  }
  echo -a -->12 $1 has had the nicks:4 %s
}

;search common chans with an user
alias comchans {
  /var %x 0
  :comchanloop
  /inc %x
  if ($1 ison $chan(%x)) {
    if (!%y) { /var %y $chan(%x) }
    else { /var %y $+(%y,$chr(44),$chr(32),$chan(%x)) }
  }
  if (%x < $chan(0)) {
    goto comchanloop
  }
  /return %y
}

;update the current online users (topic)
alias joins_user {
  renwin @joins @joins $line(@joins,0,1) users online
}

;check old nicknames on hostmask
alias checknick {
  if ($1 isin $read(nicks.txt, s, $address($1, 2))) { 
    return $read(nicks.txt, s, $address($1, 2)) 
    halt 
  }
  if (($read(nicks.txt, w, $address($1, 2) $+ *)) && ($1 !isin $read(nicks.txt, s, $address($1, 2)))) { 
    var %oldnicks $read(nicks.txt, s, $address($1, 2))
    /write -s $address($1, 2) nicks.txt $address($1, 2) %oldnicks $+ , $1
    return $read(nicks.txt, s, $address($1, 2)) 
    halt
  }
  /write nicks.txt $address($1, 2) $1
  return $read(nicks.txt, s, $address($1, 2)) 

}

;fill the sidebar with online users
alias update_joins {
  set %z $chan(0)
  while (%z >= 1) {
    set %y $nick($chan(%z),0)
    while (%y >= 1) {
      aline -nl @joins $nick($chan(%z),%y)
      dec %y
    }
    dec %z
  }
}

;repeat info (+ some whois info)
alias getinfo {
  whois $1
  .enable #getinfo
  aline @joins 03 $+ $timestamp * $1 $+ 's host is01 $address($1, 5)
  aline -p @joins 03 $+ $timestamp * $1 comchans: 01 $+ $comchans($1)
  aline -p @joins 03 $+ $timestamp * $1 $+ 's other nicknames:01 $checknick($1)
  set %x $numtok($comchans($1), 44)
  while (%x >= 1) {
    aline @joins 03 $+ $timestamp * $1 joined01 $gettok($comchans($1), %x, 44) 04 $+ $hget(join,$address($1,2) $+ $strip($gettok($comchans($1), %x, 44)) $+ .num) 03times, last:01 $duration($calc($ctime - $hget(join,$address($1,2) $+ $strip($gettok($comchans($1), %x, 44)) $+ .last))) 03ago

    dec %x
  }
  .timerget2 1 1 .disable #getinfo
  .timerget 1 1 aline @joins 

}

;checks users that are in the list, but are not online
alias clean_joins {
  set %x $line(@joins,0,1)
  while (%x >= 1) {
    if (!$address($line(@joins,%x,1),2)) { /dline -l @joins %x }
    dec %x
  }
}

#getinfo off
;whois information for getinfo
raw *:*: { 
  if ($istok($whoisnumerics,$numeric,124)) haltdef
  if ($numeric == 301) aline @joins 11? Away: Yes: ( $+ $3- $+ ) 
  elseif ($numeric == 307) aline @joins 03 $+ $timestamp * Registered Nickname: 01Yes.
  elseif ($numeric == 310) aline @joins 03 $+ $timestamp * IRC Helper: 01Yes.  
  elseif ($numeric == 311) {
    aline @joins 03 $+ $timestamp * Real Name:01 $6- 
  }
  elseif ($numeric == 312) aline @joins 03 $+ $timestamp * Server:01 $3 
  elseif ($numeric == 313) aline @joins 03 $+ $timestamp * Network Functions:01 $5-9

  elseif ($numeric == 317) {
    aline @joins 03 $+ $timestamp * Signed on at:01 $asctime($4,dddd dd/mm/yyyy HH:nn:ss) 
    aline @joins 03 $+ $timestamp * Time idle:01 $duration($3) 
    aline @joins 03 $+ $timestamp * Time online:01 $duration($calc($ctime - $4)) 
  }
  elseif ($numeric == 320) aline @joins 03 $+ $timestamp * Swhois:01 $2- 
  elseif ($numeric == 330) aline @joins 03 $+ $timestamp * Authname:01 $3 
  elseif ($numeric == 335) aline @joins 03 $+ $timestamp * Bot:01 Yes
  elseif ($numeric == 338) {
    aline @joins 03 $+ $timestamp * Real Hostmask:01 $3 
    aline @joins 03 $+ $timestamp * Real IP:01 $4 
  }
  elseif ($numeric == 378) aline @joins 03 $+ $timestamp * Connecting from:01 $6-  
  elseif ($numeric == 379) aline @joins 03 $+ $timestamp * Modes:01 $6-
  elseif ($numeric == 671) aline @joins 03 $+ $timestamp * Secure Connection:01 Yes
}
#getinfo end

;menu for joinswindow
menu @joins {
  clear window:/clear @joins
  clear listbox:/clear -l @joins
  clean listbox:/clean_joins
  $iif($$1, get info):/getinfo $$1
  $iif($$1, del user):/dline -l @joins $fline(@joins,$$1,1,1)
}

;menu for checking an users previous nicks in a channel
menu nicklist {
  Previous nicks:/prevnicks $$1
}

Comments

Sign in to comment.
Aucun50   -  Apr 04, 2009

By the screen shot it looks nice haven't got to test it out, for your first script here it's very good.

 Respond  
horstefan   -  Apr 04, 2009

first post is mine... please dont flame

edit: updated the script
reason: .who caused a buffer overflow, while it wasnt really neccesary

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.