Files
open-im-server/pkg/common/constant/constant.go
T

332 lines
9.7 KiB
Go
Raw Normal View History

2021-05-26 19:37:10 +08:00
package constant
const (
///ContentType
//UserRelated
2022-07-28 18:14:58 +08:00
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
2022-12-11 13:16:24 +08:00
ReactionMessageModifier = 121
ReactionMessageDeleter = 122
2022-07-26 15:16:46 +08:00
Common = 200
GroupMsg = 201
SignalMsg = 202
CustomNotification = 203
2021-05-26 19:37:10 +08:00
//SysRelated
2022-05-25 15:21:53 +08:00
NotificationBegin = 1000
DeleteMessageNotification = 1100
2022-01-16 16:31:28 +08:00
FriendApplicationApprovedNotification = 1201 //add_friend_response
FriendApplicationRejectedNotification = 1202 //add_friend_response
FriendApplicationNotification = 1203 //add_friend
2022-01-16 12:25:41 +08:00
FriendAddedNotification = 1204
2022-01-16 16:31:28 +08:00
FriendDeletedNotification = 1205 //delete_friend
FriendRemarkSetNotification = 1206 //set_friend_remark?
BlackAddedNotification = 1207 //add_black
BlackDeletedNotification = 1208 //remove_black
2022-12-07 10:00:53 +08:00
FriendInfoUpdatedNotification = 1209
2022-03-31 14:50:02 +08:00
ConversationOptChangeNotification = 1300 // change conversation opt
2021-06-28 15:31:36 +08:00
2022-02-22 18:02:00 +08:00
UserNotificationBegin = 1301
2022-12-06 13:06:20 +08:00
UserInfoUpdatedNotification = 1303 //SetSelfInfoTip = 204
2022-02-22 18:02:00 +08:00
UserNotificationEnd = 1399
2022-03-28 15:55:55 +08:00
OANotification = 1400
2021-12-24 15:02:47 +08:00
2022-02-22 18:02:00 +08:00
GroupNotificationBegin = 1500
2022-02-15 14:11:20 +08:00
2022-06-08 15:05:57 +08:00
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
2022-03-14 15:14:14 +08:00
SignalingNotificationBegin = 1600
SignalingNotification = 1601
2022-05-30 12:12:09 +08:00
SignalingNotificationEnd = 1649
SuperGroupNotificationBegin = 1650
2022-05-30 18:23:12 +08:00
SuperGroupUpdateNotification = 1651
2022-08-16 19:15:54 +08:00
MsgDeleteNotification = 1652
2022-05-30 12:12:09 +08:00
SuperGroupNotificationEnd = 1699
2022-03-31 14:50:02 +08:00
ConversationPrivateChatNotification = 1701
2022-08-05 12:08:00 +08:00
ConversationUnreadNotification = 1702
2022-03-31 14:50:02 +08:00
2022-12-07 21:12:48 +08:00
BusinessNotificationBegin = 2000
BusinessNotification = 2001
BusinessNotificationEnd = 2099
2022-05-30 15:10:26 +08:00
NotificationEnd = 3000
2021-05-26 19:37:10 +08:00
2022-03-17 19:00:05 +08:00
//status
MsgNormal = 1
2022-03-17 20:55:47 +08:00
MsgDeleted = 4
2022-03-17 19:00:05 +08:00
2021-05-26 19:37:10 +08:00
//MsgFrom
UserMsgType = 100
SysMsgType = 200
//SessionType
2022-05-28 18:10:08 +08:00
SingleChatType = 1
GroupChatType = 2
SuperGroupChatType = 3
2022-03-28 15:55:55 +08:00
NotificationChatType = 4
2021-11-25 14:12:52 +08:00
//token
NormalToken = 0
InValidToken = 1
KickedToken = 2
ExpiredToken = 3
//MultiTerminalLogin
2022-01-13 18:33:11 +08:00
//Full-end login, but the same end is mutually exclusive
2021-11-25 14:12:52 +08:00
AllLoginButSameTermKick = 1
2022-01-13 18:33:11 +08:00
//Only one of the endpoints can log in
2021-11-25 14:12:52 +08:00
SingleTerminalLogin = 2
2022-01-13 18:33:11 +08:00
//The web side can be online at the same time, and the other side can only log in at one end
2021-11-25 14:12:52 +08:00
WebAndOther = 3
2022-01-13 18:33:11 +08:00
//The PC side is mutually exclusive, and the mobile side is mutually exclusive, but the web side can be online at the same time
2021-11-25 14:12:52 +08:00
PcMobileAndWeb = 4
2022-08-21 16:05:58 +08:00
//The PC terminal can be online at the same time,but other terminal only one of the endpoints can login
PCAndOther = 5
2021-11-29 16:26:57 +08:00
2021-11-29 18:24:39 +08:00
OnlineStatus = "online"
OfflineStatus = "offline"
2021-12-17 14:28:43 +08:00
Registered = "registered"
UnRegistered = "unregistered"
2021-12-06 16:06:19 +08:00
//MsgReceiveOpt
ReceiveMessage = 0
NotReceiveMessage = 1
ReceiveNotNotifyMessage = 2
2021-12-23 17:22:26 +08:00
//OptionsKey
2022-03-28 17:37:30 +08:00
IsHistory = "history"
IsPersistent = "persistent"
IsOfflinePush = "offlinePush"
IsUnreadCount = "unreadCount"
IsConversationUpdate = "conversationUpdate"
IsSenderSync = "senderSync"
IsNotPrivate = "notPrivate"
IsSenderConversationUpdate = "senderConversationUpdate"
2022-05-18 18:37:42 +08:00
IsSenderNotificationPush = "senderNotificationPush"
2022-12-19 11:18:23 +08:00
IsReactionFromCache = "reactionFromCache"
2022-01-26 18:43:01 +08:00
//GroupStatus
2022-03-24 15:33:30 +08:00
GroupOk = 0
GroupBanChat = 1
GroupStatusDismissed = 2
2022-03-28 19:27:05 +08:00
GroupStatusMuted = 3
2022-03-24 15:33:30 +08:00
2022-05-12 19:00:48 +08:00
//GroupType
2022-07-06 15:28:34 +08:00
NormalGroup = 0
SuperGroup = 1
WorkingGroup = 2
2022-05-12 19:00:48 +08:00
2022-02-07 08:44:21 +08:00
GroupBaned = 3
2022-01-26 18:43:01 +08:00
GroupBanPrivateChat = 4
2022-02-07 08:44:21 +08:00
2022-02-07 19:42:09 +08:00
//UserJoinGroupSource
JoinByAdmin = 1
2022-02-19 18:48:15 +08:00
2022-07-12 19:24:06 +08:00
JoinByInvitation = 2
JoinBySearch = 3
JoinByQRCode = 4
2022-02-19 18:48:15 +08:00
//Minio
MinioDurationTimes = 3600
2022-07-31 01:14:26 +08:00
//Aws
AwsDurationTimes = 3600
2022-02-21 16:24:25 +08:00
// verificationCode used for
2022-02-22 18:02:00 +08:00
VerificationCodeForRegister = 1
VerificationCodeForReset = 2
2022-02-21 16:24:25 +08:00
VerificationCodeForRegisterSuffix = "_forRegister"
2022-02-22 18:02:00 +08:00
VerificationCodeForResetSuffix = "_forReset"
2022-02-28 17:57:03 +08:00
//callbackCommand
2023-01-12 15:55:44 +08:00
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"
2022-12-22 17:23:14 +08:00
CallbackBeforeSetMessageReactionExtensionCommand = "callbackBeforeSetMessageReactionExtensionCommand"
CallbackBeforeDeleteMessageReactionExtensionsCommand = "callbackBeforeDeleteMessageReactionExtensionsCommand"
2023-02-22 18:43:40 +08:00
CallbackGetMessageListReactionExtensionsCommand = "callbackGetMessageListReactionExtensionsCommand"
CallbackAddMessageListReactionExtensionsCommand = "callbackAddMessageListReactionExtensionsCommand"
2022-10-19 21:06:48 +08:00
2022-03-04 14:27:54 +08:00
//callback actionCode
2022-03-11 17:29:20 +08:00
ActionAllow = 0
2022-02-28 17:57:03 +08:00
ActionForbidden = 1
2022-03-04 14:27:54 +08:00
//callback callbackHandleCode
2022-03-03 16:41:17 +08:00
CallbackHandleSuccess = 0
2022-03-11 17:29:20 +08:00
CallbackHandleFailed = 1
2022-03-23 15:44:34 +08:00
// minioUpload
OtherType = 1
VideoType = 2
2022-03-23 17:40:51 +08:00
ImageType = 3
2022-04-20 16:25:33 +08:00
2022-09-06 15:51:18 +08:00
// sendMsgStaus
MsgStatusNotExist = 0
MsgIsSending = 1
MsgSendSuccessed = 2
MsgSendFailed = 3
2021-05-26 19:37:10 +08:00
)
2022-08-04 17:20:33 +08:00
2022-08-10 19:31:57 +08:00
const (
WriteDiffusion = 0
ReadDiffusion = 1
)
2022-04-22 15:12:10 +08:00
const (
2022-06-07 16:27:11 +08:00
AtAllString = "AtAllTag"
AtNormal = 0
AtMe = 1
AtAll = 2
AtAllAtMe = 3
GroupNotification = 4
2022-04-22 15:12:10 +08:00
)
2021-05-26 19:37:10 +08:00
var ContentType2PushContent = map[int64]string{
2022-06-02 20:06:14 +08:00
Picture: "[图片]",
Voice: "[语音]",
Video: "[视频]",
File: "[文件]",
Text: "你收到了一条文本消息",
AtText: "[有人@你]",
GroupMsg: "你收到一条群聊消息",
Common: "你收到一条新消息",
2022-06-09 18:16:23 +08:00
SignalMsg: "音视频通话邀请",
2021-05-26 19:37:10 +08:00
}
2021-09-26 14:26:45 +08:00
2022-04-24 15:55:19 +08:00
const (
2022-04-24 17:27:26 +08:00
FieldRecvMsgOpt = 1
FieldIsPinned = 2
FieldAttachedInfo = 3
FieldIsPrivateChat = 4
FieldGroupAtType = 5
FieldIsNotInGroup = 6
FieldEx = 7
2022-07-26 21:02:11 +08:00
FieldUnread = 8
2022-11-16 11:54:24 +08:00
FieldBurnDuration = 9
2022-04-24 15:55:19 +08:00
)
2021-12-28 21:17:41 +08:00
const (
AppOrdinaryUsers = 1
AppAdmin = 2
GroupOrdinaryUsers = 1
GroupOwner = 2
GroupAdmin = 3
2021-12-30 11:42:10 +08:00
GroupResponseAgree = 1
GroupResponseRefuse = -1
2022-01-16 16:31:28 +08:00
FriendResponseAgree = 1
FriendResponseRefuse = -1
2021-12-28 21:17:41 +08:00
Male = 1
Female = 2
)
2023-03-03 17:42:26 +08:00
const OperationID = "operationID"
const OpUserID = "opUserID"
2023-03-14 15:35:58 +08:00
const ConnID = "connID"
2023-03-21 12:28:21 +08:00
const OpUserPlatform = "platform"
2023-03-15 16:37:09 +08:00
const Token = "token"
2023-03-22 10:11:18 +08:00
const RpcCustomHeader = "customHeader" // rpc中间件自定义ctx参数
2023-03-21 19:20:54 +08:00
const CheckKey = "CheckKey"
2023-03-03 17:42:26 +08:00
2022-02-08 14:45:21 +08:00
const (
UnreliableNotification = 1
ReliableNotificationNoMsg = 2
ReliableNotificationMsg = 3
)
2023-01-30 21:47:29 +08:00
const (
2023-02-07 20:28:34 +08:00
BecomeFriendByImport = 1 //管理员导入
BecomeFriendByApply = 2 //申请添加
2023-01-30 21:47:29 +08:00
)
2022-02-08 14:45:21 +08:00
2022-06-23 18:56:52 +08:00
const (
ApplyNeedVerificationInviteDirectly = 0 // 申请需要同意 邀请直接进
AllNeedVerification = 1 //所有人进群需要验证,除了群主管理员邀请进群
Directly = 2 //直接进群
)
2022-08-01 17:44:40 +08:00
const (
GroupRPCRecvSize = 30
GroupRPCSendSize = 30
)
2021-09-26 14:26:45 +08:00
const FriendAcceptTip = "You have successfully become friends, so start chatting"
2022-01-26 18:43:01 +08:00
func GroupIsBanChat(status int32) bool {
2022-04-08 15:40:07 +08:00
if status != GroupStatusMuted {
2022-01-26 18:43:01 +08:00
return false
}
return true
}
func GroupIsBanPrivateChat(status int32) bool {
if status != GroupBanPrivateChat {
return false
}
return true
2022-02-07 08:44:21 +08:00
}
2022-02-21 15:01:06 +08:00
2022-03-31 11:15:06 +08:00
const LogFileName = "OpenIM.log"
2022-05-09 18:23:06 +08:00
2023-03-06 18:26:23 +08:00
const LocalHost = "0.0.0.0"
2023-03-06 18:47:48 +08:00
// flag parse
const (
2023-03-08 13:34:12 +08:00
FlagPort = "port"
FlagWsPort = "ws_port"
FlagPrometheusPort = "prometheus_port"
FlagConf = "config_folder_path"
2023-03-06 18:47:48 +08:00
)
2023-03-21 15:33:33 +08:00
const OpenIMCommonConfigKey = "OpenIMServerConfig"