Diffstat (limited to 'kabc/plugins/ldap/resourceldap.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kabc/plugins/ldap/resourceldap.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/kabc/plugins/ldap/resourceldap.cpp b/kabc/plugins/ldap/resourceldap.cpp index 55c43af..c3097de 100644 --- a/kabc/plugins/ldap/resourceldap.cpp +++ b/kabc/plugins/ldap/resourceldap.cpp | |||
@@ -35,48 +35,55 @@ $Id$ | |||
35 | #include <stdlib.h> | 35 | #include <stdlib.h> |
36 | 36 | ||
37 | #include "resourceldap.h" | 37 | #include "resourceldap.h" |
38 | #include "resourceldapconfig.h" | 38 | #include "resourceldapconfig.h" |
39 | 39 | ||
40 | using namespace KABC; | 40 | using namespace KABC; |
41 | 41 | ||
42 | extern "C" | 42 | extern "C" |
43 | { | 43 | { |
44 | //US void *init_kabc_ldap() | 44 | //US void *init_kabc_ldap() |
45 | void *init_microkabc_ldap() | 45 | void *init_microkabc_ldap() |
46 | { | 46 | { |
47 | return new KRES::PluginFactory<ResourceLDAP,ResourceLDAPConfig>(); | 47 | return new KRES::PluginFactory<ResourceLDAP,ResourceLDAPConfig>(); |
48 | } | 48 | } |
49 | } | 49 | } |
50 | 50 | ||
51 | void addModOp( LDAPMod ***pmods, const QString &attr, const QString &value ); | 51 | void addModOp( LDAPMod ***pmods, const QString &attr, const QString &value ); |
52 | 52 | ||
53 | 53 | ||
54 | ResourceLDAP::ResourceLDAP( const KConfig *config ) | 54 | ResourceLDAP::ResourceLDAP( const KConfig *config ) |
55 | : Resource( config ), mPort( 389 ), mLdap( 0 ) | 55 | : Resource( config ), mPort( 389 ), mLdap( 0 ) |
56 | { | 56 | { |
57 | KConfig *cfg = (KConfig *)config; | 57 | KConfig *cfg = (KConfig *)config; |
58 | if ( cfg ) { | 58 | if ( cfg ) { |
59 | #ifdef _WIN32_ | ||
60 | // we use plugins on win32. the group is stored in a static variable | ||
61 | // such that group info not available on win32 plugins | ||
62 | // to fix that, it would be a looooot of work | ||
63 | if ( !cfg->tempGroup().isEmpty() ) | ||
64 | cfg->setGroup( cfg->tempGroup() ); | ||
65 | #endif | ||
59 | mUser = cfg->readEntry( "LdapUser" ); | 66 | mUser = cfg->readEntry( "LdapUser" ); |
60 | mPassword = KStringHandler::obscure( cfg->readEntry( "LdapPassword" ) ); | 67 | mPassword = KStringHandler::obscure( cfg->readEntry( "LdapPassword" ) ); |
61 | mDn = cfg->readEntry( "LdapDn" ); | 68 | mDn = cfg->readEntry( "LdapDn" ); |
62 | mHost = cfg->readEntry( "LdapHost" ); | 69 | mHost = cfg->readEntry( "LdapHost" ); |
63 | mPort = cfg->readNumEntry( "LdapPort", 389 ); | 70 | mPort = cfg->readNumEntry( "LdapPort", 389 ); |
64 | mFilter = cfg->readEntry( "LdapFilter" ); | 71 | mFilter = cfg->readEntry( "LdapFilter" ); |
65 | mAnonymous = cfg->readBoolEntry( "LdapAnonymous" ); | 72 | mAnonymous = cfg->readBoolEntry( "LdapAnonymous" ); |
66 | 73 | ||
67 | QStringList attributes = cfg->readListEntry( "LdapAttributes" ); | 74 | QStringList attributes = cfg->readListEntry( "LdapAttributes" ); |
68 | for ( uint pos = 0; pos < attributes.count(); pos += 2 ) | 75 | for ( uint pos = 0; pos < attributes.count(); pos += 2 ) |
69 | mAttributes.insert( attributes[ pos ], attributes[ pos + 1 ] ); | 76 | mAttributes.insert( attributes[ pos ], attributes[ pos + 1 ] ); |
70 | } | 77 | } |
71 | 78 | ||
72 | /** | 79 | /** |
73 | If you want to add new attributes, append them here, add a | 80 | If you want to add new attributes, append them here, add a |
74 | translation string in the ctor of AttributesDialog and | 81 | translation string in the ctor of AttributesDialog and |
75 | handle them in the load() method below. | 82 | handle them in the load() method below. |
76 | These are the default values from | 83 | These are the default values from |
77 | */ | 84 | */ |
78 | if ( mAttributes.count() == 0 ) { | 85 | if ( mAttributes.count() == 0 ) { |
79 | mAttributes.insert( "commonName", "cn" ); | 86 | mAttributes.insert( "commonName", "cn" ); |
80 | mAttributes.insert( "formattedName", "displayName" ); | 87 | mAttributes.insert( "formattedName", "displayName" ); |
81 | mAttributes.insert( "familyName", "sn" ); | 88 | mAttributes.insert( "familyName", "sn" ); |
82 | mAttributes.insert( "givenName", "givenName" ); | 89 | mAttributes.insert( "givenName", "givenName" ); |