Update of /cvsroot/mahogany/M/src/mail
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6784/src/mail
Modified Files:
ASMailFolder.cpp MailFolder.cpp MailFolderCC.cpp VFolder.cpp
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.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/ASMailFolder.cpp,v
retrieving revision 1.73
retrieving revision 1.74
diff -b -u -2 -r1.73 -r1.74
--- ASMailFolder.cpp 8 Apr 2004 18:22:19 -0000 1.73
+++ ASMailFolder.cpp 30 Jun 2005 23:39:48 -0000 1.74
@@ -1009,6 +1009,6 @@
/** Get a listing of all mailboxes.
@param pattern a wildcard matching the folders to list
- @param subscribed_only if true, only the subscribed ones
- @param reference implementation dependend reference
+ @param subscribed_only return only the folders we're subscribed to if
true
+ @param reference the path to start from
*/
Ticket ListFolders(const String &pattern,
@@ -1210,18 +1210,4 @@
}
-String ASMailFolder::GetImapSpec(void) const
-{
- String spec;
- MailFolder *mf = GetMailFolder();
- if ( mf )
- {
- spec = ((MailFolderCC *)mf)->GetImapSpec();
-
- mf->DecRef();
- }
-
- return spec;
-}
-
// ----------------------------------------------------------------------------
// debugging functions
Index: MailFolder.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/MailFolder.cpp,v
retrieving revision 1.314
retrieving revision 1.315
diff -b -u -2 -r1.314 -r1.315
--- MailFolder.cpp 4 Oct 2004 12:30:21 -0000 1.314
+++ MailFolder.cpp 30 Jun 2005 23:39:48 -0000 1.315
@@ -1144,6 +1144,9 @@
case MF_MDIR:
case MF_MFILE:
- // the filenames use slash as separator
- return wxFILE_SEP_PATH;
+ // the filenames use slash as separator: note that we use slash both
+ // under Unix and Windows because all the file functions under Windows
+ // still understand slashes and using backslashes just adds a lot of
+ // confusion
+ return '/';
case MF_NNTP:
Index: MailFolderCC.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/MailFolderCC.cpp,v
retrieving revision 1.707
retrieving revision 1.708
diff -b -u -2 -r1.707 -r1.708
--- MailFolderCC.cpp 30 Jun 2005 17:09:16 -0000 1.707
+++ MailFolderCC.cpp 30 Jun 2005 23:39:49 -0000 1.708
@@ -45,4 +45,5 @@
#endif // USE_PCH
+#include "pointers.h"
#include "UIdArray.h"
@@ -1840,5 +1841,5 @@
Init();
- m_ASMailFolder = NULL;
+ m_listData = NULL;
m_SearchMessagesFound = NULL;
@@ -2331,4 +2332,7 @@
case HalfOpen:
+ // only IMAP supports half opening, for all the other folder types
+ // c-client is not even going to try to do anything
+ if ( folderType == MF_IMAP )
ccOptions |= OP_HALFOPEN;
break;
@@ -3163,5 +3167,5 @@
String specDst = MailFolder::GetImapSpec(folder);
String serverSrc = GetFirstPartFromImapSpec(specDst);
- String serverDst = GetFirstPartFromImapSpec(GetImapSpec());
+ String serverDst = GetFirstPartFromImapSpec(m_ImapSpec);
if ( serverSrc == serverDst )
@@ -5056,8 +5060,8 @@
MailFolderCC::mm_list(MAILSTREAM * stream,
char delim,
- String name,
+ const String& name,
long attrib)
{
- if(gs_mmListRedirect)
+ if ( gs_mmListRedirect )
{
gs_mmListRedirect(stream, delim, name, attrib);
@@ -5066,34 +5070,35 @@
MailFolderCC *mf = LookupObject(stream);
- CHECK_RET(mf,_T("NULL mailfolder"));
+ CHECK_RET(mf, _T("NULL mailfolder"));
+
+ CHECK_RET(mf->m_listData, _T("mm_list() without preceding mail_list()?"));
+
+ // translate IMAP spec to folder path
+ String path;
+ if ( !name.StartsWith(mf->m_ImapSpec, &path) )
+ {
+ FAIL_MSG( _T("returned mailbox doesn't start with reference?") );
+ path = name;
+ }
- // create the event corresponding to the folder
- ASMailFolder::ResultFolderExists *result =
+ // create the event corresponding to the folder and process it immediately
+ MEventManager::Dispatch
+ (
+ new MEventASFolderResultData
+ (
+ MakeRefCounter
+ (
ASMailFolder::ResultFolderExists::Create
(
- mf->m_ASMailFolder,
- mf->m_Ticket,
- name,
+ mf->m_listData->m_ASMailFolder,
+ mf->m_listData->m_Ticket,
+ path,
delim,
attrib,
- mf->m_UserData
+ mf->m_listData->m_UserData
+ )
+ ).get()
+ )
);
-
- // and send it
- MEventManager::Send(new MEventASFolderResultData (result) );
-
- // don't forget to free the result - MEventASFolderResultData makes a copy
- // (i.e. calls IncRef) of it
- result->DecRef();
-
- // wxYield() is needed to send the events resulting from (previous) calls
- // to MEventManager::Send(), but don't forget to prevent any other calls to
- // c-client from happening - this will result in a fatal error as it is not
- // reentrant
-#if wxCHECK_VERSION(2, 2, 6)
- wxYieldIfNeeded();
-#else // wxWin <= 2.2.5
- wxYield();
-#endif // wxWin 2.2.5/2.2.6
}
@@ -5108,5 +5113,5 @@
MailFolderCC::mm_lsub(MAILSTREAM * stream,
char /* delim */,
- String /* name */,
+ const String& /* name */,
long /* attrib */)
{
@@ -5124,5 +5129,5 @@
void
MailFolderCC::mm_status(MAILSTREAM *stream,
- String mailbox,
+ const String& mailbox,
MAILSTATUS *status)
{
@@ -5142,5 +5147,5 @@
*/
void
-MailFolderCC::mm_notify(MAILSTREAM * stream, String str, long errflg)
+MailFolderCC::mm_notify(MAILSTREAM * stream, const String& str, long errflg)
{
MailFolderCC *mf = MailFolderCC::LookupObject(stream);
@@ -5364,4 +5369,21 @@
}
+inline
+MailFolderCC::ListFoldersData::ListFoldersData(ASMailFolder *asmf,
+ Ticket ticket,
+ UserData ud)
+{
+ m_UserData = ud;
+ m_Ticket = ticket;
+ m_ASMailFolder = asmf;
+ m_ASMailFolder->IncRef();
+}
+
+inline
+MailFolderCC::ListFoldersData::~ListFoldersData()
+{
+ m_ASMailFolder->DecRef();
+}
+
void
MailFolderCC::ListFolders(ASMailFolder *asmf,
@@ -5376,4 +5398,6 @@
CHECK_RET( asmf, _T("no ASMailFolder in ListFolders") );
+ CHECK_RET( !m_listData, _T("reentrancy in MailFolderCC::ListFolders") );
+
String spec = m_ImapSpec;
@@ -5386,9 +5410,10 @@
}
- // make sure that there is a folder name delimiter before pattern -- this is
- // convenient for the calling code however it makes it impossible to
- // enumerate all folders under the given one including itself, so we use a
- // dirty hack: empty pattern is just like "*" except that we don't add the
- // delimiter before it
+ // make sure that there is a folder name delimiter before pattern
+ //
+ // doing this automatically is convenient for the calling code however it
+ // makes it impossible to enumerate all folders under the given one
+ // including itself, so we use a dirty hack: empty pattern is just like "*"
+ // except that we don't add the delimiter before it
if ( !spec.empty() && !pattern.empty() )
{
@@ -5406,37 +5431,30 @@
spec << reference << (pattern.empty() ? String(_T("*")) : pattern);
- // set user data (retrieved by mm_list)
- m_UserData = ud;
- m_Ticket = ticket;
- m_ASMailFolder = asmf;
- m_ASMailFolder->IncRef();
+#ifdef OS_WIN
+ // c-client code only accepts slashes for file path separators
+ spec.Replace("\\", "/");
+#endif // OS_WIN
- if ( subscribedOnly )
- {
- mail_lsub (m_MailStream, NULL, (char *) spec.c_str());
- }
- else
- {
- mail_list (m_MailStream, NULL, (char *) spec.c_str());
- }
- // Send event telling about end of listing:
- ASMailFolder::ResultFolderExists *result =
- ASMailFolder::ResultFolderExists::Create
+ // remember list data, this will be used from mm_list() called by mail_list
+ m_listData = new ListFoldersData(asmf, ticket, ud);
+
+ (subscribedOnly ? mail_lsub : mail_list)
+ (m_MailStream, NULL, const_cast<char *>(spec.c_str()));
+
+ // send event telling about end of listing:
+ MEventManager::Send(
+ new MEventASFolderResultData
+ (
+ MakeRefCounter
(
- m_ASMailFolder,
- m_Ticket,
- _T(""), // empty name == no more entries
- 0, // no delim
- 0, // no flags
- m_UserData
+ ASMailFolder::ResultFolderExists::
+ CreateNoMore(asmf, m_listData->m_Ticket, m_listData->m_UserData)
+ ).get()
+ )
);
- // and send it
- MEventManager::Send(new MEventASFolderResultData (result) );
-
- result->DecRef();
- m_ASMailFolder->DecRef();
- m_ASMailFolder = NULL;
+ delete m_listData;
+ m_listData = NULL;
}
Index: VFolder.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/VFolder.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -b -u -2 -r1.16 -r1.17
--- VFolder.cpp 4 Oct 2004 12:30:23 -0000 1.16
+++ VFolder.cpp 30 Jun 2005 23:39:50 -0000 1.17
@@ -217,9 +217,4 @@
}
-String MailFolderVirt::GetImapSpec() const
-{
- return GetName();
-}
-
MFolderType MailFolderVirt::GetType() const
{
-------------------------------------------------------
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