Libksieve

sievedefaulttemplate.cpp
1 /*
2  Copyright (C) 2013-2020 Laurent Montel <[email protected]>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #include "sievedefaulttemplate.h"
21 #include "vacation/vacationutils.h"
22 
23 #include <KLocalizedString>
24 
25 QVector<PimCommon::defaultTemplate> KSieveUi::SieveDefaultTemplate::defaultTemplates()
26 {
28  PimCommon::defaultTemplate tmp;
29  tmp.name = i18n("Filter on Mailing List-ID");
30  tmp.text = QStringLiteral("require \"fileinto\";\n"
31  "if header :contains \"List-ID\" [ \"examples.com\", \"examples.mail.com\" ] {\n"
32  " fileinto \"list-example/examples\"; \n"
33  " stop;\n"
34  "}\n");
35  lst << tmp;
36 
37  tmp.name = i18n("Filter on Subject");
38  tmp.text = QStringLiteral("require \"fileinto\";\n"
39  "if header :contains \"Subject\" \"Foo Foo\" { \n"
40  " fileinto \"INBOX.Foo\"; \n"
41  "}\n");
42  lst << tmp;
43 
44  tmp.name = i18n("Filter on Spamassassin");
45  tmp.text = QStringLiteral("require \"fileinto\";\n"
46  "if header :contains \"X-Spam-Level\" \"*********\" { \n"
47  " fileinto \"Spam\";\n"
48  "}\n");
49  lst << tmp;
50 
51  tmp.name = i18n("Flag messages");
52  tmp.text = QStringLiteral("require \"imap4flags\";\n"
53  "if address \"From\" \"[email protected]\" { \n"
54  " setflag \"\\\\Seen\";\n"
55  "}\n");
56  lst << tmp;
57 
58  tmp.name = i18n("Forward Message");
59  tmp.text = QStringLiteral("require \"copy\";\n"
60  "if header :contains \"Subject\" \"foo\" { \n"
61  " redirect :copy \"[email protected]\";\n"
62  "}\n");
63  lst << tmp;
64 
65  tmp.name = i18n("Forward Message and add copy");
66  tmp.text = QStringLiteral("require [\"copy\", \"fileinto\"];\n"
67  "if header :contains \"Subject\" \"foo\" { \n"
68  " redirect :copy \"[email protected]\";\n"
69  " fileinto \"Forwarded Messages\"; \n"
70  "}\n");
71  lst << tmp;
72 
73  tmp.name = i18n("Destroy mail posted by...");
74  tmp.text = QStringLiteral("if header :contains [\"from\",\"cc\"]\n"
75  "[\n"
76  "\"[email protected]\",\n"
77  "\"[email protected]\"\n"
78  "]\n"
79  "{\n"
80  " discard;\n"
81  " stop;\n"
82  "}\n");
83  lst << tmp;
84 
85  tmp.name = i18n("Vacations");
86 
87  tmp.text = QStringLiteral("require \"vacation\";\n\n"
88  "if header :contains \"X-Spam-Flag\" \"YES\" { keep; stop; }\n"
89  "vacation :addresses [ \"[email protected]\", \"[email protected]\" ] :days 7 text: \n%1"
90  "\n.\n;\n").arg(VacationUtils::defaultMessageText());
91  lst << tmp;
92 
93  return lst;
94 }
QString i18n(const char *text, const TYPE &arg...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 1 2020 23:08:20 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.