Revision: 7311
http://mahogany.svn.sourceforge.net/mahogany/?rev=7311&view=rev
Author: vadz
Date: 2007-08-04 07:33:07 -0700 (Sat, 04 Aug 2007)
Log Message:
-----------
decouple options for autocollecting addresses in incoming and outgoing email,
in particular allow the latter when the former is disabled
Modified Paths:
--------------
trunk/M/CHANGES
trunk/M/include/Moptions.h
trunk/M/src/classes/MessageView.cpp
trunk/M/src/classes/Moptions.cpp
trunk/M/src/gui/wxComposeView.cpp
trunk/M/src/gui/wxOptionsDlg.cpp
Added Paths:
-----------
trunk/M/tests/mime/
trunk/M/tests/mime/Makefile
trunk/M/tests/mime/decode.cpp
Modified: trunk/M/CHANGES
===================================================================
--- trunk/M/CHANGES 2007-08-04 14:15:56 UTC (rev 7310)
+++ trunk/M/CHANGES 2007-08-04 14:33:07 UTC (rev 7311)
@@ -6,9 +6,10 @@
See at the end of file for the list of contributors (initials appearing
in the second column of the changelog below).
-Release 0.68 '' September xx, 2006
+Release 0.68 '' September xx, 2007
---------------------------------------
+2007-08-04 VZ: Allow autocollecting addresses in outgoing messages only
2007-04-26 VZ: Add the possibility to treat different addresses as equivalent
2007-01-10 VZ: Show the message subject in the composer window title bar
2007-01-08 VZ: Added support for "subject" parameter of mailto: URLs
Modified: trunk/M/include/Moptions.h
===================================================================
--- trunk/M/include/Moptions.h 2007-08-04 14:15:56 UTC (rev 7310)
+++ trunk/M/include/Moptions.h 2007-08-04 14:33:07 UTC (rev 7311)
@@ -371,7 +371,7 @@
extern const MOption MP_USEOUTGOINGFOLDER;
extern const MOption MP_OUTGOINGFOLDER;
extern const MOption MP_SHOWHEADERS;
-extern const MOption MP_AUTOCOLLECT;
+extern const MOption MP_AUTOCOLLECT_INCOMING;
extern const MOption MP_AUTOCOLLECT_ADB;
extern const MOption MP_AUTOCOLLECT_NAMED;
extern const MOption MP_AUTOCOLLECT_SENDER;
@@ -1142,7 +1142,7 @@
/// Show all message headers?
#define MP_SHOWHEADERS_NAME _T("ShowHeaders")
/// Autocollect email addresses? 0=no 1=ask 2=always
-#define MP_AUTOCOLLECT_NAME _T("AutoCollect")
+#define MP_AUTOCOLLECT_INCOMING_NAME _T("AutoCollect")
/// Name of the address books for autocollected addresses
#define MP_AUTOCOLLECT_ADB_NAME _T("AutoCollectAdb")
/// Autocollect email addresses from sender only ?
@@ -2137,7 +2137,7 @@
/// Show all message headers?
#define MP_SHOWHEADERS_DEFVAL 0l
/// Autocollect email addresses?
-#define MP_AUTOCOLLECT_DEFVAL (long)M_ACTION_ALWAYS
+#define MP_AUTOCOLLECT_INCOMING_DEFVAL (long)M_ACTION_ALWAYS
/// Name of the address books for autocollected addresses
#define MP_AUTOCOLLECT_ADB_DEFVAL _T("autocollect.adb")
/// Autocollect email addresses from sender only ?
Modified: trunk/M/src/classes/MessageView.cpp
===================================================================
--- trunk/M/src/classes/MessageView.cpp 2007-08-04 14:15:56 UTC (rev 7310)
+++ trunk/M/src/classes/MessageView.cpp 2007-08-04 14:33:07 UTC (rev 7311)
@@ -95,7 +95,7 @@
// options we use here
// ----------------------------------------------------------------------------
-extern const MOption MP_AUTOCOLLECT;
+extern const MOption MP_AUTOCOLLECT_INCOMING;
extern const MOption MP_AUTOCOLLECT_ADB;
extern const MOption MP_AUTOCOLLECT_SENDER;
extern const MOption MP_AUTOCOLLECT_NAMED;
@@ -1170,7 +1170,7 @@
settings->showExtImages = READ_CONFIG_BOOL(profile,
MP_INLINE_GFX_EXTERNAL);
}
- settings->autocollect = (MAction)(long)READ_CONFIG(profile, MP_AUTOCOLLECT);
+ settings->autocollect = (MAction)(long)READ_CONFIG(profile,
MP_AUTOCOLLECT_INCOMING);
settings->autocollectSenderOnly = READ_CONFIG(profile,
MP_AUTOCOLLECT_SENDER);
settings->autocollectNamed = READ_CONFIG(profile, MP_AUTOCOLLECT_NAMED);
settings->autocollectBookName = READ_CONFIG_TEXT(profile,
MP_AUTOCOLLECT_ADB);
Modified: trunk/M/src/classes/Moptions.cpp
===================================================================
--- trunk/M/src/classes/Moptions.cpp 2007-08-04 14:15:56 UTC (rev 7310)
+++ trunk/M/src/classes/Moptions.cpp 2007-08-04 14:33:07 UTC (rev 7311)
@@ -430,7 +430,7 @@
const MOption MP_OUTGOINGFOLDER;
const MOption MP_SHOWHEADERS;
-const MOption MP_AUTOCOLLECT;
+const MOption MP_AUTOCOLLECT_INCOMING;
const MOption MP_AUTOCOLLECT_ADB;
const MOption MP_AUTOCOLLECT_SENDER;
const MOption MP_AUTOCOLLECT_OUTGOING;
@@ -846,7 +846,7 @@
DEFINE_OPTION(MP_USEOUTGOINGFOLDER),
DEFINE_OPTION(MP_OUTGOINGFOLDER),
DEFINE_OPTION(MP_SHOWHEADERS),
- DEFINE_OPTION(MP_AUTOCOLLECT),
+ DEFINE_OPTION(MP_AUTOCOLLECT_INCOMING),
DEFINE_OPTION(MP_AUTOCOLLECT_ADB),
DEFINE_OPTION(MP_AUTOCOLLECT_SENDER),
DEFINE_OPTION(MP_AUTOCOLLECT_OUTGOING),
Modified: trunk/M/src/gui/wxComposeView.cpp
===================================================================
--- trunk/M/src/gui/wxComposeView.cpp 2007-08-04 14:15:56 UTC (rev 7310)
+++ trunk/M/src/gui/wxComposeView.cpp 2007-08-04 14:33:07 UTC (rev 7311)
@@ -109,7 +109,7 @@
extern const MOption MP_ADB_SUBSTRINGEXPANSION;
extern const MOption MP_ALWAYS_USE_EXTERNALEDITOR;
-extern const MOption MP_AUTOCOLLECT;
+extern const MOption MP_AUTOCOLLECT_INCOMING;
extern const MOption MP_AUTOCOLLECT_ADB;
extern const MOption MP_AUTOCOLLECT_NAMED;
extern const MOption MP_AUTOCOLLECT_OUTGOING;
@@ -4621,7 +4621,7 @@
// remember the addresses we sent mail to
SaveRecipientsAddresses
(
- (MAction)(long)READ_CONFIG(m_Profile, MP_AUTOCOLLECT),
+ M_ACTION_ALWAYS,
READ_CONFIG_TEXT(m_Profile, MP_AUTOCOLLECT_ADB),
_("Previous Recipients")
);
Modified: trunk/M/src/gui/wxOptionsDlg.cpp
===================================================================
--- trunk/M/src/gui/wxOptionsDlg.cpp 2007-08-04 14:15:56 UTC (rev 7310)
+++ trunk/M/src/gui/wxOptionsDlg.cpp 2007-08-04 14:33:07 UTC (rev 7311)
@@ -481,11 +481,11 @@
ConfigField_MLAddressesHelp,
ConfigField_MLAddresses,
ConfigField_AutoCollect_HelpText,
- ConfigField_AutoCollect,
ConfigField_AutoCollectAdb,
+ ConfigField_AutoCollectIncoming,
ConfigField_AutoCollectSenderOnly,
+ ConfigField_AutoCollectNameless,
ConfigField_AutoCollectOutgoing,
- ConfigField_AutoCollectNameless,
ConfigField_WhiteListHelp,
ConfigField_WhiteList,
ConfigField_EquivAddressesHelp,
@@ -1658,14 +1658,14 @@
Field_Message, -1 },
{ gettext_noop("&Mailing list addresses"), Field_List, -1, },
{ gettext_noop("Mahogany may automatically remember all e-mail addresses in
the messages you\n"
- "receive in a special address book. This is called
'address\n"
- "autocollection' and may be turned on or off from this
page."),
+ "receive and/or send in a special address book. This is
called \"address\n"
+ "autocollection\" and may be configured using the options
below:"),
Field_Message, -1
},
- { gettext_noop("&Autocollect addresses"), Field_Radio, -1,
},
- { gettext_noop("Address &book to use"), Field_Text,
ConfigField_AutoCollect },
- { gettext_noop("Autocollect only &senders' addresses"), Field_Bool,
ConfigField_AutoCollect},
- { gettext_noop("Collect addresses in &outgoing mail"), Field_Bool,
ConfigField_AutoCollect},
- { gettext_noop("Ignore addresses without &names"), Field_Bool,
ConfigField_AutoCollect},
+ { gettext_noop("Address &book to use"), Field_Text, -1 },
+ { gettext_noop("Collect addresses in &incoming mail"), Field_Radio, -1,
},
+ { gettext_noop("Autocollect only &senders' addresses"), Field_Bool,
ConfigField_AutoCollectIncoming},
+ { gettext_noop("Ignore addresses without &names"), Field_Bool,
ConfigField_AutoCollectIncoming},
+ { gettext_noop("Collect addresses in &outgoing mail"), Field_Bool, -1 },
{ gettext_noop("\nWhite list is the list of addresses which always pass "
"through the built-in spam filter."),
@@ -2192,11 +2192,11 @@
CONFIG_NONE(),
CONFIG_ENTRY(MP_LIST_ADDRESSES),
CONFIG_NONE(),
- CONFIG_ENTRY(MP_AUTOCOLLECT),
CONFIG_ENTRY(MP_AUTOCOLLECT_ADB),
+ CONFIG_ENTRY(MP_AUTOCOLLECT_INCOMING),
CONFIG_ENTRY(MP_AUTOCOLLECT_SENDER),
+ CONFIG_ENTRY(MP_AUTOCOLLECT_NAMED),
CONFIG_ENTRY(MP_AUTOCOLLECT_OUTGOING),
- CONFIG_ENTRY(MP_AUTOCOLLECT_NAMED),
CONFIG_NONE(),
CONFIG_ENTRY(MP_WHITE_LIST),
CONFIG_NONE(),
Added: trunk/M/tests/mime/Makefile
===================================================================
--- trunk/M/tests/mime/Makefile (rev 0)
+++ trunk/M/tests/mime/Makefile 2007-08-04 14:33:07 UTC (rev 7311)
@@ -0,0 +1,21 @@
+WX_CONFIG := /usr/local/src/build/wx-gtkud/wx-config
+
+top_builddir := /home/zeitlin/build/M-gtkud
+top_srcdir := ../..
+
+CXXFLAGS := -I$(top_srcdir)/include `$(WX_CONFIG) --cxxflags`
+
+all: decode
+
+decode: decode.o $(top_builddir)/src/mail/MimeDecode.o
+ `$(WX_CONFIG) --cxx` -o $@ $^ `$(WX_CONFIG) --libs`
+
+decode.o: decode.cpp
+
+$(top_builddir)/src/mail/MimeDecode.o: $(top_srcdir)/src/mail/MimeDecode.cpp
+ $(MAKE) -C $(top_builddir)/src mail/MimeDecode.o
+
+clean:
+ $(RM) decode.o decode
+
+.PHONY: all clean
Added: trunk/M/tests/mime/decode.cpp
===================================================================
--- trunk/M/tests/mime/decode.cpp (rev 0)
+++ trunk/M/tests/mime/decode.cpp 2007-08-04 14:33:07 UTC (rev 7311)
@@ -0,0 +1,241 @@
+#include <wx/init.h>
+#include <wx/string.h>
+
+typedef wxString String;
+
+#include "mail/MimeDecode.h"
+
+extern "C" {
+
+void *fs_get (size_t size) { return malloc(size); }
+void fs_resize (void **p, size_t size) { *p = realloc(*p, size); }
+void fs_give (void **p) { free(*p); *p = NULL; }
+
+char *cpystr (const char *string)
+{
+ return string ? strcpy ((char *) fs_get (1 + strlen (string)),string) : NULL;
+}
+
+void mm_log (char *string,long errflg)
+{
+ printf("mm_log[%ld]: %s\n", errflg, string);
+}
+
+void fatal (char *string)
+{
+ mm_log(string, -1);
+ abort();
+}
+
+#define WARN (long) 1 /* mm_log warning type */
+#define ERROR (long) 2 /* mm_log error type */
+#define PARSE (long) 3 /* mm_log parse error type */
+#define BYE (long) 4 /* mm_notify stream dying */
+
+#define NIL 0 /* convenient name */
+
+#define MAILTMPLEN 1024 /* size of a temporary buffer */
+
+/* Convert two hex characters into byte
+ * Accepts: char for high nybble
+ * char for low nybble
+ * Returns: byte
+ *
+ * Arguments must be isxdigit validated
+ */
+
+unsigned char hex2byte (unsigned char c1,unsigned char c2)
+{
+ /* merge the two nybbles */
+ return ((c1 -= (isdigit (c1) ? '0' : ((c1 <= 'Z') ? 'A' : 'a') - 10)) << 4) +
+ (c2 - (isdigit (c2) ? '0' : ((c2 <= 'Z') ? 'A' : 'a') - 10));
+}
+/* Convert QUOTED-PRINTABLE contents to 8BIT
+ * Accepts: source
+ * length of source
+ * pointer to return destination length
+ * Returns: destination as 8-bit text or NIL if error
+ */
+
+unsigned char *rfc822_qprint (unsigned char *src,unsigned long srcl,
+ unsigned long *len)
+{
+ char tmp[MAILTMPLEN];
+ unsigned int bogon = NIL;
+ unsigned char *ret = (unsigned char *) fs_get ((size_t) srcl + 1);
+ unsigned char *d = ret;
+ unsigned char *t = d;
+ unsigned char *s = src;
+ unsigned char c,e;
+ *len = 0; /* in case we return an error */
+ /* until run out of characters */
+ while (((unsigned long) (s - src)) < srcl) {
+ switch (c = *s++) { /* what type of character is it? */
+ case '=': /* quoting character */
+ if (((unsigned long) (s - src)) < srcl) switch (c = *s++) {
+ case '\0': /* end of data */
+ s--; /* back up pointer */
+ break;
+ case '\015': /* non-significant line break */
+ if ((((unsigned long) (s - src)) < srcl) && (*s == '\012')) s++;
+ case '\012': /* bare LF */
+ t = d; /* accept any leading spaces */
+ break;
+ default: /* two hex digits then */
+ if (!(isxdigit (c) && (((unsigned long) (s - src)) < srcl) &&
+ (e = *s++) && isxdigit (e))) {
+ /* This indicates bad MIME. One way that it can be caused is if
+ a single-section message was QUOTED-PRINTABLE encoded and then
+ something (e.g. a mailing list processor) appended text. The
+ problem is that there is no way to determine where the encoded
+ data ended and the appended crud began. Consequently, prudent
+ software will always encapsulate a QUOTED-PRINTABLE segment
+ inside a MULTIPART.
+ */
+ if (!bogon++) { /* only do this once */
+ sprintf (tmp,"Invalid quoted-printable sequence: =%.80s",
+ (char *) s - 1);
+ mm_log (tmp,PARSE);
+ }
+ *d++ = '='; /* treat = as ordinary character */
+ *d++ = c; /* and the character following */
+ t = d; /* note point of non-space */
+ break;
+ }
+ *d++ = hex2byte (c,e); /* merge the two hex digits */
+ t = d; /* note point of non-space */
+ break;
+ }
+ break;
+ case ' ': /* space, possibly bogus */
+ *d++ = c; /* stash the space but don't update s */
+ break;
+ case '\015': /* end of line */
+ case '\012': /* bare LF */
+ d = t; /* slide back to last non-space, drop in */
+ default:
+ *d++ = c; /* stash the character */
+ t = d; /* note point of non-space */
+ }
+ }
+ *d = '\0'; /* tie off results */
+ *len = d - ret; /* calculate length */
+ return ret; /* return the string */
+}
+/* Convert BASE64 contents to binary
+ * Accepts: source
+ * length of source
+ * pointer to return destination length
+ * Returns: destination as binary or NIL if error
+ */
+
+#define WSP 0176 /* NUL, TAB, LF, FF, CR, SPC */
+#define JNK 0177
+#define PAD 0100
+
+void *rfc822_base64 (unsigned char *src,unsigned long srcl,unsigned long *len)
+{
+ char c,*s,tmp[MAILTMPLEN];
+ void *ret = fs_get ((size_t) ((*len = 4 + ((srcl * 3) / 4))) + 1);
+ char *d = (char *) ret;
+ int e;
+ static char decode[256] = {
+ WSP,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,WSP,WSP,JNK,WSP,WSP,JNK,JNK,
+ JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,
+ WSP,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,076,JNK,JNK,JNK,077,
+ 064,065,066,067,070,071,072,073,074,075,JNK,JNK,JNK,PAD,JNK,JNK,
+ JNK,000,001,002,003,004,005,006,007,010,011,012,013,014,015,016,
+ 017,020,021,022,023,024,025,026,027,030,031,JNK,JNK,JNK,JNK,JNK,
+ JNK,032,033,034,035,036,037,040,041,042,043,044,045,046,047,050,
+ 051,052,053,054,055,056,057,060,061,062,063,JNK,JNK,JNK,JNK,JNK,
+ JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,
+ JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,
+ JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,
+ JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,
+ JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,
+ JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,
+ JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,
+ JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK
+ };
+ /* initialize block */
+ memset (ret,0,((size_t) *len) + 1);
+ *len = 0; /* in case we return an error */
+
+ /* simple-minded decode */
+ for (e = 0; srcl--; ) switch (c = decode[*src++]) {
+ default: /* valid BASE64 data character */
+ switch (e++) { /* install based on quantum position */
+ case 0:
+ *d = c << 2; /* byte 1: high 6 bits */
+ break;
+ case 1:
+ *d++ |= c >> 4; /* byte 1: low 2 bits */
+ *d = c << 4; /* byte 2: high 4 bits */
+ break;
+ case 2:
+ *d++ |= c >> 2; /* byte 2: low 4 bits */
+ *d = c << 6; /* byte 3: high 2 bits */
+ break;
+ case 3:
+ *d++ |= c; /* byte 3: low 6 bits */
+ e = 0; /* reinitialize mechanism */
+ break;
+ }
+ break;
+ case WSP: /* whitespace */
+ break;
+ case PAD: /* padding */
+ switch (e++) { /* check quantum position */
+ case 3: /* one = is good enough in quantum 3 */
+ /* make sure no data characters in remainder */
+ for (; srcl; --srcl) switch (decode[*src++]) {
+ /* ignore space, junk and extraneous padding */
+ case WSP: case JNK: case PAD:
+ break;
+ default: /* valid BASE64 data character */
+ /* This indicates bad MIME. One way that it can be caused is if
+ a single-section message was BASE64 encoded and then something
+ (e.g. a mailing list processor) appended text. The problem is
+ that in 1 out of 3 cases, there is no padding and hence no way
+ to detect the end of the data. Consequently, prudent software
+ will always encapsulate a BASE64 segment inside a MULTIPART.
+ */
+ sprintf (tmp,"Possible data truncation in rfc822_base64(): %.80s",
+ (char *) src - 1);
+ if (s = strpbrk (tmp,"\015\012")) *s = NIL;
+ mm_log (tmp,PARSE);
+ srcl = 1; /* don't issue any more messages */
+ break;
+ }
+ break;
+ case 2: /* expect a second = in quantum 2 */
+ if (srcl && (*src == '=')) break;
+ default: /* impossible quantum position */
+ fs_give (&ret);
+ return NIL;
+ }
+ break;
+ case JNK: /* junk character */
+ fs_give (&ret);
+ return NIL;
+ }
+ *len = d - (char *) ret; /* calculate data length */
+ *d = '\0'; /* NUL terminate just in case */
+ return ret; /* return the string */
+}
+}
+
+int main()
+{
+ wxInitializer init;
+
+ String s;
+
+ s = MIME::DecodeHeader("=?koi8-r?B?79TXxdTZIM7BINfP0NLP09k=?=");
+ s =
MIME::DecodeHeader("=?koi8-r?B?99jA1sHOyc4g68/O09TBztTJziBcKENvbnN0YW50aW5lIFZ5dXpoYW5pblwp?=
<[EMAIL PROTECTED]>");
+ s = MIME::DecodeHeader("Ludovic =?ISO-8859-1?Q?P=E9net?= <[EMAIL
PROTECTED]>");
+ printf(s.utf8_str());
+
+ return 0;
+}
+
Property changes on: trunk/M/tests/mime/decode.cpp
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates