From 4471f9028fbb19573a977f971c44de80dc3223c2 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Sat, 1 Dec 2012 12:56:18 +0100 Subject: [PATCH] Announce bug changes to the new D-Bus Globster --- index.cgi | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/index.cgi b/index.cgi index 83c3095..dd7a970 100755 --- a/index.cgi +++ b/index.cgi @@ -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 $@; }