Bug #5781 --> as a side effect of adding the connection cache, I made GetImapUserName return a const char *.

a=chofmann.
This commit is contained in:
mscott%netscape.com 1999-04-30 18:47:15 +00:00
Родитель f4f04298b1
Коммит 5e777fab76
1 изменённых файлов: 6 добавлений и 13 удалений

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

@ -418,11 +418,10 @@ void nsImapServerResponseParser::ProcessOkCommand(const char *commandToken)
{ {
PR_LOG(IMAP, PR_LOG_ALWAYS, PR_LOG(IMAP, PR_LOG_ALWAYS,
("BODYSHELL: Adding shell to cache.")); ("BODYSHELL: Adding shell to cache."));
char *userName = fServerConnection.GetImapUserName(); const char *userName = fServerConnection.GetImapUserName();
fHostSessionList->AddShellToCacheForHost( fHostSessionList->AddShellToCacheForHost(
fServerConnection.GetImapHostName(), userName, fServerConnection.GetImapHostName(), userName,
m_shell); m_shell);
PR_FREEIF(userName);
} }
} }
else else
@ -790,7 +789,7 @@ void nsImapServerResponseParser::mailbox_list(PRBool discoveredFromLsub)
void nsImapServerResponseParser::mailbox(mailbox_spec *boxSpec) void nsImapServerResponseParser::mailbox(mailbox_spec *boxSpec)
{ {
char *boxname = nsnull; char *boxname = nsnull;
char *userName = fServerConnection.GetImapUserName(); const char *userName = fServerConnection.GetImapUserName();
const char* hostName = fServerConnection.GetImapHostName(); const char* hostName = fServerConnection.GetImapHostName();
if (!PL_strcasecmp(fNextToken, "INBOX")) if (!PL_strcasecmp(fNextToken, "INBOX"))
@ -868,7 +867,6 @@ void nsImapServerResponseParser::mailbox(mailbox_spec *boxSpec)
if (fServerConnection.GetConnectionStatus() < 0) if (fServerConnection.GetConnectionStatus() < 0)
SetConnected(PR_FALSE); SetConnected(PR_FALSE);
} }
PR_FREEIF(userName);
} }
@ -1652,14 +1650,13 @@ void nsImapServerResponseParser::capability_data()
!at_end_of_line() && !at_end_of_line() &&
ContinueParse()); ContinueParse());
char* userName = fServerConnection.GetImapUserName(); const char* userName = fServerConnection.GetImapUserName();
if (fHostSessionList) if (fHostSessionList)
fHostSessionList->SetCapabilityForHost( fHostSessionList->SetCapabilityForHost(
fServerConnection.GetImapHostName(), fServerConnection.GetImapHostName(),
userName, userName,
fCapabilityFlag); fCapabilityFlag);
PR_FREEIF(userName);
nsImapProtocol *navCon = &fServerConnection; nsImapProtocol *navCon = &fServerConnection;
NS_ASSERTION(navCon, "null imap protocol connection while parsing capability response"); // we should always have this NS_ASSERTION(navCon, "null imap protocol connection while parsing capability response"); // we should always have this
if (navCon) if (navCon)
@ -1727,7 +1724,7 @@ void nsImapServerResponseParser::namespace_data()
EIMAPNamespaceType namespaceType = kPersonalNamespace; EIMAPNamespaceType namespaceType = kPersonalNamespace;
PRBool namespacesCommitted = PR_FALSE; PRBool namespacesCommitted = PR_FALSE;
const char* hostName = fServerConnection.GetImapHostName(); const char* hostName = fServerConnection.GetImapHostName();
char* userName = fServerConnection.GetImapUserName(); const char* userName = fServerConnection.GetImapUserName();
while ((namespaceType != kUnknownNamespace) && ContinueParse()) while ((namespaceType != kUnknownNamespace) && ContinueParse())
{ {
fNextToken = GetNextToken(); fNextToken = GetNextToken();
@ -1830,8 +1827,6 @@ void nsImapServerResponseParser::namespace_data()
userName, userName,
success); success);
} }
PR_FREEIF(userName);
} }
void nsImapServerResponseParser::myrights_data() void nsImapServerResponseParser::myrights_data()
@ -2057,12 +2052,11 @@ void nsImapServerResponseParser::ResetCapabilityFlag()
{ {
if (fHostSessionList) if (fHostSessionList)
{ {
char* userName = fServerConnection.GetImapUserName(); const char* userName = fServerConnection.GetImapUserName();
fHostSessionList->SetCapabilityForHost( fHostSessionList->SetCapabilityForHost(
fServerConnection.GetImapHostName(), userName, fServerConnection.GetImapHostName(), userName,
kCapabilityUndefined); kCapabilityUndefined);
PR_FREEIF(userName);
} }
} }
@ -2229,11 +2223,10 @@ struct mailbox_spec *nsImapServerResponseParser::CreateCurrentMailboxSpec(const
nsIMAPNamespace *ns = nsnull; nsIMAPNamespace *ns = nsnull;
if (host != nsnull && fHostSessionList) if (host != nsnull && fHostSessionList)
{ {
char* userName = fServerConnection.GetImapUserName(); const char* userName = fServerConnection.GetImapUserName();
fHostSessionList->GetNamespaceForMailboxForHost(host, fHostSessionList->GetNamespaceForMailboxForHost(host,
userName, mailboxNameToConvert, ns); // for userName, mailboxNameToConvert, ns); // for
// delimiter // delimiter
PR_FREEIF(userName);
} }
if (ns) if (ns)