diff --git a/pykolab/imap/cyrus.py b/pykolab/imap/cyrus.py --- a/pykolab/imap/cyrus.py +++ b/pykolab/imap/cyrus.py @@ -25,6 +25,7 @@ import pykolab +from pykolab.constants import * from pykolab.imap import IMAP from pykolab.translate import _ @@ -140,6 +141,10 @@ """ cyruslib.CYRUS.login(self, *args, **kw) self.separator = self.SEP + try: + self._id() + except Exception, errmsg: + pass log.debug( _("Continuing with separator: %r") % (self.separator), @@ -271,6 +276,13 @@ from pykolab import imap_utf7 return imap_utf7.decode(folder) + def _id(self, identity=None): + if identity is None: + identity = '("name" "Python/Kolab" "version" "%s")' % (__version__) + + typ, dat = self.m._simple_command('ID', identity) + res, dat = self.m._untagged_response(typ, dat, 'ID') + def _setquota(self, mailfolder, quota): """ Login to the actual backend server. @@ -372,11 +384,11 @@ self.xfer(mailfolder, new_server) def undelete_mailfolder( - self, - mailfolder, - to_mailfolder=None, - recursive=True - ): + self, + mailfolder, + to_mailfolder=None, + recursive=True + ): """ Login to the actual backend server, then "undelete" the mailfolder. @@ -458,7 +470,7 @@ target_server = self.find_mailfolder_server(target_folder) if hasattr(conf, 'dry_run') and not conf.dry_run: - if not target_server == self.server: + if target_server is not self.server: self.xfer(undelete_folder, target_server) self.rename(undelete_folder, target_folder)