optimize forward message and details
This commit is contained in:
parent
eb8e1cb660
commit
7b6370532e
|
@ -136,8 +136,12 @@ func (formatter *Formatter) ParseSkype(content *event.MessageEventContent, RoomM
|
||||||
if portal.Key.JID != match[4] {
|
if portal.Key.JID != match[4] {
|
||||||
content.FormattedBody = match[6]
|
content.FormattedBody = match[6]
|
||||||
content.Body = fmt.Sprintf("%s\n\n", match[6])
|
content.Body = fmt.Sprintf("%s\n\n", match[6])
|
||||||
|
|
||||||
|
// this means that there are forwarding messages across groups
|
||||||
|
if strings.HasSuffix(match[4], skypeExt.GroupSuffix) || strings.HasSuffix(portal.Key.JID, skypeExt.GroupSuffix){
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
}
|
||||||
msgMXID := ""
|
msgMXID := ""
|
||||||
msg := formatter.bridge.DB.Message.GetByID(match[5])
|
msg := formatter.bridge.DB.Message.GetByID(match[5])
|
||||||
if msg != nil {
|
if msg != nil {
|
||||||
|
|
|
@ -366,7 +366,7 @@ func (mx *MatrixHandler) shouldIgnoreEvent(evt *event.Event) bool {
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
isCustomPuppet, ok := evt.Content.Raw["net.maunium.whatsapp.puppet"].(bool)
|
isCustomPuppet, ok := evt.Content.Raw["net.maunium.skype.puppet"].(bool)
|
||||||
if ok && isCustomPuppet && mx.bridge.GetPuppetByCustomMXID(evt.Sender) != nil {
|
if ok && isCustomPuppet && mx.bridge.GetPuppetByCustomMXID(evt.Sender) != nil {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -1419,7 +1419,7 @@ func (portal *Portal) sendMessage(intent *appservice.IntentAPI, eventType event.
|
||||||
wrappedContent := event.Content{Parsed: content}
|
wrappedContent := event.Content{Parsed: content}
|
||||||
if timestamp != 0 && intent.IsCustomPuppet {
|
if timestamp != 0 && intent.IsCustomPuppet {
|
||||||
wrappedContent.Raw = map[string]interface{}{
|
wrappedContent.Raw = map[string]interface{}{
|
||||||
"net.maunium.whatsapp.puppet": intent.IsCustomPuppet,
|
"net.maunium.skype.puppet": intent.IsCustomPuppet,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt.Println("portal sendMessage timestamp:", timestamp)
|
fmt.Println("portal sendMessage timestamp:", timestamp)
|
||||||
|
@ -1477,17 +1477,14 @@ func (portal *Portal) HandleTextMessage(source *User, message skype.Resource) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// portal.SetReplySkype(content, message)
|
// portal.SetReplySkype(content, message)
|
||||||
|
fmt.Printf("\nportal HandleTextMessage2: %+v", content)
|
||||||
fmt.Println()
|
|
||||||
fmt.Printf("portal HandleTextMessage2: %+v", content)
|
|
||||||
_, _ = intent.UserTyping(portal.MXID, false, 0)
|
_, _ = intent.UserTyping(portal.MXID, false, 0)
|
||||||
resp, err := portal.sendMessage(intent, event.EventMessage, content, message.Timestamp * 1000)
|
resp, err := portal.sendMessage(intent, event.EventMessage, content, message.Timestamp * 1000)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
portal.log.Errorfln("Failed to handle message %s: %v", message.Id, err)
|
portal.log.Errorfln("Failed to handle message %s: %v", message.Id, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fmt.Println()
|
fmt.Printf("\nportal HandleTextMessage3: %+v", content)
|
||||||
fmt.Printf("portal HandleTextMessage3: %+v", content)
|
|
||||||
portal.finishHandlingSkype(source, &message, resp.EventID)
|
portal.finishHandlingSkype(source, &message, resp.EventID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue