diff --git a/libretroshare/src/services/p3chatservice.cc b/libretroshare/src/services/p3chatservice.cc index 99bca4285..8d7ddb981 100644 --- a/libretroshare/src/services/p3chatservice.cc +++ b/libretroshare/src/services/p3chatservice.cc @@ -1888,6 +1888,7 @@ bool p3ChatService::acceptLobbyInvite(const ChatLobbyId& lobby_id) ChatLobbyEntry entry ; entry.participating_friends.insert(it->second.peer_id) ; + entry.lobby_privacy_level = ((_public_lobbies.find(lobby_id)!=_public_lobbies.end())?RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC:RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE) ; // should be updated later if the lobby is advertized entry.nick_name = _default_nick_name ; entry.lobby_id = lobby_id ; entry.lobby_name = it->second.lobby_name ; diff --git a/retroshare-gui/src/gui/ChatLobbyWidget.cpp b/retroshare-gui/src/gui/ChatLobbyWidget.cpp index 6da23f41d..9e4e9d7e4 100644 --- a/retroshare-gui/src/gui/ChatLobbyWidget.cpp +++ b/retroshare-gui/src/gui/ChatLobbyWidget.cpp @@ -41,36 +41,45 @@ void ChatLobbyWidget::updateDisplay() std::list linfos ; rsMsgs->getChatLobbyList(linfos) ; + std::cerr << "got " << public_lobbies.size() << " public lobbies, and " << linfos.size() << " private lobbies." << std::endl; + // now, do a nice display of public lobbies. _lobby_table_TW->clear() ; int n=0 ; + std::string vpid ; for(uint32_t i=0;isetItem(n,COL_LOBBY_NAME,new QTableWidgetItem(QString::fromUtf8(public_lobbies[i].lobby_name.c_str()))) ; - _lobby_table_TW->setItem(n,COL_LOBBY_ID ,new QTableWidgetItem(QString::number(public_lobbies[i].lobby_id,16))) ; - _lobby_table_TW->setItem(n,COL_LOBBY_TYPE,new QTableWidgetItem(tr("Public"))) ; - _lobby_table_TW->setItem(n,COL_LOBBY_COUNT,new QTableWidgetItem(QString::number(public_lobbies[i].total_number_of_peers))) ; - - std::string vpid ; - if(rsMsgs->getVirtualPeerId(public_lobbies[i].lobby_id,vpid)) - _lobby_table_TW->setItem(n,COL_LOBBY_STATE,new QTableWidgetItem(tr("subscribed"))) ; - else - _lobby_table_TW->setItem(n,COL_LOBBY_STATE,new QTableWidgetItem("")) ; - } - - for(std::list::const_iterator it(linfos.begin());it!=linfos.end();++it,++n) - if((*it).lobby_privacy_level == RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE) + if(!rsMsgs->getVirtualPeerId(public_lobbies[i].lobby_id,vpid)) // only display unsubscribed lobbies { - _lobby_table_TW->setItem(n,COL_LOBBY_NAME,new QTableWidgetItem(QString::fromUtf8((*it).lobby_name.c_str()))) ; - _lobby_table_TW->setItem(n,COL_LOBBY_ID ,new QTableWidgetItem(QString::number((*it).lobby_id,16))) ; - _lobby_table_TW->setItem(n,COL_LOBBY_TYPE,new QTableWidgetItem(tr("Private"))) ; - _lobby_table_TW->setItem(n,COL_LOBBY_COUNT,new QTableWidgetItem(QString::number((*it).nick_names.size()))) ; + std::cerr << "adding " << public_lobbies[i].lobby_name << " #" << std::hex << public_lobbies[i].lobby_id << std::dec << " public " << public_lobbies[i].total_number_of_peers << " peers." << std::endl; - _lobby_table_TW->setItem(n,COL_LOBBY_STATE,new QTableWidgetItem(tr("subscribed"))) ; + _lobby_table_TW->setItem(n,COL_LOBBY_NAME,new QTableWidgetItem(QString::fromUtf8(public_lobbies[i].lobby_name.c_str()))) ; + _lobby_table_TW->setItem(n,COL_LOBBY_ID ,new QTableWidgetItem(QString::number(public_lobbies[i].lobby_id,16))) ; + _lobby_table_TW->setItem(n,COL_LOBBY_TYPE,new QTableWidgetItem(tr("Public"))) ; + _lobby_table_TW->setItem(n,COL_LOBBY_COUNT,new QTableWidgetItem(QString::number(public_lobbies[i].total_number_of_peers))) ; + _lobby_table_TW->setItem(n,COL_LOBBY_STATE,new QTableWidgetItem("")) ; } + for(std::list::const_iterator it(linfos.begin());it!=linfos.end();++it,++n) + { + std::cerr << "adding " << (*it).lobby_name << " #" << std::hex << (*it).lobby_id << std::dec << " private " << (*it).nick_names.size() << " peers." << std::endl; + + _lobby_table_TW->setItem(n,COL_LOBBY_NAME,new QTableWidgetItem(QString::fromUtf8((*it).lobby_name.c_str()))) ; + _lobby_table_TW->setItem(n,COL_LOBBY_ID ,new QTableWidgetItem(QString::number((*it).lobby_id,16))) ; + + if( (*it).lobby_privacy_level == RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC) + _lobby_table_TW->setItem(n,COL_LOBBY_TYPE,new QTableWidgetItem(tr("Public"))) ; + else + _lobby_table_TW->setItem(n,COL_LOBBY_TYPE,new QTableWidgetItem(tr("Private"))) ; + + _lobby_table_TW->setItem(n,COL_LOBBY_COUNT,new QTableWidgetItem(QString::number((*it).nick_names.size()))) ; + _lobby_table_TW->setItem(n,COL_LOBBY_STATE,new QTableWidgetItem(tr("subscribed"))) ; + } +} + +void ChatLobbyWidget::doubleClickCell(int row,int col) +{ // Each lobby can be joined directly, by calling // rsMsgs->joinPublicLobby(chatLobbyId) ; diff --git a/retroshare-gui/src/gui/ChatLobbyWidget.h b/retroshare-gui/src/gui/ChatLobbyWidget.h index 19f112fc2..06ccb1c46 100644 --- a/retroshare-gui/src/gui/ChatLobbyWidget.h +++ b/retroshare-gui/src/gui/ChatLobbyWidget.h @@ -15,5 +15,8 @@ class ChatLobbyWidget : public RsAutoUpdatePage, public Ui::ChatLobbyWidget ~ChatLobbyWidget(); virtual void updateDisplay() ; + + protected slots: + void doubleClickCell(int,int); };