summaryrefslogtreecommitdiff
path: root/src/jwebmail/model/de.jmhoffmann.jwebmail.mail-storage.varlink
blob: 64a4073c6c7bbbcdd1684bdb2e110745b66f46a4 (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
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)
)


method Init(unix_user: string, mailbox_path: string) -> ()
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)
method Raw(folder: string, mid: string, path: ?string) -> (header: MIMEHeader, body: string)  # body is base64 encoded
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))


error NotIninitialized()
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)