summaryrefslogtreecommitdiff
path: root/src/de.jmhoffmann.jwebmail.mail-storage.varlink
blob: 206c3df0f7e48d67909f65ef35753c44c4f30412 (plain)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
interface de.jmhoffmann.jwebmail.mail-storage


type MIMEHeader (
  mime_type:     (main_type: string, sub_type: string),
  content_dispo: (none, inline, attachment),
  file_name:     ?string
)

type MailAddr (
  name: ?string,
  address: string
)

# send_date is of ISO 8601 date-time format
type MailHeader (
  send_date:    string,
  written_from: []MailAddr,
  sender:       ?MailAddr,
  reply_to:     []MailAddr,
  send_to:      []MailAddr,
  cc:           []MailAddr,
  bcc:          []MailAddr,
  subject:      string,
  comments:     []string,
  keywords:     []string,
  mime:         MIMEHeader
)

type ListMailHeader (
  byte_size: int,
  unread:    bool,
  rec_date:  string,
  mid:       string,
  header:    MailHeader
)

type Multipart (
  preamble: ?string,
  parts:    []MIMEPart,
  epilogue: ?string
)

# exactly one of these fileds must be present
type MailBody (
  discrete:  ?string,
  multipart: ?Multipart,
  mail:      ?Mail
)

type Mail (
  head: MailHeader,
  body: MailBody
)

type MIMEPart (
  mime_header: MIMEHeader,
  body:        MailBody
)

type Sort (
  direction: (asc, desc),
  parameter: (date, size, sender, subject)
)

type Bound (
  param: string,
  id: string
)


method Init(unix_user: string, mailbox_path: string) -> ()

# deprecated: use ListSearch instead
method List(folder: string, start: int, end: int, sort: Sort) -> (mail_heads: []ListMailHeader)

method Stats(folder: string) -> (mail_count: int, unread_count: int, byte_size: int)

method Show(folder: string, mid: string) -> (mail: Mail)

# body is base64 encoded
method Raw(folder: string, mid: string, path: ?string) -> (header: MIMEHeader, body: string)

# deprecated: use ListSearch instead
method Search(folder: string, pattern: string) -> (found: []ListMailHeader)

method Folders() -> (folders: []string)

method Move(mid: string, from_folder: string, to_folder: string) -> ()

method Remove(folder: string, mid: string) -> ()

method AddFolder(name: string) -> (status: (created, skiped))

method ListSearch(
  folder: string,
  bound: ?Bound,
  direction: (after, before),
  limit: int,
  sort: Sort,
  search: ?string
) -> (
  mail_heads: []ListMailHeader,
  first: bool,
  last: bool
)


error NotInitialized()
error InvalidFolder(folder: string)
error InvalidMID(folder: string, mid: string)
error InvalidPathInMail(folder: string, mid: string, path: string)
error InvalidSearchPattern(pattern: string)
error InvalidUser(unix_user: string)
error InvalidMailbox(path: string, not_a_mailbox: bool, user_mismatch: bool)