Bug 131218 - Webcam doesnt work for Yahoo Messenger Beta
Summary: Webcam doesnt work for Yahoo Messenger Beta
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Applications
Component: Yahoo Plugin (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
: 132178 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-07-22 19:56 UTC by Rajil Saraswat
Modified: 2007-01-28 05:22 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rajil Saraswat 2006-07-22 19:56:01 UTC
Version:            (using KDE KDE 3.5.3)
Installed from:    Gentoo Packages
OS:                Linux

Latest windows Yahoo messenger Beta (8.0.0.508) which has MSN support doesnt work with kopete webcam (v0.12). On sending an invite from kopete webcam to windows yahoo, the message returned is :

Webcam connection to the user could not be established.
Please relogin and try again.
Reason: 17 - 14 - operation is not supported
Comment 1 Becheru Petru-Ioan 2006-07-26 21:02:19 UTC
confirmed on (Debian) Kopete o.12.1
Comment 2 Mr YouP 2006-08-15 06:00:42 UTC
I can't said if it was against a Yahoo messenger Beta 8 but I experienced same behavior with kopete 0.12.1 under kubuntu dapper
Comment 3 Andre Duffeck 2006-08-15 16:41:20 UTC
Does this problem occur always, or does it work sometimes?
Comment 4 Matthew Clark 2006-08-15 16:42:12 UTC
Always.
Comment 5 Andre Duffeck 2006-08-15 16:44:59 UTC
*** Bug 132178 has been marked as a duplicate of this bug. ***
Comment 6 Mr YouP 2006-08-15 17:48:20 UTC
I confirm, always.
Comment 7 Matthew Clark 2006-08-15 22:00:55 UTC
By the way, this bug isn't just in "Gentoo Packages" as specified in the Platform field.  I download and compile from source and I have the same error.
Comment 8 Andre Duffeck 2006-08-18 00:44:30 UTC
SVN commit 574054 by duffeck:

some fixes in webcam code. That should fix bug 131218.
BUG: 131218


 M  +20 -9     libkyahoo/webcamtask.cpp  
 M  +18 -2     yahooaccount.cpp  
 M  +2 -0      yahooaccount.h  


--- branches/KDE/3.5/kdenetwork/kopete/protocols/yahoo/libkyahoo/webcamtask.cpp #574053:574054
@@ -200,6 +200,7 @@
 	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 );
 	socketMap.remove( socket );
+	socket->deleteLater();
 }
 
 void WebcamTask::slotRead()
@@ -233,21 +234,28 @@
 	kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Magic Byte:" << data[2] << endl;
 
 	socketMap[socket].status = ConnectedStage2;
-	if( data[2] == (Q_INT8)0x06 )
+
+	QString server;
+	int i = 4;
+	KStreamSocket *newSocket;
+	switch( (const char)data[2] )
 	{
+	case (Q_INT8)0x06:
 		emit webcamNotAvailable(socketMap[socket].sender);
-	}
-	else if( data[2] == (Q_INT8)0x04 || data[2] == (Q_INT8)0x07 )
-	{
-		QString server;
-		int i = 4;
-		while( data[i] != (Q_INT8)0x00 )
+		break;
+	case (Q_INT8)0x04:
+	case (Q_INT8)0x07:
+		while( (const char)data[i] != (Q_INT8)0x00 )
 			server += data[i++];
 		kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Server:" << server << endl;
-// 		server = server.mid( 4, server.find( '0', 4) );
+		if( server.isEmpty() )
+		{
+			emit webcamNotAvailable(socketMap[socket].sender);
+			break;
+		}
 		
 		kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Connecting to " << server << endl;
-		KStreamSocket *newSocket = new KStreamSocket( server, QString::number(5100) );
+		newSocket = new KStreamSocket( server, QString::number(5100) );
 		socketMap[newSocket] = socketMap[socket];
 		newSocket->enableRead( true );
 		connect( newSocket, SIGNAL( connected( const KResolverEntry& ) ), this, SLOT( slotConnectionStage2Established() ) );
@@ -260,6 +268,9 @@
 		}
 		
 		newSocket->connect();	
