This is a standard "/set" method as described in
[RFC8620], Section 5.3,
but with the following additional optional request arguments:¶
-
onSuccessActivateScript:
-
Id¶
The id of the SieveScript to activate if and
only if all of the creations, modifications, and
destructions (if any) succeed.
(For references to SieveScript creations, this is
equivalent to a creation-reference, so the id will be the
creation id prefixed with a "#".)
The currently active SieveScript (if any) will be deactivated
before activating the specified SieveScript.¶
If omitted, or if the id is either invalid or nonexistent, it MUST be
ignored, and the currently active SieveScript (if any) will
remain as such.¶
The id of any activated SieveScript MUST be reported in
either the "created" or "updated" argument in the response
as appropriate, including a value of "true" for the "isActive"
property.
The id of any deactivated SieveScript MUST be reported in
the "updated" argument in the response, including a value of
"false" for the "isActive" property.¶
-
onSuccessDeactivateScript:
-
Boolean¶
If "true", the currently active
SieveScript (if any) will be deactivated if and only if
all of the creations, modifications, and destructions (if
any) succeed.
If "false" or omitted, the currently active SieveScript (if
any) will remain as such.¶
The id of any deactivated SieveScript MUST be reported in
the "updated" argument in the response, including a value of
"false" for the "isActive" property.¶
If both the "onSuccessActivateScript" and
"onSuccessDeactivateScript" arguments are
present in the request, then
"onSuccessDeactivateScript" MUST be processed first.
If neither argument is present in the request, the currently
active SieveScript (if any) will remain as such.¶
This method provides functionality equivalent to that of the
PUTSCRIPT, DELETESCRIPT, RENAMESCRIPT, and SETACTIVE commands defined
in [RFC5804].¶
Script content must first be uploaded as per
Section 2.2 prior to referencing it in a
SieveScript/set call.¶
If the SieveScript cannot be created or updated because it
would result in two SieveScripts with the same name, the
server MUST reject the request with an "alreadyExists"
SetError.
An "existingId" property of type "Id" MUST be included on the
SetError object with the id of the existing SieveScript.¶
If the SieveScript cannot be created or updated because
its size exceeds the "maxSizeScript" limit, the server MUST
reject the request with a "tooLarge" SetError.¶
If the SieveScript cannot be created because it would
exceed the "maxNumberScripts" limit or would exceed a
server-imposed storage limit, the server MUST
reject the request with an "overQuota" SetError.¶
The active SieveScript MUST NOT be destroyed
unless it is first deactivated in a separate SieveScript/set
method call.¶
The following extra SetError types are defined:¶
For "create" and "update":¶
-
invalidSieve:
-
The SieveScript content violates the
Sieve grammar [RFC5228],
and/or one
or more extensions mentioned in the script's "require"
statement(s) are not supported by the Sieve interpreter.
The "description" property on
the SetError object SHOULD contain a specific error
message giving at least the line number of the first error.¶
For "destroy":¶
-
sieveIsActive:
-
The SieveScript is active.¶
Upload a script
requiring the Imap4Flags Extension
[RFC5232]
using the JMAP uploadUrl as advertised in the example in
Section 1.2.2:¶
Create and activate
a script using the uploaded blob.
Note that the response shows that an existing active
script has been deactivated in lieu of the newly
created script being activated.¶
Update the script content using
the JMAP Blob management extension [RFC9404]:¶
Update the script name, and deactivate it:¶
Reactivate the script:¶
Deactivate and destroy the active script:¶