Bug 135972 - [PATCH] LDAP updates done externally are not reflected in kontact until restart or re-selecting resource
Summary: [PATCH] LDAP updates done externally are not reflected in kontact until resta...
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-19 17:16 UTC by BJ Blanchard
Modified: 2015-04-12 10:06 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description BJ Blanchard 2006-10-19 17:16:47 UTC
Version:            (using KDE KDE 3.5.5)
Installed from:    Gentoo Packages
OS:                Linux

When you have an LDAP resource defined (without offline caching), and there is a change on the LDAP server (ie. via phpldapadmin or some other client) - it doesn't get picked up within Kontact.

You either need to quit kontact and restart it (unacceptable in corporate environment), or un-check and re-check the resource (again - not acceptable).

I think under 3.5.3, Kontact would pick up the changes.. 3.5.4 and 3.5.5 do not however.

There is some type of caching happening, even though offline caching is completely disabled.

BJ.
Comment 1 BJ Blanchard 2006-10-24 17:24:02 UTC
The following patch forces a re-load of any active LDAP resources everytime there is a check for new mail.  It may not be the most elegant of solutions but it works!

BJ.

--- accountmanager.cpp  2006-10-23 10:57:50.000000000 -0400
+++ /usr/portage/distfiles/kdepim-3.5.5/kmail/accountmanager.cpp        2006-10-24 11:11:22.000000000 -0400
@@ -26,6 +26,18 @@
 #include <qregexp.h>
 #include <qvaluelist.h>

+// Include files for LDAP re-load
+#include <qptrlist.h>
+#include <kresources/resource.h>
+
+#include <kabc/addressbook.h>
+#include <kabc/stdaddressbook.h>
+#include <kabc/resource.h>
+#include "ldapclient.h"
+
+#include "kabc/resourceldapkio.h"
+//
+
 using namespace KMail;

 //-----------------------------------------------------------------------------
@@ -312,6 +324,25 @@
     if ( !(*it)->checkExclude() )
       singleCheckMail( (*it), _interactive);
   }
+
+  KABC::AddressBook* myAB = KABC::StdAddressBook::self(false);
+
+  QPtrList<KABC::Resource> kabcResources = myAB->resources();
+  QPtrListIterator<KABC::Resource> kabcResourceIterator( kabcResources );
+
+  KABC::Resource* i;
+
+  while( (i = kabcResourceIterator.current() ) != 0)
+  {
+       ++kabcResourceIterator;
+       KRES::Resource* res = static_cast<KRES::Resource*>( i );
+       if(res && res->type() == "ldapkio") {
+         if (res->isActive()) {
+           i->load();
+         }
+       }
+  }
+
 }
Comment 2 Laurent Montel 2015-04-12 10:06:03 UTC
Thank you for taking the time to file a bug report.

KMail2 was released in 2011, and the entire code base went through significant changes. We are currently in the process of porting to Qt5 and KF5. It is unlikely that these bugs are still valid in KMail2.

We welcome you to try out KMail 2 with the KDE 4.14 release and give your feedback.