/** * Determines if a message is incoming or outgoing based on the domains available in the configured agent * and the sender of the message. * @param msg The message that is being processed. * @param sender The sender of the message. * @param agent The STA that contains the available domains. * @return true if the message is determined to be outgoing; false otherwise */ public static boolean isOutgoing(MimeMessage msg, NHINDAddress sender, NHINDAgent agent) { if (agent == null || agent.getDomains() == null) return false; // if the sender is not from our domain, then is has to be an incoming message if (!sender.isInDomain(agent.getDomains())) return false; else { // depending on the SMTP stack configuration, a message with a sender from our domain // may still be an incoming message... check if the message is encrypted if (SMIMEStandard.isEncrypted(msg)) { return false; } } return true; }
processedMessage = (isOutgoing) ? agent.processOutgoing(envelope) : agent.processIncoming(envelope);
/** * Gets a list of recipients in the message that are part of the agent's domain. * @return A list of recipients in the agent's domain. */ public NHINDAddressCollection getDomainRecipients() { if (this.domainRecipients == null) { categorizeRecipients(getAgent().getDomains()); } return domainRecipients; }
/** * Gets a list of recipients in the message that are not part of the agent's domain. * @return A list of recipients that are not in the agent's domain. */ public Collection<NHINDAddress> getOtherRecipients() { if (this.otherRecipients == null) { categorizeRecipients(getAgent().getDomains()); } return this.otherRecipients; }
public boolean isOutgoing(MessageEnvelope envelope) { // if the sender is not from our domain, then is has to be an incoming message if (!envelope.getSender().isInDomain(agent.getDomains())) return false; else { // depending on the SMTP stack configuration, a message with a sender from our domain // may still be an incoming message... check if the message is encrypted if (SMIMEStandard.isEncrypted(envelope.getMessage())) { return false; } } return true; }