loginjob.h
00001 /* 00002 Copyright (c) 2009 Kevin Ottens <ervin@kde.org> 00003 Copyright (c) 2009 Andras Mantia <amantia@kde.org> 00004 00005 This library is free software; you can redistribute it and/or modify it 00006 under the terms of the GNU Library General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or (at your 00008 option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, but WITHOUT 00011 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to the 00017 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00018 02110-1301, USA. 00019 */ 00020 00021 #ifndef KIMAP_LOGINJOB_H 00022 #define KIMAP_LOGINJOB_H 00023 00024 #include "kimap_export.h" 00025 00026 #include "job.h" 00027 00028 namespace KIMAP { 00029 00030 class Session; 00031 struct Message; 00032 class LoginJobPrivate; 00033 00034 class KIMAP_EXPORT LoginJob : public Job 00035 { 00036 Q_OBJECT 00037 Q_DECLARE_PRIVATE(LoginJob) 00038 00039 friend class SessionPrivate; 00040 00041 public: 00042 enum EncryptionMode { 00043 Unencrypted = 0, 00044 TlsV1, 00045 SslV2, 00046 SslV3, 00047 SslV3_1, 00048 AnySslVersion 00049 }; 00050 00051 enum AuthenticationMode { 00052 ClearText = 0, 00053 Login, 00054 Plain, 00055 CramMD5, 00056 DigestMD5, 00057 NTLM, 00058 GSSAPI, 00059 Anonymous 00060 }; 00061 00062 enum ErrorCode { 00063 ERR_COULD_NOT_CONNECT = KJob::UserDefinedError + 23 // same as in kio 00064 }; 00065 00066 explicit LoginJob( Session *session ); 00067 virtual ~LoginJob(); 00068 00069 QString userName() const; 00070 void setUserName( const QString &userName ); 00071 00072 QString password() const; 00073 void setPassword( const QString &password ); 00074 00084 QString serverGreeting() const; 00085 00092 void setEncryptionMode(EncryptionMode mode); 00093 00098 EncryptionMode encryptionMode(); 00099 00100 void setAuthenticationMode( AuthenticationMode mode ); 00101 00102 protected: 00103 virtual void doStart(); 00104 virtual void handleResponse( const Message &response ); 00105 virtual void connectionLost(); 00106 00107 private: 00108 Q_PRIVATE_SLOT( d_func(), void sslResponse(bool) ) 00109 }; 00110 00111 } 00112 00113 #endif