| View previous topic :: View next topic |
| Author |
Message |
AskMe Voice
Joined: 11 Apr 2007 Posts: 23 Location: Canada
|
Posted: Mon Jun 11, 2007 4:53 pm Post subject: whois info [SOLVED] |
|
|
in MIRC when i do a whois i reveice this info
| Code: |
nick is "www.mysitecom/?u=1234" ~bla@myhost.com
|
how can i retreive the full name info "www.mysitecom/?u=1234" ???
i need this info to make a matchattr
thanks
Last edited by AskMe on Tue Jun 12, 2007 1:25 pm; edited 1 time in total |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
AskMe Voice
Joined: 11 Apr 2007 Posts: 23 Location: Canada
|
Posted: Mon Jun 11, 2007 9:38 pm Post subject: |
|
|
i need a little help on that
| Code: |
bind raw - 311 uw:RAW311
proc uw:RAW311 {from keyword args} {
set args [lindex $args]
putlog "TEST $args"
}
|
i receive this
| Code: |
TEST {botnick nick ~bla myhost.com * :www.mysitecom/?u=1234}
|
anyone can help me to just have this info please?
|
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Mon Jun 11, 2007 9:59 pm Post subject: |
|
|
First off, don't use "args" as a parameter name. It has some special mechanics that will cause problems if you are not aware of them.
Next, say we changed it to "text", first step would be to either locate the colon (:), or split the string into a list (using colon as separator character).
Easiest would probably be using split, although this might cause some problems in some cases, whereas locating the colon should always work.
Next step would depend on which method you have chosen, and you will either use lindex to retireve the proper list-item from the newly formed list, or "string range" to select a substring from the textstring.
The following example uses the substring method:
| Code: | set i [expr [string first " :" $text] + 1]
set info [string range $text $i end] |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
AskMe Voice
Joined: 11 Apr 2007 Posts: 23 Location: Canada
|
Posted: Mon Jun 11, 2007 10:34 pm Post subject: |
|
|
ok its getting better now but not perfect
| Code: |
bind raw - 311 uw:RAW311
proc uw:RAW311 {from keyword text} {
set i [expr [string first " :" $text] + 1]
set info [string range $text $i end]
putlog "TEST $info"
}
|
and the result is
| Code: |
TEST :www.mysitecom/?u=1234
|
now i need to remove the : at the begining of :www.mysitecom/?u=1234 |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Tue Jun 12, 2007 12:32 am Post subject: |
|
|
May be try:
| Code: | | [string trim [join [lrange $text $i end]] :] |
_________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
AskMe Voice
Joined: 11 Apr 2007 Posts: 23 Location: Canada
|
Posted: Tue Jun 12, 2007 12:59 am Post subject: |
|
|
| Alchera wrote: | May be try:
| Code: | | [string trim [join [lrange $text $i end]] :] |
|
not working...
result
|
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Jun 12, 2007 5:08 am Post subject: |
|
|
| Code: | | set info [string trimleft [string range $text $i end] :] |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
user

Joined: 18 Mar 2003 Posts: 1452 Location: Norway
|
Posted: Tue Jun 12, 2007 7:10 am Post subject: |
|
|
why not | Code: | | set i [expr {[string first ":" $text]+1}] | ? _________________ Have you ever read "The Manual"? |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Jun 12, 2007 8:41 am Post subject: |
|
|
Actually, the flaw is that I added 1 and not 2 to the offset. (Forgot I matched 2 characters rather than 1)
Should work as intended
| Code: | set i [expr [string first " :" $text] + 2]
set info [string range $text $i end] |
@Alchera: Why on earth would you use lrange and join on a string? _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Tue Jun 12, 2007 8:53 am Post subject: |
|
|
| nml375 wrote: | | @Alchera: Why on earth would you use lrange and join on a string? |
Typo
I copied and pasted from an xchat script I use where everything has to be split etc to remove unwanted characters (an xchat quirk apparently). _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Jun 12, 2007 9:15 am Post subject: |
|
|
Think it's rather a matter of preference, if you prefer to work with list or strings. Either way works I suppose, as long as you don't mix them up
One problem with splitting on colon ( : ) however, is that it might screw up bigtime on IPv6 hosts (thats also the reason I'm searching for " :" and not ":"). _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Tue Jun 12, 2007 9:32 am Post subject: |
|
|
| Quote: | [22:26] * =============== _|nTe|_ whois response ===============
[22:26] * [_|nTe|_] (gUeSs@helper.phazenet.com): gUeSs
[22:26] * [_|nTe|_] is a registered nick
[22:26] * [_|nTe|_] #scriptingshack @#phazeschool &#phazechat @#HelpDesk +#Command &#Ballarat
[22:26] * [_|nTe|_] Pothole.US.Phazenet.Com :Finer Than A Frogs Hair
[22:26] * [_|nTe|_] is available for help.
[22:26] * =============== _|nTe|_ whois end =============== |
I use XChat's Tcl plugin to format the above and without manipulation I'd have a series of brackets and braces amongst it all. I copied and pasted a line of code forgetting to fix it for eggdrop.
XChat snippet:
| Code: | # RPL_WHOISUSER
on 311 mywhois {
set whodata [split $_rest " "]
set servertab [findcontext [server]]
.......
complete EAT_ALL
} |
PS: I've been "inspired" to revisit this script of mine.  _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
AskMe Voice
Joined: 11 Apr 2007 Posts: 23 Location: Canada
|
Posted: Tue Jun 12, 2007 1:20 pm Post subject: |
|
|
| Sir_Fz wrote: | | Code: | | set info [string trimleft [string range $text $i end] :] |
|
This works great
| nml375 wrote: | Actually, the flaw is that I added 1 and not 2 to the offset. (Forgot I matched 2 characters rather than 1)
Should work as intended
| Code: | set i [expr [string first " :" $text] + 2]
set info [string range $text $i end] |
|
This one works great too
| user wrote: | why not | Code: | | set i [expr {[string first ":" $text]+1}] | ? |
didnt work.. they give me this result
so if anyone need the info you can use
| Code: | bind raw - 311 uw:RAW311
proc uw:RAW311 {from keyword text} {
set i [expr [string first " :" $text] + 2]
set info [string range $text $i end]
putlog "TEST $info"
}
|
or
| Code: | bind raw - 311 uw:RAW311
proc uw:RAW311 {from keyword text} {
set i [expr [string first " :" $text] + 1]
set info [string trimleft [string range $text $i end] :]
putlog "TEST $info"
}
|
they both give me
thanks to all for your help  |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Tue Jun 12, 2007 7:44 pm Post subject: |
|
|
AskMe: user's hint was based on what nml375 posted before it was fixed:
| Code: | | set i [expr {[string first " :" $text]+2}] |
It does indeed work correctly.  _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
|