def onConnectStatusChangeEvent(self, schid, newStatus, errorNumber): if self.toggle: if newStatus == ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED: self.requested = True ts3lib.requestChannelGroupList(schid) elif newStatus == ts3defines.ConnectStatus.STATUS_DISCONNECTED: self.check = False;self.ownchannels.clear()
def onConnectStatusChangeEvent(self, serverConnectionHandlerID, newStatus, errorNumber): if not self.toggle: return if newStatus == ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHING: self.requested = True ts3lib.requestChannelGroupList( ts3lib.getCurrentServerConnectionHandlerID())
def __init__(self): if path.isfile(self.ini): self.cfg.read(self.ini) else: self.cfg['general'] = { "cfgversion": "1", "debug": "False", "enabled": "True" } self.cfg['autoban'] = {"enabled": "True"} self.cfg['automod'] = {"enabled": "True", "autotp": "True"} self.cfg['antirecord'] = {"enabled": "True"} self.cfg['autokickonban'] = {"enabled": "True"} self.cfg['groups'] = { "banned": ["BAN", "NOT WELCOME"], "mod": ["MOD", "OPERATOR"], "admin": ["ADMIN"] } with open(self.ini, 'w') as configfile: self.cfg.write(configfile) self.db = QSqlDatabase.addDatabase("QSQLITE", "channelWatcher") self.db.setDatabaseName(ts3lib.getConfigPath() + "settings.db") if self.db.isValid(): self.db.open() schid = ts3lib.getCurrentschid() if schid: self.requested = True ts3lib.requestChannelGroupList(schid) (error, ownID) = ts3lib.getClientID(schid) (error, cid) = ts3lib.getChannelOfClient(schid, ownID) self.ownchannels.extend([cid]) if self.debug: ts3lib.printMessageToCurrentTab( "{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded." .format(self.timestamp(), self.name, self.author))
def processCommand(self, schid, command): cmd = command.lower() if cmd.startswith("test"): ts3lib.printMessageToCurrentTab("Status: "+str(self.toggle)) ts3lib.printMessageToCurrentTab("Ban: "+str(self.sbgroup)) ts3lib.printMessageToCurrentTab("Mod: "+str(self.smgroup)) ts3lib.printMessageToCurrentTab("Admin: "+str(self.sagroup)) ts3lib.printMessageToCurrentTab("Own Channels: "+str(self.ownchannels)) ts3lib.printMessageToCurrentTab("requestedCs: "+str(self.requestedC)) return True elif cmd.startswith("addchan"): command = int(command.split("addchan ")[1]) self.ownchannels.extend([command]) ts3lib.printMessageToCurrentTab("[color=green]Added[/color] #"+str(command)+" to list of channels: "+str(self.ownchannels)) return True elif cmd.startswith("delchan"): command = int(command.split("delchan ")[1]) self.ownchannels.remove([command]) ts3lib.printMessageToCurrentTab("[color=red]Removed[/color] #"+str(command)+" from list of channels: "+str(self.ownchannels)) return True elif cmd == "checkall": self.checkAllUsers() return True elif cmd == "load": self.requested = True ts3lib.requestChannelGroupList(ts3lib.getCurrentschid()) return True
def __init__(self): self.requested = True ts3lib.requestChannelGroupList( ts3lib.getCurrentServerConnectionHandlerID()) if self.debug: ts3lib.printMessageToCurrentTab( "{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded." .format(self.timestamp(), self.name, self.author))
def __init__(self): schid = ts3lib.getCurrentServerConnectionHandlerID() self.requested = True ts3lib.requestChannelGroupList(schid) if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab( "{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded." .format(timestamp(), self.name, self.author))
def loadVars(self, schid=False): if not schid: return; schid = ts3lib.getCurrentServerConnectionHandlerID() self.purgeDB(schid) # for cid in clist: if schid in self.cgroups: return self.cgroups[schid] = {"groups": {}} self.requestedCGroups = True;self.requestedRVars = True ts3lib.requestChannelGroupList(schid) ts3lib.requestServerVariables(schid) if PluginHost.cfg.getboolean("general", "verbose"): print(self.name, ">", "requested vars for #", schid)
def loadVars(self, schid=False): if not schid: schid = ts3lib.getCurrentServerConnectionHandlerID() self.purgeDB(schid) # for cid in clist: if schid in self.cgroups: return self.cgroups[schid] = {"groups": {}} self.requestedCGroups = True self.requestedRVars = True ts3lib.requestChannelGroupList(schid) ts3lib.requestServerVariables(schid) print(self.name, ">", "requested vars for #", schid)
def _reload(self): err, self.myid = ts3lib.getClientID(self.schid) err = ts3lib.requestServerGroupList(self.schid) if err != ts3defines.ERROR_ok: _errprint("Error requesting servergrouplist", err, self.schid) err = ts3lib.requestChannelGroupList(self.schid) if err != ts3defines.ERROR_ok: _errprint("Error requesting channelgroups", err, self.schid) self.beginResetModel() self.allchans = {} self.objs = {} self._reloadServerinfo() self._reloadChannellist() self._reloadClientlist() self.endResetModel()
def _reload(self): err, self.myid = ts3lib.getClientID(self.schid) err = ts3lib.requestServerGroupList(self.schid) if err != ts3defines.ERROR_ok: _errprint("Error requesting servergrouplist", err, self.schid) err = ts3lib.requestChannelGroupList(self.schid) if err != ts3defines.ERROR_ok: _errprint("Error requesting channelgroups", err, self.schid) self.beginResetModel() self.allchans = {} self.objs = {} self._reloadServerinfo() self._reloadChannellist() self._reloadClientlist() self.endResetModel()
def commandSetChannelGroup(self, schid, targetMode, toID, fromID, params=""): self.cmdevent = {"event": "onChannelGroupListEvent", "returnCode": "", "schid": schid, "targetMode": targetMode, "toID": toID, "fromID": fromID, "params": params} self.tmpcgroups = [] ts3lib.requestChannelGroupList(schid)
def onConnectStatusChangeEvent(self, schid, newStatus, errorNumber): if newStatus == ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED: self.requested = True;ts3lib.requestChannelGroupList(schid)
def requestChannelGroupList(self): err = ts3lib.requestChannelGroupList(self.schid) if err != ts3defines.ERROR_ok: raise ts3Error("Error requesting channel group list: (%s, %s)" % (err, ts3lib.getErrorMessage(err)[1]))