Commit a47aa387 authored by Sébastien Helleu's avatar Sébastien Helleu

ubus.pl 0.2: use ubus spec from ADO

parent d08babaf
# 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.1", "GPL3", "Ubus Notification", "ubus_shutdown", "");
"0.2", "GPL3", "Ubus Notification", "", "");
my %fds=();
my @signals=qw(weechat_pv weechat_highlight);
foreach(@signals){
weechat::hook_signal($_, "ubus_signal", "");
my $f;
open($f,"|ubus tap ~/.ipc/weechat/$_");
$fds{$_}=$f;
$f->autoflush(1);
}
sub ubus_signal{
print {$fds{$_[1]}} "$_[2]\n";
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;
}
sub ubus_shutdown{
foreach(@signals){
close ($fds{$_});
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment