mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
final stage of XPIDLizing nsIMsgHdr
This commit is contained in:
parent
6bc4955b7f
commit
481bba988b
@ -76,6 +76,11 @@ interface nsIMsgHdr : nsISupports
|
||||
attribute unsigned long messageSize;
|
||||
attribute unsigned long lineCount;
|
||||
|
||||
attribute string author;
|
||||
attribute string subject;
|
||||
attribute string recipients;
|
||||
attribute boolean recipientsIsNewsgroup;
|
||||
|
||||
/* anything below here still has to be fixed */
|
||||
void setReferences(in string references);
|
||||
|
||||
@ -84,15 +89,6 @@ interface nsIMsgHdr : nsISupports
|
||||
void setCCListArray(in string names, in string addresses,
|
||||
in unsigned long numAddresses);
|
||||
|
||||
|
||||
void setAuthor(in string author);
|
||||
void setSubject(in string subject);
|
||||
void setRecipients(in string recipients, in boolean recipientsIsNewsgroup);
|
||||
|
||||
[noscript] void getAuthor(in nsString resultAuthor);
|
||||
[noscript] void getSubject(in nsString resultSubject);
|
||||
[noscript] void getRecipients(in nsString resultRecipients);
|
||||
|
||||
[noscript] void getMime2DecodedAuthor(in nsString resultAuthor);
|
||||
[noscript] void getMime2DecodedSubject(in nsString resultSubject);
|
||||
[noscript] void getMime2DecodedRecipients(in nsString resultRecipients);
|
||||
|
@ -218,8 +218,8 @@ NS_IMETHODIMP nsMsgFilter::LogRuleHit(nsOutputStream *stream, nsIMsgDBHdr *msgHd
|
||||
char dateStr[40]; /* 30 probably not enough */
|
||||
nsMsgRuleActionType actionType;
|
||||
void *value;
|
||||
nsString author;
|
||||
nsString subject;
|
||||
nsXPIDLCString author;
|
||||
nsXPIDLCString subject;
|
||||
|
||||
GetFilterName(&filterName);
|
||||
GetAction(&actionType, &value);
|
||||
@ -229,16 +229,16 @@ NS_IMETHODIMP nsMsgFilter::LogRuleHit(nsOutputStream *stream, nsIMsgDBHdr *msgHd
|
||||
PR_ExplodeTime(date, PR_LocalTimeParameters, &exploded);
|
||||
PR_FormatTimeUSEnglish(dateStr, 100, "%m/%d/%Y %I:%M %p", &exploded);
|
||||
|
||||
msgHdr->GetAuthor(&author);
|
||||
msgHdr->GetSubject(&subject);
|
||||
msgHdr->GetAuthor(getter_Copies(author));
|
||||
msgHdr->GetSubject(getter_Copies(subject));
|
||||
if (stream)
|
||||
{
|
||||
*stream << "Applied filter \"";
|
||||
*stream << filterName;
|
||||
*stream << "\" to message from ";
|
||||
*stream << nsAutoCString(author);
|
||||
*stream << (const char*)author;
|
||||
*stream << " - ";
|
||||
*stream << nsAutoCString(subject);
|
||||
*stream << (const char *)subject;
|
||||
*stream << " at ";
|
||||
*stream << dateStr;
|
||||
*stream << "\n";
|
||||
|
@ -482,9 +482,9 @@ nsresult nsMsgSearchOfflineMail::MatchTerms(nsIMsgDBHdr *msgToMatch,
|
||||
PRBool *pResult)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
nsString recipients;
|
||||
nsXPIDLCString recipients;
|
||||
nsXPIDLCString ccList;
|
||||
nsString matchString;
|
||||
nsXPIDLCString matchString;
|
||||
PRUint32 msgFlags;
|
||||
|
||||
PRBool result;
|
||||
@ -515,12 +515,12 @@ nsresult nsMsgSearchOfflineMail::MatchTerms(nsIMsgDBHdr *msgToMatch,
|
||||
switch (pTerm->m_attribute)
|
||||
{
|
||||
case nsMsgSearchAttrib::Sender:
|
||||
msgToMatch->GetAuthor(&matchString);
|
||||
msgToMatch->GetAuthor(getter_Copies(matchString));
|
||||
err = pTerm->MatchRfc822String (nsCAutoString(matchString), charset, &result);
|
||||
break;
|
||||
case nsMsgSearchAttrib::Subject:
|
||||
{
|
||||
msgToMatch->GetSubject(&matchString /* , PR_TRUE */);
|
||||
msgToMatch->GetSubject(getter_Copies(matchString) /* , PR_TRUE */);
|
||||
nsCAutoString singleByteString(matchString);
|
||||
err = pTerm->MatchString (&singleByteString, charset, PR_FALSE, &result);
|
||||
}
|
||||
@ -528,7 +528,7 @@ nsresult nsMsgSearchOfflineMail::MatchTerms(nsIMsgDBHdr *msgToMatch,
|
||||
case nsMsgSearchAttrib::ToOrCC:
|
||||
{
|
||||
PRBool boolKeepGoing = pTerm->MatchAllBeforeDeciding();
|
||||
msgToMatch->GetRecipients(&recipients);
|
||||
msgToMatch->GetRecipients(getter_Copies(recipients));
|
||||
err = pTerm->MatchRfc822String (nsCAutoString(recipients), charset, &result);
|
||||
if (boolKeepGoing == result)
|
||||
{
|
||||
@ -571,7 +571,7 @@ nsresult nsMsgSearchOfflineMail::MatchTerms(nsIMsgDBHdr *msgToMatch,
|
||||
}
|
||||
break;
|
||||
case nsMsgSearchAttrib::To:
|
||||
msgToMatch->GetRecipients(&recipients);
|
||||
msgToMatch->GetRecipients(getter_Copies(recipients));
|
||||
err = pTerm->MatchRfc822String(nsCAutoString(recipients), charset, &result);
|
||||
break;
|
||||
case nsMsgSearchAttrib::CC:
|
||||
@ -705,24 +705,24 @@ nsresult nsMsgSearchOfflineMail::AddResultElement (nsIMsgDBHdr *pHeaders)
|
||||
nsMsgSearchValue *pValue = new nsMsgSearchValue;
|
||||
if (pValue)
|
||||
{
|
||||
nsString subject;
|
||||
nsXPIDLCString subject;
|
||||
PRUint32 msgFlags;
|
||||
|
||||
// Don't even bother to look at expunged messages awaiting compression
|
||||
pHeaders->GetFlags(&msgFlags);
|
||||
pValue->attribute = nsMsgSearchAttrib::Subject;
|
||||
char *reString = (msgFlags & MSG_FLAG_HAS_RE) ? (char *)"Re: " : (char *)"";
|
||||
pHeaders->GetSubject(&subject);
|
||||
pValue->u.string = PR_smprintf ("%s%s", reString, (const char*) nsAutoCString(subject)); // hack. invoke cast operator by force
|
||||
pHeaders->GetSubject(getter_Copies(subject));
|
||||
pValue->u.string = PR_smprintf ("%s%s", reString, (const char*)subject);
|
||||
newResult->AddValue (pValue);
|
||||
}
|
||||
pValue = new nsMsgSearchValue;
|
||||
if (pValue)
|
||||
{
|
||||
pValue->attribute = nsMsgSearchAttrib::Sender;
|
||||
nsString author;
|
||||
pHeaders->GetAuthor(&author);
|
||||
pValue->u.string = PL_strdup((const char *) nsAutoCString(author));
|
||||
nsXPIDLCString author;
|
||||
pHeaders->GetAuthor(getter_Copies(author));
|
||||
pValue->u.string = PL_strdup(author);
|
||||
newResult->AddValue (pValue);
|
||||
err = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -152,10 +152,18 @@ NS_IMETHODIMP nsMessage::SetCcList(const char *ccList)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMessage::SetRecipients(const char *recipients, PRBool recipientsIsNewsgroup)
|
||||
NS_IMETHODIMP nsMessage::SetRecipients(const char *recipients)
|
||||
{
|
||||
if(mMsgHdr)
|
||||
return mMsgHdr->SetRecipients(recipients, recipientsIsNewsgroup);
|
||||
return mMsgHdr->SetRecipients(recipients);
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMessage::SetRecipientsIsNewsgroup(PRBool aIsNewsgroup)
|
||||
{
|
||||
if(mMsgHdr)
|
||||
return mMsgHdr->SetRecipientsIsNewsgroup(aIsNewsgroup);
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -201,7 +209,7 @@ NS_IMETHODIMP nsMessage::SetStatusOffset(PRUint32 statusOffset)
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMessage::GetAuthor(nsString *resultAuthor)
|
||||
NS_IMETHODIMP nsMessage::GetAuthor(char* *resultAuthor)
|
||||
{
|
||||
if(mMsgHdr)
|
||||
return mMsgHdr->GetAuthor(resultAuthor);
|
||||
@ -209,7 +217,7 @@ NS_IMETHODIMP nsMessage::GetAuthor(nsString *resultAuthor)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMessage::GetSubject(nsString *resultSubject)
|
||||
NS_IMETHODIMP nsMessage::GetSubject(char* *resultSubject)
|
||||
{
|
||||
if(mMsgHdr)
|
||||
return mMsgHdr->GetSubject(resultSubject);
|
||||
@ -217,7 +225,7 @@ NS_IMETHODIMP nsMessage::GetSubject(nsString *resultSubject)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMessage::GetRecipients(nsString *resultRecipients)
|
||||
NS_IMETHODIMP nsMessage::GetRecipients(char* *resultRecipients)
|
||||
{
|
||||
if(mMsgHdr)
|
||||
return mMsgHdr->GetRecipients(resultRecipients);
|
||||
@ -225,6 +233,14 @@ NS_IMETHODIMP nsMessage::GetRecipients(nsString *resultRecipients)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMessage::GetRecipientsIsNewsgroup(PRBool* aIsNewsgroup)
|
||||
{
|
||||
if(mMsgHdr)
|
||||
return mMsgHdr->GetRecipientsIsNewsgroup(aIsNewsgroup);
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMessage::GetCcList(char **ccList)
|
||||
{
|
||||
if(mMsgHdr)
|
||||
|
@ -45,67 +45,9 @@ public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIMESSAGE
|
||||
NS_DECL_NSIDBMESSAGE
|
||||
|
||||
NS_DECL_NSIMSGHDR
|
||||
|
||||
NS_IMETHOD Init(const char *aURI);
|
||||
//nsIMsgHdr
|
||||
NS_IMETHOD GetProperty(const char *propertyName, nsString &resultProperty);
|
||||
NS_IMETHOD SetProperty(const char *propertyName, nsString &propertyStr);
|
||||
NS_IMETHOD GetUint32Property(const char *propertyName, PRUint32 *pResult);
|
||||
NS_IMETHOD SetUint32Property(const char *propertyName, PRUint32 propertyVal);
|
||||
NS_IMETHOD GetNumReferences(PRUint16 *result);
|
||||
NS_IMETHOD GetStringReference(PRInt32 refNum, nsCString &resultReference);
|
||||
NS_IMETHOD GetDate(PRTime *result);
|
||||
NS_IMETHOD SetDate(PRTime date);
|
||||
NS_IMETHOD SetMessageId(const char *messageId);
|
||||
NS_IMETHOD SetReferences(const char *references);
|
||||
NS_IMETHOD SetCcList(const char *ccList);
|
||||
NS_IMETHOD SetRecipients(const char *recipients, PRBool recipientsIsNewsgroup);
|
||||
NS_IMETHOD SetRecipientsArray(const char *names, const char *addresses, PRUint32 numAddresses);
|
||||
NS_IMETHOD SetCCListArray(const char *names, const char *addresses, PRUint32 numAddresses);
|
||||
NS_IMETHOD SetAuthor(const char *author);
|
||||
NS_IMETHOD SetSubject(const char *subject);
|
||||
NS_IMETHOD SetStatusOffset(PRUint32 statusOffset);
|
||||
|
||||
NS_IMETHOD GetAuthor(nsString *resultAuthor);
|
||||
NS_IMETHOD GetSubject(nsString *resultSubject);
|
||||
NS_IMETHOD GetRecipients(nsString *resultRecipients);
|
||||
NS_IMETHOD GetCcList(char **ccList);
|
||||
NS_IMETHOD GetMessageId(char **resultMessageId);
|
||||
|
||||
NS_IMETHOD GetMime2DecodedAuthor(nsString *resultAuthor);
|
||||
NS_IMETHOD GetMime2DecodedSubject(nsString *resultSubject);
|
||||
NS_IMETHOD GetMime2DecodedRecipients(nsString *resultRecipients);
|
||||
|
||||
NS_IMETHOD GetAuthorCollationKey(nsString *resultAuthor);
|
||||
NS_IMETHOD GetSubjectCollationKey(nsString *resultSubject);
|
||||
NS_IMETHOD GetRecipientsCollationKey(nsString *resultRecipients);
|
||||
|
||||
// flag handling routines
|
||||
NS_IMETHOD GetFlags(PRUint32 *result);
|
||||
NS_IMETHOD SetFlags(PRUint32 flags);
|
||||
NS_IMETHOD OrFlags(PRUint32 flags, PRUint32 *result);
|
||||
NS_IMETHOD AndFlags(PRUint32 flags, PRUint32 *result);
|
||||
|
||||
// Mark message routines
|
||||
NS_IMETHOD MarkRead(PRBool bRead);
|
||||
NS_IMETHOD MarkFlagged(PRBool bFlagged);
|
||||
|
||||
NS_IMETHOD GetMessageKey(nsMsgKey *result);
|
||||
NS_IMETHOD GetThreadId(nsMsgKey *result);
|
||||
NS_IMETHOD SetThreadId(nsMsgKey inKey);
|
||||
NS_IMETHOD SetMessageKey(nsMsgKey inKey);
|
||||
NS_IMETHOD GetMessageSize(PRUint32 *result);
|
||||
NS_IMETHOD SetMessageSize(PRUint32 messageSize);
|
||||
NS_IMETHOD GetLineCount(PRUint32 *result);
|
||||
NS_IMETHOD SetLineCount(PRUint32 lineCount);
|
||||
NS_IMETHOD SetPriority(nsMsgPriority priority);
|
||||
NS_IMETHOD SetPriorityString(const char *priority);
|
||||
NS_IMETHOD GetMessageOffset(PRUint32 *result);
|
||||
NS_IMETHOD GetStatusOffset(PRUint32 *result);
|
||||
NS_IMETHOD GetCharSet(nsString *result);
|
||||
NS_IMETHOD GetPriority(nsMsgPriority *result);
|
||||
NS_IMETHOD GetThreadParent(nsMsgKey *result);
|
||||
NS_IMETHOD SetThreadParent(nsMsgKey inKey);
|
||||
|
||||
protected:
|
||||
nsIMsgFolder *mFolder;
|
||||
|
@ -692,7 +692,6 @@ nsMsgCompose::SendMsgEx(MSG_DeliverMode deliverMode,
|
||||
|
||||
if (m_compFields && identity)
|
||||
{
|
||||
nsAutoString aString;
|
||||
nsAutoString aCharset(msgCompHeaderInternalCharset());
|
||||
char *outCString;
|
||||
|
||||
@ -872,8 +871,8 @@ nsresult nsMsgCompose::CreateMessage(const PRUnichar * originalMsgURI,
|
||||
nsCOMPtr<nsIMessage> message = getter_AddRefs(GetIMessageFromURI(firstURI.GetUnicode()));
|
||||
if ((NS_SUCCEEDED(rv)) && message)
|
||||
{
|
||||
nsAutoString aString("");
|
||||
nsAutoString bString("");
|
||||
nsXPIDLCString subject;
|
||||
nsAutoString subjectStr("");
|
||||
nsAutoString aCharset("");
|
||||
nsAutoString decodedString;
|
||||
nsAutoString encodedCharset; // we don't use this
|
||||
@ -881,7 +880,7 @@ nsresult nsMsgCompose::CreateMessage(const PRUnichar * originalMsgURI,
|
||||
|
||||
rv = message->GetCharSet(&aCharset);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = message->GetSubject(&aString);
|
||||
rv = message->GetSubject(getter_Copies(subject));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mType = type;
|
||||
@ -896,17 +895,20 @@ nsresult nsMsgCompose::CreateMessage(const PRUnichar * originalMsgURI,
|
||||
if (!aCharset.Equals(""))
|
||||
m_compFields->SetCharacterSet(nsAutoCString(aCharset));
|
||||
|
||||
bString += "Re: ";
|
||||
bString += aString;
|
||||
if (NS_SUCCEEDED(rv = nsMsgI18NDecodeMimePartIIStr(bString, encodedCharset, decodedString)))
|
||||
subjectStr += "Re: ";
|
||||
subjectStr += subject;
|
||||
if (NS_SUCCEEDED(rv = nsMsgI18NDecodeMimePartIIStr(subjectStr, encodedCharset, decodedString)))
|
||||
m_compFields->SetSubject(decodedString.GetUnicode());
|
||||
else
|
||||
m_compFields->SetSubject(bString.GetUnicode());
|
||||
|
||||
rv = message->GetAuthor(&aString);
|
||||
m_compFields->SetSubject(subjectStr.GetUnicode());
|
||||
|
||||
nsXPIDLCString author;
|
||||
rv = message->GetAuthor(getter_Copies(author));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
m_compFields->SetTo(nsAutoCString(aString));
|
||||
if (NS_SUCCEEDED(rv = nsMsgI18NDecodeMimePartIIStr(aString, encodedCharset, decodedString)))
|
||||
m_compFields->SetTo(author);
|
||||
|
||||
nsString authorStr(author);
|
||||
if (NS_SUCCEEDED(rv = nsMsgI18NDecodeMimePartIIStr(authorStr, encodedCharset, decodedString)))
|
||||
if (NS_SUCCEEDED(rv = ConvertFromUnicode(msgCompHeaderInternalCharset(), decodedString, &aCString)))
|
||||
{
|
||||
m_compFields->SetTo(aCString);
|
||||
@ -915,21 +917,24 @@ nsresult nsMsgCompose::CreateMessage(const PRUnichar * originalMsgURI,
|
||||
|
||||
if (type == nsIMsgCompType::ReplyAll)
|
||||
{
|
||||
nsAutoString cString;
|
||||
rv = message->GetRecipients(&cString);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
CleanUpRecipients(cString);
|
||||
nsXPIDLCString recipients;
|
||||
rv = message->GetRecipients(getter_Copies(recipients));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsAutoString recipStr(recipients);
|
||||
CleanUpRecipients(recipStr);
|
||||
|
||||
nsXPIDLCString ccList;
|
||||
rv = message->GetCcList(getter_Copies(ccList));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsAutoString dString(ccList);
|
||||
CleanUpRecipients(dString);
|
||||
if (cString.Length() > 0 && dString.Length() > 0)
|
||||
cString = cString + ", ";
|
||||
cString = cString + dString;
|
||||
m_compFields->SetCc(nsAutoCString(cString));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (NS_SUCCEEDED(rv = nsMsgI18NDecodeMimePartIIStr(cString, encodedCharset, decodedString)))
|
||||
nsAutoString ccListStr(ccList);
|
||||
CleanUpRecipients(ccListStr);
|
||||
if (recipStr.Length() > 0 && ccListStr.Length() > 0)
|
||||
recipStr += ", ";
|
||||
recipStr += ccListStr;
|
||||
m_compFields->SetCc(nsAutoCString(recipStr));
|
||||
|
||||
if (NS_SUCCEEDED(rv = nsMsgI18NDecodeMimePartIIStr(recipStr, encodedCharset, decodedString)))
|
||||
if (NS_SUCCEEDED(rv = ConvertFromUnicode(msgCompHeaderInternalCharset(), decodedString, &aCString)))
|
||||
{
|
||||
char * resultStr = nsnull;
|
||||
@ -967,14 +972,14 @@ nsresult nsMsgCompose::CreateMessage(const PRUnichar * originalMsgURI,
|
||||
if (!aCharset.Equals(""))
|
||||
m_compFields->SetCharacterSet(nsAutoCString(aCharset));
|
||||
|
||||
bString += "[Fwd: ";
|
||||
bString += aString;
|
||||
bString += "]";
|
||||
subjectStr += "[Fwd: ";
|
||||
subjectStr += subject;
|
||||
subjectStr += "]";
|
||||
|
||||
if (NS_SUCCEEDED(rv = nsMsgI18NDecodeMimePartIIStr(bString, encodedCharset, decodedString)))
|
||||
if (NS_SUCCEEDED(rv = nsMsgI18NDecodeMimePartIIStr(subjectStr, encodedCharset, decodedString)))
|
||||
m_compFields->SetSubject(decodedString.GetUnicode());
|
||||
else
|
||||
m_compFields->SetSubject(bString.GetUnicode());
|
||||
m_compFields->SetSubject(subjectStr.GetUnicode());
|
||||
|
||||
// Setup quoting callbacks for later...
|
||||
if (type == nsIMsgCompType::ForwardAsAttachment)
|
||||
|
@ -428,7 +428,7 @@ nsresult
|
||||
nsMsgSendLater::CompleteMailFileSend()
|
||||
{
|
||||
nsresult rv;
|
||||
nsString recips;
|
||||
nsXPIDLCString recips;
|
||||
nsXPIDLCString ccList;
|
||||
PRBool created;
|
||||
nsCOMPtr<nsIMsgCompFields> compFields = nsnull;
|
||||
@ -440,7 +440,7 @@ nsCOMPtr<nsIMsgSend> pMsgSend = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Get the recipients...
|
||||
if (NS_FAILED(mMessage->GetRecipients(&recips)))
|
||||
if (NS_FAILED(mMessage->GetRecipients(getter_Copies(recips))))
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
else
|
||||
mMessage->GetCcList(getter_Copies(ccList));
|
||||
@ -464,12 +464,13 @@ nsCOMPtr<nsIMsgSend> pMsgSend = nsnull;
|
||||
// Since we have already parsed all of the headers, we are simply going to
|
||||
// set the composition fields and move on.
|
||||
//
|
||||
nsString author;
|
||||
mMessage->GetAuthor(&author);
|
||||
nsXPIDLCString author;
|
||||
mMessage->GetAuthor(getter_Copies(author));
|
||||
|
||||
nsMsgCompFields * fields = (nsMsgCompFields *)compFields.get();
|
||||
|
||||
fields->SetFrom(author.ToNewUnicode());
|
||||
nsString authorStr(author);
|
||||
fields->SetFrom(authorStr.ToNewUnicode());
|
||||
|
||||
if (m_to)
|
||||
fields->SetTo(m_to);
|
||||
@ -569,14 +570,11 @@ nsMsgSendLater::StartNextMailFileSend()
|
||||
|
||||
myRDFNode->GetValue(getter_Copies(aMessageURI));
|
||||
|
||||
char *tString = nsnull;
|
||||
nsString subject;
|
||||
mMessage->GetSubject(&subject);
|
||||
tString = subject.ToNewCString();
|
||||
#ifdef NS_DEBUG
|
||||
printf("Sending message: [%s]\n", tString);
|
||||
nsXPIDLCString subject;
|
||||
mMessage->GetSubject(getter_Copies(subject));
|
||||
printf("Sending message: [%s]\n", (const char*)subject);
|
||||
#endif
|
||||
PR_FREEIF(tString);
|
||||
|
||||
mTempFileSpec = nsMsgCreateTempFileSpec("nsqmail.tmp");
|
||||
if (!mTempFileSpec)
|
||||
|
@ -34,68 +34,9 @@ class nsCString;
|
||||
|
||||
class nsMsgHdr : public nsIMsgDBHdr {
|
||||
public:
|
||||
|
||||
NS_DECL_NSIMSGHDR
|
||||
friend class nsMsgDatabase;
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// nsIMsghdr methods:
|
||||
NS_IMETHOD GetProperty(const char *propertyName, nsString &resultProperty);
|
||||
NS_IMETHOD SetProperty(const char *propertyName, nsString &propertyStr);
|
||||
NS_IMETHOD GetUint32Property(const char *propertyName, PRUint32 *pResult);
|
||||
NS_IMETHOD SetUint32Property(const char *propertyName, PRUint32 propertyVal);
|
||||
NS_IMETHOD GetNumReferences(PRUint16 *result);
|
||||
NS_IMETHOD GetStringReference(PRInt32 refNum, nsCString &resultReference);
|
||||
NS_IMETHOD GetDate(PRTime *result);
|
||||
NS_IMETHOD SetDate(PRTime date);
|
||||
NS_IMETHOD SetMessageId(const char *messageId);
|
||||
NS_IMETHOD SetReferences(const char *references);
|
||||
NS_IMETHOD SetCcList(const char *ccList);
|
||||
NS_IMETHOD SetRecipients(const char *recipients, PRBool recipientsIsNewsgroup);
|
||||
NS_IMETHOD SetRecipientsArray(const char *names, const char *addresses, PRUint32 numAddresses);
|
||||
NS_IMETHOD SetCCListArray(const char *names, const char *addresses, PRUint32 numAddresses);
|
||||
NS_IMETHOD SetAuthor(const char *author);
|
||||
NS_IMETHOD SetSubject(const char *subject);
|
||||
NS_IMETHOD SetStatusOffset(PRUint32 statusOffset);
|
||||
|
||||
NS_IMETHOD GetAuthor(nsString *resultAuthor);
|
||||
NS_IMETHOD GetSubject(nsString *resultSubject);
|
||||
NS_IMETHOD GetRecipients(nsString *resultRecipients);
|
||||
NS_IMETHOD GetMessageId(char **resultMessageId);
|
||||
|
||||
NS_IMETHOD GetMime2DecodedAuthor(nsString *resultAuthor);
|
||||
NS_IMETHOD GetMime2DecodedSubject(nsString *resultSubject);
|
||||
NS_IMETHOD GetMime2DecodedRecipients(nsString *resultRecipients);
|
||||
|
||||
NS_IMETHOD GetAuthorCollationKey(nsString *resultAuthor);
|
||||
NS_IMETHOD GetSubjectCollationKey(nsString *resultSubject);
|
||||
NS_IMETHOD GetRecipientsCollationKey(nsString *resultRecipients);
|
||||
|
||||
NS_IMETHOD GetCcList(char **ccList);
|
||||
// flag handling routines
|
||||
NS_IMETHOD GetFlags(PRUint32 *result);
|
||||
NS_IMETHOD SetFlags(PRUint32 flags);
|
||||
NS_IMETHOD OrFlags(PRUint32 flags, PRUint32 *result);
|
||||
NS_IMETHOD AndFlags(PRUint32 flags, PRUint32 *result);
|
||||
|
||||
// Mark message routines
|
||||
NS_IMETHOD MarkRead(PRBool bRead);
|
||||
NS_IMETHOD MarkFlagged(PRBool bRead);
|
||||
|
||||
NS_IMETHOD GetMessageKey(nsMsgKey *result);
|
||||
NS_IMETHOD GetThreadId(nsMsgKey *result);
|
||||
NS_IMETHOD SetThreadId(nsMsgKey inKey);
|
||||
NS_IMETHOD SetMessageKey(nsMsgKey inKey);
|
||||
NS_IMETHOD GetMessageSize(PRUint32 *result);
|
||||
NS_IMETHOD SetMessageSize(PRUint32 messageSize);
|
||||
NS_IMETHOD GetLineCount(PRUint32 *result);
|
||||
NS_IMETHOD SetLineCount(PRUint32 lineCount);
|
||||
NS_IMETHOD SetPriority(nsMsgPriority priority);
|
||||
NS_IMETHOD SetPriorityString(const char *priority);
|
||||
NS_IMETHOD GetMessageOffset(PRUint32 *result);
|
||||
NS_IMETHOD GetStatusOffset(PRUint32 *result);
|
||||
NS_IMETHOD GetCharSet(nsString *result);
|
||||
NS_IMETHOD GetPriority(nsMsgPriority *msgPriority);
|
||||
NS_IMETHOD GetThreadParent(nsMsgKey *result);
|
||||
NS_IMETHOD SetThreadParent(nsMsgKey inKey);
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// nsMsgHdr methods:
|
||||
nsMsgHdr(nsMsgDatabase *db, nsIMdbRow *dbRow);
|
||||
@ -132,6 +73,7 @@ protected:
|
||||
nsCString m_references;
|
||||
nsMsgPriority m_priority;
|
||||
|
||||
PRBool m_recipientsIsNewsgroup;
|
||||
// nsMsgHdrs will have to know what db and row they belong to, since they are really
|
||||
// just a wrapper around the msg row in the mdb. This could cause problems,
|
||||
// though I hope not.
|
||||
|
@ -538,7 +538,8 @@ nsresult nsMailDatabase::PrePopulate()
|
||||
newHdr->SetAuthor("bird@celtics.com (Larry Bird)");
|
||||
newHdr->SetSubject("Why the Lakers suck");
|
||||
newHdr->SetDate(now);
|
||||
newHdr->SetRecipients("riley@heat.com (Pat Riley)", PR_FALSE);
|
||||
newHdr->SetRecipients("riley@heat.com (Pat Riley)");
|
||||
newHdr->SetRecipientsIsNewsgroup(PR_FALSE);
|
||||
AddNewHdrToDB (newHdr, PR_TRUE);
|
||||
newHdr->Release();
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "nsMsgThread.h"
|
||||
#include "nsFileStream.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIMsgHeaderParser.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
#include "nsMorkCID.h"
|
||||
@ -2502,12 +2503,12 @@ nsresult nsMsgDatabase::ThreadNewHdr(nsMsgHdr* newHdr, PRBool &newThread)
|
||||
}
|
||||
#ifdef SUBJ_THREADING
|
||||
// try subject threading if we couldn't find a reference and the subject starts with Re:
|
||||
nsAutoString subject;
|
||||
nsXPIDLCString subject;
|
||||
|
||||
newHdr->GetSubject(&subject);
|
||||
newHdr->GetSubject(getter_Copies(subject));
|
||||
if ((ThreadBySubjectWithoutRe() || (newHdrFlags & MSG_FLAG_HAS_RE)) && (!thread))
|
||||
{
|
||||
nsCAutoString cSubject = subject;
|
||||
nsCAutoString cSubject(subject);
|
||||
thread = getter_AddRefs(GetThreadForSubject(cSubject));
|
||||
if(thread)
|
||||
{
|
||||
@ -2672,13 +2673,11 @@ nsresult nsMsgDatabase::AddNewThread(nsMsgHdr *msgHdr)
|
||||
|
||||
nsMsgThread *threadHdr = nsnull;
|
||||
|
||||
nsAutoString subject;
|
||||
nsXPIDLCString subject;
|
||||
|
||||
nsresult err = msgHdr->GetSubject(&subject);
|
||||
nsresult err = msgHdr->GetSubject(getter_Copies(subject));
|
||||
|
||||
nsAutoCString cSubject(subject);
|
||||
|
||||
err = CreateNewThread(msgHdr->m_messageKey, (const char *) cSubject, &threadHdr);
|
||||
err = CreateNewThread(msgHdr->m_messageKey, subject, &threadHdr);
|
||||
msgHdr->SetThreadId(msgHdr->m_messageKey);
|
||||
if (threadHdr)
|
||||
{
|
||||
@ -2792,17 +2791,15 @@ nsresult nsMsgDatabase::DumpContents()
|
||||
nsMsgHdr* msgHdr = NS_STATIC_CAST(nsMsgHdr*, msg); // closed system, cast ok
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsAutoString author;
|
||||
nsAutoString subject;
|
||||
nsXPIDLCString author;
|
||||
nsXPIDLCString subject;
|
||||
|
||||
msgHdr->GetMessageKey(&key);
|
||||
msgHdr->GetAuthor(&author);
|
||||
msgHdr->GetSubject(&subject);
|
||||
char *authorStr = author.ToNewCString();
|
||||
char *subjectStr = subject.ToNewCString();
|
||||
printf("hdr key = %u, author = %s subject = %s\n", key, (authorStr) ? authorStr : "", (subjectStr) ? subjectStr : "");
|
||||
delete [] authorStr;
|
||||
delete [] subjectStr;
|
||||
msgHdr->GetAuthor(getter_Copies(author));
|
||||
msgHdr->GetSubject(getter_Copies(subject));
|
||||
printf("hdr key = %u, author = %s subject = %s\n", key,
|
||||
((const char *)author) ? (const char *)author : "",
|
||||
((const char*)subject) ? (const char*)subject : "");
|
||||
NS_RELEASE(msgHdr);
|
||||
}
|
||||
}
|
||||
|
@ -372,12 +372,25 @@ NS_IMETHODIMP nsMsgHdr::SetReferences(const char *references)
|
||||
return SetStringColumn(references, m_mdb->m_referencesColumnToken);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::SetRecipients(const char *recipients, PRBool rfc822 /* = PR_TRUE */)
|
||||
NS_IMETHODIMP nsMsgHdr::SetRecipients(const char *recipients)
|
||||
{
|
||||
// need to put in rfc822 address parsing code here (or make caller do it...)
|
||||
return SetStringColumn(recipients, m_mdb->m_recipientsColumnToken);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::SetRecipientsIsNewsgroup(PRBool rfc822)
|
||||
{
|
||||
m_recipientsIsNewsgroup = rfc822; // ???
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::GetRecipientsIsNewsgroup(PRBool *rfc822)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(rfc822);
|
||||
(*rfc822) = m_recipientsIsNewsgroup;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::SetRecipientsArray(const char *names, const char *addresses, PRUint32 numAddresses)
|
||||
{
|
||||
nsresult ret;
|
||||
@ -405,7 +418,8 @@ NS_IMETHODIMP nsMsgHdr::SetRecipientsArray(const char *names, const char *addres
|
||||
curName += strlen(curName) + 1;
|
||||
curAddress += strlen(curAddress) + 1;
|
||||
}
|
||||
ret = SetRecipients(allRecipients, PR_TRUE);
|
||||
ret = SetRecipients(allRecipients);
|
||||
SetRecipientsIsNewsgroup(PR_TRUE);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -537,19 +551,19 @@ NS_IMETHODIMP nsMsgHdr::SetPriorityString(const char *priority)
|
||||
return SetPriority(priorityVal);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::GetAuthor(nsString *resultAuthor)
|
||||
NS_IMETHODIMP nsMsgHdr::GetAuthor(char* *resultAuthor)
|
||||
{
|
||||
return m_mdb->RowCellColumnTonsString(GetMDBRow(), m_mdb->m_senderColumnToken, *resultAuthor);
|
||||
return m_mdb->RowCellColumnToCharPtr(GetMDBRow(), m_mdb->m_senderColumnToken, resultAuthor);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::GetSubject(nsString *resultSubject)
|
||||
NS_IMETHODIMP nsMsgHdr::GetSubject(char* *resultSubject)
|
||||
{
|
||||
return m_mdb->RowCellColumnTonsString(GetMDBRow(), m_mdb->m_subjectColumnToken, *resultSubject);
|
||||
return m_mdb->RowCellColumnToCharPtr(GetMDBRow(), m_mdb->m_subjectColumnToken, resultSubject);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::GetRecipients(nsString *resultRecipients)
|
||||
NS_IMETHODIMP nsMsgHdr::GetRecipients(char* *resultRecipients)
|
||||
{
|
||||
return m_mdb->RowCellColumnTonsString(GetMDBRow(), m_mdb->m_recipientsColumnToken, *resultRecipients);
|
||||
return m_mdb->RowCellColumnToCharPtr(GetMDBRow(), m_mdb->m_recipientsColumnToken, resultRecipients);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::GetCcList(char * *resultCCList)
|
||||
|
@ -1170,7 +1170,8 @@ int nsParseMailMessageState::FinalizeHeaders()
|
||||
*ch = 0;
|
||||
recipient->length = nsCRT::strlen(recipient->value);
|
||||
}
|
||||
m_newMsgHdr->SetRecipients(recipient->value, PR_FALSE);
|
||||
m_newMsgHdr->SetRecipients(recipient->value);
|
||||
m_newMsgHdr->SetRecipientsIsNewsgroup(PR_FALSE);
|
||||
}
|
||||
else if (recipient)
|
||||
{
|
||||
@ -1187,8 +1188,10 @@ int nsParseMailMessageState::FinalizeHeaders()
|
||||
PR_FREEIF(addresses);
|
||||
PR_FREEIF(names);
|
||||
}
|
||||
else // hmm, should we just use the original string?
|
||||
m_newMsgHdr->SetRecipients(recipient->value, PR_TRUE);
|
||||
else { // hmm, should we just use the original string?
|
||||
m_newMsgHdr->SetRecipients(recipient->value);
|
||||
m_newMsgHdr->SetRecipientsIsNewsgroup(PR_TRUE);
|
||||
}
|
||||
}
|
||||
if (ccList)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user