summaryrefslogtreecommitdiff
path: root/offlineimap/extras.py
blob: e373c1d015e240ae66dab1e067a3de856ab72ad0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Useful features for offlineimap


prioritylist = [ "INBOX" ]

def prioritycmp(x, y):
    for prefix in prioritylist:
        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)


import subprocess

def get_password(server):
    return subprocess.check_output(["pass", server]).strip().split("\n")[0].strip()