Minor idle cleanup

This commit is contained in:
karxi 2016-12-10 19:49:58 -05:00
parent e8de29b1db
commit 7b018e0906
2 changed files with 8 additions and 4 deletions

View file

@ -406,8 +406,7 @@ class PesterText(QtGui.QTextEdit):
window.chatlog.log(parent.chum.handle, lexmsg) window.chatlog.log(parent.chum.handle, lexmsg)
else: else:
if ((window.idler.auto or window.idler.manual) and parent.chumopen if ((window.idler.auto or window.idler.manual) and parent.chumopen
and chum.handle.lower() not in ('nickserv', 'chanserv', and not parent.isBot(handle)):
'hostserv')):
idlethreshhold = 60 idlethreshhold = 60
if (not hasattr(self, 'lastmsg')) or \ if (not hasattr(self, 'lastmsg')) or \
datetime.now() - self.lastmsg > timedelta(0,idlethreshhold): datetime.now() - self.lastmsg > timedelta(0,idlethreshhold):

View file

@ -2051,7 +2051,6 @@ class PesterWindow(MovingWindow):
# karxi: TODO: Need to consider sticking an idle-setter here. # karxi: TODO: Need to consider sticking an idle-setter here.
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def checkIdle(self): def checkIdle(self):
# TODO: Streamline this later, because ew.
newpos = QtGui.QCursor.pos() newpos = QtGui.QCursor.pos()
oldpos = self.idler.pos oldpos = self.idler.pos
# Save the new position. # Save the new position.
@ -2094,7 +2093,7 @@ class PesterWindow(MovingWindow):
# might affect, but I've been using it for months and haven't # might affect, but I've been using it for months and haven't
# noticed any issues.... # noticed any issues....
handle = convo.chum.handle handle = convo.chum.handle
if handle.lower() in ("nickserv", "chanserv", "memoserv"): if self.isBot(handle):
# Don't send these idle messages. # Don't send these idle messages.
continue continue
# karxi: Now we just use 'handle' instead of 'h'. # karxi: Now we just use 'handle' instead of 'h'.
@ -2103,6 +2102,12 @@ class PesterWindow(MovingWindow):
convo.textArea.append(convertTags(msg)) convo.textArea.append(convertTags(msg))
self.chatlog.log(handle, msg) self.chatlog.log(handle, msg)
self.sendMessage.emit("PESTERCHUM:IDLE", handle) self.sendMessage.emit("PESTERCHUM:IDLE", handle)
# Presented here so it can be called by other scripts.
@staticmethod
def isBot(handle):
return handle.upper() in BOTNAMES
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def importExternalConfig(self): def importExternalConfig(self):
f = QtGui.QFileDialog.getOpenFileName(self) f = QtGui.QFileDialog.getOpenFileName(self)