Date: Mon, 03 Oct 2011 23:14:42 +0400 From: Boris Samorodov <bsam@passap.ru> To: Doug Barton <dougb@FreeBSD.org> Cc: cvs-ports@FreeBSD.org, cvs-all@FreeBSD.org, Boris Samorodov <bsam@FreeBSD.org>, ports-committers@FreeBSD.org Subject: Re: cvs commit: ports/mail/imaptools distinfo Message-ID: <1317669282.4008.4.camel@bsam.tel.ru> In-Reply-To: <4E8A0449.1020303@FreeBSD.org> References: <201110031305.p93D5K3x082695@repoman.freebsd.org> <4E8A0449.1020303@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
В пн, 03/10/2011 в 11:51 -0700, Doug Barton пишет: > On 10/03/2011 06:05, Boris Samorodov wrote: > > bsam 2011-10-03 13:05:20 UTC > > > > FreeBSD ports repository > > > > Modified files: > > mail/imaptools distinfo > > Log: > > Update distinfo and fix fetching. The distfile was rerolled without > > changing the version. Confirmed by the author via private e-mail. > > He said that it's not a good practice and would avoid doing it in > > the future. > > > > Reported by: pontyhat (pavmail) > > > > Revision Changes Path > > 1.10 +2 -2 ports/mail/imaptools/distinfo > > > > http://www.FreeBSD.org/cgi/cvsweb.cgi/ports/mail/imaptools/distinfo.diff?&r1=1.9&r2=1.10&f=h > > > Confirming with the author is fine, but did you compare the old and new > distfiles yourself? If so, what changed? Yes, I compared them: ----- diff -ruN 15/old/migrateIMAP.pl 15/new/migrateIMAP.pl --- 15/old/migrateIMAP.pl 2011-09-28 08:08:54.000000000 +0400 +++ 15/new/migrateIMAP.pl 2011-09-30 09:21:15.000000000 +0400 @@ -1,6 +1,6 @@ #!/usr/bin/perl -# $Header: /mhub4/sources/imap-tools/migrateIMAP.pl,v 1.13 2011/09/28 04:29:54 rick Exp $ +# $Header: /mhub4/sources/imap-tools/migrateIMAP.pl,v 1.14 2011/09/30 05:42:21 rick Exp $ #************************************************************************* # * @@ -22,8 +22,6 @@ init(); -$showIMAP=1; - # Get the list of usernames and passwords @users = getUserList( $userlist ); @@ -131,6 +129,8 @@ createMbx( $mbx, $dst ) unless mbxExists( $mbx, $dst); + get_supported_flags( $mbx, $dst, \%SUPPORTED_FLAGS ); + if ( $sent_after ) { getDatedMsgList( $mbx, $sent_after, \@msgs, $src ); } else { @@ -162,6 +162,7 @@ $added=0; foreach $_ ( @msgs ) { ($msgnum,$date,$flags,$msgid) = split(/\|/, $_); + $flags = validate_flags( $flags, \%SUPPORTED_FLAGS ); if ( $update ) { # If we are in 'update' mode then don't copy @@ -676,8 +677,7 @@ if ( $response =~ /^1 OK/i ) { # print STDERR "response $response\n"; last; - } - elsif ( $response !~ /^\*/ ) { + } elsif ( $response !~ /^\*/ ) { Log ("unexpected response: $response"); # print STDERR "Error: $response\n"; return 0; @@ -878,7 +878,6 @@ } elsif ( $response !~ /^\*/ ) { Log ("Unexpected APPEND response: >$response<"); -exit; # next; return 0; } @@ -1427,3 +1426,49 @@ } } + +sub get_supported_flags { + +my $mbx = shift; +my $conn = shift; +my $FLAGS = shift; + + # Determine which flags are supported by the mailbox + + sendCommand ($conn, "1 EXAMINE \"$mbx\""); + undef @response; + $empty=0; + while ( 1 ) { + readResponse ( $conn ); + if ( $response =~ /^1 OK/i ) { + last; + } elsif ( $response !~ /^\*/ ) { + Log ("unexpected response: $response"); + last; + } elsif ( $response =~ /^\* FLAGS \((.+)\)/i ) { + %$FLAGS = (); + foreach my $flag ( split(/\s+/, $1) ) { + $$FLAGS{$flag} = 1; + } + } + } + +} + +sub validate_flags { + +my $flags = shift; +my $valid_flags = shift; +my $newflags; + + # Remove any flags not supported by the destination mailbox + + foreach my $flag ( split(/\s+/, $flags ) ) { + next unless $$valid_flags{$flag}; + $newflags .= "$flag "; + } + chop $newflags; + + return $newflags; + +} ----- -- WBR, bsam
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1317669282.4008.4.camel>