<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Wednesday, June 14, 2006, 9:02 AM -->
<!-- MuClient version 3.75 -->

<!-- Plugin "test_OnPluginCommandEntered" generated by Plugin Wizard -->

<muclient>
<plugin
   name="test_OnPluginCommandEntered"
   author="Nick Gammon"
   id="d26dbc51e7d99af46d526a64"
   language="lua"
   purpose="tests OnPluginCommandEntered callback"
   date_written="2006-06-14 09:00:44"
   requires="3.75"
   version="1.0"
   >

</plugin>


<!--  Script  -->

<include name="$PLUGINSDEFAULTDIR-$PROGRAMDIR-$WORLDDIR-$PLUGINDIR-blah" />

<script>
<![CDATA[
function OnPluginCommandEntered (sText)
  a, b, c = rex.new ("(?:say |:|spoof |ooc |page \w+|whisper \w+)(.+)"):exec (sText)

  if a == nil then
    return sText  -- not matched our regular expression
  end

  -- matched regular expression - check the command
  check = SpellCheckCommand (c [1], c [2])

  -- if check failed, cancel sending
  if check == 0 then
  	DoAfterSpecial (0.1, string.format ("PasteCommand (%q)", sText), 12)
    return '\t'	-- cancelled, don't process
  end

  -- get the amended command, send that instead
  return GetCommand ()
end
]]>
</script>


</muclient>
