Revert last commit, re: normalizeID.
This commit is contained in:
@@ -66,7 +66,7 @@ func (gw *Gateway) FindCanonicalMsgID(protocol string, mID string) string {
|
|||||||
v, _ := gw.Messages.Peek(mid)
|
v, _ := gw.Messages.Peek(mid)
|
||||||
ids := v.([]*BrMsgID)
|
ids := v.([]*BrMsgID)
|
||||||
for _, downstreamMsgObj := range ids {
|
for _, downstreamMsgObj := range ids {
|
||||||
if normalizeID(ID) == normalizeID(downstreamMsgObj.ID) {
|
if ID == downstreamMsgObj.ID {
|
||||||
return strings.Replace(mid.(string), protocol+" ", "", 1)
|
return strings.Replace(mid.(string), protocol+" ", "", 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -74,18 +74,6 @@ func (gw *Gateway) FindCanonicalMsgID(protocol string, mID string) string {
|
|||||||
return ""
|
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 {
|
func (gw *Gateway) AddBridge(cfg *config.Bridge) error {
|
||||||
br := gw.Router.getBridge(cfg.Account)
|
br := gw.Router.getBridge(cfg.Account)
|
||||||
if br == nil {
|
if br == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user