NeoMutt  2021-02-05-666-ge300cd
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 */
char * path
Definition: lib.h:69
uint8_t MuttFormatFlags
Flags for mutt_expando_format(), e.g. MUTT_FORMAT_FORCESUBJ.
Definition: format_flags.h:29
The envelope/body of an email.
Definition: email.h:37
struct MxOps MxNntpOps
NNTP Mailbox - Implements MxOps -.
Definition: nntp.c:2750
int nntp_complete(char *buf, size_t buflen)
Auto-complete NNTP newsgroups.
Definition: complete.c:47
void nntp_clear_cache(struct NntpAccountData *adata)
Clear the NNTP cache.
Definition: newsrc.c:846
struct NntpAccountData * adata
Definition: mdata.h:47
struct NntpMboxData * mutt_newsgroup_uncatchup(struct Mailbox *m, struct NntpAccountData *adata, char *group)
Uncatchup newsgroup.
Definition: newsrc.c:1347
int nntp_check_msgid(struct Mailbox *m, const char *msgid)
Fetch article by Message-ID.
Definition: nntp.c:2141
struct NntpMboxData * mutt_newsgroup_subscribe(struct NntpAccountData *adata, char *group)
Subscribe newsgroup.
Definition: newsrc.c:1256
void nntp_newsrc_close(struct NntpAccountData *adata)
Unlock and close .newsrc file.
Definition: newsrc.c:118
Flags to control mutt_expando_format()
NNTP-specific Account data -.
Definition: adata.h:36
anum_t last
Definition: lib.h:78
int nntp_active_fetch(struct NntpAccountData *adata, bool mark_new)
Fetch list of all newsgroups from server.
Definition: nntp.c:1963
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 -Expando Description %a Account url %p Port %P Port...
Definition: newsrc.c:925
An entry in a .newsrc (subscribed newsgroups)
Definition: lib.h:75
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:2280
Convenience wrapper for the core headers.
char * group
Definition: mdata.h:34
int nntp_check_children(struct Mailbox *m, const char *msgid)
Fetch children of article with the Message-ID.
Definition: nntp.c:2211
struct NntpAccountData * nntp_select_server(struct Mailbox *m, const char *server, bool leave_lock)
Open a connection to an NNTP server.
Definition: newsrc.c:1017
A mailbox.
Definition: mailbox.h:81
int nntp_post(struct Mailbox *m, const char *msg)
Post article.
Definition: nntp.c:1879
int nntp_newsrc_parse(struct NntpAccountData *adata)
Parse .newsrc file.
Definition: newsrc.c:162
struct NntpMboxData * mutt_newsgroup_unsubscribe(struct NntpAccountData *adata, char *group)
Unsubscribe newsgroup.
Definition: newsrc.c:1280
Login details for a remote server.
Definition: connaccount.h:51
NNTP-specific Mailbox data -.
Definition: mdata.h:32
unsigned int index
Definition: lib.h:68
uint8_t flags
e.g. MB_NORMAL
Definition: mailbox.h:134
MailboxType
Supported mailbox formats.
Definition: mailbox.h:43
NNTP article cache.
Definition: lib.h:66
enum MailboxType nntp_path_probe(const char *path, const struct stat *st)
Is this an NNTP Mailbox? - Implements MxOps::path_probe() -.
Definition: nntp.c:2709
struct NntpAccountData * CurrentNewsSrv
Current NNTP news server.
Definition: nntp.c:78
int nntp_newsrc_update(struct NntpAccountData *adata)
Update .newsrc file.
Definition: newsrc.c:439
struct NntpMboxData * mutt_newsgroup_catchup(struct Mailbox *m, struct NntpAccountData *adata, char *group)
Catchup newsgroup.
Definition: newsrc.c:1308
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 -Expando Description %C Current newsgro...
Definition: browse.c:55
#define anum_t
Definition: lib.h:60
void nntp_expand_path(char *buf, size_t buflen, struct ConnAccount *acct)
Make fully qualified url from newsgroup name.
Definition: newsrc.c:559
anum_t first
Definition: lib.h:77
Definition: mxapi.h:103
void nntp_mailbox(struct Mailbox *m, char *buf, size_t buflen)
Get first newsgroup with new messages.
Definition: newsrc.c:1390