update disclaim

This commit is contained in:
François 2025-05-10 07:13:05 +02:00
parent 9eb1eca8d1
commit 66f299aca1
3 changed files with 49 additions and 28 deletions

View File

@ -1,7 +1,7 @@
<?php <?php
/* /*
* Kaz addon (see https://git.kaz.bzh/KAZ/depollueur for information) * Kaz addon (see https://git.kaz.bzh/KAZ/depollueur for information)
* foward dowload to NextCloud API * foward download to NextCloud API
c.php => config c.php => config
c.php?s="sender"&t="token" c.php?s="sender"&t="token"

View File

@ -62,7 +62,7 @@ const string Attachment::HTML ("html");
const string Attachment::RELATED ("related"); const string Attachment::RELATED ("related");
const string Attachment::SIGNED ("signed"); const string Attachment::SIGNED ("signed");
const string Attachment::ALTERNATIVE ("alternative"); const string Attachment::ALTERNATIVE ("alternative");
const string Attachment::KAZ_ATTACH_NAME ("vos-pieces-jointes-kaz-ici.htm"); const string Attachment::KAZ_ATTACH_NAME ("vos-pieces-jointes-kaz-ici.html");
const string Attachment::MULTIPART ("multipart/"); const string Attachment::MULTIPART ("multipart/");
const regex Attachment::nameCharsetRegEx ( ".*name\\*=\\s*([; \t]*)"); const regex Attachment::nameCharsetRegEx ( ".*name\\*=\\s*([; \t]*)");

View File

@ -66,15 +66,23 @@ static const regex archiveURLRegex (".*(([&?]g=)|([&?]l=/)).*");
static const string KAZ_PLAIN_HR ("______________________________________________________________________________"); static const string KAZ_PLAIN_HR ("______________________________________________________________________________");
static const string KAZ_PLAIN_START ("~~ PJ-KAZ !"); // don't end whith space static const string KAZ_PLAIN_START ("~~ PJ-KAZ !"); // don't end whith space
static const string KAZ_PLAIN_STOP (KAZ_PLAIN_START+" ~~"); static const string KAZ_PLAIN_STOP (KAZ_PLAIN_START+" ~~");
static const string KAZ_PLAIN_DONT_TOUCH ("(conservez cette partie intacte dans votre réponse si vous voulez transmettre les documents précédents (version "+LAST_VERSION_NUM+"))"); static const string KAZ_PLAIN_DONT_TOUCH ("(conservez cette partie si vous souhaitez transmettre les documents précédents (version "+LAST_VERSION_NUM+"))");
static const string KAZ_PLAIN_WARNING ("Attention : Kaz a dépollué ce message. Les pièces jointes ont été retirées et placées dans un dépôt provisoire. " static const string KAZ_PLAIN_WARNING ("Attention : si vous souhaitez récupérer des informations de votre correspondant envoyées en pièces-jointes, lisez attentivement ce qui suit.\n\n"
"Elles seront automatiquement supprimées dans 1 mois. "
"Si elles sont importantes et que vous souhaitez les conserver, vous devez utiliser les liens ci-dessous. " "Pour des questions de sobriété numérique, les pièces-jointes ont été supprimées de ce courriel et remplacées par des liens de téléchargement.\n"
"Pour mieux comprendre la politique de nos services visitez kaz.bzh"); "Ne cherchez pas à utiliser la fonction enregistrement des pièces-jointes de votre logiciel. Le trombone qui apparaît nest là que pour vous signaler des liens à télécharger.\n"
static const string KAZ_PLAIN_DOWLOAD_ONE ("Vos pièces jointes sont à télécharger individuellement ici :"); "Il y a 3 sortes de liens :\n"
static const string KAZ_PLAIN_DOWLOAD_OTHER ("(Contenu dans des messages précédents)"); " * un ensemble de liens de téléchargement individuel\n"
static const string KAZ_PLAIN_DOWLOAD_ALL ("Vous pouvez télécharger l'ensemble dans une archive là :"); " * un lien de téléchargement récapitulatif permettant daccéder à lensemble précédent dans une archive\n"
static const string KAZ_PLAIN_DOWLOAD_CLOUD ("Expérimental : vous pouvez classer les pièces jointes dans votre cloud là :"); " * une fonctionnalité proposée au kaznautes sous la forme dun lien permettant de ranger les pièces jointes dans un bureau virtuel (nextcloud)\n\n"
"En « dépolluant » ce message, Kaz a retiré et placé les pièces jointes dorigine dans un dépôt provisoire.\n"
"Si elles sont importantes et que vous souhaitez les conserver, vous devez utiliser les liens en bas de ce courriel.\n"
"Elles seront automatiquement supprimées dans 1 mois.\n\n"
"Pour mieux comprendre la politique de nos services visitez https://wiki.kaz.bzh/le_gros_de_kaz");
static const string KAZ_PLAIN_DOWNLOAD_ONE ("Vos pièces jointes sont à télécharger individuellement ici :");
static const string KAZ_PLAIN_DOWNLOAD_OTHER ("(Contenu dans des messages précédents)");
static const string KAZ_PLAIN_DOWNLOAD_ALL ("Vous pouvez télécharger l'ensemble dans une archive là :");
static const string KAZ_PLAIN_DOWNLOAD_CLOUD ("Pour les kaznautes, vous pouvez classer les pièces jointes dans votre cloud en suivant ce lien :");
static const string HEAD ("<head>"); static const string HEAD ("<head>");
static const string HEAD_END ("</head>"); static const string HEAD_END ("</head>");
@ -95,11 +103,24 @@ static const string KAZ_HTML_TAG ("<!--KAZ"); // don't end whith space
static const string KAZ_HTML_START (KAZ_HTML_TAG+" START-->"); static const string KAZ_HTML_START (KAZ_HTML_TAG+" START-->");
static const string KAZ_HTML_STOP (KAZ_HTML_TAG+" STOP-->"); static const string KAZ_HTML_STOP (KAZ_HTML_TAG+" STOP-->");
// Textes précédents encodés en SGML // Textes précédents encodés en SGML
static const string KAZ_HTML_NOT_SAVE ("<p><b>Ceci n'est pas une pi&egrave;ce-jointe, mais la liste des liens pour les t&eacute;l&eacute;charger.</b></p>");
static const string KAZ_HTML_DONT_TOUCH ("(conservez cette partie intacte dans votre r&eacute;ponse si vous voulez transmettre les documents pr&eacute;c&eacute;dents (version "+LAST_VERSION_NUM+"))"); static const string KAZ_HTML_DONT_TOUCH ("(conservez cette partie intacte dans votre r&eacute;ponse si vous voulez transmettre les documents pr&eacute;c&eacute;dents (version "+LAST_VERSION_NUM+"))");
static const string KAZ_HTML_DOWLOAD_ONE ("Vos pi&egrave;ces jointes sont &agrave; t&eacute;l&eacute;charger individuellement ici :"); static const string KAZ_HTML_WARNING ("<div class=\"nb\"><p>Attention : si vous souhaitez r&eacute;cup&eacute;rer des informations de votre correspondant envoy&eacute;es en pi&egrave;ces-jointes, lisez attentivement ce qui suit.</p>"
static const string KAZ_HTML_DOWLOAD_OTHER ("(Contenu dans des messages pr&eacute;c&eacute;dents)");
static const string KAZ_HTML_DOWLOAD_ALL ("Vous pouvez t&eacute;l&eacute;charger l'ensemble dans une archive l&agrave; :"); "<p>Pour des questions de sobri&eacute;t&eacute; num&eacute;rique, les pi&egrave;ces-jointes ont &eacute;t&eacute; supprim&eacute;es de ce courriel et remplac&eacute;es par des liens de t&eacute;l&eacute;chargement.</br>"
static const string KAZ_HTML_DOWLOAD_CLOUD ("Expérimental : vous pouvez classer les pi&egrave;ces jointes dans votre cloud l&agrave; :"); "Ne cherchez pas &agrave; utiliser la fonction enregistrement des pi&egrave;ces-jointes de votre logiciel. Le trombone qui appara&icirc;t nest l&agrave; que pour vous signaler des liens &agrave; t&eacute;l&eacute;charger.</br>"
"Il y a 3 sortes de liens :<ul>"
"<li>un ensemble de liens de t&eacute;l&eacute;chargement individuel</li>"
"<li>un lien de t&eacute;l&eacute;chargement r&eacute;capitulatif permettant dacc&eacute;der &agrave; lensemble pr&eacute;c&eacute;dent dans une archive</li>"
"<li>une fonctionnalit&eacute; propos&eacute;e au kaznautes sous la forme dun lien permettant de ranger les pi&egrave;ces jointes dans un bureau virtuel (nextcloud)</li></ul>"
"En « d&eacute;polluant » ce message, Kaz a retir&eacute; et plac&eacute; les pi&egrave;ces jointes dorigine dans un d&eacute;p&ocirc;t provisoire.</br>"
"Si elles sont importantes et que vous souhaitez les conserver, vous devez utiliser les liens en bas de ce courriel.</br>"
"Elles seront automatiquement supprim&eacute;es dans 1 mois.</p>"
"<p>Pour mieux comprendre la politique de nos services visitez https://wiki.kaz.bzh/le_gros_de_kaz</p></div>");
static const string KAZ_HTML_DOWNLOAD_ONE ("Vos pi&egrave;ces jointes sont &agrave; t&eacute;l&eacute;charger individuellement ici :");
static const string KAZ_HTML_DOWNLOAD_OTHER ("(Contenu dans des messages pr&eacute;c&eacute;dents)");
static const string KAZ_HTML_DOWNLOAD_ALL ("Vous pouvez t&eacute;l&eacute;charger l'ensemble dans une archive l&agrave; :");
static const string KAZ_HTML_DOWNLOAD_CLOUD ("Expérimental : vous pouvez classer les pi&egrave;ces jointes dans votre cloud l&agrave; :");
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_HTML_CLOUD ("cloud");
@ -116,20 +137,20 @@ 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_DOWNLOAD_ALL+" < "+TMPL_DOWNLOAD+" >\n");
const string MainAttachment::templatePlainCloudLink ("\n * "+KAZ_PLAIN_DOWLOAD_CLOUD+" < "+TMPL_DOWNLOAD+" >\n"); const string MainAttachment::templatePlainCloudLink ("\n * "+KAZ_PLAIN_DOWNLOAD_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::templatePlainFooter ("\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=\"kaz2\">"
"<p style=\"font-size:10px; color:#969696;\">"+KAZ_HTML_DONT_TOUCH+"</p>\n" "<p style=\"font-size:10px; color:#969696;\">"+KAZ_HTML_DONT_TOUCH+"</p>\n"
"<p>"+KAZ_HTML_DOWLOAD_ONE+"<ul>\n"); "<p>"+KAZ_HTML_DOWNLOAD_ONE+"<ul>\n");
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_DOWNLOAD_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_DOWNLOAD_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_CLOUD+"</a>"+LI_END+"\n"); const string MainAttachment::templateHtmlCloudLink ("</ul><ul>"+LI_ALL+KAZ_HTML_DOWNLOAD_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=\"kaz2\" 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");
const regex MainAttachment::whiteSpaceRegEx ("\\s+"); const regex MainAttachment::whiteSpaceRegEx ("\\s+");
@ -307,10 +328,10 @@ MainAttachment::getDisclaim (string &plain, string &html) const {
return; return;
} }
plain = "\n"+KAZ_PLAIN_START+"\n\n"+KAZ_PLAIN_HR+"\n"+KAZ_PLAIN_DONT_TOUCH+"\n\n"+KAZ_PLAIN_DOWLOAD_ONE+"\n"+plainNewLinks; plain = "\n"+KAZ_PLAIN_START+"\n\n"+KAZ_PLAIN_HR+"\n"+KAZ_PLAIN_DONT_TOUCH+"\n\n"+KAZ_PLAIN_DOWNLOAD_ONE+"\n"+plainNewLinks;
html = templateHtmlHeader+htmlNewLinks; html = templateHtmlHeader+htmlNewLinks;
if (previousLinks.size ()) { if (previousLinks.size ()) {
plain += "\n"+KAZ_PLAIN_DOWLOAD_OTHER+"\n"+plainOldLinks; plain += "\n"+KAZ_PLAIN_DOWNLOAD_OTHER+"\n"+plainOldLinks;
html += templateHtmlOtherLink+htmlOldLinks; html += templateHtmlOtherLink+htmlOldLinks;
} }
if (linkCount > 1 && archiveDownloadURL.length ()) { if (linkCount > 1 && archiveDownloadURL.length ()) {
@ -860,7 +881,7 @@ MainAttachment::substitute (ifstream &mbox, ofstream &outbox, const SizeArg &min
LOG ("remove tag: " << endTag << " content: " << content); LOG ("remove tag: " << endTag << " content: " << content);
} }
} }
content += htmlDisclaim+BODY_END+HTML_END; content += htmlDisclaim+KAZ_HTML_WARNING+BODY_END+HTML_END;
LOG ("content: " << content); LOG ("content: " << content);
} }
if (isPlain) if (isPlain)
@ -889,7 +910,7 @@ MainAttachment::substitute (ifstream &mbox, ofstream &outbox, const SizeArg &min
outbox << boundary.substr (0, boundaryMiddleSize) << endl outbox << boundary.substr (0, boundaryMiddleSize) << endl
<< KAZ_ATTACHMENT_TEXT_HTML << endl; << KAZ_ATTACHMENT_TEXT_HTML << endl;
cerr << "eMailShrinker: force attachment" << endl; cerr << "eMailShrinker: force attachment" << endl;
string content (KAZ_HTML_CONTENT+htmlDisclaim+BODY_END+HTML_END); string content (KAZ_HTML_CONTENT+KAZ_HTML_NOT_SAVE+htmlDisclaim+KAZ_HTML_WARNING+BODY_END+HTML_END);
base64Encode (content); base64Encode (content);
outbox << content << endl; outbox << content << endl;