mirror of https://github.com/djcb/mu.git
* refactoring: split src/ into mu/ and lib/
This commit is contained in:
parent
605657d4de
commit
46f10cfde9
|
@ -35,7 +35,7 @@ else
|
|||
emacs=
|
||||
endif
|
||||
|
||||
SUBDIRS=m4 man src $(widgets) $(guile) $(emacs) contrib toys
|
||||
SUBDIRS=m4 man lib $(widgets) $(guile) mu $(emacs) contrib toys
|
||||
|
||||
ACLOCAL_AMFLAGS=-I m4
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
AC_INIT([mu],[0.9.8.5-dev2],[http://code.google.com/p/mu0/issues/list],[mu])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_SRCDIR([src/mu.cc])
|
||||
AC_CONFIG_SRCDIR([mu/mu.cc])
|
||||
# libtoolize wants to put some stuff in here; if you have an old
|
||||
# autotools/libtool setup. you can try to comment this out
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
@ -291,8 +291,10 @@ AS_IF([test "x$PMCCABE" = "xno"],[
|
|||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
src/Makefile
|
||||
src/tests/Makefile
|
||||
mu/Makefile
|
||||
mu/tests/Makefile
|
||||
lib/Makefile
|
||||
lib/tests/Makefile
|
||||
widgets/Makefile
|
||||
emacs/Makefile
|
||||
emacs/mu4e-meta.el
|
||||
|
|
|
@ -25,7 +25,7 @@ AM_CXXFLAGS=-Wall -Wextra -Wno-unused-parameter
|
|||
# note, we need top_builddir for snarfing with 'make distcheck' (ie.,
|
||||
# with separate builddir)
|
||||
SUBDIRS= . mu examples
|
||||
INCLUDES=-I. -I${top_builddir} -I${top_srcdir}/src ${GUILE_CFLAGS} ${GLIB_CFLAGS}
|
||||
INCLUDES=-I. -I${top_builddir} -I${top_srcdir}/lib ${GUILE_CFLAGS} ${GLIB_CFLAGS}
|
||||
|
||||
# don't use -Werror, as it might break on other compilers
|
||||
# use -Wno-unused-parameters, because some callbacks may not
|
||||
|
@ -41,7 +41,7 @@ libguile_mu_la_SOURCES= \
|
|||
mu-guile-message.h
|
||||
|
||||
libguile_mu_la_LIBADD= \
|
||||
${top_builddir}/src/libmu.la \
|
||||
${top_builddir}/lib/libmu.la \
|
||||
${GUILE_LIBS}
|
||||
|
||||
XFILES= \
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 2011 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
** Copyright (C) 2011-2012 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
**
|
||||
** 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
|
||||
|
|
|
@ -32,32 +32,12 @@ INCLUDES=$(XAPIAN_CXXFLAGS) $(GMIME_CFLAGS) $(GLIB_CFLAGS)
|
|||
AM_CFLAGS=-Wall -Wextra -Wno-unused-parameter -Wdeclaration-after-statement -pedantic -Wno-variadic-macros
|
||||
AM_CXXFLAGS=-Wall -Wextra -Wno-unused-parameter
|
||||
|
||||
bin_PROGRAMS= \
|
||||
mu
|
||||
|
||||
noinst_LTLIBRARIES= \
|
||||
libmu.la
|
||||
|
||||
# note, mu.cc is only '.cc' and not '.c' because libmu must explicitly
|
||||
# be linked as c++, not c.
|
||||
mu_SOURCES= \
|
||||
mu.cc
|
||||
|
||||
mu_LDADD= \
|
||||
libmu.la
|
||||
|
||||
libmu_la_SOURCES= \
|
||||
mu-bookmarks.c \
|
||||
mu-bookmarks.h \
|
||||
mu-cmd-cfind.c \
|
||||
mu-cmd-extract.c \
|
||||
mu-cmd-find.c \
|
||||
mu-cmd-index.c \
|
||||
mu-cmd-server.c \
|
||||
mu-cmd.c \
|
||||
mu-cmd.h \
|
||||
mu-config.c \
|
||||
mu-config.h \
|
||||
mu-contacts.c \
|
||||
mu-contacts.h \
|
||||
mu-container.c \
|
|
@ -229,6 +229,15 @@ struct _PartInfo {
|
|||
typedef struct _PartInfo PartInfo;
|
||||
|
||||
|
||||
/* like the elvis operator,
|
||||
* http://colinharrington.net/blog/2008/10/groovy-elvis-operator/
|
||||
*/
|
||||
static const char*
|
||||
elvis (const char *s1, const char *s2)
|
||||
{
|
||||
return s1 ? s1 : s2;
|
||||
}
|
||||
|
||||
static void
|
||||
each_part (MuMsg *msg, MuMsgPart *part, PartInfo *pinfo)
|
||||
{
|
||||
|
@ -236,34 +245,31 @@ each_part (MuMsg *msg, MuMsgPart *part, PartInfo *pinfo)
|
|||
char *name, *tmp;
|
||||
char *tmpfile;
|
||||
|
||||
fname = mu_msg_part_file_name (part);
|
||||
if (!fname)
|
||||
if (!(fname = mu_msg_part_file_name (part)))
|
||||
fname = mu_msg_part_description (part);
|
||||
|
||||
if (fname)
|
||||
name = mu_str_escape_c_literal (fname, TRUE);
|
||||
else
|
||||
name = g_strdup_printf
|
||||
("\"%s-%s-%d\"",
|
||||
part->type ? part->type : "application",
|
||||
part->subtype ? part->subtype : "octet-stream",
|
||||
part->index);
|
||||
name = g_strdup_printf ("\"%s-%s-%d\"",
|
||||
elvis (part->type, "application"),
|
||||
elvis (part->subtype, "octet-stream"),
|
||||
part->index);
|
||||
|
||||
tmpfile = NULL;
|
||||
if (pinfo->want_images && g_ascii_strcasecmp (part->type, "image") == 0) {
|
||||
char *tmp;
|
||||
tmp = get_temp_file (msg, part->index);
|
||||
if (tmp) {
|
||||
if ((tmp = get_temp_file (msg, part->index))) {
|
||||
tmpfile = mu_str_escape_c_literal (tmp, TRUE);
|
||||
g_free (tmp);
|
||||
}
|
||||
}
|
||||
|
||||
tmp = g_strdup_printf
|
||||
("%s(:index %d :name %s :mime-type \"%s/%s\"%s%s :attachment %s :size %i)",
|
||||
pinfo->parts ? pinfo->parts : "", part->index, name,
|
||||
part->type ? part->type : "application",
|
||||
part->subtype ? part->subtype : "octet-stream",
|
||||
("%s(:index %d :name %s :mime-type \"%s/%s\"%s%s "
|
||||
":attachment %s :size %i)",
|
||||
elvis (pinfo->parts, ""), part->index, name,
|
||||
elvis (part->type, "application"),
|
||||
elvis (part->subtype, "octet-stream"),
|
||||
tmpfile ? " :temp" : "", tmpfile ? tmpfile : "",
|
||||
mu_msg_part_looks_like_attachment (part, TRUE) ? "t" : "nil",
|
||||
(int)part->size);
|
||||
|
@ -338,10 +344,6 @@ mu_msg_to_sexp (MuMsg *msg, unsigned docid, const MuMsgIterThreadInfo *ti,
|
|||
if (docid != 0)
|
||||
g_string_append_printf (gstr, "\t:docid %u\n", docid);
|
||||
|
||||
if (!header_only) /* force loading of file... should do this a bit
|
||||
* more elegantly */
|
||||
mu_msg_get_header (msg, "Reply-To");
|
||||
|
||||
append_sexp_contacts (gstr, msg);
|
||||
|
||||
if (ti)
|
||||
|
@ -351,8 +353,7 @@ mu_msg_to_sexp (MuMsg *msg, unsigned docid, const MuMsgIterThreadInfo *ti,
|
|||
|
||||
t = mu_msg_get_date (msg);
|
||||
/* weird time format for emacs 29-bit ints...*/
|
||||
g_string_append_printf (gstr,
|
||||
"\t:date (%u %u 0)\n", (unsigned)(t >> 16),
|
||||
g_string_append_printf (gstr,"\t:date (%u %u 0)\n", (unsigned)(t >> 16),
|
||||
(unsigned)(t & 0xffff));
|
||||
g_string_append_printf (gstr, "\t:size %u\n",
|
||||
(unsigned) mu_msg_get_size (msg));
|
||||
|
@ -366,7 +367,6 @@ mu_msg_to_sexp (MuMsg *msg, unsigned docid, const MuMsgIterThreadInfo *ti,
|
|||
append_sexp_flags (gstr, msg);
|
||||
|
||||
/* headers are retrieved from the database, views from the message file
|
||||
*
|
||||
* file attr things can only be gotten from the file (ie., mu
|
||||
* view), not from the database (mu find). */
|
||||
if (!header_only) {
|
||||
|
@ -375,6 +375,5 @@ mu_msg_to_sexp (MuMsg *msg, unsigned docid, const MuMsgIterThreadInfo *ti,
|
|||
}
|
||||
|
||||
g_string_append (gstr, ")\n");
|
||||
|
||||
return g_string_free (gstr, FALSE);
|
||||
}
|
|
@ -26,9 +26,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <mu-msg.h>
|
||||
|
||||
#include "mu-config.h"
|
||||
#include "mu-msg.h"
|
||||
#include "mu-log.h"
|
||||
#include "mu-util.h"
|
||||
|
||||
|
@ -41,7 +39,6 @@
|
|||
|
||||
struct _MuRuntimeData {
|
||||
gchar *_str[MU_RUNTIME_PATH_NUM];
|
||||
MuConfig *_config;
|
||||
gchar *_name; /* e.g., 'mu', 'mug' */
|
||||
};
|
||||
typedef struct _MuRuntimeData MuRuntimeData;
|
||||
|
@ -116,48 +113,6 @@ mu_runtime_init (const char* muhome_arg, const char *name)
|
|||
return _initialized = TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
gboolean
|
||||
mu_runtime_init_from_cmdline (int *pargc, char ***pargv, const char *name)
|
||||
{
|
||||
g_return_val_if_fail (!_initialized, FALSE);
|
||||
g_return_val_if_fail (name, FALSE);
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
g_type_init ();
|
||||
|
||||
_data = g_new0 (MuRuntimeData, 1);
|
||||
_data->_config = mu_config_init (pargc, pargv);
|
||||
if (!_data->_config) {
|
||||
runtime_free ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!mu_util_create_dir_maybe (_data->_config->muhome, 0700, TRUE)) {
|
||||
g_printerr ("mu: invalid mu homedir specified;"
|
||||
" use --muhome=<dir>\n");
|
||||
runtime_free ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
_data->_name = g_strdup (name);
|
||||
_data->_str[MU_RUNTIME_PATH_MUHOME] =
|
||||
g_strdup (_data->_config->muhome);
|
||||
init_paths (_data->_str[MU_RUNTIME_PATH_MUHOME], _data);
|
||||
|
||||
if (!init_log (runtime_path(MU_RUNTIME_PATH_MUHOME), name,
|
||||
_data->_config->log_stderr,
|
||||
_data->_config->quiet,
|
||||
_data->_config->debug)) {
|
||||
runtime_free ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return _initialized = TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
runtime_free (void)
|
||||
{
|
||||
|
@ -168,7 +123,7 @@ runtime_free (void)
|
|||
|
||||
g_free (_data->_name);
|
||||
|
||||
mu_config_uninit (_data->_config);
|
||||
/* mu_config_uninit (_data->_config); */
|
||||
|
||||
mu_log_uninit();
|
||||
|
||||
|
@ -252,10 +207,3 @@ mu_runtime_path (MuRuntimePath path)
|
|||
|
||||
return runtime_path (path);
|
||||
}
|
||||
|
||||
MuConfig*
|
||||
mu_runtime_config (void)
|
||||
{
|
||||
g_return_val_if_fail (_initialized, NULL);
|
||||
return _data->_config;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
||||
**
|
||||
**
|
||||
** Copyright (C) 2010 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify it
|
||||
|
@ -21,18 +21,17 @@
|
|||
#define __MU_RUNTIME_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <mu-config.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* initialize the mu runtime system; initializes logging and other
|
||||
* systems. To uninitialize, use mu_runtime_uninit
|
||||
*
|
||||
* @param muhome path where to find the mu home directory (typicaly, ~/.mu)
|
||||
*
|
||||
* @param muhome path where to find the mu home directory (typicaly, ~/.mu)
|
||||
* @param name of the main program, ie. 'mu', 'mug' or
|
||||
* 'procmule'. this influences the name of the e.g. the logfile
|
||||
*
|
||||
*
|
||||
* @return TRUE if succeeded, FALSE in case of error
|
||||
*/
|
||||
gboolean mu_runtime_init (const char *muhome, const char *name);
|
||||
|
@ -43,12 +42,12 @@ gboolean mu_runtime_init (const char *muhome, const char *name);
|
|||
* will parse the command line assuming the parameters of the 'mu'
|
||||
* program. Initializes logging and other systems. To uninitialize,
|
||||
* use mu_runtime_uninit
|
||||
*
|
||||
*
|
||||
* @param ptr to the param count (typically, argc)
|
||||
* @param ptr to the params (typically, argv)
|
||||
* @param name of the main program, ie. 'mu', 'mug' or
|
||||
* 'procmule'. this influences the name of the e.g. the logfile
|
||||
*
|
||||
*
|
||||
* @return TRUE if succeeded, FALSE in case of error
|
||||
*/
|
||||
gboolean mu_runtime_init_from_cmdline (int *pargc, char ***pargv,
|
||||
|
@ -56,8 +55,8 @@ gboolean mu_runtime_init_from_cmdline (int *pargc, char ***pargv,
|
|||
|
||||
|
||||
/**
|
||||
* free all resources
|
||||
*
|
||||
* free all resources
|
||||
*
|
||||
*/
|
||||
void mu_runtime_uninit (void);
|
||||
|
||||
|
@ -76,21 +75,12 @@ typedef enum _MuRuntimePath MuRuntimePath;
|
|||
|
||||
/**
|
||||
* get a file system path to some 'special' file or directory
|
||||
*
|
||||
*
|
||||
* @return ma string which should be not be modified/freed, or NULL in
|
||||
* case of error.
|
||||
*/
|
||||
const char* mu_runtime_path (MuRuntimePath path);
|
||||
|
||||
|
||||
/**
|
||||
* get the mu configuration options (ie., the parsed command line
|
||||
* parameters)
|
||||
*
|
||||
* @return the configuration options
|
||||
*/
|
||||
MuConfig* mu_runtime_config (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /*__MU_RUNTIME_H__*/
|
|
@ -25,8 +25,8 @@
|
|||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <mu-msg.h>
|
||||
#include <mu-flags.h>
|
||||
#include "lib/mu-msg.h"
|
||||
#include "lib/mu-flags.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
|
@ -19,11 +19,11 @@ include $(top_srcdir)/gtest.mk
|
|||
INCLUDES=$(XAPIAN_CXXFLAGS) \
|
||||
$(GMIME_CFLAGS) \
|
||||
$(GLIB_CFLAGS) \
|
||||
-I ${top_srcdir} -I ${top_srcdir}/src \
|
||||
-I ${top_srcdir} \
|
||||
-I ${top_srcdir}/lib \
|
||||
-DMU_TESTMAILDIR=\"${abs_srcdir}/testdir\" \
|
||||
-DMU_TESTMAILDIR2=\"${abs_srcdir}/testdir2\" \
|
||||
-DMU_TESTMAILDIR3=\"${abs_srcdir}/testdir3\" \
|
||||
-DMU_PROGRAM=\"${abs_top_builddir}/src/mu\" \
|
||||
-DABS_CURDIR=\"${abs_builddir}\" \
|
||||
-DABS_SRCDIR=\"${abs_srcdir}\"
|
||||
|
||||
|
@ -53,39 +53,14 @@ TEST_PROGS += test-mu-msg-fields
|
|||
test_mu_msg_fields_SOURCES= test-mu-msg-fields.c dummy.cc
|
||||
test_mu_msg_fields_LDADD= libtestmucommon.la
|
||||
|
||||
TEST_PROGS += test-mu-query
|
||||
test_mu_query_SOURCES= test-mu-query.c dummy.cc
|
||||
test_mu_query_LDADD= libtestmucommon.la
|
||||
|
||||
TEST_PROGS += test-mu-contacts
|
||||
test_mu_contacts_SOURCES= test-mu-contacts.c dummy.cc
|
||||
test_mu_contacts_LDADD= libtestmucommon.la
|
||||
|
||||
TEST_PROGS += test-mu-cmd
|
||||
test_mu_cmd_SOURCES= test-mu-cmd.c dummy.cc
|
||||
test_mu_cmd_LDADD= libtestmucommon.la
|
||||
|
||||
TEST_PROGS += test-mu-cmd-cfind
|
||||
test_mu_cmd_cfind_SOURCES= test-mu-cmd-cfind.c dummy.cc
|
||||
test_mu_cmd_cfind_LDADD= libtestmucommon.la
|
||||
|
||||
|
||||
TEST_PROGS += test-mu-msg
|
||||
test_mu_msg_SOURCES= test-mu-msg.c dummy.cc
|
||||
test_mu_msg_LDADD= libtestmucommon.la
|
||||
|
||||
TEST_PROGS += test-mu-runtime
|
||||
test_mu_runtime_SOURCES= test-mu-runtime.c dummy.cc
|
||||
test_mu_runtime_LDADD= libtestmucommon.la
|
||||
|
||||
TEST_PROGS += test-mu-store
|
||||
test_mu_store_SOURCES= test-mu-store.c dummy.cc
|
||||
test_mu_store_LDADD= libtestmucommon.la
|
||||
|
||||
TEST_PROGS += test-mu-threads
|
||||
test_mu_threads_SOURCES= test-mu-threads.c dummy.cc
|
||||
test_mu_threads_LDADD= libtestmucommon.la
|
||||
|
||||
TEST_PROGS += test-mu-date
|
||||
test_mu_date_SOURCES= test-mu-date.c dummy.cc
|
||||
test_mu_date_LDADD= libtestmucommon.la
|
||||
|
@ -94,22 +69,27 @@ TEST_PROGS += test-mu-flags
|
|||
test_mu_flags_SOURCES= test-mu-flags.c dummy.cc
|
||||
test_mu_flags_LDADD= libtestmucommon.la
|
||||
|
||||
# we need to use dummy.cc to enforce c++ linking...
|
||||
BUILT_SOURCES= \
|
||||
dummy.cc
|
||||
|
||||
dummy.cc:
|
||||
touch dummy.cc
|
||||
|
||||
# TEST_PROGS += test-mu-msg-file
|
||||
# test_mu_msg_file_SOURCES= test-mu-msg-file.c dummy.cc
|
||||
# test_mu_msg_file_LDADD= libtestmucommon.la
|
||||
#
|
||||
|
||||
libtestmucommon_la_SOURCES= \
|
||||
test-mu-common.c \
|
||||
test-mu-common.h
|
||||
libtestmucommon_la_LIBADD= ../libmu.la
|
||||
|
||||
|
||||
|
||||
|
||||
# note the question marks; make does not like files with ':', so we
|
||||
# use the (also supported) version with '!' instead. We could escape
|
||||
# the : with \: but automake does not recognize that....
|
||||
|
||||
# 12 messages, the '.ignore' message should be ignored
|
||||
# test messages, the '.ignore' message should be ignored
|
||||
# when indexing
|
||||
EXTRA_DIST= \
|
||||
testdir/tmp/1220863087.12663.ignore \
|
||||
|
@ -145,30 +125,4 @@ EXTRA_DIST= \
|
|||
testdir2/Foo/new/.noindex \
|
||||
testdir2/wom_bat/cur/atomic \
|
||||
testdir2/wom_bat/cur/rfc822.1 \
|
||||
testdir2/wom_bat/cur/rfc822.2 \
|
||||
testdir3/tree \
|
||||
testdir3/tree/new \
|
||||
testdir3/tree/new/.noindex \
|
||||
testdir3/tree/cur \
|
||||
testdir3/tree/cur/child0.1 \
|
||||
testdir3/tree/cur/root1 \
|
||||
testdir3/tree/cur/child3.0.0.0.0 \
|
||||
testdir3/tree/cur/child0.0 \
|
||||
testdir3/tree/cur/child4.1 \
|
||||
testdir3/tree/cur/child4.0 \
|
||||
testdir3/tree/cur/root2 \
|
||||
testdir3/tree/cur/child0.1.0 \
|
||||
testdir3/tree/cur/child2.0.0 \
|
||||
testdir3/tree/cur/root0 \
|
||||
testdir3/tree/tmp \
|
||||
testdir3/tree/tmp/.noindex \
|
||||
testdir3/cycle \
|
||||
testdir3/cycle/new \
|
||||
testdir3/cycle/new/.noindex \
|
||||
testdir3/cycle/cur \
|
||||
testdir3/cycle/cur/rogue0 \
|
||||
testdir3/cycle/cur/cycle0 \
|
||||
testdir3/cycle/cur/cycle0.0.0 \
|
||||
testdir3/cycle/cur/cycle0.0 \
|
||||
testdir3/cycle/tmp \
|
||||
testdir3/cycle/tmp/.noindex
|
||||
testdir2/wom_bat/cur/rfc822.2
|
|
@ -1,6 +1,6 @@
|
|||
/* -*-mode: c; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-*/
|
||||
|
||||
/*
|
||||
/*
|
||||
** Copyright (C) 2008-2010 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify it
|
||||
|
@ -15,8 +15,8 @@
|
|||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software Foundation,
|
||||
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**
|
||||
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
|
@ -31,7 +31,7 @@
|
|||
#include <locale.h>
|
||||
|
||||
#include "test-mu-common.h"
|
||||
#include "src/mu-date.h"
|
||||
#include "mu-date.h"
|
||||
|
||||
|
||||
static void
|
||||
|
@ -41,7 +41,7 @@ test_mu_date_str (void)
|
|||
char buf[64];
|
||||
gchar *tmp;
|
||||
time_t some_time;
|
||||
|
||||
|
||||
some_time = 1234567890;
|
||||
tmbuf = localtime (&some_time);
|
||||
strftime (buf, 64, "%x", tmbuf);
|
||||
|
@ -54,9 +54,9 @@ test_mu_date_str (void)
|
|||
tmbuf = localtime (&some_time);
|
||||
strftime (buf, 64, "%c", tmbuf);
|
||||
tmp = mu_date_str ("%c", some_time);
|
||||
|
||||
|
||||
g_assert_cmpstr (tmp, ==, buf);
|
||||
g_free (tmp);
|
||||
g_free (tmp);
|
||||
}
|
||||
|
||||
|
||||
|
@ -73,7 +73,7 @@ test_mu_date_parse_hdwmy (void)
|
|||
diff = time(NULL) - mu_date_parse_hdwmy ("5y");
|
||||
g_assert (diff > 0);
|
||||
g_assert_cmpuint (5 * 365 * 24 * 60 * 60 - diff, <=, 1);
|
||||
|
||||
|
||||
diff = time(NULL) - mu_date_parse_hdwmy ("3m");
|
||||
g_assert (diff > 0);
|
||||
g_assert_cmpuint (3 * 30 * 24 * 60 * 60 - diff, <=, 1);
|
||||
|
@ -81,13 +81,13 @@ test_mu_date_parse_hdwmy (void)
|
|||
diff = time(NULL) - mu_date_parse_hdwmy ("21d");
|
||||
g_assert (diff > 0);
|
||||
g_assert_cmpuint (21 * 24 * 60 * 60 - diff, <=, 1);
|
||||
|
||||
|
||||
diff = time(NULL) - mu_date_parse_hdwmy ("2w");
|
||||
g_assert (diff > 0);
|
||||
g_assert_cmpuint (2 * 7 * 24 * 60 * 60 - diff, <=, 1);
|
||||
|
||||
|
||||
g_assert_cmpint (mu_date_parse_hdwmy("-1y"),==, (time_t)-1);
|
||||
|
||||
|
||||
g_assert_cmpint (mu_date_parse_hdwmy("-1y"),==, (time_t)-1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -95,9 +95,9 @@ static void
|
|||
test_mu_date_complete_begin (void)
|
||||
{
|
||||
g_assert_cmpstr (mu_date_complete_s("2000", TRUE), ==,
|
||||
"20000101000000");
|
||||
"20000101000000");
|
||||
g_assert_cmpstr (mu_date_complete_s("2", TRUE), ==,
|
||||
"20000101000000");
|
||||
"20000101000000");
|
||||
g_assert_cmpstr (mu_date_complete_s ("", TRUE), ==,
|
||||
"00000101000000");
|
||||
g_assert_cmpstr (mu_date_complete_s ("201007", TRUE), ==,
|
||||
|
@ -113,9 +113,9 @@ static void
|
|||
test_mu_date_complete_end (void)
|
||||
{
|
||||
g_assert_cmpstr (mu_date_complete_s ("2000", FALSE), ==,
|
||||
"20001231235959");
|
||||
"20001231235959");
|
||||
g_assert_cmpstr (mu_date_complete_s ("2", FALSE), ==,
|
||||
"29991231235959");
|
||||
"29991231235959");
|
||||
g_assert_cmpstr (mu_date_complete_s ("", FALSE), ==,
|
||||
"99991231235959");
|
||||
g_assert_cmpstr (mu_date_complete_s ("201007", FALSE), ==,
|
||||
|
@ -134,7 +134,7 @@ test_mu_date_interpret_begin (void)
|
|||
{
|
||||
time_t now;
|
||||
now = time (NULL);
|
||||
|
||||
|
||||
g_assert_cmpstr (mu_date_interpret_s ("now", TRUE) , ==,
|
||||
mu_date_str_s("%Y%m%d%H%M%S", now));
|
||||
|
||||
|
@ -147,7 +147,7 @@ test_mu_date_interpret_end (void)
|
|||
{
|
||||
time_t now;
|
||||
now = time (NULL);
|
||||
|
||||
|
||||
g_assert_cmpstr (mu_date_interpret_s ("now", FALSE) , ==,
|
||||
mu_date_str_s("%Y%m%d%H%M%S", now));
|
||||
|
||||
|
@ -167,7 +167,7 @@ main (int argc, char *argv[])
|
|||
/* mu_str_date */
|
||||
g_test_add_func ("/mu-str/mu-date-str",
|
||||
test_mu_date_str);
|
||||
|
||||
|
||||
g_test_add_func ("/mu-str/mu_date_parse_hdwmy",
|
||||
test_mu_date_parse_hdwmy);
|
||||
g_test_add_func ("/mu-str/mu_date_complete_begin",
|
||||
|
@ -180,10 +180,10 @@ main (int argc, char *argv[])
|
|||
g_test_add_func ("/mu-str/mu_date_interpret_end",
|
||||
test_mu_date_interpret_end);
|
||||
|
||||
|
||||
|
||||
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 ();
|
||||
}
|
|
@ -23,7 +23,7 @@
|
|||
#endif /*HAVE_CONFIG_H*/
|
||||
|
||||
#include <glib.h>
|
||||
#include "src/mu-flags.h"
|
||||
#include "mu-flags.h"
|
||||
#include "test-mu-common.h"
|
||||
|
||||
|
|
@ -29,8 +29,8 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "test-mu-common.h"
|
||||
#include "src/mu-maildir.h"
|
||||
#include "src/mu-util.h"
|
||||
#include "mu-maildir.h"
|
||||
#include "mu-util.h"
|
||||
|
||||
static void
|
||||
test_mu_maildir_mkdir_01 (void)
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
** Copyright (C) 2008-2010 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify it
|
||||
|
@ -13,8 +13,8 @@
|
|||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software Foundation,
|
||||
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**
|
||||
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
|
@ -29,7 +29,7 @@
|
|||
#include <locale.h>
|
||||
|
||||
#include "test-mu-common.h"
|
||||
#include "src/mu-msg-fields.h"
|
||||
#include "mu-msg-fields.h"
|
||||
|
||||
static void
|
||||
test_mu_msg_field_body (void)
|
||||
|
@ -37,11 +37,11 @@ test_mu_msg_field_body (void)
|
|||
MuMsgFieldId field;
|
||||
|
||||
field = MU_MSG_FIELD_ID_BODY_TEXT;
|
||||
|
||||
|
||||
g_assert_cmpstr (mu_msg_field_name(field),==, "body");
|
||||
g_assert_cmpuint (mu_msg_field_shortcut(field),==, 'b');
|
||||
g_assert_cmpuint (mu_msg_field_xapian_prefix(field),==, 'B');
|
||||
|
||||
|
||||
g_assert_cmpuint (mu_msg_field_is_numeric(field), ==, FALSE);
|
||||
}
|
||||
|
||||
|
@ -51,11 +51,11 @@ test_mu_msg_field_subject (void)
|
|||
MuMsgFieldId field;
|
||||
|
||||
field = MU_MSG_FIELD_ID_SUBJECT;
|
||||
|
||||
|
||||
g_assert_cmpstr (mu_msg_field_name(field),==, "subject");
|
||||
g_assert_cmpuint (mu_msg_field_shortcut(field),==, 's');
|
||||
g_assert_cmpuint (mu_msg_field_xapian_prefix(field),==, 'S');
|
||||
|
||||
|
||||
g_assert_cmpuint (mu_msg_field_is_numeric(field), ==,FALSE);
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ test_mu_msg_field_to (void)
|
|||
MuMsgFieldId field;
|
||||
|
||||
field = MU_MSG_FIELD_ID_TO;
|
||||
|
||||
|
||||
g_assert_cmpstr (mu_msg_field_name(field),==, "to");
|
||||
g_assert_cmpuint (mu_msg_field_shortcut(field),==, 't');
|
||||
g_assert_cmpuint (mu_msg_field_xapian_prefix(field),==, 'T');
|
||||
|
@ -80,7 +80,7 @@ test_mu_msg_field_prio (void)
|
|||
MuMsgFieldId field;
|
||||
|
||||
field = MU_MSG_FIELD_ID_PRIO;
|
||||
|
||||
|
||||
g_assert_cmpstr (mu_msg_field_name(field),==, "prio");
|
||||
g_assert_cmpuint (mu_msg_field_shortcut(field),==, 'p');
|
||||
g_assert_cmpuint (mu_msg_field_xapian_prefix(field),==, 'P');
|
||||
|
@ -94,12 +94,12 @@ test_mu_msg_field_flags (void)
|
|||
MuMsgFieldId field;
|
||||
|
||||
field = MU_MSG_FIELD_ID_FLAGS;
|
||||
|
||||
|
||||
g_assert_cmpstr (mu_msg_field_name(field),==, "flag");
|
||||
g_assert_cmpuint (mu_msg_field_shortcut(field),==, 'g');
|
||||
g_assert_cmpuint (mu_msg_field_xapian_prefix(field),==, 'G');
|
||||
|
||||
g_assert_cmpuint (mu_msg_field_is_numeric(field),==, TRUE);
|
||||
g_assert_cmpuint (mu_msg_field_is_numeric(field),==, TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -124,11 +124,11 @@ main (int argc, char *argv[])
|
|||
|
||||
/* FIXME: add tests for mu_msg_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 ();
|
||||
}
|
|
@ -30,8 +30,8 @@
|
|||
#include <locale.h>
|
||||
|
||||
#include "test-mu-common.h"
|
||||
#include "src/mu-msg.h"
|
||||
#include "src/mu-str.h"
|
||||
#include "mu-msg.h"
|
||||
#include "mu-str.h"
|
||||
|
||||
static gboolean
|
||||
check_contact_01 (MuMsgContact *contact, int *idx)
|
|
@ -31,7 +31,7 @@
|
|||
#include <locale.h>
|
||||
|
||||
#include "test-mu-common.h"
|
||||
#include "src/mu-store.h"
|
||||
#include "mu-store.h"
|
||||
|
||||
static void
|
||||
test_mu_store_new_destroy (void)
|
|
@ -31,8 +31,8 @@
|
|||
#include <locale.h>
|
||||
|
||||
#include "test-mu-common.h"
|
||||
#include "src/mu-str.h"
|
||||
#include "src/mu-msg-prio.h"
|
||||
#include "mu-str.h"
|
||||
#include "mu-msg-prio.h"
|
||||
|
||||
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
#include <limits.h>
|
||||
|
||||
#include "test-mu-common.h"
|
||||
#include "src/mu-util.h"
|
||||
#include "lib/mu-util.h"
|
||||
|
||||
static void
|
||||
test_mu_util_dir_expand_00 (void)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue