From 9956db2ba168028f5e4725a44bb21dddbf5daf29 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Thu, 8 Nov 2007 15:04:52 +0000 Subject: Do not use subject for finding out who has changed what git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@304 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- parse-wiki | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'parse-wiki') diff --git a/parse-wiki b/parse-wiki index c2ddac9..e56ceca 100755 --- a/parse-wiki +++ b/parse-wiki @@ -25,8 +25,6 @@ $project = $1; die ("Project is not a nice name.\n") unless defined $project; -my $from; -my $what; my $is_base64 = 0; @@ -54,34 +52,23 @@ while (defined($line = shift @mail)) { } while (defined($line = shift @headers)) { - if ($line =~ m/^Subject:\s+(?:\[.*?\]\s+)?(?:Trivial )?Update\s+of\s+"(.*)"\s+by\s+(.*?)\s*$/s) { - $what = $1; - $from = $2; - # =?utf-8?q?=5BOFTC=5D_Update_of_=22OFTC=22_by_PeterPalfrader?= - # =?utf-8?q?=5BOFTC=5D_Update_of_=22Staff=22_by_SethArnold?= - } elsif ($line =~ m/^Subject: (?:\[.*?\] )?=\?utf-8\?q\?=5BOFTC=5D_(?:Trivial_)?Update_of_=22(.*)=22_by_(.*?)\?=$/s) { - $what = $1; - $from = $2; - } elsif ($line =~ m/^Content-Transfer-Encoding: base64$/s) { + if ($line =~ m/^Content-Transfer-Encoding: base64$/s) { $is_base64 = 1; } elsif ($line =~ m/^$/) { last; } }; -$from =~ s/\?=\s*=\?utf-8\?q\?//sg; - -die ("$PROGRAM_NAME - $project: No author found.\n") unless defined $from; -die ("$PROGRAM_NAME - $project: No what found.\n") unless defined $what; - my $body = join '', @mail; $body = decode_base64($body) if ($is_base64); my $message; my $url; +my $from; my @lines = split(/\n/, $body); while (defined($line = shift @lines)) { - if ($line =~ m/^The following page has been changed by /) { + if ($line =~ m/^The following page has been changed by (.*):/) { + $from = $1; $url = shift @lines } elsif ($line =~ m/^The comment on the change is:/) { $message = shift @lines; @@ -89,6 +76,12 @@ while (defined($line = shift @lines)) { }; }; +die ("$PROGRAM_NAME - $project: No author found.\n") unless defined $from; +die ("$PROGRAM_NAME - $project: No url found.\n") unless defined $url; +$from =~ s/\?=\s*=\?utf-8\?q\?//sg; + +my $what = $url; +$what =~ s#https?://[^/]*/[^/]*/##; my $notice = (defined $message) ? "$from updated $what: $message" : "$from updated $what"; -- cgit v1.2.3