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