# Wroted by BaSh - http://www.deelab.org/bash # Visualizza una notifica quando il proprio nick viene nominato all'interno di un canale # o quando qualcuno avvia una query e quando lo stato รจ impostato su away. import weechat, pynotify, string WEECHAT_ICON = "/usr/share/pixmaps/pidgin/protocols/48/irc.png" weechat.register("wee-notifier", "0.1.1", "", "A real time notification system for weechat using pynotify") weechat.add_message_handler("privmsg", "handle_message") class WeeNotification: def show_notification(self,chan,message): pynotify.init("wee-notifier") wn = pynotify.Notification(chan, message, WEECHAT_ICON) wn.set_urgency(pynotify.URGENCY_NORMAL) wn.set_timeout(pynotify.EXPIRES_NEVER) wn.show() def message_irc(self,message): string = '' msg = message.split(":") for i in range(len(msg)): if i > 0: string += msg[i]+' ' return string def handle_message(server, args): window = WeeNotification() string = args.split('!') nick = string[0].replace(':','') nick_say = string[1].split("PRIVMSG") nickname = weechat.get_info("nick") current_server = weechat.get_info("server") current_chan = weechat.get_info("channel") away = weechat.get_info("away") chan = nick_say[1].split(":")[0].strip() message = window.message_irc(nick_say[1]) if (away == '1'): if (nickname == chan): window.show_notification("Private message by "+ nick, message) elif (nickname) in message: if "ACTION" in message: window.show_notification(""+message.replace('ACTION','')+"" ,""+ nick +" ("+chan+")") weechat.prnt(message) else: window.show_notification(chan +" on "+ server, ""+nick+": "+message) return weechat.PLUGIN_RC_OK