Simple notification plugin for XChat
Uses libnotify and its command line tool notify-send.
![]()
__module_name__ = "Notify Connector"
__module_version__ = "0.1"
__module_description__ = "Smart notifications using libnotify"
import xchat
from subprocess import Popen,PIPE
notify_icon = "/usr/share/pixmaps/xchat.png"
def notify( topic, message, sender, urgency = "low" ):
p = Popen(["notify-send","-i", notify_icon,"-u", urgency, topic, message])
p.wait()
def print_CTCP_generic_cb(word, word_eol, userdata):
notify("CTCP von " + word[1] +" empfangen", word[0], "low")
return xchat.EAT_NONE # Let xchat do its normal printing
def print_notice_cb(word, word_eol, userdata):
notify("Notiz von " + word[0] +" empfangen", word[1], "low")
return xchat.EAT_NONE # Let xchat do its normal printing
def print_channel_msg_hilight_cb(word, word_eol, userdata):
notify(word[0] + " sagt", word[1], "critical")
return xchat.EAT_NONE # Let xchat do its normal printing
xchat.hook_print("CTCP Generic", print_CTCP_generic_cb)
xchat.hook_print("Notice", print_notice_cb)
xchat.hook_print("Channel Msg Hilight", print_channel_msg_hilight_cb)