added response to lobby invites

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-LobbiesWithGXSIds@7983 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-03-05 21:51:12 +00:00
parent aad84cd54d
commit 7c3ad32436
2 changed files with 36 additions and 18 deletions

View File

@ -834,30 +834,49 @@ void ChatLobbyWidget::displayChatLobbyEvent(qulonglong lobby_id, int event_type,
void ChatLobbyWidget::readChatLobbyInvites()
{
std::list<ChatLobbyInvite> invites;
rsMsgs->getPendingChatLobbyInvites(invites);
std::list<ChatLobbyInvite> invites;
rsMsgs->getPendingChatLobbyInvites(invites);
RsGxsId default_id ;
rsMsgs->getDefaultIdentityForChatLobby(default_id) ;
for(std::list<ChatLobbyInvite>::const_iterator it(invites.begin());it!=invites.end();++it)
{
#warning We need here a QDialog that also asks for the identity to use.
#ifdef REMOVED_CODE
QDialog dialog ;
QMessageBox mb(QObject::tr("Join chat lobby"),
tr("%1 invites you to chat lobby named %2").arg(QString::fromUtf8(rsPeers->getPeerName((*it).peer_id).c_str())).arg(RsHtml::plainText(it->lobby_name)),
QMessageBox::Question, QMessageBox::Yes,QMessageBox::No, 0);
if (QMessageBox::Ok == QMessageBox::question(this, tr("Invitation to chat lobby"), tr("%1 invites you to chat lobby named %2").arg(QString::fromUtf8(rsPeers->getPeerName((*it).peer_id).c_str())).arg(RsHtml::plainText(it->lobby_name)), QMessageBox::Ok, QMessageBox::Ignore)) {
std::cerr << "Accepting invite to lobby " << (*it).lobby_name << std::endl;
GxsIdChooser *idchooser = new GxsIdChooser ;
idchooser->loadIds(IDCHOOSER_ID_REQUIRED,default_id) ;
rsMsgs->acceptLobbyInvite((*it).lobby_id);
mb.layout()->addWidget(new QLabel(tr("Choose an identity for this lobby:"))) ;
mb.layout()->addWidget(idchooser) ;
RsPeerId vpid;
if(rsMsgs->getVirtualPeerId((*it).lobby_id,vpid )) {
ChatDialog::chatFriend(ChatId((*it).lobby_id),true);
} else {
std::cerr << "No lobby known with id 0x" << std::hex << (*it).lobby_id << std::dec << std::endl;
}
} else {
int res = mb.exec() ;
if (res == QMessageBox::No)
{
rsMsgs->denyLobbyInvite((*it).lobby_id);
continue ;
}
#endif
RsGxsId chosen_id ;
idchooser->getChosenId(chosen_id) ;
if(chosen_id.isNull())
{
rsMsgs->denyLobbyInvite((*it).lobby_id);
continue ;
}
rsMsgs->acceptLobbyInvite((*it).lobby_id,chosen_id);
RsPeerId vpid;
if(rsMsgs->getVirtualPeerId((*it).lobby_id,vpid ))
ChatDialog::chatFriend(ChatId((*it).lobby_id),true);
else
std::cerr << "No lobby known with id 0x" << std::hex << (*it).lobby_id << std::dec << std::endl;
}
}

View File

@ -322,8 +322,7 @@ void ChatLobbyDialog::addChatMsg(const ChatMessage& msg)
QString message = QString::fromUtf8(msg.msg.c_str());
RsGxsId gxs_id = msg.lobby_peer_gxs_id ;
if(!isParticipantMuted(gxs_id)) {
#warning We could change addChatMsg to display the peer's icon, passing a ChatId
if(!isParticipantMuted(gxs_id)) { // We could change addChatMsg to display the peers icon, passing a ChatId
RsIdentityDetails details ;
QString name ;