[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nmh-commits] CVS: nmh/sbr Makefile.in,1.13,1.14 folder_addmsg.c,1.2,1.3
From: |
Jon Steinhart <address@hidden> |
Subject: |
[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 |
Date: |
Fri, 23 Aug 2002 16:37:03 -0400 |
Update of /cvsroot/nmh/nmh/sbr
In directory subversions:/tmp/cvs-serv10734/nmh/sbr
Modified Files:
Makefile.in folder_addmsg.c folder_delmsgs.c folder_pack.c
m_convert.c
Log Message:
Added external program hooks.
Index: Makefile.in
===================================================================
RCS file: /cvsroot/nmh/nmh/sbr/Makefile.in,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** Makefile.in 14 Dec 2000 01:30:45 -0000 1.13
--- Makefile.in 23 Aug 2002 20:37:01 -0000 1.14
***************
*** 58,62 ****
context_replace.c context_save.c copy.c \
copyip.c cpydata.c cpydgst.c discard.c done.c dtime.c dtimep.c \
! error.c fdcompare.c folder_addmsg.c folder_delmsgs.c \
folder_free.c folder_pack.c folder_read.c \
folder_realloc.c gans.c getans.c getanswer.c \
--- 58,62 ----
context_replace.c context_save.c copy.c \
copyip.c cpydata.c cpydgst.c discard.c done.c dtime.c dtimep.c \
! error.c ext_hook.o fdcompare.c folder_addmsg.c folder_delmsgs.c \
folder_free.c folder_pack.c folder_read.c \
folder_realloc.c gans.c getans.c getanswer.c \
Index: folder_addmsg.c
===================================================================
RCS file: /cvsroot/nmh/nmh/sbr/folder_addmsg.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** folder_addmsg.c 2 Jul 2002 22:09:14 -0000 1.2
--- folder_addmsg.c 23 Aug 2002 20:37:01 -0000 1.3
***************
*** 21,28 ****
int
folder_addmsg (struct msgs **mpp, char *msgfile, int selected,
! int unseen, int preserve)
{
int infd, outfd, linkerr, first_time, msgnum;
char *nmsg, newmsg[BUFSIZ];
struct msgs *mp;
struct stat st1, st2;
--- 21,30 ----
int
folder_addmsg (struct msgs **mpp, char *msgfile, int selected,
! int unseen, int preserve, int deleting)
{
int infd, outfd, linkerr, first_time, msgnum;
char *nmsg, newmsg[BUFSIZ];
+ char oldmsg[BUFSIZ];
+ struct msgs *op;
struct msgs *mp;
struct stat st1, st2;
***************
*** 133,139 ****
/*
! * Now try to link message into folder
*/
if (link (msgfile, newmsg) != -1) {
return msgnum;
} else {
--- 135,155 ----
/*
! * Now try to link message into folder.
! * Then run the external hook on the message if one was specified in
the context.
! * Run the refile hook if we're moving the message from one place to
another.
! * We have to construct the from path name for this because it's not
there.
! * Run the add hook if the message is getting copied or lined somewhere
else.
*/
if (link (msgfile, newmsg) != -1) {
+
+ if (deleting) {
+ op = folder_read(getfolder(1));
+ (void)snprintf(oldmsg, sizeof (oldmsg), "%s/%s", op->foldpath,
msgfile);
+ folder_free(op);
+ (void)ext_hook("ref-hook", oldmsg, newmsg);
+ }
+ else
+ (void)ext_hook("add-hook", newmsg, (char *)0);
+
return msgnum;
} else {
***************
*** 184,187 ****
--- 200,209 ----
close (infd);
close (outfd);
+
+ if (deleting)
+ (void)ext_hook("ref-hook", newmsg, msgfile);
+ else
+ (void)ext_hook("add-hook", newmsg, (char *)0);
+
return msgnum;
}
Index: folder_delmsgs.c
===================================================================
RCS file: /cvsroot/nmh/nmh/sbr/folder_delmsgs.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** folder_delmsgs.c 2 Jul 2002 22:09:14 -0000 1.2
--- folder_delmsgs.c 23 Aug 2002 20:37:01 -0000 1.3
***************
*** 23,31 ****
int
! folder_delmsgs (struct msgs *mp, int unlink_msgs)
{
pid_t pid;
int msgnum, vecp, retval = 0;
char buf[100], *dp, **vec;
/*
--- 23,32 ----
int
! folder_delmsgs (struct msgs *mp, int unlink_msgs, int nohook)
{
pid_t pid;
int msgnum, vecp, retval = 0;
char buf[100], *dp, **vec;
+ char msgpath[BUFSIZ];
/*
***************
*** 83,86 ****
--- 84,100 ----
unset_selected (mp, msgnum);
mp->numsel--;
+
+ /*
+ * Run the external hook on the message if one was specified in
the context.
+ * All we have is the message number; we have changed to the
directory
+ * containing the message. So, we need to extract that directory
to form
+ * the complete path. Note that the caller knows the directory,
but has
+ * no way of passing that to us.
+ */
+
+ if (!nohook) {
+ (void)snprintf(msgpath, sizeof (msgpath), "%s/%d",
getcwd(msgpath, sizeof (msgpath)), msgnum);
+ (void)ext_hook("del-hook", msgpath, (char *)0);
+ }
dp = m_name (msgnum);
Index: folder_pack.c
===================================================================
RCS file: /cvsroot/nmh/nmh/sbr/folder_pack.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** folder_pack.c 2 Jul 2002 22:09:14 -0000 1.2
--- folder_pack.c 23 Aug 2002 20:37:01 -0000 1.3
***************
*** 60,63 ****
--- 60,71 ----
}
+ /*
+ * Invoke the external refile hook for each message being
renamed.
+ */
+
+ (void)snprintf(oldmsg, sizeof (oldmsg), "%s/%d", mp->foldpath,
msgnum);
+ (void)snprintf(newmsg, sizeof (newmsg), "%s/%d", mp->foldpath,
hole);
+ ext_hook("ref-hook", oldmsg, newmsg);
+
/* check if this is the current message */
if (msgnum == mp->curmsg)
Index: m_convert.c
===================================================================
RCS file: /cvsroot/nmh/nmh/sbr/m_convert.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** m_convert.c 2 Jul 2002 22:09:14 -0000 1.2
--- m_convert.c 23 Aug 2002 20:37:01 -0000 1.3
***************
*** 226,230 ****
/*
* Convert the various message names to
! * there numeric value.
*
* n (integer)
--- 226,230 ----
/*
* Convert the various message names to
! * their numeric values.
*
* n (integer)
[Prev in Thread] |
Current Thread |
[Next in 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,
Jon Steinhart <address@hidden> <=
- Prev by Date:
[Nmh-commits] CVS: nmh/docs README-HOOKS,NONE,1.1 README-ATTACHMENTS,1.1,1.2
- Next by Date:
[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
- Previous by thread:
[Nmh-commits] CVS: nmh/docs README-HOOKS,NONE,1.1 README-ATTACHMENTS,1.1,1.2
- Next by 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
- Index(es):