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

  1. /*
  2.  * Program:    Interactive Mail Access Protocol 2 (IMAP2) 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:    15 June 1988
  13.  * Last Edited:    21 April 1992
  14.  *
  15.  * Sponsorship:    The original version of this work was developed in the
  16.  *        Symbolic Systems Resources Group of the Knowledge Systems
  17.  *        Laboratory at Stanford University in 1987-88, and was funded
  18.  *        by the Biomedical Research Technology Program of the National
  19.  *        Institutes of Health under grant number RR-00785.
  20.  *
  21.  * Original version Copyright 1988 by The Leland Stanford Junior University.
  22.  * Copyright 1992 by the University of Washington.
  23.  *
  24.  *  Permission to use, copy, modify, and distribute this software and its
  25.  * documentation for any purpose and without fee is hereby granted, provided
  26.  * that the above copyright notices appear in all copies and that both the
  27.  * above copyright notices and this permission notice appear in supporting
  28.  * documentation, and that the name of the University of Washington or The
  29.  * Leland Stanford Junior University not be used in advertising or publicity
  30.  * pertaining to distribution of the software without specific, written prior
  31.  * permission.  This software is made available "as is", and
  32.  * THE UNIVERSITY OF WASHINGTON AND THE LELAND STANFORD JUNIOR UNIVERSITY
  33.  * DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD TO THIS SOFTWARE,
  34.  * INCLUDING WITHOUT LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  35.  * FITNESS FOR A PARTICULAR PURPOSE, AND IN NO EVENT SHALL THE UNIVERSITY OF
  36.  * WASHINGTON OR THE LELAND STANFORD JUNIOR UNIVERSITY BE LIABLE FOR ANY
  37.  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
  38.  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
  39.  * CONTRACT, TORT (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF
  40.  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  41.  *
  42.  */
  43.  
  44.  
  45. /* Build parameters */
  46.  
  47. #define MAXLOGINTRIALS 3    /* maximum number of login trials */
  48. #define MAPLOOKAHEAD 20        /* fetch lookahead */
  49.  
  50.  
  51. /* Constants */
  52.  
  53. #define IMAPTCPPORT (long) 143    /* assigned TCP contact port */
  54.  
  55. /* IMAP2 specific definitions */
  56.  
  57.  
  58. /* Parsed reply message from imap_reply */
  59.  
  60. typedef struct imap_parsed_reply {
  61.   char *line;            /* original reply string pointer */
  62.   char *tag;            /* command tag this reply is for */
  63.   char *key;            /* reply keyword */
  64.   char *text;            /* subsequent text */
  65. } IMAPPARSEDREPLY;
  66.  
  67.  
  68. #define IMAPTMPLEN 16*MAILTMPLEN
  69.  
  70. /* IMAP2 I/O stream local data */
  71.  
  72. typedef struct imap_local {
  73.   void *tcpstream;        /* TCP I/O stream */
  74.   IMAPPARSEDREPLY reply;    /* last parsed reply */
  75.   unsigned int use_body : 1;    /* server supports structured bodies */
  76.   unsigned int use_find : 1;    /* server supports FIND command */
  77.   unsigned int use_bboard : 1;    /* server supports BBOARD command */
  78.   unsigned long cachesize;    /* current cache size */
  79.   char **header;        /* cached message headers */
  80.   char **text;            /* cached message RFC822 texts */
  81.   char tmp[IMAPTMPLEN];        /* temporary buffer */
  82. } IMAPLOCAL;
  83.  
  84.  
  85. /* Convenient access to local data */
  86.  
  87. #define LOCAL ((IMAPLOCAL *) stream->local)
  88.  
  89. /* Coddle certain compilers' 6-character symbol limitation */
  90.  
  91. #ifdef __COMPILER_KCC__
  92. #define map_valid ivalid
  93. #define map_find ifind
  94. #define map_find_bboards ifindb
  95. #define map_open iopen
  96. #define map_close iclose
  97. #define map_fetchfast iffast
  98. #define map_fetchflags ifflags
  99. #define map_fetchenvelope ifenv
  100. #define map_fetchheader ifhead
  101. #define map_fetchtext iftext
  102. #define map_fetchbody ifbody
  103. #define map_setflag isflag
  104. #define map_clearflag icflag
  105. #define map_search isearch
  106. #define map_ping iping
  107. #define map_check icheck
  108. #define map_expunge iexpun
  109. #define map_copy icopy
  110. #define map_move imove
  111. #define map_gc igc
  112. #define map_gc_body igcb
  113.  
  114. #define imap_hostfield imhfld
  115. #define imap_mailboxfield immfld
  116. #define imap_host imhost
  117. #define imap_select imsele
  118. #define imap_send imsend
  119. #define imap_reply imrepl
  120. #define imap_parse_reply imprep
  121. #define imap_fake imfake
  122. #define imap_OK imok
  123. #define imap_parse_unsolicited impuns
  124. #define imap_parse_flaglst impflg
  125. #define imap_searched imsear
  126. #define imap_expunged imexpu
  127. #define imap_parse_data impdat
  128. #define imap_parse_prop imppro
  129. #define imap_parse_envelope impenv
  130. #define imap_parse_adrlist impadl
  131. #define imap_parse_address impadr
  132. #define imap_parse_flags impfla
  133. #define imap_parse_sys_flag impsfl
  134. #define imap_parse_user_flag impufl
  135. #define imap_parse_string impstr
  136. #define imap_parse_number impnum
  137. #define imap_parse_enclist impecl
  138. #define imap_parse_encoding impenc
  139. #define imap_parse_body impbod
  140. #define imap_parse_body_structure impbst
  141. #endif
  142.  
  143. /* Function prototypes */
  144.  
  145. DRIVER *map_valid  ();
  146. void map_find  ();
  147. void map_find_bboards  ();
  148. MAILSTREAM *map_open  ();
  149. void map_close  ();
  150. void map_fetchfast  ();
  151. void map_fetchflags  ();
  152. ENVELOPE *map_fetchenvelope  ();
  153. char *map_fetchheader  ();
  154. char *map_fetchtext  ();
  155. char *map_fetchbody  ();
  156. void map_setflag  ();
  157. void map_clearflag  ();
  158. void map_search  ();
  159. long map_ping  ();
  160. void map_check  ();
  161. void map_expunge  ();
  162. long map_copy  ();
  163. long map_move  ();
  164. void map_gc  ();
  165. void map_gc_body  ();
  166.  
  167. char *imap_hostfield  ();
  168. char *imap_mailboxfield  ();
  169. char *imap_host  ();
  170. IMAPPARSEDREPLY *imap_send  ();
  171. IMAPPARSEDREPLY *imap_reply  ();
  172. IMAPPARSEDREPLY *imap_parse_reply  ();
  173. IMAPPARSEDREPLY *imap_fake  ();
  174. long imap_OK  ();
  175. void imap_parse_unsolicited  ();
  176. void imap_parse_flaglst  ();
  177. void imap_searched  ();
  178. void imap_expunged  ();
  179. void imap_parse_data  ();
  180. void imap_parse_prop  ();
  181. void imap_parse_envelope  ();
  182. ADDRESS *imap_parse_adrlist  ();
  183. ADDRESS *imap_parse_address  ();
  184. void imap_parse_flags  ();
  185. void imap_parse_user_flag  ();
  186. char *imap_parse_string  ();
  187. unsigned long imap_parse_number  ();
  188. void imap_parse_body  ();
  189. void imap_parse_body_structure  ();
  190.