- protected void processTemplate(Request request, Template template) throws RedirectException {
- super.processTemplate(request, template);
- Sone sone = getCurrentSone(request.getToadletContext());
- List<Post> allPosts = new ArrayList<Post>();
- allPosts.addAll(sone.getPosts());
- for (Sone friendSone : sone.getFriendSones()) {
- allPosts.addAll(friendSone.getPosts());
+ 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);
+ }
+ }