mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
fix rich group card.
This commit is contained in:
parent
a21576d299
commit
6fc1377e87
@ -80,6 +80,14 @@ func decodeLoginResponse(c *QQClient, _ uint16, payload []byte) (interface{}, er
|
||||
}
|
||||
} // need captcha
|
||||
|
||||
if t == 40 {
|
||||
return LoginResponse{
|
||||
Success: false,
|
||||
ErrorMessage: "账号被冻结",
|
||||
Error: UnknownLoginError,
|
||||
}, nil
|
||||
}
|
||||
|
||||
if t == 160 {
|
||||
|
||||
if t174, ok := m[0x174]; ok { // 短信验证
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"github.com/Mrs4s/MiraiGo/binary"
|
||||
devinfo "github.com/Mrs4s/MiraiGo/client/pb"
|
||||
"github.com/Mrs4s/MiraiGo/client/pb/msg"
|
||||
"github.com/Mrs4s/MiraiGo/client/pb/oidb"
|
||||
"github.com/Mrs4s/MiraiGo/message"
|
||||
"github.com/Mrs4s/MiraiGo/utils"
|
||||
"google.golang.org/protobuf/proto"
|
||||
@ -367,21 +368,6 @@ func (c *QQClient) parseGroupMessage(m *msg.Message) *message.GroupMessage {
|
||||
Member: info,
|
||||
})
|
||||
}
|
||||
if m.Head.GroupInfo != nil && m.Head.GroupInfo.GroupCard != "" && mem.CardName != m.Head.GroupInfo.GroupCard {
|
||||
old := mem.CardName
|
||||
if mem.Nickname == m.Head.GroupInfo.GroupCard {
|
||||
mem.CardName = ""
|
||||
} else {
|
||||
mem.CardName = m.Head.GroupInfo.GroupCard
|
||||
}
|
||||
if old != mem.CardName {
|
||||
go c.dispatchMemberCardUpdatedEvent(&MemberCardUpdatedEvent{
|
||||
Group: group,
|
||||
OldCard: old,
|
||||
Member: mem,
|
||||
})
|
||||
}
|
||||
}
|
||||
sender = &message.Sender{
|
||||
Uin: mem.Uin,
|
||||
Nickname: mem.Nickname,
|
||||
@ -398,6 +384,7 @@ func (c *QQClient) parseGroupMessage(m *msg.Message) *message.GroupMessage {
|
||||
Time: m.Head.MsgTime,
|
||||
Elements: message.ParseMessageElems(m.Body.RichText.Elems),
|
||||
}
|
||||
var extInfo *msg.ExtraInfo
|
||||
// pre parse
|
||||
for _, elem := range m.Body.RichText.Elems {
|
||||
// is rich long msg
|
||||
@ -413,6 +400,37 @@ func (c *QQClient) parseGroupMessage(m *msg.Message) *message.GroupMessage {
|
||||
}
|
||||
}
|
||||
}
|
||||
if elem.ExtraInfo != nil {
|
||||
extInfo = elem.ExtraInfo
|
||||
}
|
||||
}
|
||||
if !sender.IsAnonymous() {
|
||||
mem := group.FindMember(m.Head.FromUin)
|
||||
groupCard := m.Head.GroupInfo.GroupCard
|
||||
if extInfo != nil && len(extInfo.GroupCard) > 0 && extInfo.GroupCard[0] == 0x0A {
|
||||
buf := oidb.D8FCCommCardNameBuf{}
|
||||
if err := proto.Unmarshal(extInfo.GroupCard, &buf); err == nil && len(buf.RichCardName) > 0 {
|
||||
groupCard = ""
|
||||
for _, e := range buf.RichCardName {
|
||||
groupCard += string(e.Text)
|
||||
}
|
||||
}
|
||||
}
|
||||
if m.Head.GroupInfo != nil && groupCard != "" && mem.CardName != groupCard {
|
||||
old := mem.CardName
|
||||
if mem.Nickname == groupCard {
|
||||
mem.CardName = ""
|
||||
} else {
|
||||
mem.CardName = groupCard
|
||||
}
|
||||
if old != mem.CardName {
|
||||
go c.dispatchMemberCardUpdatedEvent(&MemberCardUpdatedEvent{
|
||||
Group: group,
|
||||
OldCard: old,
|
||||
Member: mem,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
if m.Body.RichText.Ptt != nil {
|
||||
g.Elements = []message.IMessageElement{
|
||||
|
@ -476,6 +476,108 @@ func (x *D8FCClientInfo) GetIngClientver() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
type D8FCCommCardNameBuf struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
RichCardName []*D8FCRichCardNameElem `protobuf:"bytes,1,rep,name=richCardName" json:"richCardName,omitempty"`
|
||||
}
|
||||
|
||||
func (x *D8FCCommCardNameBuf) Reset() {
|
||||
*x = D8FCCommCardNameBuf{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_oidb0x8fc_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *D8FCCommCardNameBuf) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*D8FCCommCardNameBuf) ProtoMessage() {}
|
||||
|
||||
func (x *D8FCCommCardNameBuf) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_oidb0x8fc_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use D8FCCommCardNameBuf.ProtoReflect.Descriptor instead.
|
||||
func (*D8FCCommCardNameBuf) Descriptor() ([]byte, []int) {
|
||||
return file_oidb0x8fc_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *D8FCCommCardNameBuf) GetRichCardName() []*D8FCRichCardNameElem {
|
||||
if x != nil {
|
||||
return x.RichCardName
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type D8FCRichCardNameElem struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Ctrl []byte `protobuf:"bytes,1,opt,name=ctrl" json:"ctrl,omitempty"`
|
||||
Text []byte `protobuf:"bytes,2,opt,name=text" json:"text,omitempty"`
|
||||
}
|
||||
|
||||
func (x *D8FCRichCardNameElem) Reset() {
|
||||
*x = D8FCRichCardNameElem{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_oidb0x8fc_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *D8FCRichCardNameElem) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*D8FCRichCardNameElem) ProtoMessage() {}
|
||||
|
||||
func (x *D8FCRichCardNameElem) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_oidb0x8fc_proto_msgTypes[6]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use D8FCRichCardNameElem.ProtoReflect.Descriptor instead.
|
||||
func (*D8FCRichCardNameElem) Descriptor() ([]byte, []int) {
|
||||
return file_oidb0x8fc_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *D8FCRichCardNameElem) GetCtrl() []byte {
|
||||
if x != nil {
|
||||
return x.Ctrl
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *D8FCRichCardNameElem) GetText() []byte {
|
||||
if x != nil {
|
||||
return x.Text
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_oidb0x8fc_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_oidb0x8fc_proto_rawDesc = []byte{
|
||||
@ -549,8 +651,17 @@ var file_oidb0x8fc_proto_rawDesc = []byte{
|
||||
0x12, 0x16, 0x0a, 0x06, 0x69, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x06, 0x69, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x67, 0x43,
|
||||
0x6c, 0x69, 0x65, 0x6e, 0x74, 0x76, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c,
|
||||
0x69, 0x6e, 0x67, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x76, 0x65, 0x72, 0x42, 0x08, 0x5a, 0x06,
|
||||
0x2e, 0x3b, 0x6f, 0x69, 0x64, 0x62,
|
||||
0x69, 0x6e, 0x67, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x76, 0x65, 0x72, 0x22, 0x50, 0x0a, 0x13,
|
||||
0x44, 0x38, 0x46, 0x43, 0x43, 0x6f, 0x6d, 0x6d, 0x43, 0x61, 0x72, 0x64, 0x4e, 0x61, 0x6d, 0x65,
|
||||
0x42, 0x75, 0x66, 0x12, 0x39, 0x0a, 0x0c, 0x72, 0x69, 0x63, 0x68, 0x43, 0x61, 0x72, 0x64, 0x4e,
|
||||
0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x44, 0x38, 0x46, 0x43,
|
||||
0x52, 0x69, 0x63, 0x68, 0x43, 0x61, 0x72, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x45, 0x6c, 0x65, 0x6d,
|
||||
0x52, 0x0c, 0x72, 0x69, 0x63, 0x68, 0x43, 0x61, 0x72, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x3e,
|
||||
0x0a, 0x14, 0x44, 0x38, 0x46, 0x43, 0x52, 0x69, 0x63, 0x68, 0x43, 0x61, 0x72, 0x64, 0x4e, 0x61,
|
||||
0x6d, 0x65, 0x45, 0x6c, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x74, 0x72, 0x6c, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x63, 0x74, 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65,
|
||||
0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x42, 0x08,
|
||||
0x5a, 0x06, 0x2e, 0x3b, 0x6f, 0x69, 0x64, 0x62,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -565,24 +676,27 @@ func file_oidb0x8fc_proto_rawDescGZIP() []byte {
|
||||
return file_oidb0x8fc_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_oidb0x8fc_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
||||
var file_oidb0x8fc_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
|
||||
var file_oidb0x8fc_proto_goTypes = []interface{}{
|
||||
(*D8FCReqBody)(nil), // 0: D8FCReqBody
|
||||
(*D8FCMemberInfo)(nil), // 1: D8FCMemberInfo
|
||||
(*D8FCCardNameElem)(nil), // 2: D8FCCardNameElem
|
||||
(*D8FCLevelName)(nil), // 3: D8FCLevelName
|
||||
(*D8FCClientInfo)(nil), // 4: D8FCClientInfo
|
||||
(*D8FCReqBody)(nil), // 0: D8FCReqBody
|
||||
(*D8FCMemberInfo)(nil), // 1: D8FCMemberInfo
|
||||
(*D8FCCardNameElem)(nil), // 2: D8FCCardNameElem
|
||||
(*D8FCLevelName)(nil), // 3: D8FCLevelName
|
||||
(*D8FCClientInfo)(nil), // 4: D8FCClientInfo
|
||||
(*D8FCCommCardNameBuf)(nil), // 5: D8FCCommCardNameBuf
|
||||
(*D8FCRichCardNameElem)(nil), // 6: D8FCRichCardNameElem
|
||||
}
|
||||
var file_oidb0x8fc_proto_depIdxs = []int32{
|
||||
1, // 0: D8FCReqBody.memLevelInfo:type_name -> D8FCMemberInfo
|
||||
3, // 1: D8FCReqBody.levelName:type_name -> D8FCLevelName
|
||||
4, // 2: D8FCReqBody.msgClientInfo:type_name -> D8FCClientInfo
|
||||
2, // 3: D8FCMemberInfo.richCardName:type_name -> D8FCCardNameElem
|
||||
4, // [4:4] is the sub-list for method output_type
|
||||
4, // [4:4] is the sub-list for method input_type
|
||||
4, // [4:4] is the sub-list for extension type_name
|
||||
4, // [4:4] is the sub-list for extension extendee
|
||||
0, // [0:4] is the sub-list for field type_name
|
||||
6, // 4: D8FCCommCardNameBuf.richCardName:type_name -> D8FCRichCardNameElem
|
||||
5, // [5:5] is the sub-list for method output_type
|
||||
5, // [5:5] is the sub-list for method input_type
|
||||
5, // [5:5] is the sub-list for extension type_name
|
||||
5, // [5:5] is the sub-list for extension extendee
|
||||
0, // [0:5] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_oidb0x8fc_proto_init() }
|
||||
@ -651,6 +765,30 @@ func file_oidb0x8fc_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_oidb0x8fc_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*D8FCCommCardNameBuf); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_oidb0x8fc_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*D8FCRichCardNameElem); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
@ -658,7 +796,7 @@ func file_oidb0x8fc_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_oidb0x8fc_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 5,
|
||||
NumMessages: 7,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
@ -47,4 +47,13 @@ message D8FCLevelName {
|
||||
message D8FCClientInfo {
|
||||
optional int32 implat = 1;
|
||||
optional string ingClientver = 2;
|
||||
}
|
||||
|
||||
message D8FCCommCardNameBuf {
|
||||
repeated D8FCRichCardNameElem richCardName = 1;
|
||||
}
|
||||
|
||||
message D8FCRichCardNameElem {
|
||||
optional bytes ctrl = 1;
|
||||
optional bytes text = 2;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user