2012-02-25 13:15:36 -05:00
|
|
|
#include <iostream>
|
2012-02-25 16:03:06 -05:00
|
|
|
#include <vector>
|
|
|
|
#include <list>
|
|
|
|
#include <interface/rsvoip.h>
|
2012-02-25 13:15:36 -05:00
|
|
|
#include "PluginGUIHandler.h"
|
2012-02-25 16:03:06 -05:00
|
|
|
#include <gui/chat/ChatDialog.h>
|
|
|
|
#include <gui/AudioPopupChatDialog.h>
|
2012-02-25 13:15:36 -05:00
|
|
|
|
|
|
|
void PluginGUIHandler::ReceivedInvitation(const QString& peer_id)
|
|
|
|
{
|
|
|
|
std::cerr << "****** Plugin GUI handler: received data!" << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void PluginGUIHandler::ReceivedVoipData(const QString& peer_id)
|
|
|
|
{
|
|
|
|
std::cerr << "****** Plugin GUI handler: received invitation!" << std::endl;
|
2012-02-25 16:03:06 -05:00
|
|
|
|
|
|
|
std::vector<RsVoipDataChunk> chunks ;
|
|
|
|
|
|
|
|
if(!rsVoip->getIncomingData(peer_id.toStdString(),chunks))
|
|
|
|
{
|
|
|
|
std::cerr << "PluginGUIHandler::ReceivedVoipData(): No data chunks to get. Weird!" << std::endl;
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
ChatDialog *di = ChatDialog::getExistingChat(peer_id.toStdString()) ;
|
|
|
|
|
|
|
|
AudioPopupChatDialog *adi = dynamic_cast<AudioPopupChatDialog*>(di) ;
|
|
|
|
|
|
|
|
if(adi != NULL)
|
|
|
|
for(unsigned int i=0;i<chunks.size();++i)
|
|
|
|
{
|
|
|
|
QByteArray qb(reinterpret_cast<const char *>(chunks[i].data),chunks[i].size) ;
|
|
|
|
adi->addAudioData(peer_id,&qb) ;
|
|
|
|
free(chunks[i].data) ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
std::cerr << "Error: received audio data for a chat dialog that does not stand Audio (Peer id = " << peer_id.toStdString() << "!" << std::endl;
|
2012-02-25 13:15:36 -05:00
|
|
|
}
|
|
|
|
|