Whois dialog

By RusselB on Jan 18, 2006

Start by right clicking on any menu and selecting Who2
If no nicks have been selected, then you'll be asked to enter the nick(s). Multiple nicks separated by commas or spaces will work.
If a single nick is entered, either manually or by selection from the nicklist, that person is whois'd automatically.
If more than one nick is entered/selected, then the nicks will be in a drop down box, where the nick can be selected. When a nick is selected in the dialog, that nick is whois'd. Channels appear in a list, one per line, with the total number of channels that person is on being displayed. Selecting a channel in that list will show that person's idle time for that channel, presuming it is a common channel, or N/A will be displayed (Not Available).
Double clicking a channel in that list will join you to the channel.
Thanks to ryu.dragonryder who got me started on this in the first place.
Switches to WhoWas version automatically if necessary.
When multiple nicks are entered/selected, the first nick is whois'd automatically. A slight layout change, but one that I think looks better. Any suggestions for changes/additions will be considered on a first come, first serve basis (also subject to my scripting knowledge)
Hope everyone likes the new layout and options.
Code can now be used directly from the command line:/who2 <nick(s)>
<nick(s)> can be separated by commas and/or spaces.
Channels list is now a checkbox list, with common channels pre-checked rather than 2 lists.
Please note that the Clone detection routine is not the most accurate, especially if vhosts are being used.
Title variable changed to try to eliminate multiple scripts using the same variable. Also added buttons for quick access to IRCops commands of Kill, K-Line, G-Line, Z-Line, GZ-Line and Shun.
NOTE: These commands are based on the format used by UnrealIRCd.

