[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nmh-commits] CVS: nmh/uip burst.c,1.4,1.5 inc.c,1.13,1.14 mhstoresbr.c,
From: |
Jon Steinhart <address@hidden> |
Subject: |
[Nmh-commits] CVS: nmh/uip burst.c,1.4,1.5 inc.c,1.13,1.14 mhstoresbr.c,1.7,1.8 rcvstore.c,1.7,1.8 refile.c,1.4,1.5 rmf.c,1.4,1.5 rmm.c,1.4,1.5 sortm.c,1.5,1.6 |
Date: |
Fri, 23 Aug 2002 16:37:04 -0400 |
Update of /cvsroot/nmh/nmh/uip
In directory subversions:/tmp/cvs-serv10734/nmh/uip
Modified Files:
burst.c inc.c mhstoresbr.c rcvstore.c refile.c rmf.c rmm.c
sortm.c
Log Message:
Added external program hooks.
Index: burst.c
===================================================================
RCS file: /cvsroot/nmh/nmh/uip/burst.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** burst.c 2 Jul 2002 22:09:14 -0000 1.4
--- burst.c 23 Aug 2002 20:37:01 -0000 1.5
***************
*** 43,47 ****
*/
static int find_delim (int, struct smsg *);
! static void burst (struct msgs **, int, struct smsg *, int, int, int);
static void cpybrst (FILE *, FILE *, char *, char *, int);
--- 43,47 ----
*/
static int find_delim (int, struct smsg *);
! static void burst (struct msgs **, int, struct smsg *, int, int, int, char *);
static void cpybrst (FILE *, FILE *, char *, char *, int);
***************
*** 157,161 ****
printf ("%d message%s exploded from digest %d\n",
numburst, numburst > 1 ? "s" : "", msgnum);
! burst (&mp, msgnum, smsgs, numburst, inplace, verbosw);
} else {
if (numburst == 0) {
--- 157,161 ----
printf ("%d message%s exploded from digest %d\n",
numburst, numburst > 1 ? "s" : "", msgnum);
! burst (&mp, msgnum, smsgs, numburst, inplace, verbosw, maildir);
} else {
if (numburst == 0) {
***************
*** 257,261 ****
static void
burst (struct msgs **mpp, int msgnum, struct smsg *smsgs, int numburst,
! int inplace, int verbosw)
{
int i, j, mode;
--- 257,261 ----
static void
burst (struct msgs **mpp, int msgnum, struct smsg *smsgs, int numburst,
! int inplace, int verbosw, char *maildir)
{
int i, j, mode;
***************
*** 297,300 ****
--- 297,303 ----
* source message, to make room for each of the messages
* contained within the digest.
+ *
+ * This is equivalent to refiling a message from the point
+ * of view of the external hooks.
*/
if (inplace) {
***************
*** 308,311 ****
--- 311,319 ----
if (rename (f2, f1) == NOTOK)
admonish (f1, "unable to rename %s to", f2);
+
+ (void)snprintf(f1, sizeof (f1), "%s/%d", maildir, i);
+ (void)snprintf(f2, sizeof (f2), "%s/%d", maildir, j);
+ ext_hook("ref-hook", f1, f2);
+
copy_msg_flags (mp, i, j);
clear_msg_flags (mp, j);
***************
*** 317,321 ****
unset_selected (mp, msgnum);
! /* new hghmsg is hghmsg + numburst */
i = inplace ? msgnum + numburst : mp->hghmsg;
for (j = numburst; j >= (inplace ? 0 : 1); i--, j--) {
--- 325,347 ----
unset_selected (mp, msgnum);
! /* new hghmsg is hghmsg + numburst
! *
! * At this point, there is an array of numburst smsgs, each element of
! * which contains the starting and stopping offsets (seeks) of the message
! * in the digest. The inplace flag is set if the original digest is
replaced
! * by a message containing the table of contents. smsgs[0] is that table
of
! * contents. Go through the message numbers in reverse order (high to
low).
! *
! * Set f1 to the name of the destination message, f2 to the name of a
scratch
! * file. Extract a message from the digest to the scratch file. Move the
! * original message to a backup file if the destination message number is
the
! * same as the number of the original message, which only happens if the
! * inplace flag is set. Then move the scratch file to the destination
message.
! *
! * Moving the original message to the backup file is equivalent to
deleting the
! * message from the point of view of the external hooks. And bursting
each
! * message is equivalent to adding a new message.
! */
!
i = inplace ? msgnum + numburst : mp->hghmsg;
for (j = numburst; j >= (inplace ? 0 : 1); i--, j--) {
***************
*** 337,343 ****
--- 363,376 ----
if (rename (f1, f3) == NOTOK)
admonish (f3, "unable to rename %s to", f1);
+
+ (void)snprintf(f3, sizeof (f3), "%s/%d", maildir, i);
+ ext_hook("del-hook", f3, (char *)0);
}
if (rename (f2, f1) == NOTOK)
admonish (f1, "unable to rename %s to", f2);
+
+ (void)snprintf(f3, sizeof (f3), "%s/%d", maildir, i);
+ ext_hook("add-hook", f3, (char *)0);
+
copy_msg_flags (mp, i, msgnum);
mp->msgflags |= SEQMOD;
Index: inc.c
===================================================================
RCS file: /cvsroot/nmh/nmh/uip/inc.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** inc.c 2 Jul 2002 22:09:14 -0000 1.13
--- inc.c 23 Aug 2002 20:37:01 -0000 1.14
***************
*** 246,249 ****
--- 246,250 ----
struct stat st, s1;
FILE *aud = NULL;
+ char b[MAXPATHLEN + 1];
#ifdef POP
***************
*** 803,807 ****
newmsg = folder_addmsg(mp, tmpfilenam);
#endif
-
/* create scanline for new message */
switch (i = scan (in, msgnum + 1, msgnum + 1, nfs, width,
--- 804,807 ----
***************
*** 827,830 ****
--- 827,837 ----
case SCNMSG:
case SCNENC:
+ /*
+ * Run the external program hook on the message.
+ */
+
+ (void)snprintf(b, sizeof (b), "%s/%d", maildir, msgnum + 1);
+ (void)ext_hook("add-hook", b, (char *)0);
+
if (aud)
fputs (scanl, aud);
Index: mhstoresbr.c
===================================================================
RCS file: /cvsroot/nmh/nmh/uip/mhstoresbr.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** mhstoresbr.c 2 Jul 2002 22:09:14 -0000 1.7
--- mhstoresbr.c 23 Aug 2002 20:37:01 -0000 1.8
***************
*** 922,926 ****
if ((mp = folder_read (folder))) {
/* Link file into folder */
! msgnum = folder_addmsg (&mp, filename, 0, 0, 0);
} else {
advise (NULL, "unable to read folder %s", folder);
--- 922,926 ----
if ((mp = folder_read (folder))) {
/* Link file into folder */
! msgnum = folder_addmsg (&mp, filename, 0, 0, 0, 0);
} else {
advise (NULL, "unable to read folder %s", folder);
Index: rcvstore.c
===================================================================
RCS file: /cvsroot/nmh/nmh/uip/rcvstore.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** rcvstore.c 2 Jul 2002 22:09:15 -0000 1.7
--- rcvstore.c 23 Aug 2002 20:37:01 -0000 1.8
***************
*** 204,208 ****
* to the Unseen-Sequence's.
*/
! if ((msgnum = folder_addmsg (&mp, tmpfilenam, 0, unseensw, 0)) == -1)
done (1);
--- 204,208 ----
* to the Unseen-Sequence's.
*/
! if ((msgnum = folder_addmsg (&mp, tmpfilenam, 0, unseensw, 0, 0)) == -1)
done (1);
Index: refile.c
===================================================================
RCS file: /cvsroot/nmh/nmh/uip/refile.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** refile.c 2 Jul 2002 22:09:15 -0000 1.4
--- refile.c 23 Aug 2002 20:37:01 -0000 1.5
***************
*** 67,71 ****
static void clsfolds (struct st_fold *, int);
static void remove_files (int, char **);
! static int m_file (char *, struct st_fold *, int, int);
--- 67,71 ----
static void clsfolds (struct st_fold *, int);
static void remove_files (int, char **);
! static int m_file (char *, struct st_fold *, int, int, int);
***************
*** 214,218 ****
opnfolds (folders, foldp);
for (i = 0; i < filep; i++)
! if (m_file (files[i], folders, foldp, preserve))
done (1);
/* If -nolink, then "remove" files */
--- 214,218 ----
opnfolds (folders, foldp);
for (i = 0; i < filep; i++)
! if (m_file (files[i], folders, foldp, preserve, 0))
done (1);
/* If -nolink, then "remove" files */
***************
*** 248,256 ****
opnfolds (folders, foldp);
! /* Link all the selected messages into destination folders */
for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
if (is_selected (mp, msgnum)) {
cp = getcpy (m_name (msgnum));
! if (m_file (cp, folders, foldp, preserve))
done (1);
free (cp);
--- 248,261 ----
opnfolds (folders, foldp);
! /* Link all the selected messages into destination folders.
! *
! * This causes the add hook to be run for messages that are
! * linked into another folder. The refile hook is run for
! * messages that are moved to another folder.
! */
for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
if (is_selected (mp, msgnum)) {
cp = getcpy (m_name (msgnum));
! if (m_file (cp, folders, foldp, preserve, !linkf))
done (1);
free (cp);
***************
*** 270,276 ****
}
! /* If -nolink, then "remove" messages from source folder */
if (!linkf) {
! folder_delmsgs (mp, unlink_msgs);
}
--- 275,285 ----
}
! /* If -nolink, then "remove" messages from source folder.
! *
! * Note that folder_delmsgs does not call the delete hook
! * because the message has already been handled above.
! */
if (!linkf) {
! folder_delmsgs (mp, unlink_msgs, 1);
}
***************
*** 388,392 ****
static int
! m_file (char *msgfile, struct st_fold *folders, int nfolders, int preserve)
{
int msgnum;
--- 397,401 ----
static int
! m_file (char *msgfile, struct st_fold *folders, int nfolders, int preserve,
int refile)
{
int msgnum;
***************
*** 394,398 ****
for (fp = folders, ep = folders + nfolders; fp < ep; fp++) {
! if ((msgnum = folder_addmsg (&fp->f_mp, msgfile, 1, 0, preserve)) == -1)
return 1;
}
--- 403,407 ----
for (fp = folders, ep = folders + nfolders; fp < ep; fp++) {
! if ((msgnum = folder_addmsg (&fp->f_mp, msgfile, 1, 0, preserve,
nfolders == 1 && refile)) == -1)
return 1;
}
Index: rmf.c
===================================================================
RCS file: /cvsroot/nmh/nmh/uip/rmf.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** rmf.c 2 Jul 2002 22:09:15 -0000 1.4
--- rmf.c 23 Aug 2002 20:37:01 -0000 1.5
***************
*** 153,156 ****
--- 153,162 ----
others = 0;
+ /*
+ * Run the external delete hook program.
+ */
+
+ (void)ext_hook("del-hook", maildir, (char *)0);
+
j = strlen(BACKUP_PREFIX);
while ((dp = readdir (dd))) {
Index: rmm.c
===================================================================
RCS file: /cvsroot/nmh/nmh/uip/rmm.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** rmm.c 2 Jul 2002 22:09:15 -0000 1.4
--- rmm.c 23 Aug 2002 20:37:01 -0000 1.5
***************
*** 146,150 ****
/* "remove" the SELECTED messages */
! folder_delmsgs (mp, unlink_msgs);
seq_save (mp); /* synchronize message sequences */
--- 146,150 ----
/* "remove" the SELECTED messages */
! folder_delmsgs (mp, unlink_msgs, 0);
seq_save (mp); /* synchronize message sequences */
Index: sortm.c
===================================================================
RCS file: /cvsroot/nmh/nmh/uip/sortm.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** sortm.c 2 Jul 2002 22:09:15 -0000 1.5
--- sortm.c 23 Aug 2002 20:37:01 -0000 1.6
***************
*** 233,237 ****
if (verbose) { /* announce what we're doing */
if (subjsort)
! printf ("sorting by %s-major %s-minor\n",
submajor ? subjsort : datesw,
submajor ? datesw : subjsort);
--- 233,237 ----
if (verbose) { /* announce what we're doing */
if (subjsort)
! printf ("sorting by %s-major %s-minor\n",
submajor ? subjsort : datesw,
submajor ? datesw : subjsort);
***************
*** 241,245 ****
/* first sort by date, or by subject-major, date-minor */
! qsort ((char *) dlist, nmsgs, sizeof(*dlist),
(qsort_comp) (submajor && subjsort ? txtsort : dsort));
--- 241,245 ----
/* first sort by date, or by subject-major, date-minor */
! qsort ((char *) dlist, nmsgs, sizeof(*dlist),
(qsort_comp) (submajor && subjsort ? txtsort : dsort));
***************
*** 293,297 ****
while (*s && (*s)->s_subj[0] &&
strcmp((*s)->s_subj, s[-1]->s_subj) == 0 &&
! (datelimit == 0 ||
(*s)->s_clock - s[-1]->s_clock <= datelimit)) {
il[(*s)->s_msg] = 0;
--- 293,297 ----
while (*s && (*s)->s_subj[0] &&
strcmp((*s)->s_subj, s[-1]->s_subj) == 0 &&
! (datelimit == 0 ||
(*s)->s_clock - s[-1]->s_clock <= datelimit)) {
il[(*s)->s_msg] = 0;
***************
*** 304,307 ****
--- 304,313 ----
dlist = flist;
}
+
+ /*
+ * At this point, dlist is a sorted array of pointers to smsg structures,
+ * each of which contains a message number.
+ */
+
rename_msgs (mp, dlist);
***************
*** 313,317 ****
}
! static int
read_hdrs (struct msgs *mp, char *datesw)
{
--- 319,323 ----
}
! static int
read_hdrs (struct msgs *mp, char *datesw)
{
***************
*** 432,436 ****
* try to make the subject "canonical": delete
* leading "re:", everything but letters & smash
! * letters to lower case.
*/
register char *cp, *cp2, c;
--- 438,442 ----
* try to make the subject "canonical": delete
* leading "re:", everything but letters & smash
! * letters to lower case.
*/
register char *cp, *cp2, c;
***************
*** 473,477 ****
* sort on dates.
*/
! static int
dsort (struct smsg **a, struct smsg **b)
{
--- 479,483 ----
* sort on dates.
*/
! static int
dsort (struct smsg **a, struct smsg **b)
{
***************
*** 489,493 ****
* sort on subjects.
*/
! static int
subsort (struct smsg **a, struct smsg **b)
{
--- 495,499 ----
* sort on subjects.
*/
! static int
subsort (struct smsg **a, struct smsg **b)
{
***************
*** 500,504 ****
}
! static int
txtsort (struct smsg **a, struct smsg **b)
{
--- 506,510 ----
}
! static int
txtsort (struct smsg **a, struct smsg **b)
{
***************
*** 518,521 ****
--- 524,528 ----
int nxt, old, new;
char *newname, oldname[BUFSIZ];
+ char newbuf[MAXPATHLEN + 1];
for (;;) {
***************
*** 532,540 ****
adios (newname, "unable to rename %s to", oldname);
copy_msg_flags (mp, new, old);
if (mp->curmsg == old)
seq_setcur (mp, new);
! if (nxt == endmsg)
break;
--- 539,551 ----
adios (newname, "unable to rename %s to", oldname);
+ (void)snprintf(oldname, sizeof (oldname), "%s/%d", mp->foldpath, old);
+ (void)snprintf(newbuf, sizeof (newbuf), "%s/%d", mp->foldpath, new);
+ ext_hook("ref-hook", oldname, newbuf);
+
copy_msg_flags (mp, new, old);
if (mp->curmsg == old)
seq_setcur (mp, new);
! if (nxt == endmsg)
break;
***************
*** 551,554 ****
--- 562,566 ----
seqset_t tmpset;
char f1[BUFSIZ], tmpfil[BUFSIZ];
+ char newbuf[MAXPATHLEN + 1];
struct smsg *sp;
***************
*** 556,560 ****
for (i = 0; i < nmsgs; i++) {
! if (! (sp = mlist[i]))
continue; /* did this one */
--- 568,572 ----
for (i = 0; i < nmsgs; i++) {
! if (! (sp = mlist[i]))
continue; /* did this one */
***************
*** 577,580 ****
--- 589,603 ----
if (rename (f1, tmpfil) == NOTOK)
adios (tmpfil, "unable to rename %s to ", f1);
+
+ /*
+ * Run the external hook to refile the old message as message
+ * number 2147483647. This is our way of making a temporary
+ * message number. I don't really like this.
+ */
+
+ (void)snprintf(f1, sizeof (f1), "%s/%d", mp->foldpath, old);
+ (void)snprintf(newbuf, sizeof (newbuf), "%s/2147483647", mp->foldpath);
+ ext_hook("ref-hook", f1, newbuf);
+
get_msg_flags (mp, &tmpset, old);
***************
*** 582,585 ****
--- 605,616 ----
if (rename (tmpfil, m_name(new)) == NOTOK)
adios (m_name(new), "unable to rename %s to", tmpfil);
+
+ /*
+ * Run the external hook to refile the temorary message number
+ * to the real place.
+ */
+
+ (void)snprintf(f1, sizeof (f1), "%s/%d", mp->foldpath, new);
+ ext_hook("ref-hook", newbuf, f1);
set_msg_flags (mp, &tmpset, new);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Nmh-commits] CVS: nmh/uip burst.c,1.4,1.5 inc.c,1.13,1.14 mhstoresbr.c,1.7,1.8 rcvstore.c,1.7,1.8 refile.c,1.4,1.5 rmf.c,1.4,1.5 rmm.c,1.4,1.5 sortm.c,1.5,1.6,
Jon Steinhart <address@hidden> <=
- Prev by Date:
[Nmh-commits] CVS: nmh/sbr Makefile.in,1.13,1.14 folder_addmsg.c,1.2,1.3 folder_delmsgs.c,1.2,1.3 folder_pack.c,1.2,1.3 m_convert.c,1.2,1.3
- Previous by thread:
[Nmh-commits] CVS: nmh/sbr Makefile.in,1.13,1.14 folder_addmsg.c,1.2,1.3 folder_delmsgs.c,1.2,1.3 folder_pack.c,1.2,1.3 m_convert.c,1.2,1.3
- Index(es):