mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-01 07:35:58 +08:00
group info set
This commit is contained in:
@@ -58,6 +58,20 @@ func (rpc *rpcAuth) UserToken(_ context.Context, req *pbAuth.UserTokenReq) (*pbA
|
||||
return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{}, Token: tokens, ExpiredTime: expTime}, nil
|
||||
}
|
||||
|
||||
func (rpc *rpcAuth) ForceLogout(_ context.Context, req *pbAuth.ForceLogoutReq) (*pbAuth.ForceLogoutResp, error) {
|
||||
//log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " rpc args ", req.String())
|
||||
//err := token_verify.DeleteToken(req.FromUserID, int(req.Platform))
|
||||
//if err != nil {
|
||||
// errMsg := req.OperationID + " imdb.DeleteToken failed " + err.Error() + req.FromUserID + utils.Int32ToString(req.Platform)
|
||||
// log.NewError(req.OperationID, errMsg)
|
||||
// return &pbAuth.ForceLogoutResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}}, nil
|
||||
//}
|
||||
//
|
||||
//return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{}, Token: tokens, ExpiredTime: expTime}, nil
|
||||
return nil, nil
|
||||
|
||||
}
|
||||
|
||||
type rpcAuth struct {
|
||||
rpcPort int
|
||||
rpcRegisterName string
|
||||
|
||||
@@ -887,17 +887,25 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
|
||||
|
||||
////bitwise operators: 0001:groupName; 0010:Notification 0100:Introduction; 1000:FaceUrl; 10000:owner
|
||||
var changedType int32
|
||||
groupName := ""
|
||||
notification := ""
|
||||
introduction := ""
|
||||
faceURL := ""
|
||||
if group.GroupName != req.GroupInfo.GroupName && req.GroupInfo.GroupName != "" {
|
||||
changedType = 1
|
||||
groupName = req.GroupInfo.GroupName
|
||||
}
|
||||
if group.Notification != req.GroupInfo.Notification && req.GroupInfo.Notification != "" {
|
||||
changedType = changedType | (1 << 1)
|
||||
notification = req.GroupInfo.Notification
|
||||
}
|
||||
if group.Introduction != req.GroupInfo.Introduction && req.GroupInfo.Introduction != "" {
|
||||
changedType = changedType | (1 << 2)
|
||||
introduction = req.GroupInfo.Introduction
|
||||
}
|
||||
if group.FaceURL != req.GroupInfo.FaceURL && req.GroupInfo.FaceURL != "" {
|
||||
changedType = changedType | (1 << 3)
|
||||
faceURL = req.GroupInfo.FaceURL
|
||||
}
|
||||
//only administrators can set group information
|
||||
var groupInfo db.Group
|
||||
@@ -909,7 +917,7 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
|
||||
}
|
||||
log.NewInfo(req.OperationID, "SetGroupInfo rpc return ", pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{}})
|
||||
if changedType != 0 {
|
||||
chat.GroupInfoSetNotification(req.OperationID, req.OpUserID, req.GroupInfo.GroupID)
|
||||
chat.GroupInfoSetNotification(req.OperationID, req.OpUserID, req.GroupInfo.GroupID, groupName, notification, introduction, faceURL)
|
||||
}
|
||||
return &pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{}}, nil
|
||||
}
|
||||
|
||||
@@ -225,12 +225,20 @@ func GroupCreatedNotification(operationID, opUserID, groupID string, initMemberL
|
||||
}
|
||||
|
||||
//群信息改变后掉用
|
||||
func GroupInfoSetNotification(operationID, opUserID, groupID string) {
|
||||
//groupName := ""
|
||||
// notification := ""
|
||||
// introduction := ""
|
||||
// faceURL := ""
|
||||
func GroupInfoSetNotification(operationID, opUserID, groupID string, groupName, notification, introduction, faceURL string) {
|
||||
GroupInfoChangedTips := open_im_sdk.GroupInfoSetTips{Group: &open_im_sdk.GroupInfo{}, OpUser: &open_im_sdk.GroupMemberFullInfo{}}
|
||||
if err := setGroupInfo(groupID, GroupInfoChangedTips.Group); err != nil {
|
||||
log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID)
|
||||
return
|
||||
}
|
||||
GroupInfoChangedTips.Group.GroupName = groupName
|
||||
GroupInfoChangedTips.Group.Notification = notification
|
||||
GroupInfoChangedTips.Group.Introduction = introduction
|
||||
GroupInfoChangedTips.Group.FaceURL = faceURL
|
||||
if err := setOpUserInfo(opUserID, groupID, GroupInfoChangedTips.OpUser); err != nil {
|
||||
log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user