2012-01-11 19:13:25 -05:00
# include <QTreeWidget>
# include <QMenu>
# include <QMessageBox>
2012-01-07 14:52:58 -05:00
# include "ChatLobbyWidget.h"
2012-01-11 19:13:25 -05:00
# include "chat/CreateLobbyDialog.h"
2013-02-22 16:42:27 -05:00
# include "chat/ChatTabWidget.h"
2012-01-11 19:13:25 -05:00
# include "common/RSTreeWidgetItem.h"
# include "notifyqt.h"
# include "chat/ChatLobbyDialog.h"
2012-01-07 14:52:58 -05:00
2012-01-11 19:13:25 -05:00
# include "retroshare/rsmsgs.h"
# include "retroshare/rspeers.h"
# include "retroshare/rsnotify.h"
# define COLUMN_NAME 0
# define COLUMN_USER_COUNT 1
2012-03-16 18:47:49 -04:00
# define COLUMN_TOPIC 2
# define COLUMN_COUNT 3
2012-01-11 19:13:25 -05:00
# define COLUMN_DATA 0
# define ROLE_SORT Qt::UserRole
# define ROLE_ID Qt::UserRole + 1
# define ROLE_SUBSCRIBED Qt::UserRole + 2
2012-01-30 18:20:42 -05:00
# define ROLE_PRIVACYLEVEL Qt::UserRole + 3
2012-01-11 19:13:25 -05:00
# define TYPE_FOLDER 0
# define TYPE_LOBBY 1
# define IMAGE_CREATE ""
# define IMAGE_PUBLIC ""
# define IMAGE_PRIVATE ""
# define IMAGE_SUBSCRIBE ""
# define IMAGE_UNSUBSCRIBE ""
2012-01-07 14:52:58 -05:00
ChatLobbyWidget : : ChatLobbyWidget ( QWidget * parent , Qt : : WFlags flags )
2012-02-17 05:03:38 -05:00
: RsAutoUpdatePage ( 5000 , parent , flags )
2012-01-07 14:52:58 -05:00
{
2012-01-11 19:13:25 -05:00
setupUi ( this ) ;
QObject : : connect ( NotifyQt : : getInstance ( ) , SIGNAL ( lobbyListChanged ( ) ) , SLOT ( lobbyChanged ( ) ) ) ;
QObject : : connect ( NotifyQt : : getInstance ( ) , SIGNAL ( chatLobbyEvent ( qulonglong , int , const QString & , const QString & ) ) , this , SLOT ( displayChatLobbyEvent ( qulonglong , int , const QString & , const QString & ) ) ) ;
QObject : : connect ( NotifyQt : : getInstance ( ) , SIGNAL ( chatLobbyInviteReceived ( ) ) , this , SLOT ( readChatLobbyInvites ( ) ) ) ;
2013-02-22 16:42:27 -05:00
lobbyTreeWidget = new QTreeWidget ;
getTabWidget ( ) - > addTab ( lobbyTreeWidget , tr ( " Lobby list " ) ) ;
layout ( ) - > addWidget ( getTabWidget ( ) ) ;
layout ( ) - > update ( ) ;
2012-01-11 19:13:25 -05:00
QObject : : connect ( lobbyTreeWidget , SIGNAL ( customContextMenuRequested ( QPoint ) ) , this , SLOT ( lobbyTreeWidgetCostumPopupMenu ( ) ) ) ;
QObject : : connect ( lobbyTreeWidget , SIGNAL ( itemDoubleClicked ( QTreeWidgetItem * , int ) ) , this , SLOT ( itemDoubleClicked ( QTreeWidgetItem * , int ) ) ) ;
2012-01-18 15:02:19 -05:00
2012-08-21 19:54:39 -04:00
QObject : : connect ( newlobbytoolButton , SIGNAL ( clicked ( ) ) , this , SLOT ( createChatLobby ( ) ) ) ;
2012-01-11 19:13:25 -05:00
compareRole = new RSTreeWidgetItemCompareRole ;
compareRole - > setRole ( COLUMN_NAME , ROLE_SORT ) ;
lobbyTreeWidget - > setColumnCount ( COLUMN_COUNT ) ;
lobbyTreeWidget - > sortItems ( COLUMN_NAME , Qt : : AscendingOrder ) ;
QTreeWidgetItem * headerItem = lobbyTreeWidget - > headerItem ( ) ;
headerItem - > setText ( COLUMN_NAME , tr ( " Name " ) ) ;
headerItem - > setText ( COLUMN_USER_COUNT , tr ( " Count " ) ) ;
2012-03-16 18:47:49 -04:00
headerItem - > setText ( COLUMN_TOPIC , tr ( " Topic " ) ) ;
2012-01-11 19:13:25 -05:00
headerItem - > setTextAlignment ( COLUMN_NAME , Qt : : AlignHCenter | Qt : : AlignVCenter ) ;
2012-03-16 18:47:49 -04:00
headerItem - > setTextAlignment ( COLUMN_TOPIC , Qt : : AlignHCenter | Qt : : AlignVCenter ) ;
2012-01-11 19:13:25 -05:00
headerItem - > setTextAlignment ( COLUMN_USER_COUNT , Qt : : AlignHCenter | Qt : : AlignVCenter ) ;
QHeaderView * header = lobbyTreeWidget - > header ( ) ;
header - > setResizeMode ( COLUMN_NAME , QHeaderView : : Interactive ) ;
2012-03-16 18:47:49 -04:00
header - > setResizeMode ( COLUMN_USER_COUNT , QHeaderView : : Interactive ) ;
header - > setResizeMode ( COLUMN_TOPIC , QHeaderView : : Stretch ) ;
2012-01-07 16:01:43 -05:00
2012-01-11 19:13:25 -05:00
lobbyTreeWidget - > setColumnWidth ( COLUMN_NAME , 200 ) ;
lobbyTreeWidget - > setColumnWidth ( COLUMN_USER_COUNT , 50 ) ;
privateLobbyItem = new RSTreeWidgetItem ( compareRole , TYPE_FOLDER ) ;
privateLobbyItem - > setText ( COLUMN_NAME , tr ( " Private Lobbies " ) ) ;
privateLobbyItem - > setData ( COLUMN_NAME , ROLE_SORT , " 1 " ) ;
2012-01-30 18:20:42 -05:00
privateLobbyItem - > setData ( COLUMN_DATA , ROLE_PRIVACYLEVEL , RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE ) ;
2012-01-11 19:13:25 -05:00
lobbyTreeWidget - > insertTopLevelItem ( 0 , privateLobbyItem ) ;
publicLobbyItem = new RSTreeWidgetItem ( compareRole , TYPE_FOLDER ) ;
publicLobbyItem - > setText ( COLUMN_NAME , tr ( " Public Lobbies " ) ) ;
publicLobbyItem - > setData ( COLUMN_NAME , ROLE_SORT , " 2 " ) ;
2012-01-30 18:20:42 -05:00
publicLobbyItem - > setData ( COLUMN_DATA , ROLE_PRIVACYLEVEL , RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC ) ;
2012-01-11 19:13:25 -05:00
lobbyTreeWidget - > insertTopLevelItem ( 1 , publicLobbyItem ) ;
lobbyTreeWidget - > expandAll ( ) ;
lobbyChanged ( ) ;
2012-01-07 14:52:58 -05:00
}
2012-01-11 19:13:25 -05:00
2012-01-07 14:52:58 -05:00
ChatLobbyWidget : : ~ ChatLobbyWidget ( )
{
2012-06-09 10:14:04 -04:00
if ( compareRole ) {
delete ( compareRole ) ;
}
2012-01-11 19:13:25 -05:00
}
void ChatLobbyWidget : : lobbyTreeWidgetCostumPopupMenu ( )
{
2012-01-30 18:20:42 -05:00
QTreeWidgetItem * item = lobbyTreeWidget - > currentItem ( ) ;
2012-01-11 19:13:25 -05:00
QMenu contextMnu ( this ) ;
2012-01-30 18:20:42 -05:00
if ( item & & item - > type ( ) = = TYPE_FOLDER ) {
QAction * action = contextMnu . addAction ( QIcon ( IMAGE_CREATE ) , tr ( " Create chat lobby " ) , this , SLOT ( createChatLobby ( ) ) ) ;
action - > setData ( item - > data ( COLUMN_DATA , ROLE_PRIVACYLEVEL ) . toInt ( ) ) ;
}
2012-01-11 19:13:25 -05:00
if ( item & & item - > type ( ) = = TYPE_LOBBY ) {
if ( item - > data ( COLUMN_DATA , ROLE_SUBSCRIBED ) . toBool ( ) ) {
contextMnu . addAction ( QIcon ( IMAGE_UNSUBSCRIBE ) , tr ( " Unsubscribe " ) , this , SLOT ( unsubscribeItem ( ) ) ) ;
} else {
contextMnu . addAction ( QIcon ( IMAGE_SUBSCRIBE ) , tr ( " Subscribe " ) , this , SLOT ( subscribeItem ( ) ) ) ;
}
}
2012-01-30 18:20:42 -05:00
if ( contextMnu . children ( ) . count ( ) = = 0 ) {
return ;
}
2012-01-11 19:13:25 -05:00
contextMnu . exec ( QCursor : : pos ( ) ) ;
}
void ChatLobbyWidget : : lobbyChanged ( )
{
updateDisplay ( ) ;
}
2012-03-16 18:47:49 -04:00
static void updateItem ( QTreeWidgetItem * item , ChatLobbyId id , const std : : string & name , const std : : string & topic , int count , bool subscribed )
2012-01-11 19:13:25 -05:00
{
item - > setText ( COLUMN_NAME , QString : : fromUtf8 ( name . c_str ( ) ) ) ;
item - > setData ( COLUMN_NAME , ROLE_SORT , QString : : fromUtf8 ( name . c_str ( ) ) ) ;
2012-03-16 19:07:28 -04:00
if ( topic . empty ( ) )
{
2012-03-30 19:02:52 -04:00
item - > setText ( COLUMN_TOPIC , qApp - > translate ( " ChatLobbyWidget " , " [No topic provided] " ) ) ;
item - > setData ( COLUMN_TOPIC , ROLE_SORT , qApp - > translate ( " ChatLobbyWidget " , " [No topic provided] " ) ) ;
2012-03-16 19:07:28 -04:00
}
else
{
item - > setText ( COLUMN_TOPIC , QString : : fromUtf8 ( topic . c_str ( ) ) ) ;
item - > setData ( COLUMN_TOPIC , ROLE_SORT , QString : : fromUtf8 ( topic . c_str ( ) ) ) ;
}
2012-03-16 18:47:49 -04:00
2012-01-11 19:13:25 -05:00
item - > setText ( COLUMN_USER_COUNT , QString : : number ( count ) ) ;
2012-01-12 06:14:50 -05:00
item - > setData ( COLUMN_DATA , ROLE_ID , ( qulonglong ) id ) ;
2012-01-11 19:13:25 -05:00
item - > setData ( COLUMN_DATA , ROLE_SUBSCRIBED , subscribed ) ;
for ( int column = 0 ; column < COLUMN_COUNT ; + + column ) {
item - > setTextColor ( column , subscribed ? QColor ( ) : QColor ( Qt : : gray ) ) ;
}
2012-01-07 14:52:58 -05:00
}
void ChatLobbyWidget : : updateDisplay ( )
{
2012-01-28 08:20:01 -05:00
# ifdef CHAT_LOBBY_GUI_DEBUG
2012-01-07 16:01:43 -05:00
std : : cerr < < " updating chat lobby display! " < < std : : endl ;
2012-01-28 08:20:01 -05:00
# endif
2012-12-04 16:36:05 -05:00
std : : vector < VisibleChatLobbyRecord > visibleLobbies ;
rsMsgs - > getListOfNearbyChatLobbies ( visibleLobbies ) ;
2012-01-07 14:52:58 -05:00
2012-01-11 19:13:25 -05:00
std : : list < ChatLobbyInfo > lobbies ;
rsMsgs - > getChatLobbyList ( lobbies ) ;
2012-01-07 16:01:43 -05:00
2012-01-28 08:20:01 -05:00
# ifdef CHAT_LOBBY_GUI_DEBUG
2012-12-04 16:36:05 -05:00
std : : cerr < < " got " < < visibleLobbies . size ( ) < < " visible lobbies, and " < < lobbies . size ( ) < < " private lobbies. " < < std : : endl ;
2012-01-28 08:20:01 -05:00
# endif
2012-01-07 16:37:31 -05:00
2012-01-11 19:13:25 -05:00
// now, do a nice display of lobbies
2012-01-07 14:52:58 -05:00
2012-01-11 19:13:25 -05:00
std : : string vpid ;
uint32_t i ;
2012-12-04 16:36:05 -05:00
uint32_t size = visibleLobbies . size ( ) ;
2012-01-11 19:13:25 -05:00
std : : list < ChatLobbyInfo > : : const_iterator lobbyIt ;
// remove not existing public lobbies
2012-12-04 16:36:05 -05:00
for ( int p = 0 ; p < 2 ; + + p )
{
QTreeWidgetItem * lobby_item = ( p = = 0 ) ? publicLobbyItem : privateLobbyItem ;
int childCnt = lobby_item - > childCount ( ) ;
int childIndex = 0 ;
while ( childIndex < childCnt ) {
QTreeWidgetItem * itemLoop = lobby_item - > child ( childIndex ) ;
if ( itemLoop - > type ( ) = = TYPE_LOBBY )
{
// check for visible lobby
for ( i = 0 ; i < size ; + + i )
if ( itemLoop - > data ( COLUMN_DATA , ROLE_ID ) . toULongLong ( ) = = visibleLobbies [ i ] . lobby_id )
2012-01-11 19:13:25 -05:00
break ;
2012-12-04 16:36:05 -05:00
if ( i > = size )
{
// Check for participating lobby with public level
//
for ( lobbyIt = lobbies . begin ( ) ; lobbyIt ! = lobbies . end ( ) ; + + lobbyIt )
if ( itemLoop - > data ( COLUMN_DATA , ROLE_ID ) . toULongLong ( ) = = lobbyIt - > lobby_id )
break ;
if ( lobbyIt = = lobbies . end ( ) )
{
delete ( lobby_item - > takeChild ( lobby_item - > indexOfChild ( itemLoop ) ) ) ;
childCnt = lobby_item - > childCount ( ) ;
continue ;
}
2012-01-11 19:13:25 -05:00
}
}
2012-12-04 16:36:05 -05:00
childIndex + + ;
2012-01-11 19:13:25 -05:00
}
}
2012-01-07 16:01:43 -05:00
2012-12-04 16:36:05 -05:00
// Now add visible lobbies
//
for ( i = 0 ; i < size ; + + i )
{
const VisibleChatLobbyRecord & lobby = visibleLobbies [ i ] ;
2012-01-07 16:37:31 -05:00
2012-01-23 17:49:47 -05:00
# ifdef CHAT_LOBBY_GUI_DEBUG
2012-12-04 16:36:05 -05:00
std : : cerr < < " adding " < < lobby . lobby_name < < " topic " < < lobby . lobby_topic < < " # " < < std : : hex < < lobby . lobby_id < < std : : dec < < " public " < < lobby . total_number_of_peers < < " peers. Lobby type: " < < lobby . lobby_privacy_level < < std : : endl ;
2012-01-23 17:49:47 -05:00
# endif
2012-01-07 18:03:59 -05:00
2012-01-11 19:13:25 -05:00
QTreeWidgetItem * item = NULL ;
2012-12-04 16:36:05 -05:00
QTreeWidgetItem * lobby_item = ( visibleLobbies [ i ] . lobby_privacy_level = = RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC ) ? publicLobbyItem : privateLobbyItem ;
// Search existing item
//
int childCnt = lobby_item - > childCount ( ) ;
for ( int childIndex = 0 ; childIndex < childCnt ; childIndex + + )
{
QTreeWidgetItem * itemLoop = lobby_item - > child ( childIndex ) ;
2012-01-11 19:13:25 -05:00
if ( itemLoop - > type ( ) = = TYPE_LOBBY & & itemLoop - > data ( COLUMN_DATA , ROLE_ID ) . toULongLong ( ) = = lobby . lobby_id ) {
item = itemLoop ;
break ;
}
2012-01-07 16:37:31 -05:00
}
2012-01-07 16:01:43 -05:00
2012-01-11 19:13:25 -05:00
if ( item = = NULL ) {
item = new RSTreeWidgetItem ( compareRole , TYPE_LOBBY ) ;
2012-12-04 16:36:05 -05:00
lobby_item - > addChild ( item ) ;
2012-01-11 19:13:25 -05:00
}
2012-12-04 16:36:05 -05:00
if ( lobby_item = = publicLobbyItem )
item - > setIcon ( COLUMN_NAME , QIcon ( IMAGE_PUBLIC ) ) ;
else
item - > setIcon ( COLUMN_NAME , QIcon ( IMAGE_PRIVATE ) ) ;
2012-01-07 16:37:31 -05:00
2012-01-11 19:13:25 -05:00
bool subscribed = false ;
if ( rsMsgs - > getVirtualPeerId ( lobby . lobby_id , vpid ) ) {
subscribed = true ;
}
2012-01-07 16:37:31 -05:00
2012-03-16 18:47:49 -04:00
updateItem ( item , lobby . lobby_id , lobby . lobby_name , lobby . lobby_topic , lobby . total_number_of_peers , subscribed ) ;
2012-01-11 19:13:25 -05:00
}
2012-01-07 18:03:59 -05:00
2012-12-04 16:36:05 -05:00
// Now add participating lobbies.
//
for ( lobbyIt = lobbies . begin ( ) ; lobbyIt ! = lobbies . end ( ) ; + + lobbyIt )
{
2012-01-11 19:13:25 -05:00
const ChatLobbyInfo & lobby = * lobbyIt ;
2012-01-23 17:49:47 -05:00
# ifdef CHAT_LOBBY_GUI_DEBUG
2012-03-16 18:47:49 -04:00
std : : cerr < < " adding " < < lobby . lobby_name < < " topic " < < lobby . lobby_topic < < " # " < < std : : hex < < lobby . lobby_id < < std : : dec < < " private " < < lobby . nick_names . size ( ) < < " peers. " < < std : : endl ;
2012-01-23 17:49:47 -05:00
# endif
2012-01-11 19:13:25 -05:00
QTreeWidgetItem * itemParent ;
if ( lobby . lobby_privacy_level = = RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC ) {
itemParent = publicLobbyItem ;
} else {
itemParent = privateLobbyItem ;
}
QTreeWidgetItem * item = NULL ;
// search existing item
2012-12-04 16:36:05 -05:00
int childCount = itemParent - > childCount ( ) ;
for ( int childIndex = 0 ; childIndex < childCount ; childIndex + + ) {
2012-01-11 19:13:25 -05:00
QTreeWidgetItem * itemLoop = itemParent - > child ( childIndex ) ;
if ( itemLoop - > type ( ) = = TYPE_LOBBY & & itemLoop - > data ( COLUMN_DATA , ROLE_ID ) . toULongLong ( ) = = lobby . lobby_id ) {
item = itemLoop ;
break ;
}
}
if ( item = = NULL ) {
item = new RSTreeWidgetItem ( compareRole , TYPE_LOBBY ) ;
itemParent - > addChild ( item ) ;
}
if ( lobby . lobby_privacy_level = = RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC ) {
item - > setIcon ( COLUMN_NAME , QIcon ( IMAGE_PUBLIC ) ) ;
} else {
item - > setIcon ( COLUMN_NAME , QIcon ( IMAGE_PRIVATE ) ) ;
}
2012-03-16 18:47:49 -04:00
updateItem ( item , lobby . lobby_id , lobby . lobby_name , lobby . lobby_topic , lobby . nick_names . size ( ) , true ) ;
2012-01-07 16:37:31 -05:00
}
}
2012-01-07 16:01:43 -05:00
2012-01-11 19:13:25 -05:00
void ChatLobbyWidget : : createChatLobby ( )
2012-01-07 16:37:31 -05:00
{
2012-01-30 18:20:42 -05:00
int privacyLevel = 0 ;
QAction * action = qobject_cast < QAction * > ( sender ( ) ) ;
if ( action ) {
privacyLevel = action - > data ( ) . toInt ( ) ;
}
2012-01-11 19:13:25 -05:00
std : : list < std : : string > friends ;
2012-01-30 18:20:42 -05:00
CreateLobbyDialog ( friends , privacyLevel ) . exec ( ) ;
2012-01-11 19:13:25 -05:00
}
2012-01-27 13:51:27 -05:00
static void subscribeLobby ( QTreeWidgetItem * item )
2012-01-11 19:13:25 -05:00
{
if ( item = = NULL & & item - > type ( ) ! = TYPE_LOBBY ) {
return ;
}
ChatLobbyId id = item - > data ( COLUMN_DATA , ROLE_ID ) . toULongLong ( ) ;
2012-12-04 16:36:05 -05:00
if ( rsMsgs - > joinVisibleChatLobby ( id ) ) {
2012-01-11 19:13:25 -05:00
std : : string vpeer_id ;
if ( rsMsgs - > getVirtualPeerId ( id , vpeer_id ) ) {
2012-01-17 15:36:36 -05:00
ChatDialog : : chatFriend ( vpeer_id ) ;
2012-01-11 19:13:25 -05:00
}
}
}
2012-01-27 13:51:27 -05:00
void ChatLobbyWidget : : subscribeItem ( )
{
subscribeLobby ( lobbyTreeWidget - > currentItem ( ) ) ;
}
2012-01-11 19:13:25 -05:00
void ChatLobbyWidget : : unsubscribeItem ( )
{
QTreeWidgetItem * item = lobbyTreeWidget - > currentItem ( ) ;
if ( item = = NULL & & item - > type ( ) ! = TYPE_LOBBY ) {
return ;
}
const ChatLobbyId id = item - > data ( COLUMN_DATA , ROLE_ID ) . toULongLong ( ) ;
std : : string vpeer_id ;
if ( rsMsgs - > getVirtualPeerId ( id , vpeer_id ) ) {
2012-01-17 15:36:36 -05:00
ChatDialog : : closeChat ( vpeer_id ) ;
2012-01-11 19:13:25 -05:00
}
rsMsgs - > unsubscribeChatLobby ( id ) ;
}
2012-02-17 05:03:38 -05:00
void ChatLobbyWidget : : itemDoubleClicked ( QTreeWidgetItem * item , int /*column*/ )
2012-01-11 19:13:25 -05:00
{
2012-01-27 13:51:27 -05:00
subscribeLobby ( item ) ;
2012-01-11 19:13:25 -05:00
}
2013-02-22 16:42:27 -05:00
ChatTabWidget * ChatLobbyWidget : : getTabWidget ( )
{
static ChatTabWidget * instance = new ChatTabWidget ( ) ;
return instance ;
}
2012-01-11 19:13:25 -05:00
void ChatLobbyWidget : : displayChatLobbyEvent ( qulonglong lobby_id , int event_type , const QString & nickname , const QString & str )
{
std : : string vpid ;
if ( rsMsgs - > getVirtualPeerId ( lobby_id , vpid ) ) {
2012-01-17 15:36:36 -05:00
if ( ChatLobbyDialog * cld = dynamic_cast < ChatLobbyDialog * > ( ChatDialog : : getExistingChat ( vpid ) ) ) {
2012-01-11 19:13:25 -05:00
cld - > displayLobbyEvent ( event_type , nickname , str ) ;
}
}
2012-01-07 14:52:58 -05:00
}
2012-01-11 19:13:25 -05:00
void ChatLobbyWidget : : readChatLobbyInvites ( )
{
std : : list < ChatLobbyInvite > invites ;
rsMsgs - > getPendingChatLobbyInvites ( invites ) ;
for ( std : : list < ChatLobbyInvite > : : const_iterator it ( invites . begin ( ) ) ; it ! = invites . end ( ) ; + + it ) {
2012-02-06 13:48:23 -05:00
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 ( QString : : fromUtf8 ( ( * it ) . lobby_name . c_str ( ) ) ) , QMessageBox : : Ok , QMessageBox : : Ignore ) ) {
2012-01-11 19:13:25 -05:00
std : : cerr < < " Accepting invite to lobby " < < ( * it ) . lobby_name < < std : : endl ;
rsMsgs - > acceptLobbyInvite ( ( * it ) . lobby_id ) ;
2012-01-07 14:52:58 -05:00
2012-01-11 19:13:25 -05:00
std : : string vpid ;
if ( rsMsgs - > getVirtualPeerId ( ( * it ) . lobby_id , vpid ) ) {
2012-01-17 15:36:36 -05:00
ChatDialog : : chatFriend ( vpid ) ;
2012-01-11 19:13:25 -05:00
} else {
std : : cerr < < " No lobby known with id 0x " < < std : : hex < < ( * it ) . lobby_id < < std : : dec < < std : : endl ;
}
} else {
rsMsgs - > denyLobbyInvite ( ( * it ) . lobby_id ) ;
}
}
}