All pastes #1497518 Raw Edit

Anonymous

public python v1 · immutable
#1497518 ·published 2009-07-16 21:18 UTC
rendered paste body
"""beep.py - invokes a system command on highlight or private messageuse /set *beep* to list the optionsto alter the beep command change the option beep_cmd"""import osimport weechatweechat.register("beep", "", "0.1",                 "Public domain", "Python version of Beep for weechat", "", "")settings = {    'beep_highlight': 'on',    'beep_pv': 'on',    'beep_cmd': 'beep.sh'    }for option, default in settings.items():    if weechat.config_get_plugin(option) == '':        weechat.config_set_plugin(option, default)def highlight(*args):    if weechat.config_get_plugin('beep_highlight') == 'on':        beep_cmd = weechat.config_get_plugin('beep_cmd')        os.system(beep_cmd)    return weechat.WEECHAT_RC_OKdef pv(*args):    if weechat.config_get_plugin('beep_pv') == 'on':        beep_cmd = weechat.config_get_plugin('beep_cmd')        os.system(beep_cmd)    return weechat.WEECHAT_RC_OKweechat.hook_signal("weechat_highlight", "highlight", "")weechat.hook_signal("weechat_pv", "pv", "")