package 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.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 }