-
Notifications
You must be signed in to change notification settings - Fork 182
/
SmtpState.java
39 lines (33 loc) · 1.14 KB
/
SmtpState.java
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
/*
* Copyright (c) 2014 Wael Chatila / Icegreen Technologies. All Rights Reserved.
* This software is released under the Apache license 2.0
* This file has been used and modified.
* Original file can be found on http://foedus.sourceforge.net
*/
package com.icegreen.greenmail.smtp;
import com.icegreen.greenmail.mail.MovingMessage;
import com.icegreen.greenmail.smtp.auth.AuthenticationState;
public class SmtpState {
MovingMessage currentMessage;
public SmtpState() {
clearMessage();
}
public MovingMessage getMessage() {
return currentMessage;
}
/**
* To destroy a half-constructed message.
*/
public void clearMessage() {
currentMessage = new MovingMessage();
}
/**
* To destroy a half-constructed message, but preserves the
* {@link MovingMessage#getAuthenticationState()}.
*/
public void clearMessagePreservingAuthenticationState() {
AuthenticationState authState = currentMessage != null ? currentMessage.getAuthenticationState() : null;
currentMessage = new MovingMessage();
currentMessage.setAuthenticationState(authState);
}
}