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 

results

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
ap
Halfop


Joined: 09 Jun 2006
Posts: 44

PostPosted: Sun Aug 06, 2006 1:58 pm    Post subject: results Reply with quote

Hi, I am going thorugh the chanlist to save the userslist to the variable if they have a undernet host, if they don't have a undernet host then i don't save it.
I am using the following codes but sometime it missed some undernet hosts and sometime it works fine. Is there any better way to do it? thanks

Code:
foreach user [chanlist $chan]] {
     set userhost [getchanhost $user $chan]
      if {[string match "*.users.undernet.org" $userhost]} {
        set h [lindex $userhost [lsearch -glob $userhost *.users.undernet.org]]
   } else {
        set h "N/A"
      }
Back to top
View user's profile Send private message
krimson
Halfop


Joined: 19 Apr 2006
Posts: 86

PostPosted: Sun Aug 06, 2006 2:31 pm    Post subject: Reply with quote

well, what your code does there is check each host if it matches *.users.undernet.org and overwrites the variable $h until the last user to be checked.

i'm not sure what you want to do with this, so if you'd be more specific i could help out with some code
Back to top
View user's profile Send private message Send e-mail
ap
Halfop


Joined: 09 Jun 2006
Posts: 44

PostPosted: Sun Aug 06, 2006 2:37 pm    Post subject: Reply with quote

well i am going thorugh the chanlist and i check if user has undernet host, if yes then i save to a variable, in the above code i set that to "h", if no then i move "n/a" but there must be the better way. i think something is fishy in the above codes because bot doesn't check his host even that's undernet host. i need the codes so it check the chanlist and it should check if user has a undernost host, if yes then write to the variaable if not then write "n/a"
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Aug 06, 2006 3:25 pm    Post subject: Reply with quote

There are quite a few flaws in that code:
1. You iterate through all members of a channel, doing that check; but each time you overwrite the result of the previous test.. Unless you use $h further down inside that foreach-loop, that would not make sense

2. You are mixing lists and string commands; this is a BIG no-do. If you wish to use list-commands, you'll have to convert the string to a list, using commands such as "list" or "split".

If you wish to isolate the hostname part from nick!ident@hostname, I'd suggest something like this:
Code:

...
set userhost [getchanhost $user $chan]
if {[string match "*.users.undernet.org" $userhost]} {
  set h [lindex [split $userhost "@"] end]
} ...


Of course, you'd still have to do something useful with $h before you close the foreach-loop...

edit: Removed an accidental space between $ and userhost in the example-code
_________________
NML_375, idling at #eggdrop@IrcNET


Last edited by nml375 on Mon Aug 07, 2006 11:28 am; edited 1 time in total
Back to top
View user's profile Send private message
ap
Halfop


Joined: 09 Jun 2006
Posts: 44

PostPosted: Sun Aug 06, 2006 6:08 pm    Post subject: Reply with quote

thank you , but how do i get ident@host

Quote:
set userhost [getchanhost $user $chan]
if {[string match "*.users.undernet.org" $ userhost]} {
set h [lindex [split $userhost "@"] end]
} ...
Back to top
View user's profile Send private message
krimson
Halfop


Joined: 19 Apr 2006
Posts: 86

PostPosted: Mon Aug 07, 2006 3:01 am    Post subject: Reply with quote

Quote:
Code:
set userhost [getchanhost $user $chan]


this provides you the ident@host part
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help 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