Statistics
| Revision:

root / libsylph / nntp.h @ 3051

History | View | Annotate | Download (3.1 kB)

1
/*
2
 * LibSylph -- E-Mail client library
3
 * Copyright (C) 1999-2012 Hiroyuki Yamamoto
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Lesser General Public
7
 * License as published by the Free Software Foundation; either
8
 * version 2.1 of the License, or (at your option) any later version.
9
 *
10
 * This library is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * Lesser General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Lesser General Public
16
 * License along with this library; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 */
19
20
#ifndef __NNTP_H__
21
#define __NNTP_H__
22
23
#include "session.h"
24
#if USE_SSL
25
#  include "ssl.h"
26
#endif
27
#include "socks.h"
28
29
typedef struct _NNTPSession        NNTPSession;
30
31
#define NNTP_SESSION(obj)       ((NNTPSession *)obj)
32
33
struct _NNTPSession
34
{
35
        Session session;
36
37
        gchar *group;
38
39
        gchar *userid;
40
        gchar *passwd;
41
        gboolean auth_failed;
42
};
43
44
#define NN_SUCCESS        0
45
#define NN_SOCKET        2
46
#define NN_AUTHFAIL        3
47
#define NN_PROTOCOL        4
48
#define NN_SYNTAX        5
49
#define NN_IOERR        6
50
#define NN_ERROR        7
51
#define NN_AUTHREQ        8
52
#define NN_AUTHCONT        9
53
54
#define NNTPBUFSIZE        8192
55
56
#if USE_SSL
57
Session *nntp_session_new        (const gchar        *server,
58
                                 gushort         port,
59
                                 gchar                *buf,
60
                                 const gchar        *userid,
61
                                 const gchar        *passwd,
62
                                 SSLType         ssl_type);
63
Session *nntp_session_new_full        (const gchar        *server,
64
                                 gushort         port,
65
                                 SocksInfo        *socks_info,
66
                                 gchar                *buf,
67
                                 const gchar        *userid,
68
                                 const gchar        *passwd,
69
                                 SSLType         ssl_type);
70
#else
71
Session *nntp_session_new        (const gchar        *server,
72
                                 gushort         port,
73
                                 gchar                *buf,
74
                                 const gchar        *userid,
75
                                 const gchar        *passwd);
76
Session *nntp_session_new_full        (const gchar        *server,
77
                                 gushort         port,
78
                                 SocksInfo        *socks_info,
79
                                 gchar                *buf,
80
                                 const gchar        *userid,
81
                                 const gchar        *passwd);
82
#endif
83
84
gint nntp_group                        (NNTPSession        *session,
85
                                 const gchar        *group,
86
                                 gint                *num,
87
                                 gint                *first,
88
                                 gint                *last);
89
gint nntp_get_article                (NNTPSession        *session,
90
                                 const gchar        *cmd,
91
                                 gint                 num,
92
                                 gchar               **msgid);
93
gint nntp_article                (NNTPSession        *session,
94
                                 gint                 num,
95
                                 gchar               **msgid);
96
gint nntp_body                        (NNTPSession        *session,
97
                                 gint                 num,
98
                                 gchar               **msgid);
99
gint nntp_head                        (NNTPSession        *session,
100
                                 gint                 num,
101
                                 gchar               **msgid);
102
gint nntp_stat                        (NNTPSession        *session,
103
                                 gint                 num,
104
                                 gchar               **msgid);
105
gint nntp_next                        (NNTPSession        *session,
106
                                 gint                *num,
107
                                 gchar               **msgid);
108
gint nntp_xover                        (NNTPSession        *session,
109
                                 gint                 first,
110
                                 gint                 last);
111
gint nntp_xhdr                        (NNTPSession        *session,
112
                                 const gchar        *header,
113
                                 gint                 first,
114
                                 gint                 last);
115
gint nntp_list                        (NNTPSession        *session);
116
gint nntp_post                        (NNTPSession        *session,
117
                                 FILE                *fp);
118
gint nntp_newgroups                (NNTPSession        *session);
119
gint nntp_newnews                (NNTPSession        *session);
120
gint nntp_mode                        (NNTPSession        *session,
121
                                 gboolean         stream);
122
123
#endif /* __NNTP_H__ */