BOOL CMapiMessage::FetchHeaders( void) { LPSPropValue pVal = CMapiApi::GetMapiProperty( m_lpMsg, PR_TRANSPORT_MESSAGE_HEADERS); if (pVal && CMapiApi::IsLargeProperty( pVal)) { m_headers.Truncate(); CMapiApi::GetLargeStringProperty( m_lpMsg, PR_TRANSPORT_MESSAGE_HEADERS, m_headers); } else if (pVal && (PROP_TYPE( pVal->ulPropTag) == PT_TSTRING) && (pVal->Value.LPSZ) && (*(pVal->Value.LPSZ))) { m_headers = pVal->Value.LPSZ; } else { // Need to build the headers from the other stuff m_headers.Truncate(); BuildHeaders(); } if (pVal) CMapiApi::MAPIFreeBuffer( pVal); m_fromLine.Truncate(); if (NeedsFromLine()) { BuildFromLine(); } if (!m_fromLine.IsEmpty()) { MAPI_DUMP_STRING(m_fromLine.get()); } MAPI_DUMP_STRING(m_headers.get()); MAPI_TRACE0("\r\n"); ProcessHeaders(); if (!m_headers.IsEmpty()) { if (!m_bHasSubject) AddSubject( m_headers); if (!m_bHasFrom) AddFrom( m_headers); if (!m_bHasDate) AddDate( m_headers); m_headers.Trim( kWhitespace, PR_FALSE, PR_TRUE); m_headers += "\x0D\x0A"; } return( !m_headers.IsEmpty()); }
//long buildCounter = 0; //__________________________________________________________________ void _HYSequencePane::BuildPane (bool setport) { if (setport) { StartDraw(); EraseAll(); } if (columnStrings.lLength) { long visWidth = _HYCanvas::GetMaxW()-headerWidth-5, visHeight = _HYCanvas::GetMaxH()-5, rowCount = speciesIndex.lLength, slotHeight = GetSlotHeight(),h,v,lastColor = -1, selectionIndex = 0, c; if (settings.width&HY_COMPONENT_V_SCROLL) visWidth-=HY_SCROLLER_WIDTH; if (settings.width&HY_COMPONENT_H_SCROLL) visHeight-=HY_SCROLLER_WIDTH; if (startColumn<0) startColumn = 0; if (startRow<0) startRow = 0; if (setport) { endColumn = startColumn+visWidth/charWidth; h = (endColumn-startColumn)/5; endColumn = startColumn+(visWidth-h)/charWidth; endRow = startRow+visHeight/slotHeight; } if (endColumn>columnStrings.lLength) endColumn = columnStrings.lLength; if (endRow>rowCount) endRow = rowCount; _HYRect r = {0,0,visHeight,visWidth+headerWidth,1}, backCharRect; _HYColor blackC = {0,0,0}, charColor = {0,0,0}, whiteC = {255,255,255}, selectColor = highlightColor; if (setport) SetColor (backColor); else { selectColor = (_HYColor){160,160,160}; SetColor (whiteC); } FillRect (r); SetColor (blackC); BuildHeaders(); if (numbers) { r.left = 0; r.right = visWidth+headerWidth; r.bottom = (GetSlotHeight()+1); SetColor (headerColor); FillRect(r); if (setport) { SetColor (blackC); r.top = r.bottom; DrawLine (r); } } if (setport) { r.left = r.right = headerWidth; r.top = 0; r.bottom = visHeight; DrawLine (r); } r.left = r.right = headerWidth; r.top = 0; r.bottom = visHeight; h = HY_SEQUENCE_PANE_CHAR_SPACING/2+headerWidth; visWidth+=headerWidth; for (c = startColumn; c < endColumn; c++,h+=charWidth) { if (h+charWidth>visWidth) { endColumn = c; break; } bool isColumnSelected = false; if (selectionIndex<selection.lLength) { rowCount = selection.lData[selectionIndex]; while ((rowCount<c)&&(selectionIndex<selection.lLength)) { selectionIndex++; rowCount = selection.lData[selectionIndex]; } if (c==rowCount) { if (!invertColors) { _HYRect invR; invR.top = (GetSlotHeight()+1)+1; invR.bottom = visHeight-1; invR.right = h+charWidth; invR.left = h; if (c&&(c%blockWidth==0)) invR.right+=2; else if (c+1==endColumn) invR.right+=3; charColor = GetColor(); SetColor (selectColor); FillRect (invR); SetColor (charColor); } selectionIndex++; isColumnSelected = true; } } if (c && (c%blockWidth==0) && (setport|| c>startColumn) ) { SetColor (blackC); if (numbers) { _String number (c); #ifdef __MAC__ rowCount = h-2-GetVisibleStringWidth(number); #else rowCount = h-2-GetVisibleStringWidth(number, font); #endif if (rowCount>headerWidth) DisplayText (number,slotHeight-3,rowCount,true); } if (setport) { r.left = r.right = h; DrawLine (r); } SetColor (charColor); h+=2; } if (numbers) v = slotHeight+(GetSlotHeight()+1); else v = slotHeight; _String *thisString = (_String*)columnStrings(c); unsigned char topChar = showDots?thisString->sData[speciesIndex.lData[0]]:0; //if (!setport) //SetColor (blackC); backCharRect = (_HYRect) { v-slotHeight+1,h-1,v+1,h+charWidth-1,0 }; if ((c+1)%blockWidth == 0) backCharRect.right++; for (long r = startRow; r < endRow; r++,v+=slotHeight) { unsigned char thisC = thisString->sData[speciesIndex.lData[r]]; long myColor = colorMap[thisC]; if (r && thisC==topChar) thisC = '.'; //if (setport) { if (invertColors && !isColumnSelected) { charColor = LongToHYColor (characterColors.lData[myColor]); if ((long)charColor.R+charColor.G+charColor.B > 100) { SetColor (charColor); FillRect (backCharRect); } backCharRect.top += slotHeight; backCharRect.bottom += slotHeight; SetColor (blackC); } else if (colorMap[thisC]!=lastColor) { lastColor = colorMap[thisC]; charColor = LongToHYColor(characterColors.lData[lastColor]); SetColor (charColor); } } DisplayChar (thisC,v,h); } } if ((!setport)&&(c%blockWidth == 0)) { SetColor (blackC); if (numbers) { _String number (c); #ifdef __MAC__ rowCount = h-2-GetVisibleStringWidth(number); #else rowCount = h-2-GetVisibleStringWidth(number, font); #endif if (rowCount>headerWidth) DisplayText (number,slotHeight-3,rowCount,true); } } SetColor (blackC); r.left = 0; r.right = visWidth; if (settings.width&HY_COMPONENT_BORDER_B) { r.top = r.bottom = visHeight-1; if (setport) DrawLine(r); } } if (setport) EndDraw(); }
nsresult nsMsgSendLater::DeliverQueuedLine(char *line, int32_t length) { int32_t flength = length; m_bytesRead += length; // convert existing newline to CRLF // Don't need this because the calling routine is taking care of it. // if (length > 0 && (line[length-1] == '\r' || // (line[length-1] == '\n' && (length < 2 || line[length-2] != '\r')))) // { // line[length-1] = '\r'; // line[length++] = '\n'; // } // // // We are going to check if we are looking at a "From - " line. If so, // then just eat it and return NS_OK // if (!PL_strncasecmp(line, "From - ", 7)) return NS_OK; if (m_inhead) { if (m_headersPosition == 0) { // This line is the first line in a header block. // Remember its position. m_headersPosition = m_position; // Also, since we're now processing the headers, clear out the // slots which we will parse data into, so that the values that // were used the last time around do not persist. // We must do that here, and not in the previous clause of this // `else' (the "I've just seen a `From ' line clause") because // that clause happens before delivery of the previous message is // complete, whereas this clause happens after the previous msg // has been delivered. If we did this up there, then only the // last message in the folder would ever be able to be both // mailed and posted (or fcc'ed.) PR_FREEIF(m_to); PR_FREEIF(m_bcc); PR_FREEIF(m_newsgroups); PR_FREEIF(m_newshost); PR_FREEIF(m_fcc); PR_FREEIF(mIdentityKey); } if (line[0] == '\r' || line[0] == '\n' || line[0] == 0) { // End of headers. Now parse them; open the temp file; // and write the appropriate subset of the headers out. m_inhead = false; nsresult rv = MsgNewBufferedFileOutputStream(getter_AddRefs(mOutFile), mTempFile, -1, 00600); if (NS_FAILED(rv)) return NS_MSG_ERROR_WRITING_FILE; nsresult status = BuildHeaders(); if (NS_FAILED(status)) return status; uint32_t n; rv = mOutFile->Write(m_headers, m_headersFP, &n); if (NS_FAILED(rv) || n != (uint32_t)m_headersFP) return NS_MSG_ERROR_WRITING_FILE; } else { // Otherwise, this line belongs to a header. So append it to the // header data. if (!PL_strncasecmp (line, HEADER_X_MOZILLA_STATUS, PL_strlen(HEADER_X_MOZILLA_STATUS))) // Notice the position of the flags. m_flagsPosition = m_position; else if (m_headersFP == 0) m_flagsPosition = 0; nsresult status = do_grow_headers (length + m_headersFP + 10); if (NS_FAILED(status)) return status; memcpy(m_headers + m_headersFP, line, length); m_headersFP += length; } } else { // This is a body line. Write it to the file. PR_ASSERT(mOutFile); if (mOutFile) { uint32_t wrote; nsresult rv = mOutFile->Write(line, length, &wrote); if (NS_FAILED(rv) || wrote < (uint32_t) length) return NS_MSG_ERROR_WRITING_FILE; } } m_position += flength; return NS_OK; }
//__________________________________________________________________ void _HYSequencePane::ProcessVSelectionChange (long h, long v, bool shift, bool command, bool drag, bool editName) { if (selection.lLength) { selection.Clear(); BuildPane(); _MarkForUpdate(); SendSelectionChange(); } if (drag) return; if ((h<headerWidth)&&(v>(GetSlotHeight()+1))) { long k, p; v = (v-(GetSlotHeight()+1))/(GetFont().size+HY_SEQUENCE_PANE_CHAR_SPACING)+startRow; if (v>=endRow) return; if (editName) { EditSequenceName (v); return; } if (shift) { if (recentClick!=-1) { if (v==recentClick) { return; } if ((!command)||drag) vselection.Clear(); if (v>recentClick) { k=recentClick; p=v; } else { p=recentClick; k=v; } if (!command||!vselection.lLength||drag) for (h=k;h<=p;h++) vselection<<h; else { for (h=k;h<=p;h++) { AddSpeciesToSelection(h); } } StartDraw(); BuildHeaders(); EndDraw(); _MarkForUpdate(); SendSelectionChange(); return; } } else { if (command) { h = vselection.BinaryFind (v); if (h>=0) vselection.Delete(h); else vselection.InsertElement ((BaseRef)v,-h-2,false,false); StartDraw(); BuildHeaders(); EndDraw(); _MarkForUpdate(); SendSelectionChange(true); return; } } if (vselection.BinaryFind(v)>0) return; vselection.Clear(); vselection<<v; recentClick = v; StartDraw(); BuildHeaders(); EndDraw(); _MarkForUpdate(); } SendSelectionChange(true); }