Troncage du sujet après les 255 premiers caractères

tags/0.0.1
Daniel Berteaud 12 years ago
parent c6cea9d36e
commit 0a3b5d51df
  1. 7
      root/usr/share/qpsmtpd/plugins/logging/log2sql

@ -136,8 +136,13 @@ my($header) = $transaction->header();
#'touch' this message :-)) #'touch' this message :-))
$header->add("X-Sql-Log-ID",$mail_id); $header->add("X-Sql-Log-ID",$mail_id);
my $subject = scalar $header->get("Subject");
chomp($subject);
# Only keep the first 255 chars to be sure it can be inserted in the table
$subject= substr $subject, 0, 254;
my($statement) = "UPDATE ".$mail_table." SET subject=". my($statement) = "UPDATE ".$mail_table." SET subject=".
$dbh->quote(scalar $header->get("Subject")). $dbh->quote($subject).
",header_size=".$dbh->quote(length($header->as_string())). ",header_size=".$dbh->quote(length($header->as_string())).
",body_size=".$dbh->quote($transaction->body_size()). ",body_size=".$dbh->quote($transaction->body_size()).
" WHERE mail_id=".$mail_id; " WHERE mail_id=".$mail_id;

Loading…
Cancel
Save