/* * e-mail-local.c * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with the program; if not, see * * * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * */ #ifdef HAVE_CONFIG_H #include #endif #include "e-mail-local.h" #include #include "e-mail-folder-utils.h" #define CHECK_LOCAL_FOLDER_TYPE(type) \ ((type) < G_N_ELEMENTS (default_local_folders)) /* The array elements correspond to EMailLocalFolder. */ static struct { const gchar *display_name; CamelFolder *folder; gchar *folder_uri; } default_local_folders[] = { { N_("Inbox") }, { N_("Drafts") }, { N_("Outbox") }, { N_("Sent") }, { N_("Templates") }, { "Inbox" } /* "always local" inbox */ }; static CamelStore *local_store; static gboolean mail_local_initialized = FALSE; void e_mail_local_init (EMailSession *session, const gchar *data_dir) { CamelService *service; CamelURL *url; gchar *temp; gint ii; GError *error = NULL; if (mail_local_initialized) return; g_return_if_fail (E_IS_MAIL_SESSION (session)); g_return_if_fail (data_dir != NULL); mail_local_initialized = TRUE; url = camel_url_new ("maildir:", NULL); temp = g_build_filename (data_dir, "local", NULL); camel_url_set_path (url, temp); camel_url_set_param (url, "need-summary-check", "no"); g_free (temp); temp = camel_url_to_string (url, 0); service = camel_session_add_service ( CAMEL_SESSION (session), "local", temp, CAMEL_PROVIDER_STORE, &error); g_free (temp); if (error != NULL) goto fail; /* Populate the rest of the default_local_folders array. */ for (ii = 0; ii < G_N_ELEMENTS (default_local_folders); ii++) { const gchar *display_name; display_name = default_local_folders[ii].display_name; default_local_folders[ii].folder_uri = e_mail_folder_uri_build ( CAMEL_STORE (service), display_name); /* FIXME camel_store_get_folder() may block. */ if (!strcmp (display_name, "Inbox")) default_local_folders[ii].folder = camel_store_get_inbox_folder_sync ( CAMEL_STORE (service), NULL, &error); else default_local_folders[ii].folder = camel_store_get_folder_sync ( CAMEL_STORE (service), display_name, CAMEL_STORE_FOLDER_CREATE, NULL, &error); if (error != NULL) { g_critical ("%s", error->message); g_clear_error (&error); } } camel_url_free (url); local_store = g_object_ref (service); return; fail: g_critical ( "Could not initialize local store/folder: %s", error->message); g_error_free (error); camel_url_free (url); } CamelFolder * e_mail_local_get_folder (EMailLocalFolder type) { g_return_val_if_fail (mail_local_initialized, NULL); g_return_val_if_fail (CHECK_LOCAL_FOLDER_TYPE (type), NULL); return default_local_folders[type].folder; } const gchar * e_mail_local_get_folder_uri (EMailLocalFolder type) { g_return_val_if_fail (mail_local_initialized, NULL); g_return_val_if_fail (CHECK_LOCAL_FOLDER_TYPE (type), NULL); return default_local_folders[type].folder_uri; } CamelStore * e_mail_local_get_store (void) { g_return_val_if_fail (mail_local_initialized, NULL); g_return_val_if_fail (CAMEL_IS_STORE (local_store), NULL); return local_store; } '>dependabot/npm_and_yarn/devel/electron6/files/node-fetch-2.6.1 dependabot/npm_and_yarn/devel/electron6/files/serve-10.1.2 gnome-3.22 gnome-3.24 gnome-3.26 gnome-3.28 gnome-3.32 gnome-3.36 gstreamer gstreamer-1.16 gstreamer0.10-removal main master mate-1.16 mate-1.18 mate-1.20 mate-1.22 FreeBSD GNOME current development ports (https://github.com/freebsd/freebsd-ports-gnome) aboutsummaryrefslogtreecommitdiffstats log msg author committer range path: root/cad/tkgateCommit message (Expand)AuthorAgeFilesLines * Do not use post-stage. Use post-install instead.mat2016-12-021-1/+1 * cad/tkgate: Unbreak FreeBSD 11, Fix depends on restmarino2015-07-071-1/+2 * - Fix build by adding iconv dependencyvsevolod2015-06-241-1/+1 * Restore removed cad/tkgate.vsevolod2015-06-245-0/+1467 * - Remove cad/tkgate: it segfaults on startup, and has been doing so for as longgahr2013-09-2520-2801/+0 * Add NO_STAGE all over the place in preparation for the staging support (cat: ...bapt2013-09-201-0/+1 * - Use single space after WWW:sunpoet2013-09-081-1/+1 * - Remove MAKE_JOBS_SAFE variableak2013-08-151-1/+0 * - Fix PLISTgahr2013-05-151-0/+2 * - Fix run-time with Tcl/Tk 8.6gahr2013-05-142-3/+10 * - Update to 2.0-b10gahr2013-05-1419-546/+2752 * - Update MASTER_SITESmiwi2013-04-261-10/+5 * - Add mirror sites to MASTER_SITESmiwi2011-08-262-158/+177 * No problems fetching from MASTER_SITES.crees2011-08-231-3/+0 * Deprecate port with no more public distfilesbapt2011-08-021-0/+3 * - Get Rid MD5 supportmiwi2011-03-201-1/+0 * Fix a few typos in ports/cad.olgeni2010-07-301-1/+1 * For ports maintained by ports@FreeBSD.org, remove names and/ordougb2009-12-211-4/+0 * - Remove unneeded dependency from gtk12/gtk20 [1]miwi2008-04-201-4/+4 * Migration from bison 1.x to 2.xade2007-10-171-2/+2 * - Welcome X.org 7.2 \o/.flz2007-05-201-0/+1 * Update to 1.8.7erwin2007-02-173-5/+49 * - Respect X11BASE [1]rafan2006-11-301-1/+5 * Reset inactive maintainer who has not responded to email.linimon2006-09-051-1/+1 * SHA256ifyedwin2006-01-22