summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-11-05 22:59:11 +0000
committerDries Buytaert <dries@buytaert.net>2001-11-05 22:59:11 +0000
commitdb47bac35ec035388cfdab0a9fb27e97f8099742 (patch)
treef1ae2de16fdaa0ab39199d61828076e9eeb9af45 /scripts
parentf88cfaa2dd205846843068175931e68c582bb037 (diff)
downloadbrdo-db47bac35ec035388cfdab0a9fb27e97f8099742.tar.gz
brdo-db47bac35ec035388cfdab0a9fb27e97f8099742.tar.bz2
- node.module:
+ Changed node_form() to use good ol' tables instead of div/CSS-tags. + Revised the "revision API": I think we have both an easy and powerful API now that should make everyone happy. + Improved the usability of the rollback functionality a bit. + Removed the "view node" link from the "node overview" page in the admin section and added a "delete node" link instead. + Added a few missing translations; there might be missing more translations though. - book.module: + Made the book module use the "revision API" instead of having it poke and use the innards and underlying details of the revision system. - queue.module: + Made the queue module use the improved revision number. - module.inc: + Applied Moshe's patch: added more arguments to module_invoke() - mail-to-sql.pl: + Added support for more header fields and for folded fields Notes: - no database updates required
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mail-to-sql.pl39
1 files changed, 27 insertions, 12 deletions
diff --git a/scripts/mail-to-sql.pl b/scripts/mail-to-sql.pl
index 9085c9af2..6fcb89631 100644
--- a/scripts/mail-to-sql.pl
+++ b/scripts/mail-to-sql.pl
@@ -2,37 +2,52 @@
use DBI;
-# database settings:
+# Database settings:
my $db_name = 'drop';
my $db_user = 'drop';
my $db_pass = 'drop';
-# read data from stdin:
+# Read data from stdin:
my @data = <STDIN>;
my $data = join '', @data;
my @chunks = split(/\n\n/, $data);
-# parse the header into an associative array:
+# Parse the header into an associative array:
foreach $line (split(/\n/, $chunks[0])) {
- if ($line =~ /(.*?):\s(.*)/) {
- $header{lc($1)} = $2;
+ # The field-body can be split into a multiple-line representation,
+ # which is called "folding". According to RFC 822, the rule is that
+ # wherever there may be linear-white-space (not simply LWSP-chars),
+ # a CRLF immediately followed by at least one LWSP-char may instead
+ # be inserted.
+
+ if ($line =~ /^\s(.*?)/) {
+ $data = $1;
+ }
+ elsif ($line =~ /(.*?):\s(.*)/) {
+ $key = lc($1);
+ $data = $2;
}
- $header{data} .= "$line\n";
-}
-$chunks[0] = "";
+ if ($key && $data) {
+ $header{$key} .= $data;
+ }
+}
-# debug output:
+# Debug output:
# foreach $key (sort keys %header) {
- # print "$key: $header{$key}\n";
+ # print "$key: $header{$key}\n--------\n";
# }
-# construct the mail body:
+# Store the complete header into a field:
+$header{header} = $chunks[0];
+$chunks[0] = "";
+
+# Construct the mail body:
foreach $line (@chunks) {
$body .= "$line\n\n";
}
my $db = DBI->connect("DBI:mysql:$db_name", "$db_user", "$db_pass") or die "Couldn't connect recepient database: " . DBI->errstr;
-$db->do("INSERT INTO mail (subject, sender, recepient, header, body, timestamp) VALUES (". $db->quote($header{subject}) .", ". $db->quote($header{from}) .", ". $db->quote($header{to}) .", ". $db->quote($header{data}) .", ". $db->quote($body) .", ". $db->quote(time()) .")") or die "Couldn't execute query: " . $db->errstr;
+$db->do("INSERT INTO mail (subject, header_from, header_to, header_cc, header_reply_to, header, body, timestamp) VALUES (". $db->quote($header{"subject"}) .", ". $db->quote($header{"from"}) .", ". $db->quote($header{"to"}) .", ". $db->quote($header{"cc"}) .", ". $db->quote($header{"reply-to"}) .", ". $db->quote($header{"header"}) .", ". $db->quote($body) .", ". $db->quote(time()) .")") or die "Couldn't execute query: " . $db->errstr;
$db->disconnect();