/* $VER: AreaDone.spot 1.1 (30.6.93) */
/* Marc Duponcheel */

/* will clear unread flag for unread messages in current message list */
/* usually done when one has finished reading an area */
/* therefore called 'AreaDone' (some call it Catch Up) */

/* history : 1.1 */
/* if the user currently is NOT in a any messagelist */
/* a requester ask to confirm the action before going to the messagelist */
/* some people may want to leave out that part */

address spot
options results

/* trace results */

CR = '0d'x

/* check if we are in a messagelist */
'ismessagelist'
if rc = 5 then
/* if not go to messagelist, but first ask permission */
 do
  'messagelist'
  'getareausername'
  areaname = RESULT
/* user might want to cancel */
  prompt = '"' || "Area" || CR || areaname || '"'
  'requestresponse TITLE " Done " PROMPT 'prompt''
 end

if rc ~= 5
 then
  do
   'excludeflag ALL'      /* clear any selection */
   'includeflag UNREAD'   /* select unread messages */
   'clearflags UNREAD'    /* make them 'read' */
   'excludeflag ALL'      /* clear any selection */
  end

exit /* done here ... */
