This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
message.go
97 lines (81 loc) · 2.5 KB
/
message.go
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
86
87
88
89
90
91
92
93
94
95
96
97
package textsecure
import (
"github.com/signal-golang/textsecure/groupsv2"
signalservice "github.com/signal-golang/textsecure/protobuf"
)
// Message represents a message received from the peer.
// It can optionally include attachments and be sent to a group.
type Message struct {
sourceUUID string
source string
message string
attachments []*Attachment
group *Group
groupV2 *groupsv2.GroupV2
flags uint32
expireTimer uint32
profileKey []byte
timestamp uint64
quote *signalservice.DataMessage_Quote
contact []*signalservice.DataMessage_Contact
sticker *signalservice.DataMessage_Sticker
requiredProtocolVersion uint32
isViewOnce bool
reaction *signalservice.DataMessage_Reaction
}
// Source returns the ID of the sender of the message.
func (m *Message) Source() string {
return m.source
}
// SourceUUID returns the UUID of the sender of the message.
func (m *Message) SourceUUID() string {
return m.sourceUUID
}
// ChatID returns the ChatID of the sender of the message.
func (m *Message) ChatID() string {
return m.sourceUUID
}
// Message returns the message body.
func (m *Message) Message() string {
return m.message
}
// Attachments returns the list of attachments on the message.
func (m *Message) Attachments() []*Attachment {
return m.attachments
}
// Group returns group information.
func (m *Message) Group() *Group {
return m.group
}
// GroupV2 returns group information.
func (m *Message) GroupV2() *groupsv2.GroupV2 {
return m.groupV2
}
// Timestamp returns the timestamp of the message
func (m *Message) Timestamp() uint64 {
return m.timestamp
}
// Flags returns the flags in the message
func (m *Message) Flags() uint32 {
return m.flags
}
// ExpireTimer returns the expire timer in the message
func (m *Message) ExpireTimer() uint32 {
return m.expireTimer
}
// Sticker returns the sticker in the message
func (m *Message) Sticker() *signalservice.DataMessage_Sticker {
return m.sticker
}
// Contact returns the contact in the message
func (m *Message) Contact() []*signalservice.DataMessage_Contact {
return m.contact
}
// Quote returns the quote in the message
func (m *Message) Quote() *signalservice.DataMessage_Quote {
return m.quote
}
// Reaction returns the reaction in the message
func (m *Message) Reaction() *signalservice.DataMessage_Reaction {
return m.reaction
}