home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Spezial / SPEZIAL2_97.zip / SPEZIAL2_97.iso / ANWEND / ONLINE / ELM23-2 / ELM23-2.ZIP / src / delete.c < prev    next >
C/C++ Source or Header  |  1990-04-28  |  4KB  |  142 lines

  1.  
  2. static char rcsid[] = "@(#)$Id: delete.c,v 4.1 90/04/28 22:42:43 syd Exp $";
  3.  
  4. /*******************************************************************************
  5.  *  The Elm Mail System  -  $Revision: 4.1 $   $State: Exp $
  6.  *
  7.  *             Copyright (c) 1986, 1987 Dave Taylor
  8.  *             Copyright (c) 1988, 1989, 1990 USENET Community Trust
  9.  *******************************************************************************
  10.  * Bug reports, patches, comments, suggestions should be sent to:
  11.  *
  12.  *    Syd Weinstein, Elm Coordinator
  13.  *    elm@DSI.COM            dsinc!elm
  14.  *
  15.  *******************************************************************************
  16.  * $Log:    delete.c,v $
  17.  * Revision 4.1  90/04/28  22:42:43  syd
  18.  * checkin of Elm 2.3 as of Release PL0
  19.  *
  20.  *
  21.  ******************************************************************************/
  22.  
  23. /**  Delete or undelete files: just set flag in header record!
  24.      Also tags specified message(s)...
  25.  
  26. **/
  27.  
  28. #include "headers.h"
  29.  
  30. char *show_status();
  31.  
  32. delete_msg(real_del, update_screen)
  33. int real_del, update_screen;
  34. {
  35.     /** Delete current message.  If real-del is false, then we're
  36.         actually requested to toggle the state of the current
  37.         message... **/
  38.  
  39.     if (real_del)
  40.       headers[current-1]->status |= DELETED;
  41.     else if (ison(headers[current-1]->status, DELETED))
  42.       clearit(headers[current-1]->status, DELETED);
  43.     else
  44.       setit(headers[current-1]->status, DELETED);
  45.  
  46.     if (update_screen)
  47.       show_msg_status(current-1);
  48. }
  49.  
  50. undelete_msg(update_screen)
  51. int update_screen;
  52. {
  53.     /** clear the deleted message flag **/
  54.  
  55.     clearit(headers[current-1]->status, DELETED);
  56.  
  57.     if (update_screen)
  58.       show_msg_status(current-1);
  59. }
  60.  
  61. show_msg_status(msg)
  62. int msg;
  63. {
  64.     /** show the status of the current message only.  **/
  65.  
  66.     char tempbuf[3];
  67.  
  68.     strcpy(tempbuf, show_status(headers[msg]->status));
  69.  
  70.     if (on_page(msg)) {
  71.       MoveCursor(((compute_visible(msg+1)-1) % headers_per_page) + 4, 2);
  72.       if (msg+1 == current && !arrow_cursor) {
  73.         StartBold();
  74.         Writechar( tempbuf[0] );
  75.         EndBold();
  76.       }
  77.       else
  78.         Writechar( tempbuf[0] );
  79.     }
  80. }
  81.  
  82. int
  83. tag_message(update_screen)
  84. int update_screen;
  85. {
  86.     /** Tag current message and return TRUE.
  87.         If already tagged, untag it and return FALSE. **/
  88.  
  89.     int istagged;
  90.  
  91.     if (ison(headers[current-1]->status, TAGGED)) {
  92.       clearit(headers[current-1]->status, TAGGED);
  93.       istagged = FALSE;
  94.     } else {
  95.       setit(headers[current-1]->status, TAGGED);
  96.       istagged = TRUE;
  97.     }
  98.  
  99.     if(update_screen)
  100.         show_msg_tag(current-1);
  101.     return(istagged);
  102. }
  103.  
  104. show_msg_tag(msg)
  105. int msg;
  106. {
  107.     /** show the tag status of the current message only.  **/
  108.  
  109.     if (on_page(msg)) {
  110.       MoveCursor(((compute_visible(msg+1)-1) % headers_per_page) + 4, 4);
  111.       if (msg+1 == current && !arrow_cursor) {
  112.         StartBold();
  113.         Writechar( ison(headers[msg]->status, TAGGED)? '+' : ' ');
  114.         EndBold();
  115.       }
  116.       else
  117.         Writechar( ison(headers[msg]->status, TAGGED)? '+' : ' ');
  118.     }
  119. }
  120.  
  121. show_new_status(msg)
  122. int msg;
  123. {
  124.     /** If the specified message is on this screen, show
  125.         the new status (could be marked for deletion now,
  126.         and could have tag removed...)
  127.     **/
  128.  
  129.     if (on_page(msg))
  130.       if (msg+1 == current && !arrow_cursor) {
  131.         StartBold();
  132.         PutLine2(((compute_visible(msg+1)-1) % headers_per_page) + 4,
  133.            2, "%s%c", show_status(headers[msg]->status),
  134.            ison(headers[msg]->status, TAGGED )? '+' : ' ');
  135.         EndBold();
  136.       }
  137.       else
  138.         PutLine2(((compute_visible(msg+1)-1) % headers_per_page) + 4,
  139.            2, "%s%c", show_status(headers[msg]->status),
  140.            ison(headers[msg]->status, TAGGED )? '+' : ' ');
  141. }
  142.