From 3475d464f8b24e715ea09a940da6ca0480a72781 Mon Sep 17 00:00:00 2001 From: Kiooeht Date: Wed, 24 Aug 2011 00:10:23 -0700 Subject: [PATCH] Compress kick exit dumps into one line --- dataobjs.py | 27 ++++++++++++++++++++------- memos.py | 22 ++++++++++++---------- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/dataobjs.py b/dataobjs.py index a452695..8dbd22d 100644 --- a/dataobjs.py +++ b/dataobjs.py @@ -249,15 +249,28 @@ class PesterProfile(object): initials = pcf+self.initials() return "%s %s %s %s." % \ (syscolor.name(), self.colorhtml(), initials, timetext, verb, channel[1:].upper().replace("_", " ")) - def memobanmsg(self, opchum, opgrammar, syscolor, timeGrammar, reason): + def memobanmsg(self, opchum, opgrammar, syscolor, initials, reason): + opinit = opgrammar.pcf+opchum.initials()+opgrammar.number + if type(initials) == type(list()): + if opchum.handle == reason: + return "%s banned %s from responding to memo." % \ + (opchum.colorhtml(), opinit, self.colorhtml(), ", ".join(initials)) + else: + return "%s banned %s from responding to memo: [%s]." % \ + (opchum.colorhtml(), opinit, self.colorhtml(), ", ".join(initials), unicode(reason)) + else: + initials = timeGrammar.pcf+self.initials()+timeGrammar.number + if opchum.handle == reason: + return "%s banned %s from responding to memo." % \ + (opchum.colorhtml(), opinit, self.colorhtml(), initials) + else: + return "%s banned %s from responding to memo: [%s]." % \ + (opchum.colorhtml(), opinit, self.colorhtml(), initials, unicode(reason)) + def memopermabanmsg(self, opchum, opgrammar, syscolor, timeGrammar): initials = timeGrammar.pcf+self.initials()+timeGrammar.number opinit = opgrammar.pcf+opchum.initials()+opgrammar.number - if opchum.handle == reason: - return "%s banned %s from responding to memo." % \ - (opchum.colorhtml(), opinit, self.colorhtml(), initials) - else: - return "%s banned %s from responding to memo: [%s]." % \ - (opchum.colorhtml(), opinit, self.colorhtml(), initials, unicode(reason)) + return "%s permabanned %s from the memo." % \ + (opchum.colorhtml(), opinit, self.colorhtml(), initials) def memojoinmsg(self, syscolor, td, timeGrammar, verb): (temporal, pcf, when) = (timeGrammar.temporal, timeGrammar.pcf, timeGrammar.when) timetext = timeDifference(td) diff --git a/memos.py b/memos.py index cbca0a9..9cc0e20 100644 --- a/memos.py +++ b/memos.py @@ -987,19 +987,21 @@ class PesterMemo(PesterConvo): ttracker = self.times[h] else: ttracker = TimeTracker(timedelta(0)) + allinitials = [] + 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") while ttracker.getTime() is not None: grammar = ttracker.getGrammar() - 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.memobanmsg(opchum, opgrammar, systemColor, grammar, reason) - self.textArea.append(convertTags(msg)) - self.mainwindow.chatlog.log(self.channel, msg) + allinitials.append("%s%s%s" % (grammar.pcf, chum.initials(), grammar.number)) ttracker.removeTime(ttracker.getTime()) + msg = chum.memobanmsg(opchum, opgrammar, systemColor, allinitials, reason) + self.textArea.append(convertTags(msg)) + self.mainwindow.chatlog.log(self.channel, msg) if chum is self.mainwindow.profile(): # are you next?