Public fucntions for pop3.
Showing
1 changed file
with
113 additions
and
0 deletions
include/mailutils/pop3.h
0 → 100644
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | ||
2 | Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc. | ||
3 | |||
4 | This library is free software; you can redistribute it and/or | ||
5 | modify it under the terms of the GNU Lesser General Public | ||
6 | License as published by the Free Software Foundation; either | ||
7 | version 2 of the License, or (at your option) any later version. | ||
8 | |||
9 | This library is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | Lesser General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Lesser General Public | ||
15 | License along with this library; if not, write to the Free Software | ||
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ | ||
17 | |||
18 | #ifndef _MAILUTILS_POP3_H | ||
19 | #define _MAILUTILS_POP3_H | ||
20 | |||
21 | #include <mailutils/list.h> | ||
22 | #include <mailutils/stream.h> | ||
23 | |||
24 | #ifdef __cplusplus | ||
25 | extern "C" { | ||
26 | #endif | ||
27 | |||
28 | struct _mu_pop3; | ||
29 | typedef struct _mu_pop3* mu_pop3_t; | ||
30 | |||
31 | extern int mu_pop3_create (mu_pop3_t *pop3); | ||
32 | extern void mu_pop3_destroy (mu_pop3_t *pop3); | ||
33 | |||
34 | extern int mu_pop3_set_carrier (mu_pop3_t pop3, stream_t carrier); | ||
35 | extern int mu_pop3_get_carrier (mu_pop3_t pop3, stream_t *pcarrier); | ||
36 | |||
37 | extern int mu_pop3_connect (mu_pop3_t pop3); | ||
38 | extern int mu_pop3_disconnect (mu_pop3_t pop3); | ||
39 | |||
40 | extern int mu_pop3_set_timeout (mu_pop3_t pop3, int timeout); | ||
41 | extern int mu_pop3_get_timeout (mu_pop3_t pop3, int *timeout); | ||
42 | |||
43 | extern int mu_pop3_set_debug (mu_pop3_t pop3, void (*print) __P((const char *buffer))); | ||
44 | |||
45 | extern int mu_pop3_apop (mu_pop3_t pop3, const char *name, const char *digest); | ||
46 | |||
47 | /* It is the responsability of the caller to call list_destroy() when done | ||
48 | with the list. The item in the list is of type "const char *", | ||
49 | no processing is done on the item except the removal of the trailing newline. */ | ||
50 | extern int mu_pop3_capa (mu_pop3_t pop3, list_t *plist); | ||
51 | |||
52 | extern int mu_pop3_dele (mu_pop3_t pop3, unsigned int mesgno); | ||
53 | |||
54 | extern int mu_pop3_list (mu_pop3_t pop3, unsigned int mesgno, size_t *mesg_octet); | ||
55 | |||
56 | /* A list is return with the multi-line answer. It is the responsability of | ||
57 | the caller to call list_destroy() to dipose of the list. */ | ||
58 | extern int mu_pop3_list_all (mu_pop3_t pop3, list_t *plist); | ||
59 | |||
60 | extern int mu_pop3_noop (mu_pop3_t pop3); | ||
61 | |||
62 | extern int mu_pop3_pass (mu_pop3_t pop3, const char *pass); | ||
63 | |||
64 | extern int mu_pop3_quit (mu_pop3_t pop3); | ||
65 | |||
66 | /* A stream is return with the multi-line answer. It is the responsability of | ||
67 | the caller to call stream_destroy() to dipose of the stream. */ | ||
68 | extern int mu_pop3_retr (mu_pop3_t pop3, unsigned int mesgno, stream_t *pstream); | ||
69 | |||
70 | extern int mu_pop3_rset (mu_pop3_t pop3); | ||
71 | |||
72 | extern int mu_pop3_stat (mu_pop3_t pop3, unsigned int *count, size_t *octets); | ||
73 | |||
74 | /* A stream is return with the multi-line answer. It is the responsability of | ||
75 | the caller to call stream_destroy() to dipose of the stream. */ | ||
76 | extern int mu_pop3_top (mu_pop3_t pop3, unsigned int mesgno, unsigned int lines, stream_t *pstream); | ||
77 | |||
78 | /* The uidl is malloc and return in puidl, it is the responsability of caller | ||
79 | to free() the uild when done. */ | ||
80 | extern int mu_pop3_uidl (mu_pop3_t pop3, unsigned int mesgno, char **puidl); | ||
81 | /* A list is return with the multi-line answer. It is the responsability of | ||
82 | the caller to call list_destroy() to dipose of the list. */ | ||
83 | extern int mu_pop3_uidl_all (mu_pop3_t pop3, list_t *plist); | ||
84 | |||
85 | extern int mu_pop3_user (mu_pop3_t pop3, const char *user); | ||
86 | |||
87 | |||
88 | /* Reads the multi-line response of the server, nread will be 0 when the termination octets | ||
89 | are detected. Clients should not use this function unless they are sending direct command. */ | ||
90 | extern int mu_pop3_readline (mu_pop3_t pop3, char *buffer, size_t buflen, size_t *nread); | ||
91 | |||
92 | /* Returns the last command acknowledge. If the server supports RESP-CODE, the message | ||
93 | could be retrieve, but it is up the caller to do the parsing. */ | ||
94 | extern int mu_pop3_response (mu_pop3_t pop3, char *buffer, size_t buflen, size_t *nread); | ||
95 | |||
96 | /* pop3_writeline copies the line in the internal buffer, a mu_pop3_send() is | ||
97 | needed to do the actual transmission. */ | ||
98 | extern int mu_pop3_writeline (mu_pop3_t pop3, const char *format, ...); | ||
99 | |||
100 | /* mu_pop3_sendline() is equivalent to: | ||
101 | mu_pop3_writeline (pop3, line); | ||
102 | mu_pop3_send (pop3); | ||
103 | */ | ||
104 | extern int mu_pop3_sendline (mu_pop3_t pop3, const char *line); | ||
105 | |||
106 | /* Transmit via the carrier the internal buffer data. */ | ||
107 | extern int mu_pop3_send (mu_pop3_t pop3); | ||
108 | |||
109 | #ifdef __cplusplus | ||
110 | } | ||
111 | #endif | ||
112 | |||
113 | #endif /* _MAILUTILS_POP3_H */ |
-
Please register or sign in to post a comment