kio Library API Documentation

kpasswdserver.h

00001 /*
00002     This file is part of the KDE Cookie Jar
00003 
00004     Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU General Public License
00008     version 2 as published by the Free Software Foundation.
00009 
00010     This software is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this library; see the file COPYING. If not, write to
00017     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018     Boston, MA 02111-1307, USA.
00019 */
00020 //----------------------------------------------------------------------------
00021 //
00022 // KDE Password Server
00023 // $Id: kpasswdserver.h,v 1.4.2.1 2003/03/05 12:38:58 waba Exp $
00024 
00025 #ifndef KPASSWDSERVER_H
00026 #define KPASSWDSERVER_H
00027 
00028 #include <qdict.h>
00029 #include <qintdict.h>
00030 
00031 #include <dcopclient.h>
00032 #include <kio/authinfo.h>
00033 #include <kded/kdedmodule.h>
00034 
00035 class KPasswdServer : public KDEDModule
00036 {
00037   Q_OBJECT
00038   K_DCOP
00039 public:
00040   KPasswdServer(const QCString &);
00041   ~KPasswdServer();
00042 
00043 k_dcop:
00044   KIO::AuthInfo checkAuthInfo(KIO::AuthInfo, long);
00045   KIO::AuthInfo queryAuthInfo(KIO::AuthInfo, QString, long, long);
00046   void addAuthInfo(KIO::AuthInfo, long);
00047 
00048 public slots:
00049   void processRequest();
00050   // Remove all authentication info associated with windowId
00051   void removeAuthForWindowId(long windowId);
00052 
00053 protected:
00054   struct AuthInfo;
00055 
00056   QString createCacheKey( const KIO::AuthInfo &info );
00057   const AuthInfo *findAuthInfoItem(const QString &key, const KIO::AuthInfo &info);
00058   void removeAuthInfoItem(const QString &key, const KIO::AuthInfo &info);
00059   void addAuthInfoItem(const QString &key, const KIO::AuthInfo &info, long windowId, long seqNr, bool canceled);
00060   KIO::AuthInfo copyAuthInfo(const AuthInfo *);
00061   void updateAuthExpire(const QString &key, const AuthInfo *, long windowId, bool keep);
00062   
00063   struct AuthInfo {
00064     AuthInfo() { expire = expNever; isCanceled = false; seqNr = 0; }
00065   
00066     KURL url;
00067     QString directory;
00068     QString username;
00069     QString password;
00070     QString realmValue;
00071     QString digestInfo;
00072     
00073     enum { expNever, expWindowClose, expTime } expire;
00074     QValueList<long> windowList;
00075     unsigned long expireTime;
00076     long seqNr;
00077     
00078     bool isCanceled;
00079   };
00080 
00081   class AuthInfoList : public QPtrList<AuthInfo>
00082   {
00083     public: 
00084       AuthInfoList() { setAutoDelete(true); }
00085       int compareItems(QPtrCollection::Item n1, QPtrCollection::Item n2);
00086   };
00087   
00088   QDict< AuthInfoList > m_authDict;
00089 
00090   struct Request {
00091      DCOPClient *client;
00092      DCOPClientTransaction *transaction;
00093      QString key;
00094      KIO::AuthInfo info;
00095      QString errorMsg;
00096      long windowId;
00097      long seqNr;
00098      bool prompt;
00099   };
00100 
00101   QPtrList< Request > m_authPending;
00102   QPtrList< Request > m_authWait;
00103   QIntDict<QStringList> mWindowIdList;
00104   DCOPClient *m_dcopClient;
00105   long m_seqNr;
00106 };
00107 
00108 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:13:56 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001