Merge branch 'release-0.5.2' 0.5.2
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 29 Mar 2011 18:24:36 +0000 (20:24 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 29 Mar 2011 18:24:36 +0000 (20:24 +0200)
pom.xml
src/main/java/net/pterodactylus/sone/core/Core.java
src/main/java/net/pterodactylus/sone/freenet/wot/WebOfTrustConnector.java
src/main/java/net/pterodactylus/sone/main/SonePlugin.java
src/main/java/net/pterodactylus/sone/web/LoginPage.java
src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java
src/main/resources/templates/include/createSone.html
src/main/resources/templates/include/head.html
src/main/resources/templates/include/viewPost.html
src/main/resources/templates/include/viewReply.html
src/main/resources/templates/viewSone.html

diff --git a/pom.xml b/pom.xml
index 229f2ef..0dfac6e 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
        <modelVersion>4.0.0</modelVersion>
        <groupId>net.pterodactylus</groupId>
        <artifactId>sone</artifactId>
-       <version>0.5.1</version>
+       <version>0.5.2</version>
        <dependencies>
                <dependency>
                        <groupId>net.pterodactylus</groupId>
index 7dc398e..e0373e9 100644 (file)
@@ -817,7 +817,6 @@ public class Core implements IdentityListener, UpdateListener {
                                @SuppressWarnings("synthetic-access")
                                public void run() {
                                        if (!preferences.isSoneRescueMode()) {
-                                               soneDownloader.fetchSone(sone);
                                                return;
                                        }
                                        logger.log(Level.INFO, "Trying to restore Sone from Freenet…");
index b6d68d3..1802f2d 100644 (file)
@@ -42,7 +42,7 @@ public class WebOfTrustConnector implements ConnectorListener {
        private static final Logger logger = Logging.getLogger(WebOfTrustConnector.class);
 
        /** The name of the WoT plugin. */
-       private static final String WOT_PLUGIN_NAME = "plugins.WoT.WoT";
+       private static final String WOT_PLUGIN_NAME = "plugins.WebOfTrust.WebOfTrust";
 
        /** A random connection identifier. */
        private static final String PLUGIN_CONNECTION_IDENTIFIER = "Sone-WoT-Connector-" + Math.abs(Math.random());
index 0f7f0e8..635b734 100644 (file)
@@ -78,7 +78,7 @@ public class SonePlugin implements FredPlugin, FredPluginL10n, FredPluginBaseL10
        }
 
        /** The version. */
-       public static final Version VERSION = new Version(0, 5, 1);
+       public static final Version VERSION = new Version(0, 5, 2);
 
        /** The logger. */
        private static final Logger logger = Logging.getLogger(SonePlugin.class);
index 1126f7b..eaa8351 100644 (file)
@@ -72,7 +72,11 @@ public class LoginPage extends SoneTemplatePage {
                        Sone selectedSone = webInterface.getCore().getLocalSone(soneId, false);
                        if (selectedSone != null) {
                                setCurrentSone(request.getToadletContext(), selectedSone);
-                               throw new RedirectException("index.html");
+                               String target = request.getHttpRequest().getParam("target");
+                               if ((target == null) || (target.length() == 0)) {
+                                       target = "index.html";
+                               }
+                               throw new RedirectException(target);
                        }
                }
                List<OwnIdentity> ownIdentitiesWithoutSone = CreateSonePage.getOwnIdentitiesWithoutSone(webInterface.getCore());
index a7df9c2..a04873d 100644 (file)
@@ -17,6 +17,8 @@
 
 package net.pterodactylus.sone.web;
 
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
 import java.util.Arrays;
 import java.util.Collection;
 
@@ -28,6 +30,7 @@ import net.pterodactylus.util.template.Template;
 import net.pterodactylus.util.template.TemplateContext;
 import freenet.clients.http.SessionManager.Session;
 import freenet.clients.http.ToadletContext;
+import freenet.support.api.HTTPRequest;
 
 /**
  * Base page for the Freetalk web interface.
@@ -204,7 +207,26 @@ public class SoneTemplatePage extends TemplatePage {
        @Override
        protected String getRedirectTarget(Page.Request request) {
                if (requiresLogin() && (getCurrentSone(request.getToadletContext(), false) == null)) {
-                       return "login.html";
+                       HTTPRequest httpRequest = request.getHttpRequest();
+                       String originalUrl = httpRequest.getPath();
+                       if (httpRequest.hasParameters()) {
+                               StringBuilder requestParameters = new StringBuilder();
+                               for (String parameterName : httpRequest.getParameterNames()) {
+                                       if (requestParameters.length() > 0) {
+                                               requestParameters.append("%26");
+                                       }
+                                       String[] parameterValues = httpRequest.getMultipleParam(parameterName);
+                                       for (String parameterValue : parameterValues) {
+                                               try {
+                                                       requestParameters.append(URLEncoder.encode(parameterName, "UTF-8")).append("%3d").append(URLEncoder.encode(parameterValue, "UTF-8"));
+                                               } catch (UnsupportedEncodingException uee1) {
+                                                       /* A JVM without UTF-8? I don’t think so. */
+                                               }
+                                       }
+                               }
+                               originalUrl += "?" + requestParameters.toString();
+                       }
+                       return "login.html?target=" + originalUrl;
                }
                return null;
        }
