; ############################################## ; # Start Idle Away Timer # ; ############################################## on *:start: if ($readini(Settings.ini,Away.Config,AutoAway) == on) .timerAway.IdleCheck -o 0 30 Away.IdleCheck ; ############################################## ; # Load Default Options # ; ############################################## on *:load: { if (!$readini(Settings.ini,Away.Config,NickEditType)) writeini Settings.ini Away.Config NickEditType Suffix if (!$readini(Settings.ini,Away.Config,NickPrefix)) writeini Settings.ini Away.Config NickPrefix Away| if (!$readini(Settings.ini,Away.Config,NickSuffix)) writeini Settings.ini Away.Config NickSuffix |Away if (!$readini(Settings.ini,Away.Config,AutoAway)) writeini Settings.ini Away.Config AutoAway off if (!$readini(Settings.ini,Away.Config,AutoAwayTime)) writeini Settings.ini Away.Config AutoAwayTime 900 if (!$readini(Settings.ini,Away.Config,LeavingTime)) writeini Settings.ini Away.Config LeavingTime off if (!$readini(Settings.ini,Away.Config,LeavingTimeFormat)) writeini Settings.ini Away.Config LeavingTimeFormat HH:nn:ss if (!$readini(Settings.ini,Away.Config,TimeAway)) writeini Settings.ini Away.Config TimeAway off if (!$readini(Settings.ini,Away.Config,TimeAwayFormat)) writeini Settings.ini Away.Config TimeAwayFormat Short if (!$readini(Settings.ini,Away.Config,ARChannelMessage)) writeini Settings.ini Away.Config ARChannelMessage off if (!$readini(Settings.ini,Away.Config,ARPrivateMessage)) writeini Settings.ini Away.Config ARPrivateMessage off echo -a 4>>> Successfully loaded $remove($script,$scriptdir) - Away System script written by Urza } ; ############################################## ; # Remove Away if unloaded # ; ############################################## on *:unload: { disable #away unset %away.* hfree away.*.responses } ; ############################################## ; # Check for away on connect # ; ############################################## on *:connect: { if ($group(#away) == on) { var %edittype = $readini(Settings.ini,Away.Config,NickEditType) if (%Away.Preset) var %nickadd = $gettok($readini(Settings.ini,Away.Config,Preset. $+ %Away.Preset),2,32) else var %nickadd = $readini(Settings.ini,Away.Config,Nick $+ %edittype) if (%edittype == Prefix) && ($+(%nickadd,*) !iswm $me) nick $+(%nickadd,$me) if (%edittype == Suffix) && ($+(*,%nickadd) !iswm $me) nick $+($me,%nickadd) ame is currently away $iif(%Away.Reason,- %Away.Reason) $iif(%Away.leavetime,- Left at %Away.Leavtime) $iif($Away.Gonefor,- Gone for $Away.Gonefor) !away $iif(%Away.Reason,- %Away.Reason) $iif(%Away.leavetime,- Left at %Away.Leavtime) $iif($Away.Gonefor,- Gone for $Away.Gonefor) } } ; ############################################## ; # Cancel Away on exit # ; ############################################## on *:exit: { disable #away unset %away.* } ; ############################################## ; # Popup Menus # ; ############################################## menu status,channel,query,menubar,@Away.Logs { - Away Settings .Open away options: dialog $iif($dialog(away),-o,-m) away away .$iif($active == @Away.Logs,Close window):window -c $active . - . Set away $+ $chr(58) $iif($group(#away) == off,on,off): { if ($group(#away) == off) away $?="Enter away reason or leave black for default (if set)" else back } .- .$iif($group(#away) == on && %Away.Preset == 1,$style(3),$iif($group(#away) == on || !$readini(Settings.ini,Away.Config,Preset.1),$style(2))) Preset 1 - $iif($readini(settings.ini,Away.Config,Preset.1),$gettok($v1,1,32),Not set):away $gettok($readini(settings.ini,Away.Config,Preset.1),1,32) .$iif($group(#away) == on && %Away.Preset == 2,$style(3),$iif($group(#away) == on || !$readini(Settings.ini,Away.Config,Preset.2),$style(2))) Preset 2 - $iif($readini(settings.ini,Away.Config,Preset.2),$gettok($v1,1,32),Not set):away $gettok($readini(settings.ini,Away.Config,Preset.2),1,32) .$iif($group(#away) == on && %Away.Preset == 3,$style(3),$iif($group(#away) == on || !$readini(Settings.ini,Away.Config,Preset.3),$style(2))) Preset 3 - $iif($readini(settings.ini,Away.Config,Preset.3),$gettok($v1,1,32),Not set):away $gettok($readini(settings.ini,Away.Config,Preset.3),1,32) .$iif($group(#away) == on && %Away.Preset == 4,$style(3),$iif($group(#away) == on || !$readini(Settings.ini,Away.Config,Preset.4),$style(2))) Preset 4 - $iif($readini(settings.ini,Away.Config,Preset.4),$gettok($v1,1,32),Not set):away $gettok($readini(settings.ini,Away.Config,Preset.4),1,32) .$iif($group(#away) == on && %Away.Preset == 5,$style(3),$iif($group(#away) == on || !$readini(Settings.ini,Away.Config,Preset.5),$style(2))) Preset 5 - $iif($readini(settings.ini,Away.Config,Preset.5),$gettok($v1,1,32),Not set):away $gettok($readini(settings.ini,Away.Config,Preset.5),1,32) .$iif($group(#away) == on && %Away.Preset == 6,$style(3),$iif($group(#away) == on || !$readini(Settings.ini,Away.Config,Preset.6),$style(2))) Preset 6 - $iif($readini(settings.ini,Away.Config,Preset.6),$gettok($v1,1,32),Not set):away $gettok($readini(settings.ini,Away.Config,Preset.6),1,32) .$iif($group(#away) == on && %Away.Preset == 7,$style(3),$iif($group(#away) == on || !$readini(Settings.ini,Away.Config,Preset.7),$style(2))) Preset 7 - $iif($readini(settings.ini,Away.Config,Preset.7),$gettok($v1,1,32),Not set):away $gettok($readini(settings.ini,Away.Config,Preset.7),1,32) } ; ############################################## ; # Main Dialog # ; ############################################## dialog away { title Away System Settings size -1 -1 150 180 option dbu box "Away Settings", 1, 4 4 142 150 Box "Nick Settings", 2, 7 12 136 25 combo 3, 12 22 50 10, drop edit "", 5, 65 22 50 10 button "?", 6, 128 22 10 10 box "Away Options" 4, 7 40 136 75 text "Default Away Message:", 24, 12 48 100 10 edit "", 25, 12 56 100 10 button "?", 26, 128 56 10 10 check "A&uto Away After", 7, 12 70 50 10 edit "", 8, 63 70 10 10 text "minutes Idle.", 9, 75 72.5 40 10 button "?", 10, 128 70 10 10 check "Show &Leaving Time?" 11, 12 85 60 10 edit "" 12, 75 85 50 10 button "?", 13, 128 85 10 10 check "Show &Time Away?" 14, 12 100 55 10 combo 15, 75 100 50 10, drop button "?", 16, 128 100 10 10 box "Auto Return" 17, 7 115 136 35 text "Cancel away on:" 18, 12 126 80 10 check "&Channel Message" 19, 60 125 50 10 check "&Private Message" 20, 60 135 50 10 button "?", 21, 128 135 10 10 button "Edit &Presets" 22, 12 160 60 15 button "&Ok" 23, 80 160 60 15, ok } ; ############################################## ; # Custom presets dialog # ; ############################################## dialog Custom.Aways { title Custom Away Messages size -1 -1 230 110 option dbu box "Custom Away Triggers" 1, 4 4 222 85 text "Trigger", 2, 16 12 30 10 text "Pre/Suffix", 3, 43 12 30 10 text "Away Message", 4, 100 12 50 10 list 5, 10 20 30 50 list 6, 40 20 30 50 list 7, 70 20 150 50 button "Add" 8, 10 70 50 15 button "Delete" 9, 70 70 50 15 button "Edit" 10, 130 70 50 15 button "OK", 11, 70 90 50 15, OK } ; ############################################## ; # Help Dialogs # ; ############################################## dialog Away.Help.6 { title Away System Help size -1 -1 150 120 option dbu box "Nick Suffix/Prefix Help", 1, 5 5 140 90 text "Nick PREFIX: Adds the specified text to the FRONT of your nick when going away", 2, 8 15 133 20 text "Nick SUFFIX: Adds the specified text to the END of your nick when going away", 3, 8 35 133 20 text "Don’t Change: Means that you’re nick will not change when going away or coming back", 4, 8 55 133 20 text "Suffixes and prefixes will be automatically removed when you return from away", 5, 8 75 133 20 button "OK", 6, 50 100 50 15, OK } dialog Away.Help.10 { title Away System Help size -1 -1 150 70 option dbu box "Auto Away Help", 1, 5 5 140 40 text "Enabling Auto-Away will automatically set you as away if you are idle for the specified time", 2, 8 15 134 20 text "Time must be between 1 and 60 minutes", 3, 8 35 134 20 button "OK", 4, 50 50 50 15, ok } dialog Away.Help.13 { title Away System Help size -1 -1 150 80 option dbu box "Show Leaving Time Help", 1, 5 5 140 50 text "Enabling 'Show Leaving Time' will display the time you went away in all your away messages in the specified Time Format", 2, 8 15 134 20 button "Click Here for a list of codes used in time format", 3, 8 40 134 10 button "OK", 4, 50 60 50 15, ok } dialog Away.Help.16 { title Away System Help size -1 -1 150 90 option dbu box "Show Time Away Help", 1, 5 5 140 60 text "Enabling 'Show Time Away' will display how long you have been away in all your away messages in the specified Time Format", 2, 8 15 134 20 text "Example of Short format: 5h 6m 10s" 3, 8 40 134 10 text "Example of Medium format: 5hrs 6mins 10secs" 4, 8 48 134 10 text "Example of long format: 5 hours 6 minutes 10 seconds" 5, 8 56 134 10 button "OK", 6, 50 70 50 15, ok } dialog Away.Help.21 { title Away System Help size -1 -1 150 65 option dbu box "Automatic Return Help", 1, 5 5 140 35 text "Enabling 'Automatic Return' will automatically bring you back from away if you send any Channel And/Or Private message", 2, 8 15 134 20 button "OK", 5, 50 45 50 15, ok } dialog Away.Help.26 { title Away System Help size -1 -1 150 55 option dbu box "Default Message Help", 1, 5 5 140 27 text "If you do not enter a reason when going away this default will be used", 2, 8 15 134 20 button "OK", 3, 50 35 50 15, ok } dialog Away.Help.Time { title Away System Help size -1 -1 150 155 option dbu box "Time Format Help", 1, 5 5 140 120 text "The following is a list of Codes that can be used in Time Formats", 2, 8 15 134 20 box "Time Format Codes", 3, 8 30 134 88 list 4, 20 40 20 75 list 5, 40 40 90 75 button "OK", 6, 50 130 50 15, ok } ; ############################################## ; # Dialog Initiation events # ; ############################################## on *:dialog:Away.Help.Time:init:*: { did -a $dname 4 HH did -a $dname 5 Hours - 2 Digit 24 hour time - $time(HH) did -a $dname 4 H did -a $dname 5 Hours - 1 Digit 24 hour time - $time(H) did -a $dname 4 hh did -a $dname 5 Hours - 2 Digit 12 hour time - $time(hh) did -a $dname 4 h did -a $dname 5 Hours - 1 Digit 12 hour time - $time(h) did -a $dname 4 nn did -a $dname 5 Minutes - 2 Digit - $time(nn) did -a $dname 4 n did -a $dname 5 Minutes - 1 Digit - $time(n) did -a $dname 4 ss did -a $dname 5 Seconds - 2 Digit - $time(ss) did -a $dname 4 s did -a $dname 5 Seconds - 1 Digit - $time(s) did -a $dname 4 tt did -a $dname 5 am/pm - Lower case - $time(tt) did -a $dname 4 TT did -a $dname 5 AM/PM - Upper Case - $time(TT) } on *:dialog:away:init:*: { did -a $+ $iif($readini(Settings.ini,Away.Config,NickEditType) == Prefix,c) Away 3 Prefix did -a $+ $iif($readini(Settings.ini,Away.Config,NickEditType) == Suffix,c) Away 3 Suffix did -a $+ $iif($readini(Settings.ini,Away.COnfig,NickEditType) == Don't Change,c) Away 3 Don't Change if ($readini(Settings.ini,Away.Config,NickEditType) == Don't Change) did -m Away 5 if ($readini(Settings.ini,Away.Config,NickPrefix)) && ($did(away,3).seltext == Prefix) did -ra Away 5 $readini(Settings.ini,Away.Config,NickPrefix) if ($readini(Settings.ini,Away.Config,NickSuffix)) && ($did(away,3).seltext == Suffix) did -ra Away 5 $readini(Settings.ini,Away.Config,NickSuffix) if ($readini(Settings.ini,Away.Config,AutoAway) == on) did -c Away 7 | else did -m Away 8 if ($readini(Settings.ini,Away.Config,AutoAwayTime)) did -a Away 8 $calc($ifmatch / 60) | else did -a Away 8 900 if ($readini(Settings.ini,Away.Config,LeavingTime) == on) did -c Away 11 | else did -m Away 12 if ($readini(Settings.ini,Away.Config,LeavingTimeFormat)) did -a Away 12 $ifmatch | else did -a Away 12 HH:nn:ss if ($readini(Settings.ini,Away.Config,TimeAway) == on) did -c Away 14 | else did -m Away 15 if ($readini(Settings.ini,Away.Config,TimeAwayFormat) == Short) did -ac Away 15 Short | else did -a Away 15 Short if ($readini(Settings.ini,Away.Config,TimeAwayFormat) == Medium) did -ac Away 15 Medium | else did -a Away 15 Medium if ($readini(Settings.ini,Away.Config,TimeAwayFormat) == Long) did -ac Away 15 Long | else did -a Away 15 Long if ($readini(Settings.ini,Away.Config,ARChannelMessage) == on) did -c Away 19 if ($readini(Settings.ini,Away.Config,ARPrivateMessage) == on) did -c Away 20 if ($readini(Settings.ini,Away.Config,DefaultMessage)) did -a Away 25 $ifmatch } on *:dialog:Custom.Aways:init:*: { var %x = 1 while (%x <= 7) { if ($readini(settings.ini,Away.Config,$+(Preset.,%x))) { did -a Custom.Aways 5 $gettok($v1,1,32) did -a Custom.Aways 6 $gettok($v1,2,32) did -a Custom.Aways 7 $gettok($v1,3-,32) } else halt inc %x } } ; ############################################## ; # Dialog Sclick Events # ; ############################################## on *:dialog:Away.Help.13:sclick:3: { dialog $iif($dialog(Away.Help.Time),-o,-m) Away.Help.Time Away.Help.Time dialog -x $dname } on *:dialog:away:sclick:*: { if ($did == 3) { writeini Settings.ini Away.Config NickEditType $did(3).seltext if ($did(3).seltext == Prefix) did -nra Away 5 $readini(Settings.ini,Away.Config,NickPrefix) elseif ($did(3).seltext == suffix) did -nra Away 5 $readini(Settings.ini,Away.Config,NickSuffix) else { did -m Away 5 | did -r Away 5 } } if ($did == 7) && ($did(7).state == 0) did -m Away 8 elseif ($did == 7) && ($did(7).state == 1) did -n Away 8 elseif ($did == 11) && ($did(11).state == 0) did -m Away 12 elseif ($did == 11) && ($did(11).state == 1) did -n Away 12 elseif ($did == 14) && ($did(14).state == 0) did -m Away 15 elseif ($did == 14) && ($did(14).state == 1) did -n Away 15 elseif ($istok(6|10|13|16|21|26,$did,124)) dialog $iif($dialog($+(Away.Help.,$did)),-o,-m) $+(Away.Help.,$did) $+(Away.Help.,$did) elseif ($did == 22) dialog $iif($dialog(Custom.Aways),-o,-m) Custom.Aways Custom.Aways } on *:dialog:Custom.Aways:sclick:*: { if ($did == 5) did -c Custom.Aways 6,7 $did(5).sel elseif ($did == 6) did -c Custom.Aways 5,7 $did(6).sel elseif ($did == 7) did -c Custom.Aways 5,6 $did(7).sel elseif ($did == 8) { var %x if ($did(5).lines >= 7) { %x = $input(ERROR: You may only have a max of 7 presets,wo,Error) | halt } var %trigger = $input(Enter a one word Trigger/Description $crlf $+ ----- $crlf $+ For example entering ‘sleep’ means you can go away by typing ‘/away sleep’ or by selecting ‘sleep’ from the away menu,eoq,Input Request) if ($numtok(%trigger,32) > 1) { %x = $input(ERROR: You must enter a single word trigger,wo,Invalid Input) | halt } elseif (!%trigger) { %x = $input(ERROR: Trigger can not be null,wo,Invalid Input) | halt } var %NickEdit = $input(Enter nick prefix/suffix $crlf $+ This is the text that will be added to the beginning or end of your nick when using this preset $crlf $+ ----- $crlf $+ Keep blank if you don’t wish to change your nick $crlf $+ ----- $crlf $+ NOTE: if you have 'Don't Change' set in the main options this setting IS overwritten,eoq,Input Request) if (!%NickEdit) var %NickEdit = - elseif ($remove(%Nickedit,$chr(124),$chr(91),$chr(93),$chr(92),$chr(45),$chr(95),$chr(123),$chr(125)) !isalnum) { %x = $input(ERROR: Invalid Nick Characters detected,wo,Invalid Input) | halt } var %Message = $input(Enter away message $crlf $+ ----- $crlf $+ This is the default away message used when setting away with this preset,eoq,Input Request) did -a Custom.Aways 5 %trigger did -a Custom.Aways 6 %NickEdit did -a Custom.Aways 7 %Message } elseif ($did == 9) { if (!$did(5).sel) var %x = $input(ERROR: You must select an entry to delete,wo,Invalid Selection) elseif ($?!="Are you sure you want to delete this entry - $did(5).seltext ") { did -d Custom.Aways 5 $did(5).sel did -d Custom.Aways 6 $did(6).sel did -d Custom.Aways 7 $did(7).sel } } elseif ($did == 10) { if (!$did(5).sel) { var %x = $input(ERROR: You must select an entry to edit,wo,Invalid Selection) | halt } var %x var %trigger = $input(Enter new trigger for this preset,eoq,Input Request,$did(5).seltext) if ($numtok(%trigger,32) > 1) { %x = $input(ERROR: You must enter a single word trigger,wo,Invalid Input) | halt } elseif (!%trigger) { %x = $input(ERROR: Trigger can not be null,wo,Invalid Input) | halt } var %NickEdit = $input(Enter a new Prefix/Suffix for this preset,eoq,Input Request,$did(6).seltext) if (!%NickEdit) var %NickEdit = - elseif ($remove(%Nickedit,$chr(124),$chr(91),$chr(93),$chr(92),$chr(45),$chr(95),$chr(123),$chr(125)) !isalnum) { %x = $input(ERROR: Invalid Nick Characters detected,wo,Invalid Input,$did(7).seltext) | halt } var %Message = $input(Enter a new Away message for this preset,eoq,Input Request,$did(7).seltext) did -o Custom.Aways 5 $did(5).sel %trigger did -o Custom.Aways 6 $did(6).sel %NickEdit did -o Custom.Aways 7 $did(7).sel %Message } } ; ############################################## ; # Dialog Close Events # ; ############################################## on *:dialog:Away:close:*: { if ($did(3).state == 1) && ($did(5)) writeini Settings.ini Away.Config NickPrefix $did(5) elseif ($did(4).state == 1) && ($did(5)) writeini Settings.ini Away.Config NickSuffix $did(5) else { writeini Settings.ini Away.Config NickPrefix Away| writeini Settings.ini Away.Config NickSuffix |Away } writeini Settings.ini Away.Config AutoAway $iif($did(7).state == 0,off,on) writeini Settings.ini Away.Config AutoAwayTime $iif($did(8),$calc($did(8) * 60),900) writeini Settings.ini Away.Config LeavingTime $iif($did(11).state == 0,off,on) writeini Settings.ini Away.Config LeavingTimeFormat $iif($did(12),$did(12),HH:nn:ss) writeini Settings.ini Away.Config TimeAway $iif($did(14).state == 0,off,on) writeini Settings.ini Away.Config TimeAwayFormat $iif($did(15),$did(15),Shorts) writeini Settings.ini Away.Config ARChannelMessage $iif($did(19).state == 0,off,on) writeini Settings.ini Away.Config ARPrivateMessage $iif($did(20).state == 0,off,on) if ($did(25)) writeini Settings.ini Away.Config DefaultMessage $did(25) if ($readini(Settings.ini,Away.Config,AutoAway) == on) .timerAway.IdleCheck -o 0 30 Away.IdleCheck elseif ($timer(Away.IdleCheck)) .timerAway.IdleCheck off } on *:dialog:Custom.Aways:close:*: { var %x = 1, %lines = $did(5).lines while (%x <= %lines) { did -c Custom.Aways 5,6,7 %x writeini settings.ini Away.Config $+(Preset.,%x) $did(5).seltext $did(6).seltext $did(7).seltext inc %x } dec %x while (%x < 7) { inc %x if ($readini(settings.ini,Away.Config,$+(Preset.,%x))) remini Settings.ini Away.Config $+(Preset.,%x) } } ; ############################################## ; # /Away And /back aliases # ; ############################################## alias away { if ($group(#away) == on) { Echo -a 4>>> You are already Away | halt } ; ----- Unset Idle timer, Get highlights, enable #away group for logging etc if ($timer(Away.IdleCheck)) .timerAway.IdleCheck off Get.Highlights .enable #away ; ---- Retrieve away settings from config/User entry set %Away.LeftAt $ctime var %edittype = $readini(Settings.ini,Away.Config,NickEditType) var %nickadd = $readini(Settings.ini,Away.Config,Nick $+ %edittype) if ($1) set %away.Reason $1- elseif ($readini(settings.ini,Away.Config,DefaultMessage)) set %away.Reason $v1 if ($readini(Settings.ini,Away.Config,LeavingTime) == on) { var %LeavingTimeFormat = $readini(Settings.ini,Away.Config,LeavingTimeFormat) set %away.LeaveTime $time(%LeavingTimeFormat) } ; ----- Check for presets var %x 1 while (%x <= 7) { if ($readini(Settings.ini,Away.Config,$+(Preset.,%x))) { var %preset = $v1 if ($1 == $gettok(%preset,1,32)) { var %nickadd = $gettok(%preset,2,32) var %away.reason = $gettok(%preset,3-,32) set %Away.Preset %x var %x = 7 } } inc %x } ; ----- Cycle Connections to change nick/send msg var %x = 1, %connections = $scon(0) while (%x <= %connections) { scon %x if ($status == connected) { set $+(%,Away.Oldnick.,$network) $me if ($readini(Settings.ini,Away.Config,NickEditType) != Don't Change) && (%Nickadd != -) { if (%edittype == Prefix) && ($+(%nickadd,*) !iswm $me) var %newnick = $+(%nickadd,$me) if (%edittype == Suffix) && ($+(*,%nickadd) !iswm $me) var %newnick = $+($me,%nickadd) if (%newnick) nick %newnick } if ($chan(0)) ame is now away $iif(%Away.Reason,- %Away.Reason) $iif(%Away.leavetime,- Left at %Away.Leavetime) !away Away $iif(%Away.Reason,- %Away.Reason) $iif(%Away.leavetime,- Left at %Away.Leavetime) } inc %x } } alias back { if ($group(#away) == off) { Echo -a 4>>> You are not Away | halt } var %edittype = $readini(Settings.ini,Away.Config,NickEditType) if (%Away.Preset) var %nickadd = $gettok($readini(Settings.ini,Away.Config,Preset. $+ %Away.Preset),2,32) else var %nickadd = $readini(Settings.ini,Away.Config,Nick $+ %edittype) var %x = 1, %connections = $scon(0) while (%x <= %connections) { scon %x if ($status == connected) { if ($readini(Settings.ini,Away.Config,NickEditType) != Don't Change) && (%Nickadd != -) { if (%edittype == Prefix) && ($+(%nickadd,*) iswm $me) var %newnick = $remove($me,%nickadd) if (%edittype == Suffix) && ($+(*,%nickadd) iswm $me) var %newnick = $remove($me,%nickadd) if (%newnick) nick %newnick } if ($chan(0)) ame is back $iif(%away.Reason,- from %Away.Reason) $iif(%Away.Leavetime,- Left at %Away.Leavetime) $iif($Away.GoneFor,- Gone for $Away.GoneFor) !away } inc %x } .disable #away unset %away.* if ($hget(Away.PM.Responses)) || ($hget(Away.Highlight.Responses)) hfree -w Away.*.Responses if ($readini(Settings.ini,Away.Config,AutoAway) == on) .timerAway.IdleCheck -o 0 30 Away.IdleCheck } ; ############################################## ; # Other Aliases # ; ############################################## alias -l Away.Gonefor { if ($readini(Settings.ini,Away.Config,TimeAway) == on) { var %TimeAwayFormat = $readini(Settings.ini,Away.Config,TimeAwayFormat) if (%Away.LeftAt) { var %duration = $duration($calc($ctime - %Away.LeftAt),%TimeAwayFormat) if (%TimeAwayFormat == Short) return $Short.Duration(%duration) elseif (%TimeAwayFormat == medium) return %duration elseif (%TimeAwayFormat == long) return $Long.Duration(%duration) } } else return $false } alias -l Short.Duration return $replacex($1-,secs,s,sec,s,mins,m,min,m,hrs,h,hr,h,days,d,day,d,wks,w,wk,w) alias -l Long.Duration return $replacex($1-,sec,second,secs,seconds,min,minute,mins,minutes,hr,hour,hrs,hours,wk,week,wks,weeks) alias -l Get.Highlights { var %x = 0, %Groups = $ini(mirc.ini,highlight,0) while (%x <= %groups) { var %hlights = $readini(mirc.ini,highlight,n $+ %x) set %Away.Highlights $addtok(%Away.highlights,$gettok(%hlights,2,34),44) inc %x } } alias -l Check.For.highlights { if (!%Away.Highlights) Get.Highlights var %x = 1, %highlights = $numtok(%Away.highlights,44) while (%x <= %highlights) { var %chighlight = $($gettok(%Away.Highlights,%x,44),2) if ($istok($1-,%chighlight,32)) return %chighlight inc %x } return $false } alias -l Away.Logwin { if (!$window(@Away.Logs)) window -eknz @Away.Logs echo -ti2 @Away.Logs $1- } alias -l Highlight.Response { if (!$hget(Away.highlight.Responses,$+($1,.,$2))) { scid $1 notice $2 I am currently away $iif(%Away.Reason,- %Away.Reason) $iif(%Away.LeaveTime,- Left at %Away.LeaveTime) $iif($away.gonefor,- Gone for $away.gonefor) - One time response to highlight hadd -m Away.Highlight.Responses $+($1,.,$2) 1 } } alias -l Private.Message.Response { if (!$hget(Away.PM.Responses,$+($1,.,$2))) { scid $1 notice $2 I am currently away $iif(%Away.Reason,- %Away.Reason) $iif(%Away.LeaveTime,- Left at %Away.LeaveTime) $iif($away.gonefor,- Gone for $away.gonefor) - One time response to Private Message hadd -m Away.PM.Responses $+($1,.,$2) 1 } } alias Away.IdleCheck { var %x = 1, %networks = $scon(0) var %AutoAwayTime = $readini(Settings.ini,Away.Config,AutoAwayTime) while (%x <= %networks) { scon %x { if ($status == Connected) && ($idle >= %AutoAwayTime) away Auto Away after $duration(%AutoAwayTime) Idle } inc %x } } alias Away.Config dialog -m Away Away ; ############################################## ; # Logging and hilight resposes # ; ############################################## #away off on *:text:*:#: { if (!$Check.For.highlights($1-)) && (!$istok($1-,$me,32)) && (!$istok($1-,$($+(%,Away.Oldnick.,$network),2),32)) return else { Away.Logwin 4[10CHANNEL MESSAGE4] $+(4[10,$iif($scon(0) > 1,$+($network,12/10)),$chan,12/10,$nick,4]) $1- Highlight.Response $cid $nick $check.for.highlights($1-) } } on *:action:*:#: { if (!$check.for.highlights($1-)) && (!$istok($1-,$me,32)) && (!$istok($1-,$($+(%,Away.Oldnick.,$network),2),32)) return else { Away.Logwin 4[10CHANNEL  10ACTION4] $+(4[10,$iif($scon(0) > 1,$+($network,12/10)),$chan,12/10,$nick,4]) * $nick $1- Highlight.Response $cid $nick $check.for.highlights($1-) } } on *:notice:*:?: { Away.Logwin 4[10PRIVATE NOTICE4] $+(4[10,$iif($scon(0) > 1,$+($network,12/10)),Private,12/10,$nick,4]) $1- Private.Message.Response $cid $nick } on *:text:*:?: Private.Message.Response $cid $nick on *:open:?:*: Private.Message.Response $cid $nick on *:input:#: { if ($left($1,1) != $readini(mirc.ini,text,commandchar)) { if ($readini(Settings.ini,Away.Config,ARChannelMessage) == on) back } } on *:input:?: { if ($left($1,1) != $readini(mirc.ini,text,commandchar)) { if ($readini(Settings.ini,Away.Config,ARPrivateMessage) == on) back } } #away end