mirror of https://github.com/djcb/mu.git
* *.c: rename _prefixed function into non-prefixed ones (violates ISO)
This commit is contained in:
parent
223e3f95b0
commit
da1e9a3841
81
src/mu-cmd.c
81
src/mu-cmd.c
|
@ -34,7 +34,7 @@
|
|||
#include "mu-util.h"
|
||||
|
||||
static MuCmd
|
||||
_cmd_from_string (const char* cmd)
|
||||
cmd_from_string (const char* cmd)
|
||||
{
|
||||
if (!cmd)
|
||||
return MU_CMD_UNKNOWN;
|
||||
|
@ -67,7 +67,7 @@ _cmd_from_string (const char* cmd)
|
|||
|
||||
|
||||
static gboolean
|
||||
_print_query (MuQueryXapian *xapian, const gchar *query)
|
||||
print_query (MuQueryXapian *xapian, const gchar *query)
|
||||
{
|
||||
char *querystr;
|
||||
|
||||
|
@ -82,7 +82,7 @@ _print_query (MuQueryXapian *xapian, const gchar *query)
|
|||
|
||||
|
||||
static const gchar*
|
||||
_display_field (MuMsgXapian *row, const MuMsgField* field)
|
||||
display_field (MuMsgXapian *row, const MuMsgField* field)
|
||||
{
|
||||
gint64 val;
|
||||
|
||||
|
@ -119,7 +119,7 @@ _display_field (MuMsgXapian *row, const MuMsgField* field)
|
|||
|
||||
/* returns NULL if there is an error */
|
||||
const MuMsgField*
|
||||
_sort_field_from_string (const char* fieldstr)
|
||||
sort_field_from_string (const char* fieldstr)
|
||||
{
|
||||
const MuMsgField *field;
|
||||
|
||||
|
@ -138,7 +138,7 @@ _sort_field_from_string (const char* fieldstr)
|
|||
|
||||
|
||||
static gboolean
|
||||
_print_rows (MuQueryXapian *xapian, const gchar *query, MuConfigOptions *opts)
|
||||
print_rows (MuQueryXapian *xapian, const gchar *query, MuConfigOptions *opts)
|
||||
{
|
||||
MuMsgXapian *row;
|
||||
const MuMsgField *sortfield;
|
||||
|
@ -147,7 +147,7 @@ _print_rows (MuQueryXapian *xapian, const gchar *query, MuConfigOptions *opts)
|
|||
|
||||
sortfield = NULL;
|
||||
if (opts->sortfield) {
|
||||
sortfield = _sort_field_from_string (opts->sortfield);
|
||||
sortfield = sort_field_from_string (opts->sortfield);
|
||||
if (!sortfield) /* error occured? */
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ _print_rows (MuQueryXapian *xapian, const gchar *query, MuConfigOptions *opts)
|
|||
printlen += printf ("%c", *fields);
|
||||
else
|
||||
printlen += printf ("%s",
|
||||
_display_field(row, field));
|
||||
display_field(row, field));
|
||||
++fields;
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,7 @@ _print_rows (MuQueryXapian *xapian, const gchar *query, MuConfigOptions *opts)
|
|||
|
||||
|
||||
static gboolean
|
||||
_do_output_text (MuQueryXapian *xapian, MuConfigOptions* opts,
|
||||
do_output_text (MuQueryXapian *xapian, MuConfigOptions* opts,
|
||||
const gchar **params)
|
||||
{
|
||||
gchar *query;
|
||||
|
@ -206,9 +206,9 @@ _do_output_text (MuQueryXapian *xapian, MuConfigOptions* opts,
|
|||
/* if xquery is set, we print the xapian query instead of the
|
||||
* output; this is for debugging purposes */
|
||||
if (opts->xquery)
|
||||
retval = _print_query (xapian, query);
|
||||
retval = print_query (xapian, query);
|
||||
else
|
||||
retval = _print_rows (xapian, query, opts);
|
||||
retval = print_rows (xapian, query, opts);
|
||||
|
||||
g_free (query);
|
||||
|
||||
|
@ -219,7 +219,7 @@ _do_output_text (MuQueryXapian *xapian, MuConfigOptions* opts,
|
|||
/* create a linksdir if it not exist yet; if it already existed,
|
||||
* remove old links if opts->clearlinks was specified */
|
||||
static gboolean
|
||||
_create_or_clear_linksdir_maybe (MuConfigOptions* opts)
|
||||
create_or_clear_linksdir_maybe (MuConfigOptions* opts)
|
||||
{
|
||||
if (access (opts->linksdir, F_OK) != 0) {
|
||||
|
||||
|
@ -233,7 +233,7 @@ _create_or_clear_linksdir_maybe (MuConfigOptions* opts)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_do_output_links (MuQueryXapian *xapian, MuConfigOptions* opts,
|
||||
do_output_links (MuQueryXapian *xapian, MuConfigOptions* opts,
|
||||
const gchar **params)
|
||||
{
|
||||
gchar *query;
|
||||
|
@ -241,7 +241,7 @@ _do_output_links (MuQueryXapian *xapian, MuConfigOptions* opts,
|
|||
MuMsgXapian *row;
|
||||
const MuMsgField *pathfield;
|
||||
|
||||
if (!_create_or_clear_linksdir_maybe (opts))
|
||||
if (!create_or_clear_linksdir_maybe (opts))
|
||||
return FALSE;
|
||||
|
||||
query = mu_query_xapian_combine (params, FALSE);
|
||||
|
@ -287,7 +287,7 @@ _do_output_links (MuQueryXapian *xapian, MuConfigOptions* opts,
|
|||
|
||||
|
||||
static gboolean
|
||||
_query_params_valid (MuConfigOptions *opts)
|
||||
query_params_valid (MuConfigOptions *opts)
|
||||
{
|
||||
if (opts->linksdir)
|
||||
if (opts->xquery) {
|
||||
|
@ -311,13 +311,13 @@ _query_params_valid (MuConfigOptions *opts)
|
|||
|
||||
|
||||
gboolean
|
||||
_cmd_find (MuConfigOptions *opts)
|
||||
cmd_find (MuConfigOptions *opts)
|
||||
{
|
||||
MuQueryXapian *xapian;
|
||||
gboolean rv;
|
||||
const gchar **params;
|
||||
|
||||
if (!_query_params_valid (opts))
|
||||
if (!query_params_valid (opts))
|
||||
return FALSE;
|
||||
|
||||
/* first param is 'query', search params are after that */
|
||||
|
@ -333,9 +333,9 @@ _cmd_find (MuConfigOptions *opts)
|
|||
}
|
||||
|
||||
if (opts->linksdir)
|
||||
rv = _do_output_links (xapian, opts, params);
|
||||
rv = do_output_links (xapian, opts, params);
|
||||
else
|
||||
rv = _do_output_text (xapian, opts, params);
|
||||
rv = do_output_text (xapian, opts, params);
|
||||
|
||||
mu_query_xapian_destroy (xapian);
|
||||
mu_msg_gmime_uninit();
|
||||
|
@ -345,7 +345,7 @@ _cmd_find (MuConfigOptions *opts)
|
|||
|
||||
|
||||
static gboolean
|
||||
_check_index_params (MuConfigOptions *opts)
|
||||
check_index_params (MuConfigOptions *opts)
|
||||
{
|
||||
if (opts->linksdir || opts->xquery) {
|
||||
g_warning ("Invalid option(s) for command");
|
||||
|
@ -363,7 +363,7 @@ _check_index_params (MuConfigOptions *opts)
|
|||
|
||||
|
||||
static MuResult
|
||||
_index_msg_cb (MuIndexStats* stats, void *user_data)
|
||||
index_msg_cb (MuIndexStats* stats, void *user_data)
|
||||
{
|
||||
char *kars="-\\|/";
|
||||
char output[314];
|
||||
|
@ -387,11 +387,11 @@ _index_msg_cb (MuIndexStats* stats, void *user_data)
|
|||
|
||||
|
||||
static gboolean
|
||||
_cmd_index (MuConfigOptions *opts)
|
||||
cmd_index (MuConfigOptions *opts)
|
||||
{
|
||||
int rv;
|
||||
|
||||
if (!_check_index_params (opts))
|
||||
if (!check_index_params (opts))
|
||||
return FALSE;
|
||||
|
||||
mu_msg_gmime_init ();
|
||||
|
@ -412,17 +412,17 @@ _cmd_index (MuConfigOptions *opts)
|
|||
|
||||
rv = mu_index_run (midx, opts->maildir,
|
||||
opts->reindex, &stats,
|
||||
opts->quiet ? NULL : _index_msg_cb,
|
||||
opts->quiet ? NULL : index_msg_cb,
|
||||
NULL, NULL);
|
||||
if (!opts->nocleanup) {
|
||||
stats._processed = 0; /* start over */
|
||||
mu_index_cleanup (midx, &stats,
|
||||
opts->quiet ? NULL : _index_msg_cb,
|
||||
opts->quiet ? NULL : index_msg_cb,
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (!opts->quiet) {
|
||||
_index_msg_cb (&stats, NULL);
|
||||
index_msg_cb (&stats, NULL);
|
||||
g_print ("\n");
|
||||
}
|
||||
|
||||
|
@ -439,7 +439,7 @@ _cmd_index (MuConfigOptions *opts)
|
|||
|
||||
|
||||
MuResult
|
||||
_cleanup_cb (MuIndexStats *stats, void *user_data)
|
||||
cleanup_cb (MuIndexStats *stats, void *user_data)
|
||||
{
|
||||
char *kars="-\\|/";
|
||||
char output[100];
|
||||
|
@ -464,7 +464,7 @@ _cleanup_cb (MuIndexStats *stats, void *user_data)
|
|||
|
||||
|
||||
static int
|
||||
_cmd_mkdir (MuConfigOptions *opts)
|
||||
cmd_mkdir (MuConfigOptions *opts)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -492,7 +492,7 @@ _cmd_mkdir (MuConfigOptions *opts)
|
|||
|
||||
#if 0 /* currently, turned off */
|
||||
static gboolean
|
||||
_cmd_link (MuConfigOptions *opts)
|
||||
cmd_link (MuConfigOptions *opts)
|
||||
{
|
||||
if (!opts->params[0])
|
||||
return FALSE; /* shouldn't happen */
|
||||
|
@ -507,7 +507,7 @@ _cmd_link (MuConfigOptions *opts)
|
|||
|
||||
|
||||
static gboolean
|
||||
_cmd_help (MuConfigOptions *opts)
|
||||
cmd_help (MuConfigOptions *opts)
|
||||
{
|
||||
/* FIXME: get context-sensitive help */
|
||||
_show_version ();
|
||||
|
@ -515,7 +515,7 @@ _cmd_help (MuConfigOptions *opts)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_cmd_cleanup (MuConfigOptions *opts)
|
||||
cmd_cleanup (MuConfigOptions *opts)
|
||||
{
|
||||
int rv;
|
||||
|
||||
|
@ -557,7 +557,7 @@ _cmd_cleanup (MuConfigOptions *opts)
|
|||
|
||||
|
||||
static gboolean
|
||||
_show_usage (gboolean noerror)
|
||||
show_usage (gboolean noerror)
|
||||
{
|
||||
const char* usage=
|
||||
"usage: mu [options] command [parameters]\n"
|
||||
|
@ -573,7 +573,7 @@ _show_usage (gboolean noerror)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_show_version (void)
|
||||
show_version (void)
|
||||
{
|
||||
const char* msg =
|
||||
"mu (mail indexer / searcher version) " VERSION "\n\n"
|
||||
|
@ -590,34 +590,31 @@ _show_version (void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
gboolean
|
||||
mu_cmd_execute (MuConfigOptions *opts)
|
||||
{
|
||||
MuCmd cmd;
|
||||
|
||||
if (opts->version)
|
||||
return _show_version ();
|
||||
return show_version ();
|
||||
|
||||
if (!opts->params||!opts->params[0]) /* no command? */
|
||||
return _show_usage (FALSE);
|
||||
return show_usage (FALSE);
|
||||
|
||||
cmd = _cmd_from_string (opts->params[0]);
|
||||
cmd = cmd_from_string (opts->params[0]);
|
||||
|
||||
switch (cmd) {
|
||||
|
||||
case MU_CMD_INDEX: return _cmd_index (opts);
|
||||
case MU_CMD_FIND: return _cmd_find (opts);
|
||||
case MU_CMD_INDEX: return cmd_index (opts);
|
||||
case MU_CMD_FIND: return cmd_find (opts);
|
||||
|
||||
case MU_CMD_MKDIR: return _cmd_mkdir (opts);
|
||||
case MU_CMD_MKDIR: return cmd_mkdir (opts);
|
||||
|
||||
/* case MU_CMD_CLEANUP: return _cmd_cleanup (opts); */
|
||||
/* case MU_CMD_HELP: return _cmd_help (opts); */
|
||||
/* case MU_CMD_LINK: return _cmd_link (opts); */
|
||||
|
||||
case MU_CMD_UNKNOWN: return _show_usage (FALSE);
|
||||
case MU_CMD_UNKNOWN: return show_usage (FALSE);
|
||||
default:
|
||||
g_return_val_if_reached (FALSE);
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ mu_config_init (MuConfigOptions *opts)
|
|||
}
|
||||
|
||||
static gchar*
|
||||
_guess_muhome (void)
|
||||
guess_muhome (void)
|
||||
{
|
||||
const char* home;
|
||||
|
||||
|
@ -140,7 +140,7 @@ mu_config_set_defaults (MuConfigOptions *opts)
|
|||
g_return_if_fail (opts);
|
||||
|
||||
if (!opts->muhome)
|
||||
opts->muhome = _guess_muhome ();
|
||||
opts->muhome = guess_muhome ();
|
||||
|
||||
/* note: xpath is is *not* settable from the cmdline */
|
||||
opts->xpath = g_strdup_printf ("%s%c%s", opts->muhome,G_DIR_SEPARATOR,
|
||||
|
|
|
@ -79,7 +79,7 @@ typedef struct _MuIndexCallbackData MuIndexCallbackData;
|
|||
|
||||
|
||||
static MuResult
|
||||
_insert_or_update_maybe (const char* fullpath, time_t filestamp,
|
||||
insert_or_update_maybe (const char* fullpath, time_t filestamp,
|
||||
MuIndexCallbackData *data, gboolean *updated)
|
||||
{
|
||||
MuMsgGMime *msg;
|
||||
|
@ -131,7 +131,7 @@ _insert_or_update_maybe (const char* fullpath, time_t filestamp,
|
|||
}
|
||||
|
||||
static MuResult
|
||||
_run_msg_callback_maybe (MuIndexCallbackData *data)
|
||||
run_msg_callback_maybe (MuIndexCallbackData *data)
|
||||
{
|
||||
if (data && data->_idx_msg_cb) {
|
||||
|
||||
|
@ -153,12 +153,12 @@ on_run_maildir_msg (const char* fullpath, time_t filestamp,
|
|||
MuResult result;
|
||||
gboolean updated;
|
||||
|
||||
result = _run_msg_callback_maybe (data);
|
||||
result = run_msg_callback_maybe (data);
|
||||
if (result != MU_OK)
|
||||
return result;
|
||||
|
||||
/* see if we need to update/insert anything...*/
|
||||
result = _insert_or_update_maybe (fullpath, filestamp, data,
|
||||
result = insert_or_update_maybe (fullpath, filestamp, data,
|
||||
&updated);
|
||||
|
||||
/* update statistics */
|
||||
|
@ -205,7 +205,7 @@ on_run_maildir_dir (const char* fullpath, gboolean enter,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_check_path (const char* path)
|
||||
check_path (const char* path)
|
||||
{
|
||||
g_return_val_if_fail (path, FALSE);
|
||||
|
||||
|
@ -230,7 +230,7 @@ mu_index_run (MuIndex *index, const char* path,
|
|||
|
||||
g_return_val_if_fail (index && index->_xapian, MU_ERROR);
|
||||
|
||||
if (!_check_path (path))
|
||||
if (!check_path (path))
|
||||
return MU_ERROR;
|
||||
|
||||
if (stats)
|
||||
|
@ -286,7 +286,7 @@ mu_index_stats (MuIndex *index, const char* path,
|
|||
|
||||
g_return_val_if_fail (index, MU_ERROR);
|
||||
|
||||
if (!_check_path (path))
|
||||
if (!check_path (path))
|
||||
return MU_ERROR;
|
||||
|
||||
if (stats)
|
||||
|
@ -317,7 +317,7 @@ typedef struct _CleanupData CleanupData;
|
|||
|
||||
|
||||
static MuResult
|
||||
_foreach_doc_cb (const char* path, CleanupData *cudata)
|
||||
foreach_doc_cb (const char* path, CleanupData *cudata)
|
||||
{
|
||||
MuResult rv;
|
||||
|
||||
|
@ -358,7 +358,7 @@ mu_index_cleanup (MuIndex *index, MuIndexStats *stats,
|
|||
cudata._user_data = user_data;
|
||||
|
||||
rv = mu_store_xapian_foreach (index->_xapian,
|
||||
(MuStoreXapianForeachFunc)_foreach_doc_cb,
|
||||
(MuStoreXapianForeachFunc)foreach_doc_cb,
|
||||
&cudata);
|
||||
mu_store_xapian_flush (index->_xapian);
|
||||
|
||||
|
|
16
src/mu-log.c
16
src/mu-log.c
|
@ -46,11 +46,11 @@ typedef struct _MuLog MuLog;
|
|||
|
||||
static MuLog* MU_LOG = NULL;
|
||||
|
||||
static void _log_write (const char* domain, GLogLevelFlags level,
|
||||
const gchar *msg);
|
||||
static void log_write (const char* domain, GLogLevelFlags level,
|
||||
const gchar *msg);
|
||||
|
||||
static void
|
||||
_try_close (int fd)
|
||||
try_close (int fd)
|
||||
{
|
||||
if (fd < 0)
|
||||
return;
|
||||
|
@ -90,7 +90,7 @@ log_handler (const gchar* log_domain, GLogLevelFlags log_level,
|
|||
if (log_level == G_LOG_LEVEL_DEBUG && !MU_LOG->_debug)
|
||||
return;
|
||||
|
||||
_log_write (log_domain ? log_domain : "mu", log_level, msg);
|
||||
log_write (log_domain ? log_domain : "mu", log_level, msg);
|
||||
}
|
||||
|
||||
|
||||
|
@ -139,7 +139,7 @@ mu_log_init (const char* muhome, gboolean append,
|
|||
g_free (logfile);
|
||||
|
||||
if (fd < 0 || !mu_log_init_with_fd (fd, FALSE, quiet, debug)) {
|
||||
_try_close (fd);
|
||||
try_close (fd);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ mu_log_uninit (void)
|
|||
g_return_if_fail (MU_LOG);
|
||||
|
||||
if (MU_LOG->_own)
|
||||
_try_close (MU_LOG->_fd);
|
||||
try_close (MU_LOG->_fd);
|
||||
|
||||
g_free (MU_LOG);
|
||||
MU_LOG = NULL;
|
||||
|
@ -176,8 +176,8 @@ pfx (GLogLevelFlags level)
|
|||
}
|
||||
|
||||
static void
|
||||
_log_write (const char* domain, GLogLevelFlags level,
|
||||
const gchar *msg)
|
||||
log_write (const char* domain, GLogLevelFlags level,
|
||||
const gchar *msg)
|
||||
{
|
||||
time_t now;
|
||||
ssize_t len;
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
|
||||
static gboolean
|
||||
_create_maildir (const char *path, int mode)
|
||||
create_maildir (const char *path, int mode)
|
||||
{
|
||||
int i;
|
||||
const gchar* subdirs[] = {"new", "cur", "tmp"};
|
||||
|
@ -69,7 +69,7 @@ _create_maildir (const char *path, int mode)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_create_noindex (const char *path)
|
||||
create_noindex (const char *path)
|
||||
{
|
||||
/* create a noindex file if requested */
|
||||
int fd;
|
||||
|
@ -95,10 +95,10 @@ mu_maildir_mkmdir (const char* path, mode_t mode, gboolean noindex)
|
|||
|
||||
g_return_val_if_fail (path, FALSE);
|
||||
|
||||
if (!_create_maildir (path, mode))
|
||||
if (!create_maildir (path, mode))
|
||||
return FALSE;
|
||||
|
||||
if (noindex && !_create_noindex (path))
|
||||
if (noindex && !create_noindex (path))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
@ -107,7 +107,7 @@ mu_maildir_mkmdir (const char* path, mode_t mode, gboolean noindex)
|
|||
/* determine whether the source message is in 'new' or in 'cur';
|
||||
* we ignore messages in 'tmp' for obvious reasons */
|
||||
static gboolean
|
||||
_check_subdir (const char *src, gboolean *in_cur)
|
||||
check_subdir (const char *src, gboolean *in_cur)
|
||||
{
|
||||
gchar *srcpath;
|
||||
|
||||
|
@ -127,12 +127,12 @@ _check_subdir (const char *src, gboolean *in_cur)
|
|||
}
|
||||
|
||||
static gchar*
|
||||
_get_target_fullpath (const char* src, const gchar *targetpath)
|
||||
get_target_fullpath (const char* src, const gchar *targetpath)
|
||||
{
|
||||
gchar *targetfullpath, *srcfile, *srcpath, *c;
|
||||
gboolean in_cur;
|
||||
|
||||
if (!_check_subdir (src, &in_cur))
|
||||
if (!check_subdir (src, &in_cur))
|
||||
return NULL;
|
||||
|
||||
/* note: make the filename *cough* unique by making the pathname
|
||||
|
@ -170,7 +170,7 @@ mu_maildir_link (const char* src, const char *targetpath)
|
|||
g_return_val_if_fail (src, FALSE);
|
||||
g_return_val_if_fail (targetpath, FALSE);
|
||||
|
||||
targetfullpath = _get_target_fullpath (src, targetpath);
|
||||
targetfullpath = get_target_fullpath (src, targetpath);
|
||||
if (!targetfullpath)
|
||||
return FALSE;
|
||||
|
||||
|
@ -237,7 +237,7 @@ process_file (const char* fullpath, MuMaildirWalkMsgCallback cb, void *data)
|
|||
* (we're skipping 'tmp' for obvious reasons)
|
||||
*/
|
||||
G_GNUC_CONST static gboolean
|
||||
_is_maildir_new_or_cur (const char *path)
|
||||
is_maildir_new_or_cur (const char *path)
|
||||
{
|
||||
size_t len;
|
||||
const char *sfx;
|
||||
|
@ -261,7 +261,7 @@ _is_maildir_new_or_cur (const char *path)
|
|||
|
||||
/* check if there is a noindex file (MU_WALK_NOINDEX_FILE) in this dir; */
|
||||
static gboolean
|
||||
_has_noindex_file (const char *path)
|
||||
has_noindex_file (const char *path)
|
||||
{
|
||||
char *fname;
|
||||
|
||||
|
@ -283,7 +283,7 @@ _has_noindex_file (const char *path)
|
|||
* this is slower (extra stat) but at least it works
|
||||
*/
|
||||
static gboolean
|
||||
_set_dtype (const char* path, struct dirent *entry)
|
||||
set_dtype (const char* path, struct dirent *entry)
|
||||
{
|
||||
struct stat statbuf;
|
||||
char fullpath[4096];
|
||||
|
@ -311,7 +311,7 @@ _set_dtype (const char* path, struct dirent *entry)
|
|||
|
||||
|
||||
static gboolean
|
||||
_ignore_dir_entry (struct dirent *entry)
|
||||
ignore_dir_entry (struct dirent *entry)
|
||||
{
|
||||
const char *name;
|
||||
|
||||
|
@ -352,7 +352,7 @@ process_dir_entry (const char* path, struct dirent *entry,
|
|||
char* fullpath;
|
||||
|
||||
/* ignore special dirs: */
|
||||
if (_ignore_dir_entry (entry))
|
||||
if (ignore_dir_entry (entry))
|
||||
return MU_OK;
|
||||
|
||||
fullpath = g_newa (char, strlen(path) + strlen(entry->d_name) + 1);
|
||||
|
@ -362,14 +362,14 @@ process_dir_entry (const char* path, struct dirent *entry,
|
|||
switch (entry->d_type) {
|
||||
case DT_REG:
|
||||
/* we only want files in cur/ and new/ */
|
||||
if (!_is_maildir_new_or_cur (path))
|
||||
if (!is_maildir_new_or_cur (path))
|
||||
return MU_OK;
|
||||
|
||||
return process_file (fullpath, cb_msg, data);
|
||||
|
||||
case DT_DIR: {
|
||||
/* if it has a noindex file, we ignore this dir */
|
||||
if (_has_noindex_file (fullpath)) {
|
||||
if (has_noindex_file (fullpath)) {
|
||||
g_debug ("ignoring dir %s", fullpath);
|
||||
return MU_OK;
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ process_dir_entry (const char* path, struct dirent *entry,
|
|||
|
||||
|
||||
static struct dirent*
|
||||
_dirent_copy (struct dirent *entry)
|
||||
dirent_copy (struct dirent *entry)
|
||||
{
|
||||
struct dirent *d = g_slice_new (struct dirent);
|
||||
/* NOTE: simply memcpy'ing sizeof(struct dirent) bytes will
|
||||
|
@ -393,13 +393,13 @@ _dirent_copy (struct dirent *entry)
|
|||
}
|
||||
|
||||
static void
|
||||
_dirent_destroy (struct dirent *entry)
|
||||
dirent_destroy (struct dirent *entry)
|
||||
{
|
||||
g_slice_free(struct dirent, entry);
|
||||
}
|
||||
|
||||
static gint
|
||||
_dirent_cmp (struct dirent *d1, struct dirent *d2)
|
||||
dirent_cmp (struct dirent *d1, struct dirent *d2)
|
||||
{
|
||||
return d1->d_ino - d2->d_ino;
|
||||
}
|
||||
|
@ -434,17 +434,17 @@ process_dir (const char* path, MuMaildirWalkMsgCallback msg_cb,
|
|||
|
||||
/* handle FSs that don't support entry->d_type */
|
||||
if (entry->d_type == DT_UNKNOWN)
|
||||
_set_dtype (path, entry);
|
||||
set_dtype (path, entry);
|
||||
|
||||
lst = g_list_prepend (lst, _dirent_copy(entry));
|
||||
lst = g_list_prepend (lst, dirent_copy(entry));
|
||||
}
|
||||
|
||||
c = lst = g_list_sort (lst, (GCompareFunc)_dirent_cmp);
|
||||
c = lst = g_list_sort (lst, (GCompareFunc)dirent_cmp);
|
||||
for (c = lst, result = MU_OK; c && result == MU_OK; c = c->next)
|
||||
result = process_dir_entry (path, (struct dirent*)c->data,
|
||||
msg_cb, dir_cb, data);
|
||||
|
||||
g_list_foreach (lst, (GFunc)_dirent_destroy, NULL);
|
||||
g_list_foreach (lst, (GFunc)dirent_destroy, NULL);
|
||||
g_list_free (lst);
|
||||
|
||||
closedir (dir);
|
||||
|
@ -493,7 +493,7 @@ mu_maildir_walk (const char *path, MuMaildirWalkMsgCallback cb_msg,
|
|||
|
||||
|
||||
static gboolean
|
||||
_clear_links (const gchar* dirname, DIR *dir)
|
||||
clear_links (const gchar* dirname, DIR *dir)
|
||||
{
|
||||
struct dirent *entry;
|
||||
gboolean rv;
|
||||
|
@ -510,7 +510,7 @@ _clear_links (const gchar* dirname, DIR *dir)
|
|||
|
||||
/* handle FSs that don't support entry->d_type */
|
||||
if (entry->d_type == DT_UNKNOWN)
|
||||
_set_dtype (dirname, entry);
|
||||
set_dtype (dirname, entry);
|
||||
|
||||
/* ignore non-links / non-dirs */
|
||||
if (entry->d_type != DT_LNK && entry->d_type != DT_DIR)
|
||||
|
@ -553,7 +553,7 @@ mu_maildir_clear_links (const gchar* path)
|
|||
|
||||
g_debug ("remove symlinks from %s", path);
|
||||
|
||||
rv = _clear_links (path, dir);
|
||||
rv = clear_links (path, dir);
|
||||
closedir (dir);
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -146,7 +146,7 @@ typedef gboolean (*FieldMatchFunc) (const MuMsgField *field,
|
|||
gconstpointer data);
|
||||
|
||||
static const MuMsgField*
|
||||
_find_field (FieldMatchFunc matcher, gconstpointer data)
|
||||
find_field (FieldMatchFunc matcher, gconstpointer data)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i != sizeof(FIELD_DATA)/sizeof(FIELD_DATA[0]); ++i)
|
||||
|
@ -157,7 +157,7 @@ _find_field (FieldMatchFunc matcher, gconstpointer data)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_match_name (const MuMsgField *field, const gchar* name)
|
||||
match_name (const MuMsgField *field, const gchar* name)
|
||||
{
|
||||
return strcmp (field->_name, name) == 0;
|
||||
}
|
||||
|
@ -166,11 +166,11 @@ const MuMsgField*
|
|||
mu_msg_field_from_name (const char* str)
|
||||
{
|
||||
g_return_val_if_fail (str, NULL);
|
||||
return _find_field ((FieldMatchFunc)_match_name, str);
|
||||
return find_field ((FieldMatchFunc)match_name, str);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_match_shortcut (const MuMsgField *field, char kar)
|
||||
match_shortcut (const MuMsgField *field, char kar)
|
||||
{
|
||||
return field->_shortcut[0] == kar;
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ _match_shortcut (const MuMsgField *field, char kar)
|
|||
const MuMsgField*
|
||||
mu_msg_field_from_shortcut (char kar)
|
||||
{
|
||||
return _find_field ((FieldMatchFunc)_match_shortcut,
|
||||
return find_field ((FieldMatchFunc)match_shortcut,
|
||||
GUINT_TO_POINTER((guint)kar));
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ match_id (const MuMsgField *field, MuMsgFieldId id)
|
|||
const MuMsgField*
|
||||
mu_msg_field_from_id (MuMsgFieldId id)
|
||||
{
|
||||
return _find_field ((FieldMatchFunc)match_id,
|
||||
return find_field ((FieldMatchFunc)match_id,
|
||||
GUINT_TO_POINTER(id));
|
||||
}
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ mu_msg_gmime_get_from (MuMsgGMime *msg)
|
|||
|
||||
|
||||
static const char*
|
||||
_get_recipient (MuMsgGMime *msg, GMimeRecipientType rtype, StringFields field)
|
||||
get_recipient (MuMsgGMime *msg, GMimeRecipientType rtype, StringFields field)
|
||||
{
|
||||
/* can only be set once */
|
||||
if (!msg->_fields[field]) {
|
||||
|
@ -233,14 +233,14 @@ const char*
|
|||
mu_msg_gmime_get_to (MuMsgGMime *msg)
|
||||
{
|
||||
g_return_val_if_fail (msg, NULL);
|
||||
return _get_recipient (msg, GMIME_RECIPIENT_TYPE_TO, TO_FIELD);
|
||||
return get_recipient (msg, GMIME_RECIPIENT_TYPE_TO, TO_FIELD);
|
||||
}
|
||||
|
||||
const char*
|
||||
mu_msg_gmime_get_cc (MuMsgGMime *msg)
|
||||
{
|
||||
g_return_val_if_fail (msg, NULL);
|
||||
return _get_recipient (msg, GMIME_RECIPIENT_TYPE_CC, CC_FIELD);
|
||||
return get_recipient (msg, GMIME_RECIPIENT_TYPE_CC, CC_FIELD);
|
||||
}
|
||||
|
||||
|
||||
|
@ -467,7 +467,7 @@ typedef struct _GetBodyData GetBodyData;
|
|||
|
||||
|
||||
static gboolean
|
||||
_looks_like_attachment (GMimeObject *part)
|
||||
looks_like_attachment (GMimeObject *part)
|
||||
{
|
||||
const char *str;
|
||||
GMimeContentDisposition *disp;
|
||||
|
@ -503,7 +503,7 @@ get_body_cb (GMimeObject *parent, GMimeObject *part, GetBodyData *data)
|
|||
return;
|
||||
}
|
||||
|
||||
if (_looks_like_attachment (part))
|
||||
if (looks_like_attachment (part))
|
||||
return; /* not the body */
|
||||
|
||||
/* is it right content type? */
|
||||
|
@ -732,7 +732,7 @@ mu_msg_gmime_get_field_numeric (MuMsgGMime *msg, const MuMsgField* field)
|
|||
|
||||
|
||||
static gboolean
|
||||
_fill_contact (MuMsgContact *contact, InternetAddress *addr,
|
||||
fill_contact (MuMsgContact *contact, InternetAddress *addr,
|
||||
MuMsgContactType ctype)
|
||||
{
|
||||
if (!addr)
|
||||
|
@ -752,7 +752,7 @@ _fill_contact (MuMsgContact *contact, InternetAddress *addr,
|
|||
|
||||
|
||||
static int
|
||||
_address_list_foreach (InternetAddressList *addrlist,
|
||||
address_list_foreach (InternetAddressList *addrlist,
|
||||
MuMsgContactType ctype,
|
||||
MuMsgGMimeContactsCallback cb,
|
||||
void *ptr)
|
||||
|
@ -765,8 +765,8 @@ _address_list_foreach (InternetAddressList *addrlist,
|
|||
for (i = 0, rv = 0; i != internet_address_list_length(addrlist); ++i) {
|
||||
|
||||
MuMsgContact contact;
|
||||
if (!_fill_contact(&contact,
|
||||
internet_address_list_get_address (addrlist, i),
|
||||
if (!fill_contact(&contact,
|
||||
internet_address_list_get_address (addrlist, i),
|
||||
ctype))
|
||||
{
|
||||
MU_WRITE_LOG ("ignoring contact");
|
||||
|
@ -797,7 +797,7 @@ mu_msg_gmime_get_contacts_from (MuMsgGMime *msg, MuMsgGMimeContactsCallback cb,
|
|||
list = internet_address_list_parse_string (
|
||||
g_mime_message_get_sender (msg->_mime_msg));
|
||||
|
||||
rv = _address_list_foreach (list, MU_MSG_CONTACT_TYPE_FROM, cb, ptr);
|
||||
rv = address_list_foreach (list, MU_MSG_CONTACT_TYPE_FROM, cb, ptr);
|
||||
|
||||
if (list)
|
||||
g_object_unref (G_OBJECT(list));
|
||||
|
@ -831,7 +831,7 @@ mu_msg_gmime_get_contacts_foreach (MuMsgGMime *msg, MuMsgGMimeContactsCallback c
|
|||
InternetAddressList *addrlist;
|
||||
addrlist = g_mime_message_get_recipients (msg->_mime_msg,
|
||||
ctypes[i]._gmime_type);
|
||||
rv = _address_list_foreach (addrlist, ctypes[i]._type,cb, ptr);
|
||||
rv = address_list_foreach (addrlist, ctypes[i]._type,cb, ptr);
|
||||
if (rv != 0)
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -92,8 +92,8 @@ _get_query (MuQueryXapian * mqx, const char* searchexpr, int *err = 0) {
|
|||
(searchexpr,
|
||||
Xapian::QueryParser::FLAG_BOOLEAN |
|
||||
Xapian::QueryParser::FLAG_PHRASE |
|
||||
Xapian::QueryParser::FLAG_LOVEHATE |
|
||||
Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE |
|
||||
// Xapian::QueryParser::FLAG_LOVEHATE |
|
||||
// Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE |
|
||||
Xapian::QueryParser::FLAG_WILDCARD |
|
||||
Xapian::QueryParser::FLAG_PURE_NOT |
|
||||
Xapian::QueryParser::FLAG_PARTIAL);
|
||||
|
|
8
src/mu.c
8
src/mu.c
|
@ -29,7 +29,7 @@
|
|||
#include "mu-log.h"
|
||||
|
||||
static gboolean
|
||||
_init_log (MuConfigOptions *opts)
|
||||
init_log (MuConfigOptions *opts)
|
||||
{
|
||||
gboolean rv;
|
||||
|
||||
|
@ -47,7 +47,7 @@ _init_log (MuConfigOptions *opts)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_parse_params (MuConfigOptions *config, int *argcp, char ***argvp)
|
||||
parse_params (MuConfigOptions *config, int *argcp, char ***argvp)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GOptionContext *context;
|
||||
|
@ -88,10 +88,10 @@ main (int argc, char *argv[])
|
|||
do {
|
||||
rv = FALSE;
|
||||
|
||||
if (!_parse_params (&config, &argc, &argv))
|
||||
if (!parse_params (&config, &argc, &argv))
|
||||
break;
|
||||
|
||||
if (!_init_log (&config))
|
||||
if (!init_log (&config))
|
||||
break;
|
||||
|
||||
rv = mu_cmd_execute (&config);
|
||||
|
|
Loading…
Reference in New Issue