diff options
-rw-r--r-- | lib/Net/IMAP/Sync.pm | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/lib/Net/IMAP/Sync.pm b/lib/Net/IMAP/Sync.pm index 2116443..517270b 100644 --- a/lib/Net/IMAP/Sync.pm +++ b/lib/Net/IMAP/Sync.pm @@ -571,19 +571,22 @@ sub remove($@) { my %vanished = map {$_ => 1} @{$self->{_VANISHED}}; - my @failed; + my (@failed, @expunged); foreach my $uid (@set) { if (exists $vanished{$uid}) { - # ignore succesfully EXPUNGEd messages - delete $vanished{$uid}; - delete $self->{_MODIFIED}->{$uid}; + push @expunged, $uid } else { push @failed, $uid; } } + + # ignore succesfully EXPUNGEd messages + delete @vanished{@expunged}; + delete @{$self->{_MODIFIED}}{@expunged}; $self->{_VANISHED} = [ keys %vanished ]; - $self->warn("Could not EXPUNGE UID(s) ".compact_set(@failed)) if @failed; + $self->log("Removed UID ".compact_set(@expunged)) if @expunged and !$self->{quiet}; + $self->warn("Could not UID EXPUNGE ".compact_set(@failed)) if @failed; return @failed; } @@ -656,6 +659,8 @@ sub append($$$@) { $cache->{UIDNEXT} = $UIDNEXT if ($cache->{UIDNEXT} // 0) < $UIDNEXT; } + $self->log("Added ".($#appends+1)." message(s) to $mailbox, got new UID ".compact_set(@uids)) + unless $self->{quiet}; return @uids; } @@ -947,6 +952,7 @@ sub push_flag_updates($$@) { } } + my @ok; foreach my $uid (@set) { if ($failed{$uid}) { # $uid was listed in the MODIFIED response code @@ -968,8 +974,15 @@ sub push_flag_updates($$@) { # got multiple FETCH responses for $uid, the last one with $flags delete $self->{_MODIFIED}->{$uid}; } + push @ok, $uid; } } + + unless ($self->{quiet}) { + $self->log("Updated flags ($flags) for UID ".compact_set(@ok)); + $self->log("Couldn't update flags ($flags) for UID ".compact_set(keys %failed).', '. + "trying again later") if %failed; + } return keys %failed; } |