Article View: comp.mail.mush
Article #843Re: instant notification of new mail in curses mode (LONG)
From: David W. Vezie
Date: Wed, 10 May 1989 07:45
Date: Wed, 10 May 1989 07:45
124 lines
5124 bytes
5124 bytes
In article <1628@taux01.UUCP> cjosta@tasu77.UUCP (Jonathan Sweedler) writes:
> ... I can change my icon
>on this window to be a mailbox, but mush, of course, doesn't put the
>flag up when new mail arrives. Is there anyway to change this easily?
I've solved that problem in a rather interresting way. I use the command
line mode of mush (it's what I'm used to, and it works the best for me).
I have a dedicated shelltool used for just mush, so I have the apropriate
icon (in this case a modified mailtool icon (with "DV" on it :-)) for it.
I use my .forward file to include a filter that does all the window management
stuff. Here's how it works:
I have two .forward files, one for when I'm here, and one for when I'm
not:
The one for when I'm here reads:
dv,"|/u0/dv/bin/mailicon"
The one for when I'm gone reads simply:
dv
Then, I make sure that my "mushtool" is always in the same window
(by using "skill" to kill off everything on ttyp0, then starting
the "mushtool" so that it automatically starts with ttyp0). My
"mailicon" program does:
---------------
#! /bin/sh
# First, free up the process doing the filtering
cat > /dev/null
# .mailtty always contains /dev/ttyp0
if [ ! -f /u0/dv/.mailtty ]; then
exit 0
fi
TTY=`cat /u0/dv/.mailtty`
if [ "X$TTY" = X ]; then
exit 0
fi
if [ ! -f $TTY ]; then
exit 0
fi
# put it in background in case it blocks
if [ -f /u0/dv/.mailautoopen ]; then
/u0/dv/bin/sVecho "\007\033]I/u0/dv/=images/mail.icon\033\\ \b\033[1t\c" > $TTY &
lastpid=$!
else
/u0/dv/bin/sVecho "\007\033]I/u0/dv/=images/mail.icon\033\\ \b\c" > $TTY &
lastpid=$!
fi
sleep 5
( /bin/kill -9 $lastpid 2> /dev/null & )
exit 0
----------------------------------------------
Couple of things with this; sVecho is the Sun port of System V echo
(/usr/5bin/echo) (since we don't keep all of /usr/5bin around). The
.mailautoopen file determines whether or not it will automatically
open the window so that I can read it (if I'm busy with something,
I'll remove the file, so that it won't). It also always changes the
icon so that it shows the "flag" as being up. There is a check here
that it can actually write to the pty. If it blocks, then it's killed
5 seconds later. When I first got this going, I had a problem with
my proc table choking with all these "mailicon" processes. This prevents
that.
Then, I've got some things in my .mushrc that controls this. My "mushtool"
script:
---------
#! /bin/sh
skill -1 ttyp0
MAILRC=$HOME/.mushrc.sun shelltool -Wp 42 180 -Ws 730 637 -WP 1088 0 -Wl ""\
-WI /u0/dv/=images/nomail.icon -c /u0/dv/bin/mush &
---------
skills off everything on ttyp0 (so that I'm guaranteed of getting that pty),
it also sets my $MAILRC to be .mushrc.sun, which reads:
---------
cd
sh tty
set screen=29
set crt=33
cmd updend "update -N;potm;f + $;sVecho '\033]I/u0/dv/=images/nomail.icon\033\0134\c'"
cmd q 'sVecho "\033[2t";updend'
set ignoreeof = q
set prompt = '^[]lNew: %n, Unread: %u, Deleted: %d, Folder: %f, (%T)^[\\Msg %m of %t: '
cmd open touch ~/.mailautoopen
cmd noopen rm ~/.mailautoopen
source ~/.mushrc.common
---------
Important things here -- updend updates the folder, runs "potm" (sets
a header to the phase of the moon), sets the pointer to the last message,
and changes the icon to be the "nomail" icon. 'q' closes the window,
then does all that (so that if I do a 'q', it will do all the updating
and such (which can take a while because I usually keep >100 messages
in my main folder) when the window's closed, and I can know when it's done
by the icon changing. I also have my prompt set to put some useful info
on the status line (note that the { '^', '[' }s up there should be changed
to escapes).
I then have two cmd's for determining whether or not my mushtool will
automatically open, and finally it sources .mushrc.common (all the common
.mushrc stuff (my normal .mushrc contains non-suntools specific versions
of the "updend", "q", commands and the $prompt).
You'll probably find things like "why does he do that? That doesn't make
any sense at all!" You're right. Just while doing this, I found a couple
of problems with it. I havn't put too much time into this system beyond
getting it to work, which it does.
Hope this helps some of you with your system.
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
David W. Vezie, Systems Hacker | dv%unicom@pacbell.com
"I support Star Wars (tm), | pacbell!unicom!dv
it's SDI that I can't stand" --Me | {sun,ucbvax}!pixar!unicom!dv
Technical Details
Message-ID:
<472@unicom.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!ucsfcgl!pixar!unicom!dvReferences:
<1628@taux01.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!ucsfcgl!pixar!unicom!dv From: dv@unicom.UUCP (David W. Vezie) Newsgroups: comp.mail.mush Subject: Re: instant notification of new mail in curses mode (LONG) Summary: what I do Keywords: new mail Message-ID: <472@unicom.UUCP> Date: 10 May 89 07:45:11 GMT References: <1628@taux01.UUCP> Organization: UNIx at the College Of Marin, Kentfield CA Lines: 124