mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
add func SolveGroupJoinRequest().
This commit is contained in:
parent
2f1e831448
commit
f96dcb7e9f
@ -37,6 +37,7 @@ qq-android协议的golang实现 移植于Mirai
|
||||
- [x] 收到其他用户进群请求
|
||||
- [ ] 新好友
|
||||
- [x] 新好友请求
|
||||
- [ ] 客户端离线
|
||||
|
||||
#### 主动操作
|
||||
- [x] 发送群消息
|
||||
|
@ -524,3 +524,42 @@ func (c *QQClient) buildSystemMsgNewFriendPacket() (uint16, []byte) {
|
||||
packet := packets.BuildUniPacket(c.Uin, seq, "ProfileService.Pb.ReqSystemMsgNew.Friend", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload)
|
||||
return seq, packet
|
||||
}
|
||||
|
||||
// ProfileService.Pb.ReqSystemMsgAction.Group
|
||||
func (c *QQClient) buildSystemMsgGroupActionPacket(reqId, requester, group int64, isInvite, accept, block bool) (uint16, []byte) {
|
||||
seq := c.nextSeq()
|
||||
req := &structmsg.ReqSystemMsgAction{
|
||||
MsgType: 1,
|
||||
MsgSeq: reqId,
|
||||
ReqUin: requester,
|
||||
SubType: 1,
|
||||
SrcId: 3,
|
||||
SubSrcId: func() int32 {
|
||||
if isInvite {
|
||||
return 10016
|
||||
}
|
||||
return 31
|
||||
}(),
|
||||
GroupMsgType: func() int32 {
|
||||
if isInvite {
|
||||
return 2
|
||||
}
|
||||
return 1
|
||||
}(),
|
||||
ActionInfo: &structmsg.SystemMsgActionInfo{
|
||||
Type: func() int32 {
|
||||
if accept {
|
||||
return 11
|
||||
}
|
||||
return 12
|
||||
}(),
|
||||
GroupCode: group,
|
||||
Blacklist: block,
|
||||
Sig: EmptyBytes,
|
||||
},
|
||||
Language: 1000,
|
||||
}
|
||||
payload, _ := proto.Marshal(req)
|
||||
packet := packets.BuildUniPacket(c.Uin, seq, "ProfileService.Pb.ReqSystemMsgAction.Group", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload)
|
||||
return seq, packet
|
||||
}
|
||||
|
@ -344,6 +344,11 @@ func (c *QQClient) FindGroup(code int64) *GroupInfo {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *QQClient) SolveGroupJoinRequest(req *UserJoinGroupRequest, accept bool) {
|
||||
_, pkt := c.buildSystemMsgGroupActionPacket(req.RequestId, req.RequesterUin, req.GroupCode, false, accept, false)
|
||||
_ = c.send(pkt)
|
||||
}
|
||||
|
||||
func (g *GroupInfo) FindMember(uin int64) *GroupMemberInfo {
|
||||
for _, m := range g.Members {
|
||||
f := m
|
||||
|
@ -543,6 +543,7 @@ func decodeSystemMsgGroupPacket(c *QQClient, _ uint16, payload []byte) (interfac
|
||||
RequesterNick: st.Msg.ReqUinNick,
|
||||
GroupCode: st.Msg.GroupCode,
|
||||
GroupName: st.Msg.GroupName,
|
||||
client: c,
|
||||
})
|
||||
case 1: // 被邀请
|
||||
c.dispatchGroupInvitedEvent(&GroupInvitedEvent{
|
||||
|
@ -119,6 +119,8 @@ type (
|
||||
RequesterNick string
|
||||
GroupCode int64
|
||||
GroupName string
|
||||
|
||||
client *QQClient
|
||||
}
|
||||
|
||||
NewFriendRequest struct {
|
||||
@ -167,3 +169,11 @@ func (m *GroupMemberInfo) DisplayName() string {
|
||||
}
|
||||
return m.CardName
|
||||
}
|
||||
|
||||
func (r *UserJoinGroupRequest) Accept() {
|
||||
r.client.SolveGroupJoinRequest(r, true)
|
||||
}
|
||||
|
||||
func (r *UserJoinGroupRequest) Reject() {
|
||||
r.client.SolveGroupJoinRequest(r, false)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user