nsIMAPBodypartMessage::nsIMAPBodypartMessage(char *partNum, nsIMAPBodypart *parentPart, bool topLevelMessage, char *bodyType, char *bodySubType, char *bodyID, char *bodyDescription, char *bodyEncoding, int32_t partLength, bool preferPlainText) : nsIMAPBodypartLeaf(partNum, parentPart, bodyType, bodySubType, bodyID, bodyDescription, bodyEncoding, partLength, preferPlainText) { m_topLevelMessage = topLevelMessage; if (m_topLevelMessage) { m_partNumberString = PR_smprintf("0"); if (!m_partNumberString) { SetIsValid(false); return; } } m_body = NULL; m_headers = new nsIMAPMessageHeaders(m_partNumberString, this); // We always have a Headers object if (!m_headers || !m_headers->GetIsValid()) { SetIsValid(false); return; } SetIsValid(true); }
test_F SetAllocaction() { Set_t *m[NMAT]; MtxErrorHandler_t *old_err_handler; int i; for (i = 0; i < NMAT; ++i) { m[i] = SetAlloc(); } for (i = 0; i < NMAT; ++i) { SetIsValid(m[i]); MTX_VERIFY(m[i]->Size == 0); } for (i = 0; i < NMAT; ++i) { if (SetFree(m[i]) != 0) { TST_FAIL("SetFree() failed"); } } old_err_handler = MtxSetErrorHandler(MyErrorHandler); for (i = 0; i < NMAT; ++i) { if (SetIsValid(m[i]) || !CheckError()) { TST_FAIL("SetIsValid() failed"); } } MtxSetErrorHandler(old_err_handler); }
// Fills in buffer (and adopts storage) for header object void nsIMAPBodyShell::AdoptMessageHeaders(char *headers, const char *partNum) { if (!GetIsValid()) return; if (!partNum) partNum = "0"; // we are going to say that a message header object only has // part data, and no header data. nsIMAPBodypart *foundPart = m_message->FindPartWithNumber(partNum); if (foundPart) { nsIMAPBodypartMessage *messageObj = foundPart->GetnsIMAPBodypartMessage(); if (messageObj) { messageObj->AdoptMessageHeaders(headers); if (!messageObj->GetIsValid()) SetIsValid(false); } else { // We were filling in message headers for a given part number. // We looked up that part number, found an object, but it // wasn't of type message/rfc822. // Something's wrong. NS_ASSERTION(false, "object not of type message rfc822"); } } else SetIsValid(false); }
nsIMAPBodyShell::nsIMAPBodyShell(nsImapProtocol *protocolConnection, nsIMAPBodypartMessage *message, uint32_t UID, const char *folderName) { m_isValid = false; m_isBeingGenerated = false; m_cached = false; m_gotAttachmentPref = false; m_generatingWholeMessage = false; m_generatingPart = NULL; m_protocolConnection = protocolConnection; m_message = message; NS_ASSERTION(m_protocolConnection, "non null connection"); if (!m_protocolConnection) return; m_prefetchQueue = new nsIMAPMessagePartIDArray(); if (!m_prefetchQueue) return; m_UID = ""; m_UID.AppendInt(UID); #ifdef DEBUG_chrisf NS_ASSERTION(folderName); #endif if (!folderName) return; m_folderName = NS_strdup(folderName); if (!m_folderName) return; SetContentModified(GetShowAttachmentsInline() ? IMAP_CONTENT_MODIFIED_VIEW_INLINE : IMAP_CONTENT_MODIFIED_VIEW_AS_LINKS); SetIsValid(m_message != nullptr); }
// Adopts storage for header data buffer. If NULL, sets isValid to false. void nsIMAPBodypart::AdoptHeaderDataBuffer(char *buf) { m_headerData = buf; if (!m_headerData) { SetIsValid(false); } }
// Fills in buffer (and adopts storage) for header object void nsIMAPBodypartMessage::AdoptMessageHeaders(char *headers) { if (!GetIsValid()) return; // we are going to say that the message headers only have // part data, and no header data. m_headers->AdoptPartDataBuffer(headers); if (!m_headers->GetIsValid()) SetIsValid(false); }
// Fills in buffer (and adopts storage) for MIME headers in appropriate object. // If object can't be found, sets isValid to false. void nsIMAPBodyShell::AdoptMimeHeader(const char *partNum, char *mimeHeader) { if (!GetIsValid()) return; NS_ASSERTION(partNum, "null partnum in body shell"); nsIMAPBodypart *foundPart = m_message->FindPartWithNumber(partNum); if (foundPart) { foundPart->AdoptHeaderDataBuffer(mimeHeader); if (!foundPart->GetIsValid()) SetIsValid(false); } else { SetIsValid(false); } }
nsIMAPBodypartMultipart::nsIMAPBodypartMultipart(char *partNum, nsIMAPBodypart *parentPart) : nsIMAPBodypart(partNum, parentPart) { if (!m_parentPart || (m_parentPart->GetType() == IMAP_BODY_MESSAGE_RFC822)) { // the multipart (this) will inherit the part number of its parent PR_FREEIF(m_partNumberString); if (!m_parentPart) { m_partNumberString = PR_smprintf("0"); } else m_partNumberString = NS_strdup(m_parentPart->GetPartNumberString()); } m_partList = new nsVoidArray(); m_bodyType = NS_strdup("multipart"); if (m_partList && m_parentPart && m_bodyType) SetIsValid(true); else SetIsValid(false); }
nsIMAPMessageHeaders::nsIMAPMessageHeaders(char *partNum, nsIMAPBodypart *parentPart) : nsIMAPBodypart(partNum, parentPart) { if (!partNum) { SetIsValid(false); return; } m_partNumberString = NS_strdup(partNum); if (!m_partNumberString) { SetIsValid(false); return; } if (!m_parentPart || !m_parentPart->GetnsIMAPBodypartMessage()) { // Message headers created without a valid Message parent NS_ASSERTION(false, "creating message headers with invalid message parent"); SetIsValid(false); } }
void CThreadInfo::Init() { // FILETIME stNow; // GetLocalTime(&stNow); SetIsValid ( false ); SetThreadID ( 0 ); // SetCreationTime( stNow ); // SetExitTime ( stNow ); // SetKernelTime ( stNow ); // SetUserTime ( stNow ); SetKernelDiff ( 0 ); SetUserDiff ( 0 ); }
CThreadInfo& CThreadInfo::operator=( CThreadInfo& src ) { if ( this == &src ) return *this; SetIsValid ( src.IsValid() ); SetThreadID ( src.GetThreadID() ); SetCreationTime( src.GetCreationTime() ); SetExitTime ( src.GetExitTime() ); SetKernelTime ( src.GetKernelTime() ); SetUserTime ( src.GetUserTime() ); SetKernelDiff ( src.GetKernelDiff() ); SetUserDiff ( src.GetUserDiff() ); return *this; }
nsIMAPBodypart::nsIMAPBodypart(char *partNumber, nsIMAPBodypart *parentPart) { SetIsValid(true); m_parentPart = parentPart; m_partNumberString = partNumber; // storage adopted m_partData = NULL; m_headerData = NULL; m_boundaryData = NULL; // initialize from parsed BODYSTRUCTURE m_contentLength = 0; m_partLength = 0; m_contentType = NULL; m_bodyType = NULL; m_bodySubType = NULL; m_bodyID = NULL; m_bodyDescription = NULL; m_bodyEncoding = NULL; }
int32_t nsIMAPBodypart::GenerateMIMEHeader(nsIMAPBodyShell *aShell, bool stream, bool prefetch) { if (prefetch && !m_headerData) { QueuePrefetchMIMEHeader(aShell); return 0; } else if (m_headerData) { int32_t mimeHeaderLength = 0; if (!ShouldFetchInline(aShell)) { // if this part isn't inline, add the X-Mozilla-IMAP-Part header char *xPartHeader = PR_smprintf("%s: %s", IMAP_EXTERNAL_CONTENT_HEADER, m_partNumberString); if (xPartHeader) { if (stream) { aShell->GetConnection()->Log("SHELL","GENERATE-XHeader",m_partNumberString); aShell->GetConnection()->HandleMessageDownLoadLine(xPartHeader, false); } mimeHeaderLength += PL_strlen(xPartHeader); PR_Free(xPartHeader); } } mimeHeaderLength += PL_strlen(m_headerData); if (stream) { aShell->GetConnection()->Log("SHELL","GENERATE-MIMEHeader",m_partNumberString); aShell->GetConnection()->HandleMessageDownLoadLine(m_headerData, false); // all one line? Can we do that? } return mimeHeaderLength; } else { SetIsValid(false); // prefetch didn't adopt a MIME header return 0; } }
nsIMAPBodypartLeaf::nsIMAPBodypartLeaf(char *partNum, nsIMAPBodypart *parentPart, char *bodyType, char *bodySubType, char *bodyID, char *bodyDescription, char *bodyEncoding, int32_t partLength, bool preferPlainText) : nsIMAPBodypart(partNum, parentPart), mPreferPlainText(preferPlainText) { m_bodyType = bodyType; m_bodySubType = bodySubType; m_bodyID = bodyID; m_bodyDescription = bodyDescription; m_bodyEncoding = bodyEncoding; m_partLength = partLength; if (m_bodyType && m_bodySubType) { m_contentType = PR_smprintf("%s/%s", m_bodyType, m_bodySubType); } SetIsValid(true); }
void MarsObject::OnAnimationEndEventHandler(std::string animationName, cocos2d::CCNode* pNode) { SetIsValid(false); }
//--------------------------------------------------------------------------- // // * @param table Table identifier // * @param code Code // * @param isValid Boolean indicating whether code is value // sgStagingCode::sgStagingCode(std::string table, std::string code, bool isValid) { SetTable(table); SetCode(code); SetIsValid(isValid); }