diff options
author | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2010-07-29 12:33:40 +0000 |
---|---|---|
committer | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2010-07-29 12:33:40 +0000 |
commit | 4b9ae942606322ad49bd97922737400fff5ea142 (patch) | |
tree | 9d7745ccccaee5827d9d2aee2abde3b1502314ae /gpgwin.cpp | |
parent | added warning, if file exists in file encryption (diff) | |
download | gpg4usb-4b9ae942606322ad49bd97922737400fff5ea142.tar.gz gpg4usb-4b9ae942606322ad49bd97922737400fff5ea142.zip |
decode quoted printable
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@363 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to 'gpgwin.cpp')
-rw-r--r-- | gpgwin.cpp | 37 |
1 files changed, 31 insertions, 6 deletions
@@ -520,10 +520,35 @@ void GpgWin::decrypt() preventNoDataErr(&text); mCtx->decrypt(text, tmp); if (!tmp->isEmpty()) { - // is it mime? - if (settings.value("mime/parseMime").toBool()) { - parseMime(tmp); + + /** + * 1) is it mime (content-type:) + * 2) parse header + * 2) choose action depending on content-type + */ + + if(Mime::isMime(tmp)) { + Header header = Mime::getHeader(tmp); + + // is it multipart, is multipart-parsing enabled + if(header.getValue("Content-Type") == "multipart/mixed" + && settings.value("mime/parseMime").toBool()) { + + parseMime(tmp); + + } else if(header.getValue("Content-Type") == "text/plain" + && settings.value("mime/parseQP").toBool()){ + + if (header.getValue("Content-Transfer-Encoding") == "quoted-printable") { + QByteArray *decode = new QByteArray(); + Mime::quotedPrintableDecode(*tmp, *decode); + //TODO: remove header + tmp = decode; + + } + } } + edit->setPlainText(QString::fromUtf8(*tmp)); } } @@ -546,11 +571,11 @@ void GpgWin::parseMime(QByteArray *message) Mime *mime = new Mime(message); foreach(MimePart tmp, mime->parts()) { - if (tmp.getValue("Content-Type") == "text/plain" - && tmp.getValue("Content-Transfer-Encoding") != "base64") { + if (tmp.header.getValue("Content-Type") == "text/plain" + && tmp.header.getValue("Content-Transfer-Encoding") != "base64") { QByteArray body; - if (tmp.getValue("Content-Transfer-Encoding") == "quoted-printable") { + if (tmp.header.getValue("Content-Transfer-Encoding") == "quoted-printable") { Mime::quotedPrintableDecode(tmp.body, body); } else { |