summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/yahoo/libkyahoo/webcamtask.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kopete/protocols/yahoo/libkyahoo/webcamtask.cpp')
-rw-r--r--kopete/protocols/yahoo/libkyahoo/webcamtask.cpp118
1 files changed, 59 insertions, 59 deletions
diff --git a/kopete/protocols/yahoo/libkyahoo/webcamtask.cpp b/kopete/protocols/yahoo/libkyahoo/webcamtask.cpp
index fe3c6d7c..2ad978f2 100644
--- a/kopete/protocols/yahoo/libkyahoo/webcamtask.cpp
+++ b/kopete/protocols/yahoo/libkyahoo/webcamtask.cpp
@@ -21,10 +21,10 @@
#include "yahootypes.h"
#include "client.h"
-#include <qbuffer.h>
-#include <qfile.h>
-#include <qtimer.h>
-#include <qpixmap.h>
+#include <tqbuffer.h>
+#include <tqfile.h>
+#include <tqtimer.h>
+#include <tqpixmap.h>
#include <ktempfile.h>
#include <kprocess.h>
#include <kstreamsocket.h>
@@ -73,7 +73,7 @@ bool WebcamTask::forMe( const Transfer* transfer ) const
return false;
}
-void WebcamTask::requestWebcam( const QString &who )
+void WebcamTask::requestWebcam( const TQString &who )
{
kdDebug(YAHOO_RAW_DEBUG) ;
@@ -108,12 +108,12 @@ void WebcamTask::parseWebcamInformation( YMSGTransfer *t )
kdDebug(YAHOO_RAW_DEBUG) << "Got WebcamInformation: Sender: " << info.sender << " Server: " << info.server << " Key: " << info.key << endl;
- KStreamSocket *socket = new KStreamSocket( info.server, QString::number(5100) );
+ KStreamSocket *socket = new KStreamSocket( info.server, TQString::number(5100) );
socketMap[socket] = info;
socket->enableRead( true );
- connect( socket, SIGNAL( connected( const KResolverEntry& ) ), this, SLOT( slotConnectionStage1Established() ) );
- connect( socket, SIGNAL( gotError(int) ), this, SLOT( slotConnectionFailed(int) ) );
- connect( socket, SIGNAL( readyRead() ), this, SLOT( slotRead() ) );
+ connect( socket, TQT_SIGNAL( connected( const KResolverEntry& ) ), this, TQT_SLOT( slotConnectionStage1Established() ) );
+ connect( socket, TQT_SIGNAL( gotError(int) ), this, TQT_SLOT( slotConnectionFailed(int) ) );
+ connect( socket, TQT_SIGNAL( readyRead() ), this, TQT_SLOT( slotRead() ) );
socket->connect();
}
@@ -124,23 +124,23 @@ void WebcamTask::slotConnectionStage1Established()
if( !socket )
return;
kdDebug(YAHOO_RAW_DEBUG) << "Webcam connection Stage1 to the user " << socketMap[socket].sender << " established." << endl;
- disconnect( socket, SIGNAL( connected( const KResolverEntry& ) ), this, SLOT( slotConnectionStage1Established() ) );
- disconnect( socket, SIGNAL( gotError(int) ), this, SLOT( slotConnectionFailed(int) ) );
+ disconnect( socket, TQT_SIGNAL( connected( const KResolverEntry& ) ), this, TQT_SLOT( slotConnectionStage1Established() ) );
+ disconnect( socket, TQT_SIGNAL( gotError(int) ), this, TQT_SLOT( slotConnectionFailed(int) ) );
socketMap[socket].status = ConnectedStage1;
- QByteArray buffer;
- QDataStream stream( buffer, IO_WriteOnly );
- QString s;
+ TQByteArray buffer;
+ TQDataStream stream( buffer, IO_WriteOnly );
+ TQString s;
if( socketMap[socket].direction == Incoming )
{
- socket->writeBlock( QCString("<RVWCFG>").data(), 8 );
- s = QString("g=%1\r\n").arg(socketMap[socket].sender);
+ socket->writeBlock( TQCString("<RVWCFG>").data(), 8 );
+ s = TQString("g=%1\r\n").arg(socketMap[socket].sender);
}
else
{
- socket->writeBlock( QCString("<RUPCFG>").data(), 8 );
- s = QString("f=1\r\n");
+ socket->writeBlock( TQCString("<RUPCFG>").data(), 8 );
+ s = TQString("f=1\r\n");
}
// Header: 08 00 01 00 00 00 00
@@ -157,21 +157,21 @@ void WebcamTask::slotConnectionStage2Established()
return;
kdDebug(YAHOO_RAW_DEBUG) << "Webcam connection Stage2 to the user " << socketMap[socket].sender << " established." << endl;
- disconnect( socket, SIGNAL( connected( const KResolverEntry& ) ), this, SLOT( slotConnectionStage2Established() ) );
- disconnect( socket, SIGNAL( gotError(int) ), this, SLOT( slotConnectionFailed(int) ) );
+ disconnect( socket, TQT_SIGNAL( connected( const KResolverEntry& ) ), this, TQT_SLOT( slotConnectionStage2Established() ) );
+ disconnect( socket, TQT_SIGNAL( gotError(int) ), this, TQT_SLOT( slotConnectionFailed(int) ) );
socketMap[socket].status = ConnectedStage2;
- QByteArray buffer;
- QDataStream stream( buffer, IO_WriteOnly );
- QString s;
+ TQByteArray buffer;
+ TQDataStream stream( buffer, IO_WriteOnly );
+ TQString s;
if( socketMap[socket].direction == Incoming )
{
// Send <REQIMG>-Packet
- socket->writeBlock( QCString("<REQIMG>").data(), 8 );
+ socket->writeBlock( TQCString("<REQIMG>").data(), 8 );
// Send request information
- s = QString("a=2\r\nc=us\r\ne=21\r\nu=%1\r\nt=%2\r\ni=\r\ng=%3\r\no=w-2-5-1\r\np=1")
+ s = TQString("a=2\r\nc=us\r\ne=21\r\nu=%1\r\nt=%2\r\ni=\r\ng=%3\r\no=w-2-5-1\r\np=1")
.arg(client()->userId()).arg(socketMap[socket].key).arg(socketMap[socket].sender);
// Header: 08 00 01 00 00 00 00
stream << (Q_INT8)0x08 << (Q_INT8)0x00 << (Q_INT8)0x01 << (Q_INT8)0x00 << (Q_INT32)s.length();
@@ -179,9 +179,9 @@ void WebcamTask::slotConnectionStage2Established()
else
{
// Send <REQIMG>-Packet
- socket->writeBlock( QCString("<SNDIMG>").data(), 8 );
+ socket->writeBlock( TQCString("<SNDIMG>").data(), 8 );
// Send request information
- s = QString("a=2\r\nc=us\r\nu=%1\r\nt=%2\r\ni=%3\r\no=w-2-5-1\r\np=2\r\nb=KopeteWebcam\r\nd=\r\n")
+ s = TQString("a=2\r\nc=us\r\nu=%1\r\nt=%2\r\ni=%3\r\no=w-2-5-1\r\np=2\r\nb=KopeteWebcam\r\nd=\r\n")
.arg(client()->userId()).arg(socketMap[socket].key).arg(socket->localAddress().nodeName());
// Header: 08 00 05 00 00 00 00 01 00 00 00 01
stream << (Q_INT8)0x0d << (Q_INT8)0x00 << (Q_INT8)0x05 << (Q_INT8)0x00 << (Q_INT32)s.length()
@@ -197,7 +197,7 @@ void WebcamTask::slotConnectionFailed( int error )
KStreamSocket* socket = const_cast<KStreamSocket*>( dynamic_cast<const KStreamSocket*>( sender() ) );
kdDebug(YAHOO_RAW_DEBUG) << "Webcam connection to the user " << socketMap[socket].sender << " failed. Error " << error << " - " << socket->errorString() << endl;
client()->notifyError( i18n("Webcam connection to the user %1 could not be established.\n\nPlease relogin and try again.")
- .arg(socketMap[socket].sender), QString("%1 - %2").arg(error).arg( socket->errorString()), Client::Error );
+ .arg(socketMap[socket].sender), TQString("%1 - %2").arg(error).arg( socket->errorString()), Client::Error );
socketMap.remove( socket );
socket->deleteLater();
}
@@ -211,7 +211,7 @@ void WebcamTask::slotRead()
switch( socketMap[socket].status )
{
case ConnectedStage1:
- disconnect( socket, SIGNAL( readyRead() ), this, SLOT( slotRead() ) );
+ disconnect( socket, TQT_SIGNAL( readyRead() ), this, TQT_SLOT( slotRead() ) );
connectStage2( socket );
break;
case ConnectedStage2:
@@ -226,13 +226,13 @@ void WebcamTask::slotRead()
void WebcamTask::connectStage2( KStreamSocket *socket )
{
kdDebug(YAHOO_RAW_DEBUG) ;
- QByteArray data( socket->bytesAvailable() );
+ TQByteArray data( socket->bytesAvailable() );
socket->readBlock ( data.data (), data.size () );
kdDebug(YAHOO_RAW_DEBUG) << "Magic Byte:" << data[2] << endl;
socketMap[socket].status = ConnectedStage2;
- QString server;
+ TQString server;
int i = 4;
KStreamSocket *newSocket;
switch( (const char)data[2] )
@@ -252,16 +252,16 @@ void WebcamTask::connectStage2( KStreamSocket *socket )
}
kdDebug(YAHOO_RAW_DEBUG) << "Connecting to " << server << endl;
- newSocket = new KStreamSocket( server, QString::number(5100) );
+ newSocket = new KStreamSocket( server, TQString::number(5100) );
socketMap[newSocket] = socketMap[socket];
newSocket->enableRead( true );
- connect( newSocket, SIGNAL( connected( const KResolverEntry& ) ), this, SLOT( slotConnectionStage2Established() ) );
- connect( newSocket, SIGNAL( gotError(int) ), this, SLOT( slotConnectionFailed(int) ) );
- connect( newSocket, SIGNAL( readyRead() ), this, SLOT( slotRead() ) );
+ connect( newSocket, TQT_SIGNAL( connected( const KResolverEntry& ) ), this, TQT_SLOT( slotConnectionStage2Established() ) );
+ connect( newSocket, TQT_SIGNAL( gotError(int) ), this, TQT_SLOT( slotConnectionFailed(int) ) );
+ connect( newSocket, TQT_SIGNAL( readyRead() ), this, TQT_SLOT( slotRead() ) );
if( socketMap[newSocket].direction == Outgoing )
{
newSocket->enableWrite( true );
- connect( newSocket, SIGNAL( readyWrite() ), this, SLOT( transmitWebcamImage() ) );
+ connect( newSocket, TQT_SIGNAL( readyWrite() ), this, TQT_SLOT( transmitWebcamImage() ) );
}
newSocket->connect();
@@ -275,7 +275,7 @@ void WebcamTask::connectStage2( KStreamSocket *socket )
void WebcamTask::processData( KStreamSocket *socket )
{
- QByteArray data( socket->bytesAvailable() );
+ TQByteArray data( socket->bytesAvailable() );
socket->readBlock ( data.data (), data.size () );
@@ -288,7 +288,7 @@ void WebcamTask::processData( KStreamSocket *socket )
parseData( data, socket );
}
-void WebcamTask::parseData( QByteArray &data, KStreamSocket *socket )
+void WebcamTask::parseData( TQByteArray &data, KStreamSocket *socket )
{
int headerLength = 0;
int read = 0;
@@ -310,7 +310,7 @@ void WebcamTask::parseData( QByteArray &data, KStreamSocket *socket )
kdDebug() << data[8] << data[9] << data[10] << data[11] << data[12] << endl;
info->timestamp = yahoo_get32(data.data() + 9);
kdDebug(YAHOO_RAW_DEBUG) << "PacketType: " << data[8] << " reason: " << info->reason << " timestamp: " << info->timestamp << endl;
- QStringList::iterator it;
+ TQStringList::iterator it;
switch( data[8] )
{
case 0x00:
@@ -384,8 +384,8 @@ void WebcamTask::parseData( QByteArray &data, KStreamSocket *socket )
{
// More headers to read
kdDebug(YAHOO_RAW_DEBUG) << "More data to read..." << endl;
- QByteArray newData( data.size() - headerLength );
- QDataStream stream( newData, IO_WriteOnly );
+ TQByteArray newData( data.size() - headerLength );
+ TQDataStream stream( newData, IO_WriteOnly );
stream.writeRawBytes( data.data() + headerLength, data.size() - headerLength );
parseData( newData, socket );
return;
@@ -408,7 +408,7 @@ void WebcamTask::parseData( QByteArray &data, KStreamSocket *socket )
if( !info->buffer )
{
kdDebug(YAHOO_RAW_DEBUG) << "Buffer created" << endl;
- info->buffer = new QBuffer();
+ info->buffer = new TQBuffer();
info->buffer->open( IO_WriteOnly );
}
@@ -419,7 +419,7 @@ void WebcamTask::parseData( QByteArray &data, KStreamSocket *socket )
if( info->buffer->size() >= static_cast<uint>(info->dataLength) )
{
info->buffer->close();
- QString who;
+ TQString who;
switch( info->type )
{
case UserRequest:
@@ -450,7 +450,7 @@ void WebcamTask::parseData( QByteArray &data, KStreamSocket *socket )
break;
case Image:
{
- QPixmap webcamImage;
+ TQPixmap webcamImage;
//webcamImage.loadFromData( info->buffer->buffer() );
// FIXME (same)
@@ -466,7 +466,7 @@ void WebcamTask::parseData( QByteArray &data, KStreamSocket *socket )
KTempFile jpcTmpImageFile;
KTempFile bmpTmpImageFile;
- QFile *file = jpcTmpImageFile.file();
+ TQFile *file = jpcTmpImageFile.file();
file->writeBlock((info->buffer->buffer()).data(), info->buffer->size());
file->close();
@@ -485,8 +485,8 @@ void WebcamTask::parseData( QByteArray &data, KStreamSocket *socket )
/******* UPTO THIS POINT ******/
emit webcamImageReceived( info->sender, webcamImage );
}
- QFile::remove(jpcTmpImageFile.name());
- QFile::remove(bmpTmpImageFile.name());
+ TQFile::remove(jpcTmpImageFile.name());
+ TQFile::remove(bmpTmpImageFile.name());
kdDebug(YAHOO_RAW_DEBUG) << "Image Received. Size: " << webcamImage.size() << endl;
}
@@ -503,8 +503,8 @@ void WebcamTask::parseData( QByteArray &data, KStreamSocket *socket )
{
// More headers to read
kdDebug(YAHOO_RAW_DEBUG) << "More data to read..." << data.size() - read << endl;
- QByteArray newData( data.size() - read );
- QDataStream stream( newData, IO_WriteOnly );
+ TQByteArray newData( data.size() - read );
+ TQDataStream stream( newData, IO_WriteOnly );
stream.writeRawBytes( data.data() + read, data.size() - read );
parseData( newData, socket );
}
@@ -520,7 +520,7 @@ void WebcamTask::cleanUpConnection( KStreamSocket *socket )
delete socket;
}
-void WebcamTask::closeWebcam( const QString & who )
+void WebcamTask::closeWebcam( const TQString & who )
{
kdDebug(YAHOO_RAW_DEBUG) ;
SocketInfoMap::Iterator it;
@@ -552,14 +552,14 @@ void WebcamTask::registerWebcam()
send( t );
}
-void WebcamTask::addPendingInvitation( const QString &userId )
+void WebcamTask::addPendingInvitation( const TQString &userId )
{
kdDebug(YAHOO_RAW_DEBUG) << "Inviting " << userId << " to watch the webcam." << endl;
pendingInvitations.append( userId );
accessGranted.append( userId );
}
-void WebcamTask::grantAccess( const QString &userId )
+void WebcamTask::grantAccess( const TQString &userId )
{
kdDebug(YAHOO_RAW_DEBUG) ;
KStreamSocket *socket = 0L;
@@ -577,9 +577,9 @@ void WebcamTask::grantAccess( const QString &userId )
kdDebug(YAHOO_RAW_DEBUG) << "Error. No outgoing socket found." << endl;
return;
}
- QByteArray ar;
- QDataStream stream( ar, IO_WriteOnly );
- QString user = QString("u=%1").arg(userId);
+ TQByteArray ar;
+ TQDataStream stream( ar, IO_WriteOnly );
+ TQString user = TQString("u=%1").arg(userId);
stream << (Q_INT8)0x0d << (Q_INT8)0x00 << (Q_INT8)0x05 << (Q_INT8)0x00 << (Q_INT32)user.length()
<< (Q_INT8)0x00 << (Q_INT8)0x00 << (Q_INT8)0x00 << (Q_INT8)0x00 << (Q_INT8)0x01;
@@ -635,11 +635,11 @@ void WebcamTask::sendEmptyWebcamImage()
pictureBuffer.resize( 0 );
transmissionPending = true;
- QTimer::singleShot( 1000, this, SLOT(sendEmptyWebcamImage()) );
+ TQTimer::singleShot( 1000, this, TQT_SLOT(sendEmptyWebcamImage()) );
}
-void WebcamTask::sendWebcamImage( const QByteArray &image )
+void WebcamTask::sendWebcamImage( const TQByteArray &image )
{
kdDebug(YAHOO_RAW_DEBUG) ;
pictureBuffer = image;
@@ -687,8 +687,8 @@ void WebcamTask::transmitWebcamImage()
}
socket->enableWrite( false );
- QByteArray buffer;
- QDataStream stream( buffer, IO_WriteOnly );
+ TQByteArray buffer;
+ TQDataStream stream( buffer, IO_WriteOnly );
stream << (Q_INT8)0x0d << (Q_INT8)0x00 << (Q_INT8)0x05 << (Q_INT8)0x00 << (Q_INT32)pictureBuffer.size()
<< (Q_INT8)0x02 << (Q_INT32)timestamp++;
socket->writeBlock( buffer.data(), buffer.size() );