projects
/
org.ibex.mail.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2668a47
)
improve PEEK logic in IMAP
author
adam
<adam@megacz.com>
Thu, 5 Jul 2007 01:39:27 +0000
(
01:39
+0000)
committer
adam
<adam@megacz.com>
Thu, 5 Jul 2007 01:39:27 +0000
(
01:39
+0000)
darcs-hash:
20070705013927
-5007d-
b17558ebacab019489907ac03ee643a9fd562b68
.gz
src/org/ibex/mail/IMAP.java
patch
|
blob
|
history
diff --git
a/src/org/ibex/mail/IMAP.java
b/src/org/ibex/mail/IMAP.java
index
ea08055
..
522509d
100644
(file)
--- a/
src/org/ibex/mail/IMAP.java
+++ b/
src/org/ibex/mail/IMAP.java
@@
-14,6
+14,8
@@
import java.net.*;
import java.text.*;
import java.io.*;
import java.text.*;
import java.io.*;
+// FEATURE: IDLE extension for blackberries
+
// FIXME: this is valid LSUB "" asdfdas%*%*%*%*SFEFGWEF
// FIXME: be very careful about where/when we quotify stuff
// FIXME: 'UID FOO 100:*' must match at least one message even if all UIDs less than 100
// FIXME: this is valid LSUB "" asdfdas%*%*%*%*SFEFGWEF
// FIXME: be very careful about where/when we quotify stuff
// FIXME: 'UID FOO 100:*' must match at least one message even if all UIDs less than 100
@@
-453,6
+455,7
@@
public class IMAP {
t = new Parser.Token[] { parser.token("FLAGS"), parser.token("INTERNALDATE"),
parser.token("RFC822.SIZE") };
}
t = new Parser.Token[] { parser.token("FLAGS"), parser.token("INTERNALDATE"),
parser.token("RFC822.SIZE") };
}
+ boolean looked_at_body = false;
for(int i=0; i<t.length; i++) {
if (r.length() > initlen) r.append(" ");
if (t[i] == null || t[i].s == null) continue;
for(int i=0; i<t.length; i++) {
if (r.length() > initlen) r.append(" ");
if (t[i] == null || t[i].s == null) continue;
@@
-470,11
+473,11
@@
public class IMAP {
} else if (!(s.equals("BODY.PEEK") || s.equals("BODY"))) { throw new Server.No("unknown fetch argument: " + s);
} else {
if (s.equalsIgnoreCase("BODY.PEEK")) spec |= PEEK;
} else if (!(s.equals("BODY.PEEK") || s.equals("BODY"))) { throw new Server.No("unknown fetch argument: " + s);
} else {
if (s.equalsIgnoreCase("BODY.PEEK")) spec |= PEEK;
- //else if (e) api.addFlags(Query.imapNumber(new int[] { num, num }), Mailbox.Flag.SEEN, false, false);
+ looked_at_body = true;
if (i >= t.length - 1 || t[i+1].type != Parser.Token.LIST) {
spec |= BODYSTRUCTURE;
if (e) { r.append(" "); r.append(Printer.bodystructure(m)); } continue;
if (i >= t.length - 1 || t[i+1].type != Parser.Token.LIST) {
spec |= BODYSTRUCTURE;
if (e) { r.append(" "); r.append(Printer.bodystructure(m)); } continue;
- //{ if (e) { r.append(" "); r.append(Printer.qq(m.body)); } continue; }
+ //if (e) { r.append(" "); r.append(Printer.qq(m.getBody().getStream())); } continue;
}
Fountain payload = Fountain.Util.create("");
r.append("[");
}
Fountain payload = Fountain.Util.create("");
r.append("[");
@@
-504,6
+507,8
@@
public class IMAP {
if (e) { r.append("] "); r.append(Printer.qq(payload.getStream())); }
}
}
if (e) { r.append("] "); r.append(Printer.qq(payload.getStream())); }
}
}
+ if ((spec & PEEK) == 0 && looked_at_body && e)
+ api.addFlags(Query.imapNumber(new int[] { num, num }), Mailbox.Flag.SEEN, false, false);
if (e) {
r.append(")");
println("* " + r.toString());
if (e) {
r.append(")");
println("* " + r.toString());
@@
-835,7
+840,7
@@
public class IMAP {
public static String qq(Stream stream) {
StringBuffer sb = new StringBuffer();
stream.transcribe(sb);
public static String qq(Stream stream) {
StringBuffer sb = new StringBuffer();
stream.transcribe(sb);
- return sb.toString();
+ return qq(sb.toString());
}
public static String qq(String s) {
StringBuffer ret = new StringBuffer();
}
public static String qq(String s) {
StringBuffer ret = new StringBuffer();