aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Net
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2015-09-05 17:39:53 +0200
committerGuilhem Moulin <guilhem@fripost.org>2015-09-05 17:39:53 +0200
commitf3a94832cb19e9aad7f0d6060ac6fee873b05ac2 (patch)
tree6270f95fd89714f75e1925cfe1820715547f7fe0 /lib/Net
parent8566f8140d92380157ceaef1fed0536e23610d7e (diff)
parentf5b7ec21e9d53ac7d93797a83c3c100dfa4de076 (diff)
Merge branch 'master' into debian
Diffstat (limited to 'lib/Net')
-rw-r--r--lib/Net/IMAP/Sync.pm31
1 files changed, 19 insertions, 12 deletions
diff --git a/lib/Net/IMAP/Sync.pm b/lib/Net/IMAP/Sync.pm
index 85ca487..ca85a54 100644
--- a/lib/Net/IMAP/Sync.pm
+++ b/lib/Net/IMAP/Sync.pm
@@ -482,19 +482,21 @@ sub search($$) {
}
-# $self->select($mailbox)
-# $self->examine($mailbox)
+# $self->select($mailbox, [$UIDs, $seqs])
+# $self->examine($mailbox, [$UIDs, $seqs])
# Issue a SELECT or EXAMINE command for the $mailbox. Upon success,
# change the state to SELECTED, otherwise go back to AUTH.
-sub select($$) {
+# The optional $UIDs and $seqs are passed are 3rd and 4th arguments to
+# the QRESYNC parameter, respectively.
+sub select($$;$$) {
my $self = shift;
my $mailbox = shift;
- $self->_select_or_examine('SELECT', $mailbox);
+ $self->_select_or_examine('SELECT', $mailbox, @_);
}
-sub examine($$) {
+sub examine($$;$$) {
my $self = shift;
my $mailbox = shift;
- $self->_select_or_examine('EXAMINE', $mailbox);
+ $self->_select_or_examine('EXAMINE', $mailbox, @_);
}
@@ -1276,13 +1278,16 @@ sub _open_mailbox($$) {
}
-# $self->_select_or_examine($command, $mailbox)
+# $self->_select_or_examine($command, $mailbox, [$UIDs, $seqs])
# Issue a SELECT or EXAMINE command for the $mailbox. Upon success,
# change the state to SELECTED, otherwise go back to AUTH.
-sub _select_or_examine($$$) {
+# The optional $UIDs and $seqs are passed are 3rd and 4th arguments to
+# the QRESYNC parameter, respectively.
+sub _select_or_examine($$$;$$) {
my $self = shift;
my $command = shift;
my $mailbox = shift;
+ my ($uids, $seqs) = @_;
my $pcache = $self->{_PCACHE}->{$mailbox} //= {};
my $cache = $self->{_CACHE}->{$mailbox} //= {};
@@ -1290,10 +1295,12 @@ sub _select_or_examine($$$) {
$mailbox = uc $mailbox eq 'INBOX' ? 'INBOX' : $mailbox; # INBOX is case-insensitive
$command .= ' '.quote($mailbox);
- $command .= " (QRESYNC ($pcache->{UIDVALIDITY} $pcache->{HIGHESTMODSEQ} "
- ."1:".($pcache->{UIDNEXT}-1)."))"
- if $self->_enabled('QRESYNC') and
- ($pcache->{HIGHESTMODSEQ} // 0) > 0 and ($pcache->{UIDNEXT} // 1) > 1;
+ if ($self->_enabled('QRESYNC') and ($pcache->{HIGHESTMODSEQ} // 0) > 0 and ($pcache->{UIDNEXT} // 1) > 1) {
+ $command .= " (QRESYNC ($pcache->{UIDVALIDITY} $pcache->{HIGHESTMODSEQ} "
+ ."1:".($pcache->{UIDNEXT}-1);
+ $command .= " ($uids $seqs)" if defined $uids and defined $seqs;
+ $command .= "))";
+ }
if ($self->{_STATE} eq 'SELECTED' and ($self->_capable('CONDSTORE') or $self->_capable('QRESYNC'))) {
# A mailbox is currently selected and the server advertises