Skip to content

Instantly share code, notes, and snippets.

@kyzentun
Created May 14, 2015 23:11
Show Gist options
  • Save kyzentun/bc476646fb70119679fd to your computer and use it in GitHub Desktop.
Save kyzentun/bc476646fb70119679fd to your computer and use it in GitHub Desktop.
# Print hilighted messages with MSGLEVEL_PUBLIC to active window
# for irssi 0.7.99 by Kyzentun based on showhilight.pl by Pawe³ 'Styx' Chuchma³a
use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
$VERSION = "0.1";
%IRSSI = (
authors => "Kyzentun",
contact => "",
name => "kyzhilight",
description => "Show hilight messages in window manager",
license => "GNU GPLv2",
changed => "Thu May 14 2015"
);
sub print_message {
my ($msg) = @_;
$msg =~ s/'/_/g;
my $command = Irssi::settings_get_str("showhilight_command_prefix").$msg.Irssi::settings_get_str("showhilight_command_suffix");
system($command);
# my $window = Irssi::active_win();
# $window->print($command, MSGLEVEL_CLIENTCRAP);
}
sub print_private {
my ($server, $text, $nick, $hostmask) = @_;
$text= $nick.": ".$text;
print_message($text);
}
sub print_public {
my ($server, $text, $nick, $hostmask, $channel) = @_;
if($text =~ /.*kyz.*/i)
{
$text= $nick.": ".$text;
print_message($text);
}
}
Irssi::settings_add_str("misc", "showhilight_command_prefix", "ratpoison -c 'echo ");
Irssi::settings_add_str("misc", "showhilight_command_suffix", "'");
# this was supposed to make it possible to set the regex in a var.
#Irssi::settings_add_str("misc", "showhilight_regex", "/.*kyz.*/i");
Irssi::signal_add_last("message private", "print_private");
Irssi::signal_add_last("message public", "print_public");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment