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

Modified Files:
        ListReceiver.cpp 
Log Message:
added ListEventReceiver::ListAll()

Index: ListReceiver.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/classes/ListReceiver.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -u -2 -r1.1 -r1.2
--- ListReceiver.cpp    8 Oct 2002 21:26:42 -0000       1.1
+++ ListReceiver.cpp    14 Oct 2002 21:47:44 -0000      1.2
@@ -50,8 +50,21 @@
 }
 
+bool ListEventReceiver::ListAll(ASMailFolder *asmf)
+{
+   CHECK( asmf, false, _T("NULL ASMailFolder in ListEventReceiver::ListAll") );
+
+   m_specRoot = asmf->GetImapSpec();
+
+   Ticket t = asmf->ListFolders(_T(""), false, _T(""), this);
+   if ( t == ILLEGAL_TICKET )
+      return false;
+
+   return true;
+}
+
 bool ListEventReceiver::OnMEvent(MEventData& event)
 {
    // we're only subscribed to the ASFolder events
-   CHECK( event.GetId() == MEventId_ASFolderResult, FALSE,
+   CHECK( event.GetId() == MEventId_ASFolderResult, false,
           _T("unexpected event type") );
 
@@ -64,5 +77,5 @@
    {
       // no: continue with other event handlers
-      return TRUE;
+      return true;
    }
 
@@ -72,5 +85,5 @@
 
       // eat the event - it was for us but we didn't process it...
-      return FALSE;
+      return false;
    }
 
@@ -79,9 +92,31 @@
    wxString path = result->GetName();
    if ( path.empty() )
+   {
+      // end of enumeration
       OnNoMoreFolders();
+
+      m_specRoot.clear();
+   }
    else
-      OnListFolder(path, result->GetDelimiter(), result->GetAttributes());
+   {
+      // if our ListAll() was called, make path really just a path from the
+      // full c-client IMAP spec (otherwise m_specRoot is empty and calling
+      // StartsWith() is a NOOP: it just copies path to name)
+      String name;
+      if ( !path.StartsWith(m_specRoot, &name) )
+      {
+         FAIL_MSG( _T("unexpected folder in mm_list()") );
+      }
+
+      const char delim = result->GetDelimiter();
+
+      // we don't want the leading slash, if any
+      if ( !name.empty() && name[0u] == delim )
+         name.erase(0, 1);
+
+      OnListFolder(name, delim, result->GetAttributes());
+   }
 
    // we don't want anyone else to receive this message - it was for us only
-   return FALSE;
+   return false;
 }



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to