blob: 89a81bdfea402999e268139129653f3421dce537 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
import offlineimap
import re
prioritized = ['INBOX', 'QueensU.INBOX']
def mycmp(x, y):
if offlineimap.__version__ < '6.4':
return mycmp_oldofflineimap(x, y)
else:
return mycmp_newofflineimap(x, y)
def mycmp_oldofflineimap(x, y):
for prefix in prioritized:
xsw = x.startswith(prefix)
ysw = y.startswith(prefix)
if xsw and ysw:
return cmp(x, y)
elif xsw:
return -1
elif ysw:
return +1
return cmp(x, y)
def mycmp_newofflineimap(x, y):
for prefix in prioritized:
if offlineimap.__version__ < '6.4':
xsw = x.startswith(prefix)
ysw = y.startswith(prefix)
else:
xsw = x.visiblename.startswith(prefix)
ysw = y.visiblename.startswith(prefix)
if xsw and ysw:
return cmp(x, y)
elif xsw:
return -1
elif ysw:
return +1
return cmp(x, y)
|