/*
Whois/Who Was dialog by RusselB
E-mail: r.k.bairstow@gmail.com
*/
ctcp *:version:*:  ctcpreply $nick VERSION Whois/Whowas 11.26.2007 by Russel Bairstow
on *:dialog:whois:init:*:{
  dialog -t Whois Who Is
  did $iif($countcs($usermode,o,O,C,A,a,N),-ev,-bh) $dname 13,14,27,36,37,38
}
dialog -l Whois {
  size -1 -1 295 130
  option dbu
  text "Nick", 1, 5 6 25 8
  combo 2, 30 5 100 10, drop
  text "Address", 3, 5 16 25 8
  edit "", 4, 30 15 150 10
  text "Name", 5, 5 26 25 8
  edit "", 6, 30 25 150 10
  text "Modes", 7, 5 36 25 8
  edit "", 8, 30 35 100 10
  text "IP", 9, 5 46 25 8
  edit "", 10, 30 45 50 10
  text "Away", 15, 5 106 25 8
  edit "", 16, 30 105 150 21, multi
  edit "", 17, 132 75 50 10, center
  text "Registered", 11, 5 86 30 8, center
  text "Server", 12, 5 76 25 8
  edit "", 18, 30 75 100 10
  text "", 19, 5 95 90 8
  text "Help", 20, 35 86 30 8, center
  text "Secure", 21, 65 86 30 8, center
  text "Sign In", 22, 5 66 25 8
  text "Sign Out", 29, 5 66 25 8
  edit "", 23, 30 65 80 10
  text "Idle", 24, 132 67 50 8, center
  button "Exit", 25, 135 2 37 12, default ok
  text "Not found in /whois or /whowas listings", 26, 30 15 150 10, center
  edit "", 28, 132 85 50 10, center
  list 30, 190 79 100 50, size check
  text "0 Common out of 0 Channels", 31, 190 71 100 8, center
  text "0 Clones detected", 32, 190 5 100 8, center
  list 33, 190 13 100 55, size
  text "DNS", 34, 5 56 25 8
  edit "", 35, 30 55 100 10
  radio "Kill", 13, 135 35 22 8, group
  radio "K-Line", 14, 160 35 25 8
  radio "Z-Line", 27, 160 43 25 8
  radio "G-Line", 36, 135 51 25 8
  radio "Shun", 37, 135 43 22 8
  radio "GZ-Line", 38, 160 51 28 8
}
#whois off
raw *:*:{
  var %raw = $numeric
  if $istok(402 311 401 379 378 307 319 312 301 313 310 671 317,$event,32) {    haltdef  }
  if %raw == 402 {
    ctcp $name time
    .whois $name
  }
  if %raw == 311 {
    did -v Whois 3,5
    did -rva Whois 4 $+($3,@,$4)
    did -rva Whois 6 $6-
  }
  elseif %raw == 401 {
    .enable #whowas
    .whowas $iif($did(Whois,2).seltext,$v1,$did(Whois,2))
  }
  elseif %raw == 379 {
    did -v Whois 7
    did -rva Whois 8 $6-
  }
  elseif %raw == 378 {
    if $gettok($iif(!$7,$6,$7),1,46) isnum && $gettok($iif(!$7,$6,$7),2,46) isnum && $gettok($iif(!$7,$6,$7),3,46) isnum && $gettok($iif(!$7,$6,$7),4,46) isnum {
      did -v Whois 9
      did -rva Whois 10 $iif(!$7,$6,$7)
      dns $iif(!$7,$6,$7)
    }
  }
  elseif %raw == 307 {    did -v Whois 11   }
  elseif %raw == 319 {
    did -rv Whois 30
    didtok Whois 30 32 $3-
    var %a = 1, %b = $comchan($did(whois,2).seltext,0)
    while %a <= %b {
      did -s Whois 30 $didwm(Whois,30,$+(*,$comchan($did(whois,2).seltext,%a)))
      inc %a
    }
    did -rva Whois 31 $did(whois,30,0).csel Common out of $did(whois,30).lines Channels
  }
  elseif %raw == 312 {
    did -v Whois 12
    did -rva Whois 18 $3
  }
  elseif %raw == 301 {
    did -v Whois 15
    did -rva Whois 16 $3-
  }
  elseif %raw == 313 {    did -rva Whois 19 $strip($5-)   }
  elseif %raw == 310 {    did -v whois 20   }
  elseif %raw == 671 {    did -v whois 21   }
  elseif %raw == 317 {
    did -h Whois 29
    did -v Whois 22
    did -rva whois 23 $asctime($4,ddd mmm d yyyy @ HH:nn:ss)
    if $3 > 0 {
      did -v Whois 24
      did -rva whois 17 $idle($3)
    }
  }
  elseif (%raw == 318) {
    did -e Whois 25
    .disable #whois
    haltdef
  }
}
#whois end
on *:dns:{
  if $dialog(whois) {
    did -ra Whois 35 $iif($dns(0).addr,$v1,Unable to Resolve)
  }
}
#whowas off
raw *:*:{
  dialog -t Whois Who Was
  var %raw = $numeric
  if $istok(301 312 314 406,$event,32) {    haltdef  }
  if %raw == 314 {
    did -v Whois 3,5
    did -rva Whois 4 $+($3,@,$4)
    did -rva Whois 6 $6-
  }
  elseif %raw == 312 {
    did -h Whois 22
    did -v Whois 12,29
    did -rva Whois 18 $3
    did -rva whois 23 $asctime($ctime($4-),ddd mmm d yyyy @ HH:nn:ss)
  }
  elseif %raw == 406 {    did -v Whois 26  }
  elseif %raw == 369 {
    did -e Whois 25
    .disable #whowas
    haltdef
  }
}
#whowas end
on *:dialog:whois:sclick:2:{
  did -b whois 25
  did -r whois 4,6,8,10,30,16,17,18,28
  did -h whois 3,4,5,6,7,8,9,10,11,12,13,30,15,16,17,18,19,20,21,22,23,24,26,28,29
  if %chan {    clones %chan  }
  .enable #whois
  .whois $name $name
  if $name == $me {
    did -v $dname 7
    did -rva $dname 8 $usermode
  }
}
alias -l clones {
  var %mask = 0
  while %mask <= 9 {
    var %a = 1, %b = $nick($1,0)
    while %a <= %b {
      if ($address($name,%mask) iswm $address($nick($1,%a),5)) && ($nick($1,%a) != $name)  && !$didwm(Whois,33,$nick($1,%a)) {
        did -a Whois 33 $nick($1,%a)
      }
      inc %a
    }
    inc %mask
  }
  if $did(Whois,33).lines == 1 {
    did -ra Whois 32 1 Clone detected
  }
  else did -ra Whois 32 $did(Whois,33).lines Clones detected
}
on *:dialog:whois:*:30:{
  var %chan = $+($chr(35),$gettok($did($dname,$did).seltext,-1,35))
  if $devent == dclick {
    .join %chan
  }
  elseif $devent == sclick {
    did -rva $dname 28 $iif($me !ison %chan,N/A,$idle($nick(%chan,$name).idle))
  }
}
on *:dialog:whois:sclick:13,14,27,36,37,38:{
  if $did == 13 {
    kill $name $$?="Reason for Kill (Required)"
  }
  elseif $istok(27 38,$did,32) {
    $iif($did == 27,zline,gzline) $+(+,*@,$did(10)) $?="Time to ban" $?="Reason"
  }
  elseif $istok(14 36,$did,32) {
    $iif($did == 14,kline,gline) + $+ $name $?="Time to ban" $?="Reason"
  }
  elseif $did == 37 {
    shun + $+ $name $?="Time to shun" $?="Reason"
  }
  dialog -e $dname
}

