def reply(self, reply): page = reply.readAll().data().decode('utf-8') soup = BeautifulSoup(page, features="html.parser") div_alert = soup.find( "div", {"class": "alert alert-success alert-dismissable"}) proxy_adress = div_alert.find("center").find("b").text ts3lib.printMessageToCurrentTab("[color=green]Connecting to proxy %s" % proxy_adress) self.proxied = True ts3lib.guiConnect( ts3defines.PluginConnectTab.PLUGIN_CONNECT_TAB_CURRENT, self.backup["address"], # Name proxy_adress, # Address self.backup["pw"], # Server Password self.backup["nickname"], # Nickname self.backup["c"], # Channel Path self.backup["cpw"], # Channel Password "", "", "", "", "", self.backup["token"], # Privilege Key self.backup["phonetic"] # Phonetic Nickname )
def reconnect(self, schid=None): try: schid = schid if schid else self.schid args = [ ts3defines.PluginConnectTab. PLUGIN_CONNECT_TAB_NEW_IF_CURRENT_CONNECTED, # connectTab: int, self.tabs[schid]["name"], # serverLabel: Union[str, unicode], self.tabs[schid] ["address"], # serverAddress: Union[str, unicode], self.tabs[schid]["pw"], # serverPassword: Union[str, unicode], self.tabs[schid]["nick"], # nickname: Union[str, unicode], self.tabs[schid]["cpath"], # channel: Union[str, unicode], self.tabs[schid] ["cpw"], # channelPassword: Union[str, unicode] "", # captureProfile: Union[str, unicode], "", # playbackProfile: Union[str, unicode] "", # hotkeyProfile: Union[str, unicode], "Default Sound Pack (Female)", # soundPack self.tabs[schid]["uid"], # userIdentity: Union[str, unicode], self.tabs[schid]["token"], # oneTimeKey: Union[str, unicode], self.tabs[schid][ "nick_phonetic"] # phoneticName: Union[str, unicode] ] print("ts3lib.guiConnect({})".format("\", \"".join( str(x) for x in args))) ts3lib.guiConnect(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13]) self.schid = 0 except: from traceback import format_exc ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
def reconnect(self, schid=None): schid = schid if schid else self.schid self.log(LogLevel.LogLevel_DEBUG, "Reconnecting to tab: {0}".format(self.tabs[schid])) ts3lib.guiConnect(ts3defines.PluginConnectTab.PLUGIN_CONNECT_TAB_CURRENT, self.tabs[schid]["name"], '{}:{}'.format(self.tabs[schid]["host"], self.tabs[schid]["port"]) if hasattr(self.tabs[schid], 'port') else self.tabs[schid]["host"], self.tabs[schid]["pw"], self.tabs[schid]["nick"], self.tabs[schid]["cpath"], self.tabs[schid]["cpw"], "", "", "", "", "", "", "") self.schid = 0
def onClientBanFromServerEvent(self, serverConnectionHandlerID, clientID, oldChannelID, newChannelID, visibility, kickerID, kickerName, kickerUniqueIdentifier, time, kickMessage): try: ts3lib.playWaveFile(serverConnectionHandlerID, path.join(self.soundPath, "ahfuck.wav")) ts3lib.printMessageToCurrentTab("f**k") if self.cfg['antiserverban']['enabled'] != 'False' and self.antiServerBanStatus != False: if time != 0 and time < self.maxSleepTime: tabID = int(self.cfg['data']['tabID']) ip = self.cfg['data']['ip'] port = self.cfg['data']['port'] #serverPw = self.cfg['general']['serverpw'] serverPw = self.currentServerPW nickname = self.cfg['data']['nickname'] channelList = [] channelPw = self.cfg['general']['channelpw'] identity = self.cfg['general']['identity'] address = ip + ":" + port if time > 30: time = time + 1 self.sleep(time) (error, schid) = ts3lib.guiConnect(tabID, "Server", address, serverPw, nickname, "", channelPw, "default", "default", "default", "default", identity, "", "") if self.cfg['antiserverban']['rejoinchannel'] != "False": self.rejoinChannel = True self.oldChannelID = oldChannelID self.backup(schid) #identity = self.cfg['data']['identityPrefix'] + self.cfg['data']['currentID'] #(error, schid) = ts3lib.guiConnect(tabID, "Server", address, serverPw, nickname, "", channelPw, "", "", "", "default", identity, "", "") #self.cfg['data']['currentID'] = self.cfg['data']['currentID'] + 1 except: from traceback import format_exc;ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "PyTSon", 0)
def onClientKickFromServerEvent(self, serverConnectionHandlerID, clientID, oldChannelID, newChannelID, visibility, kickerID, kickerName, kickerUniqueIdentifier, kickMessage): try: if self.cfg['antiserverkick'][ 'enabled'] != 'False' and self.antiServerKickStatus != False: tabID = int(self.cfg['data']['tabID']) ip = self.cfg['data']['ip'] port = self.cfg['data']['port'] #serverPw = self.cfg['general']['serverpw'] serverPw = self.currentServerPW nickname = self.cfg['data']['nickname'] channelList = [] channelPw = self.cfg['general']['channelpw'] identity = self.cfg['general']['identity'] address = ip + ":" + port (error, schid) = ts3lib.guiConnect(tabID, "Server", address, serverPw, nickname, "", channelPw, "default", "default", "default", "default", identity, "", "") if self.cfg['antiserverkick']['rejoinchannel'] != "False": self.oldChannelID = oldChannelID self.rejoinChannel = True self.backup(schid) except: from traceback import format_exc ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "PyTSon", 0)
def reply(self, reply): page = reply.readAll().data().decode('utf-8') soup = BeautifulSoup(page, features="html.parser") div_alert = soup.find("div", {"class": "alert alert-success alert-dismissable"}) proxy_adress = div_alert.find("center").find("b").text ts3lib.printMessageToCurrentTab("[color=green]Connecting to proxy %s"%proxy_adress) self.proxied = True args = [ ts3defines.PluginConnectTab.PLUGIN_CONNECT_TAB_NEW_IF_CURRENT_CONNECTED, # connectTab: int, self.backup["address"], # serverLabel: Union[str, unicode], proxy_adress, # serverAddress: Union[str, unicode], self.backup["pw"], # serverPassword: Union[str, unicode], self.backup["nickname"], # nickname: Union[str, unicode], self.backup["c"], # channel: Union[str, unicode], self.backup["cpw"], # channelPassword: Union[str, unicode] "", # captureProfile: Union[str, unicode], "", # playbackProfile: Union[str, unicode] "", # hotkeyProfile: Union[str, unicode], "Default Sound Pack (Female)", # soundPack self.backup["uid"], # userIdentity: Union[str, unicode], self.backup["token"], # oneTimeKey: Union[str, unicode], self.backup["phonetic"] # phoneticName: Union[str, unicode] ] print("ts3lib.guiConnect({})".format("\", \"".join(str(x) for x in args))) err, schid = ts3lib.guiConnect(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11],args[12], args[13]) ts3lib.requestChannelSubscribeAll(schid) print("BACKUP: ",self.backup)
def reconnect(self, schid=0, cid=0): if not schid: schid = ts3lib.getCurrentServerConnectionHandlerID() err, host, port, pw = ts3lib.getServerConnectInfo(schid) address = host if not "." in host else "{}:{}".format(host, port) # ts3lib.stopConnection(schid, "") err, nickname = ts3lib.getClientSelfVariable( schid, ts3defines.ClientProperties.CLIENT_NICKNAME) err, nickname_phonetic = ts3lib.getClientSelfVariable( schid, ts3defines.ClientPropertiesRare.CLIENT_NICKNAME_PHONETIC) err, uid = ts3lib.getClientSelfVariable( schid, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER) cpw = "" if not cid: err, cid = ts3lib.getClientSelfVariable( schid, ts3defines.ClientProperties.CLIENT_DEFAULT_CHANNEL) err, cpw = ts3lib.getClientSelfVariable( schid, ts3defines.ClientProperties.CLIENT_DEFAULT_CHANNEL_PASSWORD) else: (err, cid, cpw) = ts3lib.getChannelConnectInfo(schid, cid) err, default_token = ts3lib.getClientSelfVariable( schid, ts3defines.ClientPropertiesRare.CLIENT_DEFAULT_TOKEN) args = [ ts3defines.PluginConnectTab. PLUGIN_CONNECT_TAB_CURRENT, # connectTab: int, address, # serverLabel: Union[str, unicode], address, # serverAddress: Union[str, unicode], pw, # serverPassword: Union[str, unicode], nickname, # nickname: Union[str, unicode], cid, # channel: Union[str, unicode], cpw if cpw else "123", # channelPassword: Union[str, unicode] "", # captureProfile: Union[str, unicode], "", # playbackProfile: Union[str, unicode] "", # hotkeyProfile: Union[str, unicode], "Default Sound Pack (Female)", # soundPack uid, # userIdentity: Union[str, unicode], default_token, # oneTimeKey: Union[str, unicode], nickname_phonetic, # phoneticName: Union[str, unicode] ] print("ts3lib.guiConnect({})".format("\", \"".join( str(x) for x in args))) ts3lib.guiConnect(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13])
def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID): if atype != ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CLIENT or menuItemID != 0: return server = self.parseMeta(schid, selectedItemID) if server is None: return # err, tab = ts3.spawnNewServerConnectionHandler(0) # err = ts3.startConnection(tab, "", server.attrib["host"], server.attrib["port"] if hasattr(server, "port") else 0, "", [], "", server.attrib["pw"] if hasattr(server, "pw") else "") err, tab = ts3.guiConnect( ts3defines.PluginConnectTab. PLUGIN_CONNECT_TAB_NEW_IF_CURRENT_CONNECTED, server.text or "Server", '{}:{}'.format(server.attrib["h"], server.attrib["p"]) if hasattr(server, 'p') else server.attrib["h"], server.attrib["p"] if hasattr(server, "p") else "", "TeamspeakUser", "", "", "", "", "", "", "", "", "")
def restoreTab(self, tab=None): try: if not tab: self._timers.pop(0) schid, tab = self._tabs.popitem() args = [ PluginConnectTab.PLUGIN_CONNECT_TAB_NEW_IF_CURRENT_CONNECTED if self.first else PluginConnectTab.PLUGIN_CONNECT_TAB_NEW, # connectTab: int, tab["name"], # serverLabel: Union[str, unicode], tab["address"], # serverAddress: Union[str, unicode], tab["pw"], # serverPassword: Union[str, unicode], tab["nick"], # nickname: Union[str, unicode], tab["cpath"], # channel: Union[str, unicode], tab["cpw"], # channelPassword: Union[str, unicode] "", # captureProfile: Union[str, unicode], "", # playbackProfile: Union[str, unicode] "", # hotkeyProfile: Union[str, unicode], "Default Sound Pack (Female)", # soundPack tab["uid"], # userIdentity: Union[str, unicode], tab["token"], # oneTimeKey: Union[str, unicode], tab["nick_phonetic"] # phoneticName: Union[str, unicode] ] if self.first: self.first = False print("ts3lib.guiConnect({})".format("\", \"".join( str(x) for x in args))) err, schid = ts3lib.guiConnect(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13]) print("TAB: ", tab) ts3lib.setClientSelfVariableAsInt( schid, ClientProperties.CLIENT_INPUT_MUTED, tab["input_muted"]) ts3lib.setClientSelfVariableAsInt( schid, ClientProperties.CLIENT_OUTPUT_MUTED, int(tab["output_muted"])) ts3lib.requestChannelSubscribeAll(schid) except: ts3lib.logMessage(format_exc(), LogLevel.LogLevel_ERROR, "pyTSon", 0)
def on_serverList_doubleClicked(self): try: row = self.serverList.selectedItems()[0].row() name = self.serverList.item(row, 0).text() ip = self.serverList.item(row, 5).text() haspw = True if self.serverList.item(row, 4).text() == "Yes" else False if haspw: x = QWidget() x.setAttribute(Qt.WA_DeleteOnClose) password = QInputDialog.getText(x, "Enter Server Password", "Password:"******"": return err, tab = ts3.guiConnect( ts3defines.PluginConnectTab. PLUGIN_CONNECT_TAB_NEW_IF_CURRENT_CONNECTED, name, ip, password if haspw else "", "TeamspeakUser", "", "", "", "", "", "", "", "", "") # print('item: {0} | row: {1} | item2: {2} |item2_column: {3} | text: {4}'.format(item, row, item2, item2.column(), item2.text())) # item. # item.setData(Qt.UserRole, 22); except: print(traceback.format_exc())