equal
deleted
inserted
replaced
27 cfg_dget = lambda option: None |
27 cfg_dget = lambda option: None |
28 |
28 |
29 |
29 |
30 def _mbase64_encode(inp, dest): |
30 def _mbase64_encode(inp, dest): |
31 if inp: |
31 if inp: |
32 mb64 = b2a_base64(''.join(inp).encode('utf-16be')) |
32 mb64 = b2a_base64(''.join(inp).encode('utf-16be')).decode() |
33 dest.append('&%s-' % mb64.rstrip('\n=').replace('/', ',')) |
33 dest.append('&%s-' % mb64.rstrip('\n=').replace('/', ',')) |
34 del inp[:] |
34 del inp[:] |
35 |
35 |
36 |
36 |
37 def _mbase64_to_unicode(mb64): |
37 def _mbase64_to_unicode(mb64): |
38 return str(a2b_base64(mb64.replace(',', '/') + '==='), 'utf-16be') |
38 return str(a2b_base64(mb64.replace(',', '/').encode() + b'==='), |
|
39 'utf-16be') |
39 |
40 |
40 |
41 |
41 def utf8_to_mutf7(src): |
42 def utf8_to_mutf7(src): |
42 """ |
43 """ |
43 Converts the international mailbox name `src` into a modified |
44 Converts the international mailbox name `src` into a modified |
254 cmd_args.extend(mailboxes) |
255 cmd_args.extend(mailboxes) |
255 process = Popen(cmd_args, stderr=PIPE) |
256 process = Popen(cmd_args, stderr=PIPE) |
256 stderr = process.communicate()[1] |
257 stderr = process.communicate()[1] |
257 if process.returncode: |
258 if process.returncode: |
258 e_msg = _('Failed to create mailboxes: %r\n') % mailboxes |
259 e_msg = _('Failed to create mailboxes: %r\n') % mailboxes |
259 raise VMMError(e_msg + stderr.strip(), VMM_ERROR) |
260 raise VMMError(e_msg + stderr.strip().decode(), VMM_ERROR) |
260 |
261 |
261 def create(self): |
262 def create(self): |
262 """Create a dbox INBOX""" |
263 """Create a dbox INBOX""" |
263 os.mkdir(self._root, cfg_dget('account.directory_mode')) |
264 os.mkdir(self._root, cfg_dget('account.directory_mode')) |
264 os.chown(self._root, self._user.uid, self._user.gid) |
265 os.chown(self._root, self._user.uid, self._user.gid) |