labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r791138 - /labs/hupa/src/main/java/org/apache/hupa/server/IMAPServiceImpl.java
Date Sat, 04 Jul 2009 15:44:57 GMT
Author: norman
Date: Sat Jul  4 15:44:57 2009
New Revision: 791138

URL: http://svn.apache.org/viewvc?rev=791138&view=rev
Log:
Fix bug in fetching messages from folders which contains less messages then requested
Searching now works as aspected

Modified:
    labs/hupa/src/main/java/org/apache/hupa/server/IMAPServiceImpl.java

Modified: labs/hupa/src/main/java/org/apache/hupa/server/IMAPServiceImpl.java
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/IMAPServiceImpl.java?rev=791138&r1=791137&r2=791138&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/server/IMAPServiceImpl.java (original)
+++ labs/hupa/src/main/java/org/apache/hupa/server/IMAPServiceImpl.java Sat Jul  4 15:44:57
2009
@@ -23,6 +23,8 @@
 import java.io.InputStream;
 import java.nio.charset.Charset;
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 import org.columba.ristretto.coder.Base64DecoderInputStream;
@@ -117,17 +119,23 @@
 			}
 
 			if (end > exists) {
-				end = 0;
+				end =  exists -1;
 			}
 			SequenceSet sSet;
 			if (searchString == null) {
 				sSet = new SequenceSet(exists - end, exists - start);
 			} else {
-				Integer[] matchedIds = proto.search(new SearchKey[]{new SearchKey(SearchKey.BODY,searchString),
new SearchKey(SearchKey.SUBJECT,searchString), new SearchKey(SearchKey.FROM,searchString)});
-				if (matchedIds == null || matchedIds.length == 0) {
+			
+				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);
+				
+				System.err.println("mIds=" + matchedList.size());
+				if (matchedList.size() == 0) {
 					return mList;
 				}
-				sSet = new SequenceSet(matchedIds);
+				sSet = new SequenceSet(matchedList);
 			}
 			
 			org.columba.ristretto.imap.IMAPHeader[] headers = proto



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message