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/friend/callback.go

27 lines
833 B

package friend
import (
cbapi "Open_IM/pkg/callbackstruct"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/http"
"Open_IM/pkg/common/tracelog"
pbfriend "Open_IM/pkg/proto/friend"
"context"
)
func CallbackBeforeAddFriend(ctx context.Context, req *pbfriend.ApplyToAddFriendReq) error {
if !config.Config.Callback.CallbackBeforeAddFriend.Enable {
return nil
}
cbReq := &cbapi.CallbackBeforeAddFriendReq{
CallbackCommand: constant.CallbackBeforeAddFriendCommand,
FromUserID: req.FromUserID,
ToUserID: req.ToUserID,
ReqMsg: req.ReqMsg,
OperationID: tracelog.GetOperationID(ctx),
}
resp := &cbapi.CallbackBeforeAddFriendResp{}
return http.CallBackPostReturn(config.Config.Callback.CallbackUrl, cbReq, resp, config.Config.Callback.CallbackBeforeAddFriend)
}