Jump to content
chain

Extensible Account System

Recommended Posts

  • Administrators

So I've been working on this for a little bit. I wanted to make something where you could have a registration system for all scripts that wanted to support this kind of thing. For example if you had a casino script or trivia script that wanted to register users, you could do so with this script for both of them (assuming they were compatible). I would definitely like to collaborate with mIRC script writers who are looking to use this kind of system. I'm almost always available on skype via: jasonsphone01

Since this is a system all it's own, it does not require any other plugins to help it run. If you have any questions please use the comment section below or feel free to message me on skype! (or if you want to invite me to your IRC server, that'll work too)

Change Log:
SR-001
Extensible Account Script v.0.1.0.0.bta
Beta Release version of the EAS.

HF-001
Extensible Account Script v.0.1.0.1.bta
Clean-up of the code used in EAS.
Added more identifiers to the $eas alias
Commented-out ability to type /account open to open the account dialog.
Added the -c tag to the /account alias (before any additional arguments) to clear out the window before processing any other information.

SU-001
Extensible Account Script v.0.2.0.0.bta
Added dialogs for all normal /account alias commands.
Additional code clean-up.
Added $alock() alias for a quicker look at various user's account lock information.
Added a change log.

SU-002
Extensible Account Script v.0.3.0.0.bta
Added Menu option to bring up the console
Added an on TEXT event handler

MU-001
Extensible Account Script v.0.3.1.0.bta
Added information text to /account info command.
Added installation and version update times for statistical purposes.

MU-002
Extensible Account Script v.0.3.2.1.bta
Added Staff Channel with and output option
Added the ability to auto-join this channel upon connecting to a server.

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;Extensible Account Script;;;;;
;;;;;;;Version: 0.3.2.1.bta;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;
;;;;;Aliases;;;;;
;;;;;;;;;;;;;;;;;

alias eas {
  If ($1 == version) { return 0.3.2.1.bta }
  If ($1 == left) { return 9,1[EAS] }
  If ($1 == checkversion) { return $readini(account/account.ini,status,version) }
  If ($1 == settings) { return $readini(account/account.ini,settings,$2) }
  If ($1 == status) { return $readini(account/account.ini,status,$2) }
  If ($1 == perm) { return $readini(account/ $+ $2 $+ /permissions.ini,perms,$3) }
  If ($1 == gperm) { return $readini(account/staff/groups.ini,$2,$3) }
  If ($1 == isRegistered) { return $readini(account/ $+ $2 $+ /account.ini,status,registered) }
  If ($1 == isStaff) { return $readini(account/ $+ $2 $+ /account.ini,power,staff) }
  If ($1 == staffGroup) { return $readini(account/ $+ $2 $+ /account.ini,power,position) }
  If ($1 == isGroup) { return $readini(account/staff/groups.ini,$2,registered) }
  If ($1 == userPass) { return $readini(account/ $+ $2 $+ /account.ini,status,password) }
  If ($1 == userEmail) { return $readini(account/ $+ $2 $+ /account.ini,status,email) }
  If ($1 == opLevel) { return $readini(account/staff/groups.ini,$2,oplevel) }
  If ($1 == loggedIn) { return $readini(account/ $+ $2 $+ /account.ini,status,loggedin) }
  If ($1 == joinTime) { return $readini(account/ $+ $2 $+ /account.ini,status,jointime) }
}
alias alock {
  If (!$2) { return $readini(account/ $+ $1 $+ /account.ini,status,locked) }
  Elseif ($2 == date) { return $readini(account/ $+ $1 $+ /account.ini,status,lastlockdate) }
  Elseif ($2 == locker) { return $readini(account/ $+ $1 $+ /account.ini,status,lastlocker) }
  Elseif ($2 == reason) { return $readini(account/ $+ $1 $+ /account.ini,status,lockreason) }
  Elseif ($2 == unlock) { return $readini(account/ $+ $1 $+ /account.ini,status,unlocktime) }
  Else { return error }
}

alias cout { echo -a $eas(left) $1- }
alias re { $1- }
alias start { dialog $iif($dialog($1) == $1,-v,-md $1) $1 }
alias dclose { dialog -x $dname }

