farber@pcpond.cis.upenn.edu. (David J. Farber) (03/27/90)
Is there anyway to have a aural alarm when mail arrives (whether the mail reader is active or non active. Dave David Farber; Prof. of CIS and EE, U of Penn, Philadelphia, PA 19104-6389 Tele: 215-898-9508(off); 215-274-8292 (home); FAX: 215-274-8293; Cellular: 302-740- 1198 "The fundamental principle of science, the definition almost, is this: the sole test of the validity of any idea is experiment." -- R. P. Feynman
lacsap@mit-amt.MEDIA.MIT.EDU (Pascal Chesnais) (03/27/90)
In article <22303@netnews.upenn.edu> farber@pcpond.cis.upenn.edu (David J. Farber) writes: >Is there anyway to have a aural alarm when mail arrives (whether the mail reader is active or non active. > >Dave er, yes I do it all the time to the opening bars of "America Dream" CSNY. The problem is I really do not know the status of Berkeley code I am using. That is to say is it ok to distribute the modified sources? Anyone really know? In anycase I will package together the binaries, and put them somewhere accessible. It is a horrible kludge, it works, and I know of one other place that is running it now. My officemate hates it! pasc -- Pascal Chesnais, Research Specialist, Electronic Publishing Group Media Laboratory, E15-348, 20 Ames Street, Cambridge, Ma, 02139 (617) 253-0311 email: lacsap@plethora.media.mit.edu (NeXT)
robertl@bucsf.bu.edu (Robert La Ferla) (03/28/90)
I like that idea. I hope NeXT will incorporate it as an optional feature in Preferences. The obvious default aural alert is the English lady saying "You have new mail." __ / \ / __/_ /___/ __ /_ __ __ / INTERNET: robertl@bucsf.bu.edu / \ '_' /_/ |_- / ' / BITNET: mete0pc@buacca.bu.edu
deke@ee.rochester.edu (Dikran Kassabian) (03/28/90)
In article <> robertl@bucsf.bu.edu (Robert La Ferla) writes: >I like that idea. I hope NeXT will incorporate it as an optional feature in >Preferences. The obvious default aural alert is the English lady saying >"You have new mail." At face value this seems like an easy hack for do-it-yourself types. stat(2) /usr/spool/mail/`whoami` or whatever file is appropriate, and compare atime and mtime. When mtime increases but atime does not, play your favorite sound. This algorithm needs some more stuff to make it work. You have to initialize by tucking away the value of mtime originally read, you have to keep track of the values of both whenever you decide to play the sound, you have to choose a sleep(3) time within the loop, etc. But this could be coded in an hour or two. Less if neatness doesn't count. Of course, this method requires an additional process for every user. Not very nice. The comsat/biff approach is preferable, and probably only slightly more difficult to implemented. Nevertheless, a NeXT typically has only one user at a time that could possibly want an aural alert about mail... the one on the console. ^Deke Kassabian, deke@ee.rochester.edu or ur-valhalla!deke Univ of Rochester, Dept of EE, Rochester, NY 14627 (+1 716-275-3106)
deke@ee.rochester.edu (Dikran Kassabian) (03/29/90)
In article <1990Mar28.153439.6841@ee.rochester.edu> I (Dikran Kassabian) write: <In article <> robertl@bucsf.bu.edu (Robert La Ferla) writes: <>I like that idea. I hope NeXT will incorporate it as an optional feature in <>Preferences. The obvious default aural alert is the English lady saying <>"You have new mail." < <At face value this seems like an easy hack for do-it-yourself types. <stat(2) /usr/spool/mail/`whoami` or whatever file is appropriate, and <compare atime and mtime. When mtime increases but atime does not, play <your favorite sound. < <This algorithm needs some more stuff to make it work. You have to initialize <by tucking away the value of mtime originally read, you have to keep track <of the values of both whenever you decide to play the sound, you have to <choose a sleep(3) time within the loop, etc. But this could be coded in <an hour or two. Less if neatness doesn't count. < <Of course, this method requires an additional process for every user. Not <very nice. The comsat/biff approach is preferable, and probably only slightly <more difficult to implemented. Nevertheless, a NeXT typically has only one <user at a time that could possibly want an aural alert about mail... the <one on the console. I managed to get to a NeXT this afternoon, so I whipped it up. Here it is. Lots of improvements possible, but this seems to work. No warrnties and all that stuff... /* Audio mail notification program * D.Kassabian 3/28/90 * University of Rochester Department of Electrical Engineering * * tweak the three #defines to suit. */ #include <stdio.h> #include <time.h> #include <sys/types.h> #include <sys/stat.h> #define TIMER 2*60 #define SOUND "sndplay /home/galaxy2/staff/deke/mail.snd" #define MAILPATH "/usr/spool/mail/%s" extern char *getenv(); main (argc, argv, envp) register int argc; register char **argv; char **envp; { char *path, *user, *sys_buf; void *malloc(); struct stat *buf; long tmp_time=0; if( (user = getenv("USER"))==0 ){ /* get user name */ fprintf(stderr,"Who are you?"); exit(1); } path=malloc(sizeof(MAILPATH)+10); /* allocate storage */ buf=malloc(1024); /* allocate storage */ (void) sprintf(path,MAILPATH,user); /* setup path */ sys_buf=malloc(sizeof(SOUND)); /* allocate storage */ (void) sprintf(sys_buf,SOUND); /* setup shell command */ while(1){ /* forever... */ if( stat(path,buf)!=0 ){ /* stat path */ perror(path); exit(1); } if(( buf->st_mtime > buf->st_atime) && ((buf->st_mtime > tmp_time))){ system(sys_buf); tmp_time=buf->st_mtime; } sleep(TIMER); } /*endwhile*/ }
dorner@pequod.cso.uiuc.edu (Steve Dorner) (03/30/90)
In article <1990Mar28.153439.6841@ee.rochester.edu> deke@ee.rochester.edu (Dikran Kassabian) writes: >This algorithm needs some more stuff to make it work. You have to initialize >by tucking away the value of mtime originally read, you have to keep track >of the values of both whenever you decide to play the sound, you have to >choose a sleep(3) time within the loop, etc. But this could be coded in >an hour or two. Less if neatness doesn't count. > >Of course, this method requires an additional process for every user. Not >very nice. There's an easier way; just forward your mail to yourself and to sndplay, in your .forward file. Mine even (tries) to speak the message in the voice of the person who sent me the mail. % cat .forward dorner, "|/Users/Dorner/Apps/newmail" % cat /Users/Dorner/Apps/newmail #!/bin/sh from=`/usr/ucb/grep -i '^From:' | /usr/bin/tr 'A-Z' 'a-z' | /usr/ucb/head -1 | /bin/sed -e 's/[^ ]* //' -e 's/.*<//' -e 's/>.*//' -e 's/([^)]*)//' -e 's/@.*//' -e 's/ .*//'` if test $from != "" -a -r /Users/Dorner/Sounds/$from".snd" ; then /usr/bin/sndplay /Users/Dorner/Sounds/$from".snd" else /usr/bin/sndplay /Users/Dorner/Sounds/mail.snd fi exit 0 % It's easy enough to add a check to see if you're logged in or not; my cube is in a room occupied only by me, so I don't bother. -- Steve Dorner, U of Illinois Computing Services Office Internet: s-dorner@uiuc.edu UUCP: {convex,uunet}!uiucuxc!dorner
edwardj@microsoft.UUCP (Edward JUNG) (03/30/90)
As I recall, instead of spinning in a tight loop stat() ing a mail file, you can set up file monitoring events under NeXTStep. Being presently at Microsoft, I don't have my NeXT docs right here, but for a quick hack solution (or a quick hack with a good UI, for that matter) you might look at this feature in the OS. Edward Jung AOS Systems Architect