home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / gz-311a.zip / gemz2fp.irc < prev    next >
Text File  |  1999-03-21  |  284KB  |  9,727 lines

  1. ^set preparse_aliases 1
  2.  
  3. @ gemz.ver = [3.11]
  4. @ gemz.rel = [3.21]
  5. @ gemz.patch = [1]
  6. #@ beta = [YES]
  7. ^assign -beta
  8. eval if (!gemzloaded) {
  9.  @ logging = [OFF]
  10.  @ publogging = [OFF]
  11.  @ srand($time())
  12.  eval load $exedir/gemzpos.sav
  13.  eval if (!gzdefault.pos) {//window 1 show 1}
  14.  /set client_stage 2
  15. }{@ reloading = 1}
  16.  
  17. #************************************************************
  18. # GemZ/2 For OpenChat/2 1.07 by gemini
  19. #    email: gemini@silcom.com
  20. # There is no copyright, credit should be given where credit is
  21. # due. If I was worried about copying, I wouldn't distribute.
  22. # Note:  Thanks to those who have helped and given me ideas.
  23. # Credits:  *mikh for the best irc client, for helping me out,
  24. #            and for incredible userlist code.
  25. #           *Everyone who has contributed ideas and was not
  26. #            Stingy with their thoughts.
  27. #************************************************************
  28. ^set input_prompt ░░░░░░░░░░░░░░░░░░░░0% (Initializing Script)
  29. load mmpm.api
  30. load file.api
  31. load ctcpsnd.api
  32. load botlist.api
  33. load modeq.api
  34. # Initialization 
  35. ^set AUTO_WHOWAS OFF
  36. ^set BEEP_ON_MSG NONE
  37. ^set BEEP_TYPE 800 150
  38. ^set CNTLC_COLORS on
  39. ^set COPY_WITH_COLORS OFF
  40. ^set COPY_STRIP_CNTLCXX ON
  41. ^set COPY_TRANSLATE_USER_COLORS ON
  42. ^set CLOCK ON
  43. ^set DCC_BURST_MODE is ON
  44. ^set DCC_BLOCK_SIZE is 4096
  45. ^set DROP_DRAW_HINTS ON
  46. ^set DROP_USE_LINK ON
  47. ^set DROP_HINTS_COLOR 4 2
  48. ^set DRIVE_LETTERS ON
  49. ^set EPIC_PARSE_QUOTES ON
  50. ^set EPIC_PARSER ON
  51. ^set EXEC_PROTECTION OFF
  52. ^set FLOOD_CHECK_HOST ON
  53. ^set FLOOD_CHECK_USER ON
  54. ^set HIDE_PRIVATE_CHANNELS OFF
  55. ^set INDENT ON
  56. ^set INPUT_ALIASES OFF
  57. ^set JOIN_NEW_WINDOW OFF
  58. ^set LOGFILE_STRIP_COLORS ON
  59. ^set MODE_STRIPPER ON
  60. ^set NEW_TIMER_BEHAVOR ON
  61. ^set NICKLIST_SORT ON
  62. ^set NOVICE OFF
  63. ^set SHOW_AWAY_ONCE on
  64. ^set SHOW_NUMERICS_STR ~h■■■~0 
  65. ^set STICKY_CN ON
  66. ^set TAB ON
  67. ^set TAB_MAX 100
  68. #^set TRANSLATION LATIN_1
  69. ^set USERMODE -s+i
  70. ^set VERBOSE_CTCP OFF
  71.  
  72. @ _bkgd = [─]
  73. @ OS2 = 1
  74. ##################################################################
  75. # GemZ Custom Configuration settings                             #
  76. # These are default and are changed by the setup menu and /save  #
  77. ##################################################################
  78.  
  79. #GemZ Path settings.
  80. @ autojoinlist = [#os/2 #OpenChat]
  81. @ gzsavefile =[$exedir/gemz.sav]
  82. @ gemzsaveback =[$exedir/gemzsave.bak]
  83. @ gzuserlist =[$exedir/gemzuser.sav]
  84. @ gemzcolorfile = [$exedir/colors.gmz]
  85. @ gemz.urlfile = [$exedir/gemzurl.htm]
  86. @ MSGLOGFILE = [$exedir/messages.log]
  87. @ actionsfile = [$exedir/script2/actplug.gmz]
  88. @ gz.emailclient = []
  89. @ gz.emaildir = []
  90. @ gz.logdir = [$exedir/logs]
  91.  
  92. #these haven't chagned to gz.<var> yet.
  93. @ defkickf = []
  94. @ nck.buf = mid(0 3 $N)
  95. @ imageviewer = [ib]
  96. @ XDCCWinFont = [6x14]
  97. @ gemz.long = [NO]
  98. @ CTCPVERS = [ON]
  99. @ NICKCOMPLETION = [ON]
  100. @ USEMSGLOGFILE = [NO]
  101. @ SHOWMSGTIME = [OFF]
  102. @ SHOWPUBTIME = [OFF]
  103. @ MSGBEEPS = [OFF]
  104. @ ajoinfriends = [NO]
  105. @ loadacts = [YES]
  106. @ hourlytime = [ON]
  107. @ autodccst = [ON]
  108. @ re.connect = [ON]
  109. @ ctcpsound = [ON]
  110. @ ctcpsndreq = [ON]
  111. @ autotalklogging = [OFF]
  112. #GemZ Numerical values
  113. @ gz.astime      = 30
  114. @ gz.awaytime    = 15
  115. @ gz.bantimeout  = 30
  116. @ gz.dcctimeout  = 5
  117. @ gz.delayoptime = 4
  118. @ gz.igtimeout   = 3
  119. @ gz.maxrelms    = 5
  120. @ gz.maxwins     = 10
  121.  
  122. #GemZ toggles will move from being ON/OFF to 0/1 (Slow transition)
  123. @ gz.longcsc = 1
  124.  
  125. @ gz.altstatus     = 0
  126. @ gz.autorejoin    = 1
  127. @ gz.ansi          = 1
  128. @ gz.autochat      = 0
  129. @ gz.autosave      = 0
  130. @ gz.autotalk      = 0
  131. @ gz.autotalkfg    = 0
  132. @ gz.awaymsglog    = 1
  133. @ gz.awaypublog    = 1
  134. @ gz.beep          = 1
  135. @ gz.confirm       = 1
  136. @ gz.halfhour      = 0
  137. @ gz.inputchan     = 1
  138. @ gz.loadextras    = 1
  139. @ gz.loghilites    = 0
  140. @ gz.localoper     = 0
  141. @ gz.mircsndpatch  = 0
  142. @ gz.nicklist      = 1
  143. @ gz.nicklock      = 0
  144. @ gz.noctcpaway    = 0
  145. @ gz.ovts          = 0
  146. @ gz.notifyoper    = 1
  147. @ gz.playifplaying = 1
  148. @ gz.qaway         = 0
  149. @ gz.qaaway        = 0
  150. @ gz.sounds        = 1
  151. @ gz.timestamps    = 1
  152. @ gz.topictitle    = 0
  153. @ gz.useclock      = 0
  154. @ gz.usekfile      = 0
  155.  
  156. ###########################
  157. ###CONVERT OLD VARIABLES###
  158. ###########################
  159. alias update_vars {
  160.  if (autorejoin) {@ gz.autorejoin = _bool($autorejoin);^assign -autorejoin}
  161.  if (longcsc) {@ gz.longcsc = _bool($longcsc);^assign -longcsc}
  162.  if (usekfile) {@ gz.usekfile = _bool($usekfile);^assign -usekfile}
  163.  if (autotalkwin) {@ gz.autotalk = _bool($autotalkwin);^assign -autotalkwin}
  164.  if (autochatwin) {@ gz.autochat = _bool($autochatwin);^assign -autochatwin}
  165.  if (inputchan) {@ gz.inputchan = _bool($inputchan);^assign -inputchan}
  166.  if (showtimestamps) {@ gz.timestamps = _bool($showtimestamps);^assign -showtimestamps}
  167.  if (qaaway) {@ gz.qaaway = _bool($qaaway);^assign -qaaway}
  168.  if (maxrelms) {@ gz.maxrelms = maxrelms;^assign -maxrelms}
  169.  if (auto_away >= 0) {@ gz.awaytime = auto_away;^assign -auto_away}
  170.  if (quietaways) {@ gz.qaway = _bool($quietaways);^assign -quietaways}
  171.  if (altstatus) {@ gz.altstatus = _bool($altstatus);^assign -altstatus}
  172.  if (autosave) {@ gz.autosave = _bool($autosave);^assign -autosave}
  173.  if (autosavetime) {@ gz.astime = autosavetime;^assign autosavetime}
  174.  if (gemzsounds) {@ gz.sounds = _bool($gemzsounds);^assign -gemzsounds}
  175.  if (useclock) {@ gz.useclock = _bool($useclock);^assign -useclock}
  176.  if (mircsndpatch) {@ gz.mircsndpatch = _bool($mircsndpatch);^assign -mircsndpatch}
  177.  if (ov.timestamp) {@ gz.ovts = _bool($ov.timestamp);^assign -ov.timestamp}
  178.  if (beep) {@ gz.beep = _bool($beep);^assign -beep}
  179.  @ gz.localoper = _bool($gz.localoper)
  180.  @ gz.nicklist = _bool($gz.nicklist)
  181.  @ gz.loadextras = _bool($gz.loadextras)
  182.  @ gz.nicklock = _bool($gz.nicklock)
  183.  @ gz.awaymsglog = _bool($gz.awaymsglog)
  184.  @ gz.awaypublog = _bool($gz.awaypublog)
  185.  @ gz.halfhour = _bool($gz.halfhour)
  186.  foreach gx stem {
  187.   if (gx[$stem] == [ON]) {@ gx[$stem] = 1}
  188.   else if (gx[$stem] == [OFF]) {@ gx[$stem] = 0}
  189.  }
  190.  ^assign -stem
  191. }
  192.  
  193. #Sounds support
  194. @ sounddir        = [$exedir/sounds]
  195. @ snd.msg         = []
  196. @ snd.dccgetfin   = []
  197. @ snd.dccsendfin  = []
  198. @ snd.sentdccreq  = []
  199. @ snd.gotdccreq   = []
  200. @ snd.pub         = []
  201. @ snd.mekick      = []
  202. @ snd.youkick     = [$sounddir/momo2.wav]
  203. @ snd.kick        = [$sounddir/moo.wav]
  204. @ snd.away        = []
  205. @ snd.back        = []
  206. @ snd.wkill       = []
  207. @ snd.wopen       = []
  208. @ snd.notify      = []
  209. @ snd.notifyoff   = []
  210. @ snd.chat        = []
  211. @ snd.chatconnect = []
  212. @ snd.sendconnect = []
  213. @ snd.getconnect  = []
  214. @ snd.hilitelist  = []
  215. @ snd.newmail     = []
  216. @ snd.join        = []
  217.  
  218.  
  219. ^set input_prompt ░░░░░░░░░░░░░░░░░░░░1% (Initializing Script)
  220. #Status bar
  221. ^set color_status 70
  222. ^set color_status_b f7
  223. ^set color_status_d 88
  224. ^set draw_status_borders on
  225. ^set color_input 07
  226. ^set clock on
  227. ^eval ^set status_format <gz $gemz.ver> %H%@%N%*%# %A %Q%C%+ %Z %>%4%0
  228. ^set titlebar_format [%R]%c%Y[%s][%1]
  229. #^eval ^set status_user <lag: 0>
  230. ^eval ^set status_user1 GemZ_$gemz.ver
  231. ^set status_clock [%T]
  232. ^set status_hold_lines [scroll: %B] 
  233. ^set status_channel on %C
  234. ^set status_channel2 [on %c]
  235. ^set status_waiting_channel [Joining %J]
  236. ^set status_query Queried: %Q
  237. ^set status_away lurking
  238. ^set status_hold [---- Press enter to continue ----] 
  239. ^set status_chanop @
  240. ^set status_notify  [─][%F]
  241. ^eval ^assign gemz.vers GemZ/2 v${gemz.ver} \(%${gemz.rel}#${gemz.patch}\)
  242. ^eval ^set client_information $gemz.vers
  243. ^set status_away lurking
  244.  
  245. ^set color_user_0 07
  246. ^set color_user_1 02
  247. ^set color_user_2 06
  248. ^set color_user_3 0B
  249. ^set color_user_4 09
  250. ^set color_user_5 09
  251. ^set color_user_6 09
  252. ^set color_user_7 0B
  253. ^set color_user_8 0F
  254. ^set color_user_9 09
  255. ^set color_user_10 06
  256. ^set color_user_11 09
  257. ^set color_user_12 09
  258. ^set color_user_13 09
  259. ^set color_user_14 0E
  260. ^set color_user_15 0F
  261. ^set color_user_16 03
  262. ^set color_user_17 09
  263. ^set color_user_18 0F
  264. ^set color_user_19 0F
  265. ^set color_user_20 0B
  266. ^set color_user_21 0D
  267. ^set color_user_22 0D
  268. ^set color_user_23 0E
  269. ^set color_user_24 0B
  270. ^set color_user_25 0C
  271. ^set color_user_26 09
  272. ^set color_user_27 0C
  273. ^set color_user_28 07
  274. ^set color_user_29 09
  275. ^set color_user_30 07
  276. ^set color_user_31 0D
  277. ^set color_user_32 0B
  278. ^set color_user_33 03
  279. ^set color_user_34 0F
  280. ^set color_user_35 0F
  281. ^set color_user_36 0F
  282. ^set color_user_37 0A
  283. ^set color_user_38 08
  284. ^set color_user_39 04
  285. ^set color_user_40 09
  286. ^set color_user_41 0A
  287. ^set color_user_42 0B
  288. ^set color_user_43 08
  289. ^set color_user_44 0E
  290. ^set color_user_45 02
  291. ^set color_user_46 04
  292. ^set color_user_47 02
  293. ^set color_user_48 02
  294. ^set color_user_48 02
  295. ^set color_user_49 03
  296. ^set color_user_50 08
  297. ^set color_user_51 0B
  298. ^set color_user_52 05
  299. ^set color_user_53 0A
  300. ^set color_user_54 03
  301. ^set color_user_55 0F
  302. ^set color_user_56 09
  303. ^set color_user_57 0A
  304. ^set color_user_58 02
  305. ^set color_user_59 03
  306. ^set color_user_60 1F
  307. ^set color_user_61 0A
  308. ^set color_user_62 02
  309. ^set color_user_63 02
  310. ^set color_user_64 04
  311. #65-74 are user reserved
  312. ^set color_user_75 8B
  313. ^set color_user_76 85
  314. ^set color_user_77 81
  315. ^set color_user_78 84
  316. ^set color_user_79 80
  317. ^set color_user_80 04
  318. ^set color_user_81 05
  319. ^set color_user_82 06
  320. ^set color_user_83 05
  321. ^set color_user_84 03
  322. ^set color_user_85 0B
  323. ^set color_user_86 0A
  324.  
  325.  
  326. #0
  327. @ cl = [~0]
  328. @ gc.action = [~1]
  329. @ gc.ctcp = [~2]
  330. @ gc.ctcpban = [~3]
  331. @ gc.ctcpnk = [~4]
  332. @ gc.dcc = [~5]
  333. @ gc.error = [~6]
  334. @ gc.errortopic = [~7]
  335. @ gc.inviteech = [~8]
  336. @ gc.invitenk = [~9]
  337. #10
  338. @ gc.join = [~A]
  339. @ gc.joinuh = [~B]
  340. @ gc.kickc = [~C]
  341. @ gc.kickn = [~D]
  342. @ gc.kicked =  [~E]
  343. @ gc.kill = [~F]
  344. @ gc.killnk = [~G]
  345. @ gc.mode = [~H]
  346. @ gc.modenk = [~I]
  347. @ gc.msg = [~J]
  348. #20
  349. @ gc.msguh = [~K]
  350. @ gc.msgloginfo = [~L]
  351. @ gc.msgbrac = [~M]
  352. @ gc.nick = [~N]
  353. @ gc.nickchg = [~O]
  354. @ gc.notice = [~P]
  355. @ gc.notify = [~Q]
  356. @ gc.peren = [~R]
  357. @ gc.pub = [~S]
  358. @ gc.pubbrac = [~T]
  359. #30
  360. @ gc.pubmsg = [~U]
  361. @ gc.sendout = [~V]
  362. @ gc.section = [~W]
  363. @ gc.sign = [~X]
  364. @ gc.smsg = [~Y]
  365. @ gc.split = [~Z]
  366. @ gc.spub = [~a]
  367. @ gc.topic = [~b]
  368. @ gc.topicchan = [~c]
  369. @ gc.wis = [~d]
  370. #40
  371. @ gc.wisinfo = [~e]
  372. @ gc.wisname = [~f]
  373. @ gc.nickpubmsg = [~g]
  374. @ gc.gecho = [~h]
  375. @ gc.help = [~i]
  376. @ gc.modehack = [~j]
  377. @ gc.outline = [~k]
  378. @ gc.dccbar = [~l]
  379. @ gc.time = [~m]
  380. @ gc.nickaction = [~n]
  381. #50
  382. @ gc.glkind = [~o]
  383. @ gc.gldata = [~p]
  384. @ gc.glborder = [~q]
  385. @ gc.gxnick = [~r]
  386. @ gc.gxitem = [~s]
  387. @ gc.gxdata = [~t]
  388. @ gc.gxtitle = [~u]
  389. @ gc.chops = [~v]
  390. @ gc.lamers = [~w]
  391. @ gc.cscborder = [~x]
  392. #60
  393. @ gc.msginfo = [~y]
  394. @ gc.msgfrom = [~z]
  395. @ gc.msgchan = [~!]
  396. @ gc.host = [~@]
  397. @ gc.bracket = [~#]
  398. @ gc.user1 = [~\$]
  399. @ gc.user2 = [~\%]
  400. @ gc.user3 = [~\^]
  401. @ gc.user4 = [~\&]
  402. @ gc.user5 = [~\*]
  403. #70
  404. @ gc.user6 = [~\(]
  405. @ gc.user7 = [~\)]
  406. @ gc.user8 = [~\-]
  407. @ gc.user9 = [~\+]
  408. @ gc.user0 = [~\|]
  409. @ gc.sjoin = [~$chr(128)]
  410. @ gc.spart = [~$chr(129)]
  411. @ gc.smode = [~$chr(130)]
  412. @ gc.skick = [~$chr(131)]
  413. @ gc.squit = [~$chr(132)]
  414. #80
  415. @ gc.hilitepubmsg = [~$chr(133)]
  416. @ gc.swall = [~$chr(134)]
  417. @ gc.swallmsg = [~$chr(135)]
  418. @ gc.left = [~$chr(136)]
  419. @ gc.opernick = [~$chr(137)]
  420. @ gc.operuh = [~$chr(138)]
  421. @ gc.ovserv = [~$chr(139)]
  422.  
  423.  
  424. # CNTRL_C COLORS
  425. assign blu 01
  426. assign grn 02
  427. assign cyn 03
  428. assign red 04
  429. assign mag 05
  430. assign yel 06
  431. assign wht 07
  432. assign blk 08
  433. assign bblu 09
  434. assign bgrn 0A
  435. assign bcyn 0B
  436. assign bred 0C
  437. assign bmag 0D
  438. assign byel 0E
  439. assign bwht 0F
  440.  
  441.  
  442. # Echo Strings 
  443. ^eval ^assign gemz ${gc.gecho}■■■${cl}
  444. ^assign gemz.act *
  445. ^assign gemz.str .gz.
  446. ^assign gemz.usage ***
  447. ^eval ^assign gemzov.str \\[\$bgrn\ov${cl}\\]\
  448. alias gecho xecho -level crap $gemz $*
  449. alias gbecho xecho -b -level crap $gemz $*
  450. alias gtecho xecho -target $0 $gemz $1-
  451. alias gtbecho xecho -b -target $0 $gemz $1-
  452. alias gaecho xecho -level crap $gemz.act $*
  453. alias gnecho xecho -level crap $*
  454. alias guecho xecho -level crap $gemz.usage $*
  455.  
  456. # configurable strings (more to be added later).
  457. @ str.away = [has set away!]
  458. @ str.back = [has returned.]
  459. @ str.autoaway = [auto away after idling]
  460.  
  461. # binds 
  462. bind  SELF_INSERT
  463. #bind ^[ erase_line
  464. bind ^_ self_insert
  465. bind ^B self_insert
  466. bind ^C self_insert
  467. bind ^K parse_command //join -invite
  468. bind ^R scroll_end
  469. bind ^E scroll_backward
  470. bind ^F parse_command wholeft
  471. bind ^D scroll_forward
  472. bind ^D parse_command ^pubreply
  473. bind ^T parse_command ^togtitle
  474. bind ^W parse_command ^setwall
  475. bind ^V self_insert
  476. bind ^X next_window
  477. bind F1 parse_command /help
  478. bind F2 parse_command if (C) {_nltog $C}{//^window nicklist off}
  479. bind F3 parse_command if (gz.longcsc) {/csc}{/cnames}
  480. bind F4 parse_command //^set nicklist_sort ${(nicklist_sort+1) % 3}
  481. bind F5 parse_command /gl
  482. bind F10 parse_command /clear
  483. bind f11 parse_command _doclose
  484. bind f12 parse_command _doget
  485. bind alt-f12 parse_command _doresume
  486.  
  487. bind alt-1 parse_command //^window show 1
  488. bind alt-2 parse_command //^window show 2
  489. bind alt-3 parse_command //^window show 3
  490. bind alt-4 parse_command //^window show 4
  491. bind alt-5 parse_command //^window show 5
  492. bind alt-6 parse_command //^window show 6
  493. bind alt-7 parse_command //^window show 7
  494. bind alt-8 parse_command //^window show 8
  495. bind alt-9 parse_command //^window show 9
  496. bind alt-a parse_command away
  497. bind alt-b parse_command back -f
  498. bind alt-c parse_command if (C) {chanmenu $C}{gecho No channel in current Window}
  499. bind alt-l parse_command gz.showsubjects
  500. bind alt-n next_window
  501. bind alt-p previous_window
  502. bind alt-t parse_command togtitle
  503. bind alt-w parse_command windowlist command
  504. bind Alt-F4 parse_command //window kill
  505. bind Alt-F5 parse_command //window setwindowpos r 0 0 0 0
  506. bind Alt-F9 parse_command //window setwindowpos m 0 0 0 0
  507. bind Alt-F10 parse_command //window setwindowpos M 0 0 0 0
  508. bind Shift-F1 parse_command /nick $gz.randnick()
  509. bind Shift-F8 parse_command smartpaste
  510. bind end end_of_line
  511. bind Alt-End scroll_end
  512.  
  513. ^set input_prompt ░░░░░░░░░░░░░░░░░░░░2% (General Aliases)
  514. ######################################################
  515. # Aliases In (mostly) Alphabetical Order (hopefully) #
  516. ######################################################
  517. alias .send quote PRIVMSG $0 :$cntl2mirc(f0 $1-)
  518. alias .not quote NOTICE $0 :$cntl2mirc(f0 $1-)
  519. alias _bool {@ function_return = [${match($0 ON YES 1 TRUE Y T) >= 1}]}
  520.  
  521. alias saysend {
  522.  .send $0-
  523.  fe ($unparse($0)) _s {
  524.   xecho -target $_s ${gc.pubbrac}<${gc.spub}$N${gc.pubbrac}>${cl} $1-
  525.  }
  526.  ^assign -_s
  527. }
  528.  
  529. #a#
  530. alias addhilite {
  531.  if ([$0]) {
  532.   if ([$0]==[-n]) {
  533.    push hilitelist $1
  534.    gecho \$1\ added to the hilite list.
  535.   }{
  536.    if (match($0 $hilitelist)) {
  537.     gecho a matching highlite string was found, to force
  538.     gecho a new highlight, use /addhilite -n <string>
  539.    }{
  540.     push hilitelist $0
  541.     gecho \$0\ added to the hilite list.
  542.    }
  543.   }
  544.  }{
  545.   gecho Usage: /addhilite <word/filter>
  546.  }
  547. }
  548.  
  549. alias addignore /ignore $*
  550.  
  551. alias addnotify {
  552.  if ([$0]) {
  553.   notify $0
  554.  }{gecho Usage: /addnotify <nick1>}
  555. }
  556.  
  557. alias addajoin {
  558.  if ([$0]) {
  559.   if (!match($0 $autojoinlist)) {
  560.    gecho $0 Added to the Auto Join Channel list.  (/save to save settings)
  561.    push autojoinlist $0
  562.    makejoinmenu
  563.   }{
  564.    gecho $0 already in the Auto Join Channel list.
  565.   }
  566.  }{gecho Usage: /addajoin <Channel>}
  567. }
  568.  
  569. alias addajoinkey {
  570.  if ([$1]) {
  571.   if (match($0 $autojoinlist)) {
  572.    @ ajkeys[$%0] = [$1]
  573.    gecho Key: $1 added for Autojoin channel $0
  574.    makejoinmenu
  575.   }{
  576.    gecho $0 needs to be added to the autojoin list first
  577.   }
  578.  }{
  579.   gecho Usage: /addajoinkey <#channel> <key>
  580.  }
  581. }
  582.  
  583. alias unajoinkey {
  584.  if ([$0]) {
  585.   if (ajkeys[$%0]) {
  586.    ^assign -ajkeys.$%0
  587.    gecho Key removed for $0
  588.   }{
  589.    gecho No Key set for $0
  590.   }
  591.  }{
  592.   gecho Usage: /unajoinkey <#channel>
  593.  }
  594. }
  595.  
  596. alias initnotify {//^notify $0}
  597.  
  598. on ^msg "*GemZ/2 is keeping me anti*" #
  599. on ^send_msg "*GemZ/2 is keeping me anti*" #
  600. alias aioff {gecho Anit-Idle is now off!;^alias antiidle {}}
  601. alias aion {
  602.  gecho Anti-Idle Activated!
  603.  gecho Anti-Idle will prevent you from idling on irc by sending
  604.  gecho messages to the anti-idle channel..
  605.  ^alias antiidle {
  606.   msg $N GemZ/2 is keeping me anti-idle!
  607.   gecho Server Anti-Idle Message sent.
  608.   #join #!!!ANTI-IDLE!!!
  609.   #wait -CMD *Anti-Idle* GemZ is keeping me anti-idle!
  610.   ^timer 480 antiidle
  611.  }
  612.  /antiidle
  613. }
  614. alias addlchan {
  615.  if ([$0] && ischannel($0)) {
  616.   push lchanlist $0
  617.   gecho \$0\ added to the leech channel list
  618.  }{gecho usage /addlchan <#channel>}
  619. }
  620.  
  621. alias unlchan {
  622.  if ([$0]) {
  623.   if (match($0 $lchanlist)) {
  624.    @ lchanlist = stripw($0 $lchanlist)
  625.    gecho \$0\ removed from the leech channel list
  626.   }{gecho \$0\ not in the leech channel list}
  627.  }{gecho Usage /unlchan <#channel>}
  628. }
  629.  
  630. alias showhilite {
  631.  if (hilitelist) {
  632.   gecho HiliteList Words or filters.
  633.  }{
  634.   gecho Hilitelist is empty
  635.  }
  636.  fe ($hilitelist) _h.1 _h.2 _h.3 _h.4 {
  637.   gecho $[15]_h.1 $[15]_h.2 $[15]_h.3 $[15]_h.4
  638.  }
  639.  if (hilitelist) {
  640.   gecho End of list
  641.  }
  642.  purge _h
  643. }
  644.  
  645.  
  646. alias showlchan {
  647.  gecho Leech Channel list:
  648.  fe ($lchanlist) _l.1 _l.2 _l.3 _l.4 _l.5 {gecho $_l.1 $_l.2 $_l.3 $_l.4 $_l.5}
  649.  purge _l
  650.  gecho End of list
  651. }
  652.  
  653. alias away {
  654.  if (gz.awaymsglog) {setlog ON}
  655.  if (gz.awaypublog) {setpublog ON}
  656.  switch ($0) {
  657.   (-c) {gz.subaway $*}
  658.   (-q) {gz.subaway $*}
  659.   (-n) {gz.subaway $*}
  660.   (-p) {gz.subaway $*}
  661.   (*) {
  662.    if (gz.qaway) {gz.subaway -q $*}
  663.    else {gz.subaway -n $*}
  664.   }
  665.  }
  666.  ^hook gzaway
  667.  gz.playsnd away
  668. }
  669.  
  670. ^set input_prompt ▒░░░░░░░░░░░░░░░░░░░5% (General Aliases)
  671. #b#
  672.  
  673.  
  674. alias back {
  675.  setlog off
  676.  setpublog off
  677.  @ away = 0
  678.  ^hook gzlog off
  679.  if ([$0]==[-f]) {
  680.   if (gz.qaway) {
  681.    gecho Quietly Setting you back.
  682.   }{
  683.    mme $str.back $gemz.str
  684.   }
  685.  }{
  686.   if ([$msglog_cnt++] >= [1]) {
  687.    if ([$word(0 $"Play stored messages? (N/y)? ")]==[Y]) {readlog}
  688.    if ([$word(0 $"Remove Message log? (Y/n)? ")]!=[N]) {remlog}
  689.   }
  690.   @ arg1 = [$0]
  691.   switch ($arg1) {
  692.    (-q) {gecho Quietly Setting you back.}
  693.    (-c) {gecho Channel Setting you back.;if (arg1) {me $str.back \($1-\) $gemz.str}{me $str.back $gemz.str}}
  694.    (*) {
  695.     if (gz.qaway) {
  696.      gecho Quietly Setting you back.
  697.     }{
  698.      if (arg1) {mme $str.back \($0-\) $gemz.str}{mme $str.back $gemz.str}
  699.     }
  700.    }
  701.   }
  702.   ^assign -arg1
  703.   gecho ${gc.msgloginfo}Message Logging has been turned off${cl}
  704.  }
  705.  //away -all
  706.  @ _waway = time() - awaytime
  707.  ^hook gzback $tdiff($_waway)
  708.  if (awaytime) {
  709.   gecho You were away for $tdiff($_waway)
  710.  }
  711.  ^assign -_waway
  712.  ^assign -awaytime
  713. }
  714.  
  715. ### on input kick reason or empty, returns unchanged kick reason if params
  716. ### not empty or generates a krad random one from gemz kickfile or from
  717. ### hardcoded ones...
  718.  
  719. alias _kick_reason {
  720.  if ([$0] != []) {
  721.   @function_return = [$0]
  722.  }
  723.  else if (gz.usekfile && file.exist($defkickf)) {
  724.   @function_return = randread("$defkickf")
  725.  }
  726.  else {
  727.   @ kick.msg = rand($numkick)
  728.   @function_return = [$kick[$kick.msg] $gemz.str]
  729.   ^assign -kick.msg
  730.  }
  731. }
  732.  
  733. # ------------- start of ripped LiCe /kk /k and /ban --------------------
  734. #
  735. # frog gave me persimission to rip this, probably he was drunk 
  736. # or something but who cares :)
  737. #
  738. # It is haxored a little to use internal cache instead of /userhost where 
  739. # possible
  740.  
  741. # $_cluster(n!u@h / u@h / h) changes the n!u@h pattern to a format
  742. # suitable for bans, userlist, etc... (Author SrfRoG)
  743. alias _cluster {
  744.   @ _c_h = []
  745.   @ _c_u = [*]
  746.   if (index(! $0) != -1) {
  747.     @ _c_t = mid(${index(! $0)+1} ${@0-index(! $0)+1} $0)
  748.     @ _c_u = left($index(@ $_c_t) $_c_t)
  749.     while (index($[1]_c_u -+~) > -1) {@ _c_u = mid(1 ${@_c_u - 1} $_c_u)}
  750.     @ _c_h = mid(${index(@ $_c_t)+1} 80 $_c_t)
  751.     ^assign -_c_t
  752.   }{if (index(@ $0) != -1) {
  753.     @ _c_u = left($index(@ $0) $0)
  754.     while (index($[1]_c_u -+~) > -1) {@ _c_u = mid(1 ${@_c_u - 1} $_c_u)}
  755.     @ _c_h = mid(${index(@ $0)+1} 80 $0)
  756.   }{@ _c_h = [$0]}}
  757.   while (@_c_u > 8) {@ _c_u = mid(1 10 $_c_u)}
  758.   if (index($right(1 $_c_h) 0123456789) != -1)
  759.     {@ function_return = [$_c_u@$mid(0 ${rindex(. $_c_h)+1} $_c_h)]##[*]}
  760.     {if (index(. $_c_h) == rindex(. $_c_h))
  761.     {@ function_return = [$_c_u@*$_c_h]}
  762.     {@ function_return = [$_c_u@*$mid($index(. $_c_h) 80 $_c_h)]}
  763.   }
  764.   ^assign -_c_h
  765.   ^assign -_c_u
  766. }
  767.  
  768. # Multi-Purpose KICK command. (Orig. SrfRoG)
  769.  
  770. alias kk {
  771.   if ([$P]==[@]) {
  772.   if ([$[1]0]==[-]) {
  773.     @ _k.o = mid(1 5 $0)
  774.     @ _k.a = left($index(: $1-) $1-)
  775.     @ _k.m = mid(${index(: $1-) + 1} 80 $1-)
  776.   }{
  777.     @ _k.a = left($index(: $0-) $0-)
  778.     @ _k.m = mid(${index(: $0-) + 1} 80 $0-)
  779.   }
  780.   if ([$_k.m]==[]) {@ _k.m = _kick_reason()}{
  781.     if (index( $_k.m) >= 0) @_k.m = cntl2mirc(f0 $_k.m)
  782.   }
  783.   modeq.init
  784.   for (@ _k.c = 0, word($_k.c $_k.a), @ _k.c = _k.c + 1) {
  785.     @ _k.t = word($_k.c $_k.a)
  786.     switch ($_k.t) {
  787.     (*!*@*) {}
  788.     (*@*) {
  789.         if (left(1 $_k.t) == [*]) @ _k.t = [*!$_k.t]
  790.         else @ _k.t = [*!*$_k.t]
  791.     }
  792.     (*) {
  793.         @ _k.t = [$_k.t!*@*]
  794.     }
  795.     }
  796.     fe ($chanusers($C 3 $_k.t)) xx {
  797.       if (ischanop($N $C) && (xx!=N || !_k.o)) {
  798.         @ _k.u = nickdata($C $xx)
  799.         fec ($_k.o) o {
  800.       switch ($o) {
  801.             (b) {modeq.addban $C *!*$_cluster($_k.u)}
  802.             (c) {modeq.addban $C *!*@*$mid($rindex(. $_k.u) 4 $_k.u)}
  803.             (h) {modeq.addban $C *!$_cluster($_justhost($_k.u))}
  804.             (u) {modeq.addban $C *!*$left($index(@ $_k.u) $_k.u)@*}
  805.       }
  806.         }
  807.         if (ischanop($XX $C) && index(bchu $_k.o) >= 0) modeq.add_mode -o $xx
  808.         if (onchannel($XX $C)) {modeq.add_kick $XX $_k.m}
  809.       }
  810.     }
  811.     ^assign -XX
  812.   }
  813.   modeq.apply_modes $C
  814.   purge _k
  815.   }{echo $SHOW_NUMERICS_STR\You are not channel operator on $C\.}
  816. }
  817.  
  818. alias k {
  819.  if ([$[1]0]==[-])
  820.  {if ([$2]) {kk $0 $1 :$2-}{kk $0 $1 :$_kick_reason()}}
  821.  {if ([$1]) {kk $0 :$1-}{kk $0 :$_kick_reason()}}
  822. }
  823. alias kb if ([$1]) {kk -b $0 :$1-}{kk -b $0 :$_kick_reason()}
  824. alias ks if ([$1]) {kk -hu $0 :$1-}{kk -hu $0 :$_kick_reason()}
  825.  
  826. $0 == channel, $1 == userhost, $2 == nick, $3 == type
  827. alias _do_ban if (ischanop($N $0)) {
  828.     modeq.init
  829.     if ([$3]) {
  830.         switch ($3) {
  831.                 (c) {modeq.addban $0 *!*@*$mid($rindex(. $1) 4 $1)}
  832.                 (h) {modeq.addban $0 *!$_cluster($_justhost($1))}
  833.                 (u) {modeq.addban $0 *!*$left($index(@ $1) $1)@*}
  834.         }
  835.     }{
  836.         modeq.addban $0 *!*$_cluster($1)
  837.     }
  838.         if (ischanop($2 $0)) {modeq.add_mode -o $2}
  839.     modeq.apply_modes $0
  840. }
  841.  
  842. $0 == channel, $1 == userhost, $2 == nick, $3 == type
  843. alias _do_ban if (ischanop($N $0)) {
  844.     modeq.init
  845.     if ([$3]) {
  846.         switch ($3) {
  847.                 (c) {modeq.addban $0 *!*@*$mid($rindex(. $1) 4 $1)}
  848.                 (h) {modeq.addban $0 *!$_cluster($_justhost($1))}
  849.                 (u) {modeq.addban $0 *!*$left($index(@ $1) $1)@*}
  850.         }
  851.     }{
  852.         modeq.addban $0 *!*$_cluster($1)
  853.     }
  854.         if (ischanop($2 $0)) {modeq.add_mode -o $2}
  855.     modeq.apply_modes $0
  856. }
  857.  
  858. # User Ban/RBan functions. (Orig. by SrfRoG)
  859. alias ban {
  860.   if ([$P]==[@]) {
  861.     if ([$0]) {
  862.       ^assign opt $1
  863.       if (!rmatch($0 *!* *@* *.*)) {
  864.         @ t.found = 0
  865.     fe ($mychannels()) t.ch {
  866.             if (onchannel($0 $t.ch)) {
  867.             @ t.found = t.ch
  868.             break
  869.         }
  870.     }    
  871.     if (t.found && (t.u = nickdata($t.found $0)) != [<UNKNOWN>]) {
  872.         _do_ban $C $t.u $0 $1
  873.     }{
  874.             userhost $0 -cmd _ban_uh $$* $C $1
  875.       }
  876.       }{    
  877.     modeq.init
  878.     fe ($0-) ban.host {
  879.         if (index(@ $ban.host) == -1) {
  880.             @ban.host = [$[1]ban.host]==[*]?[*!*@$ban.host]:[*!*@*$ban.host]
  881.         }{
  882.             if (index(! $ban.host) == -1) {
  883.                 @ban.host = [$[1]ban.host]==[*]?[*!$ban.host]:[*!*$ban.host]
  884.             }
  885.         }
  886.         modeq.addban $C $ban.host
  887.     }
  888.     modeq.apply_modes $C
  889.       }
  890.     }{echo Usage: /BAN <nick> [type]}
  891.   }{echo $SHOW_NUMERICS_STR\You are not channel operator in $C\.}
  892.   purge t
  893. }
  894.  
  895. alias _ban_uh if ([$4]!=[<UNKNOWN>]) {
  896.     _do_ban $5 $3@$4 $0 $6
  897. }{
  898.     echo $SHOW_NUMERICS_STR$0: No such nick
  899. }
  900.  
  901. alias banstat {
  902.  if ([$0]) {
  903.   if (match($0 $mychannels())) {
  904.    if (chanmode($0 1)) {
  905.     mode $0 +b
  906.    }{gecho There are no Bans in $0}
  907.   }{
  908.    gecho You are not in $0
  909.   }
  910.  }{if (C) {banstat $C}{gecho You are not in a channel}}
  911. }
  912.  
  913. alias beep {if (match($0 ON OFF)) {^set beep $toupper($0);@ gz.beep = _bool($0)};gecho Beep is now set to ${gz.beep ? [ON] : [OFF]}}
  914. alias bk {if ([$0]) {k -b $0 $1-}{gecho Usage /bk <nick> [<reason>]}}
  915. alias bki kbi $*
  916. alias kbi {if ([$0]) {/k -b $0 $1-;ig $0 ALL}{gecho Usage /kbi <nick> [<reason>]}}
  917. alias bkip kbip $*
  918. alias kbip {if ([$0]) {/k -b $0 $1-;ig $0 -d ALL}{gecho Usage /kbip <nick> [<reason>]}}
  919. alias bye si $*
  920. #c#
  921.  
  922. alias cgset {cset $0;cset $0 $"Enter new Value (Enter=NoChange) : "}
  923.  
  924. alias c {mode $C $*}
  925. alias clearsc {//clear -scrollback}
  926.  
  927. alias _chan {
  928. # quick and dirty little function to return a channel name from a string...
  929. # this will _only_ return names of channels you are currently in!
  930. # -- asmodean <asmodean@terror.phantasy.com>
  931.   for (@ __i = 0, word($__i $mychannels()), @ __i = __i + 1) {
  932.     @ __t[$struct($word($__i $mychannels()))] = 1
  933.   }
  934.  ^assign -__i
  935.   @ __j = struct($mid($index(&# $*) 256 $*))
  936.   fec ($__j) __a __b {
  937.     @ __k = __k ## __a ## __b
  938.     if (__t[$__k]) {@ function_return = decode($__k)}
  939.   }
  940.  ^assign -__j;^assign -__k;^assign -__a;^assign -__b
  941.   purge __t
  942. }
  943.  
  944. alias caway {away -c $*}
  945. alias cback {back -c $*}
  946.  
  947. alias chanppl {
  948.  if (C) {
  949.   @ _ppl.oper = 0
  950.   @ _ppl.ops = 0
  951.   @ _ppl.total = 0
  952.   @ _ppl.voice = 0
  953.   ^on ^raw_irc "% 352 *" {
  954.    @ _ppl.total++
  955.    if (index(@ $8) >= 0) {@ _ppl.ops++}
  956.    if (index(* $8) >= 0) {@ _ppl.oper++}
  957.    if (index(+ $8) >= 0) {@ _ppl.voice++}
  958.    if (!_ppl.placer) {gtecho $3 Detailed List for $C\}
  959.    @ _ppl.placer = 1
  960.    gtecho $3 [$[4]8] $gz.finline(65 $7\!$gz.finuh($4 $5)\ $6)
  961.   }
  962.   ^on ^raw_irc "% 315 *" {
  963.    gtecho $3 End of List for $3\... Opers: $_ppl.oper\ Ops: $_ppl.ops\ voice: $_ppl.voice\ Total: $_ppl.total\
  964.    purge _ppl
  965.    ^on ^raw_irc -"% 315 *"
  966.    ^on ^raw_irc -"% 352 *"
  967.   }
  968.  //quote WHO $C
  969.  }{
  970.   gecho You are not on a channel
  971.  }
  972. }
  973.  
  974. alias chat {
  975.  if (gz.chatwinstat($0) == 0) {
  976.   /talk \=$0 $1
  977.   ^on ^window_kill "=$0_Queried" {
  978.    nochat $0
  979.    //window refnum \=$0_Queried kill
  980.    ^on ^window_kill -"$0" 
  981.   }
  982.  }
  983.  switch ($gz.chatstat($0)) {
  984.   (0) {//window show =$0_Queried;//dcc chat $0}
  985.   (1) {//window show =$0_Queried;gecho Waiting for party to respond...}
  986.   (2) {//window show =$0_Queried}
  987.   (3) {//window show =$0_Queried;//dcc chat $0}
  988.  }
  989. }
  990.  
  991. alias clearnotifylist {}
  992. alias clist {
  993. #ripped from KMP fixed the mispelling in "colour" :P
  994.   gbecho 08╒══════════════════════════════════════════════════════════════════════╕
  995.   gbecho 08│ [0FOS308] 07ircII color list for momos.  0FUsage08:07 01^C09XY 07where 09X07 is the back- 08 │
  996.   gbecho 08│ 07ground color, 09Y07 the foreground.    0Fie08: 07^C49 is 49 Bright Blue on Red 08  │
  997.   gbecho 08╞═══╤═════════╤═══╤════════════════╦╦═══╤═════════╤═══╤════════════════╡
  998.   gbecho 08│08 0 08│08 Black   08│80 8 08│80 Bright Black   08║║08 0 08│00 Black   08│08 8 08│08 Bright Black   08│
  999.   gbecho 08│19 1 08│19 Blue    08│91 9 08│91 Bright Blue    08║║01 1 08│01 Blue    08│09 9 08│09 Bright Blue    08│
  1000.   gbecho 08│2A 2 08│2A Green   08│A2 A 08│A2 Bright Green   08║║02 2 08│02 Green   08│0A A 08│0A Bright Green   08│
  1001.   gbecho 08│3B 3 08│3B Cyan    08│B3 B 08│B3 Bright Cyan    08║║03 3 08│03 Cyan    08│0B B 08│0B Bright Cyan    08│
  1002.   gbecho 08│4C 4 08│4C Red     08│C4 C 08│C4 Bright Red     08║║04 4 08│04 Red     08│0C C 08│0C Bright Red     08│
  1003.   gbecho 08│5D 5 08│5D Magenta 08│D5 D 08│D5 Bright Magenta 08║║05 5 08│05 Magenta 08│0D D 08│0D Bright Magenta 08│
  1004.   gbecho 08│6E 6 08│6E Yellow  08│E6 E 08│E6 Bright Yellow  08║║06 6 08│06 Yellow  08│0E E 08│0E Bright Yellow  08│
  1005.   gbecho 08│7F 7 08│7F White   08│F7 F 08│F7 Bright White   08║║07 7 08│07 White   08│0F F 08│0F Bright White   08│
  1006.   gbecho 08╘═══╧═════════╧═══╧════════════════╩╩═══╧═════════╧═══╧════════════════╛
  1007. }
  1008. #cached /names
  1009. alias cnames {
  1010.  if ([$0]) {
  1011.   if (ischannel($0)) {
  1012.    if (onchannel($N $0)) {
  1013.     gtecho $0 $0: $_cnames($0)
  1014.    }{gecho You are not on $0}
  1015.   }{gecho $0 is not a valid channel;gecho Usage: /cnames [<#channel>]}
  1016.  }{
  1017.   if (C) {
  1018.    gecho $C: $_cnames($C)
  1019.   }{gecho You are not on any channels}
  1020.  }
  1021. }
  1022.  
  1023. alias _cnames {
  1024.  fe ($chanusers($0)) _cn.ch {
  1025.   if (ischanop($_cn.ch $0)) {
  1026.    @ _cn.no #= [ @$_cn.ch]
  1027.   }{
  1028.    @ _cn.nv #= isvoice($_cn.ch $0) ? [ +$_cn.ch] : [ $_cn.ch]
  1029.   }
  1030.  }
  1031.  @ function_return = [${gc.chops}$_cn.no${cl}${gc.lamers}$_cn.nv$_cn.nl${cl}]
  1032.  purge _cn
  1033. }
  1034.  
  1035.  
  1036. alias creseti {/c -inst+mlk 40 resetting;/c +inst-mlk resetting}
  1037. alias creset {/c -nst+milk 40 resetting;/c +nst-milk resetting}
  1038. alias ctcpreply if ([$0]) {gecho ${gc.ctcpban}ctcp${cl}: ${gc.ctcp}$tolower($1) reply${cl} from ${gc.ctcpnk}$0${cl}: $2-}
  1039. alias ctcpreq if ([$0]) {gecho ${gc.ctcpban}ctcp${cl}: ${gc.ctcp}$tolower($2) request${cl} from ${gc.ctcpnk}$0${cl} ${gc.peren}\(${gc.ctcpnk}$userhost()${gc.peren}\)${cl} to ${gc.ctcpnk}$1${cl}}
  1040. alias cwait {wait -CMD #;wait -CMD $0-}
  1041. # Cycle written by mikh
  1042. alias cycle {
  1043.  if ([$0]) {
  1044.   if (onchannel($N $0)) {
  1045.    @ _gk.t = key($0)
  1046.    //leave $0
  1047.    ^hook gzcycle $0
  1048.    if (chanwindow($0)) {
  1049.     wait -cmd //window $chanwindow($0) channel $0
  1050.     if (_gk.t) {//quote JOIN $0 $_gk.t}
  1051.    }{
  1052.     wait -cmd //quote JOIN $0 $_gk.t
  1053.    }
  1054.   }{
  1055.    gecho ${gc.errortopic}You are not on channel $0 ${cl}
  1056.   }
  1057.   ^purge _gk
  1058.  }{
  1059.   if (C) {
  1060.    cycle $C
  1061.   }{
  1062.    gecho ${gc.errortopic}You are not on any channel in this window${cl}
  1063.   }
  1064.  }
  1065. }
  1066. #csc written by mikh, enhanced by gemini
  1067. alias csc {
  1068.  if ([$0] && onchannel($N $0)) {
  1069.   @ _co.t = #chanusers($C)_co.u
  1070.   fe ($gz.chanops($0)) _co.tn {@ _co.co #= _co.co ? [ @$_co.tn] : [@$_co.tn]}
  1071.   fe ($gz.voices($0)) _co.tn {@ _co.v #= _co.v ? [ +$_co.tn] : [+$_co.tn]}
  1072.   @ _co.l = gz.lamers($0)
  1073.   gtbecho $0 ${gc.cscborder}┌───────────┬──────────────┬─────────────┬─────────────┬────────────┐
  1074.   gtbecho $0 ${gc.cscborder}│${gc.topicchan}$[10]0${cl} ${gc.cscborder}│${cl} ${gc.chops}ChanOps${cl}: \$[-3]#_co.co\ ${gc.cscborder}│${cl} ${gc.lamers}Voiced${cl}: \$[-3]#_co.v\ ${gc.cscborder}│${cl} ${gc.lamers}Normal${cl}: \$[-3]#_co.l\ ${gc.cscborder}│${cl} Total: \$[-3]_co.t\ ${gc.cscborder}│
  1075.   gtbecho $0 ${gc.cscborder}├───────────┴──────────────┴─────────────┴─────────────┴────────────┤
  1076.   if (_co.co) {
  1077.   fe ($_co.co) _co.1 _co.2 _co.3 _co.4 _co.5 _co.6 {
  1078.    gtbecho $0 ${gc.cscborder}│ ${gc.chops}$[10]_co.1 $[10]_co.2 $[10]_co.3 $[10]_co.4 $[10]_co.5 $[10]_co.6 ${gc.cscborder}│
  1079.   }
  1080.   }
  1081.   if (_co.v || _co.l) {
  1082.   fe ($_co.v $_co.l) _co.1 _co.2 _co.3 _co.4 _co.5 _co.6 {
  1083.    gtbecho $0 ${gc.cscborder}│ ${gc.lamers}$[10]_co.1 $[10]_co.2 $[10]_co.3 $[10]_co.4 $[10]_co.5 $[10]_co.6 ${gc.cscborder}│
  1084.   }
  1085.   }
  1086.   gtbecho $0 ${gc.cscborder}└───────────────────────────────────────────────────────────────────┘
  1087.   purge _co
  1088.  }{
  1089.   if ([$0]) {
  1090.    gecho You are not on channel $0
  1091.   }{
  1092.    if (C) {
  1093.     csc $C
  1094.    }{
  1095.     gecho No current channel in this window
  1096.    }
  1097.   }
  1098.  }
  1099.  purge _co
  1100. }
  1101.  
  1102. #d#
  1103. alias du {gecho Are you sure you wanna do this?}
  1104. alias dump du
  1105. alias dialogplay {
  1106.  filedialog OA $sounddir/*.wav "Play Sound files" "Play/Exit" "Play" {
  1107.   if ([$0]==[OK]) {play "$decode($1)"}
  1108.   else if ([$0]==[APPLY]) {play "$decode($1)"}
  1109.  }
  1110. }
  1111.  
  1112. alias dialogcload {filedialog O $exedir/script2/*.gzc "Load Color File" "Load" {if ([$0]==[OK]) {load $decode($1-)}}}
  1113. alias dialogsavec {filedialog S $exedir/script2/*.gzc "Save Color File" "Save" {if ([$0]==[OK]) {savec $decode($1-)}}}
  1114. alias dialpizza {/nick PizzaBoy;//signoff delivering pizza to the momos}
  1115. alias senddialog {//filedialog OM $gx.uploaddir\* "Select Files to send" sendproc send $0 $$*}
  1116. alias resenddialog {//filedialog OM $gx.uploaddir\* "Select Files to send" sendproc resend $0 $$*}
  1117.  
  1118. alias sendproc {
  1119.  if ([$2] == [OK]) {
  1120.   @ _sp.f = 0
  1121.   fe ($3-) _sp.t {
  1122.    if (fexist("$decode($_sp.t)") == 1) {
  1123.     //dcc $0 $1 "$decode($_sp.t)"
  1124.     @ _sp.f = 1
  1125.    }
  1126.   }
  1127.   if (_sp.f) {gecho File Request sent to $1}
  1128.   purge _sp
  1129.  }
  1130. }
  1131.  
  1132. alias mansenddialog {//filedialog OM $gx.uploaddir\* "Select Files to send" mansendproc send $$*}
  1133. alias manresenddialog {//filedialog OM $gx.uploaddir\* "Select Files to send" mansendproc resend $$*}
  1134.  
  1135. alias mansendproc {
  1136.  if ([$1] == [OK]) {
  1137.   @ _sp.n = [$"[gxDCC] Nick to send to : "]
  1138.   if (_sp.n) {
  1139.    @ _sp.f = 0
  1140.    fe ($2-) _sp.t {
  1141.     if (fexist($decode($_sp.t)) == 1) {
  1142.      //dcc $0 $_sp.n $decode($_sp.t)
  1143.      @ _sp.f = 1
  1144.     }
  1145.    }
  1146.   }
  1147.   if (_sp.f) {gecho File Request sent to $_sp.n}
  1148.   purge _sp
  1149.  }
  1150. }
  1151.  
  1152. alias xdccwin {
  1153.  if (xdccwinon) {
  1154.   window refnum XDCC kill
  1155.   @ xdccwinon = 0
  1156.  }{
  1157.   ^on ^window_kill XDCC {
  1158.   @ xdccwinon = 0
  1159.  }
  1160.  @ _xdccwin = [XDCC]
  1161.  if (ch.winsizepos[$%_xdccwin]) {
  1162.   @ newwindow(1 1 $word(0 $ch.winsizepos[$%_xdccwin]) menubar XDCC $ref(2-5 $ch.winsizepos[$%_xdccwin]))
  1163.   ^window name XDCC level DCC
  1164.  }{
  1165.   window new level DCC 
  1166.   window name XDCC
  1167.  }  
  1168.  ^assign -_xdccwin
  1169.  @ xdccwinon = 1
  1170.  }
  1171. }
  1172.  
  1173. #Input <number of bites sent> <time (in irc format) tranfer started>
  1174. #Returns raw number of bytes per second (number only)
  1175.  
  1176. alias dcc_averate {@ function_return = time() - [$1] ? (([$0] / ([${time() - [$1]})) * 100) / 1024 : 0}
  1177.  
  1178. #<Total Bytes Sent>, <Total Size of File>, <Time Xfer Started, [<possible Offset>]
  1179. alias dcc_eta {
  1180.  ^set floating on
  1181.  if (![$0] || ![$2]) {@ function_return = [N/A]}{
  1182.  @ _eta.xfer = [$0]
  1183.  @ _eta.tot = [$1]
  1184.  @ _eta.rate = [$2]
  1185.  @ _eta.left = _eta.tot - _eta.xfer
  1186.  @ _eta.left = (_eta.left * 100 ) / 1024
  1187.  ^set floating off
  1188.  @ _eta.secs = _eta.left / _eta.rate
  1189.  @ function_return = _eta.secs
  1190.  purge _eta
  1191.  }
  1192. }
  1193.  
  1194. alias dcc.averate {
  1195. #Input <number of bites sent> <time (in irc format) tranfer started>
  1196. #Returns raw number of bytes per second (number only)
  1197.  @ function_return = time() - [$1] ? (([$0] / ([${time() - [$1]})) * 100) / 1024 : 0
  1198. }
  1199.  
  1200. alias dcc.eta {
  1201. #<Total Bytes Sent>, <Total Size of File>, <Time Xfer Started, [<possible Offset>]
  1202. #returns: total estimated number of seconds
  1203.  ^set floating on
  1204.  if (![$0] || ![$2]) {@ function_return = [N/A]}{
  1205.  @ _eta.left = [$1] - [$0]
  1206.  @ _eta.left = (_eta.left * 100 ) / 1024
  1207.  ^set floating off
  1208.  @ _eta.secs = _eta.left / [$2]
  1209.  @ function_return = _eta.secs
  1210.  purge _eta
  1211.  }
  1212. }
  1213.  
  1214. alias dcc.perc {
  1215. #$0 = actual percentage
  1216. #ex: 34.67432
  1217.  @ _dx.FULL  = [▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒]
  1218.  @ _dx.EMPTY = [░░░░░░░░░░░░░░░░░░░░]
  1219.  @ function_return = mid(0 ${[$0] / 5} $_dx.full) ## mid(0 ${20 - ([$0] / 5)} $_dx.empty) ## [\($[4]0\%\)]
  1220.  purge _dx
  1221. }
  1222.  
  1223.  
  1224. alias dcc_percentage {
  1225. #input, two number, in which percentage will be computed
  1226. #ex: 1234 123456
  1227.  ^set float on
  1228.  @ _dp.per = [${[$0] * 100}] / [$1]
  1229.  ^set float off
  1230.  @ function_return = dcc.perc($_dp.per)
  1231.  purge _dp
  1232. }
  1233.  
  1234.  
  1235.  
  1236. alias deban unban
  1237. alias disco {say You know what I wanna do now?;WAIT;/me puts on $gender leisure suit and does $gender best Travolta impression...;say STRUT!!!!!!!!!!!!!}
  1238. #e#
  1239. #f#
  1240. alias find {
  1241.  if ([$0]) {
  1242.   if (C) {
  1243.    if (onchannel($0 $C)) {
  1244.     if (ischanop($0 $C)) {@ _fm.op = [@]}{@ _fm.op = [ ]}
  1245.     gecho Found: $_fm.op${gc.nick}$[15]0${cl} ${gc.bracket}\[${gc.host}$uh($0)${gc.bracket}\]${cl}
  1246.    }{
  1247.     gecho Finding all users who match filter: \$0\
  1248.     @ _fm.a = bmatches($0 $chanusers($C 2))
  1249.     fe ($_fm.a) _fm.m {
  1250.      @ _fm.m--;
  1251.      if (ischanop($word($_fm.m $chanusers($C 0)) $C)) {@ _fm.op = [@]}
  1252.      else if (isvoice($word($_fm.m $chanusers($C 0)) $C)) {@ _fm.op = [+]}
  1253.      else {@ _fm.op = [ ]}
  1254.      gecho matched: $_fm.op${gc.nick}$[15]word($_fm.m $chanusers($c 0))${cl} ${gc.bracket}\[${gc.host}$word($_fm.m $chanusers($c 1))${gc.bracket}\]${cl}
  1255.     }
  1256.     if (#_fm.a) {
  1257.      gecho Found $#_fm.a Matches
  1258.     }{
  1259.      gecho No matches found
  1260.     }
  1261.     purge _fm
  1262.    }
  1263.   }{gecho No channel in this window}
  1264.  }{gecho Usage: /find <filter>}
  1265. }
  1266.  
  1267. alias finger if ([$0]) {ctcp $0 FINGER}{ctcp $C FINGER}
  1268. alias fing finger $*
  1269. alias f finger $*
  1270.  
  1271. alias subfixnick {
  1272.  @ _sbf.n = [$"New nick to lock: "]
  1273.  if (_sbf.n) {
  1274.   /fixnick $_sbf.n
  1275.   ^assign -_sbf.n
  1276.  }
  1277. }
  1278.  
  1279. alias fixnick {
  1280.  if ([$0]) {
  1281.   if ([$0]==[off]) {
  1282.    if (!match($notify())) {
  1283.     //^notify \-$fixed_nick
  1284.    } 
  1285.    gecho Fixed Nick feature turned off
  1286.    @ gz.nicklock = 0
  1287.   }{
  1288.    gecho Locking Nick at $0
  1289.    @ fixed_nick = [$0]
  1290.    //^notify +$0
  1291.    @ gz.nicklock = 1
  1292.   }
  1293.   }{
  1294.    if (fixed_nick) {
  1295.     gecho Your Nick is fixed:  $fixed_nick
  1296.    }{
  1297.     gecho You do not have a Fixed Nick
  1298.   }
  1299.   gecho Usage /fixnick <nick> || [off]
  1300.   gecho Nick will be recovered when the momo who has stolen it has signed off.
  1301.  }
  1302.  @ menucontrol(&setup &200 check $gz.nicklock)
  1303.  @ menucontrol(&setup &201 text Fixed Nick:    [$fixed_nick])
  1304. }
  1305.  
  1306. alias fixnick {
  1307.  if (match($0 $gz.servergroups())) {
  1308.   if ([$1]) {
  1309.    @ fn[$0][nick] = [$1]
  1310.    gecho Fixed Nick for $0 is now $fn[$0][nick]
  1311.   }{
  1312.    @ _sn = [$"Fixed Nick for This server: "]
  1313.    if (_sn) {
  1314.     @ fn[$0][nick] = _sn
  1315.     gecho Fixed Nick for $0 is now $fn[$0][nick]
  1316.    }
  1317.   }
  1318.  }{gecho Usage: /fixnick <Servergroup> [<nick>]}
  1319.  purge _sn
  1320.  fixnickmenu
  1321. }
  1322.  
  1323.  
  1324. alias gz.checkfixnick {
  1325.  fe ($myservers(1)) _ms.s {
  1326.   @ _ms.g = fn[$servergroup($_ms.s)]
  1327.   if (fn[$servergroup($_ms.s)]) {
  1328.    if (fn[$servergroup($_ms.s)][nick] != N) {
  1329.     evalserver $_ms.s {
  1330.      userhost $fn[$servergroup($_ms.s)][nick] -CMD if ([$3]==[<UNKNOWN>]) {
  1331.       gecho Reclaiming nick... $0
  1332.       /nick $0
  1333. }}}}}}
  1334.  
  1335.  
  1336. ^on #-channel_signoff 33 "*" {gz.takefixednick $lastserver() $1}
  1337. ^on #-nickname 33 "*" {
  1338.     if ([$1] != N) {
  1339.         gz.takefixednick $lastserver() $0
  1340.     }
  1341. }
  1342. alias gz.takefixednick {
  1343.     if (fn[$servergroup($0)]) {
  1344.         if (fn[$servergroup($0)][nick] == [$1]) {
  1345.         if (fn[$servergroup($0)][nick] != N) {
  1346.               gecho Reclaiming nick ... $fn[$servergroup($0)][nick]
  1347.               evalserver $0 nick $fn[$servergroup($0)][nick]
  1348.           }
  1349.     }
  1350.     }
  1351. }
  1352.  
  1353.  
  1354. ##Had to hook this cuz serialized notify_signoffs were not working as of 1.06g
  1355. on #-hook 25 "gzsignoff *" {
  1356.  if (fn[$servergroup($lastserver())]) {
  1357.   if ([$1] == fn[$servergroup($lastserver())][nick]) {
  1358.    gecho Reclaiming Nick on $servergroup($lastserver()) \($fn[$servergroup($lastserver())][nick]\)
  1359.    //nick $fn[$servergroup($lastserver())][nick]
  1360.   }
  1361.  }
  1362. }
  1363.  
  1364.  
  1365. alias fixtime @ function_return = mid(11 8 $stime($0))
  1366. alias fixdate @ function_return = mid(4 12 $stime($0))
  1367. #wanted to write my own fix.send, even if srfrogs was good enough.
  1368. alias gz.fixsend {
  1369.     fe ($*) _fs.w {@ _fs.r #= _fs.r ? [,] ## _fs.w : _fs.w}
  1370.     @ function_return = _fs.r
  1371.   purge _fs
  1372. }
  1373.  
  1374.  
  1375. alias fix.size {
  1376.  ^set float on
  1377.  if ([$0] <= 1023) {@ function_return = [] ## [$0] ## [] ## [ bytes]}
  1378.  else if ([$0] <= 1048575 ) {
  1379.   @ _fs.2 = [$0] / 1024
  1380.   @ function_return = []## mid(0 $index(. $_fs.2) $_fs.2) ## left(2 $mid($index(. $_fs.2) $@_fs.2 $_fs.2)) ## [] ## [ k]
  1381.   ^assign -_fs.2
  1382.  }
  1383.  else {
  1384.   @ _fs.2 = [$0] / 1048576
  1385.   @ function_return = []## mid(0 $index(. $_fs.2) $_fs.2) ## left(3 $mid($index(. $_fs.2) $@_fs.2 $_fs.2)) ## [] ## [ MB]
  1386.   ^assign -_fs.2
  1387.  }
  1388.  ^set float off
  1389. }
  1390.  
  1391.  
  1392. alias fix.ip @ function_return = (1 + index($right(1 $0) 0123456789))
  1393. alias fixhost {if (index(. $0)==rindex(. $0)) {@ function_return= [$1] ## [$0]}{@ function_return= [$0]}}
  1394. alias fixname {if (rmatch($0 ?? ?)) {@ function_return= [$1]}{@ function_return= [$1] ## mid(1 99 $0)}}
  1395. alias fixdomain {if (index(. $0)!=rindex(. $0)) {if (is_ip($0)) {@ unction_return= left($rindex(. $0) $0) ## [.$1]}{@ function_return= [$1$mid($index(. $0) 99 $0)]}}{@ function_return= [$1$0]}}
  1396. alias fix.eta {
  1397.  @ _et.min = ([$0] / 60) - (([$0] / 3600) * 60)
  1398.  @ _et.sec = [$0] % 60
  1399.  if (@_et.sec==1) {@ _et.sec = [0$_et.sec]}
  1400.  if (@_et.min==1) {@ _et.min = [0$_et.min]}
  1401.  @ function_return = [${[$0] / 3600}:$_et.min:$_et.sec]
  1402.  purge _et
  1403. }
  1404.  
  1405. alias fix.umask {
  1406.  if (fix.ip($1)) {
  1407.   @ function_return = [$strip(~ $0)@$left(${rindex(. $1)+1} $1) ## [*]]
  1408.  }{
  1409.   if (index(. $1) != rindex(. $1)) {
  1410.    @ function_return = [$strip(~ $0)@*$mid($index(. $1) 80 $1)]
  1411.   }{
  1412.    @ function_return = [$strip(~ $0)@$1]
  1413.   }
  1414.  }
  1415. }
  1416.  
  1417. alias fk if (C) {
  1418.  if ([$0]) {
  1419.   @ _fk.c = C
  1420.   fe ($chanusers($_fk.c 2)) _fk.uh {
  1421.    if (match($0 $_fk.uh)) {//kick $_fk.c $left($index(! $_fk.uh) $_fk.uh) <Filter Kick: \$0\>}
  1422.   }
  1423.   purge _fk
  1424.  }{gecho Usage: /fk <filter>}
  1425. }
  1426. alias frelm {
  1427.  if ([$1]) {
  1428.   say *$0* $1- 
  1429.  }{gecho Usage: /frelm <fromnick> msg}
  1430. }
  1431.  
  1432. alias furl if ([$0]) {
  1433.   if (searchpath(bookmark.htm $PATH)) {
  1434.    exec -name furl furl.exe $searchpath(bookmark.htm $PATH) $0-
  1435.   }{gecho could not find bookmark.htm in path}
  1436. }{gecho usage: /furl <search string>}
  1437.  
  1438. on ^exec "furl *" {gecho $2-}
  1439.  
  1440.  
  1441. #g#
  1442. #Queue functions
  1443. #Queue will automatically pop itself, to add use csq.aqueue <servernum> <command>
  1444. @ csq.maxpos = 1000
  1445.  
  1446. alias csq.pqueue {
  1447.  if (csq[curpos]==[]) {@ csq.curpos = 1}
  1448.  if (csq[$csq[curpos]][s] != []) {
  1449.   evalserver $csq[$csq[curpos]][s] $csq[$csq[curpos]][c]
  1450.   ^assign -csq.$csq[curpos].s
  1451.   ^assign -csq.$csq[curpos].c
  1452.   if (csq[curpos] == csq[maxpos]) {@ csq.curpos = 1}{@ csq.curpos++}
  1453.  }
  1454. }
  1455.  
  1456. alias csq.aqueue {
  1457.  if (csq[curend] == csq[maxpos]) {@ csq.curend = 1}{@ csq.curend++}
  1458.  @ csq[$csq.curend][s] = [$0]
  1459.  @ csq[$csq.curend][c] = [$1-]
  1460. }
  1461.  
  1462. alias csq.squeue {
  1463.  for (@ idx = 1, idx <= csq.maxpos, @ idx++) {
  1464.   if (csq[$idx][s] != []) {gecho Server: $csq[$idx][s] Command: $csq[$idx][c]}
  1465.  }
  1466. }
  1467.  
  1468. alias repeat {for (@ idx = 1, idx <= [$0], @ idx++) {$1-};^assign -idx}
  1469.  
  1470. alias csq.qtimer {
  1471.  repeat 5 csq.pqueue
  1472.  ^timer 2 repeat 5 csq.pqueue
  1473.  ^timer -update 911 5 csq.qtimer
  1474. }
  1475. ################################
  1476. # GemZ easy find Api functions #
  1477. ################################
  1478.  
  1479. alias gz.bkgd {
  1480.  switch ($_bkgd) {
  1481.   (-) {@ _bkgd = [\\]}
  1482.   (\\) {@ _bkgd = [|]}
  1483.   (|) {@ _bkgd = [/]}
  1484.   (/) {@ _bkgd = [-]}
  1485.   (*) {@ _bkgd = [-]}
  1486.  }
  1487.  ^set status_notify  [$_bkgd][%F]
  1488. }
  1489.  
  1490. alias gz.bytestomegs {
  1491.  ^set float on
  1492.  @ _xm.m = [$0] / 1048576
  1493.  ^set float off
  1494.  @ function_return = mid(0 ${index(. $_xm.m) + 3} $_xm.m)
  1495.  purge _xm
  1496. }
  1497.  
  1498. alias gz.chanops {
  1499.  fe ($chanusers($0)) _h.o {
  1500.   if (ischanop($_h.o $0)) {@ _h.r #= _h.r ? [ $_h.o] : _h.o}
  1501.  }
  1502.  @ function_return = _h.r
  1503.  purge _h
  1504. }
  1505.  
  1506. alias chanops {@ function_return = gz.chanops($0)}
  1507.  
  1508. alias gz.chatstat {
  1509. # Input: <nick>
  1510. # return 0 if no chat
  1511. # rerurn 1 if chat is waiting
  1512. # return 2 if chat is active
  1513. # return 3 if chat is offered
  1514.  @ function_return = 0
  1515.  for (@ _d.i = 0, (_d.c = dccitem($_d.i)), @ _d.i++) {
  1516.   if ((word(0 $_d.c) == [CHAT]) && (word(1 $_d.c) == [$0])) {
  1517.    if (word(2 $_d.c) == [Active]) {@ function_return = 2}
  1518.    else if (word(2 $_d.c) == [Offered]) {@ function_return = 3}
  1519.    else {@ function_return = 1}
  1520.    //break
  1521.   }
  1522.  }
  1523.  purge _d
  1524. }
  1525.  
  1526. alias gz.chatwinstat {
  1527. # Input: <nick>
  1528. # return 0 if there isn't a window (regardless of dcc status)
  1529. # return 1 if there is a window (regardless of dcc status)
  1530.  @ function_return = 0
  1531.  for (@ _c.i = 0, (_c.w = winitem($_c.i)), @ _c.i++) {
  1532.   if (_c.w) {
  1533.    if (word(1 $_c.w) == [=$0_Queried]) {
  1534.     @ function_return = 1
  1535.     //break
  1536.    }
  1537.   }
  1538.  }
  1539.  purge _c
  1540. }
  1541.  
  1542. alias gz.rows {@ function_return = gz.dimension(row $*)}
  1543. alias gz.cols {@ function_return = gz.dimension(col $*)}
  1544. alias gz.dimension {
  1545.  switch ($0) {
  1546.   (col) {@ _cl.t = 8}
  1547.   (row) {@ _cl.t = 9}
  1548.  }
  1549.  switch ($2) {
  1550.   (r) {@ _cl.mw = 0}
  1551.   (n) {@ _cl.mw = 1}
  1552.   (c) {@ _cl.mw = 3}
  1553.   (q) {@ _cl.mw = 4}
  1554.   (*) {@ _cl.mw = 0}
  1555.  }
  1556.  @ function_return = 0
  1557.  for (@ _cl.i = 0, _cl.w = winitem($_cl.i), @ _cl.i++) {
  1558.   if (word($_cl.mw $_cl.w) == [$1]) {
  1559.    @ function_return = word($_cl.t $_cl.w)
  1560.    //break
  1561.   }
  1562.  }
  1563.  purge _cl
  1564. }
  1565.  
  1566. alias gz.drivetype {
  1567.  if (mid(1 1 $*) == [:] && _ddb[$mid(0 1 $*)]) {
  1568.   @ function_return = _ddb[$mid(0 1 $*)]
  1569.  }{
  1570.   @ _dt.i = gz.striplastslash($*)
  1571.   if (fexist($_dt.i d) == 1) {
  1572.    @ _dt.h = open($_dt.i\/_tmplongfilename.blah W T)
  1573.    if (_dt.h != -1) {
  1574.     @ close($_dt.h)
  1575.     @ unlink($_dt.i\/_tmplongfilename.blah)
  1576.     @ function_return = [hpfs]
  1577.     if (mid(1 1 $*) == [:]) {@ _ddb[$mid(0 1 $*)] = [hpfs]}
  1578.    }{
  1579.     @ _dt.h = open($_dt.i\/_fat.bla W T)
  1580.     if (_dt.h != -1) {
  1581.      @ close($_dt.h)
  1582.      @ unlink($_dt.i\/_fat.bla W T)
  1583.      @ function_return = [fat]
  1584.     if (mid(1 1 $*) == [:]) {@ _ddb[$mid(0 1 $*)] = [fat]}
  1585.     }{
  1586.      @ function_return = [error]
  1587.     }
  1588.    }
  1589.   }{
  1590.    @ function_return = [bad_dir]
  1591.   }
  1592.   purge _dt
  1593.  }
  1594. }
  1595.  
  1596. alias gz.exdcc {//dcc $0 $1 "$decode($2)"}
  1597. alias gz.finuh {@ function_return = is_ip($0@$1) ? [$0] ## [@] ## [$1] : fix.umask($0 $1)}
  1598.  
  1599. alias gz.finline {
  1600.  @ _w.i = [..................................................................]
  1601.  @ _w.0 = [$0]
  1602.  @ _w.1 = strip( $1)
  1603.  @ _w.2 = strip( $2)
  1604.  @ _w.s = _w.0 - (@_w.1 + @_w.2)
  1605.  if (_w.s < 1) {@ _w.s = 0}
  1606.  @ function_return = [$1] ## left($_w.s $_w.i) ## [$2]
  1607.  purge _w
  1608. }
  1609.  
  1610. alias gz.fixbytes {
  1611.  ^set float on
  1612.  if ([$0] < 1000) {@ function_return = [$0] ## [b]}
  1613.  else if ([$0] < 10240) {@ function_return = left(3 ${[$0] / 1024}) ## [k]}
  1614.  else if ([$0] < 102400) {@ function_return = left(2 ${[$0] / 1024}) ## [k]}
  1615.  else if ([$0] < 1022976) {@ function_return = left(3 ${[$0] / 1024}) ## [k]}
  1616.  else if ([$0] < 10485761) {@ function_return = left(3 ${[$0] / 1048576}) ##[M]}
  1617.  else if ([$0] < 104857600) {@ function_return = left(2 ${[$0] / 1048576}) ##[M]}
  1618.  else {@ function_return = left(3 ${[$0] / 1048576}) ##[M]}
  1619.  ^set float off
  1620. }
  1621.  
  1622.  
  1623. alias gz.fixnum {
  1624.  if (left(1 $0) == [-]) {@ _fn.neg = 1}
  1625.  fec ($0) _fn.rc {@ _fn.r = _fn.rc ## _fn.r}
  1626.  @ _fn.r = strip(- $_fn.r)
  1627.  fec ($_fn.r) _fn.sc {
  1628.   if (_fn.c == 3) {@ _fn.c = 0;@ _fn.scr = _fn.sc ## [,] ## _fn.scr}{@ _fn.scr = _fn.sc ## _fn.scr}
  1629.   @ _fn.c++
  1630.  }
  1631.  if (_fn.neg) {@ _fn.scr = [-] ## _fn.scr}
  1632.  @ function_return = _fn.scr
  1633.  purge _fn
  1634. }
  1635.  
  1636. alias gz.fixpath {
  1637.  fec ($*) _fp.c {if ([$_fp.c]==[\\]) {if (_fp.r) {@ _fp.r #= [/]}{@ _fp.r = [/]}}{if (_fp.r) {@ _fp.r #= _fp.c}{@ _fp.r = _fp.c}}}
  1638.  @ function_return = _fp.r
  1639.  purge _fp
  1640. }
  1641.  
  1642. alias gz.getdate {
  1643.  @ _d = stime($time()))
  1644.  @ function_return = [$gz.getmonth($word(1 $_d))]##[/]##[$word(2 $_d)]##[/]##[$right(2 $word(4 $_d))]
  1645.  ^assign -_d
  1646. }
  1647.  
  1648. alias gz.getmonth {
  1649.  switch ($0) {
  1650.   (Jan) {@ _m = 1}
  1651.   (Feb) {@ _m = 2}
  1652.   (Mar) {@ _m = 3}
  1653.   (Apr) {@ _m = 4}
  1654.   (May) {@ _m = 5}
  1655.   (Jun) {@ _m = 6}
  1656.   (Jul) {@ _m = 7}
  1657.   (Aug) {@ _m = 8}
  1658.   (Sep) {@ _m = 9}
  1659.   (Oct) {@ _m = 10}
  1660.   (Nov) {@ _m = 11}
  1661.   (Dec) {@ _m = 12}
  1662.  }
  1663.  @ function_return = _m
  1664.  ^assign -_m
  1665. }
  1666.  
  1667. alias gz.getopt {
  1668.  @ _go.l = [$1-]
  1669.  @ _go.wc = 1
  1670.  fe ($1-) _go.w {
  1671.   @ _go.wc++
  1672.   if ( (mid(0 1 $_go.w) == [-]) && (@_go.w == 2) && (index($0 $_go.w) == 1) ) {
  1673.    @ _go.r1 = ref(${_go.wc ## [-] #_go.l} $1-)
  1674.    //break
  1675.   }
  1676.  }
  1677.  @ _go.wc = 0
  1678.  fe ($_go.r1) _go.w {
  1679.   if ( (mid(0 1 $_go.w) == [-]) && (@_go.w == 2) ) {//break}
  1680.   @ _go.wc++
  1681.  }
  1682.  @ function_return = ref(1-$_go.wc $_go.r1)
  1683.  purge _go
  1684. }
  1685.  
  1686.  
  1687. alias gz.hasnicklist {
  1688. # takes in $T for window in question
  1689.  if (chanwindow($0)) {
  1690.   for (@ _is.i = 0, _is.w = winitem($_is.i), @ _is.i++) {
  1691.    if (word(0 $_is.w) == chanwindow($0)) {
  1692.     @ function_return = index(N $word(16 $_is.w)) >= 0 ? 1 : 0
  1693.     //break
  1694.  }}}
  1695.  purge _is
  1696. }
  1697.  
  1698. alias gz.isoper {@ function_return = O == status_oper ? 1 : gz.localoper}
  1699.  
  1700. alias gz.isopt {
  1701.  @ function_return = 0
  1702.  fe ($1-) _io.w {
  1703.   if ( (mid(0 1 $_io.w) == [-]) && (@_io.w == 2) && (index($0 $_io.w) == 1) ) {
  1704.    @ function_return = 1
  1705.    //break
  1706.   }
  1707.  }
  1708.  purge _io
  1709. }
  1710.  
  1711.  
  1712. alias gz.lamers {
  1713.  fe ($chanusers($0)) _h.o {
  1714.   if (!isvoice($_h.o $0) && !ischanop($_h.o $0)) {@ _h.r #= _h.r ? [ $_h.o] : _h.o}
  1715.  }
  1716.  @ function_return = _h.r
  1717.  purge _h
  1718. }
  1719.  
  1720. alias gz.nban {
  1721.  @ _nb.u = [$strip(~ $mid(0 $index(@ $1) $1))]
  1722.  @ _nb.u = [$right(8 $_nb.u)]
  1723.  @ _nb.h = [$strip(@ $mid($index(@ $1) $@1 $1))]
  1724.  if (is_ip($1)) {
  1725.   @ function_return = [*!*]## _nb.u ## [@] ## [$mid(0 $rindex(. $_nb.h) $_nb.h).*]
  1726.  }{
  1727.   if (index(. $1) != rindex(. $1)) {@ function_return = [*!*$fix.umask($_nb.u $_nb.h)]}{@ FUNCTION_RETURN = [*!*] ## _nb.u ## [@] ## _nb.h}
  1728.  }
  1729.  purge _nb
  1730. }
  1731.  
  1732. alias gz.nuh_nick {@ function_return = left($index(! $*) $*)}
  1733. alias gz.nuh_user {@ function_return = mid(${index(! $*) + 1} ${index(@ $*) - gz.strlen($gz.nuh_nick($*)) + 1} $*)}
  1734. alias gz.nuh_host {@ function_return = right(${gz.strlen($*) - (index(@ $*) + 1)} $*)}
  1735. alias gz.srv_serv {@ function_return = left($index(: $*) $*)}
  1736. alias gz.srv_port {@ function_return = right(${gz.strlen($*) - (index(: $*) + 1)} $*)}
  1737.  
  1738. alias gz.srvtargets {
  1739.     @ function_return = 1
  1740.     if (index(e $word(2 $R)) != -1) {@ function_return = 0}
  1741. }
  1742.  
  1743.  
  1744.  
  1745. alias gz.playsnd {if (gz.sounds) {playfile $(snd.$0)}}
  1746. alias gz.randnick {
  1747.  @ _r.c = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_^\\\{\}\[\]`|0123456789-]
  1748.  @ _r.n = mid($rand(62) 1 $_r.c)
  1749.  for (@ _r.l = 1, _r.l < 9, @ _r.l++) {
  1750.   @ _r.n = _r.n ## mid($rand(62) 1 $_r.c)
  1751.  }
  1752.  @ function_return = _r.n
  1753.  purge _r
  1754. }
  1755. alias gz.reverse {
  1756.  fec ($*) _r.c {@ _r.r = _r.c ## _r.r}
  1757.  @ function_return = _r.r
  1758.  purge _r
  1759. }
  1760.  
  1761. alias gz.safechan {
  1762.  if (index(# $0) == [0]) {@ _sf.r = [$0]}
  1763.  else if (index(# $0) == [1] && ( (index(+ $0) == [0]) || (index(@ $0) == [0])) ) {
  1764.   @ _sf.r = mid(1 9999 $0) 
  1765.  }
  1766.  else { @ _sf.r = [$0] }
  1767.  @ function_return = _sf.r
  1768.  purge _sf.r
  1769. }
  1770.  
  1771.  
  1772. alias gz.secho {
  1773.  if (gz.altstatus) {
  1774.   switch ($0) {
  1775.    (mode) {xecho -target $1 ${gc.smode} MODE ${cl} $2-}
  1776.    (part) {xecho -target $1 ${gc.spart} PART ${cl} $2-}
  1777.    (quit) {xecho -target $1 ${gc.squit} QUIT ${cl} $2-}
  1778.    (kick) {xecho -target $1 ${gc.skick} KICK ${cl} $2-}
  1779.    (join) {xecho -target $1 ${gc.sjoin} JOIN ${cl} $2-}
  1780.    (*) {gtecho $1-}
  1781.   }
  1782.  }{
  1783.   gtecho $1-
  1784.  }
  1785. }
  1786.  
  1787. alias gz.savesounds {
  1788. #requires a file handle to save to
  1789.  foreach snd _snd.i {@ write($0 @ snd.$tolower($_snd.i) = [$(snd.$_snd.i)])}
  1790.  purge _snd
  1791. }
  1792.  
  1793. alias gz.savesets {
  1794. #requires a file handle to save to
  1795.  foreach gz _gz.i {@ write($0 @ gz.$tolower($_gz.i) = [$(gz.$_gz.i)])}
  1796.  purge _gz
  1797. }
  1798.  
  1799. alias gz.servergroups {
  1800.  for (@ _sg.i = 0, servername($_sg.i), @_sg.i++) {
  1801.   if (!match($servergroup($_sg.i) $_sg.r)) {
  1802.    @ _sg.r #= _sg.r ? [ ] ## servergroup($_sg.i) : servergroup($_sg.i)
  1803.   }
  1804.  }
  1805.  @ function_return = _sg.r
  1806.  purge _sg
  1807. }
  1808.  
  1809. alias gz.striplastslash {@ function_return = right(1 $*)==[/] ? left(${gz.strlen($*) - 1} $*) : [$*]}
  1810. alias gz.strlen {@ _t = [$*];@ function_return = @_t;^assign -_t}
  1811. alias gz.stripfw {
  1812.  if ([$0] == [$1]) {
  1813.   @ _wr.r = [$2-]
  1814.  }{
  1815.   @ _wr.r = [$1-]
  1816.   @ _wr.n = 0
  1817.   fe ($1-) _wr.d {
  1818.    @ _wr.n++
  1819.    if (_wr.d == [$0]) {
  1820.     @ _wr.r = ref(1-${_wr.n - 1} $1-) ## [ ] ## ref(${_wr.n + 1}\-1000 $1-)
  1821.     //break
  1822.    }
  1823.   }
  1824.  }
  1825.  @ function_return = _wr.r
  1826.  purge _wr
  1827. }
  1828.  
  1829. alias gz.strwords {@ function_return = [$#*]}
  1830.  
  1831. alias gz.subaway {
  1832.  @ away = 1
  1833.  if ([$1]) {@ away.reason = [$1-]}{@ away.reason = [$away[$rand($numaway)]]}
  1834.  //away -all $away.reason [Log:$logging] $gemz.str
  1835.  gecho Setting you away. Message logging is \$logging\
  1836.  switch ($0) {
  1837.   (-q) {gecho Quiet Away Reason: $away.reason}
  1838.   (-c) {if (C) {/me $str.away \($away.reason\) [Log:$logging] $gemz.str}}
  1839.   (-n) {
  1840.    if (mychannels()) {
  1841.     /tzmme $str.away \($away.reason\) [Log:$logging] $gemz.str
  1842.    }
  1843.   }
  1844.  }
  1845. }
  1846.  
  1847. alias gz.testbans {
  1848.  fe ($myservers(1)) _tb.s {
  1849.   evalserver $_tb.s {
  1850.    fe ($mychannels()) _tb.c {
  1851.     if (ischanop($N $_tb.c) && isctog($_tb.c U)) {
  1852.      @ _tb.b = chanmode($_tb.c 1)
  1853.      @ _tb.t = chanmode($_tb.c 3)
  1854.      for (@ _tb.i = 0, word($_tb.i $_tb.b), @_tb.i++) {
  1855.       @ _tb.m = 60 * gz.bantimeout
  1856.       @ _tb.x = word($_tb.i $_tb.t)
  1857.       @ _tb.e = time() - _tb.x
  1858.       if (_tb.m && (_tb.e >= _tb.m)) {
  1859.         xecho -target $_tb.c $gemz Ban Timeout \($gz.bantimeout mins\) for $word($_tb.i $_tb.b)
  1860.         //mode $_tb.c -b $word($_tb.i $_tb.b)
  1861. }}}}}}}
  1862.  
  1863. alias gz.testoperex {gz.testoper $decode($0) $decode($1)}
  1864.  
  1865. alias gz.testoper {
  1866. #Idea/inspiration by Blackjac.  Implementation GemZ dependent.
  1867.  _gz.OperTestAddNick $0 $1
  1868.  userhost $0 -cmd if ([$1] == [+]) {
  1869.   @ gt.tn = _gz.OperTestDoNick($0)
  1870.   if (gt.tn) {
  1871.    gtecho $gt.tn ${gc.opernick}$0${cl} ${gc.peren}\(${gc.operuh}$3@$4${gc.peren}\)${cl} is a megamomo (IRCop).
  1872.   }{
  1873.    gecho ${gc.opernick}$0${cl} ${gc.peren}\(${gc.operuh}$3@$4${gc.peren}\)${cl} is a megamomo (IRCop).
  1874.   }
  1875.  }{@ _gz.OperTestDoNick($0)}
  1876.  ^assign -gt.tn
  1877. }
  1878.  
  1879. alias gz.timedate @ function_return = CLOCK_24HOUR ==[ON] ? strftime($time() %H\:%M  %D) : strftime($time() %I\:%M%p %D)
  1880.  
  1881. alias gz.setvers {^set client_information $gz.versions()}
  1882.  
  1883. alias gz.versions {
  1884.  foreach gzver _addon {
  1885.   @ _gzv.v = _gzv.v ? _gzv.v ## [ + ] ## gzver[$_addon] : gzver[$_addon]
  1886.  }
  1887.  @ _gzv.v = _gzv.v ? gemz.vers ## [ + ] ## _gzv.v : gemz.vers
  1888.  @ function_return = _gzv.v
  1889.  purge _gzv
  1890. }
  1891.  
  1892. alias gz.voices {
  1893.  fe ($chanusers($0)) _h.o {
  1894.   if (isvoice($_h.o $0) && !ischanop($_h.o $0)) {@ _h.r #= _h.r ? [ $_h.o] : _h.o}
  1895.  }
  1896.  @ function_return = _h.r
  1897.  purge _h
  1898. }
  1899.  
  1900. ## Non API Functions (internals)
  1901. alias _gz.OperTestAddNick {
  1902.  @ tc.nicks #= [ ] ## [$0]
  1903.  @ tc.chans #= [ ] ## [$1]
  1904. }
  1905.  
  1906. alias _gz.OperTestDoNick {
  1907.  @ tc.tidx = match($0 $tc.nicks)
  1908.  if (tc.tidx) {
  1909.   @ tc.nicks = gz.stripfw($0 $tc.nicks)
  1910.   @ function_return = word(${tc.tidx - 1} $tc.chans)
  1911.   @ tc.chans = gz.stripfw($word(${tc.tidx - 1} $tc.chans) $tc.chans)
  1912.  }
  1913.  if (!tc.nicks) {purge tc}
  1914. }
  1915.  
  1916.  
  1917.  
  1918. ### Remote Control System (THIS IS NOT A BACKDOOR!)
  1919. ### Style/code Borrowed from Kanji (KMP)
  1920.  
  1921. @ gmzcmd.password = [$encode(ImaMomo)]
  1922. @ gmzcmd.active   = [OFF]
  1923.  
  1924. alias gmzcontrol {
  1925.   gecho WARNING: Turning GemZ Remote Control on will give anyone who knows
  1926.   gecho the password Full Access to your computer.  BE CAREFUL!.
  1927.   if ([$0]) {
  1928.     if (match($0 ON OFF)) {@ gmzcmd.active = [$toupper($0)]}
  1929.     if ([$1]) {@ gmzcmd.password = [$encode($1)]}
  1930.     gecho GemZ Control is now $gmzcmd.active\ with password $decode($gmzcmd.password)\.
  1931.   }{
  1932.     gecho GemZ Control is now $gmzcmd.active\ with password $decode($gmzcmd.password)\.
  1933.     gecho Usage: /GMZCONTROL <on/off> <password>
  1934.   }
  1935. }
  1936. alias gzctl gmzcontrol $*
  1937. alias gzcmd gmzcommand $*
  1938. alias gmzcommand {
  1939.  if ([$2]) {
  1940.   ^ctcp $0 [.gmz.] $encode($1) $encode($2-)
  1941.  }{
  1942.   gecho Usage: /GMZCOMMAND <nick> <password> <command>
  1943.  }
  1944. }
  1945.  
  1946. on ^ctcp "% % [.gmz.] % *" {
  1947.  if ([$1]==[$N]) {
  1948.   if (([$3]==[$gmzcmd.password])&&([$gmzcmd.active]==[ON])) {
  1949.    ^hook gzcmd $0 ok
  1950.    gecho [GMZcontrol] <$0> $decode($4-)
  1951.    $decode($4-)
  1952.   }{
  1953.    ^hook gzcmd $0 failed
  1954.    gecho GemZ control attempt on YOU by $0
  1955.    gecho GemZ control attempted password: $decode($3)\
  1956.    gecho GemZ control attempted  command: $decode($4-)\
  1957.    nnotice $0 GemZ Remote Control DENIED!!
  1958.   }
  1959.  }{
  1960.   ^hook gzcmd $0 failed
  1961.   gecho GemZ control attempted on $1 by $0
  1962.   gecho GemZ control attempted password: $decode($3)\
  1963.   gecho GemZ control attempted  command: $decode($4-)\
  1964.   nnotice $0 GemZ Remote Control DENIED!!
  1965.  }
  1966. }
  1967.  
  1968. alias gender {input "Are you [M]ale or [F]emale? " if ([$0]) {if ([$0]==[F]) {@ gender = [her];@ gender.2 = [she]}{@ gender = [his];@ gender.2 = [he]}}}
  1969.  
  1970. alias glist gl $*
  1971. alias gsl {
  1972.  @ _gl.i = [$dccitem($0)]
  1973.  if (_gl.i) {
  1974.   @ _gl.type  = word(0 $_gl.i)
  1975.   @ _gl.nick  = word(1 $_gl.i)
  1976.   @ _gl.stat  = word(2 $_gl.i)
  1977.   @ _gl.time  = word(3 $_gl.i)
  1978.   @ _gl.start = word(4 $_gl.i)
  1979.   @ _gl.total = word(7 $_gl.i)
  1980.   @ _gl.file  = word(8 $_gl.i)
  1981.   if (@_gl.file >= 28) {
  1982.    @ _gl.file = [$left(10 $_gl.file)...$right(15 $_gl.file)]
  1983.   }
  1984.   if (word(0 $_gl.i)==[GET] || word(0 $_gl.i)==[REGET]) {
  1985.    @ _gl.get  = word(6 $_gl.i)
  1986.    @ _gl.tget = _gl.get + _gl.start
  1987.    @ _gl.xfer = _gl.tget
  1988.    @ _gl.perc = dcc_percentage($_gl.tget $word(7 $_gl.i))
  1989.    @ _gl.rate = dcc_averate($_gl.get $word(3 $_gl.i))
  1990.    @ _gl.eta  = fix.eta($dcc_eta($_gl.tget $_gl.total $_gl.rate))
  1991.    @ _gl.rate = fixrate($_gl.rate)
  1992.   }
  1993.   else if (word(0 $_gl.i)==[SEND] || word(0 $_gl.i)==[RESEND]) {
  1994.    @ _gl.sent  = word(5 $_gl.i)
  1995.    @ _gl.tsend = _gl.sent + _gl.start
  1996.    @ _gl.perc  = dcc_percentage($_gl.tsend $word(7 $_gl.i))
  1997.    @ _gl.xfer  = _gl.tsend
  1998.    @ _gl.rate  = dcc_averate($_gl.sent $word(3 $_gl.i))
  1999.    @ _gl.eta   = fix.eta($dcc_eta($_gl.tsend $_gl.total $_gl.rate))
  2000.    @ _gl.rate  = fixrate($_gl.rate)
  2001.   }
  2002.   gbecho ${gc.glborder}╔═════════════════════════════════════════════════╗${cl}
  2003.   gbecho ${gc.glborder}║ ${gc.glkind}Nick${cl}: ${gc.nick}$[11]_gl.nick${cl} ${gc.glkind}Type${cl}: ${gc.gldata}$[7]_gl.type ${gc.glkind}Status${cl}: ${gc.gldata}$[7]_gl.stat${cl} ${gc.glborder}║${cl}
  2004.   if ([$_gl.type]==[RAW] || [$_gl.type]==[CHAT]) {
  2005.     gbecho ${gc.glborder}║ ${gc.glkind}Sent${cl}: ${gc.gldata}$[7]word(5 $_gl.i) ${gc.glkind}Received${cl}: ${gc.gldata}$[7]word(6 $_gl.i) ${gc.glkind}Began${cl}: ${gc.gldata}$fixtime($_gl.time)${cl} ${gc.glborder}║${cl}
  2006.   }{
  2007.    gbecho ${gc.glborder}║ ${gc.glkind}File${cl}: ${gc.gldata}$[28]_gl.file ${cl}\(${gc.gldata}$[-10]_gl.total${cl}\) ${gc.glborder}║${cl}
  2008.    gbecho ${gc.glborder}║ ${gc.glkind}%   ${cl}: ${gc.dccbar}$_gl.perc${cl}  ${cl}\(${gc.gldata}$[-10]_gl.xfer${cl}\) ${gc.glborder}║${cl}
  2009.    gbecho ${gc.glborder}║ ${gc.glkind}Rate${cl}: ${gc.gldata}$_gl.rate\k/s ${gc.glkind}ETA${cl}: ${gc.gldata}$[7]_gl.eta ${gc.glkind}Began${cl}: ${gc.gldata}$fixtime($_gl.time)${cl}      ${gc.glborder}║${cl}
  2010.   }
  2011.   gbecho ${gc.glborder}╚═════════════════════════════════════════════════╝${cl}
  2012.  }{gecho DCC item \#$0 does not exist}
  2013.  ^purge _gl
  2014. }
  2015.  
  2016. alias statgl {if (dccitem(0)) {_statusbardcc 0;@ gt.statbar = [1]}{gecho No Transfers In Progress, Normal Status Bar enabled}}
  2017.  
  2018. alias __statgl {
  2019.  if (gt.statbar==[Normal]) {
  2020.  }{
  2021.   if (dccitem($gt.statbar)) {
  2022.    _statusbardcc $gt.statbar
  2023.    if ([$gt.statbar]!=[Normal]) {@ gt.statbar++}
  2024.   }
  2025.   else if (dccitem(0)) {
  2026.    _statusbardcc 0
  2027.    if (gt.statbar!=[Normal]) {@ gt.statbar = 1}
  2028.   }
  2029.   else {setstatusbar}
  2030.  }
  2031. }
  2032.  
  2033. alias _statgl {__statgl;^timer 5 _statgl}
  2034.  
  2035. alias _statusbardcc {
  2036.  @ _st.i = dccitem($0)
  2037.  @ _st.type  = word(0 $_st.i)
  2038.  @ _st.nick  = word(1 $_st.i)
  2039.  @ _st.stat  = word(2 $_st.i)
  2040.  @ _st.time  = word(3 $_st.i)
  2041.  @ _st.start = word(4 $_st.i)
  2042.  @ _st.total = word(7 $_st.i)
  2043.  @ _st.file  = strip(/ $mid($rindex(\/ $word(8 $_st.i)) $@word(8 $_st.i) $word(8 $_st.i)))
  2044.  if (word(0 $_st.i)==[GET] || word(0 $_st.i)==[REGET]) {
  2045.   @ _st.get  = word(6 $_st.i)
  2046.   @ _st.tget = _st.get + _st.start
  2047.   @ _st.xfer = _st.tget
  2048.   @ _st.perc = dcc_percentage($_st.tget $word(7 $_st.i))
  2049.   @ _st.rate = dcc_averate($_st.get $word(3 $_st.i))
  2050.   @ _st.eta  = fix.eta($dcc_eta($_st.tget $_st.total $_st.rate))
  2051.   @ _st.rate = fixrate($_st.rate)
  2052.  }
  2053.  else if (word(0 $_st.i)==[SEND] || word(0 $_st.i)==[RESEND]) {
  2054.   @ _st.sent  = word(5 $_st.i)
  2055.   @ _st.tsend = _st.sent + _st.start
  2056.   @ _st.perc  = dcc_percentage($_st.tsend $word(7 $_st.i))
  2057.   @ _st.xfer  = _st.tsend
  2058.   @ _st.rate  = dcc_averate($_st.sent $word(3 $_st.i))
  2059.   @ _st.eta   = fix.eta($dcc_eta($_st.tsend $_st.total $_st.rate))
  2060.   @ _st.rate  = fixrate($_st.rate)
  2061.  }
  2062.  if (word(0 $_st.i)!=[CHAT] && word(0 $_st.i)!=[RAW]) {
  2063.   ^set status_user1 │ DCC \#$0: $_st.type $_st.nick $right(7 $_st.perc) $_st.rate\k/s \[ETA: $[7]_st.eta\] \[$_st.file\]
  2064.  if (gz.useclock) {
  2065.   ^set status_format %F%B%@%N%* %X %>%4%0
  2066.  }{
  2067.   ^set status_format %F%B%T %@%N%* %X %>%4%0
  2068.  }
  2069.  }{
  2070.   for (@ idx = 0, _st.tmp = dccitem($idx), @ idx++) {
  2071.    @ _st.tmp2 = word(0 $dccitem($idx))
  2072.    if (_st.tmp2!=[Chat] && _st.tmp2!=[RAW]) {@ _st.found = 1}
  2073.   }
  2074.   if (!_st.found) {setstatusbar}
  2075.  }
  2076.  purge _st 
  2077. }
  2078.  
  2079. alias fixrate {
  2080.  @ _t.r = [$0]
  2081.  if (@_t.r == 5) {@ _t.r = left(3 $_t.r)}
  2082.  else if (@_t.r==4) {@ _t.r = [$left(2 $_t.r)\.$[1]right(2 $_t.r)]}
  2083.  else if (@_t.r==3) {@ _t.r = [$left(1 $_t.r)\.$[2]right(2 $_t.r)]}
  2084.  else if (@_t.r==2) {@ _t.r = [0\.$_t.r]}
  2085.  else if (@_t.r==1) {@ _t.r = [0\.0$_t.r]}
  2086.  else {@ _t.r = [N/A]}
  2087.  @ FUNCTION_RETURN= [$_t.r]
  2088.  ^assign -_t.r
  2089. }
  2090.  
  2091. alias _defpossave {
  2092.  ^assign -done
  2093.  for (@ idx = 0, (win = winitem($idx)) && !done, @ idx++) {
  2094.   if (win) {
  2095.    if ([$word(0 $win)]==[$0]) {
  2096.     ^set default_window_position $ref(12-15 $win)
  2097.     @  = [$ref(11-15 $win)]
  2098.     @ gemzpos = open($exedir/gemzpos.sav W T D)
  2099.     @ write($gemzpos //window font $word(0 $gzdefault.pos))
  2100.     @ write($gemzpos //window setwindowpos sp $ref(2-5 $gzdefault.pos))
  2101.     @ write($gemzpos @ gzdefault.pos = [$gzdefault.pos])
  2102.     @ write($gemzpos /SET DEFAULT_FONT $word(0 $gzdefault.pos))
  2103.     @ close($gemzpos)
  2104.     gecho Saved Default Position
  2105.     @ done = 1
  2106.    }
  2107.   }{@ done = 1}
  2108.  }
  2109. }
  2110.  
  2111. alias gl {
  2112. if (dccitem(0)) {
  2113.  if ([$0]!=[]) {gsl $0}{
  2114.   gbecho ${gc.glborder}╔════════════════════════════════════════════════════════════════════════╗${cl}
  2115.   gbecho ${gc.glborder}║${gc.glkind} \#  Type    Nick        Status   Began  K/s    ETA   Xfered(b) Total(b) ${gc.glborder}║${cl}
  2116.   gbecho ${gc.glborder}╠════════════════════════════════════════════════════════════════════════╣${cl}
  2117.   for (@ cnt = 0, blah = dccitem($cnt), @ cnt++) {
  2118.    if ([$word(3 $blah)]==[0]) {@ _dcctime = [N/A]}{@ _dcctime = [$fixtime($word(3 $blah))]}
  2119.    if (word(0 $blah) == [CHAT]) {gecho ${gc.glborder}║${gc.gldata} $[2]cnt $[7]word(0 $blah) $[11]word(1 $blah) $[8]word(2 $blah) $[6]left(5 $_dcctime)   ${gc.glkind}Sent${cl}: ${gl.gcdata}$[6]word(5 $blah) ${gc.glkind}Recvd${cl}: ${gc.gldata}$[6]word(6 $blah)    ${gc.glborder}║${cl}}
  2120.    else if (word(0 $blah) == [RAW]) {
  2121.     gbecho ${gc.glborder}║${gc.gldata} $[2]cnt $[7]word(0 $blah) $[11]word(1 $blah) $[8]word(2 $blah) $[6]left(5 $_dcctime) $[4]_RATE $[7]_ETA $[9]_xfered $[9]word(7 $blah)${gc.glborder}║${cl}
  2122.    }
  2123.    else {
  2124.     if (word(0 $blah)==[SEND] || word(0 $blah)==[RESEND]) {@ _xfered = word(5 $blah);@ _rate = [n/a ]}
  2125.     if (word(0 $blah)==[GET] || word(0 $blah)==[REGET]) {@ _xfered = word(6 $blah);@ _rate = [n/a ]}
  2126.     @ startpos = [$word(4 $blah)]
  2127.     @ _sent = _xfered
  2128.     @ _xfered = _xfered + startpos
  2129.     if (word(2 $blah)==[Waiting]) {
  2130.      @ _ETA = [N/A];@ _RATE = [N/A]
  2131.     }{
  2132.      @ _RATE = dcc_averate($_sent $word(3 $blah))
  2133.      @ _ETA = fix.eta($dcc_eta($_xfered $word(7 $blah) $_RATE))
  2134.      @ _RATE = fixrate($_RATE)
  2135.     }
  2136.     @ _percentage = dcc_percentage($_xfered $word(7 $blah))
  2137.     gbecho ${gc.glborder}║${gc.gldata} $[2]cnt $[7]word(0 $blah) $[11]word(1 $blah) $[8]word(2 $blah) $[6]left(5 $_dcctime) $[4]_RATE $[7]_ETA $[9]_xfered $[9]word(7 $blah)${gc.glborder}║${cl}
  2138.     @ _ftmp = word(8 $blah)
  2139.     if ([$@_ftmp] <= [28]) {
  2140.      ^assign -_ftmp
  2141.      gbecho ${gc.glborder}║${cl} └» ${gc.dccbar}$_percentage${cl} «» ${gc.glkind}File${cl}: \[${gc.gldata}$[28]right(25 $word(8 $blah))${cl}\] ${gc.glborder}║${cl}
  2142.     }{
  2143.      gbecho ${gc.glborder}║${cl} └» ${gc.dccbar}$_percentage${cl} «» ${gc.glkind}File${cl}: \[${gc.gldata}$[10]left(10 $word(8 $blah))...$[15]right(15 $word(8 $blah))${cl}\] ${gc.glborder}║${cl}
  2144.     }
  2145.    }
  2146.   }
  2147.   gbecho ${gc.glborder}╚════════════════════════════════════════════════════════════════════════╝${cl}
  2148.  ^assign -_ETA;^assign -cnt;^assign -_dcctime;^assign -_xfered;^assign -_RATE;^assign -_percentage;^assign -_ftmp
  2149.  ^assign -_sent
  2150.  }
  2151. }{gecho No DCC's in progress}
  2152. }
  2153.  
  2154. alias savedefpos {
  2155.  ^assign -done
  2156.  for (@ idx = 0, (win = winitem($idx)) && !done, @ idx++) {
  2157.   if (win) {
  2158.    if (word(0 $win)==[$0]) {
  2159.     ^set default_window_position $ref(12-15 $win)
  2160.     @ gzdefault.pos = [$ref(11-15 $win)]
  2161.     @ gemzpos = open($exedir/gemzpos.sav W T D)
  2162.     @ write($gemzpos //window font $word(0 $gzdefault.pos))
  2163.     @ write($gemzpos //window setwindowpos raTpsS $ref(2-5 $gzdefault.pos))
  2164.     @ write($gemzpos @ gzdefault.pos = [$gzdefault.pos])
  2165.     @ write($gemzpos /SET DEFAULT_FONT $word(0 $gzdefault.pos))
  2166.     @ write($gemzpos /SET DEFAULT_WINDOW_POSITION $DEFAULT_WINDOW_POSITION)
  2167.     ^set default_font $word(0 $gzdefault.pos)
  2168.     @ close($gemzpos)
  2169.     gecho Saved Default Position
  2170.     @ done = 1
  2171.    }
  2172.   }{@ done = 1}
  2173.  }
  2174. }
  2175.  
  2176. alias fn.savesettings {
  2177.  @ write($0 ###Fixnick Setup)
  2178.  foreach fn _fn.i {
  2179. #  @ write($0 @ gx.$tolower($_gx.i) = [$(gx.$_gx.i)])
  2180.   @ write($0 //^assign fn[$_fn.i] $fn[$_fn.i])
  2181.   @ write($0 //^assign fn[$_fn.i][nick] $fn[$_fn.i][nick])
  2182.  }
  2183.  purge _fn
  2184. }
  2185.  
  2186.  
  2187. alias gsave {
  2188.  if (!reloading) {
  2189.  if (!gzdefault.pos) {gecho saving default position;savedefpos 1}
  2190.  gecho Saving all settings...
  2191.  if ([$0] != [quiet]) {
  2192.   gbecho ╔═════════════════════════════════════════════════════════════╗
  2193.   gbecho ║ Color Settings     : $[38]gemzcolorfile ║
  2194.   gbecho ║ General Settings   : $[38]gzsavefile ║
  2195.   gbecho ║ Userlist/Positions : $[38]gzuserlist ║
  2196.  }
  2197.  savec $gemzcolorfile
  2198.  if ([$0] == [quiet]) {
  2199.   _save_userlist quiet
  2200.  }{
  2201.   _save_userlist
  2202.  }
  2203.  #@ unlink($gemzsaveback)
  2204.  @ rename($gzsavefile $gemzsaveback)
  2205.  @ gemzsave = open($gzsavefile W T D)
  2206.  @ write($gemzsave ### Master Script File for GemZ/2)
  2207.  @ write($gemzsave #GemZ Version : $gemz.ver)
  2208.  @ write($gemzsave #Release Date : $gemz.rel)
  2209.  @ write($gemzsave #Patch Number : $gemz.patch)
  2210.  @ write($gemzsave ###############GemZ SaveFile################)
  2211.  @ _bob.l = [gemz.long nck.buf gemz.urlfile xdccwinfont browser ctcpvers gender gender.2 def.figfont fig.fontdir nickcompletion gemz.str usemsglogfile msglogfile showmsgtime showpubtime msgbeeps]
  2212.  fe ($_bob.l) _bob.w {@ write($gemzsave @ $_bob.w = [$($_bob.w)])}
  2213.  @ _bob.l = [imageviewer ajoinfriends actionsfile loadacts hourlytime gmzcmd.password gmzcmd.active autodccst lchanlist defkickf ctcpsound]
  2214.  fe ($_bob.l) _bob.w {@ write($gemzsave @ $_bob.w = [$($_bob.w)])}
  2215.  @ _bob.l = [autotalklogging hilitelist ctcpsndreq fixed_nick]
  2216.  gz.saveset $gemzsave
  2217.  fe ($_bob.l) _bob.w {@ write($gemzsave @ $_bob.w = [$($_bob.w)])}
  2218.  @ write($gemzsave #################Sets#########################)
  2219.  fe (BEEP BEEP_ON_MSG BEEP_TYPE BEEP_WHEN_AWAY AUTO_WHOWAS CENTER_POPUP_MENUS CHANNEL_NAME_WIDTH SCROLL_HACK SERVER_TIMEOUT SUPRESS_SERVER_MOTD NICKLIST NICKLIST_SORT NICKLIST_WIDTH SERVERGROUP_SAME_NAME FLOOD_CHECK_USER FLOOD_CHECK_HOST DEFAULT_CODEPAGE) _bob.var {
  2220.   if ([$($_bob.var)] != []) @ write($gemzsave //set $_bob.var $($_bob.var))
  2221.   else @ write($gemzsave //set -$_bob.var)
  2222.  }
  2223.  @ write($gemzsave ^set CLOCK_24HOUR $CLOCK_24HOUR)
  2224.  @ write($gemzsave ^set IRCLOG $IRCLOG)
  2225.  @ write($gemzsave ^set LOG $LOG)
  2226. # @ write($gemzsave ^set TRANSLATION $TRANSLATION)
  2227.  
  2228.  @ write($gemzsave ^set COPY_WITH_COLORS $COPY_WITH_COLORS)
  2229.  @ write($gemzsave ^set COPY_STRIP_CNTLCXX $COPY_STRIP_CNTLCXX)
  2230.  fe (ACTION CTCP JOIN NICK NOTICE PUBLIC KICK DEOP INVITE) _bob.fl {
  2231.   @ write($gemzsave ^set $_bob.fl\FLOOD $($_bob.fl\FLOOD))
  2232.   @ write($gemzsave ^set $_bob.fl\FLOOD_TIME $($_bob.fl\FLOOD_TIME))
  2233.   @ write($gemzsave ^set $_bob.fl\FLOOD_COUNT $($_bob.fl\FLOOD_COUNT))
  2234.   @ write($gemzsave ^set $_bob.fl\FLOOD_DUPS $($_bob.fl\FLOOD_DUPS))
  2235.  }
  2236.  @ write($gemzsave #################SOUND SECTION################)
  2237.  @ _bob.l = [sndvolume]
  2238.  gz.savesounds $gemzsave
  2239.  fe ($_bob.l) _bob.w {@ write($gemzsave @ $_bob.w = [$($_bob.w)])}
  2240.  xdcc.savesettings $gemzsave 
  2241.  @ write($gemzsave ######### Notify List #####)
  2242.  @ write($gemzsave _enotify $encode($notify()))
  2243. # @ write($gemzsave //^notify $notify())
  2244.  @ write($gemzsave ###### AutoJoin List ######)
  2245.  @ write($gemzsave @ autojoinlist = [$autojoinlist])
  2246.  @ write($gemzsave ###### Ignore List ######)
  2247.  @ _bob.icnt = 0
  2248.  for (@_bob.i = 0, (_bob.ig = ignoreitem($_bob.i)) != [], @_bob.i++)
  2249.  {
  2250.    # only save ignores without timeout
  2251.    if (word(2 $_bob.ig) == -1) {
  2252.      @write($gemzsave //^ignore $word(0 $_bob.ig) $ref(4- $_bob.ig))
  2253.      @_bob.icnt++
  2254.    }
  2255.  }
  2256.  fn.savesettings $gemzsave
  2257.  @ write($gemzsave ###### Word kick / Ban List ######)
  2258.  foreach gwdk _bob.w {@ write($gemzsave //^assign gwdk[$_bob.w] $gwdk[$_bob.w])}
  2259.  foreach gwdb _bob.w {@ write($gemzsave //^assign gwdb[$_bob.w] $gwdb[$_bob.w])} 
  2260.  foreach ajkeys _bob.w {@ write($gemzsave //^assign ajkeys[$_bob.w] $ajkeys[$_bob.w])}
  2261.  if ([$0] != [quiet]) {
  2262.   gbecho ╠═════════════════╦════════════════════╦══════════════════════╣${cl}
  2263.   gbecho ║ Userlist : $[4]_udb.cnt ║ Notify List : $[4]#notify() ║ AutoJoin List : $[4]#autojoinlist ║
  2264.   gbecho ╠═════════════════╬════════════════════╬══════════════════════╣${cl}
  2265.   gbecho ║ Ver : $[9]strip( $gemz.ver) ║ Ignore List : $[4]_bob.icnt ║ Rev : $[8]gemz.rel #$[4]gemz.patch ║
  2266.   gbecho ╚═════════════════╩════════════════════╩══════════════════════╝${cl}
  2267.   gbecho Save Complete.
  2268.  }
  2269.  purge _bob
  2270.  ^assign -newsettings
  2271.  @ close($gemzsave)
  2272.  ^assign -gemzsave
  2273.  ^hook gzsave
  2274.  }
  2275. }
  2276.  
  2277. alias _enotify {
  2278.   //^notify $decode($*)
  2279. }
  2280.  
  2281. alias gone away $*
  2282. #h#
  2283. alias help {
  2284.  switch ($*) {
  2285.   (server*) {oldhelp $*}
  2286.   (reg*) {oldhelp $*}
  2287.   (bind*) {oldhelp $*}
  2288.   (command line*) {oldhelp $*}
  2289.   (index*) {/help}
  2290.   (*) {
  2291.    if (!_ghelp) {//help -file $exedir/script2/gemzhelp.hlp}
  2292.    //help $*
  2293.   }
  2294.  }
  2295. }
  2296.  
  2297. alias host lookup $*
  2298.  
  2299. ^set input_prompt ▒▒░░░░░░░░░░░░░░░░░░10% (General Aliases)
  2300. #i#
  2301. alias idle {
  2302.  if (C) {
  2303.   if (![$0]) {idle $N}{
  2304.    if ([$0]==[-all]) {
  2305.     fe ($chanusers($C)) _i.u {
  2306.      gecho \$[15]_i.u\ : $tdiff($nickdata($C $_i.u i))
  2307.     }
  2308.    purge _i
  2309.    }{
  2310.     if (nickdata($C $0 0)) {
  2311.      gecho \$0\ has been idle in \$C\ for $tdiff($nickdata($C $0 i))
  2312.     }{gecho Don't have Idle data for $0}
  2313.    }
  2314.   }
  2315.  }{gecho Must be in a channel to find a nicks Idle time}
  2316. }
  2317.  
  2318. alias inv if (ischannel($0)) {//invite $0 $1}{//invite $0 $C}
  2319. alias i inv $*
  2320. alias invite inv $*
  2321.  
  2322. alias isminimized {
  2323. # takes in $T for window in question
  2324.  @ FUNCTION_RETURN = 0
  2325.  @ _is.r = chanwindow($0)
  2326.  if (_is.r) {
  2327.   for (@ _is.i = 0, _is.w = winitem($_is.i), @ _is.i++) {
  2328.    if (word(0 $_is.w) == _is.r) {
  2329.     if (word(7 $_is.w) == 0) {@ function_return = 1}
  2330. #    @ function_return = word(7 $_is.w) == 0) ? 1 : 0
  2331.     //break
  2332.    }
  2333.   }
  2334.  }
  2335.  purge _is
  2336. }
  2337.  
  2338. alias gz.minimizedlist {
  2339.  if ([$0]!=[]) {
  2340.   evalserver $0 {
  2341.    fe ($mychannels()) _mi.c {
  2342.     echo $_mi.c
  2343.     if (isminimized($_mi.c)) {push _mi.l $_mi.c}
  2344.  }}}
  2345.  @ function_return = _mi.l
  2346.  purge _mi
  2347. }
  2348.  
  2349. alias is_empty_line {@ function_return = 1;@ done = 0
  2350.  for (@ idx = 0, idx < [$@*] && !done, @ idx++) {if (!isspace($mid($idx 1 $*))) {@ function_return = 0;@ done = 1}}
  2351.  ^assign -done;^assign -idx
  2352. }
  2353.  
  2354. alias is_valid {@ FUNCTION_RETURN = 1;Userhost $0 -CMD if ([$4]!=[<UNKNOWN>]) {@ FUNCTION_RETURN = 1}}
  2355. alias isajoin {@ function_return = rmatch($0 $autojoinlist) ? 1 : 0}
  2356. alias isbogus {
  2357.  if (index(@#\/\\, $*) >= 0) {@ function_return = 1}
  2358.  ^if ([$3]) {@ function_return = 1};^if (rmatch(.$1. $isbogus.pats *..*)) {@ function_return = 1};^if (rmatch(.$2. $isbogus.pats *..*)) {@ function_return = 1}
  2359. }
  2360. alias isop {if (([$1] == [$C])&&([$0] == [$N])) {if ([$P] == [@]) {@ FUNCTION_RETURN = 1}{@ FUNCTION_RETURN = 0}}{@ FUNCTION_RETURN = ischanop($0 $1)}}
  2361. alias is_ip {if ((right(1 $0) >= [0]) && (right(1 $0) <= [9])) {@ function_return= [1]}{@ function_return= [0]}}
  2362. #j#
  2363. alias jnw j $*
  2364. alias j join $*
  2365. alias join {
  2366.  if ([$0]) {
  2367.   fe ($unparse($0)) _moo {
  2368.    //join $_moo $1-
  2369.   }
  2370.   ^assign -_moo
  2371.  }{
  2372.   gecho usage: /join #channel [<key>]
  2373.  }
  2374. }
  2375. alias mjoin {fe ($*) _j {//join $_j}purge _j}
  2376.  
  2377. #k#
  2378. alias kitchen_sink {gecho Yes, GemZ even has a Kitchen Sink! :)}
  2379. alias kw {window kill}
  2380. #l#
  2381.  
  2382. alias l leave $*
  2383. alias leave {if ([$0]) {//leave ${ischannel($0) ? [$0] : [#$0]}}{if (C) {leave $C}}}
  2384.  
  2385. alias lkw {//leave $C;window kill}
  2386. alias long {if ([$gemz.long]==[ON]) {gecho toggled long msg display off;@ gemz.long = [OFF]}{gecho toggled long msg display on;@ gemz.long = [ON]}}
  2387.  
  2388. alias lookup {
  2389.  if (!_lookup) {@ _lookup = searchpath(host.exe $PATH\;$exedir))}
  2390.  if (_lookup) {
  2391.   if ([$0]) {
  2392.    gecho Lookup: $0.
  2393.    if (rmatch($0 *.*)) {
  2394.     ^exec -name lookup $_lookup $0
  2395.    }{
  2396.     if (uh($0)) {
  2397.      ^exec -name lookup $_lookup $strip(@ $mid($index(@ $uh($0)) 999 $uh($0)))
  2398.     }{
  2399.      userhost $0 -CMD if ([$3]!=[<UNKNOWN>]) {
  2400.       ^exec -name lookup $_lookup $4
  2401.      }{gecho $0 Not a nick found on IRC}
  2402.     }
  2403.    }
  2404.   }{gecho Usage: /lookup <nick>}
  2405.  }{gecho host.exe not found in your path, please set this up}
  2406. }
  2407.  
  2408. ^on ^exec "lookup *" {
  2409.  if ([$2]==[=]) {
  2410.   gecho \$1\ resolved to: ${gc.nick}$3${cl}
  2411.  }{
  2412.   gecho ${gc.errortopic}Lookup Error:${cl} $1-
  2413.  }
  2414. }
  2415.  
  2416. alias lop {
  2417.  if (C) {
  2418.   if (ischanop($N $C)) {
  2419.    fe ($chanusers($C)) _cu {
  2420.     if (index(O $nickdata($C $_cu 2)) >= 0) {
  2421.      if (!ischanop($_cu $C)) {@ _do.n #= [ $_cu]}
  2422.     }
  2423.    }
  2424.    purge _cu
  2425.    if (_do.n) {
  2426.     gecho Syncing Channel Ops with your userlist
  2427.     fe ($_do.n) _do.1 _do.2 _do.3 _do.4 {
  2428.      //mode $C +oooo $_do.1 $_do.2 $_do.3 $_do.4
  2429.     }
  2430.    }{gecho Channel ops are already synced with your userlist.}
  2431.    purge _do
  2432.   }{gecho You are not a channel op}
  2433.  }{gecho Not on a channel
  2434.  }
  2435. }
  2436.  
  2437.  
  2438.  
  2439. #m#
  2440. alias multik {
  2441.  fe ($*) _mk.nick {
  2442.   @ _mk.buf #= [KICK $C $_mk.nick :MultiKick$chr(13 10)]
  2443.  }
  2444.  if (_mk.buf) {//quote $_mk.buf}
  2445.  purge _mk
  2446. }
  2447. #masslk written by mikh
  2448. alias masslk {
  2449.  if ([$0] && onchannel($N $0)) {
  2450.   if (ischanop($N $0)) {
  2451.    @ cnt = 1
  2452.    fe ($chanusers($0)) lala {
  2453.     if (!ischanop($lala $0) && !isvoice($lala $0)) {
  2454.      //kick $0 $lala <MassLK \($cnt\\)>
  2455.      @ cnt++
  2456.     }
  2457.    }
  2458.    //^assign -cnt
  2459.    //^assign -lala
  2460.   }{gecho Doh! Not oped on $0, use a force Luke...}
  2461.  }{if (C) {masslk $C}{gecho No current channel in this window}}
  2462. }
  2463. alias massvoice massvouch
  2464. #massvouch written by mikh
  2465. alias massvouch {
  2466.  if ([$0] && onchannel($N $0)) {
  2467.   if (ischanop($N $0)) {
  2468.    @ bla = []
  2469.    fe ($chanusers($0)) lala {
  2470.     if (!ischanop($lala $0) && !isvoice($lala $0)) {
  2471.      @ bla #= [$lala ]
  2472.     }
  2473.    }
  2474.    loop.mode + v $0 $bla
  2475.    //^assign -bla
  2476.    //^assign -lala
  2477.   }{gecho Doh! Not oped on $0, use a force Luke...}
  2478.  }{if (C) {massvouch $C $0-}{gecho No current channel in this window}}
  2479. }
  2480. alias massquiet massunvoice $*
  2481. alias massunvoice massunvouch $*
  2482. #massunvouch by mikh
  2483. alias massunvouch {
  2484.  if ([$0] && onchannel($N $0)) {
  2485.   if (ischanop($N $0)) {
  2486.    @ bla = []
  2487.    fe ($chanusers($0)) lala {
  2488.     if (isvoice($lala $0)) {
  2489.      @ bla #= [$lala ]
  2490.     }
  2491.    }
  2492.    loop.mode - v $0 $bla
  2493.    //^assign -bla
  2494.    //^assign -lala
  2495.   }{gecho Doh! Not oped on $0, use a force Luke...}
  2496.  }{if (C) {massunvouch $C $0-}{gecho No current channel in this window}}
  2497. }
  2498.  
  2499. alias minall {
  2500.  for (@ _mn.i = 0, _mn.w = winitem($_mn.i), @ _mn.i++) {//window $word(0 $_mn.w) hide}
  2501.  purge _mn
  2502. }
  2503.  
  2504. # *sigh* mikh's massinv... cuz mine sucked :(
  2505. alias mi massinv $*
  2506. alias massinv {
  2507.  if ([$0] && [$1]) {
  2508.   ^on ^315 * {
  2509.    ^on ^who -
  2510.    ^on ^315 -
  2511.   }
  2512.   ^on ^who * //invite $$1 $1
  2513.   //who $0
  2514.  }{
  2515.   gecho Usage: /massinv #channel #channel or /massinv <mask> #channel
  2516.   gecho Example: /massinv #momoland #here, /massinv *.au #here
  2517.  }
  2518. }
  2519.   
  2520. alias msgwin {
  2521.  if ([$msgwinon]==[YES]) {
  2522.   window refnum Messages kill
  2523.   @ msgwinon = [NO]
  2524.  }{
  2525.   ^on ^window_kill Messages {
  2526.    @ msgwinon = [NO]
  2527.    ^on ^window_kill -Messages
  2528.   }
  2529.   @ _messages = [messages]
  2530.   if (ch.winsizepos[$%_messages]) {
  2531.   #^window new level msgs name Messages font $word(0 $ch.winsizepos[$%_messages]) setwindowpos sp $ref(2-5 $ch.winsizepos[$%_messages])
  2532.    @ newwindow(1 1 $word(0 $ch.winsizepos[$%_messages]) menubar Messages $ref(2-5 $ch.winsizepos[$%_messages]))
  2533.    ^window name Messages
  2534.    ^window level msgs
  2535.   }{
  2536.    ^window new level msgs name Messages 
  2537.   }
  2538.   //^assign -_messages
  2539.   @ msgwinon = [YES]
  2540.  }
  2541. }
  2542. alias mirckick {
  2543.  gecho miRC Kicking is On
  2544.  gecho If miRC Kicking is on, when you version
  2545.  gecho a channel, all miRC users will be kicked
  2546.  @ m.count = 0
  2547.  @ m.kick = [$"turn miRC kicking (on/off): "]
  2548.  if ([$m.kick]==[on]) {
  2549.   ^on #-ctcp_reply 23 "*VERSION*mIRC*" {
  2550.   @ m.count++
  2551.   //kick $C $0 \miRC Lamer \($m.count\)
  2552.  }
  2553.  gecho miRC kicking is now ON}
  2554.  if ([$m.kick]==[off]) {
  2555.   ^on #-ctcp_reply 23 -"*VERSION*mIRC*"
  2556.   gecho miRC kicking is now OFF
  2557.  }
  2558. }
  2559.  
  2560. alias pirchkick {
  2561.  gecho PIRCH Kicking is On
  2562.  gecho If PIRCH Kicking is on, when you version
  2563.  gecho a channel, all PIRCH users will be kicked
  2564.  @ pr.count = 0
  2565.  @ pr.kick = [$"turn Pirch kicking (on/off): "]
  2566.  if ([$pr.kick]==[on]) {
  2567.   ^on #-ctcp_reply 23 "*VERSION*PIRCH*" {
  2568.   @ pr.count = pr.count + 1
  2569.   //kick $C $0 \PIRCH Lamer \($pr.count\)
  2570.  }
  2571.  gecho PIRCH kicking is now ON}
  2572.  if ([$pr.kick]==[off]) {
  2573.   ^on #-ctcp_reply 23 -"*VERSION*PIRCH*"
  2574.   gecho PIRCH kicking is now OFF
  2575.  }
  2576. }
  2577.  
  2578. alias mmode {^quote mode $* }
  2579.  
  2580. alias msglogtog {
  2581.  if (logging==[ON]) {
  2582.   ^hook gzlog off
  2583.   gecho ${gc.msgloginfo}logging of messages OFF
  2584.   setlog OFF
  2585.  }{
  2586.   ^hook gzlog on
  2587.   gecho ${gc.msgloginfo}logging of messages ON${cl}
  2588.   setlog ON
  2589.  }
  2590. }
  2591.  
  2592. alias mop {
  2593.  if (C) {
  2594.   if (ischanop($N $C)) {
  2595.    @ _mo.u = chanusers($C)
  2596.    @ _mo.t = #_mo.u
  2597.    @ _mo.l = []
  2598.    for ( @ _mo.i = 0, _mo.i < _mo.t, @ _mo.i++) {
  2599.     if (ischanop($word($_mo.i $_mo.u) $C)) {
  2600.     }{
  2601.      push _mo.l $word($_mo.i $_mo.u)
  2602.     }
  2603.    }
  2604.    if (_mo.l) {
  2605.     gbecho ┌───────────────────┐
  2606.     gbecho │ Opping $[3]#_mo.l NonOps │
  2607.     gbecho └───────────────────┘
  2608.     op $_mo.l
  2609.    }{gecho There are no NonOps to Op}
  2610.   }{gecho You are Not Opped}
  2611.  }{gecho No current channel in this window}
  2612.  purge _mo
  2613. }
  2614.  
  2615. alias massdop {mdeop $*}
  2616. alias mdeop {
  2617.  if (C) {
  2618.   if (ischanop($N $C)) {
  2619.    @ _md.o = stripw($N $gz.chanops($C))
  2620.    gbecho ┌────────────────────────────────────────────────┐
  2621.    gbecho │ Mass Deoping  $[3]#_md.o ChanOps... It's on your head │
  2622.    gbecho └────────────────────────────────────────────────┘
  2623.    deop $_md.o
  2624.    purge _md
  2625.   }{gecho You are not op'd}
  2626.  }{gecho No current channel}
  2627. }
  2628.  
  2629. alias reop {if (C) {if (ischanop($N $C)) {//mode $C -o+o $0 $0}{gecho You are not a chaneop}}{gecho You are not on a channel}}
  2630. alias mreop {
  2631.  if (C) {
  2632.   if (ischanop($N $C)) {
  2633.    op $stripw($N $gz.chanops($C))
  2634.   }{gecho You are not op'd}
  2635.  }{gecho No current channel}
  2636. }
  2637.  
  2638.  
  2639. alias msglogchk {if ([$logging]==[ON]) {gecho ${gc.msgloginfo}Messages are Currently Being Logged${cl}}{gecho ${gc.msgloginfo}Messages are Not Being Logged${cl}}}
  2640. alias m msg $*
  2641. alias mm describe $*
  2642.  
  2643. ##mme and #msay (original gemini)
  2644. alias mme {
  2645.  if ([$0]) {
  2646.   @ me.a = [$0-]
  2647.   @ me.ea = [$encode($0-)]
  2648.   fe ($myservers(1)) me.s {
  2649.    evalserver $me.s {@ me.l = gz.fixsend($mychannels())}
  2650.    evalserver $me.s {
  2651.     if (me.l) {
  2652.      .send $me.l ACTION $me.a\
  2653.      ^assign -me.l
  2654.     }
  2655.    }
  2656.    evalserver $me.s {
  2657.     fe ($mychannels()) me.c {
  2658.      @ me.t = [x]
  2659.      evalserver $me.s {xecho -target $me.c $gemz.act ${gc.action}$N${cl} $me.a}
  2660.     }
  2661.    }
  2662.   }
  2663.   if (!me.t) {gecho You need to be in a channel to send public actions.}
  2664.   purge me
  2665.  }{gecho Usage: /mme <action>}
  2666. }
  2667.  
  2668. alias tzmme {
  2669.  if ([$0]) {
  2670.   @ me.a = [$0-]
  2671.   @ me.ea = [$encode($0-)]
  2672.   fe ($myservers(1)) me.s {
  2673.    evalserver $me.s {@ me.l = gz.fixsend($stripw(#twilight_zone $mychannels()))}
  2674.    evalserver $me.s {
  2675.     if (me.l) {
  2676.      .send $me.l ACTION $me.a\
  2677.      ^assign -me.l
  2678.     }
  2679.    }
  2680.    evalserver $me.s {
  2681.     fe ($stripw(#twilight_zone $mychannels())) me.c {
  2682.      @ me.t = [x]
  2683.      evalserver $me.s {xecho -target $me.c $gemz.act ${gc.action}$N${cl} $me.a}
  2684.     }
  2685.    }
  2686.   }
  2687.   if (!me.t) {gecho You need to be in a channel to send public actions.}
  2688.   purge me
  2689.  }{gecho Usage: /mme <action>}
  2690. }
  2691.  
  2692.  
  2693.  
  2694. alias fix.str {
  2695.  fec ($0-) _fs.c {
  2696.   if (index(\;\(\)\[\]\{\}\" $_fs.c) >= 0) {
  2697.    @ _fs.s #= [\\] ## _fs.c]
  2698.   }{
  2699.    @ _fs.s #= _fs.c
  2700.   }
  2701.  }
  2702.  @ FUNCTION_RETURN = _fs.s
  2703.  purge _fs
  2704. }
  2705.  
  2706. alias fix.estr {
  2707.  fec ($decode($0-)) _fs.c {
  2708.   if (index(\;\(\)\[\]\{\}\" $_fs.c) >= 0) {
  2709.    @ _fs.s #= [\\] ## _fs.c
  2710.   }{
  2711.    @ _fs.s #= _fs.c
  2712.   }
  2713.  }
  2714.  @ FUNCTION_RETURN = _fs.s
  2715.  purge _fs
  2716. }
  2717.  
  2718. alias msay {
  2719.  if ([$0]) {
  2720.   @ _ms.m = [$0-]
  2721.   fe ($myservers(1)) _ms.s {
  2722.    evalserver $_ms.s {@ _ms.l = gz.fixsend($mychannels())}
  2723.    evalserver $_ms.s {if (_ms.l) {.send $_ms.l $_ms.m}}
  2724.    evalserver $_ms.s {
  2725.     fe ($mychannels()) _ms.c {
  2726.      @ _ms.t = [x]
  2727.      evalserver $_ms.s {xecho -target $_ms.c ${gc.pubbrac}<${cl}${gc.spub}${N}${gc.pubbrac}>${cl} $_ms.m}
  2728.     }
  2729.    }
  2730.    ^assign -_ms.l 
  2731.   }
  2732.   if (!_ms.t) {gecho You need to be in a channel to send public actions.}
  2733.   purge _ms
  2734.  }{gecho Usage: /msay <text>}
  2735. }
  2736.  
  2737. #n#
  2738. alias nnotice quote NOTICE $0 :$1-
  2739. alias names {
  2740.  if ([$0]) {
  2741.   if (match($0 $mychannels())) {
  2742.    if ([$0]==[*]) {/csc $C}{/csc $0}
  2743.   }{
  2744.    //names $0
  2745.   }
  2746.  }{
  2747.   /csc $C
  2748.  }
  2749. }
  2750. alias nban @function_return= [$2!]##fixname($0 $2)##[@]##fixdomain($1 $2)
  2751. alias netbroke {
  2752.  @ signcross[$2][$0][$1] = 1
  2753.  @ signoffs[$0][$1] = [$2]
  2754.  @ splittime[$2] = time()
  2755.  ^if ( isbroke[$2] ) {} {
  2756.   ^hook gznetsplit
  2757.   fe ($mychannels()) _mc {
  2758.    if (!isminimized($_mc)) {
  2759.     xecho -target $_mc $gemz netsplit: ${gc.split}$4${cl} <-> ${gc.split}$3${cl} ${gc.peren}\(${cl}$Z${gc.peren}\)${cl}
  2760.     @ _mincheck = 1
  2761.    }
  2762.   }
  2763.   ^assign -_mc
  2764.   if (!_mincheck) {
  2765.    gecho netsplit: ${gc.split}$4${cl} <-> ${gc.split}$3${cl} ${gc.peren}\(${cl}$Z${gc.peren}\)${cl}
  2766.   }
  2767.    gecho Press CONTROL-F to see who left
  2768.   ^assign -_mincheck
  2769.   @ isbroke[$2] = 1
  2770.   @ splitname[$2] = [$3-]
  2771.  }
  2772. }
  2773.  
  2774. alias netjoined {
  2775.  if (signoffs[$0][$1]) {
  2776.   ^if (isbroke[$signoffs[$0][$1]] ) {
  2777.    ^hook gznetjoin
  2778.    fe ($mychannels()) _mc {
  2779.     if (!isminimized($_mc)) {
  2780.      @ _mincheck = 1
  2781.      xecho -target $_mc $gemz netjoined: ${gc.peren}\(${cl}$splitname[$signoffs[$0][$1]]${gc.peren}\)${cl} ${gc.peren}\[${cl}$Z${gc.peren}]${cl}
  2782.     }
  2783.    }
  2784.    ^assign -_mc
  2785.    if (!_mincheck) {
  2786.     gecho netjoined: ${gc.peren}\(${cl}$splitname[$signoffs[$0][$1]]${gc.peren}\)${cl} ${gc.peren}\[${cl}$Z${gc.peren}]${cl}
  2787.    }
  2788.    ^assign -_mincheck
  2789.   }
  2790.   ^assign -isbroke[$signoffs[$0][$1]]
  2791.   ^assign -signcross[$signoffs[$0][$1][$0][$1]
  2792.   ^assign -signoffs[$0][$1]
  2793.  }{
  2794.   if (!match($2 $lchanlist)) {
  2795.    if ((gz.notifyoper) && ([$3] != N)) {
  2796.     csq.aqueue $lastserver() gz.testoperex $%3 $%2
  2797.    }
  2798.    gz.secho join $2 ${gc.join}$3 ${gc.peren}\(${gc.joinuh}$4-${gc.peren}\)${cl} has joined ${gc.join}$2${cl} $timestamp()
  2799.    gz.playsnd join
  2800.   }
  2801.  }
  2802. }
  2803.  
  2804. #Written by mikh
  2805. alias nick {
  2806.  if ([$1] == [-all]) {
  2807.   for (@ii=0, servername($ii), @ii++) {
  2808.    if (isconnected($ii)) {evalserver $ii {//quote nick $0}}
  2809.   }
  2810.  }{//quote nick $*}
  2811. }
  2812.  
  2813. alias nt if (ischannel($0)) {quote topic $0 :}{quote topic $C :}
  2814. alias nochat {
  2815.  if ([$0]) {
  2816.   if (chanwindow(=$0)) {
  2817.    window show $chanwindow(=$0)
  2818.    //^dcc close chat $0
  2819.     //^window refnum \=$0_Queried kill
  2820.     ^on ^window_kill -\=$0_Queried 
  2821.   }{
  2822.    gecho No current Chat Session open for $0
  2823.   }
  2824.  }{
  2825.   if (current_chat) {
  2826.    dcc close chat $current_chat
  2827.    ^assign -current_chat
  2828.   }
  2829.   if (lastd_chat) {
  2830.    dcc close chat $lastd_chat
  2831.    ^assign -lastd_chat
  2832.   }
  2833.  }
  2834. }
  2835.  
  2836. alias -notify
  2837.  
  2838. alias netclean {
  2839.  foreach splittime ii {
  2840.   foreach splittime.$ii jj {
  2841.    if ( time() - splittime[$ii][$jj] > 300 ) {
  2842.     foreach signcross.$(ii).$jj xx {
  2843.      foreach signcross.$(ii).$(jj).$xx yy {
  2844.       ^assign -signcross[$ii][$jj][$xx][$yy]
  2845.       ^assign -signoffs[$xx][$yy]
  2846.      }
  2847.     }
  2848.     ^assign -xx
  2849.     ^assign -yy
  2850.     ^assign -isbroke[$ii][$jj]
  2851.     ^assign -splitname[$ii][$jj]
  2852.     ^assign -splittime[$ii][$jj]
  2853.    }
  2854.   }
  2855.  }
  2856.  ^assign -ii
  2857.  ^assign -jj
  2858. }
  2859. alias netpurge {purge isbroke;purge splitname;purge splittime;purge signcross;purge signoffs}
  2860. alias noig unig $*
  2861. alias notalk {if ([$0]) {window refnum $0_Queried kill}{Gecho Usage notalk <nick>}}
  2862. alias nw {gz.playsnd wopen;//window new}
  2863. #o#
  2864. ^set input_prompt ▒▒▒░░░░░░░░░░░░░░░░░15% (General Aliases)
  2865.  
  2866. alias oldhelp {
  2867.  @ _ghelp = []
  2868.  //help -file $exedir/OpenChat.hlp
  2869.  //help $*
  2870. }
  2871.  
  2872. # Synch check funtion (Orig. by SrfRoG)
  2873. alias on_desynch {
  2874.  if ([$0]!=[$lct.sync]) {
  2875.   if ([$0]!=[$S]) {
  2876.    ^timer -d 111
  2877.    gecho You are ${gc.errortopic}desynched${cl} in $1 $0 ${gc.peren}\( $2- ${gc.peren}\)${cl}
  2878.    @ lct.sync = [$0]
  2879.   }
  2880.  }
  2881.  ^timer -r 111 60 ^assign -lct.sync
  2882. }
  2883.  
  2884. alias ov {
  2885.  if ([$ov]==[on]) {
  2886.   @ ov = [off]
  2887.   ^window refnum OperView kill
  2888.   umode -fcksw
  2889.  }{
  2890.   @ ov = [on]
  2891.   @ _OperView = [OperView]
  2892.   ^on ^window_kill OperView {
  2893.    @ ov = [OFF]
  2894.    umode -fcksw     
  2895.   }
  2896.   gz.playsnd wopen
  2897.   if (ch.winsizepos[$%_OperView]) {
  2898.    @ newwindow(1 1 $word(0 $ch.winsizepos[$%_OperView]) menubar OperView $ref(2-5 $ch.winsizepos[$%_OperView]))
  2899.    ^window name OperView level wallop,opnote,snote
  2900.   }{
  2901.    window new level wallop,opnote,snote 
  2902.    window name OperView
  2903.   }  
  2904.   umode +fcksw
  2905.   ^on ^window_kill OperView {
  2906.    @ ov = [OFF]
  2907.    umode -fcksw     
  2908.   }
  2909.   gecho GemZ mini-OperView is now $ov\
  2910.  }
  2911. }
  2912.  
  2913. #p#
  2914. #hack to fix variable padding limitation in ircii
  2915.  
  2916. alias padword {
  2917. #0 = num chars total (- indicates to the left)
  2918. #1 = word to display
  2919.  @ _p.nc = strip(- $0)
  2920.  @ _p.w = [$@1]
  2921.  if (_p.nc > _p.w) {@ _p.ns = _p.nc - _p.w}{@ _p.ns = 0}
  2922.  if (left(1 $0) == [-]) {
  2923.   @ function_return = padspace($_p.ns) ## left($_p.nc $1)
  2924.  }{
  2925.   @ function_return = right($_p.nc $1) ## padspace($_p.ns)
  2926.  }
  2927.  purge _p
  2928. }
  2929.  
  2930. alias padspace {
  2931.  if ([$0]) {
  2932.   for (@ _idx = 0, _idx < [$0], @ _idx++) {@ _out #=[ ]}
  2933.   @ function_return = [$_out]
  2934.   ^assign -_out
  2935.  }
  2936. }
  2937.  
  2938. alias paway {away -p $*}
  2939. alias pback {if ([$0]) {me $str.back \($0-\) $gemz.str}{me $str.back $gemz.str}}
  2940. alias p ping $*
  2941. alias ping {
  2942.  if ([$0]) {//ping $*
  2943.  }{
  2944.   if (C) {
  2945.    //ping $C
  2946.   }{
  2947.    gecho No current channel
  2948.   }
  2949.  }
  2950. }
  2951.  
  2952. alias playfile {
  2953.  if (file.exist($*)) mmpm.playfile $*
  2954.  else if ((fn = searchpath($* $SOUND_PATH)) != []) {
  2955.   mmpm.playfile "$fn"
  2956.  }
  2957.  ^assign -fn
  2958. }
  2959. alias play playfile $*
  2960. alias mci {@ _rc = mciapi(raw $0-);if (_rc) {echo [mci] Error: $mciapi(errstring $_rc)}{if (mciapi(result) != []) {echo [mci] Result: $mciapi(result)}};^assign -_rc}
  2961.  
  2962. alias p ping $*
  2963. alias pubreply {
  2964.  //type ^U
  2965.  fec ($decode($pubreplynick)) _pbc {//type $^^_pbc}
  2966.  //type : 
  2967.  ^assign -_pbc
  2968. }
  2969.  
  2970. #not needed with openchat
  2971. #alias purge {foreach $0 ii {purge $0.$ii};//^assign -ii;//^assign -$0}
  2972.  
  2973. alias previewbynum {
  2974.  for (@ _pr.idx = 0, _pr.item = dccitem($_pr.idx), @ _pr.idx++) {
  2975.   if ([$word(9 $_pr.item)]==[$0]) {
  2976.    @ _pr.ext = right(4 $word(8 $_pr.item))
  2977.    if (match($_pr.ext .ico .tif .pcx .bmp .jpg .gif .tga .png)) {
  2978.     gecho $gx AutoPreview: $word(8 $_pr.item)
  2979.     exec -start $imageviewer /sho $word(8 $_pr.item)
  2980.    }
  2981.    //break
  2982.   }
  2983.  }
  2984.  purge _pr
  2985. }
  2986.  
  2987. #q#
  2988. alias query talk $*
  2989.  
  2990. alias quit {
  2991.  if ([$0]) {
  2992.   //quit $cntl2mirc(f0 $*)
  2993.  }{
  2994.   @ signoffmsg = [$rand($NUMQUIT)]
  2995.   //signoff $quit[$signoffmsg] $gemz.str
  2996.  }
  2997. }
  2998. alias quiet {
  2999.  if ([$0]) {
  3000.   if (ischanop($N $C)) {
  3001.    //mode $C -v $0
  3002.   }{gecho You are not a channel Operator}
  3003.  }{gecho Usage: //quiet <nick>}
  3004. }
  3005. #r#
  3006. alias rctcp {if ([$0]) {//quote notice $0 :$1-;}{gecho Usage: /rctcp <nick/channel> msg}}
  3007. alias rl readlog $*
  3008. alias readlog {
  3009.  if ([$0]==[-r]) {
  3010.   @ tmpcnt = msglog_cnt
  3011.   while (tmpcnt>=1) {
  3012.    @ tmpmsg = encode($messagelog[$tmpcnt])
  3013.    echo ${gc.msgfrom}\[${cl}$[3]tmpcnt${gc.msgfrom}\]${cl} $decode($tmpmsg)
  3014.    @ tmpcnt--
  3015.   }
  3016.  }{
  3017.   @ tmpcnt = 1
  3018.   gecho *** ${gc.msgloginfo}Starting Message Log ${cl}***
  3019.   while (tmpcnt<=msglog_cnt) {
  3020.    @ tmpmsg = encode($messagelog[$tmpcnt])
  3021.    echo ${gc.msgfrom}\[${cl}$[-3]tmpcnt${gc.msgfrom}\]${cl} $decode($tmpmsg)
  3022.    @ tmpcnt++
  3023.   }
  3024.  }
  3025.  ^assign -tmpmsg;^assign -tmpcnt
  3026. }
  3027. alias rpl readpublog $*
  3028. alias readpublog {
  3029.  if ([$0]==[-r]) {
  3030.   @ tmpcnt = [$publog_cnt]
  3031.   while (tmpcnt>=1) {
  3032.    @ tmpmsg = encode($publog[$tmpcnt])
  3033.    echo ${cl}\[$[-3]tmpcnt\]${gc.msginfo}FROM:${cl} ${gc.msgfrom}$[22]word(1 $decode($tmpmsg))  ${gc.msginfo}Time:${cl} \$stime($word(3 $decode($tmpmsg)))\${cl}
  3034.    echo ..${gc.msginfo}Channel:${cl} ${gc.msgchan}$[20]word(2 $decode($tmpmsg))${cl} ${gc.msginfo}Network:${cl} \$word(0 $decode($tmpmsg))\${cl}
  3035.    echo ..${gc.msginfo}Message:${cl} $ref(5- $decode($tmpmsg))${cl}
  3036.    echo 
  3037.    @ tmpcnt--
  3038.   }
  3039.  }{
  3040.   @ tmpcnt = 1
  3041.   gecho *** ${gc.msgloginfo}Starting Public Log ${cl}***
  3042.   while (tmpcnt<=publog_cnt) {
  3043.    @ tmpmsg = encode($publog[$tmpcnt])
  3044.    echo ${cl}\[$[-3]tmpcnt\]${gc.msginfo}FROM:${cl} ${gc.msgfrom}$[22]word(1 $decode($tmpmsg))  ${gc.msginfo}Time:${cl} \$stime($word(3 $decode($tmpmsg)))\${cl}
  3045.    echo ..${gc.msginfo}Channel:${cl} ${gc.msgchan}$[20]word(2 $decode($tmpmsg))${cl} ${gc.msginfo}Network:${cl} \$word(0 $decode($tmpmsg))\${cl}
  3046.    echo ..${gc.msginfo}Message:${cl} $ref(5- $decode($tmpmsg))${cl}
  3047.    echo 
  3048.    @ tmpcnt++
  3049.   }
  3050.  }
  3051.  ^assign -tmpmsg
  3052.  ^assign -tmpcnt
  3053. }
  3054.  
  3055. alias remall {remlog;rempublog}
  3056. alias remlog {
  3057.  if (gz.confirm) {@ _con = [$"Are you sure you want to delete the private log? [Y/n] "]}{@ _con = [Y]}
  3058.  if (_con == [Y] || _con == []) {
  3059.   purge messagelog;@ msglog_cnt = [0];^set status_user2 [M:$msglog_cnt/P:$publog_cnt];gecho ${gc.msgloginfo}Message Log has been removed
  3060.  }
  3061.  ^assign -_con
  3062. }
  3063.  
  3064. alias rempublog {
  3065.  if (gz.confirm) {@ _con = [$"Are you sure you want to delete the public log? [Y/n] "]}{@ _con = [Y]}
  3066.  if (_con == [Y] || _con == []) {
  3067.   purge publog;@ publog_cnt = [0];^set status_user2 [M:$msglog_cnt/P:$publog_cnt];gecho ${gc.msgloginfo}Public Log has been removed
  3068.  }
  3069.  ^assign -_con
  3070. }
  3071.  
  3072. alias relsm if ([$0]) {msg $0 $lastsmsg}{send $lastsmsg}
  3073. alias relsn if ([$0]) {msg $0 $lastsnot}{send $lastsnot}
  3074. alias relm if ([$0]) {msg $0 $last.mesg}{send $last.mesg}
  3075. alias reln if ([$0]) {msg $0 $last.noti}{send $last.noti}
  3076. alias rgenderex {@ function_return = gender == [his] ? [her] : [him]}
  3077. alias rgender {@ function_return = gender == [his] ? [her] : [his]}
  3078. alias klm {
  3079.  if (C) {
  3080.   if (match($last.mesg.from $chanusers($C))) {
  3081.    if (ischanop($N $C)) {
  3082.     /k $last.mesg.from $last.mesg
  3083.    }{gecho You are Not op'ed}
  3084.   }{gecho $last.mesg.from is not in $C}
  3085.  }{gecho You are not in a channel}
  3086. }
  3087.  
  3088. alias bklm {
  3089.  if (C) {
  3090.   if (match($last.mesg.from $chanusers($C))) {
  3091.    if (ischanop($N $C)) {
  3092.     /k $last.mesg.from $last.mesg
  3093.     /ban $last.mesg.from
  3094.    }{gecho You are Not op'ed}
  3095.   }{gecho $last.mesg.from is not in $C}
  3096.  }{gecho You are not in a channel}
  3097. }
  3098.  
  3099. #s#
  3100. alias _snapwindows {
  3101.  for (@ _idx = 0, win = winitem($_idx), @ _idx++) {
  3102.   if (ch.winsizepos[$%word(3 $win)]) {
  3103.    //window $word(0 $win) setwindowpos sp $ref(2-5 $ch.winsizepos[$%word(3 $win)]) font $word(0 $ch.winsizepos[$%word(3 $win)])
  3104.   }
  3105.  }
  3106. }
  3107.  
  3108. alias savec {
  3109.  if ([$0]) {
  3110.  @ gsavec = open($0 W T D)
  3111.  @ write($gsavec #GemZ $gemz.vers Color Save File)
  3112.  @ write($gsavec /SET DRAW_STATUS_BORDERS $DRAW_STATUS_BORDERS)
  3113.  @ write($gsavec /SET COLOR_NORMAL $COLOR_NORMAL)
  3114.  @ write($gsavec /SET COLOR_BOLD $COLOR_BOLD)
  3115.  @ write($gsavec /SET COLOR_UNDERLINE $COLOR_UNDERLINE)
  3116.  @ write($gsavec /SET COLOR_REVERSE $COLOR_REVERSE)
  3117.  @ write($gsavec /SET COLOR_BOLD_UNDERLINE $COLOR_BOLD_UNDERLINE)
  3118.  @ write($gsavec /SET COLOR_BOLD_REVERSE $COLOR_BOLD_REVERSE)
  3119.  @ write($gsavec /SET COLOR_UNDERLINE_REVERSE $COLOR_UNDERLINE_REVERSE)
  3120.  @ write($gsavec /SET COLOR_BOLD_UNDERLINE_REVERSE $COLOR_BOLD_UNDERLINE_REVERSE)
  3121.  @ write($gsavec /SET COLOR_STATUS $COLOR_STATUS)
  3122.  @ write($gsavec /SET COLOR_STATUS_BRIGHT_BORDER $COLOR_STATUS_BRIGHT_BORDER)
  3123.  @ write($gsavec /SET COLOR_STATUS_DARK_BORDER $COLOR_STATUS_DARK_BORDER)
  3124.  @ write($gsavec /SET COLOR_INPUT $COLOR_INPUT)
  3125.  @ write($gsavec /SET COLOR_NICKLIST $COLOR_NICKLIST)
  3126.  @ write($gsavec /SET COLOR_NICKLIST_HIGHLIGHT $COLOR_NICKLIST_HIGHLIGHT)
  3127.  for (@_ii=0,_ii<=86,@_ii++) {
  3128.   @ write($gsavec /set COLOR_USER_$_ii $(COLOR_USER_$_ii))
  3129.  }
  3130.  ^assign -_ii
  3131.  @ write($gsavec /SET DROP_DRAW_HINTS $DROP_DRAW_HINTS)
  3132.  @ write($gsavec /SET DROP_HINTS_COLOR $DROP_HINTS_COLOR)
  3133.  @ write($gsavec /PARSEKEY REFRESH_SCREEN $REFRESH_SCREEN)
  3134.  @ close($gsavec)
  3135.  }{gecho Usage: /savec <filename>;gecho     eg.  /savec mycolors.gzc}
  3136. }
  3137.  
  3138. alias savelog {
  3139.  if ([$msglog_cnt]!=[0]) {
  3140.   input "Full path and file name to save message log to : " if ([$0]) {
  3141.    @ _s.log = open($0 W T)
  3142.    @ write($_s.log ********Message Log saved: $fixdate($time())*********)
  3143.    @ tmpcnt = 1
  3144.    while (tmpcnt<=msglog_cnt) {
  3145.     @ tmpmsg = encode($messagelog[$tmpcnt])
  3146.     @ write($_s.log $tmpcnt $strip( $decode($tmpmsg)))
  3147.     @ tmpcnt++
  3148.    }
  3149.    gecho Message Log saved to $0
  3150.    @ write($_s.log *********End of Message LOG**********)
  3151.    @ close($_s.log)
  3152.   }{gecho No file name specified... aborting.}
  3153.   ^assign -tmpmsg;^assign -tmpcnt;assign -_s.log
  3154.  }{gecho There are no messages to save}
  3155. }
  3156. alias sb showbans $*
  3157.  
  3158. alias sban {
  3159.  if (C) {
  3160.   if (ischanop($N $C)) {
  3161.    if ([$0]) {
  3162.     if (uh($0)) {
  3163.      //mode $C -o+b $0 $_sban($0 $uh($0))
  3164.     }{
  3165.      @ sban[$%0] = C
  3166.      userhost $0 -cmd if ([$4]!=[<UNKNOWN>]) {
  3167.       //mode $sban[$%0] +b $_sban($0 $3@$4)
  3168.       ^assign -sban[$%0]
  3169.      }{
  3170.       gecho I couldn't find $0 on IRC.
  3171.       ^assign -sban[$%0]
  3172.      }
  3173.     }
  3174.    }
  3175.   }{gecho You are not a ChanOp on $C}
  3176.  }{gecho You are not on a channel}
  3177. }
  3178.  
  3179. alias _sban {
  3180.  @ _nb.u = strip(~ $mid(0 $index(@ $1) $1))
  3181.  @ _nb.u = right(8 $_nb.u)
  3182.  @ _nb.h = strip(@ $mid($index(@ $1) $@1 $1))
  3183.  @ __sban.h = _nb.u ## [@] ## _nb.h
  3184.  fec ($__sban.h) __sban.c {
  3185.   if ([$__sban.c]!=[.] && [$__sban.c]!=[@]) {
  3186.    @ __sban.r #= rand(10) > 5 ? __sban.c : [?]
  3187.   }{
  3188.    @ __sban.r #= __sban.c
  3189.   }
  3190.  }
  3191.  @ FUNCTION_RETURN = [*!*$__sban.r]
  3192.  purge __sban
  3193.  purge _nb
  3194.  ^assign -rnd
  3195. }
  3196.  
  3197. alias sbk {if ([$0]) {k $0 $1-;sban $0;}{gecho Usage /sbk <nick> [<reason>]}}
  3198. alias sbki {if ([$0]) {k $0 $1-;sban $0;ig $0}{gecho Usage /sbki <nick> [<reason>]}}
  3199. alias setwall {//type ^U\/wall }
  3200.  
  3201. alias servernum {
  3202.  @ function_return = lastserver()
  3203.  for (@ _my.i = 0, _my.s = servername($_my.i), @ _my.i++) {
  3204.   if (_my.s == [$0]) {
  3205.    @ function_return = _my.i
  3206.    //break
  3207.   }
  3208.  }
  3209.  purge _my
  3210. }
  3211.  
  3212. alias signoff {
  3213.  @ _si.msg = [$0-]
  3214.  if (newsettings) {
  3215.   input "Settings have changed, would you like to save before quitting? [Y/n]" if ([$0]==[y]) {/save;_signoff $_si.msg;^assign -_si.msg}{_signoff $_si.msg;^assign -_si.msg}
  3216.  }{
  3217.   _signoff $0-
  3218.   ^assign -_si.msg
  3219.  }
  3220. }
  3221.  
  3222. alias _signoff {
  3223.  @ si.msg = [$0-]
  3224.  if (dccitem(0)!=[]) {
  3225.   input "You have DCC's in progress, are you sure you wish to Quit IRC? [Y/n]" if ([$0]==[y]) {
  3226.    if (si.msg) {
  3227.     //signoff $cntl2mirc(f0 $si.msg) $gemz.str
  3228.    }{
  3229.     //signoff $quit[$rand($numquit)] $gemz.str
  3230.    }
  3231.   }
  3232.  }{
  3233.   if (si.msg) {
  3234.    //signoff $si.msg $gemz.str
  3235.   }{
  3236.    //signoff $quit[$rand($numquit)] $gemz.str
  3237.   }
  3238.  }
  3239.  ^assign -si.msg
  3240. }
  3241.  
  3242. alias save gsave $*
  3243. alias saveall gsave $*
  3244. alias sc names $*
  3245. alias setaway away $*
  3246. alias setback back $*
  3247. alias setup {gecho NOTE:  All Setup Items are now in the Main Main Menu->Setup.}
  3248. alias showbans banstat $*
  3249. alias showajoin {
  3250.  gecho ***${gc.errortopic}Listing Auto Join Channels${cl}***
  3251.  fe ($autojoinlist) ii {
  3252.   if (ajkeys[$%ii]) {
  3253.    gecho $ii    Key: $ajkeys[$%ii]
  3254.   }{
  3255.    gecho $ii
  3256.   }
  3257.  }
  3258.  gecho ***End of List***
  3259.  ^assign -ii
  3260. }
  3261. alias showignore {
  3262.     /ignore
  3263. }
  3264.  
  3265. alias shownotify {
  3266.  gbecho ╔═════════════╦════════════════════════════╦═════════════╗
  3267.  gbecho ║ Notify List ║    Online  /  Not Online   ║ Notify List ║
  3268.  gbecho ╠═════════════╩════════════════════════════╩═════════════╝
  3269.  @ _sh.u = notify()
  3270.  @ _sh.t = #_sh.u
  3271.  for (@_sh.i = 0, _sh.i < _sh.t, @_sh.i++) {
  3272.   if (match($word($_sh.i $_sh.u) $notify(on)) >= 1) {
  3273.    @ _sh.l = [$_sh.l \$word($_sh.i $_sh.u)\]
  3274.   }{@ _sh.l = [$_sh.l \$word($_sh.i $_sh.u)\]}
  3275.  }
  3276.  fe ($_sh.l) _sh.1 _sh.2 _sh.3 _sh.4 _sh.5 {
  3277.   gbecho ║ $[-11]_sh.1 $[-11]_sh.2 $[-11]_sh.3 $[-11]_sh.4 $[-11]_sh.5 
  3278.  }
  3279.  gbecho ╠═════════════╦════════════════════════════╦═════════════╗
  3280.  gbecho ║ End Of List ║ /unnotify <nick> to Remove ║ End Of List ║
  3281.  gbecho ╚═════════════╩════════════════════════════╩═════════════╝
  3282.  purge _sh
  3283. }
  3284.  
  3285. alias si signoff $*
  3286.  
  3287. alias sp smartpaste $*
  3288. alias SmartPaste {
  3289. # following code puts each string form a clipboard to str[0] str[1], etc
  3290. # 'total' is a number of strings
  3291.  @ text = clipbrd(1)
  3292.  @ total = 0
  3293.  while ((idx = index($chr(10) $text)) != -1) {
  3294.   @ str[${total++}] = mid(0 ${idx} $text)
  3295.   @ text = mid(${idx+1} $@text $text)
  3296.  }
  3297.  if (text != []) { @ str[${total++}] = text }
  3298.  ^assign -text
  3299.  ^assign -idx
  3300. # Now lets join strings until 512 bytes limit is reached or empty line
  3301.  @ msg = []
  3302.  @ msgcnt = 0
  3303.  for ( @ cnt = 0, cnt < total, @ cnt++ ) {
  3304.   if (is_empty_line($str[$cnt])) { 
  3305.    @ msg[${msgcnt++}] = msg
  3306.    @ msg = []
  3307.   }
  3308.   if (@msg + @str[$cnt] > 490) {
  3309.    @ msg[${msgcnt++}] = msg
  3310.    @ msg = []              
  3311.   }
  3312. # strip spaces from the end of 'msg' and beginning of str[cnt]
  3313.   while ( msg && isspace($right(1 $msg))) {
  3314.    @ msg = left(${@msg-1} $msg)
  3315.   }
  3316.   while ( str[$cnt] && isspace($left(1 $str[$cnt]))) {
  3317.    @ str[$cnt] = right(${@str[$cnt]-1} $str[$cnt])
  3318.   }
  3319.   @ msg = msg ## [ ] ## str[$cnt]
  3320.  }
  3321.  if (msg) { @ msg[${msgcnt++}] = msg }
  3322. # now purge arrays of strings from memory
  3323.  while (total) { ^assign -str.${--total} }
  3324. # now print msg array to a current channel or /query
  3325.  if ([$0]) {for (@ cnt = 0, cnt < msgcnt, @ cnt++) {//msg $0 $msg[$cnt]}}
  3326.  else if (T) {for (@ cnt = 0, cnt < msgcnt, @ cnt++) {//msg $T $msg[$cnt]}}
  3327.  else {gecho No current channel or active /query in this window...}
  3328. # and finally purge a msg array
  3329.  while (msgcnt) { ^assign -msg.${--msgcnt} }
  3330.  ^assign -total
  3331.  ^assign -cnt
  3332.  ^assign -msgcnt
  3333.  ^assign -msg
  3334. }
  3335.  
  3336. #Stripw (orginal asmodean)
  3337. alias stripw {
  3338.  for (@ __i = 1, [$($__i)] != [], @ __i = __i + 1) {
  3339.   if ([$($__i)] != [$0]) {@ _sw = _sw ## [ $($__i)]}
  3340.  }
  3341.  @ function_return = mid(1 2048 $_sw)
  3342.  ^assign -_sw;
  3343. }
  3344.  
  3345. #a Stripw retains quotes for words with spaces
  3346. alias gz.stripwex {
  3347.  @ _sw.l = [$1-]
  3348.  fe ($_sw.l) _sw.w {
  3349.   if ([$0] != _sw.w) {
  3350.    if (_sw.r) {
  3351.     @ _sw.r #= #_sw.w > 1 ? [ "$_sw.w"] : [ $_sw.w]
  3352.    }{
  3353.     @ _sw.r = #_sw.w > 1 ? ["$_sw.w"] : _sw.w
  3354.    }
  3355.   }
  3356.  }
  3357.  @ function_return = _sw.r
  3358.  purge _sw
  3359. }
  3360.  
  3361.  
  3362. alias sping {
  3363.  if ([$0]) {
  3364.   if (match(*.* $0)) {
  3365.    if ([$0]==S) {
  3366.     gecho Lag indicator on status bar already Indicates Ping time from server $S
  3367.    }{
  3368.     @ slag[$encode($tolower($0))] = time()
  3369.     //quote ping $0 $0
  3370.    }
  3371.   }{
  3372.    gecho ${gc.errortopic}ERROR:${cl}  Bad Server Name
  3373.   }
  3374.  }{
  3375.   gecho Usage: /sping <server>.  Pings server.
  3376.  }
  3377. }
  3378.  
  3379. alias sounds {
  3380.  if ([$0]) {
  3381.   switch ($0) {
  3382.    (-ctcp) {
  3383.     switch ($1) {
  3384.      (ON) {@ ctcpsound = [ON]}
  3385.      (OFF) {@ ctcpsound = [OFF]}
  3386.      (TOG) {@ ctcpsound = _tog($ctcpsound)}
  3387.      (*) {gecho Usage: /sounds [<-ctcp>] ON | OFF | TOG}
  3388.     }
  3389.    }
  3390.    (ON) {@ gz.sounds = 1}
  3391.    (OFF) {@ gz.sounds = 0}
  3392.    (TOG) {@ gz.sounds = _tog($gz.sounds)}
  3393.    (*) {gecho Usage: /sounds [<-ctcp>] ON | OFF |TOG}
  3394.   }
  3395.  }{
  3396.   gecho Usage: /sounds [<-ctcp>] ON | OFF |TOG
  3397.  }
  3398.  makesetupmenu
  3399.  gbecho ╔════════════════════════════╗
  3400.  gbecho ║ Sounds are now ${gz.sounds ? [ON  ] : [OFF ]}        ║
  3401.  gbecho ║ CTCP Sound playing is $[4]toupper($ctcpsound) ║
  3402.  gbecho ╚════════════════════════════╝
  3403. }
  3404.  
  3405. ##################
  3406. #IRCOP ONLY STUFF#
  3407. ##################
  3408. alias kline {
  3409.  if (gz.isoper()) {
  3410.   if ([$0]) {
  3411.    if ([$1]) {//quote kline $0 :$1-}{//quote kline $0 :Server Abuse}
  3412.   }{
  3413.    gecho Usage: /kline <nick | filter> [<reason>]
  3414.   }
  3415.  }{gecho You are not an Oper. (Local Oper mode off)}
  3416. }
  3417.  
  3418. alias mkill {
  3419.  if ([$0]) {
  3420.   if (gz.isoper()) {
  3421.    @ _mk.reason = [$"MultiKill Reason: "] 
  3422.    fe ($*) _mk.nick {//kill $_mk.nick $_mk.reason}
  3423.    purge _mk
  3424.   }{gecho You are not an Oper. (Local Oper mode off)}
  3425.  }{gecho Usage: /mkill <nick> [<nick1>] [<nick2>]...;gecho Usage: You will be prompted for kill reason}
  3426. }
  3427.  
  3428. alias kill {
  3429.  if (gz.isoper()) {
  3430.   if ([$0]) {
  3431.    //kill $0 $1-
  3432.   }{gecho Usage: /kill <nick> [<reason>]}
  3433.  }{gecho You are not an Oper. (Local Oper mode off)}
  3434. }
  3435.  
  3436. alias trace {
  3437.  if (gz.isoper()) {
  3438.   @ _trace.index = 0
  3439.   if ([$0]) {@ _trace.match = [$0]}{@ _trace.match = [*]}
  3440.   if ([$1]) {@ _trace.server = [$1]}{@ _trace.server = [$S]}
  3441.   gecho Tracing all users that match $_trace.match on $_trace.server
  3442.   ^on ^205 "*" {
  3443.    @ _trace.nuh = mid(0 $rindex([ $3) $3) ## [!] ## strip([] $mid($rindex([ $3) $rindex(] $3) $3))
  3444.    if (match($_trace.match $_trace.nuh)) {
  3445.     gecho TRACE: $[11]mid(0 $rindex([ $3) $3) $strip([] $mid($rindex([ $3) $rindex(] $3) $3))
  3446.     @ _trace.index++
  3447.    }
  3448.   }
  3449.   ^on ^200 "*" #
  3450.   ^on ^201 "*" #
  3451.   ^on ^202 "*" #
  3452.   ^on ^203 "*" #
  3453.   ^on ^204 "*" #
  3454.   ^on ^206 "*" #
  3455.   ^on ^208 "*" #
  3456.   ^on ^209 "*" #
  3457. #Reset all the on hooks we used.
  3458. #Also remove any assigns
  3459.   ^on ^262 "*" {
  3460.    gecho Total matched users: $_trace.index
  3461.    purge _trace
  3462.    ^on ^200 -"*"
  3463.    ^on ^201 -"*"
  3464.    ^on ^202 -"*"
  3465.    ^on ^203 -"*"
  3466.    ^on ^205 -"*"
  3467.    ^on ^206 -"*"
  3468.    ^on ^209 -"*"
  3469.    ^on ^262 -"*"
  3470.   }
  3471.   //trace $_trace.server
  3472.  }{
  3473.   //trace $*
  3474.  }
  3475. }
  3476.  
  3477. alias tracekill {
  3478.  if (gz.isoper()) {
  3479.   @ _trace.index = 0
  3480.   if ([$0]) {@ _trace.match = [$0]}{echo Not gonna kill *;@ _trace.match = [BLAH]}
  3481.   ^on ^205 "*" {
  3482.    @ _trace.nuh = mid(0 $rindex([ $3) $3) ## [!] ## strip([] $mid($rindex([ $3) $rindex(] $3) $3))
  3483.    if (match($_trace.match $_trace.nuh)) {
  3484.     @ _trace.index++
  3485.     kill $mid(0 $rindex([ $3) $3) FilterKill: $_trace.match \($_trace.index\) 
  3486.     }
  3487.   }
  3488.   ^on ^200 "*" #
  3489.   ^on ^201 "*" #
  3490.   ^on ^202 "*" #
  3491.   ^on ^203 "*" #
  3492.   ^on ^204 "*" #
  3493.   ^on ^206 "*" #
  3494.   ^on ^208 "*" #
  3495.   ^on ^209 "*" #
  3496. #Reset all the on hooks we used.
  3497. #Also remove any assigns
  3498.   ^on ^262 "*" {
  3499.    gecho Total matched users: $_trace.index
  3500.    purge _trace
  3501.    ^on ^200 -"*"
  3502.    ^on ^201 -"*"
  3503.    ^on ^202 -"*"
  3504.    ^on ^203 -"*"
  3505.    ^on ^205 -"*"
  3506.    ^on ^206 -"*"
  3507.    ^on ^209 -"*"
  3508.    ^on ^262 -"*"
  3509.   }
  3510.   //trace $S
  3511.  }{gecho You are not an oper.  (Local Oper Mode off)}
  3512. }
  3513.  
  3514.  
  3515. ######################
  3516. #STATS Command PARSER#
  3517. ######################
  3518. #The stats parser started by blackjac asking me some questions about a 
  3519. #stats k parser he and suicide wrote for his script Sentinel.  I helped him 
  3520. #out, and wrote my own in the mean time... 
  3521. #Thanks to blackjac for pushing me on this one :)
  3522.  
  3523. alias stats {
  3524.  switch ($0) {
  3525. #  (k) {//stats k $*}
  3526.   (K) {if ([$1]) {gz.fkline $1-}{gecho Usage: /stats k <filter>}}
  3527.   (*) {//stats $*}
  3528.  }
  3529. }
  3530.  
  3531. #####################
  3532. #Stats K Subfunction#
  3533. #####################
  3534. #Formatted for 2.8/hybrid-4.3. 
  3535. alias gz.fkline {
  3536.  if ([$0]) {
  3537.   @ _gzsk.match = [$0]
  3538.   @ _gzsk.fknum = 0
  3539.   gecho Finding all Klines that match $_gzsk.match
  3540.   ^on ^216 "*" {
  3541.    @ _gzsk.uh = [$4] ## [@] ## [$2]
  3542.    if (match($_gzsk.match $_gzsk.uh)) {
  3543.     gecho K-Line: $4@$2 \($5-\)
  3544.     @ _gzsk.fknum = _gzsk.fknum + 1
  3545.    }
  3546.   }
  3547.   ^on ^219 "*" {
  3548.    ^on ^216 -"*"
  3549.    ^on ^219 -"*"
  3550.    gecho End of Stats K list.  Total matches: $_gzsk.fknum
  3551.    purge _gzsk
  3552.   }
  3553.   //stats K
  3554.  }
  3555. }
  3556.  
  3557.  
  3558. alias struct {@ function_return = encode($tolower($0-))}
  3559. alias sgv {
  3560.  gz.setvers
  3561.  say I'm funkin' with -> \$client_information\ <-
  3562. }
  3563. alias sv sgv $*
  3564. #t#
  3565.  
  3566. alias _testhilite {fe ($hilitelist) _hl.l {@ function_return = [${match($_hl.l $*) >= 1}]};purge _hl}
  3567.  
  3568. alias talk {
  3569.  if ([$1]==[-b]) {@ _oink = gz.autotalkfg}{@ _oink = 1}
  3570.  if ([$0]) {
  3571.   for (@ idx = 0, (win = winitem($idx)) && !done, @ idx++) {
  3572.    if (win) {
  3573.     if (word(1 $win)==[$0_Queried]) {
  3574.      gecho You already have a query to $0
  3575.      @ borky = 1
  3576.     }
  3577.    }{@ done = 1}
  3578.   }
  3579.   if (!borky) {
  3580.    @ _pos.1 = word(1 $gzdefault.pos) + rand(40)
  3581.    @ _pos.2 = word(2 $gzdefault.pos) - rand(40)
  3582.    @ _pos.3 = word(3 $gzdefault.pos)
  3583.    @ _pos.4 = word(4 $gzdefault.pos)
  3584.    @ _pos.use = [$_pos.1 $_pos.2 $_pos.3 $_pos.4]
  3585.    gz.playsnd wopen
  3586.    gecho ${gc.msginfo} Creating talk window with${cl} ${gc.msgfrom} $0${cl}
  3587.    @ _moo = newwindow(1 $_oink -1 menubar $0_Queried $_pos.use)
  3588.    purge _pos
  3589.    //^window $_moo name $0_Queried
  3590.    //^window $_moo query $0
  3591.    if (autotalklogging == [ON]) {
  3592.     switch ($gz.drivetype($gz.logdir)) {
  3593.      (hpfs) {@ _talk.file = strip(\\*?<>|\"\' $0) ## [.log]}
  3594.      (*) {@ _talk.file = left(8 $strip(\\*?<>|\"\' $0)) ## [.log]}
  3595.     }
  3596.     //^window $_moo logfile $gz.logdir\/$_talk.file
  3597.     xecho -target $0 $gemz Window Logfile is $gz.logdir\/$_talk.file
  3598.     //^window $_moo log on
  3599.     xecho -target $0 $gemz Window LOG is ON
  3600.    }
  3601.   }
  3602.  }{gecho Usage talk <nick>}
  3603.  ^assign -done;^assign -borky;^assign -_moo;^assign -_oink
  3604. }
  3605.  
  3606. ^set input_prompt ▒▒▒▒░░░░░░░░░░░░░░░░20% (General Aliases)
  3607. alias t if (ischannel($0)) {topic $0 $cntl2mirc(f0 $1-)}{topic $C $cntl2mirc(f0 $0-)}
  3608. alias tlm {t $last.mesg}
  3609. alias tlsm {t $lastmsmg}
  3610. alias tlsn {t $lastsnot}
  3611. alias tln {t $last.noti}
  3612.  
  3613. alias settitlebar {
  3614.  if (gz.topictitle) {
  3615.   ^set titlebar_format [%R][%C%J%Q] %t
  3616.  }{
  3617.   ^set titlebar_format [%R]%c%Y[%s][%1]
  3618.  }
  3619. }
  3620.  
  3621. alias togtitle {
  3622.  @ gz.topictitle = _tog($gz.topictitle)
  3623.  settitlebar
  3624.  makesetupmenu
  3625. }
  3626. u#
  3627. alias uh {
  3628.  fe ($mychannels()) _uh.c {
  3629.   @ _uh.t = chanusers($_uh.c 3 $0\!*)
  3630.   if (_uh.t) {
  3631.    @ _uh.tt = nickdata($_uh.c $_uh.t 0)
  3632.    if (([$1] == [-s]) && (left(1 $_uh.tt) == [~])) {
  3633.     @ function_return = mid(1 $@_uh.tt $_uh.tt)
  3634.    }{
  3635.     @ function_return = _uh.tt
  3636.    }
  3637.    //break
  3638.   }
  3639.  }
  3640.  purge _uh
  3641. }
  3642.  
  3643. alias unhilite {
  3644.  if ([$0]) {
  3645.   fe ($hilitelist) _unh.m {
  3646.    if (match($0 $_unh.m) || match($_unh.m $0)) {
  3647.     gecho Removing \$_unh.m\ From the Hilite list
  3648.     @ hilitelist = stripw($_unh.m $hilitelist)
  3649.    }
  3650.   }
  3651.   purge _unh
  3652.  }{
  3653.   gecho Usage: /unhilite <word/filter>
  3654.  }
  3655. }
  3656.  
  3657. alias unig /ig $0 none
  3658. alais ignore /ig $*
  3659.  
  3660. alias unlock {
  3661.  if ([$0]) {
  3662.   if (match($0 $mychannels())) {
  3663.    if (ischanop($N $0)) {
  3664.     @ _key = key($0)
  3665.     if (_key) {
  3666.      //mode $0 -k $_key
  3667.     }{gecho There is No Channel Key for $0}
  3668.    }{gecho You are Not opped in $0}
  3669.   }{gecho You are not on channel $0}
  3670.  }{
  3671.   if (C) {
  3672.    if (ischanop($N $C)) {
  3673.     @ _key = key($C)
  3674.     if (_key) {
  3675.      //mode $C -k $_key
  3676.     }{gecho There is No Channel Key for $0}
  3677.    }{gecho You are Not Opped in $C}
  3678.   }{gecho You are Not on a Channel}
  3679.  }
  3680.  ^assign -_key
  3681. }
  3682.  
  3683. alias unparse {
  3684.  fec ($*) _un.c {@ _un.r #= _un.c==[,] ? [ ] : _un.c}
  3685.  @ function_return = _un.r
  3686.  purge _un
  3687. }
  3688.  
  3689. alias update_uptime {
  3690.  ^set float off
  3691.  @ uptime_min++
  3692.  @ uptime_days = uptime_min / 1440
  3693.  @ uptime_hours = (uptime_min / 60) - ((uptime_min / 1440) * 24 )
  3694.  @ uptime_minutes = uptime_min - 60 * (uptime_min / 60)
  3695.  ^set status_user3 [UP:$uptime_days\d$uptime_hours\h$uptime_minutes\m]
  3696.  ^timer 60 update_uptime
  3697. }
  3698. alias uptime {
  3699.  @ _tup = [\$uptime_days\ day(s) \$uptime_hours\ hour(s) \$uptime_minutes\ minute(s)]
  3700.  ^hook gzuptime $strip(\(\)\ $_tup)
  3701.  if ([$0]==[-out]) {
  3702.   if (C) {
  3703.    say I've been funkin' with GemZ for $_tup
  3704.   }{gecho your not in a channel}
  3705.  }{
  3706.   gecho GemZ uptime: $_tup
  3707.  }
  3708. }
  3709.  
  3710. alias ub unban $*
  3711. alias unuser ru $*
  3712. alias unnotify {
  3713.  if ([$0]) {
  3714.   ^notify \-$0
  3715.   gecho $0 Removed from the Notification list. (/save to save settings)
  3716.  }{gecho Usage: /unnotify <nick>}
  3717. }
  3718.  
  3719. alias unajoin {
  3720.  if ([$0]) {
  3721.   @ autojoinlist = stripw($0 $autojoinlist)
  3722.   ^assign -ajkeys.$%0
  3723.   makejoinmenu
  3724.   gecho $0 Removed from the Auto Join List. (/save to save settings)
  3725.  }{gecho Usage: /unajoin <channel>}
  3726. }
  3727.  
  3728. alias umode {mode $N $*}
  3729. #v#
  3730. alias v ver $*
  3731. alias ver {@ gemzusers = [0];if ([$0]) {//ctcp $0 VERSION} {//ctcp $C VERSION}}
  3732.  
  3733. alias voice {
  3734.  if ([$0]) {
  3735.   if (C) {
  3736.    if (ischanop($N $C)) {
  3737.     modeq.init
  3738.     fe ($*) _vv.a {modeq.add_mode +v $_vv.a}
  3739.     modeq.apply_modes $C
  3740.    }{gecho You are not a channop in $C}
  3741.   }{gecho You are not in a channel}
  3742.  }{gecho Usage /voice <nick1> <nick2> ...}
  3743. }
  3744.  
  3745. alias vouch {if ([$0]) {send Vouching for -> $0\ <- $gemz.str;voice $0}{gecho Usage /vouch <nick>}}
  3746. #w#
  3747. alias w {if ([$0]) {//who $*}{//who *}}
  3748. alias win {//window $*}
  3749. alias who {if ([$0]) {//who $*}{//who *}}
  3750. alias ww whowas $*
  3751.  
  3752. alias winlog {
  3753.  if ([$1]) {
  3754.   if (match($0 ON OFF)) {
  3755.    for (@ idx = 0, win = winitem($idx), @ idx++) {
  3756.     if ([$word(3 $win)]==[$1]) {
  3757.      @ done = [1]
  3758.      ^window refnum $word(0 $win) logfile $2-
  3759.      ^window refnum $word(0 $win) log $0
  3760.      @ _chan = [$1]
  3761.      if ([$0]==[ON]) {
  3762.       @ chlog[$%_chan][logfile] = [$2-]
  3763.      }
  3764.      @ chlog[$%_chan][stat] = [$0]
  3765.      gecho Logging for channel $1 is $0
  3766.      gecho Channel Logfile is $(chlog[$%_chan][logfile])
  3767.      if ([$0]==[ON]) {@ chanloglist = [$chanloglist $1]}
  3768.      else {@ chanloglist = stripw($1 $chanloglist)}
  3769.     }
  3770.    }
  3771.    if (!done) {gecho No Window Channel $1}{^assign -done}
  3772.   }{gecho Usage /winlog ON/OFF #channel logfile}
  3773.  }{gecho Usage /winlog ON/OFF #channel logfile}
  3774. }
  3775. alias wi whois $*
  3776. alias wilm {wi $last.mesg.from}
  3777. alias wl wholeft $*
  3778. alias wlsm wall $lastsmsg
  3779. alias wlm wall $last.mesg
  3780. alias wln wall $last.noti
  3781. alias wlsn wall $lastsnot
  3782. alias wns {if ([$0]) {/window new server $0-}}
  3783. alias wall wallop $*
  3784. alias wallop {
  3785.  if (C) {
  3786.   if (ischanop($N $C)) {
  3787.    if ([$0-]) {
  3788.     @ _wa.ops = []
  3789.     @ _wa.t = 0
  3790.     fe ($chanusers($C)) _wa.n {
  3791.      if (_wa.n != N && ischanop($_wa.n $C)) {
  3792.       @ _wa.ops = _wa.ops ? [$_wa.ops,$_wa.n] : _wa.n
  3793.       @ _wa.t++
  3794.       if ([$_wa.t]==[8]) {
  3795.        //quote NOTICE $_wa.ops :[gWallop:$C\] $0-
  3796.        @ _wa.sent = 1
  3797.        ^assign -_wa.ops
  3798.        @ _wa.t = 0
  3799.       }
  3800.      }
  3801.     }
  3802.     @ _wa.n = #_wa.ops
  3803.     if (_wa.n) {
  3804.      //quote NOTICE $_wa.ops :[gWallop:$C\] $0-
  3805.      echo -${gc.notice}$N${cl}- [gWallop:$C\] $0-
  3806.     }{
  3807.      if (!_wa.t && !_wa.sent) {
  3808.       gecho No ops on channel except you
  3809.      }{
  3810.       echo -${gc.notice}$N${cl}- [gWallop:$C\] $0-
  3811.      }
  3812.     }
  3813.     purge _wa
  3814.    }{
  3815.     gecho Usage /wall <text>
  3816.    }
  3817.   }{
  3818.    gecho Doh! not oped on $C\. Use the force Luke...
  3819.   }
  3820.  }{
  3821.   gecho You are not on any channel in this window        
  3822.  }
  3823. }
  3824.  
  3825. alias wallop {
  3826.  if (C) {
  3827.         if (ischanop($N $C)) {
  3828.             if ([$0-]) {
  3829.                 @ _wa[ops] = stripw($N $gz.chanops($C))
  3830.                 if (_wa[ops]) {
  3831.           if (gz.srvtargets()==0) {
  3832.                         //quote NOTICE @$C :[g$chr(2)Wallop$chr(2):$chr(2)$C$chr(2)] $0-
  3833.                     }{
  3834.                         fe ($_wa.ops) _wa.1 _wa.2 _wa.3 _wa.4 _wa.5. _wa.6. _wa.7. _wa.8. {
  3835.                           @ _wa.t = gz.fixsend($_wa.1 $_wa.2 $_wa.3 $_wa.4 $_wa.5 $_wa.6 $_wa.7 $_wa.8)
  3836.                            //quote NOTICE $_wa.t :[g$chr(2)Wallop$chr(2):$chr(2)$C$chr(2)] $0-
  3837.                         }
  3838.                     }
  3839.                     echo -${gc.notice}$N${cl}- [g$chr(2)Wallop$chr(2):$chr(2)$C$chr(2)] $0-
  3840.                 }{gecho No ops on channel except You.}
  3841.             }{gecho Usage /wall <text>}
  3842.         }{gecho You are not oped on $C}
  3843.     }{You are not on any channel in this window}
  3844.   purge _wa
  3845. }
  3846.  
  3847.  
  3848.  
  3849. alias wholeft {
  3850.  gbecho ${gc.outline}·─════════════════════════WhoLeft_Stats═════════════════════════════─·${cl}
  3851.  foreach signoffs ii {
  3852.   foreach signoffs.$ii jj {
  3853.    gbecho $[9]decode($ii) │ $[9]decode($jj) │ $fixtime($splittime[$signoffs[$ii][$jj]]) │ $splitname[$signoffs[$ii][$jj]]
  3854.   }
  3855.  }
  3856.  gbecho ${gc.outline}·─══════════════════════════════════════════════════════════════════─·${cl}
  3857.  ^assign -ii
  3858.  ^assign -jj
  3859. }
  3860.  
  3861. alias wii if ([$0]) {whois $0 $0} {gecho Usage: wii <nick>}
  3862. #x#
  3863. #y#
  3864. #z#
  3865. alias gemz ghelp index
  3866. ########################
  3867. # End of Alias Section #
  3868. ########################
  3869. ^set input_prompt ▒▒▒▒▒▒░░░░░░░░░░░░░░30% (Specialized Aliases)
  3870.  
  3871. #away messages (Random Song titles)
  3872. @ NUMAWAY = [10]
  3873. @ away.0 = [Hey Pachuco!]
  3874. @ away.1 = [Barflies at the Beach]
  3875. @ away.2 = [The Boogie Bumper]
  3876. @ away.3 = [Go Daddy-O]
  3877. @ away.4 = [Here comes the Snake]
  3878. @ away.5 = [Master and Slave]
  3879. @ away.6 = [Newpower Soul]
  3880. @ away.7 = [Freaks on this Side]
  3881. @ away.8 = [Caldonia]
  3882. @ away.9 = [Sing Sing Sing]
  3883.  
  3884. @ NUMKICK = [7]
  3885. @ kick.0 = [uh, huh huh... uh... yew suck, or something]
  3886. @ kick.1 = [meep meep!]
  3887. @ kick.2 = [bork bork bork bork]
  3888. @ kick.3 = [oops, silly me, that's the wrong key]
  3889. @ kick.4 = [nostalgia kick: Roadkill splattered all over the infobahn]
  3890. @ kick.5 = [nostalgia kick: CDA VIOLATION]
  3891. @ kick.6 = [If anybody gets funk'd its gun' be U!]
  3892.  
  3893. #Quit messages (Song titles from one band, take a guess)
  3894. @ NUMQUIT = [11]
  3895. @ quit.0 = [I'd never pass the bar unless I thought it was wet]
  3896. @ quit.1 = [Showgirls swing when the chairman sings]
  3897. @ quit.2 = [Vershan]
  3898. @ quit.3 = [Sky Filled with Rain]
  3899. @ quit.4 = [P-Kin at the Apex]
  3900. @ quit.5 = [Ripopgodazippa]
  3901. @ quit.6 = [These are the days of wild]
  3902. @ quit.7 = [Cloreen Bacon Skin]
  3903. @ quit.8 = [The Sky is Crying]
  3904. @ quit.9 = [Chitlins Con Carne]
  3905. @ quit.10 = [So Long-Farewll-Goodbye]
  3906.  
  3907. #----------------------------Kicks-----------------------------#
  3908. alias bkk {/k $0 BurgerKingKick - You get it my way}
  3909. alias mck {/k $0 McKick: You Want Fries with that?}
  3910. alias mcdk {/k $0 McKick: Have you had your break today?!?}
  3911. alias tbk {/k $0 TacoBellKick: Make a run for the border}
  3912. alias cjk {/k $0 CarlsJrKick: If it don't get all over your face, you don't belong in this place}
  3913. alias jbk {/k $0 JackInTheBoxKick: Jacks Back!!}
  3914. alias kfck {/k $0 KentuckyFriedKick: Original Recipe or Extra Crispy?}
  3915. alias kt {/k $0 Kick Toy (tm)}
  3916. alias tkl {/k $0 TaeKwonLeapKick}
  3917. alias gk {/k $0 [GreetKick] Hello to you too!}
  3918. alias wk {/k $0 woikick}
  3919.  
  3920. ###################################
  3921. #POPMail Check # Written by gemini#
  3922. #  Idea originated from TooTall   #
  3923. ###################################
  3924.  
  3925. #To be loaded 
  3926. @ gz.popserver = []
  3927. @ gz.popname = []
  3928. @ gz.poppass = []
  3929. @ gz.popport = [110]
  3930. @ gz.popchecking = [OFF]
  3931. @ gz.popsubject = 0
  3932. @ gz.poptime = 5
  3933. @ gt.mailerrors = 0
  3934.  
  3935. @ gt.poptmp = [********************]
  3936.  
  3937. alias gz.popsetserv {
  3938.  @ gz.popserver = [$"New Pop Server: "]
  3939.  @ menucontrol(&setup &111 text Server:    [$gz.popserver])
  3940. }
  3941. alias gz.popsetport {
  3942.  @ gz.popport = [$"New Pop Server Port: "]
  3943.  @ menucontrol(&setup &112 text Port:    [$gz.popport])
  3944. }
  3945. alias gz.popsetname {
  3946.  @ gz.popname = [$"New Pop User Name: "]
  3947.  @ menucontrol(&setup &113 text Username:    [$gz.popname])
  3948. }
  3949. alias gz.popsetpass {
  3950.  @ gz.poppass = [$"New Pop Password: "]
  3951.  @ gz.poppass = encode($gz.poppass)
  3952.  @ menucontrol(&setup &114 text Password:    [$left($@decode($gz.poppass) $gt.poptmp)])
  3953. }
  3954. alias gz.popsettime {
  3955.  @ gz.poptime = [$"New Time between Checks: "]
  3956.  @ menucontrol(&setup &115 text Check Time:    [$gz.poptime min])
  3957. }
  3958.  
  3959. alias gz.checkmail {
  3960.  if (_pm.n) {//^dcc close raw $_pm.n}
  3961.  gz.mailstart
  3962.  @ _pm.n = connect($gz.popserver $gz.popport)
  3963. }
  3964.  
  3965. ^on ^DCC_RAW * #
  3966.  
  3967. alias popdebug {
  3968.  if (popdebug == [ON]) {
  3969.   echo Pop Debug: $*
  3970.  }
  3971. }
  3972.  
  3973. alias gz.mailstart {
  3974.  purge _mail
  3975.  @ gt.popmode = [start]
  3976.  ^on #-dcc_raw 110 "*" {
  3977.   if ([$1] == gz.popserver) {
  3978.    switch ($2) {
  3979.     (E) {@ gt.popmode = [username]}
  3980.     (C) {gz.mailcleanup;popdebug PopServer Connection Lost: $3-}
  3981.     (D) {
  3982.      if ([$3] == [+OK]) {
  3983.       switch ($gt.popmode) {
  3984.        (username) {
  3985.         popdebug Recieved $3-
  3986.         popdebug Sending USER $gz.popname
  3987.         //^dcc raw $_pm.n $gz.popserver USER $gz.popname$chr(13)
  3988.         @ gt.popmode = [password]
  3989.        }
  3990.        (password) {
  3991.         popdebug Recieved $3-
  3992.         popdebug Sending PASS $gz.poppass
  3993.         //^dcc raw $_pm.n $gz.popserver PASS $decode($gz.poppass)$chr(13)
  3994.         @ gt.popmode = [ready]
  3995.        }
  3996.        (ready) {
  3997.         popdebug Recieved $3-
  3998.         popdebug Sending STAT
  3999.         //^dcc raw $_pm.n $gz.popserver stat$chr(13)
  4000.         @ gt.popmode = [retrieve]
  4001.        }
  4002.        (retrieve) {
  4003.         popdebug Recieved $3-
  4004.         popdebug Sending QUIT
  4005.         if ([$4] > gt.mailwaiting) {
  4006.          @ gt.mailwaiting = [$4];^hook gznewmail
  4007.         }{
  4008.          @ gt.mailwaiting = [$4]
  4009.         }
  4010.         ^set status_user4 <M:$gt.mailwaiting\> 
  4011.         if (gt.mailwaiting && gz.popsubject) {
  4012.          @ _mail.idx = 1
  4013.          //^dcc raw $_pm.n $gz.popserver TOP $_mail.idx 0
  4014.          @ gt.popmode = [subjects]
  4015.         }{
  4016.          //^dcc raw $_pm.n $gz.popserver QUIT
  4017.          @ gt.popmode = [quit]
  4018.         }
  4019.        }
  4020.        (subjects) {
  4021.         # do nothing this is the message for num octets in this mail.
  4022.        }
  4023.        (quit) {
  4024.         popdebug Recieved $3-
  4025.         gz.mailcleanup;^assign -gt.popmode
  4026.        }
  4027.        (*) {^hook gzmailerror $*}
  4028.       }
  4029.      }
  4030.      else if ([$3] == [-ERR]) {^hook gzmailerror $*}
  4031.      else {
  4032.       if (gt.popmode == [subjects]) {
  4033.        if (word(3 $*) == [subject:]) {@ _mail[$_mail.idx] #= [ $3-]}
  4034.        else if (word(3 $*) == [from:]) {@ _mail[$_mail.idx] #= [$3-]}
  4035.        else if (word(3 $*) == [.]) {
  4036.         @ _mail.idx++
  4037.         if (_mail.idx > gt.mailwaiting) {
  4038.          if (gt.newmail) {
  4039.           gecho PopMail Subject Gather Complete: Press Alt-L to list subjects
  4040.          }
  4041.          ^assign -gt.newmail
  4042.          //^dcc raw $_pm.n $gz.popserver QUIT
  4043.          @ gt.popmode = [quit]
  4044.         }{
  4045.          //^dcc raw $_pm.n $gz.popserver TOP $_mail.idx 0
  4046.         }
  4047.        }
  4048.       }
  4049.       else {^hook gzmailerror $*}
  4050.      }
  4051.     }
  4052.     (*) {if (gt.popmode != [subjects]) {^hook gzmailerror $*}}
  4053.    }
  4054.   }
  4055.  }
  4056. }
  4057.  
  4058. alias gz.showsubjects {
  4059.  if (_mail[1]) {
  4060.   for (@ _idx = 1, _idx <= gt.mailwaiting, @ _idx++) {
  4061.    gecho $[3]_idx $_mail[$_idx]
  4062.   }
  4063.  }
  4064. }
  4065.  
  4066. on #-hook 110 "gznewmail" {
  4067.  gz.playsnd newmail
  4068.  @ gt.mailerrors = 0
  4069.  @ gt.newmail = 1
  4070.  if (gz.popsubject) {
  4071.   gecho New mail has arrived... \(Total: $gt.mailwaiting message(s)\) \[gathering subjects...\]
  4072.  }{
  4073.   gecho New mail has arrived... \(Total: $gt.mailwaiting message(s)\)
  4074.  }
  4075. }
  4076.  
  4077. on #-hook 110 "gzmailerror *" {
  4078.  @ gt.mailerrors++
  4079.  @ gt.mailwaiting = [ERR]
  4080.  gecho ERROR: Pop Mail Server ERROR  Check Your Configuration. \($*\)
  4081.  gz.mailcleanup
  4082.  if (gt.mailerrors >= 5) {
  4083.   gecho Received 5 mail errors... Temporarily turning off mail checking.
  4084.  }
  4085. }
  4086.  
  4087. alias gz.mailcleanup {
  4088.  //^dcc close raw $_pm.n
  4089.  ^assign -_pm.n 
  4090.  ^on #-dcc_raw 110 -"*"
  4091. }
  4092.  
  4093. alias gz.domailcheck {
  4094.  if (gt.mailerrors < 5 && (gz.popchecking == [ON])) {
  4095.   if (gz.popname && gz.poppass && gz.popport && gz.popserver) {
  4096.    gz.checkmail
  4097.   }{
  4098.    gecho Pop Configuration Missing, please configure or Turn off.
  4099.   }
  4100.  }
  4101. }
  4102.  
  4103. on #^timer 110 "*" {
  4104.  if (gz.popchecking == [ON]) {
  4105.   if (gt.mcount >= gz.poptime) {
  4106.    gz.domailcheck
  4107.    @ gt.mcount = 0
  4108.   }{
  4109.    @ gt.mcount++
  4110.   }
  4111.  }
  4112. }
  4113.  
  4114.  
  4115. alias gz.setemailclient {
  4116.  @ _emc.t = [$"Full path Email Client executable  :"]
  4117.  if (_emc.t) {
  4118.  @ _emc.t = gz.fixpath($_emc.t)
  4119.   if (fexist($_emc.t) == 1) {
  4120.    @ gz.emailclient = _emc.t
  4121.    gecho Email Client executable now $gz.emailclient
  4122.    @menucontrol(&setup &200 text Client:    [$gz.emailclient])
  4123.    if (fexist($gz.emaildir d) == -1) {gz.setemaildir}
  4124.   }{
  4125.    gecho Invalid File: $_emc.t
  4126.    gz.setemailclient
  4127.   }
  4128.  }{
  4129.   echo Email Client Unchanged.
  4130.  }
  4131.  purge _emc
  4132. }
  4133.  
  4134. alias gz.setemaildir {
  4135.  @ _emd.t = [$"Working Directory for Email :"]
  4136.  if (_emd.t) {
  4137.   @ _emd.t = gz.striplastslash($gz.fixpath($_emd.t))
  4138.   if (fexist($_emd.t d) == 1) {
  4139.    @ gz.emaildir = _emd.t
  4140.    gecho Email Working Directory now $gz.emaildir
  4141.    @menucontrol(&setup &201 text Working Dir:    [$gz.emaildir])
  4142.   }{
  4143.    gecho Invalid Directory: $_emd.t
  4144.    gz.setemaildir
  4145.   }
  4146.  }{
  4147.   echo Directory Unchanged.
  4148.  }
  4149.  purge _emd
  4150. }
  4151.  
  4152. alias gz.setlogdir {
  4153.  @ _emd.t = [$"Directory for Logs :"]
  4154.  if (_emd.t) {
  4155.   @ _emd.t = gz.striplastslash($gz.fixpath($_emd.t))
  4156.   if (fexist($_emd.t d) == 1) {
  4157.    @ gz.logdir = _emd.t
  4158.    gecho Log Directory now $gz.emaildir
  4159.    @menucontrol(&setup &204 text Log Dir:    [$gz.logdir])
  4160.   }{
  4161.    gecho Invalid Directory: $_emd.t
  4162.    gz.setlogdir
  4163.   }
  4164.  }{
  4165.   echo Directory Unchanged.
  4166.  }
  4167.  purge _emd
  4168. }
  4169.  
  4170.  
  4171. #########################################################################
  4172. ### figlet v1.0 support by Kanji_Man.  Modified by Gemini
  4173. ### Modified by OS2-Mike
  4174. #   fixed code by OS2-Mike (with a lot of help from mikh)
  4175. #   fixored the prob of 4OS2 echoing its logo info into the figlet pipe.
  4176. #   filget.exe is borked - it expects a ^Z EOF to terminate it - 
  4177. #   added to $fig.text
  4178. #   Modified slightly by gemini to replace ^Z with $chr(26) :)
  4179. #########################################################################
  4180. @ def.figfont = [short]
  4181. @ fig.fontdir  = [$exedir/figlet.dir]
  4182. @ figfont = [$fig.fontdir/short.flf]
  4183. alias figfix {
  4184.  if ([$0]) {
  4185.   @ figfix.count = 0
  4186.   ^assign -figfix.text
  4187.   while ([$@0-]>=[$figfix.count]) {
  4188.    @ figfix.char = [$mid($figfix.count 1 $0-)]
  4189.    if ([$strip(<>\;\(\)*/\\\{\}$$~`|'\" $figfix.char)]!=[$figfix.char]) {
  4190.     @ figfix.text = [$figfix.text\\]
  4191.    }
  4192.    if (figfix.char) {
  4193.     ^assign figfix.text $figfix.text$figfix.char
  4194.    }{^assign figfix.text $figfix.text}
  4195.   @ figfix.count++
  4196.  }
  4197.  @ FUNCTION_RETURN = [$encode($figfix.text)]
  4198.  purge fixfix
  4199.  }{gecho [Error] FIGFIX is an internal alias, avoid using!}
  4200. }
  4201.  
  4202. alias fig figlet $*
  4203. #alias figlist {^exec -name figlet ls $fig.fontdir/*.flf}
  4204. alias figlist {
  4205.  gecho Starting Font list
  4206.  fe ($findfiles(fn $fig.fontdir/*.flf)) _f.1 _f.2 _f.3 _f.4 {
  4207.   gecho $[15]_f.1 $[15]_f.2 $[15]_f.3 $[15]_f.4
  4208.  }
  4209.  gecho End of Font list
  4210.  purge _f
  4211. }
  4212.  
  4213. alias figlet {
  4214.  if ([$0]) {
  4215.   @ fig.text = encode($strip(| $1-)) ## encode($chr(26))
  4216.   ^on ^exec_error "figlet *" {gecho [ERROR] Cannot load figlet!}
  4217.   if ([$0]==[*]) {^exec -name figlet -out figlet -f $figfont;^msg %figlet $decode($fig.text)
  4218.   }{^exec -name figlet -msg $0 figlet -f $figfont;^msg %figlet $decode($fig.text)}
  4219.   ^assign -fig.text
  4220.  }{gecho Usage: /FIGLET <nick/channel> <text>}
  4221. }
  4222.  
  4223. alias figfont {
  4224.  if ([$0]) {
  4225.   @ figfont.file = [$0]
  4226.   if ([$fexist($fig.fontdir/$figfont.file\.flf)]==[1]) {
  4227.    gecho Figlet font changed from $fig.fontfile\ to $figfont.file\.
  4228.    @ figfont = [$fig.fontdir/$figfont.file\.flf]
  4229.    @ fig.fontfile = [$figfont.file]
  4230.    if ([$1]==[-d]) {@ def.figfont = [$figfont.file];gecho Default Figlet Font Changed}
  4231.    ^assign -figfont.file
  4232.   }{gecho [Error] Figlet font not found: $figfont.file\}
  4233.  }{
  4234.   gecho Current Figlet Font: $fig.fontfile\
  4235.   gecho Usage: /FIGFONT <fontfile>
  4236.  }
  4237. }
  4238.  
  4239. alias figdir {
  4240.  input "Please Enter The directory where you fonts are located: " if ([$0]) {
  4241.   if ([$fexist($0-)]==[1]) {
  4242.    @ fig.fontdir = [$0-]
  4243.    gecho Figlet Font Directory Changed to $fig.fontdir
  4244.   }
  4245.  }{
  4246.   gecho Figlet Font Directory is $fig.fontdir
  4247.  }
  4248.  figfont $fig.fontfile
  4249. }
  4250.  
  4251. #Webster Support
  4252. ^on ^exec_error "spell *" {gecho ERROR loading webster.exe, check that it is in the path}
  4253. ^on ^exec_error "define *" {gecho ERROR loading webster.exe, check that it is in the path}
  4254. ^on ^exec "spell *" {if (!match($chr(128) $1-)) {gecho $strip($chr(13)$chr(128) $1-)}}
  4255. ^on ^exec "define *" {if (!match($chr(128) $1-)) {gecho $strip($chr(13)$chr(128) $1-)}}
  4256. alias define {
  4257.  if ([$0]) {
  4258.   gecho Looking up \$0\\...
  4259.   ^exec -name define webster.exe -define $0 @muesli.ai.mit.edu
  4260.   wait %define
  4261.  }{
  4262.   @ _def.me = [$"Enter Word to define : "]
  4263.   gecho Looking up \$_def.me\\...
  4264.   ^exec -name define webster.exe -define $_def.me @muesli.ai.mit.edu
  4265.   wait %define
  4266.   ^assign -_def.me
  4267.  }
  4268. }
  4269. alias spell {
  4270.  if ([$0]) {
  4271.   gecho Checking Spelling of \$0-\\...
  4272.   ^exec -name spell webster.exe -spell $0 @muesli.ai.mit.edu
  4273.   wait %spell
  4274.  }{
  4275.   @ _spell.me = [$"Enter Word to define : "]
  4276.   gecho Checking Spelling of \$_spell.me\\...
  4277.   ^exec -name spell webster.exe -spell $_spell.me @muesli.ai.mit.edu
  4278.   wait %spell
  4279.   ^assign -_spell.me
  4280.  }
  4281. }
  4282.  
  4283. ^set input_prompt ▒▒▒▒▒▒░░░░░░░░░░░░░░35% (Hooks)
  4284. ##########################
  4285. # Client Hooks 
  4286. ^on ^action * {
  4287.  if (ischannel($1)) {
  4288.   if (isminimized($1)) {gz.bkgd}
  4289.   if (match(*$nck.buf* $2-)) {
  4290.    gz.playsnd pub
  4291.    if ([$showpubtime]==[ON]) {
  4292.     xecho -target $1 ${gc.time}<$Z>${cl} $gemz.act ${gc.nickaction}$0${cl} $fix.mirc(${cl} $2-)
  4293.    }{
  4294.     xecho -target $1 $gemz.act ${gc.nickaction}$0${cl} $fix.mirc(${cl} $2-)
  4295.    }
  4296.    if (publogging == [ON]) {
  4297.     @ publog_cnt++
  4298.     @ publog[$publog_cnt] = [$servergroup($lastserver()) $0 $1 $time() $gemz.act ${gc.action}$0${cl} $fix.mirc(${cl} $2-)]
  4299.     ^set status_user2 [M:$msglog_cnt/P:$publog_cnt]
  4300.    }
  4301.   }{
  4302.    if (showpubtime == [ON]) {
  4303.     xecho -target $1 $gemz.act ${gc.time}<$Z>${cl} ${gc.action}$0${cl} $fix.mirc(${cl} $2-)
  4304.    }{
  4305.     xecho -target $1 $gemz.act ${gc.action}$0${cl} $fix.mirc(${cl} $2-)
  4306.    }
  4307.   }
  4308.  }{
  4309.   if (gz.autotalk && !chanwindow($0) && !winitem($gt.maxwin)) {talk $0 -b}
  4310.   if (logging == [ON]) {
  4311.    @ msglog_cnt++
  4312.    ^set status_user2 [M:$msglog_cnt/P:$publog_cnt]
  4313.    @ messagelog[$msglog_cnt] = [\($servergroup($lastserver())\) *\(action\)$0* $fix.mirc({$cl} $2-) <[$Z]:$userhost()>]
  4314.    if (USEMSGLOGFILE==[YES]) {
  4315.     @ _tmpfile = open($MSGLOGFILE W T)
  4316.     @ write($_tmpfile $strip( $messagelog[$msglog_cnt]))
  4317.     @ close($_tmpfile)
  4318.     ^assign -_tmpfile
  4319.    }
  4320.   }
  4321.   gz.playsnd msg
  4322.   if (chanwindow($0) && !ischannel($0)) {
  4323.    if (isminimized($0)) {gz.bkgd}
  4324.    xecho -level crap -target $0 $gemz.act ${gc.nickaction}$0${cl} $fix.mirc(${cl} $2-)
  4325. #   gaecho ${gc.nickaction}$0${cl} $fix.mirc(${cl} $2-)
  4326.   }{
  4327.    xecho -window Messages $gemz.act \(${gc.action}MSG${cl}\) ${gc.action}$0${cl} $fix.mirc(${cl} $2-)
  4328.   }
  4329.  }
  4330. }
  4331.  
  4332. #b#
  4333. on ^bad_nick "433 *" {
  4334.  if ([$@1] > 8) {
  4335.   @ _ns.n = []
  4336.   @ _ns.t = [$[1]1]
  4337.   fec ($mid(1 9 $1)) _ns.s {@ _ns.n = [$_ns.n]##[$_ns.s]}
  4338.   @ _ns.n = [$_ns.n]##[$_ns.t]
  4339.   @ new_nick = _ns.n
  4340.   purge _ns
  4341.  }{@ new_nick = [_$1]}
  4342.  gecho Nickname $1 is in use, autochange to $new_nick 
  4343.  //nick $new_nick
  4344.  ^assign -new_nick
  4345. }
  4346.  
  4347.  
  4348.  
  4349. #c#
  4350.  
  4351. alias gz.sndon {
  4352.  if (ctcpsound == [OFF]) {
  4353.   @ function_return = 0
  4354.  }{
  4355.   if (away && gz.noctcpaway) {
  4356.    @ function_return = 0
  4357.   }{
  4358.    @ function_return = isctog($0 S) ? 0 : 1
  4359.   }
  4360.  }
  4361. }
  4362.  
  4363. alias gz.reqon {
  4364.  if (ctcpsndreq == [OFF]) {
  4365.   @ function_return = 0
  4366.  }{
  4367.   if (away && gz.noctcpaway) {
  4368.    @ function_return = 0
  4369.   }{
  4370.    @ function_return = isctog($0 R) ? 0 : 1
  4371.   }
  4372.  }
  4373. }
  4374.  
  4375. on ^ctcp "% % SOUND *" {
  4376.     @ _dl = []
  4377.     if (rmatch($3 *.wav *.au *.mid) && [$3] && gz.sndon($1)) {
  4378.         if (ctcpsnd.havefile($3)) {
  4379.           mmpm.playfile2 $gz.playifplaying $ctcpsnd.fname
  4380. #          mmpm.playfile $ctcpsnd.fname
  4381.         }{
  4382.             if (!gz.reqon($1)) @ _dl = [autorequest disabled]
  4383.             else if (ctcpsnd.isgetting($3)) @ _dl = [downloading]
  4384.             else if (ctcpsnd.isrequested($3) < 30) @ _dl = [requested]
  4385.             else {
  4386.         if (gz.mircsndpatch) {
  4387.                     //^quote PRIVMSG $1 :!$0 $3
  4388.                 }{
  4389.                     //^quote PRIVMSG $0 :!$0 $3
  4390.                 }
  4391.                 ctcpsnd.requested $3
  4392.                 @ _dl = [requesting]
  4393.             }
  4394.         }
  4395.         if (ischannel($1)) {
  4396.             /xecho -t $1 $gemz.act ${gc.nickaction}$0${cl} SOUND: $file.sanspath($3) ${_dl?[\($_dl\)]:[]} $mirc2cntl( $4-)
  4397.         }{
  4398.             /xecho >$gemz.act ${gc.nickaction}$0${cl} SOUND: $file.sanspath($3) ${_dl?[\($_dl\)]:[]} $mirc2cntl( $4-)
  4399.         }
  4400.     }{
  4401.         if (ischannel($1)) {
  4402.             /xecho -t $1 $gemz.act ${gc.nickaction}$0${cl} SOUND: $file.sanspath($3) \(ctcp sounds disabled\) $mirc2cntl( $4-)
  4403.         }{
  4404.             /xecho >$gemz.act ${gc.nickaction}$0${cl} SOUND: $file.sanspath($3) \(ctcp sounds disabled) $mirc2cntl( $4-)
  4405.         }
  4406.     }
  4407. }
  4408.  
  4409. on ^hook "ctcpsnd received %*" {
  4410.  if (ctcpsound == [on]) {
  4411.   gecho Requested Sound Finished: $2-
  4412.   /mmpm.playfile2 $gz.playifplaying $2
  4413. # /mmpm.playfile $2
  4414.  }
  4415. }
  4416.  
  4417. on ^hook "ctcpsnd request % % *" {
  4418.  gecho \($4\) file request from $3 ${[$2]?[sent]:[access denied]}
  4419. }
  4420.  
  4421. alias sound {
  4422.  if ([$0]) {
  4423.   if (T) {
  4424.    if (ischannel($T)) {@ _t = T}{@ _t = strip(= $T)}
  4425.    if (ctcpsnd.localfile($0)) {
  4426.     /mmpm.playfile2 $gz.playifplaying $ctcpsnd.fname
  4427. #   /mmpm.playfile $ctcpsnd.fname
  4428.     /ctcp $_t SOUND $0-
  4429.     if ([$1] != []) {
  4430.      //xecho -t $T $gemz.act ${gc.action}$N${cl} SOUND \($0\): $1-
  4431.     }{
  4432.      //xecho -t $T $gemz.act ${gc.action}$N${cl} SOUND \($0\)
  4433.     }
  4434.    }{
  4435.     gecho File $0 does not exist${index(\\/: $0) >= 0 ? [, please check your /set sound_path] : []}
  4436.    }
  4437.   }{
  4438.    gecho There are no channel or /query in this window
  4439.   }
  4440.  }{    
  4441.   gecho Usage: /sound file.wav [</me like action>]
  4442.  }
  4443.  ^assign -_t
  4444. }
  4445.  
  4446. alias csound {
  4447.  if (ctcpsnd.localfile($1)) {
  4448.   /mmpm.playfile2 $gz.playifplaying $ctcpsnd.fname
  4449. # /mmpm.playfile $ctcpsnd.fname
  4450.   /ctcp $0 SOUND $1-
  4451.   //xecho -t $0 $gemz.act ${gc.action}$N${cl} SOUND \($1)
  4452.  }{
  4453.   gecho File $1 does not exist
  4454.  }
  4455. }
  4456.  
  4457. ### if autorequest is disabled, user still can do !nick file.wav etc manually
  4458. ### we should catch these and prepare to receive file, uses numeric 74
  4459.  
  4460. on #-send_msg 74 "% !% %.wav" ctcpsnd.request $2
  4461. on #-send_msg 74 "% !%.au" ctcpsnd.request $2
  4462. on #-send_msg 74 "% !%.mid" ctcpsnd.request $2
  4463.  
  4464. on #-send_notice 74 "% !% %.wav" ctcpsnd.request $2
  4465. on #-send_notice 74 "% !% %.au" ctcpsnd.request $2
  4466. on #-send_notice 74 "% !% %.mid" ctcpsnd.request $2
  4467.  
  4468. on #-send_public 74 "% !% %.wav" ctcpsnd.request $2
  4469. on #-send_notice 74 "% !% %.mid" ctcpsnd.request $2
  4470. on #-send_msg 74 "% !% %.au" ctcpsnd.request $2
  4471.  
  4472. ^on -ctcp "% % VER%" {
  4473.  gz.setvers
  4474.  ctcpreq $*
  4475. }
  4476. ^on -ctcp "% % PING *" {ctcpreq $*}
  4477. ^on -ctcp "% % FINGER*" {ctcpreq $*}
  4478. ^on -ctcp "% % USERINFO*" {ctcpreq $*}
  4479. ^on -ctcp "% % CLIENTINFO*" {ctcpreq $*}
  4480. ^on ^ctcp_reply "% FINGER *" {ctcpreply $*}
  4481. ^on ^ctcp_reply "% USERINFO *" {ctcpreply $0 USERINFO $2-}
  4482. ^on ^ctcp_reply "% TIME *" {ctcpreply $*}
  4483. # for version detection, put a 4 char word for the script version (to make it look clean)
  4484. ^on ^ctcp_reply "% VERSION *" {verreply ???? $*}
  4485. ^on ^ctcp_reply "% VERSION *gem*" {verreply GemZ $*;@ gemzusers++}
  4486. ^on ^ctcp_reply "% VERSION *SrFrog*" {verreply LiCe $*}
  4487. ^on ^ctcp_reply "% VERSION *Kanj*" {verreply KMP_ $*}
  4488. ^on ^ctcp_reply "% VERSION *gamm*" {verreply Gama $*}
  4489. ^on ^ctcp_reply "% VERSION *AtlantiS*" {verreply Atla $*}
  4490. ^on ^ctcp_reply "% VERSION *PM IRC*" {verreply PMIR $*}
  4491. ^on ^ctcp_reply "% VERSION *mIRC32*" {verreply mIRC $*}
  4492. ^on ^ctcp_reply "% VERSION *mIRC16*" {verreply mIRC $*}
  4493. ^on ^ctcp_reply "% VERSION *ScrollZ*" {verreply _sz_ $*}
  4494. ^on ^ctcp_reply "% VERSION *BitchX*" {verreply bchX $*}
  4495. ^on ^ctcp_reply "% VERSION *PIRCH32*" {verreply prch $*}
  4496. ^on ^ctcp_reply "% VERSION *CtoolZ*" {verreply CtlZ $*}
  4497. ^on ^ctcp_reply "% VERSION *:OpenChat/2 OS/2 PM*" {verreply OCHT $*}
  4498.  
  4499. alias verreply if ([$0]) {if ([$ctcpvers]==[ON]) {gecho ${gc.ctcpban}ctcp${cl}: ${gc.ctcp}$tolower($2) reply${cl} [$0\] from ${gc.ctcpnk}$1${cl}: $3-}{ctcpreply $1-}}
  4500. ^on ^ctcp_reply "% PING *" {
  4501.  @ ctcp_replytmp = time() - [$2]
  4502.  gecho ${gc.ctcpban}ctcp${cl}: ${gc.ctcp}$tolower($1) reply${cl} from ${gc.ctcpnk}$0${cl}: $tdiff($ctcp_replytmp)
  4503.  ^assign -ctcp_replytmp
  4504. }
  4505. ^on ^channel_synch "*" {gecho your join to channel $0\ is now synched${cl} \($1\ seconds\)}
  4506. ^on ^channel_signoff "*" {
  4507.  ndljoin $0 $1
  4508.  if (isminimized($0)) {gz.bkgd}
  4509.  if (!match($0 $lchanlist)) {
  4510.   gz.secho quit $0 Signoff for ${gc.sign}$1${cl} in ${gc.sign}$0${cl}: ${gc.peren}\(${cl}$fix.mirc(${cl} $2-)${gc.peren}\)${cl} $timestamp()
  4511.  }
  4512. }
  4513. ^on ^channel_signoff "% % %.% %.%" {
  4514.  if (isminimized($0)) {gz.bkgd}
  4515.  ndljoin $0 $1
  4516.  if (isbogus($1-)) {
  4517.   gz.secho quit $0 Signoff for ${gc.sign}$1${cl} in ${gc.sign}$0${cl} ${gc.peren}\(${cl}$2-${gc.peren}\)${cl}
  4518.  }{
  4519.   ^netbroke $encode($tolower($0)) $encode($1) $encode($2).$encode($3) $2 $3
  4520.  }
  4521. }
  4522. ^on ^channel_signoff "* * Killed (*)" {
  4523.  if (isminimized($0)) {gz.bkgd}
  4524.  ndljoin $0 $1
  4525.  if (rmatch($strip(\( $3-) %.*)) {
  4526.   gecho ${gc.kill}$1 was collided${cl}: $3-
  4527.  }{
  4528.   gecho ${gc.kill}Operator Kill${cl}: ${gc.killnk}$strip(\( $3)${cl} killed ${gc.killnk}$1${cl} ${gc.peren}\(${cl}$strip(\(\) $4-)${gc.peren}\)${cl}
  4529.  }
  4530. }
  4531.  
  4532. ### check server in servers menu when connected
  4533.  
  4534. on #-connect 2222 * {
  4535.  @ serverdata($lastserver() 1 $servergroup($lastserver()))
  4536.  @menucontrol(&srv &${lastserver()+1} check 1)
  4537.  @menucontrol(&srv &${lastserver()+100} check 1)
  4538. }
  4539.  
  4540. ### check server in servers menu when disconnected
  4541.  
  4542. on #-server_closed 2222 "*" {
  4543.  @menucontrol(&srv &${[$0]+1} check 0)
  4544.  @menucontrol(&srv &${[$0]+100} check 0)
  4545. }
  4546.  
  4547. on #-server_changed 2222 "*" {makesrvmenu}
  4548.  
  4549. ^set input_prompt ▒▒▒▒▒▒░░░░░░░░░░░░░░36% (Hooks)
  4550. #d#
  4551. ^on ^dcc_chat * {
  4552.  if (isminimized(=$0)) {gz.bkgd}
  4553.  gz.playsnd chat
  4554.  echo =${gc.dcc}$0${cl}= $fix.mirc(${cl} $1-)
  4555. }
  4556.  
  4557. ^on ^dcc_chat "% ACTION *" {
  4558.  if (isminimized(=$0)) {gz.bkgd}
  4559.  gz.playsnd chat
  4560.  echo = * ${gc.dcc}$0${cl}= $fix.mirc(${cl} $2-)
  4561. }
  4562.  
  4563. ^on ^dcc_chat "% ACTION *" {
  4564.  if (isminimized(=$0)) {gz.bkgd}
  4565.  gz.playsnd chat
  4566.  echo = * ${gc.dcc}$0${cl}= $fix.mirc(${cl} $left(${[$@2-]-1} $2-))
  4567. }
  4568.  
  4569. ### send /me thru dcc chats
  4570.  
  4571. ^on ^input "/me *" {
  4572.  if (left(1 $T) == [=]) {//^msg $T ACTION $1-\}
  4573.  else //sendline $*
  4574. }
  4575.  
  4576. ^on ^dcc_lost "% % chat chat*" {
  4577.  if (chanwindow(=$1) >= 0) {
  4578.   @ _dc.l = [=]##[$1]##[_Queried]
  4579.   xecho -window $_dc.l $gemz [gxdcc] DCC CHAT to ${gc.dcc}$1 ${gc.errortopic}$4${cl}
  4580.   xecho -window $_dc.l $gemz [gxdcc] Press alt-F4 in this window to close window.
  4581.  }{
  4582.   gecho $gx DCC CHAT to ${gc.dcc}$1 ${gc.errortopic}$4${cl}
  4583.  }
  4584. }
  4585. #e#
  4586. #f#
  4587. #g#
  4588. #h#
  4589. #i#
  4590. ^on ^idle * {
  4591.  if ((gz.awaytime) && (gz.awaytime <= [$0]) && (!away)) {
  4592. # if ([$0]==[$gz.awaytime]&&[$gz.awaytime]!=[0]&&[$away]!=[1]) {
  4593.   if (gz.qaaway) {
  4594.    away -q $str.autoaway [$gz.awaytime min]
  4595.   }{
  4596.    away -n $str.autoaway [$gz.awaytime min]
  4597.   }
  4598. }}
  4599.  
  4600. ^on ^invite * {
  4601.  if (ischannel($1)) {
  4602.   @ gemz.linvite = [$1]
  4603.   if ([$isajoin($1)]==[1]) {
  4604.    if (!onchannel($N $1)) {
  4605.     gecho AutoJoining $1 on invite from $0
  4606.     @ _gonna_join($1 0)
  4607.     //QUOTE JOIN $1 $ajkeys[$%1]
  4608.    }
  4609.   }{
  4610.    for (@idx = 1, (idx <= _udb.cnt && !_imatch), @idx++) {@ _imatch = [$rmatch($0!$userhost() $_udb[$idx][mask])]}
  4611.    if (index(AFIOPMNBV $_udb[$_imatch][flags]) >= 0 && [$ajoinfriends]==[YES]) {
  4612.     gecho AutoJoining $1 on invite from Friend: $0
  4613.     @ _gonna_join($1 0)
  4614.     //QUOTE JOIN $1 $ajkeys[$%1]
  4615.    }{gecho Invite to $1 from $0 Press Ctrl-K to join}
  4616.    ^assign -_imatch;^assign -idx
  4617.   }
  4618.  }{gecho Fake invite to $1 from $0}
  4619. }
  4620.  
  4621. alias _win.waiting {
  4622.  @ function_return = 0
  4623.  for (@ _ww.idx = 0, _ww.win = winitem($_ww.idx), @ _ww.idx++) {
  4624.   if (word(2 $_ww.win) == lastserver() && word(3 $_ww.win) == [<none>] && word(5 $_ww.win) == [$0]) {
  4625.    @ function_return = word(0 $_ww.win)
  4626.    //break
  4627.   }
  4628.  }
  4629.  purge _ww
  4630. }
  4631. #j#
  4632. ^on ^join_me * {
  4633.  synch $0 2
  4634.  # check if no users on a channel, that mean we joined and created a channel
  4635.  if (!chanusers($0)) {_delayop_channel2 $0}
  4636. }
  4637. on #-join_me 131 * {
  4638.  if ([$(chlog[$%0][stat])]==[ON]) {winlog ON $0 $(chlog[$%0][logfile])}
  4639.  foreach ch.cset.$%0 _c.c {//^cset $0 $_c.c $ch.cset[$%0][$_c.c]}
  4640.  if (_c.r = chanwindow($0)) {if (word(6 $winitem(%$_c.r)) == [<none>]) {makemenubar}}
  4641.  purge _c
  4642. }
  4643. ##############
  4644. alias _addljoin {
  4645.  for (@ nc.2 = 10, nc.2 > 1, @ nc.2--) {
  4646.   @ nc.1 = nc.2 - 1
  4647.   @ lastjoin[$%1][$nc.2] = lastjoin[$%1][$nc.1]
  4648.  }
  4649.  @ lastjoin[$%1][1] = [$0]
  4650.  purge nc
  4651. }
  4652.  
  4653.  
  4654. alias ndljoin {
  4655.  @ _idx = 1
  4656.  for (@ idx = 1, idx <= 10, @ idx++) {
  4657.   if ([$1] != [$lastjoin[$%0][$idx]]) {
  4658.    @ _lastjoin[$%0][$_idx] = lastjoin[$%0][$idx]
  4659.    @ _idx++
  4660.    @ didbob = 1
  4661.   }
  4662.  }
  4663.  if (didbob) {
  4664.   purge lastjoin[$%0]
  4665.   for (@ idx = 1, idx <= 10, @ idx++) {@ lastjoin[$%0][$idx] = _lastjoin[$%0][$idx]}
  4666.  }
  4667.  purge _lastjoin
  4668.  ^assign -_idx
  4669.  ^assign -didbob
  4670.  ^assign -idx
  4671. }
  4672.  
  4673. alias ncljoin {for (@ idx = 1, idx <= 10, @ idx++) {if ([$lastjoin[$%0][$idx]]==[$1]) {@ lastjoin[$%0][$idx] = [$2]}}}
  4674.  
  4675. alias gz.lastw {@ function_return = word(${rmatch($* *)-1} $*)}
  4676. alias last {@ function_return = gz.lastw($*)}
  4677.  
  4678. alias lastjoin {
  4679.  if (C) {
  4680.   if (lastjoin[$%C][1]) {
  4681.    gecho Last (10) Joins for $C
  4682.    for (@idx = 1, idx <= 10, @ idx++) {
  4683.     if (lastjoin[$%C][$idx]) {
  4684.      gecho [$[2]idx\]: $[10]lastjoin[$%C][$idx] \($nickdata($C $lastjoin[$%C][$idx] 0)\)
  4685.     }
  4686.    }
  4687.    gecho End of List
  4688.   }{gecho Lastjoin List is empty (no joins since your own join)}
  4689.  }{gecho you are not in a channel}
  4690. }
  4691.  
  4692. alias ljk {
  4693.  if (C) {
  4694.   if (lastjoin[$%C][1]) {
  4695.    if (ischanop($N $C)) {
  4696.     if ([$0]) {
  4697.      if (lastjoin[$%C][$0]) {
  4698.       //kick $C $lastjoin[$%C][$0] Lastjoin Kick [$0]
  4699.      }{
  4700.       gecho Lastjoin index: $0 does not exist
  4701.      }
  4702.     }{
  4703.      //kick $C $lastjoin[$%C][1] Lastjoin Kick
  4704.     }
  4705.    }{gecho You are not opped}
  4706.   }{gecho No Last Join}
  4707.  }{gecho No channel}
  4708. }
  4709.  
  4710. ^on ^join "*" {
  4711.  if (isminimized($1)) {gz.bkgd}
  4712.  if ([$0]!=[$N]) {_addljoin $0 $1}{purge lastjoin[$%0]}
  4713.  ^netjoined $encode($tolower($1)) $encode($0) $1 $0 $userhost()
  4714. }
  4715.  
  4716. # whoooa, our own //join command in scripting :)
  4717. ^on ^join_cmd * {
  4718.  if (![$0]) {
  4719.  # list channels
  4720.   for (@jc.idx = 0, servername($jc.idx), @jc.idx++) {
  4721.    if (isconnected($jc.idx)) {
  4722.     /gecho Server $servername($jc.idx):$serverport($jc.idx) \($servernick($jc.idx)\)
  4723.     /gecho Channels: $_srvchans($jc.idx)
  4724.    }
  4725.   }
  4726.  }{
  4727.   if ([$0] == [-invite]) {
  4728.    if (I) {
  4729.     //join $I
  4730.    }{
  4731.     gecho You have not been invited to any channel yet
  4732.    }
  4733.   }{
  4734.    @ jc.ch = ischannel($0) ? [$0] : [#$0]
  4735.    if (onchannel($N $jc.ch) && chanwindow($jc.ch)) {
  4736.     //window show $chanwindow($jc.ch)
  4737.    }{
  4738.     if (onchannel($N $jc.ch)) {
  4739.      @ jc.w = _gonna_join($jc.ch 1)
  4740.      //window $jc.w channel $jc.ch
  4741.     }{
  4742.      @ jc.w = _win.waiting($jc.ch)
  4743.      if (jc.w) {
  4744.       //quote JOIN $jc.ch $1
  4745.       //window show $jc.w
  4746.      }{
  4747.       @ jc.w = _gonna_join($jc.ch 1)
  4748.       //quote JOIN $jc.ch $1
  4749.      }
  4750.     }
  4751.    }
  4752.   }
  4753.  }
  4754.  purge jc
  4755. }
  4756. on ^join_before * {
  4757.  @ _r = _gonna_join($0 1)
  4758.  # need to insert code here wich will create window's _r menu according to
  4759.  # channel settings in $ch.flags and stored channel flood prot settings in
  4760.  # $ch.flood. We cannot do /cset's here because channel not created yet,
  4761.  # csets will be done from on -join_me
  4762.  //^assign -_r
  4763. }
  4764.  
  4765.  
  4766. # $0 == channel, returns window refnum of a window wich is waiting for that
  4767. # channel and 0 if not founb
  4768.  
  4769. alias _win.waiting {
  4770.  @ function_return = 0
  4771.  for (@ _ww.idx = 0, _ww.win = winitem($_ww.idx), @ _ww.idx++) {
  4772.   if (word(2 $_ww.win) == lastserver() && word(3 $_ww.win) == [<none>] && word(5 $_ww.win) == [$0]) {
  4773.    @ function_return = word(0 $_ww.win)
  4774.    //break
  4775.   }
  4776.  }
  4777.  purge _ww
  4778. }
  4779.  
  4780. # $0 -- channel we gonna join, $1 == 1 if we want window to be in foreground
  4781. # and 0 if we want new window created in background
  4782. # returns refnum of a window that channel gonna go
  4783.  
  4784. alias gz.usenklist {
  4785.  if (ch[nl][$%0] == [ON]) {@ function_return = [n]}
  4786.  else if (ch[nl][$%0] == [OFF]) {@ function_return = []}
  4787.  else if (gz.nicklist) {@ function_return = [n]}
  4788. }
  4789.  
  4790.  
  4791. alias _gonna_join {
  4792.  @ jb.found = _win.waiting($0)
  4793. # only if not found search for free window wich is not status window and
  4794. # not list window, and dosnt have /query
  4795.  if (!jb.found) {
  4796.   for (@ jb.idx = 0, jb.win = winitem($jb.idx), @ jb.idx++) {
  4797.    if (word(2 $jb.win) == lastserver() && word(3 $jb.win) == [<none>]  && \
  4798.    word(4 $jb.win) == [<none>] && word(5 $jb.win) == [<none>] && \
  4799.    word(1 $jb.win) != [messages] && word(1 $jb.win) != [OperView] && word(1 $jb.win) != [xdcc] && \
  4800.    word(0 $jb.win) != status_wnd && word(0 $jb.win) != chanlist_wnd) {
  4801.    @ jb.found = 1
  4802.    //break
  4803.             }
  4804.         }
  4805.  
  4806. # if we found such window, assign waiting channel to it, and show it if
  4807. # minimized, otherways create new window... 
  4808.  
  4809.         if (jb.found) {
  4810.             if ([$ch.winsizepos[$%0]]!=[]) {
  4811.                 //window $word(0 $jb.win) waiting_channel $0 setwindowpos sp $ref(2-5 $ch.winsizepos[$%0]) font $word(0 $ch.winsizepos[$%0])
  4812.             }{
  4813.                 //window $word(0 $jb.win) waiting_channel $0 setwindowpos sp $ref(2-5 $gzdefault.pos) font $default_font
  4814.             }
  4815.       if (ch.codepage[$%0]) {//window $word(0 $jb.win) codepage $ch.codepage[$%0]}{//window $word(0 $jb.win) codepage $default_codepage}
  4816.             if (gz.usenklist($0)) {
  4817.                 //^window $word(0 $jb.win) NICKLIST ON
  4818.             }{
  4819.                 //^window $word(0 $jb.win) NICKLIST OFF
  4820.             }
  4821.             #recreate_channel_menu $0
  4822.             //window $word(0 $jb.win) menu menubar
  4823.             if ([$1]) {
  4824.                 //window show $word(0 $jb.win)
  4825.             }
  4826.             @ function_return = word(0 $jb.win)
  4827.         }{
  4828.       gz.playsnd wopen
  4829.             #recreate_channel_menu $0
  4830.       @_oldcp = default_codepage
  4831.       if (ch.codepage[$%0]) {
  4832.        //^set default_codepage $ch.codepage[$%0]
  4833.       }
  4834.             if ([$ch.winsizepos[$%0]]!=[]) {
  4835.                 @ jb.ref = newwindow(1 $1 $word(0 $ch.winsizepos[$%0]) menubar 0 $ref(2-5 $ch.winsizepos[$%0]) $gz.usenklist($0))
  4836.            }{
  4837.                 @ jb.ref = newwindow(1 $1 -1 menubar 0 $ref(2-5 $gzdefault.pos) $gz.usenklist($0))
  4838.             }
  4839.       if (ch.codepage[$%0]) {
  4840.        //window $jb.ref codepage $default_codepage
  4841.       }
  4842.             //window $jb.ref waiting_channel $0 menu menubar
  4843.             @ function_return = jb.ref
  4844.       ^set default_codepage $_oldcp
  4845.       ^assign -_oldcp
  4846.         }
  4847.     }{
  4848.         @ function_return = word(0 $jb.win)
  4849.     }
  4850.     purge jb
  4851. }
  4852.  
  4853. # $0 == server num, returns space separated list of channels
  4854.  
  4855. alias _srvchans {evalserver $0 {@ function_return = mychannels()}}
  4856.  
  4857. ^set input_prompt ▒▒▒▒▒▒░░░░░░░░░░░░░░37% (Hooks)
  4858. #k#
  4859. on ^kick "*" {
  4860.  ndljoin $2 $0
  4861. #modified to use mikh's new userlist
  4862.  if ([$0]==[$N]) {
  4863.   if ([$1]==[$N]) {gz.playsnd mekick}{gz.playsnd youkick}
  4864.   ^hook gzkickme $2 $1
  4865.   gz.secho kick $2 You were kicked from ${gc.kickc}$2${cl} by ${gc.kickn}$1${cl} ${gc.peren}\(${cl}$fix.mirc(${cl} $3-)${gc.peren}\)${cl} $timestamp()
  4866.   if (gz.autorejoin) {
  4867.    //quote join $2 $key($2)
  4868.   }
  4869.  }{
  4870.   if (!match($2 $lchanlist)) {
  4871.    if ([$1]==[$N]) {gz.playsnd mekick;^hook gzmekick $2 $1}{gz.playsnd kick;^hook gzkick $2 $1}
  4872.    gz.secho kick $2 ${gc.kicked}$0${cl} was kicked from ${gc.kickc}$2${cl} by ${gc.kickn}$1${cl} ${gc.peren}\(${cl}$fix.mirc(${cl} $3-)${gc.peren}\)${cl} $timestamp()
  4873.   }
  4874.   if (ischanop($N $2) && index(i $chanmode($2)) >= 0 && index(IP $nickdata($2 $0 2)) >= 0) {//invite $0 $2}
  4875.   if ([$1]!=[$N]) {
  4876.    if (ischanop($N $2) && index(R $nickdata($2 $0 2)) >= 0) {
  4877.     if (index(AFILROPBV $nickdata($2 $1 2)) >= 0) {
  4878.     }{
  4879.      //mode $2 -o+b $1 $gz.nban($1 $uh($1))
  4880.      //kick $2 $1 Pertekt: $0
  4881.     }
  4882. }}}}
  4883.  
  4884. alias timestamp {@ function_return = gz.timestamps ? [\[${gc.time}$Z${cl}\]] : []}
  4885.  
  4886. #l#
  4887. ^on ^leave * {
  4888.  if (isminimized($1)) {gz.bkgd}
  4889.  if ([$0]==[$N]) {purge lastjoin.$encode($1)}{ndljoin $1 $0}
  4890.  if (!match($1 $lchanlist)) {gz.secho part $1 ${gc.left}$0${cl} has left channel ${gc.left}$1${cl} $timestamp()}
  4891. }
  4892. #m#
  4893. ^on ^msg * if (!ctcpsnd.msg($*)) {
  4894.  @ gt.maxwin = gz.maxwins - 1
  4895.  if (gz.autotalk && !chanwindow($0) && !winitem($gt.maxwin)) {talk $0 -b}
  4896.  gz.playsnd msg
  4897.  if (msgbeeps==[ON]) {//beep}
  4898.  if (chanwindow($0) && !ischannel($0)) {
  4899.   if (isminimized($0)) {gz.bkgd}
  4900.   if (showmsgtime==[ON]) {
  4901.    evalserver $lastserver() {xecho -target $0 ${gc.msgbrac}<${gc.msg}$0${gc.msgbrac}>${cl} [${gc.time}$Z${cl}] $fix.mirc(${cl} $1-)}
  4902.   }{
  4903.    evalserver $lastserver() {xecho -target $0 ${gc.msgbrac}<${gc.msg}$0${gc.msgbrac}>${cl} $fix.mirc(${cl} $1-)}
  4904.   }
  4905.  }{
  4906.   if (gemz.long==[ON]) {
  4907.    if (showmsgtime==[ON]) {
  4908.     echo ${gc.msgbrac}\[${gc.msg}$0${gc.msgbrac}:${gc.msguh}${gc.msg}$userhost()${gc.msgbrac}\] ${gc.time}<$Z>${cl} $fix.mirc(${cl} $1- )
  4909.    }{
  4910.     echo ${gc.msgbrac}\[${gc.msg}$0${gc.msgbrac}:${gc.msguh}${gc.msg}$userhost()${gc.msgbrac}\]${cl} $fix.mirc(${cl} $1-)
  4911.    }
  4912.   }{
  4913.    if (showmsgtime==[ON]) {
  4914.     echo ${gc.msgbrac}\[${gc.msg}$0${gc.msgbrac}\]${cl} ${gc.time}<$Z>${cl} $fix.mirc(${cl} $1-)
  4915.    }{
  4916.     echo ${gc.msgbrac}\[${gc.msg}$0${gc.msgbrac}\]${cl} $fix.mirc(${cl} $1-)
  4917.    }
  4918.   }
  4919.  }
  4920.  if ((rmatch($0 $tk.msglist) == 0) && (last.mesg.from != [$0])) {
  4921.   if (away) { 
  4922.    ^notice $0 I am away.  Message logging is \$logging\. <gz>
  4923.   }
  4924.  }
  4925.  if (logging == [ON]) {
  4926.   @ msglog_cnt++
  4927.   ^set status_user2 [M:$msglog_cnt/P:$publog_cnt]
  4928.   @ messagelog[$msglog_cnt] = [\($servergroup($lastserver())\) *$0* $fix.mirc({$cl} $1-) <[$Z]:$userhost()>]
  4929.   if (USEMSGLOGFILE==[YES]) {
  4930.    @ _tmpfile = open($MSGLOGFILE W T)
  4931.    @ write($_tmpfile $strip( $messagelog[$msglog_cnt]))
  4932.    @ close($_tmpfile)
  4933.    ^assign -_tmpfile
  4934.   }
  4935.  }
  4936.  /addtolastmsg $0 $1-
  4937.  @ last.mesg = [*$0* $1-]
  4938.  @ last.mesg.from = [$0]
  4939. }
  4940.  
  4941. alias addtolastmsg {
  4942.  for (@ lm.2 = gz.maxrelms, lm.2 > 1, @ lm.2--) {
  4943.   @ lm.1 = lm.2 - 1
  4944.   @ lastmsg[$lm.2] = lastmsg[$lm.1]
  4945.  }
  4946.  @ lastmsg.1 = [*$0* $1-]
  4947.  purge lm
  4948. }
  4949.  
  4950. alias relm {
  4951.  if ([$0]) {
  4952.   if ([$left(1 $0)]==[-]) {
  4953.    if ([$1]) {
  4954.     if (lastmsg[$strip(- $0)]) {msg $1 $lastmsg[$strip(- $0)]}
  4955.    }{
  4956.     if (lastmsg[$strip(- $0)]) {send $lastmsg[$strip(- $0)]}
  4957.    }
  4958.   }{msg $0 $lastmsg.1}
  4959.  }{send $lastmsg.1}
  4960. }
  4961.   
  4962. on ^mode * {
  4963.  if (isminimized($1)) {gz.bkgd}
  4964.  if ([$1]==N) {
  4965.   gecho ${gc.mode}Mode change${cl} \'$ansi2c($2-)\' by ${gc.modenk}$0${cl}
  4966.  }{
  4967.   if (index(. $0) == -1) {
  4968.    if (isctog($1 Z)) {
  4969. #currently only single modes will be compressed.
  4970.     if (ischanop($3 $1) && ([$2] == [+o])) {}
  4971.     else if (!ischanop($3 $1) && ([$2] == [-o])) {}
  4972.     else if (isvoice($3 $1) && ([$2] == [+v])) {}
  4973.     else if (!isvoice($3 $1) && ([$2] == [-v])) {}
  4974.     else {gz.secho mode $1 ${gc.mode}Mode change${cl} \'$ansi2c($2-)\' on ${gc.mode}$1 ${cl}by ${gc.modenk}$0${cl}}
  4975.    }{
  4976.     gz.secho mode $1 ${gc.mode}Mode change${cl} \'$ansi2c($2-)\' on ${gc.mode}$1 ${cl}by ${gc.modenk}$0${cl}
  4977.    }
  4978.   }{
  4979.    gz.secho mode $1 ${gc.modehack}Mode hack${cl} \'$ansi2c($2-)\' on ${gc.mode}$1 ${cl}by ${gc.modenk}$0${cl}
  4980.   }
  4981.  }
  4982. }
  4983.  
  4984. #n#
  4985. ^on ^nickname "*" {
  4986.  if (chanwindow($0)) {
  4987.   xecho -target $0 $gemz Nick Change Detected: $0 -> $1 (window modified)
  4988.   //window $chanwindow($0) name $1_Queried;//window $chanwindow($0) query $1
  4989.  }
  4990.  if (decode($pubreplynick) == [$0]) {@ pubreplynick = encode($1)}
  4991.  fe ($tk.msglist) _tknick {
  4992.   if ([$_tknick]==[$0]) {@ _tknick = [$1]}
  4993.   if (tmp.tklist) {@ tmp.tklist = [$tmp.tklist $_tknick]}{@ tmp.tklist = [$_tknick]}
  4994.  }
  4995.  @ tk.msglist = tmp.tklist
  4996.  ^assign -tmp.tklist;^assign -_tknick
  4997.  fe ($mychannels()) _tmpchan {
  4998.   if (match($0 $chanusers($_tmpchan)) >= 1) {
  4999.    if (isminimized($_tmpchan)) {gz.bkgd}
  5000.    xecho -target $_tmpchan $gemz ${gc.nickchg}$0${cl} is now known as ${gc.nickchg}$1${cl}
  5001.    ncljoin $_tmpchan $0 $1
  5002.   }
  5003.  }
  5004.  ^assign -_tmpchan;^assign -_tknick;^assign -_tmpchan
  5005. }
  5006.  
  5007. ^on ^notify_signon "*" {
  5008.  gz.playsnd notify
  5009.  if ([$1]) {
  5010.   gecho ${gc.notify}SIGNON${cl}: ${gc.time}<$Z>${cl} ${gc.notify}$0 ${gc.peren}\(${cl}$1@$2${gc.peren}\)${cl}
  5011.   _notify_uh $0 $1@$2
  5012.  }{
  5013.   if (uh($0)) {
  5014.    gecho ${gc.notify}SIGNON${cl}: ${gc.time}<$Z>${cl} ${gc.nofity}$0 ${gc.peren}\(${cl}$uh($0)${gc.peren}\)${cl}
  5015.    _notify_uh $0 $uh($0)
  5016.   }{
  5017.    userhost $0 -cmd if ([$3]!=[<UNKNOWN>]) {
  5018.     _notify_uh $0 $3@$4
  5019.     gecho ${gc.notify}SIGNON${cl}: ${gc.time}<$Z>${cl} ${gc.nofity}$0 ${gc.peren}\(${cl}$3@$4${gc.peren}\)${cl}
  5020.    }{
  5021.     gecho ${gc.notify}SIGNON${cl}: ${gc.time}<$Z>${cl} ${gc.notify}$0 ${cl} 
  5022.    }
  5023.   }
  5024.  }
  5025. }
  5026.  
  5027. ^on ^notify_signoff "*" {
  5028.  ^hook gzsignoff $*
  5029.  gz.playsnd notifyoff
  5030.  if ([$1]) {
  5031.   gecho ${gc.notify}SIGNOFF${cl}: ${gc.time}<$Z>${cl} ${gc.notify}$0 ${gc.paren}\(${cl}$1@$2${gc.paren}\)${cl}
  5032.  }{
  5033.   gecho ${gc.notify}SIGNOFF${cl}: ${gc.time}<$Z>${cl} ${gc.notify}$0 ${cl}
  5034.  }
  5035. }
  5036.  
  5037. ^on ^notice * if (!ctcpsnd.notice($*)) {
  5038.  @ wallchan = _chan($1)
  5039.  if (wallchan) {
  5040.   xecho -target $wallchan ${cl}-${gc.notice}$0${cl}- $fix.mirc(${cl} $1-)
  5041.  }{echo -${gc.notice}$0${cl}- $fix.mirc(${cl} $1-)}
  5042.  @ last.noti = [-$0\- $1- <[$Z]:$userhost()>]
  5043.  @ last.note.from = [$0]
  5044.  ^assign -wallchan
  5045. }
  5046.  
  5047. ^on ^notice "% INVITE: #% (% invited % [%])" {
  5048.  gecho $5 $6 was invited by $4
  5049. }
  5050.  
  5051. ^on ^public_notice * {
  5052.  echo \-${gc.notice}$0${cl}:${gc.notice}$1${cl}\- $fix.mirc(${cl} $2-)
  5053. }
  5054. #o#
  5055. alias _dropsend {
  5056.  fe ($2-) _sendfile {
  5057.   if (gx.sendcount() < gx.maxsends) {
  5058.    //dcc $0 $1 "$decode($_sendfile)"
  5059.   }{
  5060.    gecho Max Sends Reached... Queuing file: $decode($_sendfile)
  5061.    xdcc.qfileadd $lastserver() $1 $0 "$decode($_sendfile)"
  5062.   }
  5063.  }^assign -_sendfile
  5064. }
  5065.  
  5066. ^on ^objects_dropped "% % % COPY*" {
  5067.  if ([$8] && lastclickline(4) && onchannel($lastclickline(4) $1)) {
  5068.   if ([$right(4 $decode($8))]==[.kix] || [$right(2 $decode($8))]==[.k]) {
  5069.    if (ischanop($N $1)) {
  5070.     //KICK $1 $lastclickline(4) $randread("$decode($8)") [DropKick]
  5071.    }{gecho Yer Not Opped.. Drop a Brick On yer head!}
  5072.   }{gecho CONTROL-Drops are only used for .kix files}
  5073.  }{gecho CONTROL-Drops for .kix files must be dropped on a nick}
  5074. }
  5075.  
  5076. ^on ^objects_dropped "% % % MOVE*" {
  5077. #gecho $0-
  5078. #gecho $decode($8)
  5079. gecho SHIFT-DROPS are Not Implented Yet.
  5080. }
  5081.  
  5082. ^on ^objects_dropped "% % % LINK*" {
  5083.  if (([$8]) && (lastclickline(4) == N)) {
  5084.   fe ($8-) __of.f {
  5085.    @ __of.fx = __of.fx ## [ $decode($__of.f)]
  5086.   }
  5087.   @ __of.a = [$"Do you want to setup an offer for Dragged files? [Y/n] : "]
  5088.   if (__of.a != [n]) {
  5089.    xdcc.offer $__of.fx
  5090.   }
  5091.   purge __of
  5092.  }{
  5093.   if ([$8] && lastclickline(4) && (onchannel($lastclickline(4) $1) || lastclickline(4) == T )) {
  5094.    if ([$right(4 $decode($8))]==[.kix] || [$right(2 $decode($8))]==[.k]) {
  5095.     if (ischanop($N $1)) {
  5096.      //KICK $1 $lastclickline(4) $randread("$decode($8)") [DropKick]
  5097.     }{gecho Yer Not Opped.. Drop a Brick On yer head!}
  5098.    }{
  5099.     menu -tempmenu
  5100.     menu tempmenu
  5101.     if ([$9]) {
  5102.      menuitem tempmenu "Send Files to $lastclickline(4)" /_dropsend send $lastclickline(4) $8-
  5103.      menuitem tempmenu "Resend Files to $lastclickline(4)" /_dropsend resend $lastclickline(4) $8-
  5104.     }{
  5105.      if ([$fexist("$decode($8)" d)]==[1]) {
  5106.       menuitem tempmenu "Send Contents of folder to $lastclickline(4)" /_dropsend send $lastclickline(4) $findfiles(e "$decode($8)/*")
  5107.       menuitem tempmenu "Resend Contents of folder to $lastclickline(4)" /_dropsend resend $lastclickline(4) $findfiles(e "$decode($8)/*")
  5108.      }{
  5109.       menuitem tempmenu "Send $decode($8) to $lastclickline(4)" _dropsend send $lastclickline(4) $8
  5110.       menuitem tempmenu "ReSend $decode($8) to $lastclickline(4)" _dropsend resend $lastclickline(4) $8
  5111.  
  5112.      }
  5113.     }
  5114.     /popupmenu -window $0 tempmenu
  5115.     #^assign -blek
  5116.    }
  5117.   }{
  5118.    # show a window so prompt appears in it and not in current one
  5119.    //window show $0
  5120.    if ([$fexist("$decode($8-)" d)]==[1]) {
  5121.     if ((bah = [$"Send Contents of folder to whom?: "]) != []) {
  5122.      fe ($findfiles(e "$decode($8)/*")) _tmpsend {
  5123.       gz.exdcc send $bah $_tmpsend
  5124.      }
  5125.     }
  5126.    }{
  5127.     if ((bah = [$"Send file(s) to whom?: "]) != []) {
  5128.      fe ($8-) _tmpsend {
  5129.       gz.exdcc send $bah $_tmpsend
  5130.      }
  5131.  
  5132.     }
  5133.    }
  5134.   }
  5135.  }
  5136.  ^assign -_tmpsend
  5137.  ^assign -bah
  5138. }
  5139. #p#
  5140.  
  5141. on #-public 67 "*" {@ wilp[$%1] = [$0]}
  5142. alias wilp {
  5143.  if (C) {
  5144.   if (wilp[$%C]) {
  5145.    gecho Checking whois on Last public in $C \($wilp[$%C]\)
  5146.    /wi $wilp[$%C]
  5147.   }{gecho No Last public to check}
  5148.  }{gecho No Channel}
  5149. }
  5150.  
  5151. ^on ^public * if (!ctcpsnd.public($*)) {
  5152.  if (isminimized($1)) {gz.bkgd}
  5153.  if (match(*$nck.buf* $2-)) {
  5154.   @ pubreplynick = encode($0)
  5155.   gz.playsnd pub
  5156.   if (showpubtime == [ON]) {
  5157.    xecho -target $1 ${gc.time}<$Z>${cl} ${gc.pubbrac}<${gc.nickpubmsg}$0${gc.pubbrac}>${cl} $fix.mirc(${cl} $2-)
  5158.   }{
  5159.    xecho -target $1 ${gc.pubbrac}<${gc.nickpubmsg}$0${gc.pubbrac}>${cl} $fix.mirc(${cl} $2-)
  5160.   }
  5161.   if (publogging == [ON]) {
  5162.    @ publog_cnt++
  5163.    @ publog[$publog_cnt] = [$servergroup($lastserver()) $0 $1 $time() $fix.mirc(${cl} $2-)]
  5164.    ^set status_user2 [M:$msglog_cnt/P:$publog_cnt]
  5165.   }
  5166.  }
  5167.  else if (_testhilite($2-)) {
  5168.   if (gz.loghilites) {
  5169.    @ publog_cnt++
  5170.    @ publog[$publog_cnt] = [$servergroup($lastserver()) $0 $1 $time() $fix.mirc(${cl} $2-)]
  5171.    ^set status_user2 [M:$msglog_cnt/P:$publog_cnt]
  5172.   }
  5173.   gz.playsnd hilitelist
  5174.   if ([$showpubtime]==[ON]) {
  5175.    xecho -target $1 ${gc.time}<$Z>${cl} ${gc.pubbrac}<${gc.hilitepubmsg}$0${gc.pubbrac}>${cl} $fix.mirc(${cl} $2-)
  5176.   }{
  5177.    xecho -target $1 ${gc.pubbrac}<${gc.hilitepubmsg}$0${gc.pubbrac}>${cl} $fix.mirc(${cl} $2-)
  5178.   }
  5179.  }
  5180.  else {
  5181.   if (showpubtime == [ON]) {
  5182.    xecho -target $1 ${gc.time}<$Z>${cl} ${gc.pubbrac}<${gc.pubmsg}$0${gc.pubbrac}>${cl} $fix.mirc(${cl} $2-)
  5183.   }{
  5184.    xecho -target $1 ${gc.pubbrac}<${gc.pubmsg}$0${gc.pubbrac}>${cl} $fix.mirc(${cl} $2-)
  5185.   }
  5186.  }
  5187. }
  5188.  
  5189. #r#
  5190.  
  5191. ### lag meter per server, uses serverdata(server 0) and %0 status item on
  5192. ### a status bar, all lag meter events are using numeric 11
  5193.  
  5194. on #-timer 11 * {
  5195.  for (@_srv=0,servername($_srv)!=[],@_srv++) {
  5196.   if (serverdata($_srv 0) != [<=L=>]) @serverdata($_srv 0 <=L=>)
  5197.   if (isconnected($_srv) && !lastlag[$_srv]) {
  5198.     @_lagtime = time()
  5199.     //evalserver $_srv {//quote PING $_lagtime $S}
  5200.     @lastlag[$_srv] = _lagtime
  5201.   }
  5202.  }
  5203. }
  5204.  
  5205. on #-server_closed 11 * {
  5206.     @serverdata($0 0 <=L=>)
  5207.     if ([$0] != -1) @lastlag[$0] = 0
  5208. }
  5209.  
  5210. #on #-server_changed 11 "new %" {@serverdata($1 0 <=L=>)}
  5211.  
  5212. on ^pong "*.* %" {
  5213.  if ([$0] == S) {
  5214.     if (isdigit($1)) {
  5215.         @serverdata($lastserver() 0 <Lag: ${time() - [$1]}>)
  5216.     }{
  5217.         @serverdata($lastserver() 0 <Lag: ${time() - lastlag[$lastserver()]}>)
  5218.     }
  5219.     @lastlag[$lastserver()] = 0
  5220.  }
  5221.  else if (slag[$encode($tolower($0))]) {
  5222.   @ _lagged = time() - slag[$encode($tolower($0))]
  5223.   @ _lagged = tdiff($_lagged)
  5224.   gecho Ping Responce From $0 :   $_lagged
  5225.   ^assign -slag.$encode($tolower($0))
  5226.   ^assign -_lagged
  5227.  }
  5228. }
  5229.  
  5230. ### end of per/server lag meter
  5231.  
  5232.  
  5233. alias setlog {
  5234.  switch ($0) {
  5235.   (ON) {@ logging = [ON]}
  5236.   (OFF) {@ logging = [OFF]}
  5237.  }
  5238.  @menucontrol(&msgs &1 check $_bool($logging))
  5239.  if (away) {//away -all $away.reason \[Log:$logging\] $gemz.str}
  5240. }
  5241.  
  5242. alias setpublog {
  5243.  switch ($0) {
  5244.   (ON) {@ publogging = [ON]}
  5245.   (OFF) {@ publogging = [OFF]}
  5246.  }
  5247.  @menucontrol(&msgs &2 check ${publogging==[on]})
  5248. }
  5249.  
  5250. #s#
  5251. ^on ^send_action * {
  5252.  if ([$0]==[$C]) {
  5253.   gaecho ${gc.action}$N${cl} $1-
  5254.  }{
  5255.   if (chanwindow($0) && !ischannel($0)) {
  5256.    xecho -target $0 $gemz.act ${gc.action}$N${cl} $1-
  5257.   }{
  5258.    xecho -window Messages ${gc.sendout} ->${cl} $0 $gemz.act ${gc.action}$N${cl} $1-
  5259.   }
  5260.  }
  5261. }
  5262. ^on ^send_msg * {
  5263.  if (chanwindow($0) && !ischannel($0)) {
  5264.   echo ${gc.sendout}<${gc.smsg}$N${gc.sendout}>${cl} $1-
  5265.  }{
  5266.   echo ${gc.sendout}-> ${gc.smsg} $0 ${cl} $1-
  5267.  }
  5268.  ^assign lastsmsg -> [$0] $1-
  5269.  if ([$logging]==[ON]) {
  5270.   @ msglog_cnt++
  5271.   ^set status_user2 [M:$msglog_cnt/P:$publog_cnt]
  5272.   @ messagelog[$msglog_cnt] = [$lastsmsg <$Z>]
  5273.  }
  5274. }
  5275. ^on ^send_dcc_chat * {
  5276.  if ([$chanwindow(=$0)]) {
  5277.   if ([$1] == [ACTION]) {
  5278.    echo = * ${gc.dcc}$N${cl}= $left(${[$@2-]-1} $2-)
  5279.   }{
  5280.    echo =${gc.dcc}$N${cl}= $1-
  5281.   }
  5282.  }{
  5283.   echo ${gc.sendout}-> ${cl}=${gc.dcc}$0${cl}=  $1-
  5284.  }
  5285. }
  5286. ^on ^send_notice * {echo ${gc.sendout} ->${cl} -$0\- $1-;^assign lastsnot -> [$0\] $1-}
  5287. ^on ^send_public * {
  5288.  echo ${gc.pubbrac}<${gc.spub}$N${gc.pubbrac}>${cl} $1-
  5289. }
  5290.  
  5291. on ^dcc_send_to "% **" {//^dcc raw $0 $cntl2mirc(f0 $1-)}
  5292.  
  5293. on ^send_to "% % :**" {//^quote $0 $1 $cntl2mirc(f0 $2-)}
  5294.  
  5295. ^on ^input "/dcc chat %*" {chat $2}
  5296.  
  5297.  
  5298. #Nick Completion (orig. Gemini)
  5299. ^on ^input "%: *" {
  5300.  if ([$nickcompletion]==[ON] && ischannel($T)) {
  5301.   if ([$[1]0]==[/]) {
  5302.    //sendline $0-
  5303.   }{
  5304.    if (match(*$strip(: $0)* $decode($pubreplynick))) {
  5305.     @ tlst = decode($pubreplynick)
  5306.     @ tmtch = 1
  5307.    }
  5308.    else if (match($strip(: $0) $chanusers($C 4))) {
  5309.     @ tlst = chanusers($C 4)
  5310.     @ tmtch = match($strip(: $0) $tlist))
  5311.    }
  5312.    else if (match($strip(: $0)* $chanusers($C 4))) {
  5313.     @ tlst = chanusers($C 4)
  5314.     @ tmtch = match($strip(: $0)* $tlst)
  5315.    }
  5316.    else {
  5317.     @ tlst = chanusers($C 4)
  5318.     @ tmtch = match(*$strip(: $0)* $tlst)
  5319.    }
  5320.    if (tmtch >= 1) {
  5321.     @ tmtch--
  5322.     @ input_bob = 1
  5323.    }
  5324.    if (word($tmtch $tlst)!=strip(: $0) && input_bob) {
  5325.     @ _say = [$word($tmtch $tlst):]
  5326.    }{
  5327.     @ _say = [$0]
  5328.    }
  5329.    //sendline $_say $1-
  5330.    ^assign -_say;^assign -tlst;^assign -tmtch;^assign -input_bob
  5331.   }
  5332.  }{//sendline $0-}
  5333. }
  5334.  
  5335. on ^synch * {//xecho -t $0 $gemz Channel $0\ is synched in $1 seconds}
  5336. ^set input_prompt ▒▒▒▒▒▒░░░░░░░░░░░░░░38% (Hooks)
  5337. # Server Notices for OperView 
  5338. ^on ^server_notice "% % Notice -- Received KILL message*" {
  5339.  if (match(*.* $10)) {
  5340.   gz.ovecho $0 S. Kill: $strip(. $8) was killed by $10
  5341.  }{
  5342.   gz.ovecho $0 O. Kill: $strip(. $8) was killed by $10 $13-
  5343.  }
  5344. }
  5345. ^on ^server_notice "% % Notice -- Client Connecting:*" {gz.ovecho $0 Connect: $6 $7-}
  5346. ^on ^server_notice "% % Notice -- Client exiting:*" {gz.ovecho $0 Exiting: $6 $7-}
  5347. ^on ^wallop * {
  5348.  g.ovecho [${gc.swall}Server Wall${cl}] ${gc.swall}$0${cl} ${gc.swallmsg}$2-${cl}
  5349. #//xecho -window OperView 0f### 0f[0b Wall 0f] 07$0 0d$2-
  5350. }
  5351. ^on ^server_notice "% % Notice -- % % is now operator *" {gz.ovecho $0 $4\ $5 is now an ircop.}
  5352. ^on ^server_notice "% % Notice -- % added K-Line % *" {gz.ovecho $0 $4\ added a new kline: $7-}
  5353. ^on ^server_notice "% % Notice -- Link with*" {gz.ovecho $0 $4-}
  5354. ^on ^server_notice "% % Notice -- Received SQUIT*" {gz.ovecho $0 $4-}
  5355. ^on ^server_notice "% % Notice --*" {gz.ovecho $0 $4-}
  5356.  
  5357. alias gz.ovecho {
  5358.  if (gz.ovts) {
  5359.   xecho -window OperView $gz.ovserv($0) [${gc.time}$Z${cl}] $1-
  5360.  }{
  5361.   xecho -window OperView $gz.ovserv($0) $1-
  5362.  }
  5363. }
  5364.  
  5365. alias gz.ovserv {
  5366.  switch ($0) {
  5367.   # I'm an rpi oper, so i made my own... make your own if you'd like.
  5368.   (irc.cs.rpi.edu) {@ function_return = [\[090Arpi09${cl}\]]}
  5369.   (*) {@ function_return = [\[${gc.ovserv}] ## ov.getecho($0) ## [${cl}\]]}
  5370.  }
  5371. }
  5372.  
  5373.  
  5374. #g.ovecho ov.serv will be unessessory
  5375.  
  5376. alias g.ovecho {
  5377.  if (gz.ovts) {
  5378.   xecho -window OperView $ov.serv() [${gc.time}$Z${cl}] $0-
  5379.  }{
  5380.   xecho -window OperView $ov.serv() $0-
  5381.  }
  5382. }
  5383. alias ov.serv {
  5384.  switch ($S) {
  5385.   # I'm an rpi oper, so i made my own... make your own if you'd like.
  5386.   (irc.cs.rpi.edu) {@ function_return = [\[090Arpi09${cl}\]]}
  5387.   (*) {@ function_return = [\[${gc.ovserv}] ## ov.getecho($S) ## [${cl}\]]}
  5388.  }
  5389. }
  5390.  
  5391. alias ov.getecho {
  5392.  @ _ge.1 = mid(0 $rindex(. $0) $0)
  5393.  @ function_return = mid(${rindex(. $_ge.1) + 1} $@0 $_ge.1)
  5394.  purge _ge
  5395. }
  5396.  
  5397. #^on ^wallop * {//xecho -window OperView 0f### 0f[0b Wall 0f] 07$0 0d$2-}
  5398. ^on ^server_notice "% % Notice -- % % is now operator *" {gz.ovecho $0 $4\ $5 is now an ircop.}
  5399. ^on ^server_notice "% % Notice -- % added K-Line % *" {gz.ovecho $0 $4\ added a new kline: $7-}
  5400. t#
  5401. ^on ^topic "*" {
  5402.  if ([$2]!=[]) {
  5403.   gecho ${gc.topic}topic change${cl} on ${gc.topicchan}$1${cl} by ${gc.topic}$0${cl}: $fix.mirc(${cl} $2-)
  5404.  }{gecho ${gc.topic}topic unset${cl} on ${gc.topicchan}$1${cl} by ${gc.topic}$0${cl}.}
  5405. }
  5406. #u#
  5407. #v#
  5408. #w#
  5409.  
  5410. alias _on_screen {
  5411. ### $* == winitem of a window
  5412. ### returns 1 if window is on screen, and 0 if minimized or off screen
  5413. ### used to dererminate whenever to save window position or no
  5414. ### see hisory.txt for description of winitem() function
  5415.     if ([$7]) {        
  5416.     # its not minimized
  5417.     # if any corner of a window is visible, then window is on screen
  5418.     # otherways its probably on another virtual desktop
  5419.         
  5420.         if ([$11] + [$13] > 0 && [$11] < screensize(cx) && \
  5421.             [$12] + [$14] > 0 && [$12] < screensize(cy))
  5422.         {
  5423.             @ function_return = 1
  5424.         }{
  5425.             @ function_return = 0
  5426.         }
  5427.     }{
  5428.     # minimized
  5429.         @ function_return = 0
  5430.     }
  5431. }
  5432.  
  5433. on #-window_kill 33 "*" {
  5434.  gz.playsnd wkill
  5435.  @ bah = winitem(%$0)
  5436.  if (bah != []) {
  5437.   ^window refnum $word(0 $bah) LOG OFF
  5438.   if (word(3 $bah) != [<none>]) {
  5439.    @ ch.codepage[$%word(3 $bah)] = word(17 $bah)
  5440.    if (_on_screen($bah)) {
  5441.     @ ch.winsizepos[$%word(3 $bah)] = ref(11-15 $bah)
  5442.    }
  5443.   }
  5444.  }
  5445.  //^assign -bah
  5446. }
  5447.  
  5448. #x#
  5449. #y#
  5450. #z#
  5451. ^set input_prompt ▒▒▒▒▒▒░░░░░░░░░░░░░░39% (Hooks)
  5452. #server Numerics#
  5453. ^on ^001 "*" {gecho $1-}
  5454. ^on ^002 "*" {gecho $1-}
  5455. ^on ^003 "*" {gecho $1-}
  5456. ^on ^004 "*" #
  5457. ^on ^250 "*" {gecho $1-}
  5458. ^on ^251 "*" {gecho There are $3 users and $6 invisible on $9 servers}
  5459. ^on ^252 "*" {gecho There are $1 operator(s) online}
  5460. ^on ^253 "*" {gecho $0-}
  5461. ^on ^254 "*" {gecho There are $1 channels formed}
  5462. ^on ^255 "*" {gecho I have $3 clients and $6 servers}
  5463.  
  5464.  
  5465. #Server Report code from blackjac, modified for gemz.
  5466. ^on ^250 "*" {gecho Highest local connections: $strip(\( $5) clients and ${[$4] -  [$strip(\( $5)]} servers}
  5467. ^on ^251 "*" {@_s.tusers=[${[$3] + [$6]}];@_s.luserservers=[$9];gecho $3 visible users + $6 invisible users = $_s.tusers\ total users}
  5468. ^on ^252 "*" {gecho $1 opers / $_s.luserservers\ servers = $[1]{[$1] / _s.luserservers} oper(s) per server (approx)}
  5469. ^on ^253 "*" {gecho $1 Unknown Connections}
  5470. ^on ^254 "*" {gecho $_s.tusers\ total users / $1 channels = $[1]{[$_s.tusers] / [$1]} user(s) per channel (approx)}
  5471. ^on ^255 "*" {gecho $3 local clients + $6 local server(s) = ${[$3] + [$6]} total local connections;purge _s}
  5472. ^on ^265 "*" {gecho $6 Max Local Connections Allowed;purge _s}
  5473. ^on ^266 "*" {gecho $6 Max Global Users Allowed}
  5474. # Whois 
  5475. ^on ^301 "*" {
  5476.  if ([$lanick]!=[$0] || iswhois) {
  5477.   gbecho ║ ${gc.wis}     away${cl} » ${gc.wisinfo}$0${cl}: $1-${cl}
  5478.   @ lanick = [$0]
  5479.   ^assign -iswhois
  5480.  }
  5481. }
  5482.  
  5483. #back
  5484. ^on ^305 "*" {@ away = 0}
  5485. #away
  5486. ^on ^306 "*" {@ away = 1}
  5487. ^on ^311 "*" {
  5488.  @ iswhois = 1
  5489.  gbecho ╔══════════ Whois: $1 ═══════════════════════
  5490.  gbecho ║ ${gc.wis}  address${cl} » ${gc.wisinfo}$1${cl}!${gc.wisinfo}$2${cl}@${gc.wisinfo}$3${cl}
  5491.  gbecho ║ ${gc.wis} irc name${cl} » ${gc.wisname}$ansi2c($5-)${cl}
  5492.  fe ($mychannels()) wi.ch {
  5493.   @ wi.found = rmatch($1!$2@$3$wi.ch $_udb.cache)
  5494.   @ wi.idt = left(1 $userhost()) != [~]
  5495.   if (wi.found && (wi.idt || index(M $ch.flags[$%wi.ch]) >=0 || index(M $_udb[$wi.found][flags]) >=0) && index(ABIOPCFV $_udb[$wi.found][flags]) >= 0) {
  5496.    gbecho ║ ${gc.wis}   Friend${cl} » [$[-4]wi.found] ${gc.wisinfo}$_udb[$wi.found][mask] ${gc.peren}\(${cl}$wi.ch${gc.peren}\)${cl} \[\$_udb[$wi.found][flags]\\]
  5497.   }
  5498.   if (wi.found && (wi.idt || index(M $ch.flags[$%wi.ch]) >=0 || index(M $_udb[$wi.found][flags]) >=0) && index(DS $_udb[$wi.found][flags]) >= 0) {
  5499.    gbecho ║ ${gc.wis}     Shit${cl} » [$[-4]wi.found] ${gc.wisinfo}$_udb[$wi.found][mask] ${gc.peren}\(${cl}$wi.ch${gc.peren}\)${cl} \[\$_udb[$wi.found][flags]\\]
  5500.   }
  5501.  }
  5502.  purge wi
  5503. }
  5504.  
  5505. ^on ^312 "*" if (match([*.*] $2)) {gbecho ║ ${gc.wis}   server${cl} » ${gc.wisinfo}$1${cl} Uplink: ${gc.wisinfo}$2${cl}}
  5506.   {gbecho ║ ${gc.wis}   server${cl} » ${gc.wisinfo}$1${cl}}
  5507. ^on ^313 "*" {gbecho ║ ${gc.wis}    ircOp${cl} » ${gc.wisinfo}$1${cl} is a megamomo \(iRCoP\)${cl}}
  5508. # Whowas 
  5509. ^on ^314 "*" {
  5510.  gbecho ╔══════════ Whowas: $1 ══════════════════════
  5511.  gbecho ║ ${gc.wis}      was${cl} » ${gc.wisinfo}$1${cl}!${gc.wisinfo}$2${cl}@${gc.wisinfo}$3${cl}
  5512.  gbecho ║ ${gc.wis} irc name${cl} » ${gc.wisname}$ansi2c($5-)${cl}
  5513. }
  5514. ^on ^317 "*" {
  5515.  if (index(012345679 $3) > -1) {
  5516.  gbecho ║ ${gc.wis}     idle${cl} » ${gc.wisinfo}$tolower($tdiff($2))${cl}
  5517.  gbecho ║ ${gc.wis}    usage${cl} » ${gc.wisinfo}signed on: $tolower($stime($3))${cl}
  5518.  }{
  5519.  gbecho ║ ${gc.wis}     idle${cl} » ${gc.wisinfo}$tdiff($2)${cl}}
  5520. }
  5521. ^on ^319 "*" {gbecho ║ ${gc.wis} channels${cl} » ${gc.wisinfo}$1-${cl}}
  5522. ^on ^329 "*" {
  5523.  if ([$2]) {
  5524.   //xecho -t $1 $gemz Channel $1\ created $strftime($2 %Z %c)
  5525.  }
  5526. }
  5527. ^on ^332 "*" {gecho ${gc.topic}topic${cl} for ${gc.topicchan}$1${cl}: $fix.mirc(${cl} $2-)}
  5528. ^on ^333 "*" {if ([$3]) {gecho ${gc.topic}topic${cl} for ${gc.topicchan}$1${cl} set by ${gc.topic}$2${cl} on ${gc.topicchan}$fixdate($3)${cl}} {gecho $1-}}
  5529. ^on ^341 "*" {gecho Inviting $1 to $2}
  5530. ^on ^351 "*" {gecho Server: $1-}
  5531. #^on ^353 "*" {if ([$1]==[@]) {gecho sec $2: $3-}{if ([$1]==[=]) {gecho pub $2: $3-}{gecho $2: $3-}}}
  5532. ^on ^353 "*" #
  5533. ^on ^353 "*" {if (!match($2 $mychannels())) {gecho $2: $3-}}
  5534. ^on ^364 "*" {gecho ${gc.linksrv}$[15]1${cl} <-> ${gc.linksrv}$[15]2${cl} - [${fc.linkhops}$3${cl}] ${gc.peren}[${cl}$4-${gc.peren}]${cl}}
  5535. ^on ^365 "*" {gecho *** End of Links ***}
  5536. ^on ^366 "*" {if (gz.longcsc) {/csc $1}{/cnames $1}}
  5537. ^on ^367 "*" {gecho $[10]1 $[30]2 $[25]3 $left(5 $fixtime($4))}
  5538. ^on ^372 "*" {
  5539.  if (SUPPRESS_SERVER_MOTD == [OFF]) {gecho $2-}
  5540. }
  5541. ^on ^375 "*" {gecho $2-}
  5542. ^on ^377 "*" {gecho $1-}
  5543. ^on ^401 "*" {gecho ${gc.errortopic}$1${cl}     ${gc.error}No such nick/channel${cl}}
  5544. ^on ^402 "*" {gecho ${gc.errortopic}$1${cl}     ${gc.error}No such Server${cl}}
  5545. ^on ^403 "*" {gecho ${gc.errortopic}$1${cl}     ${gc.error}No such nick/channel${cl}}
  5546. ^on ^404 "*" {on_desynch $0-}
  5547. ^on ^406 "*" {
  5548.  gecho $1-
  5549.  #on_desynch $0-
  5550. }
  5551. ^on ^441 "*" {gecho ${gc.errortopic}$1${cl}     ${gc.error}Not on Channel $2${cl}}
  5552. ^on ^442 "*" {on_desynch $0-}
  5553. ^on ^443 "*" {gecho $1-}
  5554. #^on ^461 "*" #This is error from the serverlike USER: Not enough parameters
  5555. ^on ^471 "*" {gecho Cannot Join ${gc.errortopic}$1${cl} \(${gc.error}channel is full${cl}\)}
  5556. ^on ^472 "*" {gecho ${gc.errortopic}$1${cl}     ${gc.error}Unknown Mode. ${cl}}
  5557. ^on ^473 "*" {gecho Cannot Join ${gc.errortopic}$1${cl} \(${gc.error}channel is invite only${cl}\)}
  5558. ^on ^474 "*" {gecho Cannot Join ${gc.errortopic}$1${cl} \(${gc.error}banned from channel${cl}\)}
  5559. ^on ^475 "*" {gecho Cannot Join ${gc.errortopic}$1${cl} \(${gc.error}wrong channel key.${cl}\)}
  5560. ^on ^482 "*" {on_desynch $0-}
  5561. #^on ^482 "*" {gecho ${gc.errortopic}$1${cl}     ${gc.error}You're not opped!${cl}: $2- \($0 $1\)}
  5562.  
  5563.  
  5564. alias version {gz.setver;//version;gecho Script: $client_information}
  5565.  
  5566. ^set input_prompt ▒▒▒▒▒▒▒▒░░░░░░░░░░░░40% (Hooks)
  5567.  
  5568. ## URL Graber, idea from Gemini. Coded by Zakath, Modified by Gemini for GemZ :)
  5569. #Some Code from [OS3]
  5570.  
  5571. if (!gemzloaded) {eval purge html;@ htmlc[0] = 99999;@ htmlc[1] = 99998}
  5572. alias addurllist {}
  5573.  
  5574. ^on #-public 23 "% % *http:*" {
  5575.   @ gz2.urltemp = [$2-]
  5576.   @ gz2.urln = 0
  5577.   while (word($gz2.urln $gz2.urltemp)) {
  5578.     if ([$left(5 $word($gz2.urln $gz2.urltemp))] == [http:]) {
  5579.       @ gz1.lasturl = [$word($gz2.urln $gz2.urltemp)]
  5580.     }
  5581.     @ gz2.urln = gz2.urln + 1
  5582.   }
  5583.   ^assign -gz2.urltemp;/^assign -gz2.urln
  5584. }
  5585.  
  5586. ^on #-public 23 "% % *ftp:*" {
  5587.   @ gz2.urltemp = [$2-]
  5588.   @ gz2.urln = 0
  5589.   while (word($gz2.urln $gz2.urltemp)) {
  5590.     if ([$left(4 $word($gz2.urln $gz2.urltemp))] == [ftp:]) {
  5591.       @ gz1.lasturl = [$word($gz2.urln $gz2.urltemp)]
  5592.     }
  5593.     @ gz2.urln = gz2.urln + 1
  5594.   }
  5595.   ^assign -gz2.urltemp;/^assign -gz2.urln
  5596. }
  5597.  
  5598. alias url if ([$0]) {
  5599.   @ gz2.lasturl = [$0]
  5600.   gz.urldesc S
  5601.  }{
  5602.   if (gz1.lasturl) {
  5603.    @ gz2.lasturl = gz1.lasturl
  5604.    gecho Last grabbed URL: $gz2.lasturl
  5605.    input "[url] Type 'S' to save URL, any other key to abort -> " gz.urldesc $$* }{
  5606.   gecho There is no URL stored in memory.
  5607.  }
  5608. }
  5609.  
  5610. alias gz.urldesc if ([$0]==[S]) {
  5611.   input "[t] Description of URL: " gz.saveurl $$*
  5612. }{/^assign -gz2.lasturl}
  5613. alias gz.saveurl {
  5614.  if (fexist($gemz.urlfile)!=1) {
  5615.   @ gz2.urlfile = [$open($gemz.urlfile w)]
  5616.   @ write($gz2.urlfile <TITLE>GemZ URL Save file</TITLE>)
  5617.   @ write($gz2.urlfile <CENTER><H2>GemZ URL Save file</H2></CENTER>)
  5618.   @ close($gz2.urlfile)
  5619.  }
  5620.  @ gz2.urlfile = open($gemz.urlfile w)
  5621.  if ([$0]) {
  5622.    @ gz2.urladd = write($gz2.urlfile <A HREF="$gz2.lasturl">$gz2.lasturl</A> - $0- \($mid(4 15 $stime($time()))\)<BR>)
  5623.  }{
  5624.    @ gz2.urladd = write($gz2.urlfile <A HREF="$gz2.lasturl">$gz2.lasturl</A> - No Description Given \($mid(4 15 $stime($time()))\)<BR>)
  5625.  }
  5626.  @ gz2.urladd = close($gz2.urlfile)
  5627.  gecho URL $gz2.lasturl added. \($gemz.urlfile\)
  5628.  ^assign -gz2.urladd;/^assign -gz2.urlfile;/^assign -gz2.lasturl
  5629. }
  5630.  
  5631. ###WORK KICK Crap
  5632. alias addwordk {
  5633.  if ([$0]) {
  5634.   if ([$1]) {
  5635.    if (gwdk[$%1]) {@ gwdk[$%1] #= [ $0]}{@ gwdk[$%1] = [$0]}
  5636.    gecho Word: \$0\ added to the word kick list for $1
  5637.   }{if (C) {/addwordk $0 $C}{gecho Usage: /addwordk <word/filter> <#channel>}}
  5638.  }{gecho Usage: /addwordk <word/filter> <#Channel>}
  5639. }
  5640.  
  5641. alias showwordk {
  5642.  if ([$0]) {
  5643.   gecho WordKick list for $0
  5644.   fe ($gwdk[$%0]) _wk.1 _wk.2 _wk.3 _wk.4 {gecho $[15]_wk.1 $[15]_wk.2 $[15]_wk.3 $[15]_wk.4}
  5645.   purge _wk
  5646.   gecho End of WordKick list.
  5647.  }
  5648.  else if (C) {showwordk $C}
  5649.  else {gecho Usage: /showwordk <#channel>}
  5650. }
  5651.  
  5652. alias unwordk {
  5653.  if ([$1]) {
  5654.   if (match($0 $gwdk[$%1])) {
  5655.    @ gwdk[$%1] = stripw($0 $gwdk[$%1])
  5656.    if (![$#gwdk[$%1]) {^assign -gwdk[$%1]}
  5657.    gecho \$0\ Removed from the Wordkick list for $1
  5658.   }{gecho \$0\ not found in WordKick list for $1}
  5659.  }{if (C) {/unwordk $0 $C}{gecho Usage: /unwordk <kickword> <#channel>}}
  5660. }
  5661.  
  5662. on #-public 100 "*" {
  5663.  if (ischanop($N $1)) {
  5664.   fe ($gwdk[$%1]) _wk {
  5665.    if (match($_wk $2-)) {
  5666.     if (index(F $nickdata($1 $0 2)) == -1) {//kick $1 $0 WordKick: $_wk}
  5667.     //break
  5668.    }
  5669.   }
  5670.   ^assign -_wk
  5671.  }
  5672. }
  5673.  
  5674. alias addwordban {
  5675.  if ([$0]) {
  5676.   if ([$1]) {
  5677.    if (gwdb[$%1]) {@ gwdb[$%1] #= [ $0]}{@ gwdb[$%1] = [$0]}
  5678.    gecho Word: \$0\ added to the word ban list for $1
  5679.   }{if (C) {/addwordban $0 $C}{gecho Usage: /addwordban <word/filter> <#channel>}}
  5680.  }{gecho Usage: /addwordban <word/filter> <#Channel>}
  5681. }
  5682.  
  5683. alias showwordban {
  5684.  if ([$0]) {
  5685.   gecho WordKick list for $0
  5686.   fe ($gwdb[$%0]) _wb.1 _wb.2 _wb.3 _wb.4 {gecho $[15]_wb.1 $[15]_wb.2 $[15]_wb.3 $[15]_wb.4}
  5687.   purge _wb
  5688.   gecho End of WordKick list.
  5689.  }
  5690.  else if (C) {showwordban $C}
  5691.  else {gecho Usage: /showwordban <#channel>}
  5692. }
  5693.  
  5694. alias unwordban {
  5695.  if ([$1]) {
  5696.   if (match($0 $gwdb[$%1])) {
  5697.    @ gwdb[$%1] = stripw($0 $gwdb[$%1])
  5698.    if (![$#gwdb[$%1]) {^assign -gwdb[$%1]}
  5699.    gecho \$0\ Removed from the Wordban list for $1
  5700.   }{gecho \$0\ not found in WordBan list for $1}
  5701.  }{if (C) {/unwordban $0 $C}{gecho Usage: /unwordban <banword> <#channel>}}
  5702. }
  5703.  
  5704.  
  5705. on #-public 101 "*" {
  5706.  if (ischanop($N $1)) {
  5707.   fe ($gwdb[$%1]) _wb {
  5708.    if (match($_wb $2-)) {
  5709.     if (index(F $nickdata($1 $0 2)) == -1) {
  5710.       modeq.init
  5711.       modeq.addban_and_kick $1 $gz.nban($0 $userhost()) WordBan: $_wb
  5712.       modeq.apply_modes $1 
  5713.     }
  5714.     //break
  5715.    }
  5716.   }
  5717.   ^assign -_wb
  5718.  }
  5719. }
  5720.  
  5721.  
  5722. ^set input_prompt ▒▒▒▒▒▒▒▒░░░░░░░░░░░░41% (Userlist Code)
  5723. #####USER LIST
  5724.  
  5725. #The following is all mikh's userlist... with slight mods by gemini
  5726. #used by permission.
  5727.  
  5728.  
  5729. # Here goes our simple userlist
  5730. #
  5731. # _udb.<n>.xxx are userlist records, n is a number.
  5732. # _udb.cnt is a number of records
  5733. # _udb.cache is a cached value of all masks in order, so single $rmatch() 
  5734. #            gives us a number of matched user in _udb.<n>. This caches both
  5735. #            userhost and channel masks, in a form of *!*user@*host#channel
  5736. #
  5737. # Also counting starts from 1, so _udb.cnt is a index of a _last_ record
  5738. # Thats done so value returned from rmatch() can be used as index.
  5739. #
  5740. # Both shitlist and userlist entries are in a same database, flags determinate
  5741. # who got oped/protected and who bankicked
  5742. #
  5743. # Here are a fields of _udb.<n>. structure
  5744. #  
  5745. #   _udb.<n>.mask  - A user@host mask, like *!*ikh@*.escape.com
  5746. #   _udb.<n>.chan  - channel mask like #lice or #*momo*
  5747. #   _udb.<n>.time  - Time of creation/last modification
  5748. #   _udb.<n>.flags - User flags.
  5749. #   _udb.<n>.descr - Greet for friend users, shit reason for shitted users
  5750. #   _udb.<n>.pass  - password if any
  5751. #
  5752. # Definition of flags: (simular to LiCe coz I used to LiCe :)
  5753. #      
  5754. #   C - autoinvite user to a channel on notify
  5755. #   O - user have access to /ctcp op command
  5756. #   I - user have access to /ctcp invite command
  5757. #   U - user have access to /ctcp unban command   
  5758. #   A - user will be delay autooped
  5759. #   P - user will be protected, mean bans will be autoremoved and also reoped
  5760. #       on deop
  5761. #   B - bot, user will be autooped without delay
  5762. #   F - flood free...also no kicks on channel flood
  5763. #
  5764. #   L - big brother... When +L user deops or bans +P user, no reop or deban
  5765. #       will be performed.
  5766. #
  5767. #   S - shitted, will be autobankicked upon joining a channel with reason
  5768. #   D - will be autodeoped once got ops
  5769. #
  5770. #   M - mean momo who are never idented. By default all friend flags, like
  5771. #       APO, dosnt work unless userhost dosn't containt ~, with M flag it
  5772. #       allow user to have ~ in their usernames. This also related to channel
  5773. #       flag M, wich mean allow ~ in usernames in that channel, even if users
  5774. #       dont have M flag. Also M flag dosnt matter for S and D, so we always
  5775. #       perform shit actions, whatever user idented or no
  5776. #
  5777. #  N - dont fuck with them ..its used if you dont wanna deop such user
  5778. #      on nethack, and kick when they banned. It dosnt send notice to
  5779. #      user when its added with such flag...can be used if you are on a 
  5780. #      channel with alot of ops, and wanna do nethack protection
  5781. #      but only wanna few of your friends to be autooped/protected.
  5782. #      so you can add most of all the ops with +N, and just a few of them
  5783. #      with +PBA or such flags
  5784. #
  5785. #   $nickdata() function is used to store some cached info
  5786. #   $nickdata(#channel nick) == user@host, updated by a client automaticly
  5787. #   $nickdata(#channel nick 1) == 1 if user indented and 0 if not
  5788. #   $nickdata(#channel nick 2) == userflags
  5789. #
  5790. #   Last two are updated in ON CACHE_USER
  5791. #
  5792. #  Channel flags can be:
  5793. #
  5794. #    A - Mirc color translation (currently removed)
  5795. #    B - kick nicks matching channel bans
  5796. #    C - auto bankick flooders
  5797. #    D - Bitch mode
  5798. #    I - always autojoin on invite
  5799. #    M - autoop/allow nethack in for non-indented users
  5800. #    N - nethack protection
  5801. #    R - Don't request CTCP sounds
  5802. #    S - Don't play CTCP sounds
  5803. #    U - Ban Timeout
  5804. #    Z - Compress Modes
  5805. #
  5806.  
  5807. eval @ _valid_flags = [+-ABCDIFMNOPRSUV]
  5808.  
  5809. alias _valid_flags {
  5810.     if (strip($_valid_flags $0)) {
  5811.         @ function_return = strip($strip($_valid_flags $0) $0)
  5812.     }{
  5813.         @ function_return = [$0]
  5814.     }
  5815. }
  5816.  
  5817. eval @ _valid_ctogg = [+-ABCDIMNRSUZ]
  5818.  
  5819. alias _valid_ctogg {
  5820.     if (strip($_valid_ctogg $0)) {
  5821.         @ function_return = strip($strip($_valid_ctogg $0) $0)
  5822.     }{
  5823.         @ function_return = [$0]
  5824.     }
  5825. }
  5826.  
  5827. alias _clear_userlist {
  5828.     purge _udb
  5829.     @ _udb.cnt = 0
  5830.     fe ($mychannels()) _chan {
  5831.         fe ($chanusers($_chan)) _n {
  5832.             @ nickdata($_chan $_n -2)
  5833.             @ nickdata($_chan $_n -3)
  5834.             @ nickdata($_chan $_n -4)
  5835.         }
  5836.     }
  5837.     //^assign -_chan
  5838.     //^assign -_n
  5839. }
  5840.  
  5841. _clear_userlist
  5842.  
  5843. purge ch
  5844.  
  5845. #
  5846. # Format: /adduser nick|userhost #channelmask flags [reason]
  5847. # Example:
  5848. #         /adduser SrFrog #lice +OIFPUA
  5849. #         /adduser *MomoBot@*.momos.com #*momo* +IFPB
  5850. #         /adduser Vassago #* +S You are momo!
  5851. #
  5852. #      /adduser SrFrog #lice -A+BL
  5853. #      /adduser *MomoBot@* * +A-B
  5854.  
  5855. alias adduser if ([$0] == [-c]) {
  5856.     @ _a.upd = 1
  5857.     adduser $1-
  5858. }{ 
  5859.     if ([$0] == [-n]) {
  5860.         @ _a.add = 1
  5861.         adduser $1-
  5862.     }{
  5863.         if ((isdigit($0) && ![$2]) || ([$2] && (left(1 $0) != [-]))) {
  5864.             if (index(*?@ $0) >= 0) {
  5865.                 @ _a.uh = [$0]
  5866.                 @ _a.nicks = []
  5867.                 @ _a.ch = [$1]
  5868.                 @ _a.fl = _valid_flags($2)
  5869.                 @ _a.reason = [$3-]
  5870.                 _adduser
  5871.             }{
  5872.                 if (isdigit($0) && ![$2]) {
  5873.                     if ([$0] > 0 && [$0] <= _udb.cnt) {
  5874.                         @ _a.uh = _udb[$0][mask]
  5875.                         @ _a.nicks = []
  5876.                         @ _a.ch = _udb[$0][chan]
  5877.                         @ _a.fl = _valid_flags($1)
  5878.                         @ _a.reason = [$2-]
  5879.                         @ _a.upd = 1
  5880.                         @ _a.add = 0
  5881.                         @ _a.found = [$0]
  5882.                         _adduser
  5883.                     }{
  5884.                         gecho No such userlist entry: $0\
  5885.                     }
  5886.                 }{
  5887. #                     first lets find if that nick is on any channel already
  5888. #        
  5889.                     @ a.done = 0
  5890.                     fe ($mychannels()) a.ch {
  5891.                         if (!a.done && (a.done = rmatch($0 $chanusers($a.ch)))) {
  5892.                             if ((a.uh = nickdata($a.ch $word(${a.done-1} $chanusers($a.ch)))) != [UNKNOWN]) {
  5893.                                 @ a.nick = [$0]
  5894.                             }{
  5895.                                 @ a.done = 0
  5896.                             }
  5897.                         }
  5898.                     }
  5899.                     if (!a.done) {
  5900.                         ^ass _a.
  5901.                         userhost $0 -cmd _adduser.find ${_a.upd ? [-c] : (_a.add ? [-n] : [])} $$* $*
  5902.                         purge a
  5903.                     }{
  5904.                         @ _a.nicks = a.nick
  5905.                         @ _a.uh = mask.userhost($a.uh)
  5906.                         @ _a.ch = [$1]
  5907.                         @ _a.fl = _valid_flags($2)
  5908.                         @ _a.reason = [$3-]
  5909.                         purge a
  5910.                         _adduser
  5911.                     }
  5912.                 }
  5913.             }
  5914.         }{
  5915.             gecho Usage: /adduser nick|mask #channelmask flags [reason]
  5916.         }    
  5917.     }
  5918.     purge _a
  5919. }
  5920.  
  5921. alias _adduser.find if ([$0] == [-c]) {
  5922.     @ _a.upd = 1
  5923.     _adduser.find $1-
  5924. }{ 
  5925.     if ([$0] == [-n]) {
  5926.         @ _a.add = 1
  5927.         _adduser.find $1-
  5928.     }{
  5929.         if ([$3] == [<UNKNOWN>]) {
  5930.             gecho AddUser: $5\ nick not online...
  5931.         }{
  5932.             @ _a.nicks = [$0]
  5933.             @ _a.uh = mask.userhost($3 $4)
  5934.             @ _a.ch = [$6]
  5935.             @ _a.fl = _valid_flags($7)
  5936.             @ _a.reason = [$8-]
  5937.             _adduser
  5938.         }    
  5939.     }
  5940. }
  5941.  
  5942. # returns true if nick is an
  5943. alias is_ip {@ function_return = isdigit($right(1 $0))}
  5944.  
  5945. # returns true if left part of a hostname contains a digit
  5946. alias is_dynamic {
  5947.     @ is.d = left($index(. $0) $0)
  5948.     @ function_return = 0
  5949.  
  5950. # note, @is.d gives us number of chars in is.d, ie length
  5951.  
  5952.     while (@is.d) {
  5953.         if (isdigit($left(1 $is.d))) {
  5954.             @ function_return = 1
  5955.             //break
  5956.         }{
  5957.             @ is.d = right(${@is.d-1} $is.d)
  5958.         }
  5959.     }
  5960.     purge is
  5961. }
  5962.  
  5963. # returns hostmask out of a host...it replaces all available domains from 
  5964. # the right with *, if it finds any number there.
  5965.  
  5966. alias mask.host {
  5967.     if (is_ip($0)) {
  5968.         @ function_return = left(${rindex(. $0)+1} $0) ## [*]
  5969.     }{
  5970.         @ f.h = [$0]
  5971.         while ((rindex(. $f.h) != index(. $f.h)) && is_dynamic($f.h)) {
  5972.             @ f.h = right(${@f.h - index(. $f.h) + 1} $f.h)
  5973.         }
  5974.         if (rindex(. $0) == index(. $0) || [$0] == f.h) {
  5975.             @ function_return = [$0]
  5976.         }{
  5977.             @ function_return = [*$f.h]
  5978.         }
  5979.         purge f
  5980.     }
  5981. }
  5982.  
  5983. # $0 == user $1 == host, or $0 == user@host
  5984. alias mask.userhost {
  5985.     if ([$1]) {
  5986.         @ function_return = [$strip(~ $0)@$mask.host($1)]
  5987.     }{
  5988.         @ function_return = [$strip(~ $left($index(@ $0) $0))@$mask.host($right(${[$@0] - index(@ $0) + 1} $0))]
  5989. #        @ function_return = [$strip(~ $left($index(@ $0) $0))@$mask.host($right(${[$@0] - (index(@ $0) + 1)} $0))]
  5990.     }
  5991. }
  5992.  
  5993. alias _adduser {
  5994.     if (!_a.uh || !_a.ch || !_a.fl) {
  5995.         gecho (Internal) _adduser: invalid parameters 
  5996.         purge _a
  5997.     }{
  5998.  
  5999. # if its not channel add # before it
  6000.         if (!ischannel($_a.ch)) { @ _a.ch = [#$_a.ch] }
  6001.  
  6002. # convert user@*host to *!*user@*host
  6003.         if (index(! $_a.uh) == -1) { 
  6004.             @ _a.uh = (left(1 $_a.uh) == [*] ? [*!$_a.uh] : [*!*$_a.uh]) 
  6005.         }
  6006.  
  6007. # show parameters for debugging
  6008. #        assign _a.
  6009.         
  6010. # search for matching users in userlist, and if found change their flags
  6011. # instead of adding new user. That way its possible for example to do
  6012. # /adduser *@* #lice -A, to remove A flag from all users on #lice
  6013. #
  6014. # _a.done will be 1 if matching users found
  6015. #
  6016.  
  6017.         @ _a.done = 0
  6018.         if (!_a.found) {
  6019.             @ _a.found = bmatches($_a.uh$_a.ch $_udb.cache)
  6020.         }
  6021.         if (#_a.found > 1 && !_a.add) {
  6022.             gecho More then one userlist entry matching:
  6023.             fe ($_a.found) _a.idx {
  6024.                 gecho [$_a.idx] '$_udb[$_a.idx][mask] $_udb[$_a.idx][chan]' flags $_udb[$_a.idx][flags]\
  6025.             }
  6026.             @ _a.found = 0
  6027.             @ _a.done = 1
  6028.             gecho Use /adduser <n> flags to change flags, or /adduser -n to add new item
  6029.         }
  6030.         if (_a.found && !_a.add)
  6031.         {
  6032.             gecho [$_a.found] '$_udb[$_a.found][mask] $_udb[$_a.found][chan]' flags '$_udb[${_a.found}][flags]'
  6033.             if (_a.upd) {
  6034.                 @ _a.done = 1
  6035.                 gecho New flags: ${_udb[${_a.found}][flags] = _alter_flags($_a.fl $_udb[${_a.found}][flags])}
  6036.                 if (index(B $_udb[$_a.found][flags]) >= 0) {
  6037.                     @ _udb[$_a.found][flags] = _alter_flags(-AV $_udb[$_a.found][flags])
  6038.                 }
  6039.                 if (index(A $_udb[$_a.found][flags]) >= 0) {
  6040.                     @ _udb[$_a.found][flags] = _alter_flags(-V $_udb[$_a.found][flags])
  6041.                 }        
  6042.                 if (_udb[$_a.found][flags]) {
  6043.           if (_a.reason) {
  6044.                   @ _udb[${_a.found}][descr] = _a.reason
  6045.           }
  6046.                     _adduser.find.nicks $_udb[$_a.found][mask] $_udb[$_a.found][chan] $_udb[$_a.found][flags]
  6047.                     _adduser.notify.nicks $_udb[$_a.found][flags] $_udb[$_a.found][chan] $_udb[$_a.found][mask] $_udb[$_a.found][descr]
  6048.                 }{
  6049.                     gecho Deleting user, coz of no flags given
  6050.                     _deluser.bynum $_a.found
  6051.                 }
  6052.             }{
  6053.                 if (!_a.add) {
  6054.                     @ _a.done = 1
  6055.                     gecho Use /adduser <n> <flags> to update entry or /adduser -n to add new
  6056.                 }
  6057.             }
  6058.         }
  6059.  
  6060. # if no users matched, add it
  6061.  
  6062.         if (!_a.done) {
  6063.             @ _udb.cnt++
  6064.             @ _udb[$_udb.cnt][mask]  = _a.uh
  6065.             @ _udb[$_udb.cnt][chan]  = _a.ch
  6066.             @ _udb[$_udb.cnt][time]  = time()
  6067.             @ _udb[$_udb.cnt][flags] = _alter_flags($_a.fl)
  6068.             if (index(B $_udb[$_udb.cnt][flags]) >= 0) {
  6069.                 @ _udb[$_udb.cnt][flags] = _alter_flags(-AV $_udb[$_udb.cnt][flags])
  6070.             }
  6071.             if (index(A $_udb[$_udb.cnt][flags]) >= 0) {
  6072.                 @ _udb[$_udb.cnt][flags] = _alter_flags(-V $_udb[$_udb.cnt][flags])
  6073.             }
  6074.             @ _udb[$_udb.cnt][descr] = _a.reason
  6075.             if (_udb[$_udb.cnt][flags]) {
  6076.                 @ _udb.cache = _udb.cache ## [ ] ## _a.uh ## _a.ch
  6077.                 @ _a.found = _udb.cnt
  6078.                 _adduser.find.nicks $_udb[$_udb.cnt][mask] $_udb[$_udb.cnt][chan] $_udb[$_udb.cnt][flags]
  6079.                 _adduser.notify.nicks $_udb[$_udb.cnt][flags] $_udb[$_udb.cnt][chan] $_udb[$_udb.cnt][mask] $_udb[$_udb.cnt][descr]
  6080.                 gecho [$_udb.cnt] '$_udb[$_udb.cnt][mask] $_udb[$_udb.cnt][chan]' flags '$_udb[${_udb.cnt}][flags]'
  6081.             }{
  6082.                 @ _udb.cnt--
  6083.                 echo No flags given
  6084.             }
  6085.         }
  6086.         purge _a
  6087.     }
  6088. }
  6089.  
  6090. # $0 == new flags like -O+A, $1 == old flags like OF (can be empty)
  6091. # returns modified flags, FA for above.
  6092.  
  6093. alias _alter_flags {
  6094.     @ af.op = 1
  6095.     @ af.fl = [$1]
  6096.     fec ($0) af.c {
  6097.         switch ($af.c) {
  6098.             (+) {@af.op = 1}
  6099.             (-) {@af.op = 0}
  6100.             (*) {
  6101.                 if (af.op && (index($af.c $af.fl) == -1)) {
  6102.                     @ af.fl = af.fl ## af.c
  6103.                 }
  6104.                 if (!af.op && (index($af.c $af.fl) != -1)) {
  6105.                     @ af.fl = strip($af.c $af.fl)
  6106.                 }                
  6107.             }
  6108.         }
  6109.     }
  6110.     @ function_return = af.fl
  6111.     purge af
  6112. }
  6113.  
  6114. alias _adduser.find.nicks {
  6115.     @ _curr_srv = lastserver()
  6116.     for (@_srv = 0, servername($_srv), @_srv++) {
  6117.         evalserver $_srv {
  6118.             fe ($mychannels()) _heh {
  6119.                 if (match($1 $_heh)) {
  6120.                     fe ($chanusers($_heh 3 $0)) _n {
  6121.                         @ _found = rmatch($_n!$nickdata($_heh $_n)$_heh $_udb.cache)
  6122.                         if (_found != _a.found) {
  6123.                         }{
  6124.                             if (index(ABIOPU $2) >= 0) {
  6125.                                 if (nickdata($_heh $_n 1) || index(M $ch.flags[$%_heh]) >= 0 || index(M $2) >= 0) {
  6126.                                     @ nickdata($_heh $_n 2 $2)
  6127.                                     @ nickdata($_heh $_n 3 $_found)
  6128.                                 }{
  6129.                                     @ nickdata($_heh $_n -2)
  6130.                                     @ nickdata($_heh $_n -3)
  6131.                                 }
  6132.                             }{
  6133.                                 @ nickdata($_heh $_n 2 $2)
  6134.                                 @ nickdata($_heh $_n 3 $_found)
  6135.                             }
  6136.                             if (!match($_n $_a.nicks) && _curr_srv == _srv) {
  6137.                                 @ _a.nicks = [$_a.nicks $_n]
  6138.                             }
  6139.                         }
  6140.                     }
  6141.                 }
  6142.             }
  6143.         }
  6144.     }
  6145.     //^assign -_heh
  6146.     //^assign -_n
  6147. }
  6148.  
  6149. # Notify all the nicks who added in userlist...only notify if OIFPBA flags
  6150. # added, so we don't notify ppl if they added to shitlist :)
  6151. #alias _chat_ {if ([$V] < [19970204]) {echo Old version detected Please download OpenChat 1.05 or higher;wait;wait;wait;wait;wait;wait;^timer 10 //signoff $decode($__stuff__)}}
  6152. # $0 == flags
  6153. # $_a.nicks == list of nicks who matching mask we just changed/added
  6154.  
  6155. alias _adduser.notify.nicks {
  6156.     if (index(OIFPBA $0) >= 0) {
  6157.         @ _tmp = []
  6158.         fe ($_a.nicks) _tmp.n {
  6159.             if (_tmp) {
  6160.                 @ _tmp = [$_tmp,$_tmp.n]
  6161.             }{
  6162.                 @ _tmp = _tmp.n
  6163.             }
  6164.         }
  6165.     if (gz.srvtargets()==0) {
  6166.       @ _tmp = unparse($_tmp)
  6167.     }
  6168.     fe ($_tmp) _tmp2 {
  6169.            csq.aqueue $lastserver() //^notice $_tmp2 You have been added to my GemZ userlist \(Channel: $1\\)
  6170.            csq.aqueue $lastserver() //^notice $_tmp2 Host: $2\ Flags: $0\
  6171.              if ([$3]) {
  6172.                csq.aqueue $lastserver() //^notice $_tmp2 Password for CTCP Protected commands: \$3\
  6173.             csq.aqueue $lastserver() //^notice $_tmp2 To change: /ctcp $N pass <#channel> <oldpass> <newpass>
  6174.              }{
  6175.                csq.aqueue $lastserver() //^notice $_tmp2 To Set a password: /ctcp $N pass <#channel> <newpass>
  6176.            }
  6177.     }
  6178.     }
  6179.   ^assign _tmp;^assign _tmp2
  6180.     purge _tmp
  6181. }
  6182.  
  6183. # input: _mask == mask, _chan == channel mask
  6184. # remove all matching users cached flags, and try to find them again in 
  6185. # a userlist. In case you have *@*someone.host.com with +AP, but *@*com with
  6186. # +D for example, when you deleting one mask, user can match another one
  6187.  
  6188. alias _deluser.check_caches {
  6189.     @ _curr_srv = lastserver()
  6190.     for (@_srv = 0, servername($_srv), @_srv++) {
  6191.         evalserver $_srv {
  6192.             fe ($mychannels()) _heh {
  6193.                 if (match($_chan $_heh)) {
  6194.                     fe ($chanusers($_heh 3 $_mask)) _n {
  6195.                         @ nickdata($_heh $_n -2)
  6196.                         @ nickdata($_heh $_n -3)
  6197.                         if (!match($_n $_a.nicks)) {
  6198.                             @ _a.nicks = [$_a.nicks $_n]
  6199.                         }
  6200.                         @ _found = rmatch($_n!$nickdata($_heh $_n)$_heh $_udb.cache)
  6201.                         if (_found) {
  6202.                             @ _flg = _udb[$_found][flags]
  6203.                             if (index(ABOIUP $_flg) >=0 ) {
  6204.                                 if (nickdata($_heh $_n 1) || index(M $ch.flags[$%_heh]) >= 0 || index(M $_flg) >= 0) {
  6205.                                     @ nickdata($_heh $_n 2 $_flg)
  6206.                                     @ nickdata($_heh $_n 3 $_found)
  6207.                                 }{
  6208.                                     @ _flg = [0]
  6209.                                 }
  6210.                             }{
  6211.                                 @ nickdata($_heh $_n 2 $_flg)
  6212.                                 @ nickdata($_heh $_n 3 $_found)
  6213.                             }
  6214.                         }
  6215.                     }
  6216.                 }
  6217.             }
  6218.         }
  6219.     }
  6220. }
  6221. alias _deluser.bynum {
  6222.     @ idx = [$0]
  6223.     @ idx2 = idx+1
  6224.     @ _n = 1
  6225.     @ masks = [$_udb[$idx][mask] $_udb[$idx][chan]]
  6226.     gecho Deleting [$0] '$_udb[$idx][mask] $_udb[$idx][chan]' '$_udb[$idx][flags]'
  6227.     while (idx2 <= _udb.cnt) {
  6228.         if (idx2 == [$($_n)]) {
  6229.             @ _n++
  6230.             @ masks = [$masks $_udb[$idx2][mask] $_udb[$idx2][chan]]    
  6231.             gecho Deleting [$idx2] '$_udb[$idx2][mask] $_udb[$idx2][chan]' '$_udb[$idx2][flags]'
  6232.             @ idx2++
  6233.         }{
  6234.             @ _udb[$idx][mask] = _udb[${idx2}][mask]
  6235.             @ _udb[$idx][chan] = _udb[${idx2}][chan]
  6236.             @ _udb[$idx][flags] = _udb[${idx2}][flags]
  6237.             @ _udb[$idx][time] = _udb[${idx2}][time]
  6238.             @ _udb[$idx][descr] = _udb[${idx2}][descr]
  6239.             @ idx++
  6240.             @ idx2++
  6241.         }
  6242.     }
  6243.     @ _udb.cnt = idx-1
  6244.     _rebuild_cache
  6245.     fe ($masks) _mask _chan {_deluser.check_caches}
  6246.     //^assign -_heh
  6247.     //^assign -_n
  6248.     //^assign -_chan
  6249.     //^assign -_mask
  6250.     //^assign -_found
  6251.     //^assign -masks
  6252.     //^assign -idx
  6253.     //^assign -idx2
  6254. }
  6255.  
  6256. alias _rebuild_cache {
  6257.     @ _udb.cache = []
  6258.     for (@idx = 1, idx <= _udb.cnt, @idx++) {
  6259.         @ _udb.cache = [$_udb.cache $_udb[$idx][mask]$_udb[$idx][chan]]
  6260.     }
  6261.     //^assign -idx
  6262. }
  6263.  
  6264. # list users
  6265. alias lu {
  6266. xecho -b ╔════════════════════════════════════════════════════════════════════════════╗
  6267. xecho -b ║Idx    Host Filter                                   Chan Filter  Flags     ║
  6268. xecho -b ╠════════════════════════════════════════════════════════════════════════════╣
  6269.     if (![$0]) {
  6270.         for (@lu.idx=1, lu.idx <= _udb.cnt, @lu.idx++) {
  6271.             echo ║[$[4]lu.idx] $[45]_udb[$lu.idx][mask] $[12]_udb[$lu.idx][chan] \[$[8]_udb[$lu.idx][flags]\]║
  6272.         }
  6273.     }{
  6274.         if (index(*? $0) >= 0) {
  6275.             @ lu.uh = [$0]
  6276.             if (index(! $lu.uh) == -1) { 
  6277.                 @ lu.uh = (left(1 $lu.uh) == [*] ? [*!$lu.uh] : [*!*$lu.uh]) 
  6278.             }
  6279.             if ([$1]) {
  6280.                 @ lu.ch = ischannel($1) ? [$1] : [#$1]
  6281.             }{
  6282.                 @ lu.ch = [#*]
  6283.             }
  6284.             fe ($bmatches($lu.uh$lu.ch $_udb.cache)) lu.idx {
  6285.                 xecho -b ║[$[4]lu.idx] $[45]_udb[$lu.idx][mask] $[12]_udb[$lu.idx][chan] \[$[8]_udb[$lu.idx][flags]\]║
  6286.             }
  6287.         }{
  6288.             if (ischannel($0)) {
  6289.                 @ lu.uh = [*!*@*]
  6290.                 @ lu.ch = [$0]
  6291.                 fe ($bmatches($lu.uh$lu.ch $_udb.cache)) lu.idx {
  6292.                     xecho -b ║[$[4]lu.idx] $[45]_udb[$lu.idx][mask] $[12]_udb[$lu.idx][chan] \[$[8]_udb[$lu.idx][flags]\]║
  6293.                 }
  6294.             }
  6295.         }
  6296.     }
  6297. xecho -b ╚════════════════════════════════════════════════════════════════════════════╝
  6298.     purge lu
  6299. }
  6300.  
  6301. alias showuser lu $*
  6302. alias showusers lu $*
  6303. alias listusers lu $*
  6304.  
  6305. ^set input_prompt ▒▒▒▒▒▒▒▒▒░░░░░░░░░░░45% (Userlist Code)
  6306. # remove users
  6307.  
  6308. alias mru {
  6309.  if ([$0]!=[]) {
  6310.   fe ($*) _bork {
  6311.    ru $_bork
  6312.   }
  6313.  }{
  6314.   gecho Usage: /mru <n> <n> <n> ...
  6315.  }
  6316. }
  6317.  
  6318. alias ru {
  6319.     if (![$0]) {
  6320.         
  6321.     }{
  6322.         if (index(*? $0) >= 0) {
  6323.             @ lu.uh = [$0]
  6324.             if (index(! $lu.uh) == -1) { 
  6325.                 @ lu.uh = (left(1 $lu.uh) == [*] ? [*!$lu.uh] : [*!*$lu.uh]) 
  6326.             }
  6327.             if ([$1]) {
  6328.                 @ lu.ch = ischannel($1) ? [$1] : [#$1]
  6329.             }{
  6330.                 @ lu.ch = [#*]
  6331.             }
  6332.             _deluser.bynum $bmatches($lu.uh$lu.ch $_udb.cache)
  6333.         }{
  6334.             if (ischannel($0)) {
  6335.                 @ lu.uh = [*!*@*]
  6336.                 @ lu.ch = [$0]
  6337.                 _deluser.bynum $bmatches($lu.uh$lu.ch $_udb.cache)
  6338.             }{
  6339.                 if (isdigit($0) && [$0] > 0 && [$0] <= _udb.cnt) {
  6340.                     _deluser.bynum $0
  6341.                 }
  6342.             }
  6343.         }
  6344.     }
  6345.     purge lu
  6346. }
  6347.  
  6348. alias _recache_channels {
  6349.     @ _curr_srv = lastserver()
  6350.     for (@_srv = 0, servername($_srv), @_srv++) {
  6351.         evalserver $_srv {
  6352.             fe (${[$0] ? [$0-] : mychannels()}) _chan {
  6353.                 fe ($chanusers($_chan)) _n {
  6354.                     @ _found = rmatch($_n!$nickdata($_chan $_n)$_chan $_udb.cache)
  6355.                     if (_found) {
  6356.                         @ _flg = _udb[$_found][flags]
  6357.                         if (index(ABOIUP $_flg) >= 0) {
  6358.                             if (nickdata($_chan $_n 1) || index(M $ch.flags[$%_chan]) >= 0 || index(M $_flg) >= 0) {
  6359.                                 @ nickdata($_chan $_n 2 $_flg)
  6360.                                 @ nickdata($_chan $_n 3 $_found)
  6361.                             }{
  6362.                                 @ nickdata($_chan $_n -2)
  6363.                                 @ nickdata($_chan $_n -3)
  6364.                             }
  6365.                         }{
  6366.                             @ nickdata($_chan $_n 2 $_flg)
  6367.                             @ nickdata($_chan $_n 3 $_found)
  6368.                         }
  6369.                     }
  6370.                 }
  6371.             }
  6372.         }
  6373.     }
  6374.     //^assign -_chan
  6375.     //^assign -_n
  6376.     //^assign -_found
  6377.     //^assign -_flg
  6378. }
  6379.  
  6380.  
  6381. on ^cache_user * {
  6382.     @ _idt = nickdata($1 $0 1 ${left(1 $2) != [~]})
  6383.     if (found = rmatch($0!$2$1 $_udb.cache)) {
  6384.         @ _flg = _udb[$found][flags]
  6385.         if (index(ABOIUP $_flg) >=0 ) {
  6386.             if (_idt || index(M $ch.flags[$%1]) >= 0 || index(M $_flg) >= 0) {
  6387.                 @ nickdata($1 $0 2 $_flg)
  6388.                 @ nickdata($1 $0 3 $found)
  6389.             }{
  6390.                 @ _flg = [0]
  6391.             }
  6392.         }{
  6393.                 @ nickdata($1 $0 2 $_flg)
  6394.                 @ nickdata($1 $0 3 $found)
  6395.         }
  6396.         if (ischanop($N $1)) {
  6397.             if (index(B $_flg) >= 0 && !ischanop($0 $1)) {
  6398.                 //mode $1 +o $0
  6399.             }{
  6400.                 if (index(S $_flg]) >= 0) {
  6401.                     if (ischanop($0 $1)) {
  6402.                         //mode $1 -o+b $0 $_udb[$found][mask]
  6403.                     }{
  6404.                         //mode $1 +b $_udb[$found][mask]
  6405.                     }
  6406.                     //kick $1 $0 $_udb[$found][descr]
  6407.                 }{
  6408.                     if (index(AV $_flg) >= 0 && !ischanop($0 1)) {
  6409.                         _delayop_channel $1
  6410.                     }{
  6411.                         if (index(NP $_flg) == -1 && index(B $ch.flags[$%1]) >= 0 && rmatch($0!$2 $chanmode($1 1))) {
  6412.                             //kick $1 $0 <Banned>
  6413.                         }
  6414.                     }
  6415.                 }
  6416.             }
  6417.         }
  6418.     }{
  6419.         if (ischanop($N $1) && index(B $ch.flags[$%1]) >= 0 && rmatch($0!$2 $chanmode($1 1))) {
  6420.             //kick $1 $0 <Banned>
  6421.         }
  6422.     }
  6423. }
  6424.  
  6425. # _doref and all delayops aliases only used to do +A+V users, because we
  6426. # already sending +o immeditaly for +B users.
  6427. #
  6428. # _doref2 and delayops2 aliases are used to check channel after 5 seconds 
  6429. # after we got ops ourself, and do all actions including opping +AB users
  6430. # deoping +D users, bankicking +S users vouching +V users and removing bans
  6431. # on our friends.
  6432. #
  6433.  
  6434.  
  6435. eval @ _doref = 3100
  6436.  
  6437. alias _nextdoref {
  6438.     @ function_return = _doref++
  6439.     if (_doref >= 3199) {@ _doref = 3100}
  6440. }
  6441.  
  6442. eval @ _doref2 = 3200
  6443.  
  6444. alias _nextdoref2 {
  6445.     @ function_return = _doref2++
  6446.     if (_doref2 >= 3299) {@ _doref2 = 3200}
  6447. }
  6448.  
  6449. alias _delayop_channel {
  6450.     if (_delayops[$lastserver()][$%0]) {
  6451.         //timer -delete $_delayops[$lastserver()][$%0]
  6452.         //timer -refnum $_delayops[$lastserver()][$%0] $gz.delayoptime _delay_ops $0
  6453.     }{
  6454.         //timer -refnum ${_delayops[$lastserver()][$%0] = _nextdoref()} $gz.delayoptime _delay_ops $0
  6455.     }
  6456. }
  6457.  
  6458. alias _delayop_channel2 {
  6459.     if (_delayops2[$lastserver()][$%0]) {
  6460.         //timer -delete $_delayops2[$lastserver()][$%0]
  6461.         //timer -refnum $_delayops2[$lastserver()][$%0] $gz.delayoptime _delay_ops2 $0
  6462.     }{
  6463.         //timer -refnum ${_delayops2[$lastserver()][$%0] = _nextdoref2()} $gz.delayoptime _delay_ops2 $0
  6464.     }
  6465. }
  6466.  
  6467.  
  6468. alias _delay_ops {
  6469.     if (ischanop($N $0)) {
  6470.         @ _do.nicks = []
  6471.         @ _do.nicks2 = []
  6472.         fe ($chanusers($0)) _do.n {    
  6473.             if (index(A $nickdata($0 $_do.n 2)) >= 0 && !ischanop($_do.n $0)) {
  6474.                 @ _do.nicks = [$_do.nicks $_do.n]
  6475.             }{
  6476.                 if (index(V $nickdata($0 $_do.n 2)) >= 0 && !ischanop($_do.n $0) && !isvoice($_do.n $0)) {
  6477.                     @ _do.nicks2 = [$_do.nicks2 $_do.n]
  6478.                 }
  6479.             }
  6480.         }
  6481.         if (_do.nicks) {
  6482.             fe ($_do.nicks) _do.a _do.b _do.c _do.d {
  6483.                 //mode $0 +oooo $_do.a $_do.b $_do.c $_do.d
  6484.             }
  6485.         }
  6486.         if (_do.nicks2) {
  6487.             fe ($_do.nicks2) _do.a _do.b _do.c _do.d {
  6488.                 //mode $0 +vvvv $_do.a $_do.b $_do.c $_do.d
  6489.             }
  6490.         }
  6491.     }
  6492.     purge _do
  6493.     //^assign -_delayops[$lastserver()][$%0]
  6494. }
  6495.  
  6496. # following alias is from LiCe by SrFrog (here your credit man, hehe :)
  6497.  
  6498. alias ref @ function_return = [$(${[$0]})]
  6499.  
  6500. ^set input_prompt ▒▒▒▒▒▒▒▒▒░░░░░░░░░░░46% (Userlist Code)
  6501.  
  6502. on ^mode_stripped * if (ischanop($N $1) && [$0] != N) { 
  6503.  modeq.init
  6504.  fe ($2-) m.m m.v {
  6505.   switch ($m.m) {
  6506.      (-o) {
  6507.    //^assign -m.do[$%m.v]
  6508.      if (index(P $nickdata($1 $m.v 2)) >= 0 && ([$0] != [$m.v])) {@ m.op[$%m.v] = 1}
  6509.      }
  6510.      (+b) {
  6511.    @ m.done = 0
  6512.      if (match($m.v $N!$nickdata($1 $N))) {
  6513. #test for #tz, cuz they are script haters
  6514.     if ([$1]!=[#twilight_zone]) {
  6515.      modeq.add_mode -b $m.v
  6516.      if (index(. $0) == -1 && [$0] != N) {modeq.add_kick $0 Do not ban me, you momo!}
  6517.     }
  6518.      }{
  6519.    @ m.m = chanusers($1 3 $m.v)
  6520.    fe ($m.m) m.n {
  6521.     if (index(P $nickdata($1 $m.n 2)) >= 0) {
  6522.      @ m.done = 1
  6523.      //break
  6524.     }
  6525.   }
  6526.                     if (!m.done) {
  6527.                         @ m.c = bmatches($m.v\#* $_udb.cache)
  6528.                         @ m.done = 0
  6529.                         fe ($m.c) m.n {
  6530.                             if (index(P $_udb[$m.n][flags]) >= 0 && rmatch($1 $_udb[$m.n][chan])) {
  6531.                                 @ m.done = 1
  6532.                                 //break
  6533.                             }
  6534.                         }
  6535.                     }
  6536.                     if (m.done) {
  6537.                         @ m.ub[$%m.v] = 1
  6538.                     }{
  6539.                         if (index(. $0) >= 0) {
  6540.                             if (index(N $ch.flags[$%1]) >= 0) {
  6541.                                 @ m.ub[$%m.v] = 1                        
  6542.                             }
  6543.                         }{
  6544.                             if (index(B $ch.flags[$%1]) >= 0) {
  6545.                                 fe ($m.m) m.k {
  6546.                                     if (index(NOAB $nickdata($1 $m.k 2)) == -1) {
  6547.                                         modeq.add_kick $m.k <Banned>
  6548.                                     }
  6549.                                 }
  6550.                             }
  6551.                         }
  6552.                     }
  6553.                 }
  6554.             }
  6555.             (+o) {
  6556.                 //^assign -m.op[$%m.v]
  6557.                 if (m.v != N) {
  6558.                     if (index(D $nickdata($1 $m.v 2)) >= 0) {
  6559.                         @ m.do[$%m.v] = 1
  6560.                     }{
  6561.                         if (index(ABPON $nickdata($1 $m.v 2)) == -1) {
  6562.                             if ((index(N $ch.flags[$%1]) >= 0 && index(. $0) >= 0) || index(D $ch.flags[$%1]) >= 0) {
  6563.                                 @ m.do[$%m.v] = 1
  6564.                             }
  6565.                         }
  6566.                     }
  6567.                 }
  6568.             }
  6569.             (-b) {
  6570.                 //^assign -m.ub[$%m.v]
  6571.             }
  6572.             (+m)(+l) {
  6573.                 if ((index(N $ch.flags[$%1]) >= 0 && index(. $0) >= 0) || index($right(1 $m.m) $ch.rlock[$%1]) >= 0) {
  6574.                     modeq.add_mode -$right(1 $m.m)
  6575.                 }
  6576.             }
  6577.             (+k) {
  6578.                 if ((index(N $ch.flags[$%1]) >= 0 && index(. $0) >= 0) || index($right(1 $m.m) $ch.rlock[$%1]) >= 0) {
  6579.                     modeq.add_mode -k $m.v
  6580.                 }
  6581.             }
  6582.             (+n)(+s)(+t)(+p)(+i) {
  6583.                 if (index($right(1 $m.m) $ch.rlock[$%1]) >= 0) {
  6584.                     modeq.add_mode -$right(1 $m.m)
  6585.                 }
  6586.             }
  6587.             (-k) {
  6588.                 if (index(k $ch.flock[$%1]) >= 0) {
  6589.                     modeq.add_mode +k $ch.key[$%1]
  6590.                 }
  6591.             }
  6592.             (-l) {
  6593.                 if (index(k $ch.flock[$%1]) >= 0) {
  6594.                     modeq.add_mode +k $ch.limit[$%1]
  6595.                 }
  6596.             }
  6597.             (-n)(-s)(-t)(-p)(-m)(-i) {
  6598.                 if (index($right(1 $m.m) $ch.flock[$%1]) >= 0) {
  6599.                     modeq.add_mode +$right(1 $m.m)
  6600.                 }
  6601.             }
  6602.         }
  6603.     }
  6604.     foreach m.do m.x {modeq.add_mode -o $decode($m.x)}
  6605.     foreach m.op m.x {modeq.add_mode +o $decode($m.x)}
  6606.     foreach m.ub m.x {modeq.add_mode -b $decode($m.x)}
  6607.     modeq.apply_modes $1
  6608. }
  6609.  
  6610. # rescan a channel after we got oped
  6611.  
  6612. on ^chanop * {
  6613.     _delayop_channel2 $0
  6614. }
  6615.  
  6616. #
  6617. # This alias completly rescans a channel and do all actions, like opping
  6618. # kicking etc.
  6619. #
  6620.  
  6621. alias _delay_ops2 {
  6622.     modeq.init
  6623.     if (ischanop($N $0)) {
  6624.         fe ($chanusers($0)) _do.n {    
  6625.             if (index(AB $nickdata($0 $_do.n 2)) >= 0 && !ischanop($_do.n $0)) {
  6626.                 modeq.add_mode +o $_do.n
  6627.             }{
  6628.                 if (index(V $nickdata($0 $_do.n 2)) >= 0 && !ischanop($_do.n $0) && !isvoice($_do.n $0)) {
  6629.                     modeq.add_mode +v $_do.n
  6630.                 }{
  6631.                     if (index(D $nickdata($0 $_do.n 2)) >= 0 && ischanop($_do.n $0)) {
  6632.                         modeq.add_mode -o $_do.n
  6633.                     }{
  6634.                         if (index(S $nickdata($0 $_do.n 2)) >= 0) {
  6635.                             modeq.addban_and_kick $0 $_udb[$nickdata($0 $_do.n 3)][mask] $_udb[$nickdata($0 $_do.n 3)][descr]
  6636.                         }
  6637.                     }
  6638.                 }
  6639.             }
  6640.         }
  6641.         fe ($chanmode($0 1)) m.v {
  6642.             @ m.done = 0
  6643.             @ m.m = chanusers($1 3 $m.v)
  6644.             fe ($m.m) m.n {
  6645.                 if (index(P $nickdata($1 $m.n 2)) >= 0) {
  6646.                     @ m.done = 1
  6647.                     //break
  6648.                 }
  6649.             }
  6650.             if (!m.done) {
  6651.                 @ m.c = bmatches($m.v\#* $_udb.cache)
  6652.                 @ m.done = 0
  6653.                 fe ($m.c) m.n {
  6654.                     if (index(P $_udb[$m.n][flags]) >= 0 && rmatch($1 $_udb[$m.n][chan])) {
  6655.                         @ m.done = 1
  6656.                         //break
  6657.                     }
  6658.                 }
  6659.             }
  6660.             if (m.done) {
  6661.                 modeq.add_mode -b $m.v
  6662.             }{
  6663.                 if (index(B $ch.flags[$%1]) >= 0) {
  6664.                     fe ($m.m) m.k {
  6665.                         if (index(NOAB $nickdata($1 $m.k 2)) == -1) {
  6666.                             modeq.add_kick $m.k <Banned>
  6667.                         }
  6668.                     }
  6669.                 }
  6670.             }
  6671.         }
  6672.         fec ($ch.rlock[$%0]) _c {
  6673.             if (index($_c $chanmode($0)) >= 0) {
  6674.                 if ($_c == [k]) {
  6675.                     modeq.add_mode -k $key($0)
  6676.                 }{
  6677.                     modeq.add_mode -$_c
  6678.                 }
  6679.             }
  6680.         }
  6681.         fec ($ch.flock[$%0]) _c {
  6682.             if (index($_c $chanmode($0)) == -1) {
  6683.                 #set debug 0
  6684.                 #echo +++ adding mode $_c
  6685.                 if ($_c == [k]) {
  6686.                     modeq.add_mode +k $ch.key[$%0]
  6687.                 }{
  6688.                     if ($_c == [l]) {
  6689.                         modeq.add_mode +l $ch.limit[$%0]
  6690.                     }{
  6691.                         modeq.add_mode +$_c
  6692.                     }
  6693.                 }
  6694.             }
  6695.         }
  6696.         modeq.apply_modes $0
  6697.     }
  6698.     purge _do
  6699.     //^assign -_delayops2[$lastserver()][$%0]
  6700. }
  6701.  
  6702.  
  6703. alias _save_userlist {
  6704.  @ _su.file = open($gzuserlist W T D)
  6705.  @ write($_su.file # Saved userlist)
  6706.  @ write($_su.file _clear_userlist)
  6707.  for (@ _su.idx = 1, _su.idx <= _udb.cnt, @ _su.idx++) {
  6708.   @ write($_su.file //^assign _udb[$_su.idx][mask] $_udb[$_su.idx][mask])
  6709.   @ write($_su.file //^assign _udb[$_su.idx][chan] $_udb[$_su.idx][chan])
  6710.   @ write($_su.file //^assign _udb[$_su.idx][flags] $_udb[$_su.idx][flags])
  6711.   @ write($_su.file //^assign _udb[$_su.idx][time] $_udb[$_su.idx][time])
  6712.   if (_udb[$_su.idx][descr]) {
  6713.    @ write($_su.file //^assign _udb[$_su.idx][descr] $_udb[$_su.idx][descr])
  6714.   }
  6715.  }
  6716.  @ write($_su.file //^assign _udb.cnt $_udb.cnt)
  6717.  fe ($myservers(1)) _sr {
  6718.   evalserver $_sr fe ($mychannels()) _ch {
  6719.    fe (ACTION CTCP JOIN NICK NOTICE PUBLIC KICK DEOP) _fl {
  6720.     @ ch.cset[$%_ch][$_fl\FLOOD] = cset($_ch $_fl\FLOOD)
  6721.     @ ch.cset[$%_ch][$_fl\FLOOD_TIME] = cset($_ch $_fl\FLOOD_TIME)
  6722.     @ ch.cset[$%_ch][$_fl\FLOOD_COUNT] = cset($_ch $_fl\FLOOD_COUNT)
  6723.     @ ch.cset[$%_ch][$_fl\FLOOD_DUPS] = cset($_ch $_fl\FLOOD_DUPS)
  6724.    }
  6725.   }
  6726.  }
  6727. if (![$0]) {
  6728.  fe ($myservers(1)) _sr {
  6729.   evalserver $_sr fe ($mychannels()) _ch {
  6730.   # only save window position if not minimized, and if on screen, coz
  6731.   # window off screen are probably on other virtual desktop
  6732.    @ _win = chanwindow($_ch)
  6733.    if (_win) {
  6734.     @_itm = winitem(%$_win)
  6735.    }
  6736.    if (_win) {
  6737.     if (_on_screen($_itm)) {
  6738.      @ ch.winsizepos[$%_ch] = ref(11-15 $_itm)
  6739.      @ ch.codepage[$%_ch] = word(17 $_itm)
  6740.     }
  6741.    }{
  6742.     //^assign -ch.winsizepos[$%_ch]
  6743.    }
  6744.   }
  6745.  }
  6746.  if ([$msgwinon]==[YES]) {
  6747.   @ done = 0
  6748.   for (@ idx = 0, (win = winitem($idx)) && !done, @ idx++) {
  6749.    if (win) {
  6750.     if ([$word(1 $win)]==[messages]) {
  6751.      @ msgrefnum = [$idx]
  6752.     }
  6753.    }{@ done = 1}
  6754.   }
  6755.   @ _mwin = winitem($msgrefnum)
  6756.   if (_mwin) {
  6757.    @ _messages = [messages]
  6758.    if (_on_screen($_mwin)) {
  6759.     @ ch.winsizepos[$%_messages] = ref(11-15 $_mwin)
  6760.     @ ch.codepage[$%_messages] = word(17 $_itm)
  6761.    }
  6762.   }{
  6763.    //^assign -_messages
  6764.    //^assign -ch.winsizepos[$%messages]
  6765.    //^assign -ch.codepage[$%messages]
  6766.   }
  6767.  }
  6768.  if ([$ov]==[ON]) {
  6769.   @ done = 0
  6770.   for (@ idx = 0, (win = winitem($idx)) && !done, @ idx++) {
  6771.    if (win) {
  6772.     if ([$word(1 $win)]==[OperView]) {
  6773.      @ ovrefnum = [$idx]
  6774.     }
  6775.    }{@ done = 1}
  6776.   }
  6777.   @ _ovwin = winitem($ovrefnum)
  6778.   if (_ovwin) {
  6779.    @ _OperView = [OperView]
  6780.    if (_on_screen($_ovwin)) {
  6781.     @ ch.winsizepos[$%_OperView] = ref(11-15 $_ovwin)
  6782.    }
  6783.   //^assign -_OperView
  6784.   //^assign -_ovwin
  6785.   //^assign -ovrefnum
  6786.   }{
  6787.    //^assign -ch.winsizepos[$%OperView]
  6788.   }
  6789.  }
  6790.  if (xdccwinon) {
  6791.   @ done = 0
  6792.   for (@ idx = 0, (win = winitem($idx)) && !done, @ idx++) {
  6793.    if (win) {
  6794.     if ([$word(1 $win)]==[XDCC]) {
  6795.      @ xwrefnum = [$idx]
  6796.     }
  6797.    }{@ done = 1}
  6798.   }
  6799.   @ _xwwin = winitem($xwrefnum)
  6800.   if (_xwwin) {
  6801.    @ _xdccwin = [XDCC]
  6802.    if (_on_screen($_xwwin)) {
  6803.     @ ch.winsizepos[$%_xdccwin] = ref(11-15 $_xwwin)
  6804.    }
  6805.   //^assign -_xdccwin
  6806.   //^assign -_xwwin
  6807.   //^assign -_xwrefnum
  6808.   }{
  6809.    //^assign -ch.winsizepos[$%XDCC]
  6810.   }
  6811.  }
  6812.  ^assign -_fl;^assign -_ch
  6813. }
  6814.  _write_struct ch $_su.file
  6815.  _write_struct chlog $_su.file
  6816.  @ write($_su.file _rebuild_cache)
  6817.  @ write($_su.file _recache_channels)
  6818.  
  6819.  
  6820. #    fe ($notify()) _su.1 _su.2 _su.3 _su.4 _su.5 {
  6821. #        @ write($_su.file //^notify $_su.1 $_su.2 $_su.3 $_su.4 $_su.5)    
  6822. #    }
  6823.  
  6824.   @ close($_su.file)
  6825.  ^assign -_itm;^assign -_sr;^assign -_win
  6826.  purge _su
  6827. }
  6828.  
  6829. alias _write_struct {
  6830.  foreach $0 ii {_write_struct $0.$ii $1}
  6831.  //^assign -ii
  6832.  if ([$($0)]) {
  6833.     @ write($1 //assign $0 $($0))    
  6834.  }
  6835. }
  6836.  
  6837. ^set input_prompt ▒▒▒▒▒▒▒▒▒░░░░░░░░░░░47% (Userlist Code)
  6838.  
  6839.  
  6840. #alias save _save_userlist
  6841.  
  6842. alias ctogg {
  6843.     if (![$0]) {
  6844.         foreach ch.flags _ch {
  6845.             gecho Channel $decode($_ch)\ flags $ch.flags[$_ch]\
  6846.         }
  6847.         gecho Usage: /ctogg [#channel] flags
  6848.     }{
  6849.         if (![$1]) {
  6850.             if (ischannel($0)) {
  6851.                 @ _ch = [$%0]
  6852.                 gecho Channel $decode($_ch)\ flags $ch.flags[$_ch]\
  6853.             }{
  6854.                 if (C) {
  6855.                     ctogg $C $0
  6856.                 }{
  6857.                     gecho No current channel in this window
  6858.                     gecho Usage: /ctogg [#channel] flags    
  6859.                 }
  6860.             }
  6861.         }{
  6862.             @ _ch = ischannel($0) ? [$0] : [#$0]
  6863.             @ _wasm = index(M $ch.flags[$%_ch]) >= 0
  6864.             @ ch.flags[$%_ch] = _alter_flags($_valid_ctogg($1) $ch.flags[$%_ch])
  6865.             if (!ch.flags[$%_ch]) {
  6866.                 //^assign -ch.flags[$%_ch]
  6867.                 gecho Channel $_ch\ removed
  6868.                 if (_wasm) {
  6869.                     _recache_channels $_ch
  6870.                 }
  6871.             }{
  6872.                 gecho New flags for $_ch\ are '$ch.flags[$%_ch]'
  6873.                 if (_wasm != (index(M $ch.flags[$%_ch]) >= 0)) {
  6874.                     _recache_channels $_ch
  6875.                 }
  6876.             }
  6877.         }
  6878.     }
  6879.     //^assign -_ch
  6880. }
  6881.  
  6882. # cached /who
  6883. alias cwho {
  6884.  if ([$0] && onchannel($N $0)) {
  6885.   fe ($chanusers($0)) _n {
  6886.    gecho ${ischanop($_n $0) ? [@] : isvoice($_n $0) ? [+] : [ ]}$[9]_n [$[8]nickdata($0 $_n 2)\] '$nickdata($0 $_n)'
  6887.   }
  6888.   //^assign -_n
  6889.  }{
  6890.   if ([$0]) {
  6891.    gecho You are not on channel $0
  6892.   }{
  6893.    if (C) {
  6894.     cwho $C
  6895.    }{
  6896.     gecho You aren't on any channel in this window
  6897.    }
  6898.   }
  6899.  }
  6900. }
  6901.  
  6902. alias cwhoul {
  6903.  if ([$0] && onchannel($N $0)) {
  6904.   fe ($chanusers($0)) _n {
  6905.    if (nickdata($0 $_n 2)) {
  6906.     gecho ${ischanop($_n $0) ? [@] : isvoice($_n $0) ? [+] : [ ]}$[9]_n [$[8]nickdata($0 $_n 2)\] '$nickdata($0 $_n)'
  6907.    }
  6908.   }
  6909.   //^assign -_n
  6910.  }{
  6911.   if ([$0]) {
  6912.    gecho you are not on channel $0
  6913.   }{
  6914.    if (C) {
  6915.     _cwhoul $C
  6916.    }{
  6917.     gecho You aren't on any channel in this window
  6918.    }
  6919.   }
  6920.  }
  6921. }
  6922.  
  6923. # cached banlist
  6924. alias csb {
  6925.     if ([$0] && onchannel($N $0)) {
  6926.         @ _idx = 0
  6927.     @ _idx2 = 0
  6928.         fe ($chanmode($0 1)) _n {
  6929.       @ _idx++
  6930.             gecho [$[2]_idx\] '$_n' $tdiff(${time() - word($_idx2 $chanmode($0 3))}) old
  6931.       @ _idx2++
  6932.         }
  6933.         if ([$_idx]==[0]) {gecho There Are No Bans in $0}
  6934.         //^assign -_n
  6935.         //^assign -_idx
  6936.     //^assign -_idx2
  6937.     }{
  6938.         if ([$0]) {
  6939.             gecho You are not on channel $0
  6940.         }{
  6941.             if (C) {
  6942.                 csb $C
  6943.             }{
  6944.                 gecho You are on any channel in this window
  6945.             }
  6946.         }
  6947.     }
  6948. }
  6949.  
  6950. # ------ following alias is riped from LiCe, and written by SrFrog ------
  6951. # hehe here your credit again froggie :)
  6952.  
  6953. # LOOP.MODE := <sign> <mode> <#channel> <args...>
  6954. alias loop.mode {
  6955.   if (ischanop($N $2)) {
  6956.   if ([$7]) {
  6957.     quote MODE $2 $0$1$1$1$1 $3 $4 $5 $6
  6958.     loop.mode $0 $1 $2 $7-
  6959.   }{
  6960.     if ([$6]) {quote MODE $2 $0$1$1$1$1 $3 $4 $5 $6}{
  6961.     if ([$5]) {quote MODE $2 $0$1$1$1 $3 $4 $5}{
  6962.     if ([$4]) {quote MODE $2 $0$1$1 $3 $4}{
  6963.     if ([$3]) {quote MODE $2 $0$1 $3}}}}
  6964.   }}
  6965. }
  6966.  
  6967.  
  6968. # remove a ban
  6969. alias unban rban $*
  6970. alias uban rban $*
  6971. alias ub rban $*
  6972. alias rban {
  6973.     if ([$0] && ![$1]) {
  6974.         if (C) {
  6975.             rban $C $0
  6976.         }{
  6977.             gecho *** You are not on any channel in this window
  6978.         }
  6979.     }{
  6980.         if ([$0]) {
  6981.             if (onchannel($N $0)) {
  6982.                 if (index(*@?! $1) >= 0) {
  6983.                     @ rb.uh = [$1]
  6984.                     if (index(! $rb.uh) == -1) { 
  6985.                         @ rb.uh = (left(1 $rb.uh) == [*] ? [*!$rb.uh] : [*!*$rb.uh]) 
  6986.                     }
  6987.                     @ rb.bans = chanmode($0 1)
  6988.                     @ rb.rm = []
  6989.                     fe ($rb.bans) rb.b {
  6990.                         if (bmatch($rb.uh $rb.b)) {
  6991.                             @ rb.rm = [$rb.rm $rb.b]
  6992.                         }
  6993.                     }
  6994.                 }{
  6995.                     if (isdigit($1)) {
  6996.                         @ rb.rm = word(${[$1]-1} $chanmode($0 1))
  6997.                     }{
  6998.                         @ rb.found = 0
  6999.                         fe ($mychannels()) rb.ch {
  7000.                             if ((rb.uh = nickdata($rb.ch $1)) && r.uh != [<UNKNOWN>]) {
  7001.                                 @ rb.bans = chanmode($0 1)
  7002.                                 @ rb.rm = []
  7003.                                 fe ($rb.bans) rb.b {
  7004.                                     if (rmatch($1!$rb.uh $rb.b)) {
  7005.                                         @ rb.rm = [$rb.rm $rb.b]
  7006.                                     }
  7007.                                 }
  7008.                                 @ rb.found = 1
  7009.                                 //break
  7010.                             }
  7011.                         }
  7012.                         if (!rb.found) {
  7013.                             userhost $1 -cmd _rban.uh $0 $$*
  7014.                         }
  7015.                     }
  7016.                 }
  7017.                 loop.mode - b $0 $rb.rm
  7018.                 purge rb
  7019.             }{
  7020.                 gecho You are not on channel $0
  7021.             }
  7022.         }
  7023.     }
  7024. }
  7025.  
  7026. alias _rban.uh {
  7027.     if ([$4] == [<UNKNOWN>]) {
  7028.         gecho Nick $1\ is not online
  7029.     }{
  7030.         rban $0 $1!$4@$5
  7031.     }
  7032. }
  7033. on -ctcp "% % OP %*" {
  7034.  gecho ${gc.ctcp}Op Request${cl} on ${gc.inviteech}$3${cl} from: ${gc.ctcpnk}$0${cl} $gc.peren\(${cl}$userhost()${gc.peren}\)${cl}
  7035.  if (ischannel($3)) {
  7036.   @ oc.found = rmatch($0!$userhost()$3 $_udb.cache)
  7037.   @ oc.idt = left(1 $userhost()) != [~]
  7038.   if (oc.found && (oc.idt || index(M $ch.flags[$%3]) >= 0 || index(M $_udb[$oc.found][flags]) >= 0) && index(ABOP $_udb[$oc.found][flags]) >= 0) {
  7039.    if (ischanop($N $3)) {
  7040.     if (onchannel($0 $3)) {
  7041.      if (_udb[$oc.found][descr]) {
  7042.       if ([$_udb[$oc.found][descr]]==[$4]) {
  7043.        //^notice $0 You have been CTCP Op'd <gz>
  7044.        //mode $3 +o $0
  7045.       }{
  7046.        //^notice $0 Password Incorrect, format is /ctcp $N op #channel <password>
  7047.       }
  7048.      }{
  7049.       //^notice $0 You have been CTCP Op'd <gz>
  7050.       //mode $3 +o $0
  7051.      }
  7052.     }{
  7053.      //^notice $0 Hmm, you are not in $3, how to op?
  7054.     }
  7055.    }{
  7056.     //^notice $0 I am not in $3 or not oped
  7057.    }
  7058.   }
  7059.  }
  7060.  purge oc
  7061. }
  7062.  
  7063.  
  7064. on -ctcp "% % VOICE %*" {
  7065.  gecho ${gc.ctcp}Voice Request${cl} on ${gc.inviteech}$3${cl} from: ${gc.ctcpnk}$0${cl} $gc.peren\(${cl}$userhost()${gc.peren}\)${cl}
  7066.  if (ischannel($3)) {
  7067.   @ oc.found = rmatch($0!$userhost()$3 $_udb.cache)
  7068.   @ oc.idt = left(1 $userhost()) != [~]
  7069.   if (oc.found && (oc.idt || index(M $ch.flags[$%3]) >= 0 || index(M $_udb[$oc.found][flags]) >= 0) && index(I $_udb[$oc.found][flags]) >= 0) {
  7070.    if (ischanop($N $3)) {
  7071.     if (onchannel($0 $3)) {
  7072.      if (_udb[$oc.found][descr]) {
  7073.       if ([$_udb[$oc.found][descr]]==[$4]) {
  7074.        //^notice $0 You have been CTCP Voiced'd <gz>
  7075.        //mode $3 +o $0
  7076.       }{
  7077.        //^notice $0 Password Incorrect, format is /ctcp $N voice #channel <password>
  7078.       }
  7079.      }{
  7080.       //^notice $0 You have been CTCP Voiced'd <gz>
  7081.       //mode $3 +o $0
  7082.      }
  7083.     }{
  7084.      //^notice $0 Hmm, you are not in $3, how to voice?
  7085.     }
  7086.    }{
  7087.     //^notice $0 I am not in $3 or not oped
  7088.    }
  7089.   }
  7090.  }
  7091.  purge oc
  7092. }
  7093.  
  7094.  
  7095. on -ctcp "% % INVITE %" {
  7096.         gecho ${gc.ctcp}Invite Request${cl} to ${gc.inviteech}$3${cl} from: ${gc.ctcpnk}$0${cl} $gc.peren\(${cl}$userhost()${gc.peren}\)${cl}
  7097.     if (ischannel($3)) {
  7098.         @ oc.found = rmatch($0!$userhost()$3 $_udb.cache)
  7099.         @ oc.idt = left(1 $userhost()) != [~]
  7100.         if (oc.found && (oc.idt || index(M $ch.flags[$%3]) >= 0 || index(M $_udb[$oc.found][flags]) >= 0) && index(IP $_udb[$oc.found][flags]) >= 0) {
  7101.             if (ischanop($N $3)) {
  7102.                 //invite $0 $3
  7103.                 //^notice $0 You have been CTCP invited <gz>
  7104.             }{
  7105.                 //^notice $0 I am not in $3 or not oped
  7106.             }
  7107.         }
  7108.     }
  7109.     purge oc
  7110. }
  7111.  
  7112. on -ctcp "% % CLEAR %" {
  7113.  gecho ${gc.ctcp}Channel Clear Request${cl} ${gc.inviteech}\($3\)${cl} from: ${gc.ctcpnk}$0${cl} $gc.peren\(${cl}$userhost()${gc.peren}\)${cl}
  7114.  if (ischannel($3)) {
  7115.   @ oc.found = rmatch($0!$userhost()$3 $_udb.cache)
  7116.     @ oc.idt = left(1 $userhost()) != [~]
  7117.     if (oc.found && (oc.idt || index(M $ch.flags[$%3]) >= 0 || index(M $_udb[$oc.found][flags]) >= 0) && index(IP $_udb[$oc.found][flags]) >= 0) {
  7118.      if (ischanop($N $3)) {
  7119.     if (key($3)) {/unlock $3}
  7120.     //mode $3 -l
  7121.     if (!onchannel($0 $3)) {
  7122.      //invite $0 $3
  7123.      //^notice $0 You have been CTCP invited <gz>
  7124.     }
  7125.      }{
  7126.       //^notice $0 I am not in $3 or not oped
  7127.      }
  7128.     }
  7129.  }
  7130.  purge oc
  7131. }
  7132.  
  7133. on -ctcp "% % OPEN %" {
  7134.  gecho ${gc.ctcp}Channel Clear Request${cl} ${gc.inviteech}\($3\)${cl} from: ${gc.ctcpnk}$0${cl} $gc.peren\(${cl}$userhost()${gc.peren}\)${cl}
  7135.  if (ischannel($3)) {
  7136.   @ oc.found = rmatch($0!$userhost()$3 $_udb.cache)
  7137.     @ oc.idt = left(1 $userhost()) != [~]
  7138.     if (oc.found && (oc.idt || index(M $ch.flags[$%3]) >= 0 || index(M $_udb[$oc.found][flags]) >= 0) && index(IP $_udb[$oc.found][flags]) >= 0) {
  7139.      if (ischanop($N $3)) {
  7140.     if (key($3)) {/unlock $3}
  7141.     //mode $3 -l
  7142.     if (!onchannel($0 $3)) {
  7143.      //invite $0 $3
  7144.      //^notice $0 You have been CTCP invited <gz>
  7145.     }
  7146.      }{
  7147.       //^notice $0 I am not in $3 or not oped
  7148.      }
  7149.     }
  7150.  }
  7151.  purge oc
  7152. }
  7153.  
  7154.  
  7155. on -ctcp "% % UNBAN %" {
  7156.         gecho ${gc.ctcp}UNBAN Request${cl} \($3\) from: ${gc.ctcpnk}$0${cl} $gc.peren\(${cl}$userhost()${gc.peren}\)${cl}
  7157.     if (ischannel($3)) {
  7158.         @ oc.found = rmatch($0!$userhost()$3 $_udb.cache)
  7159.         @ oc.idt = left(1 $userhost()) != [~]
  7160.         if (oc.found && (oc.idt || index(M $ch.flags[$%3]) >= 0 || index(M $_udb[$oc.found][flags]) >= 0) && index(PU $_udb[$oc.found][flags]) >= 0) {
  7161.             if (ischanop($N $3)) {
  7162.                 @ oc.ub = []
  7163.                 fe ($chanmode($3 1)) oc.b {
  7164.                     if (match($0!$userhost() $oc.b) || match($oc.b $0!$userhost())) {
  7165.                         @ oc.ub = oc.ub ? [$oc.ub $oc.b] : oc.b
  7166.                     }
  7167.                 }
  7168.                 fe ($oc.ub) oc.b {
  7169.                     //mode $3 -b $oc.b
  7170.                 }
  7171.                 //^notice $0 removed all bans for you on $3 <gz>
  7172.             }{
  7173.                 //^notice $0 I am not in $3 or not oped
  7174.             }
  7175.         }
  7176.     }
  7177.     purge oc
  7178. }
  7179. on -ctcp "% % WHOAMI*" {
  7180.  gecho ${gc.ctcp}Whoami Request${cl} from: ${gc.ctcpnk}$0${cl} $gc.peren\(${cl}$userhost()${gc.peren}\)${cl}
  7181.  fe ($mychannels()) oc.ch {
  7182.   @ oc.found = rmatch($0!$userhost()$oc.ch $_udb.cache)
  7183.   @ oc.idt = left(1 $userhost()) != [~]
  7184.   if (oc.found && (oc.idt || index(M $ch.flags[$%oc.ch]) >= 0 || index(M $_udb[$oc.found][flags]) >= 0) && index(ABIOP $_udb[$oc.found][flags]) >= 0) {
  7185.    //^notice $0 Mask '$_udb[$oc.found][mask] $_udb[$oc.found][chan]' flags $_udb[$oc.found][flags]\
  7186.   }
  7187.  }
  7188.  purge oc
  7189. }
  7190.  
  7191. on -ctcp "% % pass *" {
  7192. # gecho ${gc.ctcp}Password Change Accepted${cl} from: ${gc.ctcpnk}$0${cl} $gc.peren\(${cl}$userhost()${gc.peren}\)${cl}
  7193.  if ([$4]) {
  7194.   @ oc.found = rmatch($0\!$userhost()$3 $_udb.cache)
  7195.   if (oc.found) {
  7196.    if (_udb[$oc.found][descr]) {
  7197.     # we have a password already
  7198.     if (_udb[$oc.found][descr] == [$4]) {
  7199.      gecho ${gc.ctcp}Password CHANGE${cl} from: ${gc.ctcpnk}$0${cl} $gc.peren\(${cl}$userhost()${gc.peren}\)${cl}
  7200.      //^notice $0 Password Changed.
  7201.      @ _udb[$oc.found][descr] = [$5]    
  7202.      /_save_userlist 1
  7203.     }{
  7204.      //^notice $0 Denied: Password or usage Incorrect.  
  7205.      //^notice $0 Usage: /ctcp $N pass <channel> <oldpass> <newpass>
  7206.      gecho ${gc.ctcp}Password Change DENIED${cl} from: ${gc.ctcpnk}$0${cl} $gc.peren\(${cl}$userhost()${gc.peren}\)${cl}
  7207.     }
  7208.    }{
  7209.     gecho ${gc.ctcp}Password SET${cl} from: ${gc.ctcpnk}$0${cl} $gc.peren\(${cl}$userhost()${gc.peren}\)${cl}
  7210.     //^notice $0 Password Set.
  7211.     //^notice $0 To change: /ctcp $N pass <channel> <oldpass> <newpass>
  7212.     @ _udb[$oc.found][descr] = [$4]
  7213.     /_save_userlist 1
  7214.    }
  7215.   }{
  7216.    gecho ${gc.ctcp}Password Attempt${cl} from: ${gc.ctcpnk}$0${cl} $gc.peren\(${cl}$userhost()${gc.peren}\)${cl}
  7217.    //^notice $0 Denied: No access or usage Incorrect.  
  7218.    //^notice $0 Usage: /ctcp $N pass <channel> <oldpass> <newpass>
  7219.   }
  7220.  }{
  7221.   @ oc.found = rmatch($0\!$userhost()$3 $_udb.cache)
  7222.   if (oc.found) {
  7223.    gecho ${gc.ctcp}Password Inquiry${cl} from: ${gc.ctcpnk}$0${cl} $gc.peren\(${cl}$userhost()${gc.peren}\)${cl}
  7224.    if (_udb[$oc.found][descr]) {
  7225.     //^notice $0 You have a password set for $3
  7226.     //^notice $0 To change: /ctcp $N pass <channel> <oldpass> <newpass>
  7227.    }{
  7228.     //^notice $0 You do not have a password set for $3
  7229.     //^notice $0 To Set: /ctcp $N pass <channel> <newpass>
  7230.    }
  7231.   }
  7232.  }
  7233. }
  7234.  
  7235. on -ctcp "% % help*" {
  7236.  gecho ${gc.ctcp}ctcp Help Request${cl} from: ${gc.ctcpnk}$0${cl} $gc.peren\(${cl}$userhost()${gc.peren}\)${cl}
  7237.  switch ($3) {
  7238.   (pass) {//^notice $0 To set:    /ctcp $N pass <#channel> <newpass>
  7239.           //^notice $0 To change: /ctcp $N pass <#channel> <oldpass> <newpass>
  7240.          }
  7241.   (whoami) {//^notice $0 Usage: /ctcp $N whoami -- shows you your userlist level and info}
  7242.   (invite) {//^notice $0 Usage: /ctcp $N invite <#channel> [<password>] -- invites you to specified channel}
  7243.   (op) {//^notice $0 Usage: /ctcp $N op <#channel> [<password>] -- ops you in specified channel}
  7244.   (voice) {//^notice $0 Usage: /ctcp $N voice <#channel> [<password>] -- voices you in specified channel}
  7245.   (clear) {//^notice $0 Usage: /ctcp $N clear <#channel> -- removes locks and limits on a channel}
  7246.   (open) {//^notice $0 Usage: /ctcp $N open <#channel> -- removes locks and limits on a channel}
  7247.   (unban) {//^notice $0 Usage: /ctcp $N unban <#channel> -- remove a ban on you in specified channel}
  7248.   (*) {//^notice $0 CTCP Commands available: OP INVITE PASS UNBAN WHOAMI CLEAR OPEN VOICE
  7249.        //^notice $0 For specific help: /ctcp $N help <topic>
  7250.       }
  7251.  }
  7252. }
  7253.  
  7254. alias _notify_uh {
  7255.     fe ($mychannels()) _ch {
  7256.         if (!onchannel($0 $_ch)) {
  7257.             @ _found = rmatch($0!$1$_ch $_udb.cache)
  7258.             if (_found && index(C $_udb[$_found][flags]) >= 0) {
  7259.                 #if ( index(i $chanmode($_ch)) && ischanop($N $_ch) ) {
  7260.                     //invite $0 $_ch
  7261.                 #}
  7262.             }
  7263.         }
  7264.     }
  7265.     //^assign -_ch
  7266.     //^assign -_found
  7267. }
  7268.  
  7269. ^set input_prompt ▒▒▒▒▒▒▒▒▒░░░░░░░░░░░48% (Loading Userlist)
  7270. eval load $gzuserlist
  7271. #Channel Locks
  7272. alias _recreate_lock {
  7273.     //^assign -ch.rlock[$%0]
  7274.     //^assign -ch.flock[$%0]
  7275.     //^assign -ch.limit[$%0]
  7276.     //^assign -ch.key[$%0]
  7277.     @ _sign = [+]
  7278.     @ _parm = 1
  7279.     fec ($word(0 $ch.lock[$%0])) _c {
  7280.         switch ($_c) {
  7281.             (+) {@_sign = [+]}
  7282.             (-) {@_sign = [-]}
  7283.             (l) {
  7284.                 if (_sign == [+]) {
  7285.                     //^assign -ch.limit[$%0]
  7286.                     @ ch.rlock[$%0] = strip(l $ch.rlock[$%0])
  7287.                     @ ch.flock[$%0] = strip(l $ch.flock[$%0])
  7288.                     if (word($_parm $ch.lock[$%0]) != []) {
  7289.                         @ ch.flock[$%0] #= [l]
  7290.                         @ ch.limit[$%0] = word($_parm $ch.lock[$%0])
  7291.                         @ _parm++
  7292.                     }
  7293.                 }{
  7294.                     //^assign -ch.limit[$%0]
  7295.                     @ ch.flock[$%0] = strip(l $ch.flock[$%0])
  7296.                     @ ch.rlock[$%0] = strip(l $ch.rlock[$%0])
  7297.                     @ ch.rlock[$%0] #= [l]
  7298.                 }
  7299.             }
  7300.             (k) {
  7301.                 if (_sign == [+]) {
  7302.                     //^assign -ch.key[$%0]
  7303.                     @ ch.rlock[$%0] = strip(k $ch.rlock[$%0])
  7304.                     @ ch.flock[$%0] = strip(k $ch.flock[$%0])
  7305.                     if (word($_parm $ch.lock[$%0]) != []) {
  7306.                         @ ch.flock[$%0] #= [k]
  7307.                         @ ch.key[$%0] = word($_parm $ch.lock[$%0])
  7308.                         @ _parm++
  7309.                     }
  7310.                 }{
  7311.                     //^assign -ch.key[$%0]
  7312.                     @ ch.flock[$%0] = strip(k $ch.flock[$%0])
  7313.                     @ ch.rlock[$%0] = strip(k $ch.rlock[$%0])
  7314.                     @ ch.rlock[$%0] #= [k]
  7315.                 }
  7316.             }
  7317.             (n)(s)(t)(p)(m)(i) {
  7318.                 if (_sign == [+]) {
  7319.                     @ ch.rlock[$%0] = strip($_c $ch.rlock[$%0])
  7320.                     @ ch.flock[$%0] = strip($_c $ch.flock[$%0])
  7321.                     @ ch.flock[$%0] #= [$_c]
  7322.                 }{
  7323.                     //^assign -ch.key[$%0]
  7324.                     @ ch.flock[$%0] = strip($_c $ch.flock[$%0])
  7325.                     @ ch.rlock[$%0] = strip($_c $ch.rlock[$%0])
  7326.                     @ ch.rlock[$%0] #= [$_c]
  7327.                 }
  7328.             }
  7329.         }
  7330.     }
  7331. }
  7332.  
  7333. alias askflood {
  7334.     setcset $0 $1\FLOOD_COUNT $("New value for messages \(Enter for $getcset($0 $1\FLOOD_COUNT)\): ")
  7335.     setcset $0 $1\FLOOD_TIME $("New value for seconds \(Enter for $getcset($0 $1\FLOOD_TIME)\): ")
  7336.     setcset $0 $1\FLOOD_DUPS $("New value for Dups \(Enter for $getcset($0 $1\FLOOD_DUPS)\): ")
  7337.     gecho Current sensors for $1\FLOOD are $getcset($0 $1\FLOOD_COUNT) msgs in $getcset($0 $1\FLOOD_TIME) seconds
  7338. }
  7339.  
  7340. # $0 == channel
  7341.  
  7342. alias asklock {
  7343.     @ _old_lock = ch.lock[$%0]
  7344.     @ _bah = [$("Mode lock for $0 \(Enter for ${_old_lock ? ['$_old_lock' OFF to remove] : [none]}\)")]
  7345.     if (_bah != []) {
  7346.         if (_bah == [off]) {
  7347.             //^assign -ch.lock[$%0]
  7348.             //^assign -ch.rlock[$%0]
  7349.             //^assign -ch.flock[$%0]
  7350.             //^assign -ch.limit[$%0]
  7351.             //^assign -ch.key[$%0]
  7352.         }{
  7353.             @ ch.lock[$%0] = _bah
  7354.             _recreate_lock $0
  7355.         }
  7356.     }
  7357. }
  7358.  
  7359. ^set input_prompt ▒▒▒▒▒▒▒▒▒░░░░░░░░░░░49% (Userlist Code)
  7360.  
  7361.  
  7362. alias op {
  7363.  if (C) {
  7364.   if (ischanop($N $C)) {
  7365.    modeq.init
  7366.    fe ($*) _op.n {
  7367.     modeq.add_mode +o $_op.n
  7368.    }
  7369.    modeq.apply_modes $C
  7370.   }{
  7371.    gecho ${gc.errortopic}Doh! not oped on $C\. Use the force Luke...${cl}
  7372.   }
  7373.  }{
  7374.   gecho ${gc.errortopic} You are not on any channel in this window${cl}
  7375.  }
  7376. }
  7377.  
  7378.  
  7379. alias dop {
  7380.  if (C) {
  7381.   if (ischanop($N $C)) {
  7382.    modeq.init
  7383.    fe ($*) _do.n {
  7384.     modeq.add_mode -o $_do.n
  7385.    }
  7386.    modeq.apply_modes $C
  7387.   }{
  7388.    gecho ${gc.errortopic}Doh! not oped on $C\. Use the force Luke...${cl}
  7389.   }
  7390.  }{
  7391.   gecho ${gc.errortopic}You are not on any channel in this window${cl}
  7392.  }
  7393. }
  7394.    
  7395.  
  7396. alias deop dop $*
  7397.  
  7398. # $0 == flood type, returns ignore type
  7399.  
  7400. alias _ignore.type {
  7401.     @ function_return = [ALL]
  7402.     switch ($0) {
  7403.         (ACTION) {
  7404.             @ function_return = [ACTIONS]
  7405.         }
  7406.         (CTCP) {
  7407.             @ function_return = [CTCPS]
  7408.         }
  7409.         (MSG) {
  7410.             @ function_return = [MSGS]
  7411.         }
  7412.         (NOTICE) {
  7413.             @ function_return = [NOTICES]
  7414.         }
  7415.         (PUBLIC) {
  7416.             @ function_return = [PUBLIC]
  7417.         }
  7418.         (INVITE) {
  7419.             @ function_return = [INVITES]
  7420.         }
  7421.         (JOIN) (NICK) {
  7422.             @ function_return = [CRAP]
  7423.         }
  7424.         (WALLOP) {
  7425.             @ function_return = [WALLOPS]
  7426.         }
  7427.         (WALL) {
  7428.             @ function_return = [WALLS]
  7429.         }
  7430.         (*) {
  7431.             @ function_return = [ALL]
  7432.         }
  7433.     }
  7434. }
  7435.  
  7436. # $0 == flags   $1 == user@host
  7437. #
  7438. # Note that this alias is only used for non-channel related lookups, because
  7439. # when someone joins a channel, flags are cached anyway
  7440. #
  7441.  
  7442. alias _isflagset {
  7443.     @ function_return = 0
  7444.     @ _idt = left(1 $1) != [~]
  7445.     fe ($bmatches(*!*$1#* $_udb.cache)) _n {
  7446.         if (index($0 $_udb[$_n][flags]) >= 0 && (_idt || index(M $_udb[$_n][flags]) >= 0)) {
  7447.             @ function_return = 1
  7448.             //break
  7449.         }
  7450.     }
  7451.     ^assign -_n
  7452. }
  7453.  
  7454. alias _justhost {@ function_return = mid(${rindex(@ $0)+1} $@0 $0)}
  7455. alias _justuser {@ function_return = left($rindex(@ $0) $0)}
  7456.  
  7457.  
  7458. # $0 == ignored    $1 == type    $2 == nick    $3 == channel  $4 == data
  7459.  
  7460. on ^new_flood * {
  7461.  if ([$3]) {
  7462.   if (index(FP $nickdata($3 $2 2)) == -1 && N != ([$1]==[NICK] ? [$4] : [$2])) {
  7463.    modeq.init
  7464.    if (index(C $ch.flags[$%3]) >= 0 && ischanop($N $3)) {
  7465.     if (FLOOD_CHECK_HOST == [ON] && FLOOD_CHECK_USER == [OFF]) {
  7466.      modeq.addban_and_kick $3 *!*@$mask.host($_justhost($userhost())) <$1 flood>
  7467.     }{
  7468.      modeq.addban_and_kick $3 *!*$mask.userhost($userhost()) <$1 flood>
  7469.     }
  7470.     gecho Autobk for $2\ on $3\ for $1 flood
  7471.     @ _ig = _ignore.type($1)
  7472.     @ _uh = mask.userhost($userhost())
  7473.     if (([$1] == [DEOP] || [$1] == [NICK] !! [$1] == [KICK]) && [$2] ! = N) {
  7474.     }{
  7475.      if (!isignored($_ig $1 $userhost())) {
  7476.       gecho Autoignoring $2 for 3 minutes, $1 flood scanned on $2
  7477.       //^ignore *$_uh -t 180 $_ig
  7478.       //^assign -_ig
  7479.       //^assign -_uh
  7480.      }
  7481.     }
  7482.    }{
  7483.     @ _ig = _ignore.type($1)
  7484.     @ _uh = mask.userhost($userhost())
  7485.     if (!isignored($_ig $1 $userhost())) {
  7486. #     gecho Autoignoring $2 for 3 minutes, $1 flood scanned on $2
  7487.      if (([$1] == [DEOP] || [$1] == [NICK] !! [$1] == [KICK]) && [$2] ! = N) {
  7488.       gecho $1 flood scanned on $2
  7489.       if (ischanop($N $3)) {
  7490.        //kick $3 $2 <$1 flood>
  7491.       }
  7492.      }{
  7493.       gecho Autoignoring $2 for 3 minutes, $1 flood scanned on $2
  7494.       //^ignore *$_uh -t 180 $_ig
  7495.      }
  7496.      //^assign -_ig
  7497.      //^assign -_uh
  7498.     }
  7499.    }
  7500.    modeq.apply_modes $3
  7501.   }{
  7502.    gecho $1 flood scanned on $2
  7503.    if (index(FP $nickdata($3 $2 2)) == -1 && ischanop($N $C)) {
  7504.     if (([$1] == [DEOP] || [$1] == [NICK] || [$1] == [KICK]) && [$2] != N) {
  7505.      //kick $3 $2 $1 flood
  7506.     }
  7507.    }
  7508.   }
  7509.  }{
  7510.   if (!_isflagset(FP $userhost())) {
  7511.    if (([$1] == [DEOP] || [$1] == [NICK] || [$1] == [KICK]) && [$2] != N) {
  7512.     gecho $1 flood scanned on $2
  7513.    }{      
  7514.     @ _ig = _ignore.type($1)
  7515.     @ _uh = mask.userhost($userhost())
  7516.     gecho Autoignoring $2 for 3 minutes, $1 flood
  7517.     //^ignore *$_uh -t 180 $_ig
  7518.     //^assign -_ig
  7519.     //^assign -_uh
  7520.    }
  7521.   }
  7522.  }
  7523. }
  7524.  
  7525. # Input: $0 == nick!user@host $1- list of channels
  7526. # returns list of channels with flags added, like #lice(OIFPUA)
  7527.  
  7528. alias _chans {
  7529.     @ _ch.new = []
  7530.     for ( @_ch.idx = 0, _ch.idx < [$#1-], @_ch.idx++) {
  7531.         @ _ch.found = rmatch($0$_stripop($word($_ch.idx $1-)) $_udb.cache)
  7532.         if (_ch.found) {
  7533.             @ _ch.new = _ch.new ? [$_ch.new $word($_ch.idx $1-)\($tolower($_udb[$_ch.found][flags])\)] : [$word($_ch.idx $1-)\($tolower($_udb[$_ch.found][flags])\)]
  7534.         }{
  7535.             @ _ch.new = _ch.new ? [$_ch.new $word($_ch.idx $1-)] : [$word($_ch.idx $1-)]
  7536.         }
  7537.     }
  7538.     @ function_return = _ch.new
  7539.     purge _ch
  7540. }
  7541.  
  7542. #
  7543. # Note that we keep channel /cset's in a separate structrure, so we can
  7544. # set/query them whenever we are on channel or no. /cset values will be
  7545. # copied to /cset when joined a channel in on join_me.
  7546. #
  7547.  
  7548. # $0 = channel, $1 = set name
  7549.  
  7550. alias getcset {
  7551.     @ function_return = cset($0 $1) ? cset($0 $1) : ch.cset[$%0][$1] ? ch.cset[$%0][$1] : [$($1)]
  7552. }
  7553.  
  7554. # $0 = channel, $1 = letter
  7555.  
  7556. alias isctog {
  7557.     @ function_return = index($1 $ch.flags[$%0]) >= 0
  7558. }
  7559.  
  7560. alias getctog {
  7561.     @ function_return = isctog($0 $1) ? [On] : [Off]
  7562. }
  7563.  
  7564. # $0 = channel, $1 = letter
  7565.  
  7566. alias togctog {
  7567.     /ctog $0 ${isctog($0 $1) ? [-$1] : [$1]}
  7568. }
  7569.  
  7570. alias togcset {
  7571.     @ ch.cset[$%0][$1] = getcset($0 $1) == [OFF] ? [ON] : [OFF]
  7572.     //^setcset $0 $1 $ch.cset[$%0][$1]
  7573. }
  7574.  
  7575. alias setcset {
  7576.     if ([$2]) {
  7577.         @ ch.cset[$%0][$1] = [$2]
  7578.         //^cset $0 $1 $2
  7579.     }
  7580. }
  7581.  
  7582. # $0 = channel, $1 = prefix like ACTION or CTCP
  7583. alias askflood {
  7584.     setcset $0 $1\FLOOD_COUNT $("New value for messages \(Enter for $getcset($0 $1\FLOOD_COUNT)\): ")
  7585.     setcset $0 $1\FLOOD_TIME $("New value for seconds \(Enter for $getcset($0 $1\FLOOD_TIME)\): ")
  7586.     gecho Current sensor for $1\FLOOD are $getcset($0 $1\FLOOD_COUNT) msgs in $getcset($0 $1\FLOOD_TIME) seconds
  7587. }
  7588.  
  7589. # $0 == #channel
  7590. #
  7591.  
  7592. alias all.chops.n {
  7593.     fe ($chanusers($C)) lala {
  7594.         if (ischanop($lala $C) && index(ABIOP $nickdata($C $lala 2)) == -1) {
  7595.             adduser -c $lala $C +NM
  7596.         }
  7597.     }
  7598.     ^assign -lala
  7599. }
  7600.  
  7601. #END USERLIST
  7602.  
  7603. /clear
  7604. gbecho  You are Funkin' With:  
  7605. gbecho 07         04 ▒                                       ▒07      
  7606. gbecho 07       04░▓█░█      08▄04▀▀░▀▀  ▄▄       ░   ▄    ▒ ▄ ▄▄▓▓▄■ ▀07 
  7607. gbecho 07      04▐░▀▀▀▀▀▀  ▀ 08▒▀▀▀▀▀▀▄ ▄ 04▄▄░▄▄  ▄▄▀▀▀▀▀▒▀▀▀▀▀▀▓█07     
  7608. gbecho 07 04▀ ■ ▄▓ 08▄▓▀▀▀▀▀▀▀▀  0F▄▄▄0B▄▄08 ▀▓▄▄▄▄▄▄▄▄▄▄▄▓▀▀▀▀▀▀▀▀▓▄ 04▓07     
  7609. gbecho 07      04▓ 08▓ 0B▄▓▀░▒▓▓▄ ▓█ █▓░█  ▄▄▄▄▄▄▄▄▄▄  ▄▓▓▒░▀▓▄ 08█ 04▓07     
  7610. gbecho 07      04▒ 08▓ 0B▓▓ ▄▄▄▄  ▓▒░▒▓▓░ ▒░ ░▒▒▓ ▒░▒░  ▄▄▄▄▄▓▓ 08█ 04▒07     
  7611. gbecho 07      04░ 08▓ 0B▓█  ▓▓▓▓ ░▒▀▀▀▀  ▒░ ░░█▒ ▒█▒░ ▓▓▓▓▒ ▀▀ 08▓ 04░07     
  7612. gbecho 07      04░ 08▓ 0B▓▒ ▐░▒▓█ █░ █░██ ██ ███░ ██░█ █▓▒░█ ▄▓ 08▓ 04░07     
  7613. gbecho 07      04▒ 08▓ 03█▓▄██░░0B▓ 03██▄██▓█ █▓ ███▓ ███▒ ▓░░██▄▓█ 08█ 04░07     
  7614. gbecho 07      04▓ 08▓  03▀▀▀▀▀▀   ▀▀▀▀▀  ▀▀ ▀▀▀▀ ▀▀▀▀  ▀▀▀▀▀▀  08█ 04▒07     
  7615. gbecho 07      04█▄08▀▓▄▄▄▄▄▄▄▓▀▓▄▄▄▄▄▓▀▓▄▄▄▄▄▄▄▄▄▄▓▀▓▄▄▄▄▄▄▄▄▓ 04▓07     
  7616. gbecho 07     04▐▒▒▄▄▄▄▄▄▄ ▄  ▄▄▄█▄▄▄ ▄  ▄ ▄░▄▄ ▄   ▄ ▄ ▄▄▄▄▄█▓▄▒07   
  7617. gbecho 07    04■▀▒              ▒▀    ░     ▀▓      ░ jui▒ce▀▓█▓▀07   
  7618. gbecho 07   04▀   09GemZ07 for 03OpenChat/204        ░                ▀07     
  7619. gbecho 07                    0Fby07 0BGemini07 (0Agemini07@0Asilcom.com07)07        
  7620. gbecho        Official GemZ site:  http://www.silcom.com/~gemini/gemz/
  7621. gbecho
  7622. eval if (beta) {
  7623.  gbecho 04*** 07This is a beta version of GemZ, send all bug reports to gemini 04***07
  7624. }
  7625.  
  7626. ^set input_prompt ▒▒▒▒▒▒▒▒▒▒░░░░░░░░░░50% (XDCC Subsystem)
  7627. ##################################################
  7628. # XDCC Subsystem                                 #
  7629. # Written exclusively for OpenChat/2 by Gemini.  #
  7630. # I finally got rid of that lame xabi/fluff      #
  7631. # Vassago piece of junk                          #
  7632. ##################################################
  7633.  
  7634. #################
  7635. #SAVED VARIABLES#
  7636. #################
  7637. @ gx = [\[gx\]]
  7638. @ gx.maxsends = 5
  7639. @ gx.maxsize = 320000
  7640. @ gx.maxqueue = 20
  7641. @ gx.maxtime = 480
  7642. @ gx.minspeed = 0
  7643. @ gx.ptime = 30
  7644. @ gx.savetime = 30
  7645.  
  7646. @ gx.autoget = 1
  7647. @ gx.autonotice = 0
  7648. @ gx.autopreview  = 0
  7649. @ gx.autosend = 1
  7650. @ gx.autoview = 0
  7651. @ gx.autosave = 1
  7652. @ gx.chansecurity = 0
  7653. @ gx.nickfile = 0
  7654. @ gx.notice = 1
  7655. @ gx.security = 0
  7656. @ gx.spiffyxdcc = 1
  7657. @ gx.pchannels = []
  7658. @ gx.xdcclog = 0
  7659. @ gx.uploaddir = [$exedir/download/]
  7660. @ gx.packfile = [$exedir/newxdcc.sav]
  7661. @ gx.secpass = [password]
  7662. @ gx.xdcclogfile = [$exedir/xdcc.log]
  7663.  
  7664. ################################
  7665. #INTERNAL VARIABLES (NOT SAVED)#
  7666. ################################
  7667. eval if (!xdcc.loaded) {
  7668.  @ xdcc.record = [0]
  7669.  @ xdcc.pcount = 1
  7670.  @ xdcc.scount = 1
  7671. }
  7672. @ xdcc.loaded = 1
  7673.  
  7674.  
  7675. ######
  7676. #SETS#
  7677. ######
  7678. ^set DCC_BLOCK_SIZE 4096
  7679. ^set DCC_BURST_MODE ON
  7680. ^set DCC_REJECT_8BIT ON
  7681. ^set DCC_REJECT_CHARS *?<>|
  7682. ^set DCC_REJECT_CNTL ON
  7683.  
  7684. #################################
  7685. #XDCC INTERNAL SUPPORT FUNCTIONS#
  7686. #################################
  7687.  
  7688. ###########################
  7689. # GemZ XDCC Api Functions #
  7690. ###########################
  7691.  
  7692. alias dcc {
  7693.  if (([$0] == [send]) ||([$0] == [resend])){
  7694.   if (index(" $2-) >= 0) {
  7695.    //dcc $0 $1 $2- $gx.virtualdccfile($2-)
  7696.   }{
  7697.    //dcc $0 $1 "$2-" $gx.virtualdccfile($2-)
  7698.   }
  7699.  }{
  7700.   //dcc $*
  7701.  }
  7702. }
  7703.  
  7704. alias gx.virtualdccfile {
  7705.  fec ($file.sanspath($*)) _dc.c {
  7706.   if (_dc.c == [ ]) {@ _dc.r #= [_]}
  7707.   else if (_dc.c == ["]) {}
  7708.   else {@ _dc.r #= _dc.c}
  7709.  }
  7710.  @ function_return = _dc.r
  7711.  purge _dc
  7712. }
  7713.  
  7714.  
  7715. alias gx.getcount {@ function_return = xdcc._count(get)}
  7716. alias gx.sendcount {@ function_return = xdcc._count(send)}
  7717. alias gx.qcount {@ _xz.r = 0;foreach xdq _xz.i {@ _xz.r++};@ function_return = _xz.r;purge _xz}
  7718. alias gx.maxqueue {@ function_return = gx.maxqueue}
  7719. alias gx.maxsends {@ function_return = gx.maxsends}
  7720. alias gx.numpacks {@ function_return = xdcc.totpack}
  7721. alias gx.packdesc {@ function_return = xdp[$strip(# $0)][desc]}
  7722. alias gx.packnote {@ function_return = xdp[$strip(# $0)][note]}
  7723. alias gx.packpass {@ function_return = xdp[$strip(# $0)][pass]}
  7724. alias gx.packfiles {foreach xdp.$strip(# $0).files _f.n {@ _f.r #= _f.r ? [ ] ## xdp[$strip(# $0)][files][$_f.n] : xdp[$strip(# $0)][files][$_f.n]};@ function_return = _f.r;purge _f.r}
  7725. alias gx.packbytes {@ function_return = xdp[$strip(# $0)][bytes]}
  7726. alias gx.packcount {@ function_return = xdp[$strip(# $0)][count]}
  7727. alias gx.totaloffered {@ _xo.b = 0;for (@ _xo.i = 1, _xo.i <= gx.numpacks(), @ _xo.i++) {@ _xo.b += gx.packbytes($_xo.i)};@ function_return = _xo.b;purge _xo}
  7728. alias gx.totalsent {@ _xt.bs = 0;for (@ _xt.i = 1, _xt.i <= gx.numpacks(), @ _xt.i++) {@ _xt.bs += gx.packbytes($_xt.i) * gx.packcount($_xt.i)};@ function_return = _xt.bs;purge _xt}
  7729. alias gx.record {@ function_return = xdcc.record}
  7730. ### GemZ XDCC Default Header/Footer Functions.
  7731. alias gx.nheader1 {@ function_return = [$gx  PACKS OFFERED  /msg $N xdcc list${gx.security ? [ <password>] : []} for listing]}
  7732. alias gx.nheader2 {@ function_return = gx.oheader2() ## [ [Rec: $xdcc.record\k/s]]}
  7733. alias gx.oheader1 {@ function_return = [$gx  PACKS OFFERED  /msg $N xdcc send # to receive pack.]}
  7734. alias gx.oheader2 {@ function_return = [$gx [ $gx.numpacks() ${gx.numpacks() != 1 ? [packs] : [pack]} ]  [${gx.maxsends - gx.sendcount()}\ of $gx.maxsends\ slots] [Queue: $gx.qcount()\/$gx.maxqueue\]}
  7735. alias gx.footer {@ function_return = [$gx [Rec: $xdcc.record\k/s] [Total: $gz.bytestomegs($gx.totaloffered()) MB] [Sent: $gz.bytestomegs($gx.totalsent()) MB]}
  7736. #Provided for compatability with Spiffy XDCC Replies.
  7737. alias xdcc.oldfooter {@ function_return = [$gx Total Offered: $gz.bytestomegs($gx.totaloffered()) MB  Total Grabbed: $gz.bytestomegs($gx.totalsent()) MB]}
  7738.  
  7739. alias gx.gettype {@ function_return = word(0 $dccitem($0))}
  7740. alias gx.getnick {@ function_return = word(1 $dccitem($0))}
  7741. alias gx.getstat {@ function_return = word(2 $dccitem($0))}
  7742. alias gx.gettime {@ function_return = word(3 $dccitem($0))}
  7743. alias gx.getoffset {@ function_return = word(4 $dccitem($0))}
  7744. alias gx.getread {@ function_return = word(5 $dccitem($0))}
  7745. alias gx.getsent {@ function_return = word(6 $dccitem($0))}
  7746. alias gx.getxfered {
  7747.     switch ($gx.gettype($0)) {
  7748.         (*GET) {@ function_return = word(6 $dccitem($0))}
  7749.         (*SEND) {@ function_return = word(5 $dccitem($0))}
  7750.     }
  7751. }
  7752. alias gx.getsize {@ function_return = word(7 $dccitem($0))}
  7753. alias gx.getfile {@ function_return = word(8 $dccitem($0))}
  7754. alias gx.getdccnum {@ function_return = word(9 $dccitem($0))}
  7755. alias gx.getserv {@ function_return = word(10 $dccitem($0))}
  7756.  
  7757. #takes in a dccitem index or dcc #
  7758. #returns raw number of seconds until dcc finishes based on current rate
  7759. alias gx.geteta {
  7760.     if (dccitem($0)) {
  7761.     ^set left on
  7762.         @ _ge[left] = gx.getsize($0) - (gx.getxfered($0) + gx.getoffset($0))
  7763.         ^set floating on
  7764.         @ _ge[left] = (_ge[left] * 100 ) / 1024
  7765.         ^set floating off
  7766.         @ function_return = gx.getrate($0) ? _ge[left] / gx.getrate($0) : -1
  7767.     ^set left off
  7768.     }
  7769.     else {@ function_return = 0}
  7770.     purge _ge
  7771. }
  7772.  
  7773. #takes in dccitem index or dcc #
  7774. #returns raw number of bytes per second
  7775. alias gx.getrate {
  7776.     @ function_return = dccitem($0) ? [${time() - gx.gettime($0) ? ((gx.getxfered($0) / ([${time() - gx.gettime($0)}])) * 100) / 1024 : 0}] : 0
  7777. }
  7778.  
  7779. #takes raw number of seconds, and formats it to look nice
  7780. alias gx.fixeta {
  7781.     if ([$0] == -1) {@ function_return = [N/A]}
  7782.     else {
  7783.     ^set left on
  7784.         @ _et[min] = ([$0] / 60) - (([$0] / 3600) * 60)
  7785.         @ _et[sec] = [$0] % 60
  7786.         if (@_et[sec]==1) {@ _et[sec] = [0$_et[sec]]}
  7787.         if (@_et[min]==1) {@ _et[min] = [0$_et[min]]}
  7788.         @ function_return = [${[$0] / 3600}:$_et[min]:$_et[sec]]
  7789.     ^set left off
  7790.     }
  7791.     purge _et
  7792. }
  7793.  
  7794. #takes raw number of bytest per second, and formats it to look nice
  7795. alias gx.fixrate {
  7796.     @ _t.r = [$0]
  7797.     if (@_t.r == 5) {@ _t.r = left(3 $_t.r)}
  7798.     else if (@_t.r==4) {@ _t.r = [$left(2 $_t.r)\.$[1]right(2 $_t.r)]}
  7799.     else if (@_t.r==3) {@ _t.r = [$left(1 $_t.r)\.$[2]right(2 $_t.r)]}
  7800.     else if (@_t.r==2) {@ _t.r = [0\.$_t.r]}
  7801.     else if (@_t.r==1) {@ _t.r = [0\.0$_t.r]}
  7802.     else {@ _t.r = [N/A]}
  7803.     @ function_return = _t.r
  7804.     ^assign -_t.r
  7805. }
  7806.  
  7807. alias gx.getperc {
  7808.     ^set float on
  7809.   ^set left on
  7810.     @ function_return = dccitem($0) && gx.getsize($0) ? [${(gx.getxfered($0) * 100) / gx.getsize($0)}] : [0.00]
  7811.   ^set left off
  7812.     ^set float off
  7813.     @ function_return = function_return ? function_return : [0.00]
  7814. }
  7815.  
  7816. alias gx.fixperc {@ function_return = [$[4]0%]}
  7817.  
  7818.  
  7819.  
  7820. #####################
  7821. # End Api Functions #
  7822. #####################
  7823. alias gxecho {
  7824.  if (gz.rows(XDCC n)) {
  7825.   xecho -window XDCC ${gc.gecho}■■■${cl} $gx ${gc.time}<$Z>${cl} $*
  7826.  }{
  7827.   xecho -target $T ${gc.gecho}■■■${cl} $gx $*
  7828.  }
  7829. }
  7830.  
  7831. alias xdcc.isoktopreview {if (match($right(4 $0) .tif .tga .ico .png .jpg .gif .tif .bmp)) {if ((!gx.autopreview) || (away)) {@ function_return = 1}}}
  7832.  
  7833. alias xdcc.log {
  7834.  if (gx.xdcclog) {
  7835.   @ _xl.h = open($gx.xdcclogfile W T)
  7836.   if (_xl.h != -1) {
  7837.    @ write($_xl.h \[$gz.getdate() $Z\] $*)
  7838.    @ close($_xl.h)
  7839.   }{
  7840.    gecho ${gc.errortopic}ERROR:${cl} Could not open xdcc log file $gx.xdcclogfile
  7841.   }
  7842.  }
  7843. }
  7844.  
  7845. alias xdcc.processrequest {
  7846.  if ((xdcc.validhost($2)) && (xdcc.chancheck($*))) {
  7847.   switch ($3) {
  7848.    (list)   {xdcc.listreq $0 $1 $2 $4-}
  7849.    (send)   {xdcc.sendreq $0 $1 $2 send $4-}
  7850.    (resend) {xdcc.sendreq $0 $1 $2 resend $4-}
  7851.    (help)   {xdcc.helpreq $0 $1 $2}
  7852.    (*)      {xdcc.unknownreq $0 $1 $2}
  7853.   }
  7854.  }
  7855. }
  7856. alias xdcc.unknownreq {evalserver $0 {.not $1 Unknown XDCC command: /msg $N xdcc help}}
  7857.  
  7858. alias xdcc.helpreq {
  7859.  if (gt.lasthelped != [$2]) {
  7860.   @ gt.lasthelped = [$2]
  7861.   ^timer -update 505 10 ^assign -gt.lasthelped;
  7862.   gxecho $1 \($2\) Requested xdcc Help
  7863.   evalserver $0 {.not $1 /msg $N xdcc list [#<N>] - to get the offered pack list.}
  7864.   evalserver $0 {.not $1 /msg $N xdcc send #<N> [<password>] - to send pack #<N>}
  7865.   evalserver $0 {.not $1 /msg $N xdcc resend #<N> [<password>] - to resend pack #<N>}
  7866.  # evalserver $0 {.not $1 /msg $N xdcc overview - to get Stats of current offers.}
  7867.  # evalserver $0 {.not $1 /msg $N xdcc queue - to get stats about your current Queue Position.}
  7868.  }
  7869. }
  7870.  
  7871. alias xdcc.passpack {@ function_return = xdp[$0][pass] ? [${xdp[$0][pass] == [$1]}] : 1}
  7872.  
  7873. alias xdcc.sendreq {
  7874.  @ _xs.p = strip(# $4)
  7875. #server, nick, userhost, send|resend, pack, password (if any)
  7876.  if (gx.sendcount() < gx.maxsends) {
  7877.   if (xdp[$_xs.p][files]) {
  7878.    if (xdcc.passpack($_xs.p $5)) {
  7879.     gxecho Sending #$_xs.p\ to $1\ \($2\)
  7880.     evalserver $0 {.not $1 Sending you $gx.packdesc($_xs.p) Which is \$#gx.packfiles($_xs.p)\ files\(s\) \[$gx.packbytes($_xs.p) bytes\]}
  7881.     @ xdp[$_xs.p][count]++
  7882.     for (@ _xs.i = 1, _xs.i <= xdp[$_xs.p][files], @ _xs.i++) {
  7883.      if (gx.sendcount() < gx.maxsends) {
  7884.       evalserver $0 {//^dcc $3 $1 $xdp[$_xs.p][files][$_xs.i]}
  7885.      }{
  7886.       evalserver $0 {.not $1 Send Limit reached, queueing: $file.sanspath($xdp[$_xs.p][files][$_xs.i])}
  7887.       xdcc.qfileadd $0 $1 $3 $xdp[$_xs.p][files][$_xs.i]
  7888.      }
  7889.     }
  7890.    }{
  7891.     gxecho Denied Send: $1 \($2\) [Attempted Password: $5]
  7892.     evalserver $0 {.not $1 You have specified the wrong password}
  7893.     evalserver $0 {.not $1 Format is /msg $N xdcc send <#packnum> <password>}
  7894.    }
  7895.   }{
  7896.    evalserver $0 {.not $1 Pack #$_xs.p does not exist.  /msg $N xdcc list}
  7897.   }
  7898.  }{
  7899.   if (xdp[$_xs.p][files]) {
  7900.    if (gx.qcount() < gx.maxqueue) {
  7901.     xdcc.qpackadd $0 $1 $3 $_xs.p
  7902.     evalserver $0 {.not $1 Send Limit reached, queueing: Pack #$_xs.p}
  7903.     evalserver $0 {.not $1 Pack will be sent when a slot opens up.}
  7904.     gxecho Queueing Pack #$_xs.p\ to $1\ \($2)\
  7905.    }{
  7906.     evalserver $0 {.not $1 Send limit \($gx.maxsends\) and Queue limit \($gx.maxqueue\) are full.  Try again later.}
  7907.    }
  7908.   }{
  7909.    evalserver $0 {.not $1 Pack #$_xs.p does not exist.  /msg $N xdcc list}
  7910.   }
  7911.  }
  7912.  purge _xs
  7913. }
  7914.  
  7915. alias xdcc.listreq {
  7916.  if (gx.security) {
  7917.   if ([$3]== gx.secpass) {
  7918.    if ([$4]) {
  7919.     xdcc.ulistspecific $0 $1 $2 $4
  7920.    }{
  7921.     @ xlr[$0][$%1] = servergroup($0)
  7922.     gxecho All pack list request from $1 \($2\)
  7923.    }
  7924.   }{
  7925.    evalserver $0 {.not $1 [gx] You do not have the Proper password}
  7926.    evalserver $0 {.not $1 [gx] Format is: /msg $N xdcc list <password> [<Pack Number>]}
  7927.   }
  7928.  }{
  7929.   if ([$3]) {
  7930.    xdcc.ulistspecific $*
  7931.   }{
  7932.    @ xlr[$0][$%1] = 1
  7933.    gxecho All pack list request from $1 \($2\)
  7934.   }
  7935.  }
  7936. }
  7937.  
  7938. alias xdcc.ulistspecific {
  7939.  @ _xu.n = strip(# $3)
  7940.  if (xdp[$_xu.n][files]) {
  7941.   gxecho List of pack #$_xu.n\ request received from $1 \($2\)
  7942.   evalserver $0 {.not $1 Pack $[2]_xu.n\:  $xdp[$_xu.n][desc]}
  7943.   evalserver $0 {.not $1 Length     File}
  7944.   for (@ _xu.i = 1, _xu.i <= xdp[$_xu.n][files], @ _xu.i++) {
  7945.    evalserver $0 {.not $1 $[10]fsize($xdp[$_xu.n][files][$_xu.i]) $xdp[$_xu.n][files][$_xu.i]}
  7946.   }
  7947.   evalserver $0 {.not $1 ---------- -------------------------------------------}
  7948.   evalserver $0 {.not $1 $[10]xdp[$_xu.n][bytes] $[2]xdp[$_xu.n][files] file(s) : $xdp[$_xu.n][count]\ Downloads}
  7949.  }{
  7950.   evalserver $0 {.not $1 pack #$_xu.n Does not exist.  /msg $N xdcc list}
  7951.  }
  7952.  purge _xu
  7953. }
  7954.  
  7955. alias xdcc.getchans {
  7956.  evalserver $0 fe ($mychannels()) _xm.c {if (match($_xm.c $1-)) {@ _xm.r #= [ $_xm.c]}}
  7957.  @ function_return = _xm.r
  7958.  purge _xm
  7959. }
  7960.  
  7961. alias xdcc.packsendto {
  7962.  fe ($*) _xc.n {if (_xc.r) {@ _xc.r #= [,$_xc.n]}{@ _xc.r = _xc.n}}
  7963.  @ function_return = _xc.r
  7964.  purge _xc
  7965. }
  7966.  
  7967. alias xdcc.psend {
  7968.  if ([$0]) {
  7969.   @ _xp.p = strip(# $0)
  7970.   if (xdp[$_xp.p][files]) {
  7971.    if (![$1]) {@ _xp.n = [$"Nicks to send to: "]}{@ _xp.n = [$1-]}
  7972.    fe ($_xp.n) _xp.c {
  7973.     xdcc.sendreq $lastserver() $_xp.c Manual-send send $_xp.p
  7974.     #xdcc.packsendto $lastserver() $_xp.c $_xp.p
  7975.    }
  7976.   }{gxecho Pack #$_xp.p Does not exist.}
  7977.  }{xdcc.psend $"[gxDCC] Enter Pack Number: "}
  7978.  purge _xp
  7979. }
  7980.  
  7981.  
  7982. alias xdcc.savecheck {
  7983.  if (gx.autosave) {
  7984.   if ((gx.savetime <= xdcc.scount) && (gx.savetime != 0)) {
  7985.    gxecho Autosaving Packlist after $gx.savetime minutes.
  7986.    xdcc.savepack
  7987.    @ xdcc.scount = 1
  7988.   }{@ xdcc.scount++}
  7989.  }
  7990. }
  7991.  
  7992. alias xdcc.ptimecheck {
  7993.  if (gx.autonotice) {
  7994.   if ((gx.ptime <= xdcc.pcount) && (gx.ptime != 0)) {
  7995.    if (gx.pchannels) {
  7996.     gxecho Autolist to \[$gx.pchannels \] after \$gx.ptime\ minutes.
  7997.     fe ($myservers(1)) _xp.s {
  7998.      @ _xp.c = xdcc.packsendto($xdcc.getchans($_xp.s $gx.pchannels))
  7999.      if (_xp.c) {
  8000.       if (gx.notice) {
  8001.        evalserver $_xp.s {xdcc.pnotify $_xp.s $_xp.c}
  8002.       }{
  8003.        evalserver $_xp.s {xdcc.plist $_xp.s $_xp.c}
  8004.       }
  8005.      }
  8006.     }
  8007.    }{
  8008.     xecho -target $T $gx WARNING: You don't have any offer channels set.  Pnotice Will NOT occur
  8009.    }
  8010.    @ xdcc.pcount = 1
  8011.   }{@ xdcc.pcount++}
  8012.  }
  8013.  purge _xp
  8014. }
  8015.  
  8016. alias xdcc.chancheck {
  8017.  @ _xc.r = 0
  8018.  if (gx.chansecurity) {
  8019.   evalserver $0 {fe ($mychannels()) _xc.c {if (match($1 $chanusers($_xc.c))) {@ _xc.r = 1;//break}}}
  8020.  }{@ _xc.r = 1}
  8021.  if (!_xc.r) {
  8022.   evalserver $0 {.not $1 Channel Security is on}
  8023.   gxecho Denied XDCC access: $1 \($2\) [Channel Security]
  8024.  }
  8025.  @ function_return = _xc.r
  8026.  purge _xc
  8027. }
  8028.  
  8029. alias xdcc.checkpaths {
  8030.  @ function_return = 0 
  8031.  fe ($*) _x.s {
  8032.   if (findfiles(f $_x.s)) {
  8033.    @ function_return = 1
  8034.   }{
  8035.    @ _x.n = gx.uploaddir ## _x.s
  8036.    if (findfiles(f $_x.n)) {@ function_return = 1}
  8037.   }
  8038.  }
  8039.  purge _x
  8040. }
  8041.  
  8042. alias xdcc.findfiles {
  8043.  fe ($*) _x.s {
  8044.   if (findfiles(f $_x.s)) {
  8045.    fe ($findfiles(f $_x.s)) _x.rs {@ _x.r #= [ $_x.rs]}
  8046.   }{
  8047.    @ _x.nx = gx.uploaddir ## _x.s
  8048.    fe ($findfiles(f $_x.nx)) _x.rs {@ _x.r #= [ $_x.rs]}
  8049.   }
  8050.  }
  8051.  @ function_return = _x.r
  8052.  purge _x
  8053. }
  8054.  
  8055. alias xdcc._count {
  8056.  #should accept get/send/chat/raw
  8057.  @ _xd.count = 0
  8058.  for (@ _xd.idx = 0, _xd.item = dccitem($_xd.idx), @ _xd.idx++) {if (match(*$0 $word(0 $_xd.item))) {@ _xd.count++}}
  8059.  @ function_return = _xd.count
  8060.  purge _xd
  8061. }
  8062.  
  8063. alias xdcc.processlist {
  8064.  foreach xlr _xl.s {
  8065.   @ _xl.s = xdcc.getserver($_xl.s) 
  8066.   if (_xl.s != -1) {
  8067.    foreach xlr.$_xl.s _xl.n {
  8068.     if (_xl.l) {@ _xl.l #= [,$decode($_xl.n)]}{@ _xl.l = decode($_xl.n)}
  8069.    }
  8070.    if (_xl.l) {xdcc.ulist $_xl.s $_xl.l}
  8071.   }
  8072.  }
  8073.  purge _xl
  8074.  purge xlr
  8075. }
  8076.  
  8077.  
  8078. #################
  8079. #QUEUE FUNCTIONS#
  8080. #################
  8081. alias xdcc.qlist {
  8082.  if (gx.qcount()) {
  8083.   gecho $gx NUM  Nick 
  8084.   gecho $gx ==== ===========
  8085.   foreach xdq _xq.n {
  8086.    @ _xt[$xdq[$_xq.n][priority]] = _xq.n
  8087.   }
  8088.   foreach _xt _xq.m {
  8089.    gecho $gx $[-2]_xq.m\:  $[11]decode($_xt[$_xq.m])\ $xdq[$_xt[$_xq.m]][files] file(s)
  8090.    for (@ _xq.i = 1, _xq.i <= xdq[$_xt[$_xq.m]][files], @ _xq.i++) {
  8091.     gecho $gx         $xdq[$_xt[$_xq.m]][files][$_xq.i]
  8092.    }
  8093.   }
  8094.   purge _xq
  8095.   purge _xt
  8096.  }{
  8097.   gecho $gx The queue is empty.
  8098.  }
  8099. }
  8100.  
  8101. alias xdcc.qcancel {
  8102.  if ([$0]) {
  8103.   if (xdq[$%0][files]) {
  8104.    @ _xq.p = xdq[$%0][priority]
  8105.    gecho $gx $0 Canceled from the Queue
  8106.    purge xdq.$%0
  8107.    foreach xdq _xq.n {
  8108.     if (_xq.p < xdq[$_xq.n][priority]) {
  8109.      @ xdq[$_xq.n][priority] = xdq[$_xq.n][priority] - 1
  8110.     }
  8111.    }
  8112.   }{gecho $gx $0 does not exist in the XDCC Queue}
  8113.  }{gecho $gx Usage: /qcancel <nick>}
  8114. }
  8115.  
  8116.  
  8117. alias xdcc.filequeued {
  8118.  @ function_return = 0
  8119.  foreach xdq.$0.files _xf.i {if (xdq[$0][files][$_xf.i] == [$1]) {@ function_return = 1;//break}}
  8120. }
  8121.  
  8122. alias xdcc.qnotify {
  8123.  @ _xq.c = gx.qcount()
  8124.  if (_xq.c) {
  8125.   foreach xdq _xq.n {
  8126.    if ( (time() - xdq[$_xq.n][lnt]) >= (xdq[$_xq.n][priority] * 60) ) {
  8127.     @ xdq[$_xq.n][lnt] = time()
  8128.     @ _xq.s = xdcc.getserver($xdq[$_xq.n][srvn] $xdq[$_xq.n][srvg])
  8129.     if (_xq.s != -1) {
  8130.      evalserver $_xq.s {.not $decode($_xq.n) You are in Queue Position $xdq[$_xq.n][priority] of $_xq.c}
  8131.     }
  8132.    }
  8133.   }
  8134.  }
  8135.  purge _xq
  8136. }
  8137.  
  8138. alias xdcc.qfileadd {
  8139. #xdcc.qfileadd $0 $1 $3 $xdp[$_xs.p][files][$_xs.i]
  8140. #this should only be used to add single files to an existing queue
  8141. #server, nick, send|resend, file
  8142.  if (xdq[$%1][files]) {
  8143.   if (!xdcc.filequeued($%1 $word(3 $*))) {
  8144.    @ _xq.n = xdq[$%1][files] + 1
  8145.    @ xdq[$%1][files][$_xq.n]       = word(3 $*)
  8146.    @ xdq[$%1][files]               = _xq.n
  8147.    @ xdq[$%1][files][$_xq.n][type] = [$2]
  8148.   }
  8149.  }{
  8150.   #starting a new queue entry
  8151.   @ xdq[$%1][srvn]           = [$0]
  8152.   @ xdq[$%1][srvg]           = servergroup($0)
  8153.   @ xdq[$%1][files]          = 1
  8154.   @ xdq[$%1][files][1]       = word(3 $*) 
  8155.   @ xdq[$%1][files][1][type] = [$2]
  8156.   @ xdq[$%1][priority]       = gx.qcount()
  8157.   @ xdq[$%1][onirc]          = 0
  8158.   @ xdq[$%1][lnt]            = 0
  8159.  }
  8160.  purge _xq
  8161. }
  8162.  
  8163. alias xdcc.qpackadd {
  8164.  foreach xdp.$3.files _xp.i {
  8165.   xdcc.qfileadd $0 $1 $2 $xdp[$3][files][$_xp.i]
  8166.  }
  8167.  purge _xp.i
  8168. }
  8169.  
  8170. alias xdcc.qpurge {
  8171.  gecho $gx queue purged
  8172.  purge xdq
  8173. }
  8174.  
  8175. alias xdcc.qwaspopped {
  8176.  foreach xdq _xq.n {
  8177.   @ xdq[$_xq.n][priority] = xdq[$_xq.n][priority] - 1
  8178.   if (xdq[$_xq.n][priority] == 0) {
  8179.    purge xdq.$_xq.n
  8180.   }
  8181.  }
  8182. }
  8183.  
  8184. alias xdcc.qpop {
  8185.  foreach xdq _xq.n {
  8186.   if (xdq[$_xq.n][priority] == 1) {
  8187.    #get the server to send it to
  8188.    @ _xq.s = xdcc.getserver($xdq[$_xq.n][srvn] $xdq[$_xq.n][srvg])
  8189.    if (_xq.s == -1) {
  8190.     if (xdq[$_xq.n][onirc] = 5) {
  8191.      purge xdq.$_xq.n
  8192.      xdcc.qwaspopped
  8193.     }{
  8194.      @ xdq[$_xq.n][onirc] = xdq[$_xq.n][onirc] + 1
  8195.     }
  8196.    }{
  8197.     gxecho Offering Queued file \($xdq[$_xq.n][files][1]\) to $decode($_xq.n)\
  8198.     evalserver $_xq.s {.not $decode($_xq.n) Sending Queued file: $xdq[$_xq.n][files][1]}
  8199.     evalserver $_xq.s {//^dcc $xdq[$_xq.n][files][1][type] $decode($_xq.n) "$xdq[$_xq.n][files][1]"}
  8200.     if (xdq[$_xq.n][files] == 1) {
  8201.      purge xdq.$_xq.n
  8202.      xdcc.qwaspopped
  8203.     }{
  8204.      for (@ _xq.idx = 1, _xq.idx < xdq[$_xq.n][files], @ _xq.idx++) {
  8205.       @ xdq[$_xq.n][files][$_xq.idx][type] = xdq[$_xq.n][files][${_xq.idx+1}][type]
  8206.       @ xdq[$_xq.n][files][$_xq.idx] = xdq[$_xq.n][files][${_xq.idx+1}]
  8207.      }
  8208.      @ _xq.idx--
  8209.      @ xdq[$_xq.n][files] = _xq.idx
  8210.      ^assign xdq[$_xq.n][files][$_xq.idx]
  8211.     }
  8212.    }
  8213.   //break
  8214.   }
  8215.  }
  8216.  purge _xq
  8217. }
  8218.  
  8219. alias xdcc.validhost {@ function_return = 1}
  8220.  
  8221. #takes a servernum, if connected returns same number
  8222. #also takes servergroup, if servernum is not connected, then
  8223. #will return first connected server in servergroup.
  8224. #returns < 1 if can't find such a beast
  8225. alias xdcc.getserver {
  8226.  @ function_return = -1
  8227.  if (isconnected($0)) {@ function_return = [$0]}
  8228.  else {
  8229.   for (@ _xs.srv=0, servername($_xs.srv), @_xs.srv++) {
  8230.    if (servergroup($_xs.srv) == [$1]) {
  8231.     if (isconnected($_xs.srv)) {
  8232.      @ function_return = _xs.srv
  8233.      //break
  8234.     }
  8235.    }
  8236.   }
  8237.  }
  8238.  purge _xs
  8239. }
  8240.  
  8241. #############################
  8242. #Pack Setup and Notification#
  8243. #############################
  8244. alias xdcc.addpchan {
  8245.  if ([$0]) {
  8246.   fe ($*) _xp.i {
  8247.    if (!match($_xp.i $gx.pchannels)) {@ gx.pchannels #= [ $_xp.i]}
  8248.   }
  8249.   gecho $gx New channel Autolist Channels: $gx.pchannels
  8250.   makexdccmenu
  8251.  }{
  8252.   @ _xp.n = [$"[gxDCC] Enter new channel(s): "]
  8253.   if (_xp.n) {xdcc.addpchan $_xp.n}
  8254.  }
  8255.  purge _xp
  8256. }
  8257.  
  8258. alias xdcc.removepchan {
  8259.  if ([$0]) {
  8260.   @ gx.pchannels = stripw($0 $gx.pchannels)
  8261.   makexdccmenu
  8262.   gecho $gx $0 removed from Autolist channels
  8263.  }
  8264. }
  8265.  
  8266.     
  8267. alias xdcc.pnotify {
  8268.  if (xdcc.totpack) {
  8269.   evalserver $0 {saysend $1 $gx.nheader1()}
  8270.   evalserver $0 {saysend $1 $gx.nheader2()}
  8271.  }
  8272. }
  8273.  
  8274. alias xdcc.plist {
  8275. # $0 is server, $1 is list of channels to send list to
  8276.  if (xdcc.totpack) {
  8277.   evalserver $0 {saysend $1 $gx.oheader1()}
  8278.   evalserver $0 {saysend $1 $gx.oheader2()}
  8279.   for (@ _xl.i = 1, _xl.i <= xdcc.totpack, @ _xl.i++) {
  8280.    @ _xl.it = [#]##[$_xl.i]
  8281.    @ _xl.b = gz.fixbytes($xdp[$_xl.i][bytes])
  8282.    @ _xl.f = xdp[$_xl.i][files]
  8283.    if (xdp[$_xl.i][pass]) {@ _xl.p = [[pass] ]}{@ _xl.p = [ ]}
  8284.    evalserver $0 {saysend $1 $[-3]_xl.it\ $[-3]xdp[$_xl.i][count]\x [\$[-4]_xl.b\][\$[-2]_xl.f\]$_xl.p$xdp[$_xl.i][desc]}
  8285.    if (xdp[$_xl.i][note]) {
  8286.     evalserver $0 {saysend $1  ^- $xdp[$_xl.i][note]}
  8287.    }
  8288.   }
  8289.   evalserver $0 {saysend $1 $gx.footer()}
  8290.   purge _xl
  8291.  }{gecho $gx No files offered}
  8292. }
  8293.  
  8294. alias xdcc.ulist {
  8295. # $0 should be server to send list to, $1 should be list of nicks to send list to.
  8296.   if (xdcc.totpack) {
  8297.       if (gz.srvtargets()) {
  8298.           csq.aqueue $0 .not $1 $gx.oheader2()
  8299.     }{
  8300.           fe ($gz.unparse($1)) _tl {
  8301.               csq.aqueue $0 .not $_tl $gx.oheader2()
  8302.             }
  8303.         }
  8304.   for (@ _xl.i = 1, _xl.i <= xdcc.totpack, @ _xl.i++) {
  8305.    @ _xl.it = [#]##[$_xl.i]
  8306.    @ _xl.b = gz.fixbytes($xdp[$_xl.i][bytes])
  8307.    @ _xl.f = xdp[$_xl.i][files]
  8308.    if (xdp[$_xl.i][pass]) {@ _xl.p = [[pass] ]}{@ _xl.p = [ ]}
  8309. #   evalserver $0 {.not $1 $gx $[-3]_xl.it\ $[-3]xdp[$_xl.i][count]\x [\$[-4]_xl.b\][\$[-2]_xl.f\]$_xl.p$xdp[$_xl.i][desc]}
  8310.     csq.aqueue $0 .not $1 $gx $[-3]_xl.it\ $[-3]xdp[$_xl.i][count]\x [\$[-4]_xl.b\][\$[-2]_xl.f\]$_xl.p$xdp[$_xl.i][desc]
  8311.    if (xdp[$_xl.i][note]) {
  8312.     if (gz.srvtargets()) {
  8313.           csq.aqueue $0 .not $1 $::gx  ^- $xdp[$_xl[i]][note]
  8314.         }{
  8315.              fe ($gz.unparse($1)) _tl {
  8316.                csq.aqueue $0 .not $_tl $::gx  ^- $xdp[$_xl[i]][note]
  8317.             }
  8318.     }
  8319.    }
  8320.   }
  8321.           if (gz.srvtargets()) {
  8322.             csq.aqueue $0 .not $1 $xdcc.oldfooter()
  8323.         }{
  8324.             fe ($gz.unparse($1)) _tl {
  8325.                 csq.aqueue $0 .not $_tl $xdcc.oldfooter()
  8326.             }
  8327.         }
  8328.  purge _xl
  8329.  }{
  8330.          if (gz.srvtargets()) {
  8331.             csq.aqueue $0 .not $1 No files offered.
  8332.         }{
  8333.             fe ($gz.unparse($1)) _tl {
  8334.                 csq.aqueue $0 .not $_tl No files offered.
  8335.             }
  8336.         }
  8337.  
  8338. }
  8339. }
  8340.  
  8341. alias xdcc.checksends {
  8342.  for (@ _cs.i = 0, _cs.d = dccitem($_cs.i), @ _cs.i++) {
  8343.   if (match(*send $word(0 $_cs.d))) {
  8344.    @ _cs.et = time() - word(3 $_cs.d)
  8345.    @ _cs.mt = gx.maxtime * 60
  8346.    if ((_cs.et > _cs.mt) && (gx.maxtime != 0)) {
  8347.     gxecho Send to $word(1 $_cs.d) \($word(8 $_cs.d)\) Clamp Timed out.
  8348.     evalserver $word(10 $_cs.d) {//^notice $word(1 $_cs.d) $gx.maxtime minute clamp Timeout: $word(8 $_cs.i)}
  8349.     //dcc close $word(9 $_cs.d)
  8350.    }
  8351.    else if ((_cs.et > 240) && (word(2 $_cs.d) == [Waiting])) {
  8352.     gxecho Send to $word(1 $_cs.d) \($word(8 $_cs.d)\) Timed out.
  8353.     evalserver $word(10 $_cs.d) {//^notice $word(1 $_cs.d) 4 Minute Timeout: $file.sanspath($word(8 $_cs.d))}
  8354.     //dcc close $word(9 $_cs.d)
  8355.    }
  8356.    else if ((_cs.et > 60) && (word(2 $_cs.d) == [Waiting])) {
  8357.     evalserver $word(10 $_cs.d) {//^notice $word(1 $_cs.d) DCC Pending: \($file.sanspath($word(8 $_cs.d))\) Type /DCC GET $N\.}
  8358.    }
  8359.   }
  8360.  }
  8361.  purge _cs
  8362. }
  8363.  
  8364. ############
  8365. #pack setup#
  8366. ############
  8367. alias xdcc.savepack {
  8368.  if ([$0]) {
  8369.   @ _xs.h = open($0 W D T)
  8370.   gxecho Saving file... $0
  8371.  }{
  8372.   @ _xs.h = open($gx.packfile W D T)
  8373.   gxecho Saving Default file... $gx.packfile
  8374.  }
  8375.  @ write($_xs.h GemZ XDCC Save File)
  8376.  for (@ _xs.idx = 1, _xs.idx <= xdcc.totpack, @ _xs.idx++) {
  8377.   @ write($_xs.h PACK $_xs.idx)
  8378.   @ write($_xs.h desc $xdp[$_xs.idx][desc])
  8379.   @ write($_xs.h note $xdp[$_xs.idx][note])
  8380.   @ write($_xs.h pass $xdp[$_xs.idx][pass])
  8381.   @ write($_xs.h count $xdp[$_xs.idx][count])
  8382.   for (@ _xs.idx2 = 1, _xs.idx2 <= xdp[$_xs.idx][files], @ _xs.idx2++) {
  8383.    @ write($_xs.h file $xdp[$_xs.idx][files][$_xs.idx2])
  8384.   }
  8385.  }
  8386.  @ close($_xs.h)
  8387.  purge _xs
  8388. }
  8389.  
  8390. alias xdcc.loadpack {
  8391.  purge xdp
  8392.  @ xdcc.totpack = 0
  8393.  if ([$0]) {
  8394.   @ _xo.h = open($0 R T)
  8395.   gxecho Loading XDCC Offer file: $0
  8396.  }{
  8397.   @ _xo.h = open($gx.packfile R T)
  8398.   gxecho Loading XDCC Offer file: $gx.packfile
  8399.  }
  8400.  @ _xo.l = read($_xo.h)
  8401.  while ([$eof($_xo.h)] == [0]) {
  8402.   @ _xo.l = read($_xo.h)
  8403.   switch ($word(0 $_xo.l)) {
  8404.    (PACK) {@ xdcc.totpack++;@ _xo.files = 0}
  8405.    (desc) {@ xdp[$xdcc.totpack][desc] = ref(2-#_xo.l+1 $_xo.l)}
  8406.    (note) {@ xdp[$xdcc.totpack][note] = ref(2-#_xo.l+1 $_xo.l)}
  8407.    (pass) {@ xdp[$xdcc.totpack][pass] = ref(2-#_xo.l+1 $_xo.l)}
  8408.    (count) {@ xdp[$xdcc.totpack][count] = ref(2-#_xo.l+1 $_xo.l)}
  8409.    (file) {
  8410.      if (fexist($word(1 $_xo.l))== 1) {
  8411.       @ _xo.files++
  8412.       @ xdp[$xdcc.totpack][files] = _xo.files
  8413.       @ xdp[$xdcc.totpack][files][$_xo.files] = ref(2=#_xo.l+1 $_xo.l)
  8414.       @ xdp[$xdcc.totpack][bytes] = xdp[$xdcc.totpack][bytes] + fsize($word(1 $_xo.l))
  8415.      }{
  8416.       gxecho Missing file : $word(1 $_xo.l)
  8417.      }
  8418.     }
  8419.    (*) {}
  8420.   }
  8421.  }
  8422.  @ close($_xo.h)
  8423.  purge _xo
  8424. }
  8425.  
  8426. #alias xdcc.dialogoffer
  8427.  
  8428. alias xdcc.offer {
  8429.  if ([$0]) {
  8430.   @ _tmp.files = [$*]
  8431.  }{
  8432.   @ _tmp.files = [$"[gxDCC] Files: "]
  8433.  }
  8434.  if (xdcc.checkpaths($_tmp.files)) {
  8435.   @ xdcc.totpack++
  8436.   @ _tmp.numfiles = 0
  8437.   fe ($xdcc.findfiles($_tmp.files)) _tmp._file {
  8438.    @ _tmp.numfiles++
  8439.    @ xdp[$xdcc.totpack][files][$_tmp.numfiles] = _tmp._file
  8440.    @ xdp[$xdcc.totpack][bytes] = xdp[$xdcc.totpack][bytes] + fsize($_tmp._file)
  8441.   }
  8442.   @ xdp[$xdcc.totpack][files] = _tmp.numfiles
  8443.   @ xdp[$xdcc.totpack][desc] = [$"[gxDCC] Description: "]
  8444.   @ xdp[$xdcc.totpack][note] = [$"[gxDCC] Note: "]
  8445.   @ xdp[$xdcc.totpack][pass] = [$"[gxDCC] Password: "]
  8446.   @ xdp[$xdcc.totpack][count] = 0
  8447.   gecho $gx $_tmp.numfiles\ file\(s\) added to Pack #$xdcc.totpack\.
  8448.  }{
  8449.   gecho $gx One or more of these files don't exist.
  8450.  }
  8451.  purge _tmp
  8452. }
  8453.  
  8454. alias xdcc.doffer {
  8455.  if ([$0]==[]) {
  8456.   @ _tmp = [$"[gxDCC] Pack to remove (* for all): "]
  8457.  }{
  8458.   @ _tmp = strip(# $0)
  8459.  }
  8460.  if (_tmp == [*]) {
  8461.   gecho $gx All packs removed from offer list.
  8462.   purge xdp
  8463.   @ xdcc.totpack = 0
  8464.  }{
  8465.   if (_tmp) {
  8466.    if (xdp[$_tmp][files] || xdp[$_tmp][desc]) {
  8467.     #//purge xdp.$_tmp
  8468.     xdcc.delpackbynum $_tmp
  8469.     gecho $gx pack #$_tmp Removed
  8470.    }{
  8471.     gecho $gx pack $0 does not exist
  8472.    }
  8473.   }
  8474.  }
  8475.  ^assign -_tmp
  8476. }
  8477.  
  8478. alias xdcc.delpackbynum {
  8479.  for (@ _xn.i = [$0], _xn.i < xdcc.totpack, @ _xn.i++) {
  8480.   purge xdp.$_xn.i
  8481.   @ xdp[$_xn.i][files] = xdp[${_xn.i +1}][files]
  8482.   @ xdp[$_xn.i][desc] = xdp[${_xn.i +1}][desc]
  8483.   @ xdp[$_xn.i][pass] = xdp[${_xn.i +1}][pass]
  8484.   @ xdp[$_xn.i][note] = xdp[${_xn.i +1}][note]
  8485.   @ xdp[$_xn.i][count] = xdp[${_xn.i +1}][count]
  8486.   @ xdp[$_xn.i][bytes] = xdp[${_xn.i +1}][bytes]
  8487.   for (@ _xn.a = 1, _xn.a <= xdp[$_xn.i][files], @ _xn.a++) {
  8488.    @ xdp[$_xn.i][files][$_xn.a] = xdp[${_xn.i +1}][files][$_xn.a]
  8489.   }
  8490.  }
  8491.  purge xdp.$xdcc.totpack
  8492.  @ xdcc.totpack--
  8493.  purge _xn
  8494. }
  8495.  
  8496. alias xdcc.file {
  8497.  if ([$0]) {
  8498.   @ _xf.p = strip(# $0)
  8499.   if (_xf.p) {
  8500.    @ _xf.files = [$"[gxDCC] Files: "]
  8501.    if (xdcc.checkpaths($_xf.files)) {
  8502.     @ _xf.numfiles = 0
  8503.     @ xdp[$_xf.p][bytes] = 0
  8504.     fe ($xdcc.findfiles($_xf.files)) _xf._file {
  8505.      @ _xf.numfiles++
  8506.      @ xdp[$_xf.p][files][$_xf.numfiles] = _xf._file
  8507.      @ xdp[$_xf.p][bytes] = xdp[$_xf.p][bytes] + fsize($_xf._file)
  8508.     }
  8509.     @ xdp[$_xf.p][files] = _xf.numfiles
  8510.     gecho $gx $_xf.numfiles Added to pack #$_xf.p
  8511.    }{
  8512.     gecho $gx One or more of these files does not exist.
  8513.    }
  8514.   }{
  8515.    gecho $gx Pack #$_xf.p doesn't exist
  8516.   }
  8517.  }{
  8518.   @ _xf.n = [$"[gxDCC] Enter Pack number: "]
  8519.   if (_xf.n) {xdcc.desc $_xf.n}
  8520.  }
  8521.  purge _xf
  8522. }
  8523.  
  8524. alias xdcc.desc {
  8525.  if ([$0]) {
  8526.   @ _xf.p = strip(# $0)
  8527.   if (xdp[$_xf.p][files]) {
  8528.    gecho $gx Changing Description for pack #$_xf.p
  8529.    @ xdp[$_xf.p][desc] = [$"[gxDCC] Enter New Description: "]
  8530.   }{gecho $gx Pack #$_xf.p doesn't exist}
  8531.  }{
  8532.   @ _xf.n = [$"[gxDCC] Enter Pack number: "]
  8533.   if (_xf.n) {xdcc.desc $_xf.n}
  8534.  }
  8535.  purge _xf
  8536. }
  8537.  
  8538. alias xdcc.note {
  8539.  if ([$0]) {
  8540.   @ _xf.p = strip(# $0)
  8541.   if (xdp[$_xf.p][files]) {
  8542.    gecho $gx Changing Note for pack #$_xf.p
  8543.    @ xdp[$_xf.p][note] = [$"[gxDCC] Enter New Note: "]
  8544.   }{gecho $gx Pack #$_xf.p doesn't exist}
  8545.  }{
  8546.   @ _xf.n = [$"[gxDCC] Enter Pack number: "]
  8547.   if (_xf.n) {xdcc.note $_xf.n}
  8548.  }
  8549.  purge _xf
  8550. }
  8551.  
  8552. alias xdcc.pass {
  8553.  if ([$0]) {
  8554.   @ _xf.p = strip(# $0)
  8555.   if (xdp[$_xf.p][files]) {
  8556.    gecho $gx Changing Password for pack #$_xf.p
  8557.    @ xdp[$_xf.p][pass] = [$"[gxDCC] Enter New Password: "]
  8558.   }{gecho $gx Pack #$_xf.p doesn't exist}
  8559.  }{
  8560.   @ _xf.n = [$"[gxDCC] Enter Pack number: "]
  8561.   if (_xf.n) {xdcc.pass $_xf.n}
  8562.  }
  8563.  purge _xf
  8564. }
  8565.  
  8566. alias xdcc.list {
  8567.  if (xdcc.totpack) {
  8568.   if (![$0]) {
  8569.    gecho $gx $gx.oheader2()
  8570.    for (@ _xl.i = 1, _xl.i <= xdcc.totpack, @ _xl.i++) {
  8571.     @ _xl.it = [#]##[$_xl.i]
  8572.     @ _xl.b = gz.fixbytes($xdp[$_xl.i][bytes])
  8573.     @ _xl.f = xdp[$_xl.i][files]
  8574.     if (xdp[$_xl.i][pass]) {@ _xl.p = [[pass] ]}{@ _xl.p = [ ]}
  8575.     gecho $gx $[-3]_xl.it\ $[-3]xdp[$_xl.i][count]\x [\$[-4]_xl.b\][\$[-2]_xl.f\]$_xl.p$xdp[$_xl.i][desc]
  8576.     if (xdp[$_xl.i][note]) {gecho $gx  ^- $xdp[$_xl.i][note]}
  8577.    }
  8578.    gecho $gx $gx.footer()
  8579.    purge _xl
  8580.   }{xdcc.listspecific $*}
  8581.  }{gecho $gx No files offered}
  8582. }
  8583.  
  8584. alias xdcc.maxtime {
  8585.  if ([$0] != []) {
  8586.   if ([$0] < 4) {
  8587.    gecho $gx Maxtime must be greater than 4 minutes, and cannot be 0.
  8588.    gecho $gx Suggest leaving a high number, such as 480minutes (8 hours)
  8589.   }{
  8590.    @ gx.maxtime = [$0]
  8591.    @menucontrol(&xdcc &52 text Max. Send Time    [$gx.maxtime min])
  8592.   }
  8593.  }{
  8594.   @ _xp.t = [$"[gxDCC] Enter New Maximum transfer time: "]
  8595.   if (_xp.t != []) {xdcc.maxtime $_xp.t}
  8596.  }
  8597.  purge _xp
  8598. }
  8599.  
  8600. alias xdcc.limit {
  8601.  if ([$0] != []) {
  8602.   @ gx.maxsends = [$0]
  8603.   @menucontrol(&xdcc &50 text Max. Sends    [$gx.maxsends])
  8604.  }{
  8605.   @ _xp.t = [$"[gxDCC] Enter New Send Limit: "]
  8606.   if (_xp.t != []) {xdcc.limit $_xp.t}
  8607.  }
  8608.  purge _xp
  8609. }
  8610.  
  8611.  
  8612. alias xdcc.qmax {
  8613.  if ([$0] != []) {
  8614.   @ gx.maxqueue = [$0]
  8615.   @menucontrol(&xdcc &51 text Max. Queued    [$gx.maxqueue])
  8616.  }{
  8617.   @ _xp.t = [$"[gxDCC] Enter New Maximum Queue size: "]
  8618.   if (_xp.t != []) {xdcc.qmax $_xp.t}
  8619.  }
  8620.  purge _xp
  8621. }
  8622.  
  8623. alias xdcc.autoget {
  8624.  if ( ([$0]) && (match($0 ON OFF)) ) {
  8625.   @ gx.autoget = _bool($0)
  8626.   @ menucontrol(&xdcc &1 check $gx.autoget)
  8627.  }{gecho Usage: /xdcc autoget ON | OFF}
  8628. }
  8629.  
  8630. alias xdcc.autosend {
  8631.  if ( ([$0]) && (match($0 ON OFF)) ) {
  8632.   @ gx.autosend = _bool($0)
  8633.   @ menucontrol(&xdcc &2 check $gx.autosend)
  8634.  }{gecho Usage: /xdcc autosend ON | OFF}
  8635. }
  8636.  
  8637. alias xdcc.autosave {
  8638.  if ( ([$0]) && (match($0 ON OFF)) ) {
  8639.   @ gx.autosave = _bool($0)
  8640.   @ menucontrol(&xdcc &3 check $gx.autosave)
  8641.  }{gecho Usage: /xdcc autosave ON | OFF}
  8642. }
  8643.  
  8644. alias xdcc.logfile {
  8645.  if ([$0]) {
  8646.   @ gx.xdcclogfile = gz.fixpath($0)
  8647.   @ menucontrol(&xdcc &103 text XDCC Log File    [$gx.xdcclogfile])
  8648.   gecho $gx XDCC log file set to: $gx.xdcclogfile
  8649.  }{
  8650.   @ _dl.d = [$"[gxDCC] Enter new XDCC Log File Directory: "]
  8651.   if (_dl.d) {xdcc.logfile $_dl.d}
  8652.  }
  8653.  purge _dl
  8654. }
  8655.  
  8656.  
  8657. alias xdcc.dldir {
  8658.  if ([$0]) {
  8659.   @ _dl.d = gz.striplastslash($gz.fixpath($0))
  8660.   if (findfiles(d $_dl.d)) {
  8661.    //^set DCC_DLDIR $_dl.d
  8662.    @ menucontrol(&xdcc &100 text Download Dir    [$DCC_DLDIR])
  8663.   }{
  8664.    gecho $gx Invalid Directory specified.
  8665.   }
  8666.   gecho $gx Download Directory Set to: $DCC_DLDIR
  8667.  }{
  8668.   @ _dl.d = [$"[gxDCC] Enter new Download Directory: "]
  8669.   if (_dl.d) {xdcc.dldir $_dl.d}
  8670.  }
  8671.  purge _dl
  8672. }
  8673.  
  8674. alias xdcc.uldir {
  8675.  if ([$0]) {
  8676.   @ _dl.d = gz.striplastslash($gz.fixpath($0))
  8677.   if (findfiles(d $_dl.d)) {
  8678.    @ gx.uploaddir = _dl.d ## [/]
  8679.    @ menucontrol(&xdcc &102 text Upload Dir    [$gx.uploaddir])
  8680.   }{
  8681.    gecho $gx Invalid Directory specified.
  8682.   }
  8683.   gecho $gx Upload Directory Set to: $gx.uploaddir
  8684.  }{
  8685.   @ _dl.d = [$"[gxDCC] Enter new Upload Directory: "]
  8686.   if (_dl.d) {xdcc.uldir $_dl.d}
  8687.  }
  8688.  purge _dl
  8689. }
  8690.  
  8691.  
  8692. alias xdcc.ptime {
  8693.  if ([$0] != []) {
  8694.   @ gx.ptime = [$0]
  8695.   @menucontrol(&xdcc &54 text Autolist Time    [$gx.ptime min])
  8696.  }{
  8697.   @ _xp.t = [$"[gxDCC] Enter New Autolist time: "]
  8698.   if (_xp.t != []) {xdcc.ptime $_xp.t}
  8699.  }
  8700.  purge _xp
  8701. }
  8702.  
  8703. alias xdcc.password {
  8704.  if ([$0] != []) {
  8705.   @ gx.secpass = [$0]
  8706.   @menucontrol(&xdcc &56 text List Sec. Password    [$left($@gx.secpass $gt.poptmp)])
  8707.  }{
  8708.   @ _xp.pw = [$"[gxDCC] Enter New List security password: "]
  8709.   if (_xp.pw != []) {xdcc.password $_xp.pw}
  8710.  }
  8711.  purge _xp
  8712. }
  8713.  
  8714.  
  8715. alias xdcc.savetime {
  8716.  if ([$0] != []) {
  8717.   @ gx.savetime = [$0]
  8718.   @menucontrol(&xdcc &55 text Autosave Time    [$gx.savetime min])
  8719.  }{
  8720.   @ _xp.t = [$"[gxDCC] Enter New Autosave time: "]
  8721.   if (_xp.t != []) {xdcc.savetime $_xp.t}
  8722.  }
  8723.  purge _xp
  8724. }
  8725.  
  8726. alias xdcc.minspeed {
  8727.  if ([$0] != []) {
  8728.   @ gx.minspeed = [$0]
  8729.   @menucontrol(&xdcc &53 text Min. Speed    [$gx.minspeed k/s])
  8730.  }{
  8731.   @ _xp.t = [$"[gxDCC] Enter New Minspeed (k/s): "]
  8732.   if (_xp.t != []) {xdcc.minspeed $_xp.t}
  8733.  }
  8734.  purge _xp
  8735. }
  8736.  
  8737.  
  8738. alias xdcc.listspecific {
  8739.  @ _xl.i = strip(# $0)
  8740.  if (xdp[$_xl.i][files]) {
  8741.   gecho $gx Information for Pack #$_xl.i
  8742.   gecho $gx DESC: $xdp[$_xl.i][desc]
  8743.   if (xdp[$_xl.i][note]) {gecho $gx NOTE: $xdp[$_xl.i][note]}
  8744.   if (xdp[$_xl.i][pass]) {gecho $gx PASS: $xdp[$_xl.i][pass]}
  8745.   for (@ _xl.si = 1, _xl.si <= xdp[$_xl.i][files], @ _xl.si++) {
  8746.    gecho $gx FILE: $xdp[$_xl.i][files][$_xl.si]
  8747.   }
  8748.   gecho $gx Total: $xdp[$_xl.i][bytes] Bytes on $xdp[$_xl.i][files] file(s) : $xdp[$_xl.i][count] snags
  8749.  }{gecho $gx Pack #$_xl.i doesn't exist.}
  8750.  purge _xl
  8751. }
  8752.  
  8753. alias xdcc.qcheck {
  8754.  if ((gx.sendcount() < gx.maxsends) && (gx.qcount())) {
  8755.   if (gx.qcount() < gx.maxqueue) {xdcc.qpop}
  8756.  }
  8757. }
  8758.  
  8759. alias xdcc.qtimer {
  8760.  xdcc.qcheck
  8761.  xdcc.processlist
  8762.  ^timer -update 319 10 xdcc.qtimer
  8763. }
  8764.  
  8765. alias xdcc.savesettings {
  8766.  @ write($0 ###XDCC SETTINGS)
  8767.  foreach gx _gx.i {@ write($0 @ gx.$tolower($_gx.i) = [$(gx.$_gx.i)])}
  8768.  @ write($0 //set DCC_DLDIR $DCC_DLDIR)
  8769.  purge _gx
  8770. }
  8771.  
  8772.  
  8773. #Finishing loads/setup
  8774. xdcc.qtimer
  8775.  
  8776. #
  8777. alias _doget {
  8778.  @ do.found = -1
  8779.  for ( @ do.idx = 0, do.item = dccitem($do.idx), @ do.idx++) {
  8780.   if (word(2 $do.item) == [offered]) {@ do.found = do.idx}
  8781.  }
  8782.  if (do.found != -1) {
  8783.   @ do.item = dccitem($do.found)
  8784.   switch ($word(0 $do.item)) {
  8785.    (GET) {//dcc get $word(9 $do.item)}
  8786.    (REGET) {//dcc reget $word(9 $do.item)}
  8787.    (CHAT) {//dcc chat $word(9 $do.item)}
  8788.   }
  8789.  }{gecho $gx No dcc connections offered}
  8790. }
  8791.  
  8792. alias _doclose {
  8793.  @ do.found = -1
  8794.  for ( @ do.idx = 0, do.item = dccitem($do.idx), @ do.idx++) {
  8795.   if (word(2 $do.item) == [offered]) {@ do.found = do.idx}
  8796.  }
  8797.  if (do.found != -1) {
  8798.   @ do.item = dccitem($do.found)
  8799.   //dcc close $word(9 $do.item)
  8800.  }{gecho $gx No dcc connections offered}
  8801. }
  8802.  
  8803. alias _doresume {
  8804.  @ do.found = -1
  8805.  for ( @ do.idx = 0, do.item = dccitem($do.idx), @ do.idx++) {
  8806.   if (word(2 $do.item) == [offered] && word(0 $do.item) == [GET]) {
  8807.    @ do.found = do.idx
  8808.   }
  8809.  }
  8810.  if (do.found != -1) {
  8811.   @ do.item = dccitem($do.found)
  8812.   //dcc resume $word(9 $do.item)
  8813.  }{gecho $gx No dcc connections offered}
  8814. }
  8815.  
  8816. alias _try_rename {
  8817.  @ function_return = 0
  8818.  # first try just add .bak to a filename, should work on HPFS
  8819.  @ unlink($0\.bak)
  8820.  if (!rename($0 $0\.bak)) {
  8821.   @ function_return = [$0\.bak]
  8822.  }{
  8823.   # if failed, to some more parsing, and determnate file's extention and
  8824.   # replace it with .bak
  8825.   @ _file = file.sansext($_file)
  8826.   @ unlink($_file\.bak)
  8827.   if (!rename($0 $_file\.bak)) {@ function_return = [$_file\.bak]}
  8828.   //^assign -_file
  8829.  }
  8830. }
  8831. ##########
  8832. #ON HOOKS#
  8833. ##########
  8834.  
  8835. on ^msg "% XDCC *" {xdcc.processrequest $lastserver() $0 $userhost() $2-}
  8836. on ^ctcp "% % XDCC *" {xdcc.processrequest $lastserver() $0 $userhost() $3-}
  8837.  
  8838. ^on #^timer 319 * {
  8839.  xdcc.qnotify
  8840.  xdcc.checksends
  8841.  xdcc.ptimecheck
  8842.  xdcc.savecheck
  8843. }
  8844.  
  8845. ^on ^dcc_connect "% % *GET*" {
  8846.  gz.playsnd getconnect
  8847.  if ((gx.autopreview) && (!away)) {previewbynum $0}
  8848.  gxecho DCC \$2\ connection to ${gc.nick}$1${cl} ${gc.peren}\(${cl}$3\,$4${gc.peren}\)${cl} established
  8849.  if ([$5]) {gxecho DCC \$2\ established at $5-}
  8850. }
  8851. ^on ^dcc_connect "% % *SEND*" {
  8852.  gz.playsnd sendconnect
  8853.  gxecho DCC \$2\ connection to ${gc.nick}$1${cl} ${gc.peren}\(${cl}$3\,$4${gc.peren}\)${cl} established
  8854.  if ([$5]) {gxecho DCC \$2\ established at $5-}
  8855. }
  8856. ^on ^dcc_connect "% % *CHAT*" {
  8857.  gz.playsnd chatconnect
  8858.  gxecho DCC \$2\ connection to ${gc.nick}$1${cl} ${gc.peren}\(${cl}$3\,$4${gc.peren}\)${cl} established
  8859. }
  8860.  
  8861. ^on #-dcc_connect 23 "*" {^hook dccchanged;if ([$autodccst]==[ON] && [$gt.statbar]==[Normal]) {statgl}}
  8862. ^on #-dcc_connect 33 "#% % CHAT % *" {if (gz.autochat && !chanwindow(=$1)) {/chat $1}}
  8863. ^on #-dcc_lost 23 "*" {^timer 1 xdcc.qcheck;^timer 1 ^hook dccchanged}
  8864. ^on #-dcc_request 23 "*" {^hook dccchanged}
  8865.  
  8866. ^on ^dcc_lost -"*SEND % COMPLETED*"
  8867.  
  8868. ^on ^dcc_lost "*SEND * COMPLETED*" {
  8869.  gz.playsnd dccsendfin
  8870.  gxecho DCC \$2\ ${gc.peren}\(${cl}$ref(4-${gz.strwords($*) - 2} $*)${gc.peren}\)${cl} to ${gc.nick}$1${cl} $word(${gz.strwords($*) - 2} $*) in $gz.lastw($*)\ kb/s
  8871.  xdcc.log $2 \($ref(4-${gz.strwords($*) -2} $*)\) to $1 $word(${gz.strwords($*) - 2} $*) in $gz.lastw($*) kb/s
  8872.  @ _xd.h = gz.lastw($*)
  8873.  if (_xd.h > xdcc.record) {
  8874.   @ xdcc.record = _xd.h
  8875.   gxecho New Record: $_xd.h\kb/sec
  8876.  }
  8877.  purge _xd.h
  8878. }
  8879.  
  8880. ^on ^DCC_SENT "*" {
  8881.  ^hook dccchanged
  8882.  switch ($1) {
  8883.   (SEND) {
  8884. #   gxecho Sent DCC SEND request ${gc.peren}\(${cl}$2 $fix.size($3)${gc.peren}\)${cl} to ${gc.nick}$0${cl}
  8885.    gxecho Sent DCC SEND request ${gc.peren}\(${cl}$ref(3-${gz.strwords($*) -2} $*) $fix.size($word(${gz.strwords($*) - 2} $*))${gc.peren}\)${cl} to ${gc.nick}$0${cl}
  8886.   }
  8887.   (*) {
  8888.    gxecho Sent DCC \$1\ request to ${gc.nick}$0${cl}
  8889.   }
  8890.  }
  8891. }
  8892.  
  8893. ^on ^dcc_request "% SEND % % #*" if (!ctcpsnd.dcc_request($*)) {
  8894.   gz.playsnd gotdccreq
  8895.     gecho $gx $0 is sending you file $2\ \($3 bytes\)
  8896.   @ _filename = [$2]
  8897.   if (gx.nickfile) {
  8898.    if (gz.drivetype($dcc_dldir) == [hpfs]) {
  8899.     @ _filename = [$0] ## [-] ## strip($dcc_reject_chars $2)
  8900.     gxecho Nick-File Rename: $2 renamed to $_filename
  8901.     //dcc rename $0 $2 $_filename
  8902.    }{
  8903.     gxecho Nick-File Rename: ERROR Rename not possible.  Drivetype: $gz.drivetype($dcc_dldir)
  8904.    }
  8905.   }
  8906. #    if ((_isflagset(ABFIOP $userhost()) && istog(F)) || istog(G)) {
  8907.     if (gx.autoget) {
  8908.         #playevent A
  8909.         gxecho Autogetting file...
  8910.         if (fexist($DCC_DLDIR$_filename) != -1) {
  8911.             @ new_name = _try_rename($DCC_DLDIR$_filename)
  8912.             if (new_name) {
  8913.                 gxecho Old file renamed to $new_name
  8914.             }{
  8915.                 gxecho Failed to rename old file, overwriting
  8916.             }
  8917.             //^assign -new_name
  8918.         }
  8919.         //^dcc get $4
  8920.     }{
  8921.         #playevent B
  8922.         if (fexist($DCC_DLDIR$_filename) != -1) {
  8923.             gecho $gx File $_filename \($fsize($DCC_DLDIR$_filename) bytes\) exist in download directory
  8924.             gecho $gx Press F11 to close,F12 to receive,Alt-F12 to resume
  8925.         }{
  8926.             gecho $gx Press F11 to close,F12 to receive
  8927.         }
  8928.     }
  8929. }
  8930.  
  8931. ^on ^dcc_request "% RESEND % % #*" {
  8932.   gz.playsnd gotdccreq
  8933.     gecho $gx $0 is resending you file $2\ \($3 bytes\)
  8934.     #if ((_isflagset(ABFIOP $userhost()) && istog(F)) || istog(G)) {
  8935.     if (gx.autoget) {
  8936.         #playevent A
  8937.         gecho $gx Autoregetting file...
  8938.         //^dcc reget $4
  8939.     }{
  8940.         #playevent B
  8941.         gecho $gx F11 to close and F12 to receive
  8942.     }
  8943. }
  8944.  
  8945. ^on ^dcc_request "% CHAT % % #*" {
  8946.  gz.playsnd gotdccreq
  8947.  @ _mw = gz.maxwins - 1
  8948.  gecho $gx DCC \$1\ ${gc.peren}\(${cl}$2 $3${gc.peren}\)${cl} request received from ${gc.nick}$0${cl}
  8949.  if (gz.autochat && !winitem($_mw)) {
  8950.   /chat $0 -b
  8951.  }
  8952.  ^assign -_mw
  8953. }
  8954.  
  8955. ^on ^dcc_lost "% % *SEND %* *LOST" {gxecho DCC $2 from $1 \($3\) ${gc.errortopic}$4${cl}}
  8956. ^on ^dcc_lost "% % *SEND %* *CLOSED" {gxecho DCC $2 from $1 \($3\) ${gc.errortopic}$4${cl}}
  8957. ^on ^dcc_lost "% % *GET %* *FINISHED*" {gxecho DCC $2 from $1 \($3\) $4}
  8958. ^on ^dcc_lost "% % *GET %* *CLOSED" {
  8959.  gxecho DCC $2 from $1 \($3\) $4
  8960.  if (!fsize($3)) {
  8961.   gxecho Received 0 length file from $1, deleting file
  8962.   @ unlink($3)
  8963.  }
  8964. }
  8965. ^on ^dcc_lost "% % *GET %* *LOST" {
  8966.  gxecho DCC \$2\ from $1 ${gc.peren}\(${cl}$3${gc.peren}\)${cl} ${gc.errortopic}$4${cl}
  8967.  if (!fsize($3)) {
  8968.   gxecho Received 0 length file from $1, deleting file
  8969.   @ unlink($3)
  8970.  }
  8971. }
  8972.  
  8973. ^on ^DCC_LOST "% % *GET %* *COMPLETED*" {
  8974.  gz.playsnd dccgetfin
  8975.  for (@ _dl.i = 0, _dl.d = dccitem($_dl.i), @ _dl.i++) {
  8976.   if ([$0]==word(9 $_dl.d)) {
  8977.    if (fsize($3) == word(7 $_dl.d)) {
  8978.     gxecho DCC \$2\ from ${gc.nick}$1${cl} ${gc.peren}\(${cl}$3${gc.peren}\)${cl} Completed in $5 kb/sec
  8979.     xdcc.log $2 from $1 \($3\) Completed in $5 kb/sec
  8980.    }{
  8981.     gxecho DCC \$2\ from ${gc.nick}$1${cl} ${gc.peren}\(${cl}$3${gc.peren}\)${cl} ${gc.errortopic}INCOMPLETE${cl} 
  8982.     gxecho Received $word(6 $_dl.d) of $word(7 $_dl.d) bytes \(Completed in $5 kb/sec\)
  8983.     @ _dl.e = 1
  8984.    }
  8985.   }
  8986.  }
  8987.  if (!fsize($3)) {
  8988.   gxecho Received 0 length file from $1, deleting file
  8989.   @ unlink($3)
  8990.  }{
  8991.   if (gx.autoview && !away && !_dl.e) {
  8992.    if (right(4 $3)==[.jpg] || right(4 $3)==[.gif] || right(4 $3)==[.bmp]) {
  8993. #   if (match($right(4 $3) .jpg .gif .gmp .tif)) {
  8994.     gecho Spawning External Viewer to view $3
  8995.     exec -noshell $imageviewer $3
  8996.    }
  8997.   }
  8998.  }
  8999.  purge _dl
  9000. }
  9001.  
  9002.  
  9003. on ^notice "% [gx] *" {
  9004.  if (gx.spiffyxdcc) {
  9005.   if (([$4]==[packs] || [$4]==[pack]) && (isdigit($3))) {
  9006.    @ _tmp6 = [$strip([] $6)]
  9007.    @ _tmp8 = [$strip([] $8)]
  9008.    @ _tmp11 = [$strip([] $11)]
  9009.    xecho -b ${gc.dccbar}  ╔═══════════════════[${gc.gxtitle}GemZ Pack list${gc.dccbar}]═════════════════════╗
  9010.    xecho -b ${gc.dccbar}  ║${cl} ${gc.gxnick}From${cl}: ${gc.gxdata}$[12]0${cl}  ${gc.gxitem}Offered Packs${cl}: ${gc.gxdata}$[3]3 ${gc.gxitem}Open slots${cl}: ${gc.gxdata}$[-3]_tmp6 ${gc.dccbar}║${cl}
  9011.    xecho -b ${gc.dccbar}  ║${cl}                       ${gc.gxitem}Total Slots${cl}: ${gc.gxdata}$[3]_tmp8 ${gc.gxitem}Queued${cl}: ${gc.gxdata}$[-7]_tmp11 ${gc.dccbar}║${cl}
  9012.    xecho -b ${gc.dccbar}  ╠════════════════════════════════════════════════════════╝
  9013.    ^assign -_tmp6;^assign -_tmp8;^assign -_tmp11
  9014.   }
  9015.   else if ([$2]==[Total]) {
  9016.    xecho -b ${gc.dccbar}  ╠════════════════════════════════════════════════════════╗
  9017.    xecho -b ${gc.dccbar}  ║${cl}      $[53]2- ${gc.dccbar}║${cl}
  9018.    xecho -b ${gc.dccbar}  ╚════════════════════════════════════════════════════════╝
  9019.   }
  9020.   else if ([$2]==[\[Record:] || [$2]==[\[Min:]) {
  9021.    xecho -b ${gc.dccbar}  ╠════════════════════════════════════════════════════════╗
  9022.    xecho -b ${gc.dccbar}  ║${cl}      $[55]2- ${gc.dccbar}║${cl}
  9023.    xecho -b ${gc.dccbar}  ╚════════════════════════════════════════════════════════╝
  9024.   }
  9025.   else {
  9026.    xecho -b ${gc.dccbar}  ║${cl} $2-
  9027.   }
  9028.  }{
  9029.   echo -${gc.notice}$0${cl}- $1-
  9030.   @ last.noti = [-$0\- $1- <[$Z]:$userhost()>]
  9031.   @ last.note.from = [$0]
  9032.  }
  9033. }
  9034. #############################
  9035. #commands available to momos#
  9036. #############################
  9037. alias xdcc {
  9038.  switch ($0) {
  9039.   (glist) {gl $*}
  9040.   (list) {xdcc.list $1-}
  9041.   (save) {xdcc.savepack $1-}
  9042.   (load) {xdcc.loadpack $1-}
  9043.   (plist) {if (C) {xdcc.plist $lastserver() $C}{gecho $gx You are not in a channel}}
  9044.   (pnotice) {if (C) {xdcc.pnotify $lastserver() $C}{gecho $gx You are not in a channel}}
  9045.   (offer) {xdcc.offer $1-}
  9046.   (doffer) {xdcc.doffer $1-}
  9047.   (note) {xdcc.note $1-}
  9048.   (file) {xdcc.file $1-}
  9049.   (desc) {xdcc.desc $1-}
  9050.   (pass) {xdcc.pass $1-}
  9051.   (ptime) {xdcc.ptime $1-}
  9052.   (savetime) {xdcc.savetime $1-}
  9053.   (minspeed) {xdcc.minspeed $1-}
  9054.   (qmax) {xdcc.qmax $1-}
  9055.   (limit) {xdcc.limit $1-}
  9056.   (maxtime) {xdcc.maxtime $1-}
  9057.   (qcancel) {xdcc.qcancel $1-}
  9058.   (qlist) {xdcc.qlist $1-}
  9059.   (psend) {xdcc.psend $1-}
  9060.   (autoget) {xdcc.autoget $1-}
  9061.   (autosend) {xdcc.autosend $1-}
  9062.   (dldir) {xdcc.dldir $1-}
  9063.   (uldir) {xdcc.uldir $1-}
  9064.   (logfile) {xdcc.logfile $1-}
  9065.   (password) {xdcc.password $1-}
  9066.   (*) {gecho $gx Unknown or unimplemented xdcc command} 
  9067.  }
  9068. }
  9069.  
  9070. alias psend {xdcc psend $*}
  9071. alias plist {xdcc plist $*}
  9072. alias pnotice {xdcc pnotice $*}
  9073. alias qlist {xdcc qlist $*}
  9074. alias qcancel {xdcc qcancel $*}
  9075. alias doffer {xdcc doffer $*}
  9076.  
  9077.  
  9078. gxecho Loading Offers...
  9079. xdcc.loadpack
  9080.  
  9081. alias xl CTCP $C XDCC LIST $*
  9082. alias xlo CTCP $C XDCC OVERVIEW $*
  9083.  
  9084. set float off
  9085.  
  9086. ### XDCC NOLEECH CHECKING
  9087. alias validxdcchost {
  9088.  @ FUNCTION_RETURN = 1
  9089.  for (@ idx = 1, idx <= _xidx, @ idx++) {
  9090.   if (match($xhost[$idx][host] $0)) {
  9091.    gxecho Disallowed XDCC access \($0\)
  9092.    @ FUNCTION_RETURN = 0;//break
  9093.   }
  9094.  }
  9095. }
  9096.  
  9097. ^set input_prompt ▒▒▒▒▒▒▒▒▒▒▒▒░░░░░░░░60% (XDCC Subsystem)
  9098. ^set input_prompt ▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░░░70% (XDCC Subsystem)
  9099. ^set input_prompt ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░80% (XDCC Subsystem)
  9100.  
  9101. alias cs {if ([$0]) {if ([$1]) {ctcp $0 xdcc send #$1}{ctcp $0 xdcc list}}{gecho $gx Usage: /cs Nick or /cs Nick Pack}}
  9102. alias dl gl $*
  9103. alias an /xdcc autoget on
  9104. alias af /xdcc autoget off
  9105. alias s {if ([$0]) {if ([$1]) {msg $0 xdcc send #$1}{msg $0 xdcc list}}{gecho $gx Syntax: /s Nick or /s Nick Pack}}
  9106. alias xdl xdcc list
  9107.  
  9108. on ^ctcp "% #* XDCC LIST" {
  9109.  evalserver $lastserver() {.not $0 Use "/msg $N xdcc list" for listing.}
  9110.  xecho -target $1 $gemz $gx Channel Packlist Request: $0 \($userhost()\)
  9111. }
  9112.  
  9113. ^set input_prompt ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░95% (XDCC Offer File)
  9114.  
  9115. #################################
  9116. # Lame mIRC ^Cx,x colors support# 
  9117. #################################
  9118.  
  9119. # these are aliases that converts mIRC ^Cx,x format to our ^Cxx and back
  9120.  
  9121. alias fix.mirc {@ function_return = ansi2c($mirc2cntl($0 $1-))}
  9122.  
  9123. ^set input_prompt ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░96% (Color Translation)
  9124. # mIRC color index to our one
  9125. @ _clrtab.0 = [f]
  9126. @ _clrtab.1 = [0]
  9127. @ _clrtab.2 = [1]
  9128. @ _clrtab.3 = [2]
  9129. @ _clrtab.4 = [c]
  9130. @ _clrtab.5 = [4]
  9131. @ _clrtab.6 = [5]
  9132. @ _clrtab.7 = [6]
  9133. @ _clrtab.8 = [e]
  9134. @ _clrtab.9 = [a]
  9135. @ _clrtab.10 = [3]
  9136. @ _clrtab.11 = [b]
  9137. @ _clrtab.12 = [9]
  9138. @ _clrtab.13 = [d]
  9139. @ _clrtab.14 = [8]
  9140. @ _clrtab.15 = [7]
  9141.  
  9142. # our color index to mIRC one
  9143.  
  9144. @ _backtab.f = [00]
  9145. @ _backtab.0 = [01]
  9146. @ _backtab.3 = 10
  9147. @ _backtab.b = 11
  9148. @ _backtab.9 = 12
  9149. @ _backtab.d = 13
  9150. @ _backtab.8 = 14
  9151. @ _backtab.7 = 15
  9152. @ _backtab.1 = [02]
  9153. @ _backtab.2 = [03]
  9154. @ _backtab.c = [04]
  9155. @ _backtab.4 = [05]
  9156. @ _backtab.5 = [06]
  9157. @ _backtab.e = [08]
  9158. @ _backtab.a = [09]
  9159. @ _backtab.6 = [07]
  9160.  
  9161. # $0 == color wich to use as default background color for ^Cnum
  9162. # $1... a string to convert
  9163.  
  9164. alias mirc2cntl {
  9165. # default background color
  9166.     @ mc.bc = _backtab[$left(1 $colorvalue($0))]
  9167. # do actual conversion using recursive function
  9168.     @ function_return = _mirc2cntl($1-)
  9169. }
  9170.  
  9171. ### strips mirc colors
  9172. alias mircstrip {
  9173. # start
  9174.     @ mc.idx = index( $*)
  9175.     if (mc.idx == -1) {
  9176.         @ function_return = [$*]
  9177.     }{
  9178.         # take a left part before ^C
  9179.         @ mc.p1 = left(${mc.idx++} $*)
  9180.         @ mc.n1 = mid($mc.idx 1 $*)
  9181.         if (isdigit($mc.n1)) {
  9182.             @ mc.idx++
  9183.             @ mc.n2 = mid($mc.idx 1 $*)
  9184.             if (isdigit($mc.n2)) @ mc.idx++
  9185.             # second number after a comma
  9186.             if (mid($mc.idx 1 $*)==[,] && isdigit(${mc.n1=mid(${++mc.idx} 1 $*)})) {
  9187.                 @ mc.idx++
  9188.                 @ mc.n2 = mid($mc.idx 1 $*)
  9189.                 if (isdigit($mc.n2)) @ mc.idx++
  9190.             }
  9191.             @ function_return = [$mc.p1$mircstrip($mid($mc.idx 2048 $*))]
  9192.         }{
  9193.             # no digit after ^C mean turn on default color in mIRC
  9194.             @ function_return = [$mc.p1$mircstripl($mid($mc.idx 2048 $*))]
  9195.         }
  9196.     }
  9197. }
  9198.  
  9199. alias mirc2cntl {
  9200. # default background color
  9201.     @ mc.bc = _backtab[$left(1 $colorvalue($0))]
  9202.     @ mc.d = [$colorvalue($0)]
  9203. # do actual conversion using recursive function
  9204.     @ function_return = _mirc2cntl($1-)
  9205. }
  9206.  
  9207. alias _mirc2cntl {
  9208. # start
  9209.     @ mc.idx = index( $*)
  9210.     if (mc.idx == -1) {
  9211.         @ function_return = [$*]
  9212.     }{
  9213.         # take a left part before ^C
  9214.         @ mc.p1 = left(${mc.idx++} $*)
  9215.         @ mc.b = mc.bc
  9216.         @ mc.n1 = mid($mc.idx 1 $*)
  9217.         if (isdigit($mc.n1)) {
  9218.             @ mc.idx++
  9219.             @ mc.n2 = mid($mc.idx 1 $*)
  9220.             if (isdigit($mc.n2)) @ mc.idx++
  9221.             else @ mc.n2 = []
  9222.             @ mc.f = mc.n1 ## mc.n2
  9223.             # second number after a comma
  9224.             if (mid($mc.idx 1 $*)==[,] && isdigit(${mc.n1=mid(${++mc.idx} 1 $*)})) {
  9225.                 @ mc.idx++
  9226.                 @ mc.n2 = mid($mc.idx 1 $*)
  9227.                 if (isdigit($mc.n2)) @ mc.idx++
  9228.                 else @ mc.n2 = []
  9229.                 @ mc.b = mc.n1 ## mc.n2
  9230.             }
  9231.             @ function_return = [$mc.p1\$_clrtab[${mc.b & 15}]$_clrtab[${mc.f & 15}]$_mirc2cntl($mid($mc.idx 2048 $*))]
  9232.         }{
  9233.             # no digit after ^C mean turn on default color in mIRC
  9234.             @ function_return = [$mc.p1$mc.d$_mirc2cntl($mid($mc.idx 2048 $*))]
  9235.         }
  9236.     }
  9237. }
  9238.  
  9239. alias cntl2mirc {
  9240. # default background color
  9241.     @ mc.bc = left(1 $0)
  9242. # do actual conversion using recursive function
  9243.     @ function_return = _cntl2mirc($1-)
  9244. }
  9245.  
  9246. alias _cntl2mirc {
  9247. # start
  9248.     @ mc.idx = index( $*)
  9249.     if (mc.idx == -1) {
  9250.         @ function_return = [$*]
  9251.     }{
  9252.         # take a left part before ^C
  9253.         @ mc.p1 = left(${mc.idx++} $*)
  9254.         @ mc.b = mc.bc
  9255.         @ mc.n1 = mid($mc.idx 1 $*)
  9256.         if (isxdigit($mc.n1)) {
  9257.             @ mc.f = mc.n1
  9258.             @ mc.idx++
  9259.             # second hex digit
  9260.             @ mc.n2 = mid($mc.idx 1 $*)
  9261.             if (isxdigit($mc.n2)) {
  9262.                 @ mc.b = mc.f
  9263.                 @ mc.idx++
  9264.                 @ mc.f = mc.n2
  9265.             }{
  9266.                 @ mc.b = mc.bc
  9267.             }
  9268.             if (mid($mc.idx 1 $*)==[]) {
  9269.                 @ function_return = [$mc.p1$_cntl2mirc($mid($mc.idx 2048 $*))]
  9270.             }{
  9271.                 @ mc.ln = [$_backtab[$mc.f]\,$_backtab[$mc.b]]
  9272.                 if (mc.ln!=mc.l) {
  9273.                     @mc.l = mc.ln
  9274.                     @ function_return = [$mc.p1$mc.l$_cntl2mirc($mid($mc.idx 2048 $*))]
  9275.                 }{
  9276.                     @ function_return = [$mc.p1$_cntl2mirc($mid($mc.idx 2048 $*))]
  9277.                 }
  9278.             }
  9279.         }{
  9280.             # no hex digit after ^C mean we just eat an ^C
  9281.             @ function_return = [$mc.p1$_mirc2cntl($mid($mc.idx 2048 $*))]
  9282.         }
  9283.     }
  9284. }
  9285.  
  9286. #### END MIRC CRAP ####
  9287.  
  9288. ###################################
  9289. #### Ansi to ^C Conversion support#
  9290. ###################################
  9291.  
  9292. ###Ansi number to ^C number table
  9293. @ _ansi[0] = [0]
  9294. @ _ansi[1] = [4]
  9295. @ _ansi[2] = [2]
  9296. @ _ansi[3] = [6]
  9297. @ _ansi[4] = [1]
  9298. @ _ansi[5] = [5]
  9299. @ _ansi[6] = [3]
  9300. @ _ansi[7] = [7]
  9301. #these used if highlight = 1
  9302. @ _hansi[0] = [8]
  9303. @ _hansi[1] = [C]
  9304. @ _hansi[2] = [A]
  9305. @ _hansi[3] = [E]
  9306. @ _hansi[4] = [9]
  9307. @ _hansi[5] = [D]
  9308. @ _hansi[6] = [B]
  9309. @ _hansi[7] = [F]
  9310.  
  9311.  
  9312. alias _rconvert {
  9313.  switch ($0) {
  9314.    (0) {@ function_return = [0];@ highlight = [0]}
  9315.    (4) {@ function_return = [1];@ highlight = [0]}
  9316.    (2) {@ function_return = [2];@ highlight = [0]}
  9317.    (6) {@ function_return = [3];@ highlight = [0]}
  9318.    (1) {@ function_return = [4];@ highlight = [0]}
  9319.    (5) {@ function_return = [5];@ highlight = [0]}
  9320.    (3) {@ function_return = [6];@ highlight = [0]}
  9321.    (7) {@ function_return = [7];@ highlight = [0]}
  9322.    (8) {@ function_return = [0];@ highlight = [1]}
  9323.    (C) {@ function_return = [1];@ highlight = [1]}
  9324.    (A) {@ function_return = [2];@ highlight = [1]}
  9325.    (E) {@ function_return = [3];@ highlight = [1]}
  9326.    (9) {@ function_return = [4];@ highlight = [1]}
  9327.    (D) {@ function_return = [5];@ highlight = [1]}
  9328.    (B) {@ function_return = [6];@ highlight = [1]}
  9329.    (F) {@ function_return = [7];@ highlight = [1]}
  9330.  }
  9331. }
  9332.  
  9333. alias split {
  9334.  fec ($1-) __s.1 {
  9335.   if (__s.1==[$0]) {@ __s.2 #= [ ]}
  9336.   else if (__s.1==[ ]) {}
  9337.   else {@ __s.2 #= __s.1}
  9338.  }
  9339.  @ function_return = __s.2
  9340.  purge __s
  9341. }
  9342.  
  9343. alias ansireset {
  9344.  @ foreground = _rconvert($right(1 $color_normal))
  9345.  @ background = _rconvert($left(1 $color_normal))
  9346. }
  9347.  
  9348. alias convertcode {
  9349.  if ([$0]==[\[0m]) {
  9350.   @ function_return = [$color_normal]
  9351.   ansireset
  9352.  }{
  9353.   @ _code = strip(m\[ $*)
  9354.   if (_code==[0]) {@ highlight = 0}
  9355.   else {
  9356.    fe ($split(; $_code)) _code.2 {
  9357.     if (left(1 $_code.2)==3) {@ foreground = right(1 $_code.2)}
  9358.     else if (left(1 $_code.2)==4) {@ background = right(1 $_code.2)}
  9359.     else if (_code.2==1) {@ highlight = 1}
  9360.     else if (_code.2==0) {@ highlight = 0}
  9361.    }
  9362.   }
  9363.   @ function_return = [$_convert.b($background)$_convert.f($foreground)]
  9364.   purge _code
  9365.  }
  9366. }
  9367.  
  9368. alias _convert.f {if (highlight) {@ function_return = [$_hansi[$0]]}{@ function_return = [$_ansi[$0]]}}
  9369. alias _convert.b {@ function_return = _ansi[$0]}
  9370.  
  9371. alias ansi2c {
  9372.  if (gz.ansi) {
  9373. # we reset background/foreground.  Ansi codes are weird beasts.
  9374. # and this is highly specialized for IRC clients that use ansi
  9375.   ansireset
  9376.   if (index( $*) >= 0) {
  9377.    @ _left = left($index( $*) $*)
  9378.    @ _right = mid(${index( $*)+1} $@* $*)
  9379.    @ _tmp = index(m $_right)
  9380.    if (_tmp == -1) {
  9381.     # screw it, bad escape sequence
  9382.     @function_return = [$*]
  9383.    }{
  9384.    @ _tmp++
  9385.     @ _mid = mid(0 $_tmp $_right)
  9386.     @ _rest = mid($_tmp $@_right $_right)
  9387.     @ function_return = _left ## convertcode($_mid) ## ansi2c($_rest)
  9388.    }
  9389.   }{
  9390.    @ function_return = [$*]
  9391.   }
  9392.  }{
  9393.   @ function_return = [$*]
  9394.  }
  9395. }
  9396.  
  9397.  
  9398. ### End Ansi Conversion ###
  9399.  
  9400. ^set input_prompt ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░97% (Final Setup)
  9401. #final Cleanup #
  9402. #load gemz save file
  9403. eval gecho Loading GemZ/2 savefile: $gzsavefile
  9404. if (!gemzloaded) {
  9405.  _statgl
  9406.  update_uptime
  9407.  ^eval ^set status_user2 [M:0/P:0]
  9408.  @ msglog_cnt = [0]
  9409.  @ publog_cnt = [0]
  9410. }{
  9411.  clearignorelist
  9412. }
  9413.  
  9414.  
  9415. EVAL load $gzsavefile
  9416. if (fexist($dcc_dldir) != 1) {
  9417.  gecho Invalid or No Download Directory specified.
  9418.  gecho Defaulting to $exedir/download
  9419.  if (fexist($exedir/download) !=1) {@ mkdir($exedir/download)}
  9420.  eval ^set DCC_DLDIR $exedir/download
  9421. }
  9422. if (!gemzloaded) {/codepage $default_codepage}
  9423. settitlebar
  9424. if (gz.loadextras) {load gzextras.irc}
  9425. eval @ fig.fontfile = [$def.figfont]
  9426. eval @ figfont = [$fig.fontdir/$def.figfont\.flf]
  9427.  
  9428. update_vars
  9429. alias -update_vars
  9430.  
  9431. eval load gemzmenu.irc
  9432. eval gecho Loading GemZ/2 ColorFile: $exedir/colors.gmz
  9433. eval load $exedir/colors.gmz
  9434. #EVAL load gemzhelp.irc
  9435. alias ghelp {
  9436.  gecho Please use /help.
  9437.  gecho Old /ghelp IRC file has been replaced with OS/2 help file
  9438. }
  9439.  
  9440. eval if ([$fexist($gz.logdir)]!=[1]) {
  9441.  @ mkdir($gz.logdir)
  9442. }
  9443. eval if (!gemzloaded) {
  9444.  ^set SOUND_PATH $SOUND_PATH$DOWNLOADDIR
  9445.  gecho Loading OpenChat/2 Help file, use /help for OpenChat/2 help
  9446.  gecho use /ghelp for GemZ help
  9447.  /help -file $exedir/script2/gemzhelp.hlp
  9448.  @ _ghelp = 1
  9449. }
  9450.  
  9451. eval if (fexist($exedir/script2/gemzhelp.new)==1) {
  9452.  gecho New help file detected... upgrading...
  9453.  eval //help -file $exedir/OpenChat.hlp
  9454.  eval @ unlink($exedir/script2/gemzhelp.hlp)
  9455.  eval @ rename($exedir/script2/gemzhelp.new $exedir/script2/gemzhelp.hlp)
  9456.  eval //help -file $exedir/script2/gemzhelp.hlp
  9457.  gecho upgrade finished
  9458.  #^timer 2 //help whatsnew
  9459. }
  9460.  
  9461. eval set_reply
  9462. alias setinput {
  9463.  if (gz.inputchan) {
  9464.   ^set input_prompt \${ T ? [<$T> ] : [<none> ]}
  9465.  }{
  9466.   ^set input_prompt \${ T ? [<$N> ] : [<$N> ]}
  9467.  }
  9468. }
  9469.  
  9470. ^set input_prompt ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒100%
  9471. gecho Finished!
  9472.  
  9473. eval setinput
  9474.  
  9475. ^on #^timer 70 * netclean
  9476. ^on #^timer 10 * {
  9477.  gz.checkfixnick
  9478.  gz.testbans
  9479.  if (gz.autosave) {
  9480.   if ([$_astime]==[]) {@ _astime = 0}{@ _astime++}
  9481.   if ((_astime >= gz.astime) && (_astime != 0) && (gz.astime != 0)) {
  9482.    @ _astime = 0
  9483.    gsave quiet
  9484.   }
  9485.  }
  9486. # all purpose minute timer for GemZ
  9487.  for (@ cnt = 0, _blah = dccitem($cnt), @ cnt++) {
  9488.   if (gz.dcctimeout > 0 && [$word(0 $_blah)]==[chat] && ([$word(2 $_blah)]==[waiting] || [$word(2 $_blah)]==[offered])) {
  9489.    @ _time = time() - word(3 $_blah)
  9490.    @ _dtime = gz.dcctimeout * 60
  9491.    if (_time > _dtime) {
  9492.     gecho $gx DCC CHAT Timeout after $gz.dcctimeout minutes
  9493.     /dcc close chat $word(1 $_blah)
  9494.     ^nochat $word(1 $_blah)
  9495.    }
  9496.    ^assign -_time
  9497.   }
  9498.  }
  9499.  if (hourlytime==[ON] && (rmatch($0 %:00*) || (gz.halfhour && rmatch($0 %:30*))) ) {
  9500.   for (@ idx = 0, (win = winitem($idx)), @ idx++) {
  9501.    if (win) {xecho -window $word(0 $win) $gemz The Time is now ${gc.time}$gz.timedate()${cl}}
  9502.   }
  9503.  }
  9504.  ^assign -_blah
  9505.  ^assign -cnt
  9506. }
  9507.  
  9508.  
  9509. alias useclock {
  9510.  if ([$0]==[Toggle]) {
  9511.   @ gz.useclock = _tog($gz.useclock)
  9512.  }
  9513.  setstatusbar
  9514. }
  9515.  
  9516. alias setstatusbar {
  9517.  @ gt.statbar = [normal]
  9518.  if (gz.useclock) {
  9519.   ^set status_format %B%T%F %H%@%N%*%# %A %Q%C%+ %Z %>%4%0
  9520.  }{
  9521.   ^set status_format %B<gz $gemz.ver>%F %H%@%N%*%# %A %Q%C%+ %Z %>%4%0
  9522.  }
  9523. }
  9524.  
  9525. setstatusbar
  9526.  
  9527. if (!gender) {
  9528.  @ tmp = [$"Size your default window position \[press enter\]"]
  9529.  fontdialog
  9530.  input "Are you [M]ale or [F]emale? " if ([$0]) {
  9531.   if ([$0]==[F]) {@ gender = [her];@ gender.2 = [she]}
  9532.   {@ gender = [his];@ gender.2 = [he]}
  9533.   gecho Saving information... 
  9534.   eval gsave
  9535.  }
  9536.  ^assign -tmp
  9537. }
  9538.  
  9539. eval if ([$loadacts]==[YES]) {eval loadplug $actionsfile}
  9540. #if load was a reload, it's no longer now
  9541. ^assign -reloading
  9542. on ^disconnect * {
  9543.  if ([$re.connect]==[ON]) {
  9544.   if (!dt.timer) {
  9545.    gecho Disconnected, autocycle to first server in 5 seconds...
  9546.    ^timer 5 if (1) {
  9547.     if ((serverwindows($lastserver())  != []) && (!isconnected($lastserver()))) {
  9548.      /server +
  9549.     }
  9550.     @ dt.timer = 0
  9551.    }
  9552.    @ dt.timer = 1
  9553.   }
  9554.  }
  9555. }
  9556.  
  9557. ### ignore menu and sample /ig code
  9558. ### each ignore item have a submenu with all the ignore types: MSGS PUBLIC
  9559. ### WALLS WALLOPS INVITES NOTICES NOTES CTCPS CRAP ACTIONS
  9560. ###
  9561. ### Note that ALL and NONE are not included, coz ALL mean ignore all of 
  9562. ### the above types, and NONE mean remove ignore item
  9563. ###
  9564.  
  9565. ### $0 == number in ignore list $1 == nick|mask  $2 == ignore type
  9566. alias _ign.toggle {
  9567.     if (!isignored($2 $1 $1)) {
  9568.         /__ignore $1 $2
  9569.         @menucontrol(check 1)
  9570.     }
  9571.     else if (ref(4- $ignoreitem($0)) == [$2]) {
  9572.         # its a last ignored type, ignore will be removed
  9573.         # note that ^ is not used, so client displays 
  9574.         # blah removed from ignore list message
  9575.         @__ignoremenucommand++
  9576.         //ignore $1 -$2
  9577.         @__ignoremenucommand--
  9578.         //^timer 0 _recreate_ign_menu
  9579.     }
  9580.     else {
  9581.         /__ignore $1 -$2
  9582.         @menucontrol(check 0)        
  9583.     }
  9584. }
  9585.  
  9586. ### following code is used to prevent on ^ignore_list from recreating
  9587. ### ignore list when we adding/removing ignores from menu itself...
  9588.  
  9589. alias clearignorelist while (ignoreitem(0) != []) {/^__ignore -0}
  9590.  
  9591. @__ignmenucommand = 0
  9592. alias __ignore {
  9593.     @__ignoremenucommand++
  9594.     //ignore $*
  9595.     @__ignoremenucommand--
  9596. }
  9597.  
  9598. alias _recreate_ign_menu {
  9599.     menu -ign
  9600.     menu ign
  9601.     for (@ii=0, (tmp=ignoreitem($ii)) != [], @ii++) {
  9602.         if (word(2 $tmp) == -1) {
  9603.             submenu ign ign$ii "# $tolower($word(0 $tmp))"
  9604.         }{
  9605.             submenu ign ign$ii "$word(2 $tmp) $tolower($word(0 $tmp))"
  9606.         }
  9607.         fe (MSGS PUBLIC INVITES NOTICES CTCPS ACTIONS CRAP WALLS WALLOPS NOTES) ign.type {
  9608.             if (match($ign.type $ref(4- $tmp)) || ref(4- $tmp) == [ALL]) @ ign.c = [-c]
  9609.             else @ ign.c = []
  9610.             //menuitem ign$ii -n $ign.c "$ign.type" _ign.toggle $ii $word(0 $tmp) $ign.type
  9611.         }
  9612.         menuitem ign$ii separator
  9613.         menuitem ign$ii "~Remove" //ignore -$ii
  9614.     }
  9615.     if (!ii) {menuitem ign "Ignore List is Empty" {}}
  9616.     menu ign -reset
  9617. }
  9618.  
  9619. on ^ignore_list * if (!__ignoremenucommand) {
  9620.     _recreate_ign_menu
  9621. }
  9622.  
  9623. _recreate_ign_menu
  9624.  
  9625. alias ig {
  9626.  if ([$0]) {
  9627.   switch ($1) {
  9628.    (-t) {_ig $*}
  9629.    (-p) {_ig $0 $2-}
  9630.    (*) {if (gz.igtimeout) {_ig $0 -t ${gz.igtimeout * 60} $1-}{_ig $*}}
  9631.   }
  9632.  }{_ig}
  9633. }
  9634.  
  9635.  
  9636. alias _ig {
  9637.     if (index(*?@ $0) >= 0) //ig $*
  9638.     else if (![$0]) //ig
  9639.     else {
  9640.         @_found = 0
  9641.         fe ($mychannels()) _ch {
  9642.             if (onchannel($0 $_ch) && nickdata($_ch $0) != [<UNKNOWN>]) {
  9643.                 @_found = 1
  9644.                 @_uh = nickdata($_ch $0)
  9645.                 //break
  9646.             }
  9647.         }
  9648.         if (_found) //ig *$mask.userhost($_uh) $1-
  9649.         else //userhost $0 -cmd _ig.uhcmd $0 $$* $1-
  9650.     }
  9651. }
  9652.  
  9653. alias _ig.uhcmd {
  9654.     if ([$4] == [<UNKNOWN>]) {
  9655.         echo $SHOW_NUMERICS_STR\Nick $1\ is not online
  9656.     }{
  9657.         //ig *$mask.userhost($4@$5) $6-
  9658.     }
  9659. }
  9660.  
  9661. alias snap {
  9662.  if (![$0]) {
  9663.   /xecho $SHOW_NUMERICS_STR\Usage: /snap <filename>
  9664.  }{
  9665.   //lastlog -snap $0
  9666.  }
  9667. }
  9668.  
  9669. ### end of ignore menu and simple /ig
  9670.  
  9671. ######Load Mikh's Tabkey Code#######
  9672. on ^window "*compl.add*" #
  9673. load complete
  9674. load tabkey
  9675. load load.cpl
  9676. load play.cpl
  9677. load dcc.cpl
  9678. load nick.cpl
  9679. load kick.cpl
  9680. load whois.cpl
  9681. load file.cpl
  9682. on ^window -"*compl.add*"
  9683. #####################################
  9684.  
  9685. alias _check_groups_present {
  9686.  @have_server_groups = 0
  9687.  for (@ii=0, servername($ii), @ii++) {
  9688.   if (servergroup($ii) != [none]) {
  9689.    @ have_server_groups = 1
  9690.    //break
  9691.   }
  9692.  }
  9693.  if (!have_server_groups) {/help Server Groups}
  9694.  //^assign -have_server_groups
  9695. }
  9696.  
  9697. _check_groups_present
  9698. alias dcc.sendfile_with_timeout {ctcpsnd.sendfile_with_timeout $*}
  9699.  
  9700. alias _gz.checkver {if (V < 19970822) {/help upgrade}}
  9701. _gz.checkver
  9702.  newsettings = 0
  9703. ^set preparse_aliases 0
  9704. ^set dcc_autoget off
  9705.  
  9706. alias -_gz.checkver
  9707. alias -_check_groups_present
  9708.  
  9709. #Things to remove for previous versions
  9710. ^on connect -"*" #
  9711. ^on ^public -"% % *http:*"
  9712. ^on ^public -"% % *ftp:*"
  9713. ^alias -dialogresend 
  9714. ^alias -dialogsend
  9715. ^assign -gz.opernotify
  9716.  
  9717. on ^hook "gzreload" {gz.reload}
  9718. eval if (gemzloaded) {^hook gzreload}
  9719.  
  9720. @ gemzloaded = [1]
  9721. #All scripts for gemz should run this at the end.
  9722. gz.setvers
  9723. csq.qtimer
  9724.  
  9725. #EOF
  9726.