Author: dylan Date: 2006-01-09 16:19:13 -0500 (Mon, 09 Jan 2006) New Revision: 962
Added: trunk/dev-tools/repo-hooks/subbotclient.pl Modified: trunk/dev-tools/repo-hooks/post-commit Log: Added Gir hooks to haver repo, so added them to dev-tools/repo-hooks too. Another testing of Gir, too. :) Modified: trunk/dev-tools/repo-hooks/post-commit =================================================================== --- trunk/dev-tools/repo-hooks/post-commit 2006-01-07 15:29:45 UTC (rev 961) +++ trunk/dev-tools/repo-hooks/post-commit 2006-01-09 21:19:13 UTC (rev 962) @@ -36,3 +36,9 @@ REV="$2" "$1"/hooks/commit-email.pl "$REPOS" "$REV" --from [EMAIL PROTECTED] [email protected] +( + echo [$REPOS] committed revision $REV by `svnlook author "$REPOS" -r "$REV"`: + svnlook log "$REPOS" -r "$REV" +) | "$1"/hooks/subbotclient.pl + + Added: trunk/dev-tools/repo-hooks/subbotclient.pl =================================================================== --- trunk/dev-tools/repo-hooks/subbotclient.pl 2006-01-07 15:29:45 UTC (rev 961) +++ trunk/dev-tools/repo-hooks/subbotclient.pl 2006-01-09 21:19:13 UTC (rev 962) @@ -0,0 +1,82 @@ +#!/usr/bin/perl + +# Client for SubBot, a basic irc line-poster bot for subversion commits (unclever name, but hey). +# Copyright (c) 2005 Eric Goodwin +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +use Digest::SHA1 qw(sha1_base64); +use POE qw(Component::Client::TCP); + +my $password = "haspOntAi"; +my $message = ""; + +while(my $line = <>){ + chomp $line; + $message .= $line."\n"; +} + +my $send1 = encode_base64($message); +my $send2 = sha1_base64($send1.$password); +#print "$send1\n$send2\n"; + +POE::Component::Client::TCP->new + ( RemoteAddress => "scone.beginyourfear.com", + RemotePort => 5991, + Connected => sub { + my $heap = ($_[HEAP]); + $heap->{server}->put("$send1\n$send2"); + }, + Disconnected => sub { exit 1; }, + ConnectError => sub { exit 0; }, + ServerInput => sub {}, +); + +$poe_kernel->run(); + +#Stolen from MIME::Base64::Perl +sub encode_base64 ($;$) +{ + if ($] >= 5.006) { + require bytes; + if (bytes::length($_[0]) > length($_[0]) || + ($] >= 5.008 && $_[0] =~ /[^\0-\xFF]/)) + { + require Carp; + Carp::croak("The Base64 encoding is only defined for bytes"); + } + } + + use integer; + + my $eol = $_[1]; + $eol = "" unless defined $eol; + + my $res = pack("u", $_[0]); + # Remove first character of each line, remove newlines + $res =~ s/^.//mg; + $res =~ s/\n//g; + + $res =~ tr|` -_|AA-Za-z0-9+/|; # `# help emacs + # fix padding at the end + my $padding = (3 - length($_[0]) % 3) % 3; + $res =~ s/.{$padding}$/'=' x $padding/e if $padding; + # break encoded string into lines of no more than 76 characters each + if (length $eol) { + $res =~ s/(.{1,76})/$1$eol/g; + } + return $res; +} + Property changes on: trunk/dev-tools/repo-hooks/subbotclient.pl ___________________________________________________________________ Name: svn:executable + *
