Statistics
| Revision:

root / src / smtp.h @ 491

History | View | Annotate | Download (2.2 kB)

1 1 hiro
/*
2 1 hiro
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 166 hiro
 * Copyright (C) 1999-2005 Hiroyuki Yamamoto
4 1 hiro
 *
5 1 hiro
 * This program is free software; you can redistribute it and/or modify
6 1 hiro
 * it under the terms of the GNU General Public License as published by
7 1 hiro
 * the Free Software Foundation; either version 2 of the License, or
8 1 hiro
 * (at your option) any later version.
9 1 hiro
 *
10 1 hiro
 * This program is distributed in the hope that it will be useful,
11 1 hiro
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 1 hiro
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 1 hiro
 * GNU General Public License for more details.
14 1 hiro
 *
15 1 hiro
 * You should have received a copy of the GNU General Public License
16 1 hiro
 * along with this program; if not, write to the Free Software
17 1 hiro
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 1 hiro
 */
19 1 hiro
20 1 hiro
#ifndef __SMTP_H__
21 1 hiro
#define __SMTP_H__
22 1 hiro
23 1 hiro
#ifdef HAVE_CONFIG_H
24 1 hiro
#  include "config.h"
25 1 hiro
#endif
26 1 hiro
27 1 hiro
#include <glib.h>
28 1 hiro
29 1 hiro
#include "session.h"
30 1 hiro
31 1 hiro
typedef struct _SMTPSession        SMTPSession;
32 1 hiro
33 1 hiro
#define SMTP_SESSION(obj)        ((SMTPSession *)obj)
34 1 hiro
35 1 hiro
#define MSGBUFSIZE                8192
36 1 hiro
37 1 hiro
typedef enum
38 1 hiro
{
39 1 hiro
        SM_OK                        = 0,
40 1 hiro
        SM_ERROR                = 128,
41 1 hiro
        SM_UNRECOVERABLE        = 129,
42 1 hiro
        SM_AUTHFAIL                = 130
43 1 hiro
} SMTPErrorValue;
44 1 hiro
45 1 hiro
typedef enum
46 1 hiro
{
47 1 hiro
        ESMTP_8BITMIME        = 1 << 0,
48 1 hiro
        ESMTP_SIZE        = 1 << 1,
49 1 hiro
        ESMTP_ETRN        = 1 << 2
50 1 hiro
} ESMTPFlag;
51 1 hiro
52 1 hiro
typedef enum
53 1 hiro
{
54 1 hiro
        SMTPAUTH_LOGIN      = 1 << 0,
55 1 hiro
        SMTPAUTH_CRAM_MD5   = 1 << 1,
56 166 hiro
        SMTPAUTH_DIGEST_MD5 = 1 << 2,
57 166 hiro
        SMTPAUTH_PLAIN      = 1 << 3
58 1 hiro
} SMTPAuthType;
59 1 hiro
60 1 hiro
typedef enum
61 1 hiro
{
62 1 hiro
        SMTP_READY,
63 1 hiro
        SMTP_CONNECTED,
64 1 hiro
        SMTP_HELO,
65 1 hiro
        SMTP_EHLO,
66 1 hiro
        SMTP_STARTTLS,
67 1 hiro
        SMTP_FROM,
68 1 hiro
        SMTP_AUTH,
69 166 hiro
        SMTP_AUTH_PLAIN,
70 1 hiro
        SMTP_AUTH_LOGIN_USER,
71 1 hiro
        SMTP_AUTH_LOGIN_PASS,
72 1 hiro
        SMTP_AUTH_CRAM_MD5,
73 1 hiro
        SMTP_RCPT,
74 1 hiro
        SMTP_DATA,
75 1 hiro
        SMTP_SEND_DATA,
76 1 hiro
        SMTP_EOM,
77 1 hiro
        SMTP_RSET,
78 1 hiro
        SMTP_QUIT,
79 1 hiro
        SMTP_ERROR,
80 1 hiro
        SMTP_DISCONNECTED,
81 1 hiro
82 1 hiro
        N_SMTP_PHASE
83 1 hiro
} SMTPState;
84 1 hiro
85 1 hiro
struct _SMTPSession
86 1 hiro
{
87 1 hiro
        Session session;
88 1 hiro
89 1 hiro
        SMTPState state;
90 1 hiro
91 1 hiro
#if USE_SSL
92 1 hiro
        gboolean tls_init_done;
93 1 hiro
#endif
94 1 hiro
95 1 hiro
        gchar *hostname;
96 1 hiro
97 1 hiro
        gchar *user;
98 1 hiro
        gchar *pass;
99 1 hiro
100 1 hiro
        gchar *from;
101 1 hiro
        GSList *to_list;
102 1 hiro
        GSList *cur_to;
103 1 hiro
104 1 hiro
        guchar *send_data;
105 1 hiro
        guint send_data_len;
106 1 hiro
107 1 hiro
        SMTPAuthType avail_auth_type;
108 1 hiro
        SMTPAuthType forced_auth_type;
109 1 hiro
        SMTPAuthType auth_type;
110 1 hiro
111 1 hiro
        SMTPErrorValue error_val;
112 1 hiro
        gchar *error_msg;
113 1 hiro
};
114 1 hiro
115 1 hiro
Session *smtp_session_new        (void);
116 1 hiro
117 1 hiro
#endif /* __SMTP_H__ */