CamelIMAPXSummary *isum = (CamelIMAPXSummary *)folder->summary;
CamelIMAPXFolder *ifolder = (CamelIMAPXFolder *)folder;
gint total = camel_folder_summary_count (folder->summary);
- gchar *uid = NULL;
+ gchar *firstuid = NULL, *lastuid = NULL;
- if (total)
- uid = camel_folder_summary_uid_from_index (folder->summary, 0);
+ if (total) {
+ firstuid = camel_folder_summary_uid_from_index (folder->summary, 0);
+ lastuid = camel_folder_summary_uid_from_index (folder->summary, total - 1);
+ }
if (isum->modseq && ifolder->uidvalidity_on_server) {
- c(is->tagprefix, "SELECT QRESYNC %" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT "\n", ifolder->uidvalidity_on_server, isum->modseq);
- camel_imapx_command_add(ic, " (QRESYNC (%" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT " %s:*", ifolder->uidvalidity_on_server, isum->modseq, uid?uid:"1");
+ c(is->tagprefix, "SELECT QRESYNC %" G_GUINT64_FORMAT
+ " %" G_GUINT64_FORMAT "\n",
+ ifolder->uidvalidity_on_server, isum->modseq);
+
+ camel_imapx_command_add(ic, " (QRESYNC (%"
+ G_GUINT64_FORMAT " %"
+ G_GUINT64_FORMAT " %s:%s",
+ ifolder->uidvalidity_on_server,
+ isum->modseq,
+ firstuid?firstuid:"1",
+ lastuid?lastuid:"1");
+
+ g_free (firstuid);
+ g_free (lastuid);
if (total > 10) {
gint i;
}
camel_imapx_command_add(ic, "))");
}
- g_free (uid);
}
ic->complete = imapx_command_select_done;