diff options
| author | Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> | 2020-02-04 01:03:18 +0200 |
|---|---|---|
| committer | Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> | 2020-02-04 01:05:35 +0200 |
| commit | 029a4c245e9b66fd91abeb5093fbd5f4d962446b (patch) | |
| tree | b6286aa79ebae4406fd8040e8991e8244fcb02ff /mu | |
| parent | 38779cfade479cd4cb64882923d2e86b9084f677 (diff) | |
mu/mu4e: handle personal addresses as server cmdline params
So we don't need to pass them to index; they can't change anyway.
Diffstat (limited to 'mu')
| -rw-r--r-- | mu/mu-cmd-server.cc | 23 | ||||
| -rw-r--r-- | mu/mu-config.c | 6 |
2 files changed, 7 insertions, 22 deletions
diff --git a/mu/mu-cmd-server.cc b/mu/mu-cmd-server.cc index 1ecef7f..985f736 100644 --- a/mu/mu-cmd-server.cc +++ b/mu/mu-cmd-server.cc @@ -764,20 +764,6 @@ index_msg_cb (MuIndexStats *stats, void *user_data) return MU_OK; } -static void -set_my_addresses (MuStore *store, const std::vector<std::string>& addrs) -{ - if (addrs.empty()) - return; - - const char **addresses = g_new0 (const char*, addrs.size() + 1); - for (auto i = 0U; i != addrs.size(); ++i) - addresses[i] = addrs[i].c_str(); - - mu_store_set_personal_addresses (store, (const char**)addresses); - g_free (addresses); // shallow -} - static MuError index_and_maybe_cleanup (MuIndex *index, bool cleanup, bool lazy_check) @@ -808,13 +794,9 @@ index_and_maybe_cleanup (MuIndex *index, bool cleanup, bool lazy_check) static void index_handler (Context& context, const Parameters& params) { + GError *gerr{}; const auto cleanup{get_bool_or(params, "cleanup")}; const auto lazy_check{get_bool_or(params, "lazy-check")}; - const auto my_addresses{get_string_vec(params, "my-addresses")}; - - set_my_addresses(context.store, my_addresses); - - GError *gerr{}; auto index{mu_index_new (context.store, &gerr)}; if (!index) throw Error(Error::Code::Index, &gerr, "failed to create index object"); @@ -1273,10 +1255,11 @@ mu_cmd_server (MuStore *store, MuConfig *opts/*unused*/, GError **err) try return MU_OK; } + install_sig_handler(); std::cout << ";; Welcome to the " << PACKAGE_STRING << " command-server\n" << ";; Use (help) to get a list of commands, (quit) to quit.\n"; - while (!context.do_quit) { + while (!MuTerminate && !context.do_quit) { try { const auto line{read_line(context)}; diff --git a/mu/mu-config.c b/mu/mu-config.c index cc8c92d..fc2697f 100644 --- a/mu/mu-config.c +++ b/mu/mu-config.c @@ -439,8 +439,10 @@ config_options_group_server (void) { GOptionGroup *og; GOptionEntry entries[] = { - {"maildir", 'm', 0, G_OPTION_ARG_FILENAME, &MU_CONFIG.maildir, - "top of the maildir", "<maildir>"}, + {"my-address", 0, 0, G_OPTION_ARG_STRING_ARRAY, + &MU_CONFIG.my_addresses, + "my e-mail address; can be used multiple times", + "<address>"}, {"commands", 0, 0, G_OPTION_ARG_NONE, &MU_CONFIG.commands, "list the available command and their parameters, then exit", NULL}, {NULL, 0, 0, 0, NULL, NULL, NULL} |
