Statistics
| Revision:

root / libsylph / nntp.h @ 2347

History | View | Annotate | Download (2.7 kB)

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