| View previous topic :: View next topic |
| Author |
Message |
Ecimo Voice
Joined: 27 Dec 2005 Posts: 5
|
Posted: Tue Dec 27, 2005 10:26 am Post subject: Host2nick |
|
|
if there where any script that work the same way as hand2nick and nick2hand
but just with host changing to a nick also called host2nick |
|
| Back to top |
|
 |
avilon Halfop

Joined: 13 Jul 2004 Posts: 64 Location: Germany
|
Posted: Tue Dec 27, 2005 11:16 am Post subject: |
|
|
| Code: | proc host2nick hostmask {
set hostmask [string map [list {[} {\[} {]} {\]} {\\} {\\\\}] $hostmask]
foreach chan [channels] {
foreach user [chanlist $chan] {
if {[string match -nocase $hostmask $user![getchanhost $user]]} {
return $user
}
}
}
return ""
} |
|
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Dec 27, 2005 7:06 pm Post subject: |
|
|
If you want to return clones as well, use:
| Code: | # a little tweak to avilon's proc
proc host2nick hostmask {
set hostmask [string map [list {[} {\[} {]} {\]} {\\} {\\\\}] $hostmask]
set nicks [list]
foreach chan [channels] {
foreach user [chanlist $chan] {
if {[string match -nocase $hostmask $user![getchanhost $user $chan]]} {
lappend nicks $user
}
}
}
return $nicks
} |
This will return a list of nick(s) or an empty list if nothing found. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
|