many: update for lib/message updates
Adapt to the new names / directory. Big commit, but mostly just very boring renaming.
This commit is contained in:
@ -35,7 +35,7 @@ mu = executable(
|
||||
'mu-config.hh',
|
||||
mu_help_strings_h
|
||||
],
|
||||
dependencies: [ glib_dep, lib_mu_dep, thread_dep, config_h_dep ],
|
||||
dependencies: [ glib_dep, gmime_dep, lib_mu_dep, thread_dep, config_h_dep ],
|
||||
cpp_args: ['-DMU_SCRIPTS_DIR="'+ join_paths(datadir, 'mu', 'scripts') + '"'],
|
||||
install: true)
|
||||
|
||||
|
||||
@ -274,7 +274,7 @@ struct ECData {
|
||||
};
|
||||
|
||||
static void
|
||||
each_contact(const Mu::MessageContact& ci, ECData& ecdata)
|
||||
each_contact(const Mu::Contact& ci, ECData& ecdata)
|
||||
{
|
||||
if (ecdata.personal && ci.personal)
|
||||
return;
|
||||
|
||||
@ -28,13 +28,14 @@
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "message/mu-fields.hh"
|
||||
#include "mu-msg.hh"
|
||||
#include "mu-maildir.hh"
|
||||
#include "mu-query-match-deciders.hh"
|
||||
#include "mu-query.hh"
|
||||
#include "mu-bookmarks.hh"
|
||||
#include "mu-runtime.hh"
|
||||
#include "mu-message.hh"
|
||||
#include "message/mu-message.hh"
|
||||
|
||||
#include "utils/mu-util.h"
|
||||
#include "utils/mu-str.h"
|
||||
@ -43,7 +44,6 @@
|
||||
#include "utils/mu-utils.hh"
|
||||
|
||||
using namespace Mu;
|
||||
using namespace Mu::Message;
|
||||
|
||||
struct OutputInfo {
|
||||
Xapian::docid docid{};
|
||||
@ -74,8 +74,8 @@ static Option<QueryResults>
|
||||
run_query(const Store& store, const std::string& expr, const MuConfig* opts,
|
||||
GError** err)
|
||||
{
|
||||
const auto sortfield_id{message_field_id(opts->sortfield ? opts->sortfield : "")};
|
||||
if (!sortfield_id && opts->sortfield) {
|
||||
const auto sortfield{field_from_name(opts->sortfield ? opts->sortfield : "")};
|
||||
if (!sortfield && opts->sortfield) {
|
||||
g_set_error(err, MU_ERROR_DOMAIN, MU_ERROR_IN_PARAMETERS,
|
||||
"invvalid sort field: '%s'\n", opts->sortfield);
|
||||
return Nothing;
|
||||
@ -91,7 +91,7 @@ run_query(const Store& store, const std::string& expr, const MuConfig* opts,
|
||||
if (opts->threads)
|
||||
qflags |= QueryFlags::Threading;
|
||||
|
||||
return store.run_query(expr, sortfield_id, qflags, opts->maxnum);
|
||||
return store.run_query(expr, sortfield->id, qflags, opts->maxnum);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -233,7 +233,7 @@ ansi_color_maybe(Field::Id field_id, gboolean color)
|
||||
case Field::Id::Date: ansi = MU_COLOR_MAGENTA; break;
|
||||
|
||||
default:
|
||||
if (message_field(field_id).type != Field::Type::String)
|
||||
if (field_from_id(field_id).type != Field::Type::String)
|
||||
ansi = MU_COLOR_YELLOW;
|
||||
else
|
||||
ansi = MU_COLOR_RED;
|
||||
@ -275,10 +275,10 @@ field_string_list(MuMsg* msg, Field::Id field_id)
|
||||
|
||||
/* ugly... for backward compat */
|
||||
static const char*
|
||||
flags_s(MessageFlags flags)
|
||||
flags_s(Flags flags)
|
||||
{
|
||||
static char buf[64];
|
||||
const auto flagstr{message_flags_to_string(flags)};
|
||||
const auto flagstr{flags_to_string(flags)};
|
||||
|
||||
::strncpy(buf, flagstr.c_str(), sizeof(buf) - 1);
|
||||
|
||||
@ -290,7 +290,7 @@ display_field(MuMsg* msg, Field::Id field_id)
|
||||
{
|
||||
gint64 val;
|
||||
|
||||
switch (message_field(field_id).type) {
|
||||
switch (field_from_id(field_id).type) {
|
||||
case Field::Type::String: {
|
||||
const gchar* str;
|
||||
str = mu_msg_get_field_string(msg, field_id);
|
||||
@ -299,11 +299,11 @@ display_field(MuMsg* msg, Field::Id field_id)
|
||||
case Field::Type::Integer:
|
||||
if (field_id == Field::Id::Priority) {
|
||||
const auto val = static_cast<char>(mu_msg_get_field_numeric(msg, field_id));
|
||||
const auto prio = message_priority_from_char(val);
|
||||
return message_priority_name_c_str(prio);
|
||||
const auto prio = priority_from_char(val);
|
||||
return priority_name_c_str(prio);
|
||||
} else if (field_id == Field::Id::Flags) {
|
||||
val = mu_msg_get_field_numeric(msg, field_id);
|
||||
return flags_s(static_cast<MessageFlags>(val));
|
||||
return flags_s(static_cast<Flags>(val));
|
||||
} else /* as string */
|
||||
return mu_msg_get_field_string(msg, field_id);
|
||||
|
||||
@ -384,16 +384,15 @@ output_plain_fields(MuMsg* msg, const char* fields, gboolean color, gboolean thr
|
||||
g_return_if_fail(fields);
|
||||
|
||||
for (myfields = fields, nonempty = 0; *myfields; ++myfields) {
|
||||
const auto id_opt{message_field_id(*myfields)};
|
||||
if (!id_opt || (!message_field(*id_opt).is_value() &&
|
||||
!message_field(*id_opt).is_contact()))
|
||||
const auto field_opt{field_from_shortcut(*myfields)};
|
||||
if (!field_opt || (!field_opt->is_value() && !field_opt->is_contact()))
|
||||
nonempty += printf("%c", *myfields);
|
||||
|
||||
else {
|
||||
ansi_color_maybe(*id_opt, color);
|
||||
nonempty += mu_util_fputs_encoded(display_field(msg, *id_opt).c_str(),
|
||||
stdout);
|
||||
ansi_reset_maybe(*id_opt, color);
|
||||
ansi_color_maybe(field_opt->id, color);
|
||||
nonempty += mu_util_fputs_encoded(
|
||||
display_field(msg, field_opt->id).c_str(), stdout);
|
||||
ansi_reset_maybe(field_opt->id, color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
46
mu/mu-cmd.cc
46
mu/mu-cmd.cc
@ -34,7 +34,7 @@
|
||||
#include "mu-maildir.hh"
|
||||
#include "mu-contacts-cache.hh"
|
||||
#include "mu-runtime.hh"
|
||||
#include "mu-message-flags.hh"
|
||||
#include "message/mu-message.hh"
|
||||
|
||||
#include "utils/mu-util.h"
|
||||
#include "utils/mu-str.h"
|
||||
@ -49,7 +49,7 @@ static gboolean
|
||||
view_msg_sexp(MuMsg* msg, const MuConfig* opts)
|
||||
{
|
||||
::fputs(msg_to_sexp(msg, 0, mu_config_get_msg_options(opts)).to_sexp_string().c_str(),
|
||||
stdout);
|
||||
stdout);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -121,10 +121,10 @@ body_or_summary(MuMsg* msg, const MuConfig* opts)
|
||||
color = !opts->nocolor;
|
||||
body = mu_msg_get_body_text(msg, (MuMsgOptions)my_opts);
|
||||
if (!body) {
|
||||
if (any_of(mu_msg_get_flags(msg) & MessageFlags::Encrypted)) {
|
||||
if (any_of(mu_msg_get_flags(msg) & Flags::Encrypted)) {
|
||||
color_maybe(MU_COLOR_CYAN);
|
||||
g_print("[No body found; "
|
||||
"message has encrypted parts]\n");
|
||||
"message has encrypted parts]\n");
|
||||
} else {
|
||||
color_maybe(MU_COLOR_MAGENTA);
|
||||
g_print("[No body found]\n");
|
||||
@ -308,7 +308,7 @@ foreach_msg_file(Mu::Store& store, const MuConfig* opts, ForeachMsgFunc foreach_
|
||||
/* note: params[0] will be 'add' */
|
||||
if (!opts->params[0] || !opts->params[1]) {
|
||||
g_print("usage: mu %s <file> [<files>]\n",
|
||||
opts->params[0] ? opts->params[0] : "<cmd>");
|
||||
opts->params[0] ? opts->params[0] : "<cmd>");
|
||||
mu_util_g_set_error(err, MU_ERROR_IN_PARAMETERS, "missing parameters");
|
||||
return MU_ERROR_IN_PARAMETERS;
|
||||
}
|
||||
@ -327,8 +327,8 @@ foreach_msg_file(Mu::Store& store, const MuConfig* opts, ForeachMsgFunc foreach_
|
||||
if (!foreach_func(store, path, err)) {
|
||||
all_ok = FALSE;
|
||||
g_printerr("error with %s: %s\n",
|
||||
path,
|
||||
(err && *err) ? (*err)->message : "something went wrong");
|
||||
path,
|
||||
(err && *err) ? (*err)->message : "something went wrong");
|
||||
g_clear_error(err);
|
||||
continue;
|
||||
}
|
||||
@ -336,9 +336,9 @@ foreach_msg_file(Mu::Store& store, const MuConfig* opts, ForeachMsgFunc foreach_
|
||||
|
||||
if (!all_ok) {
|
||||
mu_util_g_set_error(err,
|
||||
MU_ERROR_XAPIAN_STORE_FAILED,
|
||||
"%s failed for some message(s)",
|
||||
opts->params[0]);
|
||||
MU_ERROR_XAPIAN_STORE_FAILED,
|
||||
"%s failed for some message(s)",
|
||||
opts->params[0]);
|
||||
return MU_ERROR_XAPIAN_STORE_FAILED;
|
||||
}
|
||||
|
||||
@ -399,14 +399,14 @@ each_sig(MuMsg* msg, MuMsgPart* part, VData* vdata)
|
||||
|
||||
if (vdata->oneline)
|
||||
vdata->report = g_strdup_printf("%s%s%s",
|
||||
vdata->report ? vdata->report : "",
|
||||
vdata->report ? "; " : "",
|
||||
report->report);
|
||||
vdata->report ? vdata->report : "",
|
||||
vdata->report ? "; " : "",
|
||||
report->report);
|
||||
else
|
||||
vdata->report = g_strdup_printf("%s%s\t%s",
|
||||
vdata->report ? vdata->report : "",
|
||||
vdata->report ? "\n" : "",
|
||||
report->report);
|
||||
vdata->report ? vdata->report : "",
|
||||
vdata->report ? "\n" : "",
|
||||
report->report);
|
||||
|
||||
if (vdata->combined_status == MU_MSG_PART_SIG_STATUS_BAD ||
|
||||
vdata->combined_status == MU_MSG_PART_SIG_STATUS_ERROR)
|
||||
@ -536,16 +536,16 @@ cmd_init(const MuConfig* opts, GError** err)
|
||||
/* not provided, nor could we find a good default */
|
||||
if (!opts->maildir) {
|
||||
mu_util_g_set_error(err,
|
||||
MU_ERROR_IN_PARAMETERS,
|
||||
"missing --maildir parameter and could "
|
||||
"not determine default");
|
||||
MU_ERROR_IN_PARAMETERS,
|
||||
"missing --maildir parameter and could "
|
||||
"not determine default");
|
||||
return MU_ERROR_IN_PARAMETERS;
|
||||
}
|
||||
|
||||
if (opts->max_msg_size < 0) {
|
||||
mu_util_g_set_error(err,
|
||||
MU_ERROR_IN_PARAMETERS,
|
||||
"invalid value for max-message-size");
|
||||
MU_ERROR_IN_PARAMETERS,
|
||||
"invalid value for max-message-size");
|
||||
return MU_ERROR_IN_PARAMETERS;
|
||||
} else if (opts->batch_size < 0) {
|
||||
mu_util_g_set_error(err, MU_ERROR_IN_PARAMETERS, "invalid value for batch-size");
|
||||
@ -585,9 +585,9 @@ show_usage(void)
|
||||
{
|
||||
g_print("usage: mu command [options] [parameters]\n");
|
||||
g_print("where command is one of index, find, cfind, view, mkdir, "
|
||||
"extract, add, remove, script, verify or server\n");
|
||||
"extract, add, remove, script, verify or server\n");
|
||||
g_print("see the mu, mu-<command> or mu-easy manpages for "
|
||||
"more information\n");
|
||||
"more information\n");
|
||||
}
|
||||
|
||||
typedef MuError (*readonly_store_func)(const Mu::Store&, const MuConfig*, GError** err);
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
#include <glib.h>
|
||||
#include <sys/types.h> /* for mode_t */
|
||||
#include <mu-message.hh>
|
||||
#include <message/mu-message.hh>
|
||||
#include <mu-msg.hh>
|
||||
#include <utils/mu-util.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user