Subject: | [PATCH] UID command does not work with folder management commands |
The subscribe, delete, myrights, create and close folder management
commands are sent with the UID prefix if that option is enabled. This
goes against the relevant specs, and breaks against Lotus Domino servers.
Attached patch fixes this.
Mail-IMAPClient-3.00
perl 5.8.8
Debian lenny/sid Linux 2.6.22
Subject: | foldercmd-nouid.patch |
diff --git a/lib/Mail/IMAPClient.pm b/lib/Mail/IMAPClient.pm
index 4f6493e..0f87b40 100644
--- a/lib/Mail/IMAPClient.pm
+++ b/lib/Mail/IMAPClient.pm
@@ -1112,6 +1112,14 @@ sub _imap_uid_command
$self->_imap_command("$uid$cmd$args");
}
+sub _imap_plain_command
+{
+ my $self = shift;
+ my $cmd = shift;
+ my $args = @_ ? join(" ", '', @_) : '';
+ $self->_imap_command("$cmd$args");
+}
+
sub run
{ my $self = shift;
my $string = shift or return undef;
@@ -1745,7 +1753,7 @@ sub subscribe
{ my ($self, @a) = @_;
delete $self->{Folders};
$a[-1] = $self->Massage($a[-1]) if @a;
- $self->_imap_uid_command(SUBSCRIBE => @a)
+ $self->_imap_plain_command(SUBSCRIBE => @a)
or return undef;
wantarray ? $self->History : $self->Results;
}
@@ -1754,7 +1762,7 @@ sub delete
{ my ($self, @a) = @_;
delete $self->{Folders};
$a[-1] = $self->Massage($a[-1]) if @a;
- $self->_imap_uid_command(DELETE => @a)
+ $self->_imap_plain_command(DELETE => @a)
or return undef;
wantarray ? $self->History : $self->Results;
}
@@ -1763,7 +1771,7 @@ sub myrights
{ my ($self, @a) = @_;
delete $self->{Folders};
$a[-1] = $self->Massage($a[-1]) if @a;
- $self->_imap_uid_command(MYRIGHTS => @a)
+ $self->_imap_plain_command(MYRIGHTS => @a)
or return undef;
wantarray ? $self->History : $self->Results;
}
@@ -1772,7 +1780,7 @@ sub create
{ my ($self, @a) = @_;
delete $self->{Folders};
$a[0] = $self->Massage($a[0]) if @a;
- $self->_imap_uid_command(CREATE => @a)
+ $self->_imap_plain_command(CREATE => @a)
or return undef;
wantarray ? $self->History : $self->Results;
}
@@ -1780,7 +1788,7 @@ sub create
sub close
{ my $self = shift;
delete $self->{Folders};
- $self->_imap_uid_command('CLOSE')
+ $self->_imap_command('CLOSE')
or return undef;
wantarray ? $self->History : $self->Results;
}