This commit is contained in:
bienvenu%netscape.com 1999-04-13 04:31:40 +00:00
Родитель b5d65f5e1f
Коммит 9a8005aeab
2 изменённых файлов: 57 добавлений и 0 удалений

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

@ -868,6 +868,59 @@ nsImapProtocol::AdjustChunkSize()
}
}
// authenticated state commands
// escape any backslashes or quotes. Backslashes are used a lot with our NT server
char *nsImapProtocol::CreateEscapedMailboxName(const char *rawName)
{
nsString2 escapedName(rawName, eOneByte);
for (PRInt32 strIndex = 0; *rawName; strIndex++)
{
char currentChar = *rawName++;
if ((currentChar == '\\') || (currentChar == '\"'))
{
escapedName.Insert('\\', strIndex++);
}
}
return escapedName.ToNewCString();
}
void nsImapProtocol::SelectMailbox(const char *mailboxName)
{
// ProgressEventFunction_UsingId (MK_IMAP_STATUS_SELECTING_MAILBOX);
IncrementCommandTagNumber();
m_closeNeededBeforeSelect = PR_FALSE; // initial value
GetServerStateParser().ResetFlagInfo(0);
char *escapedName = CreateEscapedMailboxName(mailboxName);
nsString2 commandBuffer(GetServerCommandTag(), eOneByte);
commandBuffer.Append(" select \"");
commandBuffer.Append(escapedName);
commandBuffer.Append("\"" CRLF);
PR_FREEIF( escapedName);
int ioStatus = SendData(commandBuffer.GetBuffer());
ParseIMAPandCheckForNewMail();
PRInt32 numOfMessagesInFlagState = 0;
nsIImapUrl::nsImapAction imapAction;
m_flagState.GetNumberOfMessages(&numOfMessagesInFlagState);
nsresult res = m_runningUrl->GetImapAction(&imapAction);
// if we've selected a mailbox, and we're not going to do an update because of the
// url type, but don't have the flags, go get them!
if (NS_SUCCEEDED(res) &&
imapAction != nsIImapUrl::nsImapSelectFolder && imapAction != nsIImapUrl::nsImapExpungeFolder
&& imapAction != nsIImapUrl::nsImapLiteSelectFolder &&
imapAction != nsIImapUrl::nsImapDeleteAllMsgs &&
((GetServerStateParser().NumberOfMessages() != numOfMessagesInFlagState) && (numOfMessagesInFlagState == 0)))
{
ProcessMailboxUpdate(PR_FALSE);
}
}
// this routine is used to fetch a message or messages, or headers for a
// message...

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

@ -171,6 +171,7 @@ public:
void Store(nsString2 &aMessageList, const char * aMessageData, PRBool
aIdsAreUid);
void Expunge();
void SelectMailbox(const char *mailboxName);
nsIImapUrl *GetCurrentUrl() {return m_runningUrl;}
// Tunnels
@ -260,6 +261,9 @@ private:
void AllocateImapUidString(PRUint32 *msgUids, PRUint32 msgCount, nsString2 &returnString);
void HeaderFetchCompleted();
// mailbox name utilities.
char *CreateEscapedMailboxName(const char *rawName);
// header listing data
PRBool m_fetchMsgListIsNew;
PRUint32 m_fetchCount;