summaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
Diffstat (limited to 'bridge')
-rw-r--r--bridge/slack/handlers.go2
-rw-r--r--bridge/slack/helpers.go5
-rw-r--r--bridge/slack/slack.go14
3 files changed, 8 insertions, 13 deletions
diff --git a/bridge/slack/handlers.go b/bridge/slack/handlers.go
index d4e5e464..a3291c38 100644
--- a/bridge/slack/handlers.go
+++ b/bridge/slack/handlers.go
@@ -205,7 +205,7 @@ func (b *Bslack) handleStatusEvent(ev *slack.MessageEvent, rmsg *config.Message)
case sMessageDeleted:
rmsg.Text = config.EventMsgDelete
rmsg.Event = config.EventMsgDelete
- rmsg.ID = "slack " + ev.DeletedTimestamp
+ rmsg.ID = ev.DeletedTimestamp
// If a message is being deleted we do not need to process
// the event any further so we return 'true'.
return true
diff --git a/bridge/slack/helpers.go b/bridge/slack/helpers.go
index 861a8758..b0fdaba1 100644
--- a/bridge/slack/helpers.go
+++ b/bridge/slack/helpers.go
@@ -173,9 +173,10 @@ func (b *Bslack) populateReceivedMessage(ev *slack.MessageEvent) (*config.Messag
Text: ev.Text,
Channel: channel.Name,
Account: b.Account,
- ID: "slack " + ev.Timestamp,
+ ID: ev.Timestamp,
Extra: make(map[string][]interface{}),
ParentID: ev.ThreadTimestamp,
+ Protocol: b.Protocol,
}
if b.useChannelID {
rmsg.Channel = "ID:" + channel.ID
@@ -183,7 +184,7 @@ func (b *Bslack) populateReceivedMessage(ev *slack.MessageEvent) (*config.Messag
// Handle 'edit' messages.
if ev.SubMessage != nil && !b.GetBool(editDisableConfig) {
- rmsg.ID = "slack " + ev.SubMessage.Timestamp
+ rmsg.ID = ev.SubMessage.Timestamp
if ev.SubMessage.ThreadTimestamp != ev.SubMessage.Timestamp {
b.Log.Debugf("SubMessage %#v", ev.SubMessage)
rmsg.Text = ev.SubMessage.Text + b.GetString(editSuffixConfig)
diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go
index c4689cbc..0951fb10 100644
--- a/bridge/slack/slack.go
+++ b/bridge/slack/slack.go
@@ -324,10 +324,8 @@ func (b *Bslack) deleteMessage(msg *config.Message, channelInfo *slack.Channel)
return true, nil
}
- // If we get a "slack <ID>", split it.
- ts := strings.Fields(msg.ID)
for {
- _, _, err := b.rtm.DeleteMessage(channelInfo.ID, ts[1])
+ _, _, err := b.rtm.DeleteMessage(channelInfo.ID, msg.ID)
if err == nil {
return true, nil
}
@@ -344,9 +342,8 @@ func (b *Bslack) editMessage(msg *config.Message, channelInfo *slack.Channel) (b
return false, nil
}
- ts := strings.Fields(msg.ID)
for {
- _, _, _, err := b.rtm.UpdateMessage(channelInfo.ID, ts[1], msg.Text)
+ _, _, _, err := b.rtm.UpdateMessage(channelInfo.ID, msg.ID, msg.Text)
if err == nil {
return true, nil
}
@@ -362,7 +359,7 @@ func (b *Bslack) postMessage(msg *config.Message, messageParameters *slack.PostM
for {
_, id, err := b.rtm.PostMessage(channelInfo.ID, msg.Text, *messageParameters)
if err == nil {
- return "slack " + id, nil
+ return id, nil
}
if err = b.handleRateLimit(err); err != nil {
@@ -413,10 +410,7 @@ func (b *Bslack) prepareMessageParameters(msg *config.Message) *slack.PostMessag
params.Username = msg.Username
params.LinkNames = 1 // replace mentions
params.IconURL = config.GetIconURL(msg, b.GetString(iconURLConfig))
- msgFields := strings.Fields(msg.ParentID)
- if len(msgFields) >= 2 {
- params.ThreadTimestamp = msgFields[1]
- }
+ params.ThreadTimestamp = msg.ParentID
if msg.Avatar != "" {
params.IconURL = msg.Avatar
}