File indexing completed on 2024-12-29 04:54:49
0001 /* 0002 SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "sievedefaulttemplate.h" 0008 #include <KSieveCore/VacationUtils> 0009 0010 #include <KLocalizedString> 0011 0012 QList<PimCommon::defaultTemplate> KSieveUi::SieveDefaultTemplate::defaultTemplates() 0013 { 0014 QList<PimCommon::defaultTemplate> lst; 0015 PimCommon::defaultTemplate tmp; 0016 tmp.name = i18n("Filter on Mailing List-ID"); 0017 tmp.text = QStringLiteral( 0018 "require \"fileinto\";\n" 0019 "if header :contains \"List-ID\" [ \"examples.com\", \"examples.mail.com\" ] {\n" 0020 " fileinto \"list-example/examples\"; \n" 0021 " stop;\n" 0022 "}\n"); 0023 lst << tmp; 0024 0025 tmp.name = i18n("Filter on Subject"); 0026 tmp.text = QStringLiteral( 0027 "require \"fileinto\";\n" 0028 "if header :contains \"Subject\" \"Foo Foo\" { \n" 0029 " fileinto \"INBOX.Foo\"; \n" 0030 "}\n"); 0031 lst << tmp; 0032 0033 tmp.name = i18n("Filter on Spamassassin"); 0034 tmp.text = QStringLiteral( 0035 "require \"fileinto\";\n" 0036 "if header :contains \"X-Spam-Level\" \"*********\" { \n" 0037 " fileinto \"Spam\";\n" 0038 "}\n"); 0039 lst << tmp; 0040 0041 tmp.name = i18n("Flag messages"); 0042 tmp.text = QStringLiteral( 0043 "require \"imap4flags\";\n" 0044 "if address \"From\" \"someone@example.org\" { \n" 0045 " setflag \"\\\\Seen\";\n" 0046 "}\n"); 0047 lst << tmp; 0048 0049 tmp.name = i18n("Forward Message"); 0050 tmp.text = QStringLiteral( 0051 "require \"copy\";\n" 0052 "if header :contains \"Subject\" \"foo\" { \n" 0053 " redirect :copy \"other@example.net\";\n" 0054 "}\n"); 0055 lst << tmp; 0056 0057 tmp.name = i18n("Forward Message and add copy"); 0058 tmp.text = QStringLiteral( 0059 "require [\"copy\", \"fileinto\"];\n" 0060 "if header :contains \"Subject\" \"foo\" { \n" 0061 " redirect :copy \"other@example.net\";\n" 0062 " fileinto \"Forwarded Messages\"; \n" 0063 "}\n"); 0064 lst << tmp; 0065 0066 tmp.name = i18n("Destroy mail posted by..."); 0067 tmp.text = QStringLiteral( 0068 "if header :contains [\"from\",\"cc\"]\n" 0069 "[\n" 0070 "\"from-foo@example.net\",\n" 0071 "\"pub@foo.com\"\n" 0072 "]\n" 0073 "{\n" 0074 " discard;\n" 0075 " stop;\n" 0076 "}\n"); 0077 lst << tmp; 0078 0079 tmp.name = i18n("Vacations"); 0080 0081 tmp.text = QStringLiteral( 0082 "require \"vacation\";\n\n" 0083 "if header :contains \"X-Spam-Flag\" \"YES\" { keep; stop; }\n" 0084 "vacation :addresses [ \"me@example.net\", \"other@example.net\" ] :days 7 text: \n%1" 0085 "\n.\n;\n") 0086 .arg(KSieveCore::VacationUtils::defaultMessageText()); 0087 lst << tmp; 0088 0089 return lst; 0090 }