xecho -b Chanop server script loaded! xecho -b Written by gircobain 16/10/2001 revised 05/11/2001 xecho -b To activate chanop server, type /chanopserv on @opfile = [~/oplist] @chanfile = [~/chaninfo] @CHANOPSERV_ON = 0 @DUMP_INT = 600 alias read_oplist { @delarray(chaninfo) ^load $chanfile @delarray(oplist) ^load $opfile } alias save_oplist { if (numitems(oplist)) { ^local fd @unlink($opfile) @fd = open($opfile w) for (@:count = 0,count < numitems(oplist),@count++) { @:opinfo = getitem(oplist $count) @write($fd \@setitem\(oplist $count $opinfo\)) } @close($fd) @unlink($chanfile) @fd = open($chanfile w) for (@:count = 0,count < numitems(chaninfo),@count++) { @:chaninfo = getitem(chaninfo $count) @write($fd \@setitem\(chaninfo $count $chaninfo\)) } @close($fd) } } alias get_ops (chan, level) { @:opstring = [] for (@:count = 0,count < numitems(oplist),@count++) { @:opinfo = getitem(oplist $count) if (word(0 $opinfo) == chan && word(2 $opinfo) == level) @opstring #= word(1 $opinfo) ## [ ] } return $opstring } alias setop (op,chan,user,level) { whois -cmd { @:oplevel = 0 @:oldlevel = 0 if (matchitem(oplist $chan $op *) > -1) @:oplevel = word(2 $getitem(oplist $matchitem(oplist $chan $op *))) if (matchitem(oplist $chan $user *) > -1) @:oldlevel = word(2 $getitem(oplist $matchitem(oplist $chan $user *))) if (match($1 "Moderator") && oplevel < 2) @oplevel = 2 if (match($1 "Admin" "Elite")) @oplevel = 4 switch ($oplevel) { (3) { if (level <= 2 && oldlevel <= 2) { if (level != oldlevel) { if (oldlevel) { @setitem(oplist $matchitem(oplist $chan $user *) $chan $user $level) }{ @setitem(oplist $numitems(oplist) $chan $user $level) } if (!match($chan $onchannels())) join $chan ^raw 205 chanserv wallop $chan $op added user $user to channel $chan with access $level if (numwords($chanusers($chan)) == 1) mode $chan +P msg $op Added user $user to channel $chan with access $level } }{ msg $op failed: requires access 4 } } (4) { if (level != oldlevel) { if (oldlevel == 4 && numwords($get_ops($chan 4)) == 1) { msg $op Cannot remove last owner }{ if (oldlevel) { @setitem(oplist $matchitem(oplist $chan $user *) $chan $user $level) }{ @setitem(oplist $numitems(oplist) $chan $user $level) } if (!match($chan $onchannels())) join $chan ^raw 205 chanserv wallop $chan $op added user $user to channel $chan with access $level if (numwords($chanusers($chan)) == 1) mode $chan +P msg $op Added user $user to channel $chan with access $level } } } (*) { msg $op failed: requires access ${(level > 2 || oldlevel > 2) ? [4] : [3 or better]} } } ^assign -op ^assign -chan ^assign -user ^assign -level } $op } alias delop (op,chan,user) { whois -cmd { @:oplevel = 0 @:oldlevel = 0 if (matchitem(oplist $chan $op *) > -1) @:oplevel = word(2 $getitem(oplist $matchitem(oplist $chan $op *))) if (matchitem(oplist $chan $user *) > -1) @:oldlevel = word(2 $getitem(oplist $matchitem(oplist $chan $user *))) if (match($1 "Moderator") && oplevel< 2) @oplevel = 2 if (match($1 "Admin" "Elite")) @oplevel = 4 if (oldlevel) { switch ($oplevel) { (3) { if (oldlevel < 3) { @delitem(oplist $matchitem(oplist $chan $user *)) if (!match($chan $onchannels())) join $chan ^raw 205 chanserv wallop $chan $op deleted user $user from channel $chan access list if (numwords($chanusers($chan)) == 1) mode $chan +P msg $0 User $user deleted from channel $chan access list }{ msg $0 failed: requires level 4 } } (4) { if (oldlevel == 4 && numwords($get_ops($chan 4)) == 1) { msg $op Cannot remove last owner }{ @delitem(oplist $matchitem(oplist $chan $user *)) if (!match($chan $onchannels())) join $chan ^raw 205 chanserv wallop $chan $op deleted user $user from channel $chan access list if (numwords($chanusers($chan)) == 1) mode $chan +P msg $0 User $user deleted from channel $chan access list } } (*) { msg $0 failed requires access ${oldlevel == 4 ? [4] : [3 or better]} } } }{ msg $0 No such user in $chan access list } ^assign -op ^assign -chan ^assign -user } $op } on #-403 1000 "% % !register" if (CHANOPSERV_ON) { if (matchitem(chaninfo $0 *) > -1) { msg $1 Channel is already registered }{ @setitem(oplist $numitems(oplist) $0 $1 4) @setitem(chaninfo $numitems(chaninfo) $0 $time() 0 0 " ") mode $0 +R op $0 $1 ^raw 205 chanserv wallop $0 $1 registered channel $0 msg $1 Channel succesfully registered } } on #-msg 1500 "% register %" if (CHANOPSERV_ON) { if (matchitem(chaninfo $2 *) > -1) { msg $0 Channel is already registered }{ @setitem(oplist $numitems(oplist) $2 $0 4) @setitem(chaninfo $numitems(chaninfo) $2 $time() 0 0 " ") if (!match($2 $onchannels())) join $2 mode $2 +R op $2 $0 ^raw 205 chanserv wallop $2 $0 registered channel $2 if (numwords($chanusers($2)) == 1) mode $2 +P msg $0 Channel succesfully registered } } on #-403 2000 "% % !info" if (CHANOPSERV_ON && matchitem(chaninfo $0 *) > -1) { @:chaninfo = getitem(chaninfo $matchitem(chaninfo $0 *)) msg $1 Info for channel $0 msg $1 Owner : $word(1 $getitem(oplist $matchitem(oplist $0 * 4))) msg $1 Current time: $strftime(%x %X) msg $1 Created : $strftime($word(1 $chaninfo) %x) $strftime($word(1 $chaninfo) %X) msg $1 Topic Lock : ${word(2 $chaninfo) ? [On] : [Off]} msg $1 Opguard : ${word(3 $chaninfo) ? [On] : [Off]} } on #-msg 2500 "% info %" if (CHANOPSERV_ON) { if (matchitem(chaninfo $2 *) > -1) { @:chaninfo = getitem(chaninfo $matchitem(chaninfo $2 *)) if (!match($2 $onchannels())) join $2 msg $0 Info for channel $2 msg $0 Owner : $word(1 $getitem(oplist $matchitem(oplist $2 * 4))) msg $0 Current time: $strftime(%x %X) msg $0 Created : $strftime($word(1 $chaninfo) %x) $strftime($word(1 $chaninfo) %X) msg $0 Topic Lock : ${word(2 $chaninfo) ? [On] : [Off]} msg $0 Opguard : ${word(3 $chaninfo) ? [On] : [Off]} if (numwords($chanusers($1)) == 1) mode $1 +P }{ msg $0 Channel not registered } } on #-403 3000 "% % !drop" if (CHANOPSERV_ON) { if (matchitem(chaninfo $chan *) > -1) { assign op $1 assign chan $0 whois -cmd { @:oplevel = 0 if (matchitem(oplist $chan $op *) > -1) @oplevel = word(2 $getitem(oplist $matchitem(oplist $chan $op *))) if (match($1 "Admin" "Elite")) @oplevel = 4 if (oplevel == 4) { @delitem(chaninfo $matchitem(chaninfo $chan *)) for (@:count = 0,count < numitems(oplist),@count++) { if (matchitem(oplist $chan *) > -1) @delitem(oplist $count) } ^raw 205 chanserv wallop $chan $op dropped channel $chan msg $op Channel $chan dropped }{ msg $op failed: requires access 4 } ^assign -op ^assign -chan } $op }{ msg $1 Channel not registered } } on #-msg 3500 "% drop %" if (CHANOPSERV_ON) { if (matchitem(chaninfo $chan *) > -1) { assign op $0 assign chan $2 whois -cmd { @:oplevel = 0 if (matchitem(oplist $chan $op *) > -1) @oplevel = word(2 $getitem(oplist $matchitem(oplist $chan $op *))) if (match($1 "Admin" "Elite")) @oplevel = 4 if (oplevel == 4) { @delitem(chaninfo $matchitem(chaninfo $chan *)) for (@:count = 0,count < numitems(oplist),@count++) { if (matchitem(oplist $chan *) > -1) @delitem(oplist $count) } ^raw 205 chanserv wallop $chan $op dropped channel $chan msg $op Channel $chan dropped }{ msg $op failed: requires access 4 } ^assign -op ^assign -chan } $op }{ msg $0 Channel not registered } } on #-403 4000 "% % !op" if (CHANOPSERV_ON && matchitem(chaninfo $0 *) > -1) { assign op $1 assign chan $0 whois -cmd { @:oplevel = 0 if (matchitem(oplist $chan $op *) > -1) @oplevel = word(2 $getitem(oplist $matchitem(oplist $chan $op *))) if (match($1 "Moderator") && oplevel < 2) @oplevel = 2 if (match($1 "Admin" "Elite")) @oplevel = 4 if (oplevel >= 2) { op $chan $op }{ msg $op failed: requires access 2 or better } ^assign -op ^assign -chan } $op } on #-msg 4500 "% op %" if (CHANOPSERV_ON) { if (matchitem(chaninfo $chan *) > -1) { assign op $0 assign chan $2 whois -cmd { @:oplevel = 0 if (matchitem(oplist $chan $op *) > -1) @oplevel = word(2 $getitem(oplist $matchitem(oplist $chan $op *))) if (match($1 "Moderator") && oplevel < 2) @oplevel = 2 if (match($1 "Admin" "Elite")) @oplevel = 4 if (oplevel >= 2) { if (!match($chan $onchannels())) join $chan op $chan $op if (numwords($chanusers($chan)) == 1) mode $chan +P }{ msg $op failed: requires access 2 or better } ^assign -op ^assign -chan } $op }{ msg $0 Channel not registered } } on #-403 5000 "% % !user % %" if (CHANOPSERV_ON && matchitem(chaninfo $0 *) > -1) { if (!match($4 -2 -1 1 2 3 4)) { msg $1 Access must be either -2, -1, 1, 2, 3 or 4 }{ assign op $1 assign chan $0 assign user $3 assign level $4 setop $op $chan $user $level } } on #-msg 5500 "% user % % %" if (CHANOPSERV_ON) { if (matchitem(chaninfo $2 *) > -1) { if (!match($4 -2 -1 1 2 3 4)) { msg $0 Access must be either -2, -1, 1, 2, 3 or 4 }{ assign op $0 assign chan $2 assign user $3 assign level $4 setop $op $chan $user $level } }{ msg $0 Channel not registered } } on #-403 6000 "% % !del *" if (CHANOPSERV_ON && matchitem(chaninfo $0 *) > -1) { assign op $1 assign chan $0 assign user $3- while (right(1 $user) == [ ]) assign user $left(${@user-1} $user) delop $op $chan $user } on #-msg 6500 "% del % *" if (CHANOPSERV_ON) { if (matchitem(chaninfo $2 *) > -1) { assign op $0 assign chan $2 assign user $3- while (right(1 $user) == [ ]) assign user $left(${@user-1} $user) delop $op $chan $user }{ msg $0 Channel not registered } } on #-403 7000 "% % !list" if (CHANOPSERV_ON && matchitem(chaninfo $0 *) > -1) { assign op $1 assign chan $0 whois -cmd { @:oplevel = 0 if (matchitem(oplist $chan $op *) > -1) @oplevel = word(2 $getitem(oplist $matchitem(oplist $chan $op *))) if (match($1 "Moderator") && oplevel < 2) @oplevel = 2 if (match($1 "Admin" "Elite")) @oplevel = 4 if (oplevel >= 2) { msg $op Access list for channel $chan for (@:count = 0,count < numitems(oplist),@count++) { @:opinfo = getitem(oplist $count) if (match($chan* $opinfo)) msg $op $restw(1 $opinfo) } }{ msg $op failed: requires access 2 or better } ^assign -op ^assign -chan } $op } on #-403 8000 "% % !list %" if (CHANOPSERV_ON && matchitem(chaninfo $0 *) > -1) { if (!match($3 -2 -1 1 2 3 4)) { msg $1 Access must be either -2, -1, 1, 2, 3 or 4 }{ assign op $1 assign chan $0 assign level $3 whois -cmd { @:oplevel = 0 if (matchitem(oplist $chan $op *) > -1) @oplevel = word(2 $getitem(oplist $matchitem(oplist $chan $op *))) if (match($1 "Moderator") && oplevel < 2) @oplevel = 2 if (match($1 "Admin" "Elite")) @oplevel = 4 if (oplevel >= 2) { msg $op Access list for channel $chan fe ($get_ops($chan $level)) each_op { msg $op $each_op $level } }{ msg $op failed: requires access 2 or better } ^assign -op ^assign -chan ^assign -level } $op } } on #-msg 7500 "% list %" if (CHANOPSERV_ON) { if (matchitem(chaninfo $2 *) > -1) { assign op $0 assign chan $2 whois -cmd { @:oplevel = 0 if (matchitem(oplist $chan $op *) > -1) @oplevel = word(2 $getitem(oplist $matchitem(oplist $chan $op *))) if (match($1 "Moderator") && oplevel < 2) @oplevel = 2 if (match($1 "Admin" "Elite")) @oplevel = 4 if (oplevel >= 2) { if (!match($chan $onchannels())) join $chan msg $op Access list for channel $chan for (@:count = 0,count < numitems(oplist),@count++) { @:opinfo = getitem(oplist $count) if (match($chan* $opinfo)) msg $op $restw(1 $opinfo) } if (numwords($chanusers($chan)) == 1) mode $chan +P }{ msg $op failed: requires access 2 or better } ^assign -op ^assign -chan ^assign -level } $op }{ msg $0 Channel not registered } } on #-msg 8500 "% list % %" if (CHANOPSERV_ON) { if (matchitem(chaninfo $2 *) > -1) { if (!match($3 -2 -1 1 2 3 4)) { msg $0 Access must be either -2, -1, 1, 2, 3 or 4 }{ assign op $0 assign chan $2 assign level $3 whois -cmd { @:oplevel = 0 if (matchitem(oplist $chan $op *) > -1) @oplevel = word(2 $getitem(oplist $matchitem(oplist $chan $op *))) if (match($1 "Moderator") && oplevel < 2) @oplevel = 2 if (match($1 "Admin" "Elite")) @oplevel = 4 if (oplevel >= 2) { if (!match($chan $onchannels())) join $chan msg $op Access list for channel $chan fe ($get_ops($chan $level)) each_op { msg $op $each_op $level } if (numwords($chanusers($chan)) == 1) mode $chan +P }{ msg $op failed: requires access 2 or better } ^assign -op ^assign -chan ^assign -level } $op } }{ msg $0 Channel not registered } } on #-403 9000 "% % !access" if (CHANOPSERV_ON && matchitem(chaninfo $0 *) > -1) { if (matchitem(oplist $0 $1 *) > -1) { @:level = word(2 $getitem(oplist $matchitem(oplist $0 $1 *))) msg $1 You have access $level on channel $0 }{ msg $1 You have no special access on channel $0 } } on #-403 10000 "% % !access *" if (CHANOPSERV_ON && matchitem(chaninfo $0 *) > -1) { assign op $1 assign chan $0 assign user $3- while (right(1 $user) == [ ]) assign user $left(${@user-1} $user) whois -cmd { @:oplevel = 0 if (matchitem(oplist $chan $op *) > -1) @:oplevel = word(2 $getitem(oplist $matchitem(oplist $chan $op *))) if (match($1 "Moderator") && oplevel < 2) @oplevel = 2 if (match($1 "Admin" "Elite")) @oplevel = 4 if (oplevel >= 2) { if (matchitem(oplist $chan $user *) > -1) { msg $op User $user has access $word(2 $getitem(oplist $matchitem(oplist $chan $user *))) on channel $chan }{ msg $op User $user has no special access on channel $chan } }{ msg $op failed: requires access 2 or better } ^assign -op ^assign -chan ^assign -user } $op } on #-msg 9500 "% access %" if (CHANOPSERV_ON) { if (matchitem(chaninfo $2 *) > -1) { if (!match($2 $onchannels())) join $2 if (matchitem(oplist $2 $0 *) > -1) { @:level = word(2 $getitem(oplist $matchitem(oplist $2 $0 *))) msg $0 You have access $level on channel $2 }{ msg $0 You have no special access on channel $2 } if (numwords($chanusers($2)) == 1) mode $2 +P }{ msg $0 Channel not registered } } on #-msg 10500 "% access % *" if (CHANOPSERV_ON) { if (matchitem(chaninfo $2 *) > -1) { assign op $0 assign chan $2 assign user $3- while (right(1 $user) == [ ]) assign user $left(${@user-1} $user) whois -cmd { @:oplevel = 0 if (matchitem(oplist $chan $op *) > -1) @:oplevel = word(2 $getitem(oplist $matchitem(oplist $chan $op *))) if (match($1 "Moderator") && oplevel < 2) @oplevel = 2 if (match($1 "Admin" "Elite")) @oplevel = 4 if (oplevel >= 2) { if (!match($chan $onchannels())) join $chan if (matchitem(oplist $chan $user *) > -1) { msg $op User $user has access $word(2 $getitem(oplist $matchitem(oplist $chan $user *))) on channel $chan }{ msg $op User $user has no special access on channel $chan } if (numwords($chanusers($chan)) == 1) mode $chan +P }{ msg $op failed: requires access 2 or better } ^assign -op ^assign -chan ^assign -user } $op }{ msg $0 Channel not registered } } on #-403 11000 "% % !topiclock %" if (CHANOPSERV_ON && matchitem(chaninfo $0 *) > -1) { if (match($3 on off)) { assign op $1 assign chan $0 assign toggle $3 whois -cmd { @:oplevel = 0 if (matchitem(oplist $chan $op *) > -1) @:oplevel = word(2 $getitem(oplist $matchitem(oplist $chan $op *))) if (match($1 "Moderator") && oplevel < 2) @oplevel = 2 if (match($1 "Admin" "Elite")) @oplevel = 4 if (oplevel > 2) { ^assign chaninfo $getitem(chaninfo $matchitem(chaninfo $chan *)) switch ($toggle) { (on) { if (word(2 $chaninfo)) { msg $op Topic lock for channel $chan already on }{ ^on ^410 "$chan *" { @:chaninfo = chngw(2 1 $getitem(chaninfo $matchitem(chaninfo $0 *))) @setitem(chaninfo $matchitem(chaninfo $0 *) $leftw(${#chaninfo - 1} $chaninfo) "$1-") on 410 -"$0 *" } ^raw 205 chanserv topic $C ^raw 205 chanserv wallop $chan $op set topic lock for channel $chan to on msg $op Topic lock for channel $chan set to on } } (off) { if (!word(2 $chaninfo)) { msg $op Topic lock for channel $chan already off }{ @setitem(chaninfo $matchitem(chaninfo $chan *) $chngw(2 0 $chaninfo)) ^raw 205 chanserv wallop $chan $op set topic lock for channel $chan to off msg $op Topic lock for channel $chan set to off } } } }{ msg $op failed: requires access 3 or better } ^assign -op ^assign -chan ^assign -toggle ^assign -chaninfo } $op }{ msg $1 failed: toggle must be either on or off } } on #-msg 11500 "% topiclock % %" if (CHANOPSERV_ON) { if (matchitem(chaninfo $2 *) > -1) { if (match($3 on off)) { assign op $0 assign chan $2 assign toggle $3 whois -cmd { @:oplevel = 0 if (matchitem(oplist $chan $op *) > -1) @:oplevel = word(2 $getitem(oplist $matchitem(oplist $chan $op *))) if (match($1 "Moderator") && oplevel < 2) @oplevel = 2 if (match($1 "Admin" "Elite")) @oplevel = 4 if (oplevel > 2) { ^assign chaninfo $getitem(chaninfo $matchitem(chaninfo $chan *)) if (!match($chan $onchannels())) join $chan if (numwords($chanusers($chan)) == 1) mode $chan +P switch ($toggle) { (on) { if (word(2 $chaninfo)) { msg $op Topic lock for channel $chan already on }{ ^on ^410 "$chan *" { @:chaninfo = chngw(2 1 $getitem(chaninfo $matchitem(chaninfo $0 *))) @setitem(chaninfo $matchitem(chaninfo $0 *) $leftw(${#chaninfo - 1} $chaninfo) "$1-") on 410 -"$0 *" } ^raw 205 chanserv topic $chan ^raw 205 chanserv wallop $chan $op set topic lock for channel $chan to on msg $op Topic lock for channel $chan set to on } } (off) { if (!word(2 $chaninfo)) { msg $op Topic lock for channel $chan already off }{ @setitem(chaninfo $matchitem(chaninfo $chan *) $chngw(2 0 $chaninfo)) ^raw 205 chanserv wallop $chan $op set topic lock for channel $chan to off msg $op Topic lock for channel $chan set to off } } } }{ msg $op failed: requires access 3 or better } ^assign -op ^assign -chan ^assign -toggle ^assign -chaninfo } $op }{ msg $0 failed: toggle must be either on or off } }{ msg $0 failed: channel not registered } } alias topiclock (channel) { return $word(2 $getitem(chaninfo $matchitem(chaninfo $channel *))) } on #-404 9520 "% set topic on *" if (CHANOPSERV_ON && matchitem(chaninfo $before(: $4) *) > -1) { if (topiclock($before(: $4)) && [$0] != [$N]) { assign op $0 assign chan $before(: $4) assign topic $5- whois -cmd { @:oplevel = 0 if (matchitem(oplist $chan $op *) > -1) @:oplevel = word(2 $getitem(oplist $matchitem(oplist $chan $op *))) if (match($1 "Moderator") && oplevel < 2) @oplevel = 2 if (match($1 "Admin" "Elite")) @oplevel = 4 if (oplevel < 3) { topic $chan $word(4 $getitem(chaninfo $matchitem(chaninfo $chan *))) }{ @:chaninfo = getitem(chaninfo $matchitem(chaninfo $chan *)) @setitem(chaninfo $matchitem(chaninfo $chan *) $leftw(${#chaninfo - 1} $chaninfo) "$topic") } ^assign -op ^assign -chan ^assign -topic } $op } } on #-403 11000 "% % !opguard %" if (CHANOPSERV_ON && matchitem(chaninfo $0 *) > -1) { if (match($3 on off)) { assign op $1 assign chan $0 assign toggle $3 whois -cmd { @:oplevel = 0 if (matchitem(oplist $chan $op *) > -1) @:oplevel = word(2 $getitem(oplist $matchitem(oplist $chan $op *))) if (match($1 "Moderator") && oplevel < 2) @oplevel = 2 if (match($1 "Admin" "Elite")) @oplevel = 4 if (oplevel > 2) { ^assign chaninfo $getitem(chaninfo $matchitem(chaninfo $chan *)) switch ($toggle) { (on) { if (word(3 $chaninfo)) { msg $op Opguard for channel $chan already on }{ @setitem(chaninfo $matchitem(chaninfo $chan *) $chngw(3 1 $chaninfo)) ^raw 205 chanserv wallop $chan $op set opguard for channel $chan to on msg $op Opguard for channel $chan set to on } } (off) { if (!word(3 $chaninfo)) { msg $op Opguard for channel $chan already off }{ @setitem(chaninfo $matchitem(chaninfo $chan *) $chngw(3 0 $chaninfo)) ^raw 205 chanserv wallop $chan $op set opguard for channel $chan to off msg $op Opguard for channel $chan set to off } } } }{ msg $op failed: requires access 3 or better } ^assign -op ^assign -chan ^assign -toggle ^assign -chaninfo } $op }{ msg $1 failed: toggle must be either on or off } } on #-msg 12500 "% opguard % %" if (CHANOPSERV_ON) { if (matchitem(chaninfo $2 *) > -1) { if (match($3 on off)) { assign op $0 assign chan $2 assign toggle $3 whois -cmd { @:oplevel = 0 if (matchitem(oplist $chan $op *) > -1) @:oplevel = word(2 $getitem(oplist $matchitem(oplist $chan $op *))) if (match($1 "Moderator") && oplevel < 2) @oplevel = 2 if (match($1 "Admin" "Elite")) @oplevel = 4 if (oplevel > 2) { ^assign chaninfo $getitem(chaninfo $matchitem(chaninfo $chan *)) if (!match($chan $onchannels())) join $chan if (numwords($chanusers($chan)) == 1) mode $chan +P switch ($toggle) { (on) { if (word(3 $chaninfo)) { msg $op Opguard for channel $chan already on }{ @setitem(chaninfo $matchitem(chaninfo $chan *) $chngw(3 1 $chaninfo)) ^raw 205 chanserv wallop $chan $op set opguard for channel $chan to on msg $op opguard for channel $chan set to on } } (off) { if (!word(3 $chaninfo)) { msg $op Opguard for channel $chan already off }{ @setitem(chaninfo $matchitem(chaninfo $chan *) $chngw(3 0 $chaninfo)) ^raw 205 chanserv wallop $chan $op set opguard for channel $chan to off msg $op Opguard for channel $chan set to off } } } }{ msg $op failed: requires access 3 or better } ^assign -op ^assign -chan ^assign -toggle ^assign -chaninfo } $op }{ msg $0 failed: toggle must be either on or off } }{ msg $0 failed: channel not registered } } alias opguard (channel) { return $word(3 $getitem(chaninfo $matchitem(chaninfo $channel *))) } on #-404 3290 "% opped % on channel %" if (CHANOPSERV_ON && matchitem(chaninfo $5 *) > -1) { if (opguard($5) && [$0] != [$N]) { assign user $2 assign chan $5 @:level = 0 if (matchitem(oplist $chan $user *) > -1) @:level = word(2 $getitem(oplist $matchitem(oplist $chan $user *))) if (level < 2) deop $chan $user ^assign -user ^assign -chan } } on #-join 9824 "*" if (CHANOPSERV_ON) { if (matchitem(chaninfo $0 *) > -1) { if (numwords($chanusers($chan)) > 1) mode $0 -P if (matchitem(oplist $0 $1 *) > -1) { switch ($word(2 $getitem(oplist $matchitem(oplist $0 $1 *)))) { (-2) { kick $0 $1 auto-kick;cban $0 $1 auto-ban } (-1) { cmuzzle $0 $1 auto-muzzle } (1) { voice $0 $1 } (2) (3) (4) { op $0 $1 } } } } } on #-leave 2486 "*" { if (matchitem(chaninfo $0 *) > -1) { if (numwords($chanusers($0)) == 1) mode $0 +P } } on ^msg "% help" { ^raw 205 $0 help chan - help about channel management ^raw 205 $0 help note - help about notes ^raw 205 $0 Chanopserv and Noteserv scripts by gircobain } on ^msg "% help chan" { ^raw 205 $0 Available Chanopserv commands: ^raw 205 $0 info - shows info about channel ^raw 205 $0 register - adds channel to the list of registered channels ^raw 205 $0 drop - removes channel from the list of registered channels ^raw 205 $0 user - adds user to channel access list with access ^raw 205 $0 op - requests for ops in channel ^raw 205 $0 list [] - lists ops in channel with access ^raw 205 $0 - if is omitted, lists all ops ^raw 205 $0 access [] - shows access in channel for user ^raw 205 $0 - if is omitted, shows own access ^raw 205 $0 topiclock - toggles topic lock for channel between on/off ^raw 205 $0 opguard - toggles opguard for channel between on/off ^raw 205 $0 Additionally, these commands can be sent as public to the channel ^raw 205 $0 they apply when preceded by !\; in this case, must be omitted ^raw 205 $0 Chanopserv script by gircobain } alias chanopserv (toggle) { switch ($toggle) { (on) { if (CHANOPSERV_ON) { xecho -b Chanop server already on }{ xecho -b Chanop server is now on @CHANOPSERV_ON = 1 ^raw 205 operserv usermode -ERROR -BAN -CHANGE -KILL -LEVEL -SERVER -MUZZLE -PORT -CLOAK -FLOOD -PING -WHOIS whois -cmd { if ([$4] != ["Cloaked"]) ^raw 652 } $N ^on ^618 "*" { if (matchitem(chaninfo $0 *) > -1) { join $0 if ([$1] == 0) mode $0 +P } ^on ^617 "*" { on 618 -"*" on 617 -"*" } } ^raw 617 read_oplist timer -ref SAVEOPS -rep -1 $DUMP_INT { save_oplist } ^on pong "*" {} } } (off) { if (!CHANOPSERV_ON) { xecho -b Chanop server already off }{ xecho -b Chanop server is now off @CHANOPSERV_ON = 0 save_oplist timer -del SAVEOPS fe ($onchannels()) chan { if (numwords($chanusers($chan)) == 1) mode $chan -P leave $chan } ^raw 205 operserv usermode operserv all } } (*) { xecho -b Chanop server is currently ${CHANOPSERV_ON ? [on] : [off]} xecho -b Usage: /chanopserv [ON | OFF] } } }