Update color field

This commit is contained in:
Dpeta 2022-09-06 00:11:45 +02:00
parent a906b6a98e
commit 45320c9bea
3 changed files with 17 additions and 7 deletions

View file

@ -1,10 +1,11 @@
# Changelog
(This document uses YYYY-MM-DD)
## [v2.4.3] - 2022-09-01
## [v2.4.3] - 2022-09-05
### Added
- Support for color via IRCv3 metadata draft.
- This way clients can keep track of each other's colors without requiring them to send a message first.
- Prompt for connecting anyway when certificate validation fails.
### Changed

8
irc.py
View file

@ -247,6 +247,14 @@ class PesterIRC(QtCore.QThread):
def updateColor(self):
#PchumLog.debug("irc updateColor (outgoing)")
#me = self.mainwindow.profile()
# Update color metadata field
try:
color = self.mainwindow.profile().color
helpers.metadata(self.cli, '*', "set", "color", str(color.name()))
except OSError as e:
PchumLog.warning(e)
self.setConnectionBroken()
# Send color messages
for h in list(self.mainwindow.convos.keys()):
try:
helpers.msg(self.cli, h, "COLOR >%s" % (self.mainwindow.profile().colorcmd()))

View file

@ -3273,6 +3273,7 @@ class PesterWindow(MovingWindow):
self.sendNotice.emit(code, RANDNICK)
except:
PchumLog.warning("No randomEncounter set in userconfig?")
self.mycolorUpdated.emit()
def aboutPesterchum(self):
if hasattr(self, 'aboutwindow') and self.aboutwindow:
@ -3698,8 +3699,11 @@ class PesterWindow(MovingWindow):
def connectAnyway(self, e):
# Prompt user to connect anyway
msgbox = QtWidgets.QMessageBox()
msgbox.setStyleSheet("QMessageBox{ %s }"
% self.theme["main/defaultwindow/style"])
try:
msgbox.setStyleSheet("QMessageBox{ %s }"
% self.theme["main/defaultwindow/style"])
except:
pass
msgbox.setIcon(QtWidgets.QMessageBox.Icon.Warning)
msgbox.setText("Server certificate validation failed")
msgbox.setInformativeText("Reason: \"%s (%s)\"" % (e.verify_message, e.verify_code)
@ -3709,10 +3713,7 @@ class PesterWindow(MovingWindow):
msgbox.setDefaultButton(QtWidgets.QMessageBox.StandardButton.No)
ret = msgbox.exec()
if ret == QtWidgets.QMessageBox.StandardButton.Yes:
self.parent.restartIRC(verify_hostname=False)
else:
return False
self.parent.restartIRC(verify_hostname=False)
pcUpdate = QtCore.pyqtSignal('QString', 'QString')
closeToTraySignal = QtCore.pyqtSignal()