def checkServer(self, schid=None): if not schid: schid = self.schid (err, servername) = ts3lib.getServerVariable(schid, ts3defines.VirtualServerProperties.VIRTUALSERVER_NAME) (err, ownuid) = ts3lib.getClientSelfVariable(schid, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER) if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab(self.name+"> Checking for channel....") print("servername:", servername, "cfg:",self.cfg.get("general","servername"), servername == self.cfg.get("general","servername")) print("myuid",ownuid,self.cfg.get("general","myuid"), ownuid == self.cfg.get("general","myuid")) if servername != self.cfg.get("general","servername"): return if ownuid != self.cfg.get("general","myuid"): return print("mein test 1") content = StringIO("[general]\nmychan = ╠-● Administrator | Blu") cfg = ConfigParser() cfg.readfp(content) print(cfg.get("general", "mychan") ) print(type(cfg.get("general", "mychan")) ) print(cfg.get("general", "mychan").split(",") ) return # mychan = StringIO("╠-● Administrator | Blu").split(",") # mychan = self.cfg.get("general", "mychan") # .split(",") print(mychan) mycid = ts3lib.getChannelIDFromChannelNames(schid, mychan) print("mein test 2") self.schids.append({schid: mycid}) print("mein test 3") self.toggleChannel(schid)
def onClientMoveEvent(self, schid, clid, oldChannelID, newChannelID, visibility, moveMessage): if not self.schids or len(self.schids) < 1 or schid != self.schids[0]: return if not self.supchan in [newChannelID, oldChannelID]: return (err, ownID) = ts3lib.getClientID(schid) (err, ownCID) = ts3lib.getChannelOfClient(schid, ownID) mycid = ts3lib.getChannelIDFromChannelNames(schid, self.cfg.get("general", "mychan").split(",")) (err, clients) = ts3lib.getChannelClientList(schid, mycid); clients = len(clients) if ownCID == mycid and clients == 1 and newChannelID == self.supchan: ts3lib.requestClientMove(schid, clid, mycid, "") else: self.checkChannel(schid)
def onNewChannelCreatedEvent(self, schid, cid, channelParentID, invokerID, invokerName, invokerUniqueIdentifier): if not self.waitforchannel: return mycid = ts3lib.getChannelIDFromChannelNames(schid, self.cfg.get("general", "mychan").split(",")) if not channelParentID == mycid: return self.waitforchannel = False self.supchan = cid for (key, val) in self.chan.items("permissions"): (err, id) = ts3lib.getPermissionIDByName(schid, key) self.perm = (id, key, ts3lib.createReturnCode()) ts3lib.requestChannelAddPerm(schid, cid, [id], [int(val)])
def checkServer(self, schid=None): if not schid: schid = self.schid (err, servername) = ts3lib.getServerVariable(schid, ts3defines.VirtualServerProperties.VIRTUALSERVER_NAME) (err, ownuid) = ts3lib.getClientSelfVariable(schid, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER) if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab(self.name+"> Checking for channel....") print("servername:", servername, "cfg:",self.cfg.get("general","servername"), servername == self.cfg.get("general","servername")) print("myuid",ownuid,self.cfg.get("general","myuid"), ownuid == self.cfg.get("general","myuid")) if servername != self.cfg.get("general","servername"): return if ownuid != self.cfg.get("general","myuid"): return print("test1") mychan = self.cfg.get("general", "mychan") # .split(",") return mycid = ts3lib.getChannelIDFromChannelNames(schid, mychan) print("test3") self.schids.append({schid: mycid}) print("test4") self.toggleChannel(schid)