static const char *alias_format_str(char *dest, size_t destlen, size_t col, int cols,
char op, const char *src, const char *fmt,
const char *ifstring, const char *elsestring,
- unsigned long data, format_flag flags)
+ unsigned long data, enum FormatFlag flags)
{
char tmp[SHORT_STRING], adr[SHORT_STRING];
struct Alias *alias = (struct Alias *) data;
static const char *folder_format_str(char *dest, size_t destlen, size_t col, int cols,
char op, const char *src, const char *fmt,
const char *ifstring, const char *elsestring,
- unsigned long data, format_flag flags)
+ unsigned long data, enum FormatFlag flags)
{
char fn[SHORT_STRING], tmp[SHORT_STRING], permission[11];
char date[SHORT_STRING], *t_fmt = NULL;
static const char *newsgroup_format_str(char *dest, size_t destlen, size_t col, int cols,
char op, const char *src, const char *fmt,
const char *ifstring, const char *elsestring,
- unsigned long data, format_flag flags)
+ unsigned long data, enum FormatFlag flags)
{
char fn[SHORT_STRING], tmp[SHORT_STRING];
struct Folder *folder = (struct Folder *) data;
snprintf(dest, destlen, tmp, Context->new);
}
else if (option(OPTMARKOLD) &&
- folder->ff->nd->lastCached >= folder->ff->nd->firstMessage &&
- folder->ff->nd->lastCached <= folder->ff->nd->lastMessage)
+ folder->ff->nd->last_cached >= folder->ff->nd->first_message &&
+ folder->ff->nd->last_cached <= folder->ff->nd->last_message)
{
snprintf(tmp, sizeof(tmp), "%%%sd", fmt);
snprintf(dest, destlen, tmp,
- folder->ff->nd->lastMessage - folder->ff->nd->lastCached);
+ folder->ff->nd->last_message - folder->ff->nd->last_cached);
}
else
{
* Used in sendlib.c for converting from mutt's Charset
*/
-struct FgetConvS
+struct FgetConv
{
FILE *file;
iconv_t cd;
*/
FGETCONV *fgetconv_open(FILE *file, const char *from, const char *to, int flags)
{
- struct FgetConvS *fc = NULL;
+ struct FgetConv *fc = NULL;
iconv_t cd = (iconv_t) -1;
static ICONV_CONST char *repls[] = { "\357\277\275", "?", 0 };
if (cd != (iconv_t) -1)
{
- fc = safe_malloc(sizeof(struct FgetConvS));
+ fc = safe_malloc(sizeof(struct FgetConv));
fc->p = fc->ob = fc->bufo;
fc->ib = fc->bufi;
fc->ibl = 0;
int fgetconv(FGETCONV *_fc)
{
- struct FgetConvS *fc = (struct FgetConvS *) _fc;
+ struct FgetConv *fc = (struct FgetConv *) _fc;
if (!fc)
return EOF;
void fgetconv_close(FGETCONV **_fc)
{
- struct FgetConvS *fc = (struct FgetConvS *) *_fc;
+ struct FgetConv *fc = (struct FgetConv *) *_fc;
if (fc->cd != (iconv_t) -1)
iconv_close(fc->cd);
static const char *compose_format_str(char *buf, size_t buflen, size_t col, int cols,
char op, const char *src, const char *prefix,
const char *ifstring, const char *elsestring,
- unsigned long data, format_flag flags)
+ unsigned long data, enum FormatFlag flags)
{
char fmt[SHORT_STRING], tmp[SHORT_STRING];
int optional = (flags & MUTT_FORMAT_OPTIONAL);
static const char *cb_format_str(char *dest, size_t destlen, size_t col, int cols,
char op, const char *src, const char *fmt,
const char *ifstring, const char *elsestring,
- unsigned long data, format_flag flags)
+ unsigned long data, enum FormatFlag flags)
{
if (!dest || (data == 0))
return src;
#endif
mutt_set_current_menu_redraw_full();
- /* the pager menu needs this flag set to recalc lineInfo */
+ /* the pager menu needs this flag set to recalc line_info */
mutt_set_current_menu_redraw(REDRAW_FLOW);
}
if (!h)
return;
- format_flag flag = MUTT_FORMAT_MAKEPRINT | MUTT_FORMAT_ARROWCURSOR | MUTT_FORMAT_INDEX;
+ enum FormatFlag flag = MUTT_FORMAT_MAKEPRINT | MUTT_FORMAT_ARROWCURSOR | MUTT_FORMAT_INDEX;
int edgemsgno, reverse = Sort & SORT_REVERSE;
struct MuttThread *tmp = NULL;
size_t i;
wchar_t *tempbuf = NULL;
size_t templen = 0;
- history_class_t hclass;
+ enum HistoryClass hclass;
wchar_t wc;
mbstate_t mbstate;
#include <stddef.h>
/* flags for mutt_FormatString() */
-typedef enum {
+enum FormatFlag
+{
MUTT_FORMAT_FORCESUBJ = (1 << 0), /* print the subject even if unchanged */
MUTT_FORMAT_TREE = (1 << 1), /* draw the thread tree */
MUTT_FORMAT_MAKEPRINT = (1 << 2), /* make sure that all chars are printable */
MUTT_FORMAT_ARROWCURSOR = (1 << 5), /* reserve space for arrow_cursor */
MUTT_FORMAT_INDEX = (1 << 6), /* this is a main index entry */
MUTT_FORMAT_NOFILTER = (1 << 7) /* do not allow filtering on this pass */
-} format_flag;
+};
typedef const char *format_t(char *dest, size_t destlen, size_t col, int cols,
char op, const char *src, const char *prefix,
const char *ifstring, const char *elsestring,
- unsigned long data, format_flag flags);
+ unsigned long data, enum FormatFlag flags);
void mutt_FormatString(char *dest, /* output buffer */
size_t destlen, /* output buffer len */
const char *src, /* template string */
format_t *callback, /* callback for processing */
unsigned long data, /* callback data */
- format_flag flags); /* callback flags */
+ enum FormatFlag flags); /* callback flags */
#endif /* _MUTT_FORMAT_FLAGS_H */
size_t param_used;
size_t param_len;
int tag_level[RICH_LAST_TAG];
- int WrapMargin;
+ int wrap_margin;
struct State *s;
};
}
}
- extra = stte->WrapMargin - stte->line_len - stte->indent_len -
+ extra = stte->wrap_margin - stte->line_len - stte->indent_len -
(stte->tag_level[RICH_INDENT_RIGHT] * IndentSize);
if (extra > 0)
{
{
if (!stte->tag_level[RICH_NOFILL] &&
(stte->line_len + stte->word_len >
- (stte->WrapMargin - (stte->tag_level[RICH_INDENT_RIGHT] * IndentSize) - stte->indent_len)))
+ (stte->wrap_margin - (stte->tag_level[RICH_INDENT_RIGHT] * IndentSize) - stte->indent_len)))
enriched_wrap(stte);
if (stte->buff_used)
memset(&stte, 0, sizeof(stte));
stte.s = s;
- stte.WrapMargin =
+ stte.wrap_margin =
((s->flags & MUTT_DISPLAY) ?
(MuttIndexWindow->cols - 4) :
((MuttIndexWindow->cols - 4) < 72) ? (MuttIndexWindow->cols - 4) : 72);
- stte.line_max = stte.WrapMargin * 4;
+ stte.line_max = stte.wrap_margin * 4;
stte.line = safe_calloc(1, (stte.line_max + 1) * sizeof(wchar_t));
stte.param = safe_calloc(1, (STRING) * sizeof(wchar_t));
#define SOMEPRIME 149711
-static unsigned int gen_string_hash(union hash_key key, unsigned int n)
+static unsigned int gen_string_hash(union HashKey key, unsigned int n)
{
unsigned int h = 0;
unsigned char *s = (unsigned char *) key.strkey;
return h;
}
-static int cmp_string_key(union hash_key a, union hash_key b)
+static int cmp_string_key(union HashKey a, union HashKey b)
{
return mutt_strcmp(a.strkey, b.strkey);
}
-static unsigned int gen_case_string_hash(union hash_key key, unsigned int n)
+static unsigned int gen_case_string_hash(union HashKey key, unsigned int n)
{
unsigned int h = 0;
unsigned char *s = (unsigned char *) key.strkey;
return h;
}
-static int cmp_case_string_key(union hash_key a, union hash_key b)
+static int cmp_case_string_key(union HashKey a, union HashKey b)
{
return mutt_strcasecmp(a.strkey, b.strkey);
}
-static unsigned int gen_int_hash(union hash_key key, unsigned int n)
+static unsigned int gen_int_hash(union HashKey key, unsigned int n)
{
return key.intkey % n;
}
-static int cmp_int_key(union hash_key a, union hash_key b)
+static int cmp_int_key(union HashKey a, union HashKey b)
{
if (a.intkey == b.intkey)
return 0;
* data data to associate with `key'
* allow_dup if nonzero, duplicate keys are allowed in the table
*/
-static int union_hash_insert(struct Hash *table, union hash_key key, void *data)
+static int union_hash_insert(struct Hash *table, union HashKey key, void *data)
{
struct HashElem *ptr = NULL;
unsigned int h;
int hash_insert(struct Hash *table, const char *strkey, void *data)
{
- union hash_key key;
+ union HashKey key;
key.strkey = table->strdup_keys ? safe_strdup(strkey) : strkey;
return union_hash_insert(table, key, data);
}
int int_hash_insert(struct Hash *table, unsigned int intkey, void *data)
{
- union hash_key key;
+ union HashKey key;
key.intkey = intkey;
return union_hash_insert(table, key, data);
}
-static struct HashElem *union_hash_find_elem(const struct Hash *table, union hash_key key)
+static struct HashElem *union_hash_find_elem(const struct Hash *table, union HashKey key)
{
int hash;
struct HashElem *ptr = NULL;
return NULL;
}
-static void *union_hash_find(const struct Hash *table, union hash_key key)
+static void *union_hash_find(const struct Hash *table, union HashKey key)
{
struct HashElem *ptr = union_hash_find_elem(table, key);
if (ptr)
void *hash_find(const struct Hash *table, const char *strkey)
{
- union hash_key key;
+ union HashKey key;
key.strkey = strkey;
return union_hash_find(table, key);
}
struct HashElem *hash_find_elem(const struct Hash *table, const char *strkey)
{
- union hash_key key;
+ union HashKey key;
key.strkey = strkey;
return union_hash_find_elem(table, key);
}
void *int_hash_find(const struct Hash *table, unsigned int intkey)
{
- union hash_key key;
+ union HashKey key;
key.intkey = intkey;
return union_hash_find(table, key);
}
struct HashElem *hash_find_bucket(const struct Hash *table, const char *strkey)
{
- union hash_key key;
+ union HashKey key;
int hash;
if (!table)
return table->table[hash];
}
-static void union_hash_delete(struct Hash *table, union hash_key key,
+static void union_hash_delete(struct Hash *table, union HashKey key,
const void *data, void (*destroy)(void *))
{
int hash;
void hash_delete(struct Hash *table, const char *strkey, const void *data,
void (*destroy)(void *))
{
- union hash_key key;
+ union HashKey key;
key.strkey = strkey;
union_hash_delete(table, key, data, destroy);
}
void int_hash_delete(struct Hash *table, unsigned int intkey, const void *data,
void (*destroy)(void *))
{
- union hash_key key;
+ union HashKey key;
key.intkey = intkey;
union_hash_delete(table, key, data, destroy);
}
#include <stdbool.h>
-union hash_key {
+union HashKey {
const char *strkey;
unsigned int intkey;
};
struct HashElem
{
- union hash_key key;
+ union HashKey key;
void *data;
struct HashElem *next;
};
bool strdup_keys : 1; /* if set, the key->strkey is strdup'ed */
bool allow_dups : 1; /* if set, duplicate keys are allowed */
struct HashElem **table;
- unsigned int (*gen_hash)(union hash_key, unsigned int);
- int (*cmp_key)(union hash_key, union hash_key);
+ unsigned int (*gen_hash)(union HashKey, unsigned int);
+ int (*cmp_key)(union HashKey, union HashKey);
};
/* flags for hash_create() */
*/
typedef const char *(*hcache_backend_t)(void);
-typedef struct
+struct HcacheOps
{
const char *name;
hcache_open_t open;
hcache_delete_t delete;
hcache_close_t close;
hcache_backend_t backend;
-} hcache_ops_t;
+};
#define HCACHE_BACKEND_LIST \
HCACHE_BACKEND(bdb) \
HCACHE_BACKEND(tokyocabinet)
#define HCACHE_BACKEND_OPS(_name) \
- const hcache_ops_t hcache_##_name##_ops = { \
- .name = #_name, \
- .open = hcache_##_name##_open, \
- .fetch = hcache_##_name##_fetch, \
- .free = hcache_##_name##_free, \
- .store = hcache_##_name##_store, \
- .delete = hcache_##_name##_delete, \
- .close = hcache_##_name##_close, \
- .backend = hcache_##_name##_backend, \
+ const struct HcacheOps hcache_##_name##_ops = { \
+ .name = #_name, \
+ .open = hcache_##_name##_open, \
+ .fetch = hcache_##_name##_fetch, \
+ .free = hcache_##_name##_free, \
+ .store = hcache_##_name##_store, \
+ .delete = hcache_##_name##_delete, \
+ .close = hcache_##_name##_close, \
+ .backend = hcache_##_name##_backend, \
};
#endif /* _MUTT_HCACHE_BACKEND_H */
static unsigned int hcachever = 0x0;
/**
- * header_cache_t - header cache structure.
+ * struct HeaderCache - header cache structure
*
* This struct holds both the backend-agnostic and the backend-specific parts
* of the header cache. Backend code MUST initialize the fetch, store,
void *ctx;
};
-typedef union {
+union Validate {
struct timeval timeval;
unsigned int uidvalidity;
-} validate;
+};
-#define HCACHE_BACKEND(name) extern const hcache_ops_t hcache_##name##_ops;
+#define HCACHE_BACKEND(name) extern const struct HcacheOps hcache_##name##_ops;
HCACHE_BACKEND_LIST
#undef HCACHE_BACKEND
/* Keep this list sorted as it is in configure.ac to avoid user surprise if no
* header_cache_backend is specified. */
-const hcache_ops_t *hcache_ops[] = {
+const struct HcacheOps *hcache_ops[] = {
#ifdef HAVE_TC
&hcache_tokyocabinet_ops,
#endif
NULL,
};
-static const hcache_ops_t *hcache_get_backend_ops(const char *backend)
+static const struct HcacheOps *hcache_get_backend_ops(const char *backend)
{
- const hcache_ops_t **ops = hcache_ops;
+ const struct HcacheOps **ops = hcache_ops;
if (!backend || !*backend)
{
static int crc_matches(const char *d, unsigned int crc)
{
- int off = sizeof(validate);
+ int off = sizeof(union Validate);
unsigned int mycrc = 0;
if (!d)
int convert = !Charset_is_utf8;
*off = 0;
- d = lazy_malloc(sizeof(validate));
+ d = lazy_malloc(sizeof(union Validate));
if (uidvalidity == 0)
{
}
else
memcpy(d, &uidvalidity, sizeof(uidvalidity));
- *off += sizeof(validate);
+ *off += sizeof(union Validate);
d = dump_int(h->crc, d, off);
int convert = !Charset_is_utf8;
/* skip validate */
- off += sizeof(validate);
+ off += sizeof(union Validate);
/* skip crc */
off += sizeof(unsigned int);
header_cache_t *mutt_hcache_open(const char *path, const char *folder, hcache_namer_t namer)
{
- const hcache_ops_t *ops = hcache_get_ops();
+ const struct HcacheOps *ops = hcache_get_ops();
if (!ops)
return NULL;
void mutt_hcache_close(header_cache_t *h)
{
- const hcache_ops_t *ops = hcache_get_ops();
+ const struct HcacheOps *ops = hcache_get_ops();
if (!h || !ops)
return;
void *mutt_hcache_fetch_raw(header_cache_t *h, const char *key, size_t keylen)
{
char path[_POSIX_PATH_MAX];
- const hcache_ops_t *ops = hcache_get_ops();
+ const struct HcacheOps *ops = hcache_get_ops();
if (!h || !ops)
return NULL;
void mutt_hcache_free(header_cache_t *h, void **data)
{
- const hcache_ops_t *ops = hcache_get_ops();
+ const struct HcacheOps *ops = hcache_get_ops();
if (!h || !ops)
return;
void *data, size_t dlen)
{
char path[_POSIX_PATH_MAX];
- const hcache_ops_t *ops = hcache_get_ops();
+ const struct HcacheOps *ops = hcache_get_ops();
if (!h || !ops)
return -1;
int mutt_hcache_delete(header_cache_t *h, const char *key, size_t keylen)
{
char path[_POSIX_PATH_MAX];
- const hcache_ops_t *ops = hcache_get_ops();
+ const struct HcacheOps *ops = hcache_get_ops();
if (!h)
return -1;
const char *mutt_hcache_backend_list(void)
{
char tmp[STRING] = { 0 };
- const hcache_ops_t **ops = hcache_ops;
+ const struct HcacheOps **ops = hcache_ops;
size_t len = 0;
for (; *ops; ++ops)
* The file is mmap(2)'d into memory. */
const size_t LMDB_DB_SIZE = 2147483648;
-enum mdb_txn_mode
+enum MdbTxnMode
{
- txn_uninitialized,
- txn_read,
- txn_write
+ TXN_UNINITIALIZED,
+ TXN_READ,
+ TXN_WRITE
};
struct HcacheLmdbCtx
MDB_env *env;
MDB_txn *txn;
MDB_dbi db;
- enum mdb_txn_mode txn_mode;
+ enum MdbTxnMode txn_mode;
};
static int mdb_get_r_txn(struct HcacheLmdbCtx *ctx)
{
int rc;
- if (ctx->txn && (ctx->txn_mode == txn_read || ctx->txn_mode == txn_write))
+ if (ctx->txn && (ctx->txn_mode == TXN_READ || ctx->txn_mode == TXN_WRITE))
return MDB_SUCCESS;
if (ctx->txn)
rc = mdb_txn_begin(ctx->env, NULL, MDB_RDONLY, &ctx->txn);
if (rc == MDB_SUCCESS)
- ctx->txn_mode = txn_read;
+ ctx->txn_mode = TXN_READ;
else
mutt_debug(2, "mdb_get_r_txn: %s: %s\n",
ctx->txn ? "mdb_txn_renew" : "mdb_txn_begin", mdb_strerror(rc));
if (ctx->txn)
{
- if (ctx->txn_mode == txn_write)
+ if (ctx->txn_mode == TXN_WRITE)
return MDB_SUCCESS;
/* Free up the memory for readonly or reset transactions */
rc = mdb_txn_begin(ctx->env, NULL, 0, &ctx->txn);
if (rc == MDB_SUCCESS)
- ctx->txn_mode = txn_write;
+ ctx->txn_mode = TXN_WRITE;
else
mutt_debug(2, "mdb_get_w_txn: mdb_txn_begin: %s\n", mdb_strerror(rc));
}
mdb_txn_reset(ctx->txn);
- ctx->txn_mode = txn_uninitialized;
+ ctx->txn_mode = TXN_UNINITIALIZED;
return ctx;
fail_dbi:
mdb_txn_abort(ctx->txn);
- ctx->txn_mode = txn_uninitialized;
+ ctx->txn_mode = TXN_UNINITIALIZED;
ctx->txn = NULL;
fail_env:
{
mutt_debug(2, "hcahce_lmdb_store: mdb_put: %s\n", mdb_strerror(rc));
mdb_txn_abort(ctx->txn);
- ctx->txn_mode = txn_uninitialized;
+ ctx->txn_mode = TXN_UNINITIALIZED;
ctx->txn = NULL;
return rc;
}
{
mutt_debug(2, "hcache_lmdb_delete: mdb_del: %s\n", mdb_strerror(rc));
mdb_txn_abort(ctx->txn);
- ctx->txn_mode = txn_uninitialized;
+ ctx->txn_mode = TXN_UNINITIALIZED;
ctx->txn = NULL;
}
return rc;
struct HcacheLmdbCtx *ctx = *vctx;
- if (ctx->txn && ctx->txn_mode == txn_write)
+ if (ctx->txn && ctx->txn_mode == TXN_WRITE)
{
mdb_txn_commit(ctx->txn);
- ctx->txn_mode = txn_uninitialized;
+ ctx->txn_mode = TXN_UNINITIALIZED;
ctx->txn = NULL;
}
* arguments.
* Returns the number of chars written.
*/
-static size_t add_index_color(char *buf, size_t buflen, format_flag flags, char color)
+static size_t add_index_color(char *buf, size_t buflen, enum FormatFlag flags, char color)
{
int len;
static const char *hdr_format_str(char *dest, size_t destlen, size_t col, int cols,
char op, const char *src, const char *prefix,
const char *ifstring, const char *elsestring,
- unsigned long data, format_flag flags)
+ unsigned long data, enum FormatFlag flags)
{
struct HdrFormatInfo *hfi = (struct HdrFormatInfo *) data;
struct Header *hdr = NULL, *htmp = NULL;
}
void _mutt_make_string(char *dest, size_t destlen, const char *s,
- struct Context *ctx, struct Header *hdr, format_flag flags)
+ struct Context *ctx, struct Header *hdr, enum FormatFlag flags)
{
struct HdrFormatInfo hfi;
}
void mutt_make_string_info(char *dst, size_t dstlen, int cols, const char *s,
- struct HdrFormatInfo *hfi, format_flag flags)
+ struct HdrFormatInfo *hfi, enum FormatFlag flags)
{
mutt_FormatString(dst, dstlen, 0, cols, s, hdr_format_str, (unsigned long) hfi, flags);
}
hash_destroy(&dup_hashes[hclass], NULL);
}
-static void save_history(history_class_t hclass, const char *s)
+static void save_history(enum HistoryClass hclass, const char *s)
{
static int n = 0;
FILE *f = NULL;
/* When removing dups, we want the created "blanks" to be right below the
* resulting h->last position. See the comment section above 'struct History'.
*/
-static void remove_history_dups(history_class_t hclass, const char *s)
+static void remove_history_dups(enum HistoryClass hclass, const char *s)
{
int source, dest, old_last;
struct History *h = GET_HISTORY(hclass);
if (HistSize == OldSize)
return;
- for (history_class_t hclass = HC_FIRST; hclass < HC_LAST; hclass++)
+ for (enum HistoryClass hclass = HC_FIRST; hclass < HC_LAST; hclass++)
init_history(&History[hclass]);
OldSize = HistSize;
}
-void mutt_history_add(history_class_t hclass, const char *s, int save)
+void mutt_history_add(enum HistoryClass hclass, const char *s, int save)
{
int prev;
struct History *h = GET_HISTORY(hclass);
h->cur = h->last; /* reset to the last entry */
}
-char *mutt_history_next(history_class_t hclass)
+char *mutt_history_next(enum HistoryClass hclass)
{
int next;
struct History *h = GET_HISTORY(hclass);
return (h->hist[h->cur] ? h->hist[h->cur] : "");
}
-char *mutt_history_prev(history_class_t hclass)
+char *mutt_history_prev(enum HistoryClass hclass)
{
int prev;
struct History *h = GET_HISTORY(hclass);
return (h->hist[h->cur] ? h->hist[h->cur] : "");
}
-void mutt_reset_history_state(history_class_t hclass)
+void mutt_reset_history_state(enum HistoryClass hclass)
{
struct History *h = GET_HISTORY(hclass);
h->cur = h->last;
}
-int mutt_history_at_scratch(history_class_t hclass)
+int mutt_history_at_scratch(enum HistoryClass hclass)
{
struct History *h = GET_HISTORY(hclass);
return h->cur == h->last;
}
-void mutt_history_save_scratch(history_class_t hclass, const char *s)
+void mutt_history_save_scratch(enum HistoryClass hclass, const char *s)
{
struct History *h = GET_HISTORY(hclass);
#ifndef _MUTT_HISTORY_H
#define _MUTT_HISTORY_H 1
-typedef enum history_class
+enum HistoryClass
{
HC_CMD,
HC_ALIAS,
HC_MBOX,
/* insert new items here to keep history file working */
HC_LAST
-} history_class_t;
+};
#define HC_FIRST HC_CMD
void mutt_init_history(void);
void mutt_read_histfile(void);
-void mutt_history_add(history_class_t hclass, const char *s, int save);
-char *mutt_history_next(history_class_t hclass);
-char *mutt_history_prev(history_class_t hclass);
-void mutt_reset_history_state(history_class_t hclass);
-int mutt_history_at_scratch(history_class_t hclass);
-void mutt_history_save_scratch(history_class_t hclass, const char *s);
+void mutt_history_add(enum HistoryClass hclass, const char *s, int save);
+char *mutt_history_next(enum HistoryClass hclass);
+char *mutt_history_prev(enum HistoryClass hclass);
+void mutt_reset_history_state(enum HistoryClass hclass);
+int mutt_history_at_scratch(enum HistoryClass hclass);
+void mutt_history_save_scratch(enum HistoryClass hclass, const char *s);
#endif /* _MUTT_HISTORY_H */
struct ImapData;
-typedef enum {
+enum ImapAuthRes
+{
IMAP_AUTH_SUCCESS = 0,
IMAP_AUTH_FAILURE,
IMAP_AUTH_UNAVAIL
-} imap_auth_res_t;
+};
struct ImapAuth
{
/* do authentication, using named method or any available if method is NULL */
- imap_auth_res_t (*authenticate)(struct ImapData *idata, const char *method);
+ enum ImapAuthRes (*authenticate)(struct ImapData *idata, const char *method);
/* name of authentication method supported, NULL means variable. If this
* is not null, authenticate may ignore the second parameter. */
const char *method;
};
/* external authenticator prototypes */
-imap_auth_res_t imap_auth_plain(struct ImapData *idata, const char *method);
+enum ImapAuthRes imap_auth_plain(struct ImapData *idata, const char *method);
#ifndef USE_SASL
-imap_auth_res_t imap_auth_anon(struct ImapData *idata, const char *method);
-imap_auth_res_t imap_auth_cram_md5(struct ImapData *idata, const char *method);
+enum ImapAuthRes imap_auth_anon(struct ImapData *idata, const char *method);
+enum ImapAuthRes imap_auth_cram_md5(struct ImapData *idata, const char *method);
#endif
-imap_auth_res_t imap_auth_login(struct ImapData *idata, const char *method);
+enum ImapAuthRes imap_auth_login(struct ImapData *idata, const char *method);
#ifdef USE_GSS
-imap_auth_res_t imap_auth_gss(struct ImapData *idata, const char *method);
+enum ImapAuthRes imap_auth_gss(struct ImapData *idata, const char *method);
#endif
#ifdef USE_SASL
-imap_auth_res_t imap_auth_sasl(struct ImapData *idata, const char *method);
+enum ImapAuthRes imap_auth_sasl(struct ImapData *idata, const char *method);
#endif
#endif /* _MUTT_IMAP_AUTH_H */
#include "protos.h"
/* this is basically a stripped-down version of the cram-md5 method. */
-imap_auth_res_t imap_auth_anon(struct ImapData *idata, const char *method)
+enum ImapAuthRes imap_auth_anon(struct ImapData *idata, const char *method)
{
int rc;
static void hmac_md5(const char *password, char *challenge, unsigned char *response);
/* imap_auth_cram_md5: AUTH=CRAM-MD5 support. */
-imap_auth_res_t imap_auth_cram_md5(struct ImapData *idata, const char *method)
+enum ImapAuthRes imap_auth_cram_md5(struct ImapData *idata, const char *method)
{
char ibuf[LONG_STRING * 2], obuf[LONG_STRING];
unsigned char hmac_response[MD5_DIGEST_LEN];
}
/* imap_auth_gss: AUTH=GSSAPI support. */
-imap_auth_res_t imap_auth_gss(struct ImapData *idata, const char *method)
+enum ImapAuthRes imap_auth_gss(struct ImapData *idata, const char *method)
{
gss_buffer_desc request_buf, send_token;
gss_buffer_t sec_token;
#include "protos.h"
/* imap_auth_login: Plain LOGIN support */
-imap_auth_res_t imap_auth_login(struct ImapData *idata, const char *method)
+enum ImapAuthRes imap_auth_login(struct ImapData *idata, const char *method)
{
char q_user[SHORT_STRING], q_pass[SHORT_STRING];
char buf[STRING];
#include "protos.h"
/* imap_auth_plain: SASL PLAIN support */
-imap_auth_res_t imap_auth_plain(struct ImapData *idata, const char *method)
+enum ImapAuthRes imap_auth_plain(struct ImapData *idata, const char *method)
{
int rc;
- imap_auth_res_t res = IMAP_AUTH_SUCCESS;
+ enum ImapAuthRes res = IMAP_AUTH_SUCCESS;
char buf[STRING];
if (mutt_account_getuser(&idata->conn->account))
#include "protos.h"
/* imap_auth_sasl: Default authenticator if available. */
-imap_auth_res_t imap_auth_sasl(struct ImapData *idata, const char *method)
+enum ImapAuthRes imap_auth_sasl(struct ImapData *idata, const char *method)
{
sasl_conn_t *saslconn = NULL;
sasl_interact_t *interaction = NULL;
};
/* Gmail document one string but use another. Support both. */
-struct Capability_Alias
+struct CapabilityAlias
{
char *name;
unsigned int value;
};
-static struct Capability_Alias Capability_Aliases[] = {
+static struct CapabilityAlias CapabilityAliases[] = {
{ "X-GM-EXT-1", X_GM_EXT1 }, { NULL, 0 },
};
}
if (!found)
{
- for (x = 0; Capability_Aliases[x].name != NULL; x++)
+ for (x = 0; CapabilityAliases[x].name != NULL; x++)
{
- if (imap_wordcasecmp(Capability_Aliases[x].name, s) == 0)
+ if (imap_wordcasecmp(CapabilityAliases[x].name, s) == 0)
{
- mutt_bit_set(idata->capabilities, Capability_Aliases[x].value);
+ mutt_bit_set(idata->capabilities, CapabilityAliases[x].value);
mutt_debug(4, " Found capability \"%s\": %d\n",
- Capability_Aliases[x].name, Capability_Aliases[x].value);
+ CapabilityAliases[x].name, CapabilityAliases[x].value);
found = true;
break;
}
idata->mailbox, count);
idata->reopen |= IMAP_NEWMAIL_PENDING;
}
- idata->newMailCount = count;
+ idata->new_mail_count = count;
}
}
/* pn vs. s: need initial seqno */
if (idata->reopen & IMAP_REOPEN_ALLOW)
{
- unsigned int count = idata->newMailCount;
+ unsigned int count = idata->new_mail_count;
if (!(idata->reopen & IMAP_EXPUNGE_PENDING) &&
(idata->reopen & IMAP_NEWMAIL_PENDING) && count > idata->max_msn)
/* clear mailbox status */
idata->status = false;
memset(idata->ctx->rights, 0, sizeof(idata->ctx->rights));
- idata->newMailCount = 0;
+ idata->new_mail_count = 0;
idata->max_msn = 0;
mutt_message(_("Selecting %s..."), idata->mailbox);
pc = imap_next_word(pc);
if (ascii_strncasecmp("EXISTS", pc, 6) == 0)
{
- count = idata->newMailCount;
- idata->newMailCount = 0;
+ count = idata->new_mail_count;
+ idata->new_mail_count = 0;
}
}
} while (rc == IMAP_CMD_CONTINUE);
int state;
};
-typedef enum {
+enum ImapCommandType
+{
IMAP_CT_NONE = 0,
IMAP_CT_LIST,
IMAP_CT_STATUS
-} IMAP_COMMAND_TYPE;
+};
struct ImapData
{
/* if set, the response parser will store results for complicated commands
* here. */
- IMAP_COMMAND_TYPE cmdtype;
+ enum ImapCommandType cmdtype;
void *cmddata;
/* command queue */
char *mailbox;
unsigned short check_status;
unsigned char reopen;
- unsigned int newMailCount; /* Set when EXISTS notifies of new mail */
+ unsigned int new_mail_count; /* Set when EXISTS notifies of new mail */
struct ImapCache cache[IMAP_CACHE_LEN];
struct Hash *uid_hash;
unsigned int uid_validity;
idx = ctx->msgcount;
oldmsgcount = ctx->msgcount;
idata->reopen &= ~(IMAP_REOPEN_ALLOW | IMAP_NEWMAIL_PENDING);
- idata->newMailCount = 0;
+ idata->new_mail_count = 0;
#ifdef USE_HCACHE
idata->hcache = imap_hcache_open(idata, NULL);
/* update to the last value we actually pulled down */
fetch_msn_end = idata->max_msn;
msn_begin = idata->max_msn + 1;
- msn_end = idata->newMailCount;
+ msn_end = idata->new_mail_count;
while (msn_end > ctx->hdrmax)
mx_alloc_memory(ctx);
imap_alloc_msn_index(idata, msn_end);
idata->reopen &= ~IMAP_NEWMAIL_PENDING;
- idata->newMailCount = 0;
+ idata->new_mail_count = 0;
}
}
return -1;
}
-typedef enum group_state_t { NONE, RX, ADDR } group_state_t;
+enum GroupState
+{
+ GS_NONE,
+ GS_RX,
+ GS_ADDR
+};
static int parse_group(struct Buffer *buf, struct Buffer *s, unsigned long data,
struct Buffer *err)
{
struct GroupContext *gc = NULL;
- group_state_t state = NONE;
+ enum GroupState state = GS_NONE;
struct Address *addr = NULL;
char *estr = NULL;
}
if (mutt_strcasecmp(buf->data, "-rx") == 0)
- state = RX;
+ state = GS_RX;
else if (mutt_strcasecmp(buf->data, "-addr") == 0)
- state = ADDR;
+ state = GS_ADDR;
else
{
switch (state)
{
- case NONE:
+ case GS_NONE:
snprintf(err->data, err->dsize, _("%sgroup: missing -rx or -addr."),
data == MUTT_UNGROUP ? "un" : "");
goto bail;
- case RX:
+ case GS_RX:
if (data == MUTT_GROUP &&
mutt_group_context_add_rx(gc, buf->data, REG_ICASE, err) != 0)
goto bail;
goto bail;
break;
- case ADDR:
+ case GS_ADDR:
if ((addr = mutt_parse_adrlist(NULL, buf->data)) == NULL)
goto bail;
if (mutt_addrlist_to_intl(addr, &estr))
{
do
{
- if (mutt_set_xdg_path(kXDGConfigDirs, buffer, sizeof(buffer)))
+ if (mutt_set_xdg_path(XDG_CONFIG_DIRS, buffer, sizeof(buffer)))
break;
snprintf(buffer, sizeof(buffer), "%s/neomuttrc-%s", SYSCONFDIR, PACKAGE_VERSION);
#define R_NONE 0
#define R_INDEX (1 << 0) /* redraw the index menu (MENU_MAIN) */
#define R_PAGER (1 << 1) /* redraw the pager menu */
-#define R_PAGER_FLOW (1 << 2) /* reflow lineInfo and redraw the pager menu */
+#define R_PAGER_FLOW (1 << 2) /* reflow line_info and redraw the pager menu */
#define R_RESORT (1 << 3) /* resort the mailbox */
#define R_RESORT_SUB (1 << 4) /* resort subthreads */
#define R_RESORT_INIT (1 << 5) /* resort from scratch */
#define EX_OK 0
#endif
-static const struct Sysexits
+static const struct SysExits
{
int v;
const char *str;
static int menu_search(struct Menu *menu, int op)
{
int r = 0, wrap = 0;
- int searchDir;
+ int search_dir;
regex_t re;
char buf[SHORT_STRING];
char *searchBuf =
mutt_str_replace(&SearchBuffers[menu->menu], buf);
searchBuf = SearchBuffers[menu->menu];
}
- menu->searchDir = (op == OP_SEARCH || op == OP_SEARCH_NEXT) ? MUTT_SEARCH_DOWN : MUTT_SEARCH_UP;
+ menu->search_dir = (op == OP_SEARCH || op == OP_SEARCH_NEXT) ? MUTT_SEARCH_DOWN : MUTT_SEARCH_UP;
}
- searchDir = (menu->searchDir == MUTT_SEARCH_UP) ? -1 : 1;
+ search_dir = (menu->search_dir == MUTT_SEARCH_UP) ? -1 : 1;
if (op == OP_SEARCH_OPPOSITE)
- searchDir = -searchDir;
+ search_dir = -search_dir;
if (searchBuf)
r = REGCOMP(&re, searchBuf, REG_NOSUB | mutt_which_case(searchBuf));
return -1;
}
- r = menu->current + searchDir;
+ r = menu->current + search_dir;
search_next:
if (wrap)
mutt_message(_("Search wrapped to top."));
return r;
}
- r += searchDir;
+ r += search_dir;
}
if (option(OPTWRAPSEARCH) && wrap++ == 0)
{
- r = searchDir == 1 ? 0 : menu->max - 1;
+ r = search_dir == 1 ? 0 : menu->max - 1;
goto search_next;
}
regfree(&re);
/* the following are used only by mutt_menu_loop() */
int top; /* entry that is the top of the current page */
int oldcurrent; /* for driver use only. */
- int searchDir; /* direction of search */
+ int search_dir; /* direction of search */
int tagged; /* number of tagged entries */
};
*
* The arguments in a URI are saved in a linked list.
*
- * @sa nm_ctxdata#query_items
+ * @sa NmCtxData#query_items
*/
struct UriTag
{
};
/**
- * nm_hdrtag - NotMuch Mail Header Tags
+ * struct NmHdrTag - NotMuch Mail Header Tags
*
* Keep a linked list of header tags and their transformed values.
* Textual tags can be transformed to symbols to save space.
*
- * @sa nm_hdrdata#tag_list
+ * @sa NmHdrData#tag_list
*/
-struct NmHdrtag
+struct NmHdrTag
{
char *tag;
char *transformed;
- struct NmHdrtag *next;
+ struct NmHdrTag *next;
};
/**
- * struct NmHdrdata - NotMuch data attached to an email
+ * struct NmHdrData - NotMuch data attached to an email
*
* This stores all the NotMuch data associated with an email.
*
* @sa Header#data, MUTT_MBOX
*/
-struct NmHdrdata
+struct NmHdrData
{
char *folder; /**< Location of the email */
char *tags;
char *tags_transformed;
- struct NmHdrtag *tag_list;
+ struct NmHdrTag *tag_list;
char *oldpath;
char *virtual_id; /**< Unique NotMuch Id */
int magic; /**< Type of mailbox the email is in */
};
/**
- * struct NmCtxdata - NotMuch data attached to a context
+ * struct NmCtxData - NotMuch data attached to a context
*
* This stores the global NotMuch data, such as the database connection.
*
* @sa Context#data, NotmuchDBLimit, NM_QUERY_TYPE_MESGS
*/
-struct NmCtxdata
+struct NmCtxData
{
notmuch_database_t *db;
return false;
}
-static void free_tag_list(struct NmHdrtag **tag_list)
+static void free_tag_list(struct NmHdrTag **tag_list)
{
- struct NmHdrtag *tmp = NULL;
+ struct NmHdrTag *tmp = NULL;
while ((tmp = *tag_list) != NULL)
{
*tag_list = 0;
}
-static void free_hdrdata(struct NmHdrdata *data)
+static void free_hdrdata(struct NmHdrData *data)
{
if (!data)
return;
FREE(&data);
}
-static void free_ctxdata(struct NmCtxdata *data)
+static void free_ctxdata(struct NmCtxData *data)
{
if (!data)
return;
FREE(&data);
}
-static struct NmCtxdata *new_ctxdata(char *uri)
+static struct NmCtxData *new_ctxdata(char *uri)
{
- struct NmCtxdata *data = NULL;
+ struct NmCtxData *data = NULL;
if (!uri)
return NULL;
- data = safe_calloc(1, sizeof(struct NmCtxdata));
+ data = safe_calloc(1, sizeof(struct NmCtxData));
mutt_debug(1, "nm: initialize context data %p\n", (void *) data);
data->db_limit = NotmuchDBLimit;
static char *header_get_id(struct Header *h)
{
- return (h && h->data) ? ((struct NmHdrdata *) h->data)->virtual_id : NULL;
+ return (h && h->data) ? ((struct NmHdrData *) h->data)->virtual_id : NULL;
}
static char *header_get_fullpath(struct Header *h, char *buf, size_t bufsz)
return buf;
}
-static struct NmCtxdata *get_ctxdata(struct Context *ctx)
+static struct NmCtxData *get_ctxdata(struct Context *ctx)
{
if (ctx && (ctx->magic == MUTT_NOTMUCH))
return ctx->data;
* result in buffy) or not (for the count in the sidebar). It is not aimed at
* enabling/disabling the feature.
*/
-static char *get_query_string(struct NmCtxdata *data, int window)
+static char *get_query_string(struct NmCtxData *data, int window)
{
mutt_debug(2, "nm: get_query_string(%d)\n", window);
return data->db_query;
}
-static int get_limit(struct NmCtxdata *data)
+static int get_limit(struct NmCtxData *data)
{
return data ? data->db_limit : 0;
}
-static int get_query_type(struct NmCtxdata *data)
+static int get_query_type(struct NmCtxData *data)
{
return (data && data->query_type) ? data->query_type : string_to_query_type(NULL);
}
-static const char *get_db_filename(struct NmCtxdata *data)
+static const char *get_db_filename(struct NmCtxData *data)
{
char *db_filename = NULL;
return db;
}
-static notmuch_database_t *get_db(struct NmCtxdata *data, int writable)
+static notmuch_database_t *get_db(struct NmCtxData *data, int writable)
{
if (!data)
return NULL;
return data->db;
}
-static int release_db(struct NmCtxdata *data)
+static int release_db(struct NmCtxData *data)
{
if (data && data->db)
{
return -1;
}
-static int db_trans_begin(struct NmCtxdata *data)
+static int db_trans_begin(struct NmCtxData *data)
{
if (!data || !data->db)
return -1;
return 0;
}
-static int db_trans_end(struct NmCtxdata *data)
+static int db_trans_end(struct NmCtxData *data)
{
if (!data || !data->db)
return -1;
return 0;
}
-static int is_longrun(struct NmCtxdata *data)
+static int is_longrun(struct NmCtxData *data)
{
return data && data->longrun;
}
-static int get_database_mtime(struct NmCtxdata *data, time_t *mtime)
+static int get_database_mtime(struct NmCtxData *data, time_t *mtime)
{
char path[_POSIX_PATH_MAX];
struct stat st;
FREE(&buf);
}
-static notmuch_query_t *get_query(struct NmCtxdata *data, int writable)
+static notmuch_query_t *get_query(struct NmCtxData *data, int writable)
{
notmuch_database_t *db = NULL;
notmuch_query_t *q = NULL;
static int update_header_tags(struct Header *h, notmuch_message_t *msg)
{
- struct NmHdrdata *data = h->data;
+ struct NmHdrData *data = h->data;
notmuch_tags_t *tags = NULL;
char *tstr = NULL, *ttstr = NULL;
- struct NmHdrtag *tag_list = NULL, *tmp = NULL;
+ struct NmHdrTag *tag_list = NULL, *tmp = NULL;
mutt_debug(2, "nm: tags update requested (%s)\n", data->virtual_id);
static int update_message_path(struct Header *h, const char *path)
{
- struct NmHdrdata *data = h->data;
+ struct NmHdrData *data = h->data;
char *p = NULL;
mutt_debug(2, "nm: path update requested path=%s, (%s)\n", path, data->virtual_id);
id = notmuch_message_get_message_id(msg);
- h->data = safe_calloc(1, sizeof(struct NmHdrdata));
+ h->data = safe_calloc(1, sizeof(struct NmHdrData));
h->free_cb = deinit_header;
/*
* Notmuch ensures that message Id exists (if not notmuch Notmuch will
* generate an ID), so it's more safe than use mutt Header->env->id
*/
- ((struct NmHdrdata *) h->data)->virtual_id = safe_strdup(id);
+ ((struct NmHdrData *) h->data)->virtual_id = safe_strdup(id);
mutt_debug(2, "nm: initialize header data: [hdr=%p, data=%p] (%s)\n",
(void *) h, (void *) h->data, id);
static void progress_reset(struct Context *ctx)
{
- struct NmCtxdata *data = NULL;
+ struct NmCtxData *data = NULL;
if (ctx->quiet)
return;
static void progress_update(struct Context *ctx, notmuch_query_t *q)
{
- struct NmCtxdata *data = get_ctxdata(ctx);
+ struct NmCtxData *data = get_ctxdata(ctx);
if (ctx->quiet || !data || data->noprogress)
return;
const char *path = NULL;
struct Header *h = NULL;
- struct NmCtxdata *data = get_ctxdata(ctx);
+ struct NmCtxData *data = get_ctxdata(ctx);
if (!data)
return;
if (newpath)
{
/* remember that file has been moved -- nm_sync_mailbox() will update the DB */
- struct NmHdrdata *hd = (struct NmHdrdata *) h->data;
+ struct NmHdrData *hd = (struct NmHdrData *) h->data;
if (hd)
{
static bool read_mesgs_query(struct Context *ctx, notmuch_query_t *q, int dedup)
{
- struct NmCtxdata *data = get_ctxdata(ctx);
+ struct NmCtxData *data = get_ctxdata(ctx);
int limit;
notmuch_messages_t *msgs = NULL;
static bool read_threads_query(struct Context *ctx, notmuch_query_t *q, int dedup, int limit)
{
- struct NmCtxdata *data = get_ctxdata(ctx);
+ struct NmCtxData *data = get_ctxdata(ctx);
notmuch_threads_t *threads = NULL;
if (!data)
return 0;
}
-static int remove_filename(struct NmCtxdata *data, const char *path)
+static int remove_filename(struct NmCtxData *data, const char *path)
{
notmuch_status_t st;
notmuch_filenames_t *ls = NULL;
return 0;
}
-static int rename_filename(struct NmCtxdata *data, const char *old,
+static int rename_filename(struct NmCtxData *data, const char *old,
const char *new, struct Header *h)
{
int rc = -1;
char *nm_header_get_folder(struct Header *h)
{
- return (h && h->data) ? ((struct NmHdrdata *) h->data)->folder : NULL;
+ return (h && h->data) ? ((struct NmHdrData *) h->data)->folder : NULL;
}
char *nm_header_get_tags(struct Header *h)
{
- return (h && h->data) ? ((struct NmHdrdata *) h->data)->tags : NULL;
+ return (h && h->data) ? ((struct NmHdrData *) h->data)->tags : NULL;
}
char *nm_header_get_tags_transformed(struct Header *h)
{
- return (h && h->data) ? ((struct NmHdrdata *) h->data)->tags_transformed : NULL;
+ return (h && h->data) ? ((struct NmHdrData *) h->data)->tags_transformed : NULL;
}
char *nm_header_get_tag_transformed(char *tag, struct Header *h)
{
- struct NmHdrtag *tmp = NULL;
+ struct NmHdrTag *tmp = NULL;
if (!h || !h->data)
return NULL;
- for (tmp = ((struct NmHdrdata *) h->data)->tag_list; tmp != NULL; tmp = tmp->next)
+ for (tmp = ((struct NmHdrData *) h->data)->tag_list; tmp != NULL; tmp = tmp->next)
{
if (strcmp(tag, tmp->tag) == 0)
return tmp->transformed;
void nm_longrun_init(struct Context *ctx, int writable)
{
- struct NmCtxdata *data = get_ctxdata(ctx);
+ struct NmCtxData *data = get_ctxdata(ctx);
if (data && get_db(data, writable))
{
void nm_longrun_done(struct Context *ctx)
{
- struct NmCtxdata *data = get_ctxdata(ctx);
+ struct NmCtxData *data = get_ctxdata(ctx);
if (data && (release_db(data) == 0))
mutt_debug(2, "nm: long run deinitialized\n");
void nm_debug_check(struct Context *ctx)
{
- struct NmCtxdata *data = get_ctxdata(ctx);
+ struct NmCtxData *data = get_ctxdata(ctx);
if (!data)
return;
int nm_read_entire_thread(struct Context *ctx, struct Header *h)
{
- struct NmCtxdata *data = get_ctxdata(ctx);
+ struct NmCtxData *data = get_ctxdata(ctx);
const char *id = NULL;
char *qstr = NULL;
notmuch_query_t *q = NULL;
char *nm_uri_from_query(struct Context *ctx, char *buf, size_t bufsz)
{
mutt_debug(2, "nm_uri_from_query (%s)\n", buf);
- struct NmCtxdata *data = get_ctxdata(ctx);
+ struct NmCtxData *data = get_ctxdata(ctx);
char uri[_POSIX_PATH_MAX + LONG_STRING + 32]; /* path to DB + query + URI "decoration" */
if (data)
char buf[LONG_STRING];
struct Context tmp_ctx;
- struct NmCtxdata tmp_ctxdata;
+ struct NmCtxData tmp_ctxdata;
tmp_ctx.magic = MUTT_NOTMUCH;
tmp_ctx.data = &tmp_ctxdata;
int nm_modify_message_tags(struct Context *ctx, struct Header *hdr, char *buf)
{
- struct NmCtxdata *data = get_ctxdata(ctx);
+ struct NmCtxData *data = get_ctxdata(ctx);
notmuch_database_t *db = NULL;
notmuch_message_t *msg = NULL;
int rc = -1;
{
char *orig_str = NULL;
char *new_str = NULL;
- struct NmCtxdata *data = get_ctxdata(ctx);
+ struct NmCtxData *data = get_ctxdata(ctx);
notmuch_database_t *db = NULL;
notmuch_query_t *q = NULL;
bool result = false;
{
char buf[PATH_MAX];
int rc;
- struct NmCtxdata *data = get_ctxdata(ctx);
+ struct NmCtxData *data = get_ctxdata(ctx);
if (!data || !new)
return -1;
notmuch_status_t st;
notmuch_message_t *msg = NULL;
int rc = -1, trans;
- struct NmCtxdata *data = get_ctxdata(ctx);
+ struct NmCtxData *data = get_ctxdata(ctx);
if (!path || !data || (access(path, F_OK) != 0))
return 0;
int nm_get_all_tags(struct Context *ctx, char **tag_list, int *tag_count)
{
- struct NmCtxdata *data = get_ctxdata(ctx);
+ struct NmCtxData *data = get_ctxdata(ctx);
notmuch_database_t *db = NULL;
notmuch_tags_t *tags = NULL;
const char *tag = NULL;
static int nm_open_mailbox(struct Context *ctx)
{
notmuch_query_t *q = NULL;
- struct NmCtxdata *data = NULL;
+ struct NmCtxData *data = NULL;
int rc = -1;
if (init_context(ctx) != 0)
static int nm_check_mailbox(struct Context *ctx, int *index_hint)
{
- struct NmCtxdata *data = get_ctxdata(ctx);
+ struct NmCtxData *data = get_ctxdata(ctx);
time_t mtime = 0;
notmuch_query_t *q = NULL;
notmuch_messages_t *msgs = NULL;
static int nm_sync_mailbox(struct Context *ctx, int *index_hint)
{
- struct NmCtxdata *data = get_ctxdata(ctx);
+ struct NmCtxData *data = get_ctxdata(ctx);
int rc = 0;
char msgbuf[STRING];
struct Progress progress;
{
char old[_POSIX_PATH_MAX], new[_POSIX_PATH_MAX];
struct Header *h = ctx->hdrs[i];
- struct NmHdrdata *hd = h->data;
+ struct NmHdrData *hd = h->data;
if (!ctx->quiet)
mutt_progress_update(&progress, i, -1);
#endif
static const char *xdg_env_vars[] = {
- [kXDGConfigHome] = "XDG_CONFIG_HOME",
- [kXDGConfigDirs] = "XDG_CONFIG_DIRS",
+ [XDG_CONFIG_HOME] = "XDG_CONFIG_HOME",
+ [XDG_CONFIG_DIRS] = "XDG_CONFIG_DIRS",
};
static const char *xdg_defaults[] = {
- [kXDGConfigHome] = "~/.config", [kXDGConfigDirs] = "/etc/xdg",
+ [XDG_CONFIG_HOME] = "~/.config", [XDG_CONFIG_DIRS] = "/etc/xdg",
};
struct Body *mutt_new_body(void)
{
char *p = s, *q = s;
size_t len;
- url_scheme_t scheme;
+ enum UrlScheme scheme;
char tmp[PATH_MAX];
scheme = url_check_scheme(s);
const char *src, /* template string */
format_t *callback, /* callback for processing */
unsigned long data, /* callback data */
- format_flag flags) /* callback flags */
+ enum FormatFlag flags) /* callback flags */
{
char prefix[SHORT_STRING], buf[LONG_STRING], *cp = NULL, *wptr = dest, ch;
char ifstring[SHORT_STRING], elsestring[SHORT_STRING];
*
* Return 1 if an entry was found that actually exists on disk and 0 otherwise.
*/
-int mutt_set_xdg_path(const XDGType type, char *buf, size_t bufsize)
+int mutt_set_xdg_path(enum XdgType type, char *buf, size_t bufsize)
{
char *xdg_env = getenv(xdg_env_vars[type]);
char *xdg = (xdg_env && *xdg_env) ? safe_strdup(xdg_env) :
bool mx_is_imap(const char *p)
{
- url_scheme_t scheme;
+ enum UrlScheme scheme;
if (!p)
return false;
#ifdef USE_POP
bool mx_is_pop(const char *p)
{
- url_scheme_t scheme;
+ enum UrlScheme scheme;
if (!p)
return false;
#ifdef USE_NNTP
bool mx_is_nntp(const char *p)
{
- url_scheme_t scheme;
+ enum UrlScheme scheme;
if (!p)
return false;
#ifdef USE_NOTMUCH
bool mx_is_notmuch(const char *p)
{
- url_scheme_t scheme;
+ enum UrlScheme scheme;
if (!p)
return false;
struct CryptCache *next;
};
-struct DnArrayS
+struct DnArray
{
char *key;
char *value;
/* We work based on user IDs, getting from a user ID to the key is
check and does not need any memory (gpgme uses reference counting). */
-struct CryptKeyinfo
+struct CryptKeyInfo
{
- struct CryptKeyinfo *next;
+ struct CryptKeyInfo *next;
gpgme_key_t kobj;
int idx; /* and the user ID at this index */
const char *uid; /* and for convenience point to this user ID */
struct CryptEntry
{
size_t num;
- struct CryptKeyinfo *key;
+ struct CryptKeyInfo *key;
};
static struct CryptCache *id_defaults = NULL;
/* Return the keyID for the key K. Note that this string is valid as
long as K is valid */
-static const char *crypt_keyid(struct CryptKeyinfo *k)
+static const char *crypt_keyid(struct CryptKeyInfo *k)
{
const char *s = "????????";
}
/* Return the long keyID for the key K. */
-static const char *crypt_long_keyid(struct CryptKeyinfo *k)
+static const char *crypt_long_keyid(struct CryptKeyInfo *k)
{
const char *s = "????????????????";
}
/* Return the short keyID for the key K. */
-static const char *crypt_short_keyid(struct CryptKeyinfo *k)
+static const char *crypt_short_keyid(struct CryptKeyInfo *k)
{
const char *s = "????????";
}
/* Return the hexstring fingerprint from the key K. */
-static const char *crypt_fpr(struct CryptKeyinfo *k)
+static const char *crypt_fpr(struct CryptKeyInfo *k)
{
const char *s = "";
/* Returns the fingerprint if available, otherwise
* returns the long keyid.
*/
-static const char *crypt_fpr_or_lkeyid(struct CryptKeyinfo *k)
+static const char *crypt_fpr_or_lkeyid(struct CryptKeyInfo *k)
{
const char *s = "????????????????";
}
/* Return a copy of KEY. */
-static struct CryptKeyinfo *crypt_copy_key(struct CryptKeyinfo *key)
+static struct CryptKeyInfo *crypt_copy_key(struct CryptKeyInfo *key)
{
- struct CryptKeyinfo *k = NULL;
+ struct CryptKeyInfo *k = NULL;
k = safe_calloc(1, sizeof(*k));
k->kobj = key->kobj;
/* Release all the keys at the address of KEYLIST and set the address
to NULL. */
-static void crypt_free_key(struct CryptKeyinfo **keylist)
+static void crypt_free_key(struct CryptKeyInfo **keylist)
{
- struct CryptKeyinfo *k = NULL;
+ struct CryptKeyInfo *k = NULL;
if (!keylist)
return;
}
/* Return true when key K is valid. */
-static bool crypt_key_is_valid(struct CryptKeyinfo *k)
+static bool crypt_key_is_valid(struct CryptKeyInfo *k)
{
if (k->flags & KEYFLAG_CANTUSE)
return false;
}
/* Return true when validity of KEY is sufficient. */
-static int crypt_id_is_strong(struct CryptKeyinfo *key)
+static int crypt_id_is_strong(struct CryptKeyInfo *key)
{
unsigned int is_strong = 0;
}
/* Return true when the KEY is valid, i.e. not marked as unusable. */
-static int crypt_id_is_valid(struct CryptKeyinfo *key)
+static int crypt_id_is_valid(struct CryptKeyInfo *key)
{
return !(key->flags & KEYFLAG_CANTUSE);
}
/* Return a bit vector describing how well the addresses ADDR and
U_ADDR match and whether KEY is valid. */
static int crypt_id_matches_addr(struct Address *addr, struct Address *u_addr,
- struct CryptKeyinfo *key)
+ struct CryptKeyInfo *key)
{
int rv = 0;
static const char *crypt_entry_fmt(char *dest, size_t destlen, size_t col, int cols,
char op, const char *src, const char *prefix,
const char *ifstring, const char *elsestring,
- unsigned long data, format_flag flags)
+ unsigned long data, enum FormatFlag flags)
{
char fmt[16];
struct CryptEntry *entry = NULL;
- struct CryptKeyinfo *key = NULL;
+ struct CryptKeyInfo *key = NULL;
int kflags = 0;
int optional = (flags & MUTT_FORMAT_OPTIONAL);
const char *s = NULL;
/* Used by the display function to format a line. */
static void crypt_entry(char *s, size_t l, struct Menu *menu, int num)
{
- struct CryptKeyinfo **key_table = (struct CryptKeyinfo **) menu->data;
+ struct CryptKeyInfo **key_table = (struct CryptKeyInfo **) menu->data;
struct CryptEntry entry;
entry.key = key_table[num];
/* Compare two addresses and the keyid to be used for sorting. */
static int _crypt_compare_address(const void *a, const void *b)
{
- struct CryptKeyinfo **s = (struct CryptKeyinfo **) a;
- struct CryptKeyinfo **t = (struct CryptKeyinfo **) b;
+ struct CryptKeyInfo **s = (struct CryptKeyInfo **) a;
+ struct CryptKeyInfo **t = (struct CryptKeyInfo **) b;
int r;
if ((r = mutt_strcasecmp((*s)->uid, (*t)->uid)))
/* Compare two key IDs and the addresses to be used for sorting. */
static int _crypt_compare_keyid(const void *a, const void *b)
{
- struct CryptKeyinfo **s = (struct CryptKeyinfo **) a;
- struct CryptKeyinfo **t = (struct CryptKeyinfo **) b;
+ struct CryptKeyInfo **s = (struct CryptKeyInfo **) a;
+ struct CryptKeyInfo **t = (struct CryptKeyInfo **) b;
int r;
if ((r = mutt_strcasecmp(crypt_fpr_or_lkeyid(*s), crypt_fpr_or_lkeyid(*t))))
/* Compare 2 creation dates and the addresses. For sorting. */
static int _crypt_compare_date(const void *a, const void *b)
{
- struct CryptKeyinfo **s = (struct CryptKeyinfo **) a;
- struct CryptKeyinfo **t = (struct CryptKeyinfo **) b;
+ struct CryptKeyInfo **s = (struct CryptKeyInfo **) a;
+ struct CryptKeyInfo **t = (struct CryptKeyInfo **) b;
unsigned long ts = 0, tt = 0;
if ((*s)->kobj->subkeys && ((*s)->kobj->subkeys->timestamp > 0))
addresses and the key IDs. For sorting. */
static int _crypt_compare_trust(const void *a, const void *b)
{
- struct CryptKeyinfo **s = (struct CryptKeyinfo **) a;
- struct CryptKeyinfo **t = (struct CryptKeyinfo **) b;
+ struct CryptKeyInfo **s = (struct CryptKeyInfo **) a;
+ struct CryptKeyInfo **t = (struct CryptKeyInfo **) b;
unsigned long ts = 0, tt = 0;
int r;
/* Print the X.500 Distinguished Name part KEY from the array of parts
DN to FP. */
-static int print_dn_part(FILE *fp, struct DnArrayS *dn, const char *key)
+static int print_dn_part(FILE *fp, struct DnArray *dn, const char *key)
{
int any = 0;
}
/* Print all parts of a DN in a standard sequence. */
-static void print_dn_parts(FILE *fp, struct DnArrayS *dn)
+static void print_dn_parts(FILE *fp, struct DnArray *dn)
{
static const char *const stdpart[] = {
"CN", "OU", "O", "STREET", "L", "ST", "C", NULL,
}
/* Parse an RDN; this is a helper to parse_dn(). */
-static const char *parse_dn_part(struct DnArrayS *array, const char *string)
+static const char *parse_dn_part(struct DnArray *array, const char *string)
{
const char *s = NULL, *s1 = NULL;
size_t n;
/* Parse a DN and return an array-ized one. This is not a validating
parser and it does not support any old-stylish syntax; gpgme is
expected to return only rfc2253 compatible strings. */
-static struct DnArrayS *parse_dn(const char *string)
+static struct DnArray *parse_dn(const char *string)
{
- struct DnArrayS *array = NULL;
+ struct DnArray *array = NULL;
size_t arrayidx, arraysize;
int i;
break; /* ready */
if (arrayidx >= arraysize)
{ /* mutt lacks a real safe_realoc - so we need to copy */
- struct DnArrayS *a2 = NULL;
+ struct DnArray *a2 = NULL;
arraysize += 5;
a2 = safe_malloc((arraysize + 1) * sizeof(*array));
fputs(_("[Can't display this user ID (invalid encoding)]"), fp);
else
{
- struct DnArrayS *dn = parse_dn(userid);
+ struct DnArray *dn = parse_dn(userid);
if (!dn)
fputs(_("[Can't display this user ID (invalid DN)]"), fp);
else
}
}
-typedef enum {
+enum KeyCap
+{
KEY_CAP_CAN_ENCRYPT,
KEY_CAP_CAN_SIGN,
KEY_CAP_CAN_CERTIFY
-} key_cap_t;
+};
-static unsigned int key_check_cap(gpgme_key_t key, key_cap_t cap)
+static unsigned int key_check_cap(gpgme_key_t key, enum KeyCap cap)
{
gpgme_subkey_t subkey = NULL;
unsigned int ret = 0;
}
/* Show detailed information about the selected key */
-static void verify_key(struct CryptKeyinfo *key)
+static void verify_key(struct CryptKeyInfo *key)
{
FILE *fp = NULL;
char cmd[LONG_STRING], tempfile[_POSIX_PATH_MAX];
/* Return a list of keys which are candidates for the selection.
Select by looking at the HINTS list. */
-static struct CryptKeyinfo *get_candidates(struct List *hints, unsigned int app, int secret)
+static struct CryptKeyInfo *get_candidates(struct List *hints, unsigned int app, int secret)
{
- struct CryptKeyinfo *db = NULL, *k = NULL, **kend = NULL;
+ struct CryptKeyInfo *db = NULL, *k = NULL, **kend = NULL;
char *pattern = NULL;
gpgme_error_t err;
gpgme_ctx_t ctx;
/* Display a menu to select a key from the array KEYS. FORCED_VALID
will be set to true on return if the user did override the
key's validity. */
-static struct CryptKeyinfo *crypt_select_key(struct CryptKeyinfo *keys,
+static struct CryptKeyInfo *crypt_select_key(struct CryptKeyInfo *keys,
struct Address *p, const char *s,
unsigned int app, int *forced_valid)
{
int keymax;
- struct CryptKeyinfo **key_table = NULL;
+ struct CryptKeyInfo **key_table = NULL;
struct Menu *menu = NULL;
int i;
bool done = false;
char helpstr[LONG_STRING], buf[LONG_STRING];
- struct CryptKeyinfo *k = NULL;
+ struct CryptKeyInfo *k = NULL;
int (*f)(const void *, const void *);
int menu_to_use = 0;
bool unusable = false;
if (i == keymax)
{
keymax += 20;
- safe_realloc(&key_table, sizeof(struct CryptKeyinfo *) * keymax);
+ safe_realloc(&key_table, sizeof(struct CryptKeyInfo *) * keymax);
}
key_table[i++] = k;
f = crypt_compare_trust;
break;
}
- qsort(key_table, i, sizeof(struct CryptKeyinfo *), f);
+ qsort(key_table, i, sizeof(struct CryptKeyInfo *), f);
if (app & APPLICATION_PGP)
menu_to_use = MENU_KEY_SELECT_PGP;
return k;
}
-static struct CryptKeyinfo *crypt_getkeybyaddr(struct Address *a,
+static struct CryptKeyInfo *crypt_getkeybyaddr(struct Address *a,
short abilities, unsigned int app,
int *forced_valid, bool oppenc_mode)
{
int this_key_has_addr_match = false;
int match = false;
- struct CryptKeyinfo *keys = NULL, *k = NULL;
- struct CryptKeyinfo *the_strong_valid_key = NULL;
- struct CryptKeyinfo *a_valid_addrmatch_key = NULL;
- struct CryptKeyinfo *matches = NULL;
- struct CryptKeyinfo **matches_endp = &matches;
+ struct CryptKeyInfo *keys = NULL, *k = NULL;
+ struct CryptKeyInfo *the_strong_valid_key = NULL;
+ struct CryptKeyInfo *a_valid_addrmatch_key = NULL;
+ struct CryptKeyInfo *matches = NULL;
+ struct CryptKeyInfo **matches_endp = &matches;
*forced_valid = 0;
if (match)
{
- struct CryptKeyinfo *tmp = NULL;
+ struct CryptKeyInfo *tmp = NULL;
*matches_endp = tmp = crypt_copy_key(k);
matches_endp = &tmp->next;
return k;
}
-static struct CryptKeyinfo *crypt_getkeybystr(char *p, short abilities,
+static struct CryptKeyInfo *crypt_getkeybystr(char *p, short abilities,
unsigned int app, int *forced_valid)
{
struct List *hints = NULL;
- struct CryptKeyinfo *keys = NULL;
- struct CryptKeyinfo *matches = NULL;
- struct CryptKeyinfo **matches_endp = &matches;
- struct CryptKeyinfo *k = NULL;
+ struct CryptKeyInfo *keys = NULL;
+ struct CryptKeyInfo *matches = NULL;
+ struct CryptKeyInfo **matches_endp = &matches;
+ struct CryptKeyInfo *k = NULL;
const char *ps = NULL, *pl = NULL, *pfcopy = NULL, *phint = NULL;
mutt_message(_("Looking for keys matching \"%s\"..."), p);
(ps && (mutt_strcasecmp(ps, crypt_short_keyid(k)) == 0)) ||
mutt_stristr(k->uid, p))
{
- struct CryptKeyinfo *tmp = NULL;
+ struct CryptKeyInfo *tmp = NULL;
mutt_debug(5, "match.\n");
default. ABILITIES describe the required key abilities (sign,
encrypt) and APP the type of the requested key; ether S/MIME or
PGP. Return a copy of the key or NULL if not found. */
-static struct CryptKeyinfo *crypt_ask_for_key(char *tag, char *whatfor, short abilities,
+static struct CryptKeyInfo *crypt_ask_for_key(char *tag, char *whatfor, short abilities,
unsigned int app, int *forced_valid)
{
- struct CryptKeyinfo *key = NULL;
+ struct CryptKeyInfo *key = NULL;
char resp[SHORT_STRING];
struct CryptCache *l = NULL;
int dummy;
size_t keylist_used = 0;
struct Address *addr = NULL;
struct Address *p = NULL, *q = NULL;
- struct CryptKeyinfo *k_info = NULL;
+ struct CryptKeyInfo *k_info = NULL;
const char *fqdn = mutt_fqdn(1);
char buf[LONG_STRING];
int forced_valid;
#ifdef HAVE_GPGME_OP_EXPORT_KEYS
struct Body *pgp_gpgme_make_key_attachment(char *tempf)
{
- struct CryptKeyinfo *key = NULL;
+ struct CryptKeyInfo *key = NULL;
gpgme_ctx_t context = NULL;
gpgme_key_t export_keys[2];
gpgme_data_t keydata = NULL;
static int gpgme_send_menu(struct Header *msg, int is_smime)
{
- struct CryptKeyinfo *p = NULL;
+ struct CryptKeyInfo *p = NULL;
char input_signas[SHORT_STRING];
char *prompt = NULL, *letters = NULL, *choices = NULL;
int choice;
return NULL;
}
-struct PgpKeyInfo *pgp_get_candidates(pgp_ring_t keyring, struct List *hints)
+struct PgpKeyInfo *pgp_get_candidates(enum PgpRing keyring, struct List *hints)
{
FILE *fp = NULL;
pid_t thepid;
struct List;
-struct PgpKeyInfo * pgp_get_candidates(pgp_ring_t keyring, struct List *hints);
+struct PgpKeyInfo * pgp_get_candidates(enum PgpRing keyring, struct List *hints);
#endif /* _NCRYPT_GNUPGPARSE_H */
int cols, char op, const char *src,
const char *prefix, const char *ifstring,
const char *elsestring,
- unsigned long data, format_flag flags)
+ unsigned long data, enum FormatFlag flags)
{
char fmt[16];
struct PgpCommandContext *cctx = (struct PgpCommandContext *) data;
pid_t pgp_invoke_list_keys(FILE **pgpin, FILE **pgpout, FILE **pgperr,
int pgpinfd, int pgpoutfd, int pgperrfd,
- pgp_ring_t keyring, struct List *hints)
+ enum PgpRing keyring, struct List *hints)
{
char uids[HUGE_STRING];
char tmpuids[HUGE_STRING];
pid_t pgp_invoke_verify_key(FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd,
int pgpoutfd, int pgperrfd, const char *uids);
pid_t pgp_invoke_list_keys(FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd,
- int pgpoutfd, int pgperrfd, pgp_ring_t keyring, struct List *hints);
+ int pgpoutfd, int pgperrfd, enum PgpRing keyring, struct List *hints);
pid_t pgp_invoke_traditional(FILE **pgpin, FILE **pgpout, FILE **pgperr,
int pgpinfd, int pgpoutfd, int pgperrfd,
const char *fname, const char *uids, int flags);
static const char *pgp_entry_fmt(char *dest, size_t destlen, size_t col, int cols,
char op, const char *src, const char *prefix,
const char *ifstring, const char *elsestring,
- unsigned long data, format_flag flags)
+ unsigned long data, enum FormatFlag flags)
{
char fmt[16];
struct PgpEntry *entry = NULL;
return kp;
}
-struct PgpKeyInfo *pgp_ask_for_key(char *tag, char *whatfor, short abilities, pgp_ring_t keyring)
+struct PgpKeyInfo *pgp_ask_for_key(char *tag, char *whatfor, short abilities, enum PgpRing keyring)
{
struct PgpKeyInfo *key = NULL;
char resp[SHORT_STRING];
}
struct PgpKeyInfo *pgp_getkeybyaddr(struct Address *a, short abilities,
- pgp_ring_t keyring, int oppenc_mode)
+ enum PgpRing keyring, int oppenc_mode)
{
struct Address *r = NULL, *p = NULL;
struct List *hints = NULL;
return NULL;
}
-struct PgpKeyInfo *pgp_getkeybystr(char *p, short abilities, pgp_ring_t keyring)
+struct PgpKeyInfo *pgp_getkeybystr(char *p, short abilities, enum PgpRing keyring)
{
struct List *hints = NULL;
struct PgpKeyInfo *keys = NULL;
struct Body;
struct PgpKeyInfo;
-typedef enum pgp_ring {
+enum PgpRing {
PGP_PUBRING,
PGP_SECRING,
-} pgp_ring_t;
+};
struct Body *pgp_make_key_attachment(char *tempf);
-struct PgpKeyInfo * pgp_ask_for_key(char *tag, char *whatfor, short abilities, pgp_ring_t keyring);
-struct PgpKeyInfo * pgp_getkeybyaddr(struct Address *a, short abilities, pgp_ring_t keyring, int oppenc_mode);
-struct PgpKeyInfo * pgp_getkeybystr(char *p, short abilities, pgp_ring_t keyring);
+struct PgpKeyInfo * pgp_ask_for_key(char *tag, char *whatfor, short abilities, enum PgpRing keyring);
+struct PgpKeyInfo * pgp_getkeybyaddr(struct Address *a, short abilities, enum PgpRing keyring, int oppenc_mode);
+struct PgpKeyInfo * pgp_getkeybystr(char *p, short abilities, enum PgpRing keyring);
#endif /* _NCRYPT_PGPKEY_H */
#include <stdio.h>
-enum packet_tags
+enum PacketTags
{
PT_RES0 = 0, /* reserved */
PT_ESK, /* Encrypted Session Key */
int cols, char op, const char *src,
const char *prefix, const char *ifstring,
const char *elsestring,
- unsigned long data, format_flag flags)
+ unsigned long data, enum FormatFlag flags)
{
char fmt[16];
struct SmimeCommandContext *cctx = (struct SmimeCommandContext *) data;
anum_t first, last;
nntp_data->unread = 0;
- if (nntp_data->lastMessage == 0 || nntp_data->firstMessage > nntp_data->lastMessage)
+ if (nntp_data->last_message == 0 || nntp_data->first_message > nntp_data->last_message)
return;
- nntp_data->unread = nntp_data->lastMessage - nntp_data->firstMessage + 1;
+ nntp_data->unread = nntp_data->last_message - nntp_data->first_message + 1;
for (unsigned int i = 0; i < nntp_data->newsrc_len; i++)
{
first = nntp_data->newsrc_ent[i].first;
- if (first < nntp_data->firstMessage)
- first = nntp_data->firstMessage;
+ if (first < nntp_data->first_message)
+ first = nntp_data->first_message;
last = nntp_data->newsrc_ent[i].last;
- if (last > nntp_data->lastMessage)
- last = nntp_data->lastMessage;
+ if (last > nntp_data->last_message)
+ last = nntp_data->last_message;
if (first <= last)
nntp_data->unread -= last - first + 1;
}
nntp_data->newsrc_ent[j].last = 0;
j++;
}
- if (nntp_data->lastMessage == 0)
- nntp_data->lastMessage = nntp_data->newsrc_ent[j - 1].last;
+ if (nntp_data->last_message == 0)
+ nntp_data->last_message = nntp_data->newsrc_ent[j - 1].last;
nntp_data->newsrc_len = j;
safe_realloc(&nntp_data->newsrc_ent, j * sizeof(struct NewsrcEntry));
nntp_group_unread_stat(nntp_data);
/* We don't actually check sequential order, since we mark
* "missing" entries as read/deleted */
last = NHDR(ctx->hdrs[i])->article_num;
- if (last >= nntp_data->firstMessage && !ctx->hdrs[i]->deleted &&
+ if (last >= nntp_data->first_message && !ctx->hdrs[i]->deleted &&
!ctx->hdrs[i]->read)
{
if (nntp_data->newsrc_len >= entries)
}
}
- if (series && first <= nntp_data->lastLoaded)
+ if (series && first <= nntp_data->last_loaded)
{
if (nntp_data->newsrc_len >= entries)
{
safe_realloc(&nntp_data->newsrc_ent, entries * sizeof(struct NewsrcEntry));
}
nntp_data->newsrc_ent[nntp_data->newsrc_len].first = first;
- nntp_data->newsrc_ent[nntp_data->newsrc_len].last = nntp_data->lastLoaded;
+ nntp_data->newsrc_ent[nntp_data->newsrc_len].last = nntp_data->last_loaded;
nntp_data->newsrc_len++;
}
safe_realloc(&nntp_data->newsrc_ent, nntp_data->newsrc_len * sizeof(struct NewsrcEntry));
nntp_data = nntp_data_find(nserv, group);
nntp_data->deleted = false;
- nntp_data->firstMessage = first;
- nntp_data->lastMessage = last;
+ nntp_data->first_message = first;
+ nntp_data->last_message = last;
nntp_data->allowed = (mod == 'y') || (mod == 'm');
mutt_str_replace(&nntp_data->desc, desc);
- if (nntp_data->newsrc_ent || nntp_data->lastCached)
+ if (nntp_data->newsrc_ent || nntp_data->last_cached)
nntp_group_unread_stat(nntp_data);
- else if (nntp_data->lastMessage && nntp_data->firstMessage <= nntp_data->lastMessage)
- nntp_data->unread = nntp_data->lastMessage - nntp_data->firstMessage + 1;
+ else if (nntp_data->last_message && nntp_data->first_message <= nntp_data->last_message)
+ nntp_data->unread = nntp_data->last_message - nntp_data->first_message + 1;
else
nntp_data->unread = 0;
return 0;
safe_realloc(&buf, buflen);
}
snprintf(buf + off, buflen - off, "%s %d %d %c%s%s\n", nntp_data->group,
- nntp_data->lastMessage, nntp_data->firstMessage,
+ nntp_data->last_message, nntp_data->first_message,
nntp_data->allowed ? 'y' : 'n', nntp_data->desc ? " " : "",
nntp_data->desc ? nntp_data->desc : "");
off += strlen(buf + off);
if (sscanf(hdata, ANUM " " ANUM, &first, &last) == 2)
{
old = true;
- nntp_data->lastCached = last;
+ nntp_data->last_cached = last;
/* clean removed headers from cache */
for (current = first; current <= last; current++)
{
- if (current >= nntp_data->firstMessage && current <= nntp_data->lastMessage)
+ if (current >= nntp_data->first_message && current <= nntp_data->last_message)
continue;
snprintf(buf, sizeof(buf), "%d", current);
}
/* store current values of first and last */
- if (!old || nntp_data->firstMessage != first || nntp_data->lastMessage != last)
+ if (!old || nntp_data->first_message != first || nntp_data->last_message != last)
{
- snprintf(buf, sizeof(buf), "%u %u", nntp_data->firstMessage, nntp_data->lastMessage);
+ snprintf(buf, sizeof(buf), "%u %u", nntp_data->first_message, nntp_data->last_message);
mutt_debug(2, "nntp_hcache_update: mutt_hcache_store index: %s\n", buf);
mutt_hcache_store_raw(hc, "index", 5, buf, strlen(buf));
}
char c;
if (!nntp_data || sscanf(id, ANUM "%c", &anum, &c) != 1 ||
- anum < nntp_data->firstMessage || anum > nntp_data->lastMessage)
+ anum < nntp_data->first_message || anum > nntp_data->last_message)
{
if (nntp_data)
mutt_debug(2, "nntp_bcache_delete: mutt_bcache_del %s\n", id);
nntp_hcache_namer(nntp_data->group, file, sizeof(file));
cache_expand(file, sizeof(file), &nntp_data->nserv->conn->account, file);
unlink(file);
- nntp_data->lastCached = 0;
+ nntp_data->last_cached = 0;
mutt_debug(2, "nntp_delete_group_cache: %s\n", file);
#endif
* %u = username */
const char *nntp_format_str(char *dest, size_t destlen, size_t col, int cols, char op,
const char *src, const char *fmt, const char *ifstring,
- const char *elsestring, unsigned long data, format_flag flags)
+ const char *elsestring, unsigned long data, enum FormatFlag flags)
{
struct NntpServer *nserv = (struct NntpServer *) data;
struct Account *acct = &nserv->conn->account;
{
if (nntp_data->deleted)
{
- nntp_data->firstMessage = first;
- nntp_data->lastMessage = last;
+ nntp_data->first_message = first;
+ nntp_data->last_message = last;
}
- if (last >= nntp_data->firstMessage && last <= nntp_data->lastMessage)
+ if (last >= nntp_data->first_message && last <= nntp_data->last_message)
{
- nntp_data->lastCached = last;
- mutt_debug(2, "nntp_select_server: %s lastCached=%u\n", nntp_data->group, last);
+ nntp_data->last_cached = last;
+ mutt_debug(2, "nntp_select_server: %s last_cached=%u\n", nntp_data->group, last);
}
}
mutt_hcache_free(hc, &hdata);
}
/* article was not cached yet, it's new */
- if (anum > nntp_data->lastCached)
+ if (anum > nntp_data->last_cached)
return;
/* article isn't read but cached, it's old */
safe_realloc(&nntp_data->newsrc_ent, sizeof(struct NewsrcEntry));
nntp_data->newsrc_len = 1;
nntp_data->newsrc_ent[0].first = 1;
- nntp_data->newsrc_ent[0].last = nntp_data->lastMessage;
+ nntp_data->newsrc_ent[0].last = nntp_data->last_message;
}
nntp_data->unread = 0;
if (Context && Context->data == nntp_data)
safe_realloc(&nntp_data->newsrc_ent, sizeof(struct NewsrcEntry));
nntp_data->newsrc_len = 1;
nntp_data->newsrc_ent[0].first = 1;
- nntp_data->newsrc_ent[0].last = nntp_data->firstMessage - 1;
+ nntp_data->newsrc_ent[0].last = nntp_data->first_message - 1;
}
if (Context && Context->data == nntp_data)
{
}
else
{
- nntp_data->unread = nntp_data->lastMessage;
+ nntp_data->unread = nntp_data->last_message;
if (nntp_data->newsrc_ent)
nntp_data->unread -= nntp_data->newsrc_ent[0].last;
}
if (!hdr->read)
nntp_parse_xref(ctx, hdr);
}
- if (anum > nntp_data->lastLoaded)
- nntp_data->lastLoaded = anum;
+ if (anum > nntp_data->last_loaded)
+ nntp_data->last_loaded = anum;
}
else
mutt_free_header(&hdr);
if (!hdr->read)
nntp_parse_xref(ctx, hdr);
}
- if (current > nntp_data->lastLoaded)
- nntp_data->lastLoaded = current;
+ if (current > nntp_data->last_loaded)
+ nntp_data->last_loaded = current;
first_over = current + 1;
}
mutt_sleep(2);
return -1;
}
- nntp_data->firstMessage = first;
- nntp_data->lastMessage = last;
+ nntp_data->first_message = first;
+ nntp_data->last_message = last;
nntp_data->deleted = false;
/* get description if empty */
nntp_data->bcache = mutt_bcache_open(&nserv->conn->account, nntp_data->group);
/* strip off extra articles if adding context is greater than $nntp_context */
- first = nntp_data->firstMessage;
- if (NntpContext && nntp_data->lastMessage - first + 1 > NntpContext)
- first = nntp_data->lastMessage - NntpContext + 1;
- nntp_data->lastLoaded = first ? first - 1 : 0;
- count = nntp_data->firstMessage;
- nntp_data->firstMessage = first;
+ first = nntp_data->first_message;
+ if (NntpContext && nntp_data->last_message - first + 1 > NntpContext)
+ first = nntp_data->last_message - NntpContext + 1;
+ nntp_data->last_loaded = first ? first - 1 : 0;
+ count = nntp_data->first_message;
+ nntp_data->first_message = first;
nntp_bcache_update(nntp_data);
- nntp_data->firstMessage = count;
+ nntp_data->first_message = count;
#ifdef USE_HCACHE
hc = nntp_hcache_open(nntp_data);
nntp_hcache_update(nntp_data, hc);
mutt_bit_unset(ctx->rights, MUTT_ACL_DELETE);
}
nntp_newsrc_close(nserv);
- rc = nntp_fetch_headers(ctx, hc, first, nntp_data->lastMessage, 0);
+ rc = nntp_fetch_headers(ctx, hc, first, nntp_data->last_message, 0);
#ifdef USE_HCACHE
mutt_hcache_close(hc);
#endif
if (rc < 0)
return -1;
- nntp_data->lastLoaded = nntp_data->lastMessage;
+ nntp_data->last_loaded = nntp_data->last_message;
nserv->newsrc_modified = false;
return 0;
}
return -1;
if (sscanf(buf, "211 " ANUM " " ANUM " " ANUM, &count, &first, &last) != 3)
return 0;
- if (first == nntp_data->firstMessage && last == nntp_data->lastMessage)
+ if (first == nntp_data->first_message && last == nntp_data->last_message)
return 0;
/* articles have been renumbered */
- if (last < nntp_data->lastMessage)
+ if (last < nntp_data->last_message)
{
- nntp_data->lastCached = 0;
+ nntp_data->last_cached = 0;
if (nntp_data->newsrc_len)
{
safe_realloc(&nntp_data->newsrc_ent, sizeof(struct NewsrcEntry));
nntp_data->newsrc_ent[0].last = 0;
}
}
- nntp_data->firstMessage = first;
- nntp_data->lastMessage = last;
+ nntp_data->first_message = first;
+ nntp_data->last_message = last;
if (!update_stat)
return 1;
/* update counters */
- else if (!last || (!nntp_data->newsrc_ent && !nntp_data->lastCached))
+ else if (!last || (!nntp_data->newsrc_ent && !nntp_data->last_cached))
nntp_data->unread = count;
else
nntp_group_unread_stat(nntp_data);
nntp_active_save_cache(nserv);
/* articles have been renumbered, remove all headers */
- if (nntp_data->lastMessage < nntp_data->lastLoaded)
+ if (nntp_data->last_message < nntp_data->last_loaded)
{
for (i = 0; i < ctx->msgcount; i++)
mutt_free_header(&ctx->hdrs[i]);
ctx->msgcount = 0;
ctx->tagged = 0;
- if (nntp_data->lastMessage < nntp_data->lastLoaded)
+ if (nntp_data->last_message < nntp_data->last_loaded)
{
- nntp_data->lastLoaded = nntp_data->firstMessage - 1;
- if (NntpContext && nntp_data->lastMessage - nntp_data->lastLoaded > NntpContext)
- nntp_data->lastLoaded = nntp_data->lastMessage - NntpContext;
+ nntp_data->last_loaded = nntp_data->first_message - 1;
+ if (NntpContext && nntp_data->last_message - nntp_data->last_loaded > NntpContext)
+ nntp_data->last_loaded = nntp_data->last_message - NntpContext;
}
ret = MUTT_REOPENED;
}
char buf[16];
void *hdata = NULL;
struct Header *hdr = NULL;
- anum_t first = nntp_data->firstMessage;
+ anum_t first = nntp_data->first_message;
- if (NntpContext && nntp_data->lastMessage - first + 1 > NntpContext)
- first = nntp_data->lastMessage - NntpContext + 1;
- messages = safe_calloc(nntp_data->lastLoaded - first + 1, sizeof(unsigned char));
+ if (NntpContext && nntp_data->last_message - first + 1 > NntpContext)
+ first = nntp_data->last_message - NntpContext + 1;
+ messages = safe_calloc(nntp_data->last_loaded - first + 1, sizeof(unsigned char));
hc = nntp_hcache_open(nntp_data);
nntp_hcache_update(nntp_data, hc);
#endif
/* check hcache for flagged and deleted flags */
if (hc)
{
- if (anum >= first && anum <= nntp_data->lastLoaded)
+ if (anum >= first && anum <= nntp_data->last_loaded)
messages[anum - first] = 1;
snprintf(buf, sizeof(buf), "%d", anum);
ctx->msgcount = j;
/* restore headers without "deleted" flag */
- for (anum = first; anum <= nntp_data->lastLoaded; anum++)
+ for (anum = first; anum <= nntp_data->last_loaded; anum++)
{
if (messages[anum - first])
continue;
}
/* fetch headers of new articles */
- if (nntp_data->lastMessage > nntp_data->lastLoaded)
+ if (nntp_data->last_message > nntp_data->last_loaded)
{
int oldmsgcount = ctx->msgcount;
bool quiet = ctx->quiet;
nntp_hcache_update(nntp_data, hc);
}
#endif
- rc = nntp_fetch_headers(ctx, hc, nntp_data->lastLoaded + 1, nntp_data->lastMessage, 0);
+ rc = nntp_fetch_headers(ctx, hc, nntp_data->last_loaded + 1, nntp_data->last_message, 0);
ctx->quiet = quiet;
if (rc >= 0)
- nntp_data->lastLoaded = nntp_data->lastMessage;
+ nntp_data->last_loaded = nntp_data->last_message;
if (ret == 0 && ctx->msgcount > oldmsgcount)
ret = MUTT_NEW_MAIL;
}
return rc;
#ifdef USE_HCACHE
- nntp_data->lastCached = 0;
+ nntp_data->last_cached = 0;
hc = nntp_hcache_open(nntp_data);
#endif
if (hc)
{
mutt_hcache_close(hc);
- nntp_data->lastCached = nntp_data->lastLoaded;
+ nntp_data->last_cached = nntp_data->last_loaded;
}
#endif
if (!nntp_data || !nntp_data->nserv)
return -1;
- if (nntp_data->firstMessage > nntp_data->lastLoaded)
+ if (nntp_data->first_message > nntp_data->last_loaded)
return 0;
/* init context */
/* fetch numbers of child messages */
snprintf(buf, sizeof(buf), "XPAT References %d-%d *%s*\r\n",
- nntp_data->firstMessage, nntp_data->lastLoaded, msgid);
+ nntp_data->first_message, nntp_data->last_loaded, msgid);
rc = nntp_fetch_lines(nntp_data, buf, sizeof(buf), NULL, fetch_children, &cc);
if (rc)
{
{
char *group;
char *desc;
- anum_t firstMessage;
- anum_t lastMessage;
- anum_t lastLoaded;
- anum_t lastCached;
+ anum_t first_message;
+ anum_t last_message;
+ anum_t last_loaded;
+ anum_t last_cached;
anum_t unread;
bool subscribed : 1;
bool new : 1;
const char *nntp_format_str(char *dest, size_t destlen, size_t col, int cols,
char op, const char *src, const char *fmt,
const char *ifstring, const char *elsestring,
- unsigned long data, format_flag flags);
+ unsigned long data, enum FormatFlag flags);
struct NntpServer *CurrentNewsSrv INITVAL(NULL);
static struct Resize
{
int line;
- int SearchCompiled;
- int SearchBack;
+ int search_compiled;
+ int search_back;
} *Resize = NULL;
#endif
return 0;
}
-static void resolve_color(struct Line *lineInfo, int n, int cnt, int flags,
+static void resolve_color(struct Line *line_info, int n, int cnt, int flags,
int special, struct AnsiAttr *a)
{
int def_color; /* color without syntax highlight */
if (!cnt)
last_color = -1; /* force attrset() */
- if (lineInfo[n].continuation)
+ if (line_info[n].continuation)
{
if (!cnt && option(OPTMARKERS))
{
addch('+');
last_color = ColorDefs[MT_COLOR_MARKERS];
}
- m = (lineInfo[n].syntax)[0].first;
- cnt += (lineInfo[n].syntax)[0].last;
+ m = (line_info[n].syntax)[0].first;
+ cnt += (line_info[n].syntax)[0].last;
}
else
m = n;
if (!(flags & MUTT_SHOWCOLOR))
def_color = ColorDefs[MT_COLOR_NORMAL];
- else if (lineInfo[m].type == MT_COLOR_HEADER)
- def_color = (lineInfo[m].syntax)[0].color;
+ else if (line_info[m].type == MT_COLOR_HEADER)
+ def_color = (line_info[m].syntax)[0].color;
else
- def_color = ColorDefs[lineInfo[m].type];
+ def_color = ColorDefs[line_info[m].type];
- if ((flags & MUTT_SHOWCOLOR) && lineInfo[m].type == MT_COLOR_QUOTED)
+ if ((flags & MUTT_SHOWCOLOR) && line_info[m].type == MT_COLOR_QUOTED)
{
- struct QClass *class = lineInfo[m].quote;
+ struct QClass *class = line_info[m].quote;
if (class)
{
color = def_color;
if (flags & MUTT_SHOWCOLOR)
{
- for (i = 0; i < lineInfo[m].chunks; i++)
+ for (i = 0; i < line_info[m].chunks; i++)
{
/* we assume the chunks are sorted */
- if (cnt > (lineInfo[m].syntax)[i].last)
+ if (cnt > (line_info[m].syntax)[i].last)
continue;
- if (cnt < (lineInfo[m].syntax)[i].first)
+ if (cnt < (line_info[m].syntax)[i].first)
break;
- if (cnt != (lineInfo[m].syntax)[i].last)
+ if (cnt != (line_info[m].syntax)[i].last)
{
- color = (lineInfo[m].syntax)[i].color;
+ color = (line_info[m].syntax)[i].color;
break;
}
/* don't break here, as cnt might be
if (flags & MUTT_SEARCH)
{
- for (i = 0; i < lineInfo[m].search_cnt; i++)
+ for (i = 0; i < line_info[m].search_cnt; i++)
{
- if (cnt > (lineInfo[m].search)[i].last)
+ if (cnt > (line_info[m].search)[i].last)
continue;
- if (cnt < (lineInfo[m].search)[i].first)
+ if (cnt < (line_info[m].search)[i].first)
break;
- if (cnt != (lineInfo[m].search)[i].last)
+ if (cnt != (line_info[m].search)[i].last)
{
color = ColorDefs[MT_COLOR_SEARCH];
search = true;
}
}
-static void append_line(struct Line *lineInfo, int n, int cnt)
+static void append_line(struct Line *line_info, int n, int cnt)
{
int m;
- lineInfo[n + 1].type = lineInfo[n].type;
- (lineInfo[n + 1].syntax)[0].color = (lineInfo[n].syntax)[0].color;
- lineInfo[n + 1].continuation = 1;
+ line_info[n + 1].type = line_info[n].type;
+ (line_info[n + 1].syntax)[0].color = (line_info[n].syntax)[0].color;
+ line_info[n + 1].continuation = 1;
/* find the real start of the line */
for (m = n; m >= 0; m--)
- if (lineInfo[m].continuation == 0)
+ if (line_info[m].continuation == 0)
break;
- (lineInfo[n + 1].syntax)[0].first = m;
- (lineInfo[n + 1].syntax)[0].last =
- (lineInfo[n].continuation) ? cnt + (lineInfo[n].syntax)[0].last : cnt;
+ (line_info[n + 1].syntax)[0].first = m;
+ (line_info[n + 1].syntax)[0].last =
+ (line_info[n].continuation) ? cnt + (line_info[n].syntax)[0].last : cnt;
}
static void new_class_color(struct QClass *class, int *q_level)
class->color = ColorQuote[class->index % ColorQuoteUsed];
}
-static void shift_class_colors(struct QClass *QuoteList,
+static void shift_class_colors(struct QClass *quote_list,
struct QClass *new_class, int index, int *q_level)
{
struct QClass *q_list = NULL;
- q_list = QuoteList;
+ q_list = quote_list;
new_class->index = -1;
while (q_list)
(*q_level)++;
}
-static void cleanup_quote(struct QClass **QuoteList)
+static void cleanup_quote(struct QClass **quote_list)
{
struct QClass *ptr = NULL;
- while (*QuoteList)
+ while (*quote_list)
{
- if ((*QuoteList)->down)
- cleanup_quote(&((*QuoteList)->down));
- ptr = (*QuoteList)->next;
- if ((*QuoteList)->prefix)
- FREE(&(*QuoteList)->prefix);
- FREE(QuoteList);
- *QuoteList = ptr;
+ if ((*quote_list)->down)
+ cleanup_quote(&((*quote_list)->down));
+ ptr = (*quote_list)->next;
+ if ((*quote_list)->prefix)
+ FREE(&(*quote_list)->prefix);
+ FREE(quote_list);
+ *quote_list = ptr;
}
return;
}
-static struct QClass *classify_quote(struct QClass **QuoteList, const char *qptr,
+static struct QClass *classify_quote(struct QClass **quote_list, const char *qptr,
int length, int *force_redraw, int *q_level)
{
- struct QClass *q_list = *QuoteList;
+ struct QClass *q_list = *quote_list;
struct QClass *class = NULL, *tmp = NULL, *ptr = NULL, *save = NULL;
char *tail_qptr = NULL;
int offset, tail_lng;
{
/* not much point in classifying quotes... */
- if (*QuoteList == NULL)
+ if (*quote_list == NULL)
{
class = safe_calloc(1, sizeof(struct QClass));
class->color = ColorQuote[0];
- *QuoteList = class;
+ *quote_list = class;
}
- return *QuoteList;
+ return *quote_list;
}
/* Did I mention how much I like emulating Lisp in C? */
q_list->prev = NULL;
/* update the root if necessary */
- if (q_list == *QuoteList)
- *QuoteList = tmp;
+ if (q_list == *quote_list)
+ *quote_list = tmp;
index = q_list->index;
else
{
if (index != -1)
- shift_class_colors(*QuoteList, tmp, index, q_level);
+ shift_class_colors(*quote_list, tmp, index, q_level);
return class;
}
class->length = length;
new_class_color(class, q_level);
- if (*QuoteList)
+ if (*quote_list)
{
- class->next = *QuoteList;
- (*QuoteList)->prev = class;
+ class->next = *quote_list;
+ (*quote_list)->prev = class;
}
- *QuoteList = class;
+ *quote_list = class;
}
if (index != -1)
- shift_class_colors(*QuoteList, tmp, index, q_level);
+ shift_class_colors(*quote_list, tmp, index, q_level);
return class;
}
return (int) (*p - *q);
}
-static void resolve_types(char *buf, char *raw, struct Line *lineInfo, int n,
- int last, struct QClass **QuoteList, int *q_level,
+static void resolve_types(char *buf, char *raw, struct Line *line_info, int n,
+ int last, struct QClass **quote_list, int *q_level,
int *force_redraw, int q_classify)
{
struct ColorLine *color_line = NULL;
bool null_rx;
int offset, i;
- if (n == 0 || ISHEADER(lineInfo[n - 1].type))
+ if (n == 0 || ISHEADER(line_info[n - 1].type))
{
if (buf[0] == '\n') /* end of header */
{
- lineInfo[n].type = MT_COLOR_NORMAL;
+ line_info[n].type = MT_COLOR_NORMAL;
getyx(stdscr, brailleLine, brailleCol);
}
else
* line's color as default. */
if (n > 0 && (buf[0] == ' ' || buf[0] == '\t'))
{
- lineInfo[n].type = lineInfo[n - 1].type; /* wrapped line */
+ line_info[n].type = line_info[n - 1].type; /* wrapped line */
if (!option(OPTHEADERCOLORPARTIAL))
{
- (lineInfo[n].syntax)[0].color = (lineInfo[n - 1].syntax)[0].color;
- lineInfo[n].is_cont_hdr = 1;
+ (line_info[n].syntax)[0].color = (line_info[n - 1].syntax)[0].color;
+ line_info[n].is_cont_hdr = 1;
}
}
else
{
- lineInfo[n].type = MT_COLOR_HDEFAULT;
+ line_info[n].type = MT_COLOR_HDEFAULT;
}
/* When this option is unset, we color the entire header the
{
if (REGEXEC(color_line->rx, buf) == 0)
{
- lineInfo[n].type = MT_COLOR_HEADER;
- lineInfo[n].syntax[0].color = color_line->pair;
- if (lineInfo[n].is_cont_hdr)
+ line_info[n].type = MT_COLOR_HEADER;
+ line_info[n].syntax[0].color = color_line->pair;
+ if (line_info[n].is_cont_hdr)
{
/* adjust the previous continuation lines to reflect the color of this continuation line */
int j;
- for (j = n - 1; j >= 0 && lineInfo[j].is_cont_hdr; --j)
+ for (j = n - 1; j >= 0 && line_info[j].is_cont_hdr; --j)
{
- lineInfo[j].type = lineInfo[n].type;
- lineInfo[j].syntax[0].color = lineInfo[n].syntax[0].color;
+ line_info[j].type = line_info[n].type;
+ line_info[j].syntax[0].color = line_info[n].syntax[0].color;
}
/* now adjust the first line of this header field */
if (j >= 0)
{
- lineInfo[j].type = lineInfo[n].type;
- lineInfo[j].syntax[0].color = lineInfo[n].syntax[0].color;
+ line_info[j].type = line_info[n].type;
+ line_info[j].syntax[0].color = line_info[n].syntax[0].color;
}
*force_redraw = 1; /* the previous lines have already been drawn on the screen */
}
}
}
else if (mutt_strncmp("\033[0m", raw, 4) == 0) /* a little hack... */
- lineInfo[n].type = MT_COLOR_NORMAL;
+ line_info[n].type = MT_COLOR_NORMAL;
else if (check_attachment_marker((char *) raw) == 0)
- lineInfo[n].type = MT_COLOR_ATTACHMENT;
+ line_info[n].type = MT_COLOR_ATTACHMENT;
else if ((mutt_strcmp("-- \n", buf) == 0) || (mutt_strcmp("-- \r\n", buf) == 0))
{
i = n + 1;
- lineInfo[n].type = MT_COLOR_SIGNATURE;
- while (i < last && check_sig(buf, lineInfo, i - 1) == 0 &&
- (lineInfo[i].type == MT_COLOR_NORMAL || lineInfo[i].type == MT_COLOR_QUOTED ||
- lineInfo[i].type == MT_COLOR_HEADER))
+ line_info[n].type = MT_COLOR_SIGNATURE;
+ while (i < last && check_sig(buf, line_info, i - 1) == 0 &&
+ (line_info[i].type == MT_COLOR_NORMAL || line_info[i].type == MT_COLOR_QUOTED ||
+ line_info[i].type == MT_COLOR_HEADER))
{
/* oops... */
- if (lineInfo[i].chunks)
+ if (line_info[i].chunks)
{
- lineInfo[i].chunks = 0;
- safe_realloc(&(lineInfo[n].syntax), sizeof(struct Syntax));
+ line_info[i].chunks = 0;
+ safe_realloc(&(line_info[n].syntax), sizeof(struct Syntax));
}
- lineInfo[i++].type = MT_COLOR_SIGNATURE;
+ line_info[i++].type = MT_COLOR_SIGNATURE;
}
}
- else if (check_sig(buf, lineInfo, n - 1) == 0)
- lineInfo[n].type = MT_COLOR_SIGNATURE;
+ else if (check_sig(buf, line_info, n - 1) == 0)
+ line_info[n].type = MT_COLOR_SIGNATURE;
else if (regexec((regex_t *) QuoteRegexp.rx, buf, 1, pmatch, 0) == 0)
{
if (regexec((regex_t *) Smileys.rx, buf, 1, smatch, 0) == 0)
if (regexec((regex_t *) QuoteRegexp.rx, buf, 1, pmatch, 0) == 0)
{
- if (q_classify && lineInfo[n].quote == NULL)
- lineInfo[n].quote = classify_quote(QuoteList, buf + pmatch[0].rm_so,
+ if (q_classify && line_info[n].quote == NULL)
+ line_info[n].quote = classify_quote(quote_list, buf + pmatch[0].rm_so,
pmatch[0].rm_eo - pmatch[0].rm_so,
force_redraw, q_level);
- lineInfo[n].type = MT_COLOR_QUOTED;
+ line_info[n].type = MT_COLOR_QUOTED;
}
else
- lineInfo[n].type = MT_COLOR_NORMAL;
+ line_info[n].type = MT_COLOR_NORMAL;
buf[smatch[0].rm_so] = c;
}
else
- lineInfo[n].type = MT_COLOR_NORMAL;
+ line_info[n].type = MT_COLOR_NORMAL;
}
else
{
- if (q_classify && lineInfo[n].quote == NULL)
- lineInfo[n].quote = classify_quote(QuoteList, buf + pmatch[0].rm_so,
+ if (q_classify && line_info[n].quote == NULL)
+ line_info[n].quote = classify_quote(quote_list, buf + pmatch[0].rm_so,
pmatch[0].rm_eo - pmatch[0].rm_so,
force_redraw, q_level);
- lineInfo[n].type = MT_COLOR_QUOTED;
+ line_info[n].type = MT_COLOR_QUOTED;
}
}
else
- lineInfo[n].type = MT_COLOR_NORMAL;
+ line_info[n].type = MT_COLOR_NORMAL;
/* body patterns */
- if (lineInfo[n].type == MT_COLOR_NORMAL || lineInfo[n].type == MT_COLOR_QUOTED ||
- (lineInfo[n].type == MT_COLOR_HDEFAULT && option(OPTHEADERCOLORPARTIAL)))
+ if (line_info[n].type == MT_COLOR_NORMAL || line_info[n].type == MT_COLOR_QUOTED ||
+ (line_info[n].type == MT_COLOR_HDEFAULT && option(OPTHEADERCOLORPARTIAL)))
{
size_t nl;
i = 0;
offset = 0;
- lineInfo[n].chunks = 0;
+ line_info[n].chunks = 0;
do
{
if (!buf[offset])
found = false;
null_rx = false;
- if (lineInfo[n].type == MT_COLOR_HDEFAULT)
+ if (line_info[n].type == MT_COLOR_HDEFAULT)
color_line = ColorHdrList;
else
color_line = ColorBodyList;
{
/* Abort if we fill up chunks.
* Yes, this really happened. See #3888 */
- if (lineInfo[n].chunks == SHRT_MAX)
+ if (line_info[n].chunks == SHRT_MAX)
{
null_rx = false;
break;
}
- if (++(lineInfo[n].chunks) > 1)
- safe_realloc(&(lineInfo[n].syntax),
- (lineInfo[n].chunks) * sizeof(struct Syntax));
+ if (++(line_info[n].chunks) > 1)
+ safe_realloc(&(line_info[n].syntax),
+ (line_info[n].chunks) * sizeof(struct Syntax));
}
- i = lineInfo[n].chunks - 1;
+ i = line_info[n].chunks - 1;
pmatch[0].rm_so += offset;
pmatch[0].rm_eo += offset;
- if (!found || pmatch[0].rm_so < (lineInfo[n].syntax)[i].first ||
- (pmatch[0].rm_so == (lineInfo[n].syntax)[i].first &&
- pmatch[0].rm_eo > (lineInfo[n].syntax)[i].last))
+ if (!found || pmatch[0].rm_so < (line_info[n].syntax)[i].first ||
+ (pmatch[0].rm_so == (line_info[n].syntax)[i].first &&
+ pmatch[0].rm_eo > (line_info[n].syntax)[i].last))
{
- (lineInfo[n].syntax)[i].color = color_line->pair;
- (lineInfo[n].syntax)[i].first = pmatch[0].rm_so;
- (lineInfo[n].syntax)[i].last = pmatch[0].rm_eo;
+ (line_info[n].syntax)[i].color = color_line->pair;
+ (line_info[n].syntax)[i].first = pmatch[0].rm_so;
+ (line_info[n].syntax)[i].last = pmatch[0].rm_eo;
}
found = true;
null_rx = false;
if (null_rx)
offset++; /* avoid degenerate cases */
else
- offset = (lineInfo[n].syntax)[i].last;
+ offset = (line_info[n].syntax)[i].last;
} while (found || null_rx);
if (nl > 0)
buf[nl] = '\n';
}
/* attachment patterns */
- if (lineInfo[n].type == MT_COLOR_ATTACHMENT)
+ if (line_info[n].type == MT_COLOR_ATTACHMENT)
{
size_t nl;
i = 0;
offset = 0;
- lineInfo[n].chunks = 0;
+ line_info[n].chunks = 0;
do
{
if (!buf[offset])
{
if (!found)
{
- if (++(lineInfo[n].chunks) > 1)
- safe_realloc(&(lineInfo[n].syntax),
- (lineInfo[n].chunks) * sizeof(struct Syntax));
+ if (++(line_info[n].chunks) > 1)
+ safe_realloc(&(line_info[n].syntax),
+ (line_info[n].chunks) * sizeof(struct Syntax));
}
- i = lineInfo[n].chunks - 1;
+ i = line_info[n].chunks - 1;
pmatch[0].rm_so += offset;
pmatch[0].rm_eo += offset;
- if (!found || pmatch[0].rm_so < (lineInfo[n].syntax)[i].first ||
- (pmatch[0].rm_so == (lineInfo[n].syntax)[i].first &&
- pmatch[0].rm_eo > (lineInfo[n].syntax)[i].last))
+ if (!found || pmatch[0].rm_so < (line_info[n].syntax)[i].first ||
+ (pmatch[0].rm_so == (line_info[n].syntax)[i].first &&
+ pmatch[0].rm_eo > (line_info[n].syntax)[i].last))
{
- (lineInfo[n].syntax)[i].color = color_line->pair;
- (lineInfo[n].syntax)[i].first = pmatch[0].rm_so;
- (lineInfo[n].syntax)[i].last = pmatch[0].rm_eo;
+ (line_info[n].syntax)[i].color = color_line->pair;
+ (line_info[n].syntax)[i].first = pmatch[0].rm_so;
+ (line_info[n].syntax)[i].last = pmatch[0].rm_eo;
}
found = 1;
null_rx = 0;
if (null_rx)
offset++; /* avoid degenerate cases */
else
- offset = (lineInfo[n].syntax)[i].last;
+ offset = (line_info[n].syntax)[i].last;
} while (found || null_rx);
if (nl > 0)
buf[nl] = '\n';
return b_read;
}
-static int format_line(struct Line **lineInfo, int n, unsigned char *buf, int flags,
+static int format_line(struct Line **line_info, int n, unsigned char *buf, int flags,
struct AnsiAttr *pa, int cnt, int *pspace, int *pvch,
int *pcol, int *pspecial, struct MuttWindow *pager_window)
{
int space = -1; /* index of the last space or TAB */
- int col = option(OPTMARKERS) ? (*lineInfo)[n].continuation : 0;
+ int col = option(OPTMARKERS) ? (*line_info)[n].continuation : 0;
size_t k;
int ch, vch, last_special = -1, special = 0, t;
wchar_t wc;
if (check_attachment_marker((char *) buf) == 0)
wrap_cols = pager_window->cols;
- /* FIXME: this should come from lineInfo */
+ /* FIXME: this should come from line_info */
memset(&mbstate, 0, sizeof(mbstate));
for (ch = 0, vch = 0; ch < cnt; ch += k, vch += k)
if (pa && ((flags & (MUTT_SHOWCOLOR | MUTT_SEARCH | MUTT_PAGER_MARKER)) ||
special || last_special || pa->attr))
{
- resolve_color(*lineInfo, n, vch, flags, special, pa);
+ resolve_color(*line_info, n, vch, flags, special, pa);
last_special = special;
}
* 0 normal exit, line was not displayed
* >0 normal exit, line was displayed
*/
-static int display_line(FILE *f, LOFF_T *last_pos, struct Line **lineInfo, int n,
- int *last, int *max, int flags, struct QClass **QuoteList,
- int *q_level, int *force_redraw, regex_t *SearchRE,
+static int display_line(FILE *f, LOFF_T *last_pos, struct Line **line_info, int n,
+ int *last, int *max, int flags, struct QClass **quote_list,
+ int *q_level, int *force_redraw, regex_t *search_re,
struct MuttWindow *pager_window)
{
unsigned char *buf = NULL, *fmt = NULL;
if (*last == *max)
{
- safe_realloc(lineInfo, sizeof(struct Line) * (*max += LINES));
+ safe_realloc(line_info, sizeof(struct Line) * (*max += LINES));
for (ch = *last; ch < *max; ch++)
{
- memset(&((*lineInfo)[ch]), 0, sizeof(struct Line));
- (*lineInfo)[ch].type = -1;
- (*lineInfo)[ch].search_cnt = -1;
- (*lineInfo)[ch].syntax = safe_malloc(sizeof(struct Syntax));
- ((*lineInfo)[ch].syntax)[0].first = ((*lineInfo)[ch].syntax)[0].last = -1;
+ memset(&((*line_info)[ch]), 0, sizeof(struct Line));
+ (*line_info)[ch].type = -1;
+ (*line_info)[ch].search_cnt = -1;
+ (*line_info)[ch].syntax = safe_malloc(sizeof(struct Syntax));
+ ((*line_info)[ch].syntax)[0].first = ((*line_info)[ch].syntax)[0].last = -1;
}
}
/* only do color highlighting if we are viewing a message */
if (flags & (MUTT_SHOWCOLOR | MUTT_TYPES))
{
- if ((*lineInfo)[n].type == -1)
+ if ((*line_info)[n].type == -1)
{
/* determine the line class */
- if (fill_buffer(f, last_pos, (*lineInfo)[n].offset, &buf, &fmt, &buflen, &buf_ready) < 0)
+ if (fill_buffer(f, last_pos, (*line_info)[n].offset, &buf, &fmt, &buflen, &buf_ready) < 0)
{
if (change_last)
(*last)--;
goto out;
}
- resolve_types((char *) fmt, (char *) buf, *lineInfo, n, *last, QuoteList,
+ resolve_types((char *) fmt, (char *) buf, *line_info, n, *last, quote_list,
q_level, force_redraw, flags & MUTT_SHOWCOLOR);
/* avoid race condition for continuation lines when scrolling up */
- for (m = n + 1; m < *last && (*lineInfo)[m].offset && (*lineInfo)[m].continuation; m++)
- (*lineInfo)[m].type = (*lineInfo)[n].type;
+ for (m = n + 1; m < *last && (*line_info)[m].offset && (*line_info)[m].continuation; m++)
+ (*line_info)[m].type = (*line_info)[n].type;
}
/* this also prevents searching through the hidden lines */
- if ((flags & MUTT_HIDE) && (*lineInfo)[n].type == MT_COLOR_QUOTED)
+ if ((flags & MUTT_HIDE) && (*line_info)[n].type == MT_COLOR_QUOTED)
flags = 0; /* MUTT_NOSHOW */
}
- /* At this point, (*lineInfo[n]).quote may still be undefined. We
+ /* At this point, (*line_info[n]).quote may still be undefined. We
* don't want to compute it every time MUTT_TYPES is set, since this
* would slow down the "bottom" function unacceptably. A compromise
* solution is hence to call regexec() again, just to find out the
* length of the quote prefix.
*/
- if ((flags & MUTT_SHOWCOLOR) && !(*lineInfo)[n].continuation &&
- (*lineInfo)[n].type == MT_COLOR_QUOTED && (*lineInfo)[n].quote == NULL)
+ if ((flags & MUTT_SHOWCOLOR) && !(*line_info)[n].continuation &&
+ (*line_info)[n].type == MT_COLOR_QUOTED && (*line_info)[n].quote == NULL)
{
- if (fill_buffer(f, last_pos, (*lineInfo)[n].offset, &buf, &fmt, &buflen, &buf_ready) < 0)
+ if (fill_buffer(f, last_pos, (*line_info)[n].offset, &buf, &fmt, &buflen, &buf_ready) < 0)
{
if (change_last)
(*last)--;
}
if (regexec((regex_t *) QuoteRegexp.rx, (char *) fmt, 1, pmatch, 0) != 0)
goto out;
- (*lineInfo)[n].quote =
- classify_quote(QuoteList, (char *) fmt + pmatch[0].rm_so,
+ (*line_info)[n].quote =
+ classify_quote(quote_list, (char *) fmt + pmatch[0].rm_so,
pmatch[0].rm_eo - pmatch[0].rm_so, force_redraw, q_level);
}
- if ((flags & MUTT_SEARCH) && !(*lineInfo)[n].continuation &&
- (*lineInfo)[n].search_cnt == -1)
+ if ((flags & MUTT_SEARCH) && !(*line_info)[n].continuation &&
+ (*line_info)[n].search_cnt == -1)
{
- if (fill_buffer(f, last_pos, (*lineInfo)[n].offset, &buf, &fmt, &buflen, &buf_ready) < 0)
+ if (fill_buffer(f, last_pos, (*line_info)[n].offset, &buf, &fmt, &buflen, &buf_ready) < 0)
{
if (change_last)
(*last)--;
}
offset = 0;
- (*lineInfo)[n].search_cnt = 0;
- while (regexec(SearchRE, (char *) fmt + offset, 1, pmatch, (offset ? REG_NOTBOL : 0)) == 0)
+ (*line_info)[n].search_cnt = 0;
+ while (regexec(search_re, (char *) fmt + offset, 1, pmatch, (offset ? REG_NOTBOL : 0)) == 0)
{
- if (++((*lineInfo)[n].search_cnt) > 1)
- safe_realloc(&((*lineInfo)[n].search),
- ((*lineInfo)[n].search_cnt) * sizeof(struct Syntax));
+ if (++((*line_info)[n].search_cnt) > 1)
+ safe_realloc(&((*line_info)[n].search),
+ ((*line_info)[n].search_cnt) * sizeof(struct Syntax));
else
- (*lineInfo)[n].search = safe_malloc(sizeof(struct Syntax));
+ (*line_info)[n].search = safe_malloc(sizeof(struct Syntax));
pmatch[0].rm_so += offset;
pmatch[0].rm_eo += offset;
- ((*lineInfo)[n].search)[(*lineInfo)[n].search_cnt - 1].first = pmatch[0].rm_so;
- ((*lineInfo)[n].search)[(*lineInfo)[n].search_cnt - 1].last = pmatch[0].rm_eo;
+ ((*line_info)[n].search)[(*line_info)[n].search_cnt - 1].first = pmatch[0].rm_so;
+ ((*line_info)[n].search)[(*line_info)[n].search_cnt - 1].last = pmatch[0].rm_eo;
if (pmatch[0].rm_eo == pmatch[0].rm_so)
offset++; /* avoid degenerate cases */
}
}
- if (!(flags & MUTT_SHOW) && (*lineInfo)[n + 1].offset > 0)
+ if (!(flags & MUTT_SHOW) && (*line_info)[n + 1].offset > 0)
{
/* we've already scanned this line, so just exit */
rc = 0;
goto out;
}
- if ((flags & MUTT_SHOWCOLOR) && *force_redraw && (*lineInfo)[n + 1].offset > 0)
+ if ((flags & MUTT_SHOWCOLOR) && *force_redraw && (*line_info)[n + 1].offset > 0)
{
/* no need to try to display this line... */
rc = 1;
goto out; /* fake display */
}
- if ((b_read = fill_buffer(f, last_pos, (*lineInfo)[n].offset, &buf, &fmt,
+ if ((b_read = fill_buffer(f, last_pos, (*line_info)[n].offset, &buf, &fmt,
&buflen, &buf_ready)) < 0)
{
if (change_last)
}
/* now chose a good place to break the line */
- cnt = format_line(lineInfo, n, buf, flags, 0, b_read, &ch, &vch, &col, &special, pager_window);
+ cnt = format_line(line_info, n, buf, flags, 0, b_read, &ch, &vch, &col, &special, pager_window);
buf_ptr = buf + cnt;
/* move the break point only if smart_wrap is set */
if (*buf_ptr == '\n')
buf_ptr++;
- if ((int) (buf_ptr - buf) < b_read && !(*lineInfo)[n + 1].continuation)
- append_line(*lineInfo, n, (int) (buf_ptr - buf));
- (*lineInfo)[n + 1].offset = (*lineInfo)[n].offset + (long) (buf_ptr - buf);
+ if ((int) (buf_ptr - buf) < b_read && !(*line_info)[n + 1].continuation)
+ append_line(*line_info, n, (int) (buf_ptr - buf));
+ (*line_info)[n + 1].offset = (*line_info)[n].offset + (long) (buf_ptr - buf);
/* if we don't need to display the line we are done */
if (!(flags & MUTT_SHOW))
}
/* display the line */
- format_line(lineInfo, n, buf, flags, &a, cnt, &ch, &vch, &col, &special, pager_window);
+ format_line(line_info, n, buf, flags, &a, cnt, &ch, &vch, &col, &special, pager_window);
/* avoid a bug in ncurses... */
#ifndef USE_SLANG_CURSES
/* end the last color pattern (needed by S-Lang) */
if (special || (col != pager_window->cols && (flags & (MUTT_SHOWCOLOR | MUTT_SEARCH))))
- resolve_color(*lineInfo, n, vch, flags, 0, &a);
+ resolve_color(*line_info, n, vch, flags, 0, &a);
/*
* Fill the blank space at the end of the line with the prevailing color.
*/
if (flags & MUTT_SHOWCOLOR)
{
- m = ((*lineInfo)[n].continuation) ? ((*lineInfo)[n].syntax)[0].first : n;
- if ((*lineInfo)[m].type == MT_COLOR_HEADER)
- def_color = ((*lineInfo)[m].syntax)[0].color;
+ m = ((*line_info)[n].continuation) ? ((*line_info)[n].syntax)[0].first : n;
+ if ((*line_info)[m].type == MT_COLOR_HEADER)
+ def_color = ((*line_info)[m].syntax)[0].color;
else
- def_color = ColorDefs[(*lineInfo)[m].type];
+ def_color = ColorDefs[(*line_info)[m].type];
ATTRSET(def_color);
}
int indicator; /* the indicator line of the PI */
int oldtopline;
int lines;
- int maxLine;
- int lastLine;
+ int max_line;
+ int last_line;
int curline;
int topline;
int force_redraw;
int has_types;
- int hideQuoted;
+ int hide_quoted;
int q_level;
- struct QClass *QuoteList;
+ struct QClass *quote_list;
LOFF_T last_pos;
LOFF_T last_offset;
struct MuttWindow *index_status_window;
struct MuttWindow *pager_status_window;
struct MuttWindow *pager_window;
struct Menu *index; /* the Pager Index (PI) */
- regex_t SearchRE;
- int SearchCompiled;
- int SearchFlag;
- int SearchBack;
+ regex_t search_re;
+ int search_compiled;
+ int search_flag;
+ int search_back;
const char *banner;
char *helpstr;
char *searchbuf;
- struct Line *lineInfo;
+ struct Line *line_info;
FILE *fp;
struct stat sb;
};
#if defined(USE_SLANG_CURSES) || defined(HAVE_RESIZETERM)
if (Resize)
{
- if ((rd->SearchCompiled = Resize->SearchCompiled))
+ if ((rd->search_compiled = Resize->search_compiled))
{
- REGCOMP(&rd->SearchRE, rd->searchbuf, REG_NEWLINE | mutt_which_case(rd->searchbuf));
- rd->SearchFlag = MUTT_SEARCH;
- rd->SearchBack = Resize->SearchBack;
+ REGCOMP(&rd->search_re, rd->searchbuf, REG_NEWLINE | mutt_which_case(rd->searchbuf));
+ rd->search_flag = MUTT_SEARCH;
+ rd->search_back = Resize->search_back;
}
rd->lines = Resize->line;
pager_menu->redraw |= REDRAW_FLOW;
{
rd->lines = -1;
for (i = 0; i <= rd->topline; i++)
- if (!rd->lineInfo[i].continuation)
+ if (!rd->line_info[i].continuation)
rd->lines++;
- for (i = 0; i < rd->maxLine; i++)
+ for (i = 0; i < rd->max_line; i++)
{
- rd->lineInfo[i].offset = 0;
- rd->lineInfo[i].type = -1;
- rd->lineInfo[i].continuation = 0;
- rd->lineInfo[i].chunks = 0;
- rd->lineInfo[i].search_cnt = -1;
- rd->lineInfo[i].quote = NULL;
-
- safe_realloc(&(rd->lineInfo[i].syntax), sizeof(struct Syntax));
- if (rd->SearchCompiled && rd->lineInfo[i].search)
- FREE(&(rd->lineInfo[i].search));
+ rd->line_info[i].offset = 0;
+ rd->line_info[i].type = -1;
+ rd->line_info[i].continuation = 0;
+ rd->line_info[i].chunks = 0;
+ rd->line_info[i].search_cnt = -1;
+ rd->line_info[i].quote = NULL;
+
+ safe_realloc(&(rd->line_info[i].syntax), sizeof(struct Syntax));
+ if (rd->search_compiled && rd->line_info[i].search)
+ FREE(&(rd->line_info[i].search));
}
- rd->lastLine = 0;
+ rd->last_line = 0;
rd->topline = 0;
}
i = -1;
j = -1;
- while (display_line(rd->fp, &rd->last_pos, &rd->lineInfo, ++i, &rd->lastLine, &rd->maxLine,
- rd->has_types | rd->SearchFlag | (rd->flags & MUTT_PAGER_NOWRAP),
- &rd->QuoteList, &rd->q_level, &rd->force_redraw,
- &rd->SearchRE, rd->pager_window) == 0)
- if (!rd->lineInfo[i].continuation && ++j == rd->lines)
+ while (display_line(rd->fp, &rd->last_pos, &rd->line_info, ++i, &rd->last_line, &rd->max_line,
+ rd->has_types | rd->search_flag | (rd->flags & MUTT_PAGER_NOWRAP),
+ &rd->quote_list, &rd->q_level, &rd->force_redraw,
+ &rd->search_re, rd->pager_window) == 0)
+ if (!rd->line_info[i].continuation && ++j == rd->lines)
{
rd->topline = i;
- if (!rd->SearchFlag)
+ if (!rd->search_flag)
break;
}
}
rd->force_redraw = 0;
while (rd->lines < rd->pager_window->rows &&
- rd->lineInfo[rd->curline].offset <= rd->sb.st_size - 1)
+ rd->line_info[rd->curline].offset <= rd->sb.st_size - 1)
{
- if (display_line(rd->fp, &rd->last_pos, &rd->lineInfo, rd->curline,
- &rd->lastLine, &rd->maxLine,
- (rd->flags & MUTT_DISPLAYFLAGS) | rd->hideQuoted |
- rd->SearchFlag | (rd->flags & MUTT_PAGER_NOWRAP),
- &rd->QuoteList, &rd->q_level, &rd->force_redraw,
- &rd->SearchRE, rd->pager_window) > 0)
+ if (display_line(rd->fp, &rd->last_pos, &rd->line_info, rd->curline,
+ &rd->last_line, &rd->max_line,
+ (rd->flags & MUTT_DISPLAYFLAGS) | rd->hide_quoted |
+ rd->search_flag | (rd->flags & MUTT_PAGER_NOWRAP),
+ &rd->quote_list, &rd->q_level, &rd->force_redraw,
+ &rd->search_re, rd->pager_window) > 0)
rd->lines++;
rd->curline++;
mutt_window_move(rd->pager_window, rd->lines, 0);
}
- rd->last_offset = rd->lineInfo[rd->curline].offset;
+ rd->last_offset = rd->line_info[rd->curline].offset;
} while (rd->force_redraw);
SETCOLOR(MT_COLOR_TILDE);
mutt_set_flag(Context, extra->hdr, MUTT_READ, 1);
}
- rd.lineInfo = safe_malloc(sizeof(struct Line) * (rd.maxLine = LINES));
- for (i = 0; i < rd.maxLine; i++)
+ rd.line_info = safe_malloc(sizeof(struct Line) * (rd.max_line = LINES));
+ for (i = 0; i < rd.max_line; i++)
{
- memset(&rd.lineInfo[i], 0, sizeof(struct Line));
- rd.lineInfo[i].type = -1;
- rd.lineInfo[i].search_cnt = -1;
- rd.lineInfo[i].syntax = safe_malloc(sizeof(struct Syntax));
- (rd.lineInfo[i].syntax)[0].first = (rd.lineInfo[i].syntax)[0].last = -1;
+ memset(&rd.line_info[i], 0, sizeof(struct Line));
+ rd.line_info[i].type = -1;
+ rd.line_info[i].search_cnt = -1;
+ rd.line_info[i].syntax = safe_malloc(sizeof(struct Syntax));
+ (rd.line_info[i].syntax)[0].first = (rd.line_info[i].syntax)[0].last = -1;
}
mutt_compile_help(helpstr, sizeof(helpstr), MENU_PAGER, PagerHelp);
mutt_refresh();
if (IsHeader(extra) && OldHdr == extra->hdr && TopLine != rd.topline &&
- rd.lineInfo[rd.curline].offset < rd.sb.st_size - 1)
+ rd.line_info[rd.curline].offset < rd.sb.st_size - 1)
{
if (TopLine - rd.topline > rd.lines)
rd.topline += rd.lines;
/* Store current position. */
rd.lines = -1;
for (i = 0; i <= rd.topline; i++)
- if (!rd.lineInfo[i].continuation)
+ if (!rd.line_info[i].continuation)
rd.lines++;
Resize = safe_malloc(sizeof(struct Resize));
Resize->line = rd.lines;
- Resize->SearchCompiled = rd.SearchCompiled;
- Resize->SearchBack = rd.SearchBack;
+ Resize->search_compiled = rd.search_compiled;
+ Resize->search_back = rd.search_back;
ch = -1;
rc = OP_REFORMAT_WINCH;
break;
case OP_NEXT_PAGE:
- if (rd.lineInfo[rd.curline].offset < rd.sb.st_size - 1)
+ if (rd.line_info[rd.curline].offset < rd.sb.st_size - 1)
{
- rd.topline = up_n_lines(PagerContext, rd.lineInfo, rd.curline, rd.hideQuoted);
+ rd.topline = up_n_lines(PagerContext, rd.line_info, rd.curline, rd.hide_quoted);
}
else if (option(OPTPAGERSTOP))
{
if (rd.topline != 0)
{
rd.topline = up_n_lines(rd.pager_window->rows - PagerContext,
- rd.lineInfo, rd.topline, rd.hideQuoted);
+ rd.line_info, rd.topline, rd.hide_quoted);
}
else
mutt_error(_("Top of message is shown."));
break;
case OP_NEXT_LINE:
- if (rd.lineInfo[rd.curline].offset < rd.sb.st_size - 1)
+ if (rd.line_info[rd.curline].offset < rd.sb.st_size - 1)
{
rd.topline++;
- if (rd.hideQuoted)
+ if (rd.hide_quoted)
{
- while (rd.lineInfo[rd.topline].type == MT_COLOR_QUOTED && rd.topline < rd.lastLine)
+ while (rd.line_info[rd.topline].type == MT_COLOR_QUOTED && rd.topline < rd.last_line)
rd.topline++;
}
}
case OP_PREV_LINE:
if (rd.topline)
- rd.topline = up_n_lines(1, rd.lineInfo, rd.topline, rd.hideQuoted);
+ rd.topline = up_n_lines(1, rd.line_info, rd.topline, rd.hide_quoted);
else
mutt_error(_("Top of message is shown."));
break;
case OP_HALF_UP:
if (rd.topline)
- rd.topline = up_n_lines(rd.pager_window->rows / 2, rd.lineInfo,
- rd.topline, rd.hideQuoted);
+ rd.topline = up_n_lines(rd.pager_window->rows / 2, rd.line_info,
+ rd.topline, rd.hide_quoted);
else
mutt_error(_("Top of message is shown."));
break;
case OP_HALF_DOWN:
- if (rd.lineInfo[rd.curline].offset < rd.sb.st_size - 1)
+ if (rd.line_info[rd.curline].offset < rd.sb.st_size - 1)
{
- rd.topline = up_n_lines(rd.pager_window->rows / 2, rd.lineInfo,
- rd.curline, rd.hideQuoted);
+ rd.topline = up_n_lines(rd.pager_window->rows / 2, rd.line_info,
+ rd.curline, rd.hide_quoted);
}
else if (option(OPTPAGERSTOP))
{
case OP_SEARCH_NEXT:
case OP_SEARCH_OPPOSITE:
- if (rd.SearchCompiled)
+ if (rd.search_compiled)
{
wrapped = false;
searchctx = 0;
search_next:
- if ((!rd.SearchBack && ch == OP_SEARCH_NEXT) ||
- (rd.SearchBack && ch == OP_SEARCH_OPPOSITE))
+ if ((!rd.search_back && ch == OP_SEARCH_NEXT) ||
+ (rd.search_back && ch == OP_SEARCH_OPPOSITE))
{
/* searching forward */
- for (i = wrapped ? 0 : rd.topline + searchctx + 1; i < rd.lastLine; i++)
+ for (i = wrapped ? 0 : rd.topline + searchctx + 1; i < rd.last_line; i++)
{
- if ((!rd.hideQuoted || rd.lineInfo[i].type != MT_COLOR_QUOTED) &&
- !rd.lineInfo[i].continuation && rd.lineInfo[i].search_cnt > 0)
+ if ((!rd.hide_quoted || rd.line_info[i].type != MT_COLOR_QUOTED) &&
+ !rd.line_info[i].continuation && rd.line_info[i].search_cnt > 0)
break;
}
- if (i < rd.lastLine)
+ if (i < rd.last_line)
rd.topline = i;
else if (wrapped || !option(OPTWRAPSEARCH))
mutt_error(_("Not found."));
else
{
/* searching backward */
- for (i = wrapped ? rd.lastLine : rd.topline + searchctx - 1; i >= 0; i--)
+ for (i = wrapped ? rd.last_line : rd.topline + searchctx - 1; i >= 0; i--)
{
- if ((!rd.hideQuoted || (rd.has_types && rd.lineInfo[i].type != MT_COLOR_QUOTED)) &&
- !rd.lineInfo[i].continuation && rd.lineInfo[i].search_cnt > 0)
+ if ((!rd.hide_quoted || (rd.has_types && rd.line_info[i].type != MT_COLOR_QUOTED)) &&
+ !rd.line_info[i].continuation && rd.line_info[i].search_cnt > 0)
break;
}
}
}
- if (rd.lineInfo[rd.topline].search_cnt > 0)
+ if (rd.line_info[rd.topline].search_cnt > 0)
{
- rd.SearchFlag = MUTT_SEARCH;
+ rd.search_flag = MUTT_SEARCH;
/* give some context for search results */
if (rd.topline - searchctx > 0)
rd.topline -= searchctx;
if (strcmp(buffer, searchbuf) == 0)
{
- if (rd.SearchCompiled)
+ if (rd.search_compiled)
{
/* do an implicit search-next */
if (ch == OP_SEARCH)
strfcpy(searchbuf, buffer, sizeof(searchbuf));
- /* leave SearchBack alone if ch == OP_SEARCH_NEXT */
+ /* leave search_back alone if ch == OP_SEARCH_NEXT */
if (ch == OP_SEARCH)
- rd.SearchBack = 0;
+ rd.search_back = 0;
else if (ch == OP_SEARCH_REVERSE)
- rd.SearchBack = 1;
+ rd.search_back = 1;
- if (rd.SearchCompiled)
+ if (rd.search_compiled)
{
- regfree(&rd.SearchRE);
- for (i = 0; i < rd.lastLine; i++)
+ regfree(&rd.search_re);
+ for (i = 0; i < rd.last_line; i++)
{
- if (rd.lineInfo[i].search)
- FREE(&(rd.lineInfo[i].search));
- rd.lineInfo[i].search_cnt = -1;
+ if (rd.line_info[i].search)
+ FREE(&(rd.line_info[i].search));
+ rd.line_info[i].search_cnt = -1;
}
}
- if ((err = REGCOMP(&rd.SearchRE, searchbuf,
+ if ((err = REGCOMP(&rd.search_re, searchbuf,
REG_NEWLINE | mutt_which_case(searchbuf))) != 0)
{
- regerror(err, &rd.SearchRE, buffer, sizeof(buffer));
+ regerror(err, &rd.search_re, buffer, sizeof(buffer));
mutt_error("%s", buffer);
- for (i = 0; i < rd.maxLine; i++)
+ for (i = 0; i < rd.max_line; i++)
{
/* cleanup */
- if (rd.lineInfo[i].search)
- FREE(&(rd.lineInfo[i].search));
- rd.lineInfo[i].search_cnt = -1;
+ if (rd.line_info[i].search)
+ FREE(&(rd.line_info[i].search));
+ rd.line_info[i].search_cnt = -1;
}
- rd.SearchFlag = 0;
- rd.SearchCompiled = 0;
+ rd.search_flag = 0;
+ rd.search_compiled = 0;
}
else
{
- rd.SearchCompiled = 1;
+ rd.search_compiled = 1;
/* update the search pointers */
i = 0;
- while (display_line(rd.fp, &rd.last_pos, &rd.lineInfo, i, &rd.lastLine, &rd.maxLine,
+ while (display_line(rd.fp, &rd.last_pos, &rd.line_info, i, &rd.last_line, &rd.max_line,
MUTT_SEARCH | (flags & MUTT_PAGER_NSKIP) | (flags & MUTT_PAGER_NOWRAP),
- &rd.QuoteList, &rd.q_level, &rd.force_redraw,
- &rd.SearchRE, rd.pager_window) == 0)
+ &rd.quote_list, &rd.q_level, &rd.force_redraw,
+ &rd.search_re, rd.pager_window) == 0)
i++;
- if (!rd.SearchBack)
+ if (!rd.search_back)
{
/* searching forward */
- for (i = rd.topline; i < rd.lastLine; i++)
+ for (i = rd.topline; i < rd.last_line; i++)
{
- if ((!rd.hideQuoted || rd.lineInfo[i].type != MT_COLOR_QUOTED) &&
- !rd.lineInfo[i].continuation && rd.lineInfo[i].search_cnt > 0)
+ if ((!rd.hide_quoted || rd.line_info[i].type != MT_COLOR_QUOTED) &&
+ !rd.line_info[i].continuation && rd.line_info[i].search_cnt > 0)
break;
}
- if (i < rd.lastLine)
+ if (i < rd.last_line)
rd.topline = i;
}
else
/* searching backward */
for (i = rd.topline; i >= 0; i--)
{
- if ((!rd.hideQuoted || rd.lineInfo[i].type != MT_COLOR_QUOTED) &&
- !rd.lineInfo[i].continuation && rd.lineInfo[i].search_cnt > 0)
+ if ((!rd.hide_quoted || rd.line_info[i].type != MT_COLOR_QUOTED) &&
+ !rd.line_info[i].continuation && rd.line_info[i].search_cnt > 0)
break;
}
rd.topline = i;
}
- if (rd.lineInfo[rd.topline].search_cnt == 0)
+ if (rd.line_info[rd.topline].search_cnt == 0)
{
- rd.SearchFlag = 0;
+ rd.search_flag = 0;
mutt_error(_("Not found."));
}
else
{
- rd.SearchFlag = MUTT_SEARCH;
+ rd.search_flag = MUTT_SEARCH;
/* give some context for search results */
if (SearchContext > 0 && SearchContext < rd.pager_window->rows)
searchctx = SearchContext;
break;
case OP_SEARCH_TOGGLE:
- if (rd.SearchCompiled)
+ if (rd.search_compiled)
{
- rd.SearchFlag ^= MUTT_SEARCH;
+ rd.search_flag ^= MUTT_SEARCH;
pager_menu->redraw = REDRAW_BODY;
}
break;
case OP_PAGER_HIDE_QUOTED:
if (rd.has_types)
{
- rd.hideQuoted ^= MUTT_HIDE;
- if (rd.hideQuoted && rd.lineInfo[rd.topline].type == MT_COLOR_QUOTED)
- rd.topline = up_n_lines(1, rd.lineInfo, rd.topline, rd.hideQuoted);
+ rd.hide_quoted ^= MUTT_HIDE;
+ if (rd.hide_quoted && rd.line_info[rd.topline].type == MT_COLOR_QUOTED)
+ rd.topline = up_n_lines(1, rd.line_info, rd.topline, rd.hide_quoted);
else
pager_menu->redraw = REDRAW_BODY;
}
int new_topline = rd.topline;
/* Skip all the email headers */
- if (ISHEADER(rd.lineInfo[new_topline].type))
+ if (ISHEADER(rd.line_info[new_topline].type))
{
- while ((new_topline < rd.lastLine ||
+ while ((new_topline < rd.last_line ||
(0 == (dretval = display_line(
- rd.fp, &rd.last_pos, &rd.lineInfo, new_topline, &rd.lastLine,
- &rd.maxLine, MUTT_TYPES | (flags & MUTT_PAGER_NOWRAP),
- &rd.QuoteList, &rd.q_level, &rd.force_redraw,
- &rd.SearchRE, rd.pager_window)))) &&
- ISHEADER(rd.lineInfo[new_topline].type))
+ rd.fp, &rd.last_pos, &rd.line_info, new_topline, &rd.last_line,
+ &rd.max_line, MUTT_TYPES | (flags & MUTT_PAGER_NOWRAP),
+ &rd.quote_list, &rd.q_level, &rd.force_redraw,
+ &rd.search_re, rd.pager_window)))) &&
+ ISHEADER(rd.line_info[new_topline].type))
{
new_topline++;
}
break;
}
- while (((new_topline + SkipQuotedOffset) < rd.lastLine ||
+ while (((new_topline + SkipQuotedOffset) < rd.last_line ||
(0 == (dretval = display_line(
- rd.fp, &rd.last_pos, &rd.lineInfo, new_topline, &rd.lastLine,
- &rd.maxLine, MUTT_TYPES | (flags & MUTT_PAGER_NOWRAP),
- &rd.QuoteList, &rd.q_level, &rd.force_redraw,
- &rd.SearchRE, rd.pager_window)))) &&
- rd.lineInfo[new_topline + SkipQuotedOffset].type != MT_COLOR_QUOTED)
+ rd.fp, &rd.last_pos, &rd.line_info, new_topline, &rd.last_line,
+ &rd.max_line, MUTT_TYPES | (flags & MUTT_PAGER_NOWRAP),
+ &rd.quote_list, &rd.q_level, &rd.force_redraw,
+ &rd.search_re, rd.pager_window)))) &&
+ rd.line_info[new_topline + SkipQuotedOffset].type != MT_COLOR_QUOTED)
new_topline++;
if (dretval < 0)
break;
}
- while (((new_topline + SkipQuotedOffset) < rd.lastLine ||
+ while (((new_topline + SkipQuotedOffset) < rd.last_line ||
(0 == (dretval = display_line(
- rd.fp, &rd.last_pos, &rd.lineInfo, new_topline, &rd.lastLine,
- &rd.maxLine, MUTT_TYPES | (flags & MUTT_PAGER_NOWRAP),
- &rd.QuoteList, &rd.q_level, &rd.force_redraw,
- &rd.SearchRE, rd.pager_window)))) &&
- rd.lineInfo[new_topline + SkipQuotedOffset].type == MT_COLOR_QUOTED)
+ rd.fp, &rd.last_pos, &rd.line_info, new_topline, &rd.last_line,
+ &rd.max_line, MUTT_TYPES | (flags & MUTT_PAGER_NOWRAP),
+ &rd.quote_list, &rd.q_level, &rd.force_redraw,
+ &rd.search_re, rd.pager_window)))) &&
+ rd.line_info[new_topline + SkipQuotedOffset].type == MT_COLOR_QUOTED)
new_topline++;
if (dretval < 0)
break;
case OP_PAGER_BOTTOM: /* move to the end of the file */
- if (rd.lineInfo[rd.curline].offset < rd.sb.st_size - 1)
+ if (rd.line_info[rd.curline].offset < rd.sb.st_size - 1)
{
i = rd.curline;
/* make sure the types are defined to the end of file */
- while (display_line(rd.fp, &rd.last_pos, &rd.lineInfo, i, &rd.lastLine,
- &rd.maxLine, rd.has_types | (flags & MUTT_PAGER_NOWRAP),
- &rd.QuoteList, &rd.q_level, &rd.force_redraw,
- &rd.SearchRE, rd.pager_window) == 0)
+ while (display_line(rd.fp, &rd.last_pos, &rd.line_info, i, &rd.last_line,
+ &rd.max_line, rd.has_types | (flags & MUTT_PAGER_NOWRAP),
+ &rd.quote_list, &rd.q_level, &rd.force_redraw,
+ &rd.search_re, rd.pager_window) == 0)
i++;
- rd.topline = up_n_lines(rd.pager_window->rows, rd.lineInfo,
- rd.lastLine, rd.hideQuoted);
+ rd.topline = up_n_lines(rd.pager_window->rows, rd.line_info,
+ rd.last_line, rd.hide_quoted);
}
else
mutt_error(_("Bottom of message is shown."));
}
}
- cleanup_quote(&rd.QuoteList);
+ cleanup_quote(&rd.quote_list);
- for (i = 0; i < rd.maxLine; i++)
+ for (i = 0; i < rd.max_line; i++)
{
- FREE(&(rd.lineInfo[i].syntax));
- if (rd.SearchCompiled && rd.lineInfo[i].search)
- FREE(&(rd.lineInfo[i].search));
+ FREE(&(rd.line_info[i].syntax));
+ if (rd.search_compiled && rd.line_info[i].search)
+ FREE(&(rd.line_info[i].search));
}
- if (rd.SearchCompiled)
+ if (rd.search_compiled)
{
- regfree(&rd.SearchRE);
- rd.SearchCompiled = 0;
+ regfree(&rd.search_re);
+ rd.search_compiled = 0;
}
- FREE(&rd.lineInfo);
+ FREE(&rd.line_info);
mutt_pop_current_menu(pager_menu);
mutt_menu_destroy(&pager_menu);
if (rd.index)
return curlist;
}
-static bool perform_and(struct Pattern *pat, pattern_exec_flag flags, struct Context *ctx,
+static bool perform_and(struct Pattern *pat, enum PatternExecFlag flags, struct Context *ctx,
struct Header *hdr, struct PatternCache *cache)
{
for (; pat; pat = pat->next)
return true;
}
-static int perform_or(struct Pattern *pat, pattern_exec_flag flags, struct Context *ctx,
+static int perform_or(struct Pattern *pat, enum PatternExecFlag flags, struct Context *ctx,
struct Header *hdr, struct PatternCache *cache)
{
for (; pat; pat = pat->next)
return alladdr;
}
-static int match_threadcomplete(struct Pattern *pat, pattern_exec_flag flags,
+static int match_threadcomplete(struct Pattern *pat, enum PatternExecFlag flags,
struct Context *ctx, struct MuttThread *t,
int left, int up, int right, int down)
{
return 0;
}
-static int match_threadparent(struct Pattern *pat, pattern_exec_flag flags,
+static int match_threadparent(struct Pattern *pat, enum PatternExecFlag flags,
struct Context *ctx, struct MuttThread *t)
{
if (!t || !t->parent || !t->parent->message)
return mutt_pattern_exec(pat, flags, ctx, t->parent->message, NULL);
}
-static int match_threadchildren(struct Pattern *pat, pattern_exec_flag flags,
+static int match_threadchildren(struct Pattern *pat, enum PatternExecFlag flags,
struct Context *ctx, struct MuttThread *t)
{
if (!t || !t->child)
* flags: MUTT_MATCH_FULL_ADDRESS - match both personal and machine address
* cache: For repeated matches against the same Header, passing in non-NULL will
* store some of the cacheable pattern matches in this structure. */
-int mutt_pattern_exec(struct Pattern *pat, pattern_exec_flag flags,
+int mutt_pattern_exec(struct Pattern *pat, enum PatternExecFlag flags,
struct Context *ctx, struct Header *h, struct PatternCache *cache)
{
int result;
} p;
};
-typedef enum {
+enum PatternExecFlag
+{
MUTT_MATCH_FULL_ADDRESS = 1
-} pattern_exec_flag;
+};
/* This is used when a message is repeatedly pattern matched against.
* e.g. for color, scoring, hooks. It caches a few of the potentially slow
return safe_calloc(1, sizeof(struct Pattern));
}
-int mutt_pattern_exec(struct Pattern *pat, pattern_exec_flag flags,
+int mutt_pattern_exec(struct Pattern *pat, enum PatternExecFlag flags,
struct Context *ctx, struct Header *h, struct PatternCache *cache);
struct Pattern *mutt_pattern_comp(/* const */ char *s, int flags, struct Buffer *err);
void mutt_check_simple(char *s, size_t len, const char *simple);
POP_BYE
};
-typedef enum {
+enum PopAuthRes
+{
POP_A_SUCCESS = 0,
POP_A_SOCKET,
POP_A_FAILURE,
POP_A_UNAVAIL
-} pop_auth_res_t;
+};
struct PopCache
{
struct PopAuth
{
/* do authentication, using named method or any available if method is NULL */
- pop_auth_res_t (*authenticate)(struct PopData *, const char *);
+ enum PopAuthRes (*authenticate)(struct PopData *, const char *);
/* name of authentication method supported, NULL means variable. If this
* is not null, authenticate may ignore the second parameter. */
const char *method;
#ifdef USE_SASL
/* SASL authenticator */
-static pop_auth_res_t pop_auth_sasl(struct PopData *pop_data, const char *method)
+static enum PopAuthRes pop_auth_sasl(struct PopData *pop_data, const char *method)
{
sasl_conn_t *saslconn = NULL;
sasl_interact_t *interaction = NULL;
}
/* APOP authenticator */
-static pop_auth_res_t pop_auth_apop(struct PopData *pop_data, const char *method)
+static enum PopAuthRes pop_auth_apop(struct PopData *pop_data, const char *method)
{
struct Md5Ctx ctx;
unsigned char digest[16];
}
/* USER authenticator */
-static pop_auth_res_t pop_auth_user(struct PopData *pop_data, const char *method)
+static enum PopAuthRes pop_auth_user(struct PopData *pop_data, const char *method)
{
char buf[LONG_STRING];
int ret;
#define mutt_make_string(A, B, C, D, E) _mutt_make_string(A, B, C, D, E, 0)
void _mutt_make_string(char *dest, size_t destlen, const char *s, struct Context *ctx,
- struct Header *hdr, format_flag flags);
+ struct Header *hdr, enum FormatFlag flags);
struct HdrFormatInfo
{
const char *pager_progress;
};
-typedef enum {
- kXDGConfigHome, /* $XDG_CONFIG_HOME */
- kXDGConfigDirs, /* $XDG_CONFIG_DIRS */
-} XDGType;
+enum XdgType
+{
+ XDG_CONFIG_HOME,
+ XDG_CONFIG_DIRS,
+};
void mutt_make_string_info(char *dst, size_t dstlen, int cols, const char *s,
- struct HdrFormatInfo *hfi, format_flag flags);
+ struct HdrFormatInfo *hfi, enum FormatFlag flags);
void mutt_free_opts(void);
const char *mutt_attach_fmt(char *dest, size_t destlen, size_t col, int cols,
char op, const char *src, const char *prefix,
const char *ifstring, const char *elsestring,
- unsigned long data, format_flag flags);
+ unsigned long data, enum FormatFlag flags);
char *mutt_charset_hook(const char *chs);
char *mutt_make_date(char *s, size_t len);
void mutt_timeout_hook(void);
void mutt_startup_shutdown_hook(int type);
-int mutt_set_xdg_path(const XDGType type, char *buf, size_t bufsize);
+int mutt_set_xdg_path(enum XdgType type, char *buf, size_t bufsize);
const char *mutt_make_version(void);
static const char *query_format_str(char *dest, size_t destlen, size_t col, int cols,
char op, const char *src, const char *fmt,
const char *ifstring, const char *elsestring,
- unsigned long data, format_flag flags)
+ unsigned long data, enum FormatFlag flags)
{
struct Entry *entry = (struct Entry *) data;
struct Query *query = entry->data;
const char *mutt_attach_fmt(char *dest, size_t destlen, size_t col, int cols,
char op, const char *src, const char *prefix,
const char *ifstring, const char *elsestring,
- unsigned long data, format_flag flags)
+ unsigned long data, enum FormatFlag flags)
{
char fmt[16];
char tmp[SHORT_STRING];
static const char *mix_entry_fmt(char *dest, size_t destlen, size_t col, int cols,
char op, const char *src, const char *prefix,
const char *ifstring, const char *elsestring,
- unsigned long data, format_flag flags)
+ unsigned long data, enum FormatFlag flags)
{
char fmt[16];
struct Remailer *remailer = (struct Remailer *) data;
static int BotIndex = -1; /* Last mailbox visible in sidebar */
/* The source of the sidebar divider character. */
-enum div_type
+enum DivType
{
SB_DIV_USER,
SB_DIV_ASCII,
SB_DIV_UTF8
};
-enum sb_src
+enum SidebarSrc
{
SB_SRC_INCOMING,
SB_SRC_VIRT,
static const char *cb_format_str(char *dest, size_t destlen, size_t col, int cols,
char op, const char *src, const char *prefix,
const char *ifstring, const char *elsestring,
- unsigned long data, format_flag flags)
+ unsigned long data, enum FormatFlag flags)
{
struct SbEntry *sbe = (struct SbEntry *) data;
unsigned int optional;
int i;
int delim_len;
- enum div_type altchar = SB_DIV_UTF8;
+ enum DivType altchar = SB_DIV_UTF8;
/* Calculate the width of the delimiter in screen cells */
delim_len = mutt_strwidth(SidebarDividerChar);
static const char *status_format_str(char *buf, size_t buflen, size_t col, int cols,
char op, const char *src, const char *prefix,
const char *ifstring, const char *elsestring,
- unsigned long data, format_flag flags)
+ unsigned long data, enum FormatFlag flags)
{
char fmt[SHORT_STRING], tmp[SHORT_STRING], *cp = NULL;
int count, optional = (flags & MUTT_FORMAT_OPTIONAL);
return 0;
}
-url_scheme_t url_check_scheme(const char *s)
+enum UrlScheme url_check_scheme(const char *s)
{
char sbuf[STRING];
char *t = NULL;
if ((i = mutt_getvaluebyname(sbuf, UrlMap)) == -1)
return U_UNKNOWN;
else
- return (url_scheme_t) i;
+ return (enum UrlScheme) i;
}
/* ciss_parse_userhost: fill in components of ciss with info from src. Note
struct Envelope;
-typedef enum url_scheme {
+enum UrlScheme
+{
U_FILE,
U_POP,
U_POPS,
U_NOTMUCH,
#endif
U_UNKNOWN
-} url_scheme_t;
+};
#define U_DECODE_PASSWD (1)
#define U_PATH (1 << 1)
struct CissUrl
{
- url_scheme_t scheme;
+ enum UrlScheme scheme;
char *user;
char *pass;
char *host;
char *path;
};
-url_scheme_t url_check_scheme(const char *s);
+enum UrlScheme url_check_scheme(const char *s);
int url_parse_ciss(struct CissUrl *ciss, char *src);
int url_ciss_tostring(struct CissUrl *ciss, char *dest, size_t len, int flags);
int url_parse_mailto(struct Envelope *e, char **body, const char *src);