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 

[SOLVED] A little UserMRG.tcl script...
Goto page Previous  1, 2
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Jun 07, 2007 4:49 pm    Post subject: Reply with quote

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


Joined: 20 May 2007
Posts: 60
Location: Brasov, Romania

PostPosted: Sun Jun 10, 2007 6:40 pm    Post subject: Reply with quote

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 Idea ? pls Shocked
_________________
I am a man of few words, but many riddles
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Jun 10, 2007 7:30 pm    Post subject: Reply with quote

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


Joined: 20 May 2007
Posts: 60
Location: Brasov, Romania

PostPosted: Sun Jun 10, 2007 9:06 pm    Post subject: Reply with quote

nml375 wrote:
Skip the string-match completely, and just test wether deleting the host works or not?


Thank you Very Happy Very Happy ..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 Cool Laughing

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 Very Happy Wink Razz
_________________
I am a man of few words, but many riddles
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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