1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00

proper flash pic support

This commit is contained in:
wfjsw 2020-11-09 00:37:48 +08:00
parent ca72d542ca
commit a84b524889
3 changed files with 34 additions and 17 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
.idea
vendor/

View File

@ -2,10 +2,11 @@ package message
import (
"fmt"
"github.com/Mrs4s/MiraiGo/binary"
"github.com/Mrs4s/MiraiGo/client/pb/msg"
"strconv"
"strings"
"github.com/Mrs4s/MiraiGo/binary"
"github.com/Mrs4s/MiraiGo/client/pb/msg"
)
type TextElement struct {
@ -112,6 +113,12 @@ type RedBagElement struct {
Title string
}
// TODO: 总之就是非常傻逼
type GroupFlashImgElement struct {
ImageElement
}
type GroupFlashPicElement struct {
GroupImageElement
}
@ -121,6 +128,10 @@ type GroupShowPicElement struct {
EffectId int32
}
type FriendFlashImgElement struct {
ImageElement
}
type FriendFlashPicElement struct {
FriendImageElement
}

View File

@ -2,16 +2,17 @@ package message
import (
"crypto/md5"
"github.com/Mrs4s/MiraiGo/binary"
"github.com/Mrs4s/MiraiGo/client/pb/msg"
"github.com/Mrs4s/MiraiGo/utils"
"github.com/golang/protobuf/proto"
"github.com/tidwall/gjson"
"math"
"reflect"
"regexp"
"strconv"
"strings"
"github.com/Mrs4s/MiraiGo/binary"
"github.com/Mrs4s/MiraiGo/client/pb/msg"
"github.com/Mrs4s/MiraiGo/utils"
"github.com/golang/protobuf/proto"
"github.com/tidwall/gjson"
)
type (
@ -480,19 +481,23 @@ func ParseMessageElems(elems []*msg.Elem) []IMessageElement {
flash := &msg.MsgElemInfoServtype3{}
_ = proto.Unmarshal(elem.CommonElem.PbElem, flash)
if flash.FlashTroopPic != nil {
res = append(res, &ImageElement{
Filename: flash.FlashTroopPic.FilePath,
Size: flash.FlashTroopPic.Size,
Width: flash.FlashTroopPic.Width,
Height: flash.FlashTroopPic.Height,
Md5: flash.FlashTroopPic.Md5,
res = append(res, &GroupFlashImgElement{
ImageElement{
Filename: flash.FlashTroopPic.FilePath,
Size: flash.FlashTroopPic.Size,
Width: flash.FlashTroopPic.Width,
Height: flash.FlashTroopPic.Height,
Md5: flash.FlashTroopPic.Md5,
},
})
}
if flash.FlashC2CPic != nil {
res = append(res, &ImageElement{
Filename: flash.FlashC2CPic.FilePath,
Size: flash.FlashC2CPic.FileLen,
Md5: flash.FlashC2CPic.PicMd5,
res = append(res, &GroupFlashImgElement{
ImageElement{
Filename: flash.FlashC2CPic.FilePath,
Size: flash.FlashC2CPic.FileLen,
Md5: flash.FlashC2CPic.PicMd5,
},
})
}
}