import net.pterodactylus.sone.web.page.PageToadlet;
import net.pterodactylus.sone.web.page.PageToadletFactory;
import net.pterodactylus.util.collection.SetBuilder;
-import net.pterodactylus.util.collection.filter.Filters;
import net.pterodactylus.util.logging.Logging;
import net.pterodactylus.util.notify.Notification;
import net.pterodactylus.util.notify.NotificationManager;
import net.pterodactylus.util.web.RedirectPage;
import net.pterodactylus.util.web.StaticPage;
import net.pterodactylus.util.web.TemplatePage;
+
+import com.google.common.collect.Collections2;
+import com.google.inject.Inject;
+
import freenet.clients.http.SessionManager;
import freenet.clients.http.SessionManager.Session;
import freenet.clients.http.ToadletContainer;
* @param sonePlugin
* The Sone plugin
*/
+ @Inject
public WebInterface(SonePlugin sonePlugin) {
this.sonePlugin = sonePlugin;
formPassword = sonePlugin.pluginRespirator().getToadletContainer().getFormPassword();
* currently logged in
*/
public Sone getCurrentSone(ToadletContext toadletContext, boolean create) {
- Set<Sone> localSones = getCore().getLocalSones();
+ Collection<Sone> localSones = getCore().getLocalSones();
if (localSones.size() == 1) {
return localSones.iterator().next();
}
}
/**
- * Returns all {@link Core#isLocalSone(Sone) local Sone}s that are
- * referenced by {@link SonePart}s in the given text (after parsing it using
+ * Returns all {@link Sone#isLocal() local Sone}s that are referenced by
+ * {@link SonePart}s in the given text (after parsing it using
* {@link SoneTextParser}).
*
* @param text
* The text to parse
* @return All mentioned local Sones
*/
- private Set<Sone> getMentionedSones(String text) {
+ private Collection<Sone> getMentionedSones(String text) {
/* we need no context to find mentioned Sones. */
Set<Sone> mentionedSones = new HashSet<Sone>();
try {
} catch (IOException ioe1) {
logger.log(Level.WARNING, String.format("Could not parse post text: %s", text), ioe1);
}
- return Filters.filteredSet(mentionedSones, Sone.LOCAL_SONE_FILTER);
+ return Collections2.filter(mentionedSones, Sone.LOCAL_SONE_FILTER);
}
/**
*/
@Override
public void newPostFound(Post post) {
- boolean isLocal = getCore().isLocalSone(post.getSone());
+ boolean isLocal = post.getSone().isLocal();
if (isLocal) {
localPostNotification.add(post);
} else {
*/
@Override
public void newReplyFound(PostReply reply) {
- boolean isLocal = getCore().isLocalSone(reply.getSone());
+ boolean isLocal = reply.getSone().isLocal();
if (isLocal) {
localReplyNotification.add(reply);
} else {