Update of /cvsroot/mahogany/M/src/mail
In directory usw-pr-cvs1:/tmp/cvs-serv7495/src/mail

Modified Files:
        SendMessageCC.cpp 
Log Message:
added SetFcc, removed old '#' hack from SendMessage

Index: SendMessageCC.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/SendMessageCC.cpp,v
retrieving revision 1.196
retrieving revision 1.197
diff -b -u -2 -r1.196 -r1.197
--- SendMessageCC.cpp   2 Sep 2002 16:14:35 -0000       1.196
+++ SendMessageCC.cpp   7 Sep 2002 00:03:25 -0000       1.197
@@ -290,5 +290,5 @@
       m_OutboxName = READ_CONFIG_TEXT(profile,MP_OUTBOX_NAME);
    if ( READ_CONFIG(profile,MP_USEOUTGOINGFOLDER) )
-      m_SentMailName = READ_CONFIG_TEXT(profile,MP_OUTGOINGFOLDER);
+      m_FccList.push_back(new String(READ_CONFIG_TEXT(profile,MP_OUTGOINGFOLDER)));
 
    // check that we have password if we use it
@@ -775,10 +775,6 @@
    }
 
-   // first remove '#fcc' stuff
-   String addressNoFCC = address;
-   ExtractFccFolders(addressNoFCC);
-
    // parse into ADDRESS struct
-   *pAdr = ParseAddressList(addressNoFCC, m_DefaultHost);
+   *pAdr = ParseAddressList(address, m_DefaultHost);
 
    // finally filter out any invalid addressees
@@ -848,27 +844,42 @@
 }
 
-void
-SendMessageCC::ExtractFccFolders(String &addresses)
+bool
+SendMessageCC::SetFcc(const String& fcc)
 {
-   kbStringList addrList;
-   kbStringList::iterator i;
+   m_FccList.clear();
 
-   char *buf = strutil_strdup(addresses);
-   // addresses are comma separated:
-   strutil_tokenise(buf, ",", addrList);
-   delete [] buf;
-   addresses = ""; // clear the address list
-   for(i = addrList.begin(); i != addrList.end(); i++)
-   {
-      strutil_delwhitespace(**i);
-      if( *((*i)->c_str()) == '#')  // folder aliases are #foldername
-         m_FccList.push_back(new String((*i)->c_str()+1)); // only the foldername
-      else
+   wxArrayString fccFolders = strutil_restore_array(fcc, ',');
+   size_t count = fccFolders.GetCount();
+   for ( size_t n = 0; n < count; n++ )
       {
-         if(! strutil_isempty(addresses))
-            addresses += ", ";
-         addresses += **i;
+      String folderName = fccFolders[n];
+      strutil_delwhitespace(folderName);
+
+      if ( folderName.empty() )
+      {
+         // be lenient and simply ignore
+         continue;
       }
+
+      // ignore the leading slash, if any: the user may specify it, but it
+      // shouldn't be passed to MFolder 
+      if ( folderName[0u] == '/' )
+         folderName.erase(0, 1);
+
+      MFolder_obj folder(folderName);
+      if ( !folder )
+      {
+         // an interesting idea: what if we interpreted the strings which are
+         // not folder names as the file names? this would allow saving
+         // outgoing messages to files very easily...
+         ERRORMESSAGE((_("The folder '%s' specified in the FCC list "
+                         "doesn't exist."), folderName.c_str()));
+         return false;
+      }
+
+      m_FccList.push_back(new String(folderName));
    }
+
+   return true;
 }
 
@@ -1441,15 +1452,7 @@
       success = Send(flags);
 
-      // make copy in the "SentMail" folder?
       if ( success )
       {
-         if ( !m_SentMailName.empty() )
-         {
-            // copy it to the sent mail in addition to all other configured
-            // folders
-            m_FccList.push_back(new String(m_SentMailName));
-         }
-
-         // save it in the local folders
+         // save it in the local folders, if any
          for ( kbStringList::iterator i = m_FccList.begin();
                i != m_FccList.end();



-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to