From cc06be351e69c684733d70bf95e232b217d07767 Mon Sep 17 00:00:00 2001 From: Kiooeht Date: Tue, 28 Jun 2011 16:26:13 -0700 Subject: [PATCH] Set IRC away when idle --- CHANGELOG.mkdn | 1 + TODO.mkdn | 2 ++ irc.py | 10 ++++++++++ pesterchum.py | 7 +++++-- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.mkdn b/CHANGELOG.mkdn index 8b76a4b..822da9d 100644 --- a/CHANGELOG.mkdn +++ b/CHANGELOG.mkdn @@ -51,6 +51,7 @@ CHANGELOG * Ping server if no ping from server to test connection - Kiooeht [evacipatedBox] (Idea: Lexi [lexicalNuance]) * MSPA comic update notifier - Kiooeht [evacipatedBox] * Volume control - Kiooeht [evacipatedBox] +* Set IRC away on idle - Kiooeht [evacipatedBox] * Bug fixes * Logviewer updates - Kiooeht [evacipatedBox] * Memo scrollbar thing - Kiooeht [evacipatedBox] diff --git a/TODO.mkdn b/TODO.mkdn index b82d4cf..ebc0b2a 100644 --- a/TODO.mkdn +++ b/TODO.mkdn @@ -17,6 +17,7 @@ Features * Remote quirk disable * Tab completion of two letter names * Compress exit dumps into one line (eg. FTC, CTC, PTC1-12 ceased responding to memo) +* Customizable name alerts Bugs ---- @@ -29,6 +30,7 @@ Bugs * right clicking an offline chum and choosing remove asks you why you're reporting someone, and if you hit cancel the menus stop working * Closing a timeclone doesn't actually cease for everyone else * Alt characters break quirks +* +q(~) and +a(&) do weird things Windows Bugs ------------ diff --git a/irc.py b/irc.py index 71a96fd..30400c1 100644 --- a/irc.py +++ b/irc.py @@ -277,6 +277,16 @@ class PesterIRC(QtCore.QThread): except socket.error: self.setConnectionBroken() + @QtCore.pyqtSlot(bool) + def setAway(self, away=True): + try: + if away: + self.cli.send("AWAY Idle") + else: + self.cli.send("AWAY") + except socket.error: + self.setConnectionBroken() + moodUpdated = QtCore.pyqtSignal(QtCore.QString, Mood) colorUpdated = QtCore.pyqtSignal(QtCore.QString, QtGui.QColor) messageReceived = QtCore.pyqtSignal(QtCore.QString, QtCore.QString) diff --git a/pesterchum.py b/pesterchum.py index 0b0cbb6..2cb08a3 100644 --- a/pesterchum.py +++ b/pesterchum.py @@ -2318,6 +2318,7 @@ class PesterWindow(MovingWindow): @QtCore.pyqtSlot(bool) def toggleIdle(self, idle): if idle: + self.setAway.emit(True) sysColor = QtGui.QColor(self.theme["convo/systemMsgColor"]) verb = self.theme["convo/text/idle"] for (h, convo) in self.convos.iteritems(): @@ -2327,6 +2328,7 @@ class PesterWindow(MovingWindow): self.chatlog.log(h, msg) self.sendMessage.emit("PESTERCHUM:IDLE", h) else: + self.setAway.emit(False) self.idletime = 0 @QtCore.pyqtSlot() def checkIdle(self): @@ -2943,6 +2945,7 @@ class PesterWindow(MovingWindow): reconnectIRC = QtCore.pyqtSignal() gainAttention = QtCore.pyqtSignal(QtGui.QWidget) pingServer = QtCore.pyqtSignal() + setAway = QtCore.pyqtSignal(bool) class PesterTray(QtGui.QSystemTrayIcon): def __init__(self, icon, mainwindow, parent): @@ -3101,8 +3104,8 @@ class MainProgram(QtCore.QObject): 'channelNames(QString)'), ('inviteChum(QString, QString)', 'inviteChum(QString, QString)'), - ('pingServer()', - 'pingServer()'), + ('pingServer()', 'pingServer()'), + ('setAway(bool)', 'setAway(bool)'), ('reconnectIRC()', 'reconnectIRC()') ] # IRC --> Main window