Commit e6bd6bed e6bd6bed52a1036ae5ca1a5df962e1ce99b5dca7 by Alain Magloire

mailbox.c mailbox.h mbx_imap.c mbx_imap.h mbx_pop.c mbx_pop.h

cleanup.
 Added Files:
 	mbx_mbox.c mbx_mbox.h
cleanup.
1 parent 42040290
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
19 #include <config.h> 19 #include <config.h>
20 #endif 20 #endif
21 21
22 #include <mbx_unix.h> 22 #include <mbx_mbox.h>
23 #include <mbx_pop.h> 23 #include <mbx_pop.h>
24 #include <mbx_imap.h> 24 #include <mbx_imap.h>
25 25
...@@ -70,7 +70,9 @@ static int mbx_get_timeout (mailbox_t, int *timeout); ...@@ -70,7 +70,9 @@ static int mbx_get_timeout (mailbox_t, int *timeout);
70 static int mbx_set_timeout (mailbox_t, int timeout); 70 static int mbx_set_timeout (mailbox_t, int timeout);
71 static int mbx_get_refresh (mailbox_t, int *refresh); 71 static int mbx_get_refresh (mailbox_t, int *refresh);
72 static int mbx_set_refresh (mailbox_t, int refresh); 72 static int mbx_set_refresh (mailbox_t, int refresh);
73 static int mbx_set_notification (mailbox_t, int (*notif) (mailbox_t)); 73 static int mbx_get_size (mailbox_t, int id, size_t *size);
74 static int mbx_set_notification (mailbox_t,
75 int (*func) (mailbox_t, void *arg));
74 76
75 /* init all the functions to a default value */ 77 /* init all the functions to a default value */
76 static void mbx_check_struct (mailbox_t); 78 static void mbx_check_struct (mailbox_t);
...@@ -82,12 +84,12 @@ static void mbx_check_struct (mailbox_t); ...@@ -82,12 +84,12 @@ static void mbx_check_struct (mailbox_t);
82 FIXME: not thread-safe. */ 84 FIXME: not thread-safe. */
83 static struct mailbox_builtin 85 static struct mailbox_builtin
84 { 86 {
85 const struct mailbox_type *mtype; 87 struct mailbox_type *mtype;
86 int is_malloc; 88 int is_malloc;
87 struct mailbox_builtin * next; 89 struct mailbox_builtin * next;
88 } mailbox_builtin [] = { 90 } mailbox_builtin [] = {
89 { NULL, 0, &url_builtin[1] }, /* sentinel, head list */ 91 { NULL, 0, &mailbox_builtin[1] }, /* sentinel, head list */
90 { &_mailbox_unix_type, 0, &mailbox_builtin[2] }, 92 { &_mailbox_mbox_type, 0, &mailbox_builtin[2] },
91 { &_mailbox_pop_type, 0, &mailbox_builtin[3] }, 93 { &_mailbox_pop_type, 0, &mailbox_builtin[3] },
92 { &_mailbox_imap_type, 0, &mailbox_builtin[0] }, 94 { &_mailbox_imap_type, 0, &mailbox_builtin[0] },
93 }; 95 };
...@@ -105,7 +107,7 @@ malibox_add_type (struct mailbox_type *mtype) ...@@ -105,7 +107,7 @@ malibox_add_type (struct mailbox_type *mtype)
105 free (current); 107 free (current);
106 return -1; 108 return -1;
107 } 109 }
108 mtype->id = url_get_id (mtype->utype); /* same ID as the url_tupe */ 110 mtype->id = mtype->utype->id; /* same ID as the url_type */
109 } 111 }
110 else 112 else
111 { 113 {
...@@ -119,7 +121,7 @@ malibox_add_type (struct mailbox_type *mtype) ...@@ -119,7 +121,7 @@ malibox_add_type (struct mailbox_type *mtype)
119 } 121 }
120 122
121 int 123 int
122 mailbox_remove_type (const struct mailbox_type *mtype) 124 mailbox_remove_type (struct mailbox_type *mtype)
123 { 125 {
124 struct mailbox_builtin *current, *previous; 126 struct mailbox_builtin *current, *previous;
125 for (previous = mailbox_builtin, current = mailbox_builtin->next; 127 for (previous = mailbox_builtin, current = mailbox_builtin->next;
...@@ -153,7 +155,7 @@ mailbox_list_type (struct mailbox_type *list, int n) ...@@ -153,7 +155,7 @@ mailbox_list_type (struct mailbox_type *list, int n)
153 } 155 }
154 156
155 int 157 int
156 mailbox_list_mtype (struct url_type **mlist, int *n) 158 mailbox_list_mtype (struct mailbox_type **mlist, int *n)
157 { 159 {
158 struct mailbox_type *mtype; 160 struct mailbox_type *mtype;
159 int i; 161 int i;
...@@ -167,13 +169,13 @@ mailbox_list_mtype (struct url_type **mlist, int *n) ...@@ -167,13 +169,13 @@ mailbox_list_mtype (struct url_type **mlist, int *n)
167 } 169 }
168 170
169 int 171 int
170 mailbox_get_type (struct mailbox_type * const *mtype, int id) 172 mailbox_get_type (struct mailbox_type **mtype, int id)
171 { 173 {
172 struct mailbox_builtin *current; 174 struct mailbox_builtin *current;
173 for (current = mailbox_builtin->next; current != mailbox_builtin; 175 for (current = mailbox_builtin->next; current != mailbox_builtin;
174 current = current->next) 176 current = current->next)
175 { 177 {
176 if (current->mtype->type == type) 178 if (current->mtype->id == id)
177 { 179 {
178 *mtype = current->mtype; 180 *mtype = current->mtype;
179 return 0;; 181 return 0;;
...@@ -218,7 +220,7 @@ mailbox_init (mailbox_t *mbox, const char *name, int id) ...@@ -218,7 +220,7 @@ mailbox_init (mailbox_t *mbox, const char *name, int id)
218 if (status == 0) 220 if (status == 0)
219 mbx_check_struct (*mbox); 221 mbx_check_struct (*mbox);
220 } 222 }
221 url_destroy (url); 223 url_destroy (&url);
222 } 224 }
223 } 225 }
224 226
...@@ -226,7 +228,7 @@ mailbox_init (mailbox_t *mbox, const char *name, int id) ...@@ -226,7 +228,7 @@ mailbox_init (mailbox_t *mbox, const char *name, int id)
226 this should take care of the case where the filename is use */ 228 this should take care of the case where the filename is use */
227 if (status != 0 ) 229 if (status != 0 )
228 { 230 {
229 status = mailbox_unix_init (mbox, name); 231 status = mailbox_mbox_init (mbox, name);
230 if (status == 0) 232 if (status == 0)
231 mbx_check_struct (*mbox); 233 mbx_check_struct (*mbox);
232 } 234 }
...@@ -234,9 +236,10 @@ mailbox_init (mailbox_t *mbox, const char *name, int id) ...@@ -234,9 +236,10 @@ mailbox_init (mailbox_t *mbox, const char *name, int id)
234 } 236 }
235 237
236 void 238 void
237 mailbox_destroy (mailbox_t * mbox) 239 mailbox_destroy (mailbox_t *mbox)
238 { 240 {
239 return mbox->_destroy (mbox); 241 struct mailbox_type *mtype = (*mbox)->mtype;
242 return mtype->_destroy (mbox);
240 } 243 }
241 244
242 /* -------------- stub functions ------------------- */ 245 /* -------------- stub functions ------------------- */
...@@ -244,22 +247,22 @@ static void ...@@ -244,22 +247,22 @@ static void
244 mbx_check_struct (mailbox_t mbox) 247 mbx_check_struct (mailbox_t mbox)
245 { 248 {
246 if (mbox->_open == NULL) 249 if (mbox->_open == NULL)
247 mbox->open = mbx_open; 250 mbox->_open = mbx_open;
248 251
249 if (mbox->_close == NULL) 252 if (mbox->_close == NULL)
250 mbox->close = mbx_close; 253 mbox->_close = mbx_close;
251 254
252 if (mbox->_get_name == NULL) 255 if (mbox->_get_name == NULL)
253 mbox->_get_name = mbx_get_name; 256 mbox->_get_name = mbx_get_name;
254 257
255 if (mbox->_get_passwd == NULL) 258 if (mbox->_get_passwd == NULL)
256 mbox->_get_passw = mbx_get_passwd; 259 mbox->_get_passwd = mbx_get_passwd;
257 260
258 if (mbox->_get_mpasswd == NULL) 261 if (mbox->_get_mpasswd == NULL)
259 mbox->_get_mpasswd = mbx_getmpasswd; 262 mbox->_get_mpasswd = mbx_get_mpasswd;
260 263
261 if (mbox->_set_passwd == NULL) 264 if (mbox->_set_passwd == NULL)
262 mbox->_set_passwd == mbx_set_passwd; 265 mbox->_set_passwd = mbx_set_passwd;
263 266
264 if (mbox->_delete == NULL) 267 if (mbox->_delete == NULL)
265 mbox->_delete = mbx_delete; 268 mbox->_delete = mbx_delete;
...@@ -324,6 +327,9 @@ mbx_check_struct (mailbox_t mbox) ...@@ -324,6 +327,9 @@ mbx_check_struct (mailbox_t mbox)
324 if (mbox->_set_refresh == NULL) 327 if (mbox->_set_refresh == NULL)
325 mbox->_set_refresh = mbx_set_refresh; 328 mbox->_set_refresh = mbx_set_refresh;
326 329
330 if (mbox->_get_size == NULL)
331 mbox->_get_size = mbx_get_size;
332
327 if (mbox->_set_notification == NULL) 333 if (mbox->_set_notification == NULL)
328 mbox->_set_notification = mbx_set_notification; 334 mbox->_set_notification = mbx_set_notification;
329 335
...@@ -365,7 +371,8 @@ mbx_get_mpasswd (mailbox_t mbox, char **passwd, int *len) ...@@ -365,7 +371,8 @@ mbx_get_mpasswd (mailbox_t mbox, char **passwd, int *len)
365 { 371 {
366 int i; 372 int i;
367 char *p; 373 char *p;
368 if ((i = mbox->_get_passwd (NULL, 0)) <= 0 || (p = malloc (i)) == NULL) 374 if ((i = mbox->_get_passwd (mbox, NULL, 0, 0)) <= 0
375 || (p = malloc (i)) == NULL)
369 { 376 {
370 return -1; 377 return -1;
371 } 378 }
...@@ -461,7 +468,8 @@ mbx_get_mbody (mailbox_t mbox, int id, char **body, int *len) ...@@ -461,7 +468,8 @@ mbx_get_mbody (mailbox_t mbox, int id, char **body, int *len)
461 { 468 {
462 int i; 469 int i;
463 char *b; 470 char *b;
464 if ((i = mbox->_get_body (NULL, 0)) <= 0 || (b = malloc (i)) == NULL) 471 if ((i = mbox->_get_body (mbox, id, NULL, 0, 0)) <= 0
472 || (b = malloc (i)) == NULL)
465 { 473 {
466 return -1; 474 return -1;
467 } 475 }
...@@ -481,7 +489,8 @@ mbx_get_mheader (mailbox_t mbox, int id, char **header, int *len) ...@@ -481,7 +489,8 @@ mbx_get_mheader (mailbox_t mbox, int id, char **header, int *len)
481 { 489 {
482 int i; 490 int i;
483 char *h; 491 char *h;
484 if ((i = mbox->_get_header (NULL, 0)) <= 0 || (h = malloc (i)) == NULL) 492 if ((i = mbox->_get_header (mbox, id, NULL, 0, 0)) <= 0
493 || (h = malloc (i)) == NULL)
485 { 494 {
486 return -1; 495 return -1;
487 } 496 }
...@@ -548,6 +557,13 @@ mbx_set_refresh (mailbox_t mbox, int refresh) ...@@ -548,6 +557,13 @@ mbx_set_refresh (mailbox_t mbox, int refresh)
548 } 557 }
549 558
550 static int 559 static int
560 mbx_get_size (mailbox_t mbox, int id, size_t *size)
561 {
562 errno = ENOSYS;
563 return -1;
564 }
565
566 static int
551 mbx_set_notification (mailbox_t mbox, int (*func) (mailbox_t, void *arg)) 567 mbx_set_notification (mailbox_t mbox, int (*func) (mailbox_t, void *arg))
552 { 568 {
553 errno = ENOSYS; 569 errno = ENOSYS;
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
19 # define _MAILBOX_H 19 # define _MAILBOX_H
20 20
21 #include <url.h> 21 #include <url.h>
22 #include <stdlib.h>
22 23
23 #ifdef __cplusplus 24 #ifdef __cplusplus
24 extern "C" { 25 extern "C" {
...@@ -44,8 +45,8 @@ struct mailbox_type ...@@ -44,8 +45,8 @@ struct mailbox_type
44 char *name; 45 char *name;
45 int id; 46 int id;
46 struct url_type *utype; 47 struct url_type *utype;
47 int (*_init) __P ((mailbox_t *, const char *name, int id)); 48 int (*_init) __P ((mailbox_t *, const char *name));
48 int (*_destroy) __P ((mailbox_t *); 49 void (*_destroy) __P ((mailbox_t *));
49 }; 50 };
50 51
51 struct _mailbox 52 struct _mailbox
...@@ -58,27 +59,27 @@ struct _mailbox ...@@ -58,27 +59,27 @@ struct _mailbox
58 int timeout; 59 int timeout;
59 int refresh; 60 int refresh;
60 mailbox_lock_t lock; 61 mailbox_lock_t lock;
61 int (*notif) __P ((mailbox_t)); 62 int (*func) __P ((mailbox_t));
62 63
63 void *data; 64 void *data;
64 struct mailbox_type *mtype; 65 struct mailbox_type *mtype;
65 66
66 /* Functions */ 67 /* Functions */
67 68
68 void (*_destroy) __P ((maibox_t *)); 69 //void (*_destroy) __P ((mailbox_t *));
69 70
70 int (*_open) __P ((mailbox_t, int flag)); 71 int (*_open) __P ((mailbox_t, int flag));
71 int (*_close) __P ((mailbox_t, int flag)); 72 int (*_close) __P ((mailbox_t, int flag));
72 73
73 /* type */ 74 /* type */
74 int (*_get_name) __P ((mailbox_t, int *type, char *desc, 75 int (*_get_name) __P ((mailbox_t, int *id, char *name,
75 int offset, int len)); 76 int offset, int len));
76 int (*_get_mtype) __P ((mailbox_t, int *type, char **desc, 77 int (*_get_mname) __P ((mailbox_t, int *id, char **name,
77 int *len)); 78 int *len));
78 79
79 /* passwd if needed */ 80 /* passwd if needed */
80 int (*_get_passwd) __P ((mailbox_t, char * passwd, int offset, int n)); 81 int (*_get_passwd) __P ((mailbox_t, char * passwd, int offset, int n));
81 int (*_get_mpasswd) __P ((mailbox_t, char ** passwd, int *n)); 82 int (*_get_mpasswd) __P ((mailbox_t, char **passwd, int *n));
82 int (*_set_passwd) __P ((mailbox_t, const char * passwd, 83 int (*_set_passwd) __P ((mailbox_t, const char * passwd,
83 int offset, int n)); 84 int offset, int n));
84 /* deleting mesgs */ 85 /* deleting mesgs */
...@@ -108,15 +109,22 @@ struct _mailbox ...@@ -108,15 +109,22 @@ struct _mailbox
108 int offset, int n)); 109 int offset, int n));
109 int (*_get_mheader) __P ((mailbox_t, int id, char **h, int *n)); 110 int (*_get_mheader) __P ((mailbox_t, int id, char **h, int *n));
110 111
111 /* misc */ 112 /* setting flags */
113 int (*_msg_is_read) __P ((mailbox_t, int id));
114 int (*_msg_set_read) __P ((mailbox_t, int id));
115 int (*_msg_is_seen) __P ((mailbox_t, int id));
116 int (*_msg_set_seen) __P ((mailbox_t, int id));
117
118 /* miscellany */
112 int (*_scan) __P ((mailbox_t, int *msgs)); 119 int (*_scan) __P ((mailbox_t, int *msgs));
113 int (*_is_updated) __P ((mailbox_t)); 120 int (*_is_updated) __P ((mailbox_t));
114 int (*_get_timeout) __P ((mailbox_t, int *timeout)); 121 int (*_get_timeout) __P ((mailbox_t, int *timeout));
115 int (*_set_timeout) __P ((mailbox_t, int timeout)); 122 int (*_set_timeout) __P ((mailbox_t, int timeout));
116 int (*_get_size) __P ((mailbox_t, int id, long *size)); 123 int (*_get_size) __P ((mailbox_t, int id, size_t *size));
117 int (*_get_refresh) __P ((mailbox_t, int *refresh)); 124 int (*_get_refresh) __P ((mailbox_t, int *refresh));
118 int (*_set_refresh) __P ((mailbox_t, int refresh)); 125 int (*_set_refresh) __P ((mailbox_t, int refresh));
119 int (*_set_notification) __P ((mailbox_t, int (*notif) __P ((mailbox_t)))); 126 int (*_set_notification) __P ((mailbox_t,
127 int (*func) __P ((mailbox_t, void * arg))));
120 }; 128 };
121 129
122 /* constructor/destructor and possible types */ 130 /* constructor/destructor and possible types */
...@@ -125,11 +133,10 @@ extern void mailbox_destroy __P ((mailbox_t *)); ...@@ -125,11 +133,10 @@ extern void mailbox_destroy __P ((mailbox_t *));
125 133
126 /* mailbox registration */ 134 /* mailbox registration */
127 extern int mailbox_list_type __P ((struct mailbox_type mtype[], int size)); 135 extern int mailbox_list_type __P ((struct mailbox_type mtype[], int size));
128 extern int mailbox_list_mtype __P ((struct mailbox_type **mtype, int *size)); 136 extern int mailbox_list_mtype __P ((struct mailbox_type *mtype[], int *size));
129 extern int mailbox_add_type __P ((struct mailbox_type *mlist)); 137 extern int mailbox_add_type __P ((struct mailbox_type *mtype));
130 extern int mailbox_remove_type __P ((const struct mailbox_type *mlist)); 138 extern int mailbox_remove_type __P ((struct mailbox_type *mtype));
131 extern int mailbox_get_type __P ((struct mailbox_type * const *mtype, 139 extern int mailbox_get_type __P ((struct mailbox_type **mtype, int id));
132 int id));
133 140
134 #ifndef INLINE 141 #ifndef INLINE
135 # ifdef __GNUC__ 142 # ifdef __GNUC__
...@@ -143,17 +150,17 @@ extern INLINE int mailbox_open __P ((mailbox_t, int flag)); ...@@ -143,17 +150,17 @@ extern INLINE int mailbox_open __P ((mailbox_t, int flag));
143 extern INLINE int mailbox_close __P ((mailbox_t, int flag)); 150 extern INLINE int mailbox_close __P ((mailbox_t, int flag));
144 151
145 /* type */ 152 /* type */
146 extern INLINE int mailbox_get_name __P ((mailbox_t, int *type, char *desc, 153 extern INLINE int mailbox_get_name __P ((mailbox_t, int *id, char *name,
147 int offset, int len)); 154 int offset, int len));
148 extern INLINE int mailbox_get_mname __P ((mailbox_t, int *type, char **desc, 155 extern INLINE int mailbox_get_mname __P ((mailbox_t, int *id, char **name,
149 int *len)); 156 int *len));
150 157
151 /* passwd */ 158 /* passwd */
152 extern INLINE int mailbox_get_passwd __P ((mailbox_t, char * passwd, 159 extern INLINE int mailbox_get_passwd __P ((mailbox_t, char *passwd,
153 int offset, int len)); 160 int offset, int len));
154 extern INLINE int mailbox_get_mpasswd __P ((mailbox_t, char ** passwd, 161 extern INLINE int mailbox_get_mpasswd __P ((mailbox_t, char **passwd,
155 int *len)); 162 int *len));
156 extern INLINE int mailbox_set_passwd __P ((mailbox_t, const char * passwd, 163 extern INLINE int mailbox_set_passwd __P ((mailbox_t, const char *passwd,
157 int offset, int len)); 164 int offset, int len));
158 165
159 /* deleting */ 166 /* deleting */
...@@ -185,15 +192,16 @@ extern INLINE int mailbox_get_mheader __P ((mailbox_t, int id, char **h, ...@@ -185,15 +192,16 @@ extern INLINE int mailbox_get_mheader __P ((mailbox_t, int id, char **h,
185 extern INLINE int mailbox_lock __P ((mailbox_t, int flag)); 192 extern INLINE int mailbox_lock __P ((mailbox_t, int flag));
186 extern INLINE int mailbox_unlock __P ((mailbox_t)); 193 extern INLINE int mailbox_unlock __P ((mailbox_t));
187 194
188 /* misc */ 195 /* miscellany */
189 extern INLINE int mailbox_scan __P ((mailbox_t, int *msgs)); 196 extern INLINE int mailbox_scan __P ((mailbox_t, int *msgs));
190 extern INLINE int mailbox_is_updated __P ((mailbox_t)); 197 extern INLINE int mailbox_is_updated __P ((mailbox_t));
191 extern INLINE int mailbox_get_timeout __P ((mailbox_t, int *timeout)); 198 extern INLINE int mailbox_get_timeout __P ((mailbox_t, int *timeout));
192 extern INLINE int mailbox_set_timeout __P ((mailbox_t, int timeout)); 199 extern INLINE int mailbox_set_timeout __P ((mailbox_t, int timeout));
193 extern INLINE int mailbox_get_refresh __P ((mailbox_t, int *refresh)); 200 extern INLINE int mailbox_get_refresh __P ((mailbox_t, int *refresh));
194 extern INLINE int mailbox_set_refresh __P ((mailbox_t, int refresh)); 201 extern INLINE int mailbox_set_refresh __P ((mailbox_t, int refresh));
202 extern INLINE int mailbox_get_size __P ((mailbox_t, int id, size_t *size));
195 extern INLINE int mailbox_set_notification __P ((mailbox_t, int 203 extern INLINE int mailbox_set_notification __P ((mailbox_t, int
196 (*notif) __P ((mailbox_t)))); 204 (*func) __P ((mailbox_t))));
197 205
198 #ifdef MU_USE_MACROS 206 #ifdef MU_USE_MACROS
199 #define mailbox_open(m, f) m->_open (m, f) 207 #define mailbox_open(m, f) m->_open (m, f)
...@@ -231,14 +239,15 @@ extern INLINE int mailbox_set_notification __P ((mailbox_t, int ...@@ -231,14 +239,15 @@ extern INLINE int mailbox_set_notification __P ((mailbox_t, int
231 #define mailbox_get_body(m, id, b, o, n) m->_get_body (m, id, b, o, n) 239 #define mailbox_get_body(m, id, b, o, n) m->_get_body (m, id, b, o, n)
232 #define mailbox_get_mbody(m, id, b, n) m->_get_body (m, id, b, n) 240 #define mailbox_get_mbody(m, id, b, n) m->_get_body (m, id, b, n)
233 241
234 /* misc */ 242 /* miscellany */
235 #define mailbox_scan(m, t) m->_scan (m, t) 243 #define mailbox_scan(m, t) m->_scan (m, t)
236 #define mailbox_is_updated(m) m->_is_updated (m) 244 #define mailbox_is_updated(m) m->_is_updated (m)
237 #define mailbox_get_timeout(m, t) m->_get_timeout (m, t) 245 #define mailbox_get_timeout(m, t) m->_get_timeout (m, t)
238 #define mailbox_set_timeout(m, t) m->_set_timeout (m, t) 246 #define mailbox_set_timeout(m, t) m->_set_timeout (m, t)
239 #define mailbox_get_refresh(m, r) m->_get_refresh (m, r) 247 #define mailbox_get_refresh(m, r) m->_get_refresh (m, r)
240 #define mailbox_set_refresh(m, r) m->_set_refresh (m, r) 248 #define mailbox_set_refresh(m, r) m->_set_refresh (m, r)
241 #define mailbox_set_notification(m, notif) m->_set_notification (m, notif) 249 #define mailbox_get_size(m, id, size) m->_get_size(m, id, size)
250 #define mailbox_set_notification(m, func) m->_set_notification (m, func)
242 #endif /* MU_USE_MACROS */ 251 #endif /* MU_USE_MACROS */
243 252
244 #ifdef __cplusplus 253 #ifdef __cplusplus
......
...@@ -16,16 +16,17 @@ ...@@ -16,16 +16,17 @@
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #include <mbx_imap.h> 18 #include <mbx_imap.h>
19 #include <url_imap.h>
19 20
20 21
21 struct mailbox_type _mailbox_imap_type = 22 struct mailbox_type _mailbox_imap_type =
22 { 23 {
23 "IMAP", 24 "IMAP4",
24 (int)&_url_imap_type, &_url_imap_type, 25 (int)&_url_imap_type, &_url_imap_type,
25 mailbox_imap_init, mailbox_imap_destroy 26 mailbox_imap_init, mailbox_imap_destroy
26 }; 27 };
27 28
28 int 29 void
29 mailbox_imap_destroy (mailbox_t *mbox) 30 mailbox_imap_destroy (mailbox_t *mbox)
30 { 31 {
31 return; 32 return;
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
21 #include <mailbox.h> 21 #include <mailbox.h>
22 22
23 extern int mailbox_imap_init __P ((mailbox_t *mbox, const char *name)); 23 extern int mailbox_imap_init __P ((mailbox_t *mbox, const char *name));
24 extern int mailbox_imap_destroy __P ((mailbox_t *mbox)); 24 extern void mailbox_imap_destroy __P ((mailbox_t *mbox));
25 25
26 extern struct mailbox_type _mailbox_imap_type; 26 extern struct mailbox_type _mailbox_imap_type;
27 27
......
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program 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
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifdef HAVE_CONFIG_H
19 #include <config.h>
20 #endif
21
22
23 #include <url_mbox.h>
24 #include <mbx_mbox.h>
25 #include <mbx_unix.h>
26 #include <mbx_mdir.h>
27
28 struct mailbox_type _mailbox_mbox_type =
29 {
30 "UNIX MBOX",
31 (int)&_url_mbox_type, &_url_mbox_type,
32 mailbox_mbox_init, mailbox_mbox_destroy
33 };
34
35 /*
36 There is no specific URL for file mailbox, until we
37 come up with a url for each like :
38 maildir://
39 mmdf://
40 ubox://
41 they all share the same url which is
42 file://<path_name> */
43 int
44 mailbox_mbox_init (mailbox_t *mbox, const char *name)
45 {
46 return -1;
47 }
48
49 void
50 mailbox_mbox_destroy (mailbox_t *mbox)
51 {
52 return ;
53 }
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program 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
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _MBX_UNIX_H
19 #define _MBX_UNIX_H 1
20
21 #include <mailbox.h>
22 #include <stdlib.h>
23 #include <stdio.h>
24
25 extern int mailbox_mbox_init __P ((mailbox_t *mbox, const char *name));
26 extern void mailbox_mbox_destroy __P ((mailbox_t *mbox));
27
28 extern struct mailbox_type _mailbox_mbox_type;
29
30 #endif /* _MBX_UNIX_H */
...@@ -15,11 +15,12 @@ ...@@ -15,11 +15,12 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #include <url_pop.h>
18 #include <mbx_pop.h> 19 #include <mbx_pop.h>
19 20
20 struct mailbox_type _mailbox_pop_type = 21 struct mailbox_type _mailbox_pop_type =
21 { 22 {
22 "POP", 23 "POP3",
23 (int)&_url_pop_type, &_url_pop_type, 24 (int)&_url_pop_type, &_url_pop_type,
24 mailbox_pop_init, mailbox_pop_destroy 25 mailbox_pop_init, mailbox_pop_destroy
25 }; 26 };
...@@ -31,7 +32,7 @@ mailbox_pop_destroy (mailbox_t *mbox) ...@@ -31,7 +32,7 @@ mailbox_pop_destroy (mailbox_t *mbox)
31 } 32 }
32 33
33 int 34 int
34 mailbox_pop_init (mailbox_t *mbox) 35 mailbox_pop_init (mailbox_t *mbox, const char *name)
35 { 36 {
36 return -1; 37 return -1;
37 } 38 }
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
21 #include <mailbox.h> 21 #include <mailbox.h>
22 22
23 extern int mailbox_pop_init __P ((mailbox_t *mbox, const char *name)); 23 extern int mailbox_pop_init __P ((mailbox_t *mbox, const char *name));
24 extern int mailbox_pop_destroy __P ((mailbox_t *mbox)); 24 extern void mailbox_pop_destroy __P ((mailbox_t *mbox));
25 25
26 extern struct mailbox_type _mailbox_pop_type; 26 extern struct mailbox_type _mailbox_pop_type;
27 27
......