/usr/share/syncevolution/xml/scripting/server/12email.xml is in syncevolution-common 1.5.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | <!-- The following email handling scripts are defined as script MACROS because they
are used in multiple <datatype> definitions below. This avoids duplicating these
script's source code in the config file -->
<macro name="EMAIL_INIT_SCRIPT"><![CDATA[
INTEGER ITEMLIMIT;
// default limit is limit of session
ITEMLIMIT = SIZELIMIT();
]]></macro>
<macro name="EMAIL_PROCESSITEM_SCRIPT"><![CDATA[
// pre-process item
if (UPPERCASE(FOLDER)=="INBOX") {
// In any case, prevent adding to inbox (delete remote items instead)
PREVENTADD();
// server always wins for inbox
CONFLICTSTRATEGY("server-wins");
if (SLOWSYNC()) {
// also prevent modifications in server
IGNOREUPDATE();
}
else {
// normal sync items going to inbox from client need special treatment
if (SYNCOP()=="add" || SYNCOP()=="replace") {
// make sure that existing server item will conflict with this item
if (LIMIT!=EMPTY && (LIMIT<0 || LIMIT>SIZELIMIT())) {
// force conflict only if this is a reload
FORCECONFLICT();
}
// make sure we never overwrite a body in the inbox
BODY = UNASSIGNED;
// delete always wins over replace in inbox (to avoid adds to inbox)
DELETEWINS();
}
}
}
else if (UPPERCASE(FOLDER)=="OUTBOX") {
// never try to change something in outbox
IGNOREUPDATE();
if (SYNCOP()!="delete") {
// - date of mail is NOW, set it such that a correct date is written to the DB
MAILDATE = DBNOW();
// MAILDATE = (INTEGER)DBNOW() - TIMEUNITS(120); // %%% backdate it 2 mins to make sure it does not get retransmitted
// - echo item as replace (to force-move it to the sent folder)
ECHOITEM("replace");
}
CONFLICTSTRATEGY("client-wins");
}
else if (UPPERCASE(FOLDER)=="SENT") {
// never try to change something in sent folder
IGNOREUPDATE();
// Server has precedence in case of conflicts
CONFLICTSTRATEGY("server-wins");
// Implement reload capability for sent items as well
if (SLOWSYNC()) {
// do not add new sent items to the server in slowsync
PREVENTADD(); // causes extra sent items on the client to be deleted
}
else {
// make sure that existing server item will conflict with this item
if (SYNCOP()=="replace") {
if (LIMIT!=EMPTY && (LIMIT<0 || LIMIT>SIZELIMIT())) {
// force conflict only if this is a reload
FORCECONFLICT();
REJECTITEM(200); // but do not process the item further
}
else {
// silently ignore other types of changes
REJECTITEM(200);
}
// make sure we never overwrite a body in the sent folder
BODY = UNASSIGNED;
}
}
}
else {
// Other folder
// - silently discard incoming item for other folder than the above
// except if it is a delete
if (SYNCOP()!="delete")
REJECTITEM(0);
}
]]></macro>
<macro name="EMAIL_MERGE_SCRIPT"><![CDATA[
// pre-process item
if (UPPERCASE(LOOSING.FOLDER)!="OUTBOX") {
// non-outbox (especially inbox) needs special merge to accomplish reload feature
// - loosing item is client's, winning is server's
if (LOOSING.LIMIT!=EMPTY) {
// loosing (remote) item specifies a new limit, override winning's default
WINNING.LIMIT=LOOSING.LIMIT;
SETWINNINGCHANGED(TRUE);
}
// make sure winning has right folder
WINNING.FOLDER=LOOSING.FOLDER;
// make sure a set read-flag gets propagated to server
if (LOOSING.ISREAD=="true") WINNING.ISREAD="true";
// merge other fields normally
MERGEFIELDS();
// make sure body does not get re-written to local DB even if merge would cause local update
LOOSING.BODY=UNASSIGNED;
}
else {
// normal merging in other folders
MERGEFIELDS();
}
]]></macro>
<macro name="EMAIL_OUTGOING_SCRIPT"><![CDATA[
// pre-process item
if (UPPERCASE(FOLDER)=="OUTBOX") {
// writing to outbox is always the ECHOITEM
// - cause item to move into "sent" folder
FOLDER = "sent";
if (!SESSIONVAR("retransfer_body")) {
// - prevent body retransfer, but not for dumb P800/P900/M600/P990 clients
BODY = UNASSIGNED; // prevent body transfer
ATT_COUNT = 0; // prevent attachment transfer
ATT_CONTENTS = UNASSIGNED;
// basically, this item is not limited (already complete on the client)
// even if contents are not sent
LIMIT = -1;
SETSIZELIMIT(-1);
}
}
else {
// outgoing item to any folder of of remote (inbox, sent...)
// - limit body to what is set in the LIMIT field
// %%% probably obsolete, as textitem will handle limit field automatically for >=V1.0.8.21
IF (LIMIT==EMPTY)
LIMIT = SIZELIMIT(); // if none set already, use default for this item (=default of datastore, if not SETSIZELIMIT() called before for this item generation)
}
// set limit for item generator
if (LIMIT!=EMPTY)
SETSIZELIMIT(LIMIT);
]]></macro>
<macro name="EMAIL_FILTERINIT_SCRIPT"><![CDATA[
// check if we need to filter
INTEGER NEEDFILTER;
NEEDFILTER =
!DBHANDLESOPTS() && // only if DB cannot handle it
(STARTDATE()!=EMPTY); // and only if a start date is set (end date not needed as there are never future emails today)
SETFILTERALL(NEEDFILTER);
RETURN NEEDFILTER;
]]></macro>
<macro name="EMAIL_FILTER_SCRIPT"><![CDATA[
INTEGER PASSES;
// check if item passes filter
PASSES=FALSE;
// Emails pass if they have a MAILDATE on or later than start date
PASSES = MAILDATE>=STARTDATE();
RETURN PASSES;
]]></macro>
|