Advertisement
Guest User

Untitled

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