NeoMutt  2021-02-05-89-gabe350
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 <sys/types.h>
49 #include <time.h>
50 #include "core/lib.h"
51 #include "format_flags.h"
52 #include "mx.h"
53 
54 struct ConfigSet;
55 struct ConnAccount;
56 struct stat;
57 
58 // These Config Variables are used outside of libnntp
59 extern unsigned char C_CatchupNewsgroup;
60 extern unsigned char C_FollowupToPoster;
61 extern char * C_GroupIndexFormat;
62 extern char * C_NewsServer;
63 extern char * C_NewsgroupsCharset;
64 extern unsigned char C_PostModerated;
65 extern bool C_ShowOnlyUnread;
66 extern bool C_XCommentTo;
67 
68 extern struct NntpAccountData *CurrentNewsSrv;
69 extern struct MxOps MxNntpOps;
70 
71 /* article number type and format */
72 #define anum_t uint32_t
73 #define ANUM "%u"
74 
78 struct NntpAcache
79 {
80  unsigned int index;
81  char *path;
82 };
83 
88 {
91 };
92 
93 /* number of entries in article cache */
94 #define NNTP_ACACHE_LEN 10
95 
96 struct NntpAccountData *nntp_select_server(struct Mailbox *m, const char *server, bool leave_lock);
99 struct NntpMboxData *mutt_newsgroup_catchup(struct Mailbox *m, struct NntpAccountData *adata, char *group);
100 struct NntpMboxData *mutt_newsgroup_uncatchup(struct Mailbox *m, struct NntpAccountData *adata, char *group);
101 int nntp_active_fetch(struct NntpAccountData *adata, bool mark_new);
103 int nntp_post(struct Mailbox *m, const char *msg);
104 int nntp_check_msgid(struct Mailbox *m, const char *msgid);
105 int nntp_check_children(struct Mailbox *m, const char *msgid);
108 void nntp_mailbox(struct Mailbox *m, char *buf, size_t buflen);
109 void nntp_expand_path(char *buf, size_t buflen, struct ConnAccount *acct);
111 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);
112 int nntp_compare_order(const void *a, const void *b);
113 enum MailboxType nntp_path_probe(const char *path, const struct stat *st);
114 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);
115 int nntp_complete(char *buf, size_t buflen);
116 
117 #endif /* MUTT_NNTP_LIB_H */
NntpMboxData::group
char * group
Definition: mdata.h:33
ConnAccount
Login details for a remote server.
Definition: connaccount.h:51
nntp_check_msgid
int nntp_check_msgid(struct Mailbox *m, const char *msgid)
Fetch article by Message-ID.
Definition: nntp.c:2118
Mailbox
A mailbox.
Definition: mailbox.h:81
MxNntpOps
struct MxOps MxNntpOps
NNTP Mailbox - Implements MxOps.
Definition: nntp.c:2726
C_FollowupToPoster
unsigned char C_FollowupToPoster
Config: (nntp) Reply to the poster if 'poster' is in the 'Followup-To' header.
Definition: config.c:38
nntp_expand_path
void nntp_expand_path(char *buf, size_t buflen, struct ConnAccount *acct)
Make fully qualified url from newsgroup name.
Definition: newsrc.c:560
format_flags.h
C_PostModerated
unsigned char C_PostModerated
Config: (nntp) Allow posting to moderated newsgroups.
Definition: config.c:51
MxOps
The Mailbox API.
Definition: mx.h:116
nntp_mailbox
void nntp_mailbox(struct Mailbox *m, char *buf, size_t buflen)
Get first newsgroup with new messages.
Definition: newsrc.c:1379
nntp_active_fetch
int nntp_active_fetch(struct NntpAccountData *adata, bool mark_new)
Fetch list of all newsgroups from server.
Definition: nntp.c:1948
nntp_compare_order
int nntp_compare_order(const void *a, const void *b)
Sort to mailbox order - Implements sort_t.
Definition: nntp.c:2257
Mailbox::flags
uint8_t flags
e.g. MB_NORMAL
Definition: mailbox.h:134
mutt_newsgroup_subscribe
struct NntpMboxData * mutt_newsgroup_subscribe(struct NntpAccountData *adata, char *group)
Subscribe newsgroup.
Definition: newsrc.c:1247
mutt_newsgroup_uncatchup
struct NntpMboxData * mutt_newsgroup_uncatchup(struct Mailbox *m, struct NntpAccountData *adata, char *group)
Uncatchup newsgroup.
Definition: newsrc.c:1336
C_GroupIndexFormat
char * C_GroupIndexFormat
Config: (nntp) printf-like format string for the browser's display of newsgroups.
Definition: config.c:39
NntpMboxData::adata
struct NntpAccountData * adata
Definition: mdata.h:46
NewsrcEntry::last
anum_t last
Definition: lib.h:90
nntp_check_children
int nntp_check_children(struct Mailbox *m, const char *msgid)
Fetch children of article with the Message-ID.
Definition: nntp.c:2188
C_XCommentTo
bool C_XCommentTo
Config: (nntp) Add 'X-Comment-To' header that contains article author.
Definition: config.c:55
nntp_path_probe
enum MailboxType nntp_path_probe(const char *path, const struct stat *st)
Is this an NNTP Mailbox? - Implements MxOps::path_probe()
Definition: nntp.c:2685
nntp_newsrc_parse
int nntp_newsrc_parse(struct NntpAccountData *adata)
Parse .newsrc file.
Definition: newsrc.c:164
lib.h
nntp_newsrc_close
void nntp_newsrc_close(struct NntpAccountData *adata)
Unlock and close .newsrc file.
Definition: newsrc.c:120
anum_t
#define anum_t
Definition: lib.h:72
mutt_newsgroup_unsubscribe
struct NntpMboxData * mutt_newsgroup_unsubscribe(struct NntpAccountData *adata, char *group)
Unsubscribe newsgroup.
Definition: newsrc.c:1271
NewsrcEntry
An entry in a .newsrc (subscribed newsgroups)
Definition: lib.h:87
nntp_select_server
struct NntpAccountData * nntp_select_server(struct Mailbox *m, const char *server, bool leave_lock)
Open a connection to an NNTP server.
Definition: newsrc.c:1012
CurrentNewsSrv
struct NntpAccountData * CurrentNewsSrv
Current NNTP news server.
Definition: nntp.c:79
nntp_newsrc_update
int nntp_newsrc_update(struct NntpAccountData *adata)
Update .newsrc file.
Definition: newsrc.c:442
C_NewsgroupsCharset
char * C_NewsgroupsCharset
Config: (nntp) Character set of newsgroups' descriptions.
Definition: config.c:42
NewsrcEntry::first
anum_t first
Definition: lib.h:89
NntpAccountData
NNTP-specific Account data -.
Definition: adata.h:33
nntp_post
int nntp_post(struct Mailbox *m, const char *msg)
Post article.
Definition: nntp.c:1866
ConfigSet
Container for lots of config items.
Definition: set.h:228
C_CatchupNewsgroup
unsigned char C_CatchupNewsgroup
Config: (nntp) Mark all articles as read when leaving a newsgroup.
Definition: config.c:37
MailboxType
MailboxType
Supported mailbox formats.
Definition: mailbox.h:43
group_index_format_str
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:54
mx.h
NntpAcache::index
unsigned int index
Definition: lib.h:80
C_ShowOnlyUnread
bool C_ShowOnlyUnread
Config: (nntp) Only show subscribed newsgroups with unread articles.
Definition: config.c:54
NntpAcache
NNTP article cache.
Definition: lib.h:78
nntp_format_str
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:920
mutt_newsgroup_catchup
struct NntpMboxData * mutt_newsgroup_catchup(struct Mailbox *m, struct NntpAccountData *adata, char *group)
Catchup newsgroup.
Definition: newsrc.c:1297
nntp_complete
int nntp_complete(char *buf, size_t buflen)
Auto-complete NNTP newsgroups.
Definition: complete.c:47
NntpMboxData
NNTP-specific Mailbox data -.
Definition: mdata.h:31
MuttFormatFlags
uint8_t MuttFormatFlags
Flags for mutt_expando_format(), e.g. MUTT_FORMAT_FORCESUBJ.
Definition: format_flags.h:29
C_NewsServer
char * C_NewsServer
Config: (nntp) Url of the news server.
Definition: config.c:41
nntp_clear_cache
void nntp_clear_cache(struct NntpAccountData *adata)
Clear the NNTP cache.
Definition: newsrc.c:843
NntpAcache::path
char * path
Definition: lib.h:81