1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00
This commit is contained in:
wfjsw 2020-08-20 19:03:28 +08:00
parent 8d1e5fb04c
commit a09956320d
3 changed files with 19 additions and 12 deletions

View File

@ -3,6 +3,9 @@ package client
import ( import (
"crypto/md5" "crypto/md5"
"encoding/hex" "encoding/hex"
"math/rand"
"strconv"
"github.com/Mrs4s/MiraiGo/binary" "github.com/Mrs4s/MiraiGo/binary"
"github.com/Mrs4s/MiraiGo/binary/jce" "github.com/Mrs4s/MiraiGo/binary/jce"
"github.com/Mrs4s/MiraiGo/client/pb" "github.com/Mrs4s/MiraiGo/client/pb"
@ -18,8 +21,6 @@ import (
"github.com/Mrs4s/MiraiGo/protocol/tlv" "github.com/Mrs4s/MiraiGo/protocol/tlv"
"github.com/Mrs4s/MiraiGo/utils" "github.com/Mrs4s/MiraiGo/utils"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"math/rand"
"strconv"
) )
var ( var (
@ -680,7 +681,7 @@ func (c *QQClient) buildSystemMsgNewFriendPacket() (uint16, []byte) {
} }
// ProfileService.Pb.ReqSystemMsgAction.Group // ProfileService.Pb.ReqSystemMsgAction.Group
func (c *QQClient) buildSystemMsgGroupActionPacket(reqId, requester, group int64, isInvite, accept, block bool) (uint16, []byte) { func (c *QQClient) buildSystemMsgGroupActionPacket(reqId, requester, group int64, isInvite, accept, block bool, reason string) (uint16, []byte) {
seq := c.nextSeq() seq := c.nextSeq()
req := &structmsg.ReqSystemMsgAction{ req := &structmsg.ReqSystemMsgAction{
MsgType: 1, MsgType: 1,
@ -709,6 +710,7 @@ func (c *QQClient) buildSystemMsgGroupActionPacket(reqId, requester, group int64
}(), }(),
GroupCode: group, GroupCode: group,
Blacklist: block, Blacklist: block,
Msg: reason,
Sig: EmptyBytes, Sig: EmptyBytes,
}, },
Language: 1000, Language: 1000,

View File

@ -707,13 +707,18 @@ func (c *QQClient) FindGroup(code int64) *GroupInfo {
return nil return nil
} }
func (c *QQClient) SolveGroupJoinRequest(i interface{}, accept bool) { func (c *QQClient) SolveGroupJoinRequest(i interface{}, accept, block bool, reason string) {
if accept {
block = false
reason = ""
}
switch req := i.(type) { switch req := i.(type) {
case *UserJoinGroupRequest: case *UserJoinGroupRequest:
_, pkt := c.buildSystemMsgGroupActionPacket(req.RequestId, req.RequesterUin, req.GroupCode, false, accept, false) _, pkt := c.buildSystemMsgGroupActionPacket(req.RequestId, req.RequesterUin, req.GroupCode, false, accept, block, reason)
_ = c.send(pkt) _ = c.send(pkt)
case *GroupInvitedRequest: case *GroupInvitedRequest:
_, pkt := c.buildSystemMsgGroupActionPacket(req.RequestId, req.InvitorUin, req.GroupCode, true, accept, false) _, pkt := c.buildSystemMsgGroupActionPacket(req.RequestId, req.InvitorUin, req.GroupCode, true, accept, block, reason)
_ = c.send(pkt) _ = c.send(pkt)
} }
} }

View File

@ -267,19 +267,19 @@ func (m *GroupMemberInfo) Manageable() bool {
} }
func (r *UserJoinGroupRequest) Accept() { func (r *UserJoinGroupRequest) Accept() {
r.client.SolveGroupJoinRequest(r, true) r.client.SolveGroupJoinRequest(r, true, false, "")
} }
func (r *UserJoinGroupRequest) Reject() { func (r *UserJoinGroupRequest) Reject(block bool, reason string) {
r.client.SolveGroupJoinRequest(r, false) r.client.SolveGroupJoinRequest(r, false, block, reason)
} }
func (r *GroupInvitedRequest) Accept() { func (r *GroupInvitedRequest) Accept() {
r.client.SolveGroupJoinRequest(r, true) r.client.SolveGroupJoinRequest(r, true, false, "")
} }
func (r *GroupInvitedRequest) Reject() { func (r *GroupInvitedRequest) Reject(block bool, reason string) {
r.client.SolveGroupJoinRequest(r, false) r.client.SolveGroupJoinRequest(r, false, block, reason)
} }
func (r *NewFriendRequest) Accept() { func (r *NewFriendRequest) Accept() {