Permalink
Browse files

Handle github links (looks only for #parrot and #moe)

  • Loading branch information...
1 parent 9f7b43e commit 2e4526c85dbd3a8fa6943a2493e8863e08f1ca1d @prakashk prakashk committed Feb 15, 2013
Showing with 30 additions and 1 deletion.
  1. +30 −1 lib/IrcLog/WWW.pm
View
@@ -319,6 +319,30 @@ my $re_links = qr/(?!)/;
}
+sub github_links {
+ my ($key, $state, $channel, $nick) = @_;
+ if ($key =~ m/^GH/i) {
+ $key =~ m/(\d+)/;
+ if ($channel eq "parrot") {
+ return qq{<a href="https://github.com/parrot/parrot/issues/$1">}
+ . encode_entities($key, ENTITIES)
+ . qq{</a> };
+ }
+ elsif ($channel eq "moe") {
+ return qq{<a href="https://github.com/MoeOrganization/moe/issues/$1">}
+ . encode_entities($key, ENTITIES)
+ . qq{</a> };
+ }
+ }
+ elsif ($key =~ m/^pull request/i) {
+ if ($channel eq "moe") {
+ return qq{<a href="https://github.com/MoeOrganization/moe/pull/$1">}
+ . encode_entities($key, ENTITIES)
+ . qq{</a> };
+ }
+ }
+}
+
sub rt_links {
my ($key, $state) = @_;
if ($key =~ m/^tt/i) {
@@ -386,7 +410,12 @@ my %output_chain = (
static_links => {
re => $re_links,
match => \&expand_links,
- rest => 'rt_links'
+ rest => 'github_links'
+ },
+ github_links => {
+ re => qr{(?i:\b(?:GH|pull request)\s*)?#\d{2,6}\b},
+ match => \&github_links,
+ rest => 'rt_links',
},
rt_links => {
re => qr{(?i:\btt\s*)?#\d{2,6}\b},

0 comments on commit 2e4526c

Please sign in to comment.