Display channel mode changes in memos
This commit is contained in:
parent
475a6259b6
commit
edba3f6fcc
4 changed files with 60 additions and 9 deletions
|
@ -51,9 +51,11 @@ 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]
|
||||
* Debug mode - illuminatedwax [ghostDunk]
|
||||
* Set IRC away on idle - Kiooeht [evacipatedBox]
|
||||
* Remote quirk shutoff in memos - Kiooeht [evacipatedBox]
|
||||
* Compress exit dumps into one line - Kiooeht [evacipatedBox] (Idea: Lexi [lexicalNuance])
|
||||
* Display channel mode change message - Kiooeht [evacipatedBox]
|
||||
* Bug fixes
|
||||
* Logviewer updates - Kiooeht [evacipatedBox]
|
||||
* Memo scrollbar thing - Kiooeht [evacipatedBox]
|
||||
|
|
|
@ -274,6 +274,12 @@ class PesterProfile(object):
|
|||
opinit = opgrammar.pcf+opchum.initials()+opgrammar.number
|
||||
return "<c=%s>%s</c> took away <c=%s>%s</c>'s voice." % \
|
||||
(opchum.colorhtml(), opinit, self.colorhtml(), self.initials())
|
||||
def memomodemsg(self, opchum, opgrammar, syscolor, modeverb, modeon):
|
||||
opinit = opgrammar.pcf+opchum.initials()+opgrammar.number
|
||||
if modeon: modeon = "now"
|
||||
else: modeon = "no longer"
|
||||
return "<c=%s>Memo is %s <c=black>%s</c> by <c=%s>%s</c></c>" % \
|
||||
(syscolor.name(), modeon, modeverb, opchum.colorhtml(), opinit)
|
||||
|
||||
@staticmethod
|
||||
def checkLength(handle):
|
||||
|
|
58
memos.py
58
memos.py
|
@ -621,27 +621,67 @@ class PesterMemo(PesterConvo):
|
|||
for u in users:
|
||||
self.userlist.addItem(u)
|
||||
|
||||
def updateChanModes(self, modes):
|
||||
def updateChanModes(self, modes, op):
|
||||
if not hasattr(self, 'modes'): self.modes = ""
|
||||
chanmodes = list(str(self.modes))
|
||||
if chanmodes and chanmodes[0] == "+": chanmodes = chanmodes[1:]
|
||||
modes = str(modes)
|
||||
if op:
|
||||
systemColor = QtGui.QColor(self.mainwindow.theme["memos/systemMsgColor"])
|
||||
chum = self.mainwindow.profile()
|
||||
opchum = PesterProfile(op)
|
||||
if self.times.has_key(op):
|
||||
opgrammar = self.times[op].getGrammar()
|
||||
elif op == self.mainwindow.profile().handle:
|
||||
opgrammar = self.time.getGrammar()
|
||||
else:
|
||||
opgrammar = TimeGrammar("CURRENT", "C", "RIGHT NOW")
|
||||
if modes[0] == "+":
|
||||
for m in modes[1:]:
|
||||
if m not in chanmodes:
|
||||
chanmodes.extend(m)
|
||||
if modes.find("s") >= 0: self.chanHide.setChecked(True)
|
||||
if modes.find("i") >= 0: self.chanInvite.setChecked(True)
|
||||
if modes.find("m") >= 0: self.chanMod.setChecked(True)
|
||||
if modes.find("s") >= 0:
|
||||
self.chanHide.setChecked(True)
|
||||
if op:
|
||||
msg = chum.memomodemsg(opchum, opgrammar, systemColor, "Secret", True)
|
||||
self.textArea.append(convertTags(msg))
|
||||
self.mainwindow.chatlog.log(self.channel, msg)
|
||||
if modes.find("i") >= 0:
|
||||
self.chanInvite.setChecked(True)
|
||||
if op:
|
||||
msg = chum.memomodemsg(opchum, opgrammar, systemColor, "Invite-Only", True)
|
||||
self.textArea.append(convertTags(msg))
|
||||
self.mainwindow.chatlog.log(self.channel, msg)
|
||||
if modes.find("m") >= 0:
|
||||
self.chanMod.setChecked(True)
|
||||
if op:
|
||||
msg = chum.memomodemsg(opchum, opgrammar, systemColor, "Mute", True)
|
||||
self.textArea.append(convertTags(msg))
|
||||
self.mainwindow.chatlog.log(self.channel, msg)
|
||||
elif modes[0] == "-":
|
||||
for i in modes[1:]:
|
||||
try:
|
||||
chanmodes.remove(i)
|
||||
except ValueError:
|
||||
pass
|
||||
if modes.find("s") >= 0: self.chanHide.setChecked(False)
|
||||
if modes.find("i") >= 0: self.chanInvite.setChecked(False)
|
||||
if modes.find("m") >= 0: self.chanMod.setChecked(False)
|
||||
if modes.find("s") >= 0:
|
||||
self.chanHide.setChecked(False)
|
||||
if op:
|
||||
msg = chum.memomodemsg(opchum, opgrammar, systemColor, "Secret", False)
|
||||
self.textArea.append(convertTags(msg))
|
||||
self.mainwindow.chatlog.log(self.channel, msg)
|
||||
if modes.find("i") >= 0:
|
||||
self.chanInvite.setChecked(False)
|
||||
if op:
|
||||
msg = chum.memomodemsg(opchum, opgrammar, systemColor, "Invite-Only", False)
|
||||
self.textArea.append(convertTags(msg))
|
||||
self.mainwindow.chatlog.log(self.channel, msg)
|
||||
if modes.find("m") >= 0:
|
||||
self.chanMod.setChecked(False)
|
||||
if op:
|
||||
msg = chum.memomodemsg(opchum, opgrammar, systemColor, "Mute", False)
|
||||
self.textArea.append(convertTags(msg))
|
||||
self.mainwindow.chatlog.log(self.channel, msg)
|
||||
chanmodes.sort()
|
||||
self.modes = "+" + "".join(chanmodes)
|
||||
if self.mainwindow.advanced:
|
||||
|
@ -732,7 +772,7 @@ class PesterMemo(PesterConvo):
|
|||
def modesUpdated(self, channel, modes):
|
||||
c = unicode(channel)
|
||||
if c == self.channel:
|
||||
self.updateChanModes(modes)
|
||||
self.updateChanModes(modes, None)
|
||||
|
||||
@QtCore.pyqtSlot(QtCore.QString)
|
||||
def closeInviteOnly(self, channel):
|
||||
|
@ -999,7 +1039,7 @@ class PesterMemo(PesterConvo):
|
|||
c.setIcon(icon)
|
||||
self.sortUsers()
|
||||
elif c == self.channel and h == "" and update[0] in ["+","-"]:
|
||||
self.updateChanModes(update)
|
||||
self.updateChanModes(update, op)
|
||||
|
||||
@QtCore.pyqtSlot()
|
||||
def addChumSlot(self):
|
||||
|
|
|
@ -2203,6 +2203,9 @@ class PesterWindow(MovingWindow):
|
|||
@QtCore.pyqtSlot(QtCore.QString, QtCore.QString)
|
||||
def cannotSendToChan(self, channel, msg):
|
||||
self.deliverMemo(channel, "ChanServ", msg)
|
||||
@QtCore.pyqtSlot(QtCore.QString, QtCore.QString)
|
||||
def modesUpdated(self, channel, modes):
|
||||
self.modesUpdated.emit(channel, modes)
|
||||
@QtCore.pyqtSlot(QtCore.QString, QtCore.QString, QtCore.QString)
|
||||
def timeCommand(self, chan, handle, command):
|
||||
(c, h, cmd) = (unicode(chan), unicode(handle), unicode(command))
|
||||
|
|
Loading…
Reference in a new issue