+		break;
+	default:
+		break;
 	}
 	socketMap.remove( socket );
 	delete socket;
--- branches/KDE/3.5/kdenetwork/kopete/protocols/yahoo/yahooaccount.cpp #574053:574054
@@ -309,7 +309,9 @@
 // 		                 SLOT(slotGotIdentities( const QStringList&)));
 		
 		QObject::connect(m_session, SIGNAL(gotWebcamInvite(const QString&)), this, SLOT(slotGotWebcamInvite(const QString&)));
-				
+		
+		QObject::connect(m_session, SIGNAL(webcamNotAvailable(const QString&)), this, SLOT(slotWebcamNotAvailable(const QString&)));
+		
 		QObject::connect(m_session, SIGNAL(webcamImageReceived(const QString&, const QPixmap& )), this, SLOT(slotGotWebcamImage(const QString&, const QPixmap& )));
 		
 		QObject::connect(m_session, SIGNAL(webcamClosed(const QString&, int )), this, SLOT(slotWebcamClosed(const QString&, int )));
@@ -437,6 +439,8 @@
 		
 		QObject::disconnect(m_session, SIGNAL(gotWebcamInvite(const QString&)), this, SLOT(slotGotWebcamInvite(const QString&)));
 		
+		QObject::disconnect(m_session, SIGNAL(webcamNotAvailable(const QString&)), this, SLOT(slotWebcamNotAvailable(const QString&)));
+		
 		QObject::disconnect(m_session, SIGNAL(webcamImageReceived(const QString&, const QPixmap& )), this, SLOT(slotGotWebcamImage(const QString&, const QPixmap& )));
 		
 		QObject::disconnect(m_session, SIGNAL(webcamClosed(const QString&, int )), this, SLOT(slotWebcamClosed(const QString&, int )));
@@ -1487,10 +1491,22 @@
 		return;
 	}
 	
+	if( m_pendingWebcamInvites.contains( who ) )
+		return;
+	
+	m_pendingWebcamInvites.append( who );
+	
 	if( KMessageBox::Yes == KMessageBox::questionYesNo( Kopete::UI::Global::mainWidget(), i18n("%1 has invited you to view his/her webcam. Accept?")
-							.arg(who), QString::null, i18n("Accept"), i18n("Ignore") ) )	
+							.arg(who), QString::null, i18n("Accept"), i18n("Ignore") ) )
+	{
+		m_pendingWebcamInvites.remove( who );
 		m_session->requestWebcam( who );
+	}
 }
