protected Argument recipient(Message.RecipientType type, String address, String charset) throws SearchException, IOException { Argument result = new Argument(); if (type == Message.RecipientType.TO) result.writeAtom("TO"); else if (type == Message.RecipientType.CC) result.writeAtom("CC"); else if (type == Message.RecipientType.BCC) result.writeAtom("BCC"); else throw new SearchException("Illegal Recipient type"); result.writeString(address, charset); return result; }
protected Argument recipient(Message.RecipientType type, String address, String charset) throws SearchException, IOException { Argument result = new Argument(); if (type == Message.RecipientType.TO) result.writeAtom("TO"); else if (type == Message.RecipientType.CC) result.writeAtom("CC"); else if (type == Message.RecipientType.BCC) result.writeAtom("BCC"); else throw new SearchException("Illegal Recipient type"); result.writeString(address, charset); return result; }
protected Argument from(String address, String charset) throws SearchException, IOException { Argument result = new Argument(); result.writeAtom("FROM"); result.writeString(address, charset); return result; }
protected Argument from(String address, String charset) throws SearchException, IOException { Argument result = new Argument(); result.writeAtom("FROM"); result.writeString(address, charset); return result; }
protected Argument body(BodyTerm term, String charset) throws SearchException, IOException { Argument result = new Argument(); result.writeAtom("BODY"); result.writeString(term.getPattern(), charset); return result; }
protected Argument subject(SubjectTerm term, String charset) throws SearchException, IOException { Argument result = new Argument(); result.writeAtom("SUBJECT"); result.writeString(term.getPattern(), charset); return result; }
protected Argument size(SizeTerm term) throws SearchException { Argument result = new Argument(); switch (term.getComparison()) { case ComparisonTerm.GT: result.writeAtom("LARGER"); break; case ComparisonTerm.LT: result.writeAtom("SMALLER"); break; default: // GT and LT is all we get from IMAP for size throw new SearchException("Cannot handle Comparison"); } result.writeNumber(term.getNumber()); return result; }
protected Argument subject(SubjectTerm term, String charset) throws SearchException, IOException { Argument result = new Argument(); result.writeAtom("SUBJECT"); result.writeString(term.getPattern(), charset); return result; }
protected Argument body(BodyTerm term, String charset) throws SearchException, IOException { Argument result = new Argument(); result.writeAtom("BODY"); result.writeString(term.getPattern(), charset); return result; }
/** * Generate argument for YoungerTerm. * * @param term the search term * @return the SEARCH Argument * @exception SearchException for failures * @since JavaMail 1.5.1 */ protected Argument younger(YoungerTerm term) throws SearchException { Argument result = new Argument(); result.writeAtom("YOUNGER"); result.writeNumber(term.getInterval()); return result; }
/** * Generate argument for OlderTerm. * * @param term the search term * @return the SEARCH Argument * @exception SearchException for failures * @since JavaMail 1.5.1 */ protected Argument older(OlderTerm term) throws SearchException { Argument result = new Argument(); result.writeAtom("OLDER"); result.writeNumber(term.getInterval()); return result; }
/** * Generate argument for ModifiedSinceTerm. * * @param term the search term * @return the SEARCH Argument * @exception SearchException for failures * @since JavaMail 1.5.1 */ protected Argument modifiedSince(ModifiedSinceTerm term) throws SearchException { Argument result = new Argument(); result.writeAtom("MODSEQ"); result.writeNumber(term.getModSeq()); return result; } }
protected Argument messageid(MessageIDTerm term, String charset) throws SearchException, IOException { Argument result = new Argument(); result.writeAtom("HEADER"); result.writeString("Message-ID"); // XXX confirm that charset conversion ought to be done result.writeString(term.getPattern(), charset); return result; }
protected Argument messageid(MessageIDTerm term, String charset) throws SearchException, IOException { Argument result = new Argument(); result.writeAtom("HEADER"); result.writeString("Message-ID"); // XXX confirm that charset conversion ought to be done result.writeString(term.getPattern(), charset); return result; }
protected Argument header(HeaderTerm term, String charset) throws SearchException, IOException { Argument result = new Argument(); result.writeAtom("HEADER"); result.writeString(term.getHeaderName()); result.writeString(term.getPattern(), charset); return result; }
protected Argument header(HeaderTerm term, String charset) throws SearchException, IOException { Argument result = new Argument(); result.writeAtom("HEADER"); result.writeString(term.getHeaderName()); result.writeString(term.getPattern(), charset); return result; }
/** * Generate argument for YoungerTerm. * * @param term the search term * @return the SEARCH Argument * @exception SearchException for failures * @since JavaMail 1.5.1 */ protected Argument younger(YoungerTerm term) throws SearchException { if (protocol != null && !protocol.hasCapability("WITHIN")) throw new SearchException("Server doesn't support YOUNGER searches"); Argument result = new Argument(); result.writeAtom("YOUNGER"); result.writeNumber(term.getInterval()); return result; }
protected Argument not(NotTerm term, String charset) throws SearchException, IOException { Argument result = new Argument(); // Add the NOT search-key result.writeAtom("NOT"); /* If this term is an AND expression, we need to enclose it * within paranthesis. * * AND expressions are either AndTerms or FlagTerms */ SearchTerm nterm = term.getTerm(); if (nterm instanceof AndTerm || nterm instanceof FlagTerm) result.writeArgument(generateSequence(nterm, charset)); else result.append(generateSequence(nterm, charset)); return result; }
/** * Generate a QRESYNC argument list based on the ResyncData. */ private static Argument resyncArgs(ResyncData rd) { Argument cmd = new Argument(); cmd.writeAtom("QRESYNC"); Argument args = new Argument(); args.writeNumber(rd.getUIDValidity()); args.writeNumber(rd.getModSeq()); UIDSet[] uids = Utility.getResyncUIDSet(rd); if (uids != null) args.writeString(UIDSet.toString(uids)); cmd.writeArgument(args); return cmd; }
/** * Generate a QRESYNC argument list based on the ResyncData. */ private static Argument resyncArgs(ResyncData rd) { Argument cmd = new Argument(); cmd.writeAtom("QRESYNC"); Argument args = new Argument(); args.writeNumber(rd.getUIDValidity()); args.writeNumber(rd.getModSeq()); UIDSet[] uids = Utility.getResyncUIDSet(rd); if (uids != null) args.writeString(UIDSet.toString(uids)); cmd.writeArgument(args); return cmd; }