mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 19:17:38 +08:00
Merge branch 'master' of https://github.com/Mrs4s/MiraiGo
This commit is contained in:
commit
88de17435a
@ -252,12 +252,12 @@ func (c *QQClient) buildFriendGroupListRequestPacket(friendStartIndex, friendLis
|
|||||||
}
|
}
|
||||||
|
|
||||||
// friendlist.GetTroopListReqV2
|
// friendlist.GetTroopListReqV2
|
||||||
func (c *QQClient) buildGroupListRequestPacket() (uint16, []byte) {
|
func (c *QQClient) buildGroupListRequestPacket(vecCookie []byte) (uint16, []byte) {
|
||||||
seq := c.nextSeq()
|
seq := c.nextSeq()
|
||||||
req := &jce.TroopListRequest{
|
req := &jce.TroopListRequest{
|
||||||
Uin: c.Uin,
|
Uin: c.Uin,
|
||||||
GetMSFMsgFlag: 1,
|
GetMSFMsgFlag: 1,
|
||||||
Cookies: []byte{},
|
Cookies: vecCookie,
|
||||||
GroupInfo: []int64{},
|
GroupInfo: []int64{},
|
||||||
GroupFlagExt: 1,
|
GroupFlagExt: 1,
|
||||||
Version: 7,
|
Version: 7,
|
||||||
|
@ -296,6 +296,11 @@ func (c *QQClient) SendGroupMessage(groupCode int64, m *message.SendingMessage,
|
|||||||
useFram = f[0]
|
useFram = f[0]
|
||||||
}
|
}
|
||||||
imgCount := m.Count(func(e message.IMessageElement) bool { return e.Type() == message.Image })
|
imgCount := m.Count(func(e message.IMessageElement) bool { return e.Type() == message.Image })
|
||||||
|
if useFram {
|
||||||
|
if m.Any(func(e message.IMessageElement) bool { return e.Type() == message.Reply }) {
|
||||||
|
useFram = false
|
||||||
|
}
|
||||||
|
}
|
||||||
msgLen := message.EstimateLength(m.Elements, 703)
|
msgLen := message.EstimateLength(m.Elements, 703)
|
||||||
if msgLen > 5000 || imgCount > 50 {
|
if msgLen > 5000 || imgCount > 50 {
|
||||||
return nil
|
return nil
|
||||||
@ -653,7 +658,7 @@ func (c *QQClient) ReloadGroupList() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *QQClient) GetGroupList() ([]*GroupInfo, error) {
|
func (c *QQClient) GetGroupList() ([]*GroupInfo, error) {
|
||||||
rsp, err := c.sendAndWait(c.buildGroupListRequestPacket())
|
rsp, err := c.sendAndWait(c.buildGroupListRequestPacket(EmptyBytes))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -352,7 +352,9 @@ func decodeGroupListResponse(c *QQClient, _ uint16, payload []byte) (interface{}
|
|||||||
data := &jce.RequestDataVersion3{}
|
data := &jce.RequestDataVersion3{}
|
||||||
data.ReadFrom(jce.NewJceReader(request.SBuffer))
|
data.ReadFrom(jce.NewJceReader(request.SBuffer))
|
||||||
r := jce.NewJceReader(data.Map["GetTroopListRespV2"][1:])
|
r := jce.NewJceReader(data.Map["GetTroopListRespV2"][1:])
|
||||||
|
vecCookie := []byte{}
|
||||||
groups := []jce.TroopNumber{}
|
groups := []jce.TroopNumber{}
|
||||||
|
r.ReadSlice(&vecCookie, 4)
|
||||||
r.ReadSlice(&groups, 5)
|
r.ReadSlice(&groups, 5)
|
||||||
var l []*GroupInfo
|
var l []*GroupInfo
|
||||||
for _, g := range groups {
|
for _, g := range groups {
|
||||||
@ -367,6 +369,13 @@ func decodeGroupListResponse(c *QQClient, _ uint16, payload []byte) (interface{}
|
|||||||
client: c,
|
client: c,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if len(vecCookie) > 0 {
|
||||||
|
rsp, err := c.sendAndWait(c.buildGroupListRequestPacket(vecCookie))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
l = append(l, rsp.([]*GroupInfo)...)
|
||||||
|
}
|
||||||
return l, nil
|
return l, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user