egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Host2nick

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Ecimo
Voice


Joined: 27 Dec 2005
Posts: 5

PostPosted: Tue Dec 27, 2005 10:26 am    Post subject: Host2nick Reply with quote

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
View user's profile Send private message
avilon
Halfop


Joined: 13 Jul 2004
Posts: 64
Location: Germany

PostPosted: Tue Dec 27, 2005 11:16 am    Post subject: Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Tue Dec 27, 2005 7:06 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber