File: ubus.pl

package info (click to toggle)
weechat-scripts 20180330-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 5,072 kB
  • sloc: python: 44,904; perl: 27,389; ruby: 2,101; lisp: 339; tcl: 244; sh: 8; makefile: 7
file content (27 lines) | stat: -rw-r--r-- 729 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# WeeChat ubus notifications 
# Arvid Picciani <aep at hereticlinux dot org>
# Released under GPL3.
#
# 0.2 uses spec single ubus interface now.

use strict;
use FileHandle;
weechat::register("ubus", "Arvid Picciani <aep at hereticlinux dot org>", 
                  "0.2",  "GPL3", "Ubus Notification", "", "");


my @signals=qw(weechat_pv weechat_highlight);

foreach(@signals){
    weechat::hook_signal($_, "ubus_signal", "");
}

sub ubus_signal{
    my $u;
    open($u,"|ubus-connect ~/.ubus/amvient/notify >/dev/null 2>/dev/null");
    $u->autoflush(1);
    my @b = split(/\t/,$_[2]);
    print {$u} "<font color=\"red\">$_[1]</font>  &nbsp; &lt;$b[0]&gt; &nbsp; $b[1]\n";
    close $u;
    return weechat::WEECHAT_RC_OK;
}