format file

This commit is contained in:
zhaoYangguang 2021-11-16 18:02:40 +08:00
parent b8da92fc1b
commit ec4dbf1e07
2 changed files with 58 additions and 72 deletions

View File

@ -2,14 +2,13 @@ package main
import (
"bytes"
"github.com/gabriel-vasile/mimetype"
"maunium.net/go/mautrix/patch"
"encoding/hex"
"encoding/xml"
"fmt"
skype "github.com/kelaresg/go-skypeapi"
skypeExt "github.com/kelaresg/matrix-skype/skype-ext"
"html"
"image"
"image/gif"
@ -24,6 +23,9 @@ import (
"sync"
"time"
skype "github.com/kelaresg/go-skypeapi"
skypeExt "github.com/kelaresg/matrix-skype/skype-ext"
"github.com/pkg/errors"
log "maunium.net/go/maulogger/v2"
"maunium.net/go/mautrix"
@ -1723,13 +1725,7 @@ func (portal *Portal) HandleMediaMessageSkype(source *User, download func(conn *
} else {
content.URL = uploaded.ContentURI.CUString()
}
// portal.SetReplySkype(content, info)
fmt.Println()
fmt.Println("mediaMessage.UrlThumbnail", mediaMessage.UrlThumbnail)
fmt.Println()
fmt.Printf("%+v", mediaMessage)
fmt.Println()
thumbnail, err = skype.Download(mediaMessage.UrlThumbnail, source.Conn.Conn, 0)
if err != nil {
portal.log.Errorfln("Failed to download thumbnail for %s: %v", err)
@ -1756,14 +1752,6 @@ func (portal *Portal) HandleMediaMessageSkype(source *User, download func(conn *
Height: thumbnailCfg.Height,
MimeType: thumbnailMime,
}
fmt.Println("content.Info")
fmt.Printf("%+v", content)
fmt.Println()
fmt.Printf("%+v", *content.Info.ThumbnailInfo)
fmt.Println()
fmt.Println()
fmt.Printf("%+v", content.Info.ThumbnailInfo)
fmt.Println()
}
}
@ -2056,11 +2044,10 @@ func (portal *Portal) convertMatrixMessageSkype(sender *User, evt *event.Event)
if evt.Type == event.EventSticker {
content.MsgType = event.MsgImage
}
fmt.Println("convertMatrixMessage content.MsgType: ", content.MsgType)
fmt.Println("convertMatrixMessage content.Body: ", content.Body)
fmt.Println("convertMatrixMessage content.NewBody: ", content.NewContent)
fmt.Println("convertMatrixMessage content.FormattedBody: ", content.FormattedBody)
portal.log.Debugln("convertMatrixMessage content.MsgType: ", content.MsgType)
portal.log.Debugln("convertMatrixMessage content.Body: ", content.Body)
portal.log.Debugln("convertMatrixMessage content.NewBody: ", content.NewContent)
portal.log.Debugln("convertMatrixMessage content.FormattedBody: ", content.FormattedBody)
info.Type = string(content.MsgType)
switch content.MsgType {
case event.MsgText, event.MsgEmote, event.MsgNotice:
@ -2197,11 +2184,10 @@ func (portal *Portal) sendDeliveryReceipt(eventID id.EventID) {
var timeout = errors.New("message sending timed out")
func (portal *Portal) HandleMatrixMessage(sender *User, evt *event.Event) {
fmt.Println("portal HandleMatrixMessage sender.JID: ", sender.JID)
fmt.Println("portal HandleMatrixMessage portal.Key.Receiver: ", portal.Key.Receiver)
fmt.Println("portal HandleMatrixMessage portal.Key.JID: ", portal.Key.JID)
if !portal.HasRelaybot() && (
(portal.IsPrivateChat() && sender.JID != portal.Key.Receiver) ||
portal.log.Debugln("HandleMatrixMessage sender.JID: ", sender.JID)
portal.log.Debugln("HandleMatrixMessage portal.Key.Receiver: ", portal.Key.Receiver)
portal.log.Debugln("HandleMatrixMessage portal.Key.JID: ", portal.Key.JID)
if !portal.HasRelaybot() && ((portal.IsPrivateChat() && sender.JID != portal.Key.Receiver) ||
portal.sendMatrixConnectionError(sender, evt.ID)) {
return
}