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