This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Host2nick

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
E
Ecimo
Voice
Posts: 5
Joined: Tue Dec 27, 2005 10:19 am

Host2nick

Post by Ecimo »

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
User avatar
avilon
Halfop
Posts: 64
Joined: Tue Jul 13, 2004 6:58 am
Location: Germany

Post by avilon »

Code: Select all

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 ""
}
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

If you want to return clones as well, use:

Code: Select all

# 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.
Post Reply