Split parent message resolution into two steps.

This commit is contained in:
Patrick Connolly
2018-12-02 02:22:45 +08:00
parent bb417f19e0
commit 45f9c16e48
2 changed files with 38 additions and 11 deletions
+11
View File
@@ -42,6 +42,17 @@ type Message struct {
Extra map[string][]interface{}
}
func (msg *Message) CanonicalParentMsgID() string {
if msg.Extra != nil && len(msg.Extra["canonical_parent_mid"]) == 1 {
return msg.Extra["canonical_parent_mid"][0].(string)
}
return ""
}
func (msg *Message) IsThreadable() bool {
return msg.CanonicalParentMsgID() != ""
}
type FileInfo struct {
Name string
Data *[]byte