Update of /cvsroot/mahogany/M/src/classes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12588/src/classes
Modified Files:
ComposeTemplate.cpp MessageView.cpp
Log Message:
when replying to PGP-encrypted messages we now use plain text (coming from the
viewer) instead of the encrypted text; for this:
1. added MessageView::OnBodyText() to accumulate the text shown in the viewer
2. added ViewFilter::Start/EndText() and ProcessURL() and overrode them in
TransparentFilter to call OnBodyText()
3. modified the view filters to use the functions above instead of using
MessageViewer methods directly
4. removed NO_QUOTE hack from MailFolder, now we don't quote anything simply
if the msgview is NULL
Index: ComposeTemplate.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/classes/ComposeTemplate.cpp,v
retrieving revision 1.65
retrieving revision 1.66
diff -b -u -2 -r1.65 -r1.66
--- ComposeTemplate.cpp 22 Apr 2004 18:45:38 -0000 1.65
+++ ComposeTemplate.cpp 12 Jul 2004 20:53:20 -0000 1.66
@@ -71,5 +71,4 @@
extern const MOption MP_REPLY_MSGPREFIX_FROM_SENDER;
extern const MOption MP_REPLY_QUOTE_EMPTY;
-extern const MOption MP_REPLY_QUOTE_SELECTION;
extern const MOption MP_REPLY_SIG_SEPARATOR;
extern const MOption MP_WRAPMARGIN;
@@ -338,10 +337,4 @@
void DoQuoteOriginal(bool isQuote, String *value) const;
- // quote a single MimePart, return true if we quoted it or false if we
- // ignored it (because we can't put such data in the composer...)
- bool DoQuotePart(const MimePart *mimePart,
- const String& prefix,
- String *value) const;
-
// get the signature to use (including the signature separator, if any)
String GetSignature() const;
@@ -1551,68 +1544,13 @@
// ----------------------------------------------------------------------------
-bool
-VarExpander::DoQuotePart(const MimePart *mimePart,
- const String& prefix,
- String *value) const
+void
+VarExpander::DoQuoteOriginal(bool isQuote, String *value) const
{
- if ( !mimePart )
- {
- // this can only happen if the top level MIME part is NULL (when we call
- // ourselves recursively the pointer is never NULL) and in this case we
- // must let the user know that something is wrong
- wxLogError(_("Failed to quote the original message."));
-
- return false;
- }
-
- bool quoted = false;
-
- const MimeType mimeType = mimePart->GetType();
- switch ( mimeType.GetPrimary() )
+ if ( !m_msgview )
{
- case MimeType::TEXT:
- *value += ExpandOriginalText(mimePart->GetTextContent(),
- prefix,
- m_profile);
-
- quoted = true;
- break;
-
- case MimeType::MULTIPART:
- // to process multipart/alternative correctly we should really iterate
- // from the end to the beginning so that we could take the best
- // representation of the data but knowing that currently we only
- // really handle plain/text anyhow, it doesn't matter -- but it will
- // if/when we extend the composer to deal with other kinds of data
- {
- for ( MimePart *mimePartNested = mimePart->GetNested();
- mimePartNested;
- mimePartNested = mimePartNested->GetNext() )
- {
- if ( DoQuotePart(mimePartNested, prefix, value) )
- {
- quoted = true;
-
- if ( mimeType.GetSubType() == _T("ALTERNATIVE") )
- {
- // only one of the alternative parts should be used
- break;
- }
- }
- }
- }
- break;
-
- default:
- // ignore all the others -- we don't want to quote pictures, do we?
- ;
+ // don't quote anything at all
+ return;
}
- return quoted;
-}
-
-void
-VarExpander::DoQuoteOriginal(bool isQuote, String *value) const
-{
// insert the original text (optionally prefixed by reply
// string)
@@ -1624,38 +1562,11 @@
//else: template "text", so no reply prefix at all
-
- // do we include everything or just the selection?
-
- // first: can we get the selection?
- bool justSelection = m_msgview != NULL;
-
- // second: should we use the selection?
- if ( justSelection && !READ_CONFIG(m_profile, MP_REPLY_QUOTE_SELECTION) )
- {
- justSelection = false;
- }
-
- // third: do we have any selection?
- if ( justSelection )
- {
- String selection = m_msgview->GetSelection();
- if ( selection.empty() )
- {
- // take everything if no selection
- justSelection = false;
- }
- else
- {
- // include the selection only in the template expansion
- *value = ExpandOriginalText(selection, prefix, m_profile, NoDetectSig);
- }
- }
-
-
- // quote everything
- if ( !justSelection )
- {
- DoQuotePart(m_msg->GetTopMimePart(), prefix, value);
- }
+ *value = ExpandOriginalText
+ (
+ m_msgview->GetText(),
+ prefix,
+ m_profile,
+ NoDetectSig
+ );
}
Index: MessageView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/classes/MessageView.cpp,v
retrieving revision 1.150
retrieving revision 1.151
diff -b -u -2 -r1.150 -r1.151
--- MessageView.cpp 18 Jun 2004 01:52:41 -0000 1.150
+++ MessageView.cpp 12 Jul 2004 20:53:20 -0000 1.151
@@ -118,4 +118,5 @@
extern const MOption MP_PGP_COMMAND;
extern const MOption MP_PLAIN_IS_TEXT;
+extern const MOption MP_REPLY_QUOTE_SELECTION;
extern const MOption MP_RFC822_IS_TEXT;
extern const MOption MP_SHOWHEADERS;
@@ -243,5 +244,6 @@
// ----------------------------------------------------------------------------
// TransparentFilter: the filter which doesn't filter anything but simply
-// shows the text in the viewer.
+// shows the text in the viewer.(always the last one in
+// filter chain)
// ----------------------------------------------------------------------------
@@ -251,4 +253,25 @@
TransparentFilter(MessageView *msgView) : ViewFilter(msgView, NULL, true)
{
+ m_isInBody = false;
+ }
+
+ virtual void ProcessURL(const String& text,
+ const String& url,
+ MessageViewer *viewer)
+ {
+ if ( m_isInBody )
+ m_msgView->OnBodyText(text);
+
+ viewer->InsertURL(text, url);
+ }
+
+ virtual void StartText()
+ {
+ m_isInBody = true;
+ }
+
+ virtual void EndText()
+ {
+ m_isInBody = false;
}
@@ -258,6 +281,11 @@
MTextStyle& style)
{
+ if ( m_isInBody )
+ m_msgView->OnBodyText(text);
+
viewer->InsertText(text, style);
}
+
+ bool m_isInBody;
};
@@ -1637,5 +1665,9 @@
}
- m_filters->GetFilter()->Process(textPart, m_viewer, style);
+ ViewFilter *filter = m_filters->GetFilter();
+ CHECK_RET( filter, _T("no view filters at all??") );
+
+ filter->StartText();
+ filter->Process(textPart, m_viewer, style);
}
@@ -2230,4 +2262,5 @@
}
+ m_textBody.clear();
m_uid = m_mailMessage->GetUId();
@@ -3139,7 +3172,13 @@
// ----------------------------------------------------------------------------
-String MessageView::GetSelection() const
+String MessageView::GetText() const
{
- return m_viewer->GetSelection();
+ String text;
+ if ( READ_CONFIG(GetProfile(), MP_REPLY_QUOTE_SELECTION) )
+ {
+ text = m_viewer->GetSelection();
+ }
+
+ return text.empty() ? m_textBody : text;
}
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates