| View previous topic :: View next topic |
| Author |
Message |
Sydneybabe Op
Joined: 27 Apr 2007 Posts: 106 Location: Philippines
|
Posted: Sat Aug 20, 2011 7:59 am Post subject: |
|
|
| Hello sir i try the script but still no luck. |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat Aug 20, 2011 9:04 am Post subject: |
|
|
It seems I introduced a new bug in my last fix (should'nt have added -- to the lsearch commands, that part was working just fine as it was).
The following have been successfully simulated in tclsh, and should work.
It will allow bots and masters/owners to override the lock.
| Code: | namespace eval modecontrol {
variable enforceModes "" #Always keep these set
variable restrictModes "" #Never permit these to be set
proc raw:modeCheck {from key text} {
variable enforceModes
variable restrictModes
set from [split $from "!"]
set nick [lindex $from 0]
set handle [nick2hand $nick]
#Sanity check
if {[isbotnick $nick] || [matchattr $handle "+mnb"]} {
return 0
}
set items [split $text]
set enforce [split $enforceModes ""]
set restrict [split $restrictModes ""]
set target [lindex $items 0]
set add 1
set act 0
foreach mode [split [lindex $items 1] ""] {
switch -- $mode {
"+" {
set add 1
}
"-" {
set add 0
}
"I" -
"e" -
"b" {
set items [lreplace $items 2 2]
}
"k" {
if {$add} {
set key [lindex $items 2]
set items [lreplace $items 2 2]
}
}
"l" {
if {$add} {
set limit [lindex $items 2]
set items [lreplace $items 2 2]
}
}
default {
if {[lsearch $enforce $mode] >= 0 && !$add} {
pushmode $target "+$mode"
set act 1
} elseif {[lsearch $restrict $mode] >= 0 && $add} {
pushmode $target "-$mode"
set act 1
}
}
}
#Uncomment this to bounce key and limits
#if {[info exists key]} {
# pushmode $target -k $key
#}
#if {[info exists limit]} {
# pushmode $target -l
#}
}
if {$act && [llength $from] > 1} {
puthelp "NOTICE $nick :Please let me handle the channel mode settings."
}
return 0
}
bind raw - "MODE" [namespace current]::modeCheck
} |
Edit: Fixed incorrect binding type
Edit: Placed code in separate namespace, separated enforced and restricted modes
Edit: Fixed missing "eval" subcommand for namespace
Edit: Incorrect lsearch order and pattern. _________________ NML_375, idling at #eggdrop@IrcNET
Last edited by nml375 on Mon Mar 19, 2012 12:34 pm; edited 4 times in total |
|
| Back to top |
|
 |
Sydneybabe Op
Joined: 27 Apr 2007 Posts: 106 Location: Philippines
|
Posted: Sat Aug 20, 2011 1:36 pm Post subject: |
|
|
I test the script this time sir but nothing happens:
| Quote: | | * User sets mode: +R |
the bot did not -R the channel :s |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat Aug 20, 2011 6:02 pm Post subject: |
|
|
What did you set lockModes to?
Also, did you get any error messages in your logs or dcc chat? _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Sydneybabe Op
Joined: 27 Apr 2007 Posts: 106 Location: Philippines
|
Posted: Sun Aug 21, 2011 12:51 am Post subject: |
|
|
Hello sir with the help of speechles the error found on this part:
| Quote: | | bind mode - "MODE" raw:modeCheck |
and now the script is working but opposite of what i requested:
| Quote: | User sets mode +m
User sets mode -m
Eggdrop sets mode +m
User sets mode +M
User sets mode -M
Eggdrop sets mode +M |
It keep the settings that offender set that not added to the masters, owners, and other bots. |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Aug 21, 2011 6:18 am Post subject: |
|
|
Then I am either confused of the intended behaviour, or you've got some other script or feature enabled that is interfering.
The way the script was written, is to enforce the modes set in lockModes - that is, do not let people remove the modes set from the channel, and do not let people add other modes to the channel.
I've now updated the previous post in order to separate enforced and restricted modes. I've also moved the code to a separate namespace, so make sure you restart your eggdrop (not just .rehash) to make sure the old code does not persist. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Sydneybabe Op
Joined: 27 Apr 2007 Posts: 106 Location: Philippines
|
Posted: Mon Aug 22, 2011 9:09 am Post subject: |
|
|
Hi sir there is an error on the script how to fix this:
| Quote: | | Unknown subcommand "modecontrol" to "namespace" |
Thanks in advance. |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Mon Aug 22, 2011 12:39 pm Post subject: |
|
|
Minor typo, lost the "eval" subcommand during copy/paste. Post updated now _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
|