mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
commit
231b2d89db
@ -1019,6 +1019,24 @@ func (c *QQClient) buildGroupPokePacket(groupCode, target int64) (uint16, []byte
|
||||
return seq, packet
|
||||
}
|
||||
|
||||
// OidbSvc.0xed3
|
||||
func (c *QQClient) buildFriendPokePacket(target int64) (uint16, []byte) {
|
||||
seq := c.nextSeq()
|
||||
body := &oidb.DED3ReqBody{
|
||||
ToUin: target,
|
||||
AioUin: target,
|
||||
}
|
||||
b, _ := proto.Marshal(body)
|
||||
req := &oidb.OIDBSSOPkg{
|
||||
Command: 3795,
|
||||
ServiceType: 1,
|
||||
Bodybuffer: b,
|
||||
}
|
||||
payload, _ := proto.Marshal(req)
|
||||
packet := packets.BuildUniPacket(c.Uin, seq, "OidbSvc.0xed3", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload)
|
||||
return seq, packet
|
||||
}
|
||||
|
||||
// OidbSvc.0x55c_1
|
||||
func (c *QQClient) buildGroupAdminSetPacket(groupCode, member int64, flag bool) (uint16, []byte) {
|
||||
seq := c.nextSeq()
|
||||
|
@ -618,6 +618,10 @@ func (c *QQClient) sendGroupPoke(groupCode, target int64) {
|
||||
_, _ = c.sendAndWait(c.buildGroupPokePacket(groupCode, target))
|
||||
}
|
||||
|
||||
func (c *QQClient) SendFriendPoke(target int64) {
|
||||
_, _ = c.sendAndWait(c.buildFriendPokePacket(target))
|
||||
}
|
||||
|
||||
func (c *QQClient) UploadGroupImage(groupCode int64, img []byte) (*message.GroupImageElement, error) {
|
||||
h := md5.Sum(img)
|
||||
seq, pkt := c.buildGroupImageStorePacket(groupCode, h[:], int32(len(img)))
|
||||
|
@ -776,6 +776,22 @@ func decodeOnlinePushReqPacket(c *QQClient, seq uint16, payload []byte) (interfa
|
||||
c.dispatchLeaveGroupEvent(&GroupLeaveEvent{Group: g})
|
||||
}
|
||||
groupLeaveLock.Unlock()
|
||||
case 290:
|
||||
t := ¬ify.GeneralGrayTipInfo{}
|
||||
_ = proto.Unmarshal(probuf, t)
|
||||
var sender int64
|
||||
for _, templ := range t.MsgTemplParam {
|
||||
if templ.Name == "uin_str1" {
|
||||
sender, _ = strconv.ParseInt(templ.Value, 10, 64)
|
||||
}
|
||||
}
|
||||
if sender == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
c.dispatchFriendNotifyEvent(&FriendPokeNotifyEvent{
|
||||
Sender: sender,
|
||||
Receiver: c.Uin,
|
||||
})
|
||||
case 0x44:
|
||||
s44 := pb.Sub44{}
|
||||
if err := proto.Unmarshal(probuf, &s44); err != nil {
|
||||
|
@ -44,7 +44,6 @@ type (
|
||||
Nickname string
|
||||
Remark string
|
||||
FaceId int16
|
||||
|
||||
//msgSeqList *utils.Cache
|
||||
}
|
||||
|
||||
@ -130,7 +129,7 @@ type (
|
||||
Member *GroupMemberInfo
|
||||
}
|
||||
|
||||
IGroupNotifyEvent interface {
|
||||
INotifyEvent interface {
|
||||
From() int64
|
||||
Content() string
|
||||
}
|
||||
|
@ -26,7 +26,8 @@ type eventHandlers struct {
|
||||
disconnectHandlers []func(*QQClient, *ClientDisconnectedEvent)
|
||||
logHandlers []func(*QQClient, *LogEvent)
|
||||
serverUpdatedHandlers []func(*QQClient, *ServerUpdatedEvent) bool
|
||||
notifyHandlers []func(*QQClient, IGroupNotifyEvent)
|
||||
groupNotifyHandlers []func(*QQClient, INotifyEvent)
|
||||
friendNotifyHandlers []func(*QQClient, INotifyEvent)
|
||||
offlineFileHandlers []func(*QQClient, *OfflineFileEvent)
|
||||
groupMessageReceiptHandlers sync.Map
|
||||
}
|
||||
@ -119,8 +120,12 @@ func (c *QQClient) OnLog(f func(*QQClient, *LogEvent)) {
|
||||
c.eventHandlers.logHandlers = append(c.eventHandlers.logHandlers, f)
|
||||
}
|
||||
|
||||
func (c *QQClient) OnGroupNotify(f func(*QQClient, IGroupNotifyEvent)) {
|
||||
c.eventHandlers.notifyHandlers = append(c.eventHandlers.notifyHandlers, f)
|
||||
func (c *QQClient) OnGroupNotify(f func(*QQClient, INotifyEvent)) {
|
||||
c.eventHandlers.groupNotifyHandlers = append(c.eventHandlers.groupNotifyHandlers, f)
|
||||
}
|
||||
|
||||
func (c *QQClient) OnFriendNotify(f func(*QQClient, INotifyEvent)) {
|
||||
c.eventHandlers.friendNotifyHandlers = append(c.eventHandlers.friendNotifyHandlers, f)
|
||||
}
|
||||
|
||||
func NewUinFilterPrivate(uin int64) func(*message.PrivateMessage) bool {
|
||||
@ -320,11 +325,22 @@ func (c *QQClient) dispatchNewFriendEvent(e *NewFriendEvent) {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *QQClient) dispatchGroupNotifyEvent(e IGroupNotifyEvent) {
|
||||
func (c *QQClient) dispatchGroupNotifyEvent(e INotifyEvent) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
for _, f := range c.eventHandlers.notifyHandlers {
|
||||
for _, f := range c.eventHandlers.groupNotifyHandlers {
|
||||
cover(func() {
|
||||
f(c, e)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (c *QQClient) dispatchFriendNotifyEvent(e INotifyEvent) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
for _, f := range c.eventHandlers.friendNotifyHandlers {
|
||||
cover(func() {
|
||||
f(c, e)
|
||||
})
|
||||
|
@ -28,6 +28,12 @@ type (
|
||||
Uin int64
|
||||
Nick string
|
||||
}
|
||||
|
||||
// FriendPokeNotifyEvent 好友戳一戳提示事件
|
||||
FriendPokeNotifyEvent struct {
|
||||
Sender int64
|
||||
Receiver int64
|
||||
}
|
||||
)
|
||||
|
||||
// grayTipProcessor 提取出来专门用于处理群内 notify tips
|
||||
@ -88,6 +94,14 @@ func (e *GroupPokeNotifyEvent) Content() string {
|
||||
return fmt.Sprintf("%d戳了戳%d", e.Sender, e.Receiver)
|
||||
}
|
||||
|
||||
func (e *FriendPokeNotifyEvent) From() int64 {
|
||||
return e.Sender
|
||||
}
|
||||
|
||||
func (e *FriendPokeNotifyEvent) Content() string {
|
||||
return fmt.Sprintf("%d戳了戳%d", e.Sender, e.Receiver)
|
||||
}
|
||||
|
||||
func (e *GroupRedBagLuckyKingNotifyEvent) From() int64 {
|
||||
return e.GroupCode
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user