Announce bug changes to the new D-Bus Globster

This commit is contained in:
Yorhel 2012-12-01 12:56:18 +01:00
parent e5fe5c859a
commit 4471f9028f

View file

@ -276,30 +276,14 @@ sub bug_post {
return $s->htmlFooter;
}
# Experimental: announce this report to the ncdc hub, through the globster bot
my $sock = '/tmp/globster.sock';
if(-e $sock) {
# Announce this report to the ncdc hub, through the globster bot
eval {
$ENV{DBUS_SESSION_BUS_ADDRESS} = 'unix:path=/tmp/dbus-globster';
require Net::DBus;
my $msg = "Bug activity for $p: $l->{summary} -> http://dev.yorhel.nl/$p/bug/$l->{issue}";
require AnyEvent;
require AnyEvent::Handle;
require AnyEvent::Socket;
require Tanja;
my $done = AnyEvent->condvar;
my $node = Tanja::Node->new();
AnyEvent::Socket::tcp_connect('unix/', $sock, sub {
my $fh = shift;
warn $! && $done->send if !$fh;
my $lnk; $lnk = $fh && $node->link(handle => AnyEvent::Handle->new(fh => $fh),
sync => 0,
on_error => sub { $_[0]&&warn$_[0]; $done->send },
on_ready => sub {
$node->send([hub=>ncdc=>chat=>undef,0,$msg]);
$lnk->close;
},
);
});
$done->recv;
}
Net::DBus->find->get_service("net.blicky.Globster")->get_object("/net/blicky/Globster/Hub/1")->SendChat(-1, $msg, 0);
1;
} || warn $@;
}