Skip to content

Commit

Permalink
Update color field
Browse files Browse the repository at this point in the history
  • Loading branch information
Dpeta committed Sep 5, 2022
1 parent a906b6a commit 45320c9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 8 additions & 0 deletions irc.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,14 @@ def updateMood(self):
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()))
Expand Down
13 changes: 7 additions & 6 deletions pesterchum.py
Original file line number Diff line number Diff line change
Expand Up @@ -3273,6 +3273,7 @@ def switchProfile(self):
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:
Expand Down Expand Up @@ -3698,8 +3699,11 @@ def chooseServer(self):
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)
Expand All @@ -3709,10 +3713,7 @@ def connectAnyway(self, e):
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()
Expand Down

0 comments on commit 45320c9

Please sign in to comment.