[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdenetwork/kopete/protocols/yahoo/libkyahoo
From: Michael Anthony Cole <colemichae () gmail ! com>
Date: 2010-01-19 1:46:52
Message-ID: 1263865612.142088.30051.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1076893 by michaelacole:
Yahoo webcam changes this mod makes sure the webcam starts every time and that you \
can invite more users while in a webcam session michaelacole
M +35 -8 webcamtask.cpp
M +1 -0 webcamtask.h
--- trunk/KDE/kdenetwork/kopete/protocols/yahoo/libkyahoo/webcamtask.cpp \
#1076892:1076893 @@ -98,13 +98,18 @@
info.dataLength = 0;
info.buffer = 0L;
info.headerRead = false;
+ if(info.sender.isEmpty()){
+ info.server = t->firstParam( 4 );
+ }
if( info.sender == client()->userId() )
{
transmittingData = true;
info.direction = Outgoing;
}
else
+ {
info.direction = Incoming;
+ }
kDebug(YAHOO_RAW_DEBUG) << "Got WebcamInformation: Sender: " << info.sender << " \
Server: " << info.server << " Key: " << info.key;
@@ -115,7 +120,8 @@
connect( socket, SIGNAL( gotError(int) ), this, SLOT( slotConnectionFailed(int) ) \
); connect( socket, SIGNAL( readyRead() ), this, SLOT( slotRead() ) );
- socket->connect();
+ socket->connect();
+
}
void WebcamTask::slotConnectionStage1Established()
@@ -165,7 +171,7 @@
QDataStream stream( &buffer, QIODevice::WriteOnly );
QString s;
-
+
if( socketMap[socket].direction == Incoming )
{
// Send <REQIMG>-Packet
@@ -278,7 +284,6 @@
data.reserve( socket->bytesAvailable() );
data = socket->readAll();
-
if( data.size() <= 0 )
{
kDebug(YAHOO_RAW_DEBUG) << "No data read.";
@@ -350,19 +355,24 @@
info->status = SendingEmpty;
emit stopTransmission();
sendEmptyWebcamImage();
+
}
-
- // Send Invitation packets
+ // Send very first Invitation packets
for(it = pendingInvitations.begin(); it != pendingInvitations.end(); it++)
{
+ kDebug(YAHOO_RAW_DEBUG) << "send primary invitation";
SendNotifyTask *snt = new SendNotifyTask( parent() );
snt->setTarget( *it );
snt->setType( SendNotifyTask::NotifyWebcamInvite );
snt->go( true );
it = pendingInvitations.erase( it );
it--;
+ info->status = SendingEmpty;
+ emit stopTransmission();
+ sendEmptyWebcamImage();
}
- break;
+
+ break;
case 0x07:
info->type = ConnectionClosed;
@@ -412,7 +422,6 @@
info->buffer = new QBuffer();
info->buffer->open( QIODevice::WriteOnly );
}
-
kDebug(YAHOO_RAW_DEBUG) << "data.size() " << data.size() << " headerLength " << \
headerLength << " buffersize " << info->buffer->size(); read = headerLength + \
info->dataLength - info->buffer->size(); info->buffer->write( data.data() + \
headerLength, data.size() - headerLength );//info->dataLength - info->buffer->size() \
); @@ -552,6 +561,7 @@
kDebug(YAHOO_RAW_DEBUG) << "Inviting " << userId << " to watch the webcam.";
pendingInvitations.append( userId );
accessGranted.append( userId );
+
}
void WebcamTask::grantAccess( const QString &userId )
@@ -629,11 +639,27 @@
pictureBuffer.resize( 0 );
transmissionPending = true;
-
+ doPendingInvitations();
QTimer::singleShot( 1000, this, SLOT(sendEmptyWebcamImage()) );
}
+void WebcamTask::doPendingInvitations()
+{
+ QStringList::iterator itb;
+ for(itb = pendingInvitations.begin(); itb != pendingInvitations.end(); itb++)
+ {
+ kDebug(YAHOO_RAW_DEBUG) << "send invitation when no users";
+ SendNotifyTask *snt = new SendNotifyTask( parent() );
+ snt->setTarget( *itb );
+ snt->setType( SendNotifyTask::NotifyWebcamInvite );
+ snt->go( true );
+ itb = pendingInvitations.erase( itb );
+ itb--;
+ }
+
+}
+
void WebcamTask::sendWebcamImage( const QByteArray &image )
{
kDebug(YAHOO_RAW_DEBUG) ;
@@ -641,6 +667,7 @@
transmissionPending = true;
KStreamSocket *socket = 0L;
SocketInfoMap::Iterator it;
+ doPendingInvitations();
for( it = socketMap.begin(); it != socketMap.end(); it++ )
{
if( it.value().direction == Outgoing )
--- trunk/KDE/kdenetwork/kopete/protocols/yahoo/libkyahoo/webcamtask.h \
#1076892:1076893 @@ -89,6 +89,7 @@
void slotConnectionFailed(int);
void slotRead();
void sendEmptyWebcamImage();
+ void doPendingInvitations();
void transmitWebcamImage();
protected:
virtual bool forMe( const Transfer* transfer ) const;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic