Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="iso-8859-1"?>
- <!DOCTYPE muclient>
- <!-- Saved on Sunday, October 20, 2013, 11:56 PM -->
- <!-- MuClient version 4.77 -->
- <!-- Plugin "CommandCleaner" generated by Plugin Wizard -->
- <muclient>
- <plugin
- name="CommandCleaner"
- author="Vakieh"
- id="d03e046d8561ad6eb7cc3958"
- language="Lua"
- purpose="Clears the command bar if it is left idle"
- save_state="y"
- date_written="2013-10-20 23:54:54"
- requires="4.77"
- version="1.0"
- >
- <description trim="n">
- <![CDATA[
- Command Cleaner moves old entered commands into the command history if you leave them alone for a certain length of time - thus preventing accidental command entries if you start something like a channel comment then get distracted.
- The cleared commands can be retrieved from the command history if necessary, by pressing the up arrow.
- Usage:
- CommandCleaner:help
- - this help description and status display
- CommandCleaner:setInterval ##
- - set the number of seconds between checks. Because of the way timers work, the actual time to clear the command bar is between the interval and 2x the interval, i.e with an interval of 15 it could be anywhere from 15-30 seconds.
- Default is 60 seconds.
- ]]>
- </description>
- </plugin>
- <!-- Get our standard constants -->
- <include name="constants.lua"/>
- <!-- Plugin help -->
- <aliases>
- <alias
- script="OnHelp"
- match="CommandCleaner:help"
- enabled="y"
- >
- </alias>
- <alias
- script="setInterval"
- match="CommandCleaner:setInterval (?<seconds>[0-9]+)"
- regexp="y"
- enabled="y"
- >
- </alias>
- </aliases>
- <script>
- <![CDATA[
- require "serialize"
- function interval_handle ()
- if previous == GetCommand() then
- PushCommand()
- check(AddTimer("interval_timer", 0, 0, interval, "", timer_flag.Enabled + timer_flag.Replace + timer_flag.Temporary, "interval_handle"))
- end
- previous = GetCommand()
- end
- function setInterval (name, line, wildcards)
- seconds = wildcards.seconds
- seconds = tonumber(seconds)
- if seconds ~= nil and seconds > 0 then
- interval = seconds
- world.Note("Setting command clearing interval to " .. interval .. " seconds.")
- else
- world.Note("Error, cannot set interval to " .. wildcards.seconds .. ".")
- end;
- end
- function OnHelp ()
- world.Note (world.GetPluginInfo (world.GetPluginID (), 3))
- world.Note("Currently clearing command buffer when idle for at least " .. interval .. " seconds.")
- end
- function OnPluginSaveState()
- SetVariable("interval", interval)
- end
- function OnPluginInstall()
- OnPluginEnable()
- end
- function OnPluginEnable()
- previous = ""
- interval = tonumber(GetVariable("interval")) or 60
- check(AddTimer("interval_timer", 0, 0, interval, "", timer_flag.Enabled + timer_flag.Replace + timer_flag.Temporary, "interval_handle"))
- end
- ]]>
- </script>
- </muclient>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement