Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- #coding=utf8
- # Imports #
- import codecs
- import weechat
- import subprocess
- import commands
- import time
- # Register #
- weechat.register('wmii-notify', '0.0.1', 'close',
- 'Notify plugin for the wmii /rbar')
- # Handlers #
- weechat.add_message_handler('weechat_highlight', 'on_hl')
- weechat.add_message_handler('weechat_pv', 'on_pv')
- # Functions #
- def bar_reset():
- bar_write(":weechat:", "write")
- def bar_write(buf, verb):
- bar_stdin = subprocess.Popen(["wmiir", verb, "/rbar/100"],
- stdin=subprocess.PIPE).stdin
- bar_stdin.write(buf)
- bar_stdin.close()
- def on_hl(server, data):
- bar_write(data, "write")
- time.sleep(5)
- bar_reset()
- return weechat.PLUGIN_RC_KO
- def on_pv(server, data):
- bar_write(data, "write")
- time.sleep(5)
- bar_reset()
- return weechat.PLUGIN_RC_KO
- def bar_reset():
- bar_write(":weechat:", "write")
- # Init #
- def bar_init():
- bar_write(":weechat:", "create")
- bar_init()
- # Exit #
- def close():
- commands.getoutput(["wmiir", "remove", "/rbar/100"])
Add Comment
Please, Sign In to add comment