Skip to content

Commit

Permalink
expando: enable external filter
Browse files Browse the repository at this point in the history
Enable expando filtering for all the format strings.

- `$alias_format`
- `$attach_format`
- `$autocrypt_acct_format`
- `$compose_format`
- `$folder_format`
- `$greeting`
- `$group_index_format`
- `$history_format`
- `$index_format`
- `$inews`
- `$mailbox_folder_format`
- `$mix_entry_format`
- `$newsrc`
- `$pattern_format`
- `$pgp_entry_format`
- `$query_format`
- `$sidebar_format`
- `$status_format`
  • Loading branch information
flatcap committed Apr 22, 2024
1 parent dbd88e0 commit 908be4a
Show file tree
Hide file tree
Showing 18 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion alias/dlg_alias.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ static int alias_make_entry(struct Menu *menu, int line, int max_cols, struct Bu
}

const struct Expando *c_alias_format = cs_subset_expando(mdata->sub, "alias_format");
return expando_render(c_alias_format, AliasRenderData, av,
return expando_filter(c_alias_format, AliasRenderData, av,
MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
}

Expand Down
2 changes: 1 addition & 1 deletion alias/dlg_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ static int query_make_entry(struct Menu *menu, int line, int max_cols, struct Bu
}

const struct Expando *c_query_format = cs_subset_expando(mdata->sub, "query_format");
return expando_render(c_query_format, QueryRenderData, av,
return expando_filter(c_query_format, QueryRenderData, av,
MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
}

Expand Down
2 changes: 1 addition & 1 deletion attach/dlg_attach.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ static int attach_make_entry(struct Menu *menu, int line, int max_cols, struct B
}

const struct Expando *c_attach_format = cs_subset_expando(NeoMutt->sub, "attach_format");
return expando_render(c_attach_format, AttachRenderData, (actx->idx[actx->v2r[line]]),
return expando_filter(c_attach_format, AttachRenderData, (actx->idx[actx->v2r[line]]),
MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
}

Expand Down
2 changes: 1 addition & 1 deletion autocrypt/dlg_autocrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ static int autocrypt_make_entry(struct Menu *menu, int line, int max_cols, struc
}

const struct Expando *c_autocrypt_acct_format = cs_subset_expando(NeoMutt->sub, "autocrypt_acct_format");
return expando_render(c_autocrypt_acct_format, AutocryptRenderData, entry,
return expando_filter(c_autocrypt_acct_format, AutocryptRenderData, entry,
MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
}

Expand Down
6 changes: 3 additions & 3 deletions browser/dlg_browser.c
Original file line number Diff line number Diff line change
Expand Up @@ -976,19 +976,19 @@ static int folder_make_entry(struct Menu *menu, int line, int max_cols, struct B
if (OptNews)
{
const struct Expando *c_group_index_format = cs_subset_expando(NeoMutt->sub, "group_index_format");
return expando_render(c_group_index_format, GroupIndexRenderData, &folder,
return expando_filter(c_group_index_format, GroupIndexRenderData, &folder,
MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
}

if (bstate->is_mailbox_list)
{
const struct Expando *c_mailbox_folder_format = cs_subset_expando(NeoMutt->sub, "mailbox_folder_format");
return expando_render(c_mailbox_folder_format, FolderRenderData, &folder,
return expando_filter(c_mailbox_folder_format, FolderRenderData, &folder,
MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
}

const struct Expando *c_folder_format = cs_subset_expando(NeoMutt->sub, "folder_format");
return expando_render(c_folder_format, FolderRenderData, &folder,
return expando_filter(c_folder_format, FolderRenderData, &folder,
MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
}

Expand Down
2 changes: 1 addition & 1 deletion compose/attach.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ static int compose_make_entry(struct Menu *menu, int line, int max_cols, struct
}

const struct Expando *c_attach_format = cs_subset_expando(sub, "attach_format");
return expando_render(c_attach_format, AttachRenderData, (actx->idx[actx->v2r[line]]),
return expando_filter(c_attach_format, AttachRenderData, (actx->idx[actx->v2r[line]]),
MUTT_FORMAT_STAT_FILE | MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
}

Expand Down
2 changes: 1 addition & 1 deletion compose/cbar.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ static int cbar_recalc(struct MuttWindow *win)
struct ComposeSharedData *shared = win->parent->wdata;

const struct Expando *c_compose_format = cs_subset_expando(shared->sub, "compose_format");
expando_render(c_compose_format, ComposeRenderData, shared,
expando_filter(c_compose_format, ComposeRenderData, shared,
MUTT_FORMAT_NO_FLAGS, win->state.cols, buf);

struct ComposeBarData *cbar_data = win->wdata;
Expand Down
4 changes: 2 additions & 2 deletions hdrline.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ void index_format_hook(const struct ExpandoNode *node, void *data,
if (!exp)
return;

expando_render(exp, IndexRenderData, data, MUTT_FORMAT_NO_FLAGS, buf->dsize, buf);
expando_filter(exp, IndexRenderData, data, MUTT_FORMAT_NO_FLAGS, buf->dsize, buf);
}

/**
Expand Down Expand Up @@ -1808,7 +1808,7 @@ int mutt_make_string(struct Buffer *buf, size_t max_cols,
hfi.msg_in_pager = inpgr;
hfi.pager_progress = progress;

return expando_render(exp, IndexRenderData, &hfi, flags, max_cols, buf);
return expando_filter(exp, IndexRenderData, &hfi, flags, max_cols, buf);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion history/dlg_history.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static int history_make_entry(struct Menu *menu, int line, int max_cols, struct
}

const struct Expando *c_history_format = cs_subset_expando(NeoMutt->sub, "history_format");
return expando_render(c_history_format, HistoryRenderData, &h,
return expando_filter(c_history_format, HistoryRenderData, &h,
MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
}

Expand Down
2 changes: 1 addition & 1 deletion mixmaster/win_hosts.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static int mix_make_entry(struct Menu *menu, int line, int max_cols, struct Buff
}

const struct Expando *c_mix_entry_format = cs_subset_expando(NeoMutt->sub, "mix_entry_format");
return expando_render(c_mix_entry_format, MixRenderData, *r,
return expando_filter(c_mix_entry_format, MixRenderData, *r,
MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
}

Expand Down
2 changes: 1 addition & 1 deletion ncrypt/dlg_gpgme.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ static int crypt_make_entry(struct Menu *menu, int line, int max_cols, struct Bu
}

const struct Expando *c_pgp_entry_format = cs_subset_expando(NeoMutt->sub, "pgp_entry_format");
return expando_render(c_pgp_entry_format, PgpEntryGpgmeRenderData, &entry,
return expando_filter(c_pgp_entry_format, PgpEntryGpgmeRenderData, &entry,
MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
}

Expand Down
2 changes: 1 addition & 1 deletion ncrypt/dlg_pgp.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ static int pgp_make_entry(struct Menu *menu, int line, int max_cols, struct Buff
}

const struct Expando *c_pgp_entry_format = cs_subset_expando(NeoMutt->sub, "pgp_entry_format");
return expando_render(c_pgp_entry_format, PgpEntryRenderData, &entry,
return expando_filter(c_pgp_entry_format, PgpEntryRenderData, &entry,
MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
}

Expand Down
2 changes: 1 addition & 1 deletion nntp/newsrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ struct NntpAccountData *nntp_select_server(struct Mailbox *m, const char *server
{
const struct Expando *c_newsrc = cs_subset_expando(NeoMutt->sub, "newsrc");
struct Buffer *buf = buf_pool_get();
expando_render(c_newsrc, NntpRenderData, adata, MUTT_FORMAT_NO_FLAGS, buf->dsize, buf);
expando_filter(c_newsrc, NntpRenderData, adata, MUTT_FORMAT_NO_FLAGS, buf->dsize, buf);
mutt_expand_path(buf->data, buf->dsize);
adata->newsrc_file = buf_strdup(buf);
buf_pool_release(&buf);
Expand Down
2 changes: 1 addition & 1 deletion pattern/dlg_pattern.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ static int pattern_make_entry(struct Menu *menu, int line, int max_cols, struct
}

const struct Expando *c_pattern_format = cs_subset_expando(NeoMutt->sub, "pattern_format");
return expando_render(c_pattern_format, PatternRenderData, entry,
return expando_filter(c_pattern_format, PatternRenderData, entry,
MUTT_FORMAT_ARROWCURSOR, max_cols, buf);
}

Expand Down
2 changes: 1 addition & 1 deletion send/send.c
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ static void mutt_make_greeting(struct Email *e, FILE *fp_out, struct ConfigSubse

struct Buffer *buf = buf_pool_get();

expando_render(c_greeting, GreetingRenderData, e, TOKEN_NO_FLAGS, buf->dsize, buf);
expando_filter(c_greeting, GreetingRenderData, e, TOKEN_NO_FLAGS, buf->dsize, buf);

fputs(buf_string(buf), fp_out);
fputc('\n', fp_out);
Expand Down
2 changes: 1 addition & 1 deletion send/sendmail.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ int mutt_invoke_sendmail(struct Mailbox *m, struct AddressList *from,
struct Buffer *cmd = buf_pool_get();

const struct Expando *c_inews = cs_subset_expando(sub, "inews");
expando_render(c_inews, NntpRenderData, 0, MUTT_FORMAT_NO_FLAGS, cmd->dsize, cmd);
expando_filter(c_inews, NntpRenderData, 0, MUTT_FORMAT_NO_FLAGS, cmd->dsize, cmd);
if (buf_is_empty(cmd))
{
i = nntp_post(m, msg);
Expand Down
2 changes: 1 addition & 1 deletion sidebar/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ static void make_sidebar_entry(char *buf, size_t buflen, int width,

struct Buffer *tmp = buf_pool_get();
const struct Expando *c_sidebar_format = cs_subset_expando(NeoMutt->sub, "sidebar_format");
expando_render(c_sidebar_format, SidebarRenderData, &sdata,
expando_filter(c_sidebar_format, SidebarRenderData, &sdata,
MUTT_FORMAT_NO_FLAGS, width, tmp);
mutt_str_copy(buf, buf_string(tmp), buflen);
buf_pool_release(&tmp);
Expand Down
2 changes: 1 addition & 1 deletion status.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ void menu_status_line(struct Buffer *buf, struct IndexSharedData *shared,
{
struct MenuStatusLineData data = { shared, menu };

expando_render(exp, StatusRenderData, &data, MUTT_FORMAT_NO_FLAGS, max_cols, buf);
expando_filter(exp, StatusRenderData, &data, MUTT_FORMAT_NO_FLAGS, max_cols, buf);
}

/**
Expand Down

0 comments on commit 908be4a

Please sign in to comment.