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/pkg/common/constant/constant.go

328 lines
9.5 KiB

package constant
const (
///ContentType
//UserRelated
Text = 101
Picture = 102
Voice = 103
Video = 104
File = 105
AtText = 106
Merger = 107
Card = 108
Location = 109
Custom = 110
Revoke = 111
HasReadReceipt = 112
Typing = 113
Quote = 114
GroupHasReadReceipt = 116
AdvancedText = 117
AdvancedRevoke = 118 //影响前者消息
CustomNotTriggerConversation = 119
CustomOnlineOnly = 120
2 years ago
ReactionMessageModifier = 121
ReactionMessageDeleter = 122
2 years ago
Common = 200
GroupMsg = 201
SignalMsg = 202
CustomNotification = 203
//SysRelated
3 years ago
NotificationBegin = 1000
DeleteMessageNotification = 1100
3 years ago
FriendApplicationApprovedNotification = 1201 //add_friend_response
FriendApplicationRejectedNotification = 1202 //add_friend_response
FriendApplicationNotification = 1203 //add_friend
3 years ago
FriendAddedNotification = 1204
3 years ago
FriendDeletedNotification = 1205 //delete_friend
FriendRemarkSetNotification = 1206 //set_friend_remark?
BlackAddedNotification = 1207 //add_black
BlackDeletedNotification = 1208 //remove_black
FriendInfoUpdatedNotification = 1209
ConversationOptChangeNotification = 1300 // change conversation opt
3 years ago
UserNotificationBegin = 1301
2 years ago
UserInfoUpdatedNotification = 1303 //SetSelfInfoTip = 204
UserNotificationEnd = 1399
OANotification = 1400
3 years ago
GroupNotificationBegin = 1500
3 years ago
2 years ago
GroupCreatedNotification = 1501
GroupInfoSetNotification = 1502
JoinGroupApplicationNotification = 1503
MemberQuitNotification = 1504
GroupApplicationAcceptedNotification = 1505
GroupApplicationRejectedNotification = 1506
GroupOwnerTransferredNotification = 1507
MemberKickedNotification = 1508
MemberInvitedNotification = 1509
MemberEnterNotification = 1510
GroupDismissedNotification = 1511
GroupMemberMutedNotification = 1512
GroupMemberCancelMutedNotification = 1513
GroupMutedNotification = 1514
GroupCancelMutedNotification = 1515
GroupMemberInfoSetNotification = 1516
GroupMemberSetToAdminNotification = 1517
GroupMemberSetToOrdinaryUserNotification = 1518
3 years ago
SignalingNotificationBegin = 1600
SignalingNotification = 1601
3 years ago
SignalingNotificationEnd = 1649
SuperGroupNotificationBegin = 1650
3 years ago
SuperGroupUpdateNotification = 1651
2 years ago
MsgDeleteNotification = 1652
3 years ago
SuperGroupNotificationEnd = 1699
ConversationPrivateChatNotification = 1701
2 years ago
ConversationUnreadNotification = 1702
2 years ago
BusinessNotificationBegin = 2000
BusinessNotification = 2001
BusinessNotificationEnd = 2099
3 years ago
NotificationEnd = 3000
3 years ago
//status
MsgNormal = 1
3 years ago
MsgDeleted = 4
3 years ago
//MsgFrom
UserMsgType = 100
SysMsgType = 200
//SessionType
3 years ago
SingleChatType = 1
GroupChatType = 2
SuperGroupChatType = 3
NotificationChatType = 4
//token
NormalToken = 0
InValidToken = 1
KickedToken = 2
ExpiredToken = 3
//MultiTerminalLogin
3 years ago
//Full-end login, but the same end is mutually exclusive
AllLoginButSameTermKick = 1
3 years ago
//Only one of the endpoints can log in
SingleTerminalLogin = 2
3 years ago
//The web side can be online at the same time, and the other side can only log in at one end
WebAndOther = 3
3 years ago
//The PC side is mutually exclusive, and the mobile side is mutually exclusive, but the web side can be online at the same time
PcMobileAndWeb = 4
//The PC terminal can be online at the same time,but other terminal only one of the endpoints can login
PCAndOther = 5
3 years ago
OnlineStatus = "online"
OfflineStatus = "offline"
Registered = "registered"
UnRegistered = "unregistered"
//MsgReceiveOpt
ReceiveMessage = 0
NotReceiveMessage = 1
ReceiveNotNotifyMessage = 2
//OptionsKey
3 years ago
IsHistory = "history"
IsPersistent = "persistent"
IsOfflinePush = "offlinePush"
IsUnreadCount = "unreadCount"
IsConversationUpdate = "conversationUpdate"
IsSenderSync = "senderSync"
IsNotPrivate = "notPrivate"
IsSenderConversationUpdate = "senderConversationUpdate"
IsSenderNotificationPush = "senderNotificationPush"
IsReactionFromCache = "reactionFromCache"
3 years ago
//GroupStatus
3 years ago
GroupOk = 0
GroupBanChat = 1
GroupStatusDismissed = 2
3 years ago
GroupStatusMuted = 3
3 years ago
3 years ago
//GroupType
2 years ago
NormalGroup = 0
SuperGroup = 1
WorkingGroup = 2
3 years ago
3 years ago
GroupBaned = 3
3 years ago
GroupBanPrivateChat = 4
3 years ago
3 years ago
//UserJoinGroupSource
JoinByAdmin = 1
3 years ago
JoinByInvitation = 2
JoinBySearch = 3
JoinByQRCode = 4
3 years ago
//Minio
MinioDurationTimes = 3600
//Aws
AwsDurationTimes = 3600
3 years ago
// verificationCode used for
VerificationCodeForRegister = 1
VerificationCodeForReset = 2
3 years ago
VerificationCodeForRegisterSuffix = "_forRegister"
VerificationCodeForResetSuffix = "_forReset"
3 years ago
//callbackCommand
2 years ago
CallbackBeforeSendSingleMsgCommand = "callbackBeforeSendSingleMsgCommand"
CallbackAfterSendSingleMsgCommand = "callbackAfterSendSingleMsgCommand"
CallbackBeforeSendGroupMsgCommand = "callbackBeforeSendGroupMsgCommand"
CallbackAfterSendGroupMsgCommand = "callbackAfterSendGroupMsgCommand"
CallbackMsgModifyCommand = "callbackMsgModifyCommand"
CallbackUserOnlineCommand = "callbackUserOnlineCommand"
CallbackUserOfflineCommand = "callbackUserOfflineCommand"
CallbackUserKickOffCommand = "callbackUserKickOffCommand"
CallbackOfflinePushCommand = "callbackOfflinePushCommand"
CallbackOnlinePushCommand = "callbackOnlinePushCommand"
CallbackSuperGroupOnlinePushCommand = "callbackSuperGroupOnlinePushCommand"
CallbackBeforeAddFriendCommand = "callbackBeforeAddFriendCommand"
CallbackBeforeCreateGroupCommand = "callbackBeforeCreateGroupCommand"
CallbackBeforeMemberJoinGroupCommand = "callbackBeforeMemberJoinGroupCommand"
CallbackBeforeSetGroupMemberInfoCommand = "CallbackBeforeSetGroupMemberInfoCommand"
CallbackBeforeSetMessageReactionExtensionCommand = "callbackBeforeSetMessageReactionExtensionCommand"
CallbackBeforeDeleteMessageReactionExtensionsCommand = "callbackBeforeDeleteMessageReactionExtensionsCommand"
2 years ago
CallbackGetMessageListReactionExtensionsCommand = "callbackGetMessageListReactionExtensionsCommand"
CallbackAddMessageListReactionExtensionsCommand = "callbackAddMessageListReactionExtensionsCommand"
3 years ago
//callback actionCode
3 years ago
ActionAllow = 0
3 years ago
ActionForbidden = 1
3 years ago
//callback callbackHandleCode
CallbackHandleSuccess = 0
3 years ago
CallbackHandleFailed = 1
3 years ago
// minioUpload
OtherType = 1
VideoType = 2
3 years ago
ImageType = 3
3 years ago
2 years ago
// sendMsgStaus
MsgStatusNotExist = 0
MsgIsSending = 1
MsgSendSuccessed = 2
MsgSendFailed = 3
)
2 years ago
2 years ago
const (
WriteDiffusion = 0
ReadDiffusion = 1
)
const (
2 years ago
AtAllString = "AtAllTag"
AtNormal = 0
AtMe = 1
AtAll = 2
AtAllAtMe = 3
GroupNotification = 4
)
var ContentType2PushContent = map[int64]string{
Picture: "[图片]",
Voice: "[语音]",
Video: "[视频]",
File: "[文件]",
Text: "你收到了一条文本消息",
AtText: "[有人@你]",
GroupMsg: "你收到一条群聊消息",
Common: "你收到一条新消息",
2 years ago
SignalMsg: "音视频通话邀请",
}
3 years ago
const (
FieldRecvMsgOpt = 1
FieldIsPinned = 2
FieldAttachedInfo = 3
FieldIsPrivateChat = 4
FieldGroupAtType = 5
FieldIsNotInGroup = 6
FieldEx = 7
FieldUnread = 8
FieldBurnDuration = 9
3 years ago
)
3 years ago
const (
AppOrdinaryUsers = 1
AppAdmin = 2
GroupOrdinaryUsers = 1
GroupOwner = 2
GroupAdmin = 3
3 years ago
GroupResponseAgree = 1
GroupResponseRefuse = -1
3 years ago
FriendResponseAgree = 1
FriendResponseRefuse = -1
3 years ago
Male = 1
Female = 2
)
2 years ago
const OperationID = "operationID"
const OpUserID = "opUserID"
2 years ago
const ConnID = "connID"
2 years ago
const OpUserIDPlatformID = "platformID"
const Token = "token"
2 years ago
3 years ago
const (
UnreliableNotification = 1
ReliableNotificationNoMsg = 2
ReliableNotificationMsg = 3
)
const (
BecomeFriendByImport = 1 //管理员导入
BecomeFriendByApply = 2 //申请添加
)
3 years ago
const (
ApplyNeedVerificationInviteDirectly = 0 // 申请需要同意 邀请直接进
AllNeedVerification = 1 //所有人进群需要验证,除了群主管理员邀请进群
Directly = 2 //直接进群
)
2 years ago
const (
GroupRPCRecvSize = 30
GroupRPCSendSize = 30
)
const FriendAcceptTip = "You have successfully become friends, so start chatting"
3 years ago
func GroupIsBanChat(status int32) bool {
3 years ago
if status != GroupStatusMuted {
3 years ago
return false
}
return true
}
func GroupIsBanPrivateChat(status int32) bool {
if status != GroupBanPrivateChat {
return false
}
return true
3 years ago
}
3 years ago
3 years ago
const LogFileName = "OpenIM.log"
3 years ago
2 years ago
const LocalHost = "0.0.0.0"
2 years ago
// flag parse
const (
2 years ago
FlagPort = "port"
FlagWsPort = "ws_port"
FlagPrometheusPort = "prometheus_port"
FlagConf = "config_folder_path"
2 years ago
)