#ifndef __NNTP_H__
#define __NNTP_H__
+#include "socket.h"
+
+typedef struct _NNTPSockInfo NNTPSockInfo;
+
#define NN_SUCCESS 0
#define NN_SOCKET 2
#define NN_AUTHFAIL 3
#define NN_SYNTAX 5
#define NN_IOERR 6
#define NN_ERROR 7
+#define NN_AUTHREQ 8
+#define NN_AUTHCONT 9
#define NNTPBUFSIZE 8192
-gint nntp_open(const gchar *server, gushort port, gchar *buf);
-gint nntp_group(gint sock, const gchar *group,
+struct _NNTPSockInfo
+{
+ SockInfo *sock;
+ gchar *userid;
+ gchar *passwd;
+ gboolean auth_failed;
+};
+
+NNTPSockInfo *nntp_open(const gchar *server, gushort port, gchar *buf);
+NNTPSockInfo *nntp_open_auth(const gchar *server, gushort port, gchar *buf,
+ const gchar *userid, const gchar *passwd);
+void nntp_close(NNTPSockInfo *sock);
+gint nntp_group(NNTPSockInfo *sock, const gchar *group,
gint *num, gint *first, gint *last);
-gint nntp_get_article(gint sock, const gchar *cmd, gint num, gchar **msgid);
-gint nntp_article(gint sock, gint num, gchar **msgid);
-gint nntp_body(gint sock, gint num, gchar **msgid);
-gint nntp_head(gint sock, gint num, gchar **msgid);
-gint nntp_stat(gint sock, gint num, gchar **msgid);
-gint nntp_next(gint sock, gint *num, gchar **msgid);
-gint nntp_xover(gint sock, gint first, gint last);
-gint nntp_post(gint sock, FILE *fp);
-gint nntp_newgroups(gint sock);
-gint nntp_newnews(gint sock);
-gint nntp_mode(gint sock, gboolean stream);
-gint nntp_ok(gint sock, gchar *argbuf);
-gint nntp_list(gint sock);
+gint nntp_get_article(NNTPSockInfo *sock, const gchar *cmd, gint num, gchar **msgid);
+gint nntp_article(NNTPSockInfo *sock, gint num, gchar **msgid);
+gint nntp_body(NNTPSockInfo *sock, gint num, gchar **msgid);
+gint nntp_head(NNTPSockInfo *sock, gint num, gchar **msgid);
+gint nntp_stat(NNTPSockInfo *sock, gint num, gchar **msgid);
+gint nntp_next(NNTPSockInfo *sock, gint *num, gchar **msgid);
+gint nntp_xover(NNTPSockInfo *sock, gint first, gint last);
+gint nntp_post(NNTPSockInfo *sock, FILE *fp);
+gint nntp_newgroups(NNTPSockInfo *sock);
+gint nntp_newnews(NNTPSockInfo *sock);
+gint nntp_mode(NNTPSockInfo *sock, gboolean stream);
+gint nntp_ok(NNTPSockInfo *sock, gchar *argbuf);
+gint nntp_list(NNTPSockInfo *sock);
#endif /* __NNTP_H__ */