aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main/java/com/juick/api/EmailManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-api/src/main/java/com/juick/api/EmailManager.java')
-rw-r--r--juick-api/src/main/java/com/juick/api/EmailManager.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/juick-api/src/main/java/com/juick/api/EmailManager.java b/juick-api/src/main/java/com/juick/api/EmailManager.java
index 1c105ef9..c90e7b7a 100644
--- a/juick-api/src/main/java/com/juick/api/EmailManager.java
+++ b/juick-api/src/main/java/com/juick/api/EmailManager.java
@@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
+import javax.annotation.Nonnull;
import javax.inject.Inject;
import javax.mail.MessagingException;
import javax.mail.Multipart;
@@ -29,17 +30,20 @@ import static com.juick.formatters.PlainTextFormatter.formatUrl;
@Component
public class EmailManager implements ApplicationListener<MessageEvent> {
+
+ public static final String MSGID_PATTERN = "\\.|@|<";
+
private static final Logger logger = LoggerFactory.getLogger(EmailManager.class);
@Inject
- EmailService emailService;
+ private EmailService emailService;
@Inject
- SubscriptionService subscriptionService;
+ private SubscriptionService subscriptionService;
@Inject
- MessagesService messagesService;
+ private MessagesService messagesService;
@Inject
- UserService userService;
+ private UserService userService;
@Override
- public void onApplicationEvent(MessageEvent event) {
+ public void onApplicationEvent(@Nonnull MessageEvent event) {
Message msg = event.getMessage();
if (msg.getRid() == 0) {
String subject = String.format("New message from %s", msg.getUser().getName());
@@ -55,7 +59,7 @@ public class EmailManager implements ApplicationListener<MessageEvent> {
}
}
- void emailNotify(String email, String subject, Message msg) {
+ private void emailNotify(String email, String subject, Message msg) {
Properties prop = System.getProperties();
prop.put("mail.smtp.starttls.enable", "true");
Session session = Session.getDefaultInstance(prop);