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
package message
import (
"git.dominic-ricottone.com/digestion/decoder"
"git.dominic-ricottone.com/digestion/renderer"
)
type MessagePart struct {
Header *MessagePartHeader
Content []string
}
func NewPart() *MessagePart {
return &MessagePart{NewPartHeader(), []string{""}}
}
func (m *MessagePart) evaluate_type() int {
switch renderer.DetermineFormatting(m.Header.ContentType) {
case renderer.FormattedTextPlain:
return 0
case renderer.FormattedTextHTML:
return 20
default:
return 30
}
}
func (m *MessagePart) evaluate_encoding() int {
switch decoder.DetermineEncoding(m.Header.ContentEncoding) {
case decoder.EncodedUTF8:
return 0
case decoder.EncodedBase64:
return 1
case decoder.EncodedQuotedPrintable:
return 1
default:
return 10
}
}