update disclaim

This commit is contained in:
François 2024-12-09 19:50:52 +01:00
parent f03c0ec95b
commit 581c553c9b
2 changed files with 18 additions and 16 deletions

View File

@ -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_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_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_ARCHIVE ("archive");
static const string KAZ_HTML_CLOUD ("cloud");
static const string KAZ_EMPTY_TEXT_PLAIN ("Content-Type: text/plain; charset=utf-8\n" static const string KAZ_EMPTY_TEXT_PLAIN ("Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: base64\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::templatePlainAddLink (" * "+TMPL_FILENAME+" < "+TMPL_DOWNLOAD+" >\n");
const string MainAttachment::templatePlainAllLink ("\n * "+KAZ_PLAIN_DOWLOAD_ALL+" < "+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::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+"<p style=\"clear: left; padding: 1pc 0 0 0; font-size:10px; color:#969696;\">"+KAZ_PLAIN_START+"</p><hr>\n" const string MainAttachment::templateHtmlHeader (KAZ_HTML_START+"<p style=\"clear: left; padding: 1pc 0 0 0; font-size:10px; color:#969696;\">"+KAZ_PLAIN_START+"</p><hr>\n"
"<div class=\"kaz\">" "<div class=\"kaz\">"
@ -125,7 +127,7 @@ const string MainAttachment::templateHtmlHeader (KAZ_HTML_START+"<p style=\"cle
const string MainAttachment::templateHtmlAddLink (LI_ONE+"<a "+HREF_ONE+TMPL_DOWNLOAD+"\">"+TMPL_FILENAME+"</a>"+LI_END+"\n"); const string MainAttachment::templateHtmlAddLink (LI_ONE+"<a "+HREF_ONE+TMPL_DOWNLOAD+"\">"+TMPL_FILENAME+"</a>"+LI_END+"\n");
const string MainAttachment::templateHtmlOtherLink ("</ul>"+KAZ_HTML_DOWLOAD_OTHER+"<ul>\n"); const string MainAttachment::templateHtmlOtherLink ("</ul>"+KAZ_HTML_DOWLOAD_OTHER+"<ul>\n");
const string MainAttachment::templateHtmlAllLink ("</ul><ul>"+LI_ALL+KAZ_HTML_DOWLOAD_ALL+" <a href=\""+TMPL_DOWNLOAD+"\">"+KAZ_HTML_ARCHIVE+"</a>"+LI_END+"\n"); const string MainAttachment::templateHtmlAllLink ("</ul><ul>"+LI_ALL+KAZ_HTML_DOWLOAD_ALL+" <a href=\""+TMPL_DOWNLOAD+"\">"+KAZ_HTML_ARCHIVE+"</a>"+LI_END+"\n");
const string MainAttachment::templateHtmlCloudLink ("</ul><ul>"+LI_ALL+KAZ_HTML_DOWLOAD_CLOUD+" <a href=\""+TMPL_DOWNLOAD+"\">"+KAZ_HTML_ARCHIVE+"</a>"+LI_END+"\n"); const string MainAttachment::templateHtmlCloudLink ("</ul><ul>"+LI_ALL+KAZ_HTML_DOWLOAD_CLOUD+" <a href=\""+TMPL_DOWNLOAD+"\">"+KAZ_HTML_CLOUD+"</a>"+LI_END+"\n");
const string MainAttachment::templateHtmlFooter ("</ul></p>\n" const string MainAttachment::templateHtmlFooter ("</ul></p>\n"
"<p class=\"msg\"><a class=\"kaz\" href=\""+KAZ_WEB_SITE+"\"> "+KAZ_WEB_SITE+" </a></p></div>\n" "<p class=\"msg\"><a class=\"kaz\" href=\""+KAZ_WEB_SITE+"\"> "+KAZ_WEB_SITE+" </a></p></div>\n"
"<hr><p style=\"font-size:10px; color:#969696;\">"+KAZ_PLAIN_STOP+"</p>"+KAZ_HTML_STOP+"\n\n"); "<hr><p style=\"font-size:10px; color:#969696;\">"+KAZ_PLAIN_STOP+"</p>"+KAZ_HTML_STOP+"\n\n");
@ -202,6 +204,18 @@ MainAttachment::copy (ifstream &mbox, ofstream &outbox, const streamoff &begin,
outbox.flush (); 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 void
MainAttachment::readArchiveUrl () { MainAttachment::readArchiveUrl () {
@ -230,18 +244,6 @@ MainAttachment::readCloudUrl () {
cloudDownloadURL = line.substr (7); 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 void
MainAttachment::setExtractDir (const bfs::path &extractDir) { MainAttachment::setExtractDir (const bfs::path &extractDir) {
@ -317,7 +319,7 @@ MainAttachment::getDisclaim (string &plain, string &html) const {
replaceAll (allHtmlLinks, TMPL_DOWNLOAD, archiveDownloadURL); replaceAll (allHtmlLinks, TMPL_DOWNLOAD, archiveDownloadURL);
html += allHtmlLinks; html += allHtmlLinks;
} }
if (linkCount && cloudDownloadURL.length ()) { if (cloudDownloadURL.length ()) {
string cloudPlainLinks (templatePlainCloudLink); string cloudPlainLinks (templatePlainCloudLink);
replaceAll (cloudPlainLinks, TMPL_DOWNLOAD, cloudDownloadURL); replaceAll (cloudPlainLinks, TMPL_DOWNLOAD, cloudDownloadURL);
plain += cloudPlainLinks; plain += cloudPlainLinks;
@ -326,7 +328,7 @@ MainAttachment::getDisclaim (string &plain, string &html) const {
html += cloudHtmlLinks; html += cloudHtmlLinks;
} }
html += templateHtmlFooter+"\n"; 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";
// & => &amp; done // & => &amp; done
LOG ("plain: " << plain); LOG ("plain: " << plain);
LOG ("html: " << html); LOG ("html: " << html);

View File

@ -61,7 +61,7 @@ namespace kaz {
class MainAttachment : public Attachment { class MainAttachment : public Attachment {
public: public:
/*! text to add in disclaim */ /*! 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 */ /*! white space to split a text */
static const regex whiteSpaceRegEx; static const regex whiteSpaceRegEx;