+ protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException {
+ super.processTemplate(request, templateContext);
+ final Sone currentSone = getCurrentSone(request.getToadletContext());
+ Collection<Post> allPosts = new ArrayList<Post>();
+ allPosts.addAll(currentSone.getPosts());
+ for (String friendSoneId : currentSone.getFriends()) {
+ Optional<Sone> friendSone = webInterface.getCore().getSone(friendSoneId);
+ if (!friendSone.isPresent()) {
+ continue;
+ }
+ allPosts.addAll(friendSone.get().getPosts());
+ }
+ for (Sone sone : webInterface.getCore().getSones()) {
+ for (Post post : sone.getPosts()) {
+ if (currentSone.equals(post.getRecipient().orNull()) && !allPosts.contains(post)) {
+ allPosts.add(post);
+ }
+ }
+ }
+ allPosts = Collections2.filter(allPosts, new Predicate<Post>() {
+
+ @Override
+ public boolean apply(Post post) {
+ return ListNotificationFilters.isPostVisible(currentSone, post);
+ }
+ });
+ allPosts = Collections2.filter(allPosts, Post.FUTURE_POSTS_FILTER);
+ List<Post> sortedPosts = new ArrayList<Post>(allPosts);
+ Collections.sort(sortedPosts, Post.TIME_COMPARATOR);
+ Pagination<Post> pagination = new Pagination<Post>(sortedPosts, webInterface.getCore().getPreferences().getPostsPerPage()).setPage(parseInt(request.getHttpRequest().getParam("page"), 0));
+ templateContext.set("pagination", pagination);
+ templateContext.set("posts", pagination.getItems());