def weechat_init Weechat.register('wmii-hi', '0.1', 'destroy', 'Blinks an IM bar on highlight messages') Weechat.add_message_handler('weechat_pv', 'on_msg') Weechat.add_message_handler('weechat_highlight', 'on_msg') return Weechat::PLUGIN_RC_OK end def destroy return 1 end def on_msg(server, args) text = args.split(":") from = text[1].sub(/!.*/,'') msg = "" if text[2] == "codemac" text = text[3..-1] else text = text[2..-1] end text.each { |i| msg = msg + i} text = text[0,80] if text.length > 80 contents = "IrcEvent " + from + "> " + msg + "\n" IO.popen("wmiir write /event", "w"){|io| io.print contents.to_s } return Weechat::PLUGIN_RC_OK end