aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-component.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-01-19 14:11:41 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-01-19 14:11:41 +0800
commit04e3d88bcc495709386e3e8bc092d86b7cd183cb (patch)
tree1bf5d7d84291dd504de712c91b2d930f21e75c97 /mail/mail-component.c
parentbfe94239cae433e03a38dcc021a34e180f33cbb0 (diff)
downloadgsoc2013-evolution-04e3d88bcc495709386e3e8bc092d86b7cd183cb.tar.gz
gsoc2013-evolution-04e3d88bcc495709386e3e8bc092d86b7cd183cb.tar.zst
gsoc2013-evolution-04e3d88bcc495709386e3e8bc092d86b7cd183cb.zip
if we can't open the pop3 cache dir, because it doesn't exist, it is not
2004-01-19 Not Zed <NotZed@Ximian.com> * em-migrate.c (em_upgrade_pop_uid_caches_1_4): if we can't open the pop3 cache dir, because it doesn't exist, it is not an error. ** See bug #52983. * mail-component.c (em_uri_from_camel, em_uri_to_camel): Handle vfolder: uri's properly. And make sure local uri's are properly encoded. (mail_component_get_folder_from_evomail_uri) (mail_component_evomail_uri_from_folder): removed, no longer used. (em_uri_from_camel): don't leak the camelurl. (d): disable debug * mail-vfolder.c (vfolder_load_storage): move the vfolder storage location to ~/.evolution/mail/vfolder rather than ~/.evolution/mail (this is currently unused anyway). (uri_is_ignore): short-circuit exit if we find a match. (mail_vfolder_add_uri): dont exit immediately if we have a vfolder uri, but don't add it to local/remove either. (mail_vfolder_delete_uri): remove any uri from the local/remote source list while we're at it. svn path=/trunk/; revision=24300
Diffstat (limited to 'mail/mail-component.c')
-rw-r--r--mail/mail-component.c166
1 files changed, 50 insertions, 116 deletions
diff --git a/mail/mail-component.c b/mail/mail-component.c
index 1f01ef691b..a437de6318 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -68,9 +68,7 @@
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-widget.h>
-
-#define d(x) x
-
+#define d(x)
#define PARENT_TYPE bonobo_object_get_type ()
static BonoboObjectClass *parent_class = NULL;
@@ -801,31 +799,50 @@ mail_component_get_local_inbox(MailComponent *mc, struct _CamelException *ex)
extern struct _CamelSession *session;
+/* email: uri's are based on the account, with special cases for local
+ * stores, vfolder and local mail.
+ * e.g.
+ * imap account imap://user@host/ -> email://accountid@accountid.host/
+ * vfolder vfolder:/storage/path#folder -> email://vfolder@local/folder
+ * local local:/storage/path#folder -> email://local@local/folder
+ */
+
char *em_uri_from_camel(const char *curi)
{
CamelURL *curl;
EAccount *account;
const char *uid, *path;
- char *euri;
+ char *euri, *tmp;
CamelProvider *provider;
provider = camel_session_get_provider(session, curi, NULL);
- if (provider == NULL)
+ if (provider == NULL) {
+ d(printf("em uri from camel failed '%s'\n", curi));
return g_strdup(curi);
+ }
curl = camel_url_new(curi, NULL);
if (curl == NULL)
return g_strdup(curi);
- account = mail_config_get_account_by_source_url(curi);
- uid = (account == NULL)?"local@local":account->uid;
+ if (strcmp(curl->protocol, "vfolder") == 0)
+ uid = "vfolder@local";
+ else if ((account = mail_config_get_account_by_source_url(curi)) == NULL)
+ uid = "local@local";
+ else
+ uid = account->uid;
path = (provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH)?curl->fragment:curl->path;
if (path[0] == '/')
path++;
- euri = g_strdup_printf("email://%s/%s", uid, path);
+
+ tmp = camel_url_encode(path, ";?");
+ euri = g_strdup_printf("email://%s/%s", uid, tmp);
+ g_free(tmp);
d(printf("em uri from camel '%s' -> '%s'\n", curi, euri));
-
+
+ camel_url_free(curl);
+
return euri;
}
@@ -838,21 +855,37 @@ char *em_uri_to_camel(const char *euri)
CamelURL *eurl, *curl;
char *uid, *curi;
- eurl = camel_url_new(euri, NULL);
- if (eurl == NULL)
+ if (strncmp(euri, "email:", 6) != 0) {
+ d(printf("em uri to camel not euri '%s'\n", euri));
return g_strdup(euri);
+ }
- if (strcmp(eurl->protocol, "email") != 0) {
- camel_url_free(eurl);
+ eurl = camel_url_new(euri, NULL);
+ if (eurl == NULL)
return g_strdup(euri);
- }
g_assert(eurl->host != NULL);
if (eurl->user != NULL) {
- if (strcmp(eurl->user, "local") == 0 && strcmp(eurl->host, "local") == 0) {
- curi = g_strdup_printf("mbox:%s/.evolution/mail/local#%s", g_get_home_dir(), eurl->path[0]=='/'?eurl->path+1:eurl->path);
+ /* Sigh, shoul'dve used mbox@local for mailboxes, not local@local */
+ if (strcmp(eurl->host, "local") == 0
+ && (strcmp(eurl->user, "local") == 0 || strcmp(eurl->user, "vfolder") == 0)) {
+ char *base;
+
+ if (strcmp(eurl->user, "vfolder") == 0)
+ curl = camel_url_new("vfolder:", NULL);
+ else
+ curl = camel_url_new("mbox:", NULL);
+
+ base = g_strdup_printf("%s/.evolution/mail/%s", g_get_home_dir(), eurl->user);
+ camel_url_set_path(curl, base);
+ g_free(base);
+ camel_url_set_fragment(curl, eurl->path[0]=='/'?eurl->path+1:eurl->path);
+ curi = camel_url_to_string(curl, 0);
+ camel_url_free(curl);
camel_url_free(eurl);
+
+ d(printf("em uri to camel local '%s' -> '%s'\n", euri, curi));
return curi;
}
@@ -867,6 +900,7 @@ char *em_uri_to_camel(const char *euri)
if (account == NULL) {
camel_url_free(eurl);
+ d(printf("em uri to camel no account '%s' -> '%s'\n", euri, euri));
return g_strdup(euri);
}
@@ -889,104 +923,4 @@ char *em_uri_to_camel(const char *euri)
return curi;
}
-
-CamelFolder *
-mail_component_get_folder_from_evomail_uri (MailComponent *component,
- guint32 flags,
- const char *evomail_uri,
- CamelException *ex)
-{
- CamelException local_ex;
- EAccountList *accounts;
- EIterator *iter;
- const char *p;
- const char *q;
- const char *folder_name;
- char *uid;
-
- camel_exception_init (&local_ex);
-
- if (strncmp (evomail_uri, "evomail:", 8) != 0)
- return NULL;
-
- p = evomail_uri + 8;
- while (*p == '/')
- p ++;
-
- q = strchr (p, '/');
- if (q == NULL)
- return NULL;
-
- uid = g_strndup (p, q - p);
- folder_name = q + 1;
-
- /* since we have no explicit account for 'local' folders, make one up */
- if (strcmp(uid, "local") == 0) {
- g_free(uid);
- return camel_store_get_folder(component->priv->local_store, folder_name, flags, ex);
- }
-
- accounts = mail_config_get_accounts ();
- iter = e_list_get_iterator ((EList *) accounts);
- while (e_iterator_is_valid (iter)) {
- EAccount *account = (EAccount *) e_iterator_get (iter);
- EAccountService *service = account->source;
- CamelProvider *provider;
- CamelStore *store;
-
- if (strcmp (account->uid, uid) != 0)
- continue;
-
- provider = camel_session_get_provider (session, service->url, &local_ex);
- if (provider == NULL)
- goto fail;
-
- store = (CamelStore *) camel_session_get_service (session, service->url, CAMEL_PROVIDER_STORE, &local_ex);
- if (store == NULL)
- goto fail;
-
- g_free (uid);
- return camel_store_get_folder (store, folder_name, flags, ex);
- }
-
- fail:
- camel_exception_clear (&local_ex);
- g_free (uid);
- return NULL;
-}
-
-
-char *
-mail_component_evomail_uri_from_folder (MailComponent *component,
- CamelFolder *folder)
-{
- CamelStore *store = camel_folder_get_parent_store (folder);
- EAccount *account;
- char *service_url;
- char *evomail_uri;
- const char *uid;
-
- if (store == NULL)
- return NULL;
-
- service_url = camel_service_get_url (CAMEL_SERVICE (store));
- account = mail_config_get_account_by_source_url (service_url);
-
- if (account == NULL) {
- /* since we have no explicit account for 'local' folders, make one up */
- /* TODO: check the folder is really a local one, folder->parent_store == local_store? */
- uid = "local";
- /*g_free (service_url);
- return NULL;*/
- } else {
- uid = account->uid;
- }
-
- evomail_uri = g_strconcat ("evomail:///", uid, "/", camel_folder_get_full_name (folder), NULL);
- g_free (service_url);
-
- return evomail_uri;
-}
-
-
BONOBO_TYPE_FUNC_FULL (MailComponent, GNOME_Evolution_Component, PARENT_TYPE, mail_component)
6 * Update to 2.4.3.marcus2004-06-124-6/+6 * - Upgrade to 804.027.vanilla2004-06-114-7/+33 * Update to version 3.2.3lofi2004-06-102-2/+1 * - Update to version 3.11.r1;thierry2004-06-076-130/+587 * - Readd distinfo for dropshadow patchpav2004-06-052-0/+4 * Update to 2.6.2.marcus2004-06-052-3/+3 * Update to 2.4.2.marcus2004-06-056-10/+10 * Update to 2.2.12bland2004-06-0512-40/+12 * Sync with new bsd.autotools.mkade2004-06-056-23/+15 * 5.x's <usbhid.h> lacks __BEGIN_DECLS / __END_DECLS, so we need to wrapdes2004-06-032-7/+6 * add missing fileijliao2004-06-032-1/+2 * Putting commit bit in storage. I don't have the timepatrick2004-06-031-1/+1 * - Move to new category x11-themes.pav2004-06-0213-112/+0 * - gtk-qt-engine was moved from x11-toolkits to x11-themespav2004-06-021-1/+0 * Repocopy x11-toolkits/gtk-qt-engine to x11-themes/gtk-qt-engine.thierry2004-06-028-182/+0 * - This port was moved to x11-themes category.pav2004-06-02144-5890/+0 * - Populate new category x11-themes with some suitable candidatespav2004-06-021-30/+0 * Previous commit unintentionally dropped maintainership.des2004-06-011-1/+1 * Upgrade to 1.8.3.des2004-06-015-29/+54 * Fix a crash when trying to render non-Hangul unicode characters. This wasmarcus2004-06-012-0/+86 * - Update to 0.42erwin2004-05-312-5/+10 * Unbreak on 4.x and get rid of USE_GCC.lofi2004-05-312-10/+78 * Add gtk-qt-engine 0.3, a GTK-QT Theme Engine allowing GTK2 to usethierry2004-05-319-0/+115 * o) Update to version 4.50.91lkoeller2004-05-305-454/+153 * Don't try to enforce PREFIX by patching, Qt already honors it.lofi2004-05-281-1/+1 * - Install Gtk2 files to gtk-2.0/2.4.0 instead of gtk-2.0/2.2.0pav2004-05-271-3/+3 * Patch configure instead of piping echo output to the configure script -lofi2004-05-252-2/+13 * Fix/update MASTER_SITES.lofi2004-05-241-4/+8 * - Update to version 1.2.1krion2004-05-248-102/+230 * - Make fetchablepav2004-05-231-8/+2 * BROKEN on amd64: Does not compile (missing -fPIC)kris2004-05-231-1/+7 * BROKEN: Unfetchablekris2004-05-231-0/+2 * - According to contents of distfile, this is 0.6.11pav2004-05-231-2/+1 * Fix location of pkgconfig file.lofi2004-05-232-3/+8 * Resign maintainership to ports@. gnome@ hasn't been that active in maintainingmarcus2004-05-224-4/+4 * Adjust CONFLICTS, the latest revision of the xfmail port does no longerlofi2004-05-221-1/+3 * Shase qscintilla shared library version.arved2004-05-201-1/+2 * Update to 1.3arved2004-05-203-7/+9 * - Chase orbitcpp shlib versionbland2004-05-192-12/+2 * Remove dependency on Xaw headers, fixing build.anholt2004-05-181-0/+42 * Upgrade to 0.15.3.obraun2004-05-184-32/+3 * Start the QT2 deorbit by marking all ports that depend non-optionalarved2004-05-171-1/+3 * Update to 3.3.2lofi2004-05-164-33/+5 * Restore maintainer; his email was bouncing last week and I fat-fingered thekris2004-05-161-1/+1 * Reset bouncing maintainer address:kris2004-05-161-1/+1 * Add an additional patch to make Qt compile on 4.x/Alpha.lofi2004-05-151-0/+14 * Update to 2.6.1.marcus2004-05-153-3/+7 * Requires libXext, which covers some of the other deps.anholt2004-05-131-4/+2 * Update to 7.0.2.anholt2004-05-112-4/+3 * Update to 6.2.3.anholt2004-05-112-4/+3 * fix build on -stableijliao2004-05-101-0/+12 * Add missing xproto build depend.anholt2004-05-091-1/+2 * Drop maintainership. Maintainer is not using FreeBSD aserwin2004-05-092-2/+2 * Update to 0.1.5.anholt2004-05-084-66/+4 * Reword some of the dropshadow patch warning message text stuff thingers.adamw2004-05-072-4/+6 * Add experimental WITH_DROPSHADOW option back in; it is not supported bymezz2004-05-064-0/+38 * Chase vte shlib version.bland2004-05-064-4/+4 * Update to 0.11.11bland2004-05-065-21/+28 * Fix build on AMD64arved2004-05-053-4/+41 * Change my email to mezz@FreeBSD.org.mezz2004-05-033-3/+3 * Update lang/ruby18 and the bundled modules to the latest 1.8 branchknu2004-05-033-46/+153 * Convert build switches to OPTIONS.lofi2004-05-031-22/+10 * Update to 2.6.1.1bland2004-05-024-14/+4 * x11-toolkits/ruby-gtkglext:mezz2004-05-021-3/+7 * Update to 2.6.1.marcus2004-05-014-4/+19 * Update to 2.4.1.marcus2004-05-016-6/+24 * Version update to handle new GTK stuff (fixing the broken port issuelinimon2004-04-303-6/+13 * - ignore creation of files in /root/GNUstepdinoex2004-04-291-5/+0 * - reorder targetdinoex2004-04-291-1/+1 * Update to 2.6.1.marcus2004-04-293-22/+25 * Fix dependencies.vs2004-04-291-1/+1 * Add a missing dependency on librsvg2 to fix the package build on 4.X.marcus2004-04-224-8/+8 * Update to 2.4.0.marcus2004-04-212-5/+5 * add p5-Gtk2-Html2 0.03ijliao2004-04-205-0/+60 * upgrade to 1.042ijliao2004-04-203-5/+28 * Update to 0.9.5: Fix build with most recent GHC version.vs2004-04-203-8/+29 * Update to 0.7.marcus2004-04-204-66/+81 * Update to 2.6.1.marcus2004-04-203-3/+5 * Update to 2.6.1.marcus2004-04-203-3/+6 * Update to 1.0.4.marcus2004-04-202-4/+3 * Update to 2.6.1.marcus2004-04-203-3/+4 * Use the right MTREE_FILEarved2004-04-193-0/+3 * BROKEN: Broken dependencykris2004-04-191-0/+2 * These broken ports are scheduled for deletion on June 18 if they arekris2004-04-191-0/+2 * Update to 1.0.1.marcus2004-04-193-3/+4 * BROKEN: Does not compilekris2004-04-192-0/+4 * Add py-fltk, a Python wrapper for the Fast Light Tool Kit cross-platform grap...pav2004-04-196-0/+145 * Add py-fox, a Python bindings for FOX GUI toolkit.pav2004-04-196-0/+232 * update to 4.0.5oliver2004-04-194-14/+12 * Drop the coalescence timeout from 50 to 15 to compromise between actualmarcus2004-04-182-2/+2 * Always add the default gtkrc file to the search path so that we know we'llmarcus2004-04-182-8/+33 * Add missing fileskris2004-04-171-0/+2 * Add a missing RUN_DEPENDS on libXpm.marcus2004-04-161-2/+3 * fix build on -stableijliao2004-04-161-2/+3 * utilize MASTER_SITE_SOURCEFORGEijliao2004-04-151-2/+3 * Unbreak, the PORTREV-bump affected path-name generation.vs2004-04-151-1/+1 * wxWindows -> wxWidgetsfjoe2004-04-1410-11/+11 * Move the gtk20 dependency to USE_GNOME to chase the gtk20 shared lib version.marcus2004-04-131-1/+1 * add guis 1.4ijliao2004-04-134-0/+50 * upgrade to 0.5.4ijliao2004-04-122-5/+5 * BROKEN on sparc64: Does not compilekris2004-04-121-1/+7 * BROKEN on sparc64: Build failskris2004-04-121-1/+7 * * Add a missing build dependency on xextensions [1]marcus2004-04-122-1/+3 * Mark this port BROKEN with gtk+-2.4.marcus2004-04-111-0/+2 * This seems to be broken globally.kris2004-04-112-8/+4 * Tidy up whitespace.trevor2004-04-1113-18/+18 * Trim whitespace.trevor2004-04-111-1/+0 * Add a missing build dependency on xextensions.marcus2004-04-101-0/+1 * Remove PTHREAD_LIBS form CONFIGURE_ENV.bland2004-04-101-2/+2 * Add x11-toolkits/ruby-gtkglext, Ruby binding for GtkGLExt.knu2004-04-094-0/+61 * - Update the Ruby/GNOME2 suite to 0.9.1.knu2004-04-096-7/+14 * Fix build with gtk+-2.4.marcus2004-04-091-0/+5 * * Teach vte about posix_openpt()marcus2004-04-094-14/+52 * Update to 0.28arved2004-04-082-7/+5 * - Resolve conflict with vimkrion2004-04-084-5/+34 * Add Shell.h to the plist.marcus2004-04-082-1/+2 * - move post-extract target to pre-configuredinoex2004-04-081-3/+1 * - Update to version 804.025.b16krion2004-04-083-17/+47 * Add missing dependency on jpeg.9.fjoe2004-04-072-0/+2 * - Fix dependency after gtk 2.4.0 importale2004-04-061-1/+1 * Correct gnome-themes dependency.marcus2004-04-061-2/+2 * wxWindows -> wxWidgetsfjoe2004-04-0612-16/+16 * Update to 2.0.2.marcus2004-04-053-4/+16 * Fix some known compatibility problems with GNOME 2.6.marcus2004-04-0511-16/+141 * Add libgtk-java, a Java wrapper around the gtk+-2.4 API.marcus2004-04-0510-0/+164 * Adjust the gtk20 path for modules, themes, and input methods to catch upmarcus2004-04-055-7/+7 * Chase the glib20 update, and bump all affected ports' PORTREVISIONs.marcus2004-04-0560-47/+60 * Presenting GNOME 2.6.0. The FreeBSD GNOME Team feels this our best releasemarcus2004-04-0577-712/+936 * upgrade to 0.5.3ijliao2004-04-054-32/+34 * Reset two missed ports back to WANT_AUTO* -- the other one mentioned,ade2004-04-052-4/+4 * BROKEN on amd64: Build failskris2004-04-032-0/+8 * - make portlint happy, fix whitepacedinoex2004-04-031-1/+1 * - Use ${TEST} and ${MAKE} instead of test and makekrion2004-04-031-7/+4 * Remove category pkg/COMMENT files in favour of a COMMENT variable in thekris2004-04-022-1/+2 * - Change tcl dependency from :build to :extractpav2004-04-021-1/+13 * upgrade to 1.00ijliao2004-04-015-70/+26 * add p5-Gnome2-Canvas 1.00ijliao2004-04-015-0/+82 * upgrade to 1.001ijliao2004-04-013-31/+29 * upgrade to 1.040ijliao2004-04-013-184/+47 * Add some more patches from Freedesktop to try and fix this ports compilationmarcus2004-03-312-6/+34 * Change the last remaining references to philip@paeps.cx to philip@FreeBSD.org.philip2004-03-312-2/+2 * not use auto-gen-plist to prevent mis-delete when portupgradeijliao2004-03-317-42/+359 * SIZEify (maintainer timeout)trevor2004-03-3138-0/+40 * Update to 2.2.11.marcus2004-03-3112-104/+12 * - Use USE_ICONV knobkrion2004-03-314-7/+7 * Declare CONFLICTS between libXt and XFree86-4-librarieslofi2004-03-281-0/+2 * Add a missing dependency on libSM.marcus2004-03-281-2/+3 * * Consolidate some GNOME components and add some new functionalitymarcus2004-03-288-4/+24 * Unbreak on -STABLE (remove -pedantic-errors)vs2004-03-28