summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/msn/dispatcher.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-22 00:30:31 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-22 00:30:31 +0000
commit69cac65817d949cda2672ec4f0aa73d5e66a0ba1 (patch)
tree073fde0496ea90eb5bf5cffe66a8da43a9f55fbc /kopete/protocols/msn/dispatcher.cpp
parent3467e6464beac3a162839bf7078e22e3a74d73e7 (diff)
downloadtdenetwork-69cac65817d949cda2672ec4f0aa73d5e66a0ba1.tar.gz
tdenetwork-69cac65817d949cda2672ec4f0aa73d5e66a0ba1.zip
TQt4 port kdenetwork
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1237912 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/protocols/msn/dispatcher.cpp')
-rw-r--r--kopete/protocols/msn/dispatcher.cpp78
1 files changed, 39 insertions, 39 deletions
diff --git a/kopete/protocols/msn/dispatcher.cpp b/kopete/protocols/msn/dispatcher.cpp
index fb88e8bc..91f3361a 100644
--- a/kopete/protocols/msn/dispatcher.cpp
+++ b/kopete/protocols/msn/dispatcher.cpp
@@ -36,7 +36,7 @@ using P2P::OutgoingTransfer;
#include <kstandarddirs.h>
#include <ktempfile.h>
-// Qt includes
+// TQt includes
#include <tqdatastream.h>
#include <tqfile.h>
#include <tqregexp.h>
@@ -50,8 +50,8 @@ using P2P::OutgoingTransfer;
#include <stdlib.h>
-Dispatcher::Dispatcher(TQObject *parent, const TQString& contact, const TQStringList &ip)
- : TQObject(parent) , m_contact(contact) , m_callbackChannel(0l) , m_ip(ip)
+Dispatcher::Dispatcher(TQObject *tqparent, const TQString& contact, const TQStringList &ip)
+ : TQObject(tqparent) , m_contact(contact) , m_callbackChannel(0l) , m_ip(ip)
{}
Dispatcher::~Dispatcher()
@@ -78,7 +78,7 @@ TQString Dispatcher::localContact()
void Dispatcher::requestDisplayIcon(const TQString& from, const TQString& msnObject)
{
- Q_UINT32 sessionId = rand()%0xFFFFFF00 + 4;
+ TQ_UINT32 sessionId = rand()%0xFFFFFF00 + 4;
TransferContext* current =
new IncomingTransfer(from, this, sessionId);
@@ -94,7 +94,7 @@ void Dispatcher::requestDisplayIcon(const TQString& from, const TQString& msnObj
TQString context = TQString::fromUtf8(KCodecs::base64Encode(msnObject.utf8()));
// NOTE remove the \0 character automatically
// appended to a TQCString.
- context.replace("=", TQString::null);
+ context.tqreplace("=", TQString());
TQString content =
"EUF-GUID: {A4268EEC-FEC5-49E5-95C3-F126696BDBF6}\r\n"
"SessionID: " + TQString::number(sessionId) + "\r\n"
@@ -105,11 +105,11 @@ void Dispatcher::requestDisplayIcon(const TQString& from, const TQString& msnObj
current->sendMessage(INVITE, content);
}
-void Dispatcher::sendFile(const TQString& path, Q_INT64 fileSize, const TQString& to)
+void Dispatcher::sendFile(const TQString& path, TQ_INT64 fileSize, const TQString& to)
{
// Create a new transfer context that will handle
// the file transfer.
- Q_UINT32 sessionId = rand()%0xFFFFFF00 + 4;
+ TQ_UINT32 sessionId = rand()%0xFFFFFF00 + 4;
TransferContext *current =
new OutgoingTransfer(to, this, sessionId);
current->m_branch = P2P::Uid::createUid();
@@ -129,26 +129,26 @@ void Dispatcher::sendFile(const TQString& path, Q_INT64 fileSize, const TQString
writer.setByteOrder(TQDataStream::LittleEndian);
// Write the header length to the stream.
- writer << (Q_INT32)638;
+ writer << (TQ_INT32)638;
// Write client version to the stream.
- writer << (Q_INT32)3;
+ writer << (TQ_INT32)3;
// Write the file size to the stream.
writer << fileSize;
// Write the file transfer flag to the stream.
// TODO support file preview. For now disable file preview.
- writer << (Q_INT32)1;
+ writer << (TQ_INT32)1;
// Write the file name in utf-16 to the stream.
TQTextStream ts(header, IO_WriteOnly);
ts.setEncoding(TQTextStream::RawUnicode);
- ts.device()->at(20);
+ ts.tqdevice()->tqat(20);
ts << path.section('/', -1);
// NOTE Background Sharing base64 [540..569]
// TODO add support for background sharing.
// Write file exchange type to the stream.
// NOTE File - 0xFFFFFFFF
// NOTE Background Sharing - 0xFFFFFFFE
- writer.device()->at(570);
- writer << (Q_UINT32)0xFFFFFFFF;
+ writer.tqdevice()->tqat(570);
+ writer << (TQ_UINT32)0xFFFFFFFF;
// Encode the file context header to base64 encoding.
context = TQString::fromUtf8(KCodecs::base64Encode(header));
@@ -182,7 +182,7 @@ void Dispatcher::sendImage(const TQString& /*fileName*/, const TQString& /*to*/)
#if MSN_WEBCAM
void Dispatcher::startWebcam(const TQString &/*myHandle*/, const TQString &msgHandle, bool wantToReceive)
{
- Q_UINT32 sessionId = rand()%0xFFFFFF00 + 4;
+ TQ_UINT32 sessionId = rand()%0xFFFFFF00 + 4;
Webcam::Who who= wantToReceive ? Webcam::wViewer : Webcam::wProducer;
TransferContext* current =
new Webcam(who, msgHandle, this, sessionId);
@@ -200,7 +200,7 @@ void Dispatcher::startWebcam(const TQString &/*myHandle*/, const TQString &msgHa
TQString content="EUF-GUID: {"+GUID+"}\r\n"
"SessionID: "+ TQString::number(sessionId)+"\r\n"
"AppID: 4\r\n"
- "Context: ewBCADgAQgBFADcAMABEAEUALQBFADIAQwBBAC0ANAA0ADAAMAAtAEEARQAwADMALQA4ADgARgBGADgANQBCADkARgA0AEUAOAB9AA==\r\n\r\n";
+ "Context: ewBCADgAQgBFADcAMABEAEUALTQBFADIAQwBBAC0ANAA0ADAAMAAtAEEARTQAwADMALQA4ADgARgBGADgANTQBCADkARgA0AEUAOAB9AA==\r\n\r\n";
// context is the base64 of the utf16 of {B8BE70DE-E2CA-4400-AE03-88FF85B9F4E8}
@@ -222,7 +222,7 @@ void Dispatcher::slotReadMessage(const TQString &from, const TQByteArray& stream
if((receivedMessage.header.dataSize == 0)/* && ((receivedMessage.header.flag & 0x02) == 0x02)*/)
{
TransferContext *current = 0l;
- TQMap<Q_UINT32, TransferContext*>::Iterator it = m_sessions.begin();
+ TQMap<TQ_UINT32, TransferContext*>::Iterator it = m_sessions.begin();
for(; it != m_sessions.end(); it++)
{
if(receivedMessage.header.ackSessionIdentifier == it.data()->m_identifier){
@@ -247,10 +247,10 @@ void Dispatcher::slotReadMessage(const TQString &from, const TQByteArray& stream
return;
}
- if(m_messageBuffer.contains(receivedMessage.header.identifier))
+ if(m_messageBuffer.tqcontains(receivedMessage.header.identifier))
{
kdDebug(14140) << k_funcinfo
- << TQString("retrieving buffered messsage, %1").arg(receivedMessage.header.identifier)
+ << TQString("retrieving buffered messsage, %1").tqarg(receivedMessage.header.identifier)
<< endl;
// The message was split, try to reconstruct the message
@@ -260,7 +260,7 @@ void Dispatcher::slotReadMessage(const TQString &from, const TQByteArray& stream
m_messageBuffer.remove(receivedMessage.header.identifier);
bufferedMessage.body.resize(bufferedMessage.body.size() + receivedMessage.header.dataSize);
- for(Q_UINT32 i=0; i < receivedMessage.header.dataSize; i++){
+ for(TQ_UINT32 i=0; i < receivedMessage.header.dataSize; i++){
// Add the remaining message data to the buffered message.
bufferedMessage.body[receivedMessage.header.dataOffset + i] = receivedMessage.body[i];
}
@@ -282,7 +282,7 @@ void Dispatcher::dispatch(const P2P::Message& message)
if(message.header.sessionId > 0)
{
- if(m_sessions.contains(message.header.sessionId)){
+ if(m_sessions.tqcontains(message.header.sessionId)){
messageHandler = m_sessions[message.header.sessionId];
}
}
@@ -293,8 +293,8 @@ void Dispatcher::dispatch(const P2P::Message& message)
TQRegExp regex("SessionID: ([0-9]*)\r\n");
if(regex.search(body) > 0)
{
- Q_UINT32 sessionId = regex.cap(1).toUInt();
- if(m_sessions.contains(sessionId)){
+ TQ_UINT32 sessionId = regex.cap(1).toUInt();
+ if(m_sessions.tqcontains(sessionId)){
// Retrieve the message handler associated with the specified session Id.
messageHandler = m_sessions[sessionId];
}
@@ -303,7 +303,7 @@ void Dispatcher::dispatch(const P2P::Message& message)
{
// Otherwise, try to retrieve the message handler
// based on the acknowlegded unique identifier.
- if(m_sessions.contains(message.header.ackUniqueIdentifier)){
+ if(m_sessions.tqcontains(message.header.ackUniqueIdentifier)){
messageHandler =
m_sessions[message.header.ackUniqueIdentifier];
}
@@ -317,7 +317,7 @@ void Dispatcher::dispatch(const P2P::Message& message)
TQString callId = regex.cap(1);
TransferContext *current = 0l;
- TQMap<Q_UINT32, TransferContext*>::Iterator it = m_sessions.begin();
+ TQMap<TQ_UINT32, TransferContext*>::Iterator it = m_sessions.begin();
for(; it != m_sessions.end(); it++)
{
current = it.data();
@@ -347,7 +347,7 @@ void Dispatcher::dispatch(const P2P::Message& message)
// The entire message has not been received;
// buffer the recevied portion of the original message.
kdDebug(14140) << k_funcinfo
- << TQString("Buffering messsage, %1").arg(message.header.identifier)
+ << TQString("Buffering messsage, %1").tqarg(message.header.identifier)
<< endl;
m_messageBuffer.insert(message.header.identifier, message);
return;
@@ -380,7 +380,7 @@ void Dispatcher::dispatch(const P2P::Message& message)
// is being requested.
regex = TQRegExp("AppID: ([0-9]*)\r\n");
regex.search(body);
- Q_UINT32 applicationId = regex.cap(1).toUInt();
+ TQ_UINT32 applicationId = regex.cap(1).toUInt();
if(applicationId == 1 || applicationId == 11 || applicationId == 12 )
{ //the AppID is 12 since Messenger 7.5
@@ -407,7 +407,7 @@ void Dispatcher::dispatch(const P2P::Message& message)
m_sessions.insert(sessionId.toUInt(), current);
// Determine the display icon being requested.
- TQString fileName = objectList.contains(msnobj)
+ TQString fileName = objectList.tqcontains(msnobj)
? objectList[msnobj]
: m_pictureUrl;
TQFile *source = new TQFile(fileName);
@@ -427,7 +427,7 @@ void Dispatcher::dispatch(const P2P::Message& message)
current->m_ackSessionIdentifier = message.header.identifier;
current->m_ackUniqueIdentifier = message.header.ackSessionIdentifier;
// Send a 200 OK message to the recipient.
- TQString content = TQString("SessionID: %1\r\n\r\n").arg(sessionId);
+ TQString content = TQString("SessionID: %1\r\n\r\n").tqarg(sessionId);
current->sendMessage(OK, content);
}
else if(applicationId == 2)
@@ -457,14 +457,14 @@ void Dispatcher::dispatch(const P2P::Message& message)
reader.setByteOrder(TQDataStream::LittleEndian);
//Retrieve the file info from the context field.
// File Size [8..15] Int64
- reader.device()->at(8);
- Q_INT64 fileSize;
+ reader.tqdevice()->tqat(8);
+ TQ_INT64 fileSize;
reader >> fileSize;
// Flag [15..18] Int32
// 0x00 File transfer with preview data.
// 0x01 File transfer without preview data.
// 0x02 Background sharing.
- Q_INT32 flag;
+ TQ_INT32 flag;
reader >> flag;
kdDebug(14140) << flag << endl;
// FileName UTF16 (Unicode) [19..539]
@@ -478,7 +478,7 @@ void Dispatcher::dispatch(const P2P::Message& message)
emit incomingTransfer(from, fileName, fileSize);
kdDebug(14140) <<
- TQString("%1, %2 bytes.").arg(fileName, TQString::number(fileSize))
+ TQString("%1, %2 bytes.").tqarg(fileName, TQString::number(fileSize))
<< endl
<< endl;
@@ -497,7 +497,7 @@ void Dispatcher::dispatch(const P2P::Message& message)
TQObject::connect(Kopete::TransferManager::transferManager(), TQT_SIGNAL(refused(const Kopete::FileTransferInfo&)), transfer, TQT_SLOT(slotTransferRefused(const Kopete::FileTransferInfo&)));
// Show the file transfer accept/decline dialog.
- Kopete::TransferManager::transferManager()->askIncomingTransfer(contact, fileName, fileSize, TQString::null, sessionId);
+ Kopete::TransferManager::transferManager()->askIncomingTransfer(contact, fileName, fileSize, TQString(), sessionId);
}
else
{
@@ -551,7 +551,7 @@ void Dispatcher::dispatch(const P2P::Message& message)
// A contact has sent an inkformat (handwriting) gif.
// NOTE The entire message body is UTF16 encoded.
TQString body = "";
- for (Q_UINT32 i=0; i < message.header.totalDataSize; i++){
+ for (TQ_UINT32 i=0; i < message.header.totalDataSize; i++){
if (message.body[i] != TQChar('\0')){
body += TQChar(message.body[i]);
}
@@ -590,7 +590,7 @@ void Dispatcher::messageAcknowledged(unsigned int correlationId, bool fullReceiv
if(fullReceive)
{
TransferContext *current = 0l;
- TQMap<Q_UINT32, TransferContext*>::Iterator it = m_sessions.begin();
+ TQMap<TQ_UINT32, TransferContext*>::Iterator it = m_sessions.begin();
for(; it != m_sessions.end(); it++)
{
current = it.data();
@@ -607,10 +607,10 @@ void Dispatcher::messageAcknowledged(unsigned int correlationId, bool fullReceiv
Kopete::Contact* Dispatcher::getContactByAccountId(const TQString& accountId)
{
Kopete::Contact *contact = 0l;
- if(parent())
+ if(tqparent())
{
// Retrieve the contact from the current chat session context.
- Kopete::ChatSession *session = dynamic_cast<Kopete::ChatSession*>(parent()->parent());
+ Kopete::ChatSession *session = dynamic_cast<Kopete::ChatSession*>(tqparent()->tqparent());
if(session)
{
contact = session->account()->contacts()[accountId];
@@ -628,7 +628,7 @@ Dispatcher::CallbackChannel::CallbackChannel(MSNSwitchBoardSocket *switchboard)
Dispatcher::CallbackChannel::~CallbackChannel()
{}
-Q_UINT32 Dispatcher::CallbackChannel::send(const TQByteArray& stream)
+TQ_UINT32 Dispatcher::CallbackChannel::send(const TQByteArray& stream)
{
return m_switchboard->sendCommand("MSG", "D", true, stream, true);
}
@@ -636,7 +636,7 @@ Q_UINT32 Dispatcher::CallbackChannel::send(const TQByteArray& stream)
Dispatcher::CallbackChannel* Dispatcher::callbackChannel()
{
if(m_callbackChannel == 0l){
- MSNSwitchBoardSocket *callback = dynamic_cast<MSNSwitchBoardSocket *>(parent());
+ MSNSwitchBoardSocket *callback = dynamic_cast<MSNSwitchBoardSocket *>(tqparent());
if(callback == 0l) return 0l;
m_callbackChannel = new Dispatcher::CallbackChannel(callback);
}