mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 19:17:38 +08:00
add: GetGroupInfo.
This commit is contained in:
parent
8408c5ac5f
commit
4bddbfc027
@ -955,6 +955,53 @@ func (c *QQClient) buildGroupAdminSetPacket(groupCode, member int64, flag bool)
|
|||||||
return seq, packet
|
return seq, packet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OidbSvc.0x88d_7
|
||||||
|
func (c *QQClient) buildGroupInfoRequestPacket(groupCode int64) (uint16, []byte) {
|
||||||
|
seq := c.nextSeq()
|
||||||
|
body := &oidb.D88DReqBody{
|
||||||
|
AppId: proto.Uint32(uint32(SystemDeviceInfo.Protocol)),
|
||||||
|
ReqGroupInfo: []*oidb.ReqGroupInfo{
|
||||||
|
{
|
||||||
|
GroupCode: proto.Uint64(uint64(groupCode)),
|
||||||
|
Stgroupinfo: &oidb.D88DGroupInfo{
|
||||||
|
GroupOwner: proto.Uint64(0),
|
||||||
|
GroupCreateTime: proto.Uint32(0),
|
||||||
|
GroupFlag: proto.Uint32(0),
|
||||||
|
GroupMemberMaxNum: proto.Uint32(0),
|
||||||
|
GroupMemberNum: proto.Uint32(0),
|
||||||
|
GroupOption: proto.Uint32(0),
|
||||||
|
GroupLevel: proto.Uint32(0),
|
||||||
|
GroupFace: proto.Uint32(0),
|
||||||
|
GroupName: EmptyBytes,
|
||||||
|
GroupMemo: EmptyBytes,
|
||||||
|
GroupFingerMemo: EmptyBytes,
|
||||||
|
GroupLastMsgTime: proto.Uint32(0),
|
||||||
|
GroupQuestion: EmptyBytes,
|
||||||
|
GroupAnswer: EmptyBytes,
|
||||||
|
GroupGrade: proto.Uint32(0),
|
||||||
|
ActiveMemberNum: proto.Uint32(0),
|
||||||
|
HeadPortraitSeq: proto.Uint32(0),
|
||||||
|
MsgHeadPortrait: &oidb.D88DGroupHeadPortrait{},
|
||||||
|
StGroupExInfo: &oidb.D88DGroupExInfoOnly{},
|
||||||
|
GroupSecLevel: proto.Uint32(0),
|
||||||
|
CmduinPrivilege: proto.Uint32(0),
|
||||||
|
NoFingerOpenFlag: proto.Uint32(0),
|
||||||
|
NoCodeFingerOpenFlag: proto.Uint32(0),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
PcClientVersion: proto.Uint32(0),
|
||||||
|
}
|
||||||
|
b, _ := proto.Marshal(body)
|
||||||
|
req := &oidb.OIDBSSOPkg{
|
||||||
|
Command: 2189,
|
||||||
|
Bodybuffer: b,
|
||||||
|
}
|
||||||
|
payload, _ := proto.Marshal(req)
|
||||||
|
packet := packets.BuildUniPacket(c.Uin, seq, "OidbSvc.0x88d_0", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload)
|
||||||
|
return seq, packet
|
||||||
|
}
|
||||||
|
|
||||||
// MultiMsg.ApplyUp
|
// MultiMsg.ApplyUp
|
||||||
func (c *QQClient) buildMultiApplyUpPacket(data, hash []byte, buType int32, groupUin int64) (uint16, []byte) {
|
func (c *QQClient) buildMultiApplyUpPacket(data, hash []byte, buType int32, groupUin int64) (uint16, []byte) {
|
||||||
seq := c.nextSeq()
|
seq := c.nextSeq()
|
||||||
|
@ -139,6 +139,7 @@ func NewClientMd5(uin int64, passwordMd5 [16]byte) *QQClient {
|
|||||||
"MultiMsg.ApplyUp": decodeMultiApplyUpResponse,
|
"MultiMsg.ApplyUp": decodeMultiApplyUpResponse,
|
||||||
"MultiMsg.ApplyDown": decodeMultiApplyDownResponse,
|
"MultiMsg.ApplyDown": decodeMultiApplyDownResponse,
|
||||||
"OidbSvc.0x6d6_2": decodeOIDB6d6Response,
|
"OidbSvc.0x6d6_2": decodeOIDB6d6Response,
|
||||||
|
"OidbSvc.0x88d_0": decodeGroupInfoResponse,
|
||||||
"PttCenterSvr.ShortVideoDownReq": decodePttShortVideoDownResponse,
|
"PttCenterSvr.ShortVideoDownReq": decodePttShortVideoDownResponse,
|
||||||
},
|
},
|
||||||
sigInfo: &loginSigInfo{},
|
sigInfo: &loginSigInfo{},
|
||||||
@ -308,6 +309,14 @@ func (c *QQClient) GetGroupFileUrl(groupCode int64, fileId string, busId int32)
|
|||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *QQClient) GetGroupInfo(groupCode int64) (*GroupInfo, error) {
|
||||||
|
i, err := c.sendAndWait(c.buildGroupInfoRequestPacket(groupCode))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return i.(*GroupInfo), nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *QQClient) SendGroupMessage(groupCode int64, m *message.SendingMessage, f ...bool) *message.GroupMessage {
|
func (c *QQClient) SendGroupMessage(groupCode int64, m *message.SendingMessage, f ...bool) *message.GroupMessage {
|
||||||
useFram := false
|
useFram := false
|
||||||
if len(f) > 0 {
|
if len(f) > 0 {
|
||||||
@ -859,9 +868,6 @@ func (c *QQClient) kickGroupMember(groupCode, memberUin int64, msg string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupInfo) removeMember(uin int64) {
|
func (g *GroupInfo) removeMember(uin int64) {
|
||||||
if g.memLock == nil {
|
|
||||||
g.memLock = new(sync.Mutex)
|
|
||||||
}
|
|
||||||
g.memLock.Lock()
|
g.memLock.Lock()
|
||||||
defer g.memLock.Unlock()
|
defer g.memLock.Unlock()
|
||||||
for i, m := range g.Members {
|
for i, m := range g.Members {
|
||||||
|
@ -385,6 +385,31 @@ func decodeGroupListResponse(c *QQClient, _ uint16, payload []byte) (interface{}
|
|||||||
return l, nil
|
return l, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func decodeGroupInfoResponse(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||||
|
pkg := oidb.OIDBSSOPkg{}
|
||||||
|
rsp := oidb.D88DRspBody{}
|
||||||
|
if err := proto.Unmarshal(payload, &pkg); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if err := proto.Unmarshal(pkg.Bodybuffer, &rsp); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(rsp.RspGroupInfo) == 0 {
|
||||||
|
return nil, errors.New(string(rsp.StrErrorInfo))
|
||||||
|
}
|
||||||
|
info := rsp.RspGroupInfo[0]
|
||||||
|
return &GroupInfo{
|
||||||
|
Uin: utils.ToGroupUin(int64(*info.GroupCode)),
|
||||||
|
Code: int64(*info.GroupCode),
|
||||||
|
Name: string(info.GroupInfo.GroupName),
|
||||||
|
Memo: string(info.GroupInfo.GroupMemo),
|
||||||
|
OwnerUin: int64(*info.GroupInfo.GroupOwner),
|
||||||
|
MemberCount: uint16(*info.GroupInfo.GroupMemberNum),
|
||||||
|
MaxMemberCount: uint16(*info.GroupInfo.GroupMemberMaxNum),
|
||||||
|
client: c,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
func decodeGroupMemberListResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
func decodeGroupMemberListResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||||
request := &jce.RequestPacket{}
|
request := &jce.RequestPacket{}
|
||||||
request.ReadFrom(jce.NewJceReader(payload))
|
request.ReadFrom(jce.NewJceReader(payload))
|
||||||
|
@ -58,7 +58,7 @@ type (
|
|||||||
Members []*GroupMemberInfo
|
Members []*GroupMemberInfo
|
||||||
|
|
||||||
client *QQClient
|
client *QQClient
|
||||||
memLock *sync.Mutex
|
memLock sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupMemberInfo struct {
|
GroupMemberInfo struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user