|
|
@ -4,6 +4,7 @@ import (
|
|
|
|
"Open_IM/pkg/common/config"
|
|
|
|
"Open_IM/pkg/common/config"
|
|
|
|
"Open_IM/pkg/common/constant"
|
|
|
|
"Open_IM/pkg/common/constant"
|
|
|
|
"Open_IM/pkg/common/db"
|
|
|
|
"Open_IM/pkg/common/db"
|
|
|
|
|
|
|
|
rocksCache "Open_IM/pkg/common/db/rocks_cache"
|
|
|
|
"Open_IM/pkg/common/log"
|
|
|
|
"Open_IM/pkg/common/log"
|
|
|
|
"Open_IM/pkg/common/token_verify"
|
|
|
|
"Open_IM/pkg/common/token_verify"
|
|
|
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
|
|
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
|
|
@ -69,14 +70,14 @@ func isMessageHasReadEnabled(pb *pbChat.SendMsgReq) (bool, int32, string) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func messageVerification(data *pbChat.SendMsgReq) (bool, int32, string, []string) {
|
|
|
|
func messageVerification(data *pbChat.SendMsgReq) (bool, int32, string, []string) {
|
|
|
|
switch data.MsgData.SessionType {
|
|
|
|
|
|
|
|
case constant.SingleChatType:
|
|
|
|
|
|
|
|
if utils.IsContain(data.MsgData.SendID, config.Config.Manager.AppManagerUid) {
|
|
|
|
if utils.IsContain(data.MsgData.SendID, config.Config.Manager.AppManagerUid) {
|
|
|
|
return true, 0, "", nil
|
|
|
|
return true, 0, "", nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if data.MsgData.ContentType <= constant.NotificationEnd && data.MsgData.ContentType >= constant.NotificationBegin {
|
|
|
|
if data.MsgData.ContentType <= constant.NotificationEnd && data.MsgData.ContentType >= constant.NotificationBegin {
|
|
|
|
return true, 0, "", nil
|
|
|
|
return true, 0, "", nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch data.MsgData.SessionType {
|
|
|
|
|
|
|
|
case constant.SingleChatType:
|
|
|
|
log.NewDebug(data.OperationID, config.Config.MessageVerify.FriendVerify)
|
|
|
|
log.NewDebug(data.OperationID, config.Config.MessageVerify.FriendVerify)
|
|
|
|
reqGetBlackIDListFromCache := &cacheRpc.GetBlackIDListFromCacheReq{UserID: data.MsgData.RecvID, OperationID: data.OperationID}
|
|
|
|
reqGetBlackIDListFromCache := &cacheRpc.GetBlackIDListFromCacheReq{UserID: data.MsgData.RecvID, OperationID: data.OperationID}
|
|
|
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID)
|
|
|
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID)
|
|
|
@ -128,6 +129,13 @@ func messageVerification(data *pbChat.SendMsgReq) (bool, int32, string, []string
|
|
|
|
case constant.GroupChatType:
|
|
|
|
case constant.GroupChatType:
|
|
|
|
fallthrough
|
|
|
|
fallthrough
|
|
|
|
case constant.SuperGroupChatType:
|
|
|
|
case constant.SuperGroupChatType:
|
|
|
|
|
|
|
|
groupInfo, err := rocksCache.GetGroupInfoFromCache(data.MsgData.GroupID)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return false, 201, err.Error(), nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if groupInfo.GroupType == constant.SuperGroup {
|
|
|
|
|
|
|
|
return true, 0, "", nil
|
|
|
|
|
|
|
|
} else {
|
|
|
|
getGroupMemberIDListFromCacheReq := &pbCache.GetGroupMemberIDListFromCacheReq{OperationID: data.OperationID, GroupID: data.MsgData.GroupID}
|
|
|
|
getGroupMemberIDListFromCacheReq := &pbCache.GetGroupMemberIDListFromCacheReq{OperationID: data.OperationID, GroupID: data.MsgData.GroupID}
|
|
|
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID)
|
|
|
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID)
|
|
|
|
if etcdConn == nil {
|
|
|
|
if etcdConn == nil {
|
|
|
@ -155,7 +163,7 @@ func messageVerification(data *pbChat.SendMsgReq) (bool, int32, string, []string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true, 0, "", cacheResp.UserIDList
|
|
|
|
return true, 0, "", cacheResp.UserIDList
|
|
|
|
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return true, 0, "", nil
|
|
|
|
return true, 0, "", nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|