~dricottone/digestion

ref: 4ee014a14f1f8605e585d22fc78ba17d366a7362 digestion/message/message.go -rw-r--r-- 541 bytes
4ee014a1Dominic Ricottone Golang version bump 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)
}