;======================================================================================================================
;QuakeNet's Service Control v2.0 By Intenz
;E-Mail:  intenz44@hotmail.com
;Date:    December 7th 2003
;NOTES:   This script is to be used only on the QuakeNet IRC Network.
;         http://www.quakenet.org/
;         
;         Do not take credit for my work.
;======================================================================================================================

;=MENU=================================================================================================================
menu status,menubar,channel {
  QN's Service Control
  .$iif($menu == channel,Channel Flags):set %qnsc.getinfo_type 1 | qnsc
  .WHOAMI:set %qnsc.getinfo_type 2 | qnsc
  .-
  .Readme:dialog -m qnsc.readme.dlg qnsc.readme.dlg
  .About:dialog -m qnsc.about.dlg qnsc.about.dlg
  .-
  .Unload:qnsc.unload_script
}

;=LOAD & UNLOAD========================================================================================================
on *:UNLOAD:{
  unset %qnsc.*
  echo -a Cleared variables.
  .timerqnsc* off
  echo -a Turned off timer.
  if ($hget(qnsc_htbl)) { hfree qnsc_htbl | echo -a Freed hash table. }
  echo -a QuakeNet's Service Control v $+ $qnsc.version unloaded.
}
on *:LOAD:{
  if (($version < 6.12) && ($version >= 6)) {
    echo 4 -a This script was written and tested using mIRC 6.12, you are using an earlier version of mIRC.
    echo 4 -a If you encounter any problems please first upgrade your copy of mIRC.
  }
  elseif ($version < 6) {
    echo 4 -a QuakeNet's Service Control is nonfuctional on this version of mIRC.
    .timerqnsc 1 1 unload -rs qnsc.mrc
    halt
  }
  if ($lock(dll)) {
    echo 4 -a You have locked the use of the command /dll this script needs to be able to use this command.
    echo 4 -a You will need to enable the use of the /dll command, this can be done by following the simple steps.
    echo -a 1. Press Alt+O
    echo -a 2. On the list on the left go all the way to the bottom.
    echo -a 3. Expand the "Other" branch and click on "Lock"
    echo -a 4. Where it says "Disable commands:" you will need to un-tick the "/dll" check box.
    echo -a 5. Click "OK" and you should now be able to use the script without any problems.
    echo -a 
    echo -a QuakeNet's Service Control v $+ $qnsc.version By Intenz is now loaded.
    echo -a Please report any bugs to intenz44@hotmail.com
    halt
  }
  echo -a QuakeNet's Service Control v $+ $qnsc.version By Intenz has been loaded sucessfully.
  echo -a Type "/qnsc" to get started or go to the channel, status and menu popups.
  echo -a Type "/qnsc help" for help on how to use the script.
  echo -a Please report any bugs to intenz44@hotmail.com
}

