mp = camel_mime_parser_new();
camel_mime_parser_init_with_stream(mp, finfo->header);
- mi = camel_message_info_new_from_parser(job->folder->summary, mp);
+ mi = camel_folder_summary_info_new_from_parser(job->folder->summary, mp);
camel_object_unref(mp);
if (mi) {
((CamelMessageInfoBase *)mi)->flags = r->server_flags;
((CamelIMAPXMessageInfo *)mi)->server_flags = r->server_flags;
camel_flag_list_copy(&((CamelMessageInfoBase *)mi)->user_flags, &r->server_user_flags);
- ((CamelIMAPXMessageInfo *)mi)->server_flags = r->server_user_flags; /*check this*/
+ ((CamelIMAPXMessageInfo *)mi)->server_user_flags = r->server_user_flags;
break;
}
}
goto fail;
}
- info = camel_message_info_new_from_message(folder->summary, message, mi);
+ info = camel_folder_summary_info_new_from_message((CamelFolderSummary *)folder->summary, message, NULL);
info->uid = uid;
uid = NULL;
camel_folder_summary_add(folder->summary, info);
}
uflags = ((CamelMessageInfoBase *)info)->user_flags;
- suflags = info->server_flags; /*check*/
+ suflags = info->server_user_flags;
while (uflags || suflags) {
int res;
folder_name = "INBOX";
storage_path = g_strdup_printf("%s/folders", imapx_store->storage_path);
- folder_dir = imap_path_to_physical (storage_path, folder_name);
+ folder_dir = imapx_path_to_physical (storage_path, folder_name);
g_free(storage_path);
- new_folder = camel_imap_folder_new (store, folder_name, folder_dir, ex);
+ /* FIXME */
+ new_folder = camel_imapx_folder_new (store, folder_dir, folder_name);
g_free(folder_dir);
camel_store_summary_info_free((CamelStoreSummary *)imapx_store->summary, si);
imap_get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex)
{
CamelIMAPXStore *istore = (CamelIMAPXStore *)store;
- CamelIMAPXFolder *folder;
+ CamelFolder *folder;
folder = get_folder_offline(store, folder_name, flags, ex);
if (folder == NULL) {
return NULL;
}
- return (CamelFolder *)folder;
+ return folder;
}
static CamelFolder *
}
}
+
+/* folder_name is path name */
+static CamelFolderInfo *
+imapx_build_folder_info (CamelIMAPXStore *imap_store, const gchar *folder_name)
+{
+ CamelURL *url;
+ const gchar *name;
+ CamelFolderInfo *fi;
+
+ fi = camel_folder_info_new ();
+ fi->full_name = g_strdup(folder_name);
+ fi->unread = -1;
+ fi->total = -1;
+
+ url = camel_url_new (imap_store->base_url, NULL);
+ g_free (url->path);
+ url->path = g_strdup_printf ("/%s", folder_name);
+ fi->uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
+ camel_url_free(url);
+ name = strrchr (fi->full_name, '/');
+ if (name == NULL)
+ name = fi->full_name;
+ else
+ name++;
+ if (!g_ascii_strcasecmp (fi->full_name, "INBOX"))
+ fi->name = g_strdup (_("Inbox"));
+ /* Do not localize the rest, these are from a server, thus shouldn't be localized */
+ /*else if (!g_ascii_strcasecmp (fi->full_name, "Drafts"))
+ fi->name = g_strdup (_("Drafts"));
+ else if (!g_ascii_strcasecmp (fi->full_name, "Sent"))
+ fi->name = g_strdup (_("Sent"));
+ else if (!g_ascii_strcasecmp (fi->full_name, "Templates"))
+ fi->name = g_strdup (_("Templates"));
+ else if (!g_ascii_strcasecmp (fi->full_name, "Trash"))
+ fi->name = g_strdup (_("Trash"));*/
+ else
+ fi->name = g_strdup (name);
+
+ return fi;
+}
+
static CamelFolderInfo *
get_folder_info_offline (CamelStore *store, const gchar *top,
guint32 flags, CamelException *ex)
name = camel_imapx_store_summary_path_to_full(imapx_store->summary, top, imapx_store->dir_sep);
}
- pattern = imap_concat(imapx_store, name, "*");
+ pattern = imapx_concat(imapx_store, name, "*");
/* folder_info_build will insert parent nodes as necessary and mark
* them as noselect, which is information we actually don't have at
&&((flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIBED) == 0
|| (si->flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED))) {
- fi = imap_build_folder_info(imapx_store, camel_store_info_path((CamelStoreSummary *)imapx_store->summary, si));
+ fi = imapx_build_folder_info(imapx_store, camel_store_info_path((CamelStoreSummary *)imapx_store->summary, si));
fi->unread = si->unread;
fi->total = si->total;
fi->flags = si->flags;
return v;
}
+gchar *
+imapx_path_to_physical (const gchar *prefix, const gchar *vpath)
+{
+ GString *out = g_string_new(prefix);
+ const gchar *p = vpath;
+ gchar c, *res;
+
+ g_string_append_c(out, '/');
+ p = vpath;
+ while ((c = *p++)) {
+ if (c == '/') {
+ g_string_append(out, "/" SUBFOLDER_DIR_NAME "/");
+ while (*p == '/')
+ p++;
+ } else
+ g_string_append_c(out, c);
+ }
+
+ res = out->str;
+ g_string_free(out, FALSE);
+
+ return res;
+}
+
+gchar *
+imapx_concat (CamelImapStore *imap_store, const gchar *prefix, const gchar *suffix)
+{
+ gsize len;
+
+ len = strlen (prefix);
+ if (len == 0 || prefix[len - 1] == imap_store->dir_sep)
+ return g_strdup_printf ("%s%s", prefix, suffix);
+ else
+ return g_strdup_printf ("%s%c%s", prefix, imap_store->dir_sep, suffix);
+}