home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume3 / pcmail / part06 / mbox.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-02-03  |  2.9 KB  |  98 lines

  1. /*++
  2. /* NAME
  3. /*      mbox 3
  4. /* SUMMARY
  5. /*      display incoming/outgoing mail messages
  6. /* PROJECT
  7. /*      pc-mail
  8. /* PACKAGE
  9. /*      mailsh
  10. /* SYNOPSIS
  11. /*    #include "pager.h"
  12. /*    #include "mbox.h"
  13. /*
  14. /*      int mbox(type,msgid)
  15. /*    char *type;
  16. /*    int msgid;
  17. /* DESCRIPTION
  18. /*      mbox() is invoked when the user has selected an incoming or
  19. /*    outgoing mail message (not a message in preparation)
  20. /*    from the main mail box menu. It instructs the pager to display 
  21. /*    the selected mail message. The message type parameter is 
  22. /*    a string with the type of message
  23. /*    (see screen.h), msgid is the numerical message id. If the file is
  24. /*    read for the first time (type == "New"), it will be marked as read.
  25. /*
  26. /*      The user has the usual options for manipulating the message
  27. /*    being displayed.
  28. /* FILES
  29. /*      mail header files in the spool directory
  30. /* SEE ALSO
  31. /*      pager(3), pager(5), kbdinp(3)
  32. /* DIAGNOSTICS
  33. /*      If a selected mail message could not be found an error message
  34. /*      is displayed instead.
  35. /* AUTHOR(S)
  36. /*      W.Z. Venema
  37. /*      Eindhoven University of Technology
  38. /*      Department of Mathematics and Computer Science
  39. /*      Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
  40. /* CREATION DATE
  41. /*      Sun Apr  5 13:01:12 GMT+1:00 1987
  42. /* LAST MODIFICATION
  43. /*    Mon Apr  4 23:45:14 MET 1988
  44. /* VERSION/RELEASE
  45. /*    1.3
  46. /*--*/
  47.  
  48. #include "defs.h"
  49. #include "path.h"
  50. #include "pager.h"
  51. #include "screen.h"
  52. #include "mailsh.h"
  53.  
  54. hidden File *letter = 0;            /* pager file */
  55.  
  56. /* show_letter - display selected mail message */
  57.  
  58. hidden int show_letter()
  59. {
  60.     set_pager(letter);                /* select message display */
  61.     ds_pager();                    /* put it on the screen */
  62.     return(0);                    /* say screen is ok */
  63. }
  64.  
  65. /* mbox - user has selected a non-work mail message file */
  66.  
  67. public int mbox(type,id)
  68. char *type;
  69. int id;
  70. {
  71.     static Screen screen[] = {
  72.     'C',    "Close",        0,      initscreen,
  73.     'D',    "Delete",       delete,    delcurr,
  74.     'M',    "Mail",        mailfile,"Mail a copy of this message",
  75.     'P',    "Print",        print,    printcurr,
  76.     'S',    "Save",         save,    "Save this message to ordinary file",
  77.     'W',    "Work",        makework,"Save this message to work file",
  78.     PGUP,    PgUp,        pu_pager,pageup,
  79.     PGDN,    PgDn,        pd_pager,pagedn,
  80.     UP,    "Up",           up_pager,csrup,
  81.     DOWN,    "Down",         dn_pager,csrdn,
  82.     0,    0,              show_letter,"(Reading a mail message)",
  83.     };
  84.     register char *seen;
  85.  
  86.     if (rd_pager(letter = open_pager(),message)) {
  87.     mesg_pager(letter,m_msgread);        /* no file or read error */
  88.     } else if (strcmp(type,"New")) {        /* !!ANONYMOUS CONSTANT!! */
  89.     /* void */ ;                /* not a new message */
  90.     } else if (rename(comment,seen = in_meta(id)) == 0) {
  91.     strcpy(comment,seen);            /* mark message as read */
  92.     junk_desk();                /* say desk-top outdated */
  93.     }
  94.     kbdinp(screen);                /* look at the screen */
  95.     close_pager(letter),letter = 0;        /* destroy the display */
  96.     return(S_REDRAW);                /* force screen redrawing */
  97. }
  98.