Revert last commit, re: normalizeID.

This commit is contained in:
Patrick Connolly
2018-12-01 18:06:42 +08:00
parent 18618ec487
commit 242c2b2ea7

View File

@@ -66,7 +66,7 @@ func (gw *Gateway) FindCanonicalMsgID(protocol string, mID string) string {
v, _ := gw.Messages.Peek(mid)
ids := v.([]*BrMsgID)
for _, downstreamMsgObj := range ids {
if normalizeID(ID) == normalizeID(downstreamMsgObj.ID) {
if ID == downstreamMsgObj.ID {
return strings.Replace(mid.(string), protocol+" ", "", 1)
}
}
@@ -74,18 +74,6 @@ func (gw *Gateway) FindCanonicalMsgID(protocol string, mID string) string {
return ""
}
// Allows matches independant of protocol,
// eg: slack vs slack-legacy
func normalizeID(id string) string {
fields := strings.Fields(id)
if len(fields) != 2 {
return id
}
protocol, mID := fields[0], fields[1]
baseProtocol := strings.Split(protocol, "-")[0]
return baseProtocol+" "+mID
}
func (gw *Gateway) AddBridge(cfg *config.Bridge) error {
br := gw.Router.getBridge(cfg.Account)
if br == nil {