Import release 2.0rc1

This commit is contained in:
Mario Fetka
2009-07-17 15:44:01 +00:00
parent 919dbe2a0f
commit 9d0ee5010b
187 changed files with 41747 additions and 39906 deletions
+66 -21
View File
@@ -28,7 +28,6 @@
#include "soap/addressbookservice.h"
#include "soap/passportloginservice.h"
#include "soap/offlineimservice.h"
#include "soap/roamingservice.h"
#include "utils/kmessconfig.h"
#include "chatmessage.h"
#include "mimemessage.h"
@@ -77,6 +76,7 @@ MsnNotificationConnection::MsnNotificationConnection()
enableNotifications_(false),
initialized_(false),
isInitiatingConnection_(false),
lastStatus_(-1),
offlineImService_(0),
passportLoginService_(0)
{
@@ -384,14 +384,7 @@ void MsnNotificationConnection::changePersonalProperties( const QString& friendl
changeFriendlyName( friendlyname );
// Check if necessary to retrieve information ( like pm, picture ) from msn storage
// using roaming service
// TODO complete the support
Q_UNUSED( cid );
/*
RoamingService *roamingService = new RoamingService( this );
roamingService->getProfile( cid );
*/
}
@@ -518,12 +511,7 @@ void MsnNotificationConnection::changeStatus( const Status newStatus )
#else
// NOTE: When changing this property, all MSNP2P code need to be retested again!!
// The capabilities are like a contract. The other client assumes everything works that's promised here.
#if ENABLE_WEBCAM
// FIXME: only show webcam capability if the user has a webcam.
const uint capabilities = ( Contact::MSN_CAP_MSN75 | Contact::MSN_CAP_WINKS | Contact::MSN_CAP_MULTI_PACKET | Contact::MSN_CAP_INK_GIF | Contact::MSN_CAP_VIDEO_CHAT );
#else
const uint capabilities = ( Contact::MSN_CAP_MSN75 | Contact::MSN_CAP_WINKS | Contact::MSN_CAP_MULTI_PACKET | Contact::MSN_CAP_INK_GIF );
#endif
#endif
const QString& statusCode( MsnStatus::getCode( newStatus ) );
@@ -602,7 +590,7 @@ void MsnNotificationConnection::closeConnection()
offlineImService_ = 0;
passportLoginService_ = 0;
isInitiatingConnection_ = false;
lastStatus_ = -1;
// Remove contacts and non-special groups from the contact list
if ( contactList_ != 0 )
@@ -793,6 +781,9 @@ QByteArray MsnNotificationConnection::createTripleDes ( const QByteArray key, co
if ( ! QCA::isSupported( "tripledes-cbc" ) )
{
kWarning() << "Triple DES encryption not supported, please install qca2 packages";
#warning "Translate this after string freeze!!"
slotError(I18N_NOOP("Triple DES encryption is not supported. This means you probably do not have "
"installed qca2 or qca2-openssl. Please install it and retry"), MsnSocketBase::ERROR_AUTH_COMPUTATION);
return "";
}
@@ -863,11 +854,23 @@ void MsnNotificationConnection::goOnline()
// Load the contact list settings
readProperties();
// Get the initial status to use: if we were previously disconnected by an error or network
// issue, use the last status instead
int initialStatus = currentAccount_->getInitialStatus();
if( lastStatus_ != -1 && lastStatus_ != STATUS_OFFLINE )
{
#ifdef KMESSDEBUG_NOTIFICATION_GENERAL
kDebug() << "Last status was set:" << MsnStatus::getCode( (Status)lastStatus_ );
#endif
initialStatus = lastStatus_;
lastStatus_ = -1;
}
// Change to the initial status
#ifdef KMESSDEBUG_NOTIFICATION_GENERAL
kDebug() << "Changing initial status to" << MsnStatus::getCode( currentAccount_->getInitialStatus() );
kDebug() << "Changing initial status to" << MsnStatus::getCode( (Status)initialStatus );
#endif
changeStatus( currentAccount_->getInitialStatus() );
changeStatus( (Status)initialStatus );
// Reset status fields.
lastCurrentMedia_ = QString::null;
@@ -1121,13 +1124,25 @@ void MsnNotificationConnection::gotOut( const QStringList& command )
// If the first command parameter is "OTH", it means that this account has connected from elsewhere.
if( command[1] == "OTH" )
{
#ifdef KMESSDEBUG_NOTIFICATION_GENERAL
kDebug() << "Got notice that this account has connected from elsewhere.";
#endif
// No need to reconnect with the last status if we were kicked out
lastStatus_ = -1;
slotError( "Connected from another location",
MsnSocketBase::ERROR_CONNECTION_OTHER );
// Don't try reconnecting when connected from elsewhere.
}
else
{
#ifdef KMESSDEBUG_NOTIFICATION_GENERAL
kDebug() << "Received notice of disconnection from the server.";
#endif
// Save the status, to use it again when reconnecting
lastStatus_ = currentAccount_->getStatus();
closeConnection();
// Try connecting again
@@ -1434,8 +1449,6 @@ void MsnNotificationConnection::gotXfr(const QStringList& command)
#ifdef KMESSDEBUG_NOTIFICATION_GENERAL
kDebug() << "Connecting to new server.";
#endif
// This is a notification server transfer. Switch this socket to the given server.
emit statusMessage( i18n("Switching to another server..."), false );
#ifdef KMESS_NETWORK_WINDOW
KMESS_NET_INIT( this, "NS " + server );
@@ -2609,7 +2622,10 @@ void MsnNotificationConnection::slotContactAdded( const QString &handle, const Q
}
else
{
contactList_->addContact( handle, handle, lists, QStringList(), contactId );
// The contact is added to the reverse list: when the user adds a contact who has added the user,
// the user must appear to be present in the contact's list (this avoids seeing the newly added
// contact as not having the user in his/her list).
contactList_->addContact( handle, handle, lists | Contact::MSN_LIST_REVERSE, QStringList(), contactId );
}
// Check if the user has requested that contact is putted into groups
@@ -2906,9 +2922,26 @@ void MsnNotificationConnection::slotError( QString error, MsnSocketBase::ErrorTy
offlineImMessages_.clear();
}
// We have to save the lastStatus before closing the connection, because closeConnection() resets it,
// but it also resets CurrentAccount so we need to retrieve it now, and set it later.
// TODO XXX HACK FIXME: move this logic to KMessSession (::getInitialStatus?)
// see the IRC logs in #kmess2 at 14 july 2009, 01:41:44...
int lastStatus = -1;
if( currentAccount_ != 0 )
{
lastStatus = currentAccount_->getStatus();
}
// First disconnect
closeConnection();
// Save the status, to use it again when reconnecting
lastStatus_ = lastStatus;
#ifdef KMESSDEBUG_NOTIFICATION_GENERAL
kDebug() << "Changed the lastStatus to " << MsnStatus::getCode( (Status)lastStatus_ );
#endif
// Then decide what kind of message to show
switch( type )
{
@@ -2960,6 +2993,18 @@ void MsnNotificationConnection::slotError( QString error, MsnSocketBase::ErrorTy
tryReconnecting = false;
break;
case MsnSocketBase::ERROR_AUTH_COMPUTATION:
#warning "Translate this after string freeze!"
message = I18N_NOOP("<p>Unable to resolve the authentication on the client<br/>"
"Maybe you do not have installed qca2 and/or qca2-plugin-ossl?</p>" );
detailedMessage = I18N_NOOP("<p>KMess could not connect to the Live Messenger servers.<br />"
"You probably need to install qca2 and qca2-plugin-ossl to make KMess work.<br/>"
"It is also possible that the MSN network is unavailable at the moment.</p>"
);
// Do not attempt to reconnect
tryReconnecting = false;
break;
// Continue as for authentication errors if the switch to HTTP had failed
case MsnSocketBase::ERROR_CONNECTION_TIME_LIMIT: