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, max_offset, needle);
426static void nntp_log_binbuf(
const char *buf,
size_t len,
const char *pfx,
int dbg)
428 char tmp[1024] = { 0 };
430 char *sentinel = tmp + len;
433 if (c_debug_level < dbg)
435 memcpy(tmp, buf, len);
437 while (nntp_memchr(&p, sentinel,
'\0'))
452 char authenticators[1024] =
"USER";
453 char *method = NULL, *a = NULL, *p = NULL;
468 if (c_nntp_authenticators)
470 mutt_str_copy(authenticators, c_nntp_authenticators,
sizeof(authenticators));
516 if ((*m !=
'\0') && (*m !=
' '))
560 if (
buf_at(buf, 0) ==
'5')
566 sasl_conn_t *saslconn = NULL;
567 sasl_interact_t *interaction = NULL;
569 char inbuf[1024] = { 0 };
570 const char *mech = NULL;
571 const char *client_out = NULL;
572 unsigned int client_len, len;
582 rc = sasl_client_start(saslconn, method, &interaction, &client_out,
584 if (rc != SASL_INTERACT)
588 if ((rc != SASL_OK) && (rc != SASL_CONTINUE))
590 sasl_dispose(&saslconn);
600 while ((rc == SASL_CONTINUE) || ((rc == SASL_OK) && client_len))
609 if (sasl_encode64(client_out, client_len, buf->
data + len,
610 buf->
dsize - len, &len) != SASL_OK)
621 method, client_len ?
" sasl_data" :
"");
643 else if (sasl_decode64(inbuf + 4, strlen(inbuf + 4), buf->
data,
644 buf->
dsize - 1, &len) != SASL_OK)
656 rc = sasl_client_step(saslconn,
buf_string(buf), len, &interaction,
657 &client_out, &client_len);
658 if (rc != SASL_INTERACT)
668 if ((rc == SASL_OK) && (client_len == 0) && (*inbuf ==
'2'))
676 sasl_dispose(&saslconn);
733 char buf[1024] = { 0 };
746 else if (mdata->
group)
748 snprintf(buf,
sizeof(buf),
"GROUP %s\r\n", mdata->
group);
764 snprintf(buf,
sizeof(buf),
_(
"Connection to %s lost. Reconnect?"),
765 adata->conn->account.host);
776 snprintf(buf,
sizeof(buf),
"GROUP %s\r\n", mdata->
group);
812 const char *msg,
int (*func)(
char *,
void *),
void *data)
819 char buf[1024] = { 0 };
821 unsigned int lines = 0;
823 struct Progress *progress = NULL;
854 if (!off && (buf[0] ==
'.'))
867 if (chunk >=
sizeof(buf))
875 if ((rc == 0) && (func(line, data) < 0))
903 char *desc = strpbrk(line,
" \t");
907 desc += strspn(desc,
" \t");
911 desc = strchr(line,
'\0');
935 char buf[256] = { 0 };
936 const char *cmd = NULL;
941 wildmat = mdata->
group;
942 if (
adata->hasLIST_NEWSGROUPS)
943 cmd =
"LIST NEWSGROUPS";
944 else if (
adata->hasXGTITLE)
949 snprintf(buf,
sizeof(buf),
"%s %s\r\n", cmd, wildmat);
976 p += strspn(p,
" \t");
980 p = strpbrk(p,
" \t");
985 char *colon = strchr(grp,
':');
989 if (sscanf(colon,
ANUM_FMT, &anum) != 1)
1012 else if ((fputs(line, fp) == EOF) || (fputc(
'\n', fp) == EOF))
1030 if (sscanf(line,
ANUM_FMT, &anum) != 1)
1032 if ((anum < fc->
first) || (anum > fc->
last))
1056 struct Email *e = NULL;
1057 char *header = NULL, *field = NULL;
1062 field = strchr(line,
'\t');
1065 if (sscanf(line,
ANUM_FMT, &anum) != 1)
1070 if ((anum < fc->first) || (anum > fc->
last))
1092 if (!strstr(header,
":full") && (fputs(header, fp) == EOF))
1097 header = strchr(header,
'\0') + 1;
1100 field = strchr(field,
'\t');
1103 if ((fputs(b, fp) == EOF) || (fputc(
'\n', fp) == EOF))
1125 char buf[16] = { 0 };
1128 snprintf(buf,
sizeof(buf),
ANUM_FMT, anum);
1208 struct Email *e = NULL;
1209 char buf[8192] = { 0 };
1212 anum_t first_over = first;
1215 if (!last || (first > last))
1237 mdata->
group, first, last);
1241 snprintf(buf,
sizeof(buf),
"LISTGROUP %s\r\n", mdata->
group);
1250 for (current = first; (current <= last); current++)
1255 snprintf(buf,
sizeof(buf),
ANUM_FMT, current);
1274 for (current = first; current <= last; current++)
1284 for (current = first; (current <= last) && (rc == 0); current++)
1289 snprintf(buf,
sizeof(buf),
ANUM_FMT, current);
1350 snprintf(buf,
sizeof(buf),
"HEAD " ANUM_FMT "\r\n", current);
1368 snprintf(buf,
sizeof(buf),
ANUM_FMT, current);
1404 first_over = current + 1;
1408 current = first_over;
1411 if ((current <= last) && (rc == 0) && !mdata->
deleted)
1414 snprintf(buf,
sizeof(buf),
"%s " ANUM_FMT "-" ANUM_FMT "\r\n", cmd, current, last);
1440 char buf[1024] = { 0 };
1441 anum_t count = 0, first = 0, last = 0;
1452 if (last < mdata->last_message)
1490 if (!m || !m->
mdata)
1537 unsigned char *messages = NULL;
1538 char buf[16] = { 0 };
1539 struct Email *e = NULL;
1543 if (c_nntp_context && ((mdata->
last_message - first + 1) > c_nntp_context))
1563 if ((anum >= first) && (anum <= mdata->last_loaded))
1564 messages[anum - first] = 1;
1566 snprintf(buf,
sizeof(buf),
ANUM_FMT, anum);
1608 if (messages[anum - first])
1611 snprintf(buf,
sizeof(buf),
ANUM_FMT, anum);
1701 char buf[1024] = { 0 };
1702 struct tm tm = { 0 };
1704 mdata.
adata = adata;
1707 if (
nntp_query(&mdata, buf,
sizeof(buf)) < 0)
1710 if (sscanf(buf,
"111 %4d%2d%2d%2d%2d%2d%*s", &tm.tm_year, &tm.tm_mon,
1711 &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) == 6)
1738 if (!line || (sscanf(line,
ANUM_FMT, &anum) != 1))
1775 char buf[256] = { 0 };
1777 bool posting =
false, auth =
true;
1839 posting ?
_(
"Posting is ok") :
_(
"Posting is NOT ok"));
1849 adata->
use_tls = c_ssl_force_tls ||
1875 mutt_error(
_(
"Could not negotiate TLS connection"));
1947 char buf[1024] = { 0 };
1963 mdata->group = NULL;
1988 while (fgets(buf + 1,
sizeof(buf) - 2, fp))
1990 size_t len = strlen(buf);
1991 if (buf[len - 1] ==
'\n')
1993 buf[len - 1] =
'\r';
2008 if (((buf[strlen(buf) - 1] !=
'\n') &&
2037 char msg[256] = { 0 };
2038 char buf[1024] = { 0 };
2042 snprintf(msg,
sizeof(msg),
_(
"Loading list of groups from server %s..."),
2049 tmp_mdata.
group = NULL;
2084 if (c_nntp_load_description)
2106 char buf[1024] = { 0 };
2107 char *msg =
_(
"Checking for new newsgroups...");
2109 int rc, update_active =
false;
2116 if (c_show_new_news)
2129 update_active =
true;
2146 tmp_mdata.
group = NULL;
2149 snprintf(buf,
sizeof(buf),
"NEWGROUPS %02d%02d%02d %02d%02d%02d GMT\r\n",
2150 tm.tm_year % 100, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
2176 if (c_nntp_load_description)
2178 unsigned int count = 0;
2182 for (i = groups_num; i < adata->
groups_num; i++)
2195 update_active =
true;
2218 char buf[1024] = { 0 };
2227 snprintf(buf,
sizeof(buf),
"HEAD %s\r\n", msgid);
2256 snprintf(buf,
sizeof(buf),
"STAT %s\r\n", msgid);
2289 char buf[256] = { 0 };
2293 if (!mdata || !mdata->
adata)
2306 snprintf(buf,
sizeof(buf),
"XPAT References " ANUM_FMT "-" ANUM_FMT " *%s*\r\n",
2320 mutt_error(
_(
"Unable to find child articles because server does not support XPAT command"));
2333 for (
int i = 0; i < cc.
num; i++)
2347 return (rc < 0) ? -1 : 0;
2357 int result = (na == nb) ? 0 : (na > nb) ? 1 : -1;
2358 return reverse ? -result : result;
2385 char buf[8192] = { 0 };
2386 char server[1024] = { 0 };
2390 anum_t first = 0, last = 0, count = 0;
2393 if (!url || !url->
host || !url->
path ||
2402 if (group[0] ==
'/')
2405 url->
path = strchr(url->
path,
'\0');
2430 if (group[0] ==
'/')
2445 if (!
mdata->newsrc_ent && !
mdata->subscribed && !c_save_unsubscribed)
2461 mutt_error(
_(
"Newsgroup %s has been removed from the server"),
mdata->group);
2462 if (!
mdata->deleted)
2464 mdata->deleted =
true;
2467 if (
mdata->newsrc_ent && !
mdata->subscribed && !c_save_unsubscribed)
2470 mdata->newsrc_len = 0;
2484 mdata->first_message = first;
2485 mdata->last_message = last;
2486 mdata->deleted =
false;
2490 if (c_nntp_load_description && !
mdata->desc)
2507 if (!
mdata->bcache && (
mdata->newsrc_ent ||
mdata->subscribed || c_save_unsubscribed))
2511 first =
mdata->first_message;
2513 if (c_nntp_context && ((
mdata->last_message - first + 1) > c_nntp_context))
2514 first =
mdata->last_message - c_nntp_context + 1;
2515 mdata->last_loaded = first ? first - 1 : 0;
2516 count =
mdata->first_message;
2517 mdata->first_message = first;
2519 mdata->first_message = count;
2566 mdata->adata->check_time = 0;
2572 mdata->last_cached = 0;
2582 char buf[16] = { 0 };
2635 if (!tmp_mdata || (tmp_mdata !=
mdata))
2646 char article[16] = { 0 };
2661 unlink(acache->
path);
2679 const char *fetch_msg =
_(
"Fetching message...");
2693 unlink(acache->
path);
2700 char buf[2048] = { 0 };
2701 snprintf(buf,
sizeof(buf),
"ARTICLE %s\r\n",
2709 unlink(acache->
path);
2716 mutt_error(
_(
"Article %s not found on the server"),
2813 .mbox_open_append = NULL,
2815 .mbox_check_stats = NULL,
2819 .msg_open_new = NULL,
2822 .msg_padding_size = NULL,
2823 .msg_save_hcache = NULL,
2825 .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://.