Code: Select all
proc pub:cmdignore {nick host handle channel text} {
if {$text == ""} {return 0}
set target [lindex [split $text] 0]
set time [lindex [split $text] 1]
set reason [join [lrange [split $text] 2 end]]
if {![string match {[0-9]*} $time]} {set it "15m"} else {set it "$time"}
if {$reason == ""} {set ir "Requested By $nick on [join [ctime [unixtime]]]."} else {set ir "$reason Set By $nick on [join [ctime [unixtime]]]."}
if {![string match *!*@* $target] && ![onchan $target]} {
putserv "PRIVMSG $channel :invalid target; no such nickname/hostmask."
return 0
}
if {[onchan $target]} {set im "*!*@[lindex [split [getchanhost $target] @] 1]"} else {"set im $target"}
newignore $im $handle "$ir" $it
putserv "PRIVMSG $channel :$nick, now ignoring $im for $it minutes."
return 1
}
proc pub:cmdunignore {nick host handle channel text} {
if {$text == ""} {return 0}
set imask [lindex [split $text] 0]
if {![isignore $imask]} {putserv "PRIVMSG $channel :invalid ignore $imask."; return 0}
if {[killignore $imask]} {
putserv "PRIVMSG $channel :$nick, no longer ingoring $imask."
return 1
} else {
putserv "PRIVMSG $channel :failed, ignore $imask must be removed manually."
return 0
}
}
Code: Select all
bind pub - !ignore pub:cmdignore
bind pub - !unignore pub:cmdunignore
proc pub:cmdignore {nick host handle channel text} {
if {$text == ""} {return 0}
set target [lindex [split $text] 0]
set time [lindex [split $text] 1]
set reason [join [lrange [split $text] 2 end]]
if {![string match {[0-9]*} $time]} {set it "15m"} else {set it "$time"}
if {$reason == ""} {set ir "Requested By $nick on [join [ctime [unixtime]]]."} else {set ir "$reason Set By $nick on [join [ctime [unixtime]]]."}
if {![string match *!*@* $target] && ![onchan $target]} {
putserv "PRIVMSG $channel :invalid target; no such nickname/hostmask."
return 0
}
if {[onchan $target]} {set im "$target!*@*"} else {"set im $target"}
newignore $im $handle "$ir" $it
putserv "PRIVMSG $channel :$nick, now ignoring $im for $it minutes."
return 1
}
proc pub:cmdunignore {nick host handle channel text} {
if {$text == ""} {return 0}
set imask [lindex [split $text] 0]
if {![isignore $imask]} {putserv "PRIVMSG $channel :invalid ignore $imask."; return 0}
if {[killignore $imask]} {
putserv "PRIVMSG $channel :$nick, no longer ingoring $imask."
return 1
} else {
putserv "PRIVMSG $channel :failed, ignore $imask must be removed manually."
return 0
}
}
and change it toif {[onchan $target]} {set im "$target!*@*"} else {"set im $target"}
Code: Select all
if {[onchan $target]} {set im "$target!*@*"} else {set im "$target"}
Code: Select all
setudef flag quiet
Code: Select all
if {[channel get $channel quiet] > 0} {return 0}
Code: Select all
if {[chanflag $channel quiet]} {return 0}
Something along that lines would be alot easyer i think, and it would probably prevent problems with unbind'ing of things done via a script.# chanflag <channel> <flag>
# version:
# v3.1
# information (mc.moretools command):
# Check to see if <flag> is enabled or disabled for <channel>. The 'get'
# option for the 'channel' command, provided by eggdrop in version 1.6.11,
# does the same as this command. Because of that, this command will try
# and query 'channel' command first (is faster); if it receives an error
# then it will proceed with my code. <flag> includes custom setudef flags
# as well as the standard ones provided by eggdrop.
# dependencies (other than eggdrop provided commands):
# The 'badargs' command from mc.moretools.
# The 'unlist' command from mc.moretools.
# examples:
# chanflag #abc123 protectops => 0
# chanflag #abc123 mc.spamcheck => 1
# credit:
# returns:
# - 0 if disabled or invalid <flag>.
# - 1 if enabled.