format file
This commit is contained in:
parent
b8da92fc1b
commit
ec4dbf1e07
38
portal.go
38
portal.go
|
@ -2,14 +2,13 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
||||||
"github.com/gabriel-vasile/mimetype"
|
"github.com/gabriel-vasile/mimetype"
|
||||||
"maunium.net/go/mautrix/patch"
|
"maunium.net/go/mautrix/patch"
|
||||||
|
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"fmt"
|
"fmt"
|
||||||
skype "github.com/kelaresg/go-skypeapi"
|
|
||||||
skypeExt "github.com/kelaresg/matrix-skype/skype-ext"
|
|
||||||
"html"
|
"html"
|
||||||
"image"
|
"image"
|
||||||
"image/gif"
|
"image/gif"
|
||||||
|
@ -24,6 +23,9 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
skype "github.com/kelaresg/go-skypeapi"
|
||||||
|
skypeExt "github.com/kelaresg/matrix-skype/skype-ext"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
log "maunium.net/go/maulogger/v2"
|
log "maunium.net/go/maulogger/v2"
|
||||||
"maunium.net/go/mautrix"
|
"maunium.net/go/mautrix"
|
||||||
|
@ -1723,13 +1725,7 @@ func (portal *Portal) HandleMediaMessageSkype(source *User, download func(conn *
|
||||||
} else {
|
} else {
|
||||||
content.URL = uploaded.ContentURI.CUString()
|
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)
|
thumbnail, err = skype.Download(mediaMessage.UrlThumbnail, source.Conn.Conn, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
portal.log.Errorfln("Failed to download thumbnail for %s: %v", err)
|
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,
|
Height: thumbnailCfg.Height,
|
||||||
MimeType: thumbnailMime,
|
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 {
|
if evt.Type == event.EventSticker {
|
||||||
content.MsgType = event.MsgImage
|
content.MsgType = event.MsgImage
|
||||||
}
|
}
|
||||||
|
portal.log.Debugln("convertMatrixMessage content.MsgType: ", content.MsgType)
|
||||||
fmt.Println("convertMatrixMessage content.MsgType: ", content.MsgType)
|
portal.log.Debugln("convertMatrixMessage content.Body: ", content.Body)
|
||||||
fmt.Println("convertMatrixMessage content.Body: ", content.Body)
|
portal.log.Debugln("convertMatrixMessage content.NewBody: ", content.NewContent)
|
||||||
fmt.Println("convertMatrixMessage content.NewBody: ", content.NewContent)
|
portal.log.Debugln("convertMatrixMessage content.FormattedBody: ", content.FormattedBody)
|
||||||
fmt.Println("convertMatrixMessage content.FormattedBody: ", content.FormattedBody)
|
|
||||||
info.Type = string(content.MsgType)
|
info.Type = string(content.MsgType)
|
||||||
switch content.MsgType {
|
switch content.MsgType {
|
||||||
case event.MsgText, event.MsgEmote, event.MsgNotice:
|
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")
|
var timeout = errors.New("message sending timed out")
|
||||||
|
|
||||||
func (portal *Portal) HandleMatrixMessage(sender *User, evt *event.Event) {
|
func (portal *Portal) HandleMatrixMessage(sender *User, evt *event.Event) {
|
||||||
fmt.Println("portal HandleMatrixMessage sender.JID: ", sender.JID)
|
portal.log.Debugln("HandleMatrixMessage sender.JID: ", sender.JID)
|
||||||
fmt.Println("portal HandleMatrixMessage portal.Key.Receiver: ", portal.Key.Receiver)
|
portal.log.Debugln("HandleMatrixMessage portal.Key.Receiver: ", portal.Key.Receiver)
|
||||||
fmt.Println("portal HandleMatrixMessage portal.Key.JID: ", portal.Key.JID)
|
portal.log.Debugln("HandleMatrixMessage portal.Key.JID: ", portal.Key.JID)
|
||||||
if !portal.HasRelaybot() && (
|
if !portal.HasRelaybot() && ((portal.IsPrivateChat() && sender.JID != portal.Key.Receiver) ||
|
||||||
(portal.IsPrivateChat() && sender.JID != portal.Key.Receiver) ||
|
|
||||||
portal.sendMatrixConnectionError(sender, evt.ID)) {
|
portal.sendMatrixConnectionError(sender, evt.ID)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue