mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
add func SolveFriendRequest().
This commit is contained in:
parent
e3984eac20
commit
7fddb30e68
@ -50,7 +50,7 @@ qq-android协议的golang实现 移植于Mirai
|
||||
- [ ] 获取/刷新讨论组列表
|
||||
- [x] 处理加群请求
|
||||
- [x] 处理被邀请加群请求
|
||||
- [ ] 处理好友请求
|
||||
- [x] 处理好友请求
|
||||
- [ ] 撤回群消息
|
||||
- [ ] 群公告设置
|
||||
- [ ] 群设置
|
||||
|
@ -563,3 +563,29 @@ func (c *QQClient) buildSystemMsgGroupActionPacket(reqId, requester, group int64
|
||||
packet := packets.BuildUniPacket(c.Uin, seq, "ProfileService.Pb.ReqSystemMsgAction.Group", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload)
|
||||
return seq, packet
|
||||
}
|
||||
|
||||
// ProfileService.Pb.ReqSystemMsgAction.Friend
|
||||
func (c *QQClient) buildSystemMsgFriendActionPacket(reqId, requester int64, accept bool) (uint16, []byte) {
|
||||
seq := c.nextSeq()
|
||||
req := &structmsg.ReqSystemMsgAction{
|
||||
MsgType: 1,
|
||||
MsgSeq: reqId,
|
||||
ReqUin: requester,
|
||||
SubType: 1,
|
||||
SrcId: 6,
|
||||
SubSrcId: 7,
|
||||
ActionInfo: &structmsg.SystemMsgActionInfo{
|
||||
Type: func() int32 {
|
||||
if accept {
|
||||
return 2
|
||||
}
|
||||
return 3
|
||||
}(),
|
||||
Blacklist: false,
|
||||
AddFrdSNInfo: &structmsg.AddFrdSNInfo{},
|
||||
},
|
||||
}
|
||||
payload, _ := proto.Marshal(req)
|
||||
packet := packets.BuildUniPacket(c.Uin, seq, "ProfileService.Pb.ReqSystemMsgAction.Friend", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload)
|
||||
return seq, packet
|
||||
}
|
||||
|
@ -356,6 +356,11 @@ func (c *QQClient) SolveGroupJoinRequest(i interface{}, accept bool) {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *QQClient) SolveFriendRequest(req *NewFriendRequest, accept bool) {
|
||||
_, pkt := c.buildSystemMsgFriendActionPacket(req.RequestId, req.RequesterUin, accept)
|
||||
_ = c.send(pkt)
|
||||
}
|
||||
|
||||
func (g *GroupInfo) FindMember(uin int64) *GroupMemberInfo {
|
||||
for _, m := range g.Members {
|
||||
f := m
|
||||
|
@ -229,7 +229,7 @@ func decodeMessageSvcPacket(c *QQClient, _ uint16, payload []byte) (interface{},
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func decodeGroupMessagePacket(c *QQClient, seq uint16, payload []byte) (interface{}, error) {
|
||||
func decodeGroupMessagePacket(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
pkt := msg.PushMessagePacket{}
|
||||
err := proto.Unmarshal(payload, &pkt)
|
||||
if err != nil {
|
||||
@ -594,6 +594,7 @@ func decodeSystemMsgFriendPacket(c *QQClient, _ uint16, payload []byte) (interfa
|
||||
Message: st.Msg.MsgAdditional,
|
||||
RequesterUin: st.ReqUin,
|
||||
RequesterNick: st.Msg.ReqUinNick,
|
||||
client: c,
|
||||
})
|
||||
}
|
||||
return nil, nil
|
||||
|
@ -130,6 +130,8 @@ type (
|
||||
Message string
|
||||
RequesterUin int64
|
||||
RequesterNick string
|
||||
|
||||
client *QQClient
|
||||
}
|
||||
|
||||
groupMemberListResponse struct {
|
||||
@ -187,3 +189,11 @@ func (r *GroupInvitedRequest) Accept() {
|
||||
func (r *GroupInvitedRequest) Reject() {
|
||||
r.client.SolveGroupJoinRequest(r, false)
|
||||
}
|
||||
|
||||
func (r *NewFriendRequest) Accept() {
|
||||
r.client.SolveFriendRequest(r, true)
|
||||
}
|
||||
|
||||
func (r *NewFriendRequest) Reject() {
|
||||
r.client.SolveFriendRequest(r, false)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user