Remote quirk shutoff

This commit is contained in:
Kiooeht 2011-06-29 10:19:22 -07:00
parent cc06be351e
commit 4a2fe110f2
6 changed files with 56 additions and 3 deletions

View file

@ -52,6 +52,7 @@ CHANGELOG
* MSPA comic update notifier - Kiooeht [evacipatedBox] * MSPA comic update notifier - Kiooeht [evacipatedBox]
* Volume control - Kiooeht [evacipatedBox] * Volume control - Kiooeht [evacipatedBox]
* Set IRC away on idle - Kiooeht [evacipatedBox] * Set IRC away on idle - Kiooeht [evacipatedBox]
* Remote quirk shutoff in memos - Kiooeht [evacipatedBox]
* Bug fixes * Bug fixes
* Logviewer updates - Kiooeht [evacipatedBox] * Logviewer updates - Kiooeht [evacipatedBox]
* Memo scrollbar thing - Kiooeht [evacipatedBox] * Memo scrollbar thing - Kiooeht [evacipatedBox]

View file

@ -14,7 +14,6 @@ Features
* Colour saving boxes things? * Colour saving boxes things?
* Chum notes? * Chum notes?
* whowas for last seen online? * whowas for last seen online?
* Remote quirk disable
* Tab completion of two letter names * Tab completion of two letter names
* Compress exit dumps into one line (eg. FTC, CTC, PTC1-12 ceased responding to memo) * Compress exit dumps into one line (eg. FTC, CTC, PTC1-12 ceased responding to memo)
* Customizable name alerts * Customizable name alerts

15
irc.py
View file

@ -287,6 +287,15 @@ class PesterIRC(QtCore.QThread):
except socket.error: except socket.error:
self.setConnectionBroken() self.setConnectionBroken()
@QtCore.pyqtSlot(QtCore.QString, QtCore.QString)
def killSomeQuirks(self, channel, handle):
c = unicode(channel)
h = unicode(handle)
try:
helpers.ctcp(self.cli, c, "NOQUIRKS", h)
except socket.error:
self.setConnectionBroken()
moodUpdated = QtCore.pyqtSignal(QtCore.QString, Mood) moodUpdated = QtCore.pyqtSignal(QtCore.QString, Mood)
colorUpdated = QtCore.pyqtSignal(QtCore.QString, QtGui.QColor) colorUpdated = QtCore.pyqtSignal(QtCore.QString, QtGui.QColor)
messageReceived = QtCore.pyqtSignal(QtCore.QString, QtCore.QString) messageReceived = QtCore.pyqtSignal(QtCore.QString, QtCore.QString)
@ -305,6 +314,7 @@ class PesterIRC(QtCore.QThread):
QtCore.QString) QtCore.QString)
cannotSendToChan = QtCore.pyqtSignal(QtCore.QString, QtCore.QString) cannotSendToChan = QtCore.pyqtSignal(QtCore.QString, QtCore.QString)
tooManyPeeps = QtCore.pyqtSignal() tooManyPeeps = QtCore.pyqtSignal()
quirkDisable = QtCore.pyqtSignal(QtCore.QString, QtCore.QString, QtCore.QString)
class PesterHandler(DefaultCommandHandler): class PesterHandler(DefaultCommandHandler):
def notice(self, nick, chan, msg): def notice(self, nick, chan, msg):
@ -331,7 +341,10 @@ class PesterHandler(DefaultCommandHandler):
handle = nick[0:nick.find("!")] handle = nick[0:nick.find("!")]
logging.info("---> recv \"CTCP %s :%s\"" % (handle, msg[1:-1])) logging.info("---> recv \"CTCP %s :%s\"" % (handle, msg[1:-1]))
if msg[1:-1] == "VERSION": if msg[1:-1] == "VERSION":
helpers.notice(self.parent.cli, handle, "\x01VERSION Pesterchum %s\x01" % (_pcVersion)) helpers.ctcp_reply(self.parent.cli, handle, "VERSION", "Pesterchum %s\x01" % (_pcVersion))
elif msg[1:-1].startswith("NOQUIRKS") and chan[0] == "#":
op = nick[0:nick.find("!")]
self.parent.quirkDisable.emit(chan, msg[10:-1], op)
return return
handle = nick[0:nick.find("!")] handle = nick[0:nick.find("!")]
logging.info("---> recv \"PRIVMSG %s :%s\"" % (handle, msg)) logging.info("---> recv \"PRIVMSG %s :%s\"" % (handle, msg))

