<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Thursday, May 24, 2007, 11:06 PM -->
<!-- MuClient version 4.01 -->

<!-- Plugin "ClientLock" generated by Plugin Wizard -->

<muclient>
<plugin
   name="ClientLock"
   author="Malix@8bit"
   id="78c224f899e7f4d174f017b6"
   language="JScript"
   purpose="Lets you lock the command window while you're AFK"
   date_written="2007-05-24 23:05:12"
   requires="3.70"
   version="1.01"
   >
<description trim="y">
<![CDATA[
This plugin will lock the command window, so you can step away from the computer without worrying about somebody messing with your character. If this plugin is removed while the client is locked it'll disconnect the world.

**** Commands ****
clientlock <password>
clientlock

  The first form of this command locks the command window with the given <password>. The second form will relock the client with the same password you used before. The password is not saved between sessions so you must enter one each time you reopen the world file. This command is not output, logged, or saved to command history to protect your password.

clientunlock <password>

  This will unlock the command window if <password> matched the password you specified in clientlock.

]]>
</description>

</plugin>


<!--  Aliases  -->

<aliases>
  <alias
   script="ClientLock"
   match="^clientlock(?: (.+))?$"
   enabled="y"
   omit_from_command_history="y"
   omit_from_log="y"
   regexp="y"
   omit_from_output="y"
   sequence="1"
  >
  </alias>
  <alias
   script="ClientUnlock"
   match="clientunlock *"
   enabled="y"
   omit_from_command_history="y"
   omit_from_log="y"
   omit_from_output="y"
   sequence="1"
  >
  </alias>
</aliases>

<!--  Script  -->


<script>
<![CDATA[
var bClientLocked = false;
var sClientPass = "";

function OnPluginClose() {
	if (bClientLocked && world.IsConnected()) {
		world.note("Attempt to uninstall plugin while locked. Closing connection.");
		world.Disconnect();
	}
}

function OnPluginDisable() {
	if (bClientLocked && world.IsConnected()) {
		world.note("Attempt to disable plugin while locked. Closing connection.");
		world.Disconnect();
	}
}

function OnPluginCommand(sText) {
	if (bClientLocked) {
		if (sText.length >= 12 && sText.slice(0,12) == "clientunlock") {
			return true;
		}
		else {
			world.note("Client is locked. Enter \"clientunlock <password>\" to unlock.");
			return false;
		}
	}
	else {
		return true;
	}
}


function ClientUnlock(thename, theoutput, wildcardsVB) {
	var wildcards = VBArray(wildcardsVB).toArray();
	if (bClientLocked) {
		if (wildcards[0] == sClientPass) {
			world.note("Client unlocked.");
			bClientLocked = false;
		}
		else {
			world.note("Incorrect password.");
		}
	}
	else {
		world.note("The client is not currently locked.");
	}
}

function ClientLock(thename, theoutput, wildcardsVB) {
	var wildcards = VBArray(wildcardsVB).toArray();
	if (bClientLocked) {
		world.note("Client is already locked.");
	}
	else {
		if (wildcards[0] == "") {
			if (sClientPass == "") {
				world.note("Initial password has not been set.");
			}
			else {
				bClientLocked = true;
				world.note("Client locked.");
			}
		}
		else {
			sClientPass = wildcards[0];
			bClientLocked = true;
			world.note("Client locked.");
		}
	}
}

]]>
</script>


<!--  Plugin help  -->

<aliases>
  <alias
   script="OnHelp"
   match="ClientLock:help"
   enabled="y"
  >
  </alias>
</aliases>

<script>
<![CDATA[
function OnHelp (sName, sLine, wildcards)
  {
  world.Note (world.GetPluginInfo (world.GetPluginID, 3));
  }
]]>
</script> 

</muclient>
