#include <lib-lib/file.h>
#include <lib-mime/mime.h>
+#include <lib-mime/rfc3676.h>
+
+#include <lib-ui/curses.h>
#include "mutt.h"
#include "recvattach.h"
#include "handler.h"
-#include "mutt_curses.h"
-#include "rfc1524.h"
-#include "rfc3676.h"
#include "keymap.h"
#include "copy.h"
#include "charset.h"
-#include "mutt_crypt.h"
+#include <lib-crypt/crypt.h>
#include "state.h"
#include "attach.h"
#include "lib.h"
-#include "lib/debug.h"
typedef int handler_f (BODY *, STATE *);
typedef handler_f *handler_t;
{
int c, ch;
char bufi[BUFI_SIZE];
- size_t l = 0;
+ ssize_t l = 0;
if (istext) {
state_set_prefix (s);
return -1;
}
-static void qp_decode_line (char *dest, char *src, size_t * l, int last)
+static void qp_decode_line (char *dest, char *src, ssize_t * l, int last)
{
char *d, *s;
char c;
{
char line[STRING];
char decline[2 * STRING];
- size_t l = 0;
- size_t linelen; /* number of input bytes in `line' */
- size_t l3;
+ ssize_t l = 0;
+ ssize_t linelen; /* number of input bytes in `line' */
+ ssize_t l3;
int last; /* store the last character in the input line */
char buf[5];
int c1, c2, c3, c4, ch, cr = 0, i;
char bufi[BUFI_SIZE];
- size_t l = 0;
+ ssize_t l = 0;
buf[4] = 0;
buf[i++] = ch;
}
if (i != 4) {
- debug_print (2, ("didn't get a multiple of 4 chars.\n"));
break;
}
else
bufi[l++] = ch;
- if (l + 8 >= sizeof (bufi))
+ if (l + 8 >= ssizeof (bufi))
mutt_convert_to_state (cd, bufi, &l, s);
}
char linelen, c, l, out;
char *pt;
char bufi[BUFI_SIZE];
- size_t k = 0;
+ ssize_t k = 0;
if (istext)
state_set_prefix (s);
char *buffer;
char *line;
char *param;
- size_t buff_len;
- size_t line_len;
- size_t line_used;
- size_t line_max;
- size_t indent_len;
- size_t word_len;
- size_t buff_used;
- size_t param_used;
- size_t param_len;
+ ssize_t buff_len;
+ ssize_t line_len;
+ ssize_t line_used;
+ ssize_t line_max;
+ ssize_t indent_len;
+ ssize_t word_len;
+ ssize_t buff_used;
+ ssize_t param_used;
+ ssize_t param_len;
int tag_level[RICH_LAST_TAG];
int WrapMargin;
STATE *s;
if (stte->line_len) {
if (stte->tag_level[RICH_CENTER] || stte->tag_level[RICH_FLUSHRIGHT]) {
/* Strip trailing white space */
- size_t y = stte->line_used - 1;
+ ssize_t y = stte->line_used - 1;
while (y && ISSPACE (stte->line[y])) {
stte->line[y] = '\0';
while (stte->line[y] && ISSPACE (stte->line[y]))
y++;
if (y) {
- size_t z;
+ ssize_t z;
for (z = y; z <= stte->line_used; z++) {
stte->line[z - y] = stte->line[z];
{
BODY *choice = NULL;
BODY *b;
- LIST *t;
+ string_list_t *t;
char buf[STRING];
int type = 0;
int mustfree = 0;
while (b) {
snprintf (buf, sizeof (buf), "%s/%s", TYPE (b), b->subtype);
if (mutt_is_autoview (b, buf)) {
- rfc1524_entry *entry = rfc1524_new_entry ();
+ rfc1524_entry *entry = rfc1524_entry_new();
if (rfc1524_mailcap_lookup (b, buf, entry, M_AUTOVIEW)) {
choice = b;
}
- rfc1524_free_entry (&entry);
+ rfc1524_entry_delete(&entry);
}
b = b->next;
}
static int autoview_handler (BODY * a, STATE * s)
{
- rfc1524_entry *entry = rfc1524_new_entry ();
+ rfc1524_entry *entry = rfc1524_entry_new();
char buffer[LONG_STRING];
char type[STRING];
char command[LONG_STRING];
if ((fpin = safe_fopen (tempfile, "w+")) == NULL) {
mutt_perror ("fopen");
- rfc1524_free_entry (&entry);
+ rfc1524_entry_delete(&entry);
return (-1);
}
if (s->flags & M_DISPLAY)
mutt_clear_error ();
}
- rfc1524_free_entry (&entry);
+ rfc1524_entry_delete(&entry);
return (rc);
}
void mutt_decode_attachment (BODY * b, STATE * s)
{
int istext = mutt_is_text_part (b);
- iconv_t cd = (iconv_t) (-1);
+ iconv_t cd = MUTT_ICONV_ERROR;
Quotebuf[0] = '\0';
const char *charset = mutt_get_parameter ("charset", b->parameter);
if (!option (OPTSTRICTMIME) && !charset)
- charset = mutt_get_first_charset (AssumedCharset);
+ charset = charset_getfirst(AssumedCharset);
if (charset && Charset)
cd = mutt_iconv_open (Charset, charset, M_ICONV_HOOK_FROM);
}
break;
}
- if (cd != (iconv_t) (-1))
+ if (cd != MUTT_ICONV_ERROR)
iconv_close (cd);
}
char tempfile[_POSIX_PATH_MAX];
handler_t handler = NULL;
long tmpoffset = 0;
- size_t tmplength = 0;
+ ssize_t tmplength = 0;
char type[STRING];
int rc = 0;
snprintf (type, sizeof (type), "%s/%s", TYPE (b), b->subtype);
if (mutt_is_autoview (b, type)) {
- rfc1524_entry *entry = rfc1524_new_entry ();
+ rfc1524_entry *entry = rfc1524_entry_new();
if (rfc1524_mailcap_lookup (b, type, entry, M_AUTOVIEW)) {
handler = autoview_handler;
s->flags &= ~M_CHARCONV;
}
- rfc1524_free_entry (&entry);
+ rfc1524_entry_delete(&entry);
}
else if (b->type == TYPETEXT) {
if (ascii_strcasecmp ("plain", b->subtype) == 0) {