info = (CamelMboxMessageInfo *)camel_folder_summary_uid(s, summary->pdata[i]);
- d(printf("Checking message %s %08x\n", camel_message_info_uid(info), info->info.flags));
+ d(printf("Checking message %s %08x\n", camel_message_info_uid(info), ((CamelMessageInfoBase *)info)->flags));
if ((info->info.info.flags & CAMEL_MESSAGE_FOLDER_FLAGGED) == 0) {
camel_message_info_free((CamelMessageInfo *)info);
continue;
}
- d(printf("Updating message %s\n", camel_message_info_uid(info)));
+ d(printf("Updating message %s: %d\n", camel_message_info_uid(info), (int)info->frompos));
camel_mime_parser_seek(mp, info->frompos, SEEK_SET);
const char *fromline;
int lastdel = FALSE;
gboolean touched = FALSE;
+ GSList *del=NULL;
#ifdef STATUS_PINE
char statnew[8], xstatnew[8];
#endif
d(printf("Looking at message %s\n", camel_message_info_uid(info)));
- /* We won't be in the same order. So lets reseek every time. Should we optimize? */
- d(printf("seeking to %d\n", (int)info->frompos));
- camel_mime_parser_seek(mp, info->frompos, SEEK_SET);
+ d(printf("seeking (%s) to %d\n", ((CamelMessageInfo *) info)->uid, (int)info->frompos));
+ if (lastdel)
+ camel_mime_parser_seek(mp, info->frompos, SEEK_SET);
if (camel_mime_parser_step(mp, &buffer, &len) != CAMEL_MIME_PARSER_STATE_FROM) {
- g_warning("Expected a From line here, didn't get it");
+ g_warning("Expected a From line here, didn't get it %d", (int)camel_mime_parser_tell(mp));
camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
_("Summary and folder mismatch, even after a sync"));
goto error;
s->unread_count--;
s->deleted_count--;
camel_folder_change_info_remove_uid(changeinfo, uid);
- camel_folder_summary_remove(s, (CamelMessageInfo *)info);
+ camel_folder_summary_remove_index_fast (s, i);
+ del = g_slist_prepend (del, (gpointer) camel_pstring_strdup(uid));
camel_message_info_free((CamelMessageInfo *)info);
count--;
i--;
write(fdout, "\n", 1);
#endif
info->frompos = lseek(fdout, 0, SEEK_CUR);
+ ((CamelMessageInfo *)info)->dirty = TRUE;
fromline = camel_mime_parser_from_line(mp);
+ d(printf("Saving %s:%d\n", camel_message_info_uid(info), info->frompos));
write(fdout, fromline, strlen(fromline));
}
info = NULL;
}
}
+ camel_db_delete_uids (s->folder->cdb, s->folder->full_name, del, ex);
+ g_slist_foreach (del, (GFunc) camel_pstring_free, NULL);
+ g_slist_free (del);
#if 0
/* if last was deleted, append the \n we removed */