diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
commit | 47c8a359c5276062c4bc17f0e82410f29081b502 (patch) | |
tree | 2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /kopete/protocols/msn/msnnotifysocket.cpp | |
parent | 6f82532777a35e0e60bbd2b290b2e93e646f349b (diff) | |
download | tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/protocols/msn/msnnotifysocket.cpp')
-rw-r--r-- | kopete/protocols/msn/msnnotifysocket.cpp | 256 |
1 files changed, 128 insertions, 128 deletions
diff --git a/kopete/protocols/msn/msnnotifysocket.cpp b/kopete/protocols/msn/msnnotifysocket.cpp index e31e0257..3b3fc531 100644 --- a/kopete/protocols/msn/msnnotifysocket.cpp +++ b/kopete/protocols/msn/msnnotifysocket.cpp @@ -28,9 +28,9 @@ #include "msnsecureloginhandler.h" #include "msnchallengehandler.h" -#include <qdatetime.h> -#include <qregexp.h> -#include <qdom.h> +#include <tqdatetime.h> +#include <tqregexp.h> +#include <tqdom.h> #include <kdebug.h> #include <kdeversion.h> @@ -41,7 +41,7 @@ #include <ktempfile.h> #include <krun.h> #include <kio/job.h> -#include <qfile.h> +#include <tqfile.h> #include <kconfig.h> #include <knotification.h> @@ -51,7 +51,7 @@ #include <ctime> -MSNNotifySocket::MSNNotifySocket( MSNAccount *account, const QString& /*msnId*/, const QString &password ) +MSNNotifySocket::MSNNotifySocket( MSNAccount *account, const TQString& /*msnId*/, const TQString &password ) : MSNSocket( account ) { m_newstatus = MSNProtocol::protocol()->NLN; @@ -64,8 +64,8 @@ MSNNotifySocket::MSNNotifySocket( MSNAccount *account, const QString& /*msnId*/, m_account = account; m_password=password; - QObject::connect( this, SIGNAL( blockRead( const QByteArray & ) ), - this, SLOT( slotReadMessage( const QByteArray & ) ) ); + TQObject::connect( this, TQT_SIGNAL( blockRead( const TQByteArray & ) ), + this, TQT_SLOT( slotReadMessage( const TQByteArray & ) ) ); m_keepaliveTimer = 0L; m_isLogged = false; } @@ -91,7 +91,7 @@ void MSNNotifySocket::disconnect() if( m_disconnectReason==Kopete::Account::Unknown ) m_disconnectReason=Kopete::Account::Manual; if( onlineStatus() == Connected ) - sendCommand( "OUT", QString::null, false ); + sendCommand( "OUT", TQString::null, false ); if( m_keepaliveTimer ) m_keepaliveTimer->stop(); @@ -107,11 +107,11 @@ void MSNNotifySocket::handleError( uint code, uint id ) { kdDebug(14140) << k_funcinfo << endl; - QString handle; + TQString handle; if(m_tmpHandles.contains(id)) handle=m_tmpHandles[id]; - QString msg; + TQString msg; MSNSocket::ErrorType type; // See http://www.hypothetic.org/docs/msn/basics.php for a // description of all possible error codes. @@ -148,7 +148,7 @@ void MSNNotifySocket::handleError( uint code, uint id ) } /*else { - QString msg = i18n( "You are trying to change the display name of a user who has not " + TQString msg = i18n( "You are trying to change the display name of a user who has not " "confirmed his or her email address;\n" "the contact was not renamed on the server." ); KMessageBox::queuedMessageBox( Kopete::UI::Global::mainWidget(), KMessageBox::Error, msg, i18n( "MSN Plugin" ) ); @@ -218,7 +218,7 @@ void MSNNotifySocket::handleError( uint code, uint id ) { /* //if(handlev==m_account->accountId()) - QString msg = i18n( "Your email address has not been verified with the MSN server.\n" + TQString 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 @@ -230,7 +230,7 @@ void MSNNotifySocket::handleError( uint code, uint id ) //This happen when too much commends are sent to the server. //the command will not be executed, too bad. // ignore it for now, as we don't really know what command it was. - /* QString msg = i18#n( "You are trying to change your status, or your display name too rapidly.\n" + /* TQString msg = i18#n( "You are trying to change your status, or your display name too rapidly.\n" "This might happen if you added yourself to your own contact list." ); KMessageBox::queuedMessageBox( Kopete::UI::Global::mainWidget(), KMessageBox::Sorry, msg, i18n( "MSN Plugin" ) ); //FIXME: try to fix this problem*/ @@ -262,7 +262,7 @@ void MSNNotifySocket::handleError( uint code, uint id ) emit errorMessage( type, msg ); } -void MSNNotifySocket::parseCommand( const QString &cmd, uint id, const QString &data ) +void MSNNotifySocket::parseCommand( const TQString &cmd, uint id, const TQString &data ) { //kdDebug(14140) << "MSNNotifySocket::parseCommand: Command: " << cmd << endl; @@ -288,9 +288,9 @@ void MSNNotifySocket::parseCommand( const QString &cmd, uint id, const QString & { m_secureLoginHandler = new MSNSecureLoginHandler(m_account->accountId(), m_password, data.section( ' ' , 2 , 2 )); - QObject::connect(m_secureLoginHandler, SIGNAL(loginFailed()), this, SLOT(sslLoginFailed())); - QObject::connect(m_secureLoginHandler, SIGNAL(loginBadPassword()), this, SLOT(sslLoginIncorrect())); - QObject::connect(m_secureLoginHandler, SIGNAL(loginSuccesful(QString )), this, SLOT(sslLoginSucceeded(QString ))); + TQObject::connect(m_secureLoginHandler, TQT_SIGNAL(loginFailed()), this, TQT_SLOT(sslLoginFailed())); + TQObject::connect(m_secureLoginHandler, TQT_SIGNAL(loginBadPassword()), this, TQT_SLOT(sslLoginIncorrect())); + TQObject::connect(m_secureLoginHandler, TQT_SIGNAL(loginSuccesful(TQString )), this, TQT_SLOT(sslLoginSucceeded(TQString ))); m_secureLoginHandler->login(); } @@ -300,7 +300,7 @@ void MSNNotifySocket::parseCommand( const QString &cmd, uint id, const QString & m_disconnectReason=Kopete::Account::Unknown; // Synchronize with the server. - QString lastSyncTime, lastChange; + TQString lastSyncTime, lastChange; if(m_account->contacts().count() > 1) { @@ -331,10 +331,10 @@ void MSNNotifySocket::parseCommand( const QString &cmd, uint id, const QString & // LST [email protected] F=Display%20Name C=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx 13 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx // But can be // LST [email protected] 10 - QString publicName, contactGuid, groups; + TQString publicName, contactGuid, groups; uint lists; - QRegExp regex("N=([^ ]+)(?: F=([^ ]+))?(?: C=([0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}))? (\\d+)\\s?((?:[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12},?)*)$"); + TQRegExp regex("N=([^ ]+)(?: F=([^ ]+))?(?: C=([0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}))? (\\d+)\\s?((?:[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12},?)*)$"); regex.search(data); // Capture passport email. @@ -368,12 +368,12 @@ void MSNNotifySocket::parseCommand( const QString &cmd, uint id, const QString & MSNContact *c = static_cast<MSNContact*>( m_account->contacts()[ data.section( ' ', 1, 1 ) ] ); if( c && c->contactId() != m_account->accountId() ) { - QString publicName=unescape( data.section( ' ', 2, 2 ) ); + TQString publicName=unescape( data.section( ' ', 2, 2 ) ); if ( (publicName!=c->contactId() || c->hasProperty(Kopete::Global::Properties::self()->nickName().key()) ) && publicName!=c->property( Kopete::Global::Properties::self()->nickName()).value().toString() ) changePublicName(publicName,c->contactId()); - QString obj=unescape(data.section( ' ', 4, 4 )); + TQString obj=unescape(data.section( ' ', 4, 4 )); c->setObject( obj ); c->setOnlineStatus( convertOnlineStatus( data.section( ' ', 0, 0 ) ) ); c->setClientFlags(data.section( ' ', 3, 3 ).toUInt()); @@ -391,7 +391,7 @@ void MSNNotifySocket::parseCommand( const QString &cmd, uint id, const QString & { // UUX is sended to acknowledge that the server has received and processed the personal Message. // if the result is 0, set the myself() contact personalMessage. - if( data.section(' ', 0, 0) == QString::fromUtf8("0") ) + if( data.section(' ', 0, 0) == TQString::fromUtf8("0") ) m_account->myself()->setProperty(MSNProtocol::protocol()->propPersonalMessage, m_propertyPersonalMessage); } else if( cmd == "FLN" ) @@ -405,7 +405,7 @@ void MSNNotifySocket::parseCommand( const QString &cmd, uint id, const QString & } else if( cmd == "XFR" ) { - QString stype=data.section( ' ', 0, 0 ); + TQString stype=data.section( ' ', 0, 0 ); if( stype=="SB" ) //switchboard connection (chat) { // Address, AuthInfo @@ -413,8 +413,8 @@ void MSNNotifySocket::parseCommand( const QString &cmd, uint id, const QString & } else if( stype=="NS" ) //notifysocket ; Got our notification server { //we are connecting and we receive the initial NS, or the msn server encounter a problem, and we are switching to another switchboard - QString host = data.section( ' ', 1, 1 ); - QString server = host.section( ':', 0, 0 ); + TQString host = data.section( ' ', 1, 1 ); + TQString server = host.section( ':', 0, 0 ); uint port = host.section( ':', 1, 1 ).toUInt(); setOnlineStatus( Connected ); emit receivedNotificationServer( server, port ); @@ -425,12 +425,12 @@ void MSNNotifySocket::parseCommand( const QString &cmd, uint id, const QString & else if( cmd == "RNG" ) { // SessionID, Address, AuthInfo, handle, publicName - emit invitedToChat( QString::number( id ), data.section( ' ', 0, 0 ), data.section( ' ', 2, 2 ), + emit invitedToChat( TQString::number( id ), data.section( ' ', 0, 0 ), data.section( ' ', 2, 2 ), data.section( ' ', 3, 3 ), unescape( data.section( ' ', 4, 4 ) ) ); } else if( cmd == "ADC" ) { - QString msnId, list, publicName, contactGuid, groupGuid; + TQString msnId, list, publicName, contactGuid, groupGuid; // Retrieve the list parameter (FL/AL/BL/RL) list = data.section( ' ', 0, 0 ); @@ -441,7 +441,7 @@ void MSNNotifySocket::parseCommand( const QString &cmd, uint id, const QString & // ADC TrID RL [email protected] F=friednly%20name // ADC TrID FL [email protected] F=My%20Name C=contactGuid // Thanks Gregg for that complex RegExp. - QRegExp regex("(?:N=([^ ]+))?(?: F=([^ ]+))?(?: C=([0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}))?\\s?((?:[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12},?)*)$"); + TQRegExp regex("(?:N=([^ ]+))?(?: F=([^ ]+))?(?: C=([0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}))?\\s?((?:[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12},?)*)$"); regex.search( data.section( ' ', 1 ) ); // Capture passport email. @@ -460,7 +460,7 @@ void MSNNotifySocket::parseCommand( const QString &cmd, uint id, const QString & } else if( cmd == "REM" ) // someone is removed from a list { - QString handle, list, contactGuid, groupGuid; + TQString handle, list, contactGuid, groupGuid; list = data.section( ' ', 0, 0 ); if( list == "FL" ) { @@ -495,13 +495,13 @@ void MSNNotifySocket::parseCommand( const QString &cmd, uint id, const QString & } else if( cmd == "CHG" ) { - QString status = data.section( ' ', 0, 0 ); + TQString status = data.section( ' ', 0, 0 ); setOnlineStatus( Connected ); emit statusChanged( convertOnlineStatus( status ) ); } else if( cmd == "SBP" ) { - QString contactGuid, type, publicName; + TQString contactGuid, type, publicName; contactGuid = data.section( ' ', 0, 0 ); type = data.section( ' ', 1, 1 ); if(type == "MFN" ) @@ -540,7 +540,7 @@ void MSNNotifySocket::parseCommand( const QString &cmd, uint id, const QString & { m_challengeHandler = new MSNChallengeHandler("CFHUR$52U_{VIX5T", "PROD0101{0RM?UBW"); // Compute the challenge response hash, and send the response. - QString chlResponse = m_challengeHandler->computeHash(data.section(' ', 0, 0)); + TQString chlResponse = m_challengeHandler->computeHash(data.section(' ', 0, 0)); sendCommand("QRY", m_challengeHandler->productId(), true, chlResponse.utf8()); // Dispose of the challenge handler. m_challengeHandler->deleteLater(); @@ -549,8 +549,8 @@ void MSNNotifySocket::parseCommand( const QString &cmd, uint id, const QString & else if( cmd == "SYN" ) { // Retrieve the last synchronization timestamp known to the server. - QString lastSyncTime = data.section( ' ', 1, 1 ); - QString lastChange = data.section( ' ', 0, 0 ); + TQString lastSyncTime = data.section( ' ', 1, 1 ); + TQString lastChange = data.section( ' ', 0, 0 ); if( lastSyncTime != m_account->configGroup()->readEntry("lastsynctime") || lastChange != m_account->configGroup()->readEntry("lastchange") ) { @@ -576,8 +576,8 @@ void MSNNotifySocket::parseCommand( const QString &cmd, uint id, const QString & MSNContact *c = static_cast<MSNContact*>( m_account->myself() ); if( c ) { - QString type = data.section( ' ', 0, 0 ); - QString prpData = unescape( data.section( ' ', 1, 1 ) ); //SECURITY???????? + TQString type = data.section( ' ', 0, 0 ); + TQString prpData = unescape( data.section( ' ', 1, 1 ) ); //SECURITY???????? c->setInfo( type, prpData ); m_account->configGroup()->writeEntry( type, prpData ); } @@ -610,21 +610,21 @@ void MSNNotifySocket::parseCommand( const QString &cmd, uint id, const QString & { // URL 6 /cgi-bin/HoTMaiL https://loginnet.passport.com/ppsecure/md5auth.srf?lc=1033 2 //example of reply: URL 10 /cgi-bin/HoTMaiL https://msnialogin.passport.com/ppsecure/md5auth.srf?lc=1036 3 - QString from_action_url = data.section( ' ', 1, 1 ); - QString rru = data.section( ' ', 0, 0 ); - QString id = data.section( ' ', 2, 2 ); + TQString from_action_url = data.section( ' ', 1, 1 ); + TQString rru = data.section( ' ', 0, 0 ); + TQString id = data.section( ' ', 2, 2 ); //write the tmp file - QString UserID=m_account->accountId(); + TQString UserID=m_account->accountId(); time_t actualTime; time(&actualTime); - QString sl = QString::number( ( unsigned long ) actualTime - m_loginTime.toULong() ); + TQString sl = TQString::number( ( unsigned long ) actualTime - m_loginTime.toULong() ); - QString md5this( m_MSPAuth + sl + m_password ); + TQString md5this( m_MSPAuth + sl + m_password ); KMD5 md5( md5this.utf8() ); - QString hotmailRequest = "<html>\n" + TQString hotmailRequest = "<html>\n" "<head>\n" "<noscript>\n" "<meta http-equiv=Refresh content=\"0; url=http://www.hotmail.com\">\n" @@ -641,7 +641,7 @@ void MSNNotifySocket::parseCommand( const QString &cmd, uint id, const QString & "<input type=\"hidden\" name=\"sl\" value=\"" + sl +"\">\n" "<input type=\"hidden\" name=\"rru\" value=\"" + rru + "\">\n" "<input type=\"hidden\" name=\"auth\" value=\"" + m_MSPAuth + "\">\n" - "<input type=\"hidden\" name=\"creds\" value=\"" + QString::fromLatin1( md5.hexDigest() ) + "\">\n" + "<input type=\"hidden\" name=\"creds\" value=\"" + TQString::fromLatin1( md5.hexDigest() ) + "\">\n" "<input type=\"hidden\" name=\"svc\" value=\"mail\">\n" "<input type=\"hidden\" name=\"js\" value=\"yes\">\n" "</form></body>\n</html>\n"; @@ -679,7 +679,7 @@ void MSNNotifySocket::sslLoginIncorrect() disconnect(); } -void MSNNotifySocket::sslLoginSucceeded(QString ticket) +void MSNNotifySocket::sslLoginSucceeded(TQString ticket) { sendCommand("USR" , "TWN S " + ticket); @@ -706,9 +706,9 @@ void MSNNotifySocket::slotOpenInbox() sendCommand("URL", "INBOX" ); } -void MSNNotifySocket::sendMail(const QString &email) +void MSNNotifySocket::sendMail(const TQString &email) { - sendCommand("URL", QString("COMPOSE " + email).utf8() ); + sendCommand("URL", TQString("COMPOSE " + email).utf8() ); } bool MSNNotifySocket::setUseHttpMethod(bool useHttp) @@ -723,17 +723,17 @@ bool MSNNotifySocket::setUseHttpMethod(bool useHttp) } else { if( !m_keepaliveTimer ) { - m_keepaliveTimer = new QTimer( this, "m_keepaliveTimer" ); - QObject::connect( m_keepaliveTimer, SIGNAL( timeout() ), SLOT( slotSendKeepAlive() ) ); + m_keepaliveTimer = new TQTimer( this, "m_keepaliveTimer" ); + TQObject::connect( m_keepaliveTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( slotSendKeepAlive() ) ); } } return ret; } -void MSNNotifySocket::slotReadMessage( const QByteArray &bytes ) +void MSNNotifySocket::slotReadMessage( const TQByteArray &bytes ) { - QString msg = QString::fromUtf8(bytes, bytes.size()); + TQString msg = TQString::fromUtf8(bytes, bytes.size()); if(msg.contains("text/x-msmsgsinitialmdatanotification")) { @@ -744,7 +744,7 @@ void MSNNotifySocket::slotReadMessage( const QByteArray &bytes ) // IU - initial unread // O - other mail // OU - other unread. - QRegExp regex("<MD><E><I>(\\d+)?</I>(?:<IU>(\\d+)?</IU>)<O>(\\d+)?</O><OU>(\\d+)?</OU></E><Q>.*</Q></MD>"); + TQRegExp regex("<MD><E><I>(\\d+)?</I>(?:<IU>(\\d+)?</IU>)<O>(\\d+)?</O><OU>(\\d+)?</OU></E><Q>.*</Q></MD>"); regex.search(msg); bool unread; @@ -753,56 +753,56 @@ void MSNNotifySocket::slotReadMessage( const QByteArray &bytes ) if(unread && mailCount > 0) { // If there are new email message available, raise the unread email event. - QObject::connect(KNotification::event( "msn_mail", i18n( "You have one unread message in your MSN inbox.", + TQObject::connect(KNotification::event( "msn_mail", i18n( "You have one unread message in your MSN inbox.", "You have %n unread messages in your MSN inbox.", mailCount ), 0 , 0 , i18n( "Open Inbox..." ) ), - SIGNAL(activated(unsigned int ) ) , this, SLOT( slotOpenInbox() ) ); + TQT_SIGNAL(activated(unsigned int ) ) , this, TQT_SLOT( slotOpenInbox() ) ); } } else if(msg.contains("text/x-msmsgsactivemailnotification")) { //this sends the server if mails are deleted - QString m = msg.right(msg.length() - msg.find("Message-Delta:") ); + TQString m = msg.right(msg.length() - msg.find("Message-Delta:") ); m = m.left(msg.find("\r\n")); mailCount = mailCount - m.right(m.length() -m.find(" ")-1).toUInt(); } else if(msg.contains("text/x-msmsgsemailnotification")) { //this sends the server if a new mail has arrived - QRegExp rx("From-Addr: ([A-Za-z0-9@._\\-]*)"); + TQRegExp rx("From-Addr: ([A-Za-z0-9@._\\-]*)"); rx.search(msg); - QString m=rx.cap(1); + TQString m=rx.cap(1); mailCount++; //TODO: it is also possible to get the subject (but warning about the encoding) - QObject::connect(KNotification::event( "msn_mail",i18n( "You have one new email from %1 in your MSN inbox." ).arg(m), + TQObject::connect(KNotification::event( "msn_mail",i18n( "You have one new email from %1 in your MSN inbox." ).arg(m), 0 , 0 , i18n( "Open Inbox..." ) ), - SIGNAL(activated(unsigned int ) ) , this, SLOT( slotOpenInbox() ) ); + TQT_SIGNAL(activated(unsigned int ) ) , this, TQT_SLOT( slotOpenInbox() ) ); } else if(msg.contains("text/x-msmsgsprofile")) { //Hotmail profile if(msg.contains("MSPAuth:")) { - QRegExp rx("MSPAuth: ([A-Za-z0-9$!*]*)"); + TQRegExp rx("MSPAuth: ([A-Za-z0-9$!*]*)"); rx.search(msg); m_MSPAuth=rx.cap(1); } if(msg.contains("sid:")) { - QRegExp rx("sid: ([0-9]*)"); + TQRegExp rx("sid: ([0-9]*)"); rx.search(msg); m_sid=rx.cap(1); } if(msg.contains("kv:")) { - QRegExp rx("kv: ([0-9]*)"); + TQRegExp rx("kv: ([0-9]*)"); rx.search(msg); m_kv=rx.cap(1); } if(msg.contains("LoginTime:")) { - QRegExp rx("LoginTime: ([0-9]*)"); + TQRegExp rx("LoginTime: ([0-9]*)"); rx.search(msg); m_loginTime=rx.cap(1); } @@ -810,18 +810,18 @@ void MSNNotifySocket::slotReadMessage( const QByteArray &bytes ) { time_t actualTime; time(&actualTime); - m_loginTime=QString::number((unsigned long)actualTime); + m_loginTime=TQString::number((unsigned long)actualTime); } if(msg.contains("EmailEnabled:")) { - QRegExp rx("EmailEnabled: ([0-9]*)"); + TQRegExp rx("EmailEnabled: ([0-9]*)"); rx.search(msg); m_isHotmailAccount = (rx.cap(1).toUInt() == 1); emit hotmailSeted(m_isHotmailAccount); } if(msg.contains("ClientIP:")) { - QRegExp rx("ClientIP: ([0-9.]*)"); + TQRegExp rx("ClientIP: ([0-9.]*)"); rx.search(msg); m_localIP = rx.cap(1); } @@ -846,29 +846,29 @@ void MSNNotifySocket::slotReadMessage( const QByteArray &bytes ) // </NOTIFICATION> // MSN sends out badly formed XML .. fix it for them (thanks MS!) - QString notificationDOMAsString(msg); + TQString notificationDOMAsString(msg); - QRegExp rx( "&(?!amp;)" ); // match ampersands but not & + TQRegExp rx( "&(?!amp;)" ); // match ampersands but not & notificationDOMAsString.replace(rx, "&"); - QDomDocument alertDOM; + TQDomDocument alertDOM; alertDOM.setContent(notificationDOMAsString); - QDomNodeList msgElements = alertDOM.elementsByTagName("MSG"); + TQDomNodeList msgElements = alertDOM.elementsByTagName("MSG"); for (uint i = 0 ; i < msgElements.count() ; i++) { - QString subscString; - QString actionString; - QString textString; + TQString subscString; + TQString actionString; + TQString textString; - QDomNode msgDOM = msgElements.item(i); + TQDomNode msgDOM = msgElements.item(i); - QDomNodeList msgChildren = msgDOM.childNodes(); + TQDomNodeList msgChildren = msgDOM.childNodes(); for (uint i = 0 ; i < msgChildren.length() ; i++) { - QDomNode child = msgChildren.item(i); - QDomElement element = child.toElement(); + TQDomNode child = msgChildren.item(i); + TQDomElement element = child.toElement(); if (element.tagName() == "SUBSCR") { - QDomAttr subscElementURLAttribute; + TQDomAttr subscElementURLAttribute; if (element.hasAttribute("url")) { subscElementURLAttribute = element.attributeNode("url"); @@ -878,7 +878,7 @@ void MSNNotifySocket::slotReadMessage( const QByteArray &bytes ) else if (element.tagName() == "ACTION") { // process ACTION node to pull out URL the alert is tied to - QDomAttr actionElementURLAttribute; + TQDomAttr actionElementURLAttribute; if (element.hasAttribute("url")) { actionElementURLAttribute = element.attributeNode("url"); @@ -888,10 +888,10 @@ void MSNNotifySocket::slotReadMessage( const QByteArray &bytes ) else if (element.tagName() == "BODY") { // process BODY node to get the text of the alert - QDomNodeList textElements = element.elementsByTagName("TEXT"); + TQDomNodeList textElements = element.elementsByTagName("TEXT"); if (textElements.count() >= 1) { - QDomElement textElement = textElements.item(0).toElement(); + TQDomElement textElement = textElements.item(0).toElement(); textString = textElement.text(); } } @@ -901,7 +901,7 @@ void MSNNotifySocket::slotReadMessage( const QByteArray &bytes ) // kdDebug( 14140 ) << "subscString " << subscString << " actionString " << actionString << " textString " << textString << endl; // build an internal list of actions ... we'll need to index into this list when we receive an event - QStringList actions; + TQStringList actions; actions.append(i18n("More Information")); m_msnAlertURLs.append(actionString); @@ -909,11 +909,11 @@ void MSNNotifySocket::slotReadMessage( const QByteArray &bytes ) m_msnAlertURLs.append(subscString); // Don't do any MSN alerts notification for new blog updates - if( subscString != QString::fromLatin1("s.htm") && actionString != QString::fromLatin1("a.htm") ) + if( subscString != TQString::fromLatin1("s.htm") && actionString != TQString::fromLatin1("a.htm") ) { KNotification* notification = KNotification::event("msn_alert", textString, 0L, 0L, actions); - QObject::connect(notification, SIGNAL(activated(unsigned int)), this, SLOT(slotMSNAlertLink(unsigned int))); - QObject::connect(notification, SIGNAL(closed()), this, SLOT(slotMSNAlertUnwanted())); + TQObject::connect(notification, TQT_SIGNAL(activated(unsigned int)), this, TQT_SLOT(slotMSNAlertLink(unsigned int))); + TQObject::connect(notification, TQT_SIGNAL(closed()), this, TQT_SLOT(slotMSNAlertUnwanted())); } } // end for each MSG tag } @@ -925,21 +925,21 @@ void MSNNotifySocket::slotReadMessage( const QByteArray &bytes ) if(!m_tmpLastHandle.isNull()) { - QString personalMessage, currentMedia; - QDomDocument psm; + TQString personalMessage, currentMedia; + TQDomDocument psm; if( psm.setContent(msg) ) { // Get the first child of the xml "document"; - QDomElement psmElement = psm.documentElement().firstChild().toElement(); + TQDomElement psmElement = psm.documentElement().firstChild().toElement(); while( !psmElement.isNull() ) { - if(psmElement.tagName() == QString::fromUtf8("PSM")) + if(psmElement.tagName() == TQString::fromUtf8("PSM")) { personalMessage = psmElement.text(); kdDebug(14140) << k_funcinfo << "Personnal Message received: " << personalMessage << endl; } - else if(psmElement.tagName() == QString::fromUtf8("CurrentMedia")) + else if(psmElement.tagName() == TQString::fromUtf8("CurrentMedia")) { if( !psmElement.text().isEmpty() ) { @@ -956,11 +956,11 @@ void MSNNotifySocket::slotReadMessage( const QByteArray &bytes ) contact->setProperty(MSNProtocol::protocol()->propPersonalMessage, currentMedia.isEmpty() ? personalMessage : currentMedia); } } - m_tmpLastHandle = QString::null; + m_tmpLastHandle = TQString::null; } } -QString MSNNotifySocket::processCurrentMedia( const QString &mediaXmlElement ) +TQString MSNNotifySocket::processCurrentMedia( const TQString &mediaXmlElement ) { /* The value of the CurrentMedia tag you can think of like an array @@ -985,10 +985,10 @@ QString MSNNotifySocket::processCurrentMedia( const QString &mediaXmlElement ) From http://msnpiki.msnfanatic.com/index.php/MSNP11:Changes */ - QString application, type, format, currentMedia; + TQString application, type, format, currentMedia; bool enabled=false, test; // \0 is textual, it's the "array" separator. - QStringList argumentLists = QStringList::split(QString::fromUtf8("\\0"), mediaXmlElement, true); + TQStringList argumentLists = TQStringList::split(TQString::fromUtf8("\\0"), mediaXmlElement, true); // Retrive the "stable" array elements. application = argumentLists[0]; @@ -997,8 +997,8 @@ QString MSNNotifySocket::processCurrentMedia( const QString &mediaXmlElement ) format = argumentLists[3]; // Get the formatter strings - QStringList formatterStrings; - QStringList::ConstIterator it; + TQStringList formatterStrings; + TQStringList::ConstIterator it; for( it = argumentLists.at(4); it != argumentLists.end(); ++it ) { formatterStrings.append( *it ); @@ -1008,10 +1008,10 @@ QString MSNNotifySocket::processCurrentMedia( const QString &mediaXmlElement ) currentMedia = format; for(uint i=0; i<formatterStrings.size(); i++) { - currentMedia = currentMedia.replace(QString("{%1}").arg(i), formatterStrings[i]); + currentMedia = currentMedia.replace(TQString("{%1}").arg(i), formatterStrings[i]); } - if( type == QString::fromUtf8("Music") ) + if( type == TQString::fromUtf8("Music") ) { // the "♫" is encoded in utf8 (and should be in utf8) currentMedia = i18n("Now Listening: ♫ %1 ♫").arg(currentMedia); @@ -1022,26 +1022,26 @@ QString MSNNotifySocket::processCurrentMedia( const QString &mediaXmlElement ) return currentMedia; } -void MSNNotifySocket::addGroup(const QString& groupName) +void MSNNotifySocket::addGroup(const TQString& groupName) { // escape spaces sendCommand( "ADG", escape( groupName ) ); } -void MSNNotifySocket::renameGroup( const QString& groupName, const QString& groupGuid ) +void MSNNotifySocket::renameGroup( const TQString& groupName, const TQString& groupGuid ) { // escape spaces sendCommand( "REG", groupGuid + " " + escape( groupName ) ); } -void MSNNotifySocket::removeGroup( const QString& groupGuid ) +void MSNNotifySocket::removeGroup( const TQString& groupGuid ) { sendCommand( "RMG", groupGuid ); } -void MSNNotifySocket::addContact( const QString &handle, int list, const QString& publicName, const QString& contactGuid, const QString& groupGuid ) +void MSNNotifySocket::addContact( const TQString &handle, int list, const TQString& publicName, const TQString& contactGuid, const TQString& groupGuid ) { - QString args; + TQString args; switch( list ) { case MSNProtocol::FL: @@ -1049,25 +1049,25 @@ void MSNNotifySocket::addContact( const QString &handle, int list, const QString // Adding the contact to a group if( !contactGuid.isEmpty() ) { - args = QString("FL C=%1 %2").arg( contactGuid ).arg( groupGuid ); + args = TQString("FL C=%1 %2").arg( contactGuid ).arg( groupGuid ); kdDebug(14140) << k_funcinfo << "In adding contact to a group" << endl; } // Adding a new contact else { - args = QString("FL N=%1 F=%2").arg( handle ).arg( escape( publicName ) ); + args = TQString("FL N=%1 F=%2").arg( handle ).arg( escape( publicName ) ); kdDebug(14140) << k_funcinfo << "In adding contact to a new contact" << endl; } break; } case MSNProtocol::AL: - args = QString("AL N=%1").arg( handle ); + args = TQString("AL N=%1").arg( handle ); break; case MSNProtocol::BL: - args = QString("BL N=%1").arg( handle ); + args = TQString("BL N=%1").arg( handle ); break; case MSNProtocol::RL: - args = QString("RL N=%1").arg( handle ); + args = TQString("RL N=%1").arg( handle ); break; default: kdDebug(14140) << k_funcinfo <<"WARNING! Unknown list " << list << "!" << endl; @@ -1077,9 +1077,9 @@ void MSNNotifySocket::addContact( const QString &handle, int list, const QString m_tmpHandles[id]=handle; } -void MSNNotifySocket::removeContact( const QString &handle, int list, const QString& contactGuid, const QString& groupGuid ) +void MSNNotifySocket::removeContact( const TQString &handle, int list, const TQString& contactGuid, const TQString& groupGuid ) { - QString args; + TQString args; switch( list ) { case MSNProtocol::FL: @@ -1115,9 +1115,9 @@ void MSNNotifySocket::setStatus( const Kopete::OnlineStatus &status ) sendCommand( "CHG", statusToString( status ) + " " + m_account->myselfClientId() + " " + escape(m_account->pictureObject()) ); } -void MSNNotifySocket::changePublicName( const QString &publicName, const QString &handle ) +void MSNNotifySocket::changePublicName( const TQString &publicName, const TQString &handle ) { - QString tempPublicName = publicName; + TQString tempPublicName = publicName; //The maximum length is 387. but with utf8 or encodage, each character may be triple // 387/3 = 129 so we make sure the lenght is not logner than 129 char, even if @@ -1144,10 +1144,10 @@ void MSNNotifySocket::changePublicName( const QString &publicName, const QString } } -void MSNNotifySocket::changePersonalMessage( MSNProtocol::PersonalMessageType type, const QString &personalMessage ) +void MSNNotifySocket::changePersonalMessage( MSNProtocol::PersonalMessageType type, const TQString &personalMessage ) { - QString tempPersonalMessage; - QString xmlCurrentMedia; + TQString tempPersonalMessage; + TQString xmlCurrentMedia; // Only espace and cut the personalMessage is the type is normal. if(type == MSNProtocol::PersonalMessageNormal) @@ -1161,14 +1161,14 @@ void MSNNotifySocket::changePersonalMessage( MSNProtocol::PersonalMessageType ty } } - QDomDocument xmlMessage; + TQDomDocument xmlMessage; xmlMessage.appendChild( xmlMessage.createElement( "Data" ) ); - QDomElement psm = xmlMessage.createElement("PSM"); + TQDomElement psm = xmlMessage.createElement("PSM"); psm.appendChild( xmlMessage.createTextNode( tempPersonalMessage ) ); xmlMessage.documentElement().appendChild( psm ); - QDomElement currentMedia = xmlMessage.createElement("CurrentMedia"); + TQDomElement currentMedia = xmlMessage.createElement("CurrentMedia"); /* Example of currentMedia xml tag: <CurrentMedia>\0Music\01\0{0} - {1}\0 Song Title\0Song Artist\0Song Album\0\0</CurrentMedia> @@ -1180,22 +1180,22 @@ void MSNNotifySocket::changePersonalMessage( MSNProtocol::PersonalMessageType ty case MSNProtocol::PersonalMessageMusic: { xmlCurrentMedia = "\\0Music\\01\\0"; - QStringList mediaList = QStringList::split(";", personalMessage); - QString formatterArguments; + TQStringList mediaList = TQStringList::split(";", personalMessage); + TQString formatterArguments; if( !mediaList[0].isEmpty() ) // Current Track { xmlCurrentMedia += "{0}"; - formatterArguments += QString("%1\\0").arg(mediaList[0]); + formatterArguments += TQString("%1\\0").arg(mediaList[0]); } if( !mediaList[1].isEmpty() ) // Current Artist { xmlCurrentMedia += " - {1}"; - formatterArguments += QString("%1\\0").arg(mediaList[1]); + formatterArguments += TQString("%1\\0").arg(mediaList[1]); } if( !mediaList[2].isEmpty() ) // Current Album { xmlCurrentMedia += " ({2})"; - formatterArguments += QString("%1\\0").arg(mediaList[2]); + formatterArguments += TQString("%1\\0").arg(mediaList[2]); } xmlCurrentMedia += "\\0" + formatterArguments + "\\0"; break; @@ -1216,7 +1216,7 @@ void MSNNotifySocket::changePersonalMessage( MSNProtocol::PersonalMessageType ty } -void MSNNotifySocket::changePhoneNumber( const QString &key, const QString &data ) +void MSNNotifySocket::changePhoneNumber( const TQString &key, const TQString &data ) { sendCommand( "PRP", key + " " + escape ( data ) ); } @@ -1227,7 +1227,7 @@ void MSNNotifySocket::createChatSession() sendCommand( "XFR", "SB" ); } -QString MSNNotifySocket::statusToString( const Kopete::OnlineStatus &status ) const +TQString MSNNotifySocket::statusToString( const Kopete::OnlineStatus &status ) const { if( status == MSNProtocol::protocol()->NLN ) return "NLN"; @@ -1269,7 +1269,7 @@ void MSNNotifySocket::slotSendKeepAlive() { // Send a dummy command to fake activity. This makes sure MSN doesn't // disconnect you when the notify socket is idle. - sendCommand( "PNG" , QString::null , false ); + sendCommand( "PNG" , TQString::null , false ); m_ping=true; } @@ -1278,7 +1278,7 @@ void MSNNotifySocket::slotSendKeepAlive() m_tmpHandles.clear(); } -Kopete::OnlineStatus MSNNotifySocket::convertOnlineStatus( const QString &status ) +Kopete::OnlineStatus MSNNotifySocket::convertOnlineStatus( const TQString &status ) { if( status == "NLN" ) return MSNProtocol::protocol()->NLN; |