Commit 2fa93e70 2fa93e705b12b3a1beba54856d45b5054209ee20 by Sergey Poznyakoff

Minor fix.

* libproto/include/amd.h: Fix indentation.
* libproto/maildir/mbox.c (maildir_scan_dir): Do not assign uids
before inserting message, it breaks their ordering.
(maildir_scan0): Assign uids here.  A temporary solution.
1 parent 583f4579
2008-07-31 Sergey Poznyakoff <gray@gnu.org.ua>
* libproto/include/amd.h: Fix indentation.
* libproto/maildir/mbox.c (maildir_scan_dir): Do not assign uids
before inserting message, it breaks their ordering.
(maildir_scan0): Assign uids here. A temporary solution.
2008-07-19 Sergey Poznyakoff <gray@gnu.org.ua>
Minor fix.
......
......@@ -20,25 +20,26 @@
#define MAX_OPEN_STREAMS 16
/* Notifications ADD_MESG. */
#define DISPATCH_ADD_MSG(mbox,mhd,n) \
do \
{ \
int bailing = 0; \
mu_monitor_unlock (mbox->monitor); \
if (mbox->observable) \
{ \
size_t tmp = (n); \
bailing = mu_observable_notify (mbox->observable, MU_EVT_MESSAGE_ADD, \
&tmp); \
} \
if (bailing != 0) \
{ \
if (pcount) \
*pcount = (mhd)->msg_count; \
mu_locker_unlock (mbox->locker); \
return EINTR; \
} \
mu_monitor_wrlock (mbox->monitor); \
#define DISPATCH_ADD_MSG(mbox,mhd,n) \
do \
{ \
int bailing = 0; \
mu_monitor_unlock (mbox->monitor); \
if (mbox->observable) \
{ \
size_t tmp = n; \
bailing = mu_observable_notify (mbox->observable, \
MU_EVT_MESSAGE_ADD, \
&tmp); \
} \
if (bailing != 0) \
{ \
if (pcount) \
*pcount = (mhd)->msg_count; \
mu_locker_unlock (mbox->locker); \
return EINTR; \
} \
mu_monitor_wrlock (mbox->monitor); \
} while (0);
struct _amd_data;
......
......@@ -635,10 +635,7 @@ maildir_scan_dir (struct _amd_data *amd, DIR *dir, char *dirname)
msg->amd_message.attr_flags = 0;
msg->amd_message.orig_flags = msg->amd_message.attr_flags;
if (insert)
{
msg->uid = amd->next_uid (amd);
_amd_message_insert (amd, (struct _amd_message*) msg);
}
_amd_message_insert (amd, (struct _amd_message*) msg);
}
}
return 0;
......@@ -654,6 +651,7 @@ maildir_scan0 (mu_mailbox_t mailbox, size_t msgno MU_ARG_UNUSED,
int status = 0;
char *name;
struct stat st;
size_t i;
if (amd == NULL)
return EINVAL;
......@@ -685,13 +683,13 @@ maildir_scan0 (mu_mailbox_t mailbox, size_t msgno MU_ARG_UNUSED,
}
free (name);
if (do_notify)
for (i = 1; i <= amd->msg_count; i++)
{
size_t i;
for (i = 0; i < amd->msg_count; i++)
{
DISPATCH_ADD_MSG(mailbox, amd, i);
}
struct _maildir_message *msg = (struct _maildir_message *)
_amd_get_message (amd, i);
msg->uid = i;
if (do_notify)
DISPATCH_ADD_MSG (mailbox, amd, i);
}
if (stat (amd->name, &st) == 0)
......