notify the channel of new tickets

chx - December 11, 2008 - 03:08
Project:Bot
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:won't fix
Description

<?php
function bot_nowpublic_irc_bot_cron() {
 
$pdo = new PDO('sqlite:/home/trac/nowpublic/db/trac.db');
 
$statement = $pdo->prepare('SELECT id, reporter, summary, priority, owner FROM ticket WHERE time > :time');
 
$statement->execute(array(':time' => time() - 300));
  foreach (
$statement as $ticket) {
   
extract($ticket);
   
$message = "New $priority ticket from $reporter for $owner: $summary https://TRACURL/ticket/$id";
   
bot_message('#nowpublic', $message);
  }
}
?>

edit: I removed the tracurl from the post. Opsie.
interested in this feature? then take the above code and make it nice and configurable. It requires PHP 5.2 but it does work for me.

#1

Morbus Iff - February 6, 2009 - 02:04
Status:active» postponed (maintainer needs more info)

I believe this would be more cleanly handled via aggregator.module integration. See http://drupal.org/node/290761. You won't be able to customize the output as you'd like it, however. See http://trac.edgewall.org/query?status=new&format=rss&col=id&col=summary&... for one example of how you could get "new tickets, sorted by ascending creation date".

I'm not sure I want to code something *specific* for new issues... Thoughts?

#2

aj045 - February 6, 2009 - 02:16

So there'd be some sort of anti-spam, aggregation feature which would collate the most recent posts and then send them to the IRC in a list like format? sounds kinda cool.

#3

Morbus Iff - February 6, 2009 - 16:53
Status:postponed (maintainer needs more info)» won't fix

Closing, per discussion with chx.

aj045: yep, pretty much :)

 
 

Drupal is a registered trademark of Dries Buytaert.