diff --git a/CHANGELOG.md b/CHANGELOG.md index d4de733..efb1f66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ ## [v2.1.0] - 2021-4-4 +### Added +- Server prompt + ### Changed - Made it so handle and ident are passed to ``_max_msg_len``, so, hopefully the text cutoff will be *slightly* less restrictive. diff --git a/TODO.md b/TODO.md index 549a3df..ddcd270 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,7 @@ # TODO LIST : ) ## ADD - A proper prompt for choosing a server. + - Memoserv support. ## FIX - Audio mixer slider in options doesn't always work. diff --git a/irc.py b/irc.py index 41c64d4..bee5638 100644 --- a/irc.py +++ b/irc.py @@ -26,18 +26,18 @@ else: logging.basicConfig(level=logging.WARNING) class PesterIRC(QtCore.QThread): - def __init__(self, config, window, server): + def __init__(self, config, window): QtCore.QThread.__init__(self) self.mainwindow = window self.config = config - self.server = server self.registeredIRC = False self.stopIRC = None self.NickServ = services.NickServ() self.ChanServ = services.ChanServ() def IRCConnect(self): + server = self.config.server() port = self.config.port() - self.cli = IRCClient(PesterHandler, host=self.server, port=int(port), nick=self.mainwindow.profile().handle, real_name='pcc31', blocking=True, timeout=120) + self.cli = IRCClient(PesterHandler, host=server, port=int(port), nick=self.mainwindow.profile().handle, real_name='pcc31', blocking=True, timeout=120) self.cli.command_handler.parent = self self.cli.command_handler.mainwindow = self.mainwindow self.cli.connect() diff --git a/oyoyo/client.py b/oyoyo/client.py index 3227440..0fa2a62 100644 --- a/oyoyo/client.py +++ b/oyoyo/client.py @@ -82,11 +82,34 @@ class IRCClient: ... cli_con.next() ... """ - self.context = ssl.create_default_context() - self.context.check_hostname = False - self.context.verify_mode = ssl.CERT_NONE - self.bare_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.socket = self.context.wrap_socket(self.bare_socket) + + # This should be moved to profiles + import json + + try: + with open("server.json", "r") as server_file: + read_file = server_file.read() + server_file.close() + server_obj = json.loads(read_file) + TLS = server_obj['TLS'] + print("TLS-status is: " + str(TLS)) + if TLS == False: + #print("false") + self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + else: + self.context = ssl.create_default_context() + self.context.check_hostname = False + self.context.verify_mode = ssl.CERT_NONE + self.bare_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.socket = self.context.wrap_socket(self.bare_socket) + except: + print("TLS except.") + self.context = ssl.create_default_context() + self.context.check_hostname = False + self.context.verify_mode = ssl.CERT_NONE + self.bare_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.socket = self.context.wrap_socket(self.bare_socket) + self.nick = None self.real_name = None self.host = None diff --git a/pesterchum.py b/pesterchum.py index ef1e47c..e4f2767 100644 --- a/pesterchum.py +++ b/pesterchum.py @@ -1058,23 +1058,6 @@ class PesterWindow(MovingWindow): self.tabconvo = None self.tabmemo = None self.shortcuts = AttrDict() - # karxi: For the record, these are set via commandline arguments. By - # default, they aren't usable any other way - you can't set them via - # the config files. - # ...which means the flag for disabling honking is also hidden and - # impossible to set via pesterchum.js. - # - # This was almost certainly intentional. - if "advanced" in options: - self.advanced = options["advanced"] - else: self.advanced = False - if "server" in options: - self.serverOverride = options["server"] - if "port" in options: - self.portOverride = options["port"] - if "honk" in options: - self.honk = options["honk"] - else: self.honk = True self.setAutoFillBackground(True) self.setObjectName("main") @@ -1094,7 +1077,24 @@ class PesterWindow(MovingWindow): except: self.userprofile = userProfile(PesterProfile("pesterClient%d" % (random.randint(100,999)), QtGui.QColor("black"), Mood(0))) self.theme = self.userprofile.getTheme() - + + # karxi: For the record, these are set via commandline arguments. By + # default, they aren't usable any other way - you can't set them via + # the config files. + # ...which means the flag for disabling honking is also hidden and + # impossible to set via pesterchum.js. + # + # This was almost certainly intentional. + if "advanced" in options: + self.advanced = options["advanced"] + else: self.advanced = False + if "server" in options: + self.serverOverride = options["server"] + if "port" in options: + self.portOverride = options["port"] + if "honk" in options: + self.honk = options["honk"] + else: self.honk = True self.modes = "" self.sound_type = None @@ -1276,10 +1276,6 @@ class PesterWindow(MovingWindow): self.mychumcolor = QtWidgets.QPushButton(self) self.mychumcolor.clicked.connect(self.changeMyColor) - # self.show() before self.initTheme() fixes a - # layering issue on windows... for some reason... - self.show() - self.initTheme(self.theme) self.waitingMessages = waitingMessageHolder(self) @@ -1317,11 +1313,8 @@ class PesterWindow(MovingWindow): self.lastping = int(time()) self.pingtimer.start(1000*90) - #@QtCore.pyqtSlot() - #def mspacheck(self): - # # Fuck you EVEN more OSX leopard! >:(((( - # if not ostools.isOSXLeopard(): - # checker = MSPAChecker(self) + self.changeServerAskedToReset = False + self.changeServer() @QtCore.pyqtSlot(QString, QString) def updateMsg(self, ver, url): @@ -2935,22 +2928,226 @@ class PesterWindow(MovingWindow): @QtCore.pyqtSlot() def quit(self): - # girl help how do i scope - # This seriously needs to be fixed but I don't feel like it