]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/IMAP.pm
imap+nntp: share COMPRESS implementation
[public-inbox.git] / lib / PublicInbox / IMAP.pm
index ce0dce0f317e8fb40a2a0b9da160594cafeb4fcf..805f1102536d99d9cf77807f86e1b0b3e6290ce4 100644 (file)
@@ -1212,8 +1212,6 @@ sub event_step {
        $self->requeue unless $pending;
 }
 
-sub compressed { undef }
-
 # RFC 4978
 sub cmd_compress ($$$) {
        my ($self, $tag, $alg) = @_;
@@ -1223,7 +1221,9 @@ sub cmd_compress ($$$) {
        # CRIME made TLS compression obsolete
        # return "$tag NO [COMPRESSIONACTIVE]\r\n" if $self->tls_compressed;
 
-       PublicInbox::IMAPdeflate->enable($self, $tag);
+       PublicInbox::IMAPdeflate->enable($self) or return
+                               \"$tag BAD failed to activate compression\r\n";
+       PublicInbox::DS::write($self, \"$tag OK DEFLATE active\r\n");
        $self->requeue;
        undef
 }
@@ -1269,4 +1269,8 @@ our @ISA = qw(PublicInbox::IMAP);
 
 sub logged_in { 0 }
 
+package PublicInbox::IMAPdeflate;
+use PublicInbox::DSdeflate;
+our @ISA = qw(PublicInbox::DSdeflate PublicInbox::IMAP);
+
 1;