KIMAP Library
session_p.h
00001 /* 00002 Copyright (c) 2009 Kevin Ottens <ervin@kde.org> 00003 00004 This library is free software; you can redistribute it and/or modify it 00005 under the terms of the GNU Library General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or (at your 00007 option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, but WITHOUT 00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00012 License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to the 00016 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 02110-1301, USA. 00018 */ 00019 00020 #ifndef KIMAP_SESSION_P_H 00021 #define KIMAP_SESSION_P_H 00022 00023 #include "session.h" 00024 #include "sessionuiproxy.h" 00025 00026 #include <ktcpsocket.h> 00027 00028 #include <QtCore/QObject> 00029 #include <QtCore/QQueue> 00030 #include <QtCore/QString> 00031 #include <QtCore/QTimer> 00032 00033 class KJob; 00034 00035 namespace KIMAP { 00036 00037 class Job; 00038 struct Message; 00039 class SessionLogger; 00040 class SessionThread; 00041 00042 class KIMAP_EXPORT SessionPrivate : public QObject 00043 { 00044 Q_OBJECT 00045 00046 friend class Session; 00047 00048 public: 00049 SessionPrivate( Session *session ); 00050 virtual ~SessionPrivate(); 00051 00052 void addJob(Job *job); 00053 QByteArray sendCommand( const QByteArray &command, const QByteArray &args = QByteArray() ); 00054 void startSsl(const KTcpSocket::SslVersion &version); 00055 void sendData( const QByteArray &data ); 00056 00057 void handleSslError( const KSslErrorUiData &errorData ); 00058 00059 KTcpSocket::SslVersion negotiatedEncryption() const; 00060 00061 void setSocketTimeout( int ms ); 00062 int socketTimeout() const; 00063 00064 Q_SIGNALS: 00065 void encryptionNegotiationResult(bool); 00066 00067 private Q_SLOTS: 00068 void onEncryptionNegotiationResult(bool isEncrypted, KTcpSocket::SslVersion sslVersion); 00069 void onSocketTimeout(); 00070 00071 private: 00072 void startNext(); 00073 void doStartNext(); 00074 void jobDone( KJob *job ); 00075 void jobDestroyed( QObject *job ); 00076 void responseReceived( const KIMAP::Message &response ); 00077 00078 void socketConnected(); 00079 void socketDisconnected(); 00080 void socketError(); 00081 00082 void startSocketTimer(); 00083 void stopSocketTimer(); 00084 void restartSocketTimer(); 00085 00086 Session *const q; 00087 00088 bool isSocketConnected; 00089 Session::State state; 00090 00091 SessionLogger *logger; 00092 SessionThread *thread; 00093 SessionUiProxy::Ptr uiProxy; 00094 00095 bool jobRunning; 00096 Job *currentJob; 00097 QQueue<Job*> queue; 00098 00099 QByteArray authTag; 00100 QByteArray selectTag; 00101 QByteArray closeTag; 00102 00103 QByteArray greeting; 00104 QByteArray currentMailBox; 00105 QByteArray upcomingMailBox; 00106 quint16 tagCount; 00107 00108 KTcpSocket::SslVersion sslVersion; 00109 00110 int socketTimerInterval; 00111 QTimer socketTimer; 00112 }; 00113 00114 } 00115 00116 #endif