hl_here.pl 1.48 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#
# Copyright (C) 2013 Sascha Ohms <sasch9r@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
17 18 19 20 21 22 23
# History:
#
# 2015-06-29, Matthew Cox <matthewcpcox@gmail.com>:
#     v0.2: fix for all buffer nesting levels
# 2013-10-19, Sascha Ohms <sasch9r@gmail.com>:
#     v0.1: script creation
#
24 25 26

use strict;

27
weechat::register('hl_here', 'Sascha Ohms', '0.2', 'GPL3', 'Show any highlights in the active buffer', '', '');
28 29 30 31 32 33 34

sub highlight_everywhere {
    my ($data, $buffer, $date, $tags, $disp, $hl, $prefix, $msg) = @_;
    my $bfname = weechat::buffer_get_string($buffer, 'name');
    my @chan = split(/\./, $bfname);

    if($hl == 1 && $buffer ne weechat::current_buffer()) {
35
        weechat::print_date_tags(weechat::current_buffer(), 0, 'no_log', $chan[-1]."\t".'<'.$prefix.weechat::color('default').'> '.$msg);
36 37 38 39 40 41
    }

    return weechat::WEECHAT_RC_OK;
}

weechat::hook_print('', '', '', 0, 'highlight_everywhere', '');