+ public Optional<PostCreated> postCreated() {
+ return Optional.<PostCreated>of(new PostCreated() {
+ @Override
+ public void postCreated(final Post post) {
+ if (post.isKnown()) {
+ return;
+ }
+ eventBus.post(new NewPostFoundEvent(post));
+ if (post.getSone().isLocal()) {
+ localElementTicker.schedule(new Runnable() {
+ @Override
+ public void run() {
+ markPostKnown(post);
+ }
+ }, 10, TimeUnit.SECONDS);
+ }
+ }
+ });
+ }
+
+ public Optional<PostReplyCreated> postReplyCreated() {
+ return Optional.<PostReplyCreated>of(new PostReplyCreated() {
+ @Override
+ public void postReplyCreated(final PostReply postReply) {
+ if (postReply.isKnown()) {
+ return;
+ }
+ eventBus.post(new NewPostReplyFoundEvent(postReply));
+ if (postReply.getSone().isLocal()) {
+ localElementTicker.schedule(new Runnable() {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void run() {
+ postReplyUpdated().get().replyUpdated(postReply);
+ }
+ }, 10, TimeUnit.SECONDS);
+ }
+ }
+ });
+ }
+
+ public Optional<ReplyUpdated<PostReply>> postReplyUpdated() {
+ return Optional.<ReplyUpdated<PostReply>>of(new ReplyUpdated<PostReply>() {
+ @Override
+ public void replyUpdated(PostReply reply) {
+ eventBus.post(new MarkPostReplyKnownEvent(reply));
+ }
+ });
+ }
+
+ public Optional<ImageCreated> imageCreated() {
+ return Optional.<ImageCreated>of(new ImageCreated() {
+ @Override
+ public void imageCreated(Image image) {
+ /* nothing happens here yet. */
+ }
+ });
+ }
+