~dricottone/digestion

digestion/message/message.go -rw-r--r-- 541 bytes
db7d0c4dDominic Ricottone Adding parcels 2 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
package message

type Message struct {
	Header       *MessageHeader
	Parts        []*MessagePart
}

func NewMessage() *Message {
	return &Message{NewHeader(), []*MessagePart{NewPart()}}
}

func (m *Message) SetHeader(s string) {
	m.Header.SetHeader(s)
}

func (m *Message) SetPartHeader(s string) {
	m.Parts[len(m.Parts)-1].Header.SetHeader(s)
}

func (m *Message) AppendPart() {
	m.Parts = append(m.Parts, NewPart())
}

func (m *Message) AppendContent(s string) {
	i := len(m.Parts)-1
	m.Parts[i].Content = append(m.Parts[i].Content, s)
}