private static String colorize(Notification notification) { switch (notification.level()) { case INFO: return "good"; case WARNING: return "warning"; case ERROR: return "danger"; default: return "warning"; } }
private static String colorize(Notification notification) { switch (notification.level()) { case INFO: return "good"; case WARNING: return "warning"; case ERROR: return "danger"; default: return "warning"; } }
@Override public void send(Notification notification) { List<String> commands = new ArrayList<>(); commands.add(configuration.bin()); commands.add("/p"); commands.add(escape(notification.title())); commands.add("/m"); commands.add(escape(notification.message())); commands.add("/d"); if (application.timeout() == -1) { commands.add(String.valueOf(TimeUnit.SECONDS.toMillis(10))); } else { commands.add(String.valueOf(application.timeout())); } commands.add("/t"); commands.add(toType(notification.level())); commands.add("/q"); try { executor.exec(commands.toArray(new String[0])); } catch (RuntimeException e) { throw new NotifuException("Error while sending notification to notifu.", e.getCause()); } }
@Override public void send(Notification notification) { List<String> commands = new ArrayList<>(); commands.add(configuration.bin()); commands.add("/p"); commands.add(escape(notification.title())); commands.add("/m"); commands.add(escape(notification.message())); commands.add("/d"); if (application.timeout() == -1) { commands.add(String.valueOf(TimeUnit.SECONDS.toMillis(10))); } else { commands.add(String.valueOf(application.timeout())); } commands.add("/t"); commands.add(toType(notification.level())); commands.add("/q"); try { executor.exec(commands.toArray(new String[0])); } catch (RuntimeException e) { throw new NotifuException("Error while sending notification to notifu.", e.getCause()); } }
@Override public void send(Notification notification) { List<String> commands = new ArrayList<>(); commands.add(configuration.bin()); commands.add(notification.title()); commands.add(notification.message()); if (application.timeout() != -1) { commands.add(CMD_TIMEOUT); commands.add(String.valueOf(application.timeout())); } commands.add(CMD_ICON); commands.add(notification.icon().asPath()); commands.add(CMD_URGENCY); commands.add(toUrgency(notification.level())); try { executor.exec(commands.toArray(new String[0])); } catch (RuntimeException e) { throw new NotifySendNotificationException("Error while sending notification to notify-send.", e.getCause()); } }
@Override public void send(Notification notification) { List<String> commands = new ArrayList<>(); commands.add(configuration.bin()); commands.add(notification.title()); commands.add(notification.message()); if (application.timeout() != -1) { commands.add(CMD_TIMEOUT); commands.add(String.valueOf(application.timeout())); } commands.add(CMD_ICON); commands.add(notification.icon().asPath()); commands.add(CMD_URGENCY); commands.add(toUrgency(notification.level())); try { executor.exec(commands.toArray(new String[0])); } catch (RuntimeException e) { throw new NotifySendNotificationException("Error while sending notification to notify-send.", e.getCause()); } }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof Notification) { Notification that = (Notification) o; return (this.message.equals(that.message())) && (this.title.equals(that.title())) && ((this.subtitle == null) ? (that.subtitle() == null) : this.subtitle.equals(that.subtitle())) && (this.icon.equals(that.icon())) && (this.level.equals(that.level())); } return false; }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof Notification) { Notification that = (Notification) o; return (this.message.equals(that.message())) && (this.title.equals(that.title())) && ((this.subtitle == null) ? (that.subtitle() == null) : this.subtitle.equals(that.subtitle())) && (this.icon.equals(that.icon())) && (this.level.equals(that.level())); } return false; }
@Override public void send(Notification notification) { if (isClientRegistered()) { GntpNotification success = Gntp.notification(gNotification, notification.title()) .text(notification.message()) .icon(notification.icon().toImage()) .priority(toPriority(notification.level())) .build(); try { gClient.notify(success, 5, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }
@Override public void send(Notification notification) { if (isClientRegistered()) { GntpNotification success = Gntp.notification(gNotification, notification.title()) .text(notification.message()) .icon(notification.icon().toImage()) .priority(toPriority(notification.level())) .build(); try { gClient.notify(success, 5, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }
@Override public void send(Notification notification) { if (!skipNotifications) { icon.setImage(createImage(notification.icon().toByteArray())); icon.displayMessage(notification.title(), notification.message(), toMessageType(notification.level())); } }
@Override public void send(Notification notification) { if (!skipNotifications) { icon.setImage(createImage(notification.icon().toByteArray())); icon.displayMessage(notification.title(), notification.message(), toMessageType(notification.level())); } }
@Override public void send(Notification notification) { if (snarl == null) { LOGGER.warn("Snarl notifier is not initialized, cannot send notification."); return; } fr.jcgay.snp4j.request.Notification snarlNotification = new fr.jcgay.snp4j.request.Notification(); snarlNotification.setIcon(Icon.base64(notification.icon().toByteArray())); snarlNotification.setText(notification.message()); snarlNotification.setTitle(notification.title()); snarlNotification.setPriority(toPriority(notification.level())); init(); try { snarl.send(snarlNotification); } catch (SnpException e) { throw new SnarlNotificationException("Cannot send notification to Snarl.", e); } }
@Override public void send(Notification notification) { if (snarl == null) { LOGGER.warn("Snarl notifier is not initialized, cannot send notification."); return; } fr.jcgay.snp4j.request.Notification snarlNotification = new fr.jcgay.snp4j.request.Notification(); snarlNotification.setIcon(Icon.base64(notification.icon().toByteArray())); snarlNotification.setText(notification.message()); snarlNotification.setTitle(notification.title()); snarlNotification.setPriority(toPriority(notification.level())); init(); try { snarl.send(snarlNotification); } catch (SnpException e) { throw new SnarlNotificationException("Cannot send notification to Snarl.", e); } }