[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Migration Tobit David to another IMAP server


From Martin Werthmöller <mw at lw-systems dot de>
Subject Migration Tobit David to another IMAP server
Date Mon, 2 Aug 2010 14:10:18 +0200

Hello List,

I need to migrate a Tobit David Server 6
"DvISE Mail Access Server MA-6.60a (0118)"
to another IMAP system. We are stumbling over the the bug from Tobit David
discussed at the thread "Migration Tobit David to Dovecot" from "Wed, 01
Apr 2009 16:37:20 +0200".

As it isn't possible to get the source code of Tobit David it seems even
simpler to modify the Perl Mail::IMAPClient module, namely the "search"
method of the Mail::IMAPClient class of the module.

As I won't patch the Packages of the Perl distribution directly, it seems
practical to overwrite the method in imapclient.

To help other users with problems like this, I attach the patch to
imapclient 1.337 and put it thereby to the list (archive).


Best regards,
Martin Werthmoeller

-- 
LWsystems - IT-Service and Consulting
mw at lw-systems dot de * http://www.lw-systems.de
--- imapsync-1.337      2010-08-02 13:56:06.000000000 +0200
+++ imapsync-1.337_tobit-workaround     2010-08-02 13:53:58.000000000 +0200
@@ -3821,6 +3821,7 @@
   $banner;
 }
 
+
 # IMAPClient 2.2.9 3.xx ads
 
 package Mail::IMAPClient;
@@ -3869,3 +3870,33 @@
     #$self->Fast_io( $self->Fast_io );
     $sock;
 }
+
+sub search {
+    my ( $self, @args ) = @_;
+
+    @args = $self->_quote_search(@args);
+
+    $self->_imap_uid_command( SEARCH => @args )
+      or return undef;
+
+    my @hits;
+    foreach ( $self->History ) {
+        chomp;
+        s/$CR?$LF$//o;
+        s/^(\s*\d+)/* SEARCH $1/;
+        s/^\*\s+SEARCH\s+(?=.*?\d)// or next;
+        push @hits, grep /^\d+$/, split;
+    }
+
+    @hits
+      or $self->_debug("Search successful but found no matching messages");
+
+    # return empty list
+    return
+        wantarray     ? @hits
+: ! at hits        ? \ at hits
+: $self->Ranges ? $self->Range( \ at hits )
+:                 \ at hits;
+}
+
+