diff --git a/docs/api.md b/docs/api.md index fa57e37..d996462 100644 --- a/docs/api.md +++ b/docs/api.md @@ -104,7 +104,7 @@ This applies as possible return type of all of the hooks below. in order to use the `RemoveRecipient` manipulation. - `can_quarantine` (default: False) - in order to use the `Quarantine` response in `hook_on_end_of_message`. + in order to use the `Quarantine` manipulation. ## `Command`s @@ -142,6 +142,7 @@ This applies as possible return type of all of the hooks below. - `ChangeHeader` - `ReplaceBodyChunk` - `ChangeMailFrom` + - `Quarantine` - *AbstractResponse* - *AbstractVerdict* - *BaseVerdictNoData* @@ -152,7 +153,6 @@ This applies as possible return type of all of the hooks below. - *BaseReplyWithCode* - `RejectWithCode` - `TempFailWithCode` - - `Quarantine` - *BaseResponseNoData* - `Continue` - `SkipToNextStage` diff --git a/src/purepythonmilter/protocol/responses.py b/src/purepythonmilter/protocol/responses.py index d8e212f..78d623b 100644 --- a/src/purepythonmilter/protocol/responses.py +++ b/src/purepythonmilter/protocol/responses.py @@ -226,7 +226,7 @@ class DiscardMessage(BaseVerdictNoData): @attrs.define(auto_attribs=False, kw_only=True) -class Quarantine(AbstractVerdict): +class Quarantine(AbstractManipulation): """ Put the message in the hold queue. Only valid at End of Message stage. The reason text is ignored by Postfix at the time of writing. @@ -234,7 +234,10 @@ class Quarantine(AbstractVerdict): """ response_char: ClassVar[bytes] = b"q" # SMFIR_QUARANTINE - reason: str + reason: str = attrs.field() + + def encode(self) -> Payload: + return Payload(self.response_char + self.reason.encode() + b"\x00") @attrs.define(auto_attribs=False, kw_only=True)