Timed Whois

By RusselB on Jan 03, 2010

Allows a user to automatically send a /whois on one or more nicks at a specific interval. This code is NOT meant for a bot.

Add nick(s) using the menu or

/timed-whois add <nick(s)>

Removal of nick(s) is in a similar manner

Timed whois of the nicks added can be turned on/off at will, but also turns on automatically when you use /away and off when you return.

On/off timing is for the entire group. At present, there is no option to turn it on/off on a per nick basis.

/*
Menu options:
Enable/Disable, Add/Remove nick(s), Set timing

Command line options:
/timed-whois add <nick(s)> -> Sets default 3 minute timing for nick(s)
/timed-whois remove <nick(s)>
/timed-whois <nick> <timing> -> adds nick if it doesn't already exist with the specified timing
/timed-whois on
/timed-whois off
*/
menu nicklist {
  Timed Whois
  .$iif($hget(auto-whois,0).item,$iif(%timed-whois == on,Disable,Enable)) : {
    set %timed-whois $iif(%timed-whois == on,off,on)
    .timed-whois %timed-whois
  }
  .$iif(!$hget(auto-whois,$$1),Add $$1) : timed-whois add $$1
  .Add other nick(s) : timed-whois add $$input(Enter nick(s),e,Space or comma separated)
  ..$iif($hget(auto-whois,$$1),Timing $$1)
  ...$iif($hget(auto-whois,$$1) == 180,$style(3)) 3 minutes : .timed-whois $$1 180
  ...$iif($hget(auto-whois,$$1) == 300,$style(3)) 5 minutes : .timed-whois $$1 300
  ...$iif($hget(auto-whois,$$1) == 600,$style(3)) 10 minutes : .timed-whois $$1 600
  ...$iif($hget(auto-whois,$$1) == 900,$style(3)) 15 minutes : .timed-whois $$1 900
  ...$iif($hget(auto-whois,$$1) == 1800,$style(3)) 30 minutes : .timed-whois $$1 1800
  .$iif($hget(auto-whois,$$1),Remove $$1) : .hdel auto-whois $$1
  .$iif($hget(auto-whois,0).item,Remove other nick(s)) : timed-whois add $$input(Enter nick(s),e,Space or comma separated)
}
raw 305:*:  $+(.timer,auto-whois,*) off
raw 306:*:{
  var %a = 1, %b = $hget(auto-whois,0).item
  while %a <= %b {
    $+(.timer,auto-whois,$hget(auto-whois,%a).item) 0 $hget(auto-whois,%a).data auto-who $hget(auto-whois,%a).item
    inc %a
  }
}
alias -l auto-who {
  if !$window(@auto-whois) {    .window @auto-whois  }
  .enable #timed-whois
  .whois $$1 $$1
}
alias timed-whois {
  if $istok(add remove,$1,32) {
    var %nicks = $replace($2-,$chr(44),$chr(32))
    var %a = 1, %b = $numtok(%nicks,32)
    while %a <= %b {
      if ($1 == add) {        .hadd -m auto-whois $gettok(%nicks,%a,32) 180      }
      elseif ($1 == remove) {        .hdel auto-whois $gettok(%nicks,%a,32)      }
      inc %a
    }
  }
  elseif $istok(on off,$1,32) {
    set %timed-whois $$1
    if ($$1 == on) {
      var %a = 1, %b = $hget(auto-whois,0).item
      while %a <= %b {
        $+(.timer,auto-whois,$hget(auto-whois,%a).item) 0 $hget(auto-whois,%a).data auto-who $hget(auto-whois,%a).item
        inc %a
      }
    }
    else {      $+(.timer,auto-whois,*) off    }
  }
  elseif $$2 isnum {    .hadd -m auto-whois $$1 $$2  }
}
#timed-whois off
raw *:*:{
  if $istok(318 402 263,$numeric,32) {
    .disable #timed-whois
    haltdef
  }
  elseif ($numeric == 317) {
    .echo -t @auto-whois $$2 has been idle for $duration($3)
  }
  halt
}
#timed-whois end
on *:nick:{
  if $timer($+(auto-whois,$nick)) {
    $+(.timer,auto-whois,$nick) off
    .hadd -m auto-whois $newnick $hget(auto-whois,$nick)
    $+(.timer,auto-whois,$newnick) 0 $hget(auto-whois,$newnick) auto-who $newnick
  }
}
on !*:quit:{
  $+(.timer,auto-whois,$nick) off
  .hdel auto-whois $nick
}
on *:start:{
  if !$hget(auto-whois) {    .hmake auto-whois 10  }
}
on *:disconnect: .disable #timed-whois
on *:exit: .disable #timed-whois 

Comments

Sign in to comment.
RusselB   -  Aug 01, 2010

Add in additional lines like

elseif ($numeric == 317) {
    .echo -t @auto-whois $$2 has been idle for $duration($3)
  }

for the additional raws that you want to show.
The raws for the /whois command (and several other commands) can be gotten from here

 Respond  
macollins2   -  Aug 01, 2010

I tried using this script however when it displays the information in the window it only showed the nicks idle time and not all the normal /whois information. I am a very basic script writer so am not sure how to make the changes to get it to do this.

 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.