Commit d9742464 authored by Matthew Barnes's avatar Matthew Barnes Committed by Rodrigo Moya
Browse files

Remove em_uri_from_camel() and em_uri_to_camel().

Functions are no longer used, or wanted.
parent 8eebc393
......@@ -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 */
......
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment