All pastes #97030 Raw Edit

talim

public text v1 · immutable
#97030 ·published 2006-07-23 10:08 UTC
rendered paste body
#!/usr/bin/perl

use strict;

Xchat::register("Message notification.", "1.0", "", "");
Xchat::hook_server("PRIVMSG", "on_text");

sub on_text {
	my ($me) = (quotemeta(Xchat::get_info("nick"))); Xchat::set_context(Xchat::find_context());
	my ($active, $nick, $chan, $text) = (Xchat::get_info("channel"), nick($_[0][0]), $_[0][2], substr($_[1][3], 1, (length($_[1][3]) - 1)));
	if (($chan ne $active) && ($text =~ /$me/i)) {
		unless ($chan =~ /^[#]/) { $chan = "Query"; } 
		unless ($text =~ /\001ACTION(.*)\001/) {
			Xchat::print(chr(3)."11[$chan] ".chr(3)."04$nick: ".chr(3)."00$text");
		}
		else {
			Xchat::print(chr(3)."11[$chan] ".chr(3)."04* $nick".chr(3)."00".$1);
		}
		return 0;
	}
}

sub nick {
	if (shift =~ /^:([^!]+)/) { return $1; }
}