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 # Changelog
(This document uses YYYY-MM-DD) (This document uses YYYY-MM-DD)
## [v2.4.3] - 2022-09-01 ## [v2.4.3] - 2022-09-05
### Added ### Added
- Support for color via IRCv3 metadata draft. - 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. - Prompt for connecting anyway when certificate validation fails.
### Changed ### Changed

8
irc.py
View file

@ -247,6 +247,14 @@ class PesterIRC(QtCore.QThread):
def updateColor(self): def updateColor(self):
#PchumLog.debug("irc updateColor (outgoing)") #PchumLog.debug("irc updateColor (outgoing)")
#me = self.mainwindow.profile() #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()): for h in list(self.mainwindow.convos.keys()):
try: try:
helpers.msg(self.cli, h, "COLOR >%s" % (self.mainwindow.profile().colorcmd())) 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) self.sendNotice.emit(code, RANDNICK)
except: except:
PchumLog.warning("No randomEncounter set in userconfig?") PchumLog.warning("No randomEncounter set in userconfig?")
self.mycolorUpdated.emit()
def aboutPesterchum(self): def aboutPesterchum(self):
if hasattr(self, 'aboutwindow') and self.aboutwindow: if hasattr(self, 'aboutwindow') and self.aboutwindow:
@ -3698,8 +3699,11 @@ class PesterWindow(MovingWindow):
def connectAnyway(self, e): def connectAnyway(self, e):
# Prompt user to connect anyway # Prompt user to connect anyway
msgbox = QtWidgets.QMessageBox() msgbox = QtWidgets.QMessageBox()
try:
msgbox.setStyleSheet("QMessageBox{ %s }" msgbox.setStyleSheet("QMessageBox{ %s }"
% self.theme["main/defaultwindow/style"]) % self.theme["main/defaultwindow/style"])
except:
pass
msgbox.setIcon(QtWidgets.QMessageBox.Icon.Warning) msgbox.setIcon(QtWidgets.QMessageBox.Icon.Warning)
msgbox.setText("Server certificate validation failed") msgbox.setText("Server certificate validation failed")
msgbox.setInformativeText("Reason: \"%s (%s)\"" % (e.verify_message, e.verify_code) msgbox.setInformativeText("Reason: \"%s (%s)\"" % (e.verify_message, e.verify_code)
@ -3710,9 +3714,6 @@ class PesterWindow(MovingWindow):
ret = msgbox.exec() ret = msgbox.exec()
if ret == QtWidgets.QMessageBox.StandardButton.Yes: if ret == QtWidgets.QMessageBox.StandardButton.Yes:
self.parent.restartIRC(verify_hostname=False) self.parent.restartIRC(verify_hostname=False)
else:
return False
pcUpdate = QtCore.pyqtSignal('QString', 'QString') pcUpdate = QtCore.pyqtSignal('QString', 'QString')
closeToTraySignal = QtCore.pyqtSignal() closeToTraySignal = QtCore.pyqtSignal()