index 30ce0f7..c0df5c0 100644 (file)
@@ -1,7 +1,7 @@
 <%if !identitiesWithoutSone.empty>
        <h1><%= Page.Login.CreateSone.Title|l10n|html></h1>
 
-       <p><%= View.CreateSone.Text.WotIdentityRequired|l10n|html|replace needle="{link}" replacement='<a href="/WoT/">'|replace needle="{/link}" replacement='</a>'></p>
+       <p><%= View.CreateSone.Text.WotIdentityRequired|l10n|html|replace needle="{link}" replacement='<a href="/WebOfTrust/">'|replace needle="{/link}" replacement='</a>'></p>
 
        <form id="create-sone" action="createSone.html" method="post">
                <input type="hidden" name="formPassword" value="<% formPassword|html>" />
@@ -23,8 +23,8 @@
        </form>
 <%else>
        <%if !sones.empty>
-               <p><%= View.CreateSone.Text.NoNonSoneIdentities|l10n|html|replace needle="{link}" replacement='<a href="/WoT/OwnIdentities">'|replace needle="{/link}" replacement="</a>"></p>
+               <p><%= View.CreateSone.Text.NoNonSoneIdentities|l10n|html|replace needle="{link}" replacement='<a href="/WebOfTrust/OwnIdentities">'|replace needle="{/link}" replacement="</a>"></p>
        <%else>
-               <p><%= View.CreateSone.Text.NoIdentities|l10n|html|replace needle="{link}" replacement='<a href="/WoT/OwnIdentities">'|replace needle="{/link}" replacement="</a>"></p>
+               <p><%= View.CreateSone.Text.NoIdentities|l10n|html|replace needle="{link}" replacement='<a href="/WebOfTrust/OwnIdentities">'|replace needle="{/link}" replacement="</a>"></p>
        <%/if>
 <%/if>
index a9fbb49..cd83600 100644 (file)
@@ -36,7 +36,7 @@
                <div id="profile" class="<%ifnull currentSone>offline<%else>online<%/if>">
                        <a class="picture" href="index.html">
                                <%ifnull !currentSone>
-                                       <img src="/WoT/GetIdenticon?identity=<% currentSone.id|html>&amp;width=80&amp;height=80" width="80" height="80" alt="Profile Avatar" />
+                                       <img src="/WebOfTrust/GetIdenticon?identity=<% currentSone.id|html>&amp;width=80&amp;height=80" width="80" height="80" alt="Profile Avatar" />
                                <%else>
                                        <img src="images/sone.png" width="80" height="80" alt="Sone is offline" />
                                <%/if>
index 3023566..676fa6a 100644 (file)
@@ -3,7 +3,7 @@
        <div class="post-time hidden"><% post.time|html></div>
        <div class="post-author hidden"><% post.sone.id|html></div>
        <div class="avatar">
-               <img src="/WoT/GetIdenticon?identity=<% post.sone.id|html>&amp;width=48&height=48" width="48" height="48" alt="Avatar Image" />
+               <img src="/WebOfTrust/GetIdenticon?identity=<% post.sone.id|html>&amp;width=48&height=48" width="48" height="48" alt="Avatar Image" />
        </div>
        <div class="inner-part">
                <div>
index cdb837c..e179e01 100644 (file)
@@ -3,7 +3,7 @@
        <div class="reply-time hidden"><% reply.time|html></div>
        <div class="reply-author hidden"><% reply.sone.id|html></div>
        <div class="avatar">
-               <img src="/WoT/GetIdenticon?identity=<% reply.sone.id|html>&amp;width=36&height=36" width="36" height="36" alt="Avatar Image" />
+               <img src="/WebOfTrust/GetIdenticon?identity=<% reply.sone.id|html>&amp;width=36&height=36" width="36" height="36" alt="Avatar Image" />
        </div>
        <div class="inner-part">
                <div>
index d2a8f6e..8df39e0 100644 (file)
@@ -25,7 +25,7 @@
 
                        <div class="profile-field">
                                <div class="name"><%= Page.ViewSone.Profile.Label.Name|l10n|html></div>
-                               <div class="value"><a href="/WoT/ShowIdentity?id=<% sone.id|html>"><% sone.niceName|html></a></div>
+                               <div class="value"><a href="/WebOfTrust/ShowIdentity?id=<% sone.id|html>"><% sone.niceName|html></a></div>
                        </div>
 
                        <%foreach sone.profile.fields field>