menu * {
  Who2 : {
    set %chan $iif($chan,$v1,$null)
    .who2 $iif($snick(%chan,0),$snicks,$iif($nick,$nick))
    ;    .who2 $iif(!%chan && $nick,$v2,$snicks)
  }
}
;ALIASES SECTION
alias -l idle {
  var %idle = $duration($1)
  return $iif($numtok(%idle,32) < 4,$duration($1,3),$+($gettok(%idle,1--3,32),$chr(32),$duration($duration($gettok(%idle,-3-,32)),3)))
}
alias -l name {
  return $iif($did(Whois,2).seltext,$v1,$did(Whois,2))
}
alias who2 {
  var %nicks = $iif($1,$1-,$$?="Enter nick(s) comma or space separated")
  var %nicks = $replace(%nicks,$chr(44),$chr(32))
  dialog $iif(!$dialog(Whois),-md,-eno) Whois Whois
  did -b whois 25
  did -r whois 2,4,6,8,10,30,16,17,18,28
  did -h whois 3,4,5,6,7,8,9,10,11,12,30,15,16,17,18,19,20,21,22,23,24,26,28,29
  didtok Whois 2 32 %nicks
  did -kc Whois 2 1
  if %chan {    clones %chan  }
  .enable #whois
  .whois $name $name
  if $name == $me {
    did -v whois 7
    did -rva whois 8 $usermode
  }
} 
on *:start:{
  if $version < 6.17 {
    echo 4 -a Sorry, but this script requires mIRC 6.17 or better
    echo -a Auto-unload will now start
    .unload -rs $script
  }
}

Comments

Sign in to comment.
Jonesy44   -  Apr 29, 2008

check out my whois dialog, then yaall see why :P

 Respond  
^Neptune   -  Apr 29, 2008

No offense, but I don\'t exactly see the point in a whois dialog when you can just whois them normally and get the info you need.

 Respond  
RusselB   -  Apr 25, 2008

Working on further updates.. Hope to have the updates finished and working by the end of the month, so watch for an update to the posted code within the next week.

 Respond  
SpotRedDog   -  Apr 25, 2008

I got it working so its good to go and I like it how some of the boxes drop away if you don\'t need them thats a nice feature!!!!Good Job!!!!! Keep all the great snippets and addon\'s coming your the Zen Master.

 Respond  
RusselB   -  Mar 21, 2008

The line information shouldn\'t show unless you are an IRCop. The Exit button is disabled until the Whois or Whowas information has been retrieved. I don\'t know why your copy isn\'t working, but I just tested mine, and will edit the current posted copy with a copy of the one I\'m using in just a few minutes.

 Respond  
SpotRedDog   -  Mar 20, 2008

Russell, I just went and updated as I see you made changes and now it doesn\'t work at all for 6.21 it only has the drop down box the exit button doesn\'t light up at all and the IRCop\'s stuff light up and I am not a IRCop I am a local op and having G-line and Z-line and the rest there is pointless and the rest of the dialog doesn\'t even light up at all so something is wrong with the dialog and I can\'t figure it out!!!! so I hope you can fix it bro I really liked using yours and deleted the script so please fix it as soon as possible!!!!

 Respond  
RusselB   -  Mar 17, 2008

I know this is a late post, but thanks for the information Scakk.. I\'ll try to have that fixed for my next update.

 Respond  
Scakk   -  Oct 15, 2007

If I enter 2 or more names in the Input box if no nicks are clicked I get each nick twice except for the first one.

Ex: blues,waiterjohn,nicky

