From a84094b6017f7ac1e6311a608c680594996a5c66 Mon Sep 17 00:00:00 2001
From: zhaoYangguang <1163765691@qq.com>
Date: Tue, 16 Nov 2021 18:03:03 +0800
Subject: [PATCH] fix mention user
---
portal.go | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/portal.go b/portal.go
index 3247d30..b1fd51b 100644
--- a/portal.go
+++ b/portal.go
@@ -2067,15 +2067,15 @@ func (portal *Portal) convertMatrixMessageSkype(sender *User, evt *event.Event)
// mention user message
r := regexp.MustCompile(`(?m)]+\bhref="(.*?)://` + portal.bridge.Config.Homeserver.ServerName + `/#/@([^"]+):(.*?)">(.*?)`)
matches := r.FindAllStringSubmatch(matchStr, -1)
- fmt.Println("matches: ", matches)
+ portal.log.Debugln("matches: ", matches)
if len(matches) > 0 {
for _, match := range matches {
if len(match) > 2 {
skyId := patch.ParseLocalPart(html.UnescapeString(match[2]), false)
- skyId = strings.ReplaceAll(skyId, "skype&", "")
+ skyId = strings.ReplaceAll(skyId, patch.AsUserPrefix, "")
skyId = strings.ReplaceAll(skyId, "-", ":")
// Adapt to the message format sent by the matrix front end
- matchStr = strings.ReplaceAll(matchStr, match[0] + ":", fmt.Sprintf(`%s`, skyId, match[4]))
+ matchStr = strings.ReplaceAll(matchStr, match[0]+":", fmt.Sprintf(`%s`, skyId, match[4]))
matchStr = strings.ReplaceAll(matchStr, match[0], fmt.Sprintf(`%s`, skyId, match[4]))
}
}