Skip to content

Commit

Permalink
User rightsbackwards compatibility (#108)
Browse files Browse the repository at this point in the history
* Add missing user rights

* Fix backwards compatibility.

More ellegannt solution should be found
  • Loading branch information
beqabeqa473 authored Dec 30, 2023
1 parent b97401b commit bd40d7e
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion bot/TeamTalk/structs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import TeamTalkPy

major, minor, patch, build = TeamTalkPy.getVersion().split(".")


class State(Enum):
NOT_CONNECTED = 0
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit bd40d7e

Please sign in to comment.