alias account {
  If (-c isin $1) {
    clear
    re account $2-
    halt
  }
  $iif($1 == open,,cout ==========)
  If ($readini(account/account.ini,status,installed) != yes) {
    If (!$1) { cout Please type 3/account install to install the Extensible Account Script. | halt }
    Elseif ($1 != install) { cout Please type 3/account install to install the Extensible Account Script. | halt }
    Else {
      cout Please wait...
      mkdir account
      writeini account/account.ini status installed yes
      writeini account/account.ini status version $eas(version)
      writeini account/account.ini status installtime $ctime
      writeini account/account.ini status updatetime $ctime
      writeini account/account.ini settings password on
      writeini account/account.ini settings email on
      writeini account/account.ini settings emailvalidate on
      write account/perms.txt op
      write account/perms.txt lockBypass
      mkdir account/staff
      re account group Owner add 4
      re account group Admin add 2
      writeini account/account.ini settings registration on
      writeini account/account.ini settings login on
      write account/opleveldesc.txt 7 - Staff, Bot Owner
      write account/opleveldesc.txt 6 - Staff, Owner (Supported services (ie ~ rank in channel))
      write account/opleveldesc.txt 5 - Staff, Admin (Supported services (ie & rank in channel))
      write account/opleveldesc.txt 4 - Staff, Operator (ie @ in channel))
      write account/opleveldesc.txt 3 - Staff, Halfop (Supported services (ie % rank in channel))
      write account/opleveldesc.txt 2 - Staff, Voice (ie + in channel))
      write account/opleveldesc.txt 1 - Staff, No rank
      write account/opleveldesc.txt 0 - Member, non-staff
      writeini account/account.ini settings output off
      writeini account/account.ini status output #account
      writeini account/account.ini settings enforcechannelaccess true
      writeini account/account.ini settings autojoin true
      cout Installation complete!
      re account
    }
  }
  Elseif ($eas(checkversion) != $eas(version)) {
    If (!$1) { cout Please type /account update to update the Extensible Account Script. | halt }
    Elseif ($1 != update) { cout Please type /account update to update the Extensible Account Script. | halt }
    Else {
      cout Please wait...
      If (!$eas(checkversion)) {
        ;;;;;Update to version 0.1.0.0.dev;;;;;
      }
      If ($eas(checkversion) == 0.1.0.0.dev) {
        ;;;;;Update to version 0.1.0.1.dev;;;;;
        writeini account/account.ini settings password on
        writeini account/account.ini settings email on
      }
      If ($eas(checkversion) == 0.1.0.1.dev) {
        ;;;;;Update to version 0.1.0.2.dev;;;;;
        writeini account/account.ini settings emailvalidate on
      }
      If ($eas(checkversion) == 0.1.0.2.dev) {
        ;;;;;Update to version 0.2.0.0.dev;;;;;
        write account/perms.txt op
        write account/perms.txt lockBypass
        mkdir account/staff
      }
      If ($eas(checkversion) == 0.2.0.0.dev) {
        ;;;;;Update to version 0.2.1.0.dev;;;;;
        re account group Owner add 4
        re account group Admin add 2
      }
      If ($eas(checkversion) == 0.2.1.0.dev) {
        ;;;;;Update to version 0.2.2.0.dev;;;;;
        writeini account/account.ini settings registration on
        writeini account/account.ini settings login on
      }
      If ($eas(checkversion) == 0.2.2.0.dev) {
        ;;;;;Update to version 0.1.0.0.bta;;;;;
        ;;;;;This is the official beta release;;;;;
        ;;;;;If anyone would like to colaberate on this project with me, add me on skype: jasonsphone01
        write account/opleveldesc.txt 7 - Staff, Bot Owner
        write account/opleveldesc.txt 6 - Staff, Owner (Supported services (ie ~ rank in channel))
        write account/opleveldesc.txt 5 - Staff, Admin (Supported services (ie & rank in channel))
        write account/opleveldesc.txt 4 - Staff, Operator (ie @ in channel))
        write account/opleveldesc.txt 3 - Staff, Halfop (Supported services (ie % rank in channel))
        write account/opleveldesc.txt 2 - Staff, Voice (ie + in channel))
        write account/opleveldesc.txt 1 - Staff, No rank
        write account/opleveldesc.txt 0 - Member, non-staff
      }
      If ($eas(checkversion) == 0.1.0.0.bta) {
        ;;;;;Update to version 0.1.0.1.bta;;;;;
        ;;;;;Code clean-up;;;;;
        ;;;;;Nothing to add presently;;;;;
      }
      If ($eas(checkversion) == 0.1.0.1.bta) {
        ;;;;;Update to version 0.2.0.0.bta;;;;;
        ;;;;;Code clean-up;;;;;
        ;;;;;Added dialogs;;;;;
        ;;;;;Nothing to add here;;;;;
      }
      If ($eas(checkversion) == 0.2.0.0.bta) {
        ;;;;;Update to version 0.3.0.0.bta;;;;;
        ;;;;;Code clean-up;;;;;
        ;;;;;Added Menu and on Text event handler;;;;;
        ;;;;;Nothing to add here;;;;;
      }
      If ($eas(checkversion) == 0.3.0.0.bta) {
        ;;;;;Update to version 0.3.1.0.bta;;;;;
        ;;;;;Added information text to /account command;;;;;
        writeini account/account.ini status installtime $ctime
      }
      If ($eas(checkversion) == 0.3.1.0.bta) {
        ;;;;;Update to version 0.3.2.0.bta;;;;;
        ;;;;;Added Staff Output Channel;;;;;
        writeini account/account.ini settings output off
        writeini account/account.ini status output #account
        writeini account/account.ini settings enforcechannelaccess true
      }
      If ($eas(checkversion) == 0.3.2.0.bta) {
        ;;;;;Update to version 0.3.2.1.bta;;;;;
        ;;;;;Added on Conect option to auto-join the account channel;;;;;
        writeini account/account.ini settings autojoin on
      }
      writeini account/account.ini status version $eas(version)
      writeini account/account.ini status updatetime $ctime
      cout Update complete!
      re account
    }
  }
  Else {
    If (!$1) {
      cout Please select from the following options:
      cout To view options for account management, please type /account manage
      cout To view options for staff management, please type /account staff
      cout To view options for script settings, please type /account settings
      cout To bring up the dialog for this script, please type /account open
      cout To view information about this script, please type /account info
    }
    Elseif ($1 == open) { start account }
    Elseif ($1 == manage) {
      cout Please select from the following options:
      cout To register/unregister a user, please type /account <register|unregister> <nick> $iif($eas(settings,password) == on,[password],) $iif($eas(settings,email) == on,[email],)
      cout To login/logout a user, please type /account <login|logout> <nick>
      cout To lock/unlock a user account, please type /account <lock|unlock> <nick> [time to expire in seconds] [reason for lock]
      cout To view the list of settings on a user account and how to modify them, please type /account view <nick>
    }
    Elseif ($1 == register) {
      If (!$2) { cout Please type /account register <nick> $iif($eas(settings,password) == on,<password>,) $iif($eas(settings,email) == on,<email>,) | halt }
      If ($eas(isRegistered,$2) == yes) { cout This user is already registered! | halt }
      If ($eas(settings,password) == on) && ($eas(settings,email) == on) {
        If (!$4) { cout Please type /account register <nick> <password> <email> | halt }
        If ($eas(settings,emailvalidate) == on) {
          If ($readini(account/account.ini,emailvalidate,$4) == registered) { cout This email is already registered to a user! | halt }
          Else { writeini account/account.ini emailvalidate $4 registered }
        }
        mkdir account/ $+ $2
        writeini account/ $+ $2 $+ /account.ini status password $3
        writeini account/ $+ $2 $+ /account.ini status email $4
      }
      Elseif ($eas(settings,password) == on) {
        If (!$3) { cout Please type /account register <nick> <password> | halt }
        mkdir account/ $+ $2
        writeini account/ $+ $2 $+ /account.ini status password $3
      }
      Elseif ($eas(settings,email) == on) {
        If (!$3) { cout Please type /account register <nick> <email> | halt }
        If ($eas(settings,emailvalidate) == on) {
          If ($readini(account/account.ini,emails,$3) == registered) { cout This email is already registered to a user! | halt }
          Else { writeini account/account.ini emailvalidate $3 registered }
        }
        mkdir account/ $+ $2
        writeini account/ $+ $2 $+ /account.ini status email $3
      }
      Else {
        mkdir account/ $+ $2
      }
      writeini account/ $+ $2 $+ /account.ini status registered yes
      writeini account/ $+ $2 $+ /account.ini status loggedin no
      writeini account/ $+ $2 $+ /account.ini status lastlogin na
      writeini account/ $+ $2 $+ /account.ini status locked no
      writeini account/ $+ $2 $+ /account.ini status lastlockdate na
      writeini account/ $+ $2 $+ /account.ini status lastlocker na
      writeini account/ $+ $2 $+ /account.ini status lockreason na
      writeini account/ $+ $2 $+ /account.ini status unlocktime $ctime
      writeini account/ $+ $2 $+ /account.ini status jointime $ctime
      writeini account/ $+ $2 $+ /account.ini power staff no
      writeini account/ $+ $2 $+ /account.ini power position member
      writeini account/ $+ $2 $+ /account.ini power premium no
      writeini account/ $+ $2 $+ /account.ini power premiumExpiration $ctime
      write account/accounts.txt $2
      cout Account registration for the nickname $2 is complete!
    }
    Elseif ($1 == unregister) {
      If (!$2) { cout Please type /account unregister <nick> | halt }
      If ($eas(isRegistered,$2) != yes) { cout This isn't a registered user. | halt }
      remini account/account.ini emailvalidate $eas(userEmail,$2)
      .remove account/ $+ $2 $+ /account.ini
      .remove account/ $+ $2 $+ /permissions.ini
      rmdir account\$2
      write -ds $+ $2 account/accounts.txt
      cout User Unregistration Complete!
    }
    Elseif ($1 == login) {
      If (!$2) { cout Please type /account login <nick> | halt }
      If ($eas(isRegistered,$2) != yes) { cout This isn't a registered user. | halt }
      If ($eas(loggedIn,$2) == yes) { cout This user is already logged in. | halt }
      writeini account/ $+ $2 $+ /account.ini status loggedin yes
      writeini account/ $+ $2 $+ /account.ini status lastlogin $ctime
      If (-s !isin $3-) { cout User has been logged-in sucessfully! }
      If ($alock($2) == yes) { cout Warning! User is currently locked but has been logged-in anyway! }
    }
    Elseif ($1 == logout) {
      If (!$2) { cout Please type /account logout <nick> | halt }
      If ($eas(isRegistered,$2) != yes) { cout This isn't a registered user. | halt }
      If ($eas(loggedIn,$2) != yes) { cout This user isn't logged in. | halt }
      writeini account/ $+ $2 $+ /account.ini status loggedin no
      If (-s !isin $3-) { cout User has been logged-out sucessfully! }
    }
    Elseif ($1 == lock) {
      If (!$4) { cout Please type /account lock <nick> <time to expire in seconds> <reason for lock> | halt }
      If ($eas(isRegistered,$2) != yes) { cout This isn't a registered user. | halt }
      If ($alock($2) == yes) { cout This user's account is already locked. | halt }
      If ($eas(perm,$2,op) == true) { cout Warning! This user can't normally be locked! }
      If ($eas(perm,$2,lockBypass) == true) || ($eas(perm,$2,op) == true) { cout Warning! This user can bypass an account lockout! }
      writeini account/ $+ $2 $+ /account.ini status locked yes
      writeini account/ $+ $2 $+ /account.ini status lastlockdate $ctime
      writeini account/ $+ $2 $+ /account.ini status lastlocker ~Console
      writeini account/ $+ $2 $+ /account.ini status lockreason $4-
      writeini account/ $+ $2 $+ /account.ini status unlocktime $calc($ctime + $3)
      cout User lock of $2 $+ 's account complete!
    }
    Elseif ($1 == unlock) {
      If (!$2) { cout Please type /account unlock <nick> | halt }
      If ($eas(isRegistered,$2) != yes) { cout This isn't a registered user. | halt }
      If ($alock($2) != yes) { cout This user's account is not locked. | halt }
      writeini account/ $+ $2 $+ /account.ini status locked no
      cout User unlock of $2 $+ 's account complete!
    }
    Elseif ($1 == view) {
      If (!$2) { cout Please type /account view <nick> | halt }
      If ($eas(isRegistered,$2) != yes) { cout This isn't a registered user. | halt }
      cout Profile information for: $2 (Generated at $asctime(ddmmmyyyy hh:nn:ss TT) $+ )
      cout Status: Registered - Locked: $alock($2) $iif($alock($2) == yes,- Date Unlockable: $asctime($alock($2,unlock),ddmmmyyyy hh:nn:ss TT),)
      cout Last login: $asctime($readini(account/ $+ $2 $+ /account.ini,status,lastlogin),ddmmmyyyy hh:nn:ss TT)
      cout Join Date: $asctime($readini(account/ $+ $2 $+ /account.ini,status,jointime),ddmmmyyyy hh:nn:ss TT)
      If ($eas(isStaff,$2) == yes) {
        cout Staff Position: $readini(account/ $+ $2 $+ /account.ini,power,position)
      }
      If ($readini(account/ $+ $2 $+ /account.ini,power,premium) == yes) {
        cout Premium Expiration Date: $asctime($readini(account/ $+ $2 $+ /account.ini,power,premiumExpiration),ddmmmyyyy hh:nn:ss TT)
      }
      If ($alock($2,date) != na) {
        cout Last Lock Date: $asctime($alock($2,date),ddmmmyyyy hh:nn:ss TT)
        cout Last Locker: $alock($2,locker)
        cout Last Lock Reason: $alock($2,reason)
      }
    }
    Elseif ($1 == staff) {
      cout Please select from one of the following options:
      cout To manage staff users, please type /account manageStaff
      cout To manage staff groups, please type /account groups
    }
    Elseif ($1 == manageStaff) {
      cout Please select from one of the following options:
      cout To make a registered user staff (or to fire a staff member), please type: /account <hire|fire> <nick> [group]
      cout (For a list of groups, please type /account groups)
      cout To manage an individual's permissions as a staff member, please type /account staffer <nick>
      cout To change a user's group as staff, please type /account changeGroup <nick> <newGroup>
    }
    Elseif ($1 == hire) {
      If (!$3) { cout Please type: /account hire <nick> <group> | cout (For a list of groups, please type /account groups) | halt }
      If ($eas(isRegistered,$2) != yes) { cout This is not a registered user. | halt }
      If ($eas(isStaff,$2) == yes) { cout This user is already staff. | halt }
      If ($readini(account/staff/groups.ini,$3,registered) != yes) { cout This is not a valid group. | halt }
      writeini account/ $+ $2 $+ /account.ini power staff yes
      writeini account/ $+ $2 $+ /account.ini power position $3
      write account/staff/staffers.txt $2
      cout Staff hired sucessfully!
    }
    Elseif ($1 == fire) {
      If (!$2) { cout Please type: /account fire <nick> | halt }
      If ($eas(isRegistered,$2) != yes) { cout This is not a registered user. | halt }
      If ($eas(isStaff,$2) != yes) { cout This user isn't staff. | halt }
      writeini account/ $+ $2 $+ /account.ini power staff no
      writeini account/ $+ $2 $+ /account.ini power position member
      write -ds $+ $2 account/staff/staffers.txt
      cout Staff fired sucessfully!
    }
    Elseif ($1 == staffer) {
      If (!$2) { cout Please type: /account staffer <nick> | halt }
      If ($eas(isRegistered,$2) != yes) { cout This is not a registered user. | halt }
      If ($eas(isStaff,$2) != yes) { cout This user is not a staffer. | halt }
      cout Information about staffer: $2 (Report generated on: $asctime(ddmmmyyyy hh:nn:ss TT) $+ )
      cout Current Group: $readini(account/ $+ $2 $+ /account.ini,power,position)
      If ($readini(account/ $+ $2 $+ /permissions.ini,status,registered) == yes) {
        cout Individiual Permissions:
        var %temp.1 1
        While (%temp.1 <= $lines(account/perms.txt)) {
          If ($readini(account/ $+ $2 $+ /permissions.ini,perms,$read(account/perms.txt,t,%temp.1))) {
            cout $read(account/perms.txt,t,%temp.1) - $eas(perm,$2,$read(account/perms.txt,t,%temp.1))
          }
          inc %temp.1
        }
        cout End of Individual Permissions.
      }
      cout To change individual permissions, type /account changePerm <nick> <permission node> <value>
      cout For a complete list of permissions, type /account permList
    }
    Elseif ($1 == permList) {
      cout The following are the permissions recognized by the EAS directly:
      var %temp.1 1
      While (%temp.1 <= $lines(account/perms.txt)) {
        cout $read(account/perms.txt,t,%temp.1)
        inc %temp.1
      }
      cout End of List
    }
    Elseif ($1 == changePerm) {
      If (!$4) { cout Please type /account changePerm <nick> <permissions node> <value> | halt }
      If ($eas(isRegistered,$2) != yes) { cout This is not a registered user. | halt }
      writeini account/ $+ $2 $+ /permissions.ini status registered yes
      writeini account/ $+ $2 $+ /permissions.ini perms $3 $4
      cout Permission set sucessfully!
    }
    Elseif ($1 == changeGroup) {
      If (!$3) { cout Please type /account changeGroup <nick> <newGroup> | halt }
      If ($eas(isRegistered,$2) != yes) { cout This user isn't registered. | halt }
      If ($eas(isStaff,$2) != yes) { cout This user isn't a staffer. | halt }
      If ($readini(account/staff/groups.ini,$3,registered) != yes) { cout This isn't a valid group. | halt }
      writeini account/ $+ $2 $+ /account.ini power position $3
      cout $2 had their group change to $3 sucessfully!
    }
    Elseif ($1 == groups) {
      cout The following is a list of groups available for staffers:
      var %temp.1 1
      While (%temp.1 <= $lines(account/staff/groups.txt)) {
        cout $read(account/staff/groups.txt,t,%temp.1)
        inc %temp.1
      }
      cout End of list. To learn more about each one (and see other available options), please type /account group <groupName> info
    }
    Elseif ($1 == group) {
      If (!$3) {
        cout Please select from one of the following options:
        cout To view a list of available groups, please type /account groups
        cout To view information specific to a group, please type /account group <groupName> info
        cout To add/remove a group, please type /account group <groupName> <add|remove> [opLevel if adding]
        cout To edit operator status, please type /account group <groupName> opLevel <actual op level, see documentation for help with this>
        cout To edit specific permissions a group has access to, please type /account group <groupName> perms <permissions node> <value>
      }
      Elseif ($3 == info) {
        If ($eas(isGroup,$2) != yes) { cout This is not a valid group. | halt }
        cout Information for group $2 (Report generated on $asctime(ddmmmyyyy hh:nn:ss TT)
        cout Op Level: $readini(account/staff/groups.ini,$2,oplevel)
        cout Specific Permissions:
        var %temp.1 1
        While (%temp.1 <= $lines(account/perms.txt)) {
          cout $read(account/perms.txt,t,%temp.1) - $eas(gperm,$2,$read(account/perms.txt,t,%temp.1))
          inc %temp.1
        }
        cout Users who have this group:
        var %temp.1 1
        While (%temp.1 <= $lines(account/accounts.txt)) {
          If ($readini(account/ $+ $read(account/accounts.txt,t,%temp.1) $+ /account.ini,power,position) == $2) {
            cout - $read(account/accounts.txt,t,%temp.1)
          }
          inc %temp.1
        }
        cout End of Report
      }
      Elseif ($3 == add) {
        If (!$4) { cout Please type /account group <groupName> add <opLevel> | halt }
        If ($eas(isGroup,$2) == yes) { cout This group already exists. | halt }
        writeini account/staff/groups.ini $2 registered yes
        writeini account/staff/groups.ini $2 opLevel $4
        var %temp.1 1
        While (%temp.1 <= $lines(account/perms.txt)) {
          writeini account/staff/groups.ini $2 $read(account/perms.txt,t,%temp.1) false
          inc %temp.1
        }
        write account/staff/groups.txt $2
        cout Group created sucessfully!
      }
      Elseif ($3 == remove) {
        If ($eas(isGroup,$2) != yes) { cout This group doesn't exist. | halt }
        write -ds $+ $2 account/staff/groups.txt
        remini account/staff/groups.ini $2
        var %temp.1 1
        While (%temp.1 <= $lines(account/accounts.txt)) {
          If ($readini(account/ $+ $read(account/accounts.txt,t,%temp.1) $+ /account.ini,power,position) == $2) {
            writeini account/ $+ $read(account/accounts.txt,t,%temp.1) $+ /account.ini power position member
          }
          inc %temp.1
        }
        cout Group removed sucessfully! Any users assigned to that group have been assigned to the member group (ie non-staff).
      }
      Elseif ($3 == opLevel) {
        If (!$4) { cout Please type /account group <groupName> opLevel <actual op level> | halt }
        If ($eas(isGroup,$2) != yes) { cout This is not a registered group | halt }
        writeini account/staff/groups.ini $2 opLevel $4
        cout Op Level for $2 changed to $4 sucessfully!
      }
      Elseif ($3 == perms) {
        If (!$5) { cout Please type /account group <groupName> perms <permissions node> <value> | halt }
        If ($eas(isGroup,$2) != yes) { cout This is not a registered group | halt }
        writeini account/staff/groups.ini $2 $4 $5
        cout Permissions set sucessfully! Please note that if the permissions node is not one in the EAS system it will not show up normally (ie from a different plugin)
      }
      Else {
        cout Unknown command.
      }
    }
    Elseif ($1 == settings) {
      If (!$2) {
        cout Please select from one of the following:
        cout To manage core account settings, please type /account settings system
        cout To manage user settings (including login and registration), please type /account settings user
        cout To manage staff settings, please type /account settings staff
      }
      Elseif ($2 == system) {
        If (!$4) {
          cout Please select from the following options:
          cout To turn Staff Channel Output $iif($readini(account/account.ini,settings,output) == on,off,on) $+ , please type: /account settings system output $iif($eas(settings,output) == on,off,on)
          cout To change the Staff Output channel (currently: $eas(status,output) $+ ), please type: /account settings system channel <input new channel>
          cout To change the Enforce Access to Output channel (currently: $eas(settings,enforcechannelaccess) $+ ), please type: /account settings system enforcechannelaccess $iif($eas(settings,enforcechannelaccess) == on,off,on)
          cout To change the Autojoin on Connect option (currently: $eas(settings,autojoin) $+ ), please type: /account settings system autojoin $iif($eas(autojoin) == on,off,on)
        }
        Elseif ($3 == output) {
          writeini account/account.ini settings output $4
          cout Staff Channel Output changed to: $4
        }
        Elseif ($3 == channel) {
          writeini account/account.ini status output $4
          cout Staff Channel has been changed to: $4
        }
        Elseif ($3 == enforcechannelaccess) {
          writeini account/account.ini settings enforcechannelaccess $4
          cout Enforce Channel Access has been changed to: $4
        }
        Elseif ($3 == autojoin) {
          writeini account/account.ini settings autojoin $4
          cout Autojoin on connect has been changed to: $$
        }
        Else {
          cout Unknown command.
        }
      }
      Elseif ($2 == user) {
        If (!$4) {
          cout Please select from one of the following options:
          cout To $iif($readini(account/account.ini,settings,registration) == on,deny,allow) registration, please type: /account settings user registration $iif($readini(account/account.ini,settings,registration) == on,off,on)
          cout To $iif($readini(account/account.ini,settings,login) == on,deny,allow) logins, please type: /account settings user login $iif($readini(account/account.ini,settings,login) == on,off,on)
          cout To $iif($readini(account/account.ini,settings,password) == on,not require,require) a password, please type: /account settings user password $iif($readini(account/account.ini,settings,password) == on,off,on)
          cout To $iif($readini(account/account.ini,settings,email) == on,not require,require) an email, please type: /account settings user email $iif($readini(account/account.ini,settings,email) == on,off,on)
          cout To $iif($readini(account/account.ini,settings,emailvalidate) == on,not block,block) the same email address registereing more than once, please type: /account settings user emailvalidate $iif($readini(account/account.ini,settings,emailvalidate) == on,off,on)
        }
        Else {
          writeini account/account.ini settings $3 $4
          cout Value updated sucessfully!
        }
      }
      Elseif ($2 == staff) {
        cout Currently there are no settings available.
      }
      Else {
        cout Unknown command.
      }
    }
    Elseif ($1 == info) {
      cout Extensible Account Script - Version $eas(version)
      cout Installed on: $asctime($eas(status,installtime),ddmmmyyyy hh:nn:ss TT)
      cout Most recently updated on: $asctime($eas(status,updatetime),ddmmmyyyy hh:nn:ss TT)
      cout This update released on $asctime(1438531200,ddmmmyyyy hh:nn:ss TT)
      cout Number of accounts currently registered: $lines(account/accounts.txt)
      cout Number of staffers: $lines(account/staff/staffers.txt)
      cout Development Area: irc.us.gamesurge.net #Tamaki
    }
  }
  Else {
    cout Unknown command.
  }
}

;;;;;;;;;;;;;;;;;
;;;;;Dialogs;;;;;
;;;;;;;;;;;;;;;;;

dialog account {
  title Account Main Menu
  option dbu
  size -1 -1 101 44
  button "Account Management", 1, 1 1 100 10
  button "Staff Management", 2, 1 11 100 10
  button "System Settings", 3, 1 22 100 10
  button "Close", 4, 1 33 100 10, cancel
}

dialog account_management {
  title Account Management
  option dbu
  size -1 -1 101 44
  button "New Account", 1, 1 1 100 10
  button "Manage Account", 2, 1 11 100 10
  button "Delete Account", 3, 1 22 100 10
  button "Back", 4, 1 33 100 10
}

dialog account_management_new {
  title New Account
  option dbu
  size -1 -1 152 55
  text "Nick", 1, 1 1 50 10
  edit "", 2, 51 1 100 10
  text "Password", 3, 1 11 50 10
  edit "", 4, 51 11 100 10, disable
  text "Email", 5, 1 22 50 10
  edit "", 6, 51 22 100 10, disable
  button "Create Account", 7, 1 33 151 10
  button "Cancel", 8, 1 44 151 10
}

dialog account_management_manage {
  title Manage Account
  option dbu
  size -1 -1 203 77
  text "Username", 1, 1 1 50 10
  edit "", 2, 51 1 100 10
  button "Search", 3, 152 1 50 10
  button "Look-up", 4, 1 11 202 10
  text "Password", 5, 1 22 50 10
  edit "", 6, 51 22 152 10, pass disable
  text "Email", 7, 1 33 50 10
  edit "", 8, 51 33 152 10, disable
  check "Lock Account", 11, 1 44 202 10, disable
  button "Complete", 9, 1 55 202 10, disable
  button "Cancel", 10, 1 66 202 10
}

dialog account_management_manage_list {
  title Account List
  option dbu
  size -1 -1 101 143
  list 1, 1 1 100 100
  text "Username", 2, 1 100 100 10
  edit "", 3, 1 110 100 10, right read
  button "Select", 4, 1 121 100 10, disable
  button "Cancel", 5, 1 132 100 10
}

dialog account_management_delete {
  title Delete Account
  option dbu
  size -1 -1 101 143
  list 1, 1 1 100 100
  text "Username", 2, 1 100 100 10
  edit "", 3, 1 110 100 10, right read
  button "Delete", 4, 1 121 100 10, disable
  button "Cancel", 5, 1 132 100 10
}

dialog account_staff {
  title Staff Management
  option dbu
  size -1 -1 101 33
  button "Manage Staffers", 1, 1 1 100 10
  button "Manage Groups", 2, 1 11 100 10
  button "Back", 3, 1 22 100 10
}

dialog account_staff_manage {
  title Manage Staff
  option dbu
  size -1 -1 101 44
  button "New Staffer", 1, 1 1 100 10
  button "Manage Staffer", 2, 1 11 100 10
  button "Fire Staffer", 3, 1 22 100 10
  button "Back", 4, 1 33 100 10
}

dialog account_staff_manage_hire {
  title Hire New Staff
  option dbu
  size -1 -1 203 55
  text "Username", 1, 1 1 50 10
  edit "", 2, 51 1 100 10
  button "Search", 3, 152 1 50 10
  button "Look-up", 4, 1 11 202 10
  text "Group", 5, 1 22 50 10
  combo 6, 51 22 152 10, drop disable
  button "Hire", 7, 1 33 202 10, disable
  button "Cancel", 8, 1 44 202 10
}

dialog account_staff_manage_hire_list {
  title Non-Staff Account List
  option dbu
  size -1 -1 101 143
  list 1, 1 1 100 100
  text "Username", 2, 1 100 100 10
  edit "", 3, 1 110 100 10, right read
  button "Select", 4, 1 121 100 10, disable
  button "Cancel", 5, 1 132 100 10
}

dialog account_staff_manage_manage {
  title Manage Staffer
  option dbu
  size -1 -1 203 66
  text "Username", 1, 1 1 50 10
  edit "", 2, 51 1 100 10
  button "Search", 3, 152 1 50 10
  button "Look-up", 4, 1 11 202 10
  text "Group", 5, 1 22 50 10
  combo 6, 51 22 152 10, drop disable
  button "Individual Permissions", 7, 1 33 202 10, disable
  button "Complete", 8, 1 44 202 10, disable
  button "Cancel", 9, 1 55 202 10
}

dialog account_staff_manage_manage_list {
  title Staff List
  option dbu
  size -1 -1 101 143
  list 1, 1 1 100 100
  text "Username", 2, 1 100 100 10
  edit "", 3, 1 110 100 10, right read
  button "Select", 4, 1 121 100 10, disable
  button "Cancel", 5, 1 132 100 10
}

dialog account_staff_manage_manage_perms {
  title Manage Permissions
  option dbu
  size -1 -1 152 55
  text "Permission", 1, 1 1 50 10
  combo 2, 51 1 100 10, drop
  text "Current", 3, 1 13 50 10
  text "", 4, 51 13 100 10, right
  text "New", 5, 1 24 50 10
  edit "", 6, 51 24 100 10, right disable
  button "Change", 7, 1 35 151 10, disable
  button "Cancel", 8, 1 46 151 10
}

dialog account_staff_manage_fire {
  title Fire Staffer
  option dbu
  size -1 -1 101 145
  list 1, 1 1 100 100
  text "Username", 2, 1 101 100 10
  text "", 3, 1 112 100 10
  button "Fire", 4, 1 123 100 10, disable
  button "Cancel", 5, 1 134 100 10
}

dialog account_staff_groups {
  title Group Options
  option dbu
  size -1 -1 101 44
  button "Create Group", 1, 1 1 100 10
  button "Manage Group", 2, 1 11 100 10
  button "Delete Group", 3, 1 22 100 10
  button "Back", 4, 1 33 100 10
}

dialog account_staff_groups_create {
  title Create Group
  option dbu
  size -1 -1 152 44
  text "Group Name", 1, 1 1 50 10
  edit "", 2, 51 1 100 10
  text "OpLevel", 3, 1 11 50 10
  combo 4, 51 11 100 10, drop
  button "Create", 5, 1 22 151 10
  button "Cancel", 6, 1 33 151 10
}

dialog account_staff_groups_manage {
  title Manage Group
  option dbu
  size -1 -1 203 68
  text "Group Name", 1, 1 1 50 10
  edit "", 2, 51 1 100 10
  button "Search", 3, 152 1 50 10
  button "Look-up", 4, 1 11 202 10
  text "OpLevel", 5, 1 22 100 10
  combo 6, 101 22 100 10, drop disable
  button "Change Permissions", 7, 1 35 202 10, disable
  button "Complete", 8, 1 46 202 10, disable
  button "Cancel", 9, 1 57 202 10
}

dialog account_staff_groups_manage_list {
  title Groups List
  option dbu
  size -1 -1 101 145
  list 1, 1 1 100 100
  text "Group Name", 2, 1 101 100 10
  text "", 3, 1 112 100 10
  button "Select", 4, 1 123 100 10, disable
  button "Cancel", 5, 1 134 100 10
}

dialog account_staff_groups_manage_perms {
  title Manage Permissions
  option dbu
  size -1 -1 152 55
  text "Permission", 1, 1 1 50 10
  combo 2, 51 1 100 10, drop
  text "Current", 3, 1 13 50 10
  text "", 4, 51 13 100 10, right
  text "New", 5, 1 24 50 10
  edit "", 6, 51 24 100 10, right disable
  button "Change", 7, 1 35 151 10, disable
  button "Cancel", 8, 1 46 151 10
}

dialog account_staff_groups_delete {
  title Delete Group
  option dbu
  size -1 -1 101 145
  list 1, 1 1 100 100
  text "Group Name", 2, 1 101 100 10
  text "", 3, 1 112 100 10
  button "Delete", 4, 1 123 100 10, disable
  button "Cancel", 5, 1 134 100 10
}

dialog account_system {
  title System Settings
  option dbu
  size -1 -1 101 44
  button "Core Settings", 1, 1 1 100 10
  button "User Settings", 2, 1 11 100 10
  button "Staff Settings", 3, 1 22 100 10
  button "Back", 4, 1 33 100 10
}

dialog account_system_core {
  title Core System Settings
  option dbu
  size -1 -1 101 66
  button "Output to Channel", 1, 1 1 100 10
  button "Output Channel", 2, 1 11 100 10
  button "Enforce Channel Access", 4, 1 22 100 10
  button "Join Output Channel", 5, 1 33 100 10
  button "Autojoin on Connect", 6, 1 44 100 10
  button "Back", 3, 1 55 100 10
}

dialog account_system_user {
  title User System Settings
  option dbu
  size -1 -1 101 66
  button "User Registration", 1, 1 1 100 10
  button "User Logins", 2, 1 11 100 10
  button "Require Password", 3, 1 22 100 10
  button "Require Email", 4, 1 33 100 10
  button "Email Validation", 5, 1 44 100 10
  button "Back", 6, 1 55 100 10
}

;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;on Dialog event;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;

on *:DIALOG:account:*:*: {
  If ($devent == sclick) {
    If ($did == 1) {
      dclose account
      start account_management
    }
    If ($did == 2) {
      dclose account
      start account_staff
    }
    If ($did == 3) {
      dclose account
      start account_system
    }
  }
}

on *:DIALOG:account_management:*:*: {
  If ($devent == sclick) {
    If ($did == 1) {
      dclose account_management
      start account_management_new
    }
    If ($did == 2) {
      dclose account_management
      start account_management_manage
    }
    If ($did == 3) {
      dclose account_management
      start account_management_delete
    }
    If ($did == 4) {
      dclose account_management
      start account
    }
  }
  If ($devent == close) {
    start account
  }
}

on *:DIALOG:account_management_new:*:*: {
  If ($devent == init) {
    If ($eas(settings,password) == on) { did -e $dname 4 }
    If ($eas(settings,email) == on) { did -e $dname 6 }
  }
  If ($devent == sclick) {
    If ($did == 7) {
      If (!$did(2)) { did -f $dname 2 }
      If ($eas(settings,password) == on) {
        If (!$did(4)) { did -f $dname 4 }
      }
      If ($eas(settings,email) == on) {
        If (!$did(6)) { did -f $dname 6 }
      }
      account register $did(2) $iif($eas(settings,password) == on,$did(4),) $iif($eas(settings,email) == on,$did(6),)
      dclose account_management_new
      start account_management
    }
    If ($did == 8) {
      dclose account_management_new
      start account_management
    }
  }
  If ($devent == close) {
    start account_management
  }
}

on *:DIALOG:account_management_manage:*:*: {
  If ($devent == sclick) {
    If ($did == 3) {
      start account_management_manage_list
    }
    If ($did == 4) {
      If ($eas(isRegistered,$did(2)) == yes) {
        did -b $dname 2-4
        If ($eas(settings,password) == on) { did -era $dname 6 $eas(userPass,$did(2)) }
        If ($eas(settings,email) == on) { did -era $dname 8 $eas(userEmail,$did(2)) }
        If ($alock($did(2)) == yes) { did -c $dname 11 }
        did -e $dname 9,11
      }
      Else {
        did -fr $dname 2
      }
    }
    If ($did == 9) {
      writeini account/ $+ $did(2) $+ /account.ini status password $did(6)
      writeini account/ $+ $did(2) $+ /account.ini status email $did(8)
      dclose $dname
      start account_management
    }
    If ($did == 10) {
      dclose $dname
      start account_management
    }
    If ($did == 11) {
      If ($alock($did(2)) == yes) {
        account unlock $did(2)
        did -u $dname 11
      }
      Else {
        var %temp.1 $?="PLease enter a time to expire in seconds."
        var %temp.2 $?="Please enter a lock reason."
        account lock $did(2) %temp.1 %temp.2
        did -c $dname 11
        start $dname
      }
    }
  }
  If ($devent == close) {
    start account_management
  }
}

on *:DIALOG:account_management_manage_list:*:*: {
  If ($devent == init) {
    If (!$dialog(account_management_manage)) {
      start account_management_manage
      dialog -v $dname
    }
    var %temp.1 1
    While (%temp.1 <= $lines(account/accounts.txt)) {
      did -a $dname 1 $read(account/accounts.txt,t,%temp.1)
      inc %temp.1
    }
  }
  If ($devent == sclick) {
    If ($did == 1) {
      did -ra $dname 3 $did(1).seltext
      did -e $dname 4
    }
    If ($did == 4) {
      If (!$dialog(account_management_manage)) { start account_management_manage }
      did -b account_management_manage 2-4
      did -ra account_management_manage 2 $did(3)
      If ($eas(settings,password) == on) { did -era account_management_manage 6 $eas(userPass,$did(3)) }
      If ($eas(settings,email) == on) { did -era account_management_manage 8 $eas(userEmail,$did(3)) }
      did -e account_management_manage 9,11
      If ($alock($did(3)) == yes) { did -c account_management_manage 11 }
      dclose $dname
      start account_management_manage
    }
    If ($did == 5) {
      dclose $dname
      start account_management_manage
    }
  }
  If ($devent == dclick) {
    If ($did == 1) {
      If (!$dialog(account_management_manage)) { start account_management_manage }
      did -b account_management_manage 2-4
      did -ra account_management_manage 2 $did(1).seltext
      If ($eas(settings,password) == on) { did -era account_management_manage 6 $eas(userPass,$did(1).seltext) }
      If ($eas(settings,email) == on) { did -era account_management_manage 8 $eas(userEmail,$did(1).seltext) }
      did -e account_management_manage 9,11
      If ($alock($did(1).seltext) == yes) { did -c account_management_manage 11 }
      dclose $dname
      start account_management_manage
    }
  }
  If ($devent == close) {
    start account_management
  }
}

on *:DIALOG:account_management_delete:*:*: {
  If ($devent == init) {
    var %temp.1 1
    While (%temp.1 <= $lines(account/accounts.txt)) {
      did -a $dname 1 $read(account/accounts.txt, %temp.1)
      inc %temp.1
    }
  }
  If ($devent == sclick) {
    If ($did == 1) {
      did -ra $dname 3 $did(1).seltext
      did -e $dname 4
    }
    If ($did == 4) {
      If (!$did(3)) { did -b $dname 4 | halt }
      account unregister $did(3)
      dclose $dname
      start account_management
    }
    If ($did == 5) {
      dclose $dname
      start account_management
    }
  }
  If ($devent == close) {
    start account_management
  }
}

on *:DIALOG:account_staff:*:*: {
  If ($devent == sclick) {
    If ($did == 1) {
      dclose $dname
      start account_staff_manage
    }
    If ($did == 2) {
      dclose $dname
      start account_staff_groups
    }
    If ($did == 3) {
      dclose $dname
      start account
    }
  }
  If ($devent == close) {
    start account
  }
}

on *:DIALOG:account_staff_manage:*:*: {
  If ($devent == sclick) {
    If ($did == 1) {
      dclose $dname
      start account_staff_manage_hire
    }
    If ($did == 2) {
      dclose $dname
      start account_staff_manage_manage
    }
    If ($did == 3) {
      dclose $dname
      start account_staff_manage_fire
    }
    If ($did == 4) {
      dclose $dname
      start account_staff
    }
  }
  If ($devent == close) {
    start account_staff
  }
}

on *:DIALOG:account_staff_manage_hire:*:*: {
  If ($devent == init) {
    var %temp.1 1
    While (%temp.1 <= $lines(account/staff/groups.txt)) {
      did -a $dname 6 $read(account/staff/groups.txt,t,%temp.1)
      inc %temp.1
    }
  }
  If ($devent == sclick) {
    If ($did == 3) {
      start account_staff_manage_hire_list
    }
    If ($did == 4) {
      If ($eas(isRegistered,$did(2)) != yes) { did -rf $dname 2 | cout User is not registered! | halt }
      If ($eas(isStaff,$did(2)) == yes) { did -rf $dname 2 | cout User is already staff! | halt }
      did -b $dname 2-4
      did -e $dname 6,7
    }
    If ($did == 7) {
      If (!$did(6).seltext) { cout Select a group first! | halt }
      account hire $did(2) $did(6)
      dclose $dname
      start account_staff_manage
    }
    If ($did == 8) {
      dclose $dname
      start account_staff_manage
    }
  }
  If ($devent == close) {
    start account_staff_manage
  }
}

on *:DIALOG:account_staff_manage_hire_list:*:*: {
  If ($devent == init) {
    var %temp.1 1
    While (%temp.1 <= $lines(account/accounts.txt)) {
      If ($eas(isStaff,$read(account/accounts.txt,t,%temp.1)) != yes) {
        did -a $dname 1 $read(account/accounts.txt,t,%temp.1)
      }
      inc %temp.1
    }
  }
  If ($devent == sclick) {
    If ($did == 1) {
      did -ra $dname 3 $did(1).seltext
      did -e $dname 4
    }
    If ($did == 4) {
      did -b account_staff_manage_hire 2-4
      did -ra account_staff_manage_hire 2 $did(3)
      did -e account_staff_manage_hire 6,7
      dclose $dname
      start account_staff_manage_hire
    }
    If ($did == 5) {
      dclose $dname
      start account_staff_manage_hire
    }
  }
  If ($devent == dclick) {
    If ($did == 1) {
      did -b account_staff_manage_hire 2-4
      did -ra account_staff_manage_hire 2 $did(1).seltext
      did -e account_staff_manage_hire 6,7
      dclose $dname
      start account_staff_manage_hire
    }
  }
  If ($devent == close) {
    start account_staff_manage_hire
  }
}

on *:DIALOG:account_staff_manage_manage:*:*: {
  If ($devent == init) {
    var %temp.1 1
    While (%temp.1 <= $lines(account/staff/groups.txt)) {
      did -a $dname 6 $read(account/staff/groups.txt,t,%temp.1)
      inc %temp.1
    }
  }
  If ($devent == sclick) {
    If ($did == 3) {
      start account_staff_manage_manage_list
    }
    If ($did == 4) {
      If ($eas(isStaff,$did(2)) != yes) { did -rf $dname 2 | cout User is not staff! | halt }
      did -b $dname 2-4
      did -e $dname 6-8
    }
    If ($did == 7) {
      start account_staff_manage_manage_perms
    }
    If ($did == 8) {
      If (!$did(6).seltext) { cout Please select a group first! | halt }
      account changeGroup $did(2) $did(6).seltext
      dclose $dname
      start account_staff_manage
    }
    If ($did == 9) {
      dclose $dname
      start account_staff_manage
    }
  }
  If ($devent == close) {
    start account_staff_manage
  }
}

on *:DIALOG:account_staff_manage_manage_list:*:*: {
  If ($devent == init) {
    var %temp.1 1
    While (%temp.1 <= $lines(account/staff/staffers.txt)) {
      did -a $dname 1 $read(account/staff/staffers.txt,t,%temp.1)
      inc %temp.1
    }
  }
  If ($devent == sclick) {
    If ($did == 1) {
      did -ra $dname 3 $did(1).seltext
      did -e $dname 4
    }
    If ($did == 4) {
      did -b account_staff_manage_manage 2-4
      did -ra account_staff_manage_manage 2 $did(3)
      did -e account_staff_manage_manage 6-8
      dclose $dname
      start account_staff_manage_manage
    }
    If ($did == 5) {
      dclose $dname
      start account_staff_manage_manage
    }
  }
  If ($devent == dclick) {
    If ($did == 1) {
      did -b account_staff_manage_manage 2-4
      did -ra account_staff_manage_manage 2 $did(1).seltext
      did -e account_staff_manage_manage 6-8
      dclose $dname
      start account_staff_manage_manage
    }
  }
  If ($devent == close) {
    start account_staff_manage_manage
  }
}

on *:DIALOG:account_staff_manage_manage_perms:*:*: {
  If ($devent == init) {
    var %temp.1 1
    While (%temp.1 <= $lines(account/perms.txt)) {
      did -a $dname 2 $read(account/perms.txt,t,%temp.1)
      inc %temp.1
    }
  }
  If ($devent == sclick) {
    If ($did == 2) {
      did -b $dname 2
      did -ra $dname 4 $eas(perm,$did(account_staff_manage_manage,2),$did(2).seltext)
      did -e $dname 6,7
    }
    If ($did == 7) {
      If (!$did(6)) { did -f $dname 6 | cout Please type a new value first! | halt }
      account changePerm $did(account_staff_manage_manage,2) $did(2).seltext $did(6)
      dclose $dname
      start account_staff_manage_manage
    }
    If ($did == 8) {
      dclose $dname
      start account_staff_manage_manage
    }
  }
  If ($devent == close) {
    start account_staff_manage_manage
  }
}

on *:DIALOG:account_staff_manage_fire:*:*: {
  If ($devent == init) {
    var %temp.1 1
    While (%temp.1 <= $lines(account/staff/staffers.txt)) {
      did -a $dname 1 $read(account/staff/staffers.txt, %temp.1)
      inc %temp.1
    }
  }
  If ($devent == sclick) {
    If ($did == 1) {
      did -ra $dname 3 $did(1).seltext
      did -e $dname 4
    }
    If ($did == 4) {
      account fire $did(3)
      dclose $dname
      start account_staff_manage
    }
    If ($did == 5) {
      dclose $dname
      start account_staff_manage
    }
  }
  If ($devent == close) {
    start account_staff_manage
  }
}

on *:DIALOG:account_staff_groups:*:*: {
  If ($devent == sclick) {
    If ($did == 1) {
      dclose $dname
      start account_staff_groups_create
    }
    If ($did == 2) {
      dclose $dname
      start account_staff_groups_manage
    }
    If ($did == 3) {
      dclose $dname
      start account_staff_groups_delete
    }
    If ($did == 4) {
      dclose $dname
      start account_staff
    }
  }
  If ($devent == close) {
    start account_staff
  }
}

on *:DIALOG:account_staff_groups_create:*:*: {
  If ($devent == init) {
    var %temp.1 1
    While (%temp.1 <= 7) {
      did -a $dname 4 %temp.1
      inc %temp.1
    }
  }
  If ($devent == sclick) {
    If ($did == 5) {
      If (!$did(2)) { did -f $dname 2 | cout Please input a name first! | halt }
      If ($eas(isGroup,$did(2)) == yes) { did -f $dname 2 | cout This group is already registered! | halt }
      If (!$did(4).seltext) { did -f $dname 4 | cout Please select an OpLevel first! | halt }
      account group $did(2) add $did(4).seltext
      dclose $dname
      start account_staff_groups
    }
    If ($did == 6) {
      dclose $dname
      start account_staff_groups
    }
  }
  If ($devent == close) {
    start account_staff_groups
  }
}

on *:DIALOG:account_staff_groups_manage:*:*: {
  If ($devent == init) {
    var %temp.1 1
    While (%temp.1 <= 7) {
      did -a $dname 6 %temp.1
      inc %temp.1
    }
  }
  If ($devent == sclick) {
    If ($did == 3) {
      start account_staff_groups_manage_list
    }
    If ($did == 4) {
      If (!$did(2)) { did -f $dname 2 | halt }
      If ($eas(isGroup,$did(2)) != yes) { did -f $dname 2 | cout This is not a valid group! | halt }
      did -b $dname 2-4
      did -e $dname 6-8
      did -ra $dname 5 OpLevel - Current: $eas(opLevel,$did(2))
    }
    If ($did == 7) {
      start account_staff_groups_manage_perms
    }
    If ($did == 8) {
      If (!$did(6).seltext) { did -f $dname 6 | cout Please select a new OpLevel! | halt }
      account group $did(2) opLevel $did(6).seltext
      dclose $dname
      start account_staff_groups
    }
    If ($did == 9) {
      dclose $dname
      start account_staff_groups
    }
  }
  If ($devent == close) {
    dclose $dname
    start account_staff_groups
  }
}

on *:DIALOG:account_staff_groups_manage_list:*:*: {
  If ($devent == init) {
    var %temp.1 1
    While (%temp.1 <= $lines(account/staff/groups.txt)) {
      did -a $dname 1 $read(account/staff/groups.txt,t,%temp.1)
      inc %temp.1
    }
  }
  If ($devent == sclick) {
    If ($did == 1) {
      did -ra $dname 3 $did(1).seltext
      did -e $dname 4
    }
    If ($did == 4) {
      did -b account_staff_groups_manage 2-4
      did -e account_staff_groups_manage 6-8
      did -ra account_staff_groups_manage 2 $did(3)
      did -ra account_staff_groups_manage 5 OpLevel - Current: $eas(opLevel,$did(3))
      dclose $dname
      start account_staff_groups_manage
    }
    If ($did == 5) {
      dclose $dname
      start account_staff_groups_manage
    }
  }
  If ($devent == dclick) {
    If ($did == 1) {
      did -b account_staff_groups_manage 2-4
      did -e account_staff_groups_manage 6-8
      did -ra account_staff_groups_manage 2 $did(1).seltext
      did -ra account_staff_groups_manage 5 OpLevel - Current: $eas(opLevel,$did(1).seltext)
      dclose $dname
      start account_staff_groups_manage
    }
  }
  If ($devent == close) {
    start account_staff_groups_manage
  }
}

on *:DIALOG:account_staff_groups_manage_perms:*:*: {
  If ($devent == init) {
    var %temp.1 1
    While (%temp.1 <= $lines(account/perms.txt)) {
      did -a $dname 2 $read(account/perms.txt,t,%temp.1)
      inc %temp.1
    }
  }
  If ($devent == sclick) {
    If ($did == 2) {
      did -b $dname 2
      did -ra $dname 4 $eas(gperm,$did(account_staff_groups_manage,2),$did(2).seltext)
      did -e $dname 6,7
    }
    If ($did == 7) {
      If (!$did(6)) { did -f $dname 6 | cout Please type a new value first! | halt }
      account group $did(account_staff_groups_manage,2) perms $did(2).seltext $did(6)
      dclose $dname
      start account_staff_groups_manage
    }
    If ($did == 8) {
      dclose $dname
      start account_staff_groups_manage
    }
  }
  If ($devent == close) {
    start account_staff_groups_manage
  }
}

on *:DIALOG:account_staff_groups_delete:*:*: {
  If ($devent == init) {
    var %temp.1 1
    While (%temp.1 <= $lines(account/staff/groups.txt)) {
      did -a $dname 1 $read(account/staff/groups.txt,t,%temp.1)
      inc %temp.1
    }
  }
  If ($devent == sclick) {
    If ($did == 1) {
      did -ra $dname 3 $did(1).seltext
      did -e $dname 4
    }
    If ($did == 4) {
      account group $did(3) remove
      dclose $dname
      start account_staff_groups
    }
    If ($did == 5) {
      dclose $dname
      start account_staff_groups
    }
  }
  If ($devent == close) {
    start account_staff_groups
  }
}

on *:DIALOG:account_system:*:*: {
  If ($devent == sclick) {
    If ($did == 1) {
      dclose $dname
      start account_system_core
    }
    If ($did == 2) {
      dclose $dname
      start account_system_user
    }
    If ($did == 3) { account settings staff | halt }
    If ($did == 4) {
      dclose $dname
      start account
    }
  }
  If ($devent == close) {
    start account
  }
}

on *:DIALOG:account_system_core:*:*: {
  If ($devent == init) {
    did -ra $dname 1 Output to Channel: $eas(settings,output)
    did -ra $dname 2 Output Channel: $eas(status,output)
    did -ra $dname 4 Enforce Channel Access: $eas(settings,enforcechannelaccess)
    did -ra $dname 6 Autojoin on Connect: $eas(settings,autojoin)
  }
  If ($devent == sclick) {
    If ($did == 1) {
      If ($eas(settings,output) == on) {
        writeini account/account.ini settings output off
        did -ra $dname 1 Output to Channel: Off
      }
      Else {
        writeini account/account.ini settings output on
        did -ra $dname 1 Output to Channel: On
      }
    }
    If ($did == 2) {
      var %temp.1 $?="Please enter the name of the new channel."
      If (%temp.1) {
        writeini account/account.ini status output %temp.1
        did -ra $dname 2 Output Channel: %temp.1
      }
      start $dname
    }
    If ($did == 3) {
      dclose $dname
      start account_system
    }
    If ($did == 4) {
      If ($eas(settings,enforcechannelaccess) == on) {
        writeini account/account.ini settings enforcechannelaccess off
        did -ra $dname 4 Enforce Channel Access: Off
      }
      Else {
        writeini account/account.ini settings enforcechannelaccess on
        did -ra $dname 4 Enforce Channel Access: On
      }
    }
    If ($did == 5) {
      join $eas(status,output)
      did -b $dname 5
      start $dname
    }
    If ($did == 6) {
      If ($eas(settings,autojoin) == on) {
        writeini account/account.ini settings autojoin off
        did -ra $dname 6 Autojoin on Connect: Off
      }
      Else {
        writeini account/account.ini settings autojoin on
        did -ra $dname 6 Autojoin on Connect: On
      }
    }
  }
  If ($devent == close) {
    start account_system
  }
}

on *:DIALOG:account_system_user:*:*: {
  If ($devent == init) {
    did -ra $dname 1 User Registration: $iif($eas(settings,registration) == on,On,Off)
    did -ra $dname 2 User Login: $iif($eas(settings,login) == on,On,Off)
    did -ra $dname 3 Require Password: $iif($eas(settings,password) == on,On,Off)
    did -ra $dname 4 Require Email: $iif($eas(settings,email) == on,On,Off)
    did -ra $dname 5 Email Validation: $iif($eas(settings,emailvalidate) == on,On,Off)
  }
  If ($devent == sclick) {
    If ($did == 1) {
      If ($eas(settings,registration) == on) {
        writeini account/account.ini settings registration off
        did -ra $dname 1 User Registration: Off
      }
      Else {
        writeini account/account.ini settings registration on
        did -ra $dname 1 User Registration: On
      }
    }
    If ($did == 2) {
      If ($eas(settings,login) == on) {
        writeini account/account.ini settings login off
        did -ra $dname 2 User Login: Off
      }
      Else {
        writeini account/account.ini settings login on
        did -ra $dname 2 User Login: On
      }
    }
    If ($did == 3) {
      If ($eas(settings,password) == on) {
        writeini account/account.ini settings password off
        did -ra $dname 3 Require Password: Off
      }
      Else {
        writeini account/account.ini settings password on
        did -ra $dname 3 Require Password: On
      }
    }
    If ($did == 4) {
      If ($eas(settings,email) == on) {
        writeini account/account.ini settings email off
        did -ra $dname 4 Require Email: Off
      }
      Else {
        writeini account/account.ini settings email on
        did -ra $dname 4 Require Email: On
      }
    }
    If ($did == 5) {
      If ($eas(settings,emailvalidate) == on) {
        writeini account/account.ini settings emailvalidate off
        did -ra $dname 5 Email Validation: Off
      }
      Else {
        writeini account/account.ini settings emailvalidate on
        did -ra $dname 5 Email Validation: On
      }
    }
    If ($did == 6) {
      dclose $dname
      start account_system
    }
  }
  If ($devent == close) {
    start account_system
  }
}

;;;;;;;;;;;;;;
;;;;;Menu;;;;;
;;;;;;;;;;;;;;

menu * {
  -
  EAS Console: /account open
}

;;;;;;;;;;;;;;;;;
;;;;;on TEXT;;;;;
;;;;;;;;;;;;;;;;;

on *:TEXT:!account*:*: {
  If ($readini(account/account.ini,status,installed) != yes) { halt }
  If ($eas(checkversion) != $eas(version)) { .msg $nick Please wait while the system is updated. | halt }
  If ($eas(isRegistered,$nick) != yes) {
    If (!$2) && ($2 != register) {
      .msg $nick You are not currently registered for an account.
      If ($eas(settings,registration) == on) {
        .msg $nick To register for an account, please type: !account register $iif($eas(settings,password) == on,$iif($eas(settings,email) == on,<password> <email>,<password>),$iif($eas(settings,email) == on,<email>,))
      }
      Else {
        .msg $nick Currently, the owner is not allowing any new registrations.
      }
    }
    Else {
      If ($eas(settings,password) == on) {
        If ($eas(settings,email) == on) {
          If (!$4) { .msg $nick Please type !account register <password> <email> | halt }
          If ($eas(settings,emailvalidate) == on) {
            If ($readini(account/account.ini,emailvalidate,$4) == registered) { .msg $nick This email is already registered to another account. | halt }
          }
          account register $nick $3 $4
          account login $nick -s
          .msg $nick You have been sucessfully registered for an account! To begin, please type !account
          If ($eas(settings,output) == on) { msg $eas(status,output) $nick has sucessfully registered for an account: $asctime(ddmmmyyyy hh:nn:ss TT) }
          halt
        }
        Else {
          If (!$3) { .msg $nick Please type !account register <password> | halt }
          account register $nick $3
          account login $nick -s
          .msg $nick You have been sucessfully registered for an account! To begin, please type !account
          If ($eas(settings,output) == on) { msg $eas(status,output) $nick has sucessfully registered for an account: $asctime(ddmmmyyyy hh:nn:ss TT) }
          halt
        }
      }
      Else {
        If ($eas(settings,email) == on) {
          If (!$3) { .msg $nick Please type !account register <email> | halt }
          If ($eas(settings,emailvalidate) == on) {
            If ($readini(account/account.ini,emailvalidate,$4) == registered) { .msg $nick This email is already registered to another account. | halt }
          }
          account register $nick $3
          account login $nick -s
          .msg $nick You have been sucessfully registered for an account! To begin, please type !account
          If ($eas(settings,output) == on) { msg $eas(status,output) $nick has sucessfully registered for an account: $asctime(ddmmmyyyy hh:nn:ss TT) }
          halt
        }
        Else {
          account register $nick
          account login $nick -s
          .msg $nick You have been sucessfully registered for an account! To begin, please type !account
          If ($eas(settings,output) == on) { msg $eas(status,output) $nick has sucessfully registered for an account: $asctime(ddmmmyyyy hh:nn:ss TT) }
          halt
        }
      }
    }
  }
  Elseif ($alock($nick) == yes) {
    If ($eas(perm,$nick,op) == true) { goto accountlogin }
    If ($eas(perm,$nick,lockBypass) == true) { goto accountlogin }
    If ($eas(gperm,$eas(staffGroup,$nick),op) == true) { goto accountlogin }
    If ($eas(gperm,$eas(staffGroup,$nick),lockBypass) == true) { goto accountlogin }
    If ($ctime >= $alock($nick,unlock)) {
      account unlock $nick
      goto accountlogin
    }
    .msg $nick You are currently locked out of your account.
    .msg $nick You are locked out for the following reason: $alock($nick,reason)
    .msg $nick Your account will unlock on: $asctime($alock($nick,unlock),ddmmmyyyy hh:nn:ss TT)
    halt
  }
  goto accountlogin
  :accountlogin
  If ($eas(loggedin,$nick) != yes) {
    If (!$3) || ($eas(userPass,$nick) !=== $3) { .msg $nick Please login first by typing /msg $me !account login <password> | halt }
    Else {
      account login $nick
      .msg $nick You have been logged-in sucessfully! To begin, please type !account
      halt
    }
  }
  Else {
    If (!$2) {
      .msg $nick Please select from the following options:
      .msg $nick To view your changeable account settings, please type !account settings
      .msg $nick To view your unchangeable account settings, please type !account uas
      .msg $nick To logout, please type !account logout
    }
    Elseif ($2 == settings) {
      If (!$3) {
        .msg $nick The following are your changeable account settings (and how to change them):
        .msg $nick Password: $iif($eas(userPass,$nick),$eas(userPass,$nick),Not Set) - !account settings pass <new password>
        .msg $nick Email: $iif($eas(userEmail,$nick),$eas(userEmail,$nick,),Not Set) - !account settings email <new email>
      }
      Elseif ($3 == pass) {
        If (!$4) { .msg $nick Please type !account settings pass <new pass> | halt }
        writeini account/ $+ $nick $+ /account.ini status password $4
        .msg $nick Your password has been changed sucessfully!
        If ($eas(settings,password) != on) { .msg $nick Currently, a password is not required to login. }
      }
      Elseif ($3 == email) {
        If (!$4) { .msg $nick Please type !account settings email <new email> | halt }
        If ($eas(settings,emailvalidate) == on) {
          If ($readini(account/account.ini,emailvalidate,$4) == registered) { .msg $nick That email is already registered to another account. | halt }
          Else {
            remini account/account.ini emailvalidate $eas(userEmail,$nick)
            writeini account/account.ini emailvalidate $4
          }
        }
        writeini account/ $+ $nick $+ /account.ini status email $4
        .msg $nick Your email has been changed sucessfully!
        If ($eas(settings,email) != on) { .msg $nick Currently, an email is not required. }
      }
      Else {
        .msg $nick Unknown command. For more help with this, please type !account settings
      }
    }
    Elseif ($2 == uas) {
      .msg $nick The following are your unchangeable account settings:
      .msg $nick Join Date: $asctime($eas(joinTime,$nick),ddmmmyyyy hh:nn:ss TT)
      .msg $nick Is your account locked? $alock($nick)
      .msg $nick Most recent lock date: $asctime($alock($nick,date),ddmmmyyyy hh:nn:ss TT) - by: $alock($nick,locker)
      .msg $nick Reason: $alock($nick,reason)
    }
    Elseif ($2 == logout) {
      account logout $nick
      .msg $nick You've been logged-out sucessfully!
    }
    Else {
      .msg $nick Unknown command. For more help with this, please type !account
    }
  }
}

;;;;;;;;;;;;;;;;;;;
;;;;;on *:JOIN;;;;;
;;;;;;;;;;;;;;;;;;;

on *:JOIN:*: {
  If ($nick == $me) { halt }
  If ($chan == $eas(status,output)) && ($eas(settings,enforcechannelaccess) == yes) {
    If ($eas(isStaff,$nick) != yes) {
      kick $chan $nick
    }
    Else {
      msg $chan Welcome $nick $+ ! Please remember this channel access is restricted.
    }
  }
}

;;;;;;;;;;;;;;;;;;;;;;
;;;;;on *:CONNECT;;;;;
;;;;;;;;;;;;;;;;;;;;;;

on *:CONNECT: {
  If ($eas(settings,autojoin) == on) {
    join $eas(status,output)
  }
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...