aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Net
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2015-07-23 17:11:21 +0200
committerGuilhem Moulin <guilhem@fripost.org>2015-07-23 17:15:38 +0200
commitf501dd5f09ca78c18fcde007e23337f05b1284b6 (patch)
tree3cd44bc0f1218d5bd4f06aaf525b0aa1096299cf /lib/Net
parentfaa472ccd478bcb900ae6e34e2cb1f6b29a30512 (diff)
Add informational messages.
Diffstat (limited to 'lib/Net')
-rw-r--r--lib/Net/IMAP/Sync.pm23
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;
}