68#include <sasl/saslutil.h>
70#if defined(USE_SSL) || defined(USE_HCACHE)
144 bool mode_reader =
false;
145 char authinfo[1024] = { 0 };
204 char *p = buf->
data + plen;
220 if ((*p ==
'\0') || (*p ==
' '))
250 mutt_error(
_(
"Server doesn't support reader mode"));
263 char buf[1024] = { 0 };
341 size_t buflen = 2048, off = 0, b = 0;
348 if ((buflen - off) < 1024)
365 cont = (chunk >= (buflen - off));
411static bool nntp_memchr(
char **haystack,
const char *sentinel,
int needle)
413 char *start = *haystack;
414 size_t max_offset = sentinel - start;
415 void *vp = memchr(start, max_offset, needle);
429static void nntp_log_binbuf(
const char *buf,
size_t len,
const char *pfx,
int dbg)
431 char tmp[1024] = { 0 };
433 char *sentinel = tmp + len;
436 if (c_debug_level < dbg)
438 memcpy(tmp, buf, len);
440 while (nntp_memchr(&p, sentinel,
'\0'))
455 char authenticators[1024] =
"USER";
456 char *method = NULL, *a = NULL, *p = NULL;
471 if (c_nntp_authenticators)
473 mutt_str_copy(authenticators, c_nntp_authenticators,
sizeof(authenticators));
519 if ((*m !=
'\0') && (*m !=
' '))
563 if (
buf_at(buf, 0) ==
'5')
569 sasl_conn_t *saslconn = NULL;
570 sasl_interact_t *interaction = NULL;
572 char inbuf[1024] = { 0 };
573 const char *mech = NULL;
574 const char *client_out = NULL;
575 unsigned int client_len, len;
585 rc = sasl_client_start(saslconn, method, &interaction, &client_out,
587 if (rc != SASL_INTERACT)
591 if ((rc != SASL_OK) && (rc != SASL_CONTINUE))
593 sasl_dispose(&saslconn);
603 while ((rc == SASL_CONTINUE) || ((rc == SASL_OK) && client_len))
612 if (sasl_encode64(client_out, client_len, buf->
data + len,
613 buf->
dsize - len, &len) != SASL_OK)
624 method, client_len ?
" sasl_data" :
"");
646 else if (sasl_decode64(inbuf + 4, strlen(inbuf + 4), buf->
data,
647 buf->
dsize - 1, &len) != SASL_OK)
659 rc = sasl_client_step(saslconn,
buf_string(buf), len, &interaction,
660 &client_out, &client_len);
661 if (rc != SASL_INTERACT)
671 if ((rc == SASL_OK) && (client_len == 0) && (*inbuf ==
'2'))
679 sasl_dispose(&saslconn);
736 char buf[1024] = { 0 };
749 else if (mdata->
group)
751 snprintf(buf,
sizeof(buf),
"GROUP %s\r\n", mdata->
group);
767 snprintf(buf,
sizeof(buf),
_(
"Connection to %s lost. Reconnect?"),
768 adata->conn->account.host);
779 snprintf(buf,
sizeof(buf),
"GROUP %s\r\n", mdata->
group);
815 const char *msg,
int (*func)(
char *,
void *),
void *data)
822 char buf[1024] = { 0 };
824 unsigned int lines = 0;
826 struct Progress *progress = NULL;
857 if (!off && (buf[0] ==
'.'))
870 if (chunk >=
sizeof(buf))
878 if ((rc == 0) && (func(line, data) < 0))
906 char *desc = strpbrk(line,
" \t");
910 desc += strspn(desc,
" \t");
914 desc = strchr(line,
'\0');
938 char buf[256] = { 0 };
939 const char *cmd = NULL;
944 wildmat = mdata->
group;
945 if (
adata->hasLIST_NEWSGROUPS)
946 cmd =
"LIST NEWSGROUPS";
947 else if (
adata->hasXGTITLE)
952 snprintf(buf,
sizeof(buf),
"%s %s\r\n", cmd, wildmat);
979 p += strspn(p,
" \t");
983 p = strpbrk(p,
" \t");
988 char *colon = strchr(grp,
':');
992 if (sscanf(colon,
ANUM_FMT, &anum) != 1)
1015 else if ((fputs(line, fp) == EOF) || (fputc(
'\n', fp) == EOF))
1033 if (sscanf(line,
ANUM_FMT, &anum) != 1)
1035 if ((anum < fc->
first) || (anum > fc->
last))
1059 struct Email *e = NULL;
1060 char *header = NULL, *field = NULL;
1065 field = strchr(line,
'\t');
1068 if (sscanf(line,
ANUM_FMT, &anum) != 1)
1073 if ((anum < fc->first) || (anum > fc->
last))
1095 if (!strstr(header,
":full") && (fputs(header, fp) == EOF))
1100 header = strchr(header,
'\0') + 1;
1103 field = strchr(field,
'\t');
1106 if ((fputs(b, fp) == EOF) || (fputc(
'\n', fp) == EOF))
1128 char buf[16] = { 0 };
1131 snprintf(buf,
sizeof(buf),
ANUM_FMT, anum);
1211 struct Email *e = NULL;
1212 char buf[8192] = { 0 };
1215 anum_t first_over = first;
1218 if (!last || (first > last))
1240 mdata->
group, first, last);
1244 snprintf(buf,
sizeof(buf),
"LISTGROUP %s\r\n", mdata->
group);
1253 for (current = first; (current <= last); current++)
1258 snprintf(buf,
sizeof(buf),
ANUM_FMT, current);
1277 for (current = first; current <= last; current++)
1287 for (current = first; (current <= last) && (rc == 0); current++)
1292 snprintf(buf,
sizeof(buf),
ANUM_FMT, current);
1353 snprintf(buf,
sizeof(buf),
"HEAD " ANUM_FMT "\r\n", current);
1371 snprintf(buf,
sizeof(buf),
ANUM_FMT, current);
1407 first_over = current + 1;
1411 current = first_over;
1414 if ((current <= last) && (rc == 0) && !mdata->
deleted)
1417 snprintf(buf,
sizeof(buf),
"%s " ANUM_FMT "-" ANUM_FMT "\r\n", cmd, current, last);
1443 char buf[1024] = { 0 };
1444 anum_t count = 0, first = 0, last = 0;
1455 if (last < mdata->last_message)
1493 if (!m || !m->
mdata)
1540 unsigned char *messages = NULL;
1541 char buf[16] = { 0 };
1542 struct Email *e = NULL;
1546 if (c_nntp_context && ((mdata->
last_message - first + 1) > c_nntp_context))
1566 if ((anum >= first) && (anum <= mdata->last_loaded))
1567 messages[anum - first] = 1;
1569 snprintf(buf,
sizeof(buf),
ANUM_FMT, anum);
1611 if (messages[anum - first])
1614 snprintf(buf,
sizeof(buf),
ANUM_FMT, anum);
1704 char buf[1024] = { 0 };
1705 struct tm tm = { 0 };
1707 mdata.
adata = adata;
1710 if (
nntp_query(&mdata, buf,
sizeof(buf)) < 0)
1713 if (sscanf(buf,
"111 %4d%2d%2d%2d%2d%2d%*s", &tm.tm_year, &tm.tm_mon,
1714 &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) == 6)
1741 if (!line || (sscanf(line,
ANUM_FMT, &anum) != 1))
1778 char buf[256] = { 0 };
1780 bool posting =
false, auth =
true;
1842 posting ?
_(
"Posting is ok") :
_(
"Posting is NOT ok"));
1852 adata->
use_tls = c_ssl_force_tls ||
1878 mutt_error(
_(
"Could not negotiate TLS connection"));
1950 char buf[1024] = { 0 };
1966 mdata->group = NULL;
1991 while (fgets(buf + 1,
sizeof(buf) - 2, fp))
1993 size_t len = strlen(buf);
1994 if (buf[len - 1] ==
'\n')
1996 buf[len - 1] =
'\r';
2011 if (((buf[strlen(buf) - 1] !=
'\n') &&
2040 char msg[256] = { 0 };
2041 char buf[1024] = { 0 };
2045 snprintf(msg,
sizeof(msg),
_(
"Loading list of groups from server %s..."),
2052 tmp_mdata.
group = NULL;
2070 mdata->has_new_mail =
true;
2087 if (c_nntp_load_description)
2109 char buf[1024] = { 0 };
2110 char *msg =
_(
"Checking for new newsgroups...");
2112 int rc, update_active =
false;
2119 if (c_show_new_news)
2132 update_active =
true;
2149 tmp_mdata.
group = NULL;
2152 snprintf(buf,
sizeof(buf),
"NEWGROUPS %02d%02d%02d %02d%02d%02d GMT\r\n",
2153 tm.tm_year % 100, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
2174 mdata->has_new_mail =
true;
2179 if (c_nntp_load_description)
2181 unsigned int count = 0;
2185 for (i = groups_num; i < adata->
groups_num; i++)
2198 update_active =
true;
2221 char buf[1024] = { 0 };
2230 snprintf(buf,
sizeof(buf),
"HEAD %s\r\n", msgid);
2259 snprintf(buf,
sizeof(buf),
"STAT %s\r\n", msgid);
2292 char buf[256] = { 0 };
2296 if (!mdata || !mdata->
adata)
2309 snprintf(buf,
sizeof(buf),
"XPAT References " ANUM_FMT "-" ANUM_FMT " *%s*\r\n",
2323 mutt_error(
_(
"Unable to find child articles because server does not support XPAT command"));
2336 for (
int i = 0; i < cc.
num; i++)
2350 return (rc < 0) ? -1 : 0;
2360 int result = (na == nb) ? 0 : (na > nb) ? 1 : -1;
2361 return reverse ? -result : result;
2388 char buf[8192] = { 0 };
2389 char server[1024] = { 0 };
2393 anum_t first = 0, last = 0, count = 0;
2396 if (!url || !url->
host || !url->
path ||
2405 if (group[0] ==
'/')
2408 url->
path = strchr(url->
path,
'\0');
2433 if (group[0] ==
'/')
2446 m->
rights &= ~MUTT_ACL_INSERT;
2448 if (!
mdata->newsrc_ent && !
mdata->subscribed && !c_save_unsubscribed)
2464 mutt_error(
_(
"Newsgroup %s has been removed from the server"),
mdata->group);
2465 if (!
mdata->deleted)
2467 mdata->deleted =
true;
2470 if (
mdata->newsrc_ent && !
mdata->subscribed && !c_save_unsubscribed)
2473 mdata->newsrc_len = 0;
2487 mdata->first_message = first;
2488 mdata->last_message = last;
2489 mdata->deleted =
false;
2493 if (c_nntp_load_description && !
mdata->desc)
2510 if (!
mdata->bcache && (
mdata->newsrc_ent ||
mdata->subscribed || c_save_unsubscribed))
2514 first =
mdata->first_message;
2516 if (c_nntp_context && ((
mdata->last_message - first + 1) > c_nntp_context))
2517 first =
mdata->last_message - c_nntp_context + 1;
2518 mdata->last_loaded = first ? first - 1 : 0;
2519 count =
mdata->first_message;
2520 mdata->first_message = first;
2522 mdata->first_message = count;
2569 mdata->adata->check_time = 0;
2575 mdata->last_cached = 0;
2585 char buf[16] = { 0 };
2638 if (!tmp_mdata || (tmp_mdata !=
mdata))
2649 char article[16] = { 0 };
2664 unlink(acache->
path);
2682 const char *fetch_msg =
_(
"Fetching message...");
2696 unlink(acache->
path);
2703 char buf[2048] = { 0 };
2704 snprintf(buf,
sizeof(buf),
"ARTICLE %s\r\n",
2712 unlink(acache->
path);
2719 mutt_error(
_(
"Article %s not found on the server"),
2816 .mbox_open_append = NULL,
2818 .mbox_check_stats = NULL,
2822 .msg_open_new = NULL,
2825 .msg_padding_size = NULL,
2826 .msg_save_hcache = NULL,
2828 .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.
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
size_t buf_len(const struct Buffer *buf)
Calculate the length of a Buffer.
const char * buf_find_string(const struct Buffer *buf, const char *s)
Return a pointer to a substring found in the buffer.
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
char buf_at(const struct Buffer *buf, size_t offset)
Return the character at the given offset.
size_t buf_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
const char * buf_find_char(const struct Buffer *buf, const char c)
Return a pointer to a char found in the buffer.
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "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.
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.
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.
bool mutt_file_seek(FILE *fp, LOFF_T offset, int whence)
Wrapper for fseeko with error handling.
#define mutt_file_fclose(FP)
#define mutt_file_fopen(PATH, MODE)
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_adata_free(void **ptr)
Free the private Account data - Implements Account::adata_free() -.
void nntp_edata_free(void **ptr)
Free the private Email data - Implements Email::edata_free() -.
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,...)
void nntp_mdata_free(void **ptr)
Free the private Mailbox data - Implements Mailbox::mdata_free() -.
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() -.
enum MailboxType nntp_path_probe(const char *path, const struct stat *st)
Is this an NNTP Mailbox? - Implements MxOps::path_probe() -.
int nntp_sort_unsorted(const struct Email *a, const struct Email *b, bool reverse)
Restore the 'unsorted' order of emails - Implements sort_email_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.
int hcache_delete_email(struct HeaderCache *hc, const char *key, size_t keylen)
Multiplexor for StoreOps::delete_record.
void hcache_close(struct HeaderCache **ptr)
Multiplexor for StoreOps::close.
struct HCacheEntry hcache_fetch_email(struct HeaderCache *hc, const char *key, size_t keylen, uint32_t uidvalidity)
Multiplexor for StoreOps::fetch.
int hcache_store_email(struct HeaderCache *hc, const char *key, size_t keylen, struct Email *e, uint32_t uidvalidity)
Multiplexor for StoreOps::store.
Header cache multiplexor.
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.
#define MUTT_MEM_CALLOC(n, type)
#define MUTT_MEM_REALLOC(pptr, n, type)
#define MUTT_MEM_MALLOC(n, type)
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.
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_sync(), 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.
struct NntpEmailData * nntp_edata_get(struct Email *e)
Get the private data for this Email.
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.
@ 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
struct Progress * progress_new(enum ProgressType type, size_t size)
Create a new Progress Bar.
void progress_free(struct Progress **ptr)
Free a Progress Bar.
void progress_set_message(struct Progress *progress, const char *fmt,...) __attribute__((__format__(__printf__
bool progress_update(struct Progress *progress, size_t pos, int percent)
Update the state of the 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.
int mutt_socket_buffer_readln_d(struct Buffer *buf, struct Connection *conn, int dbg)
Read a line from a socket into a Buffer.
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_socket_buffer_readln(buf, conn)
#define MUTT_SOCK_LOG_CMD
#define mutt_socket_send_d(conn, buf, dbg)
A group of associated Mailboxes.
void(* adata_free)(void **ptr)
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.
size_t dsize
Length of data.
char * data
Pointer to data.
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.
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)
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 *const 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 NntpMboxData ** groups_list
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.
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://.