mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
#whois off
raw *:*:{ 
  var %raw = $numeric 
  if $istok(311 401 379 378 307 319 312 301 313 310 671 317 318,$event,32) {    haltdef  } 
  if %raw == 311 { 
    %w = $true 
    did -ra Whois 4 $+($3,@,$4) 
    did -ra Whois 6 $6- 
  } 
  elseif %raw == 401 {
    did -v Whois 26 
  } 
  elseif %raw == 379 {
    did -v Whois 7
    did -rva Whois 8 $remove($3-,is using modes)
  } 
  elseif %raw == 378 {
    did -v Whois 9
    did -rva Whois 10 $7- 
  } 
  elseif %raw == 307 {    did -v Whois 11  } 
  elseif %raw == 319 {    didtok Whois 14 32 $3- }
  elseif %raw == 312 {    did -ra Whois 18 $3  } 
  elseif %raw == 301 {
    did -v Whois 15
    did -rva Whois 16 $3-
  } 
  elseif %raw == 313 {    did -v Whois 19  } 
  elseif %raw == 310 {    did -v whois 20   } 
  elseif %raw == 671 {    did -v whois 21  } 
  elseif %raw == 317 { 
    did -ra whois 17 $duration($3) 
    did -ra whois 23 $asctime($4) 
  } 
  elseif %raw == 318 { 
    did -e Whois 25 
    .disable #whois 
    haltdef 
  } 
} 
#whois end 
dialog Whois { 
  title "Who Is" 
  size -1 -1 185 140 
  option dbu 
  text "Nick", 1, 5 7 25 8 
  combo 2, 30 5 100 10, drop
  text "Address", 3, 5 17 25 8 
  edit "", 4, 30 15 150 10 
  text "Name", 5, 5 27 25 8 
  edit "", 6, 30 25 100 10 
  text "Modes", 7, 5 37 25 8 
  edit "", 8, 30 35 50 10 
  text "IP", 9, 5 47 25 8 
  edit "", 10, 30 45 50 10 
  text "Channels", 13, 5 87 25 8 
  list 14, 30 85 100 20 
  text "Away", 15, 5 107 25 8 
  edit "", 16, 30 105 150 10 
  edit "", 17, 115 115 65 10 
  text "Registered", 11, 5 55 50 8
  text "Server", 12, 5 77 25 8 
  edit "", 18, 30 75 100 10 
  text "IRCop", 19, 75 55 50 10
  text "Help", 20, 5 65 50 10
  text "Secure", 21, 75 65 50 10
  text "Sign On", 22, 5 117 25 8 
  edit "", 23, 30 115 60 10 
  text "Idle", 24, 95 117 20 8 
  button "Exit", 25, 139 2 37 12, default ok 
  text "Not online", 26, 100 5 20 10
} 

on *:dialog:whois:init:*:{ 
  did -b $dname 25 
  did -r $dname 2,4,6,8,10,14,16,17,18 
  did -u $dname 11,19,20,21 
  did -h $dname 26
} 
menu * { 
  Who2 : .who2 $iif($snicks,$v1,$$?="Nick(s) to whois") 
} 
alias who2 { 
  dialog $iif(!$dialog(Whois),-md,-eno) Whois Whois 
  didtok Whois 2 44 $1-
}
on *:dialog:whois:sclick:2:{
  did -r $dname 14,17,23
  did -h $dname 7,8,9,10,11,15,16,19,20,21
  .enable #whois 
  .whois $iif($did($dname,$did).seltext,$v1,$did($dname,$did))
} 
  


The above code works for the most part. What isn't working is the display of the Sign on & Idle times when I go to use it on any nick except mine. When I use it on my nick, it works fine.

A couple of things that I'd like added to this, if possible
A) an automatic generation of the whois information if there's only one nick in ID 2.

B) Have the lines that show the information adjust in size automatically to accomodate the length of the display. This will, of course, possibly require resizing of the dialog box itself. The specific lines I'm referring to are those that show the Nick, Address, Name, modes & server. If it can be done, and someone can show me how to do it for one, I can use that as a basis for the others.

I know that A can be done, as I had it working with just a single entry in that ID, but now that I have it so that multiple nicks can be stored in that one ID, I'm not sure how to get it to work. If the 2nd one can be done..great, if not, oh well

Here's a screen shot of the dialog as it currently stands

Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Got the first part resolved on my own. If anyone has ideas on how to implement the second part of my request, I'm listening.

Updated code reads
Code:
 #whois off
