~dricottone/digestion

ref: ce5b7f835e1ffb0d4aed72bbaf9920a025293312 digestion/message/part.go -rw-r--r-- 580 bytes
ce5b7f83Dominic Ricottone Refactored and refined API 4 years ago
                                                                                
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
package message

import (
	"git.dominic-ricottone.com/digestion/decoder"
)

type MessagePart struct {
	Header             *MessagePartHeader
	Content            []string
}

func NewPart() *MessagePart {
	return &MessagePart{NewPartHeader(), []string{""}}
}

func (m *MessagePart) evaluate_type() int {
	return 0
}

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
	}
}