| View previous topic :: View next topic |
| Author |
Message |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Jun 07, 2007 4:49 pm Post subject: |
|
|
Well, this piece confuses me:
| Code: | | string match -nocase $dhost $dhuser |
You're only checking wether the the two parameters you've entered "match" eachother. It does no test whatsoever if the hostmask entered on the commandline is added to the user record.
Easiest, I'd guess, would just to use delhost, and test the returncode to see wether the hostmask was successfully removed...
| doc/tcl.commands.doc wrote: | delhost <handle> <hostmask>
Description: deletes a hostmask from a user's host list
Returns: 1 on success; 0 if the hostmask (or user) doesn't exist
Module: core
|
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Riddler Halfop
Joined: 20 May 2007 Posts: 60 Location: Brasov, Romania
|
Posted: Sun Jun 10, 2007 6:40 pm Post subject: |
|
|
| nml375 wrote: |
Easiest, I'd guess, would just to use delhost, and test the returncode to see wether the hostmask was successfully removed...
| doc/tcl.commands.doc wrote: | delhost <handle> <hostmask>
Description: deletes a hostmask from a user's host list
Returns: 1 on success; 0 if the hostmask (or user) doesn't exist
Module: core
|
|
Well I`ve tried that also and still not the results I want....
The new code
| Code: | proc s:delhost {nick uhost hand chan text} {
global botnick dj
if {[channel get $chan djtools] && ![isbotnick $nick]} {
set dhuser [lindex [split $text] 0]
set dhost [lindex [split $text] 1]
if {$dhuser == ""} {
puthelp "NOTICE $nick :SYNTAX:\002 .delhost <user> <*!*@host>\002"
} elseif {![validuser $dhuser]} {
puthelp "NOTICE $nick :Error\002 $dhuser \002is not a valid user. Check\002 .userlist \002"
} elseif {![string match -nocase *!*@* $dhost]} {
puthelp "NOTICE $nick :Error\002 $dhost \002is not a valid host."
} else {
delhost $dhuser $dhost
puthelp "NOTICE $nick :Deleted host\002 $dhost \002from user\002 $dhuser \002"
return 0 }
puthelp "NOTICE $nick :Error\002 $dhost \002is not added as host for user\002 $dhuser \002"
}
} |
a nother suggestion/ideea ? pls  _________________ I am a man of few words, but many riddles |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Jun 10, 2007 7:30 pm Post subject: |
|
|
Skip the string-match completely, and just test wether deleting the host works or not?
| Code: | proc s:delhost {nick uhost hand chan text} {
global botnick dj
if {[channel get $chan djtools] && ![isbotnick $nick]} {
set dhuser [lindex [split $text] 0]
set dhost [lindex [split $text] 1]
if {$dhuser == ""} {
puthelp "NOTICE $nick :SYNTAX:\002 .delhost <user> <*!*@host>\002"
} elseif {![validuser $dhuser]} {
puthelp "NOTICE $nick :Error\002 $dhuser \002is not a valid user. Check\002 .userlist \002"
} elseif {![delhost $dhuser $dhost]} {
puthelp "NOTICE $nick :Error\002 $dhost \002was not added to $dhuser."
} else {
puthelp "NOTICE $nick :Deleted host\002 $dhost \002from user\002 $dhuser \002"
}
}
} |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Riddler Halfop
Joined: 20 May 2007 Posts: 60 Location: Brasov, Romania
|
Posted: Sun Jun 10, 2007 9:06 pm Post subject: |
|
|
| nml375 wrote: | Skip the string-match completely, and just test wether deleting the host works or not?
|
Thank you ..it works but it was not necessary to remove the string-match...I`ve replaced the
| Code: | | {![string match -nocase $dhost $dhuser]} { |
with your suggestion ..
| Code: | | {![delhost $dhuser $dhost]} { |
and the scripts works perfectly
| Quote: | <me> .delhost
-|EGG- SYNTAX: .delhost <user> <*!*@host>
<me> .delhost lol
-|EGG- Error lol is not a valid user. Check .userlist
<me> .delhost test 34893948
-|EGG- Error 34893948 is not a valid host.
<me> .delhost test *!*@domain.name
-|EGG- Error *!*@domain.name was not added to test.
<me> .delhost test *!*@test.ro
-|EGG- Deleted host *!*@test.ro from user test |
Thanks again for the help nml375  _________________ I am a man of few words, but many riddles |
|
| Back to top |
|
 |
|