raw *:*:{ 
  var %raw = $numeric 
  if $istok(311 401 379 378 307 319 312 301 313 310 671 317 318,$event,32) {    haltdef  } 
  if %raw == 311 { 
    did -v Whois 3,5
    did -rva Whois 4 $+($3,@,$4) 
    did -rva Whois 6 $6- 
  } 
  elseif %raw == 401 {    did -v Whois 26  } 
  elseif %raw == 379 {
    did -v Whois 7
    did -rva Whois 8 $6-
  } 
  elseif %raw == 378 {
    did -v Whois 9
    did -rva Whois 10 $7- 
  } 
  elseif %raw == 307 {    did -v Whois 11   } 
  elseif %raw == 319 {
    did -v Whois 13,14,27
    did -ra Whois 27 $numtok($3-,32)
    didtok Whois 14 32 $3-
  }
  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 -v Whois 19   } 
  elseif %raw == 310 {    did -v whois 20   } 
  elseif %raw == 671 {    did -v whois 21   } 
  elseif %raw == 317 { 
    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 
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)))
}
dialog Whois {
  title "Who Is"
  size -1 -1 195 130
  option dbu
  text "Nick", 1, 5 7 25 8
  combo 2, 30 5 100 10, drop
  text "Address", 3, 5 17 25 8
  edit "", 4, 30 15 150 10
  text "Name", 5, 5 27 25 8
  edit "", 6, 30 25 100 10
  text "Modes", 7, 5 37 25 8
  edit "", 8, 30 35 50 10
  text "IP", 9, 5 47 25 8
  edit "", 10, 30 45 50 10
  text "Channels", 13, 5 87 25 8
  list 14, 30 85 100 20
  text "Away", 15, 5 107 25 8
  edit "", 16, 30 105 150 10
  edit "", 17, 132 75 50 10, center
  text "Registered", 11, 5 55 30 8, center
  text "Server", 12, 5 77 25 8
  edit "", 18, 30 75 100 10
  text "IRCop", 19, 40 55 30 8, center
  text "Help", 20, 5 65 30 8, center
  text "Secure", 21, 40 65 30 8, center
  text "Sign On", 22, 75 57 25 8, center
  edit "", 23, 100 55 80 10
  text "Idle", 24, 132 65 50 8, center
  button "Exit", 25, 139 2 37 12, default ok
  text "Not online", 26, 100 5 20 10
  edit "", 27, 5 94 25 10, center
  edit "", 28, 132 85 50 10, center
}

on *:dialog:whois:init:*:{ 
  did -b $dname 25 
  did -r $dname 2,4,6,8,10,14,16,17,18,27,28
  did -h $dname 3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28
} 
menu * { 
  Who2 : .who2 $iif($snicks,$v1,$$?="Nick(s) to whois") 
} 
alias -l who2 { 
  dialog $iif(!$dialog(Whois),-md,-eno) Whois Whois 
  did -r Whois 2,14
  var %nicks = $replace($1-,$chr(44),$chr(32))
  if ($numtok(%nicks,32) == 1) {
    did -ca Whois 2 $1
    .enable #whois
    .whois $1 $1
  }
  else {    didtok Whois 2 32 %nicks  }
}
on *:dialog:whois:sclick:2:{
  did -r $dname 14,17,23,28
  did -h $dname 7,8,9,10,11,15,16,19,20,21
  .enable #whois 
  .whois $iif($did($dname,$did).seltext,$v1,$did($dname,$did)) $iif($did($dname,$did).seltext,$v1,$did($dname,$did))
} 
on *:dialog:whois:*:14:{
  var %chan = $+($chr(35),$gettok($did($dname,$did).seltext,-1,35))
  if $devent == dclick {
    $iif($me !ison %chan,.join %chan,echo -a 4You're already in $v2)
  }
  elseif $devent == sclick {
    did -rva $dname 28 $iif($me !ison %chan,N/A,$idle($nick(%chan,$iif($did($dname,2).seltext,$v1,$did($dname,2))).idle))
  }
}
 

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
As far as I know it's not possible to resize dialog items while the dialog is running (except maybe as a feature of one of the dialog dlls that are available). I can only think of a couple possible workarounds:

1. Make several text boxes of different sizes that are layered on top of each other, and then show/hide the appropriate box when the text is of a certain length.

2. Somehow (re)write the "dialog Whois { ... }" part dynamically, and reload the dialog each time someone performs a whois. This method seems a bit sloppy to me, but it could work. I'm not sure exactly how it could be done, but maybe this would work:

dialog whois {
title "Who Is"
size -1 -1 %who.main.w 130
option dbu
text "Address", 3, 5 17 25 8
edit "", 4, 30 15 %who.4.w 10
text "Name", 5, 5 27 25 8
edit "", 6, 30 25 %who.6.w 10
}

* Untested

If that doesn't work, maybe you could have the dialog whois { ... } part in a text file with special markers around the width portions. Then read each line in, adjust those marked portions, write the changes to a file, load that file, and then reload the dialog.

The multiple sized box method seems much easier..

-genius_at_work

Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
I think you aren't getting the sign on time and idle time on others because unless you are on the same server you have to send the nick twice in the whois to get that information
whois %nick %nick
so just adapt this part to put the nick twice[color:green]
on *:dialog:whois:sclick:2:{
did -r $dname 14,17,23
did -h $dname 7,8,9,10,11,15,16,19,20,21
.enable #whois
.whois $iif($did($dname,$did).seltext,$v1,$did($dname,$did))
}

Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Yeah, I already figured that part out, Mike. Thanks anyways.

Genius_at_work: Thanks for your advice, but I'm starting to think that doing that is going to be too much trouble for the little bit of improvement that I'd get regarding the visual layout aspect.


Link Copied to Clipboard