1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-05 03:23:50 +08:00

Friend delete handling

This commit is contained in:
Sam 2021-03-02 03:08:16 +08:00
parent 6687d1e0c0
commit f2f36691d1
3 changed files with 473 additions and 253 deletions

View File

@ -4,6 +4,7 @@ import (
"crypto/md5" "crypto/md5"
"encoding/hex" "encoding/hex"
"fmt" "fmt"
log "github.com/sirupsen/logrus"
"net" "net"
"strconv" "strconv"
"strings" "strings"
@ -647,6 +648,22 @@ func decodeOnlinePushReqPacket(c *QQClient, seq uint16, payload []byte) (interfa
c.dispatchLeaveGroupEvent(&GroupLeaveEvent{Group: g}) c.dispatchLeaveGroupEvent(&GroupLeaveEvent{Group: g})
} }
groupLeaveLock.Unlock() groupLeaveLock.Unlock()
case 0x27:
s27 := pb.Sub27{}
if err := proto.Unmarshal(probuf, &s27); err != nil {
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
}
for _, m := range s27.ModInfos {
if m.DelFriend != nil {
frdUin := m.DelFriend.Uins[0]
if frd := c.FindFriend(int64(frdUin)); frd != nil {
log.Infof("好友被删除: %v(%v)", frd.Nickname, frd.Uin)
if err := c.ReloadFriendList(); err != nil {
return nil, errors.Wrap(err, "failed to reload friend list")
}
}
}
}
case 290: case 290:
t := &notify.GeneralGrayTipInfo{} t := &notify.GeneralGrayTipInfo{}
_ = proto.Unmarshal(probuf, t) _ = proto.Unmarshal(probuf, t)

File diff suppressed because it is too large Load Diff

View File

@ -235,6 +235,18 @@ message MessageItem {
bytes sig = 7; bytes sig = 7;
} }
message Sub27DelFriend {
repeated uint64 uins = 1;
}
message Sub27ForwardBody {
Sub27DelFriend delFriend = 14;
}
message Sub27 {
repeated Sub27ForwardBody modInfos = 1;
}
message SubD4 { message SubD4 {
int64 uin = 1; int64 uin = 1;
} }