diff --git a/lib/mu-index.c b/lib/mu-index.c index 73a25c35..24f425f2 100644 --- a/lib/mu-index.c +++ b/lib/mu-index.c @@ -33,7 +33,6 @@ #include #include "mu-maildir.h" -#include "mu-util.h" #define MU_LAST_USED_MAILDIR_KEY "last_used_maildir" #define MU_INDEX_MAX_FILE_SIZE (500*1000*1000) /* 500 Mb */ diff --git a/lib/mu-index.h b/lib/mu-index.h index e4acdaf9..7a93fbf4 100644 --- a/lib/mu-index.h +++ b/lib/mu-index.h @@ -24,7 +24,7 @@ #include #include -#include /* for MuResult */ +#include #include G_BEGIN_DECLS diff --git a/lib/mu-maildir.c b/lib/mu-maildir.c index 1495c11e..03724fae 100644 --- a/lib/mu-maildir.c +++ b/lib/mu-maildir.c @@ -33,9 +33,8 @@ #include #include -#include "mu-util.h" #include "mu-maildir.h" -#include "mu-str.h" +#include "utils/mu-str.h" #define MU_MAILDIR_NOINDEX_FILE ".noindex" #define MU_MAILDIR_NOUPDATE_FILE ".noupdate" diff --git a/lib/mu-maildir.h b/lib/mu-maildir.h index ad72c446..790c345b 100644 --- a/lib/mu-maildir.h +++ b/lib/mu-maildir.h @@ -23,7 +23,7 @@ #include #include #include /* for mode_t */ -#include +#include #include diff --git a/lib/mu-msg-crypto.c b/lib/mu-msg-crypto.c index a0cfe7a5..7fff1c4d 100644 --- a/lib/mu-msg-crypto.c +++ b/lib/mu-msg-crypto.c @@ -26,7 +26,7 @@ #include "mu-msg.h" #include "mu-msg-priv.h" #include "mu-msg-part.h" -#include "mu-date.h" +#include "utils/mu-date.h" #include #include diff --git a/lib/mu-msg-doc.cc b/lib/mu-msg-doc.cc index 3cd780d7..09c0b6da 100644 --- a/lib/mu-msg-doc.cc +++ b/lib/mu-msg-doc.cc @@ -23,11 +23,12 @@ #include #include -#include "mu-util.h" #include "mu-msg-fields.h" #include "mu-msg-doc.h" -#include "mu-str.h" -#include "mu-date.h" + +#include "utils/mu-util.h" +#include "utils/mu-str.h" +#include "utils/mu-date.h" struct _MuMsgDoc { diff --git a/lib/mu-msg-doc.h b/lib/mu-msg-doc.h index 03044f48..2f5fe5c4 100644 --- a/lib/mu-msg-doc.h +++ b/lib/mu-msg-doc.h @@ -21,7 +21,7 @@ #define __MU_MSG_DOC_H__ #include -#include /* for XapianDocument */ +#include G_BEGIN_DECLS diff --git a/lib/mu-msg-file.c b/lib/mu-msg-file.c index 01b2d339..c242a6fa 100644 --- a/lib/mu-msg-file.c +++ b/lib/mu-msg-file.c @@ -28,12 +28,13 @@ #include #include -#include "mu-util.h" -#include "mu-str.h" #include "mu-maildir.h" #include "mu-store.hh" #include "mu-msg-priv.h" +#include "utils/mu-util.h" +#include "utils/mu-str.h" + static gboolean init_file_metadata (MuMsgFile *self, const char* path, const char *mdir, GError **err); static gboolean init_mime_msg (MuMsgFile *msg, const char *path, GError **err); diff --git a/lib/mu-msg-iter.cc b/lib/mu-msg-iter.cc index f74804bf..84efa9c2 100644 --- a/lib/mu-msg-iter.cc +++ b/lib/mu-msg-iter.cc @@ -32,7 +32,7 @@ #include #include -#include "mu-util.h" +#include "utils/mu-util.h" #include "mu-msg.h" #include "mu-msg-iter.h" #include "mu-threader.h" diff --git a/lib/mu-msg-part.c b/lib/mu-msg-part.c index bf69301f..8601bb4d 100644 --- a/lib/mu-msg-part.c +++ b/lib/mu-msg-part.c @@ -25,8 +25,8 @@ #include #include -#include "mu-util.h" -#include "mu-str.h" +#include "utils/mu-util.h" +#include "utils/mu-str.h" #include "mu-msg-priv.h" #include "mu-msg-part.h" diff --git a/lib/mu-msg-sexp.c b/lib/mu-msg-sexp.c index 228a7b5f..eca13c8f 100644 --- a/lib/mu-msg-sexp.c +++ b/lib/mu-msg-sexp.c @@ -19,7 +19,7 @@ #include #include -#include "mu-str.h" +#include "utils/mu-str.h" #include "mu-msg.h" #include "mu-msg-iter.h" #include "mu-msg-part.h" diff --git a/lib/mu-msg.c b/lib/mu-msg.c index 5918e84e..d8b47f70 100644 --- a/lib/mu-msg.c +++ b/lib/mu-msg.c @@ -30,9 +30,7 @@ #include "mu-msg-priv.h" /* include before mu-msg.h */ #include "mu-msg.h" - -#include "mu-util.h" -#include "mu-str.h" +#include "utils/mu-str.h" #include "mu-maildir.h" @@ -937,3 +935,70 @@ mu_msg_tickle (MuMsg *self, GError **err) mu_msg_get_flags (self), FALSE, TRUE, err); } + +const char* +mu_str_flags_s (MuFlags flags) +{ + return mu_flags_to_str_s (flags, MU_FLAG_TYPE_ANY); +} + +char* +mu_str_flags (MuFlags flags) +{ + return g_strdup (mu_str_flags_s(flags)); +} + +static void +cleanup_contact (char *contact) +{ + char *c, *c2; + + /* replace "'<> with space */ + for (c2 = contact; *c2; ++c2) + if (*c2 == '"' || *c2 == '\'' || *c2 == '<' || *c2 == '>') + *c2 = ' '; + + /* remove everything between '()' if it's after the 5th pos; + * good to cleanup corporate contact address spam... */ + c = g_strstr_len (contact, -1, "("); + if (c && c - contact > 5) + *c = '\0'; + + g_strstrip (contact); +} + + +/* this is still somewhat simplistic... */ +const char* +mu_str_display_contact_s (const char *str) +{ + static gchar contact[255]; + gchar *c, *c2; + + str = str ? str : ""; + g_strlcpy (contact, str, sizeof(contact)); + + /* we check for '<', so we can strip out the address stuff in + * e.g. 'Hello World , but only if there is + * something alphanumeric before the < + */ + c = g_strstr_len (contact, -1, "<"); + if (c != NULL) { + for (c2 = contact; c2 < c && !(isalnum(*c2)); ++c2); + if (c2 != c) /* apparently, there was something, + * so we can remove the <... part*/ + *c = '\0'; + } + + cleanup_contact (contact); + + return contact; +} + +char* +mu_str_display_contact (const char *str) +{ + g_return_val_if_fail (str, NULL); + + return g_strdup (mu_str_display_contact_s (str)); +} diff --git a/lib/mu-msg.h b/lib/mu-msg.h index 234f5c87..e4842aa2 100644 --- a/lib/mu-msg.h +++ b/lib/mu-msg.h @@ -24,7 +24,7 @@ #include #include #include -#include /* for MuError and XapianDocument */ +#include G_BEGIN_DECLS @@ -606,6 +606,49 @@ typedef gboolean (*MuMsgContactForeachFunc) (MuMsgContact* contact, void mu_msg_contact_foreach (MuMsg *msg, MuMsgContactForeachFunc func, gpointer user_data); + + +/** + * create a 'display contact' from an email header To/Cc/Bcc/From-type address + * ie., turn + * "Foo Bar" + * into + * Foo Bar + * Note that this is based on some simple heuristics. Max length is 255 bytes. + * + * mu_str_display_contact_s returns a statically allocated + * buffer (ie, non-reentrant), while mu_str_display_contact + * returns a newly allocated string that you must free with g_free + * when done with it. + * + * @param str a 'contact str' (ie., what is in the To/Cc/Bcc/From + * fields), or NULL + * + * @return a newly allocated string with a display contact + */ +const char* mu_str_display_contact_s (const char *str) G_GNUC_CONST; +char *mu_str_display_contact (const char *str) G_GNUC_WARN_UNUSED_RESULT; + +/** + * get a display string for a given set of flags, OR'ed in + * @param flags; one character per flag: + * D=draft,F=flagged,N=new,P=passed,R=replied,S=seen,T=trashed + * a=has-attachment,s=signed, x=encrypted + * + * mu_str_file_flags_s returns a ptr to a static buffer, + * while mu_str_file_flags returns dynamically allocated + * memory that must be freed after use. + * + * @param flags file flags + * + * @return a string representation of the flags; see above + * for what to do with it + */ +const char* mu_str_flags_s (MuFlags flags) G_GNUC_CONST; +char* mu_str_flags (MuFlags flags) + G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; + + G_END_DECLS #endif /*__MU_MSG_H__*/ diff --git a/lib/mu-query.cc b/lib/mu-query.cc index a1ce42de..09747138 100644 --- a/lib/mu-query.cc +++ b/lib/mu-query.cc @@ -32,9 +32,8 @@ #include "mu-msg-iter.h" -#include "mu-util.h" -#include "mu-str.h" -#include "mu-date.h" +#include "utils/mu-str.h" +#include "utils/mu-date.h" #include #include diff --git a/lib/mu-query.h b/lib/mu-query.h index 3cad88e7..45c835e6 100644 --- a/lib/mu-query.h +++ b/lib/mu-query.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include G_BEGIN_DECLS diff --git a/lib/mu-runtime.cc b/lib/mu-runtime.cc index 394acd5c..ff351640 100644 --- a/lib/mu-runtime.cc +++ b/lib/mu-runtime.cc @@ -18,7 +18,7 @@ */ #include "mu-runtime.h" -#include "mu-util.h" +#include "utils/mu-util.h" #include /* for setlocale() */ @@ -26,8 +26,6 @@ #include static std::unordered_map RuntimePaths; -#include "mu-log.h" - constexpr auto PartsDir = "parts"; constexpr auto LogDir = "log"; constexpr auto XapianDir = "xapian"; diff --git a/lib/mu-runtime.h b/lib/mu-runtime.h index 8794e705..2440f71a 100644 --- a/lib/mu-runtime.h +++ b/lib/mu-runtime.h @@ -21,7 +21,7 @@ #define __MU_RUNTIME_H__ #include -#include +#include G_BEGIN_DECLS diff --git a/lib/mu-script.c b/lib/mu-script.c index 584b4dd8..ba88b217 100644 --- a/lib/mu-script.c +++ b/lib/mu-script.c @@ -34,9 +34,9 @@ #include #include -#include "mu-str.h" +#include "utils/mu-str.h" #include "mu-script.h" -#include "mu-util.h" +#include "utils/mu-util.h" /** * Structure with information about a certain script. diff --git a/lib/mu-store.cc b/lib/mu-store.cc index 33f83032..558a8bf5 100644 --- a/lib/mu-store.cc +++ b/lib/mu-store.cc @@ -27,7 +27,7 @@ #include #include "mu-store.hh" -#include "mu-str.h" +#include "utils/mu-str.h" #include "mu-msg-part.h" #include "parser/utils.hh" diff --git a/lib/mu-store.hh b/lib/mu-store.hh index 1ab7a762..77f14f75 100644 --- a/lib/mu-store.hh +++ b/lib/mu-store.hh @@ -195,7 +195,7 @@ private: #include #include #include -#include /* for MuError, MuError */ +#include #include G_BEGIN_DECLS diff --git a/lib/mu-threader.c b/lib/mu-threader.c index 7836c131..ec163e5c 100644 --- a/lib/mu-threader.c +++ b/lib/mu-threader.c @@ -22,7 +22,7 @@ #include "mu-threader.h" #include "mu-container.h" -#include "mu-str.h" +#include "utils/mu-str.h" /* msg threading implementation based on JWZ's algorithm, as described in: * http://www.jwz.org/doc/threading.html @@ -157,7 +157,7 @@ find_or_create (GHashTable *id_table, MuMsg *msg, guint docid) MuContainer *c; const char* msgid; char fake[32]; - + g_return_val_if_fail (msg, NULL); g_return_val_if_fail (docid != 0, NULL); @@ -169,7 +169,7 @@ find_or_create (GHashTable *id_table, MuMsg *msg, guint docid) snprintf (fake, sizeof(fake), "fake:%p", (gpointer)msg); msgid = fake; } - + /* XXX the '' works around a crash; find a better * solution */ c = g_hash_table_lookup (id_table, msgid); diff --git a/lib/tests/Makefile.am b/lib/tests/Makefile.am index b0dc6cbb..839cd5a4 100644 --- a/lib/tests/Makefile.am +++ b/lib/tests/Makefile.am @@ -46,14 +46,6 @@ noinst_PROGRAMS= $(TEST_PROGS) noinst_LTLIBRARIES=libtestmucommon.la -TEST_PROGS += test-mu-util -test_mu_util_SOURCES= test-mu-util.c dummy.cc -test_mu_util_LDADD= libtestmucommon.la - -TEST_PROGS += test-mu-str -test_mu_str_SOURCES= test-mu-str.c dummy.cc -test_mu_str_LDADD= libtestmucommon.la - TEST_PROGS += test-mu-maildir test_mu_maildir_SOURCES= test-mu-maildir.c dummy.cc test_mu_maildir_LDADD= libtestmucommon.la diff --git a/lib/tests/test-mu-maildir.c b/lib/tests/test-mu-maildir.c index 2e0a127d..39521274 100644 --- a/lib/tests/test-mu-maildir.c +++ b/lib/tests/test-mu-maildir.c @@ -30,7 +30,7 @@ #include "test-mu-common.h" #include "mu-maildir.h" -#include "mu-util.h" +#include "utils/mu-util.h" static void test_mu_maildir_mkdir_01 (void) diff --git a/lib/tests/test-mu-msg.c b/lib/tests/test-mu-msg.c index d7b7671a..fef368b9 100644 --- a/lib/tests/test-mu-msg.c +++ b/lib/tests/test-mu-msg.c @@ -31,7 +31,7 @@ #include "test-mu-common.h" #include "mu-msg.h" -#include "mu-str.h" +#include "utils/mu-str.h" static MuMsg* @@ -491,6 +491,55 @@ test_mu_msg_comp_unix_programmer (void) mu_msg_unref (msg); } + + +static void +test_mu_str_prio_01 (void) +{ + g_assert_cmpstr(mu_msg_prio_name(MU_MSG_PRIO_LOW), ==, "low"); + g_assert_cmpstr(mu_msg_prio_name(MU_MSG_PRIO_NORMAL), ==, "normal"); + g_assert_cmpstr(mu_msg_prio_name(MU_MSG_PRIO_HIGH), ==, "high"); +} + + +static gboolean +ignore_error (const char* log_domain, GLogLevelFlags log_level, + const gchar* msg, gpointer user_data) +{ + return FALSE; /* don't abort */ +} + + +static void +test_mu_str_prio_02 (void) +{ + /* this must fail */ + g_test_log_set_fatal_handler ((GTestLogFatalFunc)ignore_error, NULL); + g_assert_cmpstr (mu_msg_prio_name(666), ==, NULL); +} + + + +static void +test_mu_str_display_contact (void) +{ + int i; + struct { + const char* word; + const char* disp; + } words [] = { + { "\"Foo Bar\" ", "Foo Bar"}, + { "Foo Bar ", "Foo Bar" }, + { "", "aap@noot.mies" }, + { "foo@bar.nl", "foo@bar.nl" } + }; + + for (i = 0; i != G_N_ELEMENTS(words); ++i) + g_assert_cmpstr (mu_str_display_contact_s (words[i].word), ==, + words[i].disp); +} + + int main (int argc, char *argv[]) { @@ -527,6 +576,17 @@ main (int argc, char *argv[]) g_test_add_func ("/mu-msg/mu-msg-comp-unix-programmer", test_mu_msg_comp_unix_programmer); + /* mu_str_prio */ + g_test_add_func ("/mu-str/mu-str-prio-01", + test_mu_str_prio_01); + g_test_add_func ("/mu-str/mu-str-prio-02", + test_mu_str_prio_02); + + + g_test_add_func ("/mu-str/mu-str-display_contact", + test_mu_str_display_contact); + + g_log_set_handler (NULL, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION, diff --git a/lib/utils/mu-str.c b/lib/utils/mu-str.c index 9d338771..79e3e320 100644 --- a/lib/utils/mu-str.c +++ b/lib/utils/mu-str.c @@ -31,8 +31,6 @@ #include "mu-util.h" /* PATH_MAX */ #include "mu-str.h" -#include "mu-msg-fields.h" - const char* mu_str_size_s (size_t s) @@ -54,17 +52,6 @@ mu_str_size (size_t s) return g_strdup (mu_str_size_s(s)); } -const char* -mu_str_flags_s (MuFlags flags) -{ - return mu_flags_to_str_s (flags, MU_FLAG_TYPE_ANY); -} - -char* -mu_str_flags (MuFlags flags) -{ - return g_strdup (mu_str_flags_s(flags)); -} char* mu_str_summarize (const char* str, size_t max_lines) @@ -108,60 +95,6 @@ mu_str_summarize (const char* str, size_t max_lines) } -static void -cleanup_contact (char *contact) -{ - char *c, *c2; - - /* replace "'<> with space */ - for (c2 = contact; *c2; ++c2) - if (*c2 == '"' || *c2 == '\'' || *c2 == '<' || *c2 == '>') - *c2 = ' '; - - /* remove everything between '()' if it's after the 5th pos; - * good to cleanup corporate contact address spam... */ - c = g_strstr_len (contact, -1, "("); - if (c && c - contact > 5) - *c = '\0'; - - g_strstrip (contact); -} - - -/* this is still somewhat simplistic... */ -const char* -mu_str_display_contact_s (const char *str) -{ - static gchar contact[255]; - gchar *c, *c2; - - str = str ? str : ""; - g_strlcpy (contact, str, sizeof(contact)); - - /* we check for '<', so we can strip out the address stuff in - * e.g. 'Hello World , but only if there is - * something alphanumeric before the < - */ - c = g_strstr_len (contact, -1, "<"); - if (c != NULL) { - for (c2 = contact; c2 < c && !(isalnum(*c2)); ++c2); - if (c2 != c) /* apparently, there was something, - * so we can remove the <... part*/ - *c = '\0'; - } - - cleanup_contact (contact); - - return contact; -} - -char* -mu_str_display_contact (const char *str) -{ - g_return_val_if_fail (str, NULL); - - return g_strdup (mu_str_display_contact_s (str)); -} char* diff --git a/lib/utils/mu-str.h b/lib/utils/mu-str.h index b673092e..bd985a22 100644 --- a/lib/utils/mu-str.h +++ b/lib/utils/mu-str.h @@ -22,12 +22,10 @@ #ifndef __MU_STR_H__ #define __MU_STR_H__ +#include #include #include -#include -#include - G_BEGIN_DECLS /** @@ -36,28 +34,6 @@ G_BEGIN_DECLS * @{ */ -/** - * create a 'display contact' from an email header To/Cc/Bcc/From-type address - * ie., turn - * "Foo Bar" - * into - * Foo Bar - * Note that this is based on some simple heuristics. Max length is 255 bytes. - * - * mu_str_display_contact_s returns a statically allocated - * buffer (ie, non-reentrant), while mu_str_display_contact - * returns a newly allocated string that you must free with g_free - * when done with it. - * - * @param str a 'contact str' (ie., what is in the To/Cc/Bcc/From - * fields), or NULL - * - * @return a newly allocated string with a display contact - */ -const char* mu_str_display_contact_s (const char *str) G_GNUC_CONST; -char *mu_str_display_contact (const char *str) G_GNUC_WARN_UNUSED_RESULT; - - /** * get a display size for a given size_t; uses M for sizes > * 1000*1000, k for smaller sizes. Note: this function use the @@ -88,25 +64,6 @@ char* mu_str_size (size_t s) G_GNUC_WARN_UNUSED_RESULT; char *mu_str_replace (const char *str, const char *substr, const char *repl); -/** - * get a display string for a given set of flags, OR'ed in - * @param flags; one character per flag: - * D=draft,F=flagged,N=new,P=passed,R=replied,S=seen,T=trashed - * a=has-attachment,s=signed, x=encrypted - * - * mu_str_file_flags_s returns a ptr to a static buffer, - * while mu_str_file_flags returns dynamically allocated - * memory that must be freed after use. - * - * @param flags file flags - * - * @return a string representation of the flags; see above - * for what to do with it - */ -const char* mu_str_flags_s (MuFlags flags) G_GNUC_CONST; -char* mu_str_flags (MuFlags flags) - G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; - /** * get a 'summary' of the string, ie. the first /n/ lines of the * strings, with all newlines removed, replaced by single spaces diff --git a/lib/utils/test-mu-str.c b/lib/utils/test-mu-str.c index ecba8fbf..f8b3cd04 100644 --- a/lib/utils/test-mu-str.c +++ b/lib/utils/test-mu-str.c @@ -30,11 +30,7 @@ #include -#include "test-mu-common.h" #include "mu-str.h" -#include "mu-msg-prio.h" - - static void @@ -76,34 +72,6 @@ test_mu_str_size_02 (void) -static void -test_mu_str_prio_01 (void) -{ - g_assert_cmpstr(mu_msg_prio_name(MU_MSG_PRIO_LOW), ==, "low"); - g_assert_cmpstr(mu_msg_prio_name(MU_MSG_PRIO_NORMAL), ==, "normal"); - g_assert_cmpstr(mu_msg_prio_name(MU_MSG_PRIO_HIGH), ==, "high"); -} - - -static gboolean -ignore_error (const char* log_domain, GLogLevelFlags log_level, - const gchar* msg, gpointer user_data) -{ - return FALSE; /* don't abort */ -} - - -static void -test_mu_str_prio_02 (void) -{ - /* this must fail */ - g_test_log_set_fatal_handler ((GTestLogFatalFunc)ignore_error, NULL); - g_assert_cmpstr (mu_msg_prio_name(666), ==, NULL); -} - - - - static void test_parse_arglist (void) { @@ -158,25 +126,6 @@ test_mu_str_esc_to_list (void) } -static void -test_mu_str_display_contact (void) -{ - int i; - struct { - const char* word; - const char* disp; - } words [] = { - { "\"Foo Bar\" ", "Foo Bar"}, - { "Foo Bar ", "Foo Bar" }, - { "", "aap@noot.mies" }, - { "foo@bar.nl", "foo@bar.nl" } - }; - - for (i = 0; i != G_N_ELEMENTS(words); ++i) - g_assert_cmpstr (mu_str_display_contact_s (words[i].word), ==, - words[i].disp); -} - static void assert_cmplst (GSList *lst, const char *items[]) @@ -333,16 +282,6 @@ main (int argc, char *argv[]) g_test_add_func ("/mu-str/mu-str-size-02", test_mu_str_size_02); - /* mu_str_prio */ - g_test_add_func ("/mu-str/mu-str-prio-01", - test_mu_str_prio_01); - g_test_add_func ("/mu-str/mu-str-prio-02", - test_mu_str_prio_02); - - - g_test_add_func ("/mu-str/mu-str-display_contact", - test_mu_str_display_contact); - g_test_add_func ("/mu-str/mu-str-from-list", test_mu_str_from_list); g_test_add_func ("/mu-str/mu-str-to-list", @@ -362,13 +301,6 @@ main (int argc, char *argv[]) g_test_add_func ("/mu-str/mu_str_remove_ctrl_in_place", test_mu_str_remove_ctrl_in_place); - /* FIXME: add tests for mu_str_flags; but note the - * function simply calls mu_msg_field_str */ - - g_log_set_handler (NULL, - G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| - G_LOG_FLAG_RECURSION, - (GLogFunc)black_hole, NULL); return g_test_run (); } diff --git a/lib/utils/test-mu-util.c b/lib/utils/test-mu-util.c index 7986aeb0..f3b02779 100644 --- a/lib/utils/test-mu-util.c +++ b/lib/utils/test-mu-util.c @@ -28,8 +28,7 @@ #include #include -#include "test-mu-common.h" -#include "lib/mu-util.h" +#include "mu-util.h" static void test_mu_util_dir_expand_00 (void) @@ -245,11 +244,5 @@ main (int argc, char *argv[]) g_test_add_func ("/mu-util/mu-util-program-in-path", test_mu_util_program_in_path); - - g_log_set_handler (NULL, - G_LOG_LEVEL_DEBUG| - G_LOG_LEVEL_MESSAGE| - G_LOG_LEVEL_INFO, (GLogFunc)black_hole, NULL); - return g_test_run (); } diff --git a/mu/mu-cmd-cfind.c b/mu/mu-cmd-cfind.c index 44de4930..9341b423 100644 --- a/mu/mu-cmd-cfind.c +++ b/mu/mu-cmd-cfind.c @@ -24,12 +24,13 @@ #include #include "mu-cmd.h" -#include "mu-util.h" -#include "mu-str.h" -#include "mu-date.h" #include "mu-contacts.hh" #include "mu-runtime.h" +#include "utils/mu-util.h" +#include "utils/mu-str.h" +#include "utils/mu-date.h" + /** * guess the last name for the given name; clearly, * this is just a rough guess for setting an initial value. diff --git a/mu/mu-cmd-extract.c b/mu/mu-cmd-extract.c index 60d2bd35..f0b90bcf 100644 --- a/mu/mu-cmd-extract.c +++ b/mu/mu-cmd-extract.c @@ -29,9 +29,8 @@ #include "mu-msg.h" #include "mu-msg-part.h" #include "mu-cmd.h" -#include "mu-util.h" -#include "mu-str.h" - +#include "utils/mu-util.h" +#include "utils/mu-str.h" static gboolean diff --git a/mu/mu-cmd-find.c b/mu/mu-cmd-find.c index d5e7320d..fbca90ad 100644 --- a/mu/mu-cmd-find.c +++ b/mu/mu-cmd-find.c @@ -29,8 +29,6 @@ #include #include "mu-msg.h" -#include "mu-str.h" -#include "mu-date.h" #include "mu-maildir.h" #include "mu-index.h" #include "mu-query.h" @@ -38,7 +36,10 @@ #include "mu-bookmarks.h" #include "mu-runtime.h" -#include "mu-util.h" +#include "utils/mu-util.h" +#include "utils/mu-str.h" +#include "utils/mu-date.h" + #include "mu-cmd.h" #include "mu-threader.h" diff --git a/mu/mu-cmd-index.c b/mu/mu-cmd-index.c index 968c9b33..9bb062a6 100644 --- a/mu/mu-cmd-index.c +++ b/mu/mu-cmd-index.c @@ -31,12 +31,13 @@ #include #include -#include "mu-util.h" #include "mu-msg.h" #include "mu-index.h" #include "mu-store.hh" #include "mu-runtime.h" -#include "mu-log.h" + +#include "utils/mu-util.h" +#include "utils/mu-log.h" static gboolean MU_CAUGHT_SIGNAL; diff --git a/mu/mu-cmd-script.c b/mu/mu-cmd-script.c index 808cf1b6..f43a26d9 100644 --- a/mu/mu-cmd-script.c +++ b/mu/mu-cmd-script.c @@ -30,10 +30,11 @@ #include #include "mu-cmd.h" -#include "mu-util.h" -#include "mu-str.h" #include "mu-script.h" +#include "utils/mu-util.h" +#include "utils/mu-str.h" + #define MU_GUILE_EXT ".scm" #define MU_GUILE_DESCR_PREFIX ";; INFO: " diff --git a/mu/mu-cmd-server.c b/mu/mu-cmd-server.c index 261b1fc9..70e8d952 100644 --- a/mu/mu-cmd-server.c +++ b/mu/mu-cmd-server.c @@ -44,7 +44,6 @@ #endif /*PATH_MAX */ #include "mu-runtime.h" -#include "mu-str.h" #include "mu-cmd.h" #include "mu-maildir.h" #include "mu-query.h" @@ -53,6 +52,8 @@ #include "mu-msg-part.h" #include "mu-contacts.hh" +#include "utils/mu-str.h" + /* signal handling *****************************************************/ /* * when we receive SIGINT, SIGHUP, SIGTERM, set MU_CAUGHT_SIGNAL to diff --git a/mu/mu-cmd.c b/mu/mu-cmd.c index 4b5d37ee..0146bc99 100644 --- a/mu/mu-cmd.c +++ b/mu/mu-cmd.c @@ -31,14 +31,15 @@ #include "mu-msg.h" #include "mu-msg-part.h" #include "mu-cmd.h" -#include "mu-util.h" -#include "mu-str.h" -#include "mu-date.h" #include "mu-maildir.h" #include "mu-contacts.hh" #include "mu-runtime.h" #include "mu-flags.h" -#include "mu-log.h" + +#include "utils/mu-log.h" +#include "utils/mu-util.h" +#include "utils/mu-str.h" +#include "utils/mu-date.h" #define VIEW_TERMINATOR '\f' /* form-feed */ diff --git a/mu/mu-config.c b/mu/mu-config.c index 839a1a04..1b9cd333 100644 --- a/mu/mu-config.c +++ b/mu/mu-config.c @@ -28,7 +28,6 @@ #include #include -#include "mu-util.h" #include "mu-config.h" #include "mu-cmd.h" diff --git a/mu/mu-config.h b/mu/mu-config.h index 5cbdf247..4192e4f1 100644 --- a/mu/mu-config.h +++ b/mu/mu-config.h @@ -26,7 +26,7 @@ #include /* for mode_t */ #include #include -#include +#include G_BEGIN_DECLS diff --git a/mu/tests/test-mu-query.c b/mu/tests/test-mu-query.c index 88086f8f..d492472a 100644 --- a/mu/tests/test-mu-query.c +++ b/mu/tests/test-mu-query.c @@ -33,7 +33,7 @@ #include "test-mu-common.h" #include "mu-query.h" -#include "mu-str.h" +#include "utils/mu-str.h" #include "mu-store.hh" static char* DB_PATH1 = NULL; diff --git a/mu/tests/test-mu-threads.c b/mu/tests/test-mu-threads.c index fd9f7e05..eaca2e11 100644 --- a/mu/tests/test-mu-threads.c +++ b/mu/tests/test-mu-threads.c @@ -32,7 +32,7 @@ #include "test-mu-common.h" #include "mu-query.h" -#include "mu-str.h" +#include "utils/mu-str.h" struct _tinfo { const char *threadpath; diff --git a/toys/mug/mu-msg-header-view.c b/toys/mug/mu-msg-header-view.c index 028b93b9..f1da5ac9 100644 --- a/toys/mug/mu-msg-header-view.c +++ b/toys/mug/mu-msg-header-view.c @@ -19,8 +19,8 @@ #include "mu-msg-header-view.h" -#include -#include +#include +#include #if HAVE_CONFIG_H #include diff --git a/toys/mug/mug-msg-list-view.c b/toys/mug/mug-msg-list-view.c index 99eaea9f..c265a15b 100644 --- a/toys/mug/mug-msg-list-view.c +++ b/toys/mug/mug-msg-list-view.c @@ -20,8 +20,8 @@ #include "mug-msg-list-view.h" #include "mu-query.h" -#include "mu-str.h" -#include "mu-date.h" +#include "utils/mu-str.h" +#include "utils/mu-date.h" #include "mu-threader.h" /* 'private'/'protected' functions */ diff --git a/toys/mug/mug-msg-list-view.h b/toys/mug/mug-msg-list-view.h index f410fc55..71b4260c 100644 --- a/toys/mug/mug-msg-list-view.h +++ b/toys/mug/mug-msg-list-view.h @@ -21,7 +21,7 @@ #define __MUG_MSG_LIST_VIEW_H__ #include -#include +#include G_BEGIN_DECLS /* convenience macros */ diff --git a/toys/mug/mug-msg-view.c b/toys/mug/mug-msg-view.c index 4b78cf9f..c91cfcc9 100644 --- a/toys/mug/mug-msg-view.c +++ b/toys/mug/mug-msg-view.c @@ -24,7 +24,7 @@ #include "mu-msg-view.h" #include "mug-msg-view.h" #include "mu-msg.h" -#include "mu-str.h" +#include "utils/mu-str.h" /* 'private'/'protected' functions */ static void mug_msg_view_class_init (MugMsgViewClass * klass); diff --git a/toys/mug/mug.c b/toys/mug/mug.c index 25c1f907..a95a87c3 100644 --- a/toys/mug/mug.c +++ b/toys/mug/mug.c @@ -25,7 +25,7 @@ #include #include /* for memset */ -#include +#include #include #include #include