;=INIT EVENT===========================================================================================================
;Main Dialog
on *:dialog:qnsc.main.dlg:init:0: {
  mdx SetMircVersion $version
  mdx MarkDialog $dname
  mdx SetControlMDX $dname 7 ListView report grid rowselect showsel nosortheader single > $mdx.views
  mdx SetControlMDX $dname 27 ListView report grid rowselect showsel nosortheader single > $mdx.views
  mdx SetControlMDX $dname 56 ListView report grid rowselect showsel nosortheader single > $mdx.views
  mdx SetControlMDX $dname 105 ListView report grid rowselect showsel nosortheader single > $mdx.views
  did -i qnsc.main.dlg 7 1 headerdims 121:1 73:2 | did -i qnsc.main.dlg 7 1 headertext Authname $chr(9) Flags
  did -i qnsc.main.dlg 27 1 headerdims 109:1 340:2 | did -i qnsc.main.dlg 27 1 headertext Date - Time $chr(9) Commands sent to L & Confirmation
  did -i qnsc.main.dlg 56 1 headerdims 100:1 40:2 50:3 | did -i qnsc.main.dlg 56 1 headertext Channel $chr(9) Bot $chr(9) Flags
  did -i qnsc.main.dlg 105 1 headerdims 30:1 70:2 122:3 | did -i qnsc.main.dlg 105 1 headertext Nr. $chr(9) Owner $chr(9) Hostmask
  mdx SetControlMDX qnsc.main.dlg 24 statusbar > $mdx.bars
  mdx SetControlMDX qnsc.main.dlg 139 ProgressBar smooth > $mdx.ctl_gen
  mdx SetBorderStyle qnsc.main.dlg 24
  did -i qnsc.main.dlg 24 1 setparts -1
  mdx SetFont 54,55,123,124 18 0 Webdings
  did -a qnsc.main.dlg 48 QuakeNet's Service Control v $+ $qnsc.version
  dialog -t qnsc.main.dlg $chr(91) /qnsc $chr(93) QuakeNet's Service Control v $+ $qnsc.version By Intenz
  if ($group(#qnsc.mouse_over).status == on) { did -c qnsc.main.dlg 129 }
  if (%qnsc.getinfo_type == 2) { .timerqnsc.dlg 1 0.25 did -c qnsc.main.dlg 31 }
  qnsc.msg_log
  qnsc.getinfo
}

;Input Dialog
on *:dialog:qnsc.war.dlg:init:0: {
  beep 2
  dialog -t qnsc.war.dlg %qnsc.inp_title
  did -a qnsc.war.dlg 1 %qnsc.inp_cap
  did -a qnsc.war.dlg 7 %qnsc.inp_com
  if (%qnsc.inp_url == 1) {  did -v qnsc.war.dlg 3 }
  if (%qnsc.inp_yesno = 1) { did -v qnsc.war.dlg 5,6 | did -f qnsc.war.dlg 6 }
  else { did -v qnsc.war.dlg 2 }
  did -g qnsc.war.dlg 4 $+(",$scriptdir,%qnsc.inp_icon,")
  unset %qnsc.inp_*
}

;About Dialog
on *:dialog:qnsc.about.dlg:init:0: {
  dialog -t qnsc.about.dlg QuakeNet's Service Control v $+ $qnsc.version By Intenz
  did -a qnsc.about.dlg 3 QuakeNet's Service Control v $+ $qnsc.version
  if (!$isfile($qnsc.readme_file)) || (!$qnsc.readme.check) { return $input(Help-File $qnsc.readme_file not found or invalid Format.,oh,Help-File Not Found) }
  else { loadbuf $+(-ot,Credit) qnsc.about.dlg 13 $qnsc.readme_file }
}

;Help Dialog
on *:dialog:qnsc.readme.dlg:init:0:{
  if (!$isfile($qnsc.readme_file)) || (!$qnsc.readme.check) { return $input(Help-File $qnsc.readme_file not found or invalid Format.,oh,Help-File Not Found) }
  else {
    mdx SetMircVersion $version
    mdx MarkDialog $dname
    mdx SetControlMDX $dname 3 treeview haslines hasbuttons linesatroot showsel > $mdx.views
    did -a $dname 3 +bce 1 QN's Service Control
    var %i = 0
    var %text, %numtok, %j
    while (%i < $ini($qnsc.readme_file,0)) {
      inc %i
      %text = $ini($qnsc.readme_file,%i)
      %numtok = $numtok(%text,45)
      if (%numtok == 1) {
        did -i $dname 3 1 cb root 2
        did -a $dname 3 $replace(%text,$chr(35),$chr(45))
      }
      elseif (%numtok >= 2) {
        %j = $calc(%numtok - 1)
        while (%j) { dec %j | did -i $dname 3 1 cb last }
        did -a $dname 3 $replace($gettok(%text,%numtok,45),$chr(35),$chr(45),$chr(95),$chr(32))
        did -i $dname 3 1 cb root 2
      }
    }
    qnsc.readme.loadbuf
  }
}

;=ON DIALOG EVENT======================================================================================================
;==_Main Dialog_==
on *:dialog:qnsc.main.dlg:sclick:17: {
  qnsc.htbl_add channel $did(17).seltext
  %qnsc.getinfo_type = 1
  qnsc.getinfo
}
on *:dialog:qnsc.main.dlg:sclick:127,125: {
  if ($did($did).state) { did -ra qnsc.main.dlg $did Enabled }
  else { did -ra qnsc.main.dlg $did Disabled }
}

;Menu
on *:dialog:qnsc.main.dlg:menu:133:dialog -m qnsc.about.dlg qnsc.about.dlg
on *:dialog:qnsc.main.dlg:menu:134:dialog -m qnsc.readme.dlg qnsc.readme.dlg
on *:dialog:qnsc.main.dlg:menu:20:{ unset %qnsc.* | .timerqnsc* off | hfree qnsc_htbl | dialog -x qnsc.main.dlg }
on *:dialog:qnsc.main.dlg:menu:129:{
  if ($did(129).state) { did -u qnsc.main.dlg 129 | .disable #qnsc.mouse_over }
  else { did -c qnsc.main.dlg 129 | .enable #qnsc.mouse_over }
}

;User Flags Tab
on *:dialog:qnsc.main.dlg:sclick:7: {
  if (!%qnsc.action) {
    qnsc.fillnicks
    if ($did(7).seltext) {
      qnsc.htbl_add uflag_user $gettok($did(qnsc.main.dlg,7).seltext,11,32)
      qnsc.htbl_add authname_user $gettok($did(qnsc.main.dlg,7).seltext,6,32)
      qnsc.enable_check
      did -ra qnsc.main.dlg 18 $qnsc.htbl_read(authname_user)
      did -ra qnsc.main.dlg 19 $qnsc.htbl_read(uflag_user)
      did -u qnsc.main.dlg 8,9,10,11,12,13
      qnsc.check_boxes
    }
    else {
      did -u qnsc.main.dlg 8,9,10,11,12,13,102,103
      did -r qnsc.main.dlg 18,19
      did -b qnsc.main.dlg 8,9,10,11,12,13,14,102,103
    }
    qnsc.enable_add_nick
  }
  else { qnsc.status 0 0 Please wait till the script has finished working. }
}
on *:dialog:qnsc.main.dlg:sclick:8,9,10,11,12,13,102,103: {
  did -r qnsc.main.dlg 19
  if ($did(8).state) { did -a qnsc.main.dlg 19 a }
  if ($did(102).state) { did -a qnsc.main.dlg 19 b }
  if ($did(12).state) { did -a qnsc.main.dlg 19 m }
  if ($did(13).state) { did -a qnsc.main.dlg 19 n }
  if ($did(9).state) { did -a qnsc.main.dlg 19 o }
  if ($did(103).state) { did -a qnsc.main.dlg 19 t }
  if ($did(10).state) { did -a qnsc.main.dlg 19 v }
  if ($did(11).state) { did -a qnsc.main.dlg 19 g }
}
on *:dialog:qnsc.main.dlg:sclick:77: {
  if ($did(19) == $null) { return $input(You need to give the user some channel flags to add them to the channel.,ow,No Channel Flags) }
  else { qnsc.update.flags }
}
on *:dialog:qnsc.main.dlg:sclick:14:qnsc.update.flags
on *:dialog:qnsc.main.dlg:sclick:76: {
  qnsc.status 1 0 Retrieving...
  qnsc.prog_bar 0
  did -u qnsc.main.dlg 8,9,10,11,12,13,102,103
  did -r qnsc.main.dlg 18,19
  did -b qnsc.main.dlg 8,9,10,11,12,13,14,102,103,77
  qnsc.htbl_add uflag_user 0
  set %qnsc.whois $true
  qnsc.msg_log 0 0 /MSG $qnsc.htbl_read(active_bot) WHOIS $did(76).seltext
}

;Channel Management Tab
;-Common
on *:dialog:qnsc.main.dlg:sclick:34:qnsc.msg_log 1 1 /MSG $qnsc.htbl_read(active_bot) CLEARCHAN $qnsc.htbl_read(channel)
on *:dialog:qnsc.main.dlg:sclick:35:qnsc.msg_log 1 1 /MSG $qnsc.htbl_read(active_bot) OP $qnsc.htbl_read(channel)
on *:dialog:qnsc.main.dlg:sclick:37:qnsc.msg_log 1 1 /MSG $qnsc.htbl_read(active_bot) DEOPALL $qnsc.htbl_read(channel)
on *:dialog:qnsc.main.dlg:sclick:40:qnsc.msg_log 1 1 /MSG $qnsc.htbl_read(active_bot) VOICE $qnsc.htbl_read(channel)
on *:dialog:qnsc.main.dlg:sclick:42:qnsc.msg_log 1 1 /MSG $qnsc.htbl_read(active_bot) UNBANALL $qnsc.htbl_read(channel)
on *:dialog:qnsc.main.dlg:sclick:43:qnsc.msg_log 1 1 /MSG $qnsc.htbl_read(active_bot) INVITE $qnsc.htbl_read(channel)
;-L Bot Specific
on *:dialog:qnsc.main.dlg:sclick:75: {
  if ($input(Are you sure you want to remove L bot from $qnsc.htbl_read(channel) $+ ? $+ $crlf $+ All flags will be lost!,yw,Are You Sure ?)) {
    qnsc.prog_bar 0
    set %qnsc.L_remove_progbar $calc($did(qnsc.main.dlg,7).lines - 1)
    set %qnsc.L_remove_user 2
    set %qnsc.L_remove $true
    if ($gettok($did(qnsc.main.dlg,7,%qnsc.L_remove_user).text,6,32) != $qnsc.htbl_read(authname_my)) || ($did(qnsc.main.dlg,7).lines == 2) {
      qnsc.msg_log 1 0 /MSG L REMOVEUSER $qnsc.htbl_read(channel) $chr(35) $+ $gettok($did(qnsc.main.dlg,7,%qnsc.L_remove_user).text,6,32)
    }
    else {
      inc %qnsc.L_remove_user 1
      qnsc.msg_log 1 0 /MSG L REMOVEUSER $qnsc.htbl_read(channel) $chr(35) $+ $gettok($did(qnsc.main.dlg,7,%qnsc.L_remove_user).text,6,32)
    }
    qnsc.status 1 0 Working...
    qnsc.prog_bar $int($calc((1 / %qnsc.L_remove_progbar) * 100))
  }
}
on *:dialog:qnsc.main.dlg:sclick:36:qnsc.msg_log 1 1 /MSG L SETINVITE $qnsc.htbl_read(channel)
on *:dialog:qnsc.main.dlg:sclick:38:qnsc.msg_log 1 1 /MSG L RECOVER $qnsc.htbl_read(channel)
on *:dialog:qnsc.main.dlg:sclick:41:qnsc.msg_log 1 1 /MSG L CLEARINVITE $qnsc.htbl_read(channel)
;-Welcome Massage
on *:dialog:qnsc.main.dlg:sclick:45:{
  if ($qnsc.htbl_read(active_bot) == L) {
    if ($did(127).state) {
      if ($did(44)) {
        qnsc.msg_log 1 1 /MSG L WELCOME $qnsc.htbl_read(channel) $did(44)
        if ($did(44) == remove) { did -r qnsc.main.dlg 44 | qnsc.prevbmp 2 47 $color(notice) 365 | did -u qnsc.main.dlg 127 }
      }
      else { return $input(You need to enter a welcome message.,ow,No Welcome Message) }
    }
    else { qnsc.msg_log 1 1 /MSG L WELCOME $qnsc.htbl_read(channel) remove | did -r qnsc.main.dlg 44 | qnsc.prevbmp 2 47 $color(notice) 365 }
  }
  elseif ($qnsc.htbl_read(active_bot) == Q) {
    if ($did(127).state) {
      if ($did(44)) {
        set %qnsc.wait.getinfo $true
        set %qnsc.wait.getinfo_com 1 1 /MSG Q WELCOME $qnsc.htbl_read(channel) $did(44)
        set %qnsc.wait.getinfo_var 0
        qnsc.msg_log 1 1 /MSG Q CHANFLAGS $qnsc.htbl_read(channel) +w
      }
      else { return $input(You need to enter a welcome message.,ow,No Welcome Message) }
    }
    else { qnsc.msg_log 1 1 /MSG Q CHANFLAGS $qnsc.htbl_read(channel) -w }
  }
}
on *:dialog:qnsc.main.dlg:sclick:54: {
  qnsc.htbl_add scroll_welcome $iif($calc($qnsc.htbl_read(scroll_welcome) +70) >= 0,$ifmatch,0)
  qnsc.prevbmp $calc(2- $qnsc.htbl_read(scroll_welcome)) 47 $color(notice) 365 $did(44)
}
on *:dialog:qnsc.main.dlg:sclick:55: {
  qnsc.htbl_add scroll_welcome $iif($calc($qnsc.htbl_read(scroll_welcome) -70) >= 0,$ifmatch,0)
  qnsc.prevbmp $calc(2- $qnsc.htbl_read(scroll_welcome)) 47 $color(notice) 365 $did(44)
}
on *:dialog:qnsc.main.dlg:edit:44:qnsc.prevbmp $calc(2- $qnsc.htbl_read(scroll_welcome)) 47 $color(notice) 365 $did(44)

;Q Bot Specific
;-Banlist
on *:dialog:qnsc.main.dlg:sclick:105: {
  if (!%qnsc.action) {
    if (m isin $qnsc.htbl_read(uflag_my) || n isin $qnsc.htbl_read(uflag_my)) && ($did(105).seltext) { did -e qnsc.main.dlg 107 }
    else { did -b qnsc.main.dlg 107 }
  }
  else { qnsc.status 0 0 Please wait till the script has finished working. }
}
on *:dialog:qnsc.main.dlg:sclick:109: {
  var %host = $?="Type in the nick!ident@evil.host.com $crlf eg. *!Jackie@the.isp.com"
  if (%host) {
    set %qnsc.action_stop $true
    set %qnsc.wait.getinfo $true
    set %qnsc.wait.getinfo_com 0 0 /MSG Q BANLIST $qnsc.htbl_read(channel)
    set %qnsc.wait.getinfo_var Q_banlist
    qnsc.msg_log 1 1 /MSG Q BAN $qnsc.htbl_read(channel) %host
  }
  did -r qnsc.main.dlg 105
  did -b qnsc.main.dlg 107
}
on *:dialog:qnsc.main.dlg:sclick:107: {
  set %qnsc.action_stop $true
  set %qnsc.wait.getinfo $true
  set %qnsc.wait.getinfo_com 0 0 /MSG Q BANLIST $qnsc.htbl_read(channel)
  set %qnsc.wait.getinfo_var Q_banlist
  qnsc.msg_log 1 1 /MSG Q BANDEL $qnsc.htbl_read(channel) $gettok($did(105).seltext,6,32)
  did -r qnsc.main.dlg 105
  did -b qnsc.main.dlg 107
}
on *:dialog:qnsc.main.dlg:sclick:108: {
  qnsc.msg_log 1 1 /MSG Q BANCLEAR $qnsc.htbl_read(channel)
  did -r qnsc.main.dlg 105
  did -b qnsc.main.dlg 107
}
;-Force Topic
on *:dialog:qnsc.main.dlg:sclick:126: {
  if ($did(120)) {
    if (m isin $qnsc.htbl_read(uflag_my) || n isin $qnsc.htbl_read(uflag_my)) {
      set %qnsc.wait.getinfo $true
      set %qnsc.wait.getinfo_com 1 1 /MSG Q SETTOPIC $qnsc.htbl_read(channel) $did(120)
      set %qnsc.wait.getinfo_var 0
      qnsc.msg_log 1 1 /MSG Q CHANFLAGS $qnsc.htbl_read(channel) $iif($did(125).state,+,-) $+ f
    }
    else { qnsc.msg_log 1 1 /MSG Q SETTOPIC $qnsc.htbl_read(channel) $did(120) }
  }
  else { return $input(You need to enter a topic.,ow,No Topic) }
}
on *:dialog:qnsc.main.dlg:sclick:124: {
  qnsc.htbl_add scroll_topic $iif($calc($qnsc.htbl_read(scroll_topic) +70) >= 0,$ifmatch,0)
  qnsc.prevbmp $calc(2- $qnsc.htbl_read(scroll_topic)) 122 $color(topic) 413 $did(120)
}
on *:dialog:qnsc.main.dlg:sclick:123: {
  qnsc.htbl_add scroll_topic $iif($calc($qnsc.htbl_read(scroll_topic) -70) >= 0,$ifmatch,0)
  qnsc.prevbmp $calc(2- $qnsc.htbl_read(scroll_topic)) 122 $color(topic) 413 $did(120)
}
on *:dialog:qnsc.main.dlg:edit:120:qnsc.prevbmp $calc(2- $qnsc.htbl_read(scroll_topic)) 122 $color(topic) 413 $did(120)
;-Chanflags
on *:dialog:qnsc.main.dlg:sclick:111: {
  var %s, %text
  if ($did(116).state) {
    if ($did(117) isnum) { %s = %s $+ +l | %text = %text $+ 1 1 /MSG Q LIMIT $qnsc.htbl_read(channel) $did(117) $+ $chr(25) }
    else { return $input(You need to enter a Force Limit.,ow,Force Limit) }
  }
  else { %s = %s $+ -l }
  if ($did(112).state) {
    if ($did(113) isnum) { %s = %s $+ +c | %text = %text $+ 1 1 /MSG Q AUTOLIMIT $qnsc.htbl_read(channel) $chr(35) $+ $did(113) $+ $chr(25) }
    else {
      return $input(You need to enter a Channel Limit.,ow,channel Limit)
    }
  }
  else { %s = %s $+ -c }
  if ($did(114).state) {
    if ($did(115)) { %s = %s $+ +k | %text = %text $+ 1 1 /MSG Q KEY $qnsc.htbl_read(channel) $did(115) }
    else { return $input(You need to enter a Key.,ow,Force Key) }
  }
  else { %s = %s $+ -k }
  if ($did(49).state) { %s = %s $+ +b } | else { %s = %s $+ -b }
  if ($did(137).state) { %s = %s $+ +p } | else { %s = %s $+ -p }
  if ($did(138).state) { %s = %s $+ +t } | else { %s = %s $+ -t }
  if (%text) {
    if ($right(%text,1) == $chr(25)) { %text = $left(%text,-1) }
    set %qnsc.wait.getinfo $true
    set %qnsc.wait.getinfo_com %text
    set %qnsc.wait.getinfo_var 0
  }
  qnsc.msg_log 1 1 /MSG Q CHANFLAGS $qnsc.htbl_read(channel) %s
}

;WHOAMI Tab
on *:dialog:qnsc.main.dlg:sclick:56: {
  if (!%qnsc.action) {
    did -u qnsc.main.dlg 66,69,67,68,70,71
    did -b qnsc.main.dlg 66,69,67,68,70,71,72
    if (Q == $gettok($did(qnsc.main.dlg,56).seltext,11,32)) {
      did -r qnsc.main.dlg 73
      qnsc.status 0 0 You are not allowed to change own Q flags.
      return
    }
    did -ra qnsc.main.dlg 73 $gettok($did(qnsc.main.dlg,56).seltext,16,32)
    if (a isin $did(73)) { did -c qnsc.main.dlg 66 | did -e qnsc.main.dlg 66,72 }
    if (o isin $did(73)) { did -c qnsc.main.dlg 71 | did -e qnsc.main.dlg 71,72 }
    if (v isin $did(73)) { did -c qnsc.main.dlg 67 | did -e qnsc.main.dlg 67,72 }
    if (g isin $did(73)) { did -c qnsc.main.dlg 70 | did -e qnsc.main.dlg 70,72 }
    if (m isin $did(73)) { did -c qnsc.main.dlg 68 | did -e qnsc.main.dlg 68,72 }
    if (n isin $did(73)) { did -c qnsc.main.dlg 69 | did -e qnsc.main.dlg 69,72 }
  }
  else { qnsc.status 0 0 Please wait till the script has finished working. }
}
on *:dialog:qnsc.main.dlg:sclick:66,67,68,69,70,71: {
  did -r qnsc.main.dlg 73
  if ($did(66).state) { did -a qnsc.main.dlg 73 a }
  if ($did(68).state) { did -a qnsc.main.dlg 73 m }
  if ($did(69).state) { did -a qnsc.main.dlg 73 n }
  if ($did(71).state) { did -a qnsc.main.dlg 73 o }
  if ($did(67).state) { did -a qnsc.main.dlg 73 v }
  if ($did(70).state) { did -a qnsc.main.dlg 73 g }
}
on *:dialog:qnsc.main.dlg:sclick:39:{ %qnsc.getinfo_type = 2 | qnsc.getinfo }
on *:dialog:qnsc.main.dlg:sclick:72: {
  var %s
  if ($did(66).enabled) { if ($did(66).state) { %s = %s $+ +a } | else { %s = %s $+ -a } }
  if ($did(67).enabled) { if ($did(67).state) { %s = %s $+ +v } | else { %s = %s $+ -v } }
  if ($did(71).enabled) { if ($did(71).state) { %s = %s $+ +o } | else { %s = %s $+ -o } }
  if ($did(68).enabled) { if ($did(68).state) { %s = %s $+ +m } | else { %s = %s $+ -m } }
  if ($did(69).enabled) { if ($did(69).state) { %s = %s $+ +n } | else { %s = %s $+ -n } }
  if ($did(70).enabled) { if ($did(70).state) { %s = %s $+ +g } | else { %s = %s $+ -g } }
  set %qnsc.wait.getinfo $true
  set %qnsc.wait.getinfo_com 0 0 /MSG L WHOAMI
  set %qnsc.wait.getinfo_var L_whoami
  set %qnsc.getinfo_type 2
  qnsc.msg_log 1 1 /MSG L CHANLEV $gettok($did(qnsc.main.dlg,56).seltext,6,32) $chr(35) $+ $did(57) %s
  qnsc.restore_dlg
  qnsc.status 1 0 Retrieving...
  qnsc.prog_bar 0
}
on *:dialog:qnsc.main.dlg:sclick:100:dialog -rmov qnsc.ch_email.dlg qnsc.ch_email.dlg
on *:dialog:qnsc.main.dlg:sclick:101:dialog -rmov qnsc.ch_pass.dlg qnsc.ch_pass.dlg
on *:dialog:qnsc.ch_email.dlg:sclick:7:{
  if ($did(1) && $did(2)) {
    if ($qnsc.val_email($did(2)) == 1) {
      set %qnsc.email.tmp $did(2)
      qnsc.msg_log 0 1 /MSG Q EMAIL $did(1) $did(2)
      dialog -x qnsc.ch_email.dlg
    }
  }
  else { return $input(Please fill in all the fields.,ovw,Invalid E-mail) }
}
on *:dialog:qnsc.ch_pass.dlg:sclick:7:{
  if ($did(1) && $did(2) && $did(3)) {
    var %password = $did(2)
    if ($numtok(%password,32) == 1) {
      if (%password === $did(3)) {
        if ($len(%password) >= 6) { qnsc.msg_log 0 1 /MSG Q NEWPASS $did(1) %password %password | dialog -x qnsc.ch_pass.dlg }
        else { return $input(Password is too short, minimum is 6 characters.,ow,Invalid Password) }
      }
      else { return $input(The passwords do not match.,ow,Invalid Password) }
    }
    else { return $input(The Password cannot contain spaces.,ow,Invalid Password) }
  }
  else { return $input(Please fill in all the fields.,ow,Invalid Password) }
}

;History Tab
on *:dialog:qnsc.main.dlg:DCLICK:27:clipboard $gettok($did(qnsc.main.dlg,27).seltext,12-,32)
on *:dialog:qnsc.main.dlg:sclick:28: { write -c $+(",$scriptdir,qnsc.history.log,") | did -r qnsc.main.dlg 27 }


;==_Warning Dialog_==
on *:dialog:qnsc.war.dlg:sclick:3:. $+ $did(7)
on *:dialog:qnsc.war.dlg:sclick:2:dialog -x $dname
on *:dialog:qnsc.war.dlg:sclick:5:. $+ $did(7) | dialog -x $dname


;==_About Dialog_==
on *:dialog:qnsc.about.dlg:sclick:5:.run mailto:intenz44@hotmail.com.com
on *:dialog:qnsc.about.dlg:sclick:9:.url http://www.quakenet.org/
on *:dialog:qnsc.about.dlg:sclick:15:.url http://www.mirc.com/get.html


;==_Help Dialog_==
on *:dialog:qnsc.readme.dlg:sclick:3: {
  did -i qnsc.readme.dlg 3 1 page haselect
  var %sel = $gettok($did(qnsc.readme.dlg, 3, 1), 4-, 32)
  var %branchtext, %final
  var %i = $numtok(%sel,32)
  while (%i) {
    %sel = $gettok(%sel,1- $+ %i,32)
    dec %i
    did -i qnsc.readme.dlg 3 1 cb root %sel up
    %branchtext = $replace($gettok($did($dname,$did,$gettok(%sel,-1,32)),7-,32),$chr(45),$chr(35))
    %final = %branchtext $+ - $+ %final
  }
  qnsc.readme.loadbuf $gettok(%final,2-,45)
}

;==_Say Hello_==
on *:dialog:qnsc.say_hello.dlg:sclick:7: {
  if ($did(1) && $did(2)) {
    if ($did(1) == $did(2)) {
      if ($qnsc.val_email($did(1)) == 1) {
        .MSG Q HELLO $did(1) $did(2)
        dialog -x qnsc.say_hello.dlg
      }
    }
    else { return $input(E-mail address' do not match.,ovw,Invalid E-mail) }
  }
  else { return $input(Please fill in all the fields.,ovw,Invalid E-mail) }
}

;=MOUSE EVENT==========================================================================================================
#qnsc.mouse_over on

on *:dialog:qnsc.main.dlg:mouse:17:qnsc.status 0 $did Channels that you are known on.
;User Flags
on *:dialog:qnsc.main.dlg:mouse:14:qnsc.status 0 $did Changes $did(18) $+ 's flags to + $+ $did(19) $+ .
on *:dialog:qnsc.main.dlg:mouse:76:qnsc.status 0 $did Select a nick to add. User must be authed with Q.
on *:dialog:qnsc.main.dlg:mouse:77:qnsc.status 0 $did Adds $did(76).seltext with channel flags + $+ $did(19) to $qnsc.htbl_read(channel) $+ .
on *:dialog:qnsc.main.dlg:mouse:102:qnsc.status 0 $did Authename, $did(18) $+ , will be banned from $qnsc.htbl_read(channel) $+ .
on *:dialog:qnsc.main.dlg:mouse:103:qnsc.status 0 $did Can set topic on $qnsc.htbl_read(channel) $+ .
;Channel Management
;-Common
on *:dialog:qnsc.main.dlg:mouse:34:qnsc.status 0 $did Cleares channelmodes +i, +k, +l and +m from $qnsc.htbl_read(channel) $+ .
on *:dialog:qnsc.main.dlg:mouse:35:qnsc.status 0 $did Gives you ops on $qnsc.htbl_read(channel) $+ .
on *:dialog:qnsc.main.dlg:mouse:37:qnsc.status 0 $did Deops everyone on $qnsc.htbl_read(channel) $+ .
on *:dialog:qnsc.main.dlg:mouse:43:qnsc.status 0 $did Invites you to join $qnsc.htbl_read(channel) $+ .
on *:dialog:qnsc.main.dlg:mouse:40:qnsc.status 0 $did Gives you voice on $qnsc.htbl_read(channel) $+ .
on *:dialog:qnsc.main.dlg:mouse:42:qnsc.status 0 $did Unbans all bans on $qnsc.htbl_read(channel) $+ .
;-L Bot Specific
on *:dialog:qnsc.main.dlg:mouse:36:qnsc.status 0 $did L will enforce +i on $qnsc.htbl_read(channel) $+ .
on *:dialog:qnsc.main.dlg:mouse:41:qnsc.status 0 $did Removes the +i enforce by L on $qnsc.htbl_read(channel) $+ .
on *:dialog:qnsc.main.dlg:mouse:38:qnsc.status 0 $did Same as doing DEOPALL, UNBANALL, CLEARCHAN all at once.
on *:dialog:qnsc.main.dlg:mouse:75:qnsc.status 0 $did Removes L from $qnsc.htbl_read(channel) (use with caution).
;-Edit Welcome Message
on *:dialog:qnsc.main.dlg:mouse:45:qnsc.status 0 $did Applies setting in welcome message on $qnsc.htbl_read(channel) $+ .
on *:dialog:qnsc.main.dlg:mouse:127:qnsc.status 0 $did Enable or disable welcome message on $qnsc.htbl_read(channel) $+ .
;Q Bot Specific
;-BANLIST
on *:dialog:qnsc.main.dlg:mouse:109:qnsc.status 0 $did Add a new host mask to the Banlist on $qnsc.htbl_read(channel) $+ .
on *:dialog:qnsc.main.dlg:mouse:107:qnsc.status 0 $did Deletes the selected ban from $qnsc.htbl_read(channel) $+ .
on *:dialog:qnsc.main.dlg:mouse:108:qnsc.status 0 $did Deletes all the bans from $qnsc.htbl_read(channel) $+ .
;-Force Topic
on *:dialog:qnsc.main.dlg:mouse:126:qnsc.status 0 $did Applies setting in force topic on $qnsc.htbl_read(channel) $+ .
on *:dialog:qnsc.main.dlg:mouse:125:qnsc.status 0 $did Enable or disable force topic on $qnsc.htbl_read(channel) $+ .
;-Chanflags
on *:dialog:qnsc.main.dlg:mouse:116:qnsc.status 0 $did Set a max permanent user-limit on a channel.
on *:dialog:qnsc.main.dlg:mouse:112:qnsc.status 0 $did Limit will be adjusted automatically to avoid join floods.
on *:dialog:qnsc.main.dlg:mouse:114:qnsc.status 0 $did Set a permanent key on a channel.
on *:dialog:qnsc.main.dlg:mouse:49:qnsc.status 0 $did Prevents users who hasn't got +o flag from getting OP.
on *:dialog:qnsc.main.dlg:mouse:137:qnsc.status 0 $did Prevent users who have +o/+v from being deopped/devoiced.
on *:dialog:qnsc.main.dlg:mouse:138:qnsc.status 0 $did Allow Q to set the topic if Q is restarted.
on *:dialog:qnsc.main.dlg:mouse:111:qnsc.status 0 $did Applies all the settings above.
;WHOAMI
on *:dialog:qnsc.main.dlg:mouse:39:qnsc.status 0 $did Updates the WHOAMI.
on *:dialog:qnsc.main.dlg:mouse:72:qnsc.status 0 $did Changes your flags.
on *:dialog:qnsc.main.dlg:mouse:100:qnsc.status 0 $did Change your E-mail. Used if you have forgotten password.
on *:dialog:qnsc.main.dlg:mouse:101:qnsc.status 0 $did Change your Q-Auth account password.
;Check Boxes
on *:dialog:qnsc.main.dlg:mouse:8,66:qnsc.status 0 $did Auto, used with +o/+v flags.
on *:dialog:qnsc.main.dlg:mouse:9,71:qnsc.status 0 $did Channel operator, can have the mode +o for the channel.
on *:dialog:qnsc.main.dlg:mouse:10,67:qnsc.status 0 $did Voice, can have mode +v for the channel.
on *:dialog:qnsc.main.dlg:mouse:11,70:qnsc.status 0 $did Auto, same as +a but only works with +v flag.
on *:dialog:qnsc.main.dlg:mouse:12,68:qnsc.status 0 $did Channel master. Can add and remove users for the channel.
on *:dialog:qnsc.main.dlg:mouse:13,69:qnsc.status 0 $did Channel owner. Has full access over the channel.
;History
on *:dialog:qnsc.main.dlg:mouse:28:qnsc.status 0 $did Clears the history.

#qnsc.mouse_over end

;=OTHER EVENTs=========================================================================================================
on *:dialog:qnsc.main.dlg:close:*:unset %qnsc.* | .timerqnsc* off | hfree qnsc_htbl

;=NOTICE===============================================================================================================
raw 401:*:{ if (%qnsc.action) { if ($1- == $me Q No such nick || $1- == $me L No such nick) { halt | return $input(Q or L are not currently on the network, a net split mey have occured.,ow,Q or L No such nick) } } }
on ^*:NOTICE:*:?: {
  if ($nick == L || $nick == Q) {
    ;Make sure this script triggered it
    if (%qnsc.action) {
      if ($qnsc.debug) { echo 3 -s $1- }
      ;Interperate L WHOAMI
      if (%qnsc.L_whoami) {
        if ($1- == You are not authed. Please auth with Q before sending me commands.) {
          unset %qnsc.*
          .timerqnsc* off
          hfree qnsc_htbl
          dialog -x qnsc.main.dlg
          haltdef
          .timerqnsc.dlg 1 0.25 qnsc.ti.ask_auth
          return
        }
        elseif ($istok($1-,authed,32)) { did -ra qnsc.main.dlg 57 $5 | qnsc.htbl_add authname_my $5 | haltdef | return }
        elseif ($1- == $qnsc.htbl_read(authname_my) is not known on any channels.) {
          unset %qnsc.L_whoami
          qnsc.prog_bar 10
          ;Gets Q WHOAMI ready
          set %qnsc.Q_whoami $true
          set %qnsc.Q_whoami_tmp 0
          qnsc.msg_log 0 0 /MSG Q WHOAMI

        }
        elseif ($chr(35) isin $1-) {
          did -a qnsc.main.dlg 17 $1
          did -a qnsc.main.dlg 56 $1 $chr(9) L $chr(9) $2
        }
        elseif ($1- == End of list.) {
          unset %qnsc.L_whoami
          qnsc.prog_bar 10
          ;Gets Q WHOAMI ready
          set %qnsc.Q_whoami $true
          set %qnsc.Q_whoami_tmp 0
          qnsc.msg_log 0 0 /MSG Q WHOAMI
        }
        haltdef
        return
      }
      ;Interperate Q WHOAMI
      if (%qnsc.Q_whoami) {
        if ($1 == Access) { var %tmp = $left($6,-1) | did -a qnsc.main.dlg 17 %tmp | did -a qnsc.main.dlg 56 %tmp $chr(9) Q $chr(9) $right($3,-1) }
        elseif ($1 == Global) { did -ra qnsc.main.dlg 96 $4 }
        elseif ($3 == authed) { did -ra qnsc.main.dlg 98 $6 }
        elseif ($1 == E-mail:) { did -ra qnsc.main.dlg 94 $2 | if ($chan(0) == 0) { qnsc.endwhoami } }
        elseif ($1 == You) { inc %qnsc.Q_whoami_tmp 1 | if (%qnsc.Q_whoami_tmp == $chan(0)) { qnsc.endwhoami } }
        haltdef
        return
      }
      ;Interperate CHANLEV
      if (%qnsc.chanlev) {
        if ($qnsc.htbl_read(active_bot) == L) {
          if ($$1- == Sorry, you do not have permission to view/change user flags on $qnsc.htbl_read(channel) $+ . ) {
            unset %qnsc.*
            did -e qnsc.main.dlg 17,39,100,101
            qnsc.status 1 0 You are not known on this channel and can't dump the userlist!
            qnsc.prog_bar 0
            haltdef
            return
          }
          elseif ($1- == Unknown channel $qnsc.htbl_read(channel) $+ .) {
            unset %qnsc.*
            did -e qnsc.main.dlg 17,39,100,101
            qnsc.status 1 0 $1-
            qnsc.prog_bar 0
            haltdef
            return
          }
          elseif (%qnsc.loopnum >= 3) {
            if ($1- == End of chanlev for $qnsc.htbl_read(channel) $+ .) {
              unset %qnsc.chanlev %qnsc.loopnum
              qnsc.prog_bar 75
              if (!%qnsc.action_stop) {
                ;Gets WELCOME ready
                set %qnsc.welcome $true
                qnsc.msg_log 0 0 /MSG L WELCOME $qnsc.htbl_read(channel)
              }
              else { qnsc.end_getinfo }
              haltdef
              return
            }
            else { did -a qnsc.main.dlg 7 $1 $chr(9) $2 | if ($1 == $qnsc.htbl_read(authname_my)) { qnsc.htbl_add uflag_my $2 } }
          }
          inc %qnsc.loopnum 1
          haltdef
          return
        }
        elseif ($qnsc.htbl_read(active_bot) == Q) {
          if ($1- == You are not known or banned on this channel and can't dump the userlist!) {
            unset %qnsc.*
            did -e qnsc.main.dlg 17,39,100,101
            qnsc.status 1 0 You are not known on this channel and can't dump the userlist!
            qnsc.prog_bar 0
            haltdef
            return
          }
          elseif (%qnsc.loopnum >= 2) {
            if ($1- == End of list.) {
              unset %qnsc.chanlev %qnsc.loopnum
              qnsc.prog_bar $iif(m isin $qnsc.htbl_read(uflag_my) || n isin $qnsc.htbl_read(uflag_my),30,50)
              if (!%qnsc.action_stop) {
                ;Gets Q's BanList ready
                set %qnsc.Q_banlist $true
                qnsc.msg_log 0 0 /MSG Q BANLIST $qnsc.htbl_read(channel)
              }
              else { qnsc.end_getinfo }
              haltdef
              return
            }
            else { if ($1 == $qnsc.htbl_read(authname_my)) { qnsc.htbl_add uflag_my $3 } | did -a qnsc.main.dlg 7 $1 $chr(9) $right($3,-1) }
          }
          inc %qnsc.loopnum 1
          haltdef
          return
        }
      }
      ;Interperate Q's BanList
      if (%qnsc.Q_banlist) {
        if ($left($1,1) == $chr(35)) { did -a qnsc.main.dlg 105 $1 $chr(9) $2 $chr(9) $3 }
        elseif ($1- == End of list.) {
          unset %qnsc.Q_banlist %qnsc.action
          if (!%qnsc.action_stop) {
            qnsc.prog_bar $iif(m isin $qnsc.htbl_read(uflag_my) || n isin $qnsc.htbl_read(uflag_my),40,70)
            ;Gets Q's Chanflags ready
            set %qnsc.loopnum 0
            set %qnsc.Q_chanflags $true
            qnsc.msg_log 0 0 /MSG Q CHANFLAGS $qnsc.htbl_read(channel)
          }
          else { qnsc.end_getinfo }
        }
        haltdef
        return
      }
      ;Interperate Q's Chanflags
      if (%qnsc.Q_chanflags) {
        if (b isin $5) { did -c qnsc.main.dlg 49 }
        if (c isin $5) { did -c qnsc.main.dlg 112 }
        if (f isin $5) { did -ra qnsc.main.dlg 125 Enabled | did -c qnsc.main.dlg 125 }
        else { did -ra qnsc.main.dlg 125 Disabled }
        if (k isin $5) { did -c qnsc.main.dlg 114 }
        if (l isin $5) { did -c qnsc.main.dlg 116 }
        if (p isin $5) { did -c qnsc.main.dlg 137 }
        if (t isin $5) { did -c qnsc.main.dlg 138 }
        if (w isin $5) { did -ra qnsc.main.dlg 127 Enabled | did -c qnsc.main.dlg 127 }
        else { did -ra qnsc.main.dlg 127 Disabled | did -u qnsc.main.dlg 127 }
        unset %qnsc.Q_chanflags %qnsc.action
        if (m isin $qnsc.htbl_read(uflag_my) || n isin $qnsc.htbl_read(uflag_my) || t isin $qnsc.htbl_read(uflag_my)) {
          qnsc.prog_bar $iif($ifmatch == t,85,50)
          ;Gets Q's Settopic ready
          %qnsc.loopnum = 0
          set %qnsc.Q_settopic $true
          qnsc.msg_log 0 0 /MSG Q SETTOPIC $qnsc.htbl_read(channel)
        }
        else { qnsc.end_getinfo }
        haltdef
        return
      }
      ;Interperate Q's Settopic
      if (%qnsc.Q_settopic) {
        inc %qnsc.loopnum 1
        if (%qnsc.loopnum == 2) { did -a qnsc.main.dlg 120 $1- | qnsc.prevbmp 2 122 $color(topic) 413 $1- | qnsc.htbl_add scroll_topic 2 }
        elseif (%qnsc.loopnum == 3) {
          unset %qnsc.Q_settopic %qnsc.action %qnsc.loopnum
          if (m isin $qnsc.htbl_read(uflag_my) || n isin $qnsc.htbl_read(uflag_my)) {
            qnsc.prog_bar 60
            ;Gets WELCOME ready
            set %qnsc.loopnum 0
            set %qnsc.welcome $true
            qnsc.msg_log 0 0 /MSG Q WELCOME $qnsc.htbl_read(channel)
          }
          else { qnsc.end_getinfo }
        }
        haltdef
        return
      }
      ;Interperate Welcome Message
      if (%qnsc.welcome) {
        if ($qnsc.htbl_read(active_bot) == L) {
          if ($1- == No welcome message is set for channel $did(qnsc.main.dlg,17)) { did -ra qnsc.main.dlg 127 Disabled | did -u qnsc.main.dlg 127 }
          else {
            did -a qnsc.main.dlg 44 $7-
            qnsc.prevbmp 2 47 $color(notice) 365 $7-
            did -ra qnsc.main.dlg 127 Enabled
            did -c qnsc.main.dlg 127
          }
          qnsc.htbl_add scroll_welcome 2
          qnsc.end_getinfo
        }
        elseif ($qnsc.htbl_read(active_bot) == Q) {
          inc %qnsc.loopnum 1
          if (%qnsc.loopnum == 2) { did -a qnsc.main.dlg 44 $1- | qnsc.prevbmp 2 47 $color(notice) 365 $1- }
          elseif (%qnsc.loopnum == 4) {
            qnsc.htbl_add scroll_welcome 2
            unset %qnsc.welcome %qnsc.action %qnsc.loopnum
            qnsc.prog_bar 70
            ;Gets Q's Key ready
            set %qnsc.Q_key $true
            qnsc.msg_log 0 0 /MSG Q KEY $qnsc.htbl_read(channel)
          }
        }
        haltdef
        return
      }
      ;Interperate Q's Key
      if (%qnsc.Q_key) {
        did -a qnsc.main.dlg 115 $6-
        unset %qnsc.Q_key %qnsc.action
        qnsc.prog_bar 80
        ;Gets Q's Limit ready
        set %qnsc.Q_limit $true
        qnsc.msg_log 0 0 /MSG Q LIMIT $qnsc.htbl_read(channel)
        haltdef
        return
      }
      ;Interperate Q's Limit
      if (%qnsc.Q_limit) {
        did -a qnsc.main.dlg 117 $6-
        unset %qnsc.Q_limit %qnsc.action
        qnsc.prog_bar 90
        ;Gets Q's AutoLimit ready
        set %qnsc.Q_autolimit $true
        qnsc.msg_log 0 0 /MSG Q AUTOLIMIT $qnsc.htbl_read(channel)
        haltdef
        return
      }
      ;Interperate Q's AutoLimit
      if (%qnsc.Q_autolimit) {
        did -a qnsc.main.dlg 113 $4-
        unset %qnsc.Q_autolimit %qnsc.action
        qnsc.end_getinfo
        haltdef
        return
      }
      ;logging Confermation from L
      if (%qnsc.wait.done) {
        unset %qnsc.action %qnsc.wait.done
        if ($1- == Done. || $1- == OK, password changed. || $2- == bans removed from channel. || $gettok($1-,1-4,32) == Auto-limit is changed to:) {
          if (%qnsc.wait.getinfo) {
            if (%qnsc.wait.getinfo_var) { set %qnsc. [ $+ [ %qnsc.wait.getinfo_var ] ] $true }
            unset %qnsc.wait.getinfo_var %qnsc.wait.getinfo
            if ($numtok(%qnsc.wait.getinfo_com,25) > 1) {
              qnsc.msg_log $gettok(%qnsc.wait.getinfo_com,1,25)
              set %qnsc.wait.getinfo $true
              set %qnsc.wait.getinfo_com $gettok(%qnsc.wait.getinfo_com,2-,25)
              set %qnsc.wait.getinfo_var 0
            }
            else { qnsc.msg_log %qnsc.wait.getinfo_com | unset %qnsc.wait.getinfo_com }
          }
          qnsc.status 0 0 Successful.
        }
        elseif ($1- == OK, E-mail changed.) { did -ra qnsc.main.dlg 94 %qnsc.email.tmp | qnsc.status 0 0 Successful. | unset %qnsc.email.tmp }
        elseif ($1- == Incorrect password.) { .timerqnsc.dlg 1 0.25 qnsc.ti.wrong_pass }
        else { qnsc.error ERROR in QNSC! $qnsc.htbl_read(active_bot) said: $1- }
        qnsc.msg_log 1 0 $1-
        haltdef
        return
      }
      ;Interperate WHOIS
      if (%qnsc.whois) {
        if ($qnsc.htbl_read(active_bot) == L) {
          if ($1- == User $did(qnsc.main.dlg,76).seltext is not authed) {
            qnsc.status 1 0 Ready.
            qnsc.prog_bar 100
            unset %qnsc.whois %qnsc.action
            .timerqnsc.dlg 1 0.25 qnsc.ti.usr_nt_auth $1-
          }
          elseif ($istok($1-,authed,32)) { qnsc.htbl_add authname_user $remove($5,.) | qnsc.prog_bar 40 }
          elseif ($1- == $qnsc.htbl_read(authname_user) is not known on any channels.) {
            qnsc.status 1 0 Ready.
            qnsc.prog_bar 100
            unset %qnsc.whois %qnsc.action
            qnsc.enable_check
            did -e qnsc.main.dlg 77
            did -b qnsc.main.dlg 14
            did -a qnsc.main.dlg 18 $qnsc.htbl_read(authname_user)
          }
          elseif ($1 == $qnsc.htbl_read(channel)) { qnsc.htbl_add uflag_user $2 | qnsc.prog_bar 60 }
          elseif ($1- == End of list.) {
            qnsc.status 1 0 Ready.
            qnsc.prog_bar 100
            unset %qnsc.whois %qnsc.action
            qnsc.enable_check
            if ($qnsc.htbl_read(uflag_user) == 0) {
              did -a qnsc.main.dlg 18 $qnsc.htbl_read(authname_user)
              did -e qnsc.main.dlg 77
              did -b qnsc.main.dlg 14
            }
            else {
              qnsc.status 0 0 $qnsc.htbl_read(authname_user) is already known on this channel.
              did -a qnsc.main.dlg 18 $qnsc.htbl_read(authname_user)
              did -a qnsc.main.dlg 19 $qnsc.htbl_read(uflag_user)
              did -b qnsc.main.dlg 77
              qnsc.check_boxes
            }
          }
          haltdef
          return
        }
        if ($qnsc.htbl_read(active_bot) == Q) {
          if ($2- == is NOT authed) {
            qnsc.status 1 0 Ready.
            .timerqnsc.dlg 1 0.25 qnsc.ti.usr_nt_auth $1-
            set %qnsc.whois_tmp $true
          }
          elseif (%qnsc.whois_tmp) { unset %qnsc.whois %qnsc.whois_tmp %qnsc.action | qnsc.prog_bar 100 }
          elseif ($gettok($1-,2-4,32) == is authed as) { qnsc.htbl_add authname_user $remove($5,.) | qnsc.prog_bar 40 }
          elseif ($gettok($1-,1-2,32) == Access level) { if ($6 == $qnsc.htbl_read(channel)) { qnsc.htbl_add uflag_user $remove($3,+) | qnsc.prog_bar 60 } }
          elseif ($1- == End of list. || $1- == User not known in any channels.) {
            qnsc.status 1 0 Ready.
            qnsc.prog_bar 100
            unset %qnsc.whois %qnsc.action
            qnsc.enable_check
            if ($qnsc.htbl_read(uflag_user) == 0) {
              did -a qnsc.main.dlg 18 $qnsc.htbl_read(authname_user)
              did -e qnsc.main.dlg 77
              did -b qnsc.main.dlg 14
            }
            else {
              qnsc.status 0 0 $qnsc.htbl_read(authname_user) is already known on this channel.
              did -a qnsc.main.dlg 18 $qnsc.htbl_read(authname_user)
              did -a qnsc.main.dlg 19 $qnsc.htbl_read(uflag_user)
              did -b qnsc.main.dlg 77
              qnsc.check_boxes
            }
          }
          haltdef
          return
        }
      }
      ;Removing L from a channel
      if (%qnsc.L_remove) {
        if ($1 == Done.) {
          haltdef
          if (%qnsc.L_remove_user < $did(qnsc.main.dlg,7).lines) {
            inc %qnsc.L_remove_user 1
            if ($gettok($did(qnsc.main.dlg,7,%qnsc.L_remove_user).text,6,32) != $qnsc.htbl_read(authname_my)) {
              qnsc.prog_bar $int($calc(((%qnsc.L_remove_user - 1) / %qnsc.L_remove_progbar) * 100))
              qnsc.msg_log 1 0 /MSG L REMOVEUSER $qnsc.htbl_read(channel) $chr(35) $+ $gettok($did(qnsc.main.dlg,7,%qnsc.L_remove_user).text,6,32)
            }
          }
          else {
            unset %qnsc.L_remove* %qnsc.action
            set %qnsc.getinfo_type 2
            did -c qnsc.main.dlg 31
            if ($did(qnsc.main.dlg,7).lines != 2) {
              qnsc.restore_dlg
              qnsc.status 1 0 Retrieving...
              qnsc.prog_bar 0
              qnsc.prevbmp 2 47 $color(notice) 365
              qnsc.prevbmp 2 122 $color(topic) 413
              set %qnsc.wait.getinfo $true
              set %qnsc.wait.getinfo_com 0 0 /MSG L WHOAMI
              set %qnsc.wait.getinfo_var L_whoami
              qnsc.msg_log 1 1 /MSG L REMOVEUSER $qnsc.htbl_read(channel) $chr(35) $+ $qnsc.htbl_read(authname_my)
            }
            else { qnsc.getinfo }
            .timerqnsc.dlg 1 0.25 qnsc.ti.L_rmv
          }
          return
        }
      }
      else { qnsc.error ERROR in QNSC! "%qnsc.active" is true when it should be unset. }
    }
  }
}

;=Common ALIAS=========================================================================================================
;MDX Directories
alias -l mdx.bars return $scriptdirmdx\bars.mdx
alias -l mdx.ctl_gen return $scriptdirmdx\ctl_gen.mdx
alias -l mdx.views return $scriptdirmdx\views.mdx
alias -l mdx return $dll($scriptdirmdx\mdx.dll,$$1,$2-)
;Hash Table stuffs
alias -l qnsc.htbl_add hadd qnsc_htbl $1 $2-
alias -l qnsc.htbl_read return $hget(qnsc_htbl, $1)
;Script Specific
alias -l qnsc.readme_file return $+(",$scriptdir,qnsc-readme.txt,")
alias -l qnsc.version return 2.0
alias -l qnsc.debug return $false
alias qnsc {
  if ($1 == help) { dialog -m qnsc.readme.dlg qnsc.readme.dlg }
  else {
    if ($right($server,13) == .quakenet.org) {
      if (!$dialog(qnsc.main.dlg)) {
        hmake qnsc_htbl 10
        if ($chan) { qnsc.htbl_add channel $chan }
        dialog -m qnsc.main.dlg qnsc.main.dlg
      }
    }
    else { unset %qnsc.* | return $input(You need to be on the QuakeNet IRC Network to be able to use this script. $crlf $+ irc.QuakeNet.org,ow,irc.QuakeNet.org) }
  }
}

;=Sub-Routine ALIAS====================================================================================================
alias -l qnsc.enable_add_nick { did -b qnsc.main.dlg 76 | if ($qnsc.htbl_read(active_bot) == L || $qnsc.htbl_read(active_bot) == Q) && (m isin $qnsc.htbl_read(uflag_my) || n isin $qnsc.htbl_read(uflag_my)) { did -e qnsc.main.dlg 76 } }
alias -l qnsc.ti.wrong_pass { return $input(Incorrect password. Please try again.,ow,Incorrect Password) }
alias -l qnsc.ti.ask_auth { if ($input(You are not authed. Please auth with Q before carrying on.,yw,Auth With Q)) { dialog -rmv qnsc.say_hello.dlg qnsc.say_hello.dlg } }
alias -l qnsc.ti.error { return $input(An ERROR has occurred in the QuakeNet's Service Control script. Please inform the author and try to include as much information on how this error occurred. $+ $crlf $+ E-mail: intenz44@hotmail.com $+ $crlf $+ (More info is printed in the status window.),oh,ERROR in Script) }
alias -l qnsc.ti.usr_nt_auth { return $input($1- $+ . Please get him/her to auth with Q and try again.,ow,User Not Authed) }
alias -l qnsc.ti.L_rmv { return $input(L has been removed. If you did not intend to remove L you could try to retrieve it on the QuakeNet web page.,ow,L Removed) }
alias -l qnsc.ti { return $input($gettok($1-,1,25),$gettok($1-,2,25),$gettok($1-,3,25)) }
alias -l qnsc.unload_script {
  if ($input(Are you sure you want to unload QuakeNet's Service Control?,yw,Are You Sure ?)) { unload -rs qnsc.mrc }
}
;Restore Main Dialog
alias -l qnsc.restore_dlg {
  did -r qnsc.main.dlg 105,7,73,18,19,44,117,113,115,120,94,57,17,76,56,98,96
  did -u qnsc.main.dlg 7,8,10,12,9,11,13,102,103,127,116,112,114,125,66,67,68,69,70,71,7,105,56,49,137,138
  did -b qnsc.main.dlg 73,44,117,113,115,120,17,76,103,102,13,11,9,12,10,8,49,137,138,125,114,112,116,127,71,70,69,68,67,66,14,34,35,36,37,43,38,40,41,42,75,55,54,45,107,108,109,123,124,126,111,72,101,100,39,77
  did -ra qnsc.main.dlg 127,125 Disabled
}
alias -l qnsc.check_boxes {
  if (a isin $qnsc.htbl_read(uflag_user)) { did -c qnsc.main.dlg 8 }
  if (o isin $qnsc.htbl_read(uflag_user)) { did -c qnsc.main.dlg 9 }
  if (v isin $qnsc.htbl_read(uflag_user)) { did -c qnsc.main.dlg 10 }
  if (g isin $qnsc.htbl_read(uflag_user)) { did -c qnsc.main.dlg 11 }
  if (m isin $qnsc.htbl_read(uflag_user)) { did -c qnsc.main.dlg 12 }
  if (n isin $qnsc.htbl_read(uflag_user)) { did -c qnsc.main.dlg 13 }
  if (t isin $qnsc.htbl_read(uflag_user)) { did -c qnsc.main.dlg 103 }
  if (b isin $qnsc.htbl_read(uflag_user)) { did -c qnsc.main.dlg 102 }
}
;Gets info from Q and L
alias -l qnsc.getinfo {
  qnsc.restore_dlg
  qnsc.status 1 0 Retrieving...
  qnsc.prog_bar 0
  qnsc.prevbmp 2 47 $color(notice) 365
  qnsc.prevbmp 2 122 $color(topic) 413
  set %qnsc.L_whoami $true
  qnsc.msg_log 0 0 /MSG L WHOAMI
}
;Finish off WHOAMI
alias -l qnsc.endwhoami {
  ;The End of WHOAMIs' ;p
  if (%qnsc.getinfo_type == 1) {
    unset %qnsc.Q_whoami_tmp %qnsc.Q_whoami %qnsc.action
    var %i = 0
    var %chan = $qnsc.htbl_read(channel)
    var %bot
    while (%i < $did(qnsc.main.dlg,17).lines) {
      inc %i 1
      if (%chan == $did(qnsc.main.dlg,17,%i)) { did -c qnsc.main.dlg 17 %i | goto Break }
    }
    :Break
    ;Gets CHANLEV ready
    did -r qnsc.main.dlg 7
    %qnsc.loopnum = 0
    set %qnsc.chanlev $true
    var %i = 1
    while (%i < $did(qnsc.main.dlg,56).lines) {
      inc %i
      if ($gettok($did(qnsc.main.dlg,56,%i),6,32) == %chan) { %bot = $gettok($did(qnsc.main.dlg,56,%i),11,32) }
    }
    if (%bot == Q) { qnsc.htbl_add active_bot Q | qnsc.prog_bar 20 }
    elseif (%bot == L) { qnsc.htbl_add active_bot L | qnsc.prog_bar 50 }
    else {
      unset %qnsc.*
      did -e qnsc.main.dlg 17,39,100,101
      qnsc.status 1 0 A Service Bot is not present or you are unknown on the channel.
      qnsc.prog_bar 0
      return
    }
    qnsc.msg_log 0 0 /MSG $qnsc.htbl_read(active_bot) CHANLEV %chan
  }
  else {
    unset %qnsc.*
    did -c qnsc.main.dlg 31
    did -e qnsc.main.dlg 17,39,100,101
    qnsc.status 1 0 Ready.
    qnsc.prog_bar 100
  }
}
;Finish off getinfo
alias -l qnsc.end_getinfo {
  unset %qnsc.*
  qnsc.enablemodes
  qnsc.fillnicks
  qnsc.enable_add_nick
  did -e qnsc.main.dlg 17,39,100,101
  qnsc.status 1 0 Ready.
  qnsc.prog_bar 100
}
;Fills the Add nick combo box
alias -l qnsc.fillnicks {
  did -r qnsc.main.dlg 76
  var %i = 0
  var %chan = $qnsc.htbl_read(channel)
  while (%i < $nick(%chan,0)) {
    inc %i 1
    if ($nick(%chan,%i) != $me) && ($nick(%chan,%i) != L) && ($nick(%chan,%i) != Q) { did -a qnsc.main.dlg 76 $nick(%chan,%i) }
  }
}
;Enable user access rights based on user level
alias -l qnsc.enablemodes {
  did -b qnsc.main.dlg 116,117,112,113,114,115,111,120,123,124,125,126,107,108,109,45,54,55,127,44,42,40,43,37,35,34,38,41,75,36,49,137,138
  if ($qnsc.htbl_read(active_bot) == L) {
    if (m isin $qnsc.htbl_read(uflag_my)) { did -e qnsc.main.dlg 36,41,38,34,35,37,43,40,42,44,127,55,54,45 }
    if (o isin $qnsc.htbl_read(uflag_my)) { did -e qnsc.main.dlg 35,43,42 }
    if (v isin $qnsc.htbl_read(uflag_my)) { did -e qnsc.main.dlg 43,40 }
    if (n isin $qnsc.htbl_read(uflag_my)) { did -e qnsc.main.dlg 36,41,38,34,35,37,43,40,42,44,127,55,54,45,75 }
  }
  elseif ($qnsc.htbl_read(active_bot) == Q) {
    if (m isin $qnsc.htbl_read(uflag_my)) { did -e qnsc.main.dlg 44,127,55,54,45,116,117,112,113,114,115,111,34,35,37,43,40,42,123,124,125,126,120,109,108,49,137,138 }
    if (o isin $qnsc.htbl_read(uflag_my)) { did -e qnsc.main.dlg 35,43 }
    if (v isin $qnsc.htbl_read(uflag_my)) { did -e qnsc.main.dlg 40 }
    if (t isin $qnsc.htbl_read(uflag_my)) { did -e qnsc.main.dlg 120,123,124,126 }
    if (n isin $qnsc.htbl_read(uflag_my)) { did -e qnsc.main.dlg 44,127,55,54,45,116,117,112,113,114,115,111,126,125,124,123,120,109,108,42,40,43,37,35,34,49,137,138 }
  }
}
alias -l qnsc.enable_check {
  did -b qnsc.main.dlg 8,9,10,11,12,13,102,103,14,77
  var %my_flag = $qnsc.htbl_read(uflag_my)
  var %user_flag = $qnsc.htbl_read(uflag_user)
  if (m isin %my_flag || n isin %my_flag) {
    if ($qnsc.htbl_read(active_bot) == L) {
      if (m isin %my_flag) { did -e qnsc.main.dlg 8,9,10,11,14 }
      if ($qnsc.htbl_read(authname_my) != $qnsc.htbl_read(authname_user)) {
        if ((n isin %user_flag) || (m isin %user_flag)) { did -b qnsc.main.dlg 8,9,10,11,14 | qnsc.status 0 0 You have to be owner to change a master's flags! }
      }
      if (n isin %my_flag) { did -e qnsc.main.dlg 8,9,10,11,12,13,14 }
    }
    elseif ($qnsc.htbl_read(active_bot) == Q) {
      if (m isin %my_flag) { did -e qnsc.main.dlg 8,9,10,11,102,103,14 }
      if ($qnsc.htbl_read(authname_my) != $qnsc.htbl_read(authname_user)) {
        if ((n isin %user_flag) || (m isin %user_flag)) { did -b qnsc.main.dlg 8,9,10,11,14,102,103 | qnsc.status 0 0 You have to be owner to change a master's flags! }
      }
      if (n isin %my_flag) { did -e qnsc.main.dlg 8,9,10,11,12,13,102,103,14 }
    }
  }
  else { qnsc.status 0 0 You're not the owner or master of $qnsc.htbl_read(channel) $+ . }
}
alias -l qnsc.update.flags {
  var %s
  if ($did(8).state) { %s = %s $+ +a } | else { %s = %s $+ -a }
  if ($did(10).state) { %s = %s $+ +v } | else { %s = %s $+ -v }
  if ($did(9).state) { %s = %s $+ +o } | else { %s = %s $+ -o }
  if ($did(12).enabled) { if ($did(12).state) { %s = %s $+ +m } | else { %s = %s $+ -m } }
  if ($did(13).enabled) { if ($did(13).state) { %s = %s $+ +n } | else { %s = %s $+ -n } }
  if ($did(11).state) { %s = %s $+ +g } | else { %s = %s $+ -g }
  if ($did(103).enabled) { if ($did(103).state) { %s = %s $+ +t } | else { %s = %s $+ -t } }
  if ($did(102).enabled) { if ($did(102).state) { %s = %s $+ +b } | else { %s = %s $+ -b } }
  did -u qnsc.main.dlg 8,9,10,11,12,13,102,103
  did -r qnsc.main.dlg 7,18,19,17
  did -b qnsc.main.dlg 8,9,10,11,12,13,14,102,103,77
  if ($qnsc.htbl_read(authname_user) == $qnsc.htbl_read(authname_my)) {
    did -r qnsc.main.dlg 56,57,94,98,96,73
    did -b qnsc.main.dlg 66,67,68,69,70,71,72
    did -u qnsc.main.dlg 66,67,68,69,70,71
    set %qnsc.action_stop $true
    set %qnsc.wait.getinfo $true
    set %qnsc.wait.getinfo_com 0 0 /MSG L WHOAMI
    set %qnsc.wait.getinfo_var L_whoami
    set %qnsc.getinfo_type 1
  }
  else {
    set %qnsc.action_stop $true
    set %qnsc.wait.getinfo $true
    set %qnsc.wait.getinfo_com 0 0 /MSG $qnsc.htbl_read(active_bot) CHANLEV $qnsc.htbl_read(channel)
    set %qnsc.wait.getinfo_var chanlev
  }
  qnsc.msg_log 1 1 /MSG $qnsc.htbl_read(active_bot) CHANLEV $qnsc.htbl_read(channel) $chr(35) $+ $qnsc.htbl_read(authname_user) %s
  qnsc.status 1 0 Retrieving...
  qnsc.prog_bar 0
}
alias -l qnsc.val_email {
  if ($numtok($1,32) == 1) {
    if ($numtok($1,64) == 2) {
      if ($numtok($gettok($1,2,64),46) == 2) { return 1 }
      else { return $input(E-mail address is invalid. $+ $crlf $+ It should take the form of $+ $crlf $+ user@host.com,ovw,Invalid E-mail) }
    }
    else { return $input(E-mail address is invalid. $+ $crlf $+ It should take the form of $+ $crlf $+ user@host.com,ovw,Invalid E-mail) }
  }
  else { return $input(E-mail address is invalid. $+ $crlf $+ Make sure there aren't any spaces.,ovw,Invalid E-mail) }
}

;=Function ALIAS=======================================================================================================
;Updates the Progressbar
alias -l qnsc.prog_bar did -a qnsc.main.dlg 139 $1 0 100
;Checks the qnsc-readme.txt file
alias -l qnsc.readme.check {
  if ($md5($qnsc.readme_file,2) === f6d8b6ac32b2f3394168da28fd94828b) { return $true }
  else { return $false }
}
;Updates and loggs History tab as well as messaging Q or L commands
;qnsc.msg_log log(1/0) off/wait(0/1) command
alias -l qnsc.msg_log {
  var %history_file = $+(",$scriptdir,qnsc.history.log,")
  if ($1-) {
    if ($1 == 1) {
      write %history_file $asctime(dd/mm/yy - HH:nn:ss) $+ $chr(9) $+ $$3-
      did -r qnsc.main.dlg 27
      var %i = 0
      while (%i < $lines(%history_file)) { inc %i 1 | did -a qnsc.main.dlg 27 $read(%history_file, %i) }
    }
    if ($2 == 1) { %qnsc.wait.done = $true }
    if ($left($3,1) == /) {
      . $+ $3-
      %qnsc.action = $true
      if ($qnsc.debug) { echo 7 -s $3- }
    }
  }
  else {
    did -r qnsc.main.dlg 27
    var %i = 0
    while (%i < $lines(%history_file)) { inc %i 1 | did -a qnsc.main.dlg 27 $read(%history_file, %i) }
  }
}
;Shows ERROR dialog and echos the error
alias -l qnsc.error {
  if (!%qnsc.error) {
    echo 4 -a $1-
    .timerqnsc.dlg 1 0.25 qnsc.ti.error
  }
  set -u5 %qnsc.error $true
}
;Updates the Statusbar
;qnsc.status store(1/0) id(0 to disable) caption
alias -l qnsc.status {
  if ($1 == 1) { qnsc.htbl_add statustxt $3- | .timerqnsc.stat off }
  if ($2 != 0) && (!$did($2).enabled) { return }
  else { .timerqnsc.stat 1 2 did -i qnsc.main.dlg 24 2 $qnsc.htbl_read(statustxt) }
  did -i qnsc.main.dlg 24 2 $3-
}
;Updates the Preview pictures
;qnsc.prevbmp pos id colour width caption
alias -l qnsc.prevbmp {
  window -ph +d @qnsc.prevwin 0 0 $4 19
  drawfill @qnsc.prevwin $3 $color(back) 0 0
  drawtext -pb @qnsc.prevwin $3 $color(back) $+(",$window(Status Window).font,") $window(Status Window).fontsize $1 1 $iif($5-,$5-,)
  drawsave @qnsc.prevwin $+(",$scriptdir,qnsc.prev.tmp.bmp,")
  close -@ @qnsc.prevwin
  did -g qnsc.main.dlg $2 $+(",$scriptdir,qnsc.prev.tmp.bmp,")
  .remove $+(",$scriptdir,qnsc.prev.tmp.bmp,")
}
;Loads text from readme file to the dialog
alias -l qnsc.readme.loadbuf {
  var %orig, %text
  if ($1-) { %orig = $1- }
  else { %orig = About }
  %text = $replace(%orig,$chr(45),$chr(32) $+ $chr(45) $+ $chr(32),$chr(35),$chr(45))
  dialog -t qnsc.readme.dlg QN's Service Control: %text
  did -ra qnsc.readme.dlg 5 %text
  %text = $replace(%orig,$chr(32),$chr(95))
  did -r qnsc.readme.dlg 2
  loadbuf $+(-ot,%text) qnsc.readme.dlg 2 $qnsc.readme_file
}

;=DIALOGS==============================================================================================================
;Made with the help of dohcan's Dialog Studio.
;http://www.mircscripts.org/dstudio/dstudio.html
;
;The big one :/
dialog -l qnsc.main.dlg {
  title ""
  size -1 -1 247 161
  option dbu
  tab "User Flags", 25, 2 0 242 130
  list 7, 27 24 109 99, tab 25 size
  edit "", 18, 178 25 50 10, tab 25 read autohs
  edit "", 19, 178 36 50 10, tab 25 read autohs
  check "a", 8, 152 49 17 10, disable tab 25
  check "v", 10, 172 49 17 10, disable tab 25
  check "m", 12, 192 49 17 10, disable tab 25
  check "b", 102, 212 49 17 10, disable tab 25
  check "o", 9, 152 63 17 10, disable tab 25
  check "g", 11, 172 63 17 10, disable tab 25
  check "n", 13, 192 63 17 10, disable tab 25
  check "t", 103, 212 63 17 10, disable tab 25
  button "Change", 14, 149 77 79 12, disable tab 25
  combo 76, 159 102 44 46, disable tab 25 sort size drop
  button "Add", 77, 205 102 26 10, disable tab 25
  box "View Flags", 1, 5 16 134 111, tab 25
  box "Edit Flags", 2, 142 16 92 77, tab 25
  box "Add User", 78, 142 93 92 25, tab 25
  text "Users:", 4, 9 24 16 8, tab 25
  text "Access flags:", 6, 146 37 32 8, tab 25
  text "Authname:", 5, 146 26 27 8, tab 25
  text "Nick:", 79, 146 103 12 8, tab 25
  tab "Channel Management", 26
  button "CLEARCHAN", 34, 67 23 37 12, disable tab 26
  button "OP", 35, 107 23 37 12, disable tab 26
  button "DEOPALL", 37, 147 23 37 12, disable tab 26
  button "INVITE", 43, 67 38 37 12, disable tab 26
  button "VOICE", 40, 107 38 37 12, disable tab 26
  button "UNBANALL", 42, 147 38 37 12, disable tab 26
  button "SETINVITE", 36, 47 63 37 12, disable tab 26
  button "CLEARINVITE", 41, 87 63 37 12, disable tab 26
  button "RECOVER", 38, 127 63 37 12, disable tab 26
  button "Remove L", 75, 167 63 37 12, disable tab 26
  edit "", 44, 54 90 184 10, disable tab 26 autohs
  button "3", 55, 148 115 10 8, disable tab 26
  button "4", 54, 162 115 10 8, disable tab 26
  check "Disabled", 127, 177 114 29 10, disable tab 26 push
  button "Apply", 45, 209 114 29 10, disable tab 26
  icon 47, 54 102 184 10,  " $+ $scriptdir $+ quakenet.png $+ ", 0, tab 26 noborder
  box "Edit Welcome Message", 52, 5 81 236 46, tab 26
  box "L And Q", 53, 5 16 236 38, tab 26
  box "L Bot Specific", 110, 5 55 236 25, tab 26
  text "Welcome Message:", 50, 8 91 46 8, tab 26
  text "Preview:", 51, 33 103 21 8, tab 26
  tab "Q Bot Specific", 30
  list 105, 8 26 122 39, tab 30 size
  button "Add", 109, 25 68 27 9, disable tab 30
  button "Delete", 107, 55 68 27 9, disable tab 30
  button "Delete All", 108, 85 68 27 9, disable tab 30
  check "Force limit", 116, 140 25 34 10, disable tab 30 push
  edit "", 117, 176 25 18 10, disable tab 30 autohs
  check "Channel-limit", 112, 140 38 34 10, disable tab 30 push
  edit "", 113, 176 38 18 10, disable tab 30 autohs
  check "Force Key", 114, 140 51 30 10, disable tab 30 push
  edit "", 115, 172 51 22 10, disable tab 30 autohs
  check "Bitch", 49, 200 25 38 10, disable tab 30 push
  check "Protect Users", 137, 200 38 38 10, disable tab 30 push
  check "Topic Save", 138, 200 51 38 10, disable tab 30 push
  button "Apply", 111, 177 68 27 9, disable tab 30
  edit "", 120, 30 90 208 10, disable tab 30 autohs
  button "3", 123, 148 115 10 8, disable tab 30
  button "4", 124, 162 115 10 8, disable tab 30
  check "Disabled", 125, 177 114 29 10, disable tab 30 push
  button "Apply", 126, 209 114 29 10, disable tab 30
  icon 122, 31 102 207 10,  " $+ $scriptdir $+ quakenet.png $+ ", 0, tab 30 noborder
  box "BANLIST", 106, 5 16 129 64, tab 30
  box "Force Topic", 118, 5 81 236 46, tab 30
  box "", 128, 137 62 104 18, tab 30
  box "", 135, 196 16 45 50, tab 30
  box "CHANFLAGS", 136, 137 16 60 50, tab 30
  text "Topic:", 119, 8 91 15 8, tab 30
  text "Preview:", 121, 8 103 21 8, tab 30
  tab "WHOAMI", 31
  list 56, 8 25 107 82, tab 31 size
  edit "", 57, 154 25 84 10, tab 31 read autohs
  edit "", 94, 154 36 84 10, tab 31 read autohs
  button "Change E-mail", 100, 191 48 47 8, disable tab 31
  button "Change Password", 101, 191 58 47 8, disable tab 31
  edit "", 73, 174 78 50 10, tab 31 read autohs
  check "a", 66, 152 90 17 10, disable tab 31
  check "v", 67, 175 90 17 10, disable tab 31
  check "m", 68, 198 90 17 10, disable tab 31
  check "o", 71, 152 100 17 10, disable tab 31
  check "g", 70, 175 100 17 10, disable tab 31
  check "n", 69, 198 100 17 10, disable tab 31
  button "Apply", 72, 139 111 92 12, disable tab 31
  button "Update", 39, 6 115 37 12, disable tab 31
  text "Access flags:", 74, 142 79 32 8, tab 31
  text "Authed as:", 93, 127 26 27 8, tab 31
  text "E-mail:", 99, 138 37 16 8, tab 31
  text "Global auth level:", 95, 127 57 42 8, tab 31
  text "", 98, 145 48 31 8, tab 31
  text "0", 96, 170 57 6 8, tab 31
  text "Userid:", 97, 127 48 17 8, tab 31
  text "You are unable to edit your own Q flags.", 33, 46 113 73 14, tab 31 center
  box "You are authed as:", 90, 123 16 118 53, tab 31
  box "You are known on the following channels:", 65, 5 16 114 95, tab 31
  box "Edit Your Flags", 64, 123 70 118 57, tab 31
  tab "History", 32
  list 27, 5 16 235 93, tab 32 size
  button "Clear", 28, 199 113 37 12, tab 32
  text "Commands that have been sent to L and confirmation. Double click a row to add the text to the clipboard so you can past it else where.", 29, 6 112 189 14, tab 32
  combo 17, 141 147 57 50, disable size drop
  button "Quit", 16, 205 146 37 12, ok
  list 24, 4 133 180 10, size
  text "", 139, 185 134 58 9
  text "", 48, 4 148 104 8, disable
  text "Channel:", 3, 119 148 22 8
  menu "QNSC", 92
  item "Mouse over", 129, 92
  item break, 15, 92
  item "Quit", 20, 92
  menu "Help", 131
  item "Contents", 134, 131
  item break, 21, 131
  item "About", 133, 131
}
;Change e-mail dialog
dialog -l qnsc.ch_email.dlg {
  title "Change Account E-mail"
  size -1 -1 103 66
  option dbu
  edit "", 1, 30 11 68 10, pass autohs
  edit "", 2, 30 26 68 10, autohs
  text "Password:", 4, 5 12 25 8
  text "E-mail:", 5, 5 27 16 8
  button "Apply", 7, 15 51 37 12
  box "", 8, 1 3 101 45
  text "Passwords are not saved into this script.", 9, 3 39 98 7
  button "Quit", 3, 56 51 37 12, ok
}
;Change password dialog
dialog -l qnsc.ch_pass.dlg {
  title "Change Account Password"
  size -1 -1 103 82
  option dbu
  edit "", 1, 45 11 50 10, pass autohs
  edit "", 2, 45 26 50 10, pass autohs
  edit "", 3, 45 41 50 10, pass autohs
  text "Old Password:", 4, 8 12 35 8
  text "New Password:", 5, 8 27 37 8
  text "New Password:", 6, 8 42 37 8
  button "Apply", 7, 14 66 37 12
  box "", 8, 1 3 101 59
  text "Passwords are not saved into this script.", 9, 3 53 98 7
  button "Quit", 10, 55 66 37 12, ok
}
;Say HELLO To Q Dialog
dialog -l qnsc.say_hello.dlg {
  title "Say Hello To Q"
  size -1 -1 103 75
  option dbu
  edit "", 1, 39 11 56 10, autohs
  edit "", 2, 39 26 56 10, autohs
  text "E-mail:", 4, 8 12 16 8
  text "E-mail Again:", 5, 8 27 31 8
  button "Apply", 7, 14 60 37 12
  box "", 8, 1 3 101 54
  button "Quit", 10, 55 60 37 12, ok
  text "Your password will be sent to the e-mail address, so make sure it is valid.", 3, 4 40 94 14, center
}
;About dialog
dialog -l qnsc.about.dlg {
  title ""
  size -1 -1 234 162
  option dbu
  box "", 1, 2 2 114 52
  text "", 3, 5 11 109 8, center
  text "Written By Intenz", 4, 37 19 45 8, center
  link "intenz44@hotmail.com", 5, 32 27 55 8
  text "E-mail me any bugs u may have and i will try to help :)", 6, 19 35 82 14, center
  text "This script was written and tested using mIRC 6.12, to get the latest version visit", 11, 125 31 102 14, center
  text "IRC Network.", 10, 125 22 33 7, center
  text "when on the", 8, 125 15 31 7
  link "QuakeNet", 9, 157 15 25 8
  text "This script is to be used", 7, 125 9 57 7
  icon 12, 186 10 41 15,  " $+ $scriptdir $+ quakenet.png $+ " , 0, noborder
  box "Comments", 2, 120 2 112 52
  edit "", 13, 7 65 220 89, read multi vsbar
  box "Credits", 14, 2 57 230 102
  link "http://www.mirc.com/get.html", 15, 140 44 74 8
  button "", 16, 0 0 0 0, hide ok
}
;Help dialog
dialog -l qnsc.readme.dlg {
  title ""
  size -1 -1 304 165
  option dbu
  list 3, 1 5 108 140, size
  edit , 2, 111 15 192 131, read multi hsbar vsbar
  button OK, 1, 265 150 37 12, default ok
  text "Selected Topic:", 4, 112 6 37 8
  text "", 5, 150 6 152 8
}
