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
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.
......
...@@ -21,14 +21,15 @@ ...@@ -21,14 +21,15 @@
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 MU_EVT_MESSAGE_ADD, \
32 &tmp); \ 33 &tmp); \
33 } \ 34 } \
34 if (bailing != 0) \ 35 if (bailing != 0) \
......
...@@ -635,12 +635,9 @@ maildir_scan_dir (struct _amd_data *amd, DIR *dir, char *dirname) ...@@ -635,12 +635,9 @@ 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 {
639 msg->uid = amd->next_uid (amd);
640 _amd_message_insert (amd, (struct _amd_message*) msg); 638 _amd_message_insert (amd, (struct _amd_message*) msg);
641 } 639 }
642 } 640 }
643 }
644 return 0; 641 return 0;
645 } 642 }
646 643
...@@ -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)
......