65#include <sasl/saslutil.h>
67#if defined(USE_SSL) || defined(USE_HCACHE)
141 bool mode_reader =
false;
142 char authinfo[1024] = { 0 };
201 char *p = buf->
data + plen;
217 if ((*p ==
'\0') || (*p ==
' '))
247 mutt_error(
_(
"Server doesn't support reader mode"));
260 char buf[1024] = { 0 };
338 size_t buflen = 2048, off = 0, b = 0;
345 if ((buflen - off) < 1024)
362 cont = (chunk >= (buflen - off));
408static bool nntp_memchr(
char **haystack,
const char *sentinel,
int needle)
410 char *start = *haystack;
411 size_t max_offset = sentinel - start;
412 void *vp = memchr(start, needle, max_offset);
426static void nntp_log_binbuf(
const char *buf,
size_t len,
const char *pfx,
int dbg)
428 char tmp[1024] = { 0 };
430 if (len >
sizeof(tmp) - 1)
431 len =
sizeof(tmp) - 1;
434 char *sentinel = tmp + len;
437 if (c_debug_level < dbg)
439 memcpy(tmp, buf, len);
441 while (nntp_memchr(&p, sentinel,
'\0'))
456 char authenticators[1024] =
"USER";
457 char *method = NULL, *a = NULL, *p = NULL;
472 if (c_nntp_authenticators)
474 mutt_str_copy(authenticators, c_nntp_authenticators,
sizeof(authenticators));
520 if ((*m !=
'\0') && (*m !=
' '))
564 if (
buf_at(buf, 0) ==
'5')
570 sasl_conn_t *saslconn = NULL;
571 sasl_interact_t *interaction = NULL;
573 char inbuf[1024] = { 0 };
574 const char *mech = NULL;
575 const char *client_out = NULL;
576 unsigned int client_len, len;
586 rc = sasl_client_start(saslconn, method, &interaction, &client_out,
588 if (rc != SASL_INTERACT)
592 if ((rc != SASL_OK) && (rc != SASL_CONTINUE))
594 sasl_dispose(&saslconn);
604 while ((rc == SASL_CONTINUE) || ((rc == SASL_OK) && client_len))
613 if (sasl_encode64(client_out, client_len, buf->
data + len,
614 buf->
dsize - len, &len) != SASL_OK)
625 method, client_len ?
" sasl_data" :
"");
647 else if (sasl_decode64(inbuf + 4, strlen(inbuf + 4), buf->
data,
648 buf->
dsize - 1, &len) != SASL_OK)
660 rc = sasl_client_step(saslconn,
buf_string(buf), len, &interaction,
661 &client_out, &client_len);
662 if (rc != SASL_INTERACT)
672 if ((rc == SASL_OK) && (client_len == 0) && (*inbuf ==
'2'))
680 sasl_dispose(&saslconn);
737 char buf[1024] = { 0 };
750 else if (mdata->
group)
752 snprintf(buf,
sizeof(buf),
"GROUP %s\r\n", mdata->
group);
768 snprintf(buf,
sizeof(buf),
_(
"Connection to %s lost. Reconnect?"),
769 adata->conn->account.host);
780 snprintf(buf,
sizeof(buf),
"GROUP %s\r\n", mdata->
group);
816 const char *msg,
int (*func)(
char *,
void *),
void *data)
823 char buf[1024] = { 0 };
825 unsigned int lines = 0;
827 struct Progress *progress = NULL;
858 if (!off && (buf[0] ==
'.'))
871 if (chunk >=
sizeof(buf))
879 if ((rc == 0) && (func(line, data) < 0))
907 char *desc = strpbrk(line,
" \t");
911 desc += strspn(desc,
" \t");
915 desc = strchr(line,
'\0');
939 char buf[256] = { 0 };
940 const char *cmd = NULL;
945 wildmat = mdata->
group;
946 if (
adata->hasLIST_NEWSGROUPS)
947 cmd =
"LIST NEWSGROUPS";
948 else if (
adata->hasXGTITLE)
953 snprintf(buf,
sizeof(buf),
"%s %s\r\n", cmd, wildmat);
980 p += strspn(p,
" \t");
984 p = strpbrk(p,
" \t");
989 char *colon = strchr(grp,
':');
993 if (sscanf(colon,
ANUM_FMT, &anum) != 1)
1016 else if ((fputs(line, fp) == EOF) || (fputc(
'\n', fp) == EOF))
1034 if (sscanf(line,
ANUM_FMT, &anum) != 1)
1036 if ((anum < fc->
first) || (anum > fc->
last))
1060 struct Email *e = NULL;
1061 char *header = NULL, *field = NULL;
1066 field = strchr(line,
'\t');
1069 if (sscanf(line,
ANUM_FMT, &anum) != 1)
1074 if ((anum < fc->first) || (anum > fc->
last))
1096 if (!strstr(header,
":full") && (fputs(header, fp) == EOF))
1101 header = strchr(header,
'\0') + 1;
1104 field = strchr(field,
'\t');
1107 if ((fputs(b, fp) == EOF) || (fputc(
'\n', fp) == EOF))
1129 char buf[16] = { 0 };
1132 snprintf(buf,
sizeof(buf),
ANUM_FMT, anum);
1212 struct Email *e = NULL;
1213 char buf[8192] = { 0 };
1216 anum_t first_over = first;
1219 if (!last || (first > last))
1241 mdata->
group, first, last);
1245 snprintf(buf,
sizeof(buf),
"LISTGROUP %s\r\n", mdata->
group);
1254 for (current = first; (current <= last); current++)
1259 snprintf(buf,
sizeof(buf),
ANUM_FMT, current);
1278 for (current = first; current <= last; current++)
1288 for (current = first; (current <= last) && (rc == 0); current++)
1293 snprintf(buf,
sizeof(buf),
ANUM_FMT, current);
1354 snprintf(buf,
sizeof(buf),
"HEAD " ANUM_FMT "\r\n", current);
1372 snprintf(buf,
sizeof(buf),
ANUM_FMT, current);
1408 first_over = current + 1;
1412 current = first_over;
1415 if ((current <= last) && (rc == 0) && !mdata->
deleted)
1418 snprintf(buf,
sizeof(buf),
"%s " ANUM_FMT "-" ANUM_FMT "\r\n", cmd, current, last);
1444 char buf[1024] = { 0 };
1445 anum_t count = 0, first = 0, last = 0;
1456 if (last < mdata->last_message)
1494 if (!m || !m->
mdata)
1541 unsigned char *messages = NULL;
1542 char buf[16] = { 0 };
1543 struct Email *e = NULL;
1547 if (c_nntp_context && ((mdata->
last_message - first + 1) > c_nntp_context))
1567 if ((anum >= first) && (anum <= mdata->last_loaded))
1568 messages[anum - first] = 1;
1570 snprintf(buf,
sizeof(buf),
ANUM_FMT, anum);
1612 if (messages[anum - first])
1615 snprintf(buf,
sizeof(buf),
ANUM_FMT, anum);
1705 char buf[1024] = { 0 };
1706 struct tm tm = { 0 };
1708 mdata.
adata = adata;
1711 if (
nntp_query(&mdata, buf,
sizeof(buf)) < 0)
1714 if (sscanf(buf,
"111 %4d%2d%2d%2d%2d%2d%*s", &tm.tm_year, &tm.tm_mon,
1715 &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) == 6)
1742 if (!line || (sscanf(line,
ANUM_FMT, &anum) != 1))
1779 char buf[256] = { 0 };
1781 bool posting =
false, auth =
true;
1843 posting ?
_(
"Posting is ok") :
_(
"Posting is NOT ok"));
1853 adata->
use_tls = c_ssl_force_tls ||
1879 mutt_error(
_(
"Could not negotiate TLS connection"));
1951 char buf[1024] = { 0 };
1967 mdata->group = NULL;
1992 while (fgets(buf + 1,
sizeof(buf) - 2, fp))
1994 size_t len = strlen(buf);
1995 if (buf[len - 1] ==
'\n')
1997 buf[len - 1] =
'\r';
2012 if (((buf[strlen(buf) - 1] !=
'\n') &&
2041 char msg[256] = { 0 };
2042 char buf[1024] = { 0 };
2046 snprintf(msg,
sizeof(msg),
_(
"Loading list of groups from server %s..."),
2053 tmp_mdata.
group = NULL;
2088 if (c_nntp_load_description)
2110 char buf[1024] = { 0 };
2111 char *msg =
_(
"Checking for new newsgroups...");
2113 int rc, update_active =
false;
2120 if (c_show_new_news)
2133 update_active =
true;
2150 tmp_mdata.
group = NULL;
2153 snprintf(buf,
sizeof(buf),
"NEWGROUPS %02d%02d%02d %02d%02d%02d GMT\r\n",
2154 tm.tm_year % 100, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
2180 if (c_nntp_load_description)
2182 unsigned int count = 0;
2186 for (i = groups_num; i < adata->
groups_num; i++)
2199 update_active =
true;
2222 char buf[1024] = { 0 };
2231 snprintf(buf,
sizeof(buf),
"HEAD %s\r\n", msgid);
2260 snprintf(buf,
sizeof(buf),
"STAT %s\r\n", msgid);
2293 char buf[256] = { 0 };
2297 if (!mdata || !mdata->
adata)
2310 snprintf(buf,
sizeof(buf),
"XPAT References " ANUM_FMT "-" ANUM_FMT " *%s*\r\n",
2324 mutt_error(
_(
"Unable to find child articles because server does not support XPAT command"));
2337 for (
int i = 0; i < cc.
num; i++)
2351 return (rc < 0) ? -1 : 0;
2361 int result = (na == nb) ? 0 : (na > nb) ? 1 : -1;
2362 return reverse ? -result : result;
2389 char buf[8192] = { 0 };
2390 char server[1024] = { 0 };
2394 anum_t first = 0, last = 0, count = 0;
2397 if (!url || !url->
host || !url->
path ||
2406 if (group[0] ==
'/')
2409 url->
path = strchr(url->
path,
'\0');
2434 if (group[0] ==
'/')
2449 if (!
mdata->newsrc_ent && !
mdata->subscribed && !c_save_unsubscribed)
2465 mutt_error(
_(
"Newsgroup %s has been removed from the server"),
mdata->group);
2466 if (!
mdata->deleted)
2468 mdata->deleted =
true;
2471 if (
mdata->newsrc_ent && !
mdata->subscribed && !c_save_unsubscribed)
2474 mdata->newsrc_len = 0;
2488 mdata->first_message = first;
2489 mdata->last_message = last;
2490 mdata->deleted =
false;
2494 if (c_nntp_load_description && !
mdata->desc)
2511 if (!
mdata->bcache && (
mdata->newsrc_ent ||
mdata->subscribed || c_save_unsubscribed))
2515 first =
mdata->first_message;
2517 if (c_nntp_context && ((
mdata->last_message - first + 1) > c_nntp_context))
2518 first =
mdata->last_message - c_nntp_context + 1;
2519 mdata->last_loaded = first ? first - 1 : 0;
2520 count =
mdata->first_message;
2521 mdata->first_message = first;
2523 mdata->first_message = count;
2570 mdata->adata->check_time = 0;
2576 mdata->last_cached = 0;
2586 char buf[16] = { 0 };
2639 if (!tmp_mdata || (tmp_mdata !=
mdata))
2650 char article[16] = { 0 };
2665 unlink(acache->
path);
2683 const char *fetch_msg =
_(
"Fetching message...");
2697 unlink(acache->
path);
2704 char buf[2048] = { 0 };
2705 snprintf(buf,
sizeof(buf),
"ARTICLE %s\r\n",
2713 unlink(acache->
path);
2720 mutt_error(
_(
"Article %s not found on the server"),
2817 .mbox_open_append = NULL,
2819 .mbox_check_stats = NULL,
2823 .msg_open_new = NULL,
2826 .msg_padding_size = NULL,
2827 .msg_save_hcache = NULL,
2829 .tags_commit = NULL,
void mutt_parse_mime_message(struct Email *e, FILE *fp)
Parse a MIME email.
GUI display the mailboxes in a side panel.
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_INSERT
Add/copy into the mailbox (used when editing a message)
#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.
int mutt_toupper(int arg)
Wrapper for toupper(3)
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?
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 exec_account_hook(const char *url)
Perform an account hook.
@ LL_DEBUG2
Log at debug level 2.
@ LL_DEBUG1
Log at debug level 1.
#define FREE(x)
Free memory and set the pointer to NULL.
#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.
time_t timegm(struct tm *tm)
Convert struct tm to time_t seconds since epoch.
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.
Nntp-specific Account data.
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.
Nntp-specific Email data.
Usenet network mailbox type; talk to an NNTP server.
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 * CurrentNewsSrv
Current NNTP news server.
struct NntpAccountData * nntp_select_server(struct Mailbox *m, const char *server, bool leave_lock)
Open a connection to an NNTP server.
Nntp-specific Mailbox data.
Usenet network mailbox type; talk 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.
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.
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.
@ 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.
@ 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
Log everything including full protocol.
#define MUTT_SOCK_LOG_HDR
Log commands and headers.
#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
Log commands only.
#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.
anum_t * child
Array of child article numbers.
struct Mailbox * mailbox
Mailbox.
unsigned int max
Maximum number of children.
unsigned int num
Number of children.
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 HeaderCache * hc
Header cache.
struct Progress * progress
Progress bar.
anum_t first
First article number.
struct Mailbox * mailbox
Mailbox.
bool restore
Restore message headers from cache.
anum_t last
Last article number.
unsigned char * messages
Array of message flags.
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
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 -.
time_t newgroups_time
Last newgroups request time.
bool newsrc_modified
Newsrc file was modified.
struct HashTable * groups_hash
Hash Table: "newsgroup" -> NntpMboxData.
bool hasXOVER
Server supports XOVER command.
struct NntpMboxData ** groups_list
List of newsgroups.
struct Connection * conn
Connection to NNTP Server.
unsigned int status
Connection status.
char * authenticators
Authenticators list.
char * overview_fmt
Overview format.
bool hasXGTITLE
Server supports XGTITLE command.
unsigned int groups_num
Number of newsgroups.
bool hasCAPABILITIES
Server supports CAPABILITIES command.
bool hasSTARTTLS
Server supports STARTTLS command.
bool hasLISTGROUPrange
Server supports LISTGROUPrange command.
time_t check_time
Last check time.
unsigned int use_tls
Use TLS.
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 -.
anum_t last_cached
Last cached article.
bool deleted
Newsgroup is deleted.
anum_t last_message
Last article number.
struct BodyCache * bcache
Body cache.
char * group
Name of newsgroup.
struct NntpAccountData * adata
Account data.
char * desc
Description of newsgroup.
struct NewsrcEntry * newsrc_ent
Newsrc entries.
anum_t unread
Unread articles.
anum_t last_loaded
Last loaded article.
unsigned int newsrc_len
Length of newsrc entry.
struct NntpAcache acache[NNTP_ACACHE_LEN]
Article cache.
bool has_new_mail
Has new articles.
anum_t first_message
First article number.
A parsed URL proto://user:password@host:port/path?a=1&b=2
enum UrlScheme scheme
Scheme, e.g. U_SMTPS.
#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.
#define U_NO_FLAGS
No flags are set for URL parsing.
@ U_NNTPS
Url is nntps://.