From a02790f9b13384ac37c9ac19979828834854e2bc Mon Sep 17 00:00:00 2001 From: illuminatedwax Date: Sun, 10 Apr 2011 04:22:06 -0500 Subject: [PATCH] bug fixes --- CHANGELOG.mkdn | 8 +++++++- TODO | 5 +---- convo.py | 22 +++++++++++++--------- dataobjs.py | 10 ++++++---- irc.py | 4 ++-- parsetools.py | 37 +++++++++++++++++++++++++++++++++++++ pesterchum.js | 2 +- 7 files changed, 67 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.mkdn b/CHANGELOG.mkdn index 058a066..f3f52da 100644 --- a/CHANGELOG.mkdn +++ b/CHANGELOG.mkdn @@ -12,11 +12,17 @@ CHANGELOG * Art - Grimlive [aquaMarinist] * Quirks lower() function - Kiooeht [evacipatedBox] * Quirks scrabble() function - Kiooeht [evacipatedBox] +* Quirks reverse() function - illuminatedwax [ghostDunk] * Timestamps - Kiooeht [evacipatedBox] * Logviewer - Kiooeht [evacipatedBox] * Quirk ordering - alGore -* # of users in a memo +* # of users in a memo - alGore BUG FIXES: +* mixer bug fixed +* "flags" bug fixed * incorrect characters in memos no longer break log file names * memos now do not break on case-sensitivity +* fixed QDB address +* now lines too long to send in a single message are split up correctly +* quirk replace bug fixed \ No newline at end of file diff --git a/TODO b/TODO index 7945cd4..a865abd 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,5 @@ Bugs: -* multiline msgs breaks shit -* REGEXP: \b(\S)(\S*)(\S)\b REPLACE WITH: upper(\1)\2upper(\3) <-- - this regexp, when used as a quirk and then typed in breaks -* channels aren't case sensitive! get the real name of a channel +* weird memo time bug * Windows doesn't show style sheet sometimes?? Maybe related to themes. * 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 diff --git a/convo.py b/convo.py index 2a6ddac..4c2b02b 100644 --- a/convo.py +++ b/convo.py @@ -9,7 +9,7 @@ from PyQt4 import QtGui, QtCore from dataobjs import PesterProfile, Mood, PesterHistory from generic import PesterIcon, RightClickList -from parsetools import convertTags, lexMessage, mecmd, colorBegin, colorEnd, img2smiley +from parsetools import convertTags, lexMessage, splitMessage, mecmd, colorBegin, colorEnd, img2smiley class PesterTabWindow(QtGui.QFrame): def __init__(self, mainwindow, parent=None, convo="convo"): @@ -350,7 +350,7 @@ class PesterText(QtGui.QTextEdit): "Accept": "text/plain"} try: pass - hconn = httplib.HTTPConnection('luke.violentlemon.com', 80, + hconn = httplib.HTTPConnection('qdb.pesterchum.net', 80, timeout=15) hconn.request("POST", "/index.php", params, headers) response = hconn.getresponse() @@ -599,13 +599,17 @@ class PesterConvo(QtGui.QFrame): lexmsg = lexMessage(text) if type(lexmsg[0]) is not mecmd and self.applyquirks: lexmsg = quirks.apply(lexmsg) - serverMsg = copy(lexmsg) - self.addMessage(lexmsg, True) - # if ceased, rebegin - if hasattr(self, 'chumopen') and not self.chumopen: - self.mainwindow.newConvoStarted.emit(QtCore.QString(self.title()), True) - text = convertTags(serverMsg, "ctag") - self.messageSent.emit(text, self.title()) + lexmsgs = splitMessage(lexmsg) + + for lm in lexmsgs: + serverMsg = copy(lm) + self.addMessage(lm, True) + # if ceased, rebegin + if hasattr(self, 'chumopen') and not self.chumopen: + self.mainwindow.newConvoStarted.emit(QtCore.QString(self.title()), True) + self.setChumOpen(True) + text = convertTags(serverMsg, "ctag") + self.messageSent.emit(text, self.title()) self.textInput.setText("") @QtCore.pyqtSlot() diff --git a/dataobjs.py b/dataobjs.py index 94d8797..38d071f 100644 --- a/dataobjs.py +++ b/dataobjs.py @@ -7,10 +7,11 @@ from generic import PesterIcon from parsetools import timeDifference, convertTags, lexMessage from mispeller import mispeller -_upperre = re.compile(r"upper\(([\w\\]+)\)") -_lowerre = re.compile(r"lower\(([\w\\]+)\)") -_scramblere = re.compile(r"scramble\(([\w\\]+)\)") -_reversere = re.compile(r"reverse\(([\w\\]+)\)") +_groupre = re.compile(r"\\([0-9]+)") +_upperre = re.compile(r"upper\(([\w<>\\]+)\)") +_lowerre = re.compile(r"lower\(([\w<>\\]+)\)") +_scramblere = re.compile(r"scramble\(([\w<>\\]+)\)") +_reversere = re.compile(r"reverse\(([\w<>\\]+)\)") class Mood(object): moods = ["chummy", "rancorous", "offline", "pleasant", "distraught", @@ -63,6 +64,7 @@ class pesterQuirk(object): return string def regexprep(mo): to = self.quirk["to"] + to = _groupre.sub(r"\\g<\1>", to) def upperrep(m): return mo.expand(m.group(1)).upper() def lowerrep(m): diff --git a/irc.py b/irc.py index a30294d..c0a9e08 100644 --- a/irc.py +++ b/irc.py @@ -97,8 +97,8 @@ class PesterIRC(QtCore.QThread): space = l[0].rfind(" ", 0,400) if space == -1: space = 400 - a = l[0][0:space] - b = l[0][space:] + a = l[0][0:space+1] + b = l[0][space+1:] if len(b) > 0: return [a] + splittext([b]) else: diff --git a/parsetools.py b/parsetools.py index c70beb7..a495c93 100644 --- a/parsetools.py +++ b/parsetools.py @@ -131,6 +131,8 @@ def lexMessage(string): (hyperlink, _urlre), (memolex, _memore), (smiley, _smilere)] + string = unicode(string) + string = string.replace("\n", " ").replace("\r", " ") lexed = lexer(unicode(string), lexlist) balanced = [] @@ -176,6 +178,41 @@ def convertTags(lexed, format="html"): return escaped +def splitMessage(msg, format="ctag"): + """Splits message if it is too long.""" + okmsg = [] + cbegintags = [] + output = [] + for o in msg: + okmsg.append(o) + if type(o) is colorBegin: + cbegintags.append(o) + elif type(o) is colorEnd: + cbegintags.pop() + # yeah normally i'd do binary search but im lazy + msglen = len(convertTags(okmsg, format)) + 4*(len(cbegintags)) + if msglen > 400: + okmsg.pop() + if len(okmsg) == 0: + output.append([o]) + else: + tmp = [] + for color in cbegintags: + okmsg.append(colorEnd("")) + tmp.append(color) + output.append(okmsg) + if type(o) is colorBegin: + cbegintags.append(o) + elif type(o) is colorEnd: + cbegintags.pop() + tmp.append(o) + okmsg = tmp + + if len(okmsg) > 0: + output.append(okmsg) + return output + + def addTimeInitial(string, grammar): endofi = string.find(":") diff --git a/pesterchum.js b/pesterchum.js index 1f3a778..984b9eb 100644 --- a/pesterchum.js +++ b/pesterchum.js @@ -1 +1 @@ -{"hideOfflineChums": true, "time12Format": true, "tabs": true, "showSeconds": false, "server": "irc.mindfang.org", "soundon": true, "showTimeStamps": false, "chums": ["unknownTraveler", "tentacleTherapist", "vaginalEngineer", "mechanicalSpectacle", "carcinoGeneticist", "schlagzeugGator", "gamblingGenocider", "gardenGnostic", "centaursTesticle", "arachnidsGrip", "grimAuxiliatrix", "remoteBloodbath", "nitroZealist", "greenZephyr", "arsenicCatnip", "cuttlefishCuller", "rageInducer", "gallowsCalibrator", "caligulasAquarium", "terminallyCapricious", "illuminatedWax", "aquaMarinist", "elegantDiversion", "moirailBunp", "uroborosUnbound", "androidTechnician", "midnightSparrow", "apocalypseArisen", "anguillaNuntia", "oilslickOrchid", "pretentiousFantasia", "aquaticMarinist", "lyricalKeraunoscopic", "counterRealist", "ectoBiologist", "percipientPedestrian", "asceticClinician", "doctectiveMiracles", "noSense", "ircMonster", "twinArmageddons", "cannabisHero", "jetRocket", "adiosToreador", "turntechGodhead", "magmaExploiter", "hannaSongstress", "endlessVoid", "grayscaleVisionary", "corruptedInsanity", "stupidlyBrilliant", "artsyGyarados", "obliviousCrafter", "sporadicAgent", "subtleChaotician", "nareSolee", "apostateCourier", "nocturnalTherapist", "herpaDerp", "clockworkUtopia", "digitalSamurai", "astronomicalMaster", "slipshodBrisant", "genialDustbuster", "hyperdriveTyphoon", "magnificentMiser", "gentleRuffian", "riskRepeats", "globalsoftPrika", "globalsoftPirka", "devonianCritter", "lethargicSerpent", "laughingShisa", "bluntInstrument", "sunilaSeed", "bluntInstrument", "nickServ", "ghostBinoculars", "alGore", "evacipatedBox"], "defaultprofile": "ghostDunk", "block": []} \ No newline at end of file +{"hideOfflineChums": false, "time12Format": true, "tabs": true, "soundon": true, "server": "irc.mindfang.org", "showSeconds": false, "showTimeStamps": false, "chums": ["unknownTraveler", "tentacleTherapist", "vaginalEngineer", "mechanicalSpectacle", "carcinoGeneticist", "schlagzeugGator", "gamblingGenocider", "gardenGnostic", "centaursTesticle", "arachnidsGrip", "grimAuxiliatrix", "remoteBloodbath", "nitroZealist", "greenZephyr", "arsenicCatnip", "cuttlefishCuller", "rageInducer", "gallowsCalibrator", "caligulasAquarium", "terminallyCapricious", "illuminatedWax", "aquaMarinist", "elegantDiversion", "moirailBunp", "uroborosUnbound", "androidTechnician", "midnightSparrow", "apocalypseArisen", "anguillaNuntia", "oilslickOrchid", "pretentiousFantasia", "aquaticMarinist", "lyricalKeraunoscopic", "counterRealist", "ectoBiologist", "percipientPedestrian", "asceticClinician", "doctectiveMiracles", "noSense", "ircMonster", "twinArmageddons", "cannabisHero", "jetRocket", "adiosToreador", "turntechGodhead", "magmaExploiter", "hannaSongstress", "endlessVoid", "grayscaleVisionary", "corruptedInsanity", "stupidlyBrilliant", "artsyGyarados", "obliviousCrafter", "sporadicAgent", "subtleChaotician", "nareSolee", "apostateCourier", "nocturnalTherapist", "herpaDerp", "clockworkUtopia", "digitalSamurai", "astronomicalMaster", "slipshodBrisant", "genialDustbuster", "hyperdriveTyphoon", "magnificentMiser", "gentleRuffian", "riskRepeats", "globalsoftPrika", "globalsoftPirka", "devonianCritter", "lethargicSerpent", "laughingShisa", "bluntInstrument", "sunilaSeed", "bluntInstrument", "nickServ", "ghostBinoculars", "alGore", "evacipatedBox", "acrylicEmulator", "prettyGemmaiden"], "defaultprofile": "testProfile", "block": []} \ No newline at end of file