X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FWebInterface.java;h=441e32336c899397c49a77301c86aaf1cd7e8471;hp=747b1923675eefffe78ef07fc879fd3dbc4677a5;hb=c26c8d115cd895ac1c187552ac46350a501c250a;hpb=92b5ee58620b50020b3fe9a1a942ded9a0d59c9e diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index 747b192..441e323 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -119,6 +119,12 @@ public class WebInterface implements CoreListener { /** The “new reply” notification. */ private final ListNotification newReplyNotification; + /** The “rescuing Sone” notification. */ + private final ListNotification rescuingSonesNotification; + + /** The “Sone rescued” notification. */ + private final ListNotification sonesRescuedNotification; + /** * Creates a new web interface. * @@ -158,6 +164,12 @@ public class WebInterface implements CoreListener { Template newReplyNotificationTemplate = templateFactory.createTemplate(createReader("/templates/notify/newReplyNotification.html")); newReplyNotification = new ListNotification("new-replies-notification", "replies", newReplyNotificationTemplate); + + Template rescuingSonesTemplate = templateFactory.createTemplate(createReader("/templates/notify/rescuingSonesNotification.html")); + rescuingSonesNotification = new ListNotification("sones-being-rescued-notification", "sones", rescuingSonesTemplate); + + Template sonesRescuedTemplate = templateFactory.createTemplate(createReader("/templates/notify/sonesRescuedNotification.html")); + sonesRescuedNotification = new ListNotification("sones-rescued-notification", "sones", sonesRescuedTemplate); } // @@ -387,6 +399,25 @@ public class WebInterface implements CoreListener { * {@inheritDoc} */ @Override + public void rescuingSone(Sone sone) { + rescuingSonesNotification.add(sone); + notificationManager.addNotification(rescuingSonesNotification); + } + + /** + * {@inheritDoc} + */ + @Override + public void rescuedSone(Sone sone) { + rescuingSonesNotification.remove(sone); + sonesRescuedNotification.add(sone); + notificationManager.addNotification(sonesRescuedNotification); + } + + /** + * {@inheritDoc} + */ + @Override public void newSoneFound(Sone sone) { newSoneNotification.add(sone); notificationManager.addNotification(newSoneNotification);