cvs commit: qpsmtpd/t qpsmtpd-address.t

[email protected] (Ask "Bj?rn" Hansen)
Newsgroups perl.cvs.qpsmtpd
Message-ID <[email protected]>
cvsuser     04/07/14 16:58:47

  Modified:    .        Changes STATUS
               lib/Qpsmtpd SMTP.pm Transaction.pm
  Added:       t        qpsmtpd-address.t
  Log:
    Mail::Address does RFC822 addresses, we need SMTP addresses.
    Replace Mail::Address with Peter J. Holzer's Qpsmtpd::Address module.
  
  Revision  Changes    Path
  1.69      +8 -0      qpsmtpd/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /cvs/public/qpsmtpd/Changes,v
  retrieving revision 1.68
  retrieving revision 1.69
  diff -u -w -r1.68 -r1.69
  --- Changes	5 Jun 2004 10:06:43 -0000	1.68
  +++ Changes	14 Jul 2004 23:58:47 -0000	1.69
  @@ -1,3 +1,11 @@
  +0.29 - 
  +
  +  [ many changes from cvs logs, gah ]
  +
  +  Mail::Address does RFC822 addresses, we need SMTP addresses.
  +  Replace Mail::Address with Peter J. Holzer's Qpsmtpd::Address module.
  +
  +
   0.28 - 2004/06/05
   
     Don't keep adding ip addresses to the process status line ($0) when running under PPerl.
  
  
  
  1.14      +4 -1      qpsmtpd/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /cvs/public/qpsmtpd/STATUS,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -w -r1.13 -r1.14
  --- STATUS	5 Jun 2004 10:09:30 -0000	1.13
  +++ STATUS	14 Jul 2004 23:58:47 -0000	1.14
  @@ -4,7 +4,7 @@
   
   0.29:
         - Add the first time denysoft plugin
  -      - Support email addresses with spaces in them
  +      - Support email addresses with spaces in them (done)
         - Bugfixes
   
   0.40:
  @@ -29,6 +29,9 @@
   Issues
   ======
   
  +Understand "extension parameters" to the MAIL FROM and RCPT TO
  +parameters (and make the plugin hooks able to get at them).
  +
   plugins/queue/qmail-queue is still calling exit inappropriately
   (should call disconnect or some such)
   
  
  
  
  1.30      +4 -4      qpsmtpd/lib/Qpsmtpd/SMTP.pm
  
  Index: SMTP.pm
  ===================================================================
  RCS file: /cvs/public/qpsmtpd/lib/Qpsmtpd/SMTP.pm,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -w -r1.29 -r1.30
  --- SMTP.pm	29 Jun 2004 21:45:09 -0000	1.29
  +++ SMTP.pm	14 Jul 2004 23:58:47 -0000	1.30
  @@ -11,8 +11,8 @@
   use Qpsmtpd::Plugin;
   use Qpsmtpd::Constants;
   use Qpsmtpd::Auth;
  +use Qpsmtpd::Address ();
   
  -use Mail::Address ();
   use Mail::Header ();
   #use Data::Dumper;
   use POSIX qw(strftime);
  @@ -229,10 +229,10 @@
       my ($from) = ($from_parameter =~ m/^from:\s*(\S+)/i)[0];
       warn "$$ from email address : [$from]\n";
       if ($from eq "<>" or $from =~ m/\[undefined\]/) {
  -      $from = Mail::Address->new("<>");
  +      $from = Qpsmtpd::Address->new("<>");
       } 
       else {
  -      $from = (Mail::Address->parse($from))[0];
  +      $from = (Qpsmtpd::Address->parse($from))[0];
       }
       return $self->respond(501, "could not parse your mail from command") unless $from;
   
  @@ -277,7 +277,7 @@
   
     my ($rcpt) = ($_[0] =~ m/to:(.*)/i)[0];
     $rcpt = $_[1] unless $rcpt;
  -  $rcpt = (Mail::Address->parse($rcpt))[0];
  +  $rcpt = (Qpsmtpd::Address->parse($rcpt))[0];
   
     return $self->respond(501, "could not parse recipient") unless $rcpt;
   
  
  
  
  1.14      +4 -4      qpsmtpd/lib/Qpsmtpd/Transaction.pm
  
  Index: Transaction.pm
  ===================================================================
  RCS file: /cvs/public/qpsmtpd/lib/Qpsmtpd/Transaction.pm,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -w -r1.13 -r1.14
  --- Transaction.pm	28 Jun 2004 00:00:51 -0000	1.13
  +++ Transaction.pm	14 Jul 2004 23:58:47 -0000	1.14
  @@ -160,14 +160,14 @@
   
   This adds a new recipient (as in RCPT TO) to the envelope of the mail.
   
  -The C<$recipient> is a C<Mail::Address> object. See L<Mail::Address>
  +The C<$recipient> is a C<Qpsmtpd::Address> object. See L<Qpsmtpd::Address>
   for more details.
   
   =head2 recipients( )
   
   This returns a list of the current recipients in the envelope.
   
  -Each recipient returned is a C<Mail::Address> object.
  +Each recipient returned is a C<Qpsmtpd::Address> object.
   
   =head2 relaying( )
   
  @@ -178,7 +178,7 @@
   
   Get or set the sender (MAIL FROM) address in the envelope.
   
  -The sender is a C<Mail::Address> object.
  +The sender is a C<Qpsmtpd::Address> object.
   
   =head2 header( [ HEADER ] )
   
  @@ -225,6 +225,6 @@
   
   =head1 SEE ALSO
   
  -L<Mail::Header>, L<Mail::Address>
  +L<Mail::Header>, L<Qpsmtpd::Address>, L<Qpsmtpd::Connection>
   
   =cut
  
  
  
  1.1                  qpsmtpd/t/qpsmtpd-address.t
  
  Index: qpsmtpd-address.t
  ===================================================================
  #!/usr/bin/perl
  use strict;
  use warnings;
  
  use Test::More tests => 9;
  
  BEGIN {
      use_ok('Qpsmtpd::Address');
  }
  
  my $as;
  my $ao;
  
  $as = '<>';
  $ao = Qpsmtpd::Address->parse($as);
  ok ($ao, "parse $as");
  is ($ao->format, $as, "format $as");
  
  $as = '<[email protected]>';
  $ao = Qpsmtpd::Address->parse($as);
  ok ($ao, "parse $as");
  is ($ao->format, $as, "format $as");
  
  # the \ before the @ in the local part is not required, but
  # allowed. For simplicity we add a backslash before all characters 
  # which are not allowed in a dot-string.
  $as = '<"[email protected]"@wifo.ac.at>';
  $ao = Qpsmtpd::Address->parse($as);
  ok ($ao, "parse $as");
  is ($ao->format, '<"musa_ibrah\@caramail.comandrea.luger"@wifo.ac.at>', "format $as");
  
  # email addresses with spaces
  $as = '<foo [email protected]>';
  $ao = Qpsmtpd::Address->parse($as);
  ok ($ao, "parse $as");
  is ($ao->format, '<"foo\ bar"@example.com>', "format $as");
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.