From 78ce67e3490f0eefe0bc7bc7337977cac460e29c Mon Sep 17 00:00:00 2001 From: Will Stephenson Date: Thu, 20 May 2004 14:05:34 +0000 Subject: [PATCH] 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 --- headerstyle.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/headerstyle.cpp b/headerstyle.cpp index 2b675b27f..86ea64a53 100644 --- a/headerstyle.cpp +++ b/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() ) {