You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/internal/rpc/msg/extend_msg_callback.go

89 lines
3.8 KiB

package msg
import (
2 years ago
"context"
2 years ago
cbapi "github.com/OpenIMSDK/Open-IM-Server/pkg/callbackstruct"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/http"
2 years ago
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/mcontext"
2 years ago
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/msg"
)
2 years ago
func callbackSetMessageReactionExtensions(ctx context.Context, setReq *msg.SetMessageReactionExtensionsReq) error {
2 years ago
if !config.Config.Callback.CallbackAfterSendGroupMsg.Enable {
return nil
}
req := &cbapi.CallbackBeforeSetMessageReactionExtReq{
2 years ago
OperationID: mcontext.GetOperationID(ctx),
CallbackCommand: constant.CallbackBeforeSetMessageReactionExtensionCommand,
ConversationID: setReq.ConversationID,
2 years ago
OpUserID: mcontext.GetOpUserID(ctx),
SessionType: setReq.SessionType,
2 years ago
ReactionExtensionList: setReq.ReactionExtensions,
ClientMsgID: setReq.ClientMsgID,
IsReact: setReq.IsReact,
IsExternalExtensions: setReq.IsExternalExtensions,
MsgFirstModifyTime: setReq.MsgFirstModifyTime,
}
2 years ago
resp := &cbapi.CallbackBeforeSetMessageReactionExtResp{}
1 year ago
if err := http.CallBackPostReturn(ctx, cbURL(), req, resp, config.Config.Callback.CallbackAfterSendGroupMsg); err != nil {
2 years ago
return err
}
setReq.MsgFirstModifyTime = resp.MsgFirstModifyTime
return nil
}
1 year ago
func callbackDeleteMessageReactionExtensions(ctx context.Context, setReq *msg.DeleteMessagesReactionExtensionsReq) error {
2 years ago
if !config.Config.Callback.CallbackAfterSendGroupMsg.Enable {
return nil
}
req := &cbapi.CallbackDeleteMessageReactionExtReq{
OperationID: setReq.OperationID,
CallbackCommand: constant.CallbackBeforeDeleteMessageReactionExtensionsCommand,
ConversationID: setReq.ConversationID,
OpUserID: setReq.OpUserID,
SessionType: setReq.SessionType,
2 years ago
ReactionExtensionList: setReq.ReactionExtensions,
ClientMsgID: setReq.ClientMsgID,
IsExternalExtensions: setReq.IsExternalExtensions,
MsgFirstModifyTime: setReq.MsgFirstModifyTime,
}
2 years ago
resp := &cbapi.CallbackDeleteMessageReactionExtResp{}
1 year ago
return http.CallBackPostReturn(ctx, cbURL(), req, resp, config.Config.Callback.CallbackAfterSendGroupMsg)
}
2 years ago
func callbackGetMessageListReactionExtensions(ctx context.Context, getReq *msg.GetMessagesReactionExtensionsReq) error {
2 years ago
if !config.Config.Callback.CallbackAfterSendGroupMsg.Enable {
return nil
}
2 years ago
req := &cbapi.CallbackGetMessageListReactionExtReq{
2 years ago
OperationID: mcontext.GetOperationID(ctx),
2 years ago
CallbackCommand: constant.CallbackGetMessageListReactionExtensionsCommand,
ConversationID: getReq.ConversationID,
2 years ago
OpUserID: mcontext.GetOperationID(ctx),
2 years ago
SessionType: getReq.SessionType,
2 years ago
TypeKeyList: getReq.TypeKeys,
2 years ago
}
2 years ago
resp := &cbapi.CallbackGetMessageListReactionExtResp{}
1 year ago
return http.CallBackPostReturn(ctx, cbURL(), req, resp, config.Config.Callback.CallbackAfterSendGroupMsg)
2 years ago
}
2 years ago
func callbackAddMessageReactionExtensions(ctx context.Context, setReq *msg.ModifyMessageReactionExtensionsReq) error {
2 years ago
req := &cbapi.CallbackAddMessageReactionExtReq{
2 years ago
OperationID: mcontext.GetOperationID(ctx),
2 years ago
CallbackCommand: constant.CallbackAddMessageListReactionExtensionsCommand,
ConversationID: setReq.ConversationID,
2 years ago
OpUserID: mcontext.GetOperationID(ctx),
2 years ago
SessionType: setReq.SessionType,
2 years ago
ReactionExtensionList: setReq.ReactionExtensions,
2 years ago
ClientMsgID: setReq.ClientMsgID,
IsReact: setReq.IsReact,
IsExternalExtensions: setReq.IsExternalExtensions,
MsgFirstModifyTime: setReq.MsgFirstModifyTime,
}
2 years ago
resp := &cbapi.CallbackAddMessageReactionExtResp{}
1 year ago
return http.CallBackPostReturn(ctx, cbURL(), req, resp, config.Config.Callback.CallbackAfterSendGroupMsg)
2 years ago
}