[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepim/akonadi/agents/nepomuk_email_feeder
From: Volker Krause <vkrause () kde ! org>
Date: 2009-10-01 13:33:54
Message-ID: 1254404034.835725.5809.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1030066 by vkrause:
Don't index the main body part of an email as attachment.
M +23 -11 messageanalyzer.cpp
M +1 -0 messageanalyzer.h
--- trunk/KDE/kdepim/akonadi/agents/nepomuk_email_feeder/messageanalyzer.cpp \
#1030065:1030066 @@ -40,26 +40,30 @@
MessageAnalyzer::MessageAnalyzer(const Akonadi::Item& item, const QUrl& graphUri, \
NepomukFeederAgentBase* parent) : QObject( parent ),
+ m_parent( parent ),
m_item( item ),
m_email( item.url(), graphUri ),
- m_graphUri( graphUri )
+ m_graphUri( graphUri ),
+ m_mainBodyPart( 0 )
{
NepomukFeederAgentBase::setParent( m_email, item );
const KMime::Message::Ptr msg = item.payload<KMime::Message::Ptr>();
processHeaders( msg );
- processPart( msg.get() );
- // TODO: run OTP for decryption
+ if ( !msg->body().isEmpty() || !msg->contents().isEmpty() ) {
- KMime::Content* content = msg->mainBodyPart( "text/plain" );
+ // TODO: run OTP for decryption
- // FIXME: simplyfy this text as in: remove all html tags. Is there a quick way to \
do this?
- if ( content ) {
- const QString text = content->decodedText( true, true );
- if ( !text.isEmpty() ) {
- m_email.setPlainTextMessageContents( QStringList( text ) );
+ // before we walk the part node tree, let's see if there is a main plain text \
body, so we don't interpret that as an attachment later on + m_mainBodyPart = \
msg->mainBodyPart( "text/plain" ); + if ( m_mainBodyPart ) {
+ const QString text = m_mainBodyPart->decodedText( true, true );
+ if ( !text.isEmpty() )
+ m_email.setPlainTextMessageContents( QStringList( text ) );
}
+
+ processPart( msg.get() );
}
deleteLater();
@@ -109,9 +113,17 @@
processPart( child );
}
- // main body part
- // TODO handle primary body part and put the code from the ctor here
+ // plain text main body part, we already dealt with that
+ else if ( content == m_mainBodyPart ) {
+ return;
+ }
+ // non plain text main body part, let strigi figure out what to do about that
+ else if ( !m_mainBodyPart ) {
+ m_mainBodyPart = content;
+ m_parent->indexData( m_email.uri(), content->decodedContent(), \
m_item.modificationTime() ); + }
+
// attachment -> delegate to strigi
else {
const KMime::ContentIndex index = content->index();
--- trunk/KDE/kdepim/akonadi/agents/nepomuk_email_feeder/messageanalyzer.h \
#1030065:1030066 @@ -57,6 +57,7 @@
Akonadi::Item m_item;
NepomukFast::Email m_email;
QUrl m_graphUri;
+ KMime::Content *m_mainBodyPart;
};
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic