Commit ae06384d ae06384d11d4b1f6ca576630f833ec2f32e6b05a by Sergey Poznyakoff

Add support for Unseen-Sequence in inc.

* mh/inc.c (main): Append the numbers of incorporated messages to
Unseen-Sequence, if defined in .mh_profile.
1 parent 8fcdf745
Showing 1 changed file with 17 additions and 6 deletions
...@@ -351,7 +351,7 @@ incmbx (void *item, void *data) ...@@ -351,7 +351,7 @@ incmbx (void *item, void *data)
351 mh_audit_close (audit_fp); 351 mh_audit_close (audit_fp);
352 audit_fp = NULL; 352 audit_fp = NULL;
353 } 353 }
354 354
355 mu_mailbox_close (input); 355 mu_mailbox_close (input);
356 mu_mailbox_destroy (&input); 356 mu_mailbox_destroy (&input);
357 357
...@@ -365,7 +365,9 @@ main (int argc, char **argv) ...@@ -365,7 +365,9 @@ main (int argc, char **argv)
365 int rc; 365 int rc;
366 int f_truncate = 0; 366 int f_truncate = 0;
367 int f_changecur = 0; 367 int f_changecur = 0;
368 368 size_t lastseen;
369 char *unseen_seq;
370
369 /* Native Language Support */ 371 /* Native Language Support */
370 MU_APP_INIT_NLS (); 372 MU_APP_INIT_NLS ();
371 373
...@@ -390,6 +392,7 @@ main (int argc, char **argv) ...@@ -390,6 +392,7 @@ main (int argc, char **argv)
390 mu_strerror (errno)); 392 mu_strerror (errno));
391 exit (1); 393 exit (1);
392 } 394 }
395 lastseen = incdat.lastmsg + 1;
393 396
394 /* Fixup options */ 397 /* Fixup options */
395 if (!input_file_list) 398 if (!input_file_list)
...@@ -403,12 +406,20 @@ main (int argc, char **argv) ...@@ -403,12 +406,20 @@ main (int argc, char **argv)
403 incmbx (NULL, &incdat); 406 incmbx (NULL, &incdat);
404 else 407 else
405 mu_list_foreach (input_file_list, incmbx, &incdat); 408 mu_list_foreach (input_file_list, incmbx, &incdat);
406 409
407 if (!changecur) 410 unseen_seq = mh_global_profile_get ("Unseen-Sequence", NULL);
411 if (unseen_seq)
408 { 412 {
409 mu_property_t prop = mh_mailbox_get_property (incdat.output); 413 mu_msgset_t unseen;
410 mu_property_invalidate (prop); 414
415 mu_msgset_create (&unseen, NULL, MU_MSGSET_NUM);
416 mu_msgset_add_range (unseen, lastseen, incdat.lastmsg, MU_MSGSET_NUM);
417 mh_seq_add (incdat.output,
418 unseen_seq,
419 unseen, 0);
420 mu_msgset_free (unseen);
411 } 421 }
422
412 mh_global_save_state (); 423 mh_global_save_state ();
413 424
414 mu_mailbox_close (incdat.output); 425 mu_mailbox_close (incdat.output);
......