import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.freenet.L10nFilter;
import net.pterodactylus.sone.freenet.wot.Identity;
+import net.pterodactylus.sone.freenet.wot.Trust;
import net.pterodactylus.sone.main.SonePlugin;
import net.pterodactylus.sone.notify.ListNotification;
import net.pterodactylus.sone.template.CollectionAccessor;
import net.pterodactylus.sone.template.RequestChangeFilter;
import net.pterodactylus.sone.template.SoneAccessor;
import net.pterodactylus.sone.template.SubstringFilter;
+import net.pterodactylus.sone.template.TrustAccessor;
import net.pterodactylus.sone.web.ajax.CreatePostAjaxPage;
import net.pterodactylus.sone.web.ajax.CreateReplyAjaxPage;
import net.pterodactylus.sone.web.ajax.DeletePostAjaxPage;
templateFactory.addAccessor(Reply.class, new ReplyAccessor(getCore(), templateFactory));
templateFactory.addAccessor(Identity.class, new IdentityAccessor(getCore()));
templateFactory.addAccessor(NotificationManager.class, new NotificationManagerAccessor());
+ templateFactory.addAccessor(Trust.class, new TrustAccessor());
templateFactory.addFilter("date", new DateFilter());
templateFactory.addFilter("l10n", new L10nFilter(getL10n()));
templateFactory.addFilter("substring", new SubstringFilter());
* currently logged in
*/
public Sone getCurrentSone(ToadletContext toadletContext) {
- return getCurrentSone(getCurrentSession(toadletContext));
+ return getCurrentSone(toadletContext, true);
+ }
+
+ /**
+ * Returns the currently logged in Sone.
+ *
+ * @param toadletContext
+ * The toadlet context
+ * @param create
+ * {@code true} to create a new session if no session exists,
+ * {@code false} to not create a new session
+ * @return The currently logged in Sone, or {@code null} if no Sone is
+ * currently logged in
+ */
+ public Sone getCurrentSone(ToadletContext toadletContext, boolean create) {
+ return getCurrentSone(getCurrentSession(toadletContext, create));
}
/**
*/
@Override
public void postRemoved(Post post) {
- /* TODO */
+ newPostNotification.remove(post);
}
/**
*/
@Override
public void replyRemoved(Reply reply) {
- /* TODO */
+ newReplyNotification.remove(reply);
}
/**
@SuppressWarnings("synthetic-access")
public void run() {
lockedSonesNotification.add(sone);
+ lockedSonesTickerObjects.remove(sone);
notificationManager.addNotification(lockedSonesNotification);
}
}, "Sone Locked Notification");
*/
@Override
public void soneUnlocked(Sone sone) {
- Object tickerObject = lockedSonesTickerObjects.remove(sone);
- if (tickerObject == null) {
- return;
- }
lockedSonesNotification.remove(sone);
- Ticker.getInstance().deregisterEvent(tickerObject);
+ Ticker.getInstance().deregisterEvent(lockedSonesTickerObjects.remove(sone));
}
/**