You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by no...@apache.org on 2009/07/04 17:44:57 UTC
svn commit: r791138 -
/labs/hupa/src/main/java/org/apache/hupa/server/IMAPServiceImpl.java
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