diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-05-06 06:38:31 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-06-30 00:42:10 +0800 |
commit | d974246473c9e511c01658f2c3f618755d6a514a (patch) | |
tree | 172a00249e757bf72122d11cc95667fc547d99f7 | |
parent | 8eebc3932b6940eeb19e10e3df1164c44626737c (diff) | |
download | gsoc2013-evolution-d974246473c9e511c01658f2c3f618755d6a514a.tar.gz gsoc2013-evolution-d974246473c9e511c01658f2c3f618755d6a514a.tar.zst gsoc2013-evolution-d974246473c9e511c01658f2c3f618755d6a514a.zip |
Remove em_uri_from_camel() and em_uri_to_camel().
Functions are no longer used, or wanted.
-rw-r--r-- | mail/em-utils.c | 142 | ||||
-rw-r--r-- | mail/em-utils.h | 4 |
2 files changed, 0 insertions, 146 deletions
diff --git a/mail/em-utils.c b/mail/em-utils.c index 14a8706c21..81a702ce6b 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -1450,148 +1450,6 @@ em_utils_folder_name_from_uri (const gchar *uri) return folder_name; } -/* 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 - */ - -gchar *em_uri_from_camel (const gchar *curi) -{ - CamelURL *curl; - EAccount *account; - const gchar *uid, *path; - gchar *euri, *tmp; - CamelProvider *provider; - - /* Easiest solution to code that shouldnt be calling us */ - if (!strncmp(curi, "email:", 6)) - return g_strdup (curi); - - provider = camel_provider_get (curi, 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); - - if (strcmp(curl->protocol, "vfolder") == 0) - uid = "vfolder@local"; - else if ((account = e_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) { - if (path[0] == '/') - path++; - - tmp = camel_url_encode(path, ";?"); - euri = g_strdup_printf("email://%s/%s", uid, tmp); - g_free (tmp); - } else { - euri = g_strdup_printf("email://%s/", uid); - } - - d(printf("em uri from camel '%s' -> '%s'\n", curi, euri)); - - camel_url_free (curl); - - return euri; -} - -gchar *em_uri_to_camel (const gchar *euri) -{ - EAccountList *account_list; - const EAccount *account; - EAccountService *service; - CamelProvider *provider; - CamelURL *eurl, *curl; - gchar *uid, *curi; - - if (strncmp(euri, "email:", 6) != 0) { - d(printf("em uri to camel not euri '%s'\n", euri)); - return g_strdup (euri); - } - - eurl = camel_url_new (euri, NULL); - if (eurl == NULL) - return g_strdup (euri); - - g_return_val_if_fail (eurl->host != NULL, g_strdup (euri)); - - if (eurl->user != NULL) { - /* 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)) { - gchar *base; - - if (strcmp(eurl->user, "vfolder") == 0) - curl = camel_url_new("vfolder:", NULL); - else - curl = camel_url_new("maildir:", NULL); - - base = g_strdup_printf("%s/mail/%s", e_get_user_data_dir(), eurl->user); -#ifdef G_OS_WIN32 - /* Turn backslashes into slashes to avoid URI encoding */ - { - gchar *p = base; - while ((p = strchr (p, '\\'))) - *p++ = '/'; - } -#endif - 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; - } - - uid = g_strdup_printf("%s@%s", eurl->user, eurl->host); - } else { - uid = g_strdup (eurl->host); - } - - account_list = e_get_account_list (); - account = e_account_list_find (account_list, E_ACCOUNT_FIND_UID, uid); - g_free (uid); - - if (account == NULL) { - camel_url_free (eurl); - d(printf("em uri to camel no account '%s' -> '%s'\n", euri, euri)); - return g_strdup (euri); - } - - service = account->source; - provider = camel_provider_get (service->url, NULL); - if (provider == NULL) - return g_strdup (euri); - - curl = camel_url_new (service->url, NULL); - if (provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH) - camel_url_set_fragment (curl, eurl->path[0]=='/'?eurl->path+1:eurl->path); - else - camel_url_set_path (curl, eurl->path); - - curi = camel_url_to_string (curl, 0); - - camel_url_free (eurl); - camel_url_free (curl); - - d(printf("em uri to camel '%s' -> '%s'\n", euri, curi)); - - return curi; -} - /* ********************************************************************** */ /* runs sync, in main thread */ diff --git a/mail/em-utils.h b/mail/em-utils.h index 5ae9951a68..5787b4e290 100644 --- a/mail/em-utils.h +++ b/mail/em-utils.h @@ -77,10 +77,6 @@ void em_utils_empty_trash (GtkWidget *parent, EMailSession *session); /* returns the folder name portion of an URI */ gchar *em_utils_folder_name_from_uri (const gchar *uri); -/* internal/camel uri translation */ -gchar *em_uri_from_camel (const gchar *curi); -gchar *em_uri_to_camel (const gchar *euri); - /* is this address in the addressbook? caches results */ gboolean em_utils_in_addressbook (CamelInternetAddress *addr, gboolean local_only); CamelMimePart *em_utils_contact_photo (CamelInternetAddress *addr, gboolean local); |