From bd40d7e6596a3faaf4b6f12f8001dcd08c97ffcc Mon Sep 17 00:00:00 2001 From: Beqa Gozalishvili Date: Sat, 30 Dec 2023 05:20:07 +0400 Subject: [PATCH] User rightsbackwards compatibility (#108) * Add missing user rights * Fix backwards compatibility. More ellegannt solution should be found --- bot/TeamTalk/structs.py | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/bot/TeamTalk/structs.py b/bot/TeamTalk/structs.py index 2d0f6b9..fca4fef 100644 --- a/bot/TeamTalk/structs.py +++ b/bot/TeamTalk/structs.py @@ -2,6 +2,8 @@ import TeamTalkPy +major, minor, patch, build = TeamTalkPy.getVersion().split(".") + class State(Enum): NOT_CONNECTED = 0 @@ -145,7 +147,7 @@ class UserStatusMode(Flag): N = 4096 -class UserRight(Flag): +class UserRightPre15(Flag): Null = TeamTalkPy.UserRight.USERRIGHT_NONE MultiLogin = TeamTalkPy.UserRight.USERRIGHT_MULTI_LOGIN ViewAllUsers = TeamTalkPy.UserRight.USERRIGHT_VIEW_ALL_USERS @@ -174,6 +176,41 @@ class UserRight(Flag): textMessageChannel = TeamTalkPy.UserRight.USERRIGHT_TEXTMESSAGE_CHANNEL +class UserRight15(Flag): + Null = TeamTalkPy.UserRight.USERRIGHT_NONE + MultiLogin = TeamTalkPy.UserRight.USERRIGHT_MULTI_LOGIN + ViewAllUsers = TeamTalkPy.UserRight.USERRIGHT_VIEW_ALL_USERS + CreateTemporaryChannel = TeamTalkPy.UserRight.USERRIGHT_CREATE_TEMPORARY_CHANNEL + ModifyChannels = TeamTalkPy.UserRight.USERRIGHT_MODIFY_CHANNELS + BroadcastTextMessage = TeamTalkPy.UserRight.USERRIGHT_TEXTMESSAGE_BROADCAST + KickUsers = TeamTalkPy.UserRight.USERRIGHT_KICK_USERS + BanUsers = TeamTalkPy.UserRight.USERRIGHT_BAN_USERS + MoveUsers = TeamTalkPy.UserRight.USERRIGHT_MOVE_USERS + OperatorEnable = TeamTalkPy.UserRight.USERRIGHT_OPERATOR_ENABLE + UploadFiles = TeamTalkPy.UserRight.USERRIGHT_UPLOAD_FILES + DownloadFiles = TeamTalkPy.UserRight.USERRIGHT_DOWNLOAD_FILES + UpdateServerProperties = TeamTalkPy.UserRight.USERRIGHT_UPDATE_SERVERPROPERTIES + TransmitVoice = TeamTalkPy.UserRight.USERRIGHT_TRANSMIT_VOICE + TransmitVideoCapture = TeamTalkPy.UserRight.USERRIGHT_TRANSMIT_VIDEOCAPTURE + TransmitDesktop = TeamTalkPy.UserRight.USERRIGHT_TRANSMIT_DESKTOP + TransmitDesktopInput = TeamTalkPy.UserRight.USERRIGHT_TRANSMIT_DESKTOPINPUT + TransmitMediaFileAudio = TeamTalkPy.UserRight.USERRIGHT_TRANSMIT_MEDIAFILE_AUDIO + TransmitMediaFileVideo = TeamTalkPy.UserRight.USERRIGHT_TRANSMIT_MEDIAFILE_VIDEO + TransmitMediaFile = TeamTalkPy.UserRight.USERRIGHT_TRANSMIT_MEDIAFILE + LockedNickname = TeamTalkPy.UserRight.USERRIGHT_LOCKED_NICKNAME + LockedStatus = TeamTalkPy.UserRight.USERRIGHT_LOCKED_STATUS + RecordVoice = TeamTalkPy.UserRight.USERRIGHT_RECORD_VOICE + ViewHiddenChannels = TeamTalkPy.UserRight.USERRIGHT_VIEW_HIDDEN_CHANNELS + textMessageUser = TeamTalkPy.UserRight.USERRIGHT_TEXTMESSAGE_USER + textMessageChannel = TeamTalkPy.UserRight.USERRIGHT_TEXTMESSAGE_CHANNEL + + +if major == "5" and minor >= "15": + UserRight = UserRight15 +else: + UserRight = UserRightPre15 + + class UserAccount: def __init__( self,