Gives in the drop down box: blues waiterjohn nicky waiterjohn nicky

 Respond  
RusselB   -  Sep 28, 2007

Thanks for the suggestions, Hixxy, and using your code I can now see why it appears that items are not aligned.
In regards to those radio buttons, they shouldn\'t show up unless you have IRCops on the active network when the dialog is started, and if you do have IRCops, then you should already know what those items do.

I am in the process of combining a number of the scripts that I\'ve been asked for or have noticed used a lot into one, and I think I\'ll offer your layout as an alternative in the final code. Appropriate credits will be posted.

 Respond  
hixxy   -  Sep 12, 2007

dialog Whois {
title \"Dialog\"
size -1 -1 296 206
option dbu
text \"Nick:\", 1, 4 6 12 8
combo 2, 30 5 157 10, drop
text \"Address:\", 3, 4 18 21 8
edit \"\", 4, 30 17 157 10
text \"Name:\", 5, 4 62 16 8
edit \"\", 6, 30 61 157 10
text \"Modes:\", 7, 4 74 19 8
edit \"\", 8, 30 73 157 10
text \"IP:\", 9, 4 86 8 8
edit \"\", 10, 30 85 157 10
text \"Away:\", 15, 4 133 15 8
edit \"\", 16, 30 132 157 21, multi
edit \"\", 17, 30 155 157 10
text \"Registered\", 11, 4 184 30 8
text \"Server:\", 12, 4 121 19 8
edit \"\", 18, 30 120 157 10
text \"\", 19, 4 195 94 8
text \"Help\", 20, 37 184 30 8, center
text \"Secure\", 21, 69 184 30 8, center
text \"Sign In:\", 22, 4 110 23 8
text \"Sign Out:\", 29, 4 110 22 8
edit \"\", 23, 30 108 157 10
text \"Idle:\", 24, 4 156 11 8
button \"E&xit\", 25, 256 191 37 12, ok
text \"Not found in /whois or /whowas listings\", 26, 30 18 102 8
edit \"\", 28, 30 167 157 10
list 30, 193 97 100 80, size
text \"0 Common out of 0 Channels:\", 31, 193 86 98 8
text \"0 Clones detected:\", 32, 193 6 98 8
list 33, 193 17 100 66, size
text \"DNS:\", 34, 4 98 13 8
edit \"\", 35, 30 97 157 10
radio \"Kill\", 13, 4 35 22 8, group
radio \"K-Line\", 14, 4 46 25 8
radio \"Z-Line\", 27, 30 46 25 8
radio \"G-Line\", 36, 56 35 25 8
radio \"Shun\", 37, 30 35 22 8
radio \"GZ-Line\", 38, 56 46 28 8
}

I\'ve given the dialog a little breathing space so it\'s not all shoved together, and I\'ve also aligned your controls so that the left/right/top/bottom borders line up on your dialog. It might sound fussy, but something simple like lining up your controls makes a world of difference to the presentation of your dialog.

I\'m not saying it\'s perfect, but I think it\'s a lot less cluttered and more organised. It\'s up to you whether you use it or not but hopefully you\'ll be able to see the improvements I\'ve made.

 Respond  
hixxy   -  Sep 12, 2007

Seeing as RoninWarrior didn\'t say what was wrong with your alignment, I\'ll have a go:

  • You have a list of editboxes going down the dialog, but they\'re all different sizes, which means that they\'re not aligned on the right hand side. Make them all the same width, so that they start at the same point on the left and end at the same point on the right. Even if you don\'t need all of that space for the boxes, it\'s space that is otherwise going unused, so there\'s no problem with using up a bit more space to make the dialog look that little bit neater.

  • Your \"Exit\" button is not in line with the combo box next to it. It\'s 1 or 2 pixels up from it.

  • Your \"Common Channels\" box could line up with the bottom of the \"Away\" box and the top of the \"Idle\" box, and if you add a little bit of whitespace you could also make the \"Name\" box line up with your \"Clones\" box at the top.

  • The \"Registered\" text is not in line with the rest of the text down the left hand side of your dialog.

  • Your six radio buttons are just kinda thrown in the middle of nowhere and not aligned with any of the controls around it, and nothing states what they do.

I\'m going to try and reposition everything in your dialog to show you how I think it should look, I\'ll post it later.

 Respond  
