Changeset View
Changeset View
Standalone View
Standalone View
pykolab/imap/dovecot.py
Show All 31 Lines | |||||
# As an example, with annotations you can get all existing annotations with | # As an example, with annotations you can get all existing annotations with | ||||
# one call, but if we use metadatata we have to ask for specific variables, | # one call, but if we use metadatata we have to ask for specific variables, | ||||
# there is no function to get all of them at once (at least on the RFC); in | # there is no function to get all of them at once (at least on the RFC); in | ||||
# our case when a pattern like '*' is received we look for fields of the form | # our case when a pattern like '*' is received we look for fields of the form | ||||
# 'vendor/kolab/folder-type', as we know they are the fields the functions we | # 'vendor/kolab/folder-type', as we know they are the fields the functions we | ||||
# are using need. | # are using need. | ||||
# ----- | # ----- | ||||
from __future__ import print_function | |||||
import cyruslib | import cyruslib | ||||
import imaplib | import imaplib | ||||
import sys | import sys | ||||
import time | import time | ||||
from urlparse import urlparse | from urlparse import urlparse | ||||
import pykolab | import pykolab | ||||
▲ Show 20 Lines • Show All 187 Lines • ▼ Show 20 Lines | def __init__(self, uri): | ||||
# By default don't assume that we have metadata support | # By default don't assume that we have metadata support | ||||
self.metadata = False | self.metadata = False | ||||
def __del__(self): | def __del__(self): | ||||
pass | pass | ||||
def __verbose(self, msg): | def __verbose(self, msg): | ||||
if self.VERBOSE: | if self.VERBOSE: | ||||
print >> self.LOGFD, msg | print(msg, file=self.LOGFD) | ||||
def connect(self, uri): | def connect(self, uri): | ||||
""" | """ | ||||
Dummy connect function that checks if the server that we want to | Dummy connect function that checks if the server that we want to | ||||
connect to is actually the server we are connected to. | connect to is actually the server we are connected to. | ||||
Uses pykolab.imap.IMAP.connect() in the background. | Uses pykolab.imap.IMAP.connect() in the background. | ||||
""" | """ | ||||
▲ Show 20 Lines • Show All 264 Lines • ▼ Show 20 Lines | def undelete_mailfolder(self, mailfolder, to_mailfolder=None, recursive=True): | ||||
if hasattr(conf,'dry_run') and not conf.dry_run: | if hasattr(conf,'dry_run') and not conf.dry_run: | ||||
if not target_server == self.server: | if not target_server == self.server: | ||||
self.xfer(undelete_folder,target_server) | self.xfer(undelete_folder,target_server) | ||||
self.rename(undelete_folder,target_folder) | self.rename(undelete_folder,target_folder) | ||||
else: | else: | ||||
if not target_server == self.server: | if not target_server == self.server: | ||||
print >> sys.stdout, _("Would have transfered %s from %s to %s") % (undelete_folder, self.server, target_server) | print(_("Would have transfered %s from %s to %s") % (undelete_folder, self.server, target_server), file=sys.stdout) | ||||
print >> sys.stdout, _("Would have renamed %s to %s") % (undelete_folder, target_folder) | print(_("Would have renamed %s to %s") % (undelete_folder, target_folder), file=sys.stdout) | ||||
def parse_mailfolder(self, mailfolder): | def parse_mailfolder(self, mailfolder): | ||||
""" | """ | ||||
Parse a mailfolder name to it's parts. | Parse a mailfolder name to it's parts. | ||||
Takes a fully qualified mailfolder or mailfolder sub-folder. | Takes a fully qualified mailfolder or mailfolder sub-folder. | ||||
""" | """ | ||||
mbox = { | mbox = { | ||||
▲ Show 20 Lines • Show All 100 Lines • Show Last 20 Lines |