Optimisation for KIMProxy usage in KMail: don't hit kabc for the sender's uid unless the KIMProxy actually knows of any IM contacts that are in the addressbook.

svn path=/trunk/kdepim/; revision=312917
wilder-work
Will Stephenson 22 years ago
parent 35e5cab32f
commit 78ce67e349
  1. 8
      headerstyle.cpp

@ -376,7 +376,12 @@ namespace KMail {
QString userHTML;
QString presence;
if ( strategy->showHeader( "status" ) || strategy->showHeader( "statuspic" ) )
// IM presence and kabc photo
// Check first that KIMProxy has any IM presence data, to save hitting KABC
// unless really necessary
::KIMProxy *imProxy = KMKernel::self()->imProxy();
if ( ( strategy->showHeader( "status" ) || strategy->showHeader( "statuspic" ) )
&& ( imProxy->imAddresseeUids().count() > 0 ) )
{
KABC::AddressBook *addressBook = KABC::StdAddressBook::self();
KABC::AddresseeList addresses = addressBook->findByEmail( KPIM::getEmailAddr( message->from() ) );
@ -421,7 +426,6 @@ namespace KMail {
}
}
// im status
::KIMProxy *imProxy = KMKernel::self()->imProxy();
presence = imProxy->presenceString( addresses[0].uid() );
if ( !userHTML.isEmpty() )
{

Loading…
Cancel
Save