You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ma...@apache.org on 2010/01/15 19:34:00 UTC

svn commit: r899743 - in /james/hupa/trunk: client/src/main/java/org/apache/hupa/client/ client/src/main/java/org/apache/hupa/client/mvp/ client/src/main/java/org/apache/hupa/client/widgets/ client/war/ server/src/main/java/org/apache/hupa/server/ serv...

Author: manolo
Date: Fri Jan 15 18:33:41 2010
New Revision: 899743

URL: http://svn.apache.org/viewvc?rev=899743&view=rev
Log:
Added contacts support (basic version).
right now, the contacts are get from the messages and put in user session.
Suggestion box, only is able to select an email.
Contact list is not editable.

Added:
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/ContactsHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/SessionUtils.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/ContactsHandlerTest.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/Contacts.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/ContactsResult.java
Modified:
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaConstants_es.properties
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ContactsPresenter.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ContactsView.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenter.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendView.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/widgets/MessageHeaders.java
    james/hupa/trunk/client/war/Hupa.css
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/IMAPStoreCache.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/GuiceServerModule.java
    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/guice/GuiceTestModule.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/AbtractSendMessageHandlerTest.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/ReplyMessageHandlerTest.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/mock/MockIMAPStoreCache.java
    james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/RndPanel.java

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaConstants_es.properties
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaConstants_es.properties?rev=899743&r1=899742&r2=899743&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaConstants_es.properties (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaConstants_es.properties Fri Jan 15 18:33:41 2010
@@ -77,7 +77,7 @@
 none=Ninguno
 all=Todos
 newFolder=Nuevo
-renameFolder=Renombrar
+renameFolder=Editar
 deleteFolder=Borrar
 pageNext=Siguiente
 pageLast=Última

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ContactsPresenter.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ContactsPresenter.java?rev=899743&r1=899742&r2=899743&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ContactsPresenter.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ContactsPresenter.java Fri Jan 15 18:33:41 2010
@@ -20,31 +20,41 @@
 
 import com.google.inject.Inject;
 
+import net.customware.gwt.dispatch.client.DispatchAsync;
 import net.customware.gwt.presenter.client.EventBus;
 import net.customware.gwt.presenter.client.widget.WidgetDisplay;
 import net.customware.gwt.presenter.client.widget.WidgetPresenter;
 
+import org.apache.hupa.client.HupaCallback;
+import org.apache.hupa.shared.rpc.Contacts;
+import org.apache.hupa.shared.rpc.ContactsResult;
+import org.apache.hupa.shared.rpc.ContactsResult.Contact;
+
 public class ContactsPresenter extends WidgetPresenter<ContactsPresenter.Display>{
 
+    DispatchAsync dispatcher;
+    
     @Inject
-    public ContactsPresenter(Display display, EventBus eventBus) {
+    public ContactsPresenter(Display display, EventBus eventBus, DispatchAsync dispatcher) {
         super(display, eventBus);
+        this.dispatcher = dispatcher;
     }
 
     public interface Display extends NameAwareWidgetDisplay, WidgetDisplay {
-        
+        public void setContacts(Contact[] contacts);
     }
     
     @Override
     protected void onBind() {
-        // TODO Auto-generated method stub
-        
     }
 
     @Override
     protected void onRevealDisplay() {
-        // TODO Auto-generated method stub
-        
+        dispatcher.execute(new Contacts(),  new HupaCallback<ContactsResult>(dispatcher, eventBus) {
+            public void callback(ContactsResult result) {
+                display.setContacts(result.getContacts());
+            }
+        }); 
     }
 
     @Override

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ContactsView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ContactsView.java?rev=899743&r1=899742&r2=899743&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ContactsView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ContactsView.java Fri Jan 15 18:33:41 2010
@@ -19,24 +19,30 @@
 
 package org.apache.hupa.client.mvp;
 
-import org.apache.hupa.client.HupaCSS;
-import org.apache.hupa.client.HupaConstants;
-
+import com.google.gwt.gen2.table.override.client.FlexTable;
 import com.google.gwt.user.client.ui.Composite;
 import com.google.gwt.user.client.ui.HTML;
-import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
 import com.google.gwt.user.client.ui.Widget;
 import com.google.inject.Inject;
 
+import org.apache.hupa.client.HupaCSS;
+import org.apache.hupa.client.HupaConstants;
+import org.apache.hupa.shared.rpc.ContactsResult.Contact;
+
 public class ContactsView extends Composite implements ContactsPresenter.Display{
 
-    private HorizontalPanel panel = new HorizontalPanel();
+    private VerticalPanel panel = new VerticalPanel();
+    FlexTable ctable = new FlexTable();
+    
     private HupaConstants constants;
+    
     @Inject
     public ContactsView(HupaConstants constants) {
         this.constants = constants;
         panel.addStyleName(HupaCSS.C_contacts_container);
-        panel.add(new HTML("<center><h1>Contacts view: comming soon<h1></center>"));
+        panel.add(new HTML("<h1>Contacts view: comming soon<h1>"));
+        panel.add(ctable);
         initWidget(panel);
     }
     
@@ -56,4 +62,12 @@
         return this;
     }
 
+    public void setContacts(Contact[] contacts) {
+        ctable.clearAll();
+        for(int i=0; i<contacts.length; i++) {
+            ctable.setText(i, 0, contacts[i].realname);
+            ctable.setText(i, 1, contacts[i].mail);
+        }
+    }
+
 }

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenter.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenter.java?rev=899743&r1=899742&r2=899743&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenter.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenter.java Fri Jan 15 18:33:41 2010
@@ -60,10 +60,13 @@
 import org.apache.hupa.shared.events.LoadMessagesEvent;
 import org.apache.hupa.shared.events.LoadMessagesEventHandler;
 import org.apache.hupa.shared.events.SentMessageEvent;
+import org.apache.hupa.shared.rpc.Contacts;
+import org.apache.hupa.shared.rpc.ContactsResult;
 import org.apache.hupa.shared.rpc.ForwardMessage;
 import org.apache.hupa.shared.rpc.GenericResult;
 import org.apache.hupa.shared.rpc.ReplyMessage;
 import org.apache.hupa.shared.rpc.SendMessage;
+import org.apache.hupa.shared.rpc.ContactsResult.Contact;
 import org.apache.hupa.widgets.ui.HasEnable;
 
 import java.util.ArrayList;
@@ -176,6 +179,8 @@
         public void refresh();
 
         public void setLoading(boolean loading);
+        
+        public void fillContactList(Contact[] contacts);
     }
 
     @Override
@@ -344,6 +349,12 @@
         this.folder = folder;
         this.type = type;
         
+        dispatcher.execute(new Contacts(),  new HupaCallback<ContactsResult>(dispatcher, eventBus) {
+            public void callback(ContactsResult result) {
+                display.fillContactList(result.getContacts());
+            }
+        }); 
+        
         display.getFromText().setText(user.getName());
 
         if (type.equals(Type.FORWARD)) {
@@ -352,7 +363,6 @@
         } else if (type.equals(Type.REPLY) || type.equals(Type.REPLY_ALL)) {
             if (!oldmessage.getSubject().toLowerCase().startsWith("re:"))
                 display.getSubjectText().setText("Re: " + oldmessage.getSubject());
-
             if (oldmessage.getReplyto() != null) {
                 display.getToText().setText(oldmessage.getReplyto());
             } else if (type.equals(Type.REPLY)) {
@@ -377,6 +387,7 @@
         revealDisplay();
         
         display.getEditorFocus().setFocus(true);
+        
     }
 
     public void revealDisplay(User user, IMAPFolder folder, Message oldmessage, MessageDetails oldDetails, Type type) {

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendView.java?rev=899743&r1=899742&r2=899743&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendView.java Fri Jan 15 18:33:41 2010
@@ -19,6 +19,20 @@
 
 package org.apache.hupa.client.mvp;
 
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.Focusable;
+import com.google.gwt.user.client.ui.HasHTML;
+import com.google.gwt.user.client.ui.HasText;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.MultiWordSuggestOracle;
+import com.google.gwt.user.client.ui.SuggestBox;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.inject.Inject;
+
 import gwtupload.client.BaseUploadStatus;
 import gwtupload.client.IUploadStatus;
 import gwtupload.client.IUploader;
@@ -30,23 +44,12 @@
 import org.apache.hupa.client.widgets.EnableButton;
 import org.apache.hupa.client.widgets.MessageHeaders;
 import org.apache.hupa.shared.SConsts;
+import org.apache.hupa.shared.rpc.ContactsResult.Contact;
 import org.apache.hupa.widgets.editor.Editor;
 import org.apache.hupa.widgets.ui.EnableHyperlink;
 import org.apache.hupa.widgets.ui.HasEnable;
 import org.apache.hupa.widgets.ui.Loading;
 
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.event.dom.client.HasClickHandlers;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.Focusable;
-import com.google.gwt.user.client.ui.HasHTML;
-import com.google.gwt.user.client.ui.HasText;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.TextBox;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.inject.Inject;
-
 /**
  * View which displays a form which handle sending of mails
  * 
@@ -60,18 +63,19 @@
     
     private Editor editor;
     private CommandsBar buttonsBar = new CommandsBar();
+
+    private MultiWordSuggestOracle oracle = new MultiWordSuggestOracle(" ,@<>");
     
     private Label from = new Label();
-    private TextBox to = new TextBox();
-    private TextBox cc = new TextBox();
-    private TextBox bcc = new TextBox();
+    private SuggestBox to = new SuggestBox(oracle);
+    private SuggestBox cc = new SuggestBox(oracle);
+    private SuggestBox bcc = new SuggestBox(oracle);
     private TextBox subject = new TextBox();
     private MultiUploader uploader = null;
     
     private EnableButton sendButton;
     private EnableHyperlink backButton;
     private Loading loading;
-    
 
     @Inject
     public MessageSendView(HupaConstants constants) {
@@ -232,5 +236,12 @@
     public void refresh() {
         headers.setValues(from, to, cc, bcc, subject, uploader);
     }
+    
+    public void fillContactList(Contact[] contacts){
+        oracle.clear();
+        for (Contact c: contacts) {
+            oracle.add(c.toString());
+        }
+    }
 
 }

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/widgets/MessageHeaders.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/widgets/MessageHeaders.java?rev=899743&r1=899742&r2=899743&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/widgets/MessageHeaders.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/widgets/MessageHeaders.java Fri Jan 15 18:33:41 2010
@@ -7,6 +7,7 @@
 import com.google.gwt.user.client.ui.Composite;
 import com.google.gwt.user.client.ui.HasText;
 import com.google.gwt.user.client.ui.Panel;
+import com.google.gwt.user.client.ui.SuggestBox;
 import com.google.gwt.user.client.ui.TextBox;
 import com.google.gwt.user.client.ui.Widget;
 
@@ -49,7 +50,7 @@
         if (widget == null)
             return;
         
-        if (widget instanceof TextBox){
+        if (widget instanceof TextBox || widget instanceof SuggestBox){
             widget.setWidth("100%");
         } else if (widget instanceof HasText) {
             if (((HasText)widget).getText().isEmpty())

Modified: james/hupa/trunk/client/war/Hupa.css
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/war/Hupa.css?rev=899743&r1=899742&r2=899743&view=diff
==============================================================================
--- james/hupa/trunk/client/war/Hupa.css (original)
+++ james/hupa/trunk/client/war/Hupa.css Fri Jan 15 18:33:41 2010
@@ -208,10 +208,11 @@
 	width: 150px;
 }
 
-.gwt-ListBox, .gwt-SuggestBox {
+input[type=text], input[type=file] {
     background-color:  #d8ecfd;
     border: 1px solid #7FAAFF;
 }
+
 .dragdrop-dragable{
 	background: red;
 	}
@@ -266,6 +267,12 @@
 	width: 100%;
 }
 
+/************[ view: ContactsView ]*******************/
+table.hupa-contacts {
+	margin-left: auto;
+	margin-right: auto;
+}
+
 
 /************************************************************************/
 /*** Non re-factored stuff ***/

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/IMAPStoreCache.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/IMAPStoreCache.java?rev=899743&r1=899742&r2=899743&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/IMAPStoreCache.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/IMAPStoreCache.java Fri Jan 15 18:33:41 2010
@@ -19,15 +19,15 @@
 
 package org.apache.hupa.server;
 
-import javax.mail.MessagingException;
+import com.sun.mail.imap.IMAPStore;
 
 import org.apache.hupa.shared.data.User;
 
-import com.sun.mail.imap.IMAPStore;
+import javax.mail.MessagingException;
 
 public interface IMAPStoreCache {
-    public IMAPStore get(User user) throws MessagingException;
-    public IMAPStore get(String username,String password) throws MessagingException;
-    public void delete(User user);
     public void delete(String username);
+    public void delete(User user);
+    public IMAPStore get(String username,String password) throws MessagingException;
+    public IMAPStore get(User user) throws MessagingException;
 }

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java?rev=899743&r1=899742&r2=899743&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java Fri Jan 15 18:33:41 2010
@@ -19,31 +19,32 @@
 
 package org.apache.hupa.server;
 
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+import com.google.inject.name.Named;
 
-import javax.mail.MessagingException;
-import javax.mail.NoSuchProviderException;
-import javax.mail.Session;
+import com.sun.mail.imap.IMAPStore;
 
 import org.apache.commons.logging.Log;
 import org.apache.hupa.server.guice.DemoModeConstants;
 import org.apache.hupa.server.mock.MockIMAPStore;
 import org.apache.hupa.shared.data.User;
 
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import com.google.inject.Singleton;
-import com.google.inject.name.Named;
-import com.sun.mail.imap.IMAPStore;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.mail.MessagingException;
+import javax.mail.NoSuchProviderException;
+import javax.mail.Session;
 
 @Singleton
 public class InMemoryIMAPStoreCache implements IMAPStoreCache{
 
     private Session session;
     protected Log logger;
-    private final Map<String,CachedIMAPStore> pool = new HashMap<String ,CachedIMAPStore>();
+    private final Map<String, CachedIMAPStore> pool = new HashMap<String ,CachedIMAPStore>();
     private String address;
     private int port;
     private boolean useSSL = false;
@@ -72,11 +73,9 @@
 
         }
         System.setProperty("mail.mime.decodetext.strict", "false");
-        
       
     }
     
-
     /*
      * (non-Javadoc)
      * @see org.apache.hupa.server.IMAPStoreCache#get(org.apache.hupa.shared.data.User)
@@ -187,4 +186,5 @@
             return store;
         }
     }
+
 }

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/GuiceServerModule.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/GuiceServerModule.java?rev=899743&r1=899742&r2=899743&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/GuiceServerModule.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/GuiceServerModule.java Fri Jan 15 18:33:41 2010
@@ -31,6 +31,7 @@
 import org.apache.hupa.server.IMAPStoreCache;
 import org.apache.hupa.server.InMemoryIMAPStoreCache;
 import org.apache.hupa.server.handler.CheckSessionHandler;
+import org.apache.hupa.server.handler.ContactsHandler;
 import org.apache.hupa.server.handler.CreateFolderHandler;
 import org.apache.hupa.server.handler.DeleteAllMessagesHandler;
 import org.apache.hupa.server.handler.DeleteFolderHandler;
@@ -100,6 +101,7 @@
         bindHandler(CreateFolderHandler.class);
         bindHandler(TagMessagesHandler.class);
         bindHandler(SetFlagsHandler.class);
+        bindHandler(ContactsHandler.class);
         bind(IMAPStoreCache.class).to(InMemoryIMAPStoreCache.class).in(
                 Singleton.class);
         bind(Log.class).toProvider(LogProvider.class).in(Singleton.class);

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=899743&r1=899742&r2=899743&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 Fri Jan 15 18:33:41 2010
@@ -38,6 +38,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.hupa.server.IMAPStoreCache;
+import org.apache.hupa.server.utils.SessionUtils;
 import org.apache.hupa.shared.data.IMAPFolder;
 import org.apache.hupa.shared.data.Tag;
 import org.apache.hupa.shared.data.User;
@@ -124,6 +125,7 @@
                 from = m.getFrom()[0].toString().trim();
                 try {
                     from = MimeUtility.decodeText(from);
+                    SessionUtils.addContact(sessionProvider.get(), from);
                 } catch (UnsupportedEncodingException e) {
                     logger.debug("Unable to decode from " + from + " " + e.getMessage());
                 }
@@ -135,6 +137,7 @@
                 replyto = m.getReplyTo()[0].toString().trim();
                 try {
                     replyto = MimeUtility.decodeText(replyto);
+                    SessionUtils.addContact(sessionProvider.get(), replyto);
                 } catch (UnsupportedEncodingException e) {
                     logger.debug("Unable to decode replyto " + replyto + " " + e.getMessage());
                 }
@@ -146,7 +149,15 @@
             Address[] toArray = m.getRecipients(RecipientType.TO);
             if (toArray != null) {
                 for (int b =0; b < toArray.length;b++) {
-                    to.add(toArray[b].toString());
+                    String mailTo = null;
+                    try {
+                        mailTo = MimeUtility.decodeText(toArray[b].toString());
+                        SessionUtils.addContact(sessionProvider.get(), mailTo);
+                    } catch (UnsupportedEncodingException e) {
+                        logger.debug("Unable to decode mailTo " + mailTo + " " + e.getMessage());
+                    }
+                    if (mailTo != null)
+                        to.add(mailTo);
                 }
             }
             msg.setTo(to);

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=899743&r1=899742&r2=899743&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 Fri Jan 15 18:33:41 2010
@@ -57,6 +57,7 @@
 import org.apache.hupa.server.mock.MockSMTPTransport;
 import org.apache.hupa.server.utils.MessageUtils;
 import org.apache.hupa.server.utils.RegexPatterns;
+import org.apache.hupa.server.utils.SessionUtils;
 import org.apache.hupa.shared.data.MessageAttachment;
 import org.apache.hupa.shared.data.SMTPMessage;
 import org.apache.hupa.shared.data.User;
@@ -195,7 +196,7 @@
      */
     @SuppressWarnings("unchecked")
     protected List getAttachments(A action) throws MessagingException, ActionException {
-        FileItemRegistry registry = MessageUtils.getSessionRegistry(logger, httpSessionProvider.get());
+        FileItemRegistry registry = SessionUtils.getSessionRegistry(logger, httpSessionProvider.get());
         List<MessageAttachment> attachments = action.getMessage().getMessageAttachments();
         
         ArrayList<FileItem> items = new ArrayList<FileItem>();
@@ -220,7 +221,7 @@
         ArrayList<MessageAttachment> attachments = msg.getMessageAttachments();
         if (attachments != null && ! attachments.isEmpty()) {
             for(MessageAttachment attach : attachments) 
-                MessageUtils.getSessionRegistry(logger, httpSessionProvider.get()).remove(attach.getName());
+                SessionUtils.getSessionRegistry(logger, httpSessionProvider.get()).remove(attach.getName());
         }
     }
     

Added: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/ContactsHandler.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/ContactsHandler.java?rev=899743&view=auto
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/ContactsHandler.java (added)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/ContactsHandler.java Fri Jan 15 18:33:41 2010
@@ -0,0 +1,62 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.hupa.server.handler;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+import net.customware.gwt.dispatch.server.ActionHandler;
+import net.customware.gwt.dispatch.server.ExecutionContext;
+import net.customware.gwt.dispatch.shared.ActionException;
+
+import org.apache.commons.logging.Log;
+import org.apache.hupa.server.IMAPStoreCache;
+import org.apache.hupa.server.utils.SessionUtils;
+import org.apache.hupa.shared.data.Settings;
+import org.apache.hupa.shared.rpc.Contacts;
+import org.apache.hupa.shared.rpc.ContactsResult;
+
+import javax.servlet.http.HttpSession;
+
+/**
+ * Handler for getting the list of contacts
+ */
+public class ContactsHandler implements
+        ActionHandler<Contacts, ContactsResult> {
+
+    private final Provider<HttpSession> sessionProvider;
+
+    @Inject
+    public ContactsHandler(IMAPStoreCache cache, Log logger, Provider<HttpSession> sessionProvider, Provider<Settings> settingsProvider) {
+        this.sessionProvider = sessionProvider;
+    }
+
+    public ContactsResult execute(Contacts action, ExecutionContext context) throws ActionException {
+        return new ContactsResult(SessionUtils.getContacts(sessionProvider.get()));
+    }
+
+    public Class<Contacts> getActionType() {
+        return Contacts.class;
+    }
+
+    public void rollback(Contacts action, ContactsResult result, ExecutionContext context) throws ActionException {
+    }
+
+}

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=899743&r1=899742&r2=899743&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 Fri Jan 15 18:33:41 2010
@@ -35,11 +35,9 @@
 import javax.mail.internet.InternetAddress;
 import javax.mail.internet.MimeBodyPart;
 import javax.mail.internet.MimeUtility;
-import javax.servlet.http.HttpSession;
 
 import org.apache.commons.fileupload.FileItem;
 import org.apache.commons.logging.Log;
-import org.apache.hupa.server.FileItemRegistry;
 import org.apache.hupa.server.handler.AbstractSendMessageHandler;
 
 
@@ -118,15 +116,6 @@
         return ret;
     }
 
-    public static FileItemRegistry getSessionRegistry(Log logger, HttpSession session) {
-        FileItemRegistry registry = (FileItemRegistry)session.getAttribute("registry");
-        if (registry == null) {
-            registry = new FileItemRegistry(logger);
-            session.setAttribute("registry", registry);
-        }
-        return registry;
-    }
-
     /**
      * Loop over MuliPart and write the content to the Outputstream if a
      * attachment with the given name was found.

Added: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/SessionUtils.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/SessionUtils.java?rev=899743&view=auto
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/SessionUtils.java (added)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/SessionUtils.java Fri Jan 15 18:33:41 2010
@@ -0,0 +1,69 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.hupa.server.utils;
+
+
+import org.apache.commons.logging.Log;
+import org.apache.hupa.server.FileItemRegistry;
+import org.apache.hupa.shared.rpc.ContactsResult.Contact;
+
+import java.util.HashMap;
+
+import javax.servlet.http.HttpSession;
+
+/**
+ * Utility methods for manage user's session objects
+ */
+public class SessionUtils {
+
+    public static FileItemRegistry getSessionRegistry(Log logger, HttpSession session) {
+        FileItemRegistry registry = (FileItemRegistry)session.getAttribute("registry");
+        if (registry == null) {
+            registry = new FileItemRegistry(logger);
+            session.setAttribute("registry", registry);
+        }
+        return registry;
+    }
+   
+    public static void addContact(HttpSession session, String mail) {
+        String name = !mail.contains("<") ? "" : mail.replaceAll("<.+$", "")
+                                                 .replaceAll("^[\\s\"']+","")
+                                                 .replaceAll("[\\s\"']+$", "");
+        String email = mail.replaceAll("^.*<([^>]+)>","$1");
+        Contact contact = new Contact(name, email);
+        
+        @SuppressWarnings("unchecked")
+        HashMap<String, Contact> sessionContacts = (HashMap<String, Contact>)session.getAttribute("contacts");
+        if (sessionContacts==null)
+            sessionContacts=new HashMap<String, Contact>();
+        
+        if (!sessionContacts.containsKey(contact.toString())) {
+            sessionContacts.put(contact.toString(), contact);
+            session.setAttribute("contacts", sessionContacts);
+        }
+    }
+
+    public static Contact[] getContacts(HttpSession session) {
+        @SuppressWarnings("unchecked")
+        HashMap<String, Contact> sessionContacts = (HashMap<String, Contact>)session.getAttribute("contacts");
+        return sessionContacts == null ? new Contact[]{} : sessionContacts.values().toArray(new Contact[sessionContacts.size()]);
+    }
+    
+}
\ No newline at end of file

Modified: james/hupa/trunk/server/src/test/java/org/apache/hupa/server/guice/GuiceTestModule.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/test/java/org/apache/hupa/server/guice/GuiceTestModule.java?rev=899743&r1=899742&r2=899743&view=diff
==============================================================================
--- james/hupa/trunk/server/src/test/java/org/apache/hupa/server/guice/GuiceTestModule.java (original)
+++ james/hupa/trunk/server/src/test/java/org/apache/hupa/server/guice/GuiceTestModule.java Fri Jan 15 18:33:41 2010
@@ -19,12 +19,20 @@
 
 package org.apache.hupa.server.guice;
 
-import javax.mail.Session;
-import javax.servlet.http.HttpSession;
+import com.google.inject.AbstractModule;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Singleton;
+import com.google.inject.name.Names;
+
+import com.sun.mail.imap.IMAPStore;
 
 import org.apache.commons.logging.Log;
 import org.apache.hupa.server.IMAPStoreCache;
 import org.apache.hupa.server.handler.AbstractSendMessageHandler;
+import org.apache.hupa.server.handler.ContactsHandler;
+import org.apache.hupa.server.handler.FetchFoldersHandler;
+import org.apache.hupa.server.handler.FetchMessagesHandler;
 import org.apache.hupa.server.handler.ForwardMessageHandler;
 import org.apache.hupa.server.handler.GetMessageDetailsHandler;
 import org.apache.hupa.server.handler.ReplyMessageHandler;
@@ -34,12 +42,8 @@
 import org.apache.hupa.server.mock.MockIMAPStoreCache;
 import org.apache.hupa.server.mock.MockLogProvider;
 
-import com.google.inject.AbstractModule;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import com.google.inject.Singleton;
-import com.google.inject.name.Names;
-import com.sun.mail.imap.IMAPStore;
+import javax.mail.Session;
+import javax.servlet.http.HttpSession;
 
 public class GuiceTestModule extends AbstractModule {
 
@@ -62,6 +66,9 @@
         bind(SendMessageHandler.class);
         bind(ReplyMessageHandler.class);
         bind(ForwardMessageHandler.class);
+        bind(FetchFoldersHandler.class);
+        bind(FetchMessagesHandler.class);
+        bind(ContactsHandler.class);
 
     }
 

Modified: james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/AbtractSendMessageHandlerTest.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/AbtractSendMessageHandlerTest.java?rev=899743&r1=899742&r2=899743&view=diff
==============================================================================
--- james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/AbtractSendMessageHandlerTest.java (original)
+++ james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/AbtractSendMessageHandlerTest.java Fri Jan 15 18:33:41 2010
@@ -30,6 +30,7 @@
 import org.apache.hupa.server.mock.MockIMAPFolder;
 import org.apache.hupa.server.mock.MockIMAPStoreCache;
 import org.apache.hupa.server.utils.MessageUtils;
+import org.apache.hupa.server.utils.SessionUtils;
 import org.apache.hupa.server.utils.TestUtils;
 import org.apache.hupa.shared.data.SMTPMessage;
 import org.apache.hupa.shared.data.User;
@@ -112,7 +113,7 @@
         
         MockIMAPFolder sentbox = (MockIMAPFolder) store.getFolder(DemoModeConstants.DEMO_MODE_SENT_FOLDER);
         
-        SMTPMessage smtpmsg = TestUtils.createMockSMTPMessage(MessageUtils.getSessionRegistry(logger, httpSession), 2);
+        SMTPMessage smtpmsg = TestUtils.createMockSMTPMessage(SessionUtils.getSessionRegistry(logger, httpSession), 2);
         SendMessage action = new SendMessage(smtpmsg);
         
         Message message = abstSendMsgHndl.createMessage(session, action);
@@ -151,7 +152,7 @@
         
         MockIMAPFolder sentbox = (MockIMAPFolder) store.getFolder(DemoModeConstants.DEMO_MODE_SENT_FOLDER);
         
-        SMTPMessage smtpmsg = TestUtils.createMockSMTPMessage(MessageUtils.getSessionRegistry(logger, httpSession), 2);
+        SMTPMessage smtpmsg = TestUtils.createMockSMTPMessage(SessionUtils.getSessionRegistry(logger, httpSession), 2);
         SendMessage action = new SendMessage(smtpmsg);
         
         assertTrue(sentbox.getMessages().length == 0);

Added: 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=899743&view=auto
==============================================================================
--- james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/ContactsHandlerTest.java (added)
+++ james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/ContactsHandlerTest.java Fri Jan 15 18:33:41 2010
@@ -0,0 +1,54 @@
+package org.apache.hupa.server.handler;
+
+import com.sun.mail.imap.IMAPStore;
+
+import org.apache.hupa.server.HupaTestCase;
+import org.apache.hupa.server.IMAPStoreCache;
+import org.apache.hupa.server.guice.DemoModeConstants;
+import org.apache.hupa.server.mock.MockIMAPStoreCache;
+import org.apache.hupa.server.utils.SessionUtils;
+import org.apache.hupa.shared.data.IMAPFolder;
+import org.apache.hupa.shared.data.User;
+import org.apache.hupa.shared.rpc.FetchFolders;
+import org.apache.hupa.shared.rpc.FetchMessages;
+import org.apache.hupa.shared.rpc.FetchMessagesResult;
+
+import javax.servlet.http.HttpSession;
+
+
+public class ContactsHandlerTest extends HupaTestCase {
+
+    public void testPutContactsInSession() throws Exception {
+        
+        HttpSession httpSession = injector.getInstance(HttpSession.class);
+        
+        SessionUtils.addContact(httpSession, " ' \"Somebody\" <me...@domain.com>");
+        assertEquals("Somebody",SessionUtils.getContacts(httpSession)[0].realname);
+        assertEquals("me@domain.com",SessionUtils.getContacts(httpSession)[0].mail);
+        
+    }
+
+    public void testFetchMessagesFillsContactsList() throws Exception {
+        
+        User demouser = DemoModeConstants.demoUser;
+
+        HttpSession httpSession = injector.getInstance(HttpSession.class);
+        httpSession.setAttribute("user", demouser);
+
+        IMAPStoreCache storeCache = injector.getInstance(IMAPStoreCache.class);
+        IMAPStore store = injector.getInstance(IMAPStore.class);
+        ((MockIMAPStoreCache)storeCache).addValidUser(demouser, store);
+
+        FetchFoldersHandler fetchFoldersHandler = injector.getInstance(FetchFoldersHandler.class); 
+        fetchFoldersHandler.execute(new FetchFolders(), null);
+        
+        IMAPFolder folder = new IMAPFolder(demouser.getSettings().getInboxFolderName());
+        FetchMessagesHandler fetchMessagesHandler = injector.getInstance(FetchMessagesHandler.class); 
+        FetchMessagesResult result = fetchMessagesHandler.execute(new FetchMessages(folder, 0, 10, null), null);
+        
+        assertTrue(result.getRealCount()>1);
+        assertTrue(SessionUtils.getContacts(httpSession).length>1);
+        
+    }
+    
+}

Modified: james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/ReplyMessageHandlerTest.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/ReplyMessageHandlerTest.java?rev=899743&r1=899742&r2=899743&view=diff
==============================================================================
--- james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/ReplyMessageHandlerTest.java (original)
+++ james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/ReplyMessageHandlerTest.java Fri Jan 15 18:33:41 2010
@@ -29,7 +29,7 @@
 import org.apache.hupa.server.guice.DemoModeConstants;
 import org.apache.hupa.server.mock.MockIMAPFolder;
 import org.apache.hupa.server.mock.MockIMAPStoreCache;
-import org.apache.hupa.server.utils.MessageUtils;
+import org.apache.hupa.server.utils.SessionUtils;
 import org.apache.hupa.server.utils.TestUtils;
 import org.apache.hupa.shared.data.IMAPFolder;
 import org.apache.hupa.shared.data.SMTPMessage;
@@ -50,7 +50,7 @@
         IMAPStore store = injector.getInstance(IMAPStore.class);
         ((MockIMAPStoreCache)storeCache).addValidUser(demouser, store);
 
-        FileItemRegistry registry = MessageUtils.getSessionRegistry(logger, httpSession);
+        FileItemRegistry registry = SessionUtils.getSessionRegistry(logger, httpSession);
         
         
         MockIMAPFolder sentbox = (MockIMAPFolder) store.getFolder(DemoModeConstants.DEMO_MODE_SENT_FOLDER);

Modified: james/hupa/trunk/server/src/test/java/org/apache/hupa/server/mock/MockIMAPStoreCache.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/test/java/org/apache/hupa/server/mock/MockIMAPStoreCache.java?rev=899743&r1=899742&r2=899743&view=diff
==============================================================================
--- james/hupa/trunk/server/src/test/java/org/apache/hupa/server/mock/MockIMAPStoreCache.java (original)
+++ james/hupa/trunk/server/src/test/java/org/apache/hupa/server/mock/MockIMAPStoreCache.java Fri Jan 15 18:33:41 2010
@@ -19,6 +19,14 @@
 
 package org.apache.hupa.server.mock;
 
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+import com.sun.mail.imap.IMAPStore;
+
+import org.apache.hupa.server.IMAPStoreCache;
+import org.apache.hupa.shared.data.User;
+
 import java.util.HashMap;
 import java.util.Map;
 
@@ -26,13 +34,6 @@
 import javax.mail.NoSuchProviderException;
 import javax.mail.Session;
 
-import org.apache.hupa.server.IMAPStoreCache;
-import org.apache.hupa.shared.data.User;
-
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import com.sun.mail.imap.IMAPStore;
-
 public class MockIMAPStoreCache implements IMAPStoreCache {
     private Provider<Session> provider;
     private Map<String, String> users = new HashMap<String, String>();
@@ -88,4 +89,5 @@
             throw new MessagingException("Invalid user");
         }
     }
