summaryrefslogtreecommitdiffstats
path: root/matterclient/messages.go
diff options
context:
space:
mode:
authorPatrick Connolly <patrick.c.connolly@gmail.com>2019-01-09 15:50:03 -0500
committerWim <wim@42.be>2019-01-09 21:50:03 +0100
commitb33b50987b89676a5fb71476639d488e051315d8 (patch)
tree44e57e49a9fc7d37b4ca99e8b889e1db041725bc /matterclient/messages.go
parent5193634a5210857e1fe49fc1c2d4297912794935 (diff)
downloadmatterbridge-msglm-b33b50987b89676a5fb71476639d488e051315d8.tar.gz
matterbridge-msglm-b33b50987b89676a5fb71476639d488e051315d8.tar.bz2
matterbridge-msglm-b33b50987b89676a5fb71476639d488e051315d8.zip
Add support for mattermost threading (#627)
Diffstat (limited to 'matterclient/messages.go')
-rw-r--r--matterclient/messages.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/matterclient/messages.go b/matterclient/messages.go
index 985cfe04..c2325c09 100644
--- a/matterclient/messages.go
+++ b/matterclient/messages.go
@@ -146,8 +146,8 @@ func (m *MMClient) GetPublicLinks(filenames []string) []string {
return output
}
-func (m *MMClient) PostMessage(channelId string, text string) (string, error) { //nolint:golint
- post := &model.Post{ChannelId: channelId, Message: text}
+func (m *MMClient) PostMessage(channelId string, text string, rootId string) (string, error) { //nolint:golint
+ post := &model.Post{ChannelId: channelId, Message: text, RootId: rootId}
res, resp := m.Client.CreatePost(post)
if resp.Error != nil {
return "", resp.Error
@@ -155,8 +155,8 @@ func (m *MMClient) PostMessage(channelId string, text string) (string, error) {
return res.Id, nil
}
-func (m *MMClient) PostMessageWithFiles(channelId string, text string, fileIds []string) (string, error) { //nolint:golint
- post := &model.Post{ChannelId: channelId, Message: text, FileIds: fileIds}
+func (m *MMClient) PostMessageWithFiles(channelId string, text string, rootId string, fileIds []string) (string, error) { //nolint:golint
+ post := &model.Post{ChannelId: channelId, Message: text, RootId: rootId, FileIds: fileIds}
res, resp := m.Client.CreatePost(post)
if resp.Error != nil {
return "", resp.Error
@@ -173,11 +173,11 @@ func (m *MMClient) SearchPosts(query string) *model.PostList {
}
// SendDirectMessage sends a direct message to specified user
-func (m *MMClient) SendDirectMessage(toUserId string, msg string) { //nolint:golint
- m.SendDirectMessageProps(toUserId, msg, nil)
+func (m *MMClient) SendDirectMessage(toUserId string, msg string, rootId string) { //nolint:golint
+ m.SendDirectMessageProps(toUserId, msg, rootId, nil)
}
-func (m *MMClient) SendDirectMessageProps(toUserId string, msg string, props map[string]interface{}) { //nolint:golint
+func (m *MMClient) SendDirectMessageProps(toUserId string, msg string, rootId string, props map[string]interface{}) { //nolint:golint
m.log.Debugf("SendDirectMessage to %s, msg %s", toUserId, msg)
// create DM channel (only happens on first message)
_, resp := m.Client.CreateDirectChannel(m.User.Id, toUserId)
@@ -194,7 +194,7 @@ func (m *MMClient) SendDirectMessageProps(toUserId string, msg string, props map
// build & send the message
msg = strings.Replace(msg, "\r", "", -1)
- post := &model.Post{ChannelId: m.GetChannelId(channelName, m.Team.Id), Message: msg, Props: props}
+ post := &model.Post{ChannelId: m.GetChannelId(channelName, m.Team.Id), Message: msg, RootId: rootId, Props: props}
m.Client.CreatePost(post)
}