X-Git-Url: http://git.vpit.fr/?p=perl%2Fscripts%2Fxchat.git;a=blobdiff_plain;f=Xchat%2FXPI%2FUtils.pm;fp=Xchat%2FXPI%2FUtils.pm;h=cbd9494ae1cd5a158d34dc78a32a2196eadd7ff8;hp=8fab3c469aae892395cf1ceec3f48bd49e1df141;hb=532ed2d6f4e5597f1dd76e71f2bd9880c5d779bb;hpb=7e00cc69db0ee7a4379b5378f1673efc4b531ae8 diff --git a/Xchat/XPI/Utils.pm b/Xchat/XPI/Utils.pm index 8fab3c4..cbd9494 100644 --- a/Xchat/XPI/Utils.pm +++ b/Xchat/XPI/Utils.pm @@ -23,6 +23,17 @@ sub dye_nick { return sprintf "\003%d%s", $rcolors[$col % @rcolors], $nick; } +my %gui_commands = ( + 'clear' => [ 'COLOR 0' ], + 'highlight' => [ 'FLASH' => 'COLOR 3' ], +); + +sub gui { + my $commands = $gui_commands{$_[0] || 'nope'}; + die 'Invalid command' unless defined $commands; + command "GUI $_" for @$commands; +} + sub save_context { my $cur_cxt = get_context; bless \$cur_cxt, 'Xchat::XPI::Utils::ContextGuard'; @@ -73,6 +84,7 @@ use base qw; our @EXPORT = (); our %EXPORT_TAGS = ('funcs' => [ qw< dye_nick + gui save_context local_context called_from_script > ]);