Update of /cvsroot/mahogany/M/src/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4008/src/gui

Modified Files:
        wxComposeView.cpp wxOptionsDlg.cpp 
Log Message:
added autocollection of addresses in outgoing mail

Index: wxComposeView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxComposeView.cpp,v
retrieving revision 1.386
retrieving revision 1.387
diff -b -u -2 -r1.386 -r1.387
--- wxComposeView.cpp   13 May 2005 01:46:19 -0000      1.386
+++ wxComposeView.cpp   15 May 2005 21:18:23 -0000      1.387
@@ -106,4 +106,8 @@
 extern const MOption MP_ADB_SUBSTRINGEXPANSION;
 extern const MOption MP_ALWAYS_USE_EXTERNALEDITOR;
+extern const MOption MP_AUTOCOLLECT;
+extern const MOption MP_AUTOCOLLECT_ADB;
+extern const MOption MP_AUTOCOLLECT_NAMED;
+extern const MOption MP_AUTOCOLLECT_OUTGOING;
 extern const MOption MP_COMPOSE_BCC;
 extern const MOption MP_COMPOSE_CC;
@@ -2483,33 +2487,38 @@
 }
 
-void wxComposeView::CollectWhitelist()
+void
+wxComposeView::SaveRecipientsAddresses(MAction collect,
+                                       const String& book,
+                                       const String& group)
 {
-   static RecipientType all[]
-      = { Recipient_To, Recipient_Cc, Recipient_Bcc };
+   if ( collect == M_ACTION_NEVER )
+      return;
+
+   static RecipientType types[] = { Recipient_To, Recipient_Cc, Recipient_Bcc 
};
    
-   for( size_t type = 0; type < sizeof(all) / sizeof(all[0]); ++type )
+   const bool namedOnly = READ_CONFIG_BOOL(m_Profile, MP_AUTOCOLLECT_NAMED);
+
+   for ( size_t n = 0; n < WXSIZEOF(types); ++n )
    {
       wxArrayString list;
-      GetRecipients(all[type], list);
+      GetRecipients(types[n], list);
       
-      for( size_t address = 0; address < list.GetCount(); ++address )
+      for ( size_t address = 0; address < list.GetCount(); ++address )
       {
          RefCounter<AddressList> parser(AddressList::Create(list[address]));
 
-         for( Address *field = parser->GetFirst();
+         for ( Address *field = parser->GetFirst();
             field;
             field = parser->GetNext(field) )
          {
-#if 0 // AutoCollectAddress is severely broken
-            AutoCollectAddress(
+            AutoCollectAddress
+            (
                field->GetEMail(),
                field->GetName(),
-               2, // Don't ask user, just autocollect it
-               false, // Collect addresses without name too
-               READ_APPCONFIG_TEXT(MP_WHITE_LIST),
-               _T(""), // Root group
-               this // Status bar messages to soon to be destroyed frame
+               collect,
+               namedOnly,
+               book,
+               group
             );
-#endif
          }
       }
@@ -2534,6 +2543,5 @@
 }
 
-void wxComposeView::GetRecipients(RecipientType type,
-   wxArrayString& list) const
+void wxComposeView::GetRecipients(RecipientType type, wxArrayString& list) 
const
 {
    list.Empty();
@@ -4308,4 +4316,15 @@
    if ( success )
    {
+      if ( READ_CONFIG(m_Profile, MP_AUTOCOLLECT_OUTGOING) )
+      {
+         // remember the addresses we sent mail to
+         SaveRecipientsAddresses
+         (
+            (MAction)(long)READ_CONFIG(m_Profile, MP_AUTOCOLLECT),
+            READ_CONFIG_TEXT(m_Profile, MP_AUTOCOLLECT_ADB),
+            _("Previous Recipients")
+         );
+      }
+
       if ( m_OriginalMessage != NULL )
       {

Index: wxOptionsDlg.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxOptionsDlg.cpp,v
retrieving revision 1.419
retrieving revision 1.420
diff -b -u -2 -r1.419 -r1.420
--- wxOptionsDlg.cpp    4 Oct 2004 12:30:06 -0000       1.419
+++ wxOptionsDlg.cpp    15 May 2005 21:18:24 -0000      1.420
@@ -471,4 +471,5 @@
    ConfigField_AutoCollectAdb,
    ConfigField_AutoCollectSenderOnly,
+   ConfigField_AutoCollectOutgoing,
    ConfigField_AutoCollectNameless,
    ConfigField_WhiteList,
@@ -1570,5 +1571,5 @@
    { gettext_noop("Is &home folder"), Field_Bool | Field_NotApp, -1 },
 
-   // adb: autocollect and bbdb options
+   // autocollecting and address books options
    { gettext_noop("The addresses listed below are the ones which are\n"
                   "recognized as being your own when showing the message\n"
@@ -1590,4 +1591,5 @@
    { 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("&Whitelist"),                   Field_Text | Field_AppWide, 
-1 },
@@ -2085,5 +2087,5 @@
    CONFIG_NONE(), // is home checkbox
 
-   // addresses
+   // autocollecting and address books options
    CONFIG_NONE(),
    CONFIG_ENTRY(MP_FROM_REPLACE_ADDRESSES),
@@ -2094,4 +2096,5 @@
    CONFIG_ENTRY(MP_AUTOCOLLECT_ADB),
    CONFIG_ENTRY(MP_AUTOCOLLECT_SENDER),
+   CONFIG_ENTRY(MP_AUTOCOLLECT_OUTGOING),
    CONFIG_ENTRY(MP_AUTOCOLLECT_NAMED),
    CONFIG_ENTRY(MP_WHITE_LIST),



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to