NeoMutt  2021-02-05-89-gabe350
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 }
IP
#define IP
Definition: set.h:54
DT_QUAD
#define DT_QUAD
quad-option (no/yes/ask-no/ask-yes)
Definition: types.h:37
C_NntpListgroup
bool C_NntpListgroup
Config: (nntp) Check all articles when opening a newsgroup.
Definition: config.c:46
DT_STRING
#define DT_STRING
a string
Definition: types.h:41
C_NewsgroupsCharset
char * C_NewsgroupsCharset
Config: (nntp) Character set of newsgroups' descriptions.
Definition: config.c:42
DT_NOT_NEGATIVE
#define DT_NOT_NEGATIVE
Negative numbers are not allowed.
Definition: types.h:47
DT_PATH_DIR
#define DT_PATH_DIR
Path is a directory.
Definition: types.h:53
C_ShowNewNews
bool C_ShowNewNews
Config: (nntp) Check for new newsgroups when entering the browser.
Definition: config.c:53
cs_register_variables
bool cs_register_variables(const struct ConfigSet *cs, struct ConfigDef vars[], uint32_t flags)
Register a set of config items.
Definition: set.c:286
C_NntpPoll
short C_NntpPoll
Config: (nntp) Interval between checks for new posts.
Definition: config.c:49
C_FollowupToPoster
unsigned char C_FollowupToPoster
Config: (nntp) Reply to the poster if 'poster' is in the 'Followup-To' header.
Definition: config.c:38
C_PostModerated
unsigned char C_PostModerated
Config: (nntp) Allow posting to moderated newsgroups.
Definition: config.c:51
lib.h
C_NntpUser
char * C_NntpUser
Config: (nntp) Username for the news server.
Definition: config.c:50
init.h
config_init_nntp
bool config_init_nntp(struct ConfigSet *cs)
Register nntp config variables - Implements module_init_config_t.
Definition: config.c:124
DT_NUMBER
#define DT_NUMBER
a number
Definition: types.h:35
C_NntpContext
short C_NntpContext
Config: (nntp) Maximum number of articles to list (0 for all articles)
Definition: config.c:45
C_SaveUnsubscribed
bool C_SaveUnsubscribed
Config: (nntp) Save a list of unsubscribed newsgroups to the 'newsrc'.
Definition: config.c:52
DT_PATH
#define DT_PATH
a path to a file/directory
Definition: types.h:36
DT_SENSITIVE
#define DT_SENSITIVE
Contains sensitive value, e.g. password.
Definition: types.h:49
C_NntpPass
char * C_NntpPass
Config: (nntp) Password for the news server.
Definition: config.c:48
DT_NOT_EMPTY
#define DT_NOT_EMPTY
Empty strings are not allowed.
Definition: types.h:46
DT_BOOL
#define DT_BOOL
boolean option
Definition: types.h:30
C_GroupIndexFormat
char * C_GroupIndexFormat
Config: (nntp) printf-like format string for the browser's display of newsgroups.
Definition: config.c:39
C_ShowOnlyUnread
bool C_ShowOnlyUnread
Config: (nntp) Only show subscribed newsgroups with unread articles.
Definition: config.c:54
C_Newsrc
char * C_Newsrc
Config: (nntp) File containing list of subscribed newsgroups.
Definition: config.c:43
C_NewsServer
char * C_NewsServer
Config: (nntp) Url of the news server.
Definition: config.c:41
private.h
R_INDEX
#define R_INDEX
Redraw the index menu (MENU_MAIN)
Definition: types.h:65
C_NntpLoadDescription
bool C_NntpLoadDescription
Config: (nntp) Load descriptions for newsgroups when adding to the list.
Definition: config.c:47
C_NewsCacheDir
char * C_NewsCacheDir
Config: (nntp) Directory for cached news articles.
Definition: config.c:40
DT_PATH_FILE
#define DT_PATH_FILE
Path is a file.
Definition: types.h:54
ConfigDef
Config item definition.
Definition: set.h:61
ConfigSet
Container for lots of config items.
Definition: set.h:228
C_NntpAuthenticators
char * C_NntpAuthenticators
Config: (nntp) Allowed authentication methods.
Definition: config.c:44
MUTT_ASKYES
@ MUTT_ASKYES
Ask the user, defaulting to 'Yes'.
Definition: quad.h:42
charset_validator
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
C_CatchupNewsgroup
unsigned char C_CatchupNewsgroup
Config: (nntp) Mark all articles as read when leaving a newsgroup.
Definition: config.c:37
R_PAGER
#define R_PAGER
Redraw the pager menu.
Definition: types.h:66
C_XCommentTo
bool C_XCommentTo
Config: (nntp) Add 'X-Comment-To' header that contains article author.
Definition: config.c:55
NntpVars
struct ConfigDef NntpVars[]
Definition: config.c:58