NeoMutt  2021-02-05
Teaching an old dog new tricks
DOXYGEN
config.c
Go to the documentation of this file.
1 
29 #include "config.h"
30 #include <stddef.h>
31 #include <config/lib.h>
32 #include <stdbool.h>
33 #include "private.h"
34 #include "init.h"
35 
36 // clang-format off
37 unsigned char C_CatchupNewsgroup;
38 unsigned char C_FollowupToPoster;
41 char * C_NewsServer;
43 char * C_Newsrc;
48 char * C_NntpPass;
49 short C_NntpPoll;
50 char * C_NntpUser;
51 unsigned char C_PostModerated;
56 // clang-format on
57 
58 struct ConfigDef NntpVars[] = {
59  // clang-format off
60  { "catchup_newsgroup", DT_QUAD, &C_CatchupNewsgroup, MUTT_ASKYES, 0, NULL,
61  "(nntp) Mark all articles as read when leaving a newsgroup"
62  },
63  { "followup_to_poster", DT_QUAD, &C_FollowupToPoster, MUTT_ASKYES, 0, NULL,
64  "(nntp) Reply to the poster if 'poster' is in the 'Followup-To' header"
65  },
66  { "group_index_format", DT_STRING|DT_NOT_EMPTY|R_INDEX|R_PAGER, &C_GroupIndexFormat, IP "%4C %M%N %5s %-45.45f %d", 0, NULL,
67  "(nntp) printf-like format string for the browser's display of newsgroups"
68  },
69  { "newsgroups_charset", DT_STRING, &C_NewsgroupsCharset, IP "utf-8", 0, charset_validator,
70  "(nntp) Character set of newsgroups' descriptions"
71  },
72  { "newsrc", DT_PATH|DT_PATH_FILE, &C_Newsrc, IP "~/.newsrc", 0, NULL,
73  "(nntp) File containing list of subscribed newsgroups"
74  },
75  { "news_cache_dir", DT_PATH|DT_PATH_DIR, &C_NewsCacheDir, IP "~/.neomutt", 0, NULL,
76  "(nntp) Directory for cached news articles"
77  },
78  { "news_server", DT_STRING, &C_NewsServer, 0, 0, NULL,
79  "(nntp) Url of the news server"
80  },
81  { "nntp_authenticators", DT_STRING, &C_NntpAuthenticators, 0, 0, NULL,
82  "(nntp) Allowed authentication methods"
83  },
84  { "nntp_context", DT_NUMBER|DT_NOT_NEGATIVE, &C_NntpContext, 1000, 0, NULL,
85  "(nntp) Maximum number of articles to list (0 for all articles)"
86  },
87  { "nntp_listgroup", DT_BOOL, &C_NntpListgroup, true, 0, NULL,
88  "(nntp) Check all articles when opening a newsgroup"
89  },
90  { "nntp_load_description", DT_BOOL, &C_NntpLoadDescription, true, 0, NULL,
91  "(nntp) Load descriptions for newsgroups when adding to the list"
92  },
93  { "nntp_pass", DT_STRING|DT_SENSITIVE, &C_NntpPass, 0, 0, NULL,
94  "(nntp) Password for the news server"
95  },
96  { "nntp_poll", DT_NUMBER|DT_NOT_NEGATIVE, &C_NntpPoll, 60, 0, NULL,
97  "(nntp) Interval between checks for new posts"
98  },
99  { "nntp_user", DT_STRING|DT_SENSITIVE, &C_NntpUser, 0, 0, NULL,
100  "(nntp) Username for the news server"
101  },
102  { "post_moderated", DT_QUAD, &C_PostModerated, MUTT_ASKYES, 0, NULL,
103  "(nntp) Allow posting to moderated newsgroups"
104  },
105  { "save_unsubscribed", DT_BOOL, &C_SaveUnsubscribed, false, 0, NULL,
106  "(nntp) Save a list of unsubscribed newsgroups to the 'newsrc'"
107  },
108  { "show_new_news", DT_BOOL, &C_ShowNewNews, true, 0, NULL,
109  "(nntp) Check for new newsgroups when entering the browser"
110  },
111  { "show_only_unread", DT_BOOL, &C_ShowOnlyUnread, false, 0, NULL,
112  "(nntp) Only show subscribed newsgroups with unread articles"
113  },
114  { "x_comment_to", DT_BOOL, &C_XCommentTo, false, 0, NULL,
115  "(nntp) Add 'X-Comment-To' header that contains article author"
116  },
117  { NULL, 0, NULL, 0, 0, NULL, NULL },
118  // clang-format on
119 };
120 
124 bool config_init_nntp(struct ConfigSet *cs)
125 {
126  return cs_register_variables(cs, NntpVars, 0);
127 }
#define R_PAGER
Redraw the pager menu.
Definition: types.h:66
Container for lots of config items.
Definition: set.h:228
#define IP
Definition: set.h:54
int charset_validator(const struct ConfigSet *cs, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Validate the "charset" config variable - Implements ConfigDef::validator()
Definition: charset.c:39
#define DT_NOT_EMPTY
Empty strings are not allowed.
Definition: types.h:46
bool C_SaveUnsubscribed
Config: (nntp) Save a list of unsubscribed newsgroups to the &#39;newsrc&#39;.
Definition: config.c:52
Config/command parsing.
char * C_GroupIndexFormat
Config: (nntp) printf-like format string for the browser&#39;s display of newsgroups. ...
Definition: config.c:39
char * C_NntpUser
Config: (nntp) Username for the news server.
Definition: config.c:50
char * C_NntpAuthenticators
Config: (nntp) Allowed authentication methods.
Definition: config.c:44
short C_NntpContext
Config: (nntp) Maximum number of articles to list (0 for all articles)
Definition: config.c:45
char * C_Newsrc
Config: (nntp) File containing list of subscribed newsgroups.
Definition: config.c:43
char * C_NntpPass
Config: (nntp) Password for the news server.
Definition: config.c:48
#define DT_NOT_NEGATIVE
Negative numbers are not allowed.
Definition: types.h:47
char * C_NewsServer
Config: (nntp) Url of the news server.
Definition: config.c:41
Config item definition.
Definition: set.h:61
bool config_init_nntp(struct ConfigSet *cs)
Register nntp config variables - Implements module_init_config_t.
Definition: config.c:124
#define DT_QUAD
quad-option (no/yes/ask-no/ask-yes)
Definition: types.h:37
#define DT_SENSITIVE
Contains sensitive value, e.g. password.
Definition: types.h:49
Convenience wrapper for the config headers.
#define DT_PATH_DIR
Path is a directory.
Definition: types.h:53
bool C_ShowOnlyUnread
Config: (nntp) Only show subscribed newsgroups with unread articles.
Definition: config.c:54
bool cs_register_variables(const struct ConfigSet *cs, struct ConfigDef vars[], uint32_t flags)
Register a set of config items.
Definition: set.c:286
unsigned char C_CatchupNewsgroup
Config: (nntp) Mark all articles as read when leaving a newsgroup.
Definition: config.c:37
#define DT_PATH_FILE
Path is a file.
Definition: types.h:54
#define DT_STRING
a string
Definition: types.h:41
bool C_ShowNewNews
Config: (nntp) Check for new newsgroups when entering the browser.
Definition: config.c:53
#define DT_PATH
a path to a file/directory
Definition: types.h:36
short C_NntpPoll
Config: (nntp) Interval between checks for new posts.
Definition: config.c:49
char * C_NewsCacheDir
Config: (nntp) Directory for cached news articles.
Definition: config.c:40
Ask the user, defaulting to &#39;Yes&#39;.
Definition: quad.h:42
char * C_NewsgroupsCharset
Config: (nntp) Character set of newsgroups&#39; descriptions.
Definition: config.c:42
bool C_XCommentTo
Config: (nntp) Add &#39;X-Comment-To&#39; header that contains article author.
Definition: config.c:55
Usenet network mailbox type; talk to an NNTP server.
bool C_NntpListgroup
Config: (nntp) Check all articles when opening a newsgroup.
Definition: config.c:46
bool C_NntpLoadDescription
Config: (nntp) Load descriptions for newsgroups when adding to the list.
Definition: config.c:47
#define DT_NUMBER
a number
Definition: types.h:35
#define DT_BOOL
boolean option
Definition: types.h:30
unsigned char C_FollowupToPoster
Config: (nntp) Reply to the poster if &#39;poster&#39; is in the &#39;Followup-To&#39; header.
Definition: config.c:38
unsigned char C_PostModerated
Config: (nntp) Allow posting to moderated newsgroups.
Definition: config.c:51
#define R_INDEX
Redraw the index menu (MENU_MAIN)
Definition: types.h:65