Search in sources :

Example 1 with ResponseText

use of com.zimbra.cs.mailclient.imap.ResponseText 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");
}
Also used : MailboxName(com.zimbra.cs.mailclient.imap.MailboxName) ImapRequest(com.zimbra.cs.mailclient.imap.ImapRequest) ResponseText(com.zimbra.cs.mailclient.imap.ResponseText) AppendResult(com.zimbra.cs.mailclient.imap.AppendResult)

Example 2 with ResponseText

use of com.zimbra.cs.mailclient.imap.ResponseText 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;
}
Also used : MailboxName(com.zimbra.cs.mailclient.imap.MailboxName) ImapRequest(com.zimbra.cs.mailclient.imap.ImapRequest) ResponseText(com.zimbra.cs.mailclient.imap.ResponseText) CopyResult(com.zimbra.cs.mailclient.imap.CopyResult)

Aggregations

ImapRequest (com.zimbra.cs.mailclient.imap.ImapRequest)2 MailboxName (com.zimbra.cs.mailclient.imap.MailboxName)2 ResponseText (com.zimbra.cs.mailclient.imap.ResponseText)2 AppendResult (com.zimbra.cs.mailclient.imap.AppendResult)1 CopyResult (com.zimbra.cs.mailclient.imap.CopyResult)1