<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[1078] sites/trunk/svn.wordpress.org: Slack: Add hooks for processing tickets/comments from Trac.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/1078">1078</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/1078","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>nacin</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2014-12-31 16:48:29 +0000 (Wed, 31 Dec 2014)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Slack: Add hooks for processing tickets/comments from Trac.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunksvnwordpressorgbinslackcommithookphp">sites/trunk/svn.wordpress.org/bin/slack-commit-hook.php</a></li>
<li><a href="#sitestrunksvnwordpressorgincludesslacktrachooksconfigphp">sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/config.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunksvnwordpressorgbinslacktrachookphp">sites/trunk/svn.wordpress.org/bin/slack-trac-hook.php</a></li>
<li>sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/</li>
<li><a href="#sitestrunksvnwordpressorgincludesslacktrachookscommentsphp">sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/comments.php</a></li>
<li><a href="#sitestrunksvnwordpressorgincludesslacktrachookscommitsphp">sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/commits.php</a></li>
<li><a href="#sitestrunksvnwordpressorgincludesslacktrachookstracphp">sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/trac.php</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li>sites/trunk/svn.wordpress.org/includes/slack-commit-hook/</li>
<li><a href="#sitestrunksvnwordpressorgincludesslacktrachookssenderphp">sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/sender.php</a></li>
<li><a href="#sitestrunksvnwordpressorgincludesslacktrachookstracphp">sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/trac.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunksvnwordpressorgbinslackcommithookphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/svn.wordpress.org/bin/slack-commit-hook.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/svn.wordpress.org/bin/slack-commit-hook.php   2014-12-30 23:12:40 UTC (rev 1077)
+++ sites/trunk/svn.wordpress.org/bin/slack-commit-hook.php     2014-12-31 16:48:29 UTC (rev 1078)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -6,15 +6,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">        exit( 1 );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define( 'INC', dirname( __DIR__ ) . '/includes/slack-commit-hook/' );
-require INC . 'sender.php';
-require INC . 'trac.php';
-require INC . 'config.php';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+define( 'INC', dirname( __DIR__ ) . '/includes/slack-trac-hooks' );
+require INC . '/commits.php';
+require INC . '/trac.php';
+require INC . '/config.php';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> list( , $trac, $repo, $rev ) = $argv;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> $slack_hook = 'https://hooks.slack.com/services/...';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-$sender = new \SlackCommitHook\Sender( $trac, $repo, $rev, $slack_hook );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+$sender = new Dotorg\SlackTracHooks\Commits( $trac, $repo, $rev, $slack_hook );
</ins><span class="cx" style="display: block; padding: 0 10px"> // $sender->use_test_channel( true );
</span><span class="cx" style="display: block; padding: 0 10px"> // $sender->set_svnlook_executable( ... );
</span><span class="cx" style="display: block; padding: 0 10px"> $sender->run();
</span></span></pre></div>
<a id="sitestrunksvnwordpressorgbinslacktrachookphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/svn.wordpress.org/bin/slack-trac-hook.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/svn.wordpress.org/bin/slack-trac-hook.php                             (rev 0)
+++ sites/trunk/svn.wordpress.org/bin/slack-trac-hook.php       2014-12-31 16:48:29 UTC (rev 1078)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,73 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+#!/usr/bin/env php
+<?php
+/**
+ * This script receives mail directly from Trac and sends tickets and commits to Slack.
+ *
+ * New tickets are merely identified here. It is then passed off to the API.
+ * That will change when the libraries are merged.
+ *
+ * New comments are processed here and sent to Slack.
+ */
+
+define( 'INC', dirname( __DIR__ ) . '/includes/slack-trac-hooks' );
+// This is a shared secret so the Trac server can ping the API server for processing tickets.
+define( 'NEW_TICKET_API', 'https://api.wordpress.org/dotorg/slack/newticket.php?token=...' );
+// Comments are processed and posted directly from here.
+define( 'SLACK_SENDING_HOOK', 'https://hooks.slack.com/services/...' );
+
+$lines = array();
+while ( $line = fgets( STDIN ) ) {
+       $lines[] = $line;
+}
+
+foreach ( $lines as $line ) {
+       if ( 0 !== strpos( $line, 'X-Trac-Ticket-URL: ' ) ) {
+               continue;
+       }
+       preg_match( '~X-Trac-Ticket-URL: ((([^#]+)/(\d+))(#comment:\d+)?)~', $line, $matches );
+       $comment_url = $matches[1];
+       $ticket_url = $matches[2];
+       $ticket_base_url = $matches[3];
+       $ticket = $matches[4];
+       $type = isset( $matches[5] ) ? 'comment' : 'ticket';
+       preg_match( '~^https?://([^.]+)\.trac~i', $ticket_base_url, $matches );
+       $trac = $matches[1];
+       break;
+}
+
+if ( empty( $type ) ) {
+       exit( 1 );
+}
+
+if ( $type === 'ticket' ) {
+       slack_ticket_hook( $trac, $ticket );
+} else {
+       require INC . '/comments.php';
+       require INC . '/trac.php';
+       require INC . '/config.php';
+       $args = Dotorg\SlackTracHook\Comments\process_message( $lines );
+       $args['trac']   = $trac;
+       $args['ticket'] = $ticket;
+       $args['ticket_url']  = $ticket_url;
+       $args['comment_url'] = $comment_url;
+       Dotorg\SlackTracHook\Comments\send( SLACK_SENDING_HOOK, $args );
+}
+
+function slack_ticket_hook( $trac, $ticket ) {
+       $payload = array(
+               'token' => SLACK_TICKET_HOOK_API_TOKEN,
+               'trac' => $trac,
+               'ticket' => $ticket,
+       );
+
+       $context = stream_context_create( array(
+               'http' => array(
+                       'method'  => 'POST',
+                       'header'  => 'Content-Type: application/x-www-form-urlencoded' . PHP_EOL,
+                       'content' => http_build_query( $payload ),
+               ),
+       ) );
+
+       file_get_contents( NEW_TICKET_API, false, $context );
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: sites/trunk/svn.wordpress.org/bin/slack-trac-hook.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="sitestrunksvnwordpressorgincludesslacktrachookscommentsphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/comments.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/comments.php                              (rev 0)
+++ sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/comments.php        2014-12-31 16:48:29 UTC (rev 1078)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,158 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+namespace Dotorg\SlackTracHooks\Comments;
+
+function process_message( $lines ) {
+       $lines = array_map( 'rtrim', $lines );
+       
+       // Trim off headers.
+       while ( '' !== current( $lines ) ) {
+               array_shift( $lines );
+       }
+       // Remove empty line between headers and body.
+       array_shift( $lines );
+       
+       $title = '';
+       while ( 0 !== strpos( current( $lines ), '------' ) ) {
+               if ( '' !== $title ) {
+                       $last = substr( $title, -1 );
+                       if ( $last !== '-' && $last !== '_' ) {
+                               $title .= ' ';
+                       }
+               }
+               $title .= array_shift( $lines );
+       }
+       $title = substr( $title, strpos( $title, ': ' ) + 2 );
+       
+       // Remove up to top of ticket properties table.
+       while ( 0 !== strpos( current( $lines ), '------' ) ) {
+               array_shift( $lines );
+       }
+       // Remove top border of table.
+       array_shift( $lines );
+       // Remove ticket properties table.
+       while ( 0 !== strpos( current( $lines ), '------' ) ) {
+               array_shift( $lines );
+       }
+       // Remove bottom border of table.
+       array_shift( $lines );
+       
+       // Remove empty line if present. (It is when it's a comment without changes.)
+       if ( current( $lines ) === '' ) {
+               array_shift( $lines );
+       }
+       
+       // Remove Trac email footer.
+       while ( end( $lines ) !== '--' ) {
+               array_pop( $lines );
+       }
+       // Remove -- which starts footer.
+       array_pop( $lines );
+       // Remove empty line before footer.
+       array_pop( $lines );
+       
+       preg_match( '/^(Comment|Changes) \(by (.*)\):$/', array_shift( $lines ), $matches );
+       $has_changes = $matches[1] === 'Changes';
+       $author = $matches[2];
+       
+       // Remove blank line after 'Comment|Changes (by author):'
+       array_shift( $lines );
+       
+       $changes = $comment = array();
+       if ( $has_changes ) {
+               while ( '' !== current( $lines ) ) {
+                       $changes[] = preg_replace( '~^ \* (.*?):  ~', '_*$1:*_ ', array_shift( $lines ) );
+               }
+       }
+       
+       // Remove blank lines (should be two if it had changes).
+       while ( '' === current( $lines ) ) {
+               array_shift( $lines );
+       }
+       
+       // Next line should start with 'Comment' if there is one.
+       if ( $has_changes && 0 === strpos( current( $lines ), 'Comment' ) ) {
+               array_shift( $lines ); // Remove 'Comment'
+               array_shift( $lines ); // Remove blank line
+       }
+       
+       // Everything left is the comment. Remove leading space.
+       $comment = array_map( 'ltrim', $lines );
+       
+       $changes = implode( "\n", $changes );
+       $comment = implode( "\n", $comment );
+
+       return compact( 'author', 'title', 'changes', 'comment' );
+}
+
+function format_comment( $comment, $ticket_url ) {
+       // Link 'Replying to [comment:1 user]:'
+       $comment = preg_replace_callback( '/^Replying to \[comment:(\d+) (.*)\]/m',
+               function ( $matches ) use ( $ticket_url ) {
+                       $comment_url = $ticket_url . '#comment:' . $matches[1];
+                       $text = 'Replying to ' . $matches[2];
+                       return "<$comment_url|$text>";
+               }, $comment );
+
+       // Replace {{{ and }}} with ```
+       $comment = str_replace( array( '{{{', '}}}' ), '```', $comment );
+
+       return $comment;
+}
+
+function send( $slack_hook, $args ) {
+       // Don't post auto-comments for commits.
+       if ( false !== strpos( $args['comment'], '#!CommitTicketReference' ) ) {
+               return;
+       }
+
+       $trac_class = '\\Dotorg\\SlackTracHooks\\' . $args['trac'] . '_Trac';
+       $trac = new $trac_class;
+
+               
+       $args['comment'] = format_comment( $args['comment'], $args['ticket_url'] );
+       $main_attachment = $args['changes'] ? $args['changes'] : $args['comment'];
+
+       $pretext = sprintf( '*%s updated <%s|#%s %s>*', $args['author'], $args['comment_url'], $args['ticket'], $args['title'] );
+       $fallback = trim( $pretext, '*' ) . "\n" . $main_attachment;
+
+       $payload = array(
+               'channel'     => $trac->get_firehose_channel(),
+               'icon_emoji'  => $trac->get_emoji(),
+               'username'    => $trac->get_ticket_username(),
+               'attachments' => array(
+                       array(
+                               'pretext'   => $pretext,
+                               'fallback'  => $fallback,
+                               'text'      => $main_attachment,
+                               'mrkdwn_in' => array( 'pretext', 'fallback', 'text' ),
+                       ),
+               ),
+       );
+
+       // If we have both changes and a comment, append the comment.
+       // Ensure the comment uses a darker gray color, even when alone.        
+       if ( $args['changes'] && $args['comment'] ) {
+               $payload['attachments'][] = array(
+                       'fallback'  => $args['comment'],
+                       'text'      => $args['comment'],
+                       'mrkdwn_in' => array( 'fallback', 'text' ),
+                       'color'     => '#999',
+               );
+       } elseif ( ! $args['changes'] ) {
+               $payload['attachments'][0]['color'] = '#999';
+       }
+       
+       $payload = json_encode( $payload );
+       
+       $context = stream_context_create( array(
+               'http' => array(
+                       'method'  => 'POST',
+                       'header'  => 'Content-Type: application/x-www-form-urlencoded' . PHP_EOL,
+                       'content' => http_build_query( compact( 'payload' ) ),
+               ),
+       ) );
+       
+       file_get_contents( $slack_hook, false, $context );
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/comments.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="sitestrunksvnwordpressorgincludesslacktrachookscommitsphpfromrev1075sitestrunksvnwordpressorgincludesslackcommithooksenderphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/commits.php (from rev 1075, sites/trunk/svn.wordpress.org/includes/slack-commit-hook/sender.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/commits.php                               (rev 0)
+++ sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/commits.php 2014-12-31 16:48:29 UTC (rev 1078)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,119 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+namespace Dotorg\SlackTracHooks;
+
+class Commits {
+       protected $trac;
+       protected $repo;
+       protected $rev;
+       protected $slack_hook;
+
+       protected $test_mode = false;
+       protected $svnlook = '/usr/bin/svnlook';
+
+       public function __construct( $trac, $repo, $rev, $slack_hook ) {
+               $this->set_trac( $trac );
+               $this->repo = $repo;
+               $this->rev = $rev;
+               $this->slack_hook = $slack_hook;
+       }
+
+       public function use_test_channel( $enabled ) {
+               $this->test_mode = (bool) $enabled;
+       }
+
+       public function set_svnlook_executable( $path ) {
+               $this->svnlook = $path;
+       }
+
+       public function run() {
+               $payload = $this->generate_payload();
+               foreach ( $this->trac->get_commit_channels( $this->svnlook( 'changed' ) ) as $channel ) {
+                       $this->send( $channel, $payload );
+               }
+       }
+
+       protected function set_trac( $trac ) {
+               $class = __NAMESPACE__ . '\\' . $trac . '_Trac';
+               $this->trac = new $class;
+       }
+
+       protected function generate_payload() {
+               $author = $this->svnlook( 'author' );
+               $log = $this->format_log_for_slack( $this->svnlook( 'log' ) );
+
+               $url = $this->trac->get_commit_template( $this->rev );
+               $revision = 'r' . $this->rev;
+
+               $username = $this->trac->get_commit_username();
+               $emoji    = $this->trac->get_emoji();
+               $color    = $this->trac->get_color();
+
+               $pretext = "*$username <$url|$revision>* by $author:";
+               $fallback = "$revision by $author: $log";
+
+               return array(
+                       'channel'     => '#test',
+                       'username'    => $username,
+                       'icon_emoji'  => $emoji,
+                       'attachments' => array( array(
+                               'color'     => $color,
+                               'pretext'   => $pretext,
+                               'text'      => $log,
+                               'fallback'  => $fallback,
+                               'mrkdwn_in' => array( 'text', 'pretext' ),
+                       ) ),
+               );
+       }
+
+       protected function format_log_for_slack( $log ) {
+               foreach ( $this->trac->get_log_replacements() as $find => $replace ) {
+                       $log = preg_replace( $find, '<' . $replace . '|$0>', $log );
+               }
+               return $log;
+       }
+
+       protected function svnlook( $subcommand ) {
+               $args = array(
+                       $subcommand,
+                       '-r' . $this->rev,
+                       $this->repo,
+               );
+               $args = array_map( 'escapeshellarg', $args );
+               $command = escapeshellcmd( $this->svnlook ) . ' ' . implode( ' ', $args );
+
+               if ( $subcommand === 'changed' ) {
+                       $command .= ' | awk \'{print $2}\'';
+               }
+
+               exec( $command, $output, $return_var );
+               if ( $return_var === 0 ) {
+                       return trim( implode( "\n", $output ) );
+               }
+               $this->error( "Error processing svnlook( $subcommand )" );
+       }
+
+       protected function error( $message ) {
+               error_log( $message . ' for ' . $this->repo . ' -r ' . $this->rev );
+               exit( 1 );
+       }
+
+       protected function send( $channel, $payload ) {
+               if ( $this->test_mode ) {
+                       $payload['attachments'][0]['pretext']  = "[$channel] " . $payload['attachments'][0]['pretext'];
+                       $payload['attachments'][0]['fallback'] = "[$channel] " . $payload['attachments'][0]['fallback'];
+               } else {
+                       $payload['channel'] = $channel;
+               }
+
+               $context = stream_context_create( array(
+                       'http' => array(
+                               'method'  => 'POST',
+                               'header'  => 'Content-Type: application/x-www-form-urlencoded' . PHP_EOL,
+                               'content' => http_build_query( array( 'payload' => json_encode( $payload ) ) ),
+                       ),
+               ) );
+
+               file_get_contents( $this->slack_hook, false, $context );
+       }
+}
</ins></span></pre></div>
<a id="sitestrunksvnwordpressorgincludesslacktrachooksconfigphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/config.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/svn.wordpress.org/includes/slack-commit-hook/config.php       2014-12-30 22:36:32 UTC (rev 1075)
+++ sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/config.php  2014-12-31 16:48:29 UTC (rev 1078)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,18 +1,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-namespace SlackCommitHook;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+namespace Dotorg\SlackTracHooks;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> class Core_Trac extends Trac {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        protected $channels = array( '#core', '#core-commits' );
-       protected $username = 'WordPress commit';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected $commit_channels = array( '#core', '#core-commits' );
+       protected $commit_username = 'WordPress commit';
+       protected $commit_range = array( 3, 5 );
</ins><span class="cx" style="display: block; padding: 0 10px">         protected $ticket_range = array( 3, 5 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        protected $commit_range = array( 3, 5 );
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        protected $ticket_channels  = array( '#core', '#core-newtickets' );
+       protected $ticket_username  = 'WordPress Trac';
+       protected $firehose_channel = '#core-firehose';
+
</ins><span class="cx" style="display: block; padding: 0 10px">         /**
</span><span class="cx" style="display: block; padding: 0 10px">         * File paths that cause commits to be piped to particular channels.
</span><span class="cx" style="display: block; padding: 0 10px">         * Start regex matches with # as your delimiter.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        protected $channel_matcher = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected $commit_path_filters = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                 'wp-content/themes'       => '#core-themes',
</span><span class="cx" style="display: block; padding: 0 10px">                'customize'               => '#core-customize',
</span><span class="cx" style="display: block; padding: 0 10px">                'editor-expand.js'        => '#feature-focus',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -20,46 +24,69 @@
</span><span class="cx" style="display: block; padding: 0 10px">                'wp-admin/css/editor.css' => '#feature-focus',
</span><span class="cx" style="display: block; padding: 0 10px">                'press-this.php'          => '#feature-pressthis',
</span><span class="cx" style="display: block; padding: 0 10px">        );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       /**
+        * Components or focuses that cause new tickets to be piped to particular channels.
+        */
+       protected $ticket_component_filters = array(
+               'Customize'     => '#core-customize',
+               'Bundled Theme' => '#core-themes',
+               'Press This'    => '#feature-pressthis',
+       );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> class Meta_Trac extends Trac {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        protected $channels = array( '#meta', '#meta-commits' );
-       protected $username = 'WordPress.org Meta commit';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected $commit_channels = array( '#meta', '#meta-commits' );
+       protected $commit_username = 'WordPress.org Meta commit';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        protected $channel_matcher = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected $ticket_channels = array( '#meta-newtickets' );
+
+       protected $commit_path_filters = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                 'translate.wordpress.org/' => '#meta-i18n',
</span><span class="cx" style="display: block; padding: 0 10px">                'global.wordpress.org/'    => '#meta-i18n',
</span><span class="cx" style="display: block; padding: 0 10px">                'translations'             => '#meta-i18n',
</span><span class="cx" style="display: block; padding: 0 10px">                'developer-reference/'     => '#meta-devhub',
</span><span class="cx" style="display: block; padding: 0 10px">                'wporg-developer/'         => '#meta-devhub',
</span><span class="cx" style="display: block; padding: 0 10px">        );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       protected $ticket_component_filters = array(
+               'International Forums'          => '#meta-i18n',
+               'International Sites (Rosetta)' => '#meta-i18n',
+               'translate.wordpress.org'       => '#meta-i18n',
+               'developer.wordpress.org'       => '#meta-devhub',
+       );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> class bbPress_Trac extends Trac {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        protected $channels = array( '#bbpress', '#bbpress-commits' );
-       protected $username = 'bbPress commit';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected $commit_channels = array( '#bbpress', '#bbpress-commits' );
+       protected $commit_username = 'bbPress commit';
+       protected $ticket_channels = array( '#bbpress', '#bbpress-newtickets' );
</ins><span class="cx" style="display: block; padding: 0 10px">         protected $color    = '#080';
</span><span class="cx" style="display: block; padding: 0 10px">        protected $emoji    = ':bbpress:';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> class BuddyPress_Trac extends Trac {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        protected $channels = array( '#buddypress', '#buddypress-commits' );
-       protected $username = 'BuddyPress commit';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected $commit_channels = array( '#buddypress', '#buddypress-commits' );
+       protected $commit_username = 'BuddyPress commit';
+       protected $ticket_channels = array( '#buddypress', '#buddypress-newtickets' );
</ins><span class="cx" style="display: block; padding: 0 10px">         protected $color    = '#d84800';
</span><span class="cx" style="display: block; padding: 0 10px">        protected $emoji    = ':buddypress:';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> class Dotorg_Trac extends Trac {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        protected $channels = 'dotorg';
-       protected $username = 'Private dotorg commit';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected $commit_channels = 'dotorg';
+       protected $commit_username = 'Private dotorg commit';
+       protected $ticket_channels = 'dotorg';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> class Deploy_Trac extends Trac {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        protected $channels = 'dotorg';
-       protected $username = 'Deploy commit';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected $commit_channels = 'dotorg';
+       protected $commit_username = 'Deploy commit';
+       protected $ticket_channels = 'dotorg';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> class GlotPress_Trac extends Trac {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        protected $channels = '#glotpress';
-       protected $username = 'GlotPress commit';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected $commit_channels = '#glotpress';
+       protected $commit_username = 'GlotPress commit';
+       protected $ticket_channels = '#glotpress';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunksvnwordpressorgincludesslacktrachookssenderphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/sender.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/svn.wordpress.org/includes/slack-commit-hook/sender.php       2014-12-30 22:36:32 UTC (rev 1075)
+++ sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/sender.php  2014-12-31 16:48:29 UTC (rev 1078)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,119 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-namespace SlackCommitHook;
-
-class Sender {
-       protected $trac;
-       protected $repo;
-       protected $rev;
-       protected $slack_hook;
-
-       protected $test_mode = false;
-       protected $svnlook = '/usr/bin/svnlook';
-
-       public function __construct( $trac, $repo, $rev, $slack_hook ) {
-               $this->set_trac( $trac );
-               $this->repo = $repo;
-               $this->rev = $rev;
-               $this->slack_hook = $slack_hook;
-       }
-
-       public function use_test_channel( $enabled ) {
-               $this->test_mode = (bool) $enabled;
-       }
-
-       public function set_svnlook_executable( $path ) {
-               $this->svnlook = $path;
-       }
-
-       public function run() {
-               $payload = $this->generate_payload();
-               foreach ( $this->trac->get_channels( $this->svnlook( 'changed' ) ) as $channel ) {
-                       $this->send( $channel, $payload );
-               }
-       }
-
-       protected function set_trac( $trac ) {
-               $class = __NAMESPACE__ . '\\' . $trac . '_Trac';
-               $this->trac = new $class;
-       }
-
-       protected function generate_payload() {
-               $author = $this->svnlook( 'author' );
-               $log = $this->format_log_for_slack( $this->svnlook( 'log' ) );
-
-               $url = $this->trac->get_commit_template( $this->rev );
-               $revision = 'r' . $this->rev;
-
-               $username = $this->trac->get_username();
-               $emoji    = $this->trac->get_emoji();
-               $color    = $this->trac->get_color();
-
-               $pretext = "*$username <$url|$revision>* by $author:";
-               $fallback = "$revision by $author: $log";
-
-               return array(
-                       'channel'     => '#test',
-                       'username'    => $username,
-                       'icon_emoji'  => $emoji,
-                       'attachments' => array( array(
-                               'color'     => $color,
-                               'pretext'   => $pretext,
-                               'text'      => $log,
-                               'fallback'  => $fallback,
-                               'mrkdwn_in' => array( 'text', 'pretext' ),
-                       ) ),
-               );
-       }
-
-       protected function format_log_for_slack( $log ) {
-               foreach ( $this->trac->get_log_replacements() as $find => $replace ) {
-                       $log = preg_replace( $find, '<' . $replace . '|$0>', $log );
-               }
-               return $log;
-       }
-
-       protected function svnlook( $subcommand ) {
-               $args = array(
-                       $subcommand,
-                       '-r' . $this->rev,
-                       $this->repo,
-               );
-               $args = array_map( 'escapeshellarg', $args );
-               $command = escapeshellcmd( $this->svnlook ) . ' ' . implode( ' ', $args );
-
-               if ( $subcommand === 'changed' ) {
-                       $command .= ' | awk \'{print $2}\'';
-               }
-
-               exec( $command, $output, $return_var );
-               if ( $return_var === 0 ) {
-                       return trim( implode( "\n", $output ) );
-               }
-               $this->error( "Error processing svnlook( $subcommand )" );
-       }
-
-       protected function error( $message ) {
-               error_log( $message . ' for ' . $this->repo . ' -r ' . $this->rev );
-               exit( 1 );
-       }
-
-       protected function send( $channel, $payload ) {
-               if ( $this->test_mode ) {
-                       $payload['attachments'][0]['pretext']  = "[$channel] " . $payload['attachments'][0]['pretext'];
-                       $payload['attachments'][0]['fallback'] = "[$channel] " . $payload['attachments'][0]['fallback'];
-               } else {
-                       $payload['channel'] = $channel;
-               }
-
-               $context = stream_context_create( array(
-                       'http' => array(
-                               'method'  => 'POST',
-                               'header'  => 'Content-Type: application/x-www-form-urlencoded' . PHP_EOL,
-                               'content' => http_build_query( array( 'payload' => json_encode( $payload ) ) ),
-                       ),
-               ) );
-
-               file_get_contents( $this->slack_hook, false, $context );
-       }
-}
</del></span></pre></div>
<a id="sitestrunksvnwordpressorgincludesslacktrachookstracphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/trac.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/svn.wordpress.org/includes/slack-commit-hook/trac.php 2014-12-30 22:36:32 UTC (rev 1075)
+++ sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/trac.php    2014-12-31 16:48:29 UTC (rev 1078)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,77 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-namespace SlackCommitHook;
-
-abstract class Trac {
-       protected $channels = '#test';
-       protected $username = 'Commit';
-       protected $color    = '#21759b';
-       protected $emoji    = ':wordpress:';
-
-       protected $ticket_template = 'https://%s.trac.wordpress.org/ticket/%s';
-       protected $commit_template = 'https://%s.trac.wordpress.org/changeset/%s';
-       protected $ticket_range = array( 1, 5 );
-       protected $commit_range = array( 1, 5 );
-
-       function __construct() {
-               $this->trac = str_replace( '_trac', '', strtolower( get_class( $this ) ) );
-       }
-
-       function get_username() {
-               return $this->username;
-       }
-
-       function get_color() {
-               return $this->color;
-       }
-
-       function get_emoji() {
-               return $this->emoji;
-       }
-
-       function get_ticket_template( $template = '%s' ) {
-               return sprintf( $this->ticket_template, $this->trac, $template );
-       }
-
-       function get_commit_template( $template = '%s' ) {
-               return sprintf( $this->commit_template, $this->trac, $template );
-       }
-
-       function get_digit_capture( $range ) {
-               $min = $range[0] - 1;
-               $max = $range[1] - 1;
-               return '[0-9]\d{' . $min . ',' . $max . '}';
-       }
-
-       function get_log_replacements() {
-               $commit_template = $this->get_commit_template( '$1' );
-               $ticket_digits = $this->get_digit_capture( $this->ticket_range );
-               $commit_digits = $this->get_digit_capture( $this->commit_range );
-
-               return array(
-                       "/#($ticket_digits)\b/"   => $this->get_ticket_template( '$1' ),
-                       "/\[($commit_digits)\]/"  => $commit_template,
-                       "/\br($commit_digits)\b/" => $commit_template,
-               );
-       }
-
-       function get_channels( $changed_files = null ) {
-               $channels = (array) $this->channels;
-
-               if ( empty( $this->channel_matcher ) || empty( $changed_files ) ) {
-                       return $channels;
-               }
-
-               foreach ( $this->channel_matcher as $needle => $channels_to_add ) {
-                       if ( $match[0] === '#' ) {
-                               // Append PCRE_MULTILINE so ^ and $ refer to individual lines.
-                               if ( preg_match( $needle . 'm', $changed_files ) ) {
-                                       $channels = array_merge( $channels, (array) $channels_to_add );
-                               }
-                       } elseif ( false !== strpos( $changed_files, $needle ) ) {
-                               $channels = array_merge( $channels, (array) $channels_to_add );
-                       }
-               }
-               return $channels;
-       }
-}
</del></span></pre></div>
<a id="sitestrunksvnwordpressorgincludesslacktrachookstracphpfromrev1077sitestrunksvnwordpressorgincludesslackcommithooktracphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/trac.php (from rev 1077, sites/trunk/svn.wordpress.org/includes/slack-commit-hook/trac.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/trac.php                          (rev 0)
+++ sites/trunk/svn.wordpress.org/includes/slack-trac-hooks/trac.php    2014-12-31 16:48:29 UTC (rev 1078)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,130 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+namespace Dotorg\SlackTracHooks;
+
+abstract class Trac {
+       protected $commit_channels = '#test';
+       protected $commit_username = 'Commit';
+       protected $ticket_channels = '#test';
+       protected $ticket_username;
+
+       protected $firehose_channel = false;
+
+       protected $color    = '#21759b';
+       protected $emoji    = ':wordpress:';
+
+       protected $ticket_template = 'https://%s.trac.wordpress.org/ticket/%s';
+       protected $commit_template = 'https://%s.trac.wordpress.org/changeset/%s';
+       protected $ticket_range = array( 1, 5 );
+       protected $commit_range = array( 1, 5 );
+
+       function __construct() {
+               // 'Dotorg\SlackTracHooks\Core_Trac' => 'Core_Trac'
+               $class = str_replace( __NAMESPACE__ . '\\', '', get_class( $this ) );
+
+               // 'Core_Trac' => 'core'
+               $this->trac = strtolower( str_replace( '_Trac', '', $class ) );
+
+               if ( ! isset( $this->ticket_username ) ) {
+                       // 'Core_Trac' => 'Core Trac'
+                       $this->ticket_username = str_replace( '_', ' ', $class );
+               }
+       }
+
+       function get_commit_username() {
+               return $this->commit_username;
+       }
+
+       function get_ticket_username() {
+               return $this->ticket_username;
+       }
+
+       function get_color() {
+               return $this->color;
+       }
+
+       function get_emoji() {
+               return $this->emoji;
+       }
+
+       function get_ticket_template( $template = '%s' ) {
+               return sprintf( $this->ticket_template, $this->trac, $template );
+       }
+
+       function get_commit_template( $template = '%s' ) {
+               return sprintf( $this->commit_template, $this->trac, $template );
+       }
+
+       function get_digit_capture( $range ) {
+               $min = $range[0] - 1;
+               $max = $range[1] - 1;
+               return '[0-9]\d{' . $min . ',' . $max . '}';
+       }
+
+       function get_log_replacements() {
+               $commit_template = $this->get_commit_template( '$1' );
+               $ticket_digits = $this->get_digit_capture( $this->ticket_range );
+               $commit_digits = $this->get_digit_capture( $this->commit_range );
+
+               return array(
+                       "/#($ticket_digits)\b/"   => $this->get_ticket_template( '$1' ),
+                       "/\[($commit_digits)\]/"  => $commit_template,
+                       "/\br($commit_digits)\b/" => $commit_template,
+               );
+       }
+
+       function get_commit_channels( $changed_files = null ) {
+               $channels = (array) $this->commit_channels;
+
+               if ( isset( $this->firehose_channel ) ) {
+                       $channels[] = $this->firehose_channel;
+               }
+
+               if ( empty( $this->commit_path_filters ) || empty( $changed_files ) ) {
+                       return $channels;
+               }
+
+               foreach ( $this->commit_path_filters as $needle => $channels_to_add ) {
+                       if ( $needle[0] === '#' ) {
+                               // Append PCRE_MULTILINE so ^ and $ refer to individual lines.
+                               if ( preg_match( $needle . 'm', $changed_files ) ) {
+                                       $channels = array_merge( $channels, (array) $channels_to_add );
+                               }
+                       } elseif ( false !== strpos( $changed_files, $needle ) ) {
+                               $channels = array_merge( $channels, (array) $channels_to_add );
+                       }
+               }
+       
+               return $channels;
+       }
+
+       function get_ticket_channels( $ticket = null ) {
+               $channels = (array) $this->ticket_channels;
+
+               if ( isset( $this->firehose_channel ) ) {
+                       $channels[] = $this->firehose_channel;
+               }
+
+               if ( empty( $this->ticket_component_filters ) || empty( $ticket ) ) {
+                       return $channels;
+               }
+
+               if ( isset( $ticket->component ) && isset( $this->ticket_component_filters[ $ticket->component ] ) ) {
+                       $channels = array_merge( $channels, (array) $this->ticket_component_filters[ $ticket->component ] );
+               }
+
+               if ( isset( $ticket->focuses ) ) {
+                       foreach ( explode( ', ', $ticket->focuses ) as $focus ) {
+                               if ( isset( $this->ticket_component_filters[ $focus ] ) ) {
+                                       $channels = array_merge( $channels, (array) $this->ticket_component_filters[ $focus ] );
+                               }
+                       }
+               }
+               return $channels;
+       }
+
+       function get_firehose_channel() {
+               return $this->firehose_channel;
+       }
+}
+
</ins></span></pre>
</div>
</div>

</body>
</html>