This repository has been archived by the owner on Oct 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathdemo.rascal
82 lines (67 loc) · 1.64 KB
/
demo.rascal
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#
# Used by me to development purposes.
#
MainConf = {
# The number of concurrent workers for the accounts. Default is the number
# of accounts to sync.
'max_sync_accounts': 7,
}
def configure(ui):
pass
from imapfw.api import controllers, types, drivers, shells
#
# Global variables.
#
maildirsPath = "~/.imapfw/Mail"
#
# Controllers.
#
class FakeMaildir(controllers.FakeDriver):
conf = controllers.FakeDriver.MaildirConf
import time, random
class FakeImap(controllers.FakeDriver):
conf = controllers.FakeDriver.ImapConf
def select(self, *args, **kwargs):
time.sleep(random.randint(1, 30) / 5)
return super(FakeImap, self).select(*args, **kwargs)
#
# Repositories.
#
MaildirConfA = {
'path': maildirsPath + '/MaildirA',
'max_connections': 9,
}
class MaildirA(types.Maildir):
conf = MaildirConfA
driver = drivers.Maildir # Default: drivers.Maildir.
controllers = [FakeMaildir]
MaildirConfB = {
'path': maildirsPath + '/MaildirB',
'max_connections': 2,
}
class MaildirB(types.Maildir):
conf = MaildirConfB
driver = drivers.Maildir # Default: drivers.Maildir.
controllers = [FakeMaildir]
ImapConfA = {
'backend': 'imaplib3',
'host': '127.0.0.1',
'port': '10143',
'username': 'nicolas',
'password': 'sebrecht',
'max_connections': 3,
}
class ImapA(types.Imap):
conf = ImapConfA
driver = drivers.Imap # Default: drivers.Imap.
controllers = [FakeImap]
#
# Accounts.
#
class Home(types.Account):
left = MaildirA
right = ImapA
class Foundation(types.Account):
left = MaildirB
right = ImapA
# vim: syntax=python ts=4 expandtab :