1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00
elinks/src/protocol/nntp/nntp.c
2022-01-15 20:10:37 +01:00

74 lines
1.8 KiB
C

/* Network news transport protocol implementation (RFC 977 and 2980) */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "elinks.h"
#include "config/options.h"
#include "intl/libintl.h"
#include "main/module.h"
#include "protocol/nntp/nntp.h"
/* The official color for this planet is green,
* which grows in pockets of them people willing to scheme. --delasoul */
#define NNTP_HEADER_ENTRIES "Subject,From,Date,Message-ID,Newsgroups"
/* Module and option stuff: */
enum nntp_protocol_option {
NNTP_PROTOCOL_TREE,
NNTP_PROTOCOL_SERVER,
NNTP_PROTOCOL_HEADER_ENTRIES,
NNTP_PROTOCOL_OPTIONS,
};
static union option_info nntp_protocol_options[] = {
INIT_OPT_TREE("protocol", N_("NNTP"),
"nntp", OPT_ZERO,
N_("NNTP and news specific options.")),
INIT_OPT_STRING("protocol.nntp", N_("Default news server"),
"server", OPT_ZERO, "",
N_("Used when resolving news: URIs. "
"If set to the empty string the value of the NNTPSERVER "
"environment variable will be used.")),
INIT_OPT_STRING("protocol.nntp", N_("Message header entries"),
"header_entries", OPT_ZERO, NNTP_HEADER_ENTRIES,
N_("Comma separated list of which entries in the article "
"header to show. E.g. 'Subject' and 'From'. "
"All header entries can be read in the header info dialog.")),
NULL_OPTION_INFO,
};
#define get_opt_nntp(which) nntp_protocol_options[(which)].option
char *
get_nntp_server(void)
{
return get_opt_nntp(NNTP_PROTOCOL_SERVER).value.string;
}
char *
get_nntp_header_entries(void)
{
return get_opt_nntp(NNTP_PROTOCOL_HEADER_ENTRIES).value.string;
}
struct module nntp_protocol_module = struct_module(
/* name: */ N_("NNTP"),
/* options: */ nntp_protocol_options,
/* hooks: */ NULL,
/* submodules: */ NULL,
/* data: */ NULL,
/* init: */ NULL,
/* done: */ NULL
);