Changed signatures of AllocateServerpath and AddOnlinedirectoryIfNecessary so they could be methods from the interface.

This commit is contained in:
mscott%netscape.com 1999-04-16 02:16:50 +00:00
Родитель 4589b4e244
Коммит 12691e0108
2 изменённых файлов: 34 добавлений и 23 удалений

Просмотреть файл

@ -1185,8 +1185,9 @@ void nsImapUrl::ParseImapPart(char *imapPartOfUrl)
// Returns NULL if nothing was done.
// Otherwise, returns a newly allocated name.
char *nsImapUrl::AddOnlineDirectoryIfNecessary(const char *onlineMailboxName)
NS_IMETHODIMP nsImapUrl::AddOnlineDirectoryIfNecessary(const char *onlineMailboxName, char ** directory)
{
nsresult result = NS_OK;
char *rv = NULL;
#ifdef HAVE_PORT
// If this host has an online server directory configured
@ -1218,13 +1219,18 @@ char *nsImapUrl::AddOnlineDirectoryIfNecessary(const char *onlineMailboxName)
}
}
#endif // HAVE_PORT
return rv;
if (directory)
*directory = rv;
else
PR_FREEIF(rv);
return result;
}
// Converts from canonical format (hierarchy is indicated by '/' and all real slashes ('/') are escaped)
// to the real online name on the server.
char *nsImapUrl::AllocateServerPath(const char *canonicalPath, char onlineDelimiter /* = kOnlineHierarchySeparatorUnknown */)
NS_IMETHODIMP nsImapUrl::AllocateServerPath(const char * canonicalPath, char onlineDelimiter, char ** aAllocatedPath)
{
nsresult retVal = NS_OK;
char *rv = NULL;
char delimiterToUse = onlineDelimiter;
if (onlineDelimiter == kOnlineHierarchySeparatorUnknown)
@ -1235,15 +1241,20 @@ char *nsImapUrl::AllocateServerPath(const char *canonicalPath, char onlineDelimi
else
rv = PL_strdup("");
char *onlineNameAdded = AddOnlineDirectoryIfNecessary(rv);
char *onlineNameAdded = nsnull;
AddOnlineDirectoryIfNecessary(rv, &onlineNameAdded);
if (onlineNameAdded)
{
PR_FREEIF(rv);
rv = onlineNameAdded;
}
return rv;
if (aAllocatedPath)
*aAllocatedPath = rv;
else
PR_FREEIF(rv);
return retVal;
}
@ -1344,7 +1355,7 @@ NS_IMETHODIMP nsImapUrl::CreateServerSourceFolderPathString(char **result)
if (!result)
return NS_ERROR_NULL_POINTER;
NS_LOCK_INSTANCE();
*result = AllocateServerPath(m_sourceCanonicalFolderPathSubString);
AllocateServerPath(m_sourceCanonicalFolderPathSubString, kOnlineHierarchySeparatorUnknown, result);
NS_UNLOCK_INSTANCE();
return NS_OK;

Просмотреть файл

@ -65,6 +65,23 @@ public:
NS_IMPL_CLASS_GETSET(ImapAction, nsImapAction, m_imapAction);
NS_IMETHOD GetRequiredImapState(nsImapState * aImapUrlState);
NS_IMETHOD AddOnlineDirectoryIfNecessary(const char *onlineMailboxName, char ** directory);
NS_IMETHOD GetImapPartToFetch(char **result);
NS_IMETHOD AllocateCanonicalPath(const char *serverPath, char onlineDelimiter, char **allocatedPath ) ;
NS_IMETHOD AllocateServerPath(const char * aCanonicalPath, char aOnlineDelimiter, char ** aAllocatedPath);
NS_IMETHOD CreateCanonicalSourceFolderPathString(char **result);
NS_IMETHOD CreateServerSourceFolderPathString(char **result) ;
NS_IMETHOD CreateListOfMessageIdsString(char **result) ;
NS_IMETHOD MessageIdsAreUids(PRBool *result);
NS_IMETHOD GetMsgFlags(imapMessageFlagsType *result); // kAddMsgFlags or kSubtractMsgFlags only
// for enabling or disabling mime parts on demand. Setting this to TRUE says we
// can use mime parts on demand, if we chose.
NS_IMETHOD SetAllowContentChange(PRBool allowContentChange);
NS_IMETHOD GetAllowContentChange(PRBool *results);
///////////////////////////////////////////////////////////////////////////////
// we support the nsINetlibURL interface
///////////////////////////////////////////////////////////////////////////////
@ -105,19 +122,6 @@ public:
NS_IMETHOD GetServerStatus(PRInt32 *status); // make obsolete
NS_IMETHOD ToString(PRUnichar* *aString) const;
NS_IMETHOD GetImapPartToFetch(char **result) ;
NS_IMETHOD AllocateCanonicalPath(const char *serverPath, char onlineDelimiter, char **allocatedPath ) ;
NS_IMETHOD CreateCanonicalSourceFolderPathString(char **result);
NS_IMETHOD CreateServerSourceFolderPathString(char **result) ;
NS_IMETHOD CreateListOfMessageIdsString(char **result) ;
NS_IMETHOD MessageIdsAreUids(PRBool *result);
NS_IMETHOD GetMsgFlags(imapMessageFlagsType *result); // kAddMsgFlags or kSubtractMsgFlags only
// for enabling or disabling mime parts on demand. Setting this to TRUE says we
// can use mime parts on demand, if we chose.
NS_IMETHOD SetAllowContentChange(PRBool allowContentChange);
NS_IMETHOD GetAllowContentChange(PRBool *results);
// nsImapUrl
nsImapUrl();
virtual ~nsImapUrl();
@ -145,10 +149,6 @@ protected:
char GetOnlineSubDirSeparator();
void SetOnlineSubDirSeparator(char onlineDirSeparator);
char * AllocateServerPath(const char *canonicalPath,
char onlineDelimiter = kOnlineHierarchySeparatorUnknown);
char * AddOnlineDirectoryIfNecessary(const char *onlineMailboxName);
char * ReplaceCharsInCopiedString(const char *stringToCopy, char oldChar, char newChar);
void ParseFolderPath(char **resultingCanonicalPath);
void ParseSearchCriteriaString();