System time change check, cli fallback, ":distraughtfirman" --> ":distraughtfirman:"
This commit is contained in:
parent
5cdfcc53bd
commit
82c0d38a3b
8 changed files with 282 additions and 227 deletions
11
CHANGELOG.md
11
CHANGELOG.md
|
@ -1,6 +1,17 @@
|
|||
# Changelog
|
||||
(This document uses YYYY-MM-DD)
|
||||
|
||||
## [v2.4.4] - 2022-09-10
|
||||
|
||||
### Added
|
||||
- Desync check, verify connection is alive when system time changes by multiple minutes.
|
||||
|
||||
### Changed
|
||||
- Made outgoing irc.py functions do an extra check if connection/cli exists.
|
||||
|
||||
### Fixed
|
||||
- The string for the distraughtfirman smilie being ":distraughtfirman" instead of ":distraughtfirman:".
|
||||
|
||||
## [v2.4.3] - 2022-09-06
|
||||
|
||||
### Added
|
||||
|
|
|
@ -154,7 +154,7 @@ Ideally, you'll want to create and activate a [virtual environment](https://docs
|
|||
|`:chummy:`|<img alt=':chummy: pesterchum smilie/emote' src='smilies/pc_chummy.png'>|
|
||||
|`:cool:`|<img alt=':cool: pesterchum smilie/emote' src='smilies/pccool.png'>|
|
||||
|`:smooth:`|<img alt=':smooth: pesterchum smilie/emote' src='smilies/pccool.png'>|
|
||||
|`:distraughtfirman`|<img alt=':distraughtfirman pesterchum smilie/emote' src='smilies/pc_distraughtfirman.png'>|
|
||||
|`:distraughtfirman:`|<img alt=':distraughtfirman: pesterchum smilie/emote' src='smilies/pc_distraughtfirman.png'>|
|
||||
|`:distraught:`|<img alt=':distraught: pesterchum smilie/emote' src='smilies/pc_distraught.png'>|
|
||||
|`:insolent:`|<img alt=':insolent: pesterchum smilie/emote' src='smilies/pc_insolent.png'>|
|
||||
|`:bemused:`|<img alt=':bemused: pesterchum smilie/emote' src='smilies/pc_bemused.png'>|
|
||||
|
|
26
irc.py
26
irc.py
|
@ -123,12 +123,15 @@ class PesterIRC(QtCore.QThread):
|
|||
|
||||
@QtCore.pyqtSlot(PesterProfile)
|
||||
def getMood(self, *chums):
|
||||
if hasattr(self, 'cli'):
|
||||
self.cli.command_handler.getMood(*chums)
|
||||
@QtCore.pyqtSlot(PesterList)
|
||||
def getMoods(self, chums):
|
||||
if hasattr(self, 'cli'):
|
||||
self.cli.command_handler.getMood(*chums)
|
||||
@QtCore.pyqtSlot(QString, QString)
|
||||
def sendNotice(self, text, handle):
|
||||
if hasattr(self, 'cli'):
|
||||
h = str(handle)
|
||||
t = str(text)
|
||||
try:
|
||||
|
@ -138,6 +141,7 @@ class PesterIRC(QtCore.QThread):
|
|||
self.setConnectionBroken()
|
||||
@QtCore.pyqtSlot(QString, QString)
|
||||
def sendMessage(self, text, handle):
|
||||
if hasattr(self, 'cli'):
|
||||
h = str(handle)
|
||||
textl = [str(text)]
|
||||
def splittext(l):
|
||||
|
@ -185,9 +189,7 @@ class PesterIRC(QtCore.QThread):
|
|||
self.setConnectionBroken()
|
||||
@QtCore.pyqtSlot(QString, QString,)
|
||||
def sendCTCP(self, handle, text):
|
||||
#cmd = text.split(' ')[0]
|
||||
#msg = text.replace(cmd + ' ', '')
|
||||
#msg = msg.replace(cmd, '')
|
||||
if hasattr(self, 'cli'):
|
||||
try:
|
||||
helpers.ctcp(self.cli, handle, text)
|
||||
except OSError as e:
|
||||
|
@ -195,6 +197,7 @@ class PesterIRC(QtCore.QThread):
|
|||
self.setConnectionBroken()
|
||||
@QtCore.pyqtSlot(QString, bool)
|
||||
def startConvo(self, handle, initiated):
|
||||
if hasattr(self, 'cli'):
|
||||
h = str(handle)
|
||||
try:
|
||||
helpers.msg(self.cli, h, "COLOR >%s" % (self.mainwindow.profile().colorcmd()))
|
||||
|
@ -205,6 +208,7 @@ class PesterIRC(QtCore.QThread):
|
|||
self.setConnectionBroken()
|
||||
@QtCore.pyqtSlot(QString)
|
||||
def endConvo(self, handle):
|
||||
if hasattr(self, 'cli'):
|
||||
h = str(handle)
|
||||
try:
|
||||
helpers.msg(self.cli, h, "PESTERCHUM:CEASE")
|
||||
|
@ -213,6 +217,7 @@ class PesterIRC(QtCore.QThread):
|
|||
self.setConnectionBroken()
|
||||
@QtCore.pyqtSlot()
|
||||
def updateProfile(self):
|
||||
if hasattr(self, 'cli'):
|
||||
me = self.mainwindow.profile()
|
||||
handle = me.handle
|
||||
try:
|
||||
|
@ -227,6 +232,7 @@ class PesterIRC(QtCore.QThread):
|
|||
self.updateMood()
|
||||
@QtCore.pyqtSlot()
|
||||
def updateMood(self):
|
||||
if hasattr(self, 'cli'):
|
||||
me = self.mainwindow.profile()
|
||||
# Moods via metadata
|
||||
try:
|
||||
|
@ -242,6 +248,7 @@ class PesterIRC(QtCore.QThread):
|
|||
self.setConnectionBroken()
|
||||
@QtCore.pyqtSlot()
|
||||
def updateColor(self):
|
||||
if hasattr(self, 'cli'):
|
||||
#PchumLog.debug("irc updateColor (outgoing)")
|
||||
#me = self.mainwindow.profile()
|
||||
# Update color metadata field
|
||||
|
@ -260,6 +267,7 @@ class PesterIRC(QtCore.QThread):
|
|||
self.setConnectionBroken()
|
||||
@QtCore.pyqtSlot(QString)
|
||||
def blockedChum(self, handle):
|
||||
if hasattr(self, 'cli'):
|
||||
h = str(handle)
|
||||
try:
|
||||
helpers.msg(self.cli, h, "PESTERCHUM:BLOCK")
|
||||
|
@ -268,6 +276,7 @@ class PesterIRC(QtCore.QThread):
|
|||
self.setConnectionBroken()
|
||||
@QtCore.pyqtSlot(QString)
|
||||
def unblockedChum(self, handle):
|
||||
if hasattr(self, 'cli'):
|
||||
h = str(handle)
|
||||
try:
|
||||
helpers.msg(self.cli, h, "PESTERCHUM:UNBLOCK")
|
||||
|
@ -276,6 +285,7 @@ class PesterIRC(QtCore.QThread):
|
|||
self.setConnectionBroken()
|
||||
@QtCore.pyqtSlot(QString)
|
||||
def requestNames(self, channel):
|
||||
if hasattr(self, 'cli'):
|
||||
c = str(channel)
|
||||
try:
|
||||
helpers.names(self.cli, c)
|
||||
|
@ -284,6 +294,7 @@ class PesterIRC(QtCore.QThread):
|
|||
self.setConnectionBroken()
|
||||
@QtCore.pyqtSlot()
|
||||
def requestChannelList(self):
|
||||
if hasattr(self, 'cli'):
|
||||
try:
|
||||
helpers.channel_list(self.cli)
|
||||
except OSError as e:
|
||||
|
@ -291,6 +302,7 @@ class PesterIRC(QtCore.QThread):
|
|||
self.setConnectionBroken()
|
||||
@QtCore.pyqtSlot(QString)
|
||||
def joinChannel(self, channel):
|
||||
if hasattr(self, 'cli'):
|
||||
c = str(channel)
|
||||
try:
|
||||
helpers.join(self.cli, c)
|
||||
|
@ -300,6 +312,7 @@ class PesterIRC(QtCore.QThread):
|
|||
self.setConnectionBroken()
|
||||
@QtCore.pyqtSlot(QString)
|
||||
def leftChannel(self, channel):
|
||||
if hasattr(self, 'cli'):
|
||||
c = str(channel)
|
||||
try:
|
||||
helpers.part(self.cli, c)
|
||||
|
@ -309,6 +322,7 @@ class PesterIRC(QtCore.QThread):
|
|||
self.setConnectionBroken()
|
||||
@QtCore.pyqtSlot(QString, QString)
|
||||
def kickUser(self, handle, channel):
|
||||
if hasattr(self, 'cli'):
|
||||
l = handle.split(":")
|
||||
c = str(channel)
|
||||
h = str(l[0])
|
||||
|
@ -326,6 +340,7 @@ class PesterIRC(QtCore.QThread):
|
|||
self.setConnectionBroken()
|
||||
@QtCore.pyqtSlot(QString, QString, QString)
|
||||
def setChannelMode(self, channel, mode, command):
|
||||
if hasattr(self, 'cli'):
|
||||
c = str(channel)
|
||||
m = str(mode)
|
||||
cmd = str(command)
|
||||
|
@ -339,6 +354,7 @@ class PesterIRC(QtCore.QThread):
|
|||
self.setConnectionBroken()
|
||||
@QtCore.pyqtSlot(QString)
|
||||
def channelNames(self, channel):
|
||||
if hasattr(self, 'cli'):
|
||||
c = str(channel)
|
||||
try:
|
||||
helpers.names(self.cli, c)
|
||||
|
@ -347,6 +363,7 @@ class PesterIRC(QtCore.QThread):
|
|||
self.setConnectionBroken()
|
||||
@QtCore.pyqtSlot(QString, QString)
|
||||
def inviteChum(self, handle, channel):
|
||||
if hasattr(self, 'cli'):
|
||||
h = str(handle)
|
||||
c = str(channel)
|
||||
try:
|
||||
|
@ -357,6 +374,7 @@ class PesterIRC(QtCore.QThread):
|
|||
|
||||
@QtCore.pyqtSlot()
|
||||
def pingServer(self):
|
||||
if hasattr(self, 'cli'):
|
||||
try:
|
||||
if hasattr(self, 'cli'):
|
||||
self.cli.send("PING :B33")
|
||||
|
@ -366,6 +384,7 @@ class PesterIRC(QtCore.QThread):
|
|||
|
||||
@QtCore.pyqtSlot(bool)
|
||||
def setAway(self, away=True):
|
||||
if hasattr(self, 'cli'):
|
||||
try:
|
||||
if away:
|
||||
self.cli.send("AWAY Idle")
|
||||
|
@ -377,6 +396,7 @@ class PesterIRC(QtCore.QThread):
|
|||
|
||||
@QtCore.pyqtSlot(QString, QString)
|
||||
def killSomeQuirks(self, channel, handle):
|
||||
if hasattr(self, 'cli'):
|
||||
c = str(channel)
|
||||
h = str(handle)
|
||||
try:
|
||||
|
|
2
menus.py
2
menus.py
|
@ -1815,6 +1815,8 @@ class LoadingScreen(QtWidgets.QDialog):
|
|||
#self.setWindowModality(QtCore.Qt.WindowModality.NonModal) # useless
|
||||
#self.setAttribute(QtCore.Qt.WidgetAttribute.WA_DeleteOnClose) # useless
|
||||
self.loadinglabel = QtWidgets.QLabel("CONN3CT1NG", self)
|
||||
#self.loadinglabel.setTextFormat(QtCore.Qt.TextFormat.RichText) # Clickable html links
|
||||
#self.loadinglabel.setWordWrap(True) # Unusable because of QT clipping bug (QTBUG-92381)
|
||||
self.cancel = QtWidgets.QPushButton("QU1T >:?", self)
|
||||
self.ok = QtWidgets.QPushButton("R3CONN3CT >:]", self)
|
||||
# Help reduce the number of accidental Pesterchum closures... :|
|
||||
|
|
|
@ -958,7 +958,7 @@ smiledict = {
|
|||
":chummy:": "pc_chummy.png",
|
||||
":cool:": "pccool.png",
|
||||
":smooth:": "pccool.png",
|
||||
":distraughtfirman": "pc_distraughtfirman.png",
|
||||
":distraughtfirman:": "pc_distraughtfirman.png",
|
||||
":distraught:": "pc_distraught.png",
|
||||
":insolent:": "pc_insolent.png",
|
||||
":bemused:": "pc_bemused.png",
|
||||
|
|
34
pesterchum.py
Normal file → Executable file
34
pesterchum.py
Normal file → Executable file
|
@ -1434,6 +1434,7 @@ class PesterWindow(MovingWindow):
|
|||
self.pingtimer = QtCore.QTimer()
|
||||
self.pingtimer.timeout.connect(self.checkPing)
|
||||
self.sincerecv = 0 # Time since last recv
|
||||
self.lastCheckPing = None
|
||||
|
||||
@QtCore.pyqtSlot(QString, QString)
|
||||
def updateMsg(self, ver, url):
|
||||
|
@ -1465,8 +1466,21 @@ class PesterWindow(MovingWindow):
|
|||
this function is called every 15sec'''
|
||||
# Return without irc
|
||||
if hasattr(self.parent, 'irc') == False:
|
||||
self.lastCheckPing = None
|
||||
self.sincerecv = 0
|
||||
return
|
||||
|
||||
# Desync check, happens if pc comes out of sleep.
|
||||
currentTime = time.time()
|
||||
timeDif = abs(currentTime - self.lastCheckPing)
|
||||
if timeDif > 180: # default UnrealIRCd ping timeout time.
|
||||
# 180 is the default UnrealIRCd ping timeout time.
|
||||
PchumLog.warning(("Possible desync, system time changed by %s "
|
||||
"seconds since last check. abs(%s - %s)")
|
||||
% (timeDif, currentTime, self.lastCheckPing))
|
||||
self.sincerecv = 85 # Allows one more ping attempt before disconnect.
|
||||
self.lastCheckPing = time.time()
|
||||
|
||||
# Presume connection is dead after 90 seconds of silence.
|
||||
if self.sincerecv >= 90:
|
||||
self.disconnectIRC.emit()
|
||||
|
@ -1481,15 +1495,17 @@ class PesterWindow(MovingWindow):
|
|||
self.setFocus()
|
||||
else:
|
||||
self.parent.irc.unresponsive = False
|
||||
if self.loadingscreen:
|
||||
if hasattr(self, 'loadingscreen'):
|
||||
if self.loadingscreen != None:
|
||||
PchumLog.warning("Server alive !! :O")
|
||||
self.loadingscreen.done(QtWidgets.QDialog.DialogCode.Accepted)
|
||||
|
||||
self.loadingscreen = None
|
||||
|
||||
# Send a ping if it's been 30 seconds since we've heard from the server.
|
||||
if self.sincerecv >= 30:
|
||||
self.pingServer.emit()
|
||||
|
||||
self.sincerecv += 15 # Only updating every 15s is better for performance.
|
||||
self.sincerecv += 5 # Not updating too frequently is better for performance.
|
||||
|
||||
def profile(self):
|
||||
return self.userprofile.chat
|
||||
|
@ -2163,10 +2179,16 @@ class PesterWindow(MovingWindow):
|
|||
self.doAutoJoins()
|
||||
|
||||
# Start client --> server pings
|
||||
if hasattr(self, 'pingtimer') == False:
|
||||
self.pingtimer.start(1000*15) # time in ms
|
||||
if hasattr(self, 'pingtimer'):
|
||||
self.pingtimer.start(1000*5) # time in ms
|
||||
else:
|
||||
self.pingtimer.start(1000*15)
|
||||
PchumLog.warning("No ping timer.")
|
||||
|
||||
# Desync check
|
||||
if hasattr(self, 'lastCheckPing'):
|
||||
self.lastCheckPing = time.time()
|
||||
else:
|
||||
PchumLog.warning("No ping timer.")
|
||||
|
||||
@QtCore.pyqtSlot()
|
||||
def blockSelectedChum(self):
|
||||
|
|
|
@ -112,7 +112,7 @@ smiledict = {
|
|||
":chummy:": "pc_chummy.png",
|
||||
":cool:": "pccool.png",
|
||||
":smooth:": "pccool.png",
|
||||
":distraughtfirman": "pc_distraughtfirman.png",
|
||||
":distraughtfirman:": "pc_distraughtfirman.png",
|
||||
":distraught:": "pc_distraught.png",
|
||||
":insolent:": "pc_insolent.png",
|
||||
":bemused:": "pc_bemused.png",
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
_pcVersion = "Alt. v2.4.3"
|
||||
buildVersion = "v2.4.3"
|
||||
_pcVersion = "Alt. v2.4.4"
|
||||
buildVersion = "v2.4.4"
|
||||
|
|
Loading…
Reference in a new issue