Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #############################################################################
- ; # Options alias/menu #
- ; #############################################################################
- alias Startup_Manager {
- dialog $iif($dialog(Startup),-v,-m) Startup Startup
- }
- menu * {
- Startup Manager:/Startup_Manager
- }
- ; #############################################################################
- ; # Options dialog #
- ; #############################################################################
- dialog -l Startup {
- title "Auto Startup Manager"
- size -1 -1 275 240
- option dbu
- box "Networks", 1, 4 2 130 100
- list 2, 10 10 65 85, size
- button "Add", 3, 78 10 40 15
- button "Delete", 4, 78 30 40 15
- button "Move up", 5, 78 50 40 15
- button "Move down", 6, 78 70 40 15
- box "Channels", 7, 140 2 130 100
- list 8, 146 10 65 85, size
- button "Add", 9, 214 11 40 15
- button "Delete", 10, 214 30 40 15
- button "Move up", 11, 214 50 40 15
- button "Move down", 12, 214 70 40 15
- box "Network Information and Options", 13, 4 105 130 125
- text "Address:", 16, 8 112 42 8
- text "Port:", 17, 101 112 14 8
- edit "", 18, 8 120 86 10
- text ":", 19, 94 120 4 8, center
- edit "", 20, 97 120 19 10, limit 4
- text "Description:", 21, 8 132 30 8
- edit "", 22, 8 140 121 10, autohs
- text "Nick on this network:", 23, 8 155 53 8
- edit "", 24, 59 153 50 10
- check "Connect on startup", 25, 8 165 58 10
- button "Perform commands", 14, 70 165 60 10
- check "Enable Auto ID/Auth", 26, 8 176 63 10
- check "Enable auto ghost", 27, 72 176 54 10
- text "Auth Type:", 28, 6 190 30 8, right
- combo 29, 38 190 50 10, drop
- text "User name:", 30, 6 203 30 8, right
- edit "", 31, 38 202 50 10, autohs
- text Pasword:, 32, 6 214 30 8, right
- edit "", 33, 38 213 50 10, password autohs
- box "Channel Information and Options", 34, 140 105 130 117
- text "Description:", 35, 144 112 34 8
- edit "", 36, 144 120 121 10, autohs
- check "Message when you join (identifiers allowed)", 37, 144 133 115 10
- edit "", 38, 144 143 121 10, autohs
- check "Message when others join (identifiers allowed)", 43, 144 156 120 10
- edit "", 44, 144 166 121 10, autohs
- check "Join on connect", 45, 144 180 50 10
- text "Key:", 46, 195 181 10 10
- edit "", 47, 210 180 50 10, password autohs
- check "Identify to Chanserv", 39, 144 190 63 10
- text Pasword:, 40, 145 200 30 8, right
- edit "", 41, 176 200 50 10, password autohs
- check "Set +q (founder access)", 42, 152 210 71 10
- button "Close", 48, 229 224 40 15, ok
- }
- ; #############################################################################
- ; # Perform dialog #
- ; #############################################################################
- dialog -l Perform {
- title "Perfoms"
- size -1 -1 135 139
- option dbu
- box "", 2, 3 3 128 115
- box "Performs", 1, 3 3 128 25
- text "Enter any commands to be performed upon connecting. One command per line.", 3, 9 11 119 16, center
- text "Network:", 4, 8 32 23 8
- combo 5, 33 31 60 10, drop
- edit "", 6, 7 45 120 70, multi hsbar vsbar return
- button "Close", 7, 94 121 37 15, ok
- }
- ; #############################################################################
- ; # Dialog Initiation events #
- ; #############################################################################
- on *:dialog:Startup:init:*: {
- var %x = 1, %networks = $readini(Startup.ini,Config,networks), %total = $numtok(%networks,44)
- while (%x <= %total) {
- var %network = $gettok(%networks,%x,44)
- did -a $dname 2 %network
- inc %x
- }
- did -a $dname 29 Nickserv
- did -a $dname 29 Authserv
- did -a $dname 29 Quakenet (Q)
- did -a $dname 29 Undernet (X)
- did -a $dname 29 NetGamers (P)
- did -b $dname 9,10,11,12,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,47
- }
- on *:dialog:Perform:init:*: {
- var %Network = %Perform.Network | unset %Perform.Network
- var %networks = $readini(Startup.ini,config,networks)
- var %x = 1, %total = $numtok(%networks,44)
- while (%x <= %total) {
- var %net = $gettok(%networks,%x,44)
- if (%net == %Network) did -ac $dname 5 %net
- else did -a $dname 5 %net
- inc %x
- }
- LoadPerforms %network
- }
- ; #############################################################################
- ; # Dialog Sclick events #
- ; #############################################################################
- on *:dialog:Startup:sclick:*: {
- var %network = $did(2).seltext, %networks = $readini(Startup.ini,config,networks)
- var %channel = $did(8).seltext, %chans = $readini(Startup.ini,$replace(%network,$chr(32),-),channels)
- if ($did == 2) && ($did(2).sel) {
- did -e $dname 9,10,11,12,14,16,17,18,19,20,21,22,23,24,25,26,27
- LoadOptions network $did(2).seltext
- ClearChanOptions
- }
- elseif ($did == 3) {
- var %network = $$?="Enter the name of the network you wish to add $crlf $crlf $+ Note: This MUST be proper name of the network. If you are unsure of the proper name type //echo -a $ $+ network and copy the result."
- if ($istok(%networks,%network,44)) var %x = $input(%network has already been added,oh,Error)
- else {
- did -a $dname 2 %network
- writeini -n Startup.ini $replace(%network,$chr(32),-) name %network
- writeini -n Startup.ini $replace(%network,$chr(32),-) nick $me
- writeini -n Startup.ini $replace(%network,$chr(32),-) connect 1
- writeini -n Startup.ini $replace(%network,$chr(32),-) Authtype 1
- var %x = 1, %total = $scon(0)
- while (%x <= %total) {
- if ($scon(%x).network == %network) {
- writeini -n Startup.ini $replace(%network,$chr(32),-) nick $scon(%x).me
- writeini -n Startup.ini $replace(%network,$chr(32),-) address $scon(%x).server
- writeini -n Startup.ini $replace(%network,$chr(32),-) port $scon(%x).port
- }
- inc %x
- }
- var %x = $input(%network has been successfully added. $crlf $+ Edit the network information and options below. $crlf $+ Edit channel options for this server to the right,oi,Success)
- }
- ArrangeNetworks
- }
- elseif ($did == 4) {
- if ($did(2).sel) {
- if ($input(Would you also like to delete the settings saved for %network $+ ?,yq,Delete settings?)) {
- remini Startup.ini $replace(%network,$chr(32),-)
- }
- did -d $dname 2 $did(2).sel
- did -b $dname 9,10,11,12,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33
- did -r $dname 8,18,20,22,24,31,33
- did -u $dname 25,26,27
- did -c $dname 29 0
- }
- ArrangeNetworks
- }
- elseif ($did isnum 5-6) {
- var %pos = $did(2).sel, %newpos = $calc($did(2).sel $iif($did == 5,-,+) 1)
- if (%newpos == 0) || (%newpos > $did(2).lines) return
- else {
- did -d $dname 2 %pos
- did -i $dname 2 %newpos %network
- did -c $dname 2 %newpos
- }
- ArrangeNetworks
- }
- elseif ($did == 14) {
- set %Perform.network %network
- dialog $iif($dialog(Perform),-v,-m) Perform Perform
- }
- elseif ($did == 25) {
- writeini -n Startup.ini %network Connect $did(25).state
- }
- elseif ($did == 26) {
- writeini -n Startup.ini %network Auth $did(26).state
- if ($did(26).state == 1) {
- did -e $dname 28,29,32,33
- if ($did(29).sel > 1) did -e $dname 30,31
- else did -b $dname 30,31
- }
- elseif ($did(27).state == 0) did -b $dname 28,29,30,31,32,33
- }
- elseif ($did == 27) {
- writeini -n Startup.ini %network Ghost $did(27).state
- if ($did(27).state == 1) {
- did -e $dname 28,29,32,33
- if ($did(29).sel > 1) did -e $dname 30,31
- else did -b $dname 30,31
- }
- elseif ($did(26).state == 0) did -b $dname 28,29,30,31,32,33
- }
- elseif ($did == 29) {
- var %Authtype = $did(29).sel
- if (%Authtype == 1) { did -b $dname 30,31 | LoadOptions Channel %network %channel }
- else { did -e $dname 30,31 | did -b $dname 39,40,41,42 }
- if (%Authtype isnum 3-4) did -b $dname 27
- else did -e $dname 27
- writeini -n Startup.ini %network AuthType %Authtype
- }
- elseif ($did == 8) && ($did(8).sel) {
- did -e $dname 35,36,37,38,43,44,45,46,47
- LoadOptions Channel %network $did(8).seltext
- }
- elseif ($did == 9) {
- var %channel = $$?="Enter the name of the channel you wish to add"
- var %chans = $readini(Startup.ini,%network,channels)
- if ($istok(%chans,%channel,44)) var %x = $input(%channel has already been added,oh,Error)
- elseif ($istok(%chans,$+($chr(35),%channel),44)) var %x = $input($+($chr(35),%channel) has already been added,oh,Error)
- elseif ($numtok(%channel,32) > 1) var %x = $input(Channel names can not contain spaces,oh,Error)
- else {
- if ($left(%channel,1) != $chr(35)) var %channel = $+($chr(35),%channel)
- did -a $dname 8 %channel
- writeini -n Startup.ini $replace(%network,$chr(32),-) %channel NULL¦0¦NULL¦0¦NULL¦1¦0¦NULL¦0
- writeini -n Startup.ini $replace(%network,$chr(32),-) channels $addtok(%chans,%channel,44)
- }
- }
- elseif ($did == 10) {
- if ($did(8).sel) {
- if ($input(Would you also like to delete the settings saved for %channel $+ ?,yq,Delete settings?)) {
- remini Startup.ini $replace(%network,$chr(32),-) %channel
- }
- if ($did(8).lines == 1) remini Startup.ini $replace(%network,$chr(32),-) channels
- else writeini -n Startup.ini $replace(%network,$chr(32),-) channels $remtok(%chans,%channel,1,44)
- ClearChanOptions
- did -d $dname 8 $did(8).sel
- }
- }
- elseif ($did isnum 11-12) {
- var %pos = $did(8).sel, %newpos = $calc($did(8).sel $iif($did == 11,-,+) 1)
- if (%newpos == 0) || (%newpos > $did(8).lines) return
- else {
- did -d $dname 8 %pos
- did -i $dname 8 %newpos %channel
- did -c $dname 8 %newpos
- }
- ArrangeChans %network
- }
- elseif ($did == 39) {
- if ($did(39).state == 1) did -e $dname 40,41,42
- else did -b $dname 40,41,42
- SaveChanOptions %network %channel
- }
- elseif ($did == 37) {
- SaveChanOptions %network %channel
- if ($did(37).state == 1) did -e $dname 38
- else did -b $dname 38
- }
- elseif ($did == 43) {
- SaveChanOptions %network %channel
- if ($did(43).state == 1) did -e $dname 44
- else did -b $dname 44
- }
- elseif ($did == 42) || ($did == 45) {
- SaveChanOptions %network %channel
- }
- }
- on *:dialog:Perform:sclick:5: {
- LoadPerforms $did(5).seltext
- }
- ; #############################################################################
- ; # Dialog Edit events #
- ; #############################################################################
- on *:dialog:Startup:edit:*: {
- var %network = $did(2).seltext, %pos = $did(2).sel
- var %channel = $did(8).seltext
- if ($did($did)) {
- if ($did == 18) writeini -n Startup.ini %network Address $did(18)
- elseif ($did == 20) writeini -n Startup.ini %network Port $did(20)
- elseif ($did == 22) writeini -n Startup.ini %network Description $did(22)
- elseif ($did == 24) writeini -n Startup.ini %network Nick $did(24)
- elseif ($did == 31) writeini -n Startup.ini %network User $did(31)
- elseif ($did == 33) writeini -n Startup.ini %network Pass $ifencode($did(33),m)
- }
- else {
- if ($did == 18) remini Startup.ini %network Address
- elseif ($did == 20) remini Startup.ini %network Port
- elseif ($did == 22) remini Startup.ini %network Description
- elseif ($did == 24) remini Startup.ini %network Nick
- elseif ($did == 31) remini Startup.ini %network User
- elseif ($did == 33) remini Startup.ini %network Pass
- }
- if ($did == 36) || ($did == 38) || ($did == 41) || ($did == 44) || ($did == 47) {
- if ($chr(166) isin $did($did)) {
- did -ra $dname $did $remove($did($did),$chr(166))
- var %x = $input(Due to the character $+(',$chr(166),') being used as a data seperator it may not be used here,oh,Error)
- }
- SaveChanOptions %network %channel
- }
- }
- on *:dialog:Perform:edit:6: {
- var %network = $did(5).seltext
- var %x = 1, %total = $did(6).lines
- remini StartupPerform.ini %network
- while (%x <= %total) {
- if ($did(6,%x)) writeini -n StartupPerform.ini %network %x $did(6,%x)
- inc %x
- }
- }
- ; #############################################################################
- ; # Aliases #
- ; #############################################################################
- alias -l SaveChanOptions {
- var %dname = Startup, %network = $1, %channel = $2
- var %desc = $iif($did(%dname,36),$ifmatch,NULL)
- var %sendmsgme = $did(%dname,37).state
- var %joinmsgme = $iif($did(%dname,38),$ifmatch,NULL)
- var %sendmsgother = $did(%dname,43).state
- var %joinmsgother = $iif($did(%dname,44),$ifmatch,NULL)
- var %join = $did(%dname,45).state
- var %ID = $did(%dname,39).state
- var %Pass = $iif($did(%dname,41),$ifencode($ifmatch,m),NULL)
- var %Setq = $did(%dname,42).state
- var %key = $iif($did(%dname,47),$ifencode($ifmatch,m),NULL)
- var %s = $chr(166)
- var %data = $+(%desc,%s,%sendmsgme,%s,%joinmsgme,%s,%sendmsgother,%s,%joinmsgother,%s,%join,%s,%ID,%s,%pass,%s,%Setq,%s,%key)
- writeini Startup.ini %network %channel %data
- }
- alias -l ClearChanOptions {
- var %dname = Startup
- did -b %dname 35,36,37,38,39,40,41,42,43,44,45,46,47
- did -r %dname 36,38,41,44,47
- did -u %dname 37,39,42,43,45
- }
- alias -l LoadOptions {
- var %dname = Startup
- if ($1 == network) {
- var %network = $2
- did -r %dname 8
- if ($readini(Startup.ini,%network,channels)) {
- var %chans = $v1
- var %x = 1, %total = $numtok(%chans,44)
- while (%x <= %total) {
- var %chan = $gettok(%chans,%x,44)
- did -a %dname 8 %chan
- inc %x
- }
- }
- did -ra %dname 18 $readini(Startup.ini,%network,Address)
- did -ra %dname 20 $readini(Startup.ini,%network,Port)
- did -ra %dname 22 $readini(Startup.ini,%network,Description)
- did -ra %dname 24 $readini(Startup.ini,%network,Nick)
- if ($readini(Startup.ini,%network,Connect) == 1) did -c %dname 25 | else did -u %dname 25
- if ($readini(Startup.ini,%network,Auth) == 1) did -c %dname 26 | else did -u %dname 26
- if ($readini(Startup.ini,%network,Ghost) == 1) did -c %dname 27 | else did -u %dname 27
- did -c %dname 29 $readini(Startup.ini,%network,AuthType)
- did -ra %dname 31 $readini(Startup.ini,%network,User)
- did -ra %dname 33 $ifdecode($readini(Startup.ini,%network,Pass),m)
- if ($readini(Startup.ini,%network,Auth) == 1) || ($readini(Startup.ini,%network,Ghost) == 1) {
- did -e $dname 28,29,30,31,32,33
- if ($readini(Startup.ini,%network,Authtype == 1)) did -b $dname 31
- else did -e $dname 31
- }
- else did -b $dname 28,29,30,31,32,33
- }
- else {
- var %network = $2, %channel = $3
- if (!%network) || (!%channel) return
- var %data = $readini(Startup.ini,n,%network,%channel)
- tokenize 166 %data
- if ($1 != NULL) did -ra %dname 36 $1
- if ($2 == 1) { did -c %dname 37 | did -e %dname 38 }
- else { did -u %dname 37 | did -b %dname 38 }
- if ($3 != NULL) did -ra %dname 38 $3
- if ($4 == 1) { did -c %dname 43 | did -e %dname 44 }
- else { did -u %dname 43 | did -b %dname 44 }
- if ($5 != NULL) did -ra %dname 44 $5
- if ($6 == 1) did -c %dname 45
- else did -u %dname 45
- if ($7 == 1) { did -c %dname 39 | did -e %dname 40,41,42 }
- else { did -u %dname 39 | did -b %dname 40,41,42 }
- if ($8 != NULL) did -ra %dname 41 $ifdecode($8,m)
- if ($9 == 1) did -c %dname 42 | else did -u %dname 42
- if ($10 != NULL) did -ra %dname 47 $ifdecode($10,m)
- if ($did(29).sel != 1) did -b $dname 39,40,41,42
- else did -e $dname 39
- }
- }
- alias -l LoadPerforms {
- var %dname = Perform, %network = $1
- did -r %dname 6
- var %x = 1, %total = $ini(StartupPerform.ini,%network,0)
- while (%x <= %total) {
- did -i %dname 6 %x $readini(StartupPerform.ini,-n,%network,%x)
- inc %x
- }
- }
- alias -l ArrangeNetworks {
- var %dname = Startup, %x = 1, %total = $did(%dname,2).lines
- while (%x <= %total) {
- var %networks = $addtok(%networks,$did(2,%x),44)
- inc %x
- }
- if (%networks) writeini -n Startup.ini Config Networks %networks
- }
- alias -l ArrangeChans {
- var %dname = Startup, %network = $1, %x = 1, %total = $did(%dname,8).lines
- while (%x <= %total) {
- var %chans = $addtok(%chans,$did(8,%x),44)
- inc %x
- }
- if (%chans) writeini -n Startup.ini %network channels %chans
- }
- ; #############################################################################
- ; # Start event #
- ; #############################################################################
- on *:start: {
- var %networks = $readini(Startup.ini,config,networks)
- var %x = 1, %total = $numtok(%networks,44), %connects = 1
- while (%x <= %total) {
- var %network = $gettok(%networks,%x,44), %server = $readini(Startup.ini,%network,address)
- var %port = $iif($readini(Startup.ini,%network,port),$ifmatch,6667)
- if ($readini(Startup.ini,%network,connect) == 1) {
- if (%connects == 1) server %server %port
- else server -m %server %port
- inc %connects
- }
- inc %x
- }
- }
- ; #############################################################################
- ; # Connect event #
- ; #############################################################################
- on *:connect: {
- if ($ini(Startup.ini,$network)) {
- nick $readini(Startup.ini,$network,nick)
- if ($readini(Startup.ini,$network,auth) == 1) {
- var %authtype = $readini(Startup.ini,$network,AuthType)
- var %user = $readini(Startup.ini,$network,User)
- var %pass = $ifdecode($readini(Startup.ini,$network,pass),m)
- if (%authtype == 1) .msg nickserv identify %pass
- elseif (%authtype == 2) .msg AuthServ auth %user %pass
- elseif (%authtype == 3) .msg Q@CServe.quakenet.org auth %user %pass
- elseif (%authtype == 4) .msg x@channels.undernet.org login %user %pass
- elseif (%authtype == 5) .msg P@cservice.netgamers.org login %user %pass
- }
- var %x = 1
- while ($readini(StartupPerform.ini,$network,%x)) {
- $v1
- inc %x
- }
- var %chans = $readini(Startup.ini,$network,channels)
- var %x = 1, %total = $numtok(%chans,44)
- while (%x <= %total) {
- var %chan = $gettok(%chans,%x,44), %chandata = $readini(Startup.ini,n,$network,%chan)
- var %key = $iif($gettok(%chandata,10,166) != $null,$ifdecode($v1,m))
- if ($gettok(%chandata,6,166) == 1) join %chan %key
- inc %x
- }
- }
- }
- ; #############################################################################
- ; # Join event #
- ; #############################################################################
- on *:join:#: {
- if ($readini(Startup.ini,n,$network,$chan)) {
- tokenize 166 $v1
- if ($nick == $me) {
- if ($2 == 1) && ($3 != NULL) msg $chan $($3,2)
- if ($7 == 1) {
- if ($8 != NULL) .msg chanserv identify $chan $ifdecode($8,m)
- if ($9 == 1) .msg chanserv owner $chan
- }
- }
- else {
- if ($4 == 1) && ($5 != NULL) msg $chan $($5,2)
- }
- }
- }
- ; #############################################################################
- ; # Auto ID on nickserv notice. Auth to authserv if @... is required #
- ; #############################################################################
- on *:notice:*:?: {
- if ($readini(Startup.ini,$network,auth) == 1) {
- if ($nick == nickserv) || ($nick == authserv) {
- var %user = $readini(Startup.ini,$network,user)
- var %pass = $ifdecode($readini(Startup.ini,$network,pass),m)
- if (*registered and protected* iswm $1-) .msg nickserv identify %pass
- elseif ($regex($1-,/Authserv@([^ ]*)/Si)) .msg $regml(1) auth %user %pass
- }
- }
- }
- ; #############################################################################
- ; # Nick in use raw - Auto ghost/recover #
- ; #############################################################################
- raw 433:*: {
- if ($2 == $readini(Startup.ini,$network,nick)) && (!%GhostTimer) {
- var %nick = $2
- var %authtype = $readini(Startup.ini,$network,AuthType)
- var %user = $readini(Startup.ini,$network,User)
- var %pass = $ifdecode($readini(Startup.ini,$network,pass),m)
- if (%authtype == 1) {
- if ($($+(%,dc.,$network),2)) .msg nickserv ghost %nick %pass
- else {
- .msg nickserv recover %nick %pass
- .msg nickserv release %nick %pass
- }
- }
- elseif (%authtype == 2) .msg authserv ghost %nick %pass
- elseif (%authtype == 5) .msg P@cservice.netgamers.org recover %nick %user %pass
- set -u5 %GhostTimer on
- .timer 1 2 nick %nick
- }
- }
- ; #############################################################################
- ; # Disconnect event. Set variable to decide between ns ghost and ns release #
- ; #############################################################################
- on *:disconnect: {
- set -u120 $+(%,dc.,$network)
- }
- alias -l ifencode {
- if ($version == 6.17) return $1
- else return $encode($1)
- }
- alias -l ifdecode {
- if ($version == 6.17) return $1
- else return $decode($1)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement