dnl IDLE doesn't really belong to banner. It's there just to make Blackberries
dnl happy, because otherwise BIS server disables push email.
capability_banner="IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE"
-capability="$capability_banner SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY MOVE SNIPPET=FUZZY"
+capability="$capability_banner SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY MOVE SNIPPET=FUZZY PREVIEW=FUZZY"
AC_DEFINE_UNQUOTED(CAPABILITY_STRING, "$capability", [IMAP capabilities])
AC_DEFINE_UNQUOTED(CAPABILITY_BANNER_STRING, "$capability_banner", [IMAP capabilities advertised in banner])
const bool lazy = context != NULL;
enum mail_lookup_abort temp_lookup_abort = lazy ? MAIL_LOOKUP_ABORT_NOT_IN_CACHE : mail->lookup_abort;
enum mail_lookup_abort orig_lookup_abort = mail->lookup_abort;
- const char *snippet;
+ const char *resp, *snippet;
int ret;
mail->lookup_abort = temp_lookup_abort;
ret = mail_get_special(mail, MAIL_FETCH_BODY_SNIPPET, &snippet);
mail->lookup_abort = orig_lookup_abort;
+ resp = ctx->preview_command ? "PREVIEW" : "SNIPPET";
+
if (ret == 0) {
/* got it => nothing to do */
snippet++; /* skip over snippet version byte */
return -1;
} else if (lazy) {
/* not in cache && lazy => give up */
- str_append(ctx->state.cur_str, "SNIPPET (FUZZY NIL)");
+ str_append(ctx->state.cur_str, resp);
+ str_append(ctx->state.cur_str, " (FUZZY NIL)");
return 1;
} else {
/*
* sufficiently convoluted this else branch serves to
* document it.
*/
- str_append(ctx->state.cur_str, "SNIPPET (FUZZY NIL)");
+ str_append(ctx->state.cur_str, resp);
+ str_append(ctx->state.cur_str, " (FUZZY NIL)");
return 1;
}
- str_append(ctx->state.cur_str, "SNIPPET (FUZZY ");
+ str_append(ctx->state.cur_str, resp);
+ str_append(ctx->state.cur_str, " (FUZZY ");
imap_append_string(ctx->state.cur_str, snippet);
str_append(ctx->state.cur_str, ") ");
return 1;
}
+bool imap_fetch_preview_init(struct imap_fetch_init_context *ctx)
+{
+ ctx->fetch_ctx->preview_command = TRUE;
+ return imap_fetch_snippet_init(ctx);
+}
+
bool imap_fetch_snippet_init(struct imap_fetch_init_context *ctx)
{
const struct imap_arg *list_args;
const char *str;
if (!imap_arg_get_atom(&list_args[i], &str)) {
- ctx->error = "Invalid SNIPPET algorithm/modifier";
+ ctx->error = "Invalid PREVIEW algorithm/modifier";
return FALSE;
}
/* nothing to do */
} else {
ctx->error = t_strdup_printf("'%s' is not a "
- "supported SNIPPET algorithm/modifier",
+ "supported PREVIEW algorithm/modifier",
str);
return FALSE;
}
{ "FLAGS", imap_fetch_flags_init },
{ "INTERNALDATE", fetch_internaldate_init },
{ "MODSEQ", imap_fetch_modseq_init },
+ { "PREVIEW", imap_fetch_preview_init },
{ "RFC822", imap_fetch_rfc822_init },
{ "SNIPPET", imap_fetch_snippet_init },
{ "UID", imap_fetch_uid_init },
bool flags_have_handler:1;
bool flags_update_seen:1;
bool flags_show_only_seen_changes:1;
+ bool preview_command:1;
};
void imap_fetch_handlers_register(const struct imap_fetch_handler *handlers,
bool imap_fetch_body_section_init(struct imap_fetch_init_context *ctx);
bool imap_fetch_rfc822_init(struct imap_fetch_init_context *ctx);
bool imap_fetch_binary_init(struct imap_fetch_init_context *ctx);
+bool imap_fetch_preview_init(struct imap_fetch_init_context *ctx);
bool imap_fetch_snippet_init(struct imap_fetch_init_context *ctx);
void imap_fetch_handlers_init(void);