diff --git a/configure.ac b/configure.ac index e806f20f..e7a3d858 100644 --- a/configure.ac +++ b/configure.ac @@ -42,11 +42,12 @@ AC_PROG_CC_C99 AC_PROG_INSTALL AC_HEADER_STDC -extra_flags="-Wformat-security \ - -Wstack-protector \ - -Wstack-protector-all \ - -Wno-cast-function-type \ - -Wno-bad-function-cast" +extra_flags="-Wformat-security \ + -Wstack-protector \ + -Wstack-protector-all \ + -Wno-cast-function-type \ + -Wno-bad-function-cast \ + -Wno-switch-enum" AX_CXX_COMPILE_STDCXX_17 AX_COMPILER_FLAGS_CXXFLAGS([],[],[${extra_cflags}]) @@ -276,6 +277,7 @@ mu/Makefile lib/Makefile lib/doxyfile lib/utils/Makefile +lib/message/Makefile lib/index/Makefile mu4e/Makefile mu4e/mu4e-meta.el diff --git a/lib/Makefile.am b/lib/Makefile.am index 410d58f9..e9cfdd7e 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -18,7 +18,7 @@ # before descending into tests/ include $(top_srcdir)/gtest.mk -SUBDIRS= utils index +SUBDIRS= utils message index TESTDEFS= \ -DMU_TESTMAILDIR=\"${abs_srcdir}/testdir\" \ @@ -91,8 +91,6 @@ libmu_la_SOURCES= \ mu-msg-crypto.cc \ mu-msg-doc.cc \ mu-msg-doc.hh \ - mu-msg-fields.c \ - mu-message-fields.hh \ mu-msg-file.cc \ mu-msg-file.hh \ mu-msg-part.cc \ @@ -100,18 +98,14 @@ libmu_la_SOURCES= \ mu-msg-priv.hh \ mu-msg-sexp.cc \ mu-msg.cc \ - mu-msg.hh \ - mu-message-flags.hh \ - mu-message-flags.cc \ - mu-message-priority.hh \ - mu-message-priority.cc - + mu-msg.hh libmu_la_LIBADD= \ $(XAPIAN_LIBS) \ $(GMIME_LIBS) \ $(GLIB_LIBS) \ $(GUILE_LIBS) \ + ${builddir}/message/libmu-message.la \ ${builddir}/index/libmu-index.la \ $(CODE_COVERAGE_LIBS) diff --git a/lib/message/mu-message-part.cc b/lib/message/mu-message-part.cc index 1126db27..33d548d8 100644 --- a/lib/message/mu-message-part.cc +++ b/lib/message/mu-message-part.cc @@ -20,7 +20,7 @@ #include "mu-message-part.hh" #include "mu-mime-object.hh" -#include "mu-utils.hh" +#include "utils/mu-utils.hh" using namespace Mu; diff --git a/lib/message/mu-mime-object.cc b/lib/message/mu-mime-object.cc index 862dbf79..8e56cbf6 100644 --- a/lib/message/mu-mime-object.cc +++ b/lib/message/mu-mime-object.cc @@ -20,7 +20,7 @@ #include "mu-mime-object.hh" #include "gmime/gmime-message.h" -#include "mu-utils.hh" +#include "utils/mu-utils.hh" #include #include diff --git a/lib/mu-msg-doc.cc b/lib/mu-msg-doc.cc index 068c7941..6d2a522b 100644 --- a/lib/mu-msg-doc.cc +++ b/lib/mu-msg-doc.cc @@ -23,7 +23,7 @@ #include #include -#include "mu-message.hh" +#include "message/mu-message.hh" #include "mu-msg-doc.hh" #include "utils/mu-util.h" diff --git a/lib/mu-msg-doc.hh b/lib/mu-msg-doc.hh index 1f2689a1..17834baa 100644 --- a/lib/mu-msg-doc.hh +++ b/lib/mu-msg-doc.hh @@ -22,7 +22,7 @@ #include #include -#include "mu-message.hh" +#include namespace Mu { diff --git a/lib/mu-msg-file.hh b/lib/mu-msg-file.hh index 7d0561c8..91507d24 100644 --- a/lib/mu-msg-file.hh +++ b/lib/mu-msg-file.hh @@ -20,7 +20,7 @@ #ifndef MU_MSG_FILE_HH__ #define MU_MSG_FILE_HH__ -#include "mu-message.hh" +#include "message/mu-message.hh" namespace Mu { diff --git a/lib/mu-parser.cc b/lib/mu-parser.cc index bf758464..f75aa793 100644 --- a/lib/mu-parser.cc +++ b/lib/mu-parser.cc @@ -19,13 +19,11 @@ #include "mu-parser.hh" #include -#include - #include "mu-tokenizer.hh" #include "utils/mu-utils.hh" #include "utils/mu-error.hh" -#include "mu-message.hh" +#include "message/mu-message.hh" using namespace Mu; diff --git a/lib/mu-server.cc b/lib/mu-server.cc index bafb116f..a4bdc00b 100644 --- a/lib/mu-server.cc +++ b/lib/mu-server.cc @@ -19,7 +19,7 @@ #include "config.h" -#include "mu-message.hh" +#include "message/mu-message.hh" #include "mu-msg.hh" #include "mu-server.hh" diff --git a/toys/mug/mu-msg-header-view.cc b/toys/mug/mu-msg-header-view.cc index be3dfd73..8fa12515 100644 --- a/toys/mug/mu-msg-header-view.cc +++ b/toys/mug/mu-msg-header-view.cc @@ -21,7 +21,7 @@ #include "mu-msg.hh" #include -#include +#include using namespace Mu; @@ -62,17 +62,17 @@ mu_msg_header_view_class_init(MuMsgHeaderViewClass* klass) g_type_class_add_private(gobject_class, sizeof(MuMsgHeaderViewPrivate)); /* signal definitions go here, e.g.: */ - /* signals[MY_SIGNAL_1] = */ - /* g_signal_new ("my_signal_1",....); */ - /* signals[MY_SIGNAL_2] = */ - /* g_signal_new ("my_signal_2",....); */ - /* etc. */ + /* signals[MY_SIGNAL_1] = */ + /* g_signal_new ("my_signal_1",....); */ + /* signals[MY_SIGNAL_2] = */ + /* g_signal_new ("my_signal_2",....); */ + /* etc. */ } static void mu_msg_header_view_init(MuMsgHeaderView* obj) { - /* static GtkBoxClass *parent_class = NULL; */ + /* static GtkBoxClass *parent_class = NULL; */ obj->_priv = MU_MSG_HEADER_VIEW_GET_PRIVATE(obj); obj->_priv->_grid = NULL; } @@ -155,7 +155,8 @@ get_grid(Mu::MuMsg* msg) ++row; if (add_row(grid, row, "Subject", mu_msg_get_subject(msg), TRUE)) ++row; - if (add_row(grid, row, "Date", mu_date_str_s("%c", mu_msg_get_date(msg)), TRUE)) + if (add_row(grid, row, "Date", + time_to_string("%c", mu_msg_get_date(msg)).c_str(), TRUE)) ++row; return grid; diff --git a/toys/mug/mug-msg-list-view.cc b/toys/mug/mug-msg-list-view.cc index 036375de..631a8621 100644 --- a/toys/mug/mug-msg-list-view.cc +++ b/toys/mug/mug-msg-list-view.cc @@ -1,5 +1,5 @@ /* -** Copyright (C) 2008-2020 Dirk-Jan C. Binnema +** Copyright (C) 2008-2022 Dirk-Jan C. Binnema ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the @@ -18,10 +18,9 @@ */ #include "mug-msg-list-view.h" -#include "mu-message-flags.hh" +#include "message/mu-message.hh" #include "mu-query.hh" #include "utils/mu-str.h" -#include "utils/mu-date.h" using namespace Mu; @@ -123,18 +122,18 @@ treecell_func(GtkTreeViewColumn* tree_column, gpointer data) { - MessageFlags flags; - MessagePriority prio; + Flags flags; + Priority prio; gtk_tree_model_get(tree_model, iter, MUG_COL_FLAGS, &flags, MUG_COL_PRIO, &prio, -1); g_object_set(G_OBJECT(renderer), "weight", - any_of(flags & MessageFlags::New) ? 800 : 400, + any_of(flags & Flags::New) ? 800 : 400, "weight", - any_of(flags & MessageFlags::Seen) ? 400 : 800, + any_of(flags & Flags::Seen) ? 400 : 800, "foreground", - prio == MessagePriority::High ? "red" : NULL, + prio == Priority::High ? "red" : NULL, NULL); } @@ -317,17 +316,17 @@ run_query(const char* xpath, const char* expr, MugMsgListView* self) static void add_row(GtkTreeStore* store, MuMsg* msg, GtkTreeIter* treeiter) { - const gchar *datestr; gchar * from, *to; time_t timeval; std::string flag_str; timeval = mu_msg_get_date(msg); - datestr = timeval == 0 ? "-" : mu_date_display_s(timeval); + const auto datestr{timeval == 0 ? + std::string{"-"} : time_to_string("%c", timeval)}; from = empty_or_display_contact(mu_msg_get_from(msg)); to = empty_or_display_contact(mu_msg_get_to(msg)); - flag_str = message_flags_to_string(mu_msg_get_flags(msg)); + flag_str = flags_to_string(mu_msg_get_flags(msg)); /* if (0) { */ /* GtkTreeIter myiter; */ @@ -358,7 +357,7 @@ add_row(GtkTreeStore* store, MuMsg* msg, GtkTreeIter* treeiter) MUG_COL_FLAGS, mu_msg_get_flags(msg), MUG_COL_TIME, - timeval, + datestr.c_str(), -1); g_free(from); g_free(to);