aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/database')
-rw-r--r--src/org/traccar/database/NotificationManager.java23
1 files changed, 5 insertions, 18 deletions
diff --git a/src/org/traccar/database/NotificationManager.java b/src/org/traccar/database/NotificationManager.java
index 1295b5b0c..37c6b720c 100644
--- a/src/org/traccar/database/NotificationManager.java
+++ b/src/org/traccar/database/NotificationManager.java
@@ -82,29 +82,16 @@ public class NotificationManager extends ExtendedObjectManager<Notification> {
if (usersToForward != null) {
usersToForward.add(userId);
}
- boolean sentWeb = false;
- boolean sentMail = false;
- boolean sentSms = Context.getSmsManager() == null;
+ final Set<String> notificationMethods = new HashSet<>();
for (long notificationId : getEffectiveNotifications(userId, deviceId, event.getServerTime())) {
Notification notification = getById(notificationId);
if (getById(notificationId).getType().equals(event.getType())) {
- if (!sentWeb && notification.getWeb()) {
- NotificatorManager.getWeb().sendAsync(userId, event, position);
- sentWeb = true;
- }
- if (!sentMail && notification.getMail()) {
- NotificatorManager.getMail().sendAsync(userId, event, position);
- sentMail = true;
- }
- if (!sentSms && notification.getSms()) {
- NotificatorManager.getSms().sendAsync(userId, event, position);
- sentSms = true;
- }
- }
- if (sentWeb && sentMail && sentSms) {
- break;
+ notificationMethods.addAll(notification.getMethods());
}
}
+ for (String nm : notificationMethods) {
+ NotificatorManager.getNotificator(nm).sendAsync(userId, event, position);
+ }
}
}
if (Context.getEventForwarder() != null) {