sync with 0.7.5
[claws.git] / src / nntp.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2001 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 struct _NNTPSockInfo
28 {
29         SockInfo *sock;
30
31         gchar *userid;
32         gchar *passwd;
33         gboolean auth_failed;
34 };
35
36 #define NN_SUCCESS      0
37 #define NN_SOCKET       2
38 #define NN_AUTHFAIL     3
39 #define NN_PROTOCOL     4
40 #define NN_SYNTAX       5
41 #define NN_IOERR        6
42 #define NN_ERROR        7
43 #define NN_AUTHREQ      8
44 #define NN_AUTHCONT     9
45
46 #define NNTPBUFSIZE     8192
47
48 #if USE_SSL
49 NNTPSockInfo *nntp_open         (const gchar    *server,
50                                  gushort         port,
51                                  gchar          *buf,
52                                  gboolean use_ssl);
53 #else
54 NNTPSockInfo *nntp_open         (const gchar    *server,
55                                  gushort         port,
56                                  gchar          *buf);
57 #endif
58
59 #if USE_SSL
60 NNTPSockInfo *nntp_open_auth    (const gchar    *server,
61                                  gushort         port,
62                                  gchar          *buf,
63                                  const gchar    *userid,
64                                  const gchar    *passwd,
65                                  gboolean use_ssl);
66 #else
67 NNTPSockInfo *nntp_open_auth    (const gchar    *server,
68                                  gushort         port,
69                                  gchar          *buf,
70                                  const gchar    *userid,
71                                  const gchar    *passwd);
72 #endif
73 void nntp_close                 (NNTPSockInfo   *sock);
74 gint nntp_group                 (NNTPSockInfo   *sock,
75                                  const gchar    *group,
76                                  gint           *num,
77                                  gint           *first,
78                                  gint           *last);
79 gint nntp_get_article           (NNTPSockInfo   *sock,
80                                  const gchar    *cmd,
81                                  gint            num,
82                                  gchar         **msgid);
83 gint nntp_article               (NNTPSockInfo   *sock,
84                                  gint            num,
85                                  gchar         **msgid);
86 gint nntp_body                  (NNTPSockInfo   *sock,
87                                  gint            num,
88                                  gchar         **msgid);
89 gint nntp_head                  (NNTPSockInfo   *sock,
90                                  gint            num,
91                                  gchar         **msgid);
92 gint nntp_stat                  (NNTPSockInfo   *sock,
93                                  gint            num,
94                                  gchar         **msgid);
95 gint nntp_next                  (NNTPSockInfo   *sock,
96                                  gint           *num,
97                                  gchar         **msgid);
98 gint nntp_xover                 (NNTPSockInfo   *sock,
99                                  gint            first,
100                                  gint            last);
101 gint nntp_xhdr                  (NNTPSockInfo   *sock,
102                                  const gchar    *header,
103                                  gint            first,
104                                  gint            last);
105 gint nntp_list                  (NNTPSockInfo   *sock);
106 gint nntp_post                  (NNTPSockInfo   *sock,
107                                  FILE           *fp);
108 gint nntp_newgroups             (NNTPSockInfo   *sock);
109 gint nntp_newnews               (NNTPSockInfo   *sock);
110 gint nntp_mode                  (NNTPSockInfo   *sock,
111                                  gboolean        stream);
112 gint nntp_ok                    (NNTPSockInfo   *sock,
113                                  gchar          *argbuf);
114
115 #endif /* __NNTP_H__ */