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.
Showing
3 changed files
with
35 additions
and
29 deletions
1 | 2008-07-31 Sergey Poznyakoff <gray@gnu.org.ua> | ||
2 | |||
3 | * libproto/include/amd.h: Fix indentation. | ||
4 | * libproto/maildir/mbox.c (maildir_scan_dir): Do not assign uids | ||
5 | before inserting message, it breaks their ordering. | ||
6 | (maildir_scan0): Assign uids here. A temporary solution. | ||
7 | |||
1 | 2008-07-19 Sergey Poznyakoff <gray@gnu.org.ua> | 8 | 2008-07-19 Sergey Poznyakoff <gray@gnu.org.ua> |
2 | 9 | ||
3 | Minor fix. | 10 | Minor fix. | ... | ... |
... | @@ -20,25 +20,26 @@ | ... | @@ -20,25 +20,26 @@ |
20 | #define MAX_OPEN_STREAMS 16 | 20 | #define MAX_OPEN_STREAMS 16 |
21 | 21 | ||
22 | /* Notifications ADD_MESG. */ | 22 | /* Notifications ADD_MESG. */ |
23 | #define DISPATCH_ADD_MSG(mbox,mhd,n) \ | 23 | #define DISPATCH_ADD_MSG(mbox,mhd,n) \ |
24 | do \ | 24 | do \ |
25 | { \ | 25 | { \ |
26 | int bailing = 0; \ | 26 | int bailing = 0; \ |
27 | mu_monitor_unlock (mbox->monitor); \ | 27 | mu_monitor_unlock (mbox->monitor); \ |
28 | if (mbox->observable) \ | 28 | if (mbox->observable) \ |
29 | { \ | 29 | { \ |
30 | size_t tmp = (n); \ | 30 | size_t tmp = n; \ |
31 | bailing = mu_observable_notify (mbox->observable, MU_EVT_MESSAGE_ADD, \ | 31 | bailing = mu_observable_notify (mbox->observable, \ |
32 | &tmp); \ | 32 | MU_EVT_MESSAGE_ADD, \ |
33 | } \ | 33 | &tmp); \ |
34 | if (bailing != 0) \ | 34 | } \ |
35 | { \ | 35 | if (bailing != 0) \ |
36 | if (pcount) \ | 36 | { \ |
37 | *pcount = (mhd)->msg_count; \ | 37 | if (pcount) \ |
38 | mu_locker_unlock (mbox->locker); \ | 38 | *pcount = (mhd)->msg_count; \ |
39 | return EINTR; \ | 39 | mu_locker_unlock (mbox->locker); \ |
40 | } \ | 40 | return EINTR; \ |
41 | mu_monitor_wrlock (mbox->monitor); \ | 41 | } \ |
42 | mu_monitor_wrlock (mbox->monitor); \ | ||
42 | } while (0); | 43 | } while (0); |
43 | 44 | ||
44 | struct _amd_data; | 45 | struct _amd_data; | ... | ... |
... | @@ -635,10 +635,7 @@ maildir_scan_dir (struct _amd_data *amd, DIR *dir, char *dirname) | ... | @@ -635,10 +635,7 @@ maildir_scan_dir (struct _amd_data *amd, DIR *dir, char *dirname) |
635 | msg->amd_message.attr_flags = 0; | 635 | msg->amd_message.attr_flags = 0; |
636 | msg->amd_message.orig_flags = msg->amd_message.attr_flags; | 636 | msg->amd_message.orig_flags = msg->amd_message.attr_flags; |
637 | if (insert) | 637 | if (insert) |
638 | { | 638 | _amd_message_insert (amd, (struct _amd_message*) msg); |
639 | msg->uid = amd->next_uid (amd); | ||
640 | _amd_message_insert (amd, (struct _amd_message*) msg); | ||
641 | } | ||
642 | } | 639 | } |
643 | } | 640 | } |
644 | return 0; | 641 | return 0; |
... | @@ -654,6 +651,7 @@ maildir_scan0 (mu_mailbox_t mailbox, size_t msgno MU_ARG_UNUSED, | ... | @@ -654,6 +651,7 @@ maildir_scan0 (mu_mailbox_t mailbox, size_t msgno MU_ARG_UNUSED, |
654 | int status = 0; | 651 | int status = 0; |
655 | char *name; | 652 | char *name; |
656 | struct stat st; | 653 | struct stat st; |
654 | size_t i; | ||
657 | 655 | ||
658 | if (amd == NULL) | 656 | if (amd == NULL) |
659 | return EINVAL; | 657 | return EINVAL; |
... | @@ -685,13 +683,13 @@ maildir_scan0 (mu_mailbox_t mailbox, size_t msgno MU_ARG_UNUSED, | ... | @@ -685,13 +683,13 @@ maildir_scan0 (mu_mailbox_t mailbox, size_t msgno MU_ARG_UNUSED, |
685 | } | 683 | } |
686 | free (name); | 684 | free (name); |
687 | 685 | ||
688 | if (do_notify) | 686 | for (i = 1; i <= amd->msg_count; i++) |
689 | { | 687 | { |
690 | size_t i; | 688 | struct _maildir_message *msg = (struct _maildir_message *) |
691 | for (i = 0; i < amd->msg_count; i++) | 689 | _amd_get_message (amd, i); |
692 | { | 690 | msg->uid = i; |
693 | DISPATCH_ADD_MSG(mailbox, amd, i); | 691 | if (do_notify) |
694 | } | 692 | DISPATCH_ADD_MSG (mailbox, amd, i); |
695 | } | 693 | } |
696 | 694 | ||
697 | if (stat (amd->name, &st) == 0) | 695 | if (stat (amd->name, &st) == 0) | ... | ... |
-
Please register or sign in to post a comment