;### Dialog Table ############################# dialog PMSystem { title "PM Manager v0.1" size -1 -1 124 88 option dbu button "Accept", 2, 55 2 25 10 button "Decline", 3, 90 2 25 10 button "!", 4, 80 2 7 10 button "!", 5, 115 2 7 10 button "Ignore", 8, 55 13 25 10 button "Note", 7, 90 13 25 10 list 1, 1 2 53 31, size vsbar button "!", 9, 80 13 7 10 button "More Options", 10, 55 24 67 9 radio "Block All", 6, 6 41 34 10 radio "Accept All", 11, 44 41 35 10 radio "Ignore All", 12, 85 41 35 10 button "Auto-Decline...", 14, 19 74 45 10 button "Auto-Accept...", 15, 19 64 45 10 button "Auto-Ignore...", 16, 64 64 44 10 button "Let me decide!", 13, 10 51 105 10 button "Remove...", 17, 64 74 44 10 } ;############################################## ;### Menu ##################################### Menu Channel,Status,Query { .PM Manager v0.1:{ If (!$Dialog(PMSystem)) { Dialog -m PMSystem PMSystem } } } ;############################################## Alias -l PMVersion { Return $+($chr(3),14[,$chr(3),7,PM Manager v0.1,$chr(3),$chr(3),14,],$chr(3)) } Alias -l PMDefaultSize { Return -1 -1 124 35 } Alias -l DelNick { Var %x = 1, %y = $did(PMSystem,1,1).lines While (%x <= %y) { If ($1 == $Gettok($Did(PMSystem,1,%x).text,1,32)) { Did -d PMSystem 1 %x } Inc %x } } On *:CLOSE:?:{ DelNick $Target } On *:OPEN:?:{ If ($Dialog(PMSystem)) { If (%PMSystemNote) { Msg $Nick %PMSystemNote } If ($Did(PMSystem,6).state == 1) { Msg $Nick $PMVersion I am currently blocking all PMs. Try again later. | Close -m $Nick } ElseIf ($Did(PMSystem,11).state == 1) { Msg $Nick $PMVersion Your PM has been auto accepted. | Echo -a $Nick says $qt($1-) } ElseIf ($Did(PMSystem,12).state == 1) { Close -m $Nick } ElseIf ($Nick isin %Declines) { Close -m $Nick } Elseif ($Readini(PMSystem.ini, n, $Address($Nick,2),Type) == Ignore) { Close -m $Nick } ElseIf ($Readini(PMSystem.ini, n, $Address($Nick,2),Type) == Accept) { Msg $Nick $PMVersion Your PM has been accepted. } ElseIf ($Readini(PMSystem.ini, n, $Address($Nick,2),Type) == Decline) { Msg $Nick $PMVersion Your PM has been declined. | Close -m $Nick } Else { Did -a PMSystem 1 $Nick .Timer $+ $Nick $+ $r(1,10000) 1 300 .Msg $Nick $PMVersion Your PM has timed out after 5 minutes and has been auto-declined. .Timer $+ $Nick $+ $r(1,10000) 1 300 .Close -m $Nick .Timer $+ $Nick $+ $r(1,10000) 1 300 .DelNick $Nick Msg $Nick $PMVersion Please wait for your PM to be accepted or declined. Echo -a $Nick says $qt($1-) } } } On *:DIALOG:PMSystem:Init:0:{ Dialog -bs PMSystem $PMDefaultSize } ;Accept Buttons ########## On *:DIALOG:PMSystem:Sclick:2:{ AcceptPM } On *:DIALOG:PMSystem:Sclick:4:{ AcceptPM Auto } Alias -l AcceptPM { If ($Did(PMSystem,1).seltext) { Msg $Did(1).seltext $PMVersion Your PM has been accepted. If ($1 == Auto) { Msg $Did(PMSystem,1,1).seltext $PMVersion You have been added to my auto-accept list. Writeini -n PMSystem.ini $Address($Did(PMSystem,1,1).seltext,2) Type Accept } Delnick $did(PMSystem,1,1).seltext .Timer $+ $Did(PMSystem,1,1).seltext $+ * Off } } ;########################## ;Decline Buttons ######### On *:DIALOG:PMSystem:Sclick:3:{ DeclinePM } On *:DIALOG:PMSystem:Sclick:5:{ DeclinePM Auto } Alias -l DeclinePM { If ($Did(PMSystem,1).seltext) { Msg $Did(1).seltext $PMVersion Your PM has been declined. If ($1 == Auto) { Msg $Did(PMSystem,1,1).seltext $PMVersion You have been added to my auto-decline list. Writeini -n PMSystem.ini $Address($Did(PMSystem,1,1).seltext,2) Type Decline } Set %Declines $Addtok(%Declines,$Did($Dname,1,1).seltext,32) .Timer 1 300 Set %Declines $Remtok(%Declines,$Did(PMSystem,1,1).seltext,1,32) .Timer $+ $Did(PMSystem,1,1).seltext $+ * Off Close -m $Did(PMSystem,1,1).seltext Delnick $Did(PMSystem,1,1).seltext } } ;########################## ;Ignore Buttons ########### On *:DIALOG:PMSystem:Sclick:8:{ DeclinePM } On *:DIALOG:PMSystem:Sclick:9:{ DeclinePM Auto } Alias -l IgnorePM { If ($Did(PMSystem,1).seltext) { If ($1 == Auto) { Writeini -n PMSystem.ini $Address($Did(PMSystem,1,1).seltext,2) Type Ignore } Delnick $did(PMSystem,1,1).seltext .Timer $+ $Did(PMSystem,1,1).seltext $+ * Off Close -m $Did($Dname,1,1).seltext } } ;########################## ;##### Note Button ##### On *:DIALOG:PMSystem:Sclick:7:{ Set %PMSystemNote $input(Leave a note:,eo,Note) } ;######################## ;More/Less options Button ######### On *:DIALOG:PMSystem:Sclick:10:{ If ($Did(PMSystem,10).text == More Options) { Dialog -bs PMSystem -1 -1 124 88 Did -ra PMSystem 10 Less options } Else { Dialog -bs PMSystem $PMDefaultSize Did -ra PMSystem 10 More Options } } ;################################## ;Let me decide Button ######### On *:DIALOG:PMSystem:Sclick:13:{ Did -u PMSystem 6,11,12 } ;############################### On *:DIALOG:PMSystem:Sclick:14:{ If ($input(Enter an address to add to Auto-Decline:,eo,Auto-Decline)) { Writeini -n PMSystem.ini $v1 Type Decline } } On *:DIALOG:PMSystem:Sclick:15:{ If ($input(Enter an address to add to Auto-Accept:,eo,Auto-Accept)) { Writeini -n PMSystem.ini $v1 Type Accept } } On *:DIALOG:PMSystem:Sclick:16:{ If ($input(Enter an address to add to Auto-Ignore:,eo,Auto-Ignore)) { Writeini -n PMSystem.ini $v1 Type Ignore } } On *:DIALOG:PMSystem:Sclick:17:{ If ($input(Enter an address to remove from Auto:,eo,Remove)) { Writeini -n PMSystem.ini $v1 Type None } }