Author: norman
Date: Tue Jul 7 10:06:05 2009
New Revision: 791778
URL: http://svn.apache.org/viewvc?rev=791778&view=rev
Log:
fill missing Actions
Added:
labs/hupa/src/main/java/org/apache/hupa/client/rpc/ExposeMessage.java
labs/hupa/src/main/java/org/apache/hupa/client/rpc/ExposeMessageResult.java
labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchMessages.java
labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchMessagesResult.java
labs/hupa/src/main/java/org/apache/hupa/server/AbstractIMAPActionHandler.java
- copied, changed from r791750,
labs/hupa/src/main/java/org/apache/hupa/server/AbstractIMAPHandler.java
labs/hupa/src/main/java/org/apache/hupa/server/ExposeMessageHandler.java
labs/hupa/src/main/java/org/apache/hupa/server/FetchMessagesHandler.java
Removed:
labs/hupa/src/main/java/org/apache/hupa/server/AbstractIMAPHandler.java
Modified:
labs/hupa/src/main/java/org/apache/hupa/client/gin/MyClientModule.java
labs/hupa/src/main/java/org/apache/hupa/client/gin/MyGinjector.java
labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchFolders.java
labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchFoldersResult.java
labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUser.java
labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUserResult.java
labs/hupa/src/main/java/org/apache/hupa/server/FetchFoldersHandler.java
labs/hupa/src/main/java/org/apache/hupa/server/LoginUserHandler.java
Modified: labs/hupa/src/main/java/org/apache/hupa/client/gin/MyClientModule.java
URL:
http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/gin/MyClientModule.java?rev=791778&r1=791777&r2=791778&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/gin/MyClientModule.java
(original)
+++ labs/hupa/src/main/java/org/apache/hupa/client/gin/MyClientModule.java Tue
Jul 7 10:06:05 2009
@@ -1,3 +1,22 @@
+/****************************************************************
+ * 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.client.gin;
import org.apache.hupa.client.LoginWidget;
Modified: labs/hupa/src/main/java/org/apache/hupa/client/gin/MyGinjector.java
URL:
http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/gin/MyGinjector.java?rev=791778&r1=791777&r2=791778&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/gin/MyGinjector.java
(original)
+++ labs/hupa/src/main/java/org/apache/hupa/client/gin/MyGinjector.java Tue Jul
7 10:06:05 2009
@@ -1,3 +1,21 @@
+/****************************************************************
+ * 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.client.gin;
import net.customware.gwt.dispatch.client.gin.ClientDispatchModule;
Added: labs/hupa/src/main/java/org/apache/hupa/client/rpc/ExposeMessage.java
URL:
http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/rpc/ExposeMessage.java?rev=791778&view=auto
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/rpc/ExposeMessage.java
(added)
+++ labs/hupa/src/main/java/org/apache/hupa/client/rpc/ExposeMessage.java Tue
Jul 7 10:06:05 2009
@@ -0,0 +1,61 @@
+/****************************************************************
+ * 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.client.rpc;
+
+import org.apache.hupa.client.data.IMAPFolder;
+import org.apache.hupa.client.data.IMAPMessage;
+import org.apache.hupa.client.data.IMAPUser;
+
+import net.customware.gwt.dispatch.shared.Action;
+
+public class ExposeMessage implements Action<ExposeMessageResult>{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 5826298202494313834L;
+ private IMAPUser user;
+ private IMAPFolder folder;
+ private IMAPMessage message;
+
+ @SuppressWarnings("unused")
+ private ExposeMessage() {
+
+ }
+
+ public ExposeMessage(IMAPUser user, IMAPFolder folder,IMAPMessage
message) {
+ this.user = user;
+ this.folder = folder;
+ this.message = message;
+ }
+
+ public IMAPUser getUser() {
+ return user;
+ }
+
+ public IMAPFolder getFolder() {
+ return folder;
+ }
+
+ public IMAPMessage getMessage() {
+ return message;
+ }
+}
Added:
labs/hupa/src/main/java/org/apache/hupa/client/rpc/ExposeMessageResult.java
URL:
http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/rpc/ExposeMessageResult.java?rev=791778&view=auto
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/rpc/ExposeMessageResult.java
(added)
+++ labs/hupa/src/main/java/org/apache/hupa/client/rpc/ExposeMessageResult.java
Tue Jul 7 10:06:05 2009
@@ -0,0 +1,47 @@
+/****************************************************************
+ * 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.client.rpc;
+
+import org.apache.hupa.client.data.IMAPMessage;
+
+import net.customware.gwt.dispatch.shared.Result;
+
+public class ExposeMessageResult implements Result{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 6738085246457556043L;
+ private IMAPMessage message;
+
+ @SuppressWarnings("unused")
+ private ExposeMessageResult() {
+
+ }
+
+ public ExposeMessageResult(IMAPMessage message) {
+ this.message = message;
+ }
+
+ public IMAPMessage getMessage() {
+ return message;
+ }
+
+}
Modified: labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchFolders.java
URL:
http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchFolders.java?rev=791778&r1=791777&r2=791778&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchFolders.java
(original)
+++ labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchFolders.java Tue
Jul 7 10:06:05 2009
@@ -1,3 +1,22 @@
+/****************************************************************
+ * 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.client.rpc;
import org.apache.hupa.client.data.IMAPUser;
Modified:
labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchFoldersResult.java
URL:
http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchFoldersResult.java?rev=791778&r1=791777&r2=791778&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchFoldersResult.java
(original)
+++ labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchFoldersResult.java
Tue Jul 7 10:06:05 2009
@@ -1,3 +1,22 @@
+/****************************************************************
+ * 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.client.rpc;
import java.util.ArrayList;
Added: labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchMessages.java
URL:
http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchMessages.java?rev=791778&view=auto
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchMessages.java
(added)
+++ labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchMessages.java Tue
Jul 7 10:06:05 2009
@@ -0,0 +1,53 @@
+package org.apache.hupa.client.rpc;
+
+import net.customware.gwt.dispatch.shared.Action;
+
+import org.apache.hupa.client.data.IMAPFolder;
+import org.apache.hupa.client.data.IMAPUser;
+
+public class FetchMessages implements Action<FetchMessagesResult>{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3181183289937321202L;
+ private IMAPUser user;
+ private IMAPFolder folder;
+ private int start;
+ private int offset;
+ private String searchString;
+
+ public FetchMessages(IMAPUser user, IMAPFolder folder,int start, int
offset,String searchString) {
+ this.user= user;
+ this.folder = folder;
+ this.start = start;
+ this.offset = offset;
+ this.searchString = searchString;
+ }
+
+ @SuppressWarnings("unused")
+ private FetchMessages() {
+
+ }
+
+ public IMAPUser getUser() {
+ return user;
+ }
+
+ public IMAPFolder getFolder() {
+ return folder;
+ }
+
+ public int getStart() {
+ return start;
+ }
+
+ public int getOffset() {
+ return offset;
+ }
+
+ public String getSearchString() {
+ return searchString;
+ }
+
+}
Added:
labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchMessagesResult.java
URL:
http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchMessagesResult.java?rev=791778&view=auto
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchMessagesResult.java
(added)
+++ labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchMessagesResult.java
Tue Jul 7 10:06:05 2009
@@ -0,0 +1,58 @@
+package org.apache.hupa.client.rpc;
+
+import java.util.ArrayList;
+
+import org.apache.hupa.client.data.IMAPMessage;
+/****************************************************************
+ * 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. *
+ ****************************************************************/
+
+import net.customware.gwt.dispatch.shared.Result;
+
+public class FetchMessagesResult implements Result{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 8692400285949934424L;
+ private ArrayList<IMAPMessage> messages;
+ private int start;
+ private int offset;
+
+ @SuppressWarnings("unused")
+ private FetchMessagesResult() {
+ }
+
+ public FetchMessagesResult(ArrayList<IMAPMessage> messages,int
start,int offset) {
+ this.messages = messages;
+ this.start = start;
+ this.offset = offset;
+ }
+
+ public ArrayList<IMAPMessage> getMessages() {
+ return messages;
+ }
+
+ public int getOffset() {
+ return offset;
+ }
+
+ public int getStart() {
+ return start;
+ }
+}
Modified: labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUser.java
URL:
http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUser.java?rev=791778&r1=791777&r2=791778&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUser.java (original)
+++ labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUser.java Tue Jul
7 10:06:05 2009
@@ -1,3 +1,22 @@
+/****************************************************************
+ * 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.client.rpc;
Modified:
labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUserResult.java
URL:
http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUserResult.java?rev=791778&r1=791777&r2=791778&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUserResult.java
(original)
+++ labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUserResult.java Tue
Jul 7 10:06:05 2009
@@ -1,3 +1,22 @@
+/****************************************************************
+ * 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.client.rpc;
import org.apache.hupa.client.data.IMAPUser;
Copied:
labs/hupa/src/main/java/org/apache/hupa/server/AbstractIMAPActionHandler.java
(from r791750,
labs/hupa/src/main/java/org/apache/hupa/server/AbstractIMAPHandler.java)
URL:
http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/AbstractIMAPActionHandler.java?p2=labs/hupa/src/main/java/org/apache/hupa/server/AbstractIMAPActionHandler.java&p1=labs/hupa/src/main/java/org/apache/hupa/server/AbstractIMAPHandler.java&r1=791750&r2=791778&rev=791778&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/server/AbstractIMAPHandler.java
(original)
+++
labs/hupa/src/main/java/org/apache/hupa/server/AbstractIMAPActionHandler.java
Tue Jul 7 10:06:05 2009
@@ -1,3 +1,22 @@
+/****************************************************************
+ * 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;
import java.io.IOException;
@@ -11,7 +30,7 @@
import net.customware.gwt.dispatch.shared.Result;
-public abstract class AbstractIMAPHandler<A extends Action<R>, R extends
Result> implements ActionHandler<A,R>{
+public abstract class AbstractIMAPActionHandler<A extends Action<R>, R extends
Result> implements ActionHandler<A,R>{
protected IMAPProtocol getProtocol(IMAPUser user) throws IOException,
IMAPException {
Added: labs/hupa/src/main/java/org/apache/hupa/server/ExposeMessageHandler.java
URL:
http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/ExposeMessageHandler.java?rev=791778&view=auto
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/server/ExposeMessageHandler.java
(added)
+++ labs/hupa/src/main/java/org/apache/hupa/server/ExposeMessageHandler.java
Tue Jul 7 10:06:05 2009
@@ -0,0 +1,166 @@
+/****************************************************************
+ * 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;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.Charset;
+import java.util.List;
+
+import net.customware.gwt.dispatch.server.ExecutionContext;
+import net.customware.gwt.dispatch.shared.ActionException;
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.hupa.client.data.IMAPFolder;
+import org.apache.hupa.client.data.IMAPMessage;
+import org.apache.hupa.client.data.IMAPMessageContent;
+import org.apache.hupa.client.data.IMAPUser;
+import org.apache.hupa.client.data.IMAPMessage.IMAPFlag;
+import org.apache.hupa.client.rpc.ExposeMessage;
+import org.apache.hupa.client.rpc.ExposeMessageResult;
+import org.apache.hupa.client.services.IMAPServiceException;
+import org.columba.ristretto.coder.Base64DecoderInputStream;
+import org.columba.ristretto.coder.CharsetDecoderInputStream;
+import org.columba.ristretto.coder.QuotedPrintableDecoderInputStream;
+import org.columba.ristretto.imap.IMAPException;
+import org.columba.ristretto.imap.IMAPFlags;
+import org.columba.ristretto.imap.IMAPProtocol;
+import org.columba.ristretto.imap.SequenceSet;
+import org.columba.ristretto.io.StreamUtils;
+import org.columba.ristretto.message.MimeHeader;
+import org.columba.ristretto.message.MimePart;
+import org.columba.ristretto.message.MimeTree;
+
+public class ExposeMessageHandler extends
AbstractIMAPActionHandler<ExposeMessage, ExposeMessageResult>{
+
+ public ExposeMessageResult execute(ExposeMessage action,
ExecutionContext arg1)
+ throws ActionException {
+ try {
+ return new
ExposeMessageResult(exposeMessage(action.getUser(), action.getFolder(),
action.getMessage()));
+ } catch (IMAPServiceException e) {
+ throw new ActionException(e);
+ }
+ }
+
+ public Class<ExposeMessage> getActionType() {
+ return ExposeMessage.class;
+ }
+
+ public void rollback(ExposeMessage arg0, ExposeMessageResult arg1,
+ ExecutionContext arg2) throws ActionException {
+ // TODO Auto-generated method stub
+
+ }
+
+ protected IMAPMessage exposeMessage(IMAPUser user, IMAPFolder folder,
IMAPMessage msg) throws IMAPServiceException {
+ if (msg.isExposed()) {
+ return msg;
+ }
+ IMAPProtocol proto = null;
+ try {
+ proto = getProtocol(user);
+ proto.select(folder.getName());
+
+ IMAPMessageContent content = new IMAPMessageContent();
+
+
+
+ MimeTree mTree =
proto.uidFetchBodystructure(msg.getUid());
+
+ MimePart textPart = mTree.getFirstTextPart("plain");
+
+ if (textPart != null) {
+ InputStream body =
proto.uidFetchBody(msg.getUid(), textPart
+ .getAddress());
+ MimeHeader textHeader = textPart.getHeader();
+
+ if (textHeader.getContentTransferEncoding() ==
MimeHeader.QUOTED_PRINTABLE) {
+ body = new
QuotedPrintableDecoderInputStream(body);
+ } else if
(textHeader.getContentTransferEncoding() == MimeHeader.BASE64) {
+ body = new
Base64DecoderInputStream(body);
+ }
+
+ String charsetName =
textHeader.getContentParameter("charset");
+ if (charsetName == null) {
+ charsetName =
System.getProperty("file.encoding");
+ }
+
+ body = new CharsetDecoderInputStream(body,
Charset
+ .forName(charsetName));
+
+ if
(textHeader.getMimeType().getType().equalsIgnoreCase("plain/text")) {
+ String plainContent =
StreamUtils.readInString(body)
+ .toString();
+
content.setText(StringEscapeUtils.escapeHtml(plainContent)
+ .replaceAll("\n",
"<br>"));
+ } else {
+ String plainContent =
StreamUtils.readInString(body)
+ .toString();
+
content.setText(StringEscapeUtils.escapeHtml(plainContent)
+ .replaceAll("\n",
"<br>"));
+ }
+ }
+
+ if (mTree.count() > 1 || textPart == null) {
+ System.out.println("message has attachments");
+ System.out.println("---");
+ }
+
+ msg.setIMAPMessageContent(content);
+
+
+ IMAPFlags flagsRistretto = new IMAPFlags();
+
+ List<IMAPFlag> flags = msg.getIMAPFlags();
+
+ if (flags.contains(IMAPFlag.SEEN) == false) {
+ flags.add(IMAPFlag.SEEN);
+
+
flagsRistretto.setAnswered(flags.contains(IMAPFlag.ANSWERED));
+
flagsRistretto.setDeleted(flags.contains(IMAPFlag.DELETED));
+
flagsRistretto.setJunk(flags.contains(IMAPFlag.JUNK));
+
flagsRistretto.setRecent(flags.contains(IMAPFlag.RECENT));
+
flagsRistretto.setSeen(flags.contains(IMAPFlag.SEEN));
+ flagsRistretto.setDraft(flags.contains(IMAPFlag.DRAFT));
+
+ proto.uidStore(new SequenceSet(msg.getUid()), true,
flagsRistretto);
+ }
+ return msg;
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw new IMAPServiceException("Unable to expose msg
for uid "
+ + msg.getUid());
+ } catch (IMAPException e) {
+ e.printStackTrace();
+ throw new IMAPServiceException("Unable to expose msg
for uid "
+ + msg.getUid());
+
+ } finally {
+ if (proto != null) {
+ try {
+ proto.close();
+ } catch (Exception e) {
+ // Ignore on close
+ }
+ }
+ }
+ }
+
+}
Modified:
labs/hupa/src/main/java/org/apache/hupa/server/FetchFoldersHandler.java
URL:
http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/FetchFoldersHandler.java?rev=791778&r1=791777&r2=791778&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/server/FetchFoldersHandler.java
(original)
+++ labs/hupa/src/main/java/org/apache/hupa/server/FetchFoldersHandler.java Tue
Jul 7 10:06:05 2009
@@ -37,7 +37,7 @@
import net.customware.gwt.dispatch.server.ExecutionContext;
import net.customware.gwt.dispatch.shared.ActionException;
-public class FetchFoldersHandler extends AbstractIMAPHandler<FetchFolders,
FetchFoldersResult>{
+public class FetchFoldersHandler extends
AbstractIMAPActionHandler<FetchFolders, FetchFoldersResult>{
public FetchFoldersResult execute(FetchFolders action, ExecutionContext
arg1)
throws ActionException {
Added: labs/hupa/src/main/java/org/apache/hupa/server/FetchMessagesHandler.java
URL:
http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/FetchMessagesHandler.java?rev=791778&view=auto
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/server/FetchMessagesHandler.java
(added)
+++ labs/hupa/src/main/java/org/apache/hupa/server/FetchMessagesHandler.java
Tue Jul 7 10:06:05 2009
@@ -0,0 +1,173 @@
+/****************************************************************
+ * 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;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import net.customware.gwt.dispatch.server.ExecutionContext;
+import net.customware.gwt.dispatch.shared.ActionException;
+
+import org.apache.hupa.client.data.IMAPFolder;
+import org.apache.hupa.client.data.IMAPHeader;
+import org.apache.hupa.client.data.IMAPMessage;
+import org.apache.hupa.client.data.IMAPUser;
+import org.apache.hupa.client.data.IMAPMessage.IMAPFlag;
+import org.apache.hupa.client.rpc.FetchMessages;
+import org.apache.hupa.client.rpc.FetchMessagesResult;
+import org.apache.hupa.client.services.IMAPServiceException;
+import org.columba.ristretto.imap.IMAPException;
+import org.columba.ristretto.imap.IMAPFlags;
+import org.columba.ristretto.imap.IMAPProtocol;
+import org.columba.ristretto.imap.SearchKey;
+import org.columba.ristretto.imap.SequenceSet;
+import org.columba.ristretto.message.Address;
+import org.columba.ristretto.message.BasicHeader;
+import org.columba.ristretto.message.MailboxInfo;
+
+public class FetchMessagesHandler extends
AbstractIMAPActionHandler<FetchMessages, FetchMessagesResult>{
+
+ public FetchMessagesResult execute(FetchMessages action,
ExecutionContext arg1)
+ throws ActionException {
+ try {
+ return new
FetchMessagesResult(getMessages(action.getUser(), action.getFolder(),
action.getStart(), action.getStart() + action.getOffset(),
action.getSearchString()),action.getStart(),action.getOffset());
+ } catch (IMAPServiceException e) {
+ throw new ActionException(e);
+ }
+ }
+
+ public Class<FetchMessages> getActionType() {
+ return FetchMessages.class;
+ }
+
+ public void rollback(FetchMessages arg0, FetchMessagesResult arg1,
+ ExecutionContext arg2) throws ActionException {
+ // TODO Auto-generated method stub
+
+ }
+ protected ArrayList<IMAPMessage> getMessages(IMAPUser user,IMAPFolder
folder, int start, int end,String searchString) throws IMAPServiceException {
+ ArrayList<IMAPMessage> mList = new ArrayList<IMAPMessage>();
+
+ IMAPProtocol proto = null;
+ try {
+ proto = getProtocol(user);
+ MailboxInfo mInfo = proto.select(folder.getFullName());
+
+ int exists = mInfo.getExists();
+
+ if (exists == 0) {
+ return mList;
+ }
+
+ if (end > exists) {
+ end = exists -1;
+ }
+ SequenceSet sSet;
+ if (searchString == null) {
+ sSet = new SequenceSet(exists - end, exists -
start);
+ } else {
+
+ List<Integer> matchedList = new
ArrayList<Integer>();
+
matchedList.addAll(Arrays.asList(proto.search(new SearchKey[]{new
SearchKey(SearchKey.FROM,searchString)})));
+
matchedList.addAll(Arrays.asList(proto.search(new SearchKey[]{new
SearchKey(SearchKey.TEXT,searchString)})));
+ Collections.sort(matchedList);
+
+ if (matchedList.size() == 0) {
+ return mList;
+ }
+ sSet = new SequenceSet(matchedList);
+ }
+
+ org.columba.ristretto.imap.IMAPHeader[] headers = proto
+ .fetchHeader(sSet);
+ IMAPFlags[] flags = proto.fetchFlags(sSet);
+ Integer[] uids = proto.fetchUid(sSet);
+ for (int i = 0; i < headers.length; i++) {
+ BasicHeader header = new
BasicHeader(headers[i].getHeader());
+
+ IMAPHeader newHeader = new IMAPHeader();
+ newHeader.setRawHeader(header.toString());
+
newHeader.setFrom(header.getFrom().toString().trim());
+
+ StringBuffer toBuf = new StringBuffer();
+ Address[] toArray = header.getTo();
+ for (int b =0; b < toArray.length;b++) {
+
toBuf.append(toArray[b].toString().trim());
+ if (b != toArray.length -1) {
+ toBuf.append(", ");
+ }
+ }
+ newHeader.setTo(toBuf.toString());
+
+ newHeader.setSubject(header.getSubject());
+
+ StringBuffer ccBuf = new StringBuffer();
+ Address[] ccArray = header.getCc();
+ for (int b =0; b < ccArray.length;b++) {
+
toBuf.append(ccArray[b].toString().trim());
+ if (b != ccArray.length -1) {
+ ccBuf.append(", ");
+ }
+ }
+ newHeader.setCc(ccBuf.toString());
+
+ newHeader.setReceivedDate(header.getDate());
+
+
+ List<IMAPFlag> iFlags = new
ArrayList<IMAPFlag>();
+ IMAPFlags imapFlags = flags[i];
+ if (imapFlags.getDeleted()) {
+
iFlags.add(IMAPMessage.IMAPFlag.DELETED);
+ }
+ if (imapFlags.getSeen()) {
+ iFlags.add(IMAPFlag.SEEN);
+ }
+ if (imapFlags.getRecent()) {
+ iFlags.add(IMAPFlag.RECENT);
+ }
+ IMAPMessage msg = new IMAPMessage();
+ msg.setIMAPHeader(newHeader);
+ msg.setUid(uids[i]);
+ msg.setIMAPFlags(iFlags);
+ mList.add(0, msg);
+ }
+ return mList;
+ } catch (IOException e) {
+ throw new IMAPServiceException(
+ "Error while fetching headers for user
" + user.getName()
+ + ": " +
e.getMessage());
+ } catch (IMAPException e) {
+ throw new IMAPServiceException(
+ "Error while fetching headers for user
" + user.getName()
+ + ": " +
e.getMessage());
+ } finally {
+ if (proto != null) {
+ try {
+ proto.close();
+ } catch (Exception e) {
+ // Ignore on close
+ }
+ }
+ }
+ }
+}
Modified: labs/hupa/src/main/java/org/apache/hupa/server/LoginUserHandler.java
URL:
http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/LoginUserHandler.java?rev=791778&r1=791777&r2=791778&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/server/LoginUserHandler.java
(original)
+++ labs/hupa/src/main/java/org/apache/hupa/server/LoginUserHandler.java Tue
Jul 7 10:06:05 2009
@@ -1,3 +1,22 @@
+/****************************************************************
+ * 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;
import java.io.IOException;
@@ -14,7 +33,7 @@
import org.columba.ristretto.imap.IMAPProtocol;
public class LoginUserHandler extends
- AbstractIMAPHandler<LoginUser, LoginUserResult> {
+ AbstractIMAPActionHandler<LoginUser, LoginUserResult> {
public LoginUserResult execute(LoginUser action, ExecutionContext
context)
throws ActionException {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]