ZabuzaMomochi   -  Apr 30, 2007

What you could do also is have an option set to whether the nick wants to know what the person their whoisings time is. so it will do the time ctcp, just a suggestion

 Respond  
RusselB   -  Apr 19, 2007

A few additional command options have been added for those that have IRCops status on their network(s) to make these relatively common commands easier. If you don\'t have IRCops status on the network, then these options won\'t even show. If you do have them, then you\'ll recognize the commands that were added.

 Respond  
RusselB   -  Mar 18, 2007

Problems with 6.21 resolved.

 Respond  
RusselB   -  Mar 11, 2007

NOTICE: Effective with the release of mIRC 6.21, this script has difficulties. I am working on trying to figure out why and how these came about, as well as how to fix them. For the most part everything is still OK, just that some of the information isn\'t displayed correctly.

I know it\'s been a while since 6.21 was released, but I only noticed the problems within the past week.

 Respond  
celticsoldier   -  Mar 22, 2006

Nice script. Works fine for me :)

 Respond  
Biggeorgiafan14   -  Feb 19, 2006

Amazing, works great.

 Respond  
XpLoiTeR   -  Jan 19, 2006

lol tank

 Respond  
tank59   -  Jan 19, 2006

dot dot dot.

 Respond  
RoninWarrior   -  Jan 19, 2006

i wont comment or post anything back here anymore to ruin RussleB work you have done a good job so far though.

keep up the good work RussleB

 Respond  
Yoinx   -  Jan 19, 2006

Wow, You\'re throwing a fit becuase I pointed out that you keep criticizing people\'s dialog alignments, when nobody else sees the same thing. AND I\'ve pointed that out to you a few times. OBVIOUSLY its something that\'s only happening on your system.

Childish.

 Respond  
RoninWarrior   -  Jan 19, 2006

sorry again to everyone this may concern. @yonix dont worry i contacted
Hawkee and hopefully in due time my account and stuff will be gone and i wont be in yur way or hair.

 Respond  
RoninWarrior   -  Jan 19, 2006

i apologize RussleB for not being more specific i wasnt trying to be rude in any way or knocking your work code or anything and yonix mind your own buisness because everyone has there own opionin on diffrent things i was was just stateing a fact or an issue i had with it not that it was wroung in any way shape or form . now that this has been clear up ill wont be commenting on anything anymore since this and everyone is takeing everything and allowing this to go out of control this place is just like ms.org now and it is sad fiberoptics was deffintly correct on his past statments.

 Respond  
nobody   -  Jan 18, 2006

I don\'t see any problem with the dialog aligment.

 Respond  
RusselB   -  Jan 18, 2006

@noMen: Thanks for your notes. The reason for the double $1 in the .whois is due to the fact that the person\'s idle time wasn\'t being returned when I used just the single $1. I thought I read in the help file about using /whois to get the information from the server that they were connected to, rather than the network.

The EXIT button is automatically disabled until the .whois information for the specific person has been recalled.

@anthalus: No, I haven\'t. This is the first time I\'ve heard of them, but I\'m willing to check them out.

@RoninWarrior: This is twice (that I can recall) that you\'ve mentioned about dialog alignment in regards to a dialog script/snippet that I\'ve done, yet I don\'t know what you mean. I need details about what it is you feel needs to be aligned and how it should be aligned.

I tested the dialog out on my own system at various display levels and it looked good to me at all levels.

 Respond  
Yoinx   -  Jan 18, 2006

ronninwarrior, I must AGAIN point out that you\'re the only one complaining about dialog alignment. The only thing out of any alignment is the channels editbox, which you can tell he put low like that on purpose.

You should really stop commenting on people\'s dialog alignments since you\'re the only one that HAS a dialog misalignment.

 Respond  
RoninWarrior   -  Jan 18, 2006

i couldnt get it to show any of my modes but that could be my script also but for the rest of the info if it doesnt show then everything looks to be way out of aligment and messy maybe a box for the baisc info and another box for the extra info modes ip ircop etc etc .not to bad though

 Respond  
RoninWarrior   -  Jan 18, 2006

dialog aligment please!

 Respond  
anthalus   -  Jan 18, 2006

Really nice code.

Just curious, have you ever tried using MTS themes? They give you the same freedom for this code as a dialog, but they are much easier to work with.

 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.