Peace & Protection 4.00 — File Browser
PeaceProtection4.00v4.0 / PeaceProtection4.00v4.0 / ADDONS / CHANSERV.MRC
CHANSERV.MRC — 19.81 KB — Download this file
; #= ppcsbot -rs
; ########################################
; Peace & Protection
; ChanServ support (standard addon)
; ########################################
;;; todo- users, akicks, config
;;; auto clear clears one net- no way to clear all nets, clear while offline pointless
; /csa [#chan] [0|1|2|3|no|aop|sop|founder]
; view or set cs access
alias csa {
if ($server == $null) _error /csa must be used while connected to a network.Connect to the appropriate server and try again.
if ($_isserv(cs) == $false) _error /csa only works on networks with ChanServ.If there is ChanServ on this network, type /cs on
if ($_ischan($1)) { var %chan = $1,%how = $2 }
elseif ($active ischan) { var %chan = $active,%how = $1 }
else _error No channel specified!You must use /csa in a channel or specify a channel.
if (%how == $null) {
%how = $readini -n $_cfg(pw.ini) cs- [ $+ [ %!net ] ] a [ $+ [ %chan ] ]
if (%how !isnum 0-3) %how = 0
}
else {
if (%how !isnum 0-3) {
if ($pos(asf,$left(%how,1),1) isnum) %how = $ifmatch
else %how = 0
}
if (%how) writeini $_cfg(pw.ini) cs- $+ %!net a $+ %chan %how
else remini $_cfg(pw.ini) cs- $+ %!net a $+ %chan
}
dispa You have set yourself as $:s($gettok(no access.AOP.SOP.Founder,$calc(%how + 1),46)) on $:s(%chan)
}
; /cs command [#chan|?] [params]
; not mentioned but work- help, drop, acc(ess), acc(ess) nick, info, invite, mkick, mdeop, unban me, unban all, count
alias cs {
if ($1 == on) {
var %net = $2
if ($2 == $null) %net = %!net
if (%net == offline) _error Use /cs on while connected.Or, use "/cs on network".
set %.net %net
var %opt = $$dialog(csway,csway,-4)
if (($server) && (%net == %!net)) {
%!serv = $addtok(%!serv,cs,44)
%!servnick = $addtok(%!servnick,ChanServ,32)
%!servopt = %!servopt $+ %opt
}
writeini $_cfg(pw.ini) csforce %net 1 %opt
dispa ChanServ support enabled for $:s(%net) $+ .
return
}
if ($1 == off) {
var %net = $2
if ($2 == $null) %net = %!net
if (%net == offline) _error Use /cs off while connected.Or, use "/cs off network".
if (($server) && (%net == %!net)) {
%!serv = $remtok(%!serv,cs,44)
%!servnick = $remtok(%!servnick,ChanServ,32)
%!servopt = $remove(%!servopt,!,\)
}
remini $_cfg(pw.ini) csforce %net
dispa ChanServ support disabled for $:s(%net) $+ .
return
}
if (($_isserv(cs) == $false) && (($1 != auto) || ($istok(view clear,$2,32) == $false))) {
if ($server) _error /cs only works on networks with ChanServ.If there is ChanServ on this network, type /cs on
_error /cs must be used while connected to a network.Connect to the appropriate server and try again.
}
var %chan,%param,%send,%pw,%old,%nets,%net,%type,%who
if ($1 == $null) _qhelp $_s2f(/cs +command -#channel -parameters * !ChanServ command to perform)
elseif ($_ischan($2)) { %chan = $2 | %param = $3- }
elseif (($istok(list help,$1,32)) || (($1 == auto) && ($istok(add del,$2,32) == $false))) %param = $2-
elseif ($active ischan) { %chan = $active | %param = $2- }
elseif ($2 == ?) { %chan = $_patch($_entry(-1,$null,Channel for,$1,command?)) | %param = $3- }
else _error No channel specified!You must use /cs in a channel or specify a channel.
if (($1 == set) && ($numtok(%param,32) == 1)) {
%send = msgcs SET %chan $upper(%param) | goto %param
:passwd
%pw = $$?*="New ChanServ founder password for %chan ?"
if ($$?*="Please retype password to confirm:" != %pw) _error Passwords do not match.
%send %pw
return
:founder | _okcancel 1 Transfer %chan founder to your nick? ( $+ $me $+ ) | %send | return
:desc | %send $_entry(0,$null,ChanServ description for,%chan,?(cannot be blank)) | return
:mlock | %param = $_entry(1,$chan(%chan).mode,Modes to lock on,%chan,?(blank for none)) | %send $iif(%param,%param,*) | return
:opguard | %send $_tf2o($_yesno(1,Disallow unknown users from being opped?)) | return
:keeptopic | %send $_tf2o($_yesno(1,Remember channel topic when channel is empty?)) | return
:url | %send $_entry(1,$null,ChanServ URL for,%chan,?(blank to clear)) | return
:ident | %send $_tf2o($_yesno(1,Require users to identify with NickServ to get ops?)) | return
:restrict | %send $_tf2o($_yesno(0,Only allow known ops to join,%chan,?)) | return
:topiclock | set %.fullmsg Who is allowed to change the topic? | set %.found Founder,SOPs,Any ops | %param = $$dialog(nickcomp,nickcomp,-4) | %send $gettok(FOUNDER SOP OFF,$findtok(Founder.SOPs.Any ops,%param,1,46),32) | return
:leaveops | %send $_tf2o($_yesno(0,Allow first person to join,%chan,to keep ops?)) | return
:unsecure | %send $_tf2o($_yesno(0,Allow founder commands without using founder password?)) | return
:private | %send $_tf2o($_yesno(0,Make,%chan,a private channel?)) | return
:memo | set %.fullmsg Who is allowed to send channel memos? | set %.found Founder,SOPs,AOPs,No one | %param = $$dialog(nickcomp,nickcomp,-4) | %send $gettok(FOUNDER SOP AOP NONE,$findtok(Founder.SOPs.AOPs.No one,%param,1,46),32) | return
:%param
}
elseif ($1 == auto) {
if ($gettok(%param,1,32) == add) {
if (%chan == $null) _error No channel specified.You must specify a channel to add an auto-login.
if ($gettok(%param,2,32)) %pw = $ifmatch
else {
%pw = $$?*="Password for auto-login to %chan $+ ? ( $+ %!net $+ )"
if ($$?*="Please retype password to confirm:" != %pw) _error Passwords do not match.
}
writeini $_cfg(pw.ini) cs- $+ %!net %chan $_pw.enc(%pw)
disp Auto-login to $:t(ChanServ) for $:s(%chan) added. (on %!net $+ )
%old = $readini -n $_cfg(pw.ini) cs- [ $+ [ %!net ] ] all
writeini $_cfg(pw.ini) cs- [ $+ [ %!net ] ] all $addtok(%old,%chan,32)
%old = $readini -n $_cfg(pw.ini) cs nets
writeini $_cfg(pw.ini) cs nets $addtok(%old,%!net,32)
}
elseif ($gettok(%param,1,32) == del) {
if (%chan == $null) _error No channel specified.You must specify a channel to delete an auto-login.
%pw = $readini -n $_cfg(pw.ini) cs- [ $+ [ %!net ] ] %chan
if (%pw) {
%old = $readini -n $_cfg(pw.ini) cs- [ $+ [ %!net ] ] all
%old = $remtok(%old,%chan,1,32)
if (%old == $null) {
remini $_cfg(pw.ini) cs- [ $+ [ %!net ] ] all
%old = $readini -n $_cfg(pw.ini) cs nets
%old = $remtok(%old,%!net,1,32)
if (%old == $null) remini $_cfg(pw.ini) cs nets
else writeini $_cfg(pw.ini) cs nets %old
}
else writeini $_cfg(pw.ini) cs- [ $+ [ %!net ] ] all %old
remini $_cfg(pw.ini) cs- [ $+ [ %!net ] ] %chan
disp Auto-login for $:s(%chan) deleted. (on %!net $+ )
}
else disp No auto-login has been defined for $:s(%chan) $+ . (on %!net $+ )
}
elseif ($gettok(%param,1,32) == view) {
%nets = $readini -n $_cfg(pw.ini) cs nets
if (%nets == $null) disp No ChanServ auto-logins have been defined.
else {
_info /cs auto
dispr @Info ChanServ logins-
:vloop1
%net = $gettok(%nets,1,32)
%param = $readini -n $_cfg(pw.ini) cs- [ $+ [ %net ] ] all
:vloop2
%chan = $gettok(%param,1,32)
dispr @Info $:+ Login to $:t(ChanServ) on $:s(%chan) (on %net $+ )
%param = $gettok(%param,2-,32)
if (%param) goto vloop2
%nets = $gettok(%nets,2-,32)
if (%nets) goto vloop1
}
}
elseif ($gettok(%param,1,32) == clear) {
remini $_cfg(pw.ini) cs- [ $+ [ %!net ] ]
%old = $readini -n $_cfg(pw.ini) cs nets
%old = $remtok(%old,%!net,1,32)
if (%old == $null) remini $_cfg(pw.ini) cs nets
else writeini $_cfg(pw.ini) cs nets %old
disp All ChanServ auto-logins have been deleted. (on %!net $+ )
}
else {
if (%chan) {
%pw = $readini -n $_cfg(pw.ini) cs- [ $+ [ %!net ] ] %chan
if (%pw) { .msgcs IDENTIFY %chan $_pw.enc(%pw) | disprs %chan $:c(%chan) Logging into $:t(ChanServ) }
else _error No ChanServ login defined for %chan $+ .You can add an auto-login through popups.
}
else {
%param = $readini -n $_cfg(pw.ini) cs- [ $+ [ %!net ] ] all
if (%param == $null) _error No ChanServ logins have been defined!You can add auto-logins through popups.
:aloop
%chan = $gettok(%param,1,32)
%pw = $readini -n $_cfg(pw.ini) cs- [ $+ [ %!net ] ] %chan
.msgcs IDENTIFY %chan $_pw.enc(%pw)
disprs %chan $:c(%chan) Logging into $:t(ChanServ)
%param = $gettok(%param,2-,32)
if (%param) goto aloop
}
}
}
elseif ($1 == users) { _error not done yet... }
elseif ($1 == akicks) { _error not done yet... }
elseif ($1 == config) { _error not done yet... }
elseif (($numtok(%param,32) <= 1) && ($istok(sop aop akick op deop,$1,32))) {
goto $1
:sop | :aop | %type = $upper($1) | goto ask
:akick | %type = AutoKick | goto ask
:ask
if ($findtok(Add Del List Wipe Clean,%param,1,32)) {
%send = msgcs $upper($1) %chan %param
goto $gettok(%param,1,32)
}
editbox -ap /cs $1 %chan
dispa Specify one of the following actions:
if ($1 == akick) {
dispa - $:l(Add Del List Wipe)
dispa Or, use /cs akicks to view/edit AutoKicks interactively.
}
else {
dispa - $:l(Add Del List Wipe Clean)
dispa Or, use /cs users to view/edit users interactively.
}
return
:add | %send $_entry(-1,$null,Nickname (or mask) to add as an,%type,?) | return
:del | %send $_entry(-1,$null,Nickname (or mask) of,%type,to delete?) | return
:list | %send $_entry(1,$null,Show,%type,entries matching what mask?Enter to list all entries) | return
:wipe | _okcancel 1 Delete ALL %type entries on %chan $+ ? | %send | return
:clean | %send | return
:op | :deop
if (%param) %who = $_nccs(32,%chan,$_c2s(%param))
else %who = $_c2s($_entry(0,$null,User(s) to,$2?(You may specify multiple users)))
msgcs $upper($1) %chan %who
}
elseif ($istok(list help,$1,32)) msgcs $upper($1) %param
elseif (%param) msgcs $upper($1) %chan %param
elseif ($istok(register identify unban why set drop,$1,32)) {
%send = msgcs $upper($1) %chan | goto $1
:drop | _okcancel 0 Drop ChanServ registration for %chan $+ ? | %send | return
:register | return $dialog(csregister,csregister,-4)
:identify | %send $$?*="Enter founder password:" | return
:why | %send $_entry(-1,$null,Find out why someone is opped- Enter nickname:) | return
:unban
editbox -ap /cs $1 %chan
dispa Specify one of the following actions:
dispa - $:t(ME) to unban yourself
dispa - $:t(ALL) to unban all bans
return
:set
editbox -ap /cs $1 %chan
dispa Specify one of the following settings:
dispa - $:l(Founder Passwd MLock Private Memo)
dispa - $:l(LeaveOps Unsecure Restrict OpGuard Ident)
dispa - $:l(Desc URL KeepTopic TopicLock)
dispa Or, use /cs config to edit settings interactively.
}
else msgcs $upper($1) %chan
}
; /msgcs full command
alias msgcs {
if (! isin %!servopt) {
var %bits = $numtok($server,46)
%bits = $calc(%bits - 1) $+ - $+ %bits
_linedance .raw privmsg ChanServ@services. $+ $gettok($server,%bits,46) : $+ $1-
}
elseif (\ isin %!servopt) _linedance .raw chanserv $1-
else _linedance .raw privmsg ChanServ : $+ $1-
if (($1 == register) || (($1 == set) && ($3 == passwd)) || ($1 == identify)) {
if ($1 == set) {
dispr $iif($2,$2,-ai2) Using $:t(ChanServ) for command: $:h($1-3,?????)
var %pw = $readini -n $_cfg(pw.ini) cs- [ $+ [ %!net ] ] $2
if (%pw) writeini $_cfg(pw.ini) cs- [ $+ [ %!net ] ] $2 $_pw.enc($4)
}
else {
dispr $iif($2,$2,-ai2) Using $:t(ChanServ) for command: $:h($puttok($1-,?????,3,32))
if (($1 == identify) || ($1 == register)) %-csacc. [ $+ [ $2 ] ] = fop
}
}
else {
if ($1 == drop) unset %-csacc. $+ $2
dispr $iif($2,$2,-ai2) Using $:t(ChanServ) for command: $:h($1-)
}
}
alias _cs.splice {
if ($1 == ?) {
if ($_isserv(%!serv,cs) == $false) return 0
if ($istok(voice devoice mode kick unban topic,$3,32)) return 0
if (%-csacc. [ $+ [ $2 ] ] ) return 1
var %access = $readini -n $_cfg(pw.ini) cs- [ $+ [ %!net ] ] a [ $+ [ $2 ] ]
if ((%access > 1) || ((%access == 1) && ($3 != ban))) return 1
return 0
}
goto $3
:op | :opme | cs op $2 $4- | return
:deop | cs deop $2 $4- | return
:ban | cs akick $2 add $4
}
dialog csregister {
title "Register channel with ChanServ"
size -1 -1 340 275
box "", 1, 5 8 330 60
edit "", 3, 15 31 310 22, autohs
box "Password:", 21, 5 75 330 105
text "You must enter a password for founder access. (enter it twice to confirm the password.)", 20, 20 95 300 30
text "&Password:", 8, 10 130 78 16, right
edit "", 9, 90 127 122 22, pass autohs
text "&Confirm:", 10, 10 153 78 16, right
edit "", 11, 90 150 122 22, pass autohs
box "Auto-login:", 12, 5 187 330 45
check "&Have P&&P auto-login as founder when you connect", 13, 30 206 300 16
button "OK", 101, 30 242 120 25, OK default
button "Cancel", 102, 185 242 120 25, cancel
edit %chan, 201, 1 1 1 1, hide autohs
}
on *:DIALOG:csregister:init:*:{
did -c $dname 13
did -a $dname 1 $did(201) description:
}
on *:DIALOG:csregister:sclick:101:{
if ($did(3) == $null) _error You must specify a descriptionChannels cannot be registered with no description.
if ($did(9) == $null) _error You must specify a passwordYou need a password to register the channel.
if ($did(9) != $did(11)) _error Passwords do now match.Please re-enter the password, exactly the same both times.
msgcs REGISTER $did(201) $did(9) $did(3)
if ($did(13).state) cs auto $did(201) add $did(9)
}
alias _cs.connect {
if ($readini -n $_cfg(pw.ini) csforce %!net) {
%!servopt = %!servopt $+ $gettok($ifmatch,2,32)
%!serv = $addtok(%!serv,cs,44)
%!servnick = $addtok(%!servnick,ChanServ,32)
}
if ($_isserv(cs)) .cs auto
}
alias -l cspop {
if ($_isserv(cs) == $false) unset %.cspop
else {
set -u %.cspop ChanServ
set -u %.csfounder $iif($readini -n $_cfg(pw.ini) cs- [ $+ [ %!net ] ] $active,1,0)
set -u %.csaccess $readini -n $_cfg(pw.ini) cs- [ $+ [ %!net ] ] a [ $+ [ $active ] ]
if (%.csaccess isnum 1-2) unset %.csfounder
}
}
menu channel {
-
$cspop:{ }
%.cspop
.$iif(%.csaccess < 1,Info):cs info
.-
.$iif(%.csfounder,Founder)
..Manual login...:cs identify
..Change password...:cs set passwd
..-
..Transfer founder...:cs set founder
..Drop channel...:cs drop
..-
..Perform auto-login:cs auto #
..Remove $replace($active,&,&&) auto-login...:_okcancel 1 Delete auto-login? | cs auto del
..-
..View all auto-logins:cs auto view
..Clear all auto-logins...:_okcancel 1 Delete ALL ChanServ auto-logins? | cs auto clear
.$iif(%.csfounder == 0,Founder)
..Register channel...:cs register
..Drop channel...:cs drop
..-
..Identify as Founder...:cs identify
..Change password...:cs set passwd
..-
..Add $replace($active,&,&&) auto-login...:cs auto add
..-
..View all auto-logins...:cs auto view
..Clear all auto-logins...:_okcancel 1 Delete ALL ChanServ auto-logins? | cs auto clear
.$iif(%.csaccess,Info)
..Your access:cs access
..Channel info:cs info
..Count of ops:cs count
.-
.$iif(%.csaccess,AOPs)
..$iif(%.csaccess > 1,Add..):cs aop add
..$iif(%.csaccess > 1,Remove...):cs aop del
..List..:cs aop list
..-
..$iif(%.csaccess > 2,Clean):cs aop clean
..$iif(%.csaccess > 2,Remove ALL...):cs aop wipe
.$iif(%.csaccess,SOPs)
..$iif(%.csaccess > 2,Add...):cs sop add
..$iif(%.csaccess > 2,Remove...):cs sop del
..List..:cs sop list
..-
..$iif(%.csaccess > 2,Clean):cs sop clean
..$iif(%.csaccess > 2,Remove ALL...):cs sop wipe
.$iif(%.csaccess > 1,Edit list):cs users
.$iif(%.csaccess == 1,View list):cs users
.-
.$iif(%.csaccess,AKicks)
..$iif(%.csaccess > 1,Edit list):cs akicks
..-
..$iif(%.csaccess > 1,Add..):cs akick add
..$iif(%.csaccess > 1,Remove...):cs akick del
..List..:cs akick list
..-
..$iif(%.csaccess > 2,Remove ALL...):cs akick wipe
.$iif(%.csaccess,Mass)
..Mass deop [A]:cs mdeop
..Mass kick [A]:cs mkick
..$iif(%.csaccess > 1,Unban all):cs unban all
.-
.$iif(%.csaccess > 2,Set)
..Description...:cs set desc
..URL...:cs set url
..Keep topic...:cs set keeptopic
..Topic lock...:cs set topiclock
..-
..Memo...:cs set memo
..Mode lock...:cs set mlock
..Private...:cs set private
..-
..Leave ops...:cs set leaveops
..Unsecure...:cs set unsecure
..Restrict...:cs set restrict
..Op guard...:cs set opguard
..Ident...:cs set ident
.$iif(%.csaccess > 2,Config...):cs config
.-
.My access
..$_dynpopn(%.csaccess) I have no access in #:csa # 0
..-
..$_dynpop($iif(%.csaccess == 1,1)) I am an AOP:csa # 1
..$_dynpop($iif(%.csaccess == 2,1)) I am a SOP:csa # 2
..$_dynpop($iif(%.csaccess == 3,1)) I am the Founder:csa # 3
}
alias -l cspop2 {
if ($_isserv(cs) == $false) unset %.cspop
else {
set -u %.csaccess $readini -n $_cfg(pw.ini) cs- [ $+ [ %!net ] ] a [ $+ [ $active ] ]
if (%.csaccess) set -u %.cspop ChanServ
}
}
menu nicklist {
-
$cspop2:{ }
%.cspop
.Op:cs op $$snicks
.Deop:cs deop $$snicks
.-
.$iif(%.csaccess > 1,AutoKick)
..$snick(#,1):cs akick add $$1
..-
..%.ban2:cs akick add $_ppmask($$1,0,3,2)
..%.ban3:cs akick add $_ppmask($$1,0,3,4)
..%.ban4:cs akick add $_ppmask($$1,0,3,3)
..%.ban5:cs akick add $_ppmask($$1,0,3,6)
..-
..%.banS:cs akick add $_ppmask($$1,$_stmask(2))
..%.banD:cs akick add $_ppmask($$1,$_stmask(4))
.-
.$iif(%.csaccess > 1,Add AOP)
..$snick(#,1):cs aop add $$1
..-
..%.ban2:cs aop add $_ppmask($$1,0,3,2)
..%.ban3:cs aop add $_ppmask($$1,0,3,4)
..%.ban4:cs aop add $_ppmask($$1,0,3,3)
..%.ban5:cs aop add $_ppmask($$1,0,3,6)
..-
..%.banS:cs aop add $_ppmask($$1,$_stmask(2))
..%.banD:cs aop add $_ppmask($$1,$_stmask(4))
.$iif(%.csaccess > 2,Add SOP)
..$snick(#,1):cs sop add $$1
..-
..%.ban2:cs sop add $_ppmask($$1,0,3,2)
..%.ban3:cs sop add $_ppmask($$1,0,3,4)
..%.ban4:cs sop add $_ppmask($$1,0,3,3)
..%.ban5:cs sop add $_ppmask($$1,0,3,6)
..-
..%.banS:cs sop add $_ppmask($$1,$_stmask(2))
..%.banD:cs sop add $_ppmask($$1,$_stmask(4))
.-
.$iif(%.csaccess > 1,Remove AOP)
..$snick(#,1):cs aop del $$1
..-
..%.ban2:cs aop del $_ppmask($$1,0,3,2)
..%.ban3:cs aop del $_ppmask($$1,0,3,4)
..%.ban4:cs aop del $_ppmask($$1,0,3,3)
..%.ban5:cs aop del $_ppmask($$1,0,3,6)
..-
..%.banS:cs aop del $_ppmask($$1,$_stmask(2))
..%.banD:cs aop del $_ppmask($$1,$_stmask(4))
.$iif(%.csaccess > 2,Remove SOP)
..$snick(#,1):cs sop del $$1
..-
..%.ban2:cs sop del $_ppmask($$1,0,3,2)
..%.ban3:cs sop del $_ppmask($$1,0,3,4)
..%.ban4:cs sop del $_ppmask($$1,0,3,3)
..%.ban5:cs sop del $_ppmask($$1,0,3,6)
..-
..%.banS:cs sop del $_ppmask($$1,$_stmask(2))
..%.banD:cs sop del $_ppmask($$1,$_stmask(4))
.-
.Access:cs access $$1
.Why opped:cs why $$1
}
;;; menu status { }
dialog csway {
title "ChanServ access setup"
size -1 -1 250 155
text "", 1, 10 10 180 40
radio "Use /msg ChanServ", 2, 20 45 230 22
radio "Use /chanserv", 3, 20 68 230 22
radio "Use /msg ChanServ@services.blah.net", 4, 20 91 230 22
edit "", 50, 1 1 1 1, autohs hide result
button "OK", 100, 10 122 80 25, ok default
button "Cancel", 101, 160 122 80 25, cancel
}
on *:DIALOG:csway:init:*:{
did -c $dname 2
did -o $dname 1 1 For %.net $+ , how should I access ChanServ?
unset %.net
}
on *:DIALOG:csway:sclick:100:did -o $dname 50 1 $iif($did(3).state,\,$iif($did(4).state,!))