Exemple #1
0
static void
set_group_find_defaults (MuConfig *opts)
{
	/* note, when no fields are specified, we use
	 * date-from-subject, and sort descending by date. If fields
	 * *are* specified, we sort in ascending order. */
	if (!opts->fields) {
		opts->fields = "d f s";
		if (!opts->sortfield)
			opts->sortfield = "d";
	}

	if (!opts->formatstr) /* by default, use plain output */
		opts->format = MU_CONFIG_FORMAT_PLAIN;
	else
		opts->format =
			get_output_format (opts->formatstr);

	if (opts->linksdir) {
		gchar *old = opts->linksdir;
		opts->linksdir = mu_util_dir_expand(opts->linksdir);
		if (!opts->linksdir)	/* we'll check the dir later */
			opts->linksdir = old;
		else
			g_free(old);
	}
}
Exemple #2
0
static void
set_group_index_defaults (void)
{
	char *exp;

	if (!MU_CONFIG.maildir)
		MU_CONFIG.maildir = mu_util_guess_maildir ();

	if (MU_CONFIG.maildir) {
		exp = mu_util_dir_expand(MU_CONFIG.maildir);
		if (exp) {
			g_free(MU_CONFIG.maildir);
			MU_CONFIG.maildir = exp;
		}
	}
}
Exemple #3
0
static char*
get_checked_path (const char *path)
{
	char *cpath;

	cpath = mu_util_dir_expand(path);
	if (!cpath ||
	    !mu_util_check_dir (cpath, TRUE, FALSE)) {
		print_error (MU_ERROR_IN_PARAMETERS,
			     "not a readable dir: '%s'");
		g_free (cpath);
		return NULL;
	}

	return cpath;
}
Exemple #4
0
static void
set_group_index_defaults (MuConfig *opts)
{
	char *exp;

	if (!opts->maildir)
		opts->maildir = mu_util_guess_maildir ();

	if (opts->maildir) {
		exp = mu_util_dir_expand(opts->maildir);
		if (exp) {
			g_free(opts->maildir);
			opts->maildir = exp;
		}
	}
}
Exemple #5
0
gchar*
mu_util_guess_maildir (void)
{
	const gchar *mdir1;
	gchar *mdir2;

	/* first, try MAILDIR */
	mdir1 = g_getenv ("MAILDIR");

	if (mdir1 && mu_util_check_dir (mdir1, TRUE, FALSE))
		return g_strdup (mdir1);

	/* then, try ~/Maildir */
	mdir2 = mu_util_dir_expand ("~/Maildir");
	if (mu_util_check_dir (mdir2, TRUE, FALSE))
		return mdir2;

	/* nope; nothing found */
	return NULL;
}
Exemple #6
0
static void
set_group_mu_defaults (void)
{
	gchar *exp;

	if (!MU_CONFIG.muhome)
		MU_CONFIG.muhome = mu_util_guess_mu_homedir();

	exp = mu_util_dir_expand(MU_CONFIG.muhome);
	if (exp) {
		g_free(MU_CONFIG.muhome);
		MU_CONFIG.muhome = exp;
	}

	/* check for the MU_NOCOLOR env var; but in any case don't
	 * use colors unless we're writing to a tty */
	if (g_getenv (MU_NOCOLOR) != NULL)
		MU_CONFIG.nocolor = TRUE;

	if (!isatty(fileno(stdout)))
		MU_CONFIG.nocolor = TRUE;
}