aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/imap/camel-imap-folder.c36
-rw-r--r--camel/providers/imap/camel-imap-folder.h4
-rw-r--r--camel/providers/imap/camel-imap-store.c31
3 files changed, 38 insertions, 33 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 649cf8d94e..c203e888fa 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -183,11 +183,11 @@ camel_imap_folder_get_type (void)
}
CamelFolder *
-camel_imap_folder_new (CamelStore *parent, CamelException *ex)
+camel_imap_folder_new (CamelStore *parent, const char *folder_name, CamelException *ex)
{
CamelFolder *folder = CAMEL_FOLDER (gtk_object_new (camel_imap_folder_get_type (), NULL));
- CF_CLASS (folder)->init (folder, parent, NULL, "INBOX", "/", FALSE, ex);
+ CF_CLASS (folder)->init (folder, parent, NULL, folder_name, "/", FALSE, ex);
return folder;
}
@@ -311,11 +311,10 @@ imap_init (CamelFolder *folder, CamelStore *parent_store, CamelFolder *parent_fo
static void
imap_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
{
- /* TODO: actually code this method */
+#if 0
CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
gint i, max;
-#if 0
/* uhhh...this is kinda unsafe so we'll leave it blocked out */
if (imap_folder->summary) {
max = imap_folder->summary->len;
@@ -663,7 +662,6 @@ imap_get_subfolder_names (CamelFolder *folder, CamelException *ex)
/* parse out the subfolders */
listing = g_ptr_array_new ();
- /*g_ptr_array_add (listing, g_strdup("INBOX"));*/
if (result) {
char *ptr = result;
@@ -710,40 +708,32 @@ imap_get_subfolder_names (CamelFolder *folder, CamelException *ex)
static void
imap_delete_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex)
{
- gchar *result;
- gint status;
-
- status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), folder,
- &result, "UID STORE %s +FLAGS.SILENT (\\Deleted)", uid);
+ CamelMessageInfo *info;
- if (status != CAMEL_IMAP_OK) {
+ if (!(info = (CamelMessageInfo *)imap_summary_get_by_uid (folder, uid))) {
CamelService *service = CAMEL_SERVICE (folder->parent_store);
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- "Could not mark message %s as 'Deleted' on IMAP server %s: %s",
- uid, service->url->host,
- status == CAMEL_IMAP_ERR ? result :
- "Unknown error");
- g_free (result);
+ "Could not set flags for message %s on IMAP server %s: %s",
+ uid, service->url->host, "Unknown error");
return;
}
- g_free (result);
- return;
+ info->flags |= CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_FOLDER_FLAGGED;
}
static CamelMimeMessage *
imap_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex)
{
CamelStream *msgstream;
- CamelStreamFilter *f_stream; /* will be used later w/ crlf filter */
- CamelMimeFilter *filter; /* crlf/dot filter */
+ /*CamelStreamFilter *f_stream;*/
+ /*CamelMimeFilter *filter;*/
CamelMimeMessage *msg;
- CamelMimePart *part;
+ /*CamelMimePart *part;*/
gchar *result, *header, *body, *mesg, *p;
int id, status, part_len;
- status = camel_imap_command_extended (CAMEL_STORE (folder->parent_store), folder,
+ status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), folder,
&result, "UID FETCH %s BODY.PEEK[HEADER]", uid);
if (!result || status != CAMEL_IMAP_OK) {
@@ -778,7 +768,7 @@ imap_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *
g_free (result);
printf ("*** We got the header ***\n");
- status = camel_imap_command_extended (CAMEL_STORE (folder->parent_store), folder,
+ status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), folder,
&result, "UID FETCH %s BODY[TEXT]", uid);
if (!result || status != CAMEL_IMAP_OK) {
diff --git a/camel/providers/imap/camel-imap-folder.h b/camel/providers/imap/camel-imap-folder.h
index 625b91a06f..bb27040d61 100644
--- a/camel/providers/imap/camel-imap-folder.h
+++ b/camel/providers/imap/camel-imap-folder.h
@@ -61,7 +61,9 @@ typedef struct {
/* public methods */
-CamelFolder *camel_imap_folder_new (CamelStore *parent, CamelException *ex);
+CamelFolder *camel_imap_folder_new (CamelStore *parent,
+ const char *folder_name,
+ CamelException *ex);
void camel_imap_folder_set_namespace (CamelFolder *folder, gchar *namespace);
/* Standard Gtk function */
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index cf0789de93..0c8dc87a9b 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -313,14 +313,16 @@ camel_imap_store_get_toplevel_dir (CamelImapStore *store)
{
CamelURL *url = CAMEL_SERVICE (store)->url;
- g_assert(url != NULL);
+ g_assert (url != NULL);
return url->path;
}
static gboolean
imap_create (CamelFolder *folder, CamelException *ex)
{
- gchar *result;
+ CamelStore *store = CAMEL_STORE (folder->parent_store);
+ CamelURL *url = CAMEL_SERVICE (store)->url;
+ gchar *result, *folder_path;
gint status;
g_return_val_if_fail (folder != NULL, FALSE);
@@ -338,20 +340,25 @@ imap_create (CamelFolder *folder, CamelException *ex)
return TRUE;
/* create the directory for the subfolder */
+ if (url && url->path)
+ folder_path = g_strdup_printf ("%s/%s", url->path, folder->full_name);
+ else
+ folder_path = g_strdup (folder->full_name);
status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), NULL,
- &result, "CREATE %s", folder->full_name);
+ &result, "CREATE %s", folder_path);
if (status != CAMEL_IMAP_OK) {
CamelService *service = CAMEL_SERVICE (folder->parent_store);
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
"Could not CREATE %s on IMAP server %s: %s.",
- folder->full_name, service->url->host,
+ folder_path, service->url->host,
status == CAMEL_IMAP_ERR ? result :
"Unknown error");
g_free (result);
+ g_free (folder_path);
return FALSE;
}
-
+ g_free (folder_path);
g_free (result);
return TRUE;
@@ -360,13 +367,19 @@ imap_create (CamelFolder *folder, CamelException *ex)
static CamelFolder *
get_folder (CamelStore *store, const char *folder_name, gboolean create, CamelException *ex)
{
- CamelFolder *new_folder = camel_imap_folder_new (store, ex);
+ CamelFolder *new_folder;
+
+ g_return_val_if_fail (store != NULL, NULL);
+ g_return_val_if_fail (folder_name != NULL, NULL);
+
+ new_folder = camel_imap_folder_new (store, folder_name, ex);
- if (imap_create (new_folder, ex)) {
- return new_folder;
+ if (!imap_create (new_folder, ex)) {
+ /* we should set an exception */
+ return NULL;
}
- return NULL;
+ return new_folder;
}
static gchar *