Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 1199495c authored by Laurent Montel's avatar Laurent Montel 😁

extractEmailAddress can return an empty string if email is not correct

parent b1682e10
......@@ -322,13 +322,16 @@ bool SearchRuleString::matchesInternal( const QString &msgContents ) const
const QStringList addressList = KPIMUtils::splitAddressList( msgContents.toLower() );
QStringList::ConstIterator end( addressList.constEnd() );
for ( QStringList::ConstIterator it = addressList.constBegin(); ( it != end ); ++it ) {
Akonadi::ContactSearchJob *job = new Akonadi::ContactSearchJob();
job->setLimit( 1 );
job->setQuery( Akonadi::ContactSearchJob::Email, KPIMUtils::extractEmailAddress( *it ).toLower() );
job->exec();
if ( !job->contacts().isEmpty() ) {
return true;
const QString email(KPIMUtils::extractEmailAddress( *it ).toLower());
if (!email.isEmpty()) {
Akonadi::ContactSearchJob *job = new Akonadi::ContactSearchJob();
job->setLimit( 1 );
job->setQuery( Akonadi::ContactSearchJob::Email, email );
job->exec();
if ( !job->contacts().isEmpty() ) {
return true;
}
}
}
return false;
......@@ -340,13 +343,16 @@ bool SearchRuleString::matchesInternal( const QString &msgContents ) const
QStringList::ConstIterator end( addressList.constEnd() );
for ( QStringList::ConstIterator it = addressList.constBegin(); ( it != end ); ++it ) {
Akonadi::ContactSearchJob *job = new Akonadi::ContactSearchJob();
job->setLimit( 1 );
job->setQuery( Akonadi::ContactSearchJob::Email, KPIMUtils::extractEmailAddress( *it ).toLower() );
job->exec();
if ( job->contacts().isEmpty() ) {
return true;
const QString email(KPIMUtils::extractEmailAddress( *it ).toLower());
if (!email.isEmpty()) {
Akonadi::ContactSearchJob *job = new Akonadi::ContactSearchJob();
job->setLimit( 1 );
job->setQuery( Akonadi::ContactSearchJob::Email, email );
job->exec();
if ( job->contacts().isEmpty() ) {
return true;
}
}
}
return false;
......@@ -359,15 +365,18 @@ bool SearchRuleString::matchesInternal( const QString &msgContents ) const
QStringList::ConstIterator end( addressList.constEnd() );
for ( QStringList::ConstIterator it = addressList.constBegin(); it != end; ++it ) {
Akonadi::ContactSearchJob *job = new Akonadi::ContactSearchJob();
job->setQuery( Akonadi::ContactSearchJob::Email, KPIMUtils::extractEmailAddress( *it ).toLower() );
job->exec();
const KABC::Addressee::List contacts = job->contacts();
foreach ( const KABC::Addressee &contact, contacts ) {
if ( contact.hasCategory( category ) ) {
return true;
const QString email(KPIMUtils::extractEmailAddress( *it ).toLower());
if (!email.isEmpty()) {
Akonadi::ContactSearchJob *job = new Akonadi::ContactSearchJob();
job->setQuery( Akonadi::ContactSearchJob::Email, email );
job->exec();
const KABC::Addressee::List contacts = job->contacts();
foreach ( const KABC::Addressee &contact, contacts ) {
if ( contact.hasCategory( category ) ) {
return true;
}
}
}
}
......@@ -381,15 +390,18 @@ bool SearchRuleString::matchesInternal( const QString &msgContents ) const
QStringList::ConstIterator end( addressList.constEnd() );
for ( QStringList::ConstIterator it = addressList.constBegin(); it != end; ++it ) {
Akonadi::ContactSearchJob *job = new Akonadi::ContactSearchJob();
job->setQuery( Akonadi::ContactSearchJob::Email, KPIMUtils::extractEmailAddress( *it ).toLower() );
job->exec();
const KABC::Addressee::List contacts = job->contacts();
foreach ( const KABC::Addressee &contact, contacts ) {
if ( contact.hasCategory( category ) ) {
return false;
const QString email(KPIMUtils::extractEmailAddress( *it ).toLower());
if (!email.isEmpty()) {
Akonadi::ContactSearchJob *job = new Akonadi::ContactSearchJob();
job->setQuery( Akonadi::ContactSearchJob::Email, email );
job->exec();
const KABC::Addressee::List contacts = job->contacts();
foreach ( const KABC::Addressee &contact, contacts ) {
if ( contact.hasCategory( category ) ) {
return false;
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment