projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Convert “Sone is being inserted” into EventBus-based event.
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
web
/
WebInterface.java
diff --git
a/src/main/java/net/pterodactylus/sone/web/WebInterface.java
b/src/main/java/net/pterodactylus/sone/web/WebInterface.java
index
14bbcc4
..
886383c
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/WebInterface.java
+++ b/
src/main/java/net/pterodactylus/sone/web/WebInterface.java
@@
-43,7
+43,12
@@
import net.pterodactylus.sone.core.event.MarkSoneKnownEvent;
import net.pterodactylus.sone.core.event.NewPostFoundEvent;
import net.pterodactylus.sone.core.event.NewPostReplyFoundEvent;
import net.pterodactylus.sone.core.event.NewSoneFoundEvent;
import net.pterodactylus.sone.core.event.NewPostFoundEvent;
import net.pterodactylus.sone.core.event.NewPostReplyFoundEvent;
import net.pterodactylus.sone.core.event.NewSoneFoundEvent;
+import net.pterodactylus.sone.core.event.PostRemovedEvent;
+import net.pterodactylus.sone.core.event.PostReplyRemovedEvent;
+import net.pterodactylus.sone.core.event.SoneInsertingEvent;
+import net.pterodactylus.sone.core.event.SoneLockedEvent;
import net.pterodactylus.sone.core.event.SoneRemovedEvent;
import net.pterodactylus.sone.core.event.SoneRemovedEvent;
+import net.pterodactylus.sone.core.event.SoneUnlockedEvent;
import net.pterodactylus.sone.data.Album;
import net.pterodactylus.sone.data.Image;
import net.pterodactylus.sone.data.Post;
import net.pterodactylus.sone.data.Album;
import net.pterodactylus.sone.data.Image;
import net.pterodactylus.sone.data.Post;
@@
-899,25
+904,28
@@
public class WebInterface implements CoreListener {
newSoneNotification.remove(soneRemovedEvent.sone());
}
newSoneNotification.remove(soneRemovedEvent.sone());
}
- //
- // CORELISTENER METHODS
- //
-
/**
/**
- * {@inheritDoc}
+ * Notifies the web interface that a {@link Post} was removed.
+ *
+ * @param postRemovedEvent
+ * The event
*/
*/
- @
Overrid
e
- public void postRemoved(Post
pos
t) {
- newPostNotification.remove(post);
- localPostNotification.remove(post);
- mentionNotification.remove(post);
+ @
Subscrib
e
+ public void postRemoved(Post
RemovedEvent postRemovedEven
t) {
+ newPostNotification.remove(post
RemovedEvent.post()
);
+ localPostNotification.remove(post
RemovedEvent.post()
);
+ mentionNotification.remove(post
RemovedEvent.post()
);
}
/**
}
/**
- * {@inheritDoc}
+ * Notifies the web interface that a {@link PostReply} was removed.
+ *
+ * @param postReplyRemovedEvent
+ * The event
*/
*/
- @Override
- public void replyRemoved(PostReply reply) {
+ @Subscribe
+ public void replyRemoved(PostReplyRemovedEvent postReplyRemovedEvent) {
+ PostReply reply = postReplyRemovedEvent.postReply();
newReplyNotification.remove(reply);
localReplyNotification.remove(reply);
if (!getMentionedSones(reply.getText()).isEmpty()) {
newReplyNotification.remove(reply);
localReplyNotification.remove(reply);
if (!getMentionedSones(reply.getText()).isEmpty()) {
@@
-932,10
+940,14
@@
public class WebInterface implements CoreListener {
}
/**
}
/**
- * {@inheritDoc}
+ * Notifies the web interface that a Sone was locked.
+ *
+ * @param soneLockedEvent
+ * The event
*/
*/
- @Override
- public void soneLocked(final Sone sone) {
+ @Subscribe
+ public void soneLocked(SoneLockedEvent soneLockedEvent) {
+ final Sone sone = soneLockedEvent.sone();
Object tickerObject = Ticker.getInstance().registerEvent(System.currentTimeMillis() + (5 * 60) * 1000, new Runnable() {
@Override
Object tickerObject = Ticker.getInstance().registerEvent(System.currentTimeMillis() + (5 * 60) * 1000, new Runnable() {
@Override
@@
-950,26
+962,36
@@
public class WebInterface implements CoreListener {
}
/**
}
/**
- * {@inheritDoc}
+ * Notifies the web interface that a Sone was unlocked.
+ *
+ * @param soneUnlockedEvent
+ * The event
*/
*/
- @
Overrid
e
- public void soneUnlocked(Sone
sone
) {
- lockedSonesNotification.remove(sone);
- Ticker.getInstance().deregisterEvent(lockedSonesTickerObjects.remove(sone));
+ @
Subscrib
e
+ public void soneUnlocked(Sone
UnlockedEvent soneUnlockedEvent
) {
+ lockedSonesNotification.remove(sone
UnlockedEvent.sone()
);
+ Ticker.getInstance().deregisterEvent(lockedSonesTickerObjects.remove(sone
UnlockedEvent.sone()
));
}
/**
}
/**
- * {@inheritDoc}
+ * Notifies the web interface that a {@link Sone} is being inserted.
+ *
+ * @param soneInsertingEvent
+ * The event
*/
*/
- @
Overrid
e
- public void soneInserting(Sone
sone
) {
- TemplateNotification soneInsertNotification = getSoneInsertNotification(sone);
+ @
Subscrib
e
+ public void soneInserting(Sone
InsertingEvent soneInsertingEvent
) {
+ TemplateNotification soneInsertNotification = getSoneInsertNotification(sone
InsertingEvent.sone()
);
soneInsertNotification.set("soneStatus", "inserting");
soneInsertNotification.set("soneStatus", "inserting");
- if (sone.getOptions().getBooleanOption("EnableSoneInsertNotifications").get()) {
+ if (sone
InsertingEvent.sone()
.getOptions().getBooleanOption("EnableSoneInsertNotifications").get()) {
notificationManager.addNotification(soneInsertNotification);
}
}
notificationManager.addNotification(soneInsertNotification);
}
}
+ //
+ // CORELISTENER METHODS
+ //
+
/**
* {@inheritDoc}
*/
/**
* {@inheritDoc}
*/