diff options
-rwxr-xr-x | parse-wiki | 27 |
1 files changed, 10 insertions, 17 deletions
@@ -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"; |