Author: dongxu
Date: Thu Sep 12 02:03:24 2013
New Revision: 1522108
URL: http://svn.apache.org/r1522108
Log:
constantly changed by manolo
Modified:
james/hupa/trunk/client/pom.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginPresenter.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginView.java
james/hupa/trunk/client/src/main/webapp/Hupa.html
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractFetchMessagesHandler.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractSendMessageHandler.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/MessageUtils.java
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/ContactsHandlerTest.java
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/FetchMessagesHandlerTest.java
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/utils/MessageUtilsTest.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/ContactsResult.java
Modified: james/hupa/trunk/client/pom.xml
URL:
http://svn.apache.org/viewvc/james/hupa/trunk/client/pom.xml?rev=1522108&r1=1522107&r2=1522108&view=diff
==============================================================================
--- james/hupa/trunk/client/pom.xml (original)
+++ james/hupa/trunk/client/pom.xml Thu Sep 12 02:03:24 2013
@@ -17,9 +17,7 @@
specific language governing permissions and limitations
under the License.
-->
-<project
- xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -77,10 +75,10 @@
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<exclusions>
- <exclusion>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- </exclusion>
+ <exclusion>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -97,9 +95,9 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>4.2.0.Final</version>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>4.2.0.Final</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
@@ -117,14 +115,14 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
- </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-webapp</artifactId>
+ </dependency>
</dependencies>
<build>
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
@@ -135,7 +133,7 @@
<configuration>
<runTarget>Hupa.html</runTarget>
<extraJvmArgs>
- -Xmx512M -Xss128M
-Dhupa.config.file=${project.parent.basedir}/server/src/main/webapp/WEB-INF/conf/config.properties
+ -Xmx512M -Xss128M
</extraJvmArgs>
<localWorkers>1</localWorkers>
<compileReport>true</compileReport>
@@ -187,11 +185,11 @@
</resource>
</webResources>
<warName>${project.artifactId}-${project.version}</warName>
- <archive>
- <manifest>
-
<mainClass>org.apache.hupa.Launcher</mainClass>
- </manifest>
- </archive>
+ <archive>
+ <manifest>
+ <mainClass>org.apache.hupa.Launcher</mainClass>
+ </manifest>
+ </archive>
</configuration>
</plugin>
<plugin>
@@ -246,7 +244,7 @@
</executions>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
@@ -275,33 +273,33 @@
<resources>
<resource>
<directory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</directory>
-
<include>org/apache/hupa/Launcher.class</include>
+
<include>org/apache/hupa/Launcher.class</include>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>jetty-classpath</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>unpack-dependencies</goal>
- </goals>
- <configuration>
-
<includeGroupIds>org.eclipse.jetty,javax.servlet</includeGroupIds>
-
<excludeArtifactIds>jsp-api,jstl</excludeArtifactIds>
- <outputDirectory>
-
${project.build.directory}/${project.artifactId}-${project.version}
- </outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>jetty-classpath</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>unpack-dependencies</goal>
+ </goals>
+ <configuration>
+
<includeGroupIds>org.eclipse.jetty,javax.servlet</includeGroupIds>
+
<excludeArtifactIds>jsp-api,jstl</excludeArtifactIds>
+ <outputDirectory>
+
${project.build.directory}/${project.artifactId}-${project.version}
+ </outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
</project>
Modified:
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginPresenter.java
URL:
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginPresenter.java?rev=1522108&r1=1522107&r2=1522108&view=diff
==============================================================================
---
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginPresenter.java
(original)
+++
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginPresenter.java
Thu Sep 12 02:03:24 2013
@@ -49,8 +49,6 @@ import com.google.inject.Inject;
public class LoginPresenter extends WidgetPresenter<LoginPresenter.Display>{
private HupaConstants constants = GWT.create(HupaConstants.class);
- private int minUsernameLength = 1;
- private int minPasswordLength = 1;
public interface Display extends WidgetDisplay{
public HasClickHandlers getLoginClick();
@@ -73,10 +71,10 @@ public class LoginPresenter extends Widg
* Try to login the user
*/
private void doLogin() {
- String user = display.getUserNameValue().getValue();
- String pass = display.getPasswordValue().getValue();
+ String user = display.getUserNameValue().getValue().trim();
+ String pass = display.getPasswordValue().getValue().trim();
- if (user.length() < minUsernameLength || pass.length() <
minPasswordLength)
+ if (user.isEmpty() || pass.isEmpty())
return;
display.setLoading(true);
Modified:
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginView.java
URL:
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginView.java?rev=1522108&r1=1522107&r2=1522108&view=diff
==============================================================================
---
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginView.java
(original)
+++
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginView.java
Thu Sep 12 02:03:24 2013
@@ -81,9 +81,7 @@ public class LoginView extends Composite
mainContainer.setStyleName(HupaCSS.C_login_container);
flexTable.addStyleName(HupaCSS.C_login_form);
usernameTextBox.addStyleName(HupaCSS.C_login_box);
- usernameTextBox.setName("user");
passwordTextBox.addStyleName(HupaCSS.C_login_box);
- usernameTextBox.setName("password");
buttonBar.add(submitButton);
buttonBar.add(resetButton);
@@ -112,8 +110,10 @@ public class LoginView extends Composite
// stores the presenter clickHandler.
formPanel.addSubmitHandler(new FormPanel.SubmitHandler() {
public void onSubmit(SubmitEvent event) {
- event.cancel();
- loginButton.click();
+ if (!usernameTextBox.getValue().trim().isEmpty() &&
!passwordTextBox.getValue().trim().isEmpty()) {
+ loginButton.click();
+ }
+// event.cancel();
}
});
// loginButton must be in the document to handle the click() method
@@ -134,6 +134,7 @@ public class LoginView extends Composite
passwordTextBox.setFocus(true);
} else if (event.getSource().equals(passwordTextBox)) {
submitButton.click();
+// formPanel.submit();
}
}
}
Modified: james/hupa/trunk/client/src/main/webapp/Hupa.html
URL:
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/webapp/Hupa.html?rev=1522108&r1=1522107&r2=1522108&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/webapp/Hupa.html (original)
+++ james/hupa/trunk/client/src/main/webapp/Hupa.html Thu Sep 12 02:03:24 2013
@@ -88,7 +88,7 @@
<!-- We need this because passwords in forms rendered by js are not saved
in browsers -->
<div id="login">
- <form id="loginForm" action="hupa/hupa.nocache.js" method="post">
+ <form id="loginForm" action="hupa/clear.cache.gif" method="post">
<input id="email" name="email" type="text">
<input id="password" name="password" type="password">
</form>
Modified:
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractFetchMessagesHandler.java
URL:
http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractFetchMessagesHandler.java?rev=1522108&r1=1522107&r2=1522108&view=diff
==============================================================================
---
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractFetchMessagesHandler.java
(original)
+++
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractFetchMessagesHandler.java
Thu Sep 12 02:03:24 2013
@@ -19,9 +19,18 @@
package org.apache.hupa.server.handler;
-import com.google.inject.Provider;
+import java.io.IOException;
+import java.util.ArrayList;
-import com.sun.mail.imap.IMAPStore;
+import javax.mail.Address;
+import javax.mail.FetchProfile;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.Multipart;
+import javax.mail.Part;
+import javax.mail.UIDFolder;
+import javax.mail.internet.MimeMessage.RecipientType;
+import javax.servlet.http.HttpSession;
import net.customware.gwt.dispatch.server.ExecutionContext;
import net.customware.gwt.dispatch.shared.ActionException;
@@ -29,27 +38,16 @@ import net.customware.gwt.dispatch.share
import org.apache.commons.logging.Log;
import org.apache.hupa.server.IMAPStoreCache;
import org.apache.hupa.server.preferences.UserPreferencesStorage;
+import org.apache.hupa.server.utils.MessageUtils;
import org.apache.hupa.shared.data.IMAPFolder;
+import org.apache.hupa.shared.data.Message.IMAPFlag;
import org.apache.hupa.shared.data.Tag;
import org.apache.hupa.shared.data.User;
-import org.apache.hupa.shared.data.Message.IMAPFlag;
import org.apache.hupa.shared.rpc.FetchMessages;
import org.apache.hupa.shared.rpc.FetchMessagesResult;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-
-import javax.mail.Address;
-import javax.mail.FetchProfile;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.Multipart;
-import javax.mail.Part;
-import javax.mail.UIDFolder;
-import javax.mail.internet.MimeUtility;
-import javax.mail.internet.MimeMessage.RecipientType;
-import javax.servlet.http.HttpSession;
+import com.google.inject.Provider;
+import com.sun.mail.imap.IMAPStore;
public abstract class AbstractFetchMessagesHandler <A extends FetchMessages>
extends AbstractSessionHandler<A, FetchMessagesResult>{
@@ -128,13 +126,13 @@ public abstract class AbstractFetchMessa
Message m = messages[i];
String from = null;
if (m.getFrom() != null && m.getFrom().length >0 ) {
- from = decodeText(m.getFrom()[0].toString());
+ from = MessageUtils.decodeText(m.getFrom()[0].toString());
}
msg.setFrom(from);
String replyto = null;
if (m.getReplyTo() != null && m.getReplyTo().length >0 ) {
- replyto = decodeText(m.getReplyTo()[0].toString());
+ replyto =
MessageUtils.decodeText(m.getReplyTo()[0].toString());
}
msg.setReplyto(replyto);
@@ -143,7 +141,7 @@ public abstract class AbstractFetchMessa
Address[] toArray = m.getRecipients(RecipientType.TO);
if (toArray != null) {
for (Address addr : toArray) {
- String mailTo = decodeText(addr.toString());
+ String mailTo = MessageUtils.decodeText(addr.toString());
to.add(mailTo);
}
}
@@ -152,7 +150,7 @@ public abstract class AbstractFetchMessa
// Check if a subject exist and if so decode it
String subject = m.getSubject();
if (subject != null) {
- subject = decodeText(subject);
+ subject = MessageUtils.decodeText(subject);
}
msg.setSubject(subject);
@@ -161,7 +159,7 @@ public abstract class AbstractFetchMessa
ArrayList<String> cc = new ArrayList<String>();
if (ccArray != null) {
for (Address addr : ccArray) {
- String mailCc = decodeText(addr.toString());
+ String mailCc = MessageUtils.decodeText(addr.toString());
cc.add(mailCc);
}
}
@@ -247,20 +245,5 @@ public abstract class AbstractFetchMessa
}
}
- /**
- * Decode iso-xxxx strings present in subjects and emails like:
- *
- * =?ISO-8859-1?Q?No=20hay=20ma=F1ana?= <[email protected]>
- */
- private String decodeText(String s) {
- String ret = s;
- try {
- ret = MimeUtility.decodeText(s);
- } catch (UnsupportedEncodingException e) {
- logger.debug("Unable to decode text " + s + " " + e.getMessage());
- }
- // Remove quotes around names in email addresses
- ret = ret.replaceFirst("^[\"' ]+([^\"]*)[\"' ]+<", "$1 <");
- return ret;
- }
+
}
Modified:
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractSendMessageHandler.java
URL:
http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractSendMessageHandler.java?rev=1522108&r1=1522107&r2=1522108&view=diff
==============================================================================
---
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractSendMessageHandler.java
(original)
+++
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractSendMessageHandler.java
Thu Sep 12 02:03:24 2013
@@ -147,7 +147,7 @@ public abstract class AbstractSendMessag
message.setRecipients(RecipientType.TO,
MessageUtils.getRecipients(m.getTo()));
message.setRecipients(RecipientType.CC,
MessageUtils.getRecipients(m.getCc()));
message.setRecipients(RecipientType.BCC,
MessageUtils.getRecipients(m.getBcc()));
- message.setSubject(m.getSubject());
+ message.setSubject(MessageUtils.encodeTexts(m.getSubject()));
message.saveChanges();
return message;
}
Modified:
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/MessageUtils.java
URL:
http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/MessageUtils.java?rev=1522108&r1=1522107&r2=1522108&view=diff
==============================================================================
---
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/MessageUtils.java
(original)
+++
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/MessageUtils.java
Thu Sep 12 02:03:24 2013
@@ -22,20 +22,26 @@ package org.apache.hupa.server.utils;
<<<<<<< HEAD
import java.io.File;
import java.io.IOException;
+<<<<<<< HEAD
import java.io.InputStream;
import java.io.OutputStream;
+=======
+>>>>>>> constantly changed by manolo
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+<<<<<<< HEAD
=======
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
>>>>>>> first commit
+=======
+>>>>>>> constantly changed by manolo
import javax.activation.DataHandler;
import javax.activation.DataSource;
@@ -88,10 +94,14 @@ public class MessageUtils {
Address[] array = new Address[recipients.size()];
for (int i = 0; i < recipients.size(); i++) {
<<<<<<< HEAD
+<<<<<<< HEAD
array[i] = new InternetAddress(encodeEmail(recipients.get(i)));
=======
array[i] = new InternetAddress(recipients.get(i));
>>>>>>> first commit
+=======
+ array[i] = new InternetAddress(encodeEmail(recipients.get(i)));
+>>>>>>> constantly changed by manolo
}
return array;
}
@@ -301,5 +311,53 @@ public class MessageUtils {
}
=======
+<<<<<<< HEAD
>>>>>>> first commit
+=======
+ /**
+ * Decode iso-xxxx strings present in subjects and emails like:
+ *
+ * =?ISO-8859-1?Q?No=20hay=20ma=F1ana?= <[email protected]>
+ */
+ public static String decodeText(String s) {
+ String ret = s;
+ try {
+ ret = MimeUtility.decodeText(s);
+ } catch (UnsupportedEncodingException e) {
+ System.out.println(e.getMessage());
+ }
+ ret = ret
+ // Remove quotes around names in email addresses
+ .replaceFirst("^[<\"' ]+([^\"<>]*)[>\"' ]+<", "$1 <");
+ return ret;
+ }
+
+ /**
+ * Encode non ascii characters present in emails like:
+ *
+ * =?ISO-8859-1?Q?No=20hay=20ma=F1ana?= <[email protected]>
+ */
+ public static String encodeEmail(String s) {
+ if (s == null) {
+ return s;
+ }
+ Pattern p = Pattern.compile("^\\s*(.*?)\\s*(<[^>]+>)\\s*");
+ Matcher m = p.matcher(s);
+ return m.matches() ? encodeTexts(m.group(1)) + " " + m.group(2) : s;
+ }
+
+ /**
+ * Encode non ascii characters present in email headers
+ */
+ public static String encodeTexts(String s) {
+ String ret = s;
+ if (s != null) {
+ try {
+ ret = MimeUtility.encodeText(s, "ISO-8859-1", null);
+ } catch (UnsupportedEncodingException e) {
+ }
+ }
+ return ret;
+ }
+>>>>>>> constantly changed by manolo
}
\ No newline at end of file
Modified:
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/ContactsHandlerTest.java
URL:
http://svn.apache.org/viewvc/james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/ContactsHandlerTest.java?rev=1522108&r1=1522107&r2=1522108&view=diff
==============================================================================
---
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/ContactsHandlerTest.java
(original)
+++
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/ContactsHandlerTest.java
Thu Sep 12 02:03:24 2013
@@ -40,6 +40,7 @@ public class ContactsHandlerTest extends
userPreferences.addContact("<[email protected]>");
userPreferences.addContact("[email protected]");
userPreferences.addContact("\"[email protected]\" <[email protected]>");
+ userPreferences.addContact("<[email protected]> <[email protected]>");
Assert.assertEquals(2, getContacts().length);
}
Modified:
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/FetchMessagesHandlerTest.java
URL:
http://svn.apache.org/viewvc/james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/FetchMessagesHandlerTest.java?rev=1522108&r1=1522107&r2=1522108&view=diff
==============================================================================
---
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/FetchMessagesHandlerTest.java
(original)
+++
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/FetchMessagesHandlerTest.java
Thu Sep 12 02:03:24 2013
@@ -44,7 +44,7 @@ public class FetchMessagesHandlerTest ex
MimeMessage m1 = new MimeMessage(session, is);
is = new ByteArrayInputStream("From:
\"=?ISO-8859-1?Q?Manolo_Pe=F1a?=\" <[email protected]>\nTo: [email protected]\nSubject:
something\n\ndata".getBytes());
MimeMessage m2 = new MimeMessage(session, is);
- is = new ByteArrayInputStream("From: [email protected]\nTo:
[email protected]\nSubject: =?ISO-8859-1?Q?Monta=F1a?=\n\ndata".getBytes());
+ is = new ByteArrayInputStream("From: [email protected]\nTo:
\"<[email protected]>\" <[email protected]>\nSubject:
=?ISO-8859-1?Q?Monta=F1a?=\n\ndata".getBytes());
MimeMessage m3 = new MimeMessage(session, is);
ArrayList<org.apache.hupa.shared.data.Message> msgs =
fetchMessagesHandler.convert(2, f, new Message[]{m1, m2, m3});
@@ -61,6 +61,8 @@ public class FetchMessagesHandlerTest ex
msgs = fetchMessagesHandler.convert(10, f, new Message[]{m3});
assertEquals("Monta\u00F1a", msgs.get(0).getSubject());
+ assertEquals("[email protected] <[email protected]>",
msgs.get(0).getTo().get(0));
+
}
public void testFetchMessages() throws Exception {
Modified:
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/utils/MessageUtilsTest.java
URL:
http://svn.apache.org/viewvc/james/hupa/trunk/server/src/test/java/org/apache/hupa/server/utils/MessageUtilsTest.java?rev=1522108&r1=1522107&r2=1522108&view=diff
==============================================================================
---
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/utils/MessageUtilsTest.java
(original)
+++
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/utils/MessageUtilsTest.java
Thu Sep 12 02:03:24 2013
@@ -39,6 +39,7 @@ import org.apache.hupa.server.HupaGuiceT
import java.util.List;
+import javax.mail.Address;
import javax.mail.BodyPart;
import javax.mail.Message;
@@ -78,8 +79,13 @@ public class MessageUtilsTest extends Hu
assertEquals(1, inlineImgs.size());
}
<<<<<<< HEAD
+<<<<<<< HEAD
@Test public void getRecipients () throws Exception {
+=======
+
+ public void testGetRecipients () throws Exception {
+>>>>>>> constantly changed by manolo
String encodedEmail = "=?ISO-8859-1?Q?Manolo_Pe=F1a?=
<[email protected]>";
String decodedEmail = MessageUtils.decodeText(encodedEmail);
assertFalse(encodedEmail.equals(decodedEmail));
@@ -87,6 +93,9 @@ public class MessageUtilsTest extends Hu
Address[] addr = MessageUtils.getRecipients(encodedEmail,
decodedEmail);
assertEquals(addr[0].toString(), addr[1].toString());
}
+<<<<<<< HEAD
=======
>>>>>>> first commit
+=======
+>>>>>>> constantly changed by manolo
}
\ No newline at end of file
Modified:
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/ContactsResult.java
URL:
http://svn.apache.org/viewvc/james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/ContactsResult.java?rev=1522108&r1=1522107&r2=1522108&view=diff
==============================================================================
---
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/ContactsResult.java
(original)
+++
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/ContactsResult.java
Thu Sep 12 02:03:24 2013
@@ -148,12 +148,16 @@ public class ContactsResult implements R
}
public Contact(String address) {
- mail = address.replaceAll("^.*<([^>]+)>", "$1");
+ mail = address.replaceAll("^.*<([^>]+)>\\s*$", "$1");
realname = mail.equals(address) ? mail : address
- .replaceAll("<.+$", "")
- .replaceAll("^[\\s\"']+", "")
- .replaceAll("[\\s\"']+$", "");
+ // remove the email part
+ .replaceAll("<[^<>]+>\\s*$", "")
+ // remove start symbols in the name
+ .replaceAll("^[\\s\"'<]+", "")
+ // remove end symbols in the name
+ .replaceAll("[\\s\"'>]+$", "")
+ ;
if (realname.isEmpty())
realname = mail;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]