[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-pim
Subject: [Kde-pim] KDE-PIM - LdapSearch & groupOfNames
From: Szombathelyi "György" <gyurco () freemail ! hu>
Date: 2004-07-22 19:24:31
Message-ID: 200407222124.31396.gyurco () freemail ! hu
[Download RAW message or body]
Hello!
Maybe I'm too naive, but ldapclient.cpp already contains detection for
groupOfNames, so I put the mail address retrivation from the DN to the
right(?) place. There is no need for the objectClass hack. May I commit?
Bye,
György
____________________________________________________________________
Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol.
Probald ki most! http://www.freestart.hu
["libkdepim.diff" (text/x-diff)]
Index: libkdepim/ldapclient.cpp
===================================================================
RCS file: /home/kde/kdepim/libkdepim/ldapclient.cpp,v
retrieving revision 1.13
diff -u -p -u -r1.13 ldapclient.cpp
--- libkdepim/ldapclient.cpp 22 Jul 2004 19:02:38 -0000 1.13
+++ libkdepim/ldapclient.cpp 22 Jul 2004 19:17:19 -0000
@@ -68,7 +68,6 @@ QString LdapObject::toString() const
void LdapObject::clear()
{
dn = QString::null;
- objectClass = QString::null;
attrs.clear();
}
@@ -82,7 +81,7 @@ void LdapObject::assign( const LdapObjec
}
LdapClient::LdapClient( int clientNumber, QObject* parent, const char* name )
- : QObject( parent, name ), mJob( 0 ), mActive( false ), mReportObjectClass( false )
+ : QObject( parent, name ), mJob( 0 ), mActive( false )
{
d = new LdapClientPrivate;
d->clientNumber = clientNumber;
@@ -123,13 +122,6 @@ void LdapClient::setPwdBindDN( const QSt
void LdapClient::setAttrs( const QStringList& attrs )
{
mAttrs = attrs;
- for ( QStringList::Iterator it = mAttrs.begin(); it != mAttrs.end(); ++it )
- if( (*it).lower() == "objectclass" ){
- mReportObjectClass = true;
- return;
- }
- mAttrs << "objectClass"; // via objectClass we detect distribution lists
- mReportObjectClass = false;
}
void LdapClient::startQuery( const QString& filter )
@@ -216,29 +208,6 @@ void LdapClient::endParseLDIF()
void LdapClient::finishCurrentObject()
{
mCurrentObject.dn = d->ldif.dn();
- if( mCurrentObject.objectClass.lower() == "groupofnames" ){
- LdapAttrMap::ConstIterator it = mCurrentObject.attrs.find("mail");
- if( it == mCurrentObject.attrs.end() ){
- // No explicit mail address found so far?
- // Fine, then we use the address stored in the DN.
- QString sMail;
- QStringList lMail = QStringList::split(",dc=", mCurrentObject.dn);
- const int n = lMail.count();
- if( n ){
- if( lMail.first().lower().startsWith("cn=") ){
- sMail = lMail.first().simplifyWhiteSpace().mid(3);
- if( 1 < n )
- sMail.append('@');
- for( int i=1; i<n; ++i){
- sMail.append( lMail[i] );
- if( i < n-1 )
- sMail.append('.');
- }
- mCurrentObject.attrs["mail"].append( sMail.utf8() );
- }
- }
- }
- }
mCurrentObject.client = this;
emit result( mCurrentObject );
mCurrentObject.clear();
@@ -263,11 +232,7 @@ void LdapClient::parseLDIF( const QByteA
{
name = d->ldif.attr();
value = d->ldif.val();
- bool bFoundOC = name.lower() == "objectclass";
- if( bFoundOC )
- mCurrentObject.objectClass = QString::fromUtf8( value, value.size() );
- if( mReportObjectClass || !bFoundOC )
- mCurrentObject.attrs[ name ].append( value );
+ mCurrentObject.attrs[ name ].append( value );
//kdDebug(5300) << "LdapClient::parseLDIF()" << name << " / " << value << endl;
}
break;
@@ -521,6 +486,22 @@ void LdapSearch::makeSearchData( QString
if( isDistributionList ) {
kdDebug(5300) << "\n\nLdapSearch::makeSearchData() found a list: " << name << "\n\n" << endl;
ret.append( name );
+
+ QStringList lMail = QStringList::split(",dc=", (*it1).dn);
+ const int n = lMail.count();
+ if( n ){
+ if( lMail.first().lower().startsWith("cn=") ){
+ mail = lMail.first().simplifyWhiteSpace().mid(3);
+ if( 1 < n )
+ mail.append('@');
+ for( int i=1; i<n; ++i){
+ mail.append( lMail[i] );
+ if( i < n-1 )
+ mail.append('.');
+ }
+ }
+ }
+
// following lines commented out for bugfixing kolab issue #177:
//
// Unlike we thought previously we may NOT append the server name here.
Index: libkdepim/ldapclient.h
===================================================================
RCS file: /home/kde/kdepim/libkdepim/ldapclient.h,v
retrieving revision 1.5
diff -u -p -u -r1.5 ldapclient.h
--- libkdepim/ldapclient.h 22 Jul 2004 17:29:04 -0000 1.5
+++ libkdepim/ldapclient.h 22 Jul 2004 19:17:19 -0000
@@ -65,7 +65,6 @@ class LdapObject
void clear();
QString dn;
- QString objectClass;
LdapAttrMap attrs;
LdapClient* client;
@@ -185,7 +184,6 @@ class LdapClient : public QObject
QGuardedPtr<KIO::SimpleJob> mJob;
bool mActive;
- bool mReportObjectClass;
LdapObject mCurrentObject;
QCString mBuf;
_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic