diff options
Diffstat (limited to 'kopete/protocols/msn/msnfiletransfersocket.cpp')
-rw-r--r-- | kopete/protocols/msn/msnfiletransfersocket.cpp | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/kopete/protocols/msn/msnfiletransfersocket.cpp b/kopete/protocols/msn/msnfiletransfersocket.cpp index 54a09e4a..c07fad06 100644 --- a/kopete/protocols/msn/msnfiletransfersocket.cpp +++ b/kopete/protocols/msn/msnfiletransfersocket.cpp @@ -21,7 +21,7 @@ #include <math.h> //qt -#include <qtimer.h> +#include <tqtimer.h> // kde #include <kdebug.h> @@ -40,7 +40,7 @@ using namespace KNetwork; -MSNFileTransferSocket::MSNFileTransferSocket(const QString &handle, Kopete::Contact *c,bool incoming, QObject* parent) +MSNFileTransferSocket::MSNFileTransferSocket(const TQString &handle, Kopete::Contact *c,bool incoming, TQObject* parent) : MSNSocket(parent) , MSNInvitation(incoming, MSNFileTransferSocket::applicationID() , i18n("File Transfer - MSN Plugin")) { m_handle=handle; @@ -50,8 +50,8 @@ MSNFileTransferSocket::MSNFileTransferSocket(const QString &handle, Kopete::Cont m_contact=c; ready=true; - QObject::connect( this, SIGNAL( socketClosed() ), this, SLOT( slotSocketClosed() ) ); - QObject::connect( this, SIGNAL( blockRead( const QByteArray & ) ), this, SLOT(slotReadBlock( const QByteArray & ) ) ); + TQObject::connect( this, TQT_SIGNAL( socketClosed() ), this, TQT_SLOT( slotSocketClosed() ) ); + TQObject::connect( this, TQT_SIGNAL( blockRead( const TQByteArray & ) ), this, TQT_SLOT(slotReadBlock( const TQByteArray & ) ) ); } MSNFileTransferSocket::~MSNFileTransferSocket() @@ -61,7 +61,7 @@ MSNFileTransferSocket::~MSNFileTransferSocket() kdDebug(14140) << "MSNFileTransferSocket::~MSNFileTransferSocket" <<endl; } -void MSNFileTransferSocket::parseCommand(const QString & cmd, uint id, const QString & data) +void MSNFileTransferSocket::parseCommand(const TQString & cmd, uint id, const TQString & data) { if( cmd == "VER" ) { @@ -83,7 +83,7 @@ void MSNFileTransferSocket::parseCommand(const QString & cmd, uint id, const QSt m_size=id; //data.toUInt(); //BUG: the size is take as id bye MSNSocket because it is a number m_downsize=0; - m_file=new QFile(m_fileName); + m_file=new TQFile(m_fileName); if( m_file->open( IO_WriteOnly )) sendCommand( "TFR" ,NULL,false); @@ -106,13 +106,13 @@ void MSNFileTransferSocket::parseCommand(const QString & cmd, uint id, const QSt disconnect(); } else - sendCommand("FIL" , QString::number(size()) , false); + sendCommand("FIL" , TQString::number(size()) , false); } else if( cmd == "TFR" ) { m_downsize=0; ready=true; - QTimer::singleShot( 0, this, SLOT(slotSendFile()) ); + TQTimer::singleShot( 0, this, TQT_SLOT(slotSendFile()) ); } else if( cmd == "CCL" ) { @@ -131,12 +131,12 @@ void MSNFileTransferSocket::doneConnect() MSNSocket::doneConnect(); } -void MSNFileTransferSocket::bytesReceived(const QByteArray & head) +void MSNFileTransferSocket::bytesReceived(const TQByteArray & head) { if(head[0]!='\0') { kdDebug(14140) << "MSNFileTransferSocket::bytesReceived: transfer aborted" <<endl; - QTimer::singleShot(0,this,SLOT(disconnect())); + TQTimer::singleShot(0,this,TQT_SLOT(disconnect())); } unsigned int sz=(int)((unsigned char)head.data()[2])*256+(int)((unsigned char)head.data()[1]); // kdDebug(14140) << "MSNFileTransferSocket::bytesReceived: " << sz <<endl; @@ -162,7 +162,7 @@ void MSNFileTransferSocket::slotSocketClosed() emit done(this); } -void MSNFileTransferSocket::slotReadBlock(const QByteArray &block) +void MSNFileTransferSocket::slotReadBlock(const TQByteArray &block) { m_file->writeBlock( block.data(), block.size() ); // write to file @@ -175,7 +175,7 @@ void MSNFileTransferSocket::slotReadBlock(const QByteArray &block) //the transfer seems to be finished. sendCommand( "BYE" ,"16777989",false); // if we are not already disconected in 30 seconds, do it. - QTimer::singleShot( 30000 , this, SLOT(disconnect() ) ); + TQTimer::singleShot( 30000 , this, TQT_SLOT(disconnect() ) ); } } @@ -185,8 +185,8 @@ void MSNFileTransferSocket::setKopeteTransfer(Kopete::Transfer *kt) m_kopeteTransfer=kt; if(kt) { - QObject::connect(kt , SIGNAL(transferCanceled()), this, SLOT(abort())); - QObject::connect(kt, SIGNAL(destroyed()) , this , SLOT(slotKopeteTransferDestroyed())); + TQObject::connect(kt , TQT_SIGNAL(transferCanceled()), this, TQT_SLOT(abort())); + TQObject::connect(kt, TQT_SIGNAL(destroyed()) , this , TQT_SLOT(slotKopeteTransferDestroyed())); } } @@ -194,13 +194,13 @@ void MSNFileTransferSocket::listen(int port) { m_server = new KServerSocket(); - QObject::connect( m_server, SIGNAL(readyAccept()), this, SLOT(slotAcceptConnection())); - m_server->setAddress(QString::number(port)); + TQObject::connect( m_server, TQT_SIGNAL(readyAccept()), this, TQT_SLOT(slotAcceptConnection())); + m_server->setAddress(TQString::number(port)); kdDebug(14140) << "MSNFileTransferSocket::listen: about to listen"<<endl; bool listenResult = m_server->listen(1); kdDebug(14140) << "MSNFileTransferSocket::listen: result: "<< listenResult <<endl; - QTimer::singleShot( 60000, this, SLOT(slotTimer()) ); + TQTimer::singleShot( 60000, this, TQT_SLOT(slotTimer()) ); kdDebug(14140) << "MSNFileTransferSocket::listen done" <<endl; } @@ -240,7 +240,7 @@ void MSNFileTransferSocket::abort() } else { - QByteArray bytes(3); + TQByteArray bytes(3); bytes[0]='\1'; bytes[1]='\0'; bytes[2]='\0'; @@ -249,11 +249,11 @@ void MSNFileTransferSocket::abort() } //the timer wait one second, the time to send the CCL or the binary header //retarding the disconnection keep away from a crash. (in KIO::Job::emitResult when `delete this`) - QTimer::singleShot( 1000, this, SLOT(disconnect()) ); + TQTimer::singleShot( 1000, this, TQT_SLOT(disconnect()) ); ready=false; } -void MSNFileTransferSocket::setFile( const QString &fn, long unsigned int fileSize ) +void MSNFileTransferSocket::setFile( const TQString &fn, long unsigned int fileSize ) { m_fileName=fn; if(!m_incoming) @@ -263,7 +263,7 @@ void MSNFileTransferSocket::setFile( const QString &fn, long unsigned int fileSi kdDebug(14140) << "MSNFileTransferSocket::setFileName: WARNING m_file already exists" << endl; delete m_file; } - m_file = new QFile( fn ); + m_file = new TQFile( fn ); if(!m_file->open(IO_ReadOnly)) { //FIXME: abort transfer here @@ -286,7 +286,7 @@ void MSNFileTransferSocket::slotSendFile() { //the transfer seems to be finished. // if we are not already disconected in 30 seconds, do it. - QTimer::singleShot( 30000 , this, SLOT(disconnect() ) ); + TQTimer::singleShot( 30000 , this, TQT_SLOT(disconnect() ) ); return; } @@ -295,7 +295,7 @@ void MSNFileTransferSocket::slotSendFile() char data[2046]; int bytesRead = m_file->readBlock( data, 2045 ); - QByteArray block(bytesRead+3); + TQByteArray block(bytesRead+3); // char i1= (char)fmod( bytesRead, 256 ) ; // char i2= (char)floor( bytesRead / 256 ) ; // kdDebug(14140) << "MSNFileTransferSocket::slotSendFile: " << (int)i1 <<" + 256* "<< (int)i2 <<" = " << bytesRead <<endl; @@ -317,7 +317,7 @@ void MSNFileTransferSocket::slotSendFile() } ready=false; - QTimer::singleShot( 10, this, SLOT(slotSendFile()) ); + TQTimer::singleShot( 10, this, TQT_SLOT(slotSendFile()) ); } void MSNFileTransferSocket::slotReadyWrite() @@ -326,50 +326,50 @@ void MSNFileTransferSocket::slotReadyWrite() MSNSocket::slotReadyWrite(); } -QString MSNFileTransferSocket::invitationHead() +TQString MSNFileTransferSocket::invitationHead() { - QTimer::singleShot( 10 * 60000, this, SLOT(slotTimer()) ); //the user has 10 mins to accept or refuse or initiate the transfer + TQTimer::singleShot( 10 * 60000, this, TQT_SLOT(slotTimer()) ); //the user has 10 mins to accept or refuse or initiate the transfer - return QString( MSNInvitation::invitationHead()+ + return TQString( MSNInvitation::invitationHead()+ "Application-File: "+ m_fileName.right( m_fileName.length() - m_fileName.findRev( '/' ) - 1 ) +"\r\n" - "Application-FileSize: "+ QString::number(size()) +"\r\n\r\n").utf8(); + "Application-FileSize: "+ TQString::number(size()) +"\r\n\r\n").utf8(); } -void MSNFileTransferSocket::parseInvitation(const QString& msg) +void MSNFileTransferSocket::parseInvitation(const TQString& msg) { - QRegExp rx("Invitation-Command: ([A-Z]*)"); + TQRegExp rx("Invitation-Command: ([A-Z]*)"); rx.search(msg); - QString command=rx.cap(1); + TQString command=rx.cap(1); if( msg.contains("Invitation-Command: INVITE") ) { - rx=QRegExp("Application-File: ([^\\r\\n]*)"); + rx=TQRegExp("Application-File: ([^\\r\\n]*)"); rx.search(msg); - QString filename = rx.cap(1); - rx=QRegExp("Application-FileSize: ([0-9]*)"); + TQString filename = rx.cap(1); + rx=TQRegExp("Application-FileSize: ([0-9]*)"); rx.search(msg); unsigned long int filesize= rx.cap(1).toUInt(); MSNInvitation::parseInvitation(msg); //for the cookie - Kopete::TransferManager::transferManager()->askIncomingTransfer( m_contact , filename, filesize, QString::null, QString::number( cookie() ) ); + Kopete::TransferManager::transferManager()->askIncomingTransfer( m_contact , filename, filesize, TQString::null, TQString::number( cookie() ) ); - QObject::connect( Kopete::TransferManager::transferManager(), SIGNAL( accepted( Kopete::Transfer *, const QString& ) ),this, SLOT( slotFileTransferAccepted( Kopete::Transfer *, const QString& ) ) ); - QObject::connect( Kopete::TransferManager::transferManager(), SIGNAL( refused( const Kopete::FileTransferInfo & ) ), this, SLOT( slotFileTransferRefused( const Kopete::FileTransferInfo & ) ) ); + TQObject::connect( Kopete::TransferManager::transferManager(), TQT_SIGNAL( accepted( Kopete::Transfer *, const TQString& ) ),this, TQT_SLOT( slotFileTransferAccepted( Kopete::Transfer *, const TQString& ) ) ); + TQObject::connect( Kopete::TransferManager::transferManager(), TQT_SIGNAL( refused( const Kopete::FileTransferInfo & ) ), this, TQT_SLOT( slotFileTransferRefused( const Kopete::FileTransferInfo & ) ) ); } else if( msg.contains("Invitation-Command: ACCEPT") ) { if(incoming()) { - rx=QRegExp("IP-Address: ([0-9\\.]*)"); + rx=TQRegExp("IP-Address: ([0-9\\.]*)"); rx.search(msg); - QString ip_address = rx.cap(1); - rx=QRegExp("AuthCookie: ([0-9]*)"); + TQString ip_address = rx.cap(1); + rx=TQRegExp("AuthCookie: ([0-9]*)"); rx.search(msg); - QString authcook = rx.cap(1); - rx=QRegExp("Port: ([0-9]*)"); + TQString authcook = rx.cap(1); + rx=TQRegExp("Port: ([0-9]*)"); rx.search(msg); - QString port = rx.cap(1); + TQString port = rx.cap(1); setAuthCookie(authcook); connect(ip_address, port.toUInt()); @@ -377,7 +377,7 @@ void MSNFileTransferSocket::parseInvitation(const QString& msg) else { unsigned long int auth = (rand()%(999999))+1; - setAuthCookie(QString::number(auth)); + setAuthCookie(TQString::number(auth)); setKopeteTransfer(Kopete::TransferManager::transferManager()->addTransfer(m_contact, fileName(), size(), m_contact->metaContact() ? m_contact->metaContact()->displayName() : m_contact->contactId() , Kopete::FileTransferInfo::Outgoing)); @@ -387,15 +387,15 @@ void MSNFileTransferSocket::parseInvitation(const QString& msg) MSNNotifySocket *notify=static_cast<MSNAccount*>(manager->account())->notifySocket(); if(notify){ - QCString message=QString( + TQCString message=TQString( "MIME-Version: 1.0\r\n" "Content-Type: text/x-msmsgsinvite; charset=UTF-8\r\n" "\r\n" "Invitation-Command: ACCEPT\r\n" - "Invitation-Cookie: " + QString::number(cookie()) + "\r\n" + "Invitation-Cookie: " + TQString::number(cookie()) + "\r\n" "IP-Address: " + notify->localIP() + "\r\n" "Port: 6891\r\n" - "AuthCookie: "+QString::number(auth)+"\r\n" + "AuthCookie: "+TQString::number(auth)+"\r\n" "Launch-Application: FALSE\r\n" "Request-Data: IP-Address:\r\n\r\n").utf8(); @@ -416,7 +416,7 @@ void MSNFileTransferSocket::parseInvitation(const QString& msg) } } -void MSNFileTransferSocket::slotFileTransferAccepted(Kopete::Transfer *trans, const QString& fileName) +void MSNFileTransferSocket::slotFileTransferAccepted(Kopete::Transfer *trans, const TQString& fileName) { if(trans->info().internalId().toULong() != cookie()) return; @@ -432,17 +432,17 @@ void MSNFileTransferSocket::slotFileTransferAccepted(Kopete::Transfer *trans, co { setFile(fileName); - QCString message=QString( + TQCString message=TQString( "MIME-Version: 1.0\r\n" "Content-Type: text/x-msmsgsinvite; charset=UTF-8\r\n" "\r\n" "Invitation-Command: ACCEPT\r\n" - "Invitation-Cookie: " + QString::number(cookie()) + "\r\n" + "Invitation-Cookie: " + TQString::number(cookie()) + "\r\n" "Launch-Application: FALSE\r\n" "Request-Data: IP-Address:\r\n" ).utf8(); manager->service()->sendCommand( "MSG" , "N", true, message ); - QTimer::singleShot( 3 * 60000, this, SLOT(slotTimer()) ); //if after 3 minutes the transfer has not begin, delete this + TQTimer::singleShot( 3 * 60000, this, TQT_SLOT(slotTimer()) ); //if after 3 minutes the transfer has not begin, delete this } else { |