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