+2001-01-25 [christoph] 0.8.9claws2
+
+ * po/POTFILES.in
+ add pluginwindow and prefswindow
+ * src/compose.c
+ make send respond correctly to messages that could be added
+ to the queue folder, but the UID of the message is unknown
+ * src/folder.c
+ * src/imap.c
+ don't return guessed UIDs in imap_add_msg anymore. We return
+ 0 to tell the folder system it was appened but the UID is
+ unknown. Folder system now get's the UID by scaning the folder
+ and searching the cache for the Message-ID
+
2001-01-25 [paul] 0.8.9claws1
* codeconv.c
return folder->fetch_msg(folder, item, num);
}
+static gint folder_item_get_msg_num_by_file(FolderItem *dest, const gchar *file)
+{
+ static HeaderEntry hentry[] = {{"Message-ID:", NULL, TRUE},
+ {NULL, NULL, FALSE}};
+ FILE *fp;
+ MsgInfo *msginfo;
+ gint msgnum = 0;
+ gchar buf[BUFFSIZE];
+
+ if ((fp = fopen(file, "rb")) == NULL)
+ return 0;
+
+ if ((dest->stype == F_QUEUE) || (dest->stype == F_DRAFT))
+ while (fgets(buf, sizeof(buf), fp) != NULL)
+ if (buf[0] == '\r' || buf[0] == '\n') break;
+
+ procheader_get_header_fields(fp, hentry);
+ if (hentry[0].body) {
+ extract_parenthesis(hentry[0].body, '<', '>');
+ remove_space(hentry[0].body);
+ if ((msginfo = msgcache_get_msg_by_id(dest->cache, hentry[0].body)) != NULL) {
+ msgnum = msginfo->msgnum;
+ procmsg_msginfo_free(msginfo);
+
+ debug_print("found message as uid %d\n", msgnum);
+ }
+ }
+
+ g_free(hentry[0].body);
+ fclose(fp);
+
+ return msgnum;
+}
+
gint folder_item_add_msg(FolderItem *dest, const gchar *file,
gboolean remove_source)
{
if (!dest->cache)
folder_item_read_cache(dest);
- num = folder->add_msg(folder, dest, file, remove_source);
+ num = folder->add_msg(folder, dest, file, FALSE);
if (num > 0) {
msginfo = folder->get_msginfo(folder, dest, num);
}
dest->last_num = num;
- }
+ } else if (num == 0) {
+ folder_item_scan(dest);
+ num = folder_item_get_msg_num_by_file(dest, file);
+ }
+
+ if (num >= 0 && remove_source) {
+ if (unlink(file) < 0)
+ FILE_OP_ERROR(file, "unlink");
+ }
return num;
}
{
gchar *destdir;
IMAPSession *session;
- gint messages, recent, unseen;
- guint32 uid_next, uid_validity;
gint ok;
g_return_val_if_fail(folder != NULL, -1);
session = imap_session_get(folder);
if (!session) return -1;
- ok = imap_status(session, IMAP_FOLDER(folder), dest->path,
- &messages, &recent, &uid_next, &uid_validity, &unseen);
- if (ok != IMAP_SUCCESS) {
- g_warning("can't append message %s\n", file);
- return -1;
- }
-
destdir = imap_get_real_path(IMAP_FOLDER(folder), dest->path);
ok = imap_cmd_append(SESSION(session)->sock, destdir, file);
g_free(destdir);
FILE_OP_ERROR(file, "unlink");
}
- return uid_next;
+ return 0;
}
static gint imap_do_copy(Folder *folder, FolderItem *dest, MsgInfo *msginfo,