Display OP, DeOP, Voice, and Devoice messages in memos
This commit is contained in:
parent
433a4ec8c7
commit
cdce13bacf
6 changed files with 130 additions and 7 deletions
|
@ -18,6 +18,7 @@ Bugs
|
|||
* Issues with connecting? Client not closing connection right? People keep getting "nick taken" messages
|
||||
* Windows XP SP2: sometimes mouse clicks dont register? must be some kinda crash
|
||||
* When using mood sort, scroll position jumps to last selected chum
|
||||
* In memos, entering when someone has +ov and then they -o, you don't see that they have +v
|
||||
|
||||
Mac Bugs
|
||||
--------
|
||||
|
|
16
dataobjs.py
16
dataobjs.py
|
@ -252,6 +252,22 @@ class PesterProfile(object):
|
|||
return "<c=%s><c=%s>%s %s [%s]</c> %s %s." % \
|
||||
(syscolor.name(), self.colorhtml(), temporal, self.handle,
|
||||
initials, timetext, verb)
|
||||
def memoopmsg(self, opchum, opgrammar, syscolor):
|
||||
opinit = opgrammar.pcf+opchum.initials()+opgrammar.number
|
||||
return "<c=%s>%s</c> made <c=%s>%s</c> an OP." % \
|
||||
(opchum.colorhtml(), opinit, self.colorhtml(), self.initials())
|
||||
def memodeopmsg(self, opchum, opgrammar, syscolor):
|
||||
opinit = opgrammar.pcf+opchum.initials()+opgrammar.number
|
||||
return "<c=%s>%s</c> took away <c=%s>%s</c>'s OP powers." % \
|
||||
(opchum.colorhtml(), opinit, self.colorhtml(), self.initials())
|
||||
def memovoicemsg(self, opchum, opgrammar, syscolor):
|
||||
opinit = opgrammar.pcf+opchum.initials()+opgrammar.number
|
||||
return "<c=%s>%s</c> gave <c=%s>%s</c> voice." % \
|
||||
(opchum.colorhtml(), opinit, self.colorhtml(), self.initials())
|
||||
def memodevoicemsg(self, opchum, opgrammar, syscolor):
|
||||
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())
|
||||
|
||||
@staticmethod
|
||||
def checkLength(handle):
|
||||
|
|
16
irc.py
16
irc.py
|
@ -321,7 +321,21 @@ class PesterHandler(DefaultCommandHandler):
|
|||
if channel == "#pesterchum":
|
||||
self.parent.moodUpdated.emit(handle, Mood("chummy"))
|
||||
def mode(self, op, channel, mode, handle=""):
|
||||
self.parent.userPresentUpdate.emit(handle, channel, mode)
|
||||
opnick = op[0:op.find("!")]
|
||||
if op == channel or channel == self.parent.mainwindow.profile().handle:
|
||||
modes = list(self.parent.mainwindow.modes)
|
||||
if modes and modes[0] == "+": modes = modes[1:]
|
||||
if mode[0] == "+":
|
||||
modes.extend(mode[1:])
|
||||
elif mode[0] == "-":
|
||||
for i in mode[1:]:
|
||||
try:
|
||||
modes.remove(i)
|
||||
except ValueError:
|
||||
pass
|
||||
modes.sort()
|
||||
self.parent.mainwindow.modes = "+" + "".join(modes)
|
||||
self.parent.userPresentUpdate.emit(handle, channel, mode+":%s" % (op))
|
||||
def nick(self, oldnick, newnick):
|
||||
oldhandle = oldnick[0:oldnick.find("!")]
|
||||
if oldhandle == self.mainwindow.profile().handle:
|
||||
|
|
89
memos.py
89
memos.py
|
@ -648,6 +648,10 @@ class PesterMemo(PesterConvo):
|
|||
oldnick = l[0]
|
||||
newnick = l[1]
|
||||
h = oldnick
|
||||
if update[0:2] in ["+o", "-o", "+v", "-v"]:
|
||||
l = update.split(":")
|
||||
update = l[0]
|
||||
op = l[1]
|
||||
if (update in ["join","left", "kick", "+o", "-o", "+v", "-v"]) \
|
||||
and channel != self.channel:
|
||||
return
|
||||
|
@ -728,7 +732,26 @@ class PesterMemo(PesterConvo):
|
|||
serverText = "PESTERCHUM:TIME>"+delta2txt(time, "server")
|
||||
self.messageSent.emit(serverText, self.title())
|
||||
elif update == "+o":
|
||||
chums = self.userlist.findItems(h, QtCore.Qt.MatchFlags(0))
|
||||
if self.mainwindow.config.opvoiceMessages():
|
||||
chum = PesterProfile(h)
|
||||
if h == self.mainwindow.profile().handle:
|
||||
chum = self.mainwindow.profile()
|
||||
ttracker = self.time
|
||||
curtime = self.time.getTime()
|
||||
elif self.times.has_key(h):
|
||||
ttracker = self.times[h]
|
||||
else:
|
||||
ttracker = TimeTracker(timedelta(0))
|
||||
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")
|
||||
msg = chum.memoopmsg(opchum, opgrammar, systemColor)
|
||||
self.textArea.append(convertTags(msg))
|
||||
self.mainwindow.chatlog.log(self.channel, msg)
|
||||
for c in chums:
|
||||
c.op = True
|
||||
icon = PesterIcon(self.mainwindow.theme["memos/op/icon"])
|
||||
|
@ -738,7 +761,27 @@ class PesterMemo(PesterConvo):
|
|||
self.userlist.optionsMenu.addAction(self.voiceAction)
|
||||
self.userlist.optionsMenu.addAction(self.banuserAction)
|
||||
elif update == "-o":
|
||||
chums = self.userlist.findItems(h, QtCore.Qt.MatchFlags(0))
|
||||
self.mainwindow.channelNames.emit(self.channel)
|
||||
if self.mainwindow.config.opvoiceMessages():
|
||||
chum = PesterProfile(h)
|
||||
if h == self.mainwindow.profile().handle:
|
||||
chum = self.mainwindow.profile()
|
||||
ttracker = self.time
|
||||
curtime = self.time.getTime()
|
||||
elif self.times.has_key(h):
|
||||
ttracker = self.times[h]
|
||||
else:
|
||||
ttracker = TimeTracker(timedelta(0))
|
||||
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")
|
||||
msg = chum.memodeopmsg(opchum, opgrammar, systemColor)
|
||||
self.textArea.append(convertTags(msg))
|
||||
self.mainwindow.chatlog.log(self.channel, msg)
|
||||
for c in chums:
|
||||
c.op = False
|
||||
if c.voice:
|
||||
|
@ -752,14 +795,52 @@ class PesterMemo(PesterConvo):
|
|||
self.userlist.optionsMenu.removeAction(self.voiceAction)
|
||||
self.userlist.optionsMenu.removeAction(self.banuserAction)
|
||||
elif update == "+v":
|
||||
chums = self.userlist.findItems(h, QtCore.Qt.MatchFlags(0))
|
||||
if self.mainwindow.config.opvoiceMessages():
|
||||
chum = PesterProfile(h)
|
||||
if h == self.mainwindow.profile().handle:
|
||||
chum = self.mainwindow.profile()
|
||||
ttracker = self.time
|
||||
curtime = self.time.getTime()
|
||||
elif self.times.has_key(h):
|
||||
ttracker = self.times[h]
|
||||
else:
|
||||
ttracker = TimeTracker(timedelta(0))
|
||||
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")
|
||||
msg = chum.memovoicemsg(opchum, opgrammar, systemColor)
|
||||
self.textArea.append(convertTags(msg))
|
||||
self.mainwindow.chatlog.log(self.channel, msg)
|
||||
for c in chums:
|
||||
c.voice = True
|
||||
if not c.op:
|
||||
icon = PesterIcon(self.mainwindow.theme["memos/voice/icon"])
|
||||
c.setIcon(icon)
|
||||
elif update == "-v":
|
||||
chums = self.userlist.findItems(h, QtCore.Qt.MatchFlags(0))
|
||||
if self.mainwindow.config.opvoiceMessages():
|
||||
chum = PesterProfile(h)
|
||||
if h == self.mainwindow.profile().handle:
|
||||
chum = self.mainwindow.profile()
|
||||
ttracker = self.time
|
||||
curtime = self.time.getTime()
|
||||
elif self.times.has_key(h):
|
||||
ttracker = self.times[h]
|
||||
else:
|
||||
ttracker = TimeTracker(timedelta(0))
|
||||
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")
|
||||
msg = chum.memodevoicemsg(opchum, opgrammar, systemColor)
|
||||
self.textArea.append(convertTags(msg))
|
||||
self.mainwindow.chatlog.log(self.channel, msg)
|
||||
for c in chums:
|
||||
c.voice = False
|
||||
if c.op:
|
||||
|
|
5
menus.py
5
menus.py
|
@ -666,6 +666,10 @@ class PesterOptions(QtGui.QDialog):
|
|||
if self.config.showSeconds():
|
||||
self.secondscheck.setChecked(True)
|
||||
|
||||
self.memomessagecheck = QtGui.QCheckBox("Show OP and Voice Messages in Memos", self)
|
||||
if self.config.opvoiceMessages():
|
||||
self.memomessagecheck.setChecked(True)
|
||||
|
||||
self.userlinkscheck = QtGui.QCheckBox("Disable #Memo and @User Links", self)
|
||||
self.userlinkscheck.setChecked(self.config.disableUserLinks())
|
||||
self.userlinkscheck.setVisible(False)
|
||||
|
@ -754,6 +758,7 @@ class PesterOptions(QtGui.QDialog):
|
|||
layout_chat.addWidget(self.timestampcheck)
|
||||
layout_chat.addWidget(self.timestampBox)
|
||||
layout_chat.addWidget(self.secondscheck)
|
||||
layout_chat.addWidget(self.memomessagecheck)
|
||||
# Re-enable these when it's possible to disable User and Memo links
|
||||
#layout_chat.addWidget(hr)
|
||||
#layout_chat.addWidget(QtGui.QLabel("User and Memo Links"))
|
||||
|
|
|
@ -346,6 +346,8 @@ class userConfig(object):
|
|||
return self.config.get('miniAction', 0)
|
||||
def closeAction(self):
|
||||
return self.config.get('closeAction', 1)
|
||||
def opvoiceMessages(self):
|
||||
return self.config.get('opvMessages', True)
|
||||
def addChum(self, chum):
|
||||
if chum.handle not in self.chums():
|
||||
fp = open(self.filename) # what if we have two clients open??
|
||||
|
@ -777,7 +779,6 @@ class chumArea(RightClickTree):
|
|||
child_1 = QtGui.QTreeWidgetItem(["%s" % (g)])
|
||||
j = 0
|
||||
for h in self.groups:
|
||||
print h + ":" + g
|
||||
if h == g:
|
||||
self.insertTopLevelItem(j, child_1)
|
||||
break
|
||||
|
@ -2423,6 +2424,11 @@ class PesterWindow(MovingWindow):
|
|||
if closesetting != curclose:
|
||||
self.config.set('closeAction', closesetting)
|
||||
self.setButtonAction(self.closeButton, closesetting, curclose)
|
||||
# op and voice messages
|
||||
opvmesssetting = self.optionmenu.memomessagecheck.isChecked()
|
||||
curopvmess = self.config.opvoiceMessages()
|
||||
if opvmesssetting != curopvmess:
|
||||
self.config.set('opvMessages', opvmesssetting)
|
||||
self.optionmenu = None
|
||||
|
||||
def setButtonAction(self, button, setting, old):
|
||||
|
@ -2630,7 +2636,7 @@ class MainProgram(QtCore.QObject):
|
|||
def __init__(self):
|
||||
QtCore.QObject.__init__(self)
|
||||
self.app = QtGui.QApplication(sys.argv)
|
||||
self.app.setApplicationName("Pesterchum 3.14");
|
||||
self.app.setApplicationName("Pesterchum 3.14")
|
||||
if pygame.mixer:
|
||||
# we could set the frequency higher but i love how cheesy it sounds
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue