Add --skipallmailduplicates option

This option is appropriate when host1 is Gmail and host 2 isn't.
It causes messages in [Gmail]/All Mail to be skipped if they are
in some other folder also.
This commit is contained in:
Mike Alexander 2020-11-23 20:37:59 -05:00
parent 7fda0fe570
commit 5a2605d632
4 changed files with 25 additions and 6 deletions

6
README
View file

@ -314,9 +314,13 @@ OPTIONS
X is not also Gmail. X is not also Gmail.
Activated with --gmail1 unless --noskipcrossduplicates Activated with --gmail1 unless --noskipcrossduplicates
--skipallmailduplicates : Used when host1 is GMail. Skips messages in
[Gmail]/All Mail that are also in some other folder.
--debugcrossduplicates : Prints which messages (UIDs) are skipped with --debugcrossduplicates : Prints which messages (UIDs) are skipped with
--skipcrossduplicates (and in what other folders --skipcrossduplicates (and in what other folders
they are). they are). Also prints messages skipped by
--skipallmailduplicates.
--pipemess cmd : Apply this cmd command to each message content --pipemess cmd : Apply this cmd command to each message content
before the copy. before the copy.

View file

@ -331,9 +331,13 @@ OPTIONS
X is not also Gmail. X is not also Gmail.
Activated with --gmail1 unless --noskipcrossduplicates Activated with --gmail1 unless --noskipcrossduplicates
--skipallmailduplicates : Used when host1 is GMail. Skips messages in
[Gmail]/All Mail that are also in some other folder.
--debugcrossduplicates : Prints which messages (UIDs) are skipped with --debugcrossduplicates : Prints which messages (UIDs) are skipped with
--skipcrossduplicates (and in what other folders --skipcrossduplicates (and in what other folders
they are). they are). Also prints messages skipped by
--skipallmailduplicates.
--pipemess cmd : Apply this cmd command to each message content --pipemess cmd : Apply this cmd command to each message content
before the copy. before the copy.

View file

@ -470,9 +470,13 @@ and user1 user2 are the \-\-user1 \-\-user2 values.
\& X is not also Gmail. \& X is not also Gmail.
\& Activated with \-\-gmail1 unless \-\-noskipcrossduplicates \& Activated with \-\-gmail1 unless \-\-noskipcrossduplicates
\& \&
\& \-\-skipallmailduplicates : Used when host1 is GMail. Skips messages in
\& [Gmail]/All Mail that are also in some other folder.
\&
\& \-\-debugcrossduplicates : Prints which messages (UIDs) are skipped with \& \-\-debugcrossduplicates : Prints which messages (UIDs) are skipped with
\& \-\-skipcrossduplicates (and in what other folders \& \-\-skipcrossduplicates (and in what other folders
\& they are). \& they are). Also prints messages skipped by
\& \-\-skipallmailduplicates.
\& \&
\& \-\-pipemess cmd : Apply this cmd command to each message content \& \-\-pipemess cmd : Apply this cmd command to each message content
\& before the copy. \& before the copy.

View file

@ -346,9 +346,13 @@ and user1 user2 are the --user1 --user2 values.
X is not also Gmail. X is not also Gmail.
Activated with --gmail1 unless --noskipcrossduplicates Activated with --gmail1 unless --noskipcrossduplicates
--skipallmailduplicates : Used when host1 is GMail. Skips messages in
[Gmail]/All Mail that are also in some other folder.
--debugcrossduplicates : Prints which messages (UIDs) are skipped with --debugcrossduplicates : Prints which messages (UIDs) are skipped with
--skipcrossduplicates (and in what other folders --skipcrossduplicates (and in what other folders
they are). they are). Also prints messages skipped by
--skipallmailduplicates.
--pipemess cmd : Apply this cmd command to each message content --pipemess cmd : Apply this cmd command to each message content
before the copy. before the copy.
@ -1104,7 +1108,7 @@ my(
$uidnext_default, $uidnext_default,
$fixcolonbug, $fixcolonbug,
$create_folder_old, $create_folder_old,
$skipcrossduplicates, $debugcrossduplicates, $skipcrossduplicates, $debugcrossduplicates, $skipallmailduplicates,
$disarmreadreceipts, $disarmreadreceipts,
$mixfolders, $mixfolders,
$fetch_hash_set, $fetch_hash_set,
@ -2487,7 +2491,9 @@ FOLDER: foreach my $h1_fold ( @{ $sync->{h1_folders_wanted} } )
if ( ( not exists $h2_hash{ $m_id } ) if ( ( not exists $h2_hash{ $m_id } )
and ( not ( exists $sync->{ h2_folders_of_md5 }->{ $m_id } ) and ( not ( exists $sync->{ h2_folders_of_md5 }->{ $m_id } )
or not $skipcrossduplicates ) ) or ( not $skipcrossduplicates
and ( not $skipallmailduplicates
or $h1_fold ne "[Gmail]/All Mail" ) ) ) )
{ {
# copy # copy
my $h2_msg = copy_message( $sync, $h1_msg, $h1_fold, $h2_fold, $h1_fir_ref, $permanentflags2, $cache_dir ) ; my $h2_msg = copy_message( $sync, $h1_msg, $h1_fold, $h2_fold, $h1_fir_ref, $permanentflags2, $cache_dir ) ;
@ -16802,6 +16808,7 @@ sub get_options_cmd
'maxsleep=f' => \$mysync->{maxsleep}, 'maxsleep=f' => \$mysync->{maxsleep},
'skipcrossduplicates!' => \$skipcrossduplicates, 'skipcrossduplicates!' => \$skipcrossduplicates,
'debugcrossduplicates!' => \$debugcrossduplicates, 'debugcrossduplicates!' => \$debugcrossduplicates,
'skipallmailduplicates!' => \$skipallmailduplicates,
'log!' => \$mysync->{log}, 'log!' => \$mysync->{log},
'tail!' => \$mysync->{tail}, 'tail!' => \$mysync->{tail},
'logfile=s' => \$mysync->{logfile}, 'logfile=s' => \$mysync->{logfile},