Skip to content

Instantly share code, notes, and snippets.

@json-m json-m/
Last active Dec 11, 2017

What would you like to do?
annoy everyone with ocd on irc
use warnings;
use strict;
use IPC::Open3;
use Irssi;
use vars qw($VERSION %IRSSI);
$VERSION = '0.1';
%IRSSI = (
author => 'c|p',
name => 'h-ify',
description => 'applies bold formatting to every h'
sub sig_send_text
my ($args, $server, $witem) = @_;
my $channel = Irssi::active_win()->get_active_name();
if (Irssi::settings_get_bool('hify_enabled')) {
$args =~ s/(h+)/\x02$1\x02/gi;
Irssi::signal_continue($args, $server, $witem);
sub cmd_hexec
my ($args, $server, $witem) = @_;
my $target = $witem->{name};
my $pid = open3(\*WRITE, \*READ, \*ERR, $args);
close WRITE;
my $text = join('', <READ>);
close READ;
close ERR;
waitpid($pid, 0);
for my $line (split(/\n/, $text)) {
$line = ' ' if $line eq '';
$line =~ s/(h+)/\x02$1\x02/gi;
$witem->command("msg $target $line");
Irssi::settings_add_bool('hify', 'hify_enabled', 0);
Irssi::signal_add_first('send text', \&sig_send_text);
Irssi::command_bind('hexec', 'cmd_hexec');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.