if (TextFlowed)
mutt_str_strfcpy(prefix, ">", sizeof(prefix));
else
- mutt_make_string_flags(prefix, sizeof(prefix), NONULL(IndentString), Context, e, 0);
+ mutt_make_string(prefix, sizeof(prefix), NONULL(IndentString), Context,
+ Context->mailbox, e);
}
if ((flags & MUTT_CM_NOHEADER) == 0)
{
setlocale(LC_TIME, NONULL(AttributionLocale));
mutt_make_string(tmp, sizeof(tmp) - 1, Attribution, Context,
- Context->mailbox->emails[n]);
+ Context->mailbox, Context->mailbox->emails[n]);
setlocale(LC_TIME, "");
strcat(tmp, "\n");
}
struct Email *e = hfi->email;
struct Context *ctx = hfi->ctx;
+ struct Mailbox *m = hfi->m;
if (!e || !e->env)
return src;
/* fallthrough */
case 'b':
- if (ctx)
+ if (m)
{
- p = strrchr(ctx->mailbox->path, '/');
+ p = strrchr(m->path, '/');
if (p)
mutt_str_strfcpy(buf, p + 1, buflen);
else
- mutt_str_strfcpy(buf, ctx->mailbox->path, buflen);
+ mutt_str_strfcpy(buf, m->path, buflen);
}
else
mutt_str_strfcpy(buf, "(null)", buflen);
case 'e':
snprintf(fmt, sizeof(fmt), "%%%sd", prec);
- snprintf(buf, buflen, fmt, mutt_messages_in_thread(ctx->mailbox, e, 1));
+ snprintf(buf, buflen, fmt, mutt_messages_in_thread(m, e, 1));
break;
case 'E':
if (!optional)
{
snprintf(fmt, sizeof(fmt), "%%%sd", prec);
- snprintf(buf, buflen, fmt, mutt_messages_in_thread(ctx->mailbox, e, 0));
+ snprintf(buf, buflen, fmt, mutt_messages_in_thread(m, e, 0));
}
- else if (mutt_messages_in_thread(ctx->mailbox, e, 0) <= 1)
+ else if (mutt_messages_in_thread(m, e, 0) <= 1)
optional = 0;
break;
break;
case 'm':
- if (ctx)
+ if (m)
{
snprintf(fmt, sizeof(fmt), "%%%sd", prec);
- snprintf(buf, buflen, fmt, ctx->mailbox->msg_count);
+ snprintf(buf, buflen, fmt, m->msg_count);
}
else
mutt_str_strfcpy(buf, "(null)", buflen);
case 'X':
{
- int count = mutt_count_body_parts(ctx->mailbox, e);
+ int count = mutt_count_body_parts(m, e);
/* The recursion allows messages without depth to return 0. */
if (optional)
* @param buf Buffer for the result
* @param buflen Buffer length
* @param s printf-line format string
- * @param ctx Mailbox
+ * @param ctx Mailbox Context
+ * @param m Mailbox
* @param e Email
* @param flags Format flags
*/
-void mutt_make_string_flags(char *buf, size_t buflen, const char *s,
- struct Context *ctx, struct Email *e, enum FormatFlag flags)
+void mutt_make_string_flags(char *buf, size_t buflen, const char *s, struct Context *ctx,
+ struct Mailbox *m, struct Email *e, enum FormatFlag flags)
{
struct HdrFormatInfo hfi;
hfi.email = e;
hfi.ctx = ctx;
+ hfi.m = m;
hfi.pager_progress = 0;
mutt_expando_format(buf, buflen, 0, MuttIndexWindow->cols, s,
struct HdrFormatInfo
{
struct Context *ctx;
+ struct Mailbox *m;
struct Email *email;
const char *pager_progress;
};
bool mutt_is_mail_list(struct Address *addr);
bool mutt_is_subscribed_list(struct Address *addr);
-void mutt_make_string_flags(char *buf, size_t buflen, const char *s, struct Context *ctx, struct Email *e, enum FormatFlag flags);
-void mutt_make_string_info(char *buf, size_t buflen, int cols, const char *s, struct HdrFormatInfo *hfi, enum FormatFlag flags);
-
-#define mutt_make_string(A, B, C, D, E) mutt_make_string_flags(A, B, C, D, E, 0)
+void mutt_make_string_flags(char *buf, size_t buflen, const char *s,
+ struct Context *ctx, struct Mailbox *m,
+ struct Email *e, enum FormatFlag flags);
+void mutt_make_string_info(char *buf, size_t buflen, int cols, const char *s,
+ struct HdrFormatInfo *hfi, enum FormatFlag flags);
+
+#define mutt_make_string(BUF, BUFLEN, S, CTX, M, E) \
+ mutt_make_string_flags(BUF, BUFLEN, S, CTX, M, E, 0)
#endif /* MUTT_HDRLINE_H */
struct Mailbox *m = ctx ? ctx->mailbox : NULL;
if ((mutt_pattern_exec(hook->pattern, 0, m, e, &cache) > 0) ^ hook->regex.not)
{
- mutt_make_string_flags(path, pathlen, hook->command, ctx, e, MUTT_FORMAT_PLAIN);
+ mutt_make_string_flags(path, pathlen, hook->command, ctx, ctx->mailbox,
+ e, MUTT_FORMAT_PLAIN);
return 0;
}
}
}
}
- mutt_make_string_flags(buf, buflen, NONULL(IndexFormat), Context, e, flag);
+ mutt_make_string_flags(buf, buflen, NONULL(IndexFormat), Context,
+ Context->mailbox, e, flag);
}
/**
{
struct Context *ctx = menu->data;
- mutt_make_string_flags(buf, buflen, NONULL(IndexFormat), ctx,
+ mutt_make_string_flags(buf, buflen, NONULL(IndexFormat), ctx, ctx->mailbox,
ctx->mailbox->emails[line], MUTT_FORMAT_ARROWCURSOR);
}
MessageFormat && aptr->content->email)
{
char s[SHORT_STRING];
- mutt_make_string_flags(s, sizeof(s), MessageFormat, NULL,
+ mutt_make_string_flags(s, sizeof(s), MessageFormat, NULL, NULL,
aptr->content->email,
MUTT_FORMAT_FORCESUBJ | MUTT_FORMAT_ARROWCURSOR);
if (*s)
mutt_str_strfcpy(prefix2, prefix, sizeof(prefix2));
else if (!TextFlowed)
{
- mutt_make_string_flags(prefix2, sizeof(prefix2), NONULL(IndentString),
- Context, e, 0);
+ mutt_make_string(prefix2, sizeof(prefix2), NONULL(IndentString), Context,
+ Context->mailbox, e);
}
else
mutt_str_strfcpy(prefix2, ">", sizeof(prefix2));
{
if (!TextFlowed)
{
- mutt_make_string_flags(prefix, sizeof(prefix), NONULL(IndentString),
- Context, parent_hdr, 0);
+ mutt_make_string(prefix, sizeof(prefix), NONULL(IndentString), Context,
+ Context->mailbox, parent_hdr);
}
else
mutt_str_strfcpy(prefix, ">", sizeof(prefix));
if (!TextFlowed)
{
- mutt_make_string_flags(prefix, sizeof(prefix), NONULL(IndentString),
- Context, parent_hdr, 0);
+ mutt_make_string(prefix, sizeof(prefix), NONULL(IndentString), Context,
+ Context->mailbox, parent_hdr);
}
else
mutt_str_strfcpy(prefix, ">", sizeof(prefix));
char buf[LONG_STRING];
setlocale(LC_TIME, NONULL(AttributionLocale));
- mutt_make_string(buf, sizeof(buf), ForwardAttributionIntro, ctx, cur);
+ mutt_make_string(buf, sizeof(buf), ForwardAttributionIntro, ctx, ctx->mailbox, cur);
setlocale(LC_TIME, "");
fputs(buf, fp);
fputs("\n\n", fp);
char buf[LONG_STRING];
setlocale(LC_TIME, NONULL(AttributionLocale));
- mutt_make_string(buf, sizeof(buf), ForwardAttributionTrailer, ctx, cur);
+ mutt_make_string(buf, sizeof(buf), ForwardAttributionTrailer, ctx, ctx->mailbox, cur);
setlocale(LC_TIME, "");
fputc('\n', fp);
fputs(buf, fp);
char buf[LONG_STRING];
setlocale(LC_TIME, NONULL(AttributionLocale));
- mutt_make_string(buf, sizeof(buf), Attribution, ctx, cur);
+ mutt_make_string(buf, sizeof(buf), Attribution, ctx, ctx->mailbox, cur);
setlocale(LC_TIME, "");
fputs(buf, out);
fputc('\n', out);
return;
char buf[STRING];
- mutt_make_string(buf, sizeof(buf), PostIndentString, ctx, cur);
+ mutt_make_string(buf, sizeof(buf), PostIndentString, ctx, ctx->mailbox, cur);
fputs(buf, out);
fputc('\n', out);
}
char buf[STRING];
/* set the default subject for the message. */
- mutt_make_string(buf, sizeof(buf), NONULL(ForwardFormat), ctx, cur);
+ mutt_make_string(buf, sizeof(buf), NONULL(ForwardFormat), ctx, ctx->mailbox, cur);
mutt_str_replace(&env->subject, buf);
}