def commandConnect(self, schid, targetMode, toID, fromID, params=""): params = params.split(' ', 1) ip = params[0].split(':') nickname = "" if params[1]: nickname = params[1] ts3lib.stopConnection(schid, "Connecting to %s" % ip) ts3lib.startConnection(schid, "", ip[0], int(ip[1]), nickname, [], "", "")
def onConnectStatusChangeEvent(self, schid, newStatus, errorNumber): if not self.enabled: return if newStatus != ts3defines.ConnectStatus.STATUS_CONNECTING: return if self.proxied: self.proxied = False; return err, host, port, pw = ts3lib.getServerConnectInfo(schid) if host.lower() in self.whitelist: ts3lib.printMessageToCurrentTab("[color=green]%s is whitelisted, not using proxy!" % host); return ip = QHostAddress(host) if not ip.isNull(): if ip.isLoopback(): ts3lib.printMessageToCurrentTab("[color=green]%s is Loopback, not using proxy!" % host); return elif ip.isMulticast(): ts3lib.printMessageToCurrentTab("[color=green]%s is Multicast, not using proxy!" % host); return is_nickname = False if not "." in host: ts3lib.printMessageToCurrentTab("[color=orange]%s is a server nickname, resolving..." % host) self.backup["address"] = host is_nickname = True if not is_nickname: self.backup["address"] = "{}:{}".format(host,port) ts3lib.printMessageToCurrentTab("[color=red]Not proxied on %s, disconnecting!"%self.backup["address"]) ts3lib.stopConnection(schid, "switching to proxy") if pw: self.backup["pw"] = pw err, nickname = ts3lib.getClientSelfVariable(schid, ts3defines.ClientProperties.CLIENT_NICKNAME) if not err and nickname: self.backup["nickname"] = nickname err, nickname_phonetic = ts3lib.getClientSelfVariable(schid, ts3defines.ClientPropertiesRare.CLIENT_NICKNAME_PHONETIC) if not err and nickname_phonetic: self.backup["phonetic"] = nickname_phonetic err, c = ts3lib.getClientSelfVariable(schid, ts3defines.ClientProperties.CLIENT_DEFAULT_CHANNEL) if not err and c: self.backup["c"] = c err, cpw = ts3lib.getClientSelfVariable(schid, ts3defines.ClientProperties.CLIENT_DEFAULT_CHANNEL_PASSWORD) if not err and cpw: self.backup["cpw"] = cpw err, default_token = ts3lib.getClientSelfVariable(schid, ts3defines.ClientPropertiesRare.CLIENT_DEFAULT_TOKEN) if not err and default_token: self.backup["token"] = default_token if is_nickname: self.nwmc_resolver.get(QNetworkRequest(QUrl("https://named.myteamspeak.com/lookup?name=%s"%host))) return self.proxy(host, port)
def disconnect(self, schid=0, close_tab=False): if schid < 1: schid = ts3lib.getCurrentServerConnectionHandlerID() (err, status) = ts3lib.getConnectionStatus(schid) if status != ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED: return clipboard = QApplication.clipboard().text() msg = inputBox("Disconnect", "Message", clipboard) if close_tab: self.schid = schid ts3lib.stopConnection(schid, msg if msg else "")
def commandDisconnect(self, schid, targetMode, toID, fromID, params=""): if self.cfg.getboolean('general', 'customprefix'): prefix = self.cfg.get('general', 'prefix') else: (error, id) = ts3lib.getClientID(schid);prefix = self.clientURL(schid, id) (error, nickname) = ts3lib.getClientVariableAsString(schid, fromID, ts3defines.ClientProperties.CLIENT_NICKNAME) if params != "": ts3lib.stopConnection(schid, params) else: ts3lib.stopConnection(schid, "Command %sdisconnect used by %s" % (prefix, nickname))
def processCommand(self, schid, command): ts3.printMessageToCurrentTab("Disconnecting") ts3.stopConnection(schid, "Disconnected via Pytson Script") return True
def disconnect(self, schid=schid): (err, status) = ts3lib.getConnectionStatus(schid) if status != ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED: return ts3lib.stopConnection(schid, "ts3lib.stopConnection({})".format(schid)) ts3lib.destroyServerConnectionHandler(schid)