Skip to content

Commit

Permalink
append.c: only call out to annotator on email
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbs committed Jan 23, 2025
1 parent 729e8cf commit 4c08c1a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion imap/append.c
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,10 @@ EXPORTED int append_fromstage_full(struct appendstate *as, struct body **body,
goto out;
}

if (config_getstring(IMAPOPT_ANNOTATION_CALLOUT)) {
if (
config_getstring(IMAPOPT_ANNOTATION_CALLOUT)
&& (mbtype_isa(mailbox_mbtype(mailbox)) == MBTYPE_EMAIL)
) {
if (flags)
newflags = strarray_dup(flags);
else
Expand Down Expand Up @@ -1345,6 +1348,7 @@ HIDDEN int append_run_annotator(struct appendstate *as,
strarray_t *flags = NULL;
struct body *body = NULL;
int r = 0;
struct mailbox *mailbox = NULL;

if (!config_getstring(IMAPOPT_ANNOTATION_CALLOUT))
return 0;
Expand All @@ -1354,6 +1358,13 @@ HIDDEN int append_run_annotator(struct appendstate *as,
return 0;
}

r = msgrecord_get_mailbox(msgrec, &mailbox);
if (r) goto out;

if (mbtype_isa(mailbox_mbtype(mailbox)) != MBTYPE_EMAIL) {
return 0;
}

r = msgrecord_extract_flags(msgrec, as->userid, &flags);
if (r) goto out;
r = msgrecord_extract_annots(msgrec, &user_annots);
Expand Down

0 comments on commit 4c08c1a

Please sign in to comment.