mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-06 12:37:07 +08:00
fix: merge
This commit is contained in:
parent
57fe356414
commit
54db5c6fd4
@ -434,37 +434,37 @@ callback:
|
|||||||
timeout: ${CALLBACK_TIMEOUT}
|
timeout: ${CALLBACK_TIMEOUT}
|
||||||
failedContinue: ${CALLBACK_FAILED_CONTINUE}
|
failedContinue: ${CALLBACK_FAILED_CONTINUE}
|
||||||
afterGroupMsgRead:
|
afterGroupMsgRead:
|
||||||
enable: false
|
enable: ${CALLBACK_ENABLE}
|
||||||
timeout: 5
|
timeout: ${CALLBACK_TIMEOUT}
|
||||||
failedContinue: true
|
failedContinue: ${CALLBACK_FAILED_CONTINUE}
|
||||||
afterGroupMsgRevoke:
|
afterGroupMsgRevoke:
|
||||||
enable: false
|
enable: ${CALLBACK_ENABLE}
|
||||||
timeout: 5
|
timeout: 5
|
||||||
failedContinue: true
|
failedContinue: true
|
||||||
afterJoinGroup:
|
afterJoinGroup:
|
||||||
enable: false
|
enable: ${CALLBACK_ENABLE}
|
||||||
timeout: 5
|
timeout: 5
|
||||||
failedContinue: true
|
failedContinue: true
|
||||||
beforeInviteUserToGroup:
|
beforeInviteUserToGroup:
|
||||||
enable: false
|
enable: ${CALLBACK_ENABLE}
|
||||||
timeout: 5
|
timeout: 5
|
||||||
failedContinue: true
|
failedContinue: true
|
||||||
|
|
||||||
joinGroupAfter:
|
joinGroupAfter:
|
||||||
enable: false
|
enable: ${CALLBACK_ENABLE}
|
||||||
timeout: 5
|
timeout: 5
|
||||||
failedContinue: true
|
failedContinue: true
|
||||||
##TODO CALLBACK
|
##TODO CALLBACK
|
||||||
setGroupInfoAfter:
|
setGroupInfoAfter:
|
||||||
enable: false
|
enable: ${CALLBACK_ENABLE}
|
||||||
timeout: 5
|
timeout: 5
|
||||||
failedContinue: true
|
failedContinue: true
|
||||||
setGroupInfoBefore:
|
setGroupInfoBefore:
|
||||||
enable: false
|
enable: ${CALLBACK_ENABLE}
|
||||||
timeout: 5
|
timeout: 5
|
||||||
failedContinue: true
|
failedContinue: true
|
||||||
revokeMsgAfter:
|
revokeMsgAfter:
|
||||||
enable: false
|
enable: ${CALLBACK_ENABLE}
|
||||||
timeout: 5
|
timeout: 5
|
||||||
failedContinue: true
|
failedContinue: true
|
||||||
addBlackBefore:
|
addBlackBefore:
|
||||||
|
|||||||
@ -16,6 +16,7 @@ package group
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"github.com/OpenIMSDK/tools/errs"
|
||||||
"github.com/OpenIMSDK/tools/log"
|
"github.com/OpenIMSDK/tools/log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -192,6 +193,8 @@ func CallbackBeforeSetGroupMemberInfo(ctx context.Context, req *group.SetGroupMe
|
|||||||
if resp.Ex != nil {
|
if resp.Ex != nil {
|
||||||
req.Ex = wrapperspb.String(*resp.Ex)
|
req.Ex = wrapperspb.String(*resp.Ex)
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
func CallbackAfterSetGroupMemberInfo(ctx context.Context, req *group.SetGroupMemberInfo) (err error) {
|
func CallbackAfterSetGroupMemberInfo(ctx context.Context, req *group.SetGroupMemberInfo) (err error) {
|
||||||
if !config.Config.Callback.CallbackBeforeSetGroupMemberInfo.Enable {
|
if !config.Config.Callback.CallbackBeforeSetGroupMemberInfo.Enable {
|
||||||
return nil
|
return nil
|
||||||
@ -297,5 +300,144 @@ func CallbackTransferGroupOwnerAfter(ctx context.Context, req *pbgroup.TransferG
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
func CallbackBeforeInviteUserToGroup(ctx context.Context, req *group.InviteUserToGroupReq) (err error) {
|
||||||
|
if !config.Config.Callback.CallbackBeforeInviteUserToGroup.Enable {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
callbackReq := &callbackstruct.CallbackBeforeInviteUserToGroupReq{
|
||||||
|
CallbackCommand: callbackstruct.CallbackBeforeInviteJoinGroupCommand,
|
||||||
|
OperationID: mcontext.GetOperationID(ctx),
|
||||||
|
GroupID: req.GroupID,
|
||||||
|
Reason: req.Reason,
|
||||||
|
InvitedUserIDs: req.InvitedUserIDs,
|
||||||
|
}
|
||||||
|
|
||||||
|
resp := &callbackstruct.CallbackBeforeInviteUserToGroupResp{}
|
||||||
|
err = http.CallBackPostReturn(
|
||||||
|
ctx,
|
||||||
|
config.Config.Callback.CallbackUrl,
|
||||||
|
callbackReq,
|
||||||
|
resp,
|
||||||
|
config.Config.Callback.CallbackBeforeInviteUserToGroup,
|
||||||
|
)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(resp.RefusedMembersAccount) > 0 {
|
||||||
|
// Handle the scenario where certain members are refused
|
||||||
|
// You might want to update the req.Members list or handle it as per your business logic
|
||||||
|
}
|
||||||
|
utils.StructFieldNotNilReplace(req, resp)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func CallbackAfterJoinGroup(ctx context.Context, req *group.JoinGroupReq) error {
|
||||||
|
if !config.Config.Callback.CallbackAfterJoinGroup.Enable {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
callbackReq := &callbackstruct.CallbackAfterJoinGroupReq{
|
||||||
|
CallbackCommand: callbackstruct.CallbackAfterJoinGroupCommand,
|
||||||
|
OperationID: mcontext.GetOperationID(ctx),
|
||||||
|
GroupID: req.GroupID,
|
||||||
|
ReqMessage: req.ReqMessage,
|
||||||
|
JoinSource: req.JoinSource,
|
||||||
|
InviterUserID: req.InviterUserID,
|
||||||
|
}
|
||||||
|
resp := &callbackstruct.CallbackAfterJoinGroupResp{}
|
||||||
|
if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, callbackReq, resp, config.Config.Callback.CallbackAfterJoinGroup); err != nil {
|
||||||
|
if err == errs.ErrCallbackContinue {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func CallbackBeforeSetGroupInfo(ctx context.Context, req *group.SetGroupInfoReq) error {
|
||||||
|
if !config.Config.Callback.CallbackBeforeSetGroupInfo.Enable {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
callbackReq := &callbackstruct.CallbackBeforeSetGroupInfoReq{
|
||||||
|
CallbackCommand: callbackstruct.CallbackBeforeSetGroupInfoCommand,
|
||||||
|
GroupID: req.GroupInfoForSet.GroupID,
|
||||||
|
Notification: req.GroupInfoForSet.Notification,
|
||||||
|
Introduction: req.GroupInfoForSet.Introduction,
|
||||||
|
FaceURL: req.GroupInfoForSet.FaceURL,
|
||||||
|
GroupName: req.GroupInfoForSet.GroupName,
|
||||||
|
}
|
||||||
|
|
||||||
|
if req.GroupInfoForSet.Ex != nil {
|
||||||
|
callbackReq.Ex = req.GroupInfoForSet.Ex.Value
|
||||||
|
}
|
||||||
|
log.ZDebug(ctx, "debug CallbackBeforeSetGroupInfo", callbackReq.Ex)
|
||||||
|
if req.GroupInfoForSet.NeedVerification != nil {
|
||||||
|
callbackReq.NeedVerification = req.GroupInfoForSet.NeedVerification.Value
|
||||||
|
}
|
||||||
|
if req.GroupInfoForSet.LookMemberInfo != nil {
|
||||||
|
callbackReq.LookMemberInfo = req.GroupInfoForSet.LookMemberInfo.Value
|
||||||
|
}
|
||||||
|
if req.GroupInfoForSet.ApplyMemberFriend != nil {
|
||||||
|
callbackReq.ApplyMemberFriend = req.GroupInfoForSet.ApplyMemberFriend.Value
|
||||||
|
}
|
||||||
|
resp := &callbackstruct.CallbackBeforeSetGroupInfoResp{}
|
||||||
|
|
||||||
|
if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, callbackReq, resp, config.Config.Callback.CallbackBeforeSetGroupInfo); err != nil {
|
||||||
|
if err == errs.ErrCallbackContinue {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if resp.Ex != nil {
|
||||||
|
req.GroupInfoForSet.Ex = wrapperspb.String(*resp.Ex)
|
||||||
|
}
|
||||||
|
if resp.NeedVerification != nil {
|
||||||
|
req.GroupInfoForSet.NeedVerification = wrapperspb.Int32(*resp.NeedVerification)
|
||||||
|
}
|
||||||
|
if resp.LookMemberInfo != nil {
|
||||||
|
req.GroupInfoForSet.LookMemberInfo = wrapperspb.Int32(*resp.LookMemberInfo)
|
||||||
|
}
|
||||||
|
if resp.ApplyMemberFriend != nil {
|
||||||
|
req.GroupInfoForSet.ApplyMemberFriend = wrapperspb.Int32(*resp.ApplyMemberFriend)
|
||||||
|
}
|
||||||
|
utils.StructFieldNotNilReplace(req, resp)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func CallbackAfterSetGroupInfo(ctx context.Context, req *group.SetGroupInfoReq) error {
|
||||||
|
if !config.Config.Callback.CallbackAfterSetGroupInfo.Enable {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
callbackReq := &callbackstruct.CallbackAfterSetGroupInfoReq{
|
||||||
|
CallbackCommand: callbackstruct.CallbackAfterSetGroupInfoCommand,
|
||||||
|
GroupID: req.GroupInfoForSet.GroupID,
|
||||||
|
Notification: req.GroupInfoForSet.Notification,
|
||||||
|
Introduction: req.GroupInfoForSet.Introduction,
|
||||||
|
FaceURL: req.GroupInfoForSet.FaceURL,
|
||||||
|
GroupName: req.GroupInfoForSet.GroupName,
|
||||||
|
}
|
||||||
|
if req.GroupInfoForSet.Ex != nil {
|
||||||
|
callbackReq.Ex = &req.GroupInfoForSet.Ex.Value
|
||||||
|
}
|
||||||
|
if req.GroupInfoForSet.NeedVerification != nil {
|
||||||
|
callbackReq.NeedVerification = &req.GroupInfoForSet.NeedVerification.Value
|
||||||
|
}
|
||||||
|
if req.GroupInfoForSet.LookMemberInfo != nil {
|
||||||
|
callbackReq.LookMemberInfo = &req.GroupInfoForSet.LookMemberInfo.Value
|
||||||
|
}
|
||||||
|
if req.GroupInfoForSet.ApplyMemberFriend != nil {
|
||||||
|
callbackReq.ApplyMemberFriend = &req.GroupInfoForSet.ApplyMemberFriend.Value
|
||||||
|
}
|
||||||
|
resp := &callbackstruct.CallbackAfterSetGroupInfoResp{}
|
||||||
|
if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, callbackReq, resp, config.Config.Callback.CallbackAfterSetGroupInfo); err != nil {
|
||||||
|
if err == errs.ErrCallbackContinue {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
utils.StructFieldNotNilReplace(req, resp)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,16 +17,14 @@ package msg
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/OpenIMSDK/protocol/sdkws"
|
"github.com/OpenIMSDK/protocol/sdkws"
|
||||||
|
"github.com/OpenIMSDK/tools/errs"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
|
|
||||||
"github.com/OpenIMSDK/protocol/constant"
|
"github.com/OpenIMSDK/protocol/constant"
|
||||||
pbchat "github.com/OpenIMSDK/protocol/msg"
|
pbchat "github.com/OpenIMSDK/protocol/msg"
|
||||||
"github.com/OpenIMSDK/tools/errs"
|
|
||||||
"github.com/OpenIMSDK/tools/log"
|
"github.com/OpenIMSDK/tools/log"
|
||||||
"github.com/OpenIMSDK/tools/mcontext"
|
"github.com/OpenIMSDK/tools/mcontext"
|
||||||
"github.com/OpenIMSDK/tools/utils"
|
"github.com/OpenIMSDK/tools/utils"
|
||||||
"google.golang.org/protobuf/proto"
|
|
||||||
|
|
||||||
cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"
|
cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"
|
||||||
|
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||||
@ -189,3 +187,23 @@ func CallbackSingleMsgRead(ctx context.Context, req *cbapi.CallbackSingleMsgRead
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
func CallbackAfterRevokeMsg(ctx context.Context, req *pbchat.RevokeMsgReq) error {
|
||||||
|
if !config.Config.Callback.CallbackAfterRevokeMsg.Enable {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
callbackReq := &cbapi.CallbackAfterRevokeMsgReq{
|
||||||
|
CallbackCommand: cbapi.CallbackAfterRevokeMsgCommand,
|
||||||
|
ConversationID: req.ConversationID,
|
||||||
|
Seq: req.Seq,
|
||||||
|
UserID: req.UserID,
|
||||||
|
}
|
||||||
|
resp := &cbapi.CallbackAfterSendGroupMsgResp{}
|
||||||
|
if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, callbackReq, resp, config.Config.Callback.CallbackAfterSetGroupInfo); err != nil {
|
||||||
|
if err == errs.ErrCallbackContinue {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
utils.StructFieldNotNilReplace(req, resp)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|||||||
@ -35,17 +35,6 @@ type CallBackAddFriendReplyBeforeResp struct {
|
|||||||
CommonCallbackResp
|
CommonCallbackResp
|
||||||
}
|
}
|
||||||
|
|
||||||
type CallbackAfterAddFriendReq struct {
|
|
||||||
CallbackCommand `json:"callbackCommand"`
|
|
||||||
FromUserID string `json:"fromUserID" `
|
|
||||||
ToUserID string `json:"toUserID"`
|
|
||||||
ReqMsg string `json:"reqMsg"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type CallbackAfterAddFriendResp struct {
|
|
||||||
CommonCallbackResp
|
|
||||||
}
|
|
||||||
|
|
||||||
type CallbackBeforeSetFriendRemarkReq struct {
|
type CallbackBeforeSetFriendRemarkReq struct {
|
||||||
CallbackCommand `json:"callbackCommand"`
|
CallbackCommand `json:"callbackCommand"`
|
||||||
OwnerUserID string `json:"ownerUserID"`
|
OwnerUserID string `json:"ownerUserID"`
|
||||||
|
|||||||
@ -132,33 +132,6 @@ type CallbackAfterUngroupReq struct {
|
|||||||
type CallbackAfterUngroupResp struct {
|
type CallbackAfterUngroupResp struct {
|
||||||
CommonCallbackResp
|
CommonCallbackResp
|
||||||
}
|
}
|
||||||
|
|
||||||
type CallbackAfterSetGroupInfoReq struct {
|
|
||||||
CallbackCommand `json:"callbackCommand"`
|
|
||||||
GroupID string `json:"groupID"`
|
|
||||||
GroupType *int32 `json:"groupType"`
|
|
||||||
UserID string `json:"userID"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Notification string `json:"notification"`
|
|
||||||
GroupUrl string `json:"groupUrl"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type CallbackAfterSetGroupInfoResp struct {
|
|
||||||
CommonCallbackResp
|
|
||||||
}
|
|
||||||
|
|
||||||
type CallbackAfterRevokeMsgReq struct {
|
|
||||||
CallbackCommand `json:"callbackCommand"`
|
|
||||||
GroupID string `json:"groupID"`
|
|
||||||
GroupType *int32 `json:"groupType"`
|
|
||||||
UserID string `json:"userID"`
|
|
||||||
Content string `json:"content"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type CallbackAfterRevokeMsgResp struct {
|
|
||||||
CommonCallbackResp
|
|
||||||
}
|
|
||||||
|
|
||||||
type CallbackQuitGroupReq struct {
|
type CallbackQuitGroupReq struct {
|
||||||
CallbackCommand `json:"callbackCommand"`
|
CallbackCommand `json:"callbackCommand"`
|
||||||
GroupID string `json:"groupID"`
|
GroupID string `json:"groupID"`
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user