summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/irc/libkirc/ksslsocket.h
blob: 79e3b70bd963318a6e87acf05305b3147196f669 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

#ifndef _K_SSL_SOCKET_H_
#define _K_SSL_SOCKET_H_

/*
    ksslsocket.h - KDE SSL Socket

    Copyright (c) 2005      by Tommi Rantala <[email protected]>
    Copyright (c) 2004      by Jason Keirstead <[email protected]>

    Kopete    (c) 2002-2005 by the Kopete developers <[email protected]>

    *************************************************************************
    *                                                                       *
    * This program is free software; you can redistribute it and/or modify  *
    * it under the terms of the GNU General Public License as published by  *
    * the Free Software Foundation; either version 2 of the License, or     *
    * (at your option) any later version.                                   *
    *                                                                       *
    *************************************************************************
*/

#include <tqvariant.h>
#include <kextsock.h>
#include <kio/slavebase.h>

class KSSLSocketPrivate;

class KSSLSocket : public KExtendedSocket
{
	Q_OBJECT

	public:
		KSSLSocket();
		~KSSLSocket();

		Q_LONG readBlock( char* data, Q_ULONG maxLen );
		Q_LONG writeBlock( const char* data, Q_ULONG len );
		int peekBlock( char *data, uint maxLen );
		int bytesAvailable() const;

		void showInfoDialog();

	signals:
		void sslFailure();
		void certificateAccepted();
		void certificateRejected();

	private slots:
		void slotConnected();
		void slotDisconnected();
		void slotReadData();

	private:
		int verifyCertificate();
		int messageBox( KIO::SlaveBase::MessageBoxType type, const TQString &text,
			const TQString &caption,	const TQString &buttonYes, const TQString &buttonNo );


		//Copied frm tcpslavebase to simply integrating their dialog function
		void setMetaData( const TQString &, const TQVariant & );
		bool hasMetaData( const TQString & );
		TQString metaData( const TQString & );

		KSSLSocketPrivate *d;
};

#endif