+
 }

Added: james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/Contacts.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/Contacts.java?rev=899743&view=auto
==============================================================================
--- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/Contacts.java (added)
+++ james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/Contacts.java Fri Jan 15 18:33:41 2010
@@ -0,0 +1,26 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.hupa.shared.rpc;
+
+import net.customware.gwt.dispatch.shared.Action;
+
+public class Contacts implements Action<ContactsResult>{
+    private static final long serialVersionUID = 1l;
+}

Added: 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=899743&view=auto
==============================================================================
--- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/ContactsResult.java (added)
+++ james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/ContactsResult.java Fri Jan 15 18:33:41 2010
@@ -0,0 +1,62 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.hupa.shared.rpc;
+
+import net.customware.gwt.dispatch.shared.Result;
+
+public class ContactsResult implements Result {
+
+    public static class Contact implements Result {
+        private static final long serialVersionUID = -8632580327693416473L;
+        public String mail;
+        public String realname;
+
+        public Contact() {
+        }
+
+        public Contact(String realname, String mail) {
+            this.realname = realname;
+            this.mail = mail;
+        }
+
+        public String toString() {
+            return (realname != null ? realname : "") + "<" + mail + ">";
+        }
+    }
+
+    private static final long serialVersionUID = -8740775403377441876L;
+    private Contact[] contacts;
+
+    public ContactsResult() {
+    }
+
+    public ContactsResult(Contact... contacts) {
+        this.contacts = contacts;
+    }
+
+    public Contact[] getContacts() {
+        return contacts;
+    }
+
+    public void setContacts(Contact[] contacts) {
+        this.contacts = contacts;
+    }
+
+}

Modified: james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/RndPanel.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/RndPanel.java?rev=899743&r1=899742&r2=899743&view=diff
==============================================================================
--- james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/RndPanel.java (original)
+++ james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/RndPanel.java Fri Jan 15 18:33:41 2010
@@ -19,14 +19,14 @@
 
 package org.apache.hupa.widgets.ui;
 
-import org.apache.hupa.widgets.ui.impl.RndPanelGenerator;
-import org.apache.hupa.widgets.ui.impl.RndPanelGeneratorImpl;
-
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.user.client.ui.Composite;
 import com.google.gwt.user.client.ui.FlowPanel;
 import com.google.gwt.user.client.ui.Widget;
 
+import org.apache.hupa.widgets.ui.impl.RndPanelGenerator;
+import org.apache.hupa.widgets.ui.impl.RndPanelGeneratorImpl;
+
 /**
  * Widget which renders a rounded panel.
  * 



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org