diff --git a/CHANGELOG.md b/CHANGELOG.md index e46a639..81a49ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ CHANGELOG ========= -3.5a, 2015-06-15 +3.5c, 2015-06-30 ------------------ - added emoticons to chat statistics; - added shared image download for HTML export; @@ -9,6 +9,7 @@ CHANGELOG - applying or resetting message filter will scroll to last selection; - added support for copying selected list items to clipboard; - stopped caching messages on export to avoid memory shortage; +- fixed parsing messages with deeply nested HTML (issue #38); - fixed a potential error with unexpected data in quoted messages; - fixed a potential error message on filtering chat messages; - made database comparison report window retain scroll position at the bottom; diff --git a/skyperious/conf.py b/skyperious/conf.py index d130151..4e3b59b 100644 --- a/skyperious/conf.py +++ b/skyperious/conf.py @@ -10,7 +10,7 @@ @author Erki Suurjaak @created 26.11.2011 -@modified 15.06.2015 +@modified 30.06.2015 ------------------------------------------------------------------------------ """ from ConfigParser import RawConfigParser @@ -23,8 +23,8 @@ """Program title, version number and version date.""" Title = "Skyperious" -Version = "3.5a" -VersionDate = "15.06.2015" +Version = "3.5c" +VersionDate = "30.06.2015" if getattr(sys, "frozen", False): # Running as a pyinstaller executable diff --git a/skyperious/skypedata.py b/skyperious/skypedata.py index bb95cb0..966ea45 100644 --- a/skyperious/skypedata.py +++ b/skyperious/skypedata.py @@ -8,7 +8,7 @@ @author Erki Suurjaak @created 26.11.2011 -@modified 26.06.2015 +@modified 30.06.2015 ------------------------------------------------------------------------------ """ import cgi @@ -1604,7 +1604,9 @@ def parse_message_dom(self, message, options): body = self.EMOTICON_RGX.sub(self.EMOTICON_REPL, body) dom = self.make_xml(body, message) - if MESSAGE_TYPE_SMS == message["type"]: + if MESSAGE_TYPE_SMS == message["type"] \ + or (MESSAGE_TYPE_INFO == message["type"] + and "6 # 0 @@ -1993,37 +1995,19 @@ def dom_to_html(self, dom, output, message): def dom_to_text(self, dom): """Returns a plaintext representation of the message DOM.""" - fulltext = "" - to_skip = {} # {element to skip: True, } - for elem in dom.getiterator(): - if elem in to_skip: - continue - text = elem.text or "" - tail = elem.tail or "" - subitems = [] - if "quote" == elem.tag: - text = "\"" + text - subitems = elem.getchildren() - elif "quotefrom" == elem.tag: - text = "\"\r\n%s\r\n" % text - elif "msgstatus" == elem.tag: - text = "[%s]\r\n" % text.strip() - elif "ss" == elem.tag: - text = elem.text - elif elem.tag in ["i", "b", "s"]: # italic bold strikethrough - pre = post = dict(zip("ibs", "_*~"))[elem.tag] - if elem.get("raw_pre"): pre = elem.get("raw_pre") - if elem.get("raw_post"): post = elem.get("raw_post") - text, tail = pre + text, post + tail - subitems = elem.getchildren() - if text: - fulltext += text - for i in subitems: - fulltext += self.dom_to_text(i) - to_skip[i] = True - if tail: - fulltext += tail - return fulltext + text, tail = dom.text or "", dom.tail or "" + if "quote" == dom.tag: + text = "\"" + text + elif "quotefrom" == dom.tag: + text = "\"\r\n%s\r\n" % text + elif "msgstatus" == dom.tag: + text = "[%s]\r\n" % text.strip() + elif dom.tag in ["i", "b", "s"]: # italic bold strikethrough + pre = post = dict(i="_", b="*", s="~")[dom.tag] + if dom.get("raw_pre"): pre = dom.get("raw_pre") + if dom.get("raw_post"): post = dom.get("raw_post") + text, tail = pre + text, post + tail + return text + "".join(self.dom_to_text(x) for x in dom) + tail def sanitize(self, dom, known_tags):