22 #ifndef KPIM_LDAPCLIENT_H
23 #define KPIM_LDAPCLIENT_H
28 #include <tqcstring.h>
29 #include <tqstringlist.h>
30 #include <tqmemarray.h>
31 #include <tqguardedptr.h>
34 #include <tdeio/job.h>
35 #include <tdeabc/ldif.h>
36 #include <tdeconfig.h>
38 #include <tdemacros.h>
43 typedef TQValueList<TQByteArray> LdapAttrValue;
44 typedef TQMap<TQString,LdapAttrValue > LdapAttrMap;
55 mAuth( LdapServer::Anonymous )
58 enum Security{ Sec_None, TLS, SSL };
59 enum Auth{ Anonymous, Simple, SASL };
60 TQString host()
const {
return mHost; }
61 int port()
const {
return mPort; }
62 const TQString &baseDN()
const {
return mBaseDN; }
63 const TQString &user()
const {
return mUser; }
64 const TQString &bindDN()
const {
return mBindDN; }
65 const TQString &pwdBindDN()
const {
return mPwdBindDN; }
66 int timeLimit()
const {
return mTimeLimit; }
67 int sizeLimit()
const {
return mSizeLimit; }
68 int version()
const {
return mVersion; }
69 int security()
const {
return mSecurity; }
70 int auth()
const {
return mAuth; }
71 const TQString &mech()
const {
return mMech; }
73 void setHost(
const TQString &host ) { mHost = host; }
74 void setPort(
int port ) { mPort = port; }
75 void setBaseDN(
const TQString &baseDN ) { mBaseDN = baseDN; }
76 void setUser(
const TQString &user ) { mUser = user; }
77 void setBindDN(
const TQString &bindDN ) { mBindDN = bindDN; }
78 void setPwdBindDN(
const TQString &pwdBindDN ) { mPwdBindDN = pwdBindDN; }
79 void setTimeLimit(
int timelimit ) { mTimeLimit = timelimit; }
80 void setSizeLimit(
int sizelimit ) { mSizeLimit = sizelimit; }
81 void setVersion(
int version ) { mVersion = version; }
82 void setSecurity(
int security ) { mSecurity = security; }
83 void setAuth(
int auth ) { mAuth = auth; }
84 void setMech(
const TQString &mech ) { mMech = mech; }
94 int mTimeLimit, mSizeLimit, mVersion, mSecurity, mAuth;
109 : dn( TQString() ), client( 0 ) {}
119 TQString toString()
const;
124 TQString objectClass;
148 LdapClient(
int clientNumber, TQObject* parent = 0,
const char* name = 0 );
154 int clientNumber()
const;
155 int completionWeight()
const;
156 void setCompletionWeight(
int );
158 const LdapServer& server() {
return mServer; }
159 void setServer(
const LdapServer &server ) { mServer = server; }
164 TQStringList
attrs()
const {
return mAttrs; }
183 void setAttrs(
const TQStringList& attrs );
185 void setScope(
const TQString scope ) { mScope = scope; }
190 void startQuery(
const TQString& filter );
198 void slotData( TDEIO::Job*,
const TQByteArray &data );
199 void slotInfoMessage( TDEIO::Job*,
const TQString &info );
203 void startParseLDIF();
204 void parseLDIF(
const TQByteArray& data );
206 void finishCurrentObject();
212 TQGuardedPtr<TDEIO::SimpleJob> mJob;
214 bool mReportObjectClass;
221 int mCompletionWeight;
236 typedef TQValueList<LdapResult> LdapResultList;
254 static TDEConfig *config();
255 static void readConfig( LdapServer &server, TDEConfig *config,
int num,
bool active );
256 static void writeConfig(
const LdapServer &server, TDEConfig *config,
int j,
bool active );
258 void startSearch(
const TQString& txt );
260 bool isAvailable()
const;
261 void updateCompletionWeights();
263 TQValueList< LdapClient* > clients()
const {
return mClients; }
276 void slotLDAPError(
const TQString& );
278 void slotDataTimer();
279 void slotFileChanged(
const TQString& );
282 void readWeighForClient(
LdapClient *client, TDEConfig *config,
int clientNumber );
285 void makeSearchData( TQStringList& ret, LdapResultList& resList );
286 TQValueList< LdapClient* > mClients;
287 TQString mSearchText;
291 TQValueList< LdapObject > mResults;
292 TQString mConfigFile;
295 static TDEConfig *s_config;
296 class LdapSearchPrivate* d;
void result(const KPIM::LdapObject &)
TQStringList attrs() const
void error(const TQString &)
void searchData(const TQStringList &)
Results, assembled as "Full Name <email>" (This signal can be emitted many times)
void searchData(const KPIM::LdapResultList &)
Another form for the results, with separate fields (This signal can be emitted many times)
TDEPIM classes for drag and drop of mails.
Structure describing one result returned by a LDAP query.
int completionWeight
for sorting in a completion list
int clientNumber
for sorting in a ldap-only lookup