public static final HumanReadableText unseen(long numberUnseen) { return new HumanReadableText("org.apache.james.imap.UNSEEN", "Message " + numberUnseen + " is first unseen"); }
@Override public String localize(HumanReadableText text, Locales locales) { String result; if (text == null) { result = null; } else { //FIXME implement the locale selection final Locale chosenLocale = Locale.US; //FIXME implement the localized value lookup depending on chosenLocale result = text.getDefaultValue(); Object[] params = text.getParameters(); if (params != null && params.length > 0) { MessageFormat messageFormat = new MessageFormat(result, chosenLocale); result = messageFormat.format(params); } } return result; }
/** * * Reads the mailbox name via {@link #mailboxUTF7()} but also decode it via {@link CharsetUtil#decodeModifiedUTF7(String)} * * If you really want to get the modified UTF7 version you should use {@link #mailboxUTF7()} * * @return decodedMailbox * */ public String mailbox() throws DecodingException { return CharsetUtil.decodeModifiedUTF7(mailboxUTF7()); }
private ImapMessage unsupportedCharset(String tag, ImapCommand command) { final StatusResponseFactory factory = getStatusResponseFactory(); final ResponseCode badCharset = StatusResponse.ResponseCode.badCharset(CharsetUtil.getAvailableCharsetNames()); return factory.taggedNo(tag, command, HumanReadableText.BAD_CHARSET, badCharset); }
@Override public ImapResponseComposer mailbox(String mailboxName) throws IOException { quote(CharsetUtil.encodeModifiedUTF7(mailboxName)); return this; }
protected void permanentFlags(Responder responder, MessageManager.MetaData metaData, SelectedMailbox selected) { final Flags permanentFlags = metaData.getPermanentFlags(); if (permanentFlags.contains(Flags.Flag.USER)) { permanentFlags.add(selected.getApplicableFlags()); } final StatusResponse untaggedOk = factory.untaggedOk(HumanReadableText.permanentFlags(permanentFlags), ResponseCode.permanentFlags(permanentFlags)); responder.respond(untaggedOk); }
private void handleResponseException(final ImapProcessor.Responder responder, MailboxException e, final HumanReadableText message, ImapSession session) { session.getLog().info(message.toString()); session.getLog().debug(message.toString(), e); // TODO: consider whether error message should be passed to the user final StatusResponse response = factory.untaggedNo(message); responder.respond(response); }
public static final HumanReadableText unseen(long numberUnseen) { return new HumanReadableText("org.apache.james.imap.UNSEEN", "MailboxMessage " + numberUnseen + " is first unseen"); }
/** * @see Localizer#localize(HumanReadableText, Locales) */ public String localize(HumanReadableText text, Locales locales) { String result; if (text == null) { result = null; } else { //FIXME implement the locale selection final Locale chosenLocale = Locale.US; //FIXME implement the localized value lookup depending on chosenLocale result = text.getDefaultValue(); Object[] params = text.getParameters(); if (params != null && params.length > 0) { MessageFormat messageFormat = new MessageFormat(result, chosenLocale); result = messageFormat.format(params); } } return result; }
/** * * Reads the mailbox name via {@link #mailboxUTF7()} but also decode it via {@link CharsetUtil#decodeModifiedUTF7(String)} * * If you really want to get the modified UTF7 version you should use {@link #mailboxUTF7()} * * @return decodedMailbox * */ public String mailbox() throws DecodingException { return CharsetUtil.decodeModifiedUTF7(mailboxUTF7()); }
private ImapMessage unsupportedCharset(final String tag, final ImapCommand command) { final StatusResponseFactory factory = getStatusResponseFactory(); final ResponseCode badCharset = StatusResponse.ResponseCode.badCharset(CharsetUtil.getAvailableCharsetNames()); final StatusResponse result = factory.taggedNo(tag, command, HumanReadableText.BAD_CHARSET, badCharset); return result; }
/** * @see org.apache.james.imap.encode.ImapResponseComposer#mailbox(java.lang.String) */ public ImapResponseComposer mailbox(final String mailboxName) throws IOException { quote(CharsetUtil.encodeModifiedUTF7(mailboxName)); return this; }
protected void permanentFlags(Responder responder, MessageManager.MetaData metaData, SelectedMailbox selected) { final Flags permanentFlags = metaData.getPermanentFlags(); if (permanentFlags.contains(Flags.Flag.USER)) { permanentFlags.add(selected.getApplicableFlags()); } final StatusResponse untaggedOk = factory.untaggedOk(HumanReadableText.permanentFlags(permanentFlags), ResponseCode.permanentFlags(permanentFlags)); responder.respond(untaggedOk); }
public static final HumanReadableText permanentFlags(Flags flags) { String text; if (flags.getSystemFlags() != null && flags.getSystemFlags().length > 0) { text = "Limited"; } else { text = "No permanent flags permitted"; } return new HumanReadableText("org.apache.james.imap.PERMANENT_FLAGS", text); }
public static final HumanReadableText permanentFlags(Flags flags) { String text; if (flags.getSystemFlags() != null && flags.getSystemFlags().length > 0) { text = "Limited"; } else { text = "No permanent flags permitted"; } return new HumanReadableText("org.apache.james.imap.PERMANENT_FLAGS", text); }
@Override protected void doProcess(SetQuotaRequest message, ImapSession session, String tag, ImapCommand command, Responder responder) { Object[] params = new Object[]{ "Full admin rights", command.getName(), "Can not perform SETQUOTA commands" }; HumanReadableText humanReadableText = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params); no(command, tag, responder, humanReadableText); }