Can someone please help me to write an identban tcl, i am new in tcl
i am looking an identbabn.tcl for public and partyline both, if i type at main channel .identban nick reason (if no reason then default reason), and it should work in partyline too... please help
Can someone please help me to write an identban tcl, i am new in tcl
and not: Can someone do all the work for me and email it back. So heat that chair a bit, write a few lines, and post a specific question regarding a certain part of code that you wrote. Otherwise, noone can help you, except to write it for you.
Ignorant and lazy people will save 30 minutes by chosing simple config file. Smart ones will save 3000 minutes of *everyone's* time by opting for complete config file.
sorry guys, i am very new in tcl, but i was reading tcl-commands document and was checking some other kickban scripts and i have tried my best, but it doesn't work at all, and no errors as well, please help me.
here are my codes.
Thanks again.
proc p_identban {nick uhost hand chan arg} {
set chan [string tolower $chan]
if {![isop $nick $chan] || ![botisop $chan]} {return 0}
set target [string tolower [lindex $arg 0]]
if {$target == ""} {
puthelp "NOTICE $nick :try .ib nick reason"
return 0
}
if {[lindex $arg 1] != ""} {
set reason [lrange $arg 1 end]
} else {
set reason "bad ident..."
}
set uhost [getchanhost $target $chan]
set uident [string trimleft [lindex [split $uhost "@"] 0]]
putserv "MODE $chan +b *!$uident@*"
putserv "KICK $chan $target :$reason"
newchanban $chan *!$uident@* $reason 60
}
bind pub o|o .ib p_identban
proc dcc_identban {handle idx arg} {
set chan [lindex [console $idx] 0]
set nick [hand2nick $handle]
set host [getchanhost $nick]
return [p_identban $nick $uhost $hand $chan $arg]
}
bind dcc o|o .ib dcc_identban
hmm i think no one likes to help me , when i didn't have codes, i got 3 replies that try it, when i have tried and spent 4,5 hours and posted here now no one likes to help, heh so its ok i guess, since i am new and trying to learn..
thanks everyone
proc p_identban {nick uhost hand chan arg} {
# why?
set chan [string tolower $chan]
# why testing if the bot is op or not?
# if the bot is not op, it is still capable of adding newchanbans
# to its ban list. Once the bot gets opped, it can enforce those bans :)
if {![isop $nick $chan] || ![botisop $chan]} {return 0}
# "arg" is a string, lindex is a list function.
# Use split first, or use a scan.
# Also see the TCL FAQ on this forum.
# why the string tolower?
set target [string tolower [lindex $arg 0]]
putlog "ARG: $arg"
putlog "TARGET: $target"
if {$target == ""} {
puthelp "NOTICE $nick :try .ib nick reason"
return 0
}
# again, arg is a string, lindex is a list function.
# not good.
if {[lindex $arg 1] != ""} {
# and again: arg is a string, lrange a list function. not good.
set reason [lrange $arg 1 end]
} else {
set reason "bad ident..."
}
# why not check if the target is on the channel?!
# this may lead to bans like *!*@*
# Insert this check here.
# Note that the use of "uhost" is extremely confusing.
# This procedure is also called with "uhost"!
# Use another name.
set uhost [getchanhost $target $chan]
putlog "UHOST: $uhost"
# why trimming the string on the left?
set uident [string trimleft [lindex [split $uhost "@"] 0]]
putlog "UIDENT: $uident"
# why sending a ban, a kick and setting a newchanban?
# only setting a newchanban and having the correct settings
# will make eggdrop send out the kick and ban by itself.
putserv "MODE $chan +b *!$uident@*"
putserv "KICK $chan $target :$reason"
# read up tcl-commands.doc on the syntax for newchanban.
# not good.
newchanban $chan *!$uident@* $reason 60
# Since previously all returns were explicit, nothing to
# return here? Returning "1" logs the command.
}
bind pub o|o .ib p_identban
proc dcc_identban {handle idx arg} {
set chan [lindex [console $idx] 0]
# use hand2nick like this?
# huh? not good! read tcl-commands.doc!
# Note that a partyline user may not be on IRC at all!
# This will make the test "isop" in the proc p_identban fail!
# as well as the puthelps to the nick
set nick [hand2nick $handle]
# subsequently not good!
set host [getchanhost $nick]
# What does "p_identban" return if all works well?
return [p_identban $nick $uhost $hand $chan $arg]
}
bind dcc o|o .ib dcc_identban
Thanks Egghead, i have tried as u have suggested... but still no luck at all, even tried putlog display stuff..but no luck..don't know what's wrong with codes, spend a lot of time..
here are the latest codes, i'll appreciate for your help
Thanks a lot
EEggy wrote: [snip]... but still no luck at all ...[snip]
Perhaps you can tell step by step what you try and what fails? Did you issue an ".ib" from the partyline and did that fail, or did you issue it from the chanel and did it fail? Are the bindings at least triggered?
First of all, only "hand", "idx" and "arg" are passed to this proc. Where do "nick" and "chan" come from? And once again, a partyline user is not necessarily on the channel. There is no reason to put a test like [isop] in there.
Additionally, there is no point of including a point in the DCC binding command .ib
Thanks again Egghead, yes i have tried in the partyline and at channel, in partyline when i tried .ib nick it says what? you need help...
when i tried at channel, .ib nick , no respond at all, then i used putlog....to debug..but nothing....bindings didn't trigger at all, even i have restarted a bot few times as well....i am using eggdrop1.6.12, and other scripts are working fine.
Thanks
regards
EEggy wrote:Thanks again Egghead, yes i have tried in the partyline and at channel, in partyline when i tried .ib nick it says what? you need help...
when i tried at channel, .ib nick , no respond at all, then i used putlog....to debug..but nothing....bindings didn't trigger at all, even i have restarted a bot few times as well....i am using eggdrop1.6.12, and other scripts are working fine.