2391{
2395
2396 char buf[8192] = { 0 };
2397 char server[1024] = { 0 };
2398 char *group = NULL;
2399 int rc;
2404
2406 if (!url || !url->
host || !url->
path ||
2408 {
2412 }
2413
2415 if (group[0] == '/')
2416 group++;
2417
2418 url->
path = strchr(url->
path,
'\0');
2420
2426 {
2430 }
2431
2433 {
2436 }
2438
2442
2443 if (group[0] == '/')
2444 group++;
2445
2446
2449 {
2454 }
2455
2458 if (!
mdata->newsrc_ent && !
mdata->subscribed && !c_save_unsubscribed)
2460
2461
2464 buf[0] = '\0';
2466 {
2469 }
2470
2471
2473 {
2474 mutt_error(
_(
"Newsgroup %s has been removed from the server"),
mdata->group);
2475 if (!
mdata->deleted)
2476 {
2477 mdata->deleted =
true;
2479 }
2480 if (
mdata->newsrc_ent && !
mdata->subscribed && !c_save_unsubscribed)
2481 {
2483 mdata->newsrc_len = 0;
2486 }
2487 }
2488 else
2489 {
2490
2492 {
2496 }
2497 mdata->first_message = first;
2498 mdata->last_message = last;
2499 mdata->deleted =
false;
2500
2501
2503 if (c_nntp_load_description && !
mdata->desc)
2504 {
2506 {
2509 }
2512 }
2513 }
2514
2517
2518
2519
2520 if (!
mdata->bcache && (
mdata->newsrc_ent ||
mdata->subscribed || c_save_unsubscribed))
2522
2523
2524 first =
mdata->first_message;
2526 if (c_nntp_context && ((
mdata->last_message - first + 1) > c_nntp_context))
2527 first =
mdata->last_message - c_nntp_context + 1;
2528 mdata->last_loaded = first ? first - 1 : 0;
2529 count =
mdata->first_message;
2530 mdata->first_message = first;
2532 mdata->first_message = count;
2533#ifdef USE_HCACHE
2536#endif
2537 if (!hc)
2539
2542#ifdef USE_HCACHE
2544#endif
2545 if (rc < 0)
2550}
struct BodyCache * mutt_bcache_open(struct ConnAccount *account, const char *mailbox)
Open an Email-Body Cache.
long cs_subset_long(const struct ConfigSubset *sub, const char *name)
Get a long config item by name.
void nntp_adata_free(void **ptr)
Free the private Account data - Implements Account::adata_free() -.
void * mutt_hash_find(const struct HashTable *table, const char *strkey)
Find the HashElem data in a Hash Table element using a key.
void hcache_close(struct HeaderCache **ptr)
Multiplexor for StoreOps::close.
void exec_account_hook(const char *url)
Perform an account hook.
#define FREE(x)
Free memory and set the pointer to NULL.
@ MODULE_ID_NNTP
ModuleNntp, Nntp
time_t mutt_date_now(void)
Return the number of seconds since the Unix epoch.
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
struct HeaderCache * nntp_hcache_open(struct NntpMboxData *mdata)
Open newsgroup hcache.
void nntp_delete_group_cache(struct NntpMboxData *mdata)
Remove hcache and bcache of newsgroup.
void nntp_hcache_update(struct NntpMboxData *mdata, struct HeaderCache *hc)
Remove stale cached headers.
int nntp_active_save_cache(struct NntpAccountData *adata)
Save list of all newsgroups to cache.
void nntp_bcache_update(struct NntpMboxData *mdata)
Remove stale cached messages.
void nntp_newsrc_close(struct NntpAccountData *adata)
Unlock and close .newsrc file.
int nntp_newsrc_update(struct NntpAccountData *adata)
Update .newsrc file.
struct NntpAccountData * nntp_select_server(struct Mailbox *m, const char *server, bool leave_lock)
Open a connection to an NNTP server.
static int nntp_query(struct NntpMboxData *mdata, char *line, size_t linelen)
Send data from buffer and receive answer to same buffer.
static int get_description(struct NntpMboxData *mdata, const char *wildmat, const char *msg)
Fetch newsgroups descriptions.
static int nntp_fetch_headers(struct Mailbox *m, void *hc, anum_t first, anum_t last, bool restore)
Fetch headers.
void(* adata_free)(void **ptr)
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
NNTP-specific Account data -.
bool newsrc_modified
Newsrc file was modified.
struct HashTable * groups_hash
Hash Table: "newsgroup" -> NntpMboxData.
struct Connection * conn
Connection to NNTP Server.
time_t check_time
Last check time.
NNTP-specific Mailbox data -.
char * group
Name of newsgroup.
struct NntpAccountData * adata
Account data.
Nntp private Module data.
struct NntpAccountData * current_news_srv
Current NNTP news server.
A parsed URL proto://user:password@host:port/path?a=1&b=2.
enum UrlScheme scheme
Scheme, e.g. U_SMTPS.
struct Url * url_parse(const char *src)
Fill in Url.
void url_free(struct Url **ptr)
Free the contents of a URL.
int url_tostring(const struct Url *url, char *dest, size_t len, uint8_t flags)
Output the URL string for a given Url object.
@ U_NNTPS
Url is nntps://.
#define U_NONE
No flags are set for URL parsing.