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/outgoingtransfer.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/outgoingtransfer.cpp')
-rw-r--r-- | kopete/protocols/msn/outgoingtransfer.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/kopete/protocols/msn/outgoingtransfer.cpp b/kopete/protocols/msn/outgoingtransfer.cpp index 4879cf52..f6b71c12 100644 --- a/kopete/protocols/msn/outgoingtransfer.cpp +++ b/kopete/protocols/msn/outgoingtransfer.cpp @@ -26,9 +26,9 @@ using namespace KNetwork; // Qt includes -#include <qfile.h> -#include <qregexp.h> -#include <qtimer.h> +#include <tqfile.h> +#include <tqregexp.h> +#include <tqtimer.h> // Kopete includes #include <kopetetransfermanager.h> @@ -39,7 +39,7 @@ using P2P::Dispatcher; using P2P::OutgoingTransfer; using P2P::Message; -OutgoingTransfer::OutgoingTransfer(const QString& to, P2P::Dispatcher *dispatcher, Q_UINT32 sessionId) +OutgoingTransfer::OutgoingTransfer(const TQString& to, P2P::Dispatcher *dispatcher, Q_UINT32 sessionId) : TransferContext(to,dispatcher,sessionId) { m_direction = Outgoing; @@ -51,12 +51,12 @@ OutgoingTransfer::~OutgoingTransfer() kdDebug(14140) << k_funcinfo << endl; } -void OutgoingTransfer::sendImage(const QByteArray& image) +void OutgoingTransfer::sendImage(const TQByteArray& image) { -// TODO QByteArray base64 = KCodecs::base64Encode(image); +// TODO TQByteArray base64 = KCodecs::base64Encode(image); // -// QCString body = "MIME-Version: 1.0\r\n" +// TQCString body = "MIME-Version: 1.0\r\n" // "Content-Type: image/gif\r\n" // "\r\n" // "base64:" + @@ -71,7 +71,7 @@ void OutgoingTransfer::sendImage(const QByteArray& image) // outbound.header.ackSessionIdentifier = rand()%0x8FFFFFF0 + 4; // outbound.header.ackUniqueIdentifier = 0; // outbound.header.ackDataSize = 0l; -// QByteArray bytes(4); +// TQByteArray bytes(4); // bytes.fill('\0'); // outbound.body = bytes; // outbound.applicationIdentifier = 0; @@ -84,7 +84,7 @@ void OutgoingTransfer::sendImage(const QByteArray& image) void OutgoingTransfer::slotSendData() { Q_INT32 bytesRead = 0; - QByteArray buffer(1202); + TQByteArray buffer(1202); if(!m_file) return; @@ -101,7 +101,7 @@ void OutgoingTransfer::slotSendData() buffer.resize(bytesRead); } - kdDebug(14140) << k_funcinfo << QString("Sending, %1 bytes").arg(bytesRead) << endl; + kdDebug(14140) << k_funcinfo << TQString("Sending, %1 bytes").arg(bytesRead) << endl; if((m_offset + bytesRead) < m_file->size()) { @@ -193,8 +193,8 @@ void OutgoingTransfer::acknowledged() void OutgoingTransfer::processMessage(const Message& message) { - QString body = - QCString(message.body.data(), message.header.dataSize); + TQString body = + TQCString(message.body.data(), message.header.dataSize); kdDebug(14140) << k_funcinfo << "received, " << body << endl; if(body.startsWith("BYE")) @@ -217,9 +217,9 @@ void OutgoingTransfer::processMessage(const Message& message) else if(body.startsWith("MSNSLP/1.0 200 OK")) { // Retrieve the message content type. - QRegExp regex("Content-Type: ([A-Za-z0-9$!*/\\-]*)"); + TQRegExp regex("Content-Type: ([A-Za-z0-9$!*/\\-]*)"); regex.search(body); - QString contentType = regex.cap(1); + TQString contentType = regex.cap(1); if(contentType == "application/x-msnmsgr-sessionreqbody") { @@ -246,19 +246,19 @@ void OutgoingTransfer::processMessage(const Message& message) m_transfer = Kopete::TransferManager::transferManager()->addTransfer(contact, m_file->name(), m_file->size(), m_recipient, Kopete::FileTransferInfo::Outgoing); - QObject::connect(m_transfer , SIGNAL(transferCanceled()), this, SLOT(abort())); + TQObject::connect(m_transfer , TQT_SIGNAL(transferCanceled()), this, TQT_SLOT(abort())); m_state = Negotiation; m_branch = P2P::Uid::createUid(); // Send the direct connection invitation message. - QString content = "Bridges: TRUDPv1 TCPv1\r\n" + - QString("NetID: %1\r\n").arg("-123657987") + - QString("Conn-Type: %1\r\n").arg("Restrict-NAT") + + TQString content = "Bridges: TRUDPv1 TCPv1\r\n" + + TQString("NetID: %1\r\n").arg("-123657987") + + TQString("Conn-Type: %1\r\n").arg("Restrict-NAT") + "UPnPNat: false\r\n" "ICF: false\r\n" + - QString("Hashed-Nonce: {%1}\r\n").arg(P2P::Uid::createUid()) + + TQString("Hashed-Nonce: {%1}\r\n").arg(P2P::Uid::createUid()) + "\r\n"; sendMessage(INVITE, content); } @@ -266,7 +266,7 @@ void OutgoingTransfer::processMessage(const Message& message) { // Determine whether the recipient created // a listening endpoint. - regex = QRegExp("Listening: ([^\r\n]+)\r\n"); + regex = TQRegExp("Listening: ([^\r\n]+)\r\n"); regex.search(body); bool isListening = (regex.cap(1) == "true"); @@ -281,16 +281,16 @@ void OutgoingTransfer::processMessage(const Message& message) if(isListening) { // Retrieve the hashed nonce for this direct connection instance. - regex = QRegExp("Hashed-Nonce: \\{([0-9A-F\\-]*)\\}\r\n"); + regex = TQRegExp("Hashed-Nonce: \\{([0-9A-F\\-]*)\\}\r\n"); regex.search(body); m_nonce = regex.cap(1); // Retrieve the listening endpoints of the receiving client. - regex = QRegExp("IPv4Internal-Addrs: ([^\r\n]+)\r\n"); + regex = TQRegExp("IPv4Internal-Addrs: ([^\r\n]+)\r\n"); regex.search(body); - m_peerEndpoints = QStringList::split(" ", regex.cap(1)); + m_peerEndpoints = TQStringList::split(" ", regex.cap(1)); m_endpointIterator = m_peerEndpoints.begin(); // Retrieve the listening port of the receiving client. - regex = QRegExp("IPv4Internal-Port: ([^\r\n]+)\r\n"); + regex = TQRegExp("IPv4Internal-Port: ([^\r\n]+)\r\n"); regex.search(body); m_remotePort = regex.cap(1); @@ -336,7 +336,7 @@ void OutgoingTransfer::readyToSend() slotSendData(); } -void OutgoingTransfer::connectToEndpoint(const QString& hostName) +void OutgoingTransfer::connectToEndpoint(const TQString& hostName) { m_socket = new KBufferedSocket(hostName, m_remotePort); m_socket->setBlocking(false); @@ -345,10 +345,10 @@ void OutgoingTransfer::connectToEndpoint(const QString& hostName) // when we are ready to sent data. // NOTE readyWrite consumes too much cpu usage. m_socket->enableWrite(false); - QObject::connect(m_socket, SIGNAL(readyRead()), this, SLOT(slotRead())); - QObject::connect(m_socket, SIGNAL(connected(const KResolverEntry&)), this, SLOT(slotConnected())); - QObject::connect(m_socket, SIGNAL(gotError(int)), this, SLOT(slotSocketError(int))); - QObject::connect(m_socket, SIGNAL(closed()), this, SLOT(slotSocketClosed())); + TQObject::connect(m_socket, TQT_SIGNAL(readyRead()), this, TQT_SLOT(slotRead())); + TQObject::connect(m_socket, TQT_SIGNAL(connected(const KResolverEntry&)), this, TQT_SLOT(slotConnected())); + TQObject::connect(m_socket, TQT_SIGNAL(gotError(int)), this, TQT_SLOT(slotSocketError(int))); + TQObject::connect(m_socket, TQT_SIGNAL(closed()), this, TQT_SLOT(slotSocketClosed())); // Try to connect to the endpoint. m_socket->connect(); } @@ -357,13 +357,13 @@ void OutgoingTransfer::slotConnected() { kdDebug(14140) << k_funcinfo << endl; // Check if connection is ok. - Q_UINT32 bytesWritten = m_socket->writeBlock(QCString("foo").data(), 4); + Q_UINT32 bytesWritten = m_socket->writeBlock(TQCString("foo").data(), 4); if(bytesWritten != 4) { // Not all data was written, close the socket. m_socket->closeNow(); // Schedule the data to be sent through the existing session. - QTimer::singleShot(2000, this, SLOT(slotSendData())); + TQTimer::singleShot(2000, this, TQT_SLOT(slotSendData())); return; } @@ -377,7 +377,7 @@ void OutgoingTransfer::slotConnected() // Set the flag to indicate that this is // a direct connection handshake message. handshake.header.flag = 0x100; - QString nonce = m_nonce.remove('-'); + TQString nonce = m_nonce.remove('-'); handshake.header.ackSessionIdentifier = nonce.mid(0, 8).toUInt(0, 16); handshake.header.ackUniqueIdentifier = nonce.mid(8, 4).toUInt(0, 16) | (nonce.mid(12, 4).toUInt(0, 16) << 16); @@ -386,7 +386,7 @@ void OutgoingTransfer::slotConnected() handshake.header.ackDataSize = ((Q_INT64)htonl(lo)) | (((Q_INT64)htonl(hi)) << 32); - QByteArray stream; + TQByteArray stream; // Write the message to the memory stream. m_messageFormatter.writeMessage(handshake, stream, true); // Send the byte stream over the wire. @@ -418,7 +418,7 @@ void OutgoingTransfer::slotSocketError(int) { // Otherwise, send the data through the session. m_identifier -= 1; - QTimer::singleShot(2000, this, SLOT(slotSendData())); + TQTimer::singleShot(2000, this, TQT_SLOT(slotSendData())); } } |