revoke message

pull/351/head
Gordon 2 years ago
parent e814d9ea63
commit ac631f7c49

@ -168,24 +168,26 @@ func (rpc *rpcChat) messageVerification(data *pbChat.SendMsgReq) (bool, int32, s
return false, 201, err.Error(), nil return false, 201, err.Error(), nil
} }
log.Debug(data.OperationID, "revoke message is", *revokeMessage) log.Debug(data.OperationID, "revoke message is", *revokeMessage)
req := pbChat.GetSuperGroupMsgReq{OperationID: data.OperationID, Seq: revokeMessage.Seq, GroupID: data.MsgData.GroupID}
resp, err := rpc.GetSuperGroupMsg(context.Background(), &req) if revokeMessage.RevokerID != revokeMessage.SourceMessageSendID {
if err != nil { req := pbChat.GetSuperGroupMsgReq{OperationID: data.OperationID, Seq: revokeMessage.Seq, GroupID: data.MsgData.GroupID}
log.Error(data.OperationID, "GetSuperGroupMsgReq err:", err.Error()) resp, err := rpc.GetSuperGroupMsg(context.Background(), &req)
} else if resp.ErrCode != 0 { if err != nil {
log.Error(data.OperationID, "GetSuperGroupMsgReq err:", err.Error()) log.Error(data.OperationID, "GetSuperGroupMsgReq err:", err.Error())
} else { } else if resp.ErrCode != 0 {
if resp.MsgData != nil && resp.MsgData.ClientMsgID == revokeMessage.ClientMsgID && resp.MsgData.Seq == revokeMessage.Seq { log.Error(data.OperationID, "GetSuperGroupMsgReq err:", err.Error())
revokeMessage.SourceMessageSendTime = resp.MsgData.SendTime
revokeMessage.SourceMessageSenderNickname = resp.MsgData.SenderNickname
revokeMessage.SourceMessageSendID = resp.MsgData.SendID
log.Debug(data.OperationID, "new revoke message is ", revokeMessage)
data.MsgData.Content = []byte(utils.StructToJsonString(revokeMessage))
} else { } else {
return false, 201, errors.New("msg err").Error(), nil if resp.MsgData != nil && resp.MsgData.ClientMsgID == revokeMessage.ClientMsgID && resp.MsgData.Seq == revokeMessage.Seq {
revokeMessage.SourceMessageSendTime = resp.MsgData.SendTime
revokeMessage.SourceMessageSenderNickname = resp.MsgData.SenderNickname
revokeMessage.SourceMessageSendID = resp.MsgData.SendID
log.Debug(data.OperationID, "new revoke message is ", revokeMessage)
data.MsgData.Content = []byte(utils.StructToJsonString(revokeMessage))
} else {
return false, 201, errors.New("msg err").Error(), nil
}
} }
} }
} }
if groupInfo.GroupType == constant.SuperGroup { if groupInfo.GroupType == constant.SuperGroup {
return true, 0, "", nil return true, 0, "", nil

Loading…
Cancel
Save