@q
@program jmail-warn.muf
1 99999 d
i
( jmail-warn.muf    v1.0    Jessy @ FurryMUCK    8/99
  
  JMail-Warn is a companion program to JMail that notifies users
  at logon if they have new mail.
  
  INSTALLATION:

  Set JMail-Warn Wizard, Link_OK, and AutoStart. Set a _connect
  property on Room #0 with the dbref of JMail-Warn. Example:
    
    @set #0=_connect/jmail-warn:321

  JMail-Warn may be freely ported. Please comment any changes.
)
 
: main
   
  me @ "@/mail/un/" nextprop
  begin                               (* loop through unread messages *)
    dup while
    dup dup "/" rinstr strcut swap pop                   (* in inbox? *)
    me @ "@/mail/fo/  Inbox/" 3 pick strcat "#/" strcat nextprop 
    me @ "@/mail/de/" 4 rotate strcat getprop dup if
      systime <             (* will still be there when mail is read? *)
    then
    not and if       (* if both true for a msg, break with a true val *) 
      break
    then
    me @ swap nextprop
  repeat
  
  dup if                 (* notify if a true value is on top of stack *)
    me @ ">>  You have mail." notify
  then
;
.
c
q