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

Modified Files:
        MailFolderCC.cpp 
Log Message:
fixes to make ListFolders work with MBX and MH drivers under Windows

Index: MailFolderCC.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/MailFolderCC.cpp,v
retrieving revision 1.708
retrieving revision 1.709
diff -b -u -2 -r1.708 -r1.709
--- MailFolderCC.cpp    30 Jun 2005 23:39:49 -0000      1.708
+++ MailFolderCC.cpp    1 Jul 2005 15:01:13 -0000       1.709
@@ -5076,9 +5076,15 @@
    // translate IMAP spec to folder path
    String path;
-   if ( !name.StartsWith(mf->m_ImapSpec, &path) )
+   const String& root = mf->m_listData->GetRootSpec();
+   const size_t lenRoot = root.length();
+   if ( wxStrnicmp(name, root, lenRoot) != 0 )
    {
       FAIL_MSG( _T("returned mailbox doesn't start with reference?") );
       path = name;
    }
+   else
+   {
+      path.assign(name, lenRoot, String::npos);
+   }
 
    // create the event corresponding to the folder and process it immediately
@@ -5091,10 +5097,10 @@
                ASMailFolder::ResultFolderExists::Create
                (
-                mf->m_listData->m_ASMailFolder,
-                mf->m_listData->m_Ticket,
+                mf->m_listData->GetFolder(),
+                mf->m_listData->GetTicket(),
                 path,
                 delim,
                 attrib,
-                mf->m_listData->m_UserData
+                mf->m_listData->GetData()
                )
             ).get()
@@ -5371,6 +5377,8 @@
 inline
 MailFolderCC::ListFoldersData::ListFoldersData(ASMailFolder *asmf,
+                                               const String& rootSpec,
                                                Ticket ticket,
                                                UserData ud)
+                             : m_RootSpec(rootSpec)
 {
    m_UserData = ud;
@@ -5429,17 +5437,24 @@
    }
 
-   spec << reference << (pattern.empty() ? String(_T("*")) : pattern);
-
 #ifdef OS_WIN
-   // c-client code only accepts slashes for file path separators
-   spec.Replace("\\", "/");
+   // c-client code only accepts backslashes for file path separators in
+   // MBX routines, so canonicalize the spec
+   if ( GetType() == MF_FILE )
+      spec.Replace("/", "\\");
 #endif // OS_WIN
 
 
    // remember list data, this will be used from mm_list() called by mail_list
-   m_listData = new ListFoldersData(asmf, ticket, ud);
+   m_listData = new ListFoldersData(asmf, spec, ticket, ud);
 
    (subscribedOnly ? mail_lsub : mail_list)
-      (m_MailStream, NULL, const_cast<char *>(spec.c_str()));
+   (
+      m_MailStream,
+      NULL,
+      const_cast<char *>(
+         (spec + reference + (pattern.empty() ? String(_T("*")) : pattern))
+            .c_str()
+      )
+   );
 
    // send event telling about end of listing:
@@ -5450,5 +5465,5 @@
             (
                ASMailFolder::ResultFolderExists::
-               CreateNoMore(asmf, m_listData->m_Ticket, m_listData->m_UserData)
+               CreateNoMore(asmf, m_listData->GetTicket(), 
m_listData->GetData())
             ).get()
           )



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to