mirror of https://github.com/djcb/mu.git
update for lib/utils split
Update sources with the new paths
This commit is contained in:
parent
e5337e7658
commit
b55e191421
|
@ -33,7 +33,6 @@
|
|||
#include <errno.h>
|
||||
|
||||
#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 */
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <glib.h>
|
||||
#include <mu-util.h> /* for MuResult */
|
||||
#include <utils/mu-util.h>
|
||||
#include <mu-store.hh>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
|
|
@ -33,9 +33,8 @@
|
|||
#include <errno.h>
|
||||
#include <glib/gprintf.h>
|
||||
|
||||
#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"
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <glib.h>
|
||||
#include <time.h>
|
||||
#include <sys/types.h> /* for mode_t */
|
||||
#include <mu-util.h>
|
||||
#include <utils/mu-util.h>
|
||||
#include <mu-flags.h>
|
||||
|
||||
|
||||
|
|
|
@ -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 <gmime/gmime.h>
|
||||
#include <gmime/gmime-multipart-signed.h>
|
||||
|
|
|
@ -23,11 +23,12 @@
|
|||
#include <errno.h>
|
||||
#include <xapian.h>
|
||||
|
||||
#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 {
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#define __MU_MSG_DOC_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <mu-util.h> /* for XapianDocument */
|
||||
#include <utils/mu-util.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
|
|
@ -28,12 +28,13 @@
|
|||
#include <inttypes.h>
|
||||
|
||||
#include <gmime/gmime.h>
|
||||
#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);
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <set>
|
||||
#include <map>
|
||||
|
||||
#include "mu-util.h"
|
||||
#include "utils/mu-util.h"
|
||||
#include "mu-msg.h"
|
||||
#include "mu-msg-iter.h"
|
||||
#include "mu-threader.h"
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#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"
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "mu-str.h"
|
||||
#include "utils/mu-str.h"
|
||||
#include "mu-msg.h"
|
||||
#include "mu-msg-iter.h"
|
||||
#include "mu-msg-part.h"
|
||||
|
|
71
lib/mu-msg.c
71
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 <hello@world.xx>, 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));
|
||||
}
|
||||
|
|
45
lib/mu-msg.h
45
lib/mu-msg.h
|
@ -24,7 +24,7 @@
|
|||
#include <mu-flags.h>
|
||||
#include <mu-msg-fields.h>
|
||||
#include <mu-msg-prio.h>
|
||||
#include <mu-util.h> /* for MuError and XapianDocument */
|
||||
#include <utils/mu-util.h>
|
||||
|
||||
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" <foo@bar.com>
|
||||
* 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__*/
|
||||
|
|
|
@ -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 <parser/proc-iface.hh>
|
||||
#include <parser/utils.hh>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <glib.h>
|
||||
#include <mu-store.hh>
|
||||
#include <mu-msg-iter.h>
|
||||
#include <mu-util.h>
|
||||
#include <utils/mu-util.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
#include "mu-runtime.h"
|
||||
#include "mu-util.h"
|
||||
#include "utils/mu-util.h"
|
||||
|
||||
#include <locale.h> /* for setlocale() */
|
||||
|
||||
|
@ -26,8 +26,6 @@
|
|||
#include <unordered_map>
|
||||
static std::unordered_map<MuRuntimePath, std::string> RuntimePaths;
|
||||
|
||||
#include "mu-log.h"
|
||||
|
||||
constexpr auto PartsDir = "parts";
|
||||
constexpr auto LogDir = "log";
|
||||
constexpr auto XapianDir = "xapian";
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#define __MU_RUNTIME_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <mu-log.h>
|
||||
#include <utils/mu-log.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
|
|
@ -34,9 +34,9 @@
|
|||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#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.
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <atomic>
|
||||
|
||||
#include "mu-store.hh"
|
||||
#include "mu-str.h"
|
||||
#include "utils/mu-str.h"
|
||||
#include "mu-msg-part.h"
|
||||
#include "parser/utils.hh"
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ private:
|
|||
#include <glib.h>
|
||||
#include <inttypes.h>
|
||||
#include <mu-msg.h>
|
||||
#include <mu-util.h> /* for MuError, MuError */
|
||||
#include <utils/mu-util.h>
|
||||
#include <mu-contacts.hh>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
|
|
@ -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 '<none>' works around a crash; find a better
|
||||
* solution */
|
||||
c = g_hash_table_lookup (id_table, msgid);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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\" <aap@noot.mies>", "Foo Bar"},
|
||||
{ "Foo Bar <aap@noot.mies>", "Foo Bar" },
|
||||
{ "<aap@noot.mies>", "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,
|
||||
|
|
|
@ -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 <hello@world.xx>, 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*
|
||||
|
|
|
@ -22,12 +22,10 @@
|
|||
#ifndef __MU_STR_H__
|
||||
#define __MU_STR_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <mu-msg.h>
|
||||
#include <mu-flags.h>
|
||||
|
||||
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" <foo@bar.com>
|
||||
* 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
|
||||
|
|
|
@ -30,11 +30,7 @@
|
|||
|
||||
#include <locale.h>
|
||||
|
||||
#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\" <aap@noot.mies>", "Foo Bar"},
|
||||
{ "Foo Bar <aap@noot.mies>", "Foo Bar" },
|
||||
{ "<aap@noot.mies>", "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 ();
|
||||
}
|
||||
|
|
|
@ -28,8 +28,7 @@
|
|||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
|
||||
#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 ();
|
||||
}
|
||||
|
|
|
@ -24,12 +24,13 @@
|
|||
#include <ctype.h>
|
||||
|
||||
#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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
#include <signal.h>
|
||||
|
||||
#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"
|
||||
|
||||
|
|
|
@ -31,12 +31,13 @@
|
|||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#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;
|
||||
|
||||
|
|
|
@ -30,10 +30,11 @@
|
|||
#include <errno.h>
|
||||
|
||||
#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: "
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "mu-util.h"
|
||||
#include "mu-config.h"
|
||||
#include "mu-cmd.h"
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <sys/types.h> /* for mode_t */
|
||||
#include <mu-msg-fields.h>
|
||||
#include <mu-msg.h>
|
||||
#include <mu-util.h>
|
||||
#include <utils/mu-util.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
#include "mu-msg-header-view.h"
|
||||
|
||||
#include <mu-str.h>
|
||||
#include <mu-date.h>
|
||||
#include <utils/mu-str.h>
|
||||
#include <utils/mu-date.h>
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#define __MUG_MSG_LIST_VIEW_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <mu-util.h>
|
||||
#include <utils/mu-util.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
/* convenience macros */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <gdk/gdkkeysyms.h>
|
||||
#include <string.h> /* for memset */
|
||||
|
||||
#include <mu-util.h>
|
||||
#include <utils/mu-util.h>
|
||||
#include <mu-store.hh>
|
||||
#include <mu-runtime.h>
|
||||
#include <mu-index.h>
|
||||
|
|
Loading…
Reference in New Issue