From 13608a3336e2459dfc4f62e1f3b9c75dbb6fe550 Mon Sep 17 00:00:00 2001 From: Dpeta Date: Sun, 5 Jun 2022 02:02:53 +0200 Subject: [PATCH] Only use metadata if server supports it. (RPL_ISUPPORT) --- irc.py | 59 ++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 16 deletions(-) diff --git a/irc.py b/irc.py index 3f89ae9..e3f0d38 100644 --- a/irc.py +++ b/irc.py @@ -2,7 +2,7 @@ import logging import logging.config import socket import random -from time import time +import time from PyQt5 import QtCore, QtGui @@ -35,6 +35,7 @@ class PesterIRC(QtCore.QThread): self.mainwindow = window self.config = config self.registeredIRC = False + self.metadata_supported = False self.stopIRC = None self.NickServ = services.NickServ() self.ChanServ = services.ChanServ() @@ -331,7 +332,7 @@ class PesterIRC(QtCore.QThread): @QtCore.pyqtSlot() def pingServer(self): try: - self.cli.send("PING %s" % int(time())) + self.cli.send("PING %s" % int(time.time())) except socket.error as e: PchumLog.warning(e) self.setConnectionBroken() @@ -488,8 +489,6 @@ class PesterHandler(DefaultCommandHandler): #mychumhandle = self.mainwindow.profile().handle mymood = self.mainwindow.profile().mood.value() if not self.mainwindow.config.lowBandwidth(): - from time import sleep - sleep(0.5) # To prevent TLS from dying = 350: + try: + helpers.msg(self.client, "#pesterchum", chumglub) + except socket.error as e: + PchumLog.warning(e) + self.parent.setConnectionBroken() + chumglub = "GETMOOD " + chumglub += chandle + if chumglub != "GETMOOD ": + try: + helpers.msg(self.client, "#pesterchum", chumglub) + except socket.error as e: + PchumLog.warning(e) + self.parent.setConnectionBroken() + #def isOn(self, *chums): # isonNicks = ""