+void YahooAccount::slotWebcamNotAvailable( const QString &who )
+{
+	KMessageBox::sorry( Kopete::UI::Global::mainWidget(), i18n("Webcam for %1 is not available.").arg(who), i18n( "Yahoo Plugin" ) );
+}
 
 void YahooAccount::slotGotWebcamImage( const QString& who, const QPixmap& image )
 {
--- branches/KDE/3.5/kdenetwork/kopete/protocols/yahoo/yahooaccount.h #574053:574054
@@ -211,6 +211,7 @@
 	void slotRemoveHandler(int fd);
 	//void slotHostConnect(const QString &host, int port);
 	void slotGotWebcamInvite(const QString &);
+	void slotWebcamNotAvailable( const QString &who );
 	void slotGotWebcamImage(const QString&, const QPixmap&);
 	void slotWebcamReadyForTransmission();
 	void slotWebcamStopTransmission();
@@ -264,6 +265,7 @@
 	 */
 	QMap<QString, YahooConferenceChatSession *> m_conferences;
 	QStringList m_pendingConfInvites;
+	QStringList m_pendingWebcamInvites;
 
 	QMap<unsigned int, Kopete::Transfer *> m_fileTransfers;
 
Comment 9 Rajil Saraswat 2006-08-25 21:06:36 UTC
I compiled from kopete svn today to verify this bug. Although, the bug resolved the initial problem but it opened up another.

Kopete can now send out video to Yahoo messenger (8.0.0.701,YIMS) which works brilliantly. 

However, if Yahoo Messenger invites the kopete user to view his webcam, the kopete user just sees the first frame. The picture of yahoo messenger user in kopete remains stagnant!
Comment 10 Matthew Clark 2006-08-25 21:16:06 UTC
I can confirm this.

I thought it was just my system, though, so I didn't say anything.  Of the dozens of times I've tried to view a Yahoo user's camera, only a couple of times did it show motion video, but it was only for a second or two.  So for the most part, yes, only the first frame is ever shown.
Comment 11 Rajil Saraswat 2006-08-25 21:26:37 UTC
Opening this bug.
Comment 12 Barry Tepperman 2006-09-07 23:03:15 UTC
Kopete as distributed with Kubuntu 6.06 - can view YIM user's webcam by accepting invitation without difficulty apart from occasional application crashes - and can view own webcam image - but there seems to be no way to "invite user to accept webcam images" and thus no way to send webcam images to YIM user.
Comment 13 Rajil Saraswat 2006-09-12 19:53:40 UTC
Hi Andre,
I will be happy to assist in a debug by hosting a Yahoo messenger stream from  windows and kopete clients if you need it. Please drop me an email.

Rajil
Comment 14 Andre Duffeck 2006-10-07 18:50:13 UTC
SVN commit 593368 by duffeck:

Fix bug where only the first image of a webcam transmission was shown.
BUG:131218


 M  +8 -4      webcamtask.cpp  


--- branches/KDE/3.5/kdenetwork/kopete/protocols/yahoo/libkyahoo/webcamtask.cpp #593367:593368
@@ -213,13 +213,11 @@
 	{
 		case ConnectedStage1:
 			disconnect( socket, SIGNAL( readyRead() ), this, SLOT( slotRead() ) );
-			kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Connected into stage 1" << endl;
 			connectStage2( socket );
 		break;
 		case ConnectedStage2:
 		case Sending:
 		case SendingEmpty:
-			kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Connected into stage 2" << endl;
 			processData( socket );
 		default:
 		break;
@@ -278,7 +276,6 @@
 
 void WebcamTask::processData( KStreamSocket *socket )
 {
-	kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl;
 	QByteArray data( socket->bytesAvailable() );
 	
 	socket->readBlock ( data.data (), data.size () );
@@ -293,7 +290,6 @@
 
 void WebcamTask::parseData( QByteArray &data, KStreamSocket *socket )
 {
-	kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " data " << data.size() << " bytes " << endl;
 	uint headerLength = 0;
 	uint read = 0;
 	YahooWebcamInformation *info = &socketMap[socket];
@@ -398,9 +394,17 @@
 	}
 	
 	if( info->dataLength <= 0 )
+	{
+		kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "No data to read. (info->dataLength <= 0)" << endl;
+		if( info->headerRead )
+			info->headerRead = false;
 		return;
+	}
 	if( headerLength >= data.size() )
+	{
+		kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "No data to read. (headerLength >= data.size())" << endl;
 		return;		//Nothing to read here...
+	}
 	if( !info->buffer )
 	{
 		kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Buffer created" << endl;
Comment 15 Rajil Saraswat 2006-10-07 22:20:46 UTC
Excellent work Andre. The bug seems to be fixed. I had a bit of trouble initially to get the remote stream, kopete  kept on saying "Webcam not available". However, after trying multiple times, it eventually connected and the remote stream worked well.

Thanks again.
Comment 16 Jason Carter 2006-10-09 21:28:50 UTC
I can also confirm that this is fixed, however I find that if I have already served a webcam during the current session of Kopete, I sometimes get the "Webcam for [username] is not available." Restarting Kopete allows me to send the webcam to the same user without issue. (This same error used to come up before, however the username portion wasn't in the box, so the error said "Webcam for is not available.")
Comment 17 Matthew Clark 2006-10-10 01:24:11 UTC
Pardon the stupid question, would could someone attach a patch or something?  Or at least tell me which version of Kopete in which this fix will be released?  I'm not smart enough to apply these fixes myself...
Comment 18 Will Stephenson 2007-01-27 21:53:43 UTC
Matthew: Kopete as included in KDE 3.5.6
Comment 19 Matthew Clark 2007-01-28 05:22:47 UTC
Yeah, I know.