Update of /cvsroot/mahogany/M/include
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6784/include

Modified Files:
        ASMailFolder.h ListReceiver.h MailFolder.h MailFolderCC.h 
Log Message:
1. removed MailFolder::GetImapSpec(), it doesn't make sense for an ABC
2. (AS)MailFolder::ListFolders() now always returns relative paths instead
   of IMAP specs


Index: ASMailFolder.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/ASMailFolder.h,v
retrieving revision 1.62
retrieving revision 1.63
diff -b -u -2 -r1.62 -r1.63
--- ASMailFolder.h      8 Apr 2004 18:22:19 -0000       1.62
+++ ASMailFolder.h      30 Jun 2005 23:39:45 -0000      1.63
@@ -318,5 +318,5 @@
        @param pattern a wildcard matching the folders to list
        @param subscribed_only if true, only the subscribed ones
-       @param reference implementation dependend reference
+       @param reference the path to start from
     */
    Ticket ListFolders(const String &pattern = _T("*"),
@@ -341,9 +341,4 @@
    char GetFolderDelimiter() const;
 
-   /**
-      Returns the full spec (in cclient sense) for this folder
-    */
-   String GetImapSpec(void) const;
-
    /** Get name of mailbox.
        @return the symbolic name of the mailbox
@@ -514,10 +509,14 @@
    UIdType  m_uid;
 };
-/** Holds a single folder name found in a ListFolders() call.
+
+/**
+  Holds either a single folder name returned by ListFolders() call or indicates
+  that no more folders are available.
 */
 class ASMailFolderResultFolderExists : public ASMailFolderResultImpl
 {
 public:
-   static ASMailFolder::ResultFolderExists *Create(ASMailFolder *mf,
+   static ASMailFolder::ResultFolderExists *
+   Create(ASMailFolder *mf,
                                       Ticket t,
                                       const String &name,
@@ -525,13 +524,37 @@
                                       long attrib,
                                       UserData ud)
-      { return new ASMailFolder::ResultFolderExists(mf, t, name, delimiter, 
attrib, ud); }
+   {
+      return new
+         ASMailFolderResultFolderExists(mf, t, name, delimiter, attrib, ud);
+   }
+
+   static ASMailFolder::ResultFolderExists *
+   CreateNoMore(ASMailFolder *mf, Ticket t, UserData ud)
+   {
+      return new ASMailFolderResultFolderExists(mf, t, ud);
+   }
+
+   String GetName() const { return m_Name; }
+   char GetDelimiter() const { return m_Delim; }
+   long GetAttributes() const { return m_Attrib; }
 
-   String GetName(void) const { return m_Name; }
-   char GetDelimiter(void) const { return m_Delim; }
-   long GetAttributes(void) const { return m_Attrib; }
+   bool NoMore() const { return m_NoMore; }
 
 protected:
-   ASMailFolderResultFolderExists(ASMailFolder *mf, Ticket t,
-                       const String &name, char delimiter, long attrib,
+   // ctor for "no more folders" result
+   ASMailFolderResultFolderExists(ASMailFolder *mf,
+                                  Ticket t,
+                                  UserData ud)
+      : ASMailFolderResultImpl(mf, t, ASMailFolder::Op_ListFolders, NULL, ud)
+   {
+      m_NoMore = true;
+   }
+
+   // ctor for "folder available" result
+   ASMailFolderResultFolderExists(ASMailFolder *mf,
+                                  Ticket t,
+                                  const String& name,
+                                  char delimiter,
+                                  long attrib,
                        UserData ud)
       : ASMailFolderResultImpl(mf, t, ASMailFolder::Op_ListFolders, NULL, ud)
@@ -540,9 +563,12 @@
          m_Delim = delimiter;
          m_Attrib = attrib;
+      m_NoMore = false;
       }
+
 private:
    String m_Name;
    long m_Attrib;
    char m_Delim;
+   bool m_NoMore;
 };
 

Index: ListReceiver.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/ListReceiver.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -b -u -2 -r1.3 -r1.4
--- ListReceiver.h      12 Oct 2003 13:14:48 -0000      1.3
+++ ListReceiver.h      30 Jun 2005 23:39:45 -0000      1.4
@@ -31,19 +31,22 @@
 
    /**
-     Call OnListFolder() for all folders under the given one. Note that if this
-     method is used, then the path in OnListFolder() will be just the folder
-     path and not the full IMAP spec as when asmf->ListFolders() is called
-     directly (the possibility to do the latter is kept just for the backwards
-     compatibility with the code in wxSubfoldersDialog.cpp).
+     Call OnListFolder() for all folders under the given one.
 
      @param asmf the folder to list the subfolders of
+     @param pattern wildcard matching the folders to be listed
+     @param root the path to start listing from, "" means start from root
      @return true if ok, false if ListFolders() failed
     */
-   bool ListAll(ASMailFolder *asmf);
+   bool List(ASMailFolder *asmf, const String& pattern, const String& root);
+
+   /**
+     Shortcut to List(asmf, "*", ""): returns all folders starting from root.
+    */
+   bool ListAll(ASMailFolder *asmf) { return List(asmf, _T("*"), String()); }
 
    /**
      Override this method to process an mm_list() notification for one folder.
 
-     @param path the full path to the folder (may include IMAP spec or not)
+     @param path the full path to the folder
      @param delim the folder hierarchy delimiter
      @param flags the attributes (combination of ASMailFolder::ATT_XXX values)
@@ -63,7 +66,4 @@
    // MEventReceiver cookie for the event manager
    void *m_regCookie;
-
-   // the IMAP spec of the folder we're listing the subfolders of or empty
-   String m_specRoot;
 };
 

Index: MailFolder.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/MailFolder.h,v
retrieving revision 1.198
retrieving revision 1.199
diff -b -u -2 -r1.198 -r1.199
--- MailFolder.h        21 Jun 2005 19:39:01 -0000      1.198
+++ MailFolder.h        30 Jun 2005 23:39:45 -0000      1.199
@@ -400,5 +400,8 @@
    /** Get a listing of all mailboxes.
 
-       DO NOT USE THIS FUNCTION, BUT ASMailFolder::ListFolders instead!!!
+       DO NOT USE THIS FUNCTION, BUT ASMailFolder::ListFolders instead!
+
+       This function is not reentrant and not MT-safe, it needs to be fixed to
+       be both.
 
        @param asmf the ASMailFolder initiating the request
@@ -453,10 +456,4 @@
    virtual String GetName(void) const = 0;
 
-   /**
-     Return the full specification of the folder, i.e. what makes it unique
-     among all folders of this class.
-    */
-   virtual String GetImapSpec(void) const = 0;
-
    /// Return the folder's type.
    virtual MFolderType GetType(void) const = 0;

Index: MailFolderCC.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/MailFolderCC.h,v
retrieving revision 1.221
retrieving revision 1.222
diff -b -u -2 -r1.221 -r1.222
--- MailFolderCC.h      27 Sep 2004 20:33:32 -0000      1.221
+++ MailFolderCC.h      30 Jun 2005 23:39:45 -0000      1.222
@@ -100,7 +100,4 @@
    virtual int GetFlags(void) const;
 
-   /// Return IMAP spec
-   virtual String GetImapSpec(void) const { return m_ImapSpec; }
-
    /// return full IMAP spec including the login name
    static String GetFullImapSpec(const MFolder *folder, const String& login);
@@ -507,10 +504,16 @@
    /**
       Data used by ListFolders().
+
+      This pointer is not NULL only inside ListFolders() call.
     */
+   struct ListFoldersData
+   {
+      ListFoldersData(ASMailFolder *asmf, Ticket ticket, UserData ud);
+      ~ListFoldersData();
 
-   // TODO: put all this into a single struct
    UserData m_UserData;
    Ticket   m_Ticket;
    ASMailFolder *m_ASMailFolder;
+   } *m_listData;
 
    //@}
@@ -594,6 +597,7 @@
        @param errflg error level
        */
-   static void mm_notify(MAILSTREAM *stream, String str, long
-                         errflg);
+   static void mm_notify(MAILSTREAM *stream,
+                         const String& str,
+                         long errflg);
 
    /** this mailbox name matches a listing request
@@ -603,5 +607,7 @@
        @param attrib   mailbox attributes
        */
-   static void mm_list(MAILSTREAM *stream, char delim, String name,
+   static void mm_list(MAILSTREAM *stream,
+                       char delim,
+                       const String& name,
                        long attrib);
 
@@ -612,6 +618,9 @@
        @param attrib   mailbox attributes
        */
-   static void mm_lsub(MAILSTREAM *stream, char delim, String name,
+   static void mm_lsub(MAILSTREAM *stream,
+                       char delim,
+                       const String& name,
                        long attrib);
+
    /** status of mailbox has changed
        @param stream   mailstream
@@ -619,5 +628,7 @@
        @param status   structure with new mailbox status
        */
-   static void mm_status(MAILSTREAM *stream, String mailbox, MAILSTATUS 
*status);
+   static void mm_status(MAILSTREAM *stream,
+                         const String& mailbox,
+                         MAILSTATUS *status);
 
    /** log a message



-------------------------------------------------------
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