tail is always a list_item**.
[apps/madmutt.git] / nntp.h
1 /*
2  * Copyright notice from original mutt:
3  * Copyright (C) 1998 Brandon Long <blong@fiction.net>
4  * Copyright (C) 1999 Andrej Gritsenko <andrej@lucky.net>
5  * Copyright (C) 2000-2002 Vsevolod Volkov <vvv@mutt.org.ua>
6  *
7  * This file is part of mutt-ng, see http://www.muttng.org/.
8  * It's licensed under the GNU General Public License,
9  * please see the file GPL in the top level source directory.
10  */
11
12 #ifndef _NNTP_H_
13 #define _NNTP_H_ 1
14
15 #include <lib-sys/mutt_socket.h>
16 #include <lib-mx/mx.h>
17
18 extern mx_t const nntp_mx;
19
20 /* number of entries in the hash table */
21 #define NNTP_CACHE_LEN 10
22
23 enum {
24   NNTP_NONE = 0,
25   NNTP_OK,
26   NNTP_BYE
27 };
28
29 typedef struct {
30   unsigned feat_known   : 1;
31   unsigned hasXPAT      : 1;
32   unsigned hasXGTITLE   : 1;
33   unsigned hasXOVER     : 1;
34   unsigned hasLISTGROUP : 1;
35   unsigned status       : 3;
36   char *newsrc;
37   char *cache;
38   int stat;
39   off_t size;
40   time_t mtime;
41   time_t newgroups_time;
42   time_t check_time;
43   hash_t *newsgroups;
44   string_list_t *list;                   /* list of newsgroups */
45   string_list_t **tail;                  /* last entry of list */
46   CONNECTION *conn;
47 } NNTP_SERVER;
48
49 typedef struct {
50   int   index;
51   char *path;
52 } NNTP_CACHE;
53
54 typedef struct {
55   int first;
56   int last;
57 } NEWSRC_ENTRY;
58
59 typedef struct {
60   NEWSRC_ENTRY *entries;
61   int num;             /* number of used entries */
62   int max;             /* number of allocated entries */
63   int unread;
64   int firstMessage;
65   int lastMessage;
66   int lastLoaded;
67   int lastCached;
68   unsigned subscribed:1;
69   unsigned rc:1;
70   unsigned new:1;
71   unsigned allowed:1;
72   unsigned deleted:1;
73   char *group;
74   char *desc;
75   char *cache;
76   NNTP_SERVER *nserv;
77   NNTP_CACHE acache[NNTP_CACHE_LEN];
78 } NNTP_DATA;
79
80 /* internal functions */
81 int nntp_get_active (NNTP_SERVER *);
82
83 /* exposed interface */
84 NNTP_SERVER *mutt_select_newsserver (char *);
85 NNTP_DATA *mutt_newsgroup_subscribe (NNTP_SERVER *, char *);
86 NNTP_DATA *mutt_newsgroup_unsubscribe (NNTP_SERVER *, char *);
87 NNTP_DATA *mutt_newsgroup_catchup (NNTP_SERVER *, char *);
88 NNTP_DATA *mutt_newsgroup_uncatchup (NNTP_SERVER *, char *);
89 void nntp_clear_cacheindex (NNTP_SERVER *);
90 int mutt_newsrc_update (NNTP_SERVER *);
91 int nntp_close_mailbox (CONTEXT *);
92 int nntp_fetch_message (MESSAGE *, CONTEXT *, int);
93 int nntp_post (const char *);
94 int nntp_check_msgid (CONTEXT *, const char *);
95 int nntp_check_children (CONTEXT *, const char *);
96 void nntp_buffy (char* dst, ssize_t dstlen);
97 void nntp_expand_path (char *, ssize_t, ACCOUNT *);
98 void nntp_logout_all(void);
99 const char *nntp_format_str(char *, ssize_t, char, const char *, const char *,
100                             const char *, const char *, anytype, format_flag);
101 void nntp_sync_sidebar (NNTP_DATA*);
102
103 WHERE NNTP_SERVER *CurrentNewsSrv INITVAL (NULL);
104
105 #endif /* _NNTP_H_ */