Add greentext and orangetext

trunk
qorg11 2021-10-07 14:09:01 +02:00
parent 968a5afd42
commit 0569901747
No known key found for this signature in database
GPG Key ID: 343FC20A4ACA62B9
2 changed files with 42 additions and 0 deletions

21
greentext.pl Normal file
View File

@ -0,0 +1,21 @@
#!/usr/bin/perl
use Term::ANSIColor;
weechat::register("greentext","qorg","0.1","WTFPL","Grentexts.","","");
# Paints green the messages that begin with '>'
sub greentext_cb($$$$) {
my ($data, $modifier, $modifier_data, $string) = @_;
my ($nick, $msg) = split "\t", $string;
my @chars = split("",$msg);
if($chars[0] eq '>') {
return sprintf("%s\t%s%s",$nick, weechat::color("green"),$msg);
} else {
return $string;
}
}
weechat::hook_modifier("weechat_print","greentext_cb","");

21
orangetext.pl Normal file
View File

@ -0,0 +1,21 @@
#!/usr/bin/perl
use Term::ANSIColor;
weechat::register("orangetext","qorg","0.1","WTFPL","Grentexts.","","");
# Paints green the messages that begin with '>'
sub greentext_cb($$$$) {
my ($data, $modifier, $modifier_data, $string) = @_;
my ($nick, $msg) = split "\t", $string;
my @chars = split("",$msg);
if($chars[0] eq '<') {
return sprintf("%s\t%s%s",$nick, weechat::color("yellow"),$msg);
} else {
return $string;
}
}
weechat::hook_modifier("weechat_print","greentext_cb","");