From 581c553c9b89b7f74b8f8e9e330839d374b563bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Mon, 9 Dec 2024 19:50:52 +0100 Subject: [PATCH] update disclaim --- src/cpp/MainAttachment.cpp | 32 +++++++++++++++++--------------- src/include/MainAttachment.hpp | 2 +- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/cpp/MainAttachment.cpp b/src/cpp/MainAttachment.cpp index fca0e4c..9e778a7 100644 --- a/src/cpp/MainAttachment.cpp +++ b/src/cpp/MainAttachment.cpp @@ -101,6 +101,7 @@ static const string KAZ_HTML_DOWLOAD_OTHER ("(Contenu dans des messages pr& static const string KAZ_HTML_DOWLOAD_ALL ("Vous pouvez télécharger l'ensemble dans une archive là :"); static const string KAZ_HTML_DOWLOAD_CLOUD ("Vous pouvez classer les pièces jointes dans votre cloud là :"); static const string KAZ_HTML_ARCHIVE ("archive"); +static const string KAZ_HTML_CLOUD ("cloud"); static const string KAZ_EMPTY_TEXT_PLAIN ("Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: base64\n"); @@ -117,6 +118,7 @@ Attachment::stringsToUpdate ({KAZ_PLAIN_START, "\""+CID}); const string MainAttachment::templatePlainAddLink (" * "+TMPL_FILENAME+" < "+TMPL_DOWNLOAD+" >\n"); const string MainAttachment::templatePlainAllLink ("\n * "+KAZ_PLAIN_DOWLOAD_ALL+" < "+TMPL_DOWNLOAD+" >\n"); const string MainAttachment::templatePlainCloudLink ("\n * "+KAZ_PLAIN_DOWLOAD_CLOUD+" < "+TMPL_DOWNLOAD+" >\n"); +const string MainAttachment::templatePlainFooter ("\n\n"+KAZ_WEB_SITE+"\n\n"+KAZ_PLAIN_WARNING+"\n"+KAZ_PLAIN_HR+"\n"+KAZ_PLAIN_STOP+"\n\n"); const string MainAttachment::templateHtmlHeader (KAZ_HTML_START+"

"+KAZ_PLAIN_START+"


\n" "
" @@ -125,7 +127,7 @@ const string MainAttachment::templateHtmlHeader (KAZ_HTML_START+"

"+TMPL_FILENAME+""+LI_END+"\n"); const string MainAttachment::templateHtmlOtherLink (""+KAZ_HTML_DOWLOAD_OTHER+"

\n" "

"+KAZ_WEB_SITE+"

\n" "

"+KAZ_PLAIN_STOP+"

"+KAZ_HTML_STOP+"\n\n"); @@ -202,6 +204,18 @@ MainAttachment::copy (ifstream &mbox, ofstream &outbox, const streamoff &begin, outbox.flush (); } +// ================================================================================ +void +MainAttachment::readDownloadUrl (string &url) { + DEF_LOG ("MainAttachment::readDownloadUrl", ""); + url = ""; + string line; + getline (cin, line); + LOG ("get URL: " << line); + LOG_BUG (line.rfind ("url: ", 0) != 0, return, "eMailShrinker: bug M11: no download link. (line: " << line << ")"); + url = line.substr (5); +} + // ================================================================================ void MainAttachment::readArchiveUrl () { @@ -230,18 +244,6 @@ MainAttachment::readCloudUrl () { cloudDownloadURL = line.substr (7); } -// ================================================================================ -void -MainAttachment::readDownloadUrl (string &url) { - DEF_LOG ("MainAttachment::readDownloadUrl", ""); - url = ""; - string line; - getline (cin, line); - LOG ("get URL: " << line); - LOG_BUG (line.rfind ("url: ", 0) != 0, return, "eMailShrinker: bug M11: no download link. (line: " << line << ")"); - url = line.substr (5); -} - // ================================================================================ void MainAttachment::setExtractDir (const bfs::path &extractDir) { @@ -317,7 +319,7 @@ MainAttachment::getDisclaim (string &plain, string &html) const { replaceAll (allHtmlLinks, TMPL_DOWNLOAD, archiveDownloadURL); html += allHtmlLinks; } - if (linkCount && cloudDownloadURL.length ()) { + if (cloudDownloadURL.length ()) { string cloudPlainLinks (templatePlainCloudLink); replaceAll (cloudPlainLinks, TMPL_DOWNLOAD, cloudDownloadURL); plain += cloudPlainLinks; @@ -326,7 +328,7 @@ MainAttachment::getDisclaim (string &plain, string &html) const { html += cloudHtmlLinks; } html += templateHtmlFooter+"\n"; - plain += "\n\n"+KAZ_WEB_SITE+"\n\n"+KAZ_PLAIN_WARNING+"\n"+KAZ_PLAIN_HR+"\n"+KAZ_PLAIN_STOP+"\n\n\n"; + plain += templatePlainFooter+"\n"; // & => & done LOG ("plain: " << plain); LOG ("html: " << html); diff --git a/src/include/MainAttachment.hpp b/src/include/MainAttachment.hpp index 024119b..5e85fda 100644 --- a/src/include/MainAttachment.hpp +++ b/src/include/MainAttachment.hpp @@ -61,7 +61,7 @@ namespace kaz { class MainAttachment : public Attachment { public: /*! text to add in disclaim */ - static const string templatePlainAddLink, templatePlainAllLink, templatePlainCloudLink, templateHtmlHeader, templateHtmlAddLink, templateHtmlOtherLink, templateHtmlAllLink, templateHtmlCloudLink, templateHtmlFooter; + static const string templatePlainAddLink, templatePlainAllLink, templatePlainCloudLink, templatePlainFooter, templateHtmlHeader, templateHtmlAddLink, templateHtmlOtherLink, templateHtmlAllLink, templateHtmlCloudLink, templateHtmlFooter; /*! white space to split a text */ static const regex whiteSpaceRegEx;