From fd8c7881f836c7e1fb01c42dcca714bc38f82e71 Mon Sep 17 00:00:00 2001 From: Kiooeht Date: Sat, 2 Jul 2011 14:10:59 -0700 Subject: [PATCH] Compress exit dumps into one line --- CHANGELOG.mkdn | 1 + TODO.mkdn | 2 +- dataobjs.py | 20 ++++++++++++++++++-- memos.py | 12 +++++++++--- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.mkdn b/CHANGELOG.mkdn index f57bd04..395cc46 100644 --- a/CHANGELOG.mkdn +++ b/CHANGELOG.mkdn @@ -53,6 +53,7 @@ CHANGELOG * Volume control - Kiooeht [evacipatedBox] * 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]) * Bug fixes * Logviewer updates - Kiooeht [evacipatedBox] * Memo scrollbar thing - Kiooeht [evacipatedBox] diff --git a/TODO.mkdn b/TODO.mkdn index 7fed7ff..2b68f1f 100644 --- a/TODO.mkdn +++ b/TODO.mkdn @@ -15,8 +15,8 @@ Features * Chum notes? * whowas for last seen online? * Tab completion of two letter names -* Compress exit dumps into one line (eg. FTC, CTC, PTC1-12 ceased responding to memo) * Customizable name alerts +* When 'banned' make impossible to connect using timestamp banned under Bugs ---- diff --git a/dataobjs.py b/dataobjs.py index fac8c0b..a1ae24e 100644 --- a/dataobjs.py +++ b/dataobjs.py @@ -231,8 +231,24 @@ class PesterProfile(object): return "-- %s [%s] changed their mood to %s --" % (syscolor.name(), self.handle, self.colorhtml(), self.initials(), mood.name().upper(), theme["main/chums/moods"][mood.name()]["icon"]) def idlemsg(self, syscolor, verb): return "-- %s [%s] %s --" % (syscolor.name(), self.handle, self.colorhtml(), self.initials(), verb) - def memoclosemsg(self, syscolor, timeGrammar, verb): - return "%s%s%s %s." % (syscolor.name(), self.colorhtml(), timeGrammar.pcf, self.initials(), timeGrammar.number, verb) + def memoclosemsg(self, syscolor, initials, verb): + msg = "" % (syscolor.name(), self.colorhtml()) + for i,n in initials.iteritems(): + msg += i + if len(n) == 1: + if n[0] != 0: + msg += str(n[0]) + elif len(n) > 1: + n.sort() + msg += str(n[0]) + last = n[0] + pos = 1 + while n[pos] == last+1: + + last += 1 + msg += "%s-%s" % (min(n), max(n)) + msg += ", " + return msg[:-2] + " %s." % (verb) def memoopenmsg(self, syscolor, td, timeGrammar, verb, channel): (temporal, pcf, when) = (timeGrammar.temporal, timeGrammar.pcf, timeGrammar.when) timetext = timeDifference(td) diff --git a/memos.py b/memos.py index 2ffa6b9..889f75e 100644 --- a/memos.py +++ b/memos.py @@ -791,13 +791,19 @@ class PesterMemo(PesterConvo): self.userlist.takeItem(self.userlist.row(c)) if not self.times.has_key(h): self.times[h] = TimeTracker(timedelta(0)) + allinitials = {} while self.times[h].getTime() is not None: t = self.times[h] grammar = t.getGrammar() - msg = chum.memoclosemsg(systemColor, grammar, self.mainwindow.theme["convo/text/closememo"]) - self.textArea.append(convertTags(msg)) - self.mainwindow.chatlog.log(self.channel, msg) + #allinitials.append("%s%s%s" % (grammar.pcf, chum.initials(), grammar.number)) + if "%s%s" % (grammar.pcf, chum.initials()) in allinitials: + allinitials["%s%s" % (grammar.pcf, chum.initials())].append(int(grammar.number) if grammar.number.isdigit() else 0) + else: + allinitials["%s%s" % (grammar.pcf, chum.initials())] = [int(grammar.number) if grammar.number.isdigit() else 0] self.times[h].removeTime(t.getTime()) + msg = chum.memoclosemsg(systemColor, allinitials, self.mainwindow.theme["convo/text/closememo"]) + self.textArea.append(convertTags(msg)) + self.mainwindow.chatlog.log(self.channel, msg) if update == "nick": self.addUser(newnick) newchums = self.userlist.findItems(newnick, QtCore.Qt.MatchFlags(0))