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",
|
||||
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;
|
||||
}
|
|
@ -21,7 +21,6 @@
|
|||
#define __MU_RUNTIME_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <mu-config.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
@ -82,15 +81,6 @@ typedef enum _MuRuntimePath MuRuntimePath;
|
|||
*/
|
||||
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
|
|
@ -31,7 +31,7 @@
|
|||
#include <locale.h>
|
||||
|
||||
#include "test-mu-common.h"
|
||||
#include "src/mu-date.h"
|
||||
#include "mu-date.h"
|
||||
|
||||
|
||||
static void
|
|
@ -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)
|
|
@ -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)
|
|
@ -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