home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pine / pine3.07 / c-client / bezerk.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-29  |  5.0 KB  |  167 lines

  1. /*
  2.  * Program:    Berkeley mail routines
  3.  *
  4.  * Author:    Mark Crispin
  5.  *        Networks and Distributed Computing
  6.  *        Computing & Communications
  7.  *        University of Washington
  8.  *        Administration Building, AG-44
  9.  *        Seattle, WA  98195
  10.  *        Internet: MRC@CAC.Washington.EDU
  11.  *
  12.  * Date:    20 December 1989
  13.  * Last Edited:    21 April 1992
  14.  *
  15.  * Copyright 1992 by the University of Washington
  16.  *
  17.  *  Permission to use, copy, modify, and distribute this software and its
  18.  * documentation for any purpose and without fee is hereby granted, provided
  19.  * that the above copyright notice appears in all copies and that both the
  20.  * above copyright notice and this permission notice appear in supporting
  21.  * documentation, and that the name of the University of Washington not be
  22.  * used in advertising or publicity pertaining to distribution of the software
  23.  * without specific, written prior permission.  This software is made
  24.  * available "as is", and
  25.  * THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
  26.  * WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED
  27.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN
  28.  * NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL,
  29.  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  30.  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT
  31.  * (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION
  32.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  33.  *
  34.  */
  35.  
  36.  
  37. /* Dedication:
  38.  *  This file is dedicated with affection to those Merry Marvels of Musical
  39.  * Madness . . .
  40.  *  ->  The Incomparable Leland Stanford Junior University Marching Band  <-
  41.  * who entertain, awaken, and outrage Stanford fans in the fact of repeated
  42.  * losing seasons and shattered Rose Bowl dreams [Cardinal just don't have
  43.  * HUSKY FEVER!!!].
  44.  *
  45.  */
  46.  
  47. /* Build parameters */
  48.  
  49. #define LOCKTIMEOUT 5        /* lock timeout in minutes */
  50. #define CHUNK 65536        /* read-in chunk size */
  51.  
  52.  
  53. /* Command bits from bezerk_getflags() */
  54.  
  55. #define fSEEN 1
  56. #define fDELETED 2
  57. #define fFLAGGED 4
  58. #define fANSWERED 8
  59.  
  60.  
  61. /* Status string */
  62.  
  63. #define STATUS "Status: RO\nX-Status: DFA\n\n"
  64.  
  65.  
  66. /* BEZERK per-message cache information */
  67.  
  68. typedef struct file_cache {
  69.   char *header;            /* pointer to RFC 822 header */
  70.   unsigned long headersize;    /* size of RFC 822 header */
  71.   char *body;            /* pointer to message body */
  72.   unsigned long bodysize;    /* size of message body */
  73.   unsigned long date;        /* integer representation of date */
  74.   char status[sizeof (STATUS)];    /* status flags */
  75.   char internal[1];        /* start of internal header and data */
  76. } FILECACHE;
  77.  
  78.  
  79. /* BEZERK I/O stream local data */
  80.  
  81. typedef struct bezerk_local {
  82.   unsigned int dirty : 1;    /* disk copy needs updating */
  83.   char *host;            /* local host name */
  84.   char *fname;            /* local copy of file name */
  85.   int ld;            /* lock file descriptor */
  86.   char *lname;            /* lock file name */
  87.   off_t filesize;        /* file size parsed */
  88.   time_t filetime;        /* last file time */
  89.   unsigned long cachesize;    /* size of local cache */
  90.   FILECACHE **msgs;        /* pointers to message-specific information */
  91.   char *buf;            /* temporary buffer */
  92.   unsigned long buflen;        /* current size of temporary buffer */
  93. } BEZERKLOCAL;
  94.  
  95.  
  96. /* Convenient access to local data */
  97.  
  98. #define LOCAL ((BEZERKLOCAL *) stream->local)
  99.  
  100. /* Function prototypes */
  101.  
  102. DRIVER *bezerk_valid  ();
  103. int bezerk_isvalid  ();
  104. void bezerk_find  ();
  105. void bezerk_find_bboards  ();
  106. MAILSTREAM *bezerk_open  ();
  107. void bezerk_close  ();
  108. void bezerk_fetchfast  ();
  109. void bezerk_fetchflags  ();
  110. ENVELOPE *bezerk_fetchenvelope  ();
  111. char *bezerk_snarf  ();
  112. char *bezerk_fetchheader  ();
  113. char *bezerk_fetchtext  ();
  114. char *bezerk_fetchbody ();
  115. void bezerk_setflag  ();
  116. void bezerk_clearflag  ();
  117. void bezerk_search  ();
  118. long bezerk_ping  ();
  119. void bezerk_check  ();
  120. void bezerk_expunge  ();
  121. long bezerk_copy  ();
  122. long bezerk_move  ();
  123. void bezerk_gc  ();
  124.  
  125. void bezerk_abort  ();
  126. char *bezerk_file  ();
  127. int bezerk_lock  ();
  128. void bezerk_unlock  ();
  129. int bezerk_parse  ();
  130. char *bezerk_eom  ();
  131. int bezerk_extend  ();
  132. void bezerk_save  ();
  133. int bezerk_copy_messages  ();
  134. void bezerk_write_message  ();
  135. void bezerk_update_status  ();
  136. short bezerk_getflags  ();
  137. char bezerk_search_all  ();
  138. char bezerk_search_answered  ();
  139. char bezerk_search_deleted  ();
  140. char bezerk_search_flagged  ();
  141. char bezerk_search_keyword  ();
  142. char bezerk_search_new  ();
  143. char bezerk_search_old  ();
  144. char bezerk_search_recent  ();
  145. char bezerk_search_seen  ();
  146. char bezerk_search_unanswered  ();
  147. char bezerk_search_undeleted  ();
  148. char bezerk_search_unflagged  ();
  149. char bezerk_search_unkeyword  ();
  150. char bezerk_search_unseen  ();
  151. char bezerk_search_before  ();
  152. char bezerk_search_on  ();
  153. char bezerk_search_since  ();
  154. char bezerk_search_body  ();
  155. char bezerk_search_subject  ();
  156. char bezerk_search_text  ();
  157. char bezerk_search_bcc  ();
  158. char bezerk_search_cc  ();
  159. char bezerk_search_from  ();
  160. char bezerk_search_to  ();
  161.  
  162. typedef char (*search_t)  ();
  163. search_t bezerk_search_date  ();
  164. long bezerk_date  ();
  165. search_t bezerk_search_flag  ();
  166. search_t bezerk_search_string  ();
  167.