mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-23 00:09:50 -05:00
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:
parent
aad84cd54d
commit
7c3ad32436
@ -834,30 +834,49 @@ void ChatLobbyWidget::displayChatLobbyEvent(qulonglong lobby_id, int event_type,
|
|||||||
|
|
||||||
void ChatLobbyWidget::readChatLobbyInvites()
|
void ChatLobbyWidget::readChatLobbyInvites()
|
||||||
{
|
{
|
||||||
std::list<ChatLobbyInvite> invites;
|
std::list<ChatLobbyInvite> invites;
|
||||||
rsMsgs->getPendingChatLobbyInvites(invites);
|
rsMsgs->getPendingChatLobbyInvites(invites);
|
||||||
|
|
||||||
|
RsGxsId default_id ;
|
||||||
|
rsMsgs->getDefaultIdentityForChatLobby(default_id) ;
|
||||||
|
|
||||||
for(std::list<ChatLobbyInvite>::const_iterator it(invites.begin());it!=invites.end();++it)
|
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.
|
QMessageBox mb(QObject::tr("Join chat lobby"),
|
||||||
#ifdef REMOVED_CODE
|
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)),
|
||||||
QDialog dialog ;
|
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)) {
|
GxsIdChooser *idchooser = new GxsIdChooser ;
|
||||||
std::cerr << "Accepting invite to lobby " << (*it).lobby_name << std::endl;
|
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;
|
int res = mb.exec() ;
|
||||||
if(rsMsgs->getVirtualPeerId((*it).lobby_id,vpid )) {
|
|
||||||
ChatDialog::chatFriend(ChatId((*it).lobby_id),true);
|
if (res == QMessageBox::No)
|
||||||
} else {
|
{
|
||||||
std::cerr << "No lobby known with id 0x" << std::hex << (*it).lobby_id << std::dec << std::endl;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
rsMsgs->denyLobbyInvite((*it).lobby_id);
|
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;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,8 +322,7 @@ void ChatLobbyDialog::addChatMsg(const ChatMessage& msg)
|
|||||||
QString message = QString::fromUtf8(msg.msg.c_str());
|
QString message = QString::fromUtf8(msg.msg.c_str());
|
||||||
RsGxsId gxs_id = msg.lobby_peer_gxs_id ;
|
RsGxsId gxs_id = msg.lobby_peer_gxs_id ;
|
||||||
|
|
||||||
if(!isParticipantMuted(gxs_id)) {
|
if(!isParticipantMuted(gxs_id)) { // We could change addChatMsg to display the peers icon, passing a ChatId
|
||||||
#warning We could change addChatMsg to display the peer's icon, passing a ChatId
|
|
||||||
RsIdentityDetails details ;
|
RsIdentityDetails details ;
|
||||||
|
|
||||||
QString name ;
|
QString name ;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user