i had a little luck with this patch:
http://www.mail-archive.com/mutt-users@mutt.org/msg15187.html

but there are a few picky little things.  since i have little perl and no c
experience i could use some help :>

for some reason the patch didn't apply happily even though the code looks
similar (line numbers have changed probably since version 1.2)

i may be crazy, but i just went and applied the patches by hand, so it's
possible i made a boo-boo somewhere.

basically the main problem i'm having is that mutt now says:
New mail in =lists:sendmail.]
instead of
New mail in =lists:sendmail.

I checked with older versions and also with the unpatched mutt-1.3.20 and
they both don't do this. it looks like maybe the variable for the folder name
is getting passed back with an extra character or something???

diff -u mutt-1.3.20/curs_main.c mutt-1.3.20-rr/curs_main.c                             
              ~
--- mutt-1.3.20/curs_main.c     Thu Jul 19 07:49:51 2001
+++ mutt-1.3.20-rr/curs_main.c  Fri Aug  3 23:25:57 2001
@@ -395,7 +395,7 @@
  */
 int mutt_index_menu (void)
 {
-  char buf[LONG_STRING], helpstr[SHORT_STRING];
+  char buf[LONG_STRING], helpstr[SHORT_STRING],status_buf[LONG_STRING]="";
   int op = OP_NULL;
   int done = 0;                /* controls when to exit the "event" loop */
   int i = 0, j;
@@ -533,7 +533,20 @@
 
       if (menu->redraw & REDRAW_STATUS) 
       {
+       static pid_t child=0;
        menu_status_line (buf, sizeof (buf), menu, NONULL (Status));
+       if (child) {
+                if (waitpid(child, 0, WNOHANG)) child=0;
+              }
+       if (!child && StatusCmd && *StatusCmd && strncmp(buf,status_buf,sizeof (buf)))
+       {
+           strncpy(status_buf,buf,sizeof (buf));
+                  child=vfork();
+                  if (!child) {
+                  execlp(StatusCmd,StatusCmd,status_buf,buf,0);
+                  exit(1);
+                  }
+              }
        CLEARLINE (option (OPTSTATUSONTOP) ? 0 : LINES-2);
        SETCOLOR (MT_COLOR_STATUS);
        mutt_paddstr (COLS, buf);
diff -u mutt-1.3.20/globals.h mutt-1.3.20-rr/globals.h                                 
              ~
--- mutt-1.3.20/globals.h       Mon Jun 18 08:56:14 2001
+++ mutt-1.3.20-rr/globals.h    Fri Aug  3 23:17:47 2001
@@ -99,6 +99,7 @@
 WHERE char *Spoolfile;
 WHERE char *StChars;
 WHERE char *Status;
+WHERE char *StatusCmd;
 WHERE char *Tempdir;
 WHERE char *Tochars;
 WHERE char *Username;
diff -u mutt-1.3.20/init.h mutt-1.3.20-rr/init.h                                       
              ~
--- mutt-1.3.20/init.h  Fri Jun 29 03:05:50 2001
+++ mutt-1.3.20-rr/init.h       Sat Aug  4 02:05:56 2001
@@ -2024,6 +2024,19 @@
   { "status_chars",    DT_STR,  R_BOTH, UL &StChars, UL "-*%A" },
   /*
   ** .pp
+  ** Specifies the command to be executed each time the status line
+  ** changes.
+  ** The new status line is passed as the first parameter,
+  ** the old one as the second parameter.
+  ** This is useful e.g. to change the xterm window icon title according to the
+  ** status of the mailbox.
+  ** The command can parse the status and do more complicated things, for
+  ** example, bring up a popu menu whenever a new mail arrives, sound a
+  ** bell etc etc.
+  */
+  { "status_cmd",      DT_PATH, R_NONE, UL &StatusCmd, 0 },
+  /*
+  ** .pp
   ** Controls the characters used by the "%r" indicator in
   ** ``$$status_format''. The first character is used when the mailbox is
   ** unchanged. The second is used when the mailbox has been changed, and
 
the perl script is currently like this (i had to modify it a little to make
it work and to do what i wanted it to do).

#!/usr/bin/perl 
if (($ENV{TERM} eq "vt100") or ( not defined ($ENV{XMUTT} ) ) ) {
exit(1);
}

#open (TTY, "/dev/tty");
$title=$ARGV[0];
$new=0;
@array=split(' ',$title);
if ($title =~ /N=([0-9]+)/o) {
$new=$1;
}
$boxes=0;
if ($title =~ /([0-9]+) mailboxes/o) {
$boxes=$1;
}
$line="";
if ($new or $boxes) {
$line="new ".$new."/".$boxes." ";
} 

$array[1] =~ s#:##;
$array[3] =~ s#.*=##;

$line.="Mutt ".$array[1]." ".$array[3];
#print TTY "]2;$line"; 
print "\033]0;$line\007]";

does anyone have any ideas?
any help would be appreciated (and anyone is of course welcome to use this as
a patch against the new version since the only patch i was able to find was
the one for 1.2).

w

Reply via email to