;  --------OpMinder v2.0 by Racked, 04/09/99--------Operation-tested by Zud. 04/09/99----------
;  -------- no revisions as of May 28, 1999
;  NOTE:  For mIRC version 5.51
;
;  -----||||||<<--Readme-->>||||||----
;  This script grants ops under 4 conditions:  a) you must have current op-status,
;  b) user must be in channel(s) with you, c) user must use:  /msg <nick> !pswd <password>,
;  and d)  Chanserv's OPGUARD setting (if available) must be OFF.  If the opped user leaves the channel
;  and returns, they must send the password to regain op status.
;  --------Loading--------
;  Opminder.mrc should be in the main mIRC folder:   /load -rs Opminder.mrc, or load
;  from Remotes with File\Load\Script.
;  --------Enabling--------
;  In the Status and Channel window popups, OPminder status is indicated by "OPminder [-]" (off),
;  or "OPminder [+]" (on).  The submenu item is used to toggle Off or On.
;  --------Removing & Changing Your Password--------
;  The password is removed and changed via status or channel window popups.
;  Recommendation:  change password often.  This script does not verify addresses.
;  --------Sending Your Password to 'loved ones'--------
;  From the appended channel nicklist popup, select a nick and click "Send Opminder Pass".
;  The recipient will receive your set password and the message syntax to be used to obtain ops.
;  --------OPminder.ini file--------
;  Upon the script's first response to the correct password, it creates the "OPminder.ini" file. This file logs
;  the following:  <nickname=!pswd> <time< <date> <(user address)>.  Since INI files are cached in memory,
;  /flushini is used to update the INI.  If OPminder.ini is deleted, this script will re-create it.
;  --------Final--------
;  If you modify and have problems, it's your 'baby' to fix----do NOT bug me.
;  Have fun with it!  :)
;  Racked can be found in DALnet's #mIRC setting off 'channel bombs'.
;  --------EOR (End Of Readme)--------
;
;  --------Remote Event--------
;  Log to OPminder.ini if password is correct
;  Sends appropriate notice, and if password is correct, ops the user.
;
#OPminder off
on @1:TEXT:!pswd*:?:{
  if ($2 == %OPminder.password) {
    if ( [ $readini -n $mircdirOPminder.ini OPminder nicks ] )  writeini $mircdirOPminder.ini OPminder $nick $$1 $asctime(h:nn:tt) $adate ( $+ $mask($address,3) $+ )
    else writeini $mircdirOPminder.ini OPminder nicks $readini -n $mircdirOPminder.ini OPminder nicks  $+ : $+ $nick
    flushini $mircdirOPminder.ini
    msg $nick The password is correct.  Op status granted.
    op.users $nick
  }
  else .notice $nick Sorry...that password is incorrect.
}
#OPminder end
;
;  --------[ Aliases ]--------
;  This alias verifies that the user is in channels with you.
;   It 'fires' in the ON TEXT event to users who send the correct password.
;
alias op.users {
  set %com.chan 0
  :start
  inc -u0 %com.chan 1
  if ($comchan($$1,%com.chan)) {
    if ($me isop $comchan($$1,%com.chan)) mode $comchan($$1,%com.chan) +o $$1
    goto start
  }
}
alias OPminder.SetPassword {
  if (%OPminder.password) set -u0 %temp.OPminder.password $$?="Change the password from %OPminder.password to what?"
  else set -u0 %temp.OPminder.password $$?="Set the password to what?"
  if (%temp.OPminder.password != %password) {
    set %OPminder.password %temp.OPminder.password
    echo 3 -a *** OPminder password changed to: %OPminder.password
    else echo 3 -a *** OPminder password unchanged
  }
}
;
; --------[ Labels ]--------
;  Displays dynamic popup labels
;
alias OPminder.Label { if ($group(#OPminder) == on) return OPminder [+] | else return OPminder [-] }
alias OPminder.IsOn { if ($group(#OPminder) == on) return Turn Off | else return Turn On }
alias OPminder.ChangePassword if (%OPminder.password) return Change Password
alias OPminder.UnsetPassword if (%OPminder.password) return Remove Password
alias OPminder.NoticePassword if (%OPminder.password) return Send OPminder Pass
;
; --------[ Popups ]--------
;  Displays remote group status as on or off.
;  Disable/enable #OPminder group
;  Set/Remove password
;  Send password to selected nick in channel's nicklist
;
menu status,channel {
  $OPminder.Label
  .$OPminder.IsOn:{
    if (%OPminder.password == $null) OPminder.SetPassword
    if ($group(#OPminder) == on) {
      .disable #OPminder
      echo 3 -a *** OPminder: Off
    }
    else {
      .enable #OPminder
      echo 3 -a *** OPminder: On
    }
  }
  .-
  .$OPminder.ChangePassword:OPminder.SetPassword
  .$OPminder.UnsetPassword:{
    unset %OPminder.password
    .disable #OPminder
    echo 3 -a *** OPminder: Off and password removed
  }
}
menu nicklist {
  $OPminder.NoticePassword:{
    .notice $$1 My OPminder password is: %OPminder.password $+ .  Please don't reveal it to anyone.  I will now give you ops on any channel in which I have ops.
    .notice $$1 To use this, /msg $me !pswd %OPminder.password
  }
}
;
;  --------EOF--------OPminder v2.0  Racked, 1999 

