masqmail

annotate src/pop3_in.h @ 80:e5090ac234cf

refactoring plus one small bugfix replaced deep nested conditionals with early exits fixed a small bug in the same go (Note: it is bad to fix bugs during refactoring): The SMTP_HELO case did not break in case of error. Now it does.
author meillo@marmaro.de
date Sat, 19 Jun 2010 11:11:28 +0200
parents 08114f7dcc23
children f186650135c3
rev   line source
meillo@0 1 /* pop3_in.h, Copyright 2000 (C) Oliver Kurth,
meillo@0 2 *
meillo@0 3 * This program is free software; you can redistribute it and/or modify
meillo@0 4 * it under the terms of the GNU General Public License as published by
meillo@0 5 * the Free Software Foundation; either version 2 of the License, or
meillo@0 6 * (at your option) any later version.
meillo@10 7 *
meillo@0 8 * This program is distributed in the hope that it will be useful,
meillo@0 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
meillo@0 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
meillo@0 11 * GNU General Public License for more details.
meillo@0 12 *
meillo@0 13 * You should have received a copy of the GNU General Public License
meillo@0 14 * along with this program; if not, write to the Free Software
meillo@0 15 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
meillo@0 16 */
meillo@0 17
meillo@0 18 #ifdef ENABLE_POP3
meillo@0 19
meillo@0 20 #define POP3_BUF_LEN 1024
meillo@0 21
meillo@0 22 #define POP3_INITIAL_TIMEOUT 5*60
meillo@0 23 #define POP3_CMD_TIMEOUT 5*60
meillo@0 24 #define POP3_DATA_TIMEOUT 5*60
meillo@0 25 #define POP3_FINAL_TIMEOUT 10*60
meillo@0 26
meillo@0 27 #define POP3_FLAG_DELETE 0x01
meillo@0 28 #define POP3_FLAG_UIDL 0x02
meillo@0 29 #define POP3_FLAG_UIDL_DELE 0x04
meillo@0 30 #define POP3_FLAG_APOP 0x08
meillo@0 31
meillo@0 32 #define POP3_MAX_CHILDREN 2
meillo@0 33
meillo@10 34 typedef enum _pop3_error {
meillo@10 35 pop3_ok = 0,
meillo@10 36 pop3_fail,
meillo@10 37 pop3_eof,
meillo@10 38 pop3_timeout,
meillo@10 39 pop3_login_failure,
meillo@10 40 pop3_syntax
meillo@0 41 } pop3_error;
meillo@0 42
meillo@10 43 typedef struct pop3_base {
meillo@10 44 FILE *in;
meillo@10 45 FILE *out;
meillo@10 46 gint sock;
meillo@10 47 gint dup_sock;
meillo@0 48
meillo@10 49 gchar *remote_host;
meillo@10 50 gchar *buffer;
meillo@0 51
meillo@10 52 gint next_id;
meillo@10 53 gint msg_cnt;
meillo@10 54 gint uidl_known_cnt;
meillo@10 55 gint mbox_size;
meillo@0 56
meillo@10 57 GList *list_uid_old;
meillo@10 58 GList *drop_list;
meillo@0 59
meillo@10 60 gchar *timestamp;
meillo@0 61
meillo@10 62 guint flags;
meillo@0 63
meillo@10 64 pop3_error error;
meillo@0 65 } pop3_base;
meillo@0 66
meillo@10 67 typedef struct _msg_info {
meillo@10 68 gint number;
meillo@10 69 gint size;
meillo@10 70 gchar *uid;
meillo@10 71 gboolean is_fetched;
meillo@10 72 gboolean is_in_uidl;
meillo@0 73 } msg_info;
meillo@0 74
meillo@10 75 pop3_base *pop3_in_open(gchar * host, gint port, GList * resolve_list, guint flags);
meillo@10 76 pop3_base *pop3_in_open_child(gchar * cmd, guint flags);
meillo@10 77 void pop3_in_close(pop3_base * popb);
meillo@10 78 gboolean pop3_get(pop3_base * popb, gchar * user, gchar * pass, address * rcpt, address * return_path, gint max_count, gint max_size, gboolean max_size_delete);
meillo@10 79 gboolean pop3_login(gchar * host, gint port, GList * resolve_list, gchar * user, gchar * pass, guint flags);
meillo@0 80
meillo@0 81
meillo@0 82
meillo@0 83 #endif