db05a227380ed18352de9f004a8e0f4d0e7bcc46
[claws.git] / src / nntp.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999,2000 Hiroyuki Yamamoto
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program 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
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef __NNTP_H__
21 #define __NNTP_H__
22
23 #include "socket.h"
24
25 typedef struct _NNTPSockInfo    NNTPSockInfo;
26
27 #define NN_SUCCESS      0
28 #define NN_SOCKET       2
29 #define NN_AUTHFAIL     3
30 #define NN_PROTOCOL     4
31 #define NN_SYNTAX       5
32 #define NN_IOERR        6
33 #define NN_ERROR        7
34 #define NN_AUTHREQ      8
35 #define NN_AUTHCONT     9
36
37 #define NNTPBUFSIZE     8192
38
39 struct _NNTPSockInfo
40 {
41         SockInfo *sock;
42         gchar *userid;
43         gchar *passwd;
44 };
45
46 NNTPSockInfo *nntp_open(const gchar *server, gushort port, gchar *buf);
47 NNTPSockInfo *nntp_open_auth(const gchar *server, gushort port, gchar *buf,
48                              const gchar *userid, const gchar *passwd);
49 void nntp_close(NNTPSockInfo *sock);
50 gint nntp_group(NNTPSockInfo *sock, const gchar *group,
51                 gint *num, gint *first, gint *last);
52 gint nntp_get_article(NNTPSockInfo *sock, const gchar *cmd, gint num, gchar **msgid);
53 gint nntp_article(NNTPSockInfo *sock, gint num, gchar **msgid);
54 gint nntp_body(NNTPSockInfo *sock, gint num, gchar **msgid);
55 gint nntp_head(NNTPSockInfo *sock, gint num, gchar **msgid);
56 gint nntp_stat(NNTPSockInfo *sock, gint num, gchar **msgid);
57 gint nntp_next(NNTPSockInfo *sock, gint *num, gchar **msgid);
58 gint nntp_xover(NNTPSockInfo *sock, gint first, gint last);
59 gint nntp_post(NNTPSockInfo *sock, FILE *fp);
60 gint nntp_newgroups(NNTPSockInfo *sock);
61 gint nntp_newnews(NNTPSockInfo *sock);
62 gint nntp_mode(NNTPSockInfo *sock, gboolean stream);
63 gint nntp_ok(NNTPSockInfo *sock, gchar *argbuf);
64 gint nntp_list(NNTPSockInfo *sock);
65
66 #endif /* __NNTP_H__ */