NeoMutt  2022-04-29-81-g9c5a59
Teaching an old dog new tricks
DOXYGEN
lib.h
Go to the documentation of this file.
1 
42 #ifndef MUTT_NNTP_LIB_H
43 #define MUTT_NNTP_LIB_H
44 
45 #include <stdbool.h>
46 #include <stdint.h>
47 #include <stdio.h>
48 #include "core/lib.h"
49 #include "format_flags.h"
50 
51 struct ConnAccount;
52 struct Email;
53 struct NntpAccountData;
54 struct stat;
55 
56 extern struct NntpAccountData *CurrentNewsSrv;
57 extern struct MxOps MxNntpOps;
58 
59 /* article number type and format */
60 #define anum_t uint32_t
61 #define ANUM "%u"
62 
66 struct NntpAcache
67 {
68  unsigned int index;
69  char *path;
70 };
71 
76 {
79 };
80 
81 /* number of entries in article cache */
82 #define NNTP_ACACHE_LEN 10
83 
84 struct NntpAccountData *nntp_select_server(struct Mailbox *m, const char *server, bool leave_lock);
87 struct NntpMboxData *mutt_newsgroup_catchup(struct Mailbox *m, struct NntpAccountData *adata, char *group);
88 struct NntpMboxData *mutt_newsgroup_uncatchup(struct Mailbox *m, struct NntpAccountData *adata, char *group);
89 int nntp_active_fetch(struct NntpAccountData *adata, bool mark_new);
91 int nntp_post(struct Mailbox *m, const char *msg);
92 int nntp_check_msgid(struct Mailbox *m, const char *msgid);
93 int nntp_check_children(struct Mailbox *m, const char *msgid);
96 void nntp_mailbox(struct Mailbox *m, char *buf, size_t buflen);
97 void nntp_expand_path(char *buf, size_t buflen, struct ConnAccount *acct);
99 const char *nntp_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, intptr_t data, MuttFormatFlags flags);
100 int nntp_compare_order(const struct Email *a, const struct Email *b, bool reverse);
101 enum MailboxType nntp_path_probe(const char *path, const struct stat *st);
102 const char *group_index_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, intptr_t data, MuttFormatFlags flags);
103 int nntp_complete(char *buf, size_t buflen);
104 
105 #endif /* MUTT_NNTP_LIB_H */
Convenience wrapper for the core headers.
Flags to control mutt_expando_format()
uint8_t MuttFormatFlags
Flags for mutt_expando_format(), e.g. MUTT_FORMAT_FORCESUBJ.
Definition: format_flags.h:29
const char * group_index_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, intptr_t data, MuttFormatFlags flags)
Format a string for the newsgroup menu - Implements format_t -.
Definition: browse.c:55
const char * nntp_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, intptr_t data, MuttFormatFlags flags)
Expand the newsrc filename - Implements format_t -.
Definition: newsrc.c:924
struct MxOps MxNntpOps
NNTP Mailbox - Implements MxOps -.
Definition: nntp.c:2738
enum MailboxType nntp_path_probe(const char *path, const struct stat *st)
Is this an NNTP Mailbox? - Implements MxOps::path_probe() -.
Definition: nntp.c:2698
int nntp_compare_order(const struct Email *a, const struct Email *b, bool reverse)
Sort to mailbox order - Implements sort_mail_t -.
Definition: nntp.c:2268
MailboxType
Supported mailbox formats.
Definition: mailbox.h:41
int nntp_complete(char *buf, size_t buflen)
Auto-complete NNTP newsgroups.
Definition: complete.c:47
int nntp_check_msgid(struct Mailbox *m, const char *msgid)
Fetch article by Message-ID.
Definition: nntp.c:2130
void nntp_clear_cache(struct NntpAccountData *adata)
Clear the NNTP cache.
Definition: newsrc.c:846
struct NntpMboxData * mutt_newsgroup_uncatchup(struct Mailbox *m, struct NntpAccountData *adata, char *group)
Uncatchup newsgroup.
Definition: newsrc.c:1360
int nntp_check_children(struct Mailbox *m, const char *msgid)
Fetch children of article with the Message-ID.
Definition: nntp.c:2200
int nntp_active_fetch(struct NntpAccountData *adata, bool mark_new)
Fetch list of all newsgroups from server.
Definition: nntp.c:1954
int nntp_post(struct Mailbox *m, const char *msg)
Post article.
Definition: nntp.c:1871
int nntp_newsrc_parse(struct NntpAccountData *adata)
Parse .newsrc file.
Definition: newsrc.c:162
void nntp_mailbox(struct Mailbox *m, char *buf, size_t buflen)
Get first newsgroup with new messages.
Definition: newsrc.c:1403
struct NntpMboxData * mutt_newsgroup_catchup(struct Mailbox *m, struct NntpAccountData *adata, char *group)
Catchup newsgroup.
Definition: newsrc.c:1321
void nntp_newsrc_close(struct NntpAccountData *adata)
Unlock and close .newsrc file.
Definition: newsrc.c:118
int nntp_newsrc_update(struct NntpAccountData *adata)
Update .newsrc file.
Definition: newsrc.c:442
struct NntpMboxData * mutt_newsgroup_subscribe(struct NntpAccountData *adata, char *group)
Subscribe newsgroup.
Definition: newsrc.c:1270
void nntp_expand_path(char *buf, size_t buflen, struct ConnAccount *acct)
Make fully qualified url from newsgroup name.
Definition: newsrc.c:561
struct NntpAccountData * nntp_select_server(struct Mailbox *m, const char *server, bool leave_lock)
Open a connection to an NNTP server.
Definition: newsrc.c:1018
struct NntpAccountData * CurrentNewsSrv
Current NNTP news server.
Definition: nntp.c:77
struct NntpMboxData * mutt_newsgroup_unsubscribe(struct NntpAccountData *adata, char *group)
Unsubscribe newsgroup.
Definition: newsrc.c:1294
#define anum_t
Definition: lib.h:60
Login details for a remote server.
Definition: connaccount.h:53
The envelope/body of an email.
Definition: email.h:37
A mailbox.
Definition: mailbox.h:79
Definition: mxapi.h:112
An entry in a .newsrc (subscribed newsgroups)
Definition: lib.h:76
anum_t last
Last article number in run.
Definition: lib.h:78
anum_t first
First article number in run.
Definition: lib.h:77
NNTP article cache.
Definition: lib.h:67
char * path
Cache path.
Definition: lib.h:69
unsigned int index
Index number.
Definition: lib.h:68
NNTP-specific Account data -.
Definition: adata.h:37
NNTP-specific Mailbox data -.
Definition: mdata.h:33
char * group
Name of newsgroup.
Definition: mdata.h:34
struct NntpAccountData * adata
Definition: mdata.h:47