2012-07-10 [paul] 3.8.1cvs13

* src/messageview.c
	* src/common/defs.h
	* src/common/quoted-printable.c
	* src/common/quoted-printable.h
		revert 3.8.1cvs2,3,4,5  because they (somewhere!) cause
		the bug: partial message text loss
This commit is contained in:
Paul Mangan 2012-07-10 21:13:07 +00:00
parent 86aa83338d
commit 452b4d0d24
7 changed files with 62 additions and 83 deletions

View file

@ -1,3 +1,12 @@
2012-07-10 [paul] 3.8.1cvs13
* src/messageview.c
* src/common/defs.h
* src/common/quoted-printable.c
* src/common/quoted-printable.h
revert 3.8.1cvs2,3,4,5 because they (somewhere!) cause
the bug: partial message text loss
2012-07-10 [mones] 3.8.1cvs12
* src/plugins/pgpcore/sgpgme.c

View file

@ -4387,3 +4387,4 @@
( cvs diff -u -r 1.1.2.23 -r 1.1.2.24 src/gtk/icon_legend.c; ) > 3.8.1cvs10.patchset
( cvs diff -u -r 1.1.2.70 -r 1.1.2.71 src/plugins/pgpcore/sgpgme.c; ) > 3.8.1cvs11.patchset
( cvs diff -u -r 1.1.2.71 -r 1.1.2.72 src/plugins/pgpcore/sgpgme.c; ) > 3.8.1cvs12.patchset
( cvs diff -u -r 1.94.2.234 -r 1.94.2.235 src/messageview.c; cvs diff -u -r 1.9.2.57 -r 1.9.2.58 src/common/defs.h; cvs diff -u -r 1.3.2.18 -r 1.3.2.19 src/common/quoted-printable.c; cvs diff -u -r 1.3.2.10 -r 1.3.2.11 src/common/quoted-printable.h; ) > 3.8.1cvs13.patchset

View file

@ -12,7 +12,7 @@ MINOR_VERSION=8
MICRO_VERSION=1
INTERFACE_AGE=0
BINARY_AGE=0
EXTRA_VERSION=12
EXTRA_VERSION=13
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=

View file

@ -148,9 +148,6 @@
#define BUFFSIZE 8192
/* according to RFC 821 1000 characters including CRLF */
#define MAXSMTPTEXTLEN 1000
#ifndef MAXPATHLEN
# define MAXPATHLEN 4095
#endif

View file

@ -22,81 +22,66 @@
#include "utils.h"
#define MAX_LINELEN 76
#define IS_LBREAK(p) \
((p)[0] == '\n' ? 1 : ((p)[0] == '\r' && (p)[1] == '\n') ? 2 : 0)
(*(p) == '\0' || *(p) == '\n' || (*(p) == '\r' && *((p) + 1) == '\n'))
gint qp_encode(gboolean text, gchar *out, const guchar *in, gint len)
#define SOFT_LBREAK_IF_REQUIRED(n) \
if (len + (n) > MAX_LINELEN || \
(len + (n) == MAX_LINELEN && (!IS_LBREAK(inp + 1)))) { \
*outp++ = '='; \
*outp++ = '\n'; \
len = 0; \
}
void qp_encode_line(gchar *out, const guchar *in)
{
/* counters of input/output characters */
gint inc = 0;
gint outc = 1; /* one character reserved for '=' soft line break */
const guchar *inp = in;
gchar *outp = out;
guchar ch;
gint len = 0;
while(inc < len) {
/* allow literal linebreaks in text */
if(text) {
if(IS_LBREAK(in)) {
/* inserting linebreaks is the job of our caller */
g_assert(outc <= MAX_LINELEN);
*out = '\0';
return inc + IS_LBREAK(in);
while (*inp != '\0') {
ch = *inp;
if (IS_LBREAK(inp)) {
*outp++ = '\n';
len = 0;
if (*inp == '\r')
inp++;
inp++;
} else if (ch == '\t' || ch == ' ') {
if (IS_LBREAK(inp + 1)) {
SOFT_LBREAK_IF_REQUIRED(3);
*outp++ = '=';
get_hex_str(outp, ch);
outp += 2;
len += 3;
inp++;
} else {
SOFT_LBREAK_IF_REQUIRED(1);
*outp++ = *inp++;
len++;
}
if(IS_LBREAK(in+1)) {
/* free the reserved character since no softbreak
* will be needed after the current character */
outc--;
/* guard against whitespace before a literal linebreak */
if(*in == ' ' || *in == '\t') {
goto escape;
}
}
}
if(*in == '=') {
goto escape;
}
/* Cave: Whitespace is unconditionally output literally,
* but according to the RFC it must not be output before a
* linebreak.
* This requirement is obeyed by quoting all linebreaks
* and therefore ending all lines with '='. */
else if((*in >= ' ' && *in <= '~') || *in == '\t') {
if(outc + 1 <= MAX_LINELEN) {
*out++ = *in++;
outc++;
inc++;
}
else break;
}
else {
escape:
if(outc + 3 <= MAX_LINELEN) {
*out++ = '=';
outc++;
get_hex_str(out, *in);
out += 2;
outc += 2;
in++;
inc++;
}
else break;
} else if ((ch >= 33 && ch <= 60) || (ch >= 62 && ch <= 126)) {
SOFT_LBREAK_IF_REQUIRED(1);
*outp++ = *inp++;
len++;
} else {
SOFT_LBREAK_IF_REQUIRED(3);
*outp++ = '=';
get_hex_str(outp, ch);
outp += 2;
len += 3;
inp++;
}
}
g_assert(outc <= MAX_LINELEN);
*out++ = '=';
*out = '\0';
return inc;
}
void qp_encode_line(gchar *out, const guchar *in) {
while (*in != '\0') {
in += qp_encode(TRUE, out, in, strlen(in));
if (len > 0)
*outp++ = '\n';
while(*out != '\0') out++;
*out++ = '\n';
*out++ = '\0';
}
*outp = '\0';
}
gint qp_decode_line(gchar *str)

View file

@ -22,18 +22,6 @@
#include <glib.h>
/* Processes at most 78 characters from in buffer,
* and stores one NULL-terminated line of at most 76 characters (excl. \0) of
* quoted-printable output without terminating newline characters in out buffer.
* Except when encoding text, every output line ends in a soft line break.
* Therefore the caller can chain multiple lines of encoded data resulting from
* sequential runs by glueing them together with line breaks.
* The number of processed input characters is returned. */
gint qp_encode (gboolean text,
gchar *out,
const guchar *in,
gint len);
/* Deprecated */
void qp_encode_line (gchar *out,
const guchar *in);
gint qp_decode_line (gchar *str);

View file

@ -988,9 +988,8 @@ static gint disposition_notification_send(MsgInfo *msginfo)
extract_address(orig_to);
}
if (msginfo->subject && *(msginfo->subject)) {
gint len = strlen(msginfo->subject);
enc_sub = g_malloc0(len*8);
qp_encode(TRUE, enc_sub, (const guchar *)msginfo->subject, len);
enc_sub = g_malloc0(strlen(msginfo->subject)*8);
qp_encode_line(enc_sub, (const guchar *)msginfo->subject);
g_strstrip(enc_sub);
}
ok = fprintf(fp,"MIME-Version: 1.0\n"