def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID): if atype != ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL: return if menuItemID == 0: pass elif menuItemID == 1: ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelProperties.CHANNEL_NAME, "test") ts3lib.flushChannelCreation(schid, 0)
def importChannels(self, schid, file=""): self.result = { "success": 0, "failed": 0, "total": 0, "msg": "", "stop": False } channels = self.readChannels(file) self.result["total"] = len(channels) for channel in channels: if self.result["stop"]: self.result["stop"] = False return for k, v in channel["flags"].items(): ts3lib.setChannelVariableAsString(schid, 0, k, v) print("Setting var", k, "with value", v) returnCode = ts3lib.createReturnCode() # result = {} self.channels.append({ returnCode: (channel["flags"][ChannelProperties.CHANNEL_NAME], channel["permissions"]) }) self.channels.append(channel) ts3lib.flushChannelCreation(schid, 0, returnCode)
def createChannel(self, schid): ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelProperties.CHANNEL_NAME, self.chan.get("props", "name open")) ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS, self.chan.getint("props", "maxclients")) ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelProperties.CHANNEL_CODEC, self.chan.getint("props", "codec")) ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelProperties.CHANNEL_CODEC_QUALITY, self.chan.getint("props", "codec_quality")) ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelProperties.CHANNEL_DESCRIPTION, self.description) ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelProperties.CHANNEL_FLAG_SEMI_PERMANENT, 1) ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelPropertiesRare.CHANNEL_FLAG_MAXCLIENTS_UNLIMITED, 0) ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER, 1337) print(self.schids) print(self.schids[schid]) return ts3lib.flushChannelCreation(schid, self.schids[schid]) self.waitforchannel = True
def checkChannel(self, schid): (err, clients) = ts3lib.getChannelClientList(schid, self.supchan); clients = len(clients) (err, maxclients) = ts3lib.getChannelVariable(schid, self.supchan, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS) if clients < maxclients: ts3lib.setChannelVariableAsString(schid, self.supchan, ts3defines.ChannelProperties.CHANNEL_NAME,self.chan.get("props", "name open")) elif clients >= maxclients: ts3lib.setChannelVariableAsString(schid, self.supchan, ts3defines.ChannelProperties.CHANNEL_NAME, self.chan.get("props", "name in use")) else: return ts3lib.flushChannelUpdates(schid, self.supchan)
def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID): if atype != ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL or menuItemID != 0: return err, clientID = ts3lib.getClientID(schid) err, channelID = ts3lib.getChannelOfClient(schid, clientID) # CHANNEL_NAME err, self.CHANNEL_NAME = ts3lib.getChannelVariableAsString( schid, channelID, ts3defines.ChannelProperties.CHANNEL_NAME) ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelProperties.CHANNEL_NAME, self.CHANNEL_NAME + "_") # CHANNEL_NAME_PHONETIC # err, CHANNEL_NAME_PHONETIC = ts3lib.getChannelVariableAsString(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NAME_PHONETIC) # CHANNEL_TOPIC # err, CHANNEL_TOPIC = ts3lib.getChannelVariableAsString(schid, channelID, ts3defines.ChannelProperties.CHANNEL_TOPIC) # ts3lib.setChannelVariableAsString(schid,0,ts3defines.ChannelProperties.CHANNEL_TOPIC,CHANNEL_TOPIC) # CHANNEL_DESCRIPTION # err, CHANNEL_DESCRIPTION = ts3lib.getChannelVariableAsString(schid, channelID, ts3defines.ChannelProperties.CHANNEL_DESCRIPTION) # ts3lib.setChannelVariableAsString(schid,0,ts3defines.ChannelProperties.CHANNEL_DESCRIPTION,CHANNEL_DESCRIPTION) # CHANNEL_CODEC err, CHANNEL_CODEC = ts3lib.getChannelVariableAsInt( schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC) ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelProperties.CHANNEL_CODEC, CHANNEL_CODEC) # CHANNEL_CODEC_QUALITY err, CHANNEL_CODEC_QUALITY = ts3lib.getChannelVariableAsInt( schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC_QUALITY) ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelProperties.CHANNEL_CODEC_QUALITY, CHANNEL_CODEC_QUALITY) # CHANNEL_MAXCLIENTS err, CHANNEL_MAXCLIENTS = ts3lib.getChannelVariableAsUInt64( schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS) ts3lib.setChannelVariableAsUInt64( schid, 0, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS, CHANNEL_MAXCLIENTS) # CHANNEL_MAXFAMILYCLIENTS err, CHANNEL_MAXFAMILYCLIENTS = ts3lib.getChannelVariableAsUInt64( schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS) ts3lib.setChannelVariableAsUInt64( schid, 0, ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS, CHANNEL_MAXFAMILYCLIENTS) # CHANNEL_NEEDED_TALK_POWER err, CHANNEL_NEEDED_TALK_POWER = ts3lib.getChannelVariableAsInt( schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER) ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER, CHANNEL_NEEDED_TALK_POWER) # self.returncode = ts3lib.createReturnCode() ts3lib.flushChannelCreation(schid, 0) #, self.returncode)
def onNewChannelCreatedEvent(self, schid, channelID, channelParentID, invokerID, invokerName, invokerUniqueIdentifier): err, clientID = ts3lib.getClientID(schid) if invokerID != clientID: return ts3lib.setChannelVariableAsString( schid, channelID, ts3defines.ChannelProperties.CHANNEL_NAME, self.CHANNEL_NAME) del self.CHANNEL_NAME ts3lib.flushChannelUpdates(schid, channelID)
def onClientSelfVariableUpdateEvent(self, schid, flag, oldValue, newValue) : if not self.schids or len(self.schids) < 1 or schid != self.schids[0]: return if flag != ts3defines.ClientPropertiesRare.CLIENT_AWAY: return newValue = int(newValue) if newValue == ts3defines.AwayStatus.AWAY_ZZZ: ts3lib.setChannelVariableAsInt(schid, self.supchan, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS, 0) ts3lib.setChannelVariableAsString(schid, self.supchan, ts3defines.ChannelProperties.CHANNEL_NAME, self.chan.get("props", "name closed")) ts3lib.flushChannelUpdates(schid, self.supchan) elif newValue == ts3defines.AwayStatus.AWAY_NONE: ts3lib.setChannelVariableAsInt(schid, self.supchan, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS, self.chan.getint("props", "maxclients")) ts3lib.setChannelVariableAsString(schid, self.supchan, ts3defines.ChannelProperties.CHANNEL_NAME, self.chan.get("props", "name open")) ts3lib.flushChannelUpdates(schid, self.supchan)
def onClientChannelGroupChangedEvent(self, schid, channelGroupID, channelID, clientID, invokerClientID, invokerName, invokerUniqueIdentity): (err, suid) = ts3lib.getServerVariable( schid, ts3defines.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER) # if self.debug: ts3lib.printMessageToCurrentTab('suid != self.suid: {}'.format(suid != self.suid)) if suid != self.suid: return (err, ownID) = ts3lib.getClientID(schid) # if self.debug: ts3lib.printMessageToCurrentTab('clientID != ownID: {}'.format(clientID != ownID)) if clientID != ownID: return # if self.debug: ts3lib.printMessageToCurrentTab('channelGroupID != self.channelAdminGroupID: {}'.format(channelGroupID != self.channelAdminGroupID)) if channelGroupID != self.channelAdminGroupID: return # if self.debug: ts3lib.printMessageToCurrentTab('invokerClientID != 0: {}'.format(invokerClientID != 0)) if invokerClientID == 0: (err, ntp) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER) if not ntp or ntp == 0: ts3lib.setChannelVariableAsInt( schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER, self.settings["tp"]) # (err, cmc) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS) ts3lib.setChannelVariableAsInt( schid, channelID, ts3defines.ChannelPropertiesRare. CHANNEL_FLAG_MAXCLIENTS_UNLIMITED, 0) ts3lib.setChannelVariableAsInt( schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS, self.settings["maxclients"]) (err, cnp) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NAME_PHONETIC) if not cnp or cnp == "": ts3lib.setChannelVariableAsString( schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NAME_PHONETIC, "Team | Lounge 1") ts3lib.flushChannelUpdates(schid, channelID) return # clid = ts3lib.getClientIDbyNickname(schid, self.gommeBotNick) # if not clid: ts3lib.printMessage(schid, 'Gomme-Bot not found.', ts3defines.PluginMessageTarget.PLUGIN_MESSAGE_TARGET_SERVER) # (err, uid) = ts3lib.getClientVariable(schid, self.gommeBotID, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER) # if uid != "serveradmin": return # if self.debug: ts3lib.printMessageToCurrentTab('self.gommeBotID == 0: {}'.format(self.gommeBotID == 0)) if self.gommeBotID == 0: return ts3lib.requestSendPrivateTextMsg(schid, "registriert", self.gommeBotID)
def onClientChannelGroupChangedEvent(self, schid, channelGroupID, channelID, clientID, invokerClientID, invokerName, invokerUniqueIdentity): (err, suid) = ts3lib.getServerVariable(schid, ts3defines.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER) if suid != self.suid: return (err, ownID) = ts3lib.getClientID(schid) if clientID != ownID: return if channelGroupID != self.channelAdminGroupID: return if invokerClientID == 0: (err, ntp) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER) if not ntp or ntp == 0: ts3lib.setChannelVariableAsInt(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER, self.settings["tp"]) ts3lib.setChannelVariableAsInt(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_FLAG_MAXCLIENTS_UNLIMITED, 0) ts3lib.setChannelVariableAsInt(schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS, self.settings["maxclients"]) (err, cnp) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NAME_PHONETIC) if not cnp or cnp == "": ts3lib.setChannelVariableAsString(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NAME_PHONETIC, "Team | Lounge 1") ts3lib.flushChannelUpdates(schid, channelID) if self.gommeBotID < 1: return ts3lib.requestSendPrivateTextMsg(schid, "registriert", self.gommeBotID)
def topic(self, value): if len(value) > ts3defines.TS3_MAX_SIZE_CHANNEL_TOPIC: raise ts3Error("Topic too long. length:%s, max:%s" % (len(value), ts3defines.TS3_MAX_SIZE_CHANNEL_TOPIC)) err = ts3lib.setChannelVariableAsString( self.schid, self.channelID, ts3defines.ChannelProperties.CHANNEL_TOPIC, value) if err != ts3defines.ERROR_ok: raise ts3Error("Error setting channel topic: (%s, %s)" % (err, ts3lib.getErrorMessage(err)[1]))
def description(self, value): if len(value) > ts3defines.TS3_MAX_SIZE_CHANNEL_DESCRIPTION: raise ts3Error( "Description too long. length:%s, max:%s" % (len(value), ts3defines.TS3_MAX_SIZE_CHANNEL_DESCRIPTION)) err = ts3lib.setChannelVariableAsString( self.schid, self.channelID, ts3defines.ChannelProperties.CHANNEL_DESCRIPTION, value) if err != ts3defines.ERROR_ok: raise ts3Error("Error setting channel description: (%s, %s)" % (err, ts3lib.getErrorMessage(err)[1]))
def fakeChannel(self, schid, channelID): (error, nick) = ts3lib.getChannelVariableAsString( schid, channelID, ts3defines.ChannelProperties.CHANNEL_NAME) ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelProperties.CHANNEL_NAME, nick) (error, phonetic) = ts3lib.getChannelVariableAsString( schid, channelID, ts3defines.ChannelProperties.CHANNEL_NAME_PHONETIC) ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelProperties.CHANNEL_NAME, phonetic) (error, pw) = ts3lib.getChannelVariableAsInt( schid, channelID, ts3defines.ChannelProperties.CHANNEL_PASSWORD) if pw: ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelProperties.CHANNEL_PASSWORD, ".") (error, topic) = ts3lib.getChannelVariableAsString( schid, channelID, ts3defines.ChannelProperties.CHANNEL_TOPIC) ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelProperties.CHANNEL_TOPIC, topic) (error, description) = ts3lib.getChannelVariableAsString( schid, channelID, ts3defines.ChannelProperties.CHANNEL_DESCRIPTION) ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelProperties.CHANNEL_DESCRIPTION, description) (error, neededtp) = ts3lib.getChannelVariableAsInt( schid, channelID, ts3defines.ChannelProperties.CHANNEL_NEEDED_TALK_POWER) ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelProperties.CHANNEL_NEEDED_TALK_POWER, neededtp) (error, codec) = ts3lib.getChannelVariableAsInt( schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC) ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelProperties.CHANNEL_CODEC, codec) (error, quality) = ts3lib.getChannelVariableAsInt( schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC_QUALITY) ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelProperties.CHANNEL_CODEC_QUALITY, quality) (error, latency) = ts3lib.getChannelVariableAsString( schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC_LATENCY_FACTOR) ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelProperties.CHANNEL_CODEC_LATENCY_FACTOR, latency) (error, unencrypted) = ts3lib.getChannelVariableAsInt( schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC_IS_UNENCRYPTED) ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelProperties.CHANNEL_CODEC_IS_UNENCRYPTED, unencrypted) (error, maxclients) = ts3lib.getChannelVariableAsInt( schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS) ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS, maxclients) (error, maxfamilyclients) = ts3lib.getChannelVariableAsInt( schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS) ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS, maxfamilyclients) (error, iconid) = ts3lib.getChannelVariableAsUint64( schid, channelID, ts3defines.ChannelProperties.CHANNEL_ICON_ID) ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelProperties.CHANNEL_ICON_ID, iconid) (error, _clid) = ts3lib.getClientID(schid)
def fakeChannel(self, schid, channelID): err, ownID = ts3lib.getClientID(schid) err, ownCID = ts3lib.getChannelOfClient(schid, ownID) # channel = self.ts3host.getChannel(schid, channelID) (error, name) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelProperties.CHANNEL_NAME) # name = name.encode("utf-8").decode(sys.stdout.encoding) if not error and name: ts3lib.setChannelVariableAsString( schid, ownCID, ts3defines.ChannelProperties.CHANNEL_NAME, self.str_replace(name)) """ (error, phonetic) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NAME_PHONETIC) if debug: print("err:", error, "CHANNEL_NAME_PHONETIC", phonetic) if not error and phonetic: ts3lib.setChannelVariableAsString(schid, 0,ts3defines.ChannelPropertiesRare.CHANNEL_NAME_PHONETIC,phonetic) (error, pw) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_FLAG_PASSWORD) if debug: print("err:", error, "CHANNEL_FLAG_PASSWORD", pw) if pw: (err, path, _pw) = ts3lib.getChannelConnectInfo(schid, channelID) if debug: print("err:", error, "_pw", _pw) ts3lib.setChannelVariableAsString(schid, 0,ts3defines.ChannelProperties.CHANNEL_PASSWORD,_pw if _pw else ".") """ """ (error, topic) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_TOPIC) if debug: print("err:", error, "CHANNEL_TOPIC", topic) if not error and topic: ts3lib.setChannelVariableAsString(schid, 0,ts3defines.ChannelProperties.CHANNEL_TOPIC,topic) ts3lib.requestChannelDescription(schid, channelID) (error, description) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_DESCRIPTION) if debug: print("err:", error, "CHANNEL_DESCRIPTION", description) if not error and description: ts3lib.setChannelVariableAsString(schid, 0,ts3defines.ChannelProperties.CHANNEL_DESCRIPTION,description.decode('utf-8')) """ """ (error, neededtp) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER) if debug: print("err:", error, "CHANNEL_NEEDED_TALK_POWER", neededtp) if not error and neededtp: ts3lib.setChannelVariableAsInt(schid, 0,ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER,neededtp) (error, codec) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC) if debug: print("err:", error, "CHANNEL_CODEC", codec) if not error and codec: ts3lib.setChannelVariableAsInt(schid, 0,ts3defines.ChannelProperties.CHANNEL_CODEC,codec) (error, quality) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC_QUALITY) if debug: print("err:", error, "CHANNEL_CODEC_QUALITY", quality) if not error and quality: ts3lib.setChannelVariableAsInt(schid, 0,ts3defines.ChannelProperties.CHANNEL_CODEC_QUALITY,quality) (error, latency) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC_LATENCY_FACTOR) if debug: print("err:", error, "CHANNEL_CODEC_LATENCY_FACTOR", latency) if not error and latency: ts3lib.setChannelVariableAsInt(schid, 0,ts3defines.ChannelProperties.CHANNEL_CODEC_LATENCY_FACTOR,latency) (error, unencrypted) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC_IS_UNENCRYPTED) if debug: print("err:", error, "CHANNEL_CODEC_IS_UNENCRYPTED", unencrypted) if not error and unencrypted: ts3lib.setChannelVariableAsInt(schid, 0,ts3defines.ChannelProperties.CHANNEL_CODEC_IS_UNENCRYPTED,unencrypted) (error, maxclients) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS) if debug: print("err:", error, "CHANNEL_MAXCLIENTS", maxclients) if not error and maxclients: ts3lib.setChannelVariableAsInt(schid, 0,ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS,maxclients) (error, maxfamilyclients) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS) if debug: print("err:", error, "CHANNEL_MAXFAMILYCLIENTS", maxfamilyclients) if not error and maxfamilyclients: ts3lib.setChannelVariableAsInt(schid, 0,ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS,maxfamilyclients) (error, iconid) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_ICON_ID) if debug: print("err:", error, "CHANNEL_ICON_ID", iconid) if not error and iconid: ts3lib.setChannelVariableAsInt(schid, 0,ts3defines.ChannelPropertiesRare.CHANNEL_ICON_ID,iconid) """ self.retcode = ts3lib.createReturnCode() err = ts3lib.flushChannelUpdates(schid, ownCID, self.retcode) _err, errmsg = ts3lib.getErrorMessage(err) print("ts3lib.flushChannelUpdates", "schid:", schid, "ownID:", ownID, "ownCID:", ownCID, "retcode", self.retcode, "err", err, "errmsg", errmsg) if err == ts3defines.ERROR_ok: return err = ts3lib.flushChannelCreation(schid, 0, self.retcode) _err, errmsg = ts3lib.getErrorMessage(err) print("ts3lib.flushChannelCreation", "schid:", schid, "0", "retcode", self.retcode, "err", err, "errmsg", errmsg)
def fakeChannel(self, schid, channelID): channel = self.ts3host.getChannel(schid, channelID) debug = PluginHost.cfg.getboolean("general", "verbose") (error, name) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelProperties.CHANNEL_NAME) name = name.encode("utf-8").decode(sys.stdout.encoding) # TODO MODIFY NAME if debug: print("err:", error, "CHANNEL_NAME", name) if not error and name: ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelProperties.CHANNEL_NAME, name) (error, phonetic) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NAME_PHONETIC) if debug: print("err:", error, "CHANNEL_NAME_PHONETIC", phonetic) if not error and phonetic: ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelPropertiesRare.CHANNEL_NAME_PHONETIC, phonetic) (error, pw) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelProperties.CHANNEL_FLAG_PASSWORD) if debug: print("err:", error, "CHANNEL_FLAG_PASSWORD", pw) if pw: (err, path, _pw) = ts3lib.getChannelConnectInfo(schid, channelID) if debug: print("err:", error, "_pw", _pw) ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelProperties.CHANNEL_PASSWORD, _pw if _pw else ".") """ (error, topic) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_TOPIC) if debug: print("err:", error, "CHANNEL_TOPIC", topic) if not error and topic: ts3lib.setChannelVariableAsString(schid, 0,ts3defines.ChannelProperties.CHANNEL_TOPIC,topic) ts3lib.requestChannelDescription(schid, channelID) (error, description) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_DESCRIPTION) if debug: print("err:", error, "CHANNEL_DESCRIPTION", description) if not error and description: ts3lib.setChannelVariableAsString(schid, 0,ts3defines.ChannelProperties.CHANNEL_DESCRIPTION,description.decode('utf-8')) """ (error, neededtp) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER) if debug: print("err:", error, "CHANNEL_NEEDED_TALK_POWER", neededtp) if not error and neededtp: ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER, neededtp) (error, codec) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC) if debug: print("err:", error, "CHANNEL_CODEC", codec) if not error and codec: ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelProperties.CHANNEL_CODEC, codec) (error, quality) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC_QUALITY) if debug: print("err:", error, "CHANNEL_CODEC_QUALITY", quality) if not error and quality: ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelProperties.CHANNEL_CODEC_QUALITY, quality) (error, latency) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC_LATENCY_FACTOR) if debug: print("err:", error, "CHANNEL_CODEC_LATENCY_FACTOR", latency) if not error and latency: ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelProperties.CHANNEL_CODEC_LATENCY_FACTOR, latency) (error, unencrypted) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC_IS_UNENCRYPTED) if debug: print("err:", error, "CHANNEL_CODEC_IS_UNENCRYPTED", unencrypted) if not error and unencrypted: ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelProperties.CHANNEL_CODEC_IS_UNENCRYPTED, unencrypted) (error, maxclients) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS) if debug: print("err:", error, "CHANNEL_MAXCLIENTS", maxclients) if not error and maxclients: ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS, maxclients) (error, maxfamilyclients) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS) if debug: print("err:", error, "CHANNEL_MAXFAMILYCLIENTS", maxfamilyclients) if not error and maxfamilyclients: ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS, maxfamilyclients) (error, iconid) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_ICON_ID) if debug: print("err:", error, "CHANNEL_ICON_ID", iconid) if not error and iconid: ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelPropertiesRare.CHANNEL_ICON_ID, iconid) ts3lib.flushChannelCreation(schid, 0)