68#include <sasl/saslutil.h>
70#if defined(USE_SSL) || defined(USE_HCACHE)
144 bool mode_reader =
false;
145 char buf[1024] = { 0 };
146 char authinfo[1024] = { 0 };
196 char *p = buf + plen;
208 char *p = strstr(buf,
" NEWSGROUPS");
212 if ((*p ==
'\0') || (*p ==
' '))
240 mutt_error(
_(
"Server doesn't support reader mode"));
253 char buf[1024] = { 0 };
330 size_t buflen = 2048, off = 0, b = 0;
337 if ((buflen - off) < 1024)
354 cont = (chunk >= (buflen - off));
394static bool nntp_memchr(
char **haystack,
const char *sentinel,
int needle)
396 char *start = *haystack;
397 size_t max_offset = sentinel - start;
398 void *vp = memchr(start, max_offset, needle);
412static void nntp_log_binbuf(
const char *buf,
size_t len,
const char *pfx,
int dbg)
414 char tmp[1024] = { 0 };
416 char *sentinel = tmp + len;
419 if (c_debug_level < dbg)
421 memcpy(tmp, buf, len);
423 while (nntp_memchr(&p, sentinel,
'\0'))
438 char buf[1024] = { 0 };
439 char authenticators[1024] =
"USER";
440 char *method = NULL, *a = NULL, *p = NULL;
454 if (c_nntp_authenticators)
456 mutt_str_copy(authenticators, c_nntp_authenticators,
sizeof(authenticators));
502 if ((*m !=
'\0') && (*m !=
' '))
512 snprintf(buf,
sizeof(buf),
"AUTHINFO USER %s\r\n", conn->
account.
user);
527 snprintf(buf,
sizeof(buf),
"AUTHINFO PASS %s\r\n", conn->
account.
pass);
546 sasl_conn_t *saslconn = NULL;
547 sasl_interact_t *interaction = NULL;
549 char inbuf[1024] = { 0 };
550 const char *mech = NULL;
551 const char *client_out = NULL;
552 unsigned int client_len, len;
562 rc = sasl_client_start(saslconn, method, &interaction, &client_out,
564 if (rc != SASL_INTERACT)
568 if ((rc != SASL_OK) && (rc != SASL_CONTINUE))
570 sasl_dispose(&saslconn);
577 snprintf(buf,
sizeof(buf),
"AUTHINFO SASL %s", method);
580 while ((rc == SASL_CONTINUE) || ((rc == SASL_OK) && client_len))
589 if (sasl_encode64(client_out, client_len, buf + len,
590 sizeof(buf) - len, &len) != SASL_OK)
598 if (strchr(buf,
' '))
601 method, client_len ?
" sasl_data" :
"");
623 else if (sasl_decode64(
inbuf + 4, strlen(
inbuf + 4), buf,
624 sizeof(buf) - 1, &len) != SASL_OK)
636 rc = sasl_client_step(saslconn, buf, len, &interaction, &client_out, &client_len);
637 if (rc != SASL_INTERACT)
647 if ((rc == SASL_OK) && (client_len == 0) && (*
inbuf ==
'2'))
654 sasl_dispose(&saslconn);
706 char buf[1024] = { 0 };
721 else if (mdata->
group)
723 snprintf(buf,
sizeof(buf),
"GROUP %s\r\n", mdata->
group);
739 snprintf(buf,
sizeof(buf),
_(
"Connection to %s lost. Reconnect?"),
740 adata->conn->account.host);
751 snprintf(buf,
sizeof(buf),
"GROUP %s\r\n", mdata->
group);
783 const char *msg,
int (*func)(
char *,
void *),
void *data)
790 char buf[1024] = { 0 };
792 unsigned int lines = 0;
794 struct Progress *progress = NULL;
822 if (!off && (buf[0] ==
'.'))
835 if (chunk >=
sizeof(buf))
843 if ((rc == 0) && (func(line, data) < 0))
871 char *desc = strpbrk(line,
" \t");
875 desc += strspn(desc,
" \t");
879 desc = strchr(line,
'\0');
903 char buf[256] = { 0 };
904 const char *cmd = NULL;
909 wildmat = mdata->
group;
910 if (
adata->hasLIST_NEWSGROUPS)
911 cmd =
"LIST NEWSGROUPS";
912 else if (
adata->hasXGTITLE)
917 snprintf(buf,
sizeof(buf),
"%s %s\r\n", cmd, wildmat);
944 p += strspn(p,
" \t");
948 p = strpbrk(p,
" \t");
953 char *colon = strchr(grp,
':');
957 if (sscanf(colon,
ANUM, &anum) != 1)
980 else if ((fputs(line, fp) == EOF) || (fputc(
'\n', fp) == EOF))
998 if (sscanf(line,
ANUM, &anum) != 1)
1000 if ((anum < fc->
first) || (anum > fc->
last))
1024 struct Email *e = NULL;
1025 char *header = NULL, *field = NULL;
1030 field = strchr(line,
'\t');
1033 if (sscanf(line,
ANUM, &anum) != 1)
1038 if ((anum < fc->first) || (anum > fc->
last))
1060 if (!strstr(header,
":full") && (fputs(header, fp) == EOF))
1065 header = strchr(header,
'\0') + 1;
1068 field = strchr(field,
'\t');
1071 if ((fputs(b, fp) == EOF) || (fputc(
'\n', fp) == EOF))
1093 char buf[16] = { 0 };
1096 snprintf(buf,
sizeof(buf),
ANUM, anum);
1176 struct Email *e = NULL;
1177 char buf[8192] = { 0 };
1180 anum_t first_over = first;
1183 if (!last || (first > last))
1204 snprintf(buf,
sizeof(buf),
"LISTGROUP %s " ANUM "-" ANUM "\r\n",
1205 mdata->
group, first, last);
1209 snprintf(buf,
sizeof(buf),
"LISTGROUP %s\r\n", mdata->
group);
1218 for (current = first; (current <= last); current++)
1223 snprintf(buf,
sizeof(buf),
ANUM, current);
1242 for (current = first; current <= last; current++)
1252 for (current = first; (current <= last) && (rc == 0); current++)
1257 snprintf(buf,
sizeof(buf),
ANUM, current);
1318 snprintf(buf,
sizeof(buf),
"HEAD " ANUM "\r\n", current);
1336 snprintf(buf,
sizeof(buf),
ANUM, current);
1372 first_over = current + 1;
1376 current = first_over;
1379 if ((current <= last) && (rc == 0) && !mdata->
deleted)
1382 snprintf(buf,
sizeof(buf),
"%s " ANUM "-" ANUM "\r\n", cmd, current, last);
1408 char buf[1024] = { 0 };
1409 anum_t count, first, last;
1414 if (sscanf(buf,
"211 " ANUM " " ANUM " " ANUM, &count, &first, &last) != 3)
1420 if (last < mdata->last_message)
1505 unsigned char *messages = NULL;
1506 char buf[16] = { 0 };
1507 struct Email *e = NULL;
1511 if (c_nntp_context && ((mdata->
last_message - first + 1) > c_nntp_context))
1531 if ((anum >= first) && (anum <= mdata->last_loaded))
1532 messages[anum - first] = 1;
1534 snprintf(buf,
sizeof(buf),
ANUM, anum);
1576 if (messages[anum - first])
1579 snprintf(buf,
sizeof(buf),
ANUM, anum);
1669 char buf[1024] = { 0 };
1670 struct tm tm = { 0 };
1672 mdata.
adata = adata;
1675 if (
nntp_query(&mdata, buf,
sizeof(buf)) < 0)
1678 if (sscanf(buf,
"111 %4d%2d%2d%2d%2d%2d%*s", &tm.tm_year, &tm.tm_mon,
1679 &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) == 6)
1706 if (!line || (sscanf(line,
ANUM, &anum) != 1))
1734 char buf[256] = { 0 };
1736 bool posting =
false, auth =
true;
1802 posting ?
_(
"Posting is ok") :
_(
"Posting is NOT ok"));
1812 adata->
use_tls = c_ssl_force_tls ||
1837 mutt_error(
_(
"Could not negotiate TLS connection"));
1905 char buf[1024] = { 0 };
1920 mdata->group = NULL;
1945 while (fgets(buf + 1,
sizeof(buf) - 2, fp))
1947 size_t len = strlen(buf);
1948 if (buf[len - 1] ==
'\n')
1950 buf[len - 1] =
'\r';
1964 if (((buf[strlen(buf) - 1] !=
'\n') &&
1989 char msg[256] = { 0 };
1990 char buf[1024] = { 0 };
1994 snprintf(msg,
sizeof(msg),
_(
"Loading list of groups from server %s..."),
2001 tmp_mdata.
group = NULL;
2019 mdata->has_new_mail =
true;
2036 if (c_nntp_load_description)
2058 char buf[1024] = { 0 };
2059 char *msg =
_(
"Checking for new newsgroups...");
2061 int rc, update_active =
false;
2068 if (c_show_new_news)
2081 update_active =
true;
2098 tmp_mdata.
group = NULL;
2101 snprintf(buf,
sizeof(buf),
"NEWGROUPS %02d%02d%02d %02d%02d%02d GMT\r\n",
2102 tm.tm_year % 100, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
2123 mdata->has_new_mail =
true;
2128 if (c_nntp_load_description)
2130 unsigned int count = 0;
2134 for (i = groups_num; i < adata->
groups_num; i++)
2147 update_active =
true;
2170 char buf[1024] = { 0 };
2179 snprintf(buf,
sizeof(buf),
"HEAD %s\r\n", msgid);
2208 snprintf(buf,
sizeof(buf),
"STAT %s\r\n", msgid);
2241 char buf[256] = { 0 };
2245 if (!mdata || !mdata->
adata)
2258 snprintf(buf,
sizeof(buf),
"XPAT References " ANUM "-" ANUM " *%s*\r\n",
2272 mutt_error(
_(
"Unable to find child articles because server does not support XPAT command"));
2285 for (
int i = 0; i < cc.
num; i++)
2299 return (rc < 0) ? -1 : 0;
2309 int result = (na == nb) ? 0 : (na > nb) ? 1 : -1;
2310 return reverse ? -result : result;
2337 char buf[8192] = { 0 };
2338 char server[1024] = { 0 };
2342 anum_t first, last, count = 0;
2345 if (!url || !url->
host || !url->
path ||
2354 if (group[0] ==
'/')
2357 url->
path = strchr(url->
path,
'\0');
2380 if (group[0] ==
'/')
2393 m->
rights &= ~MUTT_ACL_INSERT;
2395 if (!
mdata->newsrc_ent && !
mdata->subscribed && !c_save_unsubscribed)
2411 mutt_error(
_(
"Newsgroup %s has been removed from the server"),
mdata->group);
2412 if (!
mdata->deleted)
2414 mdata->deleted =
true;
2417 if (
mdata->newsrc_ent && !
mdata->subscribed && !c_save_unsubscribed)
2420 mdata->newsrc_len = 0;
2428 if (sscanf(buf,
"211 " ANUM " " ANUM " " ANUM, &count, &first, &last) != 3)
2434 mdata->first_message = first;
2435 mdata->last_message = last;
2436 mdata->deleted =
false;
2440 if (c_nntp_load_description && !
mdata->desc)
2457 if (!
mdata->bcache && (
mdata->newsrc_ent ||
mdata->subscribed || c_save_unsubscribed))
2461 first =
mdata->first_message;
2463 if (c_nntp_context && ((
mdata->last_message - first + 1) > c_nntp_context))
2464 first =
mdata->last_message - c_nntp_context + 1;
2465 mdata->last_loaded = first ? first - 1 : 0;
2466 count =
mdata->first_message;
2467 mdata->first_message = first;
2469 mdata->first_message = count;
2516 mdata->adata->check_time = 0;
2522 mdata->last_cached = 0;
2532 char buf[16] = { 0 };
2585 if (!tmp_mdata || (tmp_mdata !=
mdata))
2596 char article[16] = { 0 };
2611 unlink(acache->
path);
2629 const char *fetch_msg =
_(
"Fetching message...");
2643 unlink(acache->
path);
2650 char buf[2048] = { 0 };
2651 snprintf(buf,
sizeof(buf),
"ARTICLE %s\r\n",
2660 unlink(acache->
path);
2667 mutt_error(
_(
"Article %s not found on the server"),
2782 .mbox_open_append = NULL,
2784 .mbox_check_stats = NULL,
2788 .msg_open_new = NULL,
2791 .msg_padding_size = NULL,
2792 .msg_save_hcache = NULL,
2794 .tags_commit = NULL,
GUI display the mailboxes in a side panel.
void mutt_parse_mime_message(struct Email *e, FILE *fp)
Parse a MIME email.
Body Caching (local copies of email bodies)
int mutt_bcache_commit(struct BodyCache *bcache, const char *id)
Move a temporary file into the Body Cache.
struct BodyCache * mutt_bcache_open(struct ConnAccount *account, const char *mailbox)
Open an Email-Body Cache.
FILE * mutt_bcache_get(struct BodyCache *bcache, const char *id)
Open a file in the Body Cache.
int mutt_bcache_del(struct BodyCache *bcache, const char *id)
Delete a file from the Body Cache.
FILE * mutt_bcache_put(struct BodyCache *bcache, const char *id)
Create a file in the Body Cache.
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
short cs_subset_number(const struct ConfigSubset *sub, const char *name)
Get a number config item by name.
long cs_subset_long(const struct ConfigSubset *sub, const char *name)
Get a long config item by name.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Convenience wrapper for the config headers.
int mutt_account_getpass(struct ConnAccount *cac)
Fetch password into ConnAccount, if necessary.
int mutt_account_getuser(struct ConnAccount *cac)
Retrieve username into ConnAccount, if necessary.
#define MUTT_ACCT_USER
User field has been set.
Convenience wrapper for the core headers.
SecurityFlags crypt_query(struct Body *b)
Check out the type of encryption used.
struct Email * email_new(void)
Create a new Email.
void email_free(struct Email **ptr)
Free an Email.
Structs that make up an email.
struct Envelope * mutt_rfc822_read_header(FILE *fp, struct Email *e, bool user_hdrs, bool weed)
Parses an RFC822 header.
void mutt_env_free(struct Envelope **ptr)
Free an Envelope.
FILE * mutt_file_fopen(const char *path, const char *mode)
Call fopen() safely.
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
bool mutt_file_seek(FILE *fp, LOFF_T offset, int whence)
Wrapper for fseeko with error handling.
void mutt_set_flag(struct Mailbox *m, struct Email *e, enum MessageType flag, bool bf, bool upd_mbox)
Set a flag on an email.
int mutt_ssl_starttls(struct Connection *conn)
Negotiate TLS over an already opened connection.
void nntp_hashelem_free(int type, void *obj, intptr_t data)
Free our hash table data - Implements hash_hdata_free_t -.
#define mutt_message(...)
#define mutt_debug(LEVEL,...)
static bool nntp_ac_add(struct Account *a, struct Mailbox *m)
Add a Mailbox to an Account - Implements MxOps::ac_add() -.
static bool nntp_ac_owns_path(struct Account *a, const char *path)
Check whether an Account owns a Mailbox path - Implements MxOps::ac_owns_path() -.
const struct MxOps MxNntpOps
NNTP Mailbox - Implements MxOps -.
static enum MxStatus nntp_mbox_check(struct Mailbox *m)
Check for new mail - Implements MxOps::mbox_check() -.
static enum MxStatus nntp_mbox_close(struct Mailbox *m)
Close a Mailbox - Implements MxOps::mbox_close() -.
static enum MxOpenReturns nntp_mbox_open(struct Mailbox *m)
Open a Mailbox - Implements MxOps::mbox_open() -.
static enum MxStatus nntp_mbox_sync(struct Mailbox *m)
Save changes to the Mailbox - Implements MxOps::mbox_sync() -.
static int nntp_msg_close(struct Mailbox *m, struct Message *msg)
Close an email - Implements MxOps::msg_close() -.
static bool nntp_msg_open(struct Mailbox *m, struct Message *msg, struct Email *e)
Open an email message in a Mailbox - Implements MxOps::msg_open() -.
static int nntp_path_canon(struct Buffer *path)
Canonicalise a Mailbox path - Implements MxOps::path_canon() -.
static int nntp_path_parent(struct Buffer *path)
Find the parent of a Mailbox path - Implements MxOps::path_parent() -.
static int nntp_path_pretty(struct Buffer *path, const char *folder)
Abbreviate a Mailbox path - Implements MxOps::path_pretty() -.
enum MailboxType nntp_path_probe(const char *path, const struct stat *st)
Is this an NNTP Mailbox? - Implements MxOps::path_probe() -.
int nntp_compare_order(const struct Email *a, const struct Email *b, bool reverse)
Sort to mailbox order - Implements sort_mail_t -.
struct HashElem * mutt_hash_insert(struct HashTable *table, const char *strkey, void *data)
Add a new element to the Hash Table (with string keys)
void mutt_hash_delete(struct HashTable *table, const char *strkey, const void *data)
Remove an element from a Hash Table.
void * mutt_hash_find(const struct HashTable *table, const char *strkey)
Find the HashElem data in a Hash Table element using a key.
Header cache multiplexor.
int hcache_store(struct HeaderCache *hc, const char *key, size_t keylen, struct Email *e, uint32_t uidvalidity)
Multiplexor for StoreOps::store.
struct HCacheEntry hcache_fetch(struct HeaderCache *hc, const char *key, size_t keylen, uint32_t uidvalidity)
Multiplexor for StoreOps::fetch.
void hcache_close(struct HeaderCache **ptr)
Multiplexor for StoreOps::close.
int hcache_delete_record(struct HeaderCache *hc, const char *key, size_t keylen)
Multiplexor for StoreOps::delete_record.
void mutt_account_hook(const char *url)
Perform an account hook.
Parse and execute user-defined hooks.
@ LL_DEBUG2
Log at debug level 2.
@ LL_DEBUG1
Log at debug level 1.
void mailbox_changed(struct Mailbox *m, enum NotifyMailbox action)
Notify observers of a change to a Mailbox.
@ NT_MAILBOX_INVALID
Email list was changed.
#define MUTT_ACL_DELETE
Delete a message.
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
#define MUTT_ACL_WRITE
Write to a message (for flagging or linking threads)
MailboxType
Supported mailbox formats.
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
@ MUTT_UNKNOWN
Mailbox wasn't recognised.
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
void * mutt_mem_malloc(size_t size)
Allocate memory on the heap.
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
struct tm mutt_date_gmtime(time_t t)
Converts calendar time to a broken-down time structure expressed in UTC timezone.
time_t mutt_date_now(void)
Return the number of seconds since the Unix epoch.
Convenience wrapper for the library headers.
void mutt_str_remove_trailing_ws(char *s)
Trim trailing whitespace from a string.
char * mutt_str_dup(const char *str)
Copy a string, safely.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
const char * mutt_istr_find(const char *haystack, const char *needle)
Find first occurrence of string (ignoring case)
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
char * mutt_str_cat(char *buf, size_t buflen, const char *s)
Concatenate two strings.
Many unsorted constants and some structs.
@ MUTT_TAG
Tagged messages.
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
void mutt_sleep(short s)
Sleep for a while.
Some miscellaneous functions.
void mx_alloc_memory(struct Mailbox *m, int req_size)
Create storage for the emails.
MxOpenReturns
Return values for mbox_open()
@ MX_OPEN_ERROR
Open failed with an error.
@ MX_OPEN_OK
Open succeeded.
MxStatus
Return values from mbox_check(), mbox_check_stats(), mbox_snc(), and mbox_close()
@ MX_STATUS_ERROR
An error occurred.
@ MX_STATUS_OK
No changes.
@ MX_STATUS_REOPENED
Mailbox was reopened.
@ MX_STATUS_NEW_MAIL
New mail received in Mailbox.
API for encryption/signing of emails.
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_newsrc_gen_entries(struct Mailbox *m)
Generate array of .newsrc entries.
void nntp_hcache_update(struct NntpMboxData *mdata, struct HeaderCache *hc)
Remove stale cached headers.
void nntp_article_status(struct Mailbox *m, struct Email *e, char *group, anum_t anum)
Get status of articles from .newsrc.
int nntp_add_group(char *line, void *data)
Parse newsgroup.
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_group_unread_stat(struct NntpMboxData *mdata)
Count number of unread articles using .newsrc data.
void nntp_acache_free(struct NntpMboxData *mdata)
Remove all temporarily cache files.
void nntp_adata_free(void **ptr)
Free the private Account data - Implements Account::adata_free()
struct NntpEmailData * nntp_edata_get(struct Email *e)
Get the private data for this Email.
void nntp_edata_free(void **ptr)
Free the private Email data - Implements Email::edata_free()
struct NntpEmailData * nntp_edata_new(void)
Create a new NntpEmailData for an Email.
int nntp_newsrc_parse(struct NntpAccountData *adata)
Parse .newsrc file.
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.
void nntp_mdata_free(void **ptr)
Free the private Mailbox data - Implements Mailbox::mdata_free()
@ NNTP_NONE
No connection to server.
@ NNTP_BYE
Disconnected from server.
@ NNTP_OK
Connected to server.
int nntp_check_msgid(struct Mailbox *m, const char *msgid)
Fetch article by Message-ID.
int nntp_check_children(struct Mailbox *m, const char *msgid)
Fetch children of article with the Message-ID.
int nntp_active_fetch(struct NntpAccountData *adata, bool mark_new)
Fetch list of all newsgroups from server.
static int fetch_children(char *line, void *data)
Parse XPAT line.
static int nntp_auth(struct NntpAccountData *adata)
Get login, password and authenticate.
static int nntp_date(struct NntpAccountData *adata, time_t *now)
Get date and time from server.
int nntp_check_new_groups(struct Mailbox *m, struct NntpAccountData *adata)
Check for new groups/articles in subscribed groups.
static const char * OverviewFmt
Fields to get from server, if it supports the LIST OVERVIEW.FMT feature.
static int nntp_group_poll(struct NntpMboxData *mdata, bool update_stat)
Check newsgroup for new articles.
int nntp_post(struct Mailbox *m, const char *msg)
Post article.
static int nntp_capabilities(struct NntpAccountData *adata)
Get capabilities.
static int parse_overview_line(char *line, void *data)
Parse overview line.
static enum MxStatus check_mailbox(struct Mailbox *m)
Check current newsgroup for new articles.
static int nntp_connect_error(struct NntpAccountData *adata)
Signal a failed connection.
static int nntp_query(struct NntpMboxData *mdata, char *line, size_t linelen)
Send data from buffer and receive answer to same buffer.
static int nntp_fetch_lines(struct NntpMboxData *mdata, char *query, size_t qlen, const char *msg, int(*func)(char *, void *), void *data)
Read lines, calling a callback function for each.
static int get_description(struct NntpMboxData *mdata, const char *wildmat, const char *msg)
Fetch newsgroups descriptions.
static int fetch_tempfile(char *line, void *data)
Write line to temporary file.
static void nntp_parse_xref(struct Mailbox *m, struct Email *e)
Parse cross-reference.
int nntp_open_connection(struct NntpAccountData *adata)
Connect to server, authenticate and get capabilities.
static int nntp_attempt_features(struct NntpAccountData *adata)
Detect supported commands.
static int fetch_numbers(char *line, void *data)
Parse article number.
struct NntpAccountData * CurrentNewsSrv
Current news server.
static int fetch_description(char *line, void *data)
Parse newsgroup description.
static int nntp_fetch_headers(struct Mailbox *m, void *hc, anum_t first, anum_t last, bool restore)
Fetch headers.
Notmuch-specific Mailbox data.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Pop-specific Account data.
@ MUTT_PROGRESS_READ
Progress tracks elements, according to $read_inc
void progress_free(struct Progress **ptr)
Free a Progress Bar.
bool progress_update(struct Progress *progress, size_t pos, int percent)
Update the state of the progress bar.
struct Progress * progress_new(const char *msg, enum ProgressType type, size_t size)
Create a new Progress Bar.
Prototypes for many functions.
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
enum QuadOption query_quadoption(const char *prompt, struct ConfigSubset *sub, const char *name)
Ask the user a quad-question.
enum QuadOption query_yesorno(const char *prompt, enum QuadOption def)
Ask the user a Yes/No question.
int mutt_sasl_interact(sasl_interact_t *interaction)
Perform an SASL interaction with the user.
int mutt_sasl_client_new(struct Connection *conn, sasl_conn_t **saslconn)
Wrapper for sasl_client_new()
void mutt_sasl_setup_conn(struct Connection *conn, sasl_conn_t *saslconn)
Set up an SASL connection.
int mutt_socket_close(struct Connection *conn)
Close a socket.
void mutt_socket_empty(struct Connection *conn)
Clear out any queued data.
int mutt_socket_open(struct Connection *conn)
Simple wrapper.
int mutt_socket_readln_d(char *buf, size_t buflen, struct Connection *conn, int dbg)
Read a line from a socket.
#define MUTT_SOCK_LOG_FULL
#define MUTT_SOCK_LOG_HDR
#define mutt_socket_readln(buf, buflen, conn)
#define mutt_socket_send(conn, buf)
#define MUTT_SOCK_LOG_CMD
#define mutt_socket_send_d(conn, buf, dbg)
A group of associated Mailboxes.
void(* adata_free)(void **ptr)
Free the private data attached to the Account.
void * adata
Private data (for Mailbox backends)
LOFF_T offset
offset where the actual data begins
LOFF_T length
length (in bytes) of attachment
String manipulation buffer.
Keep track of the children of an article.
char host[128]
Server to login to.
MuttAccountFlags flags
Which fields are initialised, e.g. MUTT_ACCT_USER.
char inbuf[1024]
Buffer for incoming traffic.
struct ConnAccount account
Account details: username, password, etc.
int fd
Socket file descriptor.
The envelope/body of an email.
struct Envelope * env
Envelope information.
void * edata
Driver-specific data.
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
struct Body * body
List of MIME parts.
bool old
Email is seen, but unread.
void(* edata_free)(void **ptr)
Free the private data attached to the Email.
bool changed
Email has been edited.
bool flagged
Marked important?
time_t date_sent
Time when the message was sent (UTC)
bool deleted
Email is deleted.
int index
The absolute (unsorted) message number.
time_t received
Time when the message was placed in the mailbox.
char * message_id
Message ID.
char * newsgroups
List of newsgroups.
char * xref
List of cross-references.
char * real_subj
Offset of the real subject.
Keep track when getting data from a server.
struct Progress * progress
Wrapper for Email retrieved from the header cache.
struct Email * email
Retrieved email.
int vcount
The number of virtual messages.
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
int msg_count
Total number of messages.
AclFlags rights
ACL bits, see AclFlags.
enum MailboxType type
Mailbox type.
void * mdata
Driver specific data.
struct HashTable * subj_hash
Hash Table: "subject" -> Email.
struct Email ** emails
Array of Emails.
struct HashTable * id_hash
Hash Table: "message-id" -> Email.
struct Account * account
Account that owns this Mailbox.
bool readonly
Don't allow changes to the mailbox.
int msg_tagged
How many messages are tagged?
bool verbose
Display status messages?
int msg_unread
Number of unread messages.
A local copy of an email.
FILE * fp
pointer to the message data
enum MailboxType type
Mailbox type, e.g. MUTT_IMAP.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
An entry in a .newsrc (subscribed newsgroups)
anum_t last
Last article number in run.
anum_t first
First article number in run.
unsigned int index
Index number.
NNTP-specific Account data -.
struct HashTable * groups_hash
Hash Table: "newsgroup" -> NntpMboxData.
bool hasXOVER
Server supports XOVER command.
struct Connection * conn
Connection to NNTP Server.
bool hasXGTITLE
Server supports XGTITLE command.
bool hasCAPABILITIES
Server supports CAPABILITIES command.
bool hasSTARTTLS
Server supports STARTTLS command.
bool hasLISTGROUPrange
Server supports LISTGROUPrange command.
bool hasLISTGROUP
Server supports LISTGROUP command.
bool hasOVER
Server supports OVER command.
bool hasDATE
Server supports DATE command.
bool hasLIST_NEWSGROUPS
Server supports LIST_NEWSGROUPS command.
anum_t article_num
NNTP article number.
bool parsed
Email has been parse.
NNTP-specific Mailbox data -.
struct BodyCache * bcache
char * group
Name of newsgroup.
struct NntpAccountData * adata
char * desc
Description of newsgroup.
struct NewsrcEntry * newsrc_ent
struct NntpAcache acache[NNTP_ACACHE_LEN]
A parsed URL proto://user:password@host:port/path?a=1&b=2
enum UrlScheme scheme
Scheme, e.g. U_SMTPS.
time_t timegm(struct tm *tm)
Convert struct tm to time_t seconds since epoch.
#define mutt_file_mkstemp()
struct Url * url_parse(const char *src)
Fill in Url.
int url_tostring(struct Url *url, char *dest, size_t len, uint8_t flags)
Output the URL string for a given Url object.
void url_free(struct Url **ptr)
Free the contents of a URL.
@ U_NNTPS
Url is nntps://.