Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 53.90 KB | None | 0 0
  1. alias awaycolor1 { return $+($chr(3),6,$1-) }
  2. alias awaycolor2 { return $+($chr(3),11,$1-) }
  3. alias awaycolor3 { return $+($chr(3),6,$1-) }
  4. alias awaycolor4 { return $+($chr(3),11,$1-) }
  5. ; #################################################################
  6. ; ## Away system script ##
  7. ; ## Designed and written by Urza ##
  8. ; ## Email: Urza23@hotmail.com ##
  9. ; ## Written and tested in mIRC 6.17 ##
  10. ; ## Also tested in mIRC 6.16 ##
  11. ; ## May not work correctly in earlier versions ##
  12. ; ## ----------------------------------------------------------- ##
  13. ; ## Usage: ##
  14. ; ## /Away.Config - Opens the options dialog ##
  15. ; ## /Away [Reason] - Set yourself away ##
  16. ; ## /Away [Preset] - Set yourself away using a preset trigger ##
  17. ; ## /Back - Return from away ##
  18. ; ## Options are also avaliable via menus ##
  19. ; #################################################################
  20. ; ##############################################
  21. ; # Start Idle Away Timer #
  22. ; ##############################################
  23. on *:start: if ($readini(Settings.ini,Away.Config,AutoAway) == on) .timerAway.IdleCheck -o 0 30 Away.IdleCheck
  24. ; ##############################################
  25. ; # Load Default Options #
  26. ; ##############################################
  27. on *:load: {
  28. if (!$readini(AwaySettings.ini,Config,NickEditType)) writeini AwaySettings.ini Config NickEditType Suffix
  29. if (!$readini(AwaySettings.ini,Config,NickPrefix)) writeini AwaySettings.ini Config NickPrefix Away|
  30. if (!$readini(AwaySettings.ini,Config,NickSuffix)) writeini AwaySettings.ini Config NickSuffix |Away
  31. if (!$readini(AwaySettings.ini,Config,NickSetTo)) writeini AwaySettings.ini Config NickSuffix Away
  32. if (!$readini(AwaySettings.ini,Config,AutoAway)) writeini AwaySettings.ini Config AutoAway off
  33. if (!$readini(AwaySettings.ini,Config,AutoAwayTime)) writeini AwaySettings.ini Config AutoAwayTime 900
  34. if (!$readini(AwaySettings.ini,Config,IdleSettings)) writeini AwaySettings.ini Config IdleSettings Suffix~|Idle~Auto away after %time minutes idle
  35. if (!$readini(AwaySettings.ini,Config,LeavingTime)) writeini AwaySettings.ini Config LeavingTime off
  36. if (!$readini(AwaySettings.ini,Config,LeavingTimeFormat)) writeini AwaySettings.ini Config LeavingTimeFormat HH:nn:ss
  37. if (!$readini(AwaySettings.ini,Config,TimeAway)) writeini AwaySettings.ini Config TimeAway off
  38. if (!$readini(AwaySettings.ini,Config,TimeAwayFormat)) writeini AwaySettings.ini Config TimeAwayFormat Short
  39. if (!$readini(AwaySettings.ini,Config,ARChannelMessage)) writeini AwaySettings.ini Config ARChannelMessage off
  40. if (!$readini(AwaySettings.ini,Config,ARPrivateMessage)) writeini AwaySettings.ini Config ARPrivateMessage off
  41. if (!$readini(AwaySettings.ini,Config,MsgChans)) writeini AwaySettings.ini Config MsgChans on
  42. if (!$readini(AwaySettings.ini,Config,MsgQueries)) writeini AwaySettings.ini Config MsgQueries off
  43. if (!$readini(AwaySettings.ini,Config,RespondHilights)) writeini AwaySettings.ini Config RespondHilights on
  44. if (!$readini(AwaySettings.ini,Config,RespondPM)) writeini AwaySettings.ini Config RespondPM on
  45. if (!$readini(AwaySettings.ini,Config,RespondNotice)) writeini AwaySettings.ini Config RespondNotice on
  46. echo -a 4>>> Successfully loaded $remove($script,$scriptdir) - Away System script by Urza
  47. }
  48. ; ##############################################
  49. ; # Check for away on connect #
  50. ; ##############################################
  51. on *:connect: {
  52. if ($group(#away) == on) {
  53. if ($($+(%,Away.Newnick.,$network),2) != $me) nick $ifmatch
  54. ame is currently away $iif(%Away.Reason,- %Away.Reason) $iif(%Away.leavetime,- Left at %Away.Leavtime) $iif($Away.Gonefor,- Gone for $Away.Gonefor)
  55. !away Away: $iif(%Away.Reason,- %Away.Reason) $iif(%Away.leavetime,- Left at %Away.Leavtime) $iif($Away.Gonefor,- Gone for $Away.Gonefor)
  56. }
  57. }
  58. ; ##############################################
  59. ; # Remove Away if unloaded #
  60. ; ##############################################
  61. on *:unload: {
  62. disable #away
  63. unset %away.*
  64. hfree away.*.responses
  65. timerAway.Idlecheck off
  66. }
  67. ; ##############################################
  68. ; # Cancel Away on exit #
  69. ; ##############################################
  70. on *:exit: {
  71. disable #away
  72. unset %away.*
  73. timerAway.Idlecheck off
  74. }
  75. ; ##############################################
  76. ; # Popup Menus #
  77. ; ##############################################
  78. menu status,channel,query,menubar,@Away.Logs {
  79. -
  80. Away Settings
  81. .Open away options: dialog $iif($dialog(away),-o,-m) away away
  82. .$iif($active == @Away.Logs,Close window):window -c $active
  83. . -
  84. . Set away $+ $chr(58) $iif($group(#away) == off,on,off): {
  85. if ($group(#away) == off) away $?="Enter away reason or leave black for default (if set)"
  86. else back
  87. }
  88. .-
  89. .$iif($group(#away) == on && %Away.Preset == 1,$style(3),$iif($group(#away) == on || !$readini(AwaySettings.ini,Presets,1),$style(2))) Preset 1 - $iif($readini(AwaySettings.ini,Presets,1),$gettok($v1,1,126),Not set):away $gettok($readini(AwaySettings.ini,Presets,1),1,126)
  90. .$iif($group(#away) == on && %Away.Preset == 2,$style(3),$iif($group(#away) == on || !$readini(AwaySettings.ini,Presets,2),$style(2))) Preset 2 - $iif($readini(AwaySettings.ini,Presets,2),$gettok($v1,1,126),Not set):away $gettok($readini(AwaySettings.ini,Presets,2),1,126)
  91. .$iif($group(#away) == on && %Away.Preset == 3,$style(3),$iif($group(#away) == on || !$readini(AwaySettings.ini,Presets,3),$style(2))) Preset 3 - $iif($readini(AwaySettings.ini,Presets,3),$gettok($v1,1,126),Not set):away $gettok($readini(AwaySettings.ini,Presets,3),1,126)
  92. .$iif($group(#away) == on && %Away.Preset == 4,$style(3),$iif($group(#away) == on || !$readini(AwaySettings.ini,Presets,4),$style(2))) Preset 4 - $iif($readini(AwaySettings.ini,Presets,4),$gettok($v1,1,126),Not set):away $gettok($readini(AwaySettings.ini,Presets,4),1,126)
  93. .$iif($group(#away) == on && %Away.Preset == 5,$style(3),$iif($group(#away) == on || !$readini(AwaySettings.ini,Presets,5),$style(2))) Preset 5 - $iif($readini(AwaySettings.ini,Presets,5),$gettok($v1,1,126),Not set):away $gettok($readini(AwaySettings.ini,Presets,5),1,126)
  94. .$iif($group(#away) == on && %Away.Preset == 6,$style(3),$iif($group(#away) == on || !$readini(AwaySettings.ini,Presets,6),$style(2))) Preset 6 - $iif($readini(AwaySettings.ini,Presets,6),$gettok($v1,1,126),Not set):away $gettok($readini(AwaySettings.ini,Presets,6),1,126)
  95. .$iif($group(#away) == on && %Away.Preset == 7,$style(3),$iif($group(#away) == on || !$readini(AwaySettings.ini,Presets,7),$style(2))) Preset 7 - $iif($readini(AwaySettings.ini,Presets,7),$gettok($v1,1,126),Not set):away $gettok($readini(AwaySettings.ini,Presets,7),1,126)
  96. }
  97. ; ##############################################
  98. ; # Main Dialog #
  99. ; ##############################################
  100. dialog away {
  101. title Away System Settings
  102. size -1 -1 150 177
  103. option dbu
  104. tab "Basic Settings" 100,0 0 150 156
  105. tab "Exceptions and Messaging" 200,0 0 150 156
  106. Box "Default Away Settings", 2, 4 15 142 45, tab 100
  107. text "Nick:", 1, 8 28 12 10, tab 100
  108. combo 3, 22 26 50 10, drop tab 100
  109. edit "", 5, 75 26 50 10, tab 100
  110. button "?", 6, 130 26 10 10, tab 100
  111. text "Default Away Message:", 24, 8 39 100 10, tab 100
  112. edit "", 25, 8 47 117 10, autohs tab 100
  113. button "?", 26, 130 47 10 10, tab 100
  114. box "Global Options" 4, 4 62 142 92, tab 100
  115. check "A&uto Away After", 7, 12 71 50 10, tab 100
  116. edit "", 8, 63 71 10 10, tab 100
  117. text "minutes.", 9, 75 72.5 40 10, tab 100
  118. button "?", 10, 130 71 10 10, tab 100
  119. button "options", 27, 98 71 30 10, tab 100
  120. check "Show &Leaving Time?" 11, 12 85 60 10, tab 100
  121. edit "" 12, 75 85 50 10, tab 100
  122. button "?", 13, 130 85 10 10, tab 100
  123. check "Show &Time Away?" 14, 12 100 55 10, tab 100
  124. combo 15, 75 100 50 10, drop tab 100
  125. button "?", 16, 130 100 10 10, tab 100
  126. box "Auto Return" 17, 7 115 136 35, tab 100
  127. text "Cancel away on:" 18, 12 125 80 10, tab 100
  128. check "&Channel Message" 19, 60 124 50 10, tab 100
  129. check "&Private Message" 20, 60 134 50 10, tab 100
  130. button "?", 21, 130 134 10 10, tab 100
  131. ;Exception + messaging options: - display only does nothing yet
  132. box "Messaging", 30, 4 15 142 90, tab 200
  133. text "Send messages to:", 31, 8 26 50 10, tab 200
  134. check "All open channels" 32, 60 25 50 10, tab 200
  135. check "All open queries" 33, 60 35 50 10, tab 200
  136. button "?", 34, 130 26 10 10, tab 200
  137. box "Response Messages", 35, 8 48 134 38, tab 200
  138. text "Respond to:", 36, 12 56 50 10, tab 200
  139. check "Channel highlight", 37, 60 55 50 10, tab 200
  140. check "Private message", 38, 60 65 50 10, tab 200
  141. check "Private notice", 39, 60 75 50 10, tab 200
  142. button "?", 40, 130 55 10 10, tab 200
  143. button "Get mIRC hilights", 42, 18 90 50 10, tab 200
  144. button "Modify Hilights", 43, 70 90 50 10, tab 200
  145. button "?", 44, 130 90 10 10, tab 200
  146. box "Exceptions", 45, 4 109 142 24, tab 200
  147. button "Modify Away System Exceptions" 46, 8 118 100 10, tab 200
  148. button "?", 48, 130 118 10 10, tab 200
  149. button "Edit &Presets" 22, 12 159 60 15
  150. button "&Ok" 23, 80 159 60 15, ok
  151. }
  152. ; ##############################################
  153. ; # Custom presets dialog #
  154. ; ##############################################
  155. dialog Custom.Aways {
  156. title Custom Away Messages
  157. size -1 -1 236 110
  158. option dbu
  159. box "Custom Away Triggers" 1, 4 4 227 85
  160. text "Trigger", 2, 16 12 30 10
  161. text "Nick Settings", 3, 50 12 50 10
  162. text "Away Message", 4, 130 12 50 10
  163. list 5, 10 20 30 50
  164. list 6, 40 20 50 50
  165. list 7, 90 20 134 50, autohs
  166. button "Add", 8, 10 70 50 15
  167. button "Edit", 10, 65 70 50 15
  168. button "Delete", 9, 120 70 50 15
  169. button "Clear", 12, 175 70 50 15
  170. button "OK", 11, 90 90 50 15, OK
  171. }
  172. ; ##############################################
  173. ; # Idle Away Settings + Help dialogs #
  174. ; ##############################################
  175. dialog Idle.Away.Settings {
  176. title Idle Away Settings
  177. size -1 -1 120 85
  178. option dbu
  179. box "Idle away settings", 1, 4 4 112 55
  180. text "Nick Settings:", 2, 8 12 50 10
  181. combo 3, 8 20 50 10, drop
  182. edit "", 4, 62 20 50 10
  183. text "Idle away message:", 5, 8 35 50 10
  184. edit "", 6, 8 43 104 10, autohs
  185. button "&Help" 7, 5 65 50 15
  186. button "&Ok", 8, 65 65 50 15, OK
  187. }
  188. Dialog Idle.Away.Help {
  189. title Away System Help
  190. size -1 -1 150 90
  191. option dbu
  192. box "Idle away help", 1, 4 4 142 60
  193. text "Idle away nick and automatic message settings work in the same way as the default away settings in the main dialog, except that they define the settings used when you are automatically set away from Idle" 2, 8 15 133 25
  194. text "you can use %time to refer to the time you must idle before being set as away", 3, 8 45 133 20
  195. button "&Ok", 4, 50 70 50 15, OK
  196. }
  197. ; ##############################################
  198. ; # Preset Settings + Help dialogs #
  199. ; ##############################################
  200. dialog Preset.Settings {
  201. title Preset Settings
  202. size -1 -1 120 100
  203. option dbu
  204. box "Preset settings", 1, 4 4 112 70
  205. text "Trigger:", 2, 8 14 50 10
  206. edit "", 3, 30 13 50 10
  207. text "Nick Settings:", 4, 8 27 50 10
  208. combo 5, 8 35 50 10, drop
  209. edit "", 6, 62 35 50 10
  210. text "Away message:", 7, 8 50 50 10
  211. edit "", 8, 8 58 104 10, autohs
  212. button "&Help" 9, 5 80 50 15
  213. button "&Ok", 10, 65 80 50 15, OK
  214. }
  215. Dialog Preset.Help {
  216. title Away System Help
  217. size -1 -1 150 90
  218. option dbu
  219. box "Presets help", 1, 4 4 142 60
  220. text "Preset nick and Away message settings work in the same way as the default away settings in the main dialog, except that they define the settings used for the preset you are creating" 2, 8 15 133 27
  221. text "To use a preset once you have created it simply type /Away TRIGGER", 3, 8 45 133 20
  222. button "&Ok", 4, 50 70 50 15, OK
  223. }
  224. ; ##############################################
  225. ; # Exceptions dialogs #
  226. ; ##############################################
  227. dialog Away.Exceptions {
  228. title Away System Exceptions
  229. size -1 -1 120 100
  230. option dbu
  231. box "Exceptions" 1, 4 4 112 75
  232. text "Networks" 2, 8 12 50 10, center
  233. list 3, 8 19 50 58
  234. button "Add" 6, 61 20 50 10
  235. button "Delete" 7, 61 34 50 10
  236. button "Edit" 8, 61 49 50 10
  237. button "Clear" 9, 61 63 50 10
  238. button "OK" 10, 35 82 50 15, oks
  239. }
  240. dialog Away.AddException {
  241. title Add Exception
  242. size -1 -1 156 190
  243. option dbu
  244. box "Add Exception" 1, 4 4 148 165
  245. text "Network Name:" 2, 8 16 40 10
  246. edit "" 3, 50 15 60 10
  247. text "If you are unsure of a network name you can type: //echo -a $network in mIRC to view it." 20, 8 30 130 15
  248. box "Exception scope" 4, 8 50 140 55
  249. Text "This exception affects:" 5, 12 60 55 10
  250. radio "Entire network" 6, 69 59 65 10
  251. radio "certain channels only" 7, 69 69 65 10
  252. Text "Enter Channels to be excepted, seperated by spaces." 8, 12 80 130 10
  253. edit "" 9, 12 90 130 10
  254. box "Exception Options" 10, 8 110 140 55
  255. text "On this network:" 11, 12 120 45 10
  256. check "Do not change nick" 12, 55 120 55 10
  257. check "Do not send away messages" 13, 55 130 80 10
  258. check "Do not send hilight responses" 14, 55 140 80 10
  259. check "Do not send PM responses" 15, 55 150 80 10
  260. button "OK" 16, 53 172 50 15, Ok
  261. }
  262. ; ##############################################
  263. ; # Help Dialogs #
  264. ; ##############################################
  265. dialog Away.Help.6 {
  266. title Away System Help
  267. size -1 -1 150 120
  268. option dbu
  269. box "Nick Settings Help", 1, 5 5 140 90
  270. text "Nick PREFIX: Adds the specified text to the FRONT of your nick when going away", 2, 8 15 133 20
  271. text "Nick SUFFIX: Adds the specified text to the END of your nick when going away", 3, 8 35 133 20
  272. text "Set to: Sets your nick to the specified nick when you set away", 4, 9 55 133 20
  273. text "Don’t Change: Means that you’re nick will not change when going away or coming back", 5, 8 75 133 20
  274. button "OK", 7, 50 100 50 15, OK
  275. }
  276. dialog Away.Help.10 {
  277. title Away System Help
  278. size -1 -1 150 90
  279. option dbu
  280. box "Auto Away Help", 1, 5 5 140 60
  281. text "Enabling Auto-Away will automatically set you as away if you are idle for the specified time", 2, 8 15 134 20
  282. text "Time must be between 1 and 60 minutes", 3, 8 35 134 20
  283. text "Options for settings Idle nick and message can be found by clicking the options button", 4, 8 45 134 20
  284. button "OK", 5, 50 70 50 15, ok
  285. }
  286. dialog Away.Help.13 {
  287. title Away System Help
  288. size -1 -1 150 80
  289. option dbu
  290. box "Show Leaving Time Help", 1, 5 5 140 50
  291. 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
  292. button "Click Here for a list of codes used in time format", 3, 8 40 134 10
  293. button "OK", 4, 50 60 50 15, ok
  294. }
  295. dialog Away.Help.16 {
  296. title Away System Help
  297. size -1 -1 150 90
  298. option dbu
  299. box "Show Time Away Help", 1, 5 5 140 60
  300. 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
  301. text "Example of Short format: 5h 6m 10s" 3, 8 40 134 10
  302. text "Example of Medium format: 5hrs 6mins 10secs" 4, 8 48 134 10
  303. text "Example of long format: 5 hours 6 minutes 10 seconds" 5, 8 56 134 10
  304. button "OK", 6, 50 70 50 15, ok
  305. }
  306. dialog Away.Help.21 {
  307. title Away System Help
  308. size -1 -1 150 65
  309. option dbu
  310. box "Automatic Return Help", 1, 5 5 140 35
  311. 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
  312. button "OK", 5, 50 45 50 15, ok
  313. }
  314. dialog Away.Help.26 {
  315. title Away System Help
  316. size -1 -1 150 55
  317. option dbu
  318. box "Default Message Help", 1, 5 5 140 27
  319. text "If you do not enter a reason when going away this default will be used", 2, 8 15 134 20
  320. button "OK", 3, 50 35 50 15, ok
  321. }
  322. dialog Away.Help.34 {
  323. title Away System Help
  324. size -1 -1 150 60
  325. option dbu
  326. box "Message sending help", 1, 5 5 140 32
  327. text "These options refer to weather your away message will be sent to channels and/or Pm's (Queries) when leaving and returning.", 2, 8 15 134 20
  328. button "OK", 3, 50 40 50 15, ok
  329. }
  330. dialog Away.Help.40 {
  331. title Away System Help
  332. size -1 -1 150 80
  333. option dbu
  334. box "Auto Response Help", 1, 5 5 140 50
  335. text "These options refer to what actions will trigger an auto message alerting the person that you are away.", 2, 8 15 134 20
  336. text "Channel highlight is triggered whenever someone says a word that is in your hilights list", 3, 8 35 134 20
  337. button "OK", 4, 50 60 50 15, ok
  338. }
  339. dialog Away.Help.44 {
  340. title Away System Help
  341. size -1 -1 150 120
  342. option dbu
  343. box "Hilight help", 1, 5 5 140 92
  344. text "'Hilight' occurs whenever somebody says a word that is in your hilights list.", 2, 8 15 134 20
  345. text "Your away hilights determine what words, when said, will cause the script to notify the person that you are away, and log the message", 3, 8 31 134 20
  346. text "If you have hilights set in mIRC you can click 'Get mIRC Hilights' to have the away system use these same hilights", 4, 8 54 134 20
  347. text "You may also add or modify seperate ones using the 'Modify Hilights' button. Note that Identifiers such as $me (which refers to your current nick) are also allowed" 5, 8 75 134 20
  348. button "OK", 6, 50 100 50 15, ok
  349. }
  350. dialog Away.Help.48 {
  351. title Away System Help
  352. size -1 -1 150 65
  353. option dbu
  354. box "Exceptions help", 1, 5 5 140 35
  355. text "Exceptions allow you to specify networks/channels in which away messages are not sent, or networks in which your nick is not changed", 2, 8 15 134 25
  356. button "OK", 3, 50 45 50 15, ok
  357. }
  358. dialog Away.Help.Time {
  359. title Away System Help
  360. size -1 -1 150 155
  361. option dbu
  362. box "Time Format Help", 1, 5 5 140 120
  363. text "The following is a list of Codes that can be used in Time Formats", 2, 8 15 134 20
  364. box "Time Format Codes", 3, 8 30 134 88
  365. list 4, 20 40 20 75
  366. list 5, 40 40 90 75
  367. button "OK", 6, 50 130 50 15, ok
  368. }
  369. ; ##############################################
  370. ; # Dialog Initiation events #
  371. ; ##############################################
  372. ; ----- Populate Time help
  373. on *:dialog:Away.Help.Time:init:*: {
  374. did -a $dname 4 HH
  375. did -a $dname 5 Hours - 2 Digit 24 hour time - $time(HH)
  376. did -a $dname 4 H
  377. did -a $dname 5 Hours - 1 Digit 24 hour time - $time(H)
  378. did -a $dname 4 hh
  379. did -a $dname 5 Hours - 2 Digit 12 hour time - $time(hh)
  380. did -a $dname 4 h
  381. did -a $dname 5 Hours - 1 Digit 12 hour time - $time(h)
  382. did -a $dname 4 nn
  383. did -a $dname 5 Minutes - 2 Digit - $time(nn)
  384. did -a $dname 4 n
  385. did -a $dname 5 Minutes - 1 Digit - $time(n)
  386. did -a $dname 4 ss
  387. did -a $dname 5 Seconds - 2 Digit - $time(ss)
  388. did -a $dname 4 s
  389. did -a $dname 5 Seconds - 1 Digit - $time(s)
  390. did -a $dname 4 tt
  391. did -a $dname 5 am/pm - Lower case - $time(tt)
  392. did -a $dname 4 TT
  393. did -a $dname 5 AM/PM - Upper Case - $time(TT)
  394. }
  395. ; ----- Populate main dialog settings
  396. on *:dialog:away:init:*: {
  397. ;Tab 100 Controls
  398. did -a $+ $iif($readini(AwaySettings.ini,Config,NickEditType) == Prefix,c) $dname 3 Prefix
  399. did -a $+ $iif($readini(AwaySettings.ini,Config,NickEditType) == Suffix,c) $dname 3 Suffix
  400. did -a $+ $iif($readini(AwaySettings.ini,Config,NickEditType) == Set to,c) $dname 3 Set to
  401. did -a $+ $iif($readini(AwaySettings.ini,Config,NickEditType) == Don't Change,c) $dname 3 Don't Change
  402. if ($readini(AwaySettings.ini,Config,NickEditType) == Don't Change) did -m $dname 5
  403. if ($readini(AwaySettings.ini,Config,NickPrefix)) && ($did(away,3).seltext == Prefix) did -ra $dname 5 $readini(AwaySettings.ini,Config,NickPrefix)
  404. if ($readini(AwaySettings.ini,Config,NickSuffix)) && ($did(away,3).seltext == Suffix) did -ra $dname 5 $readini(AwaySettings.ini,Config,NickSuffix)
  405. if ($readini(AwaySettings.ini,Config,NickSetTo)) && ($did(away,3).seltext == Set To) did -ra $dname 5 $readini(AwaySettings.ini,Config,NickSetTo)
  406. if ($readini(AwaySettings.ini,Config,AutoAway) == on) did -c $dname 7 | else did -m $dname 8
  407. if ($readini(AwaySettings.ini,Config,AutoAwayTime)) did -a $dname 8 $calc($ifmatch / 60) | else did -a $dname 8 900
  408. if ($readini(AwaySettings.ini,Config,LeavingTime) == on) did -c $dname 11 | else did -m $dname 12
  409. if ($readini(AwaySettings.ini,Config,LeavingTimeFormat)) did -a $dname 12 $ifmatch | else did -a $dname 12 HH:nn:ss
  410. if ($readini(AwaySettings.ini,Config,TimeAway) == on) did -c $dname 14 | else did -b $dname 15
  411. if ($readini(AwaySettings.ini,Config,TimeAwayFormat) == Short) did -ac $dname 15 Short | else did -a $dname 15 Short
  412. if ($readini(AwaySettings.ini,Config,TimeAwayFormat) == Medium) did -ac $dname 15 Medium | else did -a $dname 15 Medium
  413. if ($readini(AwaySettings.ini,Config,TimeAwayFormat) == Long) did -ac $dname 15 Long | else did -a $dname 15 Long
  414. if ($readini(AwaySettings.ini,Config,ARChannelMessage) == on) did -c $dname 19
  415. if ($readini(AwaySettings.ini,Config,ARPrivateMessage) == on) did -c $dname 20
  416. if ($readini(AwaySettings.ini,Config,DefaultMessage)) did -a $dname 25 $ifmatch
  417. ;Tab 200 controls
  418. if ($readini(AwaySettings.ini,Config,MsgChans) == on) did -c $dname 32
  419. if ($readini(AwaySettings.ini,Config,MsgQueries) == on) did -c $dname 33
  420. if ($readini(AwaySettings.ini,Config,RespondHilights) == on) did -c $dname 37
  421. if ($readini(AwaySettings.ini,Config,RespondPM) == on) did -c $dname 38
  422. if ($readini(AwaySettings.ini,Config,RespondNotice) == on) did -c $dname 39
  423. }
  424. ; ----- Populate Custom presets list
  425. on *:dialog:Custom.Aways:init:*: {
  426. var %x = 1
  427. while (%x <= 7) {
  428. if ($readini(AwaySettings.ini,Presets,%x)) {
  429. did -a $dname 5 $gettok($v1,1,126)
  430. did -a $dname 6 $gettok($v1,2,126)
  431. did -a $dname 7 $gettok($v1,3-,126)
  432. }
  433. else halt
  434. inc %x
  435. }
  436. }
  437. ; ----- Populate Idle Away Settings
  438. on *:dialog:Idle.Away.Settings:init:*: {
  439. tokenize 126 $readini(AwaySettings.ini,n,Config,IdleSettings)
  440. did -a $+ $iif($1 == Prefix,c) $dname 3 Prefix
  441. did -a $+ $iif($1 == Suffix,c) $dname 3 Suffix
  442. did -a $+ $iif($1 == Set to,c) $dname 3 Set to
  443. did -a $+ $iif($1 == Don't Change,c) $dname 3 Don't Change
  444. if ($1 == Don't Change) did -m $dname 5
  445. else did -ra $dname 4 $2
  446. if ($3) did -a $dname 6 $3-
  447. }
  448. ; ----- Populate Preset settings
  449. on *:dialog:Away.Preset:init:*: {
  450. if (%Away.EditPreset) {
  451. var %pre = %Away.EditPreset, %trigger = $did(Custom.Aways,5).seltext
  452. var %edittype = $gettok($did(Custom.Aways,6).seltext,1,58), %nickedit = $gettok($did(Custom.Aways,6).seltext,2,58)
  453. var %reason = $did(Custom.Aways,7).seltext
  454. did -a $dname 3 %trigger
  455. did -a $+ $iif(%edittype == Prefix,c) $dname 5 Prefix
  456. did -a $+ $iif(%edittype == Suffix,c) $dname 5 Suffix
  457. did -a $+ $iif(%edittype == Set to,c) $dname 5 Set to
  458. did -a $+ $iif(%edittype == Don't Change,c) $dname 5 Don't Change
  459. if (%edittype == Don't Change) did -m $dname 6
  460. else did -ra $dname 6 %nickedit
  461. if (%reason) did -a $dname 8 %reason
  462. }
  463. else {
  464. did -a $dname 5 Prefix
  465. did -a $dname 5 Suffix
  466. did -a $dname 5 Set to
  467. did -a $dname 5 Don't Change
  468. }
  469. }
  470. ; Exception initiation events
  471. on *:dialog:Away.Exceptions:init:*: {
  472. var %x = 1,%total = $ini(AwaySettings.ini,Exceptions,0)
  473. while (%x <= %total) {
  474. did -a $dname 3 $ini(AwaySettings.ini,Exceptions,%x)
  475. inc %x
  476. }
  477. }
  478. on *:dialog:Away.AddException:init:*: {
  479. if (%Away.Exception) {
  480. var %info = $readini(AwaySettings.ini,Exceptions,%away.Exception)
  481. var %scope = $gettok(%info,1,126), %options = $gettok(%info,2,126), %chans = $gettok(%info,3-,126)
  482. did -a $dname 3 %Away.Exception
  483. if (%scope == 1) {
  484. did -c $dname 6
  485. did -b $dname 9
  486. }
  487. else {
  488. did -c $dname 7
  489. did -b $dname 12,15
  490. did -e $dname 9
  491. did -a $dname 9 %chans
  492. }
  493. if ($left(%options,1) == 1) && (%scope == 1) did -c $dname 12
  494. if ($mid(%options,2,1) == 1) did -c $dname 13
  495. if ($mid(%options,3,1) == 1) did -c $dname 14
  496. if ($right(%options,1) == 1) && (%scope == 1) did -c $dname 15
  497. }
  498. else {
  499. did -c $dname 6
  500. did -b $dname 9
  501. }
  502. }
  503. ; ##############################################
  504. ; # Dialog Sclick Events #
  505. ; ##############################################
  506. ; ----- Open Time Help dialog
  507. on *:dialog:Away.Help.13:sclick:3: {
  508. dialog $iif($dialog(Away.Help.Time),-o,-m) Away.Help.Time Away.Help.Time
  509. dialog -x $dname
  510. }
  511. ; ----- Select same line in each column in time help dialog
  512. on *:dialog:Away.Help.Time:sclick:*: {
  513. if ($did == 4) did -c $dname 5 $did(4).sel
  514. elseif ($did == 5) did -c $dname 4 $did(5).sel
  515. }
  516. ; ----- Processing clicks for main dialog
  517. on *:dialog:away:sclick:*: {
  518. ; Tab 100
  519. if ($did == 3) {
  520. writeini AwaySettings.ini Config NickEditType $did(3).seltext
  521. if ($did(3).seltext == Prefix) did -nra $dname 5 $readini(AwaySettings.ini,Config,NickPrefix)
  522. elseif ($did(3).seltext == suffix) did -nra $dname 5 $readini(AwaySettings.ini,Config,NickSuffix)
  523. elseif ($did(3).seltext == Set to) did -nra $dname 5 $readini(AwaySettings.ini,Config,NickSetTo)
  524. else did -rm $dname 5
  525. }
  526. if ($did == 7) && ($did(7).state == 0) did -m $dname 8
  527. elseif ($did == 7) && ($did(7).state == 1) did -n $dname 8
  528. elseif ($did == 11) && ($did(11).state == 0) did -m $dname 12
  529. elseif ($did == 11) && ($did(11).state == 1) did -n $dname 12
  530. elseif ($did == 14) && ($did(14).state == 0) did -b $dname 15
  531. elseif ($did == 14) && ($did(14).state == 1) did -e $dname 15
  532. elseif ($istok(6|10|13|16|21|26|34|40|44|48,$did,124)) dialog $iif($dialog($+(Away.Help.,$did)),-o,-m) $+(Away.Help.,$did) $+(Away.Help.,$did)
  533. elseif ($did == 22) dialog $iif($dialog(Custom.Aways),-o,-m) Custom.Aways Custom.Aways
  534. elseif ($did == 27) dialog $iif($dialog(Idle.Away.Settings),-o,-m) Idle.Away.Settings Idle.Away.Settings
  535. ; Tab 200
  536. elseif ($did == 42) {
  537. if ($input(Retrieved the following hilights from your current mIRC settings: $crlf $crlf $+ $Get.Highlights $Crlf $crlf $+ Would you like to use these as your away system highlights? You can use the 'Modify Hilights' button to modify or add to these.,yi,Highlights)) {
  538. writeini AwaySettings.ini Config Hilights $Get.Highlights
  539. }
  540. }
  541. elseif ($did == 43) {
  542. var %hilights = $input(Enter Hilight words or identifiers seperated by commans ONLY. $crlf $+ Eg: $+($me,$chr(44),ALTNICK,$chr(44),$ $+ me),oe,Modify Hilights,$readini(AwaySettings.ini,n,Config,Hilights)))
  543. if (%hilights) writeini AwaySettings.ini Config Hilights $remove(%hilights,$chr(32))
  544. else remini Settings.ini Away.Config Hilights
  545. }
  546. elseif ($did == 46) {
  547. dialog $iif($dialog(Away.Exceptions),-v,-m) Away.Exceptions Away.Exceptions
  548. }
  549. }
  550. ; ----- Process button clicks and keep selection of all columns the same in presets dialog
  551. on *:dialog:Custom.Aways:sclick:*: {
  552. if ($did == 5) did -c $dname 6,7 $did(5).sel
  553. elseif ($did == 6) did -c $dname 5,7 $did(6).sel
  554. elseif ($did == 7) did -c $dname 5,6 $did(7).sel
  555. elseif ($did == 8) dialog $iif($dialog(Away.Preset),-v,-m) Away.Preset Preset.Settings
  556. elseif ($did == 9) {
  557. if (!$did(5).sel) var %x = $input(Error: You must select an entry to delete,wo,Invalid Selection)
  558. elseif ($?!="Are you sure you want to delete this entry - $did(5).seltext ") {
  559. did -d $dname 5 $did(5).sel
  560. did -d $dname 6 $did(6).sel
  561. did -d $dname 7 $did(7).sel
  562. }
  563. }
  564. elseif ($did == 10) {
  565. if (!$did(5).sel) { var %x = $input(Error: You must select an entry to edit,wo,Invalid Selection) | halt }
  566. set %Away.EditPreset $did(5).sel
  567. dialog $iif($dialog(Away.Preset),-v,-m) Away.Preset Preset.Settings
  568. }
  569. elseif ($did == 12) {
  570. if ($input(Are you sure you want to clear all your presets?,qy,Validation Prompt)) {
  571. var %x = 7
  572. while (%x > 0) {
  573. did -c $dname 5 %x
  574. if ($did(5).seltext) did -d $dname 5,6,7 $did(5).sel
  575. dec %x
  576. }
  577. }
  578. }
  579. }
  580. ; ----- Process Idle Away clicks/settings
  581. on *:dialog:Idle.Away.Settings:sclick:*: {
  582. var %time = $calc($readini(AwaySettings.ini,Config,AutoAwayTime) / 60)
  583. if ($did == 3) {
  584. if ($did(3).seltext == Don't Change) did -rm $dname 4
  585. else did -n $dname 4
  586. }
  587. elseif ($did == 7) dialog $iif($dialog(Idle.Away.help),-v,-m) Idle.Away.help Idle.Away.Help
  588. }
  589. ; ----- Process Preset dialog clicks/settings
  590. on *:dialog:Away.Preset:sclick:*: {
  591. if ($did == 5) {
  592. if ($did(5).seltext == Don't Change) did -rm $dname 6
  593. else did -n $dname 6
  594. }
  595. elseif ($did == 9) dialog $iif($dialog(Preset.Help),-v,-m) Preset.Help Preset.Help
  596. }
  597. ; ----- Exception Clicks
  598. on *:dialog:Away.Exceptions:sclick:*: {
  599. if ($did == 6) dialog $iif($dialog(Away.AddException),-v,-m) Away.AddException Away.AddException
  600. elseif ($did == 7) {
  601. if (!$did(3).sel) var %x = $input(You must select an entry to delete,wo,Invalid Selection)
  602. elseif ($?!="Are you sure you want to delete this entry - $did(3).seltext ") {
  603. remini AwaySettings.ini Exceptions $did(3).seltext
  604. did -d $dname 3 $did(3).sel
  605. }
  606. }
  607. elseif ($did == 8) {
  608. if (!$did(3).sel) var %x = $input(You must select an entry to edit,wo,Invalid Selection)
  609. else {
  610. set %Away.Exception $did(3).seltext
  611. set %Away.ExceptionNum $did(3).sel
  612. dialog $iif($dialog(Away.AddException),-v,-m) Away.AddException Away.AddException
  613. }
  614. }
  615. elseif ($did == 9) {
  616. if ($input(Are you sure you want to clear all your network exceptions?,qy,Validation Prompt)) {
  617. var %x = $did(3).lines
  618. remini AwaySettings.ini Exceptions
  619. while (%x > 0) {
  620. did -c $dname 3 %x
  621. if ($did(3).seltext) did -d $dname 3 $did(3).sel
  622. dec %x
  623. }
  624. }
  625. }
  626. }
  627. on *:dialog:Away.AddException:Sclick:*: {
  628. if ($did == 6) {
  629. did -e $dname 12,15
  630. did -b $dname 9
  631. did -r $dname 9
  632. }
  633. elseif ($did == 7) {
  634. did -b $dname 12,15
  635. did -e $dname 9
  636. if ($did(12).state == 1) did -u $dname 12
  637. if ($did(15).state == 1) did -u $dname 15
  638. }
  639. }
  640. ; ##############################################
  641. ; # Dialog Close Events #
  642. ; ##############################################
  643. ; ----- Main dialog - save data
  644. on *:dialog:Away:close:*: {
  645. ; tab 100 settings
  646. if ($did(5)) {
  647. if ($did(3).seltext == Prefix) writeini AwaySettings.ini Config NickPrefix $did(5)
  648. elseif ($did(3).seltext == Suffix) writeini AwaySettings.ini Config NickSuffix $did(5)
  649. elseif ($did(3).seltext == Set to) writeini AwaySettings.ini Config NickSetTo $did(5)
  650. }
  651. else {
  652. writeini AwaySettings.ini Config NickPrefix Away|
  653. writeini AwaySettings.ini Config NickSuffix |Away
  654. }
  655. writeini AwaySettings.ini Config AutoAway $iif($did(7).state == 0,off,on)
  656. writeini AwaySettings.ini Config AutoAwayTime $iif($did(8),$calc($did(8) * 60),900)
  657. writeini AwaySettings.ini Config LeavingTime $iif($did(11).state == 0,off,on)
  658. writeini AwaySettings.ini Config LeavingTimeFormat $iif($did(12),$did(12),HH:nn:ss)
  659. writeini AwaySettings.ini Config TimeAway $iif($did(14).state == 0,off,on)
  660. writeini AwaySettings.ini Config TimeAwayFormat $iif($did(15),$did(15),Shorts)
  661. writeini AwaySettings.ini Config ARChannelMessage $iif($did(19).state == 0,off,on)
  662. writeini AwaySettings.ini Config ARPrivateMessage $iif($did(20).state == 0,off,on)
  663. if ($did(25)) writeini AwaySettings.ini Config DefaultMessage $did(25)
  664. else remini Settings.ini Away.Config DefaultMessage
  665. if ($readini(AwaySettings.ini,Config,AutoAway) == on) .timerAway.IdleCheck -o 0 30 Away.IdleCheck
  666. elseif ($timer(Away.IdleCheck)) .timerAway.IdleCheck off
  667. ;Tab 200 settings
  668. writeini AwaySettings.ini Config MsgChans $iif($did(32).state == 0,off,on)
  669. writeini AwaySettings.ini Config MsgQueries $iif($did(33).state == 0,off,on)
  670. writeini AwaySettings.ini Config RespondHilights $iif($did(37).state == 0,off,on)
  671. writeini AwaySettings.ini Config RespondPM $iif($did(38).state == 0,off,on)
  672. writeini AwaySettings.ini Config RespondNotice $iif($did(39).state == 0,off,on)
  673. }
  674. ; ----- Save presets
  675. on *:dialog:Custom.Aways:close:*: {
  676. var %x = 1, %lines = $did(5).lines
  677. while (%x <= %lines) {
  678. did -c $dname 5,6,7 %x
  679. writeini AwaySettings.ini presets %x $+($did(5).seltext,~,$did(6).seltext,~,$did(7).seltext)
  680. inc %x
  681. }
  682. dec %x
  683. while (%x < 7) {
  684. inc %x
  685. if ($readini(AwaySettings.ini,presets,%x)) remini AwaySettings.ini Presets %x
  686. }
  687. }
  688. ; ----- Save Idle away settings
  689. on *:dialog:Idle.Away.Settings:close:*: {
  690. writeini AwaySettings.ini Config IdleSettings $+($did(3).seltext,~,$iif($did(4),$ifmatch,IDLE),~,$iif($did(6),$ifmatch,Auto away after % $+ time minutes idle))
  691. }
  692. ; ----- Save Preset settings
  693. on *:dialog:Away.Preset:close:*: {
  694. var %pre = %away.EditPreset
  695. if (!$did(3)) var %x = $input(Error: No trigger was specified,ow,Input Error)
  696. elseif (!$did(6)) && ($did(5).seltext != Don't Change) var %x = $input(Error: You did not specify $iif($did(5).seltext,a nick $iif($did(5).seltext == set to,to change to,$ifmatch),any nick settings),ow,Input Error)
  697. elseif ($remove($did(6),$chr(91),$chr(93),$chr(92),$chr(45),$chr(95),$chr(123),$chr(124),$chr(125)) !isalnum) && ($did(6)) { var %x = $input(Error: Invalid Characters detected in specified nick,wo,Input Error) | halt }
  698. elseif (!$did(5).seltext) var %x = $input(Error: You have not specified how to change your nick - Select an option from the nick settings drop down,ow,Error)
  699. elseif ($numtok($did(3),32) > 1) || ($numtok($did(6),32) > 1) var %x = $input(Error: Trigger and nick Settings can each only be one word long,wo,Input Error)
  700. else {
  701. did $iif(%pre,-o,-a) Custom.Aways 5 $iif(%pre,%pre) $did(3)
  702. did $iif(%pre,-o,-a) Custom.Aways 6 $iif(%pre,%pre) $did(5).seltext $+ $iif($did(5).seltext != Don't Change,: $did(6))
  703. did $iif(%pre,-o,-a) Custom.Aways 7 $iif(%pre,%pre) $did(8)
  704. unset %away.EditPreset
  705. }
  706. }
  707. ; ---- Save Exception settings
  708. on *:dialog:Away.AddException:close:*: {
  709. if (!$did(3)) var %x = $input(No Network name was entered,wo,Input Error)
  710. elseif ($numtok($did(3),32) > 1) var %x = $input(Network name may not contain spaces,wo,Input Error)
  711. else {
  712. var %scope = $iif($did(6).state == 1,1,2)
  713. var %x = 1, %numchans = $numtok($did(9),32)
  714. while (%x <= %numchans) {
  715. var %token = $gettok($did(9),%x,32)
  716. if (#?* iswm %token) var %chans = %chans %token
  717. elseif (%token != $chr(35)) var %chans = %chans $+($chr(35),%token)
  718. inc %x
  719. }
  720. var %x = 12
  721. while (%x <= 15) {
  722. var %options = %options $+ $did(%x).state
  723. inc %x
  724. }
  725. did $iif(%Away.ExceptionNum,-o,-a) Away.Exceptions 3 $iif(%Away.ExceptionNum,$ifmatch) $did(3)
  726. writeini AwaySettings.ini Exceptions $did(3) $+(%scope,~,%options,~,%chans)
  727. unset %Away.Exception*
  728. }
  729. }
  730. ; ##############################################
  731. ; # /Away And /back aliases #
  732. ; ##############################################
  733. alias away {
  734. ; ----- Unset Idle timer, Get highlights, enable #away group for logging etc
  735. if ($timer(Away.IdleCheck)) .timerAway.IdleCheck off
  736. set %Away.Hilights $readini(awaySettings.ini,n,Config,Hilights)
  737. .enable #away
  738. ; ---- Retrieve away settings from config/User entry
  739. var %time = $calc($readini(AwaySettings.ini,Config,AutoAwayTime) / 60)
  740. if ($1) set %away.Reason $1-
  741. elseif ($readini(AwaySettings.ini,Config,DefaultMessage)) set %away.Reason $v1
  742. set %Away.LeftAt $ctime
  743. if ($readini(AwaySettings.ini,Config,LeavingTime) == on) {
  744. var %LeavingTimeFormat = $readini(AwaySettings.ini,Config,LeavingTimeFormat)
  745. set %away.LeaveTime $time(%LeavingTimeFormat)
  746. }
  747. ; ---- Check for idleaway
  748. If ($1- = Auto.Idle.Away) {
  749. var %IdleInfo = $readini(AwaySettings.ini,Config,IdleSettings)
  750. var %edittype = $gettok(%IdleInfo,1,126)
  751. if (%edittype == Set to) var %nickset = $gettok(%IdleInfo,2,126)
  752. else var %nickadd = $gettok(%IdleInfo,2,126)
  753. set %Away.Reason $($gettok(%IdleInfo,3-,126),2)
  754. }
  755. else {
  756. var %edittype = $readini(AwaySettings.ini,Config,NickEditType)
  757. if (%edittype == Set To) var %nickset = $readini(AwaySettings.ini,Config,NickSetTo)
  758. else var %nickadd = $readini(AwaySettings.ini,Config,Nick $+ %edittype)
  759. }
  760. ; ----- Check for presets
  761. var %x 1
  762. while (%x <= 7) {
  763. if ($readini(AwaySettings.ini,Presets,%x)) {
  764. var %preset = $v1
  765. if ($1- == $gettok(%preset,1,126)) {
  766. var %edittype = $gettok($gettok(%preset,2,126),1,58)
  767. var %nickadd = $remove($gettok($gettok(%preset,2,126),2,58),$chr(32))
  768. set %Away.Reason $gettok(%preset,3-,126)
  769. set %Away.Preset %x
  770. var %x = 7
  771. }
  772. }
  773. inc %x
  774. }
  775. ; ----- Cycle Connections to change nick/send msg
  776. var %x = 1, %connections = $scon(0)
  777. while (%x <= %connections) {
  778. scon %x
  779. if ($status == connected) {
  780. unset %Except.*
  781. if ($readini(AwaySettings.ini,Exceptions,$network)) {
  782. var %Except.info = $v1
  783. var %Except.Scope = $gettok(%Except.info,1,126)
  784. var %Except.Options = $gettok(%Except.info,2,126)
  785. if (%Except.Scope == 2) && ($mid(%Except.Options,2,1) == 1) var %Except.NoMsgChans = $gettok(%Except.Info,3-,126)
  786. if (%Except.Scope == 1) && ($left(%Except.Options,1) == 1) var %Except.NoNickChange = 1
  787. if (%Except.Scope == 1) && ($mid(%Except.Options,2,1) == 1) var %Except.NoAwayMsg = 1
  788. }
  789. set $+(%,Away.Oldnick.,$network) $me
  790. if ($readini(AwaySettings.ini,Config,NickEditType) != Don't Change) && (!%Except.NoNickChange) {
  791. if (%edittype == Set To) && (%NickSet != $me) var %newnick = %NickSet
  792. if (%edittype == Prefix) && ($+(%nickadd,*) !iswm $me) var %newnick = $+(%nickadd,$me)
  793. if (%edittype == Suffix) && ($+(*,%nickadd) !iswm $me) var %newnick = $+($me,%nickadd)
  794. set $+(%,Away.Newnick.,$network) $iif(%newnick,$ifmatch,$me)
  795. if (%newnick) nick %newnick
  796. }
  797. if ($chan(0)) && ($readini(AwaySettings.ini,Config,MsgChans) == on) && (!%Except.NoAwayMsg) {
  798. var %Chan = 1, %TotalChans = $chan(0)
  799. while (%chan <= %TotalChans) {
  800. if (!$istok(%Except.NoMsgChans,$chan(%chan),32)) describe $chan(%chan) $awaycolor1(is now away) $awaycolor2( $iif(%Away.Reason,- %Away.Reason)) $awaycolor3( $iif(%Away.leavetime,- Left at %Away.Leavetime)))
  801. inc %chan
  802. }
  803. }
  804. if ($readini(AwaySettings.ini,Config,MsgQueries) == on) && (!%Except.NoAwayMsg) {
  805. qme $awaycolor1(is now away) $awaycolor2( $iif(%Away.Reason,- %Away.Reason) $awaycolor3( $iif(%Away.leavetime,- Left at %Away.Leavetime))) }
  806. !away Away: $iif(%Away.Reason,- %Away.Reason) $iif(%Away.leavetime,- Left at %Away.Leavetime)
  807. }
  808. inc %x
  809. }
  810. }
  811. alias back {
  812. var %x = 1, %connections = $scon(0)
  813. while (%x <= %connections) {
  814. scon %x
  815. if ($status == connected) {
  816. unset %Except.*
  817. if ($readini(AwaySettings.ini,Exceptions,$network)) {
  818. var %Except.info = $v1
  819. var %Except.Scope = $gettok(%Except.info,1,126)
  820. var %Except.Options = $gettok(%Except.info,2,126)
  821. if (%Except.Scope == 2) && ($mid(%Except.Options,2,1) == 1) var %Except.NoMsgChans = $gettok(%Except.Info,3-,126)
  822. if (%Except.Scope == 1) && ($left(%Except.Options,1) == 1) var %Except.NoNickChange = 1
  823. if (%Except.Scope == 1) && ($mid(%Except.Options,2,1) == 1) var %Except.NoAwayMsg = 1
  824. }
  825. if (!%Except.NoNickChange) && ($($+(%,Away.Oldnick.,$network),2)) nick $ifmatch
  826. ; ----- Cycle Connections to change nick/send msg
  827. if ($chan(0)) && ($readini(AwaySettings.ini,Config,MsgChans) == on) && (!%Except.NoAwayMsg) {
  828. var %Chan = 1, %TotalChans = $chan(0)
  829. while (%chan <= %TotalChans) {
  830. if (!$istok(%Except.NoMsgChans,$chan(%chan),32)) describe $chan(%chan) $awaycolor1(is back) $awaycolor2( $iif(%away.Reason,- from %Away.Reason)) $awaycolor3( $iif(%Away.Leavetime,- Left at %Away.Leavetime)) $awaycolor4( $iif($Away.GoneFor,- Gone for $Away.GoneFor))
  831. inc %chan
  832. }
  833. }
  834. if ($readini(AwaySettings.ini,Config,MsgQueries) == on) && (!%Except.NoAwayMsg) {
  835. qme $chan(%chan) $awaycolor1(is back) $awaycolor2( $iif(%away.Reason,- from %Away.Reason)) $awaycolor3( $iif(%Away.Leavetime,- Left at %Away.Leavetime)) $awaycolor4( $iif($Away.GoneFor,- Gone for $Away.GoneFor))
  836. }
  837. !away
  838. }
  839. inc %x
  840. }
  841. .disable #away
  842. unset %away.*
  843. if ($hget(Away.PM.Responses)) || ($hget(Away.Highlight.Responses)) hfree -w Away.*.Responses
  844. if ($readini(AwaySettings.ini,Config,AutoAway) == on) .timerAway.IdleCheck -o 0 30 Away.IdleCheck
  845. }
  846. ; ##############################################
  847. ; # Other Aliases #
  848. ; ##############################################
  849. alias -l Away.Gonefor {
  850. if ($readini(AwaySettings.ini,Config,TimeAway) == on) {
  851. var %TimeAwayFormat = $readini(AwaySettings.ini,Config,TimeAwayFormat)
  852. if (%Away.LeftAt) {
  853. var %duration = $duration($calc($ctime - %Away.LeftAt),%TimeAwayFormat)
  854. if (%TimeAwayFormat == Short) return $Short.Duration(%duration)
  855. elseif (%TimeAwayFormat == medium) return %duration
  856. elseif (%TimeAwayFormat == long) return $Long.Duration(%duration)
  857. }
  858. }
  859. else return $false
  860. }
  861. 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)
  862. alias -l Long.Duration return $replacex($1-,sec,second,secs,seconds,min,minute,mins,minutes,hr,hour,hrs,hours,wk,week,wks,weeks)
  863. alias -l Get.Highlights {
  864. var %x = 1, %Groups = $ini(mirc.ini,highlight,0)
  865. while (%x <= %groups) {
  866. var %Away.Highlights = $addtok(%Away.highlights,$highlight(%x),44)
  867. inc %x
  868. }
  869. return %Away.Highlights
  870. }
  871. alias -l Check.For.highlights {
  872. if (!%Away.Highlights) set %Away.Highlights $readini(AwaySettings.ini,n,Config,Hilights)
  873. var %x = 1, %highlights = $numtok(%Away.highlights,44)
  874. while (%x <= %highlights) {
  875. var %chighlight = $($gettok(%Away.Highlights,%x,44),2)
  876. if ($istok($1-,%chighlight,32)) return %chighlight
  877. inc %x
  878. }
  879. return $false
  880. }
  881. alias -l Away.Logwin {
  882. if (!$window(@Away.Logs)) window -eknz @Away.Logs
  883. echo -ti2 @Away.Logs $1-
  884. }
  885. alias -l Highlight.Response {
  886. if (!$hget(Away.highlight.Responses,$+($1,.,$2))) {
  887. scid $1 .notice $2 $awaycolor1(I am currently away) $awaycolor2( $iif(%Away.Reason,- %Away.Reason)) $awaycolor3( $iif(%Away.LeaveTime,- Left at %Away.LeaveTime)) $awaycolor1( $iif($away.gonefor,- Gone for $away.gonefor)) - $awaycolor2(One time response to highlight)
  888. hadd -m Away.Highlight.Responses $+($1,.,$2) 1
  889. }
  890. }
  891. alias -l Private.Message.Response {
  892. if (!$hget(Away.PM.Responses,$+($1,.,$2))) {
  893. 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
  894. hadd -m Away.PM.Responses $+($1,.,$2) 1
  895. }
  896. }
  897. alias -l Away.IdleCheck {
  898. var %x = 1, %networks = $scon(0)
  899. var %AutoAwayTime = $readini(AwaySettings.ini,Config,AutoAwayTime)
  900. while (%x <= %networks) {
  901. scon %x {
  902. if ($status == Connected) && ($idle < %AutoAwayTime) var %Idle = off
  903. }
  904. inc %x
  905. }
  906. if (%idle != off) away Auto.Idle.Away
  907. }
  908. alias Away.Config dialog $iif($dialog(Away),-v,-m) Away Away
  909. ; ##############################################
  910. ; # Logging and hilight resposes #
  911. ; ##############################################
  912. #away off
  913. ;Hilight responses
  914. on *:text:*:#: {
  915. if (!$Check.For.highlights($1-)) && (!$istok($1-,$me,32)) && (!$istok($1-,$($+(%,Away.Oldnick.,$network),2),32)) return
  916. else {
  917. Away.Logwin 4[10CHANNEL MESSAGE4] $+(4[10,$iif($scon(0) > 1,$+($network,12/10)),$chan,12/10,$nick,4]) $1-
  918. if ($readini(AwaySettings.ini,Exceptions,$network)) {
  919. var -s %Except.info = $v1
  920. var -s %Except.Scope = $gettok(%Except.info,1,126), %Except.Options = $gettok(%Except.info,2,126)
  921. if (%Except.Scope == 2) && ($mid(%Except.Options,3,1) == 1) var %Except.NoHilight = $gettok(%Except.Info,3-,126)
  922. elseif (%Except.Scope == 1) && ($mid(%Except.Options,3,1) == 1) return
  923. }
  924. if (!$istok(%Except.NoHilight,$chan,32)) && ($readini(AwaySettings.ini,Config,RespondHilights) == on) Highlight.Response $cid $nick
  925. }
  926. }
  927. on *:action:*:#: {
  928. if (!$check.for.highlights($1-)) && (!$istok($1-,$me,32)) && (!$istok($1-,$($+(%,Away.Oldnick.,$network),2),32)) return
  929. else {
  930. Away.Logwin 4[10CHANNEL  10ACTION4] $+(4[10,$iif($scon(0) > 1,$+($network,12/10)),$chan,12/10,$nick,4]) * $nick $1-
  931. if ($readini(AwaySettings.ini,Exceptions,$network)) {
  932. var %Except.info = $v1
  933. var %Except.Scope = $gettok(%Except.info,1,126), %Except.Options = $gettok(%Except.info,2,126)
  934. if (%Except.Scope == 2) && ($mid(%Except.Options,3,1) == 1) var %Except.NoHilight = $gettok(%Except.Info,3-,126)
  935. elseif (%Except.Scope == 1) && ($mid(%Except.Options,3,1) == 1) return
  936. }
  937. if (!$istok(%Except.NoHilight,$chan,32)) && ($readini(AwaySettings.ini,Config,RespondHilights) == on) Highlight.Response $cid $nick
  938. }
  939. }
  940. ; Private notice response
  941. on *:notice:*:?: {
  942. if (*serv !iswm $nick) {
  943. Away.Logwin 4[10PRIVATE NOTICE4] $+(4[10,$iif($scon(0) > 1,$+($network,12/10)),Private,12/10,$nick,4]) $1-
  944. if ($readini(AwaySettings.ini,Exceptions,$network)) {
  945. var %Except.info = $v1
  946. var %Except.Scope = $gettok(%Except.info,1,126), %Except.Options = $gettok(%Except.info,2,126)
  947. if (%Except.Scope == 1) && ($right(%Except.Options,1) == 1) return
  948. }
  949. if ($readini(AwaySettings.ini,Config,RespondNotice) == on) Private.Message.Response $cid $nick
  950. }
  951. }
  952. ;PM responses
  953. on *:text:*:?: {
  954. if ($readini(AwaySettings.ini,Config,RespondPM) == on) && (*serv !iswm $nick) {
  955. if ($readini(AwaySettings.ini,Exceptions,$network)) {
  956. var %Except.info = $v1
  957. var %Except.Scope = $gettok(%Except.info,1,126), %Except.Options = $gettok(%Except.info,2,126)
  958. if (%Except.Scope == 2) && ($mid(%Except.Options,3,1) == 1) var %Except.NoHilight = $gettok(%Except.Info,3-,126)
  959. elseif (%Except.Scope == 1) && ($right(%Except.Options,1) == 1) return
  960. }
  961. Private.Message.Response $cid $nick
  962. }
  963. }
  964. ;Return from away on input if set
  965. on *:input:#: {
  966. if ($left($1,1) != $readini(mirc.ini,text,commandchar)) {
  967. if ($readini(AwaySettings.ini,Config,ARChannelMessage) == on) back
  968. }
  969. }
  970. on *:input:?: {
  971. if ($left($1,1) != $readini(mirc.ini,text,commandchar)) {
  972. if ($readini(AwaySettings.ini,Config,ARPrivateMessage) == on) back
  973. }
  974. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement