Fix email issue with bug tracker + add announcements to globster

This commit is contained in:
Yorhel 2012-05-04 16:25:08 +02:00
parent 42c5026131
commit c661838551

View file

@ -87,7 +87,7 @@ TUWF::register(
TUWF::set( TUWF::set(
logfile => '/www/err.log', logfile => '/www/err.log',
error_404_handler => \&notfound, error_404_handler => \&notfound,
mail_from => 'Yorhel\'s Bug Tracker <projects@yorhel.nl>', mail_from => 'Yorhels Bug Tracker <projects@yorhel.nl>',
# this is a fairly static site, allow some aggressive caching # this is a fairly static site, allow some aggressive caching
pre_request_handler => sub { $_[0]->resHeader('Cache-Control', 's-max-age=86400, max-age=3600'); 1; }, pre_request_handler => sub { $_[0]->resHeader('Cache-Control', 's-max-age=86400, max-age=3600'); 1; },
); );
@ -249,6 +249,31 @@ sub bug_post {
return $s->htmlFooter; return $s->htmlFooter;
} }
# Experimental: announce this report to the ncdc hub, through the globster bot
my $sock = '/tmp/glob.sock';
if(-e $sock) {
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;
}
$s->resRedirect("/$p/bug/$l->{issue}", 'post'); $s->resRedirect("/$p/bug/$l->{issue}", 'post');
} }