6 |
6 |
7 import VirtualMailManager.constants.ERROR as ERR |
7 import VirtualMailManager.constants.ERROR as ERR |
8 from VirtualMailManager.Domain import Domain |
8 from VirtualMailManager.Domain import Domain |
9 from VirtualMailManager.EmailAddress import EmailAddress |
9 from VirtualMailManager.EmailAddress import EmailAddress |
10 from VirtualMailManager.errors import AccountError as AccE |
10 from VirtualMailManager.errors import AccountError as AccE |
11 from VirtualMailManager.maillocation import MailLocation, MAILDIR_NAME, \ |
11 from VirtualMailManager.maillocation import MailLocation, known_format |
12 MBOX_NAME, MDBOX_NAME, SDBOX_NAME |
|
13 from VirtualMailManager.Transport import Transport |
12 from VirtualMailManager.Transport import Transport |
14 |
13 |
15 |
14 |
16 _ = lambda msg: msg |
15 _ = lambda msg: msg |
17 |
16 |
74 dbc.execute("SELECT nextval('users_uid')") |
73 dbc.execute("SELECT nextval('users_uid')") |
75 self._uid = dbc.fetchone()[0] |
74 self._uid = dbc.fetchone()[0] |
76 dbc.close() |
75 dbc.close() |
77 |
76 |
78 def _prepare(self, maillocation): |
77 def _prepare(self, maillocation): |
79 if not maillocation.lower() in map(lambda x: x.lower(), (MAILDIR_NAME, |
78 if not known_format(maillocation): |
80 MBOX_NAME, MDBOX_NAME, SDBOX_NAME)): |
79 raise AccE(_(u'Unknown mail_location mailbox format: %r') % |
81 raise AccE(_(u'Unknown mail_location directory name: %r') % |
|
82 maillocation, ERR.UNKNOWN_MAILLOCATION_NAME) |
80 maillocation, ERR.UNKNOWN_MAILLOCATION_NAME) |
83 self._setID() |
81 self._setID() |
84 self._mid = MailLocation(type_=maillocation).mid |
82 self._mid = MailLocation(format=maillocation).mid |
85 |
83 |
86 def _switchState(self, state, dcvers, service): |
84 def _switchState(self, state, dcvers, service): |
87 if not isinstance(state, bool): |
85 if not isinstance(state, bool): |
88 return False |
86 return False |
89 if not service in (None, 'all', 'imap', 'pop3', 'sieve', 'smtp'): |
87 if not service in (None, 'all', 'imap', 'pop3', 'sieve', 'smtp'): |