[Pkg-kde-commits] rev 1094 - in branches/kde-3.4.0/packages/kdenetwork/debian: . patches
Adeodato Simó
dato-guest@costa.debian.org
Sun, 22 May 2005 17:08:47 +0000
Author: dato-guest
Date: 2005-05-22 17:08:45 +0000 (Sun, 22 May 2005)
New Revision: 1094
Added:
branches/kde-3.4.0/packages/kdenetwork/debian/patches/01_kopete_fix_msn.diff
Modified:
branches/kde-3.4.0/packages/kdenetwork/debian/changelog
Log:
Prepare upload to fix the Kopete MSN breakage. Instead of a full branch
pull I'm only patching kopete/protocol/msn, since I got rejected hunks
from the full branch patch and I'm short on time.
Modified: branches/kde-3.4.0/packages/kdenetwork/debian/changelog
===================================================================
--- branches/kde-3.4.0/packages/kdenetwork/debian/changelog 2005-05-22 16:44:36 UTC (rev 1093)
+++ branches/kde-3.4.0/packages/kdenetwork/debian/changelog 2005-05-22 17:08:45 UTC (rev 1094)
@@ -1,4 +1,4 @@
-kdenetwork (4:3.4.0-0pre1) alioth; urgency=low
+kdenetwork (4:3.4.0-0pre2) alioth; urgency=low
* New upstream release.
@@ -33,7 +33,7 @@
* Provide better descriptions for applications (Closes: #287185)
- -- Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org> Fri, 4 Mar 2005 16:30:07 +0100
+ -- Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org> Sun, 22 May 2005 18:45:20 +0200
kdenetwork (4:3.3.2-4) unstable; urgency=high
Added: branches/kde-3.4.0/packages/kdenetwork/debian/patches/01_kopete_fix_msn.diff
===================================================================
--- branches/kde-3.4.0/packages/kdenetwork/debian/patches/01_kopete_fix_msn.diff 2005-05-22 16:44:36 UTC (rev 1093)
+++ branches/kde-3.4.0/packages/kdenetwork/debian/patches/01_kopete_fix_msn.diff 2005-05-22 17:08:45 UTC (rev 1094)
@@ -0,0 +1,1171 @@
+Index: msnnotifysocket.h
+===================================================================
+--- kdenetwork/kopete/protocols/msn/msnnotifysocket.h (.../tags/KDE/3.4.0/kdenetwork/kopete/protocols/msn) (revision 416970)
++++ kdenetwork/kopete/protocols/msn/msnnotifysocket.h (.../branches/KDE/3.4/kdenetwork/kopete/protocols/msn) (revision 416970)
+@@ -29,6 +29,7 @@
+ class MSNDispatchSocket;
+ class MSNAccount;
+ class KTempFile;
++class SslLoginHandler;
+
+ #include <kio/job.h>
+
+@@ -62,7 +63,7 @@
+ void createChatSession();
+
+ void sendMail(const QString &email);
+-
++
+ bool badPassword() { return m_badPassword; }
+
+ public slots:
+@@ -88,8 +89,8 @@
+ void statusChanged( const Kopete::OnlineStatus &newStatus );
+
+ void hotmailSeted(bool) ;
+-
+-
++
++
+ /**
+ * When the dispatch server sends us the notification server to use, this
+ * signal is emitted. After this the socket is automatically closed.
+@@ -109,7 +110,7 @@
+ * This reimplementation handles most of the other MSN error codes.
+ */
+ virtual void handleError( uint code, uint id );
+-
++
+ /**
+ * This reimplementation sets up the negotiating with the server and
+ * suppresses the change of the status to online until the handshake
+@@ -131,17 +132,11 @@
+ */
+ void slotSendKeepAlive();
+
+- /**
+- * Reset the keepalive time after the socket has sent a command.
+- */
+- void slotResetKeepAlive();
++ void sslLoginFailed();
++ void sslLoginIncorrect();
++ void sslLoginSucceeded(QString);
+
+
+-
+- void slotAuthJobDataReceived ( KIO::Job *, const QByteArray &data);
+- void slotAuthJobDone ( KIO::Job *);
+-
+-
+ private:
+ /**
+ * Convert the MSN status strings to a Kopete::OnlineStatus
+@@ -170,12 +165,12 @@
+ QString m_kv;
+ QString m_sid;
+ QString m_loginTime;
+- QString m_authData;
++ SslLoginHandler *m_sslLoginHandler;
+
+ QTimer *m_keepaliveTimer;
+
+ bool m_ping;
+-
++
+ bool m_badPassword;
+ };
+
+Index: msnsocket.cpp
+===================================================================
+--- kdenetwork/kopete/protocols/msn/msnsocket.cpp (.../tags/KDE/3.4.0/kdenetwork/kopete/protocols/msn) (revision 416970)
++++ kdenetwork/kopete/protocols/msn/msnsocket.cpp (.../branches/KDE/3.4/kdenetwork/kopete/protocols/msn) (revision 416970)
+@@ -133,7 +133,7 @@
+
+ void MSNSocket::slotSocketError( int error )
+ {
+- kdWarning( 14140 ) << k_funcinfo << "Error: " << error << endl;
++ kdWarning( 14140 ) << k_funcinfo << "Error: " << error << " (" << m_socket->errorString() << ")" << endl;
+
+ if(!KSocketBase::isFatalError(error))
+ return;
+@@ -467,7 +467,6 @@
+ kdDebug( 14141 ) << k_funcinfo << "Sending command: " << QString( *it ).stripWhiteSpace() << endl;
+ m_socket->writeBlock( *it, ( *it ).length() );
+ m_sendQueue.remove( it );
+- emit commandSent();
+
+ // If the queue is empty again stop waiting for readyWrite signals
+ // because of the CPU usage
+Index: msnaccount.cpp
+===================================================================
+--- kdenetwork/kopete/protocols/msn/msnaccount.cpp (.../tags/KDE/3.4.0/kdenetwork/kopete/protocols/msn) (revision 416970)
++++ kdenetwork/kopete/protocols/msn/msnaccount.cpp (.../branches/KDE/3.4/kdenetwork/kopete/protocols/msn) (revision 416970)
+@@ -940,7 +940,7 @@
+ static_cast<MSNContact *>( ct )->setReversed( true );
+ }
+ m_reverseList.append( handle );
+- configGroup()->writeEntry( "reversekList" , m_reverseList ) ;
++ configGroup()->writeEntry( "reverseList" , m_reverseList ) ;
+ }
+ }
+
+Index: kopete_msn.desktop
+===================================================================
+--- kdenetwork/kopete/protocols/msn/kopete_msn.desktop (.../tags/KDE/3.4.0/kdenetwork/kopete/protocols/msn) (revision 416970)
++++ kdenetwork/kopete/protocols/msn/kopete_msn.desktop (.../branches/KDE/3.4/kdenetwork/kopete/protocols/msn) (revision 416970)
+@@ -29,7 +29,6 @@
+ Name[tg]=MSN Пайёмбар
+ Name[uk]=Кур'єр MSN
+ Name[uz]=MSN месенжер
+-Name[xx]=xxMSN Messengerxx
+ Comment=Protocol to connect to MSN Messenger
+ Comment[ar]=البرتوكول سيتصل بمرسال MSN
+ Comment[bg]=Протокол за връзка с MSN Messenger
+@@ -73,6 +72,5 @@
+ Comment[uk]=Протокол для з'єднання з MSN Messenger
+ Comment[uz]=MSN месенжер билан алоқа ўрнатиш учун протокол
+ Comment[wa]=Protocole po s' raloyî a MSN
+-Comment[xx]=xxProtocol to connect to MSN Messengerxx
+ Comment[zh_CN]=连接到 MSN Messenger 协议
+
+Index: sslloginhandler.h
+===================================================================
+--- kdenetwork/kopete/protocols/msn/sslloginhandler.h (.../tags/KDE/3.4.0/kdenetwork/kopete/protocols/msn) (revision 0)
++++ kdenetwork/kopete/protocols/msn/sslloginhandler.h (.../branches/KDE/3.4/kdenetwork/kopete/protocols/msn) (revision 416970)
+@@ -0,0 +1,96 @@
++//Imported from KMess - 2005-05-19
++
++/***************************************************************************
++ sslloginhandler.h - description
++ -------------------
++ begin : Sat Jun 28 2003
++ copyright : (C) 2003 by Mike K. Bennett
++ email : mkb137b@hotmail.com
++ ***************************************************************************/
++
++/***************************************************************************
++ * *
++ * 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. *
++ * *
++ ***************************************************************************/
++
++#ifndef SSLLOGINHANDLER_H
++#define SSLLOGINHANDLER_H
++
++#include <qobject.h>
++#include <qstringlist.h>
++
++// Forward declarations
++class KExtendedSocket;
++class KSSL;
++class MimeMessage;
++
++/**This class handles the SSL portion of the login.
++ *@author Mike K. Bennett
++ */
++
++class SslLoginHandler : public QObject
++{
++ Q_OBJECT
++
++ public:
++ // The constructor
++ SslLoginHandler();
++ // The destructor
++ ~SslLoginHandler();
++ // Start the login process
++ void login( QString parameters, QString handle, QString password );
++
++ private : // Private methods
++ // Get the authentication data from a string
++ void parseAuthenticationData( QString data );
++ // Parse the HTTP response from the server
++ void parseHttpResponse(QString data);
++ // Get login server data from a string
++ void parseLoginServerData( QString &host, QString &page, QString serverData );
++ // Read data from the socket via SSL
++ QString readSslData();
++ // Send the authenticationn request
++ void sendAuthenticationRequest( QString loginServer, QString page );
++ // Send a HTTP request to the server
++ void sendHttpRequest( QString request, QString host, int port );
++ // Request the name of the login server
++ void sendLoginServerRequest(QString hostname);
++ // Write data to the socket via SSL
++ void writeSslData( QString data );
++
++ private slots : // Private slots
++ // Data was received over the socket
++ void dataReceived();
++ // Detect a socket error
++ void socketError(int error);
++
++ private : // Private attributes
++ // The mode of the transfer.
++ enum Mode { NONE = 0, GETLOGINSERVER = 1, GETAUTHENTICATIONDATA = 2 } mode_;
++ // The list of parameters sent by the notification server
++ QString authenticationParameters_;
++ // The cookies we received from the server
++ QStringList cookies_;
++ // The user's handle
++ QString handle_;
++ // The user's password
++ QString password_;
++ // The socket over which the SSL data is written and read
++ KExtendedSocket *socket_;
++ // The SSL handler
++ KSSL *ssl_;
++
++ signals : // Public signals
++ // Signal that the login was aborted because an internal error occured
++ void loginFailed();
++ // Signal that the login failed, username/password was incorrect
++ void loginIncorrect();
++ // Signal that the login succeeded
++ void loginSucceeded( QString authentication );
++};
++
++#endif
+Index: msnnotifysocket.cpp
+===================================================================
+--- kdenetwork/kopete/protocols/msn/msnnotifysocket.cpp (.../tags/KDE/3.4.0/kdenetwork/kopete/protocols/msn) (revision 416970)
++++ kdenetwork/kopete/protocols/msn/msnnotifysocket.cpp (.../branches/KDE/3.4/kdenetwork/kopete/protocols/msn) (revision 416970)
+@@ -23,6 +23,7 @@
+ #include "msnnotifysocket.h"
+ #include "msncontact.h"
+ #include "msnaccount.h"
++#include "sslloginhandler.h"
+
+ #include <qregexp.h>
+
+@@ -48,7 +49,8 @@
+ : MSNSocket( account )
+ {
+ m_newstatus = MSNProtocol::protocol()->NLN;
+-
++ m_sslLoginHandler=0l;
++
+ m_isHotmailAccount=false;
+ m_ping=false;
+
+@@ -59,12 +61,11 @@
+
+ m_keepaliveTimer = new QTimer( this, "m_keepaliveTimer" );
+ QObject::connect( m_keepaliveTimer, SIGNAL( timeout() ), SLOT( slotSendKeepAlive() ) );
+-
+- QObject::connect( this, SIGNAL( commandSent() ), SLOT( slotResetKeepAlive() ) );
+ }
+
+ MSNNotifySocket::~MSNNotifySocket()
+ {
++ delete m_sslLoginHandler;
+ kdDebug(14140) << k_funcinfo << endl;
+ }
+
+@@ -203,11 +204,13 @@
+ }
+ case 715:
+ {
++ /*
+ //if(handlev==m_account->accountId())
+ QString msg = i18n( "Your email address has not been verified with the MSN server.\n"
+ "You should have received a mail with a link to confirm your email address.\n"
+ "Some functions will be restricted if you do not confirm your email address." );
+ KMessageBox::queuedMessageBox( Kopete::UI::Global::mainWidget(), KMessageBox::Sorry, msg, i18n( "MSN Plugin" ) );//TODO don't show again
++ */
+ break;
+ }
+ case 800:
+@@ -245,10 +248,10 @@
+ {
+ //kdDebug(14140) << "MSNNotifySocket::parseCommand: Command: " << cmd << endl;
+
+-
++
+ if ( cmd == "VER" )
+ {
+- sendCommand( "CVR", "0x0409 winnt 5.1 i386 MSNMSGR 6.0.0602 MSMSGS " + m_account->accountId() );
++ sendCommand( "CVR", "0x0409 winnt 5.1 i386 MSNMSGR 6.2.0205 MSMSGS " + m_account->accountId() );
+ /*
+ struct utsname utsBuf;
+ uname ( &utsBuf );
+@@ -266,26 +269,15 @@
+ {
+ if( data.section( ' ', 1, 1 ) == "S" )
+ {
+- m_authData=data.section( ' ' , 2 , 2 );
+- m_kv=QString::null;
++ m_sslLoginHandler = new SslLoginHandler();
++ QObject::connect( m_sslLoginHandler, SIGNAL( loginFailed() ),
++ this, SLOT ( sslLoginFailed() ) );
++ QObject::connect( m_sslLoginHandler, SIGNAL( loginIncorrect() ),
++ this, SLOT ( sslLoginIncorrect() ) );
++ QObject::connect( m_sslLoginHandler, SIGNAL( loginSucceeded(QString) ),
++ this, SLOT ( sslLoginSucceeded(QString) ) );
+
+- if( m_account->accountId().contains("@hotmail.") )
+- m_sid="loginnet.passport.com";
+- else if( m_account->accountId().contains("@msn.") || m_account->accountId().contains("@compaq.net") || m_account->accountId().contains("@webtv.net") )
+- m_sid="msnialogin.passport.com";
+- else
+- m_sid="login.passport.com";
+-
+- QString authURL="https://"+m_sid+"/login.srf?" + m_authData;
+- authURL.replace("," , "&" ) ;
+-
+- kdDebug(14140) << k_funcinfo << "downlaod URL: " << authURL << endl;
+-
+- KIO::Job *job = KIO::get( KURL( authURL ), true, false );
+- job->addMetaData("cookies", "manual");
+- // This should force kio to download the page even is we are in the konqueror offline mode. [see bug #68483]
+- job->addMetaData("cache", "reload");
+- QObject::connect( job, SIGNAL(result( KIO::Job *)), this, SLOT(slotAuthJobDone( KIO::Job *)) );
++ m_sslLoginHandler->login( data.section( ' ' , 2 , 2 ), m_account->accountId() , m_password );
+ }
+ else
+ {
+@@ -301,6 +293,9 @@
+ // do some nice things with it :-)
+ QString publicName = unescape( data.section( ' ', 2, 2 ) );
+ emit publicNameChanged( publicName );
++
++ // We are connected start to ping
++ slotSendKeepAlive();
+ }
+ }
+ else if( cmd == "LST" )
+@@ -355,9 +350,9 @@
+ }
+ else if( cmd == "XFR" )
+ {
+- QString stype=data.section( ' ', 0, 0 );
++ QString stype=data.section( ' ', 0, 0 );
+ if( stype=="SB" ) //switchboard connection (chat)
+- {
++ {
+ // Address, AuthInfo
+ emit startChat( data.section( ' ', 1, 1 ), data.section( ' ', 3, 3 ) );
+ }
+@@ -370,7 +365,7 @@
+ emit receivedNotificationServer( server, port );
+ disconnect();
+ }
+-
++
+ }
+ else if( cmd == "RNG" )
+ {
+@@ -526,6 +521,10 @@
+ {
+ //this is a reply from a ping
+ m_ping=false;
++
++ // id is the timeout in fact, and we remove 5% of it
++ m_keepaliveTimer->start( id * 950, true );
++ kdDebug( 14140 ) << k_funcinfo << "timerTimeout=" << id << "sec"<< endl;
+ }
+ else if( cmd == "URL" )
+ {
+@@ -582,77 +581,21 @@
+ }
+
+
+-void MSNNotifySocket::slotAuthJobDataReceived ( KIO::Job */*job*/,const QByteArray &data)
++void MSNNotifySocket::sslLoginFailed()
+ {
+- m_authData += QCString( data, data.size()+1 );
+-// kdDebug(14140) << "MSNNotifySocket::slotAuthJobDataReceived: " << data << endl;
++ disconnect();
+ }
+-
+-void MSNNotifySocket::slotAuthJobDone ( KIO::Job *job)
++void MSNNotifySocket::sslLoginIncorrect()
+ {
+-// kdDebug(14140) << "MSNNotifySocket::slotAuthJobDone: "<< m_authData << endl;
+-
+- if(job->error())
+- {
+- //FIXME: Shouldn't we say that we are the MSN plugin?
+- job->showErrorDialog();
+- disconnect();
+- return;
+- }
+-
+- if(m_kv.isNull())
+- {
+- QStringList cookielist=QStringList::split("\n", job->queryMetaData("setcookies") );
+- QString cookies="Cookie: ";
+- for ( QStringList::Iterator it = cookielist.begin(); it != cookielist.end(); ++it )
+- {
+- QRegExp rx("Set-Cookie: ([^;]*)");
+- rx.search(*it);
+- cookies+=rx.cap(1)+";";
+- }
+-
+- //QRegExp rx("lc=([1-9]*),id=([1-9]*),tw=([1-9]*),fs=[1-9]*,ru=[1-9a-zA-Z%]*,ct=[1-9]*,kpp=[1-9]*,kv=([1-9]*),");
+- QRegExp rx("lc=([0-9]*),id=([0-9]*),tw=([0-9]*),.*kv=([0-9]*),");
+- rx.search(m_authData);
+-
+- QString authURL = "https://" + m_sid + "/ppsecure/post.srf?lc=" + rx.cap( 1 ) + "&id=" +
+- rx.cap( 2 ) + "&tw=" + rx.cap( 3 ) + "&cbid=" + rx.cap( 2 ) + "&da=passport.com&login=" +
+- KURL::encode_string( m_account->accountId()) + "&domain=passport.com&passwd=";
+-
+- kdDebug( 14140 ) << k_funcinfo << "Download URL: " << authURL << "(*******)" << endl;
+-
+- m_authData = QString::null;
+- m_kv=rx.cap(4);
+- if(m_kv.isNull()) m_kv="";
+-
+- authURL += KURL::encode_string( m_password ) ;
+- job = KIO::get( KURL( authURL ), false, false );
+- job->addMetaData("cookies", "manual");
+- job->addMetaData("setcookies", cookies);
+- job->addMetaData("cache", "reload");
+-
+- QObject::connect( job, SIGNAL(data( KIO::Job *,const QByteArray&)), this, SLOT(slotAuthJobDataReceived( KIO::Job *,const QByteArray&)) );
+- QObject::connect( job, SIGNAL(result( KIO::Job *)), this, SLOT(slotAuthJobDone( KIO::Job *)) );
+- }
+- else
+- {
+- if(m_authData.contains("CookiesDisabled"))
+- {
+- // FIXME: is this still possible now we add our meta data? - Martijn
+- disconnect();
+- KMessageBox::queuedMessageBox( Kopete::UI::Global::mainWidget(), KMessageBox::Error,
+- i18n( "Unable to connect to the MSN Network.\nYour Web browser options are currently set to disable cookies.\n"
+- "To use .NET Passport, you must enable cookies at least for the passport.com domain" ), i18n( "MSN Plugin" ) );
+- return;
+- }
+-
+- QRegExp rx(/*URL=http://memberservices.passport.net/memberservice.srf*/"\\?did=[0-9]*&(t=[0-9A-Za-z!$*]*&p=[0-9A-Za-z!$*]*)\"");
+- rx.search(m_authData);
+-
+- m_badPassword=true; //if this disconnect, that mean the password was bad
+- sendCommand("USR" , "TWN S " + rx.cap(1));
+- }
++ m_badPassword = true;
++ disconnect();
+ }
++void MSNNotifySocket::sslLoginSucceeded(QString a)
++{
++ sendCommand("USR" , "TWN S " + a);
++ m_sslLoginHandler->deleteLater();
++ m_sslLoginHandler=0;
++}
+
+
+ void MSNNotifySocket::slotOpenInbox()
+@@ -895,13 +838,6 @@
+ m_tmpHandles.clear();
+ }
+
+-void MSNNotifySocket::slotResetKeepAlive()
+-{
+- // Fire the timer every 90 seconds. QTimer will reset a running timer
+- // on a subsequent call if there has been activity again.
+- m_keepaliveTimer->start( 90000 );
+-}
+-
+ Kopete::OnlineStatus MSNNotifySocket::convertOnlineStatus( const QString &status )
+ {
+ if( status == "NLN" )
+Index: msnswitchboardsocket.cpp
+===================================================================
+--- kdenetwork/kopete/protocols/msn/msnswitchboardsocket.cpp (.../tags/KDE/3.4.0/kdenetwork/kopete/protocols/msn) (revision 416970)
++++ kdenetwork/kopete/protocols/msn/msnswitchboardsocket.cpp (.../branches/KDE/3.4/kdenetwork/kopete/protocols/msn) (revision 416970)
+@@ -250,12 +250,12 @@
+ QString fontInfo;
+ QString color;
+
+- rx=QRegExp("X-MMS-IM-Format: ([A-Za-z0-9$!*/;\\-]*)");
++ rx=QRegExp("X-MMS-IM-Format: ([^\r\n]*)");
+ rx.search(msg);
+ fontInfo =rx.cap(1);
+
+ color = parseFontAttr(fontInfo, "CO");
+-
++
+ // FIXME: this is so BAAAAAAAAAAAAD :(
+ if (!color.isEmpty() && color.toInt(0,16)!=0)
+ {
+@@ -429,6 +429,14 @@
+ if( !isTyping )
+ return;
+
++ if ( onlineStatus() != Connected || m_chatMembers.empty())
++ {
++ //we are not yet in a chat.
++ //if we send that command now, we may get disconnected.
++ return;
++ }
++
++
+ QCString message = QString( "MIME-Version: 1.0\r\n"
+ "Content-Type: text/x-msmsgscontrol\r\n"
+ "TypingUser: " + m_myHandle + "\r\n"
+@@ -484,7 +492,9 @@
+
+ if(msg.font() != QFont() )
+ {
+- head += "FN=" + escape( msg.font().family());
++ //It's verry strange that if the font name is bigger than 31 char, the _server_ close the socket and don't deliver the message.
++ // the real question is why ? my guess is that MS patched the server because a bug in their client, but that's just a guess.
++ head += "FN=" + escape( msg.font().family().left(31));
+ head += "; EF=";
+ if(msg.font().bold())
+ head += "B";
+@@ -496,8 +506,10 @@
+ head += "U";
+ head += "; ";
+ }
++ else head+="FN=; EF=; ";
+ /**
+ * I don't know what to set by default, so i decided to set nothing. CF Bug 82734
++ * (but don't forgeto to add an empty FN= and EF= , or webmessenger will break. (CF Bug 102371) )
+ else head+="FN=MS%20Serif; EF=; ";
+ */
+
+Index: msnp2pincoming.cpp
+===================================================================
+--- kdenetwork/kopete/protocols/msn/msnp2pincoming.cpp (.../tags/KDE/3.4.0/kdenetwork/kopete/protocols/msn) (revision 416970)
++++ kdenetwork/kopete/protocols/msn/msnp2pincoming.cpp (.../branches/KDE/3.4/kdenetwork/kopete/protocols/msn) (revision 416970)
+@@ -114,7 +114,6 @@
+ {
+ if(! m_kopeteTransfer )
+ {
+- error();
+ return;
+ }
+ //Parse the message to get some info for replying
+@@ -150,6 +149,10 @@
+ {
+ abortCurrentTransfer();
+ }
++ else if(dataMessage.contains("200 OK"))
++ {
++ //ignore
++ }
+ else
+ { //this seems to be _probably_ (just a guess) a utf-16 message. we will download it completely.
+ /*
+Index: msnsocket.h
+===================================================================
+--- kdenetwork/kopete/protocols/msn/msnsocket.h (.../tags/KDE/3.4.0/kdenetwork/kopete/protocols/msn) (revision 416970)
++++ kdenetwork/kopete/protocols/msn/msnsocket.h (.../branches/KDE/3.4/kdenetwork/kopete/protocols/msn) (revision 416970)
+@@ -124,12 +124,6 @@
+ */
+ void socketClosed();
+
+- /**
+- * The socket just sent a command from the queue. This signal is used in
+- * the notify socket to reset the keepalive timer.
+- */
+- void commandSent();
+-
+ protected:
+ /**
+ * Convenience method: escape spaces with '%20' for use in the protocol.
+Index: msnp2p.cpp
+===================================================================
+--- kdenetwork/kopete/protocols/msn/msnp2p.cpp (.../tags/KDE/3.4.0/kdenetwork/kopete/protocols/msn) (revision 416970)
++++ kdenetwork/kopete/protocols/msn/msnp2p.cpp (.../branches/KDE/3.4/kdenetwork/kopete/protocols/msn) (revision 416970)
+@@ -185,6 +185,12 @@
+ binHeader[24]=(char)size%256;
+ binHeader[25]=(int)size/256;
+
++ if(m_footer=='\1' && size>4)
++ { //when sending the data of an image, the flag is set to 0x20
++ // size>4 is because the data preparation message has not this flag.
++ binHeader[28]=0x20;
++ }
++
+ //Ack sessionID
+ binHeader[32]=(char)(rand()%256);
+ binHeader[33]=(char)(rand()%256);
+Index: config/kopete_msn_config.desktop
+===================================================================
+--- kdenetwork/kopete/protocols/msn/config/kopete_msn_config.desktop (.../tags/KDE/3.4.0/kdenetwork/kopete/protocols/msn) (revision 416970)
++++ kdenetwork/kopete/protocols/msn/config/kopete_msn_config.desktop (.../branches/KDE/3.4/kdenetwork/kopete/protocols/msn) (revision 416970)
+@@ -48,7 +48,7 @@
+ Name[sk]=Modul MSN
+ Name[sl]=Vstavek za MSN
+ Name[sr]=MSN прикључак
+-Name[sr@Latn]=MSN dodatak
++Name[sr@Latn]=MSN priključak
+ Name[sv]=MSN-insticksprogram
+ Name[ta]=MSN செருகல்
+ Name[tg]=Модули MSN
+@@ -56,7 +56,6 @@
+ Name[uk]=Втулок MSN
+ Name[uz]=MSN плагини
+ Name[wa]=Tchôke-divins MSN
+-Name[xx]=xxMSN Pluginxx
+ Name[zh_CN]=MSN 插件
+ Comment=Microsoft Network Protocol
+ Comment[ar]=بروتوكول شبكة Microsoft
+@@ -96,6 +95,5 @@
+ Comment[uk]=Мережний протокол Microsoft
+ Comment[uz]=Microsoft тармоғи билан алоқа ўрнатиш учун протокол
+ Comment[wa]=Protocole pol rantoele da Microsoft
+-Comment[xx]=xxMicrosoft Network Protocolxx
+ Comment[zh_CN]=Microsoft Network 协议
+
+Index: Makefile.am
+===================================================================
+--- kdenetwork/kopete/protocols/msn/Makefile.am (.../tags/KDE/3.4.0/kdenetwork/kopete/protocols/msn) (revision 416970)
++++ kdenetwork/kopete/protocols/msn/Makefile.am (.../branches/KDE/3.4/kdenetwork/kopete/protocols/msn) (revision 416970)
+@@ -1,3 +1,4 @@
++KDE_OPTIONS = nofinal
+ METASOURCES = AUTO
+ SUBDIRS = ui . icons config
+ AM_CPPFLAGS = -I$(srcdir)/ui \
+@@ -13,7 +14,8 @@
+ libkopete_msn_shared_la_SOURCES = msnprotocol.cpp msnaccount.cpp msnaddcontactpage.cpp msncontact.cpp \
+ msnsocket.cpp msnmessagemanager.cpp msndebugrawcmddlg.cpp \
+ msnnotifysocket.cpp msnswitchboardsocket.cpp msnfiletransfersocket.cpp msninvitation.cpp \
+- msnp2p.cpp msnp2pdisplatcher.cpp msnp2pincoming.cpp msnp2poutgoing.cpp sha1.cpp
++ msnp2p.cpp msnp2pdisplatcher.cpp msnp2pincoming.cpp msnp2poutgoing.cpp sha1.cpp \
++ sslloginhandler.cpp
+
+ libkopete_msn_shared_la_LIBADD = ./ui/libkopetemsnui.la ../../libkopete/libkopete.la $(LIB_KIO)
+ libkopete_msn_shared_la_LDFLAGS = -version-info 0:0:0 -no-undefined $(all_libraries)
+Index: sslloginhandler.cpp
+===================================================================
+--- kdenetwork/kopete/protocols/msn/sslloginhandler.cpp (.../tags/KDE/3.4.0/kdenetwork/kopete/protocols/msn) (revision 0)
++++ kdenetwork/kopete/protocols/msn/sslloginhandler.cpp (.../branches/KDE/3.4/kdenetwork/kopete/protocols/msn) (revision 416970)
+@@ -0,0 +1,453 @@
++//Imported from KMess (2005-05-19)
++
++/***************************************************************************
++ sslloginhandler.cpp - description
++ -------------------
++ begin : Sat Jun 28 2003
++ copyright : (C) 2003 by Mike K. Bennett
++ email : mkb137b@hotmail.com
++ ***************************************************************************/
++
++/***************************************************************************
++ * *
++ * 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 "sslloginhandler.h"
++
++#include <qstringlist.h>
++#include <qregexp.h>
++#include <qsocket.h>
++#include <qurl.h>
++
++#include <kdebug.h>
++#include <kextsock.h>
++#include <kssl.h>
++#include <kurl.h>
++
++#if 0
++#include "../kmessdebug.h"
++#include "mimemessage.h"
++#else
++//i didn't want to import the whole MimeMessage from Kmess for Kopete so i
++// reimplemented the base here -Olivier
++
++class MimeMessage
++{
++ public:
++ MimeMessage(const QString &msg) : message(msg) {}
++
++ QString getValue(const QString &key)
++ {
++ QRegExp rx(key+": (.*)\n");
++ rx.search(message);
++ return rx.cap(1);
++ }
++ private:
++ QString message;
++};
++
++#include "sslloginhandler.moc"
++#endif
++//there is nothing modified from here. this is exactly the kmerlin code
++
++
++
++/*
++ * Great documentation about this can be found at
++ * http://siebe.bot2k3.net/docs/
++ */
++
++
++// The constructor
++SslLoginHandler::SslLoginHandler()
++ : mode_(NONE)
++{
++ // Create the SSL handler
++ ssl_ = new KSSL( true );
++
++ // Create and set up the socket.
++ socket_ = new KExtendedSocket( );
++
++ //socket_->setSocketFlags( 0x00 | 0x600000 ); // 0x00 = anySocket | 0x600000 = bufferedSocket
++ socket_->setSocketFlags( 0x00 ); // 0x00 = anySocket | 0x600000 = bufferedSocket
++ socket_->setTimeout( 30 );
++ socket_->enableRead( true );
++ connect( socket_, SIGNAL( readyRead() ),
++ this, SLOT ( dataReceived() ) );
++ connect( socket_, SIGNAL( connectionFailed(int) ),
++ this, SLOT ( socketError(int) ) );
++}
++
++
++
++// The destructor
++SslLoginHandler::~SslLoginHandler()
++{
++ delete ssl_;
++ delete socket_;
++}
++
++
++
++// Data was received over the socket
++void SslLoginHandler::dataReceived()
++{
++#ifdef KMESSDEBUG_SSLLOGINHANDLER
++ kdDebug() << "SslLoginHandler - ******************** Data received ********************" << endl;
++ kdDebug() << "SslLoginHandler - " << socket_->bytesAvailable() << " bytes available." << endl;
++ kdDebug() << "SslLoginHandler - SSL says " << ssl_->pending() << " bytes available." << endl;
++#endif
++
++ QString data;
++ int breakOut = 0;
++ const int maxIterations = 1000;
++ while ( ( !data.contains( QRegExp("\r\n") ) ) && ( breakOut < maxIterations ) )
++ {
++ // Read data via SSL
++ data = readSslData();
++ breakOut ++;
++ }
++
++ // Output the data for debugging
++#ifdef KMESSDEBUG_SSLLOGINHANDLER
++ kdDebug() << "SslLoginHandler - ******************** Contents ********************" << endl;
++ kdDebug() << data << endl;
++ kdDebug() << "SslLoginHandler - ******************** End of data ********************" << endl;
++#endif
++
++ // Warn if timed out
++ if ( breakOut >= maxIterations )
++ {
++ kdDebug() << "WARNING - SSL read timed out." << endl;
++ emit loginFailed();
++ return;
++ }
++
++ if ( data.length() > 0 )
++ {
++ parseHttpResponse(data);
++ }
++ else
++ {
++ kdDebug() << "WARNING - Available data wasn't read from the SSL socket." << endl;
++ emit loginFailed();
++ }
++}
++
++
++
++// Start the login process
++void SslLoginHandler::login( QString parameters, QString handle, QString password )
++{
++#ifdef KMESSDEBUG_SSLLOGINHANDLER
++ kdDebug() << "SslLoginHandler - Starting login with parameters " << parameters << "." << endl;
++#endif
++
++ // Store the given data
++ authenticationParameters_ = parameters;
++ handle_ = handle;
++ password_ = password;
++
++ // Get the login server
++ sendLoginServerRequest("nexus.passport.com");
++ dataReceived();
++}
++
++
++
++// Get the authentication data from a string
++void SslLoginHandler::parseAuthenticationData( QString data )
++{
++ QString twnData;
++
++ // Pull TWN data out of the message
++ twnData = data.right( data.length() - data.find(QRegExp("from-PP='")) - 9 );
++ twnData = twnData.left( twnData.find(QRegExp("',")) );
++
++#ifdef KMESSDEBUG_SSLLOGINHANDLER
++ kdDebug() << "SslLoginHandler - data for TWN is " << twnData << "." << endl;
++#endif
++
++ // Notify the MsnNotificationConnection
++ emit loginSucceeded(twnData);
++}
++
++
++
++// Parse the HTTP response from the server
++void SslLoginHandler::parseHttpResponse(QString data)
++{
++ KURL location;
++ int headerEnd;
++ QString header;
++ int headerCode;
++ QString headerText;
++
++ // Parse the HTTP status header
++ QRegExp re("HTTP/\\d+\\.\\d+ (\\d+) ([^\r\n]+)");
++ headerEnd = data.find("\r\n");
++ header = data.left( (headerEnd == -1) ? 20 : headerEnd );
++
++ re.search(header);
++ headerCode = re.cap(1).toUInt();
++ headerText = re.cap(2);
++
++ // Create a MimeMessage, removing the HTTP status header
++ MimeMessage message( data.section( ",", 1 ) );
++
++
++ switch(mode_)
++ {
++ case GETLOGINSERVER:
++ {
++ // Step 1. This data describes the login server to use.
++ if(headerCode == 302)
++ {
++ // HTTP Redirect
++ location = KURL( message.getValue( "Location" ) );
++ sendLoginServerRequest(location.host());
++ }
++ else
++ {
++ // Parse the data
++ QString loginServer;
++ QString page;
++ parseLoginServerData( loginServer, page, message.getValue("PassportURLs") );
++
++ // Send the authentication request
++ sendAuthenticationRequest( loginServer, page );
++ }
++ break;
++ }
++ case GETAUTHENTICATIONDATA:
++ {
++ // Step 2. Get the authentication data
++ if(headerCode == 200)
++ {
++ // Login success
++ parseAuthenticationData(message.getValue("Authentication-Info"));
++ }
++ else if(headerCode == 302)
++ {
++ // HTTP Redirect
++ location = KURL( message.getValue( "Location" ) );
++ sendAuthenticationRequest(location.host(), location.path());
++ }
++ else if(headerCode == 401)
++ {
++ // Got a HTTP "401 Unauthorized"; Login failed
++ emit loginIncorrect();
++ }
++ else
++ {
++ kdDebug() << "SslLoginHandler::parseHttpResponse: WARNING "
++ << "- Unhandled response code " << headerCode << " " << headerText << endl;
++ emit loginFailed();
++ }
++ break;
++ }
++ default:
++ {
++ kdDebug() << "SslLoginHandler::parseHttpResponse: WARNING - Entered illegal state" << endl;
++ emit loginFailed();
++ }
++ }
++}
++
++
++// Get login server data from a string
++void SslLoginHandler::parseLoginServerData( QString &host, QString &page, QString serverData )
++{
++ int slashIndex;
++
++ // Get everything between "DLLogin=" and to the comma.
++ serverData = serverData.right( serverData.length() - serverData.find( "DALogin=" ) - 8 );
++ serverData = serverData.left( serverData.find( "," ) );
++
++#ifdef KMESSDEBUG_SSLLOGINHANDLER
++ kdDebug() << "SslLoginHandler - host/page=" << serverData << endl;
++#endif
++
++ // Separate the "host/page" string.
++ slashIndex = serverData.find( "/" );
++ host = serverData.left( slashIndex );
++ page = serverData.right( serverData.length() - slashIndex );
++
++#ifdef KMESSDEBUG_SSLLOGINHANDLER
++ kdDebug() << "SslLoginHandler - host=" << host << " page=" << page << endl;
++#endif
++}
++
++
++
++// Read data from the socket via SSL
++QString SslLoginHandler::readSslData()
++{
++ char rawblock[1024];
++ QCString block;
++ QString data = "";
++ int noBytesRead = 1;
++
++ // Read data from the SSL socket.
++ if ( ssl_ != 0 )
++ {
++// while( ( ssl_->pending() > 0 ) && ( noBytesRead > 0 ) )
++// while( ( socket_->bytesAvailable() > 0 ) && ( noBytesRead > 0 ) )
++ while(noBytesRead > 0)
++ {
++ noBytesRead = ssl_->read( rawblock, 1024 );
++#ifdef KMESSDEBUG_SSLLOGINHANDLER
++ kdDebug() << "SslLoginHandler - " << noBytesRead << " bytes read." << endl;
++#endif
++ block = rawblock;
++ block = block.left( noBytesRead );
++ data += QString::fromUtf8( block );
++ }
++ }
++
++ return data;
++}
++
++
++
++// Send the authenticationn request
++void SslLoginHandler::sendAuthenticationRequest( QString loginServer, QString page )
++{
++#ifdef KMESSDEBUG_SSLLOGINHANDLER
++ kdDebug() << "SslLoginHandler - Step 2. Requesting authentication data." << endl;
++#endif
++
++ QString request;
++ QString encodedHandle = handle_;
++ QString encodedPassword = password_;
++
++ QUrl::encode(encodedHandle);
++ QUrl::encode(encodedPassword);
++
++ request = "GET " + page + " HTTP/1.1\r\n"
++ "Authorization: Passport1.4"
++ " OrgVerb=GET"
++ ",OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom"
++ ",sign-in=" + encodedHandle +
++ ",pwd=" + encodedPassword +
++ "," + authenticationParameters_ + "\r\n"
++ "User-Agent: MSMSGS\r\n" // Make sure the server won't discriminate
++ "Host: " + loginServer + "\r\n"
++ "Connection: Keep-Alive\r\n"
++ "Cache-Control: no-cache\r\n\r\n";
++
++ // Step 2. Send the authorisation request
++ mode_ = GETAUTHENTICATIONDATA;
++ sendHttpRequest( request, loginServer, 443 );
++}
++
++
++
++// Send a HTTP request to the server
++void SslLoginHandler::sendHttpRequest( QString request, QString host, int port )
++{
++ QString response;
++ QString responseBody;
++
++ if ( socket_ == 0 )
++ {
++ kdDebug() << "SslLoginHandler::sendHttpRequest - WARNING "
++ << "- Trying to login using a null socket." << endl;
++ return;
++ }
++
++ // Configure the socket
++#ifdef KMESSDEBUG_SSLLOGINHANDLER
++ kdDebug() << "SslLoginHandler - Close and reset the socket." << endl;
++#endif
++ ssl_->setAutoReconfig( true );
++ ssl_->reInitialize();
++ socket_->closeNow();
++ socket_->reset();
++
++ // Try to connect
++#ifdef KMESSDEBUG_SSLLOGINHANDLER
++ kdDebug() << "SslLoginHandler - Connecting to " << host << ":" << port << "." << endl;
++#endif
++ socket_->setAddress( host, port );
++ socket_->lookup();
++ int connectionSuccess = socket_->connect();
++ if ( connectionSuccess != 0 )
++ {
++ kdDebug() << "SslLoginHandler::sendHttpRequest - WARNING "
++ << "- Connection failed, giving " << connectionSuccess << endl;
++ return;
++ }
++
++ // Try to wrap the SSL handler
++#ifdef KMESSDEBUG_SSLLOGINHANDLER
++ kdDebug() << "SslLoginHandler - Connection success, binding SSL to socket fd " << socket_->fd() << endl;
++#endif
++ int sslConnectionSuccess = ssl_->connect( socket_->fd() );
++ if ( sslConnectionSuccess != 1 )
++ {
++ kdDebug() << "SslLoginHandler::sendHttpRequest - WARNING "
++ << "- SSL Connection failed, giving " << sslConnectionSuccess << endl;
++ return;
++ }
++
++ // Send the request
++#ifdef KMESSDEBUG_SSLLOGINHANDLER
++ kdDebug() << "SslLoginHandler - SSL connected OK, sending the request." << endl;
++ kdDebug() << request;
++#endif
++ writeSslData( request );
++}
++
++
++
++// Request the name of the login server
++void SslLoginHandler::sendLoginServerRequest(QString hostname)
++{
++#ifdef KMESSDEBUG_SSLLOGINHANDLER
++ kdDebug() << "SslLoginHandler - Step 1. Requesting the login server." << endl;
++#endif
++
++ // Step 1. Send the login server request
++ // The server will respond with the location of the main SSL server.
++ mode_ = GETLOGINSERVER;
++ sendHttpRequest( "GET /rdr/pprdr.asp\r\n\r\n", hostname, 443 );
++}
++
++
++
++// Detect a socket error
++void SslLoginHandler::socketError(int error)
++{
++ kdDebug() << "SslLoginHandler : WARNING - Received error " << error << " from the socket." << endl;
++}
++
++
++
++// Write data to the socket via SSL
++void SslLoginHandler::writeSslData( QString data )
++{
++ int noBytesWritten;
++
++ if(socket_ != 0 && ssl_ != 0)
++ {
++ noBytesWritten = ssl_->write( data.latin1(), data.length() );
++ if(noBytesWritten != (int)data.length())
++ {
++ kdDebug() << "WARNING - Wanted to write " << data.length() << " to the socket, "
++ << " wrote " << noBytesWritten << "." << endl;
++ }
++#ifdef KMESSDEBUG_SSLLOGINHANDLER
++ else
++ {
++ kdDebug() << "SslLoginHandler - Sent " << noBytesWritten << " bytes via SSL." << endl;
++ }
++#endif
++ }
++}
++
+Index: ui/msneditaccountwidget.cpp
+===================================================================
+--- kdenetwork/kopete/protocols/msn/ui/msneditaccountwidget.cpp (.../tags/KDE/3.4.0/kdenetwork/kopete/protocols/msn) (revision 416970)
++++ kdenetwork/kopete/protocols/msn/ui/msneditaccountwidget.cpp (.../branches/KDE/3.4/kdenetwork/kopete/protocols/msn) (revision 416970)
+@@ -128,19 +128,20 @@
+ d->ui->m_displayPicture->setPixmap( locateLocal( "appdata", "msnpicture-" +
+ account->accountId().lower().replace( QRegExp("[./~]" ), "-" ) + ".png" ) );
+
+- connect( d->ui->m_allowButton, SIGNAL( pressed() ), this, SLOT( slotAllow() ) );
+- connect( d->ui->m_blockButton, SIGNAL( pressed() ), this, SLOT( slotBlock() ) );
+- connect( d->ui->m_selectImage, SIGNAL( pressed() ), this, SLOT( slotSelectImage() ) );
+- connect( d->ui->m_RLButton, SIGNAL( pressed() ), this, SLOT( slotShowReverseList() ) );
+- QObject::connect( d->ui->buttonRegister, SIGNAL(clicked()), this, SLOT(slotOpenRegister()));
+-
+ d->ui->m_useDisplayPicture->setChecked( config->readBoolEntry( "exportCustomPicture" ));
+ }
+ else
+ {
+ d->ui->tab_contacts->setDisabled( true );
+- d->ui->tab_info->setDisabled( true );
++ d->ui->m_displayName->setDisabled( true );
++ d->ui->m_phones->setDisabled( true );
+ }
++
++ connect( d->ui->m_allowButton, SIGNAL( pressed() ), this, SLOT( slotAllow() ) );
++ connect( d->ui->m_blockButton, SIGNAL( pressed() ), this, SLOT( slotBlock() ) );
++ connect( d->ui->m_selectImage, SIGNAL( pressed() ), this, SLOT( slotSelectImage() ) );
++ connect( d->ui->m_RLButton, SIGNAL( pressed() ), this, SLOT( slotShowReverseList() ) );
++ connect( d->ui->buttonRegister, SIGNAL(clicked()), this, SLOT(slotOpenRegister()));
+ }
+
+ MSNEditAccountWidget::~MSNEditAccountWidget()
+@@ -279,8 +280,18 @@
+ QString futurName = locateLocal( "appdata", "msnpicture-" + account()->accountId().lower().replace( QRegExp( "[./~]" ), "-" ) + ".png" );
+
+ QImage img( path );
+- img = img.smoothScale( 96, 96 );
+- if ( !img.isNull() && img.save( futurName, "PNG" ) )
++
++ if(!img.isNull()) {
++ img = img.smoothScale( 96, 96, QImage::ScaleMax );
++ // crop image if not square
++ if(img.width() > img.height()) {
++ img = img.copy((img.width()-img.height())/2, 0, img.height(), img.height());
++ }
++ else if(img.height() > img.width()) {
++ img = img.copy(0, (img.height()-img.width())/2, img.width(), img.width());
++ }
++
++ if ( img.save( futurName, "PNG" ) )
+ {
+ d->ui->m_displayPicture->setPixmap( futurName );
+ }
+@@ -289,6 +300,12 @@
+ KMessageBox::sorry( this, i18n( "<qt>An error occurred when trying to change the display picture.<br>"
+ "Make sure that you have selected a correct image file</qt>" ), i18n( "MSN Plugin" ) );
+ }
++ }
++ else
++ {
++ KMessageBox::sorry( this, i18n( "<qt>An error occurred when trying to change the display picture.<br>"
++ "Make sure that you have selected a correct image file</qt>" ), i18n( "MSN Plugin" ) );
++ }
+ if( remoteFile ) KIO::NetAccess::removeTempFile( path );
+ }
+
+Index: msnmessagemanager.cpp
+===================================================================
+--- kdenetwork/kopete/protocols/msn/msnmessagemanager.cpp (.../tags/KDE/3.4.0/kdenetwork/kopete/protocols/msn) (revision 416970)
++++ kdenetwork/kopete/protocols/msn/msnmessagemanager.cpp (.../branches/KDE/3.4/kdenetwork/kopete/protocols/msn) (revision 416970)
+@@ -267,7 +267,7 @@
+ config->setGroup( "MSN" );
+ if ( config->readBoolEntry( "SendAwayMessages", false ) &&
+ ( !m_awayMessageTime.isValid() ||
+- m_awayMessageTime.elapsed() > 1000 * config->readNumEntry( "AwayMessagesSeconds", 90 ) ) )
++ m_awayMessageTime.elapsed() > 1000 * config->readNumEntry( "AwayMessageSeconds", 90 ) ) )
+ {
+ // Don't translate "Auto-Message:" This string is caught by MSN Plus! (and also by kopete now)
+ Kopete::Message msg2( myself(), members(),