1 21 package org.jsmtpd.core.mail; 22 23 import java.io.Serializable ; 24 25 29 public class Rcpt implements Serializable { 30 31 private EmailAddress emailAddress = null; 32 private int deliveryAttempts = STATUS_PENDING; 33 private int status; 34 private String lastError=""; 35 36 public Rcpt(EmailAddress e) { 37 emailAddress = e; 38 } 39 40 public Rcpt (Rcpt original) { 41 setEmailAddress(new EmailAddress(original.getEmailAddress())); 42 deliveryAttempts = original.getDeliveryAttempts(); 43 status = original.getStatus(); 44 lastError=new String (original.getLastError()); 45 } 46 47 public EmailAddress getEmailAddress() { 48 return emailAddress; 49 } 50 51 public void setEmailAddress(EmailAddress e) { 52 emailAddress = e; 53 } 54 55 59 public int getDeliveryAttempts() { 60 return deliveryAttempts; 61 } 62 63 69 public boolean isDelivered() { 70 if (status == STATUS_DELIVERED || status == STATUS_ERROR_FATAL) 71 return true; 72 return false; 73 } 74 75 public void setDelivered(int status) { 76 this.status = status; 77 deliveryAttempts++; 78 } 79 80 public String getLastError() { 81 return lastError; 82 } 83 public void setLastError(String lastError) { 84 this.lastError = lastError; 85 } 86 87 public static final int STATUS_PENDING = 0; 88 public static final int STATUS_ERROR_NOT_FATAL = 1; 89 public static final int STATUS_ERROR_FATAL = 2; 90 public static final int STATUS_DELIVERED = 3; 91 92 93 public int getStatus() { 94 return status; 95 } 96 97 @Override 98 public String toString() { 99 if (emailAddress==null) 100 return "null adress"; 101 return this.emailAddress.toString(); 102 } 103 } | Popular Tags |