Skip to content

Commit

Permalink
code ...
Browse files Browse the repository at this point in the history
  • Loading branch information
icarus-ai committed Feb 17, 2025
1 parent 58a6b3f commit ee5d35d
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 48 deletions.
3 changes: 0 additions & 3 deletions client/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ func (c *QQClient) SendGroupMessage(groupUin uint32, elements []message2.IMessag
UID: c.GetUID(c.Uin),
Nickname: c.NickName(),
CardName: minfo.MemberCard,
//AnonymousInfo: nil,
IsFriend: true,
},
Time: ret.Timestamp1,
Expand Down Expand Up @@ -109,7 +108,6 @@ func (c *QQClient) SendPrivateMessage(uin uint32, elements []message2.IMessageEl
Uin: c.Uin,
UID: c.GetUID(c.Uin),
Nickname: c.NickName(),
//AnonymousInfo: nil,
IsFriend: true,
},
Elements: elements,
Expand Down Expand Up @@ -140,7 +138,6 @@ func (c *QQClient) SendTempMessage(groupUin uint32, uin uint32, elements []messa
Uin: c.Uin,
UID: c.GetUID(c.Uin),
Nickname: c.NickName(),
//AnonymousInfo: nil,
IsFriend: true,
},
Elements: elements,
Expand Down
15 changes: 15 additions & 0 deletions client/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,21 @@ func (c *QQClient) GetGroupRecordURL(groupUin uint32, node *oidb.IndexNode) (str
return oidb2.ParseGroupRecordDownloadResp(resp)
}

/* king bug ?
func (c *QQClient) GetVideoNode() *oidb.IndexNode {
return &oidb.IndexNode{
Info: &oidb2.FileInfo{
FileName: video.FileName,
FileSize: video.FileSize,
FileSha1: video.FileSha1,
FileHash: video.FileMd5,
},
FileUuid: video.FileUuid,
StoreId : 1, // 0旧服务器 1为nt服务器
},
}
*/

// GetPrivateVideoURL 获取私聊视频下载链接
func (c *QQClient) GetPrivateVideoURL(node *oidb.IndexNode) (string, error) {
pkt, err := oidb2.BuildPrivateVideoDownloadReq(c.Sig().UID, node)
Expand Down
3 changes: 2 additions & 1 deletion client/packets/pb/action/action.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 30 additions & 20 deletions client/packets/pb/message/element.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions client/packets/pb/message/element.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ message Elem {
optional GroupFile GroupFile = 13;
optional ExtraInfo ExtraInfo = 16;
optional VideoFile VideoFile = 19;
//optional AnonymousGroupMessage AnonymousGroupMessage = 21;
optional AnonymousGroupMessage AnonymousGroupMessage = 21;
optional QQWalletMsg QQWalletMsg = 24;
optional CustomElem CustomElem = 31;
optional GeneralFlags GeneralFlags = 37;
Expand All @@ -24,7 +24,6 @@ message Elem {
optional CommonElem CommonElem = 53;
}

/*
message AnonymousGroupMessage {
int32 Flags = 1;
bytes AnonId = 2;
Expand All @@ -34,7 +33,6 @@ message AnonymousGroupMessage {
int32 BubbleId = 6;
bytes RankColor = 7;
}
*/

message CommonElem {
int32 ServiceType = 1;
Expand Down
3 changes: 2 additions & 1 deletion client/packets/pb/message/message.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion client/packets/pb/service/highway/highway.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 5 additions & 19 deletions message/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,28 +81,16 @@ type (
UID string
Nickname string
CardName string
//AnonymousInfo *AnonymousInfo
IsFriend bool
}
/*
AnonymousInfo struct {
AnonymousID string
AnonymousNick string
}
*/

IMessageElement interface {
Type() ElementType
}

ElementType int
)

/*
func (s *Sender) IsAnonymous() bool {
return s.Uin == 80000000
}
*/

func ParsePrivateMessage(msg *message.PushMsgBody) *PrivateMessage {
prvMsg := &PrivateMessage{
ID: msg.ContentHead.Sequence.Unwrap(),
Expand Down Expand Up @@ -173,15 +161,14 @@ func ParseMessageElements(msg []*message.Elem) []IMessageElement {
}

if elem.Text != nil {
switch {
case len(elem.Text.Attr6Buf) > 0:
if len(elem.Text.Attr6Buf) > 0 {
att6 := binary.NewReader(elem.Text.Attr6Buf)
att6.SkipBytes(7)
target := att6.ReadU32()
at := NewAt(target, elem.Text.Str.Unwrap())
at.SubType = AtTypeGroupMember
res = append(res, at)
default:
} else {
res = append(res, NewText(func() string {
if strings.Contains(elem.Text.Str.Unwrap(), "\r") && !strings.Contains(elem.Text.Str.Unwrap(), "\r\n") {
return strings.ReplaceAll(elem.Text.Str.Unwrap(), "\r", "\r\n")
Expand Down Expand Up @@ -452,8 +439,7 @@ func ParseMessageBody(body *message.MessageBody, isGroup bool) []IMessageElement
if body != nil {
if body.RichText != nil && body.RichText.Ptt != nil {
ptt := body.RichText.Ptt
switch {
case isGroup && ptt.FileId != 0:
if isGroup && ptt.FileId != 0 {
res = append(res, &VoiceElement{
Name: ptt.FileName,
UUID: ptt.FileUuid,
Expand All @@ -462,7 +448,7 @@ func ParseMessageBody(body *message.MessageBody, isGroup bool) []IMessageElement
FileUuid: ptt.GroupFileKey,
},
})
case !isGroup:
} else if !isGroup {
res = append(res, &VoiceElement{
Name: ptt.FileName,
UUID: ptt.FileUuid,
Expand Down

0 comments on commit ee5d35d

Please sign in to comment.