mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-04 17:15:58 +08:00
reaction message update
This commit is contained in:
@@ -1,11 +1,67 @@
|
||||
package msg
|
||||
|
||||
import "Open_IM/pkg/proto/msg"
|
||||
import (
|
||||
cbApi "Open_IM/pkg/call_back_struct"
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/http"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/proto/msg"
|
||||
"Open_IM/pkg/utils"
|
||||
http2 "net/http"
|
||||
)
|
||||
|
||||
func callbackSetMessageReactionExtensions(req *msg.ModifyMessageReactionExtensionsReq) {
|
||||
func callbackSetMessageReactionExtensions(req *msg.SetMessageReactionExtensionsReq) cbApi.CommonCallbackResp {
|
||||
callbackResp := cbApi.CommonCallbackResp{OperationID: req.OperationID}
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), req.String())
|
||||
|
||||
}
|
||||
|
||||
func callbackDeleteMessageReactionExtensions(req *msg.DeleteMessageListReactionExtensionsReq) {
|
||||
|
||||
}
|
||||
func callbackAfterSendGroupMsg(msg *pbChat.SendMsgReq) cbApi.CommonCallbackResp {
|
||||
callbackResp := cbApi.CommonCallbackResp{OperationID: msg.OperationID}
|
||||
if !config.Config.Callback.CallbackAfterSendGroupMsg.Enable {
|
||||
return callbackResp
|
||||
}
|
||||
log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), msg)
|
||||
commonCallbackReq := copyCallbackCommonReqStruct(msg)
|
||||
commonCallbackReq.CallbackCommand = constant.CallbackAfterSendGroupMsgCommand
|
||||
req := cbApi.CallbackAfterSendGroupMsgReq{
|
||||
CommonCallbackReq: commonCallbackReq,
|
||||
GroupID: msg.MsgData.GroupID,
|
||||
}
|
||||
resp := &cbApi.CallbackAfterSendGroupMsgResp{CommonCallbackResp: &callbackResp}
|
||||
defer log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), req, *resp)
|
||||
if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackAfterSendGroupMsgCommand, req, resp, config.Config.Callback.CallbackAfterSendGroupMsg.CallbackTimeOut); err != nil {
|
||||
callbackResp.ErrCode = http2.StatusInternalServerError
|
||||
callbackResp.ErrMsg = err.Error()
|
||||
return callbackResp
|
||||
}
|
||||
return callbackResp
|
||||
}
|
||||
func callbackBeforeSendSingleMsg(msg *pbChat.SendMsgReq) cbApi.CommonCallbackResp {
|
||||
|
||||
commonCallbackReq.CallbackCommand = constant.CallbackBeforeSendSingleMsgCommand
|
||||
req := cbApi.CallbackBeforeSendSingleMsgReq{
|
||||
CommonCallbackReq: commonCallbackReq,
|
||||
RecvID: msg.MsgData.RecvID,
|
||||
}
|
||||
resp := &cbApi.CallbackBeforeSendSingleMsgResp{
|
||||
CommonCallbackResp: &callbackResp,
|
||||
}
|
||||
//utils.CopyStructFields(req, msg.MsgData)
|
||||
defer log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), req, *resp)
|
||||
if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackBeforeSendSingleMsgCommand, req, resp, config.Config.Callback.CallbackBeforeSendSingleMsg.CallbackTimeOut); err != nil {
|
||||
callbackResp.ErrCode = http2.StatusInternalServerError
|
||||
callbackResp.ErrMsg = err.Error()
|
||||
if !config.Config.Callback.CallbackBeforeSendSingleMsg.CallbackFailedContinue {
|
||||
callbackResp.ActionCode = constant.ActionForbidden
|
||||
return callbackResp
|
||||
} else {
|
||||
callbackResp.ActionCode = constant.ActionAllow
|
||||
return callbackResp
|
||||
}
|
||||
}
|
||||
return callbackResp
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user