View file

@ -374,6 +374,9 @@ class PesterMemo(PesterConvo):
self.voiceAction = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/voiceuser"], self) self.voiceAction = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/voiceuser"], self)
self.connect(self.voiceAction, QtCore.SIGNAL('triggered()'), self.connect(self.voiceAction, QtCore.SIGNAL('triggered()'),
self, QtCore.SLOT('voiceSelectedUser()')) self, QtCore.SLOT('voiceSelectedUser()'))
self.quirkDisableAction = QtGui.QAction("Kill Quirk", self)
self.connect(self.quirkDisableAction, QtCore.SIGNAL('triggered()'),
self, QtCore.SLOT('killQuirkUser()'))
self.userlist.optionsMenu.addAction(self.addchumAction) self.userlist.optionsMenu.addAction(self.addchumAction)
# ban & op list added if we are op # ban & op list added if we are op
@ -538,6 +541,7 @@ class PesterMemo(PesterConvo):
self.banuserAction.setText(theme["main/menus/rclickchumlist/banuser"]) self.banuserAction.setText(theme["main/menus/rclickchumlist/banuser"])
self.opAction.setText(theme["main/menus/rclickchumlist/opuser"]) self.opAction.setText(theme["main/menus/rclickchumlist/opuser"])
self.voiceAction.setText(theme["main/menus/rclickchumlist/voiceuser"]) self.voiceAction.setText(theme["main/menus/rclickchumlist/voiceuser"])
self.quirkDisableAction.setText("Kill Quirk")
self.quirksOff.setText(theme["main/menus/rclickchumlist/quirksoff"]) self.quirksOff.setText(theme["main/menus/rclickchumlist/quirksoff"])
self.logchum.setText(theme["main/menus/rclickchumlist/viewlog"]) self.logchum.setText(theme["main/menus/rclickchumlist/viewlog"])
@ -748,6 +752,14 @@ class PesterMemo(PesterConvo):
msgbox.setStandardButtons(QtGui.QMessageBox.Ok) msgbox.setStandardButtons(QtGui.QMessageBox.Ok)
ret = msgbox.exec_() ret = msgbox.exec_()
def quirkDisable(self, op, msg):
chums = self.userlist.findItems(op, QtCore.Qt.MatchFlags(0))
for c in chums:
if c.op:
if msg == self.mainwindow.profile().handle:
self.quirksOff.setChecked(True)
self.applyquirks = False
@QtCore.pyqtSlot(QtCore.QString, QtCore.QString, QtCore.QString) @QtCore.pyqtSlot(QtCore.QString, QtCore.QString, QtCore.QString)
def userPresentChange(self, handle, channel, update): def userPresentChange(self, handle, channel, update):
h = unicode(handle) h = unicode(handle)
@ -887,6 +899,7 @@ class PesterMemo(PesterConvo):
self.userlist.optionsMenu.addAction(self.opAction) self.userlist.optionsMenu.addAction(self.opAction)
self.userlist.optionsMenu.addAction(self.voiceAction) self.userlist.optionsMenu.addAction(self.voiceAction)
self.userlist.optionsMenu.addAction(self.banuserAction) self.userlist.optionsMenu.addAction(self.banuserAction)
self.userlist.optionsMenu.addAction(self.quirkDisableAction)
self.optionsMenu.addMenu(self.chanModeMenu) self.optionsMenu.addMenu(self.chanModeMenu)
self.sortUsers() self.sortUsers()
elif update == "-o": elif update == "-o":
@ -923,6 +936,7 @@ class PesterMemo(PesterConvo):
self.userlist.optionsMenu.removeAction(self.opAction) self.userlist.optionsMenu.removeAction(self.opAction)
self.userlist.optionsMenu.removeAction(self.voiceAction) self.userlist.optionsMenu.removeAction(self.voiceAction)
self.userlist.optionsMenu.removeAction(self.banuserAction) self.userlist.optionsMenu.removeAction(self.banuserAction)
self.userlist.optionsMenu.removeAction(self.quirkDisableAction)
self.optionsMenu.removeAction(self.chanModeMenu.menuAction()) self.optionsMenu.removeAction(self.chanModeMenu.menuAction())
self.sortUsers() self.sortUsers()
elif update == "+v": elif update == "+v":
@ -1011,6 +1025,13 @@ class PesterMemo(PesterConvo):
return return
currentHandle = unicode(self.userlist.currentItem().text()) currentHandle = unicode(self.userlist.currentItem().text())
self.mainwindow.setChannelMode.emit(self.channel, "+v", currentHandle) self.mainwindow.setChannelMode.emit(self.channel, "+v", currentHandle)
@QtCore.pyqtSlot()
def killQuirkUser(self):
if not self.userlist.currentItem():
return
currentHandle = unicode(self.userlist.currentItem().text())
self.mainwindow.killSomeQuirks.emit(self.channel, currentHandle)
def resetSlider(self, time, send=True): def resetSlider(self, time, send=True):
self.timeinput.setText(delta2txt(time)) self.timeinput.setText(delta2txt(time))
self.timeinput.setSlider() self.timeinput.setSlider()

