/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2005 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Sylpheed-Claws team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "imap.h"
#include "imap_gtk.h"
#include "inc.h"
+#include "xml.h"
#ifdef HAVE_LIBETPAN
GHashTable *flags_unset_table;
};
+static XMLTag *imap_item_get_xml(Folder *folder, FolderItem *item);
+static void imap_item_set_xml(Folder *folder, FolderItem *item, XMLTag *tag);
+
static void imap_folder_init (Folder *folder,
const gchar *name,
const gchar *path);
imap_class.close = imap_close;
imap_class.get_num_list = imap_get_num_list;
imap_class.scan_required = imap_scan_required;
+ imap_class.set_xml = folder_set_xml;
+ imap_class.get_xml = folder_get_xml;
+ imap_class.item_set_xml = imap_item_set_xml;
+ imap_class.item_get_xml = imap_item_get_xml;
/* Message functions */
imap_class.get_msginfo = imap_get_msginfo;
IMAPFolderItem *item = (IMAPFolderItem *)node->data;
item->lastuid = 0;
- item->uid_next = 0;
g_slist_free(item->uid_list);
item->uid_list = NULL;
imap_get_capabilities(session);
switch(type) {
+ case IMAP_AUTH_ANON:
+ ok = imap_cmd_login(session, user, pass, "ANONYMOUS");
+ break;
case IMAP_AUTH_CRAM_MD5:
ok = imap_cmd_login(session, user, pass, "CRAM-MD5");
break;
break;
default:
debug_print("capabilities:\n"
+ "\t ANONYMOUS %d\n"
"\t CRAM-MD5 %d\n"
"\t LOGIN %d\n",
+ imap_has_capability(session, "ANONYMOUS"),
imap_has_capability(session, "CRAM-MD5"),
imap_has_capability(session, "LOGIN"));
if (imap_has_capability(session, "CRAM-MD5"))
{
RemoteFolder *rfolder = REMOTE_FOLDER(folder);
IMAPSession *session = NULL;
+ static time_t last_failure = 0;
g_return_val_if_fail(folder != NULL, NULL);
g_return_val_if_fail(FOLDER_CLASS(folder) == &imap_class, NULL);
g_return_val_if_fail(folder->account != NULL, NULL);
- if (prefs_common.work_offline && !inc_offline_should_override()) {
+ if (prefs_common.work_offline &&
+ !inc_offline_should_override(
+ _("Sylpheed-Claws needs network access in order "
+ "to access the IMAP server."))) {
return NULL;
}
} */
} else {
imap_reset_uid_lists(folder);
+ if (time(NULL) - last_failure <= 2)
+ return NULL;
session = imap_session_new(folder, folder->account);
}
- if(session == NULL)
+ if(session == NULL) {
+ last_failure = time(NULL);
return NULL;
+ }
/* Make sure session is authenticated */
if (!IMAP_SESSION(session)->authenticated)
if (!IMAP_SESSION(session)->authenticated) {
session_destroy(SESSION(session));
rfolder->session = NULL;
+ last_failure = time(NULL);
return NULL;
}
g_return_if_fail(account->userid != NULL);
pass = account->passwd;
- if (!pass) {
+ if (!pass && account->imap_auth_type != IMAP_AUTH_ANON) {
gchar *tmp_pass;
tmp_pass = input_dialog_query_password(account->recv_server, account->userid);
if (!tmp_pass)
- tmp_pass = g_strdup(""); /* allow empty password */
+ return;
Xstrdup_a(pass, tmp_pass, {g_free(tmp_pass); return;});
g_free(tmp_pass);
+ } else if (account->imap_auth_type == IMAP_AUTH_ANON) {
+ pass = "";
}
statusbar_print_all(_("Connecting to IMAP4 server %s...\n"),
account->recv_server);
make_dir_hier(path);
filename = g_strconcat(path, G_DIR_SEPARATOR_S, itos(uid), NULL);
g_free(path);
-
+ debug_print("trying to fetch cached %s\n", filename);
if (is_file_exist(filename)) {
/* see whether the local file represents the whole message
* or not. As the IMAP server reports size with \r chars,
procmsg_msginfo_free(msginfo);
file_strip_crs(filename);
return filename;
+ } else if (!cached) {
+ debug_print("message not cached, considering file complete\n");
+ procmsg_msginfo_free(msginfo);
+ file_strip_crs(filename);
+ return filename;
} else {
procmsg_msginfo_free(cached);
procmsg_msginfo_free(msginfo);
unlock_session();
return -1;
}
+ } else if (!(MSG_IS_QUEUED(*fileinfo->flags)
+ || MSG_IS_DRAFT(*fileinfo->flags))
+ && (folder_has_parent_of_type(dest, F_QUEUE)
+ || folder_has_parent_of_type(dest, F_DRAFT))) {
+ return -1;
}
}
if (real_file == NULL)
statusbar_progress_all(0,0,0);
statusbar_pop_all();
return -1;
+ } else {
+ debug_print("appended new message as %d\n", new_uid);
+ /* put the local file in the imapcache, so that we don't
+ * have to fetch it back later. */
+ if (new_uid > 0) {
+ gchar *cache_path = folder_item_get_path(dest);
+ if (!is_dir_exist(cache_path))
+ make_dir_hier(cache_path);
+ if (is_dir_exist(cache_path)) {
+ gchar *cache_file = g_strconcat(
+ cache_path, G_DIR_SEPARATOR_S,
+ itos(new_uid), NULL);
+ copy_file(real_file, cache_file, TRUE);
+ debug_print("copied to cache: %s\n", cache_file);
+ g_free(cache_file);
+ }
+ g_free(cache_path);
+ }
}
if (relation != NULL)
g_relation_insert(relation, fileinfo->msginfo != NULL ?
(gpointer) fileinfo->msginfo : (gpointer) fileinfo,
GINT_TO_POINTER(dest->last_num + 1));
+ if (new_uid == 0) {
+ new_uid = dest->last_num+1;
+ }
if (last_uid < new_uid)
last_uid = new_uid;
if (file_is_tmp)
g_unlink(real_file);
+
+ g_free(real_file);
}
statusbar_progress_all(0,0,0);
statusbar_pop_all();
+ imap_cmd_expunge(session);
unlock_session();
g_free(destdir);
msginfo = (MsgInfo *)msglist->data;
g_return_val_if_fail(msginfo->folder != NULL, -1);
+ /* if from/to are the same "type" (with or without extra headers),
+ * copy them via imap */
if (folder == msginfo->folder->folder &&
!folder_has_parent_of_type(msginfo->folder, F_DRAFT) &&
- !folder_has_parent_of_type(msginfo->folder, F_QUEUE)) {
+ !folder_has_parent_of_type(msginfo->folder, F_QUEUE) &&
+ !folder_has_parent_of_type(dest, F_DRAFT) &&
+ !folder_has_parent_of_type(dest, F_QUEUE)) {
+ ret = imap_do_copy_msgs(folder, dest, msglist, relation);
+ return ret;
+ } else if (folder == msginfo->folder->folder &&
+ (folder_has_parent_of_type(msginfo->folder, F_DRAFT) ||
+ folder_has_parent_of_type(msginfo->folder, F_QUEUE)) &&
+ (folder_has_parent_of_type(dest, F_DRAFT) ||
+ folder_has_parent_of_type(dest, F_QUEUE))) {
ret = imap_do_copy_msgs(folder, dest, msglist, relation);
return ret;
}
-
+ /* else reupload them */
file_list = procmsg_get_message_file_list(msglist);
g_return_val_if_fail(file_list != NULL, -1);
ret = imap_add_msgs(folder, dest, file_list, relation);
-
procmsg_message_file_list_free(file_list);
return ret;
if (r != MAILIMAP_NO_ERROR)
continue;
+ session_set_access_time(SESSION(session));
+
count = 0;
for(i = 0 ; i < carray_count(env_list) ; i ++) {
struct imap_fetch_env_info * info;
imap_fetch_env_free(env_list);
}
+ for (cur = seq_list; cur != NULL; cur = g_slist_next(cur)) {
+ struct mailimap_set * imapset;
+
+ imapset = cur->data;
+ mailimap_set_free(imapset);
+ }
+
session_set_access_time(SESSION(session));
stuff->done = TRUE;
return newlist;
data->numlist = newlist;
data->cur += count;
- if (prefs_common.work_offline && !inc_offline_should_override()) {
+ if (prefs_common.work_offline &&
+ !inc_offline_should_override(
+ _("Sylpheed-Claws needs network access in order "
+ "to access the IMAP server."))) {
g_free(data);
return NULL;
}
return NULL;
}
+gchar imap_get_path_separator_for_item(FolderItem *item)
+{
+ Folder *folder = NULL;
+ IMAPFolder *imap_folder = NULL;
+ if (!item)
+ return '/';
+ folder = item->folder;
+
+ if (!folder)
+ return '/';
+
+ imap_folder = IMAP_FOLDER(folder);
+
+ if (!imap_folder)
+ return '/';
+
+ return imap_get_path_separator(imap_folder, item->path);
+}
static gchar imap_get_path_separator(IMAPFolder *folder, const gchar *path)
{
IMAPNameSpace *namespace;
gchar separator = '/';
+ IMAPSession *session = imap_session_get(FOLDER(folder));
+ g_return_val_if_fail(session != NULL, '/');
if (folder->last_seen_separator == 0) {
clist * lep_list;
real_path = imap_get_real_path(folder, path);
-#if 0
- if (time(NULL) - item->last_update >= 5 && item->last_update != 1) {
- /* do the full stuff */
- item->last_update = 1; /* force update */
- debug_print("updating everything\n");
- r = imap_status(session, folder, path, item,
- &item->c_messages, &item->c_uid_next,
- &item->c_uid_validity, &item->c_unseen, block);
- if (r != MAILIMAP_NO_ERROR) {
- debug_print("status err %d\n", r);
- return IMAP_ERROR;
- }
- item->last_update = time(NULL);
- if (messages)
- *messages = item->c_messages;
- if (uid_next)
- *uid_next = item->c_uid_next;
- if (uid_validity)
- *uid_validity = item->c_uid_validity;
- if (unseen)
- *unseen = item->c_unseen;
- return 0;
- } else if (time(NULL) - item->last_update < 5) {
- /* return cached stuff */
- debug_print("using cache\n");
- if (messages)
- *messages = item->c_messages;
- if (uid_next)
- *uid_next = item->c_uid_next;
- if (uid_validity)
- *uid_validity = item->c_uid_validity;
- if (unseen)
- *unseen = item->c_unseen;
- return 0;
- }
-#endif
-
- /* if we get there, we're updating cache */
-
if (messages) {
mask |= 1 << 0;
}
/* low-level IMAP4rev1 commands */
-#if 0
-static gint imap_cmd_authenticate(IMAPSession *session, const gchar *user,
- const gchar *pass, IMAPAuthType type)
-{
- gchar *auth_type;
- gint ok;
- gchar *buf = NULL;
- gchar *challenge;
- gint challenge_len;
- gchar hexdigest[33];
- gchar *response;
- gchar *response64;
-
- auth_type = "CRAM-MD5";
-
- imap_gen_send(session, "AUTHENTICATE %s", auth_type);
- ok = imap_gen_recv(session, &buf);
- if (ok != IMAP_SUCCESS || buf[0] != '+' || buf[1] != ' ') {
- g_free(buf);
- return IMAP_ERROR;
- }
-
- challenge = g_malloc(strlen(buf + 2) + 1);
- challenge_len = base64_decode(challenge, buf + 2, -1);
- challenge[challenge_len] = '\0';
- g_free(buf);
-
- md5_hex_hmac(hexdigest, challenge, challenge_len, pass, strlen(pass));
- g_free(challenge);
-
- response = g_strdup_printf("%s %s", user, hexdigest);
- response64 = g_malloc((strlen(response) + 3) * 2 + 1);
- base64_encode(response64, response, strlen(response));
- g_free(response);
-
- sock_puts(SESSION(session)->sock, response64);
- ok = imap_cmd_ok(session, NULL);
- if (ok != IMAP_SUCCESS)
- log_warning(_("IMAP4 authentication failed.\n"));
-
- return ok;
-}
-#endif
-
static gint imap_cmd_login(IMAPSession *session,
const gchar *user, const gchar *pass,
const gchar *type)
type);
r = imap_threaded_login(session->folder, user, pass, type);
if (r != MAILIMAP_NO_ERROR) {
- log_error("IMAP4< Error logging in to %s\n",
+ log_print("IMAP4< Error logging in to %s\n",
SESSION(session)->server);
ok = IMAP_ERROR;
} else {
+ log_print("IMAP4< Login to %s successful\n",
+ SESSION(session)->server);
ok = IMAP_SUCCESS;
}
return ok;
{
int r;
- r = imap_threaded_starttls(session->folder);
+ r = imap_threaded_starttls(session->folder,
+ SESSION(session)->server, SESSION(session)->port);
if (r != MAILIMAP_NO_ERROR) {
debug_print("starttls err %d\n", r);
return IMAP_ERROR;
data->headers = headers;
data->body = body;
- if (prefs_common.work_offline && !inc_offline_should_override()) {
+ if (prefs_common.work_offline &&
+ !inc_offline_should_override(
+ _("Sylpheed-Claws needs network access in order "
+ "to access the IMAP server."))) {
g_free(data);
return -1;
}
flag_list = imap_flag_to_lep(flags);
r = imap_threaded_append(session->folder, destfolder,
- file, flag_list);
- if (new_uid != NULL)
- *new_uid = 0;
+ file, flag_list, new_uid);
+ mailimap_flag_list_free(flag_list);
if (r != MAILIMAP_NO_ERROR) {
debug_print("append err %d\n", r);
mailimap_store_att_flags_new_remove_flags_silent(flag_list);
r = imap_threaded_store(session->folder, set, store_att_flags);
+ mailimap_store_att_flags_free(store_att_flags);
if (r != MAILIMAP_NO_ERROR) {
return IMAP_ERROR;
{
int r;
- if (prefs_common.work_offline && !inc_offline_should_override()) {
+ if (prefs_common.work_offline &&
+ !inc_offline_should_override(
+ _("Sylpheed-Claws needs network access in order "
+ "to access the IMAP server."))) {
return -1;
}
r = imap_threaded_search(folder, IMAP_SEARCH_TYPE_SIMPLE, set,
&lep_uidlist);
+ mailimap_set_free(set);
+
if (r == MAILIMAP_NO_ERROR) {
GSList * fetchuid_list;
fetchuid_list =
imap_uid_list_from_lep(lep_uidlist);
+ mailimap_search_result_free(lep_uidlist);
+
uidlist = g_slist_concat(fetchuid_list, uidlist);
}
else {
if (r == MAILIMAP_NO_ERROR) {
fetchuid_list =
imap_uid_list_from_lep_tab(lep_uidtab);
+ imap_fetch_uid_list_free(lep_uidtab);
uidlist = g_slist_concat(fetchuid_list, uidlist);
}
}
data->item = item;
data->msgnum_list = msgnum_list;
data->session = session;
- if (prefs_common.work_offline && !inc_offline_should_override()) {
+ if (prefs_common.work_offline &&
+ !inc_offline_should_override(
+ _("Sylpheed-Claws needs network access in order "
+ "to access the IMAP server."))) {
g_free(data);
return -1;
}
{
IMAPFolderItem *item = (IMAPFolderItem *)_item;
IMAPSession *session;
- gint ok, nummsgs = 0, exists, uid_val, uid_next;
+ gint ok, nummsgs = 0, exists, uid_val, uid_next = 0;
GSList *uidlist = NULL;
gchar *dir;
gboolean selected_folder;
session = imap_session_get(folder);
g_return_val_if_fail(session != NULL, -1);
lock_session();
- statusbar_print_all("Scanning %s...\n", FOLDER_ITEM(item)->path
- ? FOLDER_ITEM(item)->path:"");
+
+ if (FOLDER_ITEM(item)->path)
+ statusbar_print_all(_("Scanning folder %s%c%s ..."),
+ FOLDER_ITEM(item)->folder->name,
+ G_DIR_SEPARATOR,
+ FOLDER_ITEM(item)->path);
+ else
+ statusbar_print_all(_("Scanning folder %s ..."),
+ FOLDER_ITEM(item)->folder->name);
selected_folder = (session->mbox != NULL) &&
(!strcmp(session->mbox, item->item.path));
- if (selected_folder) {
+ if (selected_folder && time(NULL) - item->use_cache < 2) {
ok = imap_cmd_noop(session);
if (ok != IMAP_SUCCESS) {
debug_print("disconnected!\n");
}
exists = session->exists;
+ uid_next = item->c_uid_next;
+ uid_val = item->c_uid_validity;
*old_uids_valid = TRUE;
} else {
if (item->use_cache && time(NULL) - item->use_cache < 2) {
ok = imap_status(session, IMAP_FOLDER(folder), item->item.path, item,
&exists, &uid_next, &uid_val, NULL, FALSE);
}
+ item->item.last_num = uid_next - 1;
+
item->use_cache = (time_t)0;
if (ok != IMAP_SUCCESS) {
statusbar_pop_all();
}
}
- if (!selected_folder)
- item->uid_next = uid_next;
-
/* If old uid_next matches new uid_next we can be sure no message
was added to the folder */
- if (( selected_folder && !session->folder_content_changed) ||
- (!selected_folder && uid_next == item->uid_next)) {
+ debug_print("uid_next is %d and item->uid_next %d \n",
+ uid_next, item->uid_next);
+ if (uid_next == item->uid_next) {
nummsgs = g_slist_length(item->uid_list);
/* If number of messages is still the same we
we discard our cache to start a new scan to find
out which numbers have been removed */
if (exists == nummsgs) {
+ debug_print("exists == nummsgs\n");
*msgnum_list = g_slist_copy(item->uid_list);
statusbar_pop_all();
unlock_session();
remove_numbered_files_not_in_list(dir, *msgnum_list);
g_free(dir);
+ item->uid_next = uid_next;
+
debug_print("get_num_list - ok - %i\n", nummsgs);
statusbar_pop_all();
unlock_session();
}
g_free(file);
}
+ session_set_access_time(SESSION(session));
}
if (elem == NULL)
lock_session();
selected_folder = (session->mbox != NULL) &&
(!strcmp(session->mbox, item->item.path));
- if (selected_folder) {
+ if (selected_folder && time(NULL) - item->use_cache < 2) {
ok = imap_cmd_noop(session);
if (ok != IMAP_SUCCESS) {
debug_print("disconnected!\n");
item->c_uid_next = uid_next;
item->c_uid_validity = uid_val;
item->c_unseen = unseen;
-
- if ((uid_next != item->uid_next) || (exists != item->item.total_msgs)) {
+ item->item.last_num = uid_next - 1;
+ debug_print("uidnext %d, item->uid_next %d, exists %d, item->item.total_msgs %d\n",
+ uid_next, item->uid_next, exists, item->item.total_msgs);
+ if ((uid_next != item->uid_next) || (exists != item->item.total_msgs)
+ || unseen != item->item.unread_msgs || uid_val != item->item.mtime) {
unlock_session();
return TRUE;
}
unseen = g_slist_concat(unseen, uidlist);
}
- r = imap_threaded_search(folder, IMAP_SEARCH_TYPE_ANSWERED,
- imapset, &lep_uidlist);
- if (r == MAILIMAP_NO_ERROR) {
- GSList * uidlist;
-
- uidlist = imap_uid_list_from_lep(lep_uidlist);
- mailimap_search_result_free(lep_uidlist);
-
- answered = g_slist_concat(answered, uidlist);
- }
-
r = imap_threaded_search(folder, IMAP_SEARCH_TYPE_FLAGGED,
imapset, &lep_uidlist);
if (r == MAILIMAP_NO_ERROR) {
GSList * uidlist;
-
+
uidlist = imap_uid_list_from_lep(lep_uidlist);
mailimap_search_result_free(lep_uidlist);
-
+
flagged = g_slist_concat(flagged, uidlist);
}
-
- r = imap_threaded_search(folder, IMAP_SEARCH_TYPE_DELETED,
- imapset, &lep_uidlist);
- if (r == MAILIMAP_NO_ERROR) {
- GSList * uidlist;
-
- uidlist = imap_uid_list_from_lep(lep_uidlist);
- mailimap_search_result_free(lep_uidlist);
-
- deleted = g_slist_concat(deleted, uidlist);
+
+ if (item->opened || item->processing_pending || item == folder->inbox) {
+ r = imap_threaded_search(folder, IMAP_SEARCH_TYPE_ANSWERED,
+ imapset, &lep_uidlist);
+ if (r == MAILIMAP_NO_ERROR) {
+ GSList * uidlist;
+
+ uidlist = imap_uid_list_from_lep(lep_uidlist);
+ mailimap_search_result_free(lep_uidlist);
+
+ answered = g_slist_concat(answered, uidlist);
+ }
+
+ r = imap_threaded_search(folder, IMAP_SEARCH_TYPE_DELETED,
+ imapset, &lep_uidlist);
+ if (r == MAILIMAP_NO_ERROR) {
+ GSList * uidlist;
+
+ uidlist = imap_uid_list_from_lep(lep_uidlist);
+ mailimap_search_result_free(lep_uidlist);
+
+ deleted = g_slist_concat(deleted, uidlist);
+ }
}
}
msginfo = (MsgInfo *) elem->data;
flags = msginfo->flags.perm_flags;
wasnew = (flags & MSG_NEW);
- flags &= ~((reverse_seen ? 0 : MSG_UNREAD | MSG_NEW) | MSG_REPLIED | MSG_MARKED);
+ if (item->opened || item->processing_pending || item == folder->inbox) {
+ flags &= ~((reverse_seen ? 0 : MSG_UNREAD | MSG_NEW) | MSG_REPLIED | MSG_MARKED);
+ } else {
+ flags &= ~((reverse_seen ? 0 : MSG_UNREAD | MSG_NEW | MSG_MARKED));
+ }
if (reverse_seen)
flags |= MSG_UNREAD | (wasnew ? MSG_NEW : 0);
if (gslist_find_next_num(&p_unseen, msginfo->msgnum) == msginfo->msgnum) {
flags &= ~(MSG_UNREAD | MSG_NEW);
}
}
- if (gslist_find_next_num(&p_answered, msginfo->msgnum) == msginfo->msgnum)
- flags |= MSG_REPLIED;
- else
- flags &= ~MSG_REPLIED;
+
if (gslist_find_next_num(&p_flagged, msginfo->msgnum) == msginfo->msgnum)
flags |= MSG_MARKED;
else
flags &= ~MSG_MARKED;
- if (gslist_find_next_num(&p_deleted, msginfo->msgnum) == msginfo->msgnum)
- flags |= MSG_DELETED;
- else
- flags &= ~MSG_DELETED;
+
+ if (item->opened || item->processing_pending || item == folder->inbox) {
+ if (gslist_find_next_num(&p_answered, msginfo->msgnum) == msginfo->msgnum)
+ flags |= MSG_REPLIED;
+ else
+ flags &= ~MSG_REPLIED;
+ if (gslist_find_next_num(&p_deleted, msginfo->msgnum) == msginfo->msgnum)
+ flags |= MSG_DELETED;
+ else
+ flags &= ~MSG_DELETED;
+ }
g_relation_insert(msgflags, msginfo, GINT_TO_POINTER(flags));
}
GSList *tmp = NULL, *cur;
- if (prefs_common.work_offline && !inc_offline_should_override()) {
+ if (prefs_common.work_offline &&
+ !inc_offline_should_override(
+ _("Sylpheed-Claws needs network access in order "
+ "to access the IMAP server."))) {
g_free(data);
return -1;
}
tmp = folder_item_get_msg_list(item);
- if (g_slist_length(tmp) == g_slist_length(msginfo_list))
+ if (g_slist_length(tmp) <= g_slist_length(msginfo_list))
data->full_search = TRUE;
for (cur = tmp; cur; cur = cur->next)
{
if (item->flags_set_table) {
g_hash_table_foreach_remove(item->flags_set_table, process_flags, GINT_TO_POINTER(TRUE));
- g_free(item->flags_set_table);
+ g_hash_table_destroy(item->flags_set_table);
item->flags_set_table = NULL;
}
if (item->flags_unset_table) {
g_hash_table_foreach_remove(item->flags_unset_table, process_flags, GINT_TO_POINTER(FALSE));
- g_free(item->flags_unset_table);
+ g_hash_table_destroy(item->flags_unset_table);
item->flags_unset_table = NULL;
}
}
static FolderClass imap_class;
+static XMLTag *imap_item_get_xml(Folder *folder, FolderItem *item);
+static void imap_item_set_xml(Folder *folder, FolderItem *item, XMLTag *tag);
+
static Folder *imap_folder_new (const gchar *name,
const gchar *path)
{
return -1;
}
+gchar imap_get_path_separator_for_item(FolderItem *item)
+{
+ return '/';
+}
+
FolderClass *imap_get_class(void)
{
if (imap_class.idstr == NULL) {
imap_class.create_tree = imap_create_tree;
imap_class.create_folder = imap_create_folder;
imap_class.rename_folder = imap_rename_folder;
+
+ imap_class.set_xml = folder_set_xml;
+ imap_class.get_xml = folder_get_xml;
+ imap_class.item_set_xml = imap_item_set_xml;
+ imap_class.item_get_xml = imap_item_get_xml;
/* nothing implemented */
}
{
imap_gtk_synchronise(item);
}
+
+static void imap_item_set_xml(Folder *folder, FolderItem *item, XMLTag *tag)
+{
+#ifdef HAVE_LIBETPAN
+ GList *cur;
+#endif
+ folder_item_set_xml(folder, item, tag);
+
+#ifdef HAVE_LIBETPAN
+ for (cur = tag->attr; cur != NULL; cur = g_list_next(cur)) {
+ XMLAttr *attr = (XMLAttr *) cur->data;
+
+ if (!attr || !attr->name || !attr->value) continue;
+ if (!strcmp(attr->name, "uidnext"))
+ IMAP_FOLDER_ITEM(item)->uid_next = atoi(attr->value);
+ }
+#endif
+}
+
+static XMLTag *imap_item_get_xml(Folder *folder, FolderItem *item)
+{
+ XMLTag *tag;
+
+ tag = folder_item_get_xml(folder, item);
+
+#ifdef HAVE_LIBETPAN
+ xml_tag_add_attr(tag, xml_attr_new_int("uidnext",
+ IMAP_FOLDER_ITEM(item)->uid_next));
+
+#endif
+ return tag;
+}