use of com.zimbra.cs.mailclient.imap.MailboxName in project zm-mailbox by Zimbra.
the class ImapAppender method append.
private long append(MessageInfo mi, Literal data) throws IOException {
ImapRequest req = connection.newRequest(CAtom.APPEND, new MailboxName(mailbox));
if (mi.flags != null) {
req.addParam(mi.flags);
}
if (mi.date != null) {
req.addParam(mi.date);
}
req.addParam(data);
ResponseText rt = req.sendCheckStatus().getResponseText();
if (rt != null && rt.getCCode() == CAtom.APPENDUID) {
AppendResult ar = (AppendResult) rt.getData();
if (ar.getUid() > 0) {
return ar.getUid();
}
}
throw req.failed("APPENDUID supported but UID missing from result");
}
use of com.zimbra.cs.mailclient.imap.MailboxName in project zm-mailbox by Zimbra.
the class RemoteFolder method copyMessage.
public CopyResult copyMessage(long uid, String mbox) throws IOException {
assert isSelected();
String seq = String.valueOf(uid);
ImapRequest req = connection.newUidRequest(CAtom.COPY, seq, new MailboxName(mbox));
ResponseText rt = req.sendCheckStatus().getResponseText();
if (rt.getCCode() == CAtom.COPYUID) {
CopyResult cr = (CopyResult) rt.getData();
// Bug 36373: If COPYUID result 0 then assume that message no longer exists.
if (cr != null && cr.getToUids()[0] != 0) {
return cr;
}
}
// Message not found
return null;
}
use of com.zimbra.cs.mailclient.imap.MailboxName in project zm-mailbox by Zimbra.
the class TestImap method testOverflowAppend.
@Test
public void testOverflowAppend() throws Exception {
assertTrue(connection.hasCapability("UIDPLUS"));
int oldReadTimeout = connection.getConfig().getReadTimeout();
try {
connection.setReadTimeout(10);
Flags flags = Flags.fromSpec("afs");
Date date = new Date(System.currentTimeMillis());
ImapRequest req = connection.newRequest(CAtom.APPEND, new MailboxName("INBOX"));
req.addParam("{" + ((long) (Integer.MAX_VALUE) + 1) + "+}");
ImapResponse resp = req.send();
assertTrue(resp.isNO() || resp.isBAD());
req = connection.newRequest(CAtom.APPEND, new MailboxName("INBOX"));
req.addParam("{" + ((long) (Integer.MAX_VALUE) + 1) + "}");
resp = req.send();
assertTrue(resp.isNO() || resp.isBAD());
} finally {
connection.setReadTimeout(oldReadTimeout);
}
}
Aggregations