View file

@ -47,6 +47,12 @@ def mode(cli, channel, mode, options=None):
cmd += " %s" % (options) cmd += " %s" % (options)
cli.send(cmd) cli.send(cmd)
def ctcp(cli, handle, cmd, msg=""):
cli.send("PRIVMSG", handle, "\x01%s %s\x01" % (cmd, msg))
def ctcp_reply(cli, handle, cmd, msg=""):
notice(cli, str(handle), "\x01%s %s\x01" % (cmd.upper(), msg))
def msgrandom(cli, choices, dest, user=None): def msgrandom(cli, choices, dest, user=None):
o = "%s: " % user if user else "" o = "%s: " % user if user else ""
o += random.choice(choices) o += random.choice(choices)

View file

@ -2201,6 +2201,14 @@ class PesterWindow(MovingWindow):
if self.memos[c]: if self.memos[c]:
self.memos[c].timeUpdate(h, cmd) self.memos[c].timeUpdate(h, cmd)
@QtCore.pyqtSlot(QtCore.QString, QtCore.QString, QtCore.QString)
def quirkDisable(self, channel, msg, op):
(c, msg, op) = (unicode(channel), unicode(msg), unicode(op))
if not self.memos.has_key(c):
return
memo = self.memos[c]
memo.quirkDisable(op, msg)
@QtCore.pyqtSlot(QtCore.QString, PesterList) @QtCore.pyqtSlot(QtCore.QString, PesterList)
def updateNames(self, channel, names): def updateNames(self, channel, names):
c = unicode(channel) c = unicode(channel)
@ -2946,6 +2954,7 @@ class PesterWindow(MovingWindow):
gainAttention = QtCore.pyqtSignal(QtGui.QWidget) gainAttention = QtCore.pyqtSignal(QtGui.QWidget)
pingServer = QtCore.pyqtSignal() pingServer = QtCore.pyqtSignal()
setAway = QtCore.pyqtSignal(bool) setAway = QtCore.pyqtSignal(bool)
killSomeQuirks = QtCore.pyqtSignal(QtCore.QString, QtCore.QString)
class PesterTray(QtGui.QSystemTrayIcon): class PesterTray(QtGui.QSystemTrayIcon):
def __init__(self, icon, mainwindow, parent): def __init__(self, icon, mainwindow, parent):
@ -3106,6 +3115,8 @@ class MainProgram(QtCore.QObject):
'inviteChum(QString, QString)'), 'inviteChum(QString, QString)'),
('pingServer()', 'pingServer()'), ('pingServer()', 'pingServer()'),
('setAway(bool)', 'setAway(bool)'), ('setAway(bool)', 'setAway(bool)'),
('killSomeQuirks(QString, QString)',
'killSomeQuirks(QString, QString)'),
('reconnectIRC()', 'reconnectIRC()') ('reconnectIRC()', 'reconnectIRC()')
] ]
# IRC --> Main window # IRC --> Main window
@ -3141,7 +3152,9 @@ class MainProgram(QtCore.QObject):
('cannotSendToChan(QString, QString)', ('cannotSendToChan(QString, QString)',
'cannotSendToChan(QString, QString)'), 'cannotSendToChan(QString, QString)'),
('tooManyPeeps()', ('tooManyPeeps()',
'tooManyPeeps()') 'tooManyPeeps()'),
('quirkDisable(QString, QString, QString)',
'quirkDisable(QString, QString, QString)')
] ]
def connectWidgets(self, irc, widget): def connectWidgets(self, irc, widget):
self.connect(irc, QtCore.SIGNAL('finished()'), self.connect(irc, QtCore.SIGNAL('finished()'),