From 4571b6dce7b4a4c286e6e0049134050298b7ae47 Mon Sep 17 00:00:00 2001 From: Dpeta Date: Thu, 17 Mar 2022 04:11:52 +0000 Subject: [PATCH] ban/kick message to msgbox --- irc.py | 7 ++----- memos.py | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/irc.py b/irc.py index b98b6b4..e257258 100644 --- a/irc.py +++ b/irc.py @@ -543,11 +543,8 @@ class PesterHandler(DefaultCommandHandler): # Server-set usermodes don't need to be passed. if (handles == ['']) & ( ('x' in m) | ('z' in m) | ('o' in m) | ('x' in m) )!=True: - try: - self.parent.userPresentUpdate.emit(handles[i], channel, m+":%s" % (op)) - except: - PchumLog.exception('') - + self.parent.userPresentUpdate.emit(handles[i], channel, m+":%s" % (op)) + #self.parent.userPresentUpdate.emit(handles[i], channel, m+":%s" % (op)) # Passing an empty handle here might cause a crash. #except IndexError: diff --git a/memos.py b/memos.py index 57bd1ac..6d311d5 100644 --- a/memos.py +++ b/memos.py @@ -1251,7 +1251,23 @@ class PesterMemo(PesterConvo): msgbox = QtWidgets.QMessageBox() msgbox.setStyleSheet("QMessageBox{" + self.mainwindow.theme["main/defaultwindow/style"] + "}") msgbox.setText(self.mainwindow.theme["convo/text/kickedmemo"]) - msgbox.setInformativeText("press 0k to rec0nnect or cancel to absc0nd") + + # Add ban(kick) reason + # l = split update + if len(l) >= 3: + if l[1] != l[2]: # If there's no reason then reason is set to handle + # Process spare ':' characters (this might not be safe?) + aggrievocation = l[1] + ": " + l[2] + if len(l) > 3: + aggrievocation += ':' + for x in range(3, len(l)): + aggrievocation += l[x] + ':' + aggrievocation = aggrievocation.strip(':') + msgbox.setInformativeText("%s\n\npress 0k to rec0nnect or cancel to absc0nd" % aggrievocation) + else: + msgbox.setInformativeText("press 0k to rec0nnect or cancel to absc0nd") + else: + msgbox.setInformativeText("press 0k to rec0nnect or cancel to absc0nd") msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel) # Find the OK button and make it default for b in msgbox.buttons():