[kopete-devel] [patch] port jabber protocol to QtNetwork

2008-07-08 Thread Serhiy Kachaniuk
Hi!

I have 2 problems with jabber protocol in KDE4's kopete.

1. I use tsocks command line utility to redirect kopete through socks
proxy at work. Kopete from KDE3 works ok with this, however when i try
to run KDE4's kopete, i get Operation not supported.
2. We have here at work internal jabber server based on ancient
jabberd 1.4 and again, kopete from KDE3 works ok with it, but KDE4's
kopete shows message box about error in stream and crashes.

Both issues are gone when i ported jabber protocol to QtNetwork. As i
see, oscar protocol plugin was converted to QtNetwork as well.

Please review and if ok commit, i don't have an svn account.
Index: protocols/jabber/jabberbytestream.h
===
--- protocols/jabber/jabberbytestream.h	(revision 829340)
+++ protocols/jabber/jabberbytestream.h	(working copy)
@@ -21,7 +21,7 @@
 #define JABBERBYTESTREAM_H
 
 #include bytestream.h
-#include k3bufferedsocket.h
+#include QTcpSocket
 #include kopete_export.h
 
 
@@ -38,11 +38,11 @@
 
 	virtual ~JabberByteStream ();
 
-	bool connect ( QString host, QString service );
+	void connect ( QString host, int port );
 	virtual bool isOpen () const;
 	virtual void close ();
 
-	KNetwork::KBufferedSocket *socket () const;
+	QTcpSocket *socket () const;
 
 signals:
 	void connected ();
@@ -58,7 +58,7 @@
 	void slotError ( int );
 
 private:
-	KNetwork::KBufferedSocket *mSocket;
+	QTcpSocket *mSocket;
 	bool mClosing;
 
 };
Index: protocols/jabber/jabberconnector.cpp
===
--- protocols/jabber/jabberconnector.cpp	(revision 829340)
+++ protocols/jabber/jabberconnector.cpp	(working copy)
@@ -27,7 +27,7 @@
 {
 	kDebug ( JABBER_DEBUG_GLOBAL )  New Jabber connector.;
 
-	mErrorCode = KNetwork::KSocketBase::NoError;
+	mErrorCode = 0;
 
 	mByteStream = new JabberByteStream ( this );
 
@@ -54,14 +54,9 @@
 	 * For XMPP 1.0, we need to enable this!
 	 */
 
-	mErrorCode = KNetwork::KSocketBase::NoError;
+	mErrorCode = 0;
 
-	if ( !mByteStream-connect ( mHost, QString::number ( mPort ) ) )
-	{
-		// Houston, we have a problem
-		mErrorCode = mByteStream-socket()-error ();
-		emit error ();
-	}
+	mByteStream-connect ( mHost, mPort );
 
 }
 
Index: protocols/jabber/jabberaccount.cpp
===
--- protocols/jabber/jabberaccount.cpp	(revision 829340)
+++ protocols/jabber/jabberaccount.cpp	(working copy)
@@ -38,6 +38,7 @@
 #include qstring.h
 #include qregexp.h
 #include qtimer.h
+#include QAbstractSocket
 
 #include kcomponentdata.h
 #include kconfig.h
@@ -45,7 +46,6 @@
 #include kmessagebox.h
 #include klocale.h
 #include kaboutdata.h
-#include k3socketbase.h
 #include kpassworddialog.h
 #include kinputdialog.h
 #include kicon.h
@@ -854,55 +854,28 @@
 		case XMPP::ClientStream::ErrConnection:
 			switch(connectorCode)
 			{
- case KNetwork::KSocketBase::LookupFailure:
+ case QAbstractSocket::HostNotFoundError:
 	errorClass = Kopete::Account::InvalidHost;
 	errorCondition = i18n(Host not found.);
 	break;
-case KNetwork::KSocketBase::AddressInUse:
+case QAbstractSocket::AddressInUseError:
 	errorCondition = i18n(Address is already in use.);
 	break;
-case KNetwork::KSocketBase::AlreadyCreated:
-	errorCondition = i18n(Cannot recreate the socket.);
-	break;
-case KNetwork::KSocketBase::AlreadyBound:
-	errorCondition = i18n(Cannot bind the socket again.);
-	break;
-case KNetwork::KSocketBase::AlreadyConnected:
-	errorCondition = i18n(Socket is already connected.);
-	break;
-case KNetwork::KSocketBase::NotConnected:
-	errorCondition = i18n(Socket is not connected.);
-	break;
-case KNetwork::KSocketBase::NotBound:
-	errorCondition = i18n(Socket is not bound.);
-	break;
-case KNetwork::KSocketBase::NotCreated:
-	errorCondition = i18n(Socket has not been created.);
-	break;
-case KNetwork::KSocketBase::WouldBlock:
-	errorCondition = i18n(The socket operation would block. You should not see this error: please use \Report Bug\ from the Help menu.);
-	break;
-case KNetwork::KSocketBase::ConnectionRefused:
+case QAbstractSocket::ConnectionRefusedError:
 	errorCondition = i18n(Connection refused.);
 	break;
-case KNetwork::KSocketBase::ConnectionTimedOut:
-	errorCondition = i18n(Connection timed out.);
-	break;
-case KNetwork::KSocketBase::InProgress:
+case QAbstractSocket::UnfinishedSocketOperationError:
 	errorCondition = i18n(Connection attempt already in progress.);
 	break;
-case KNetwork::KSocketBase::NetFailure:
+case QAbstractSocket::NetworkError:
 	errorCondition = i18n(Network failure.);
 	break;
-case KNetwork::KSocketBase::NotSupported:
-	errorCondition = i18n(Operation is not supported.);
-	break;
-case KNetwork::KSocketBase::Timeout:
+case 

Re: [kopete-devel] [patch] port jabber protocol to QtNetwork

2008-07-08 Thread Matt Rogers
On Tuesday 08 July 2008 06:01:53 am Serhiy Kachaniuk wrote:
 Hi!

 I have 2 problems with jabber protocol in KDE4's kopete.

 1. I use tsocks command line utility to redirect kopete through socks
 proxy at work. Kopete from KDE3 works ok with this, however when i try
 to run KDE4's kopete, i get Operation not supported.
 2. We have here at work internal jabber server based on ancient
 jabberd 1.4 and again, kopete from KDE3 works ok with it, but KDE4's
 kopete shows message box about error in stream and crashes.

 Both issues are gone when i ported jabber protocol to QtNetwork. As i
 see, oscar protocol plugin was converted to QtNetwork as well.

 Please review and if ok commit, i don't have an svn account.

looks fine. will commit soon.


signature.asc
Description: This is a digitally signed message part.
___
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel