small corrections.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-ChatLobby@4695 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2011-11-27 21:46:49 +00:00
parent 6c93253050
commit b01470c639
7 changed files with 33 additions and 4 deletions

View File

@ -233,6 +233,7 @@ virtual void invitePeerToLobby(const ChatLobbyId& lobby_id,const std::string& pe
virtual void unsubscribeChatLobby(const ChatLobbyId& lobby_id) = 0;
virtual bool setNickNameForChatLobby(const ChatLobbyId& lobby_id,const std::string& nick) = 0;
virtual bool getNickNameForChatLobby(const ChatLobbyId& lobby_id,std::string& nick) = 0 ;
virtual ChatLobbyId createChatLobby(const std::string& lobby_name,const std::list<std::string>& invited_friends) = 0 ;
/****************************************/

View File

@ -285,4 +285,9 @@ bool p3Msgs::getNickNameForChatLobby(const ChatLobbyId& lobby_id,std::string& ni
return mChatSrv->getNickNameForChatLobby(lobby_id,nick_name) ;
}
ChatLobbyId p3Msgs::createChatLobby(const std::string& lobby_name,const std::list<std::string>& invited_friends)
{
return mChatSrv->createChatLobby(lobby_name,invited_friends) ;
}

View File

@ -173,7 +173,7 @@ class p3Msgs: public RsMsgs
virtual void unsubscribeChatLobby(const ChatLobbyId& lobby_id) ;
virtual bool setNickNameForChatLobby(const ChatLobbyId& lobby_id,const std::string&) ;
virtual bool getNickNameForChatLobby(const ChatLobbyId&,std::string& nick) ;
virtual ChatLobbyId createChatLobby(const std::string& lobby_name,const std::list<std::string>& invited_friends) ;
private:

View File

@ -1352,7 +1352,7 @@ void p3ChatService::denyLobbyInvite(const ChatLobbyId& lobby_id)
_lobby_invites_queue.erase(it) ;
}
void p3ChatService::createChatLobby(const std::string& lobby_name,const std::list<std::string>& invited_friends)
ChatLobbyId p3ChatService::createChatLobby(const std::string& lobby_name,const std::list<std::string>& invited_friends)
{
std::cerr << "Creating a new Chat lobby !!" << std::endl;
ChatLobbyId lobby_id ;
@ -1376,6 +1376,8 @@ void p3ChatService::createChatLobby(const std::string& lobby_name,const std::lis
for(std::list<std::string>::const_iterator it(invited_friends.begin());it!=invited_friends.end();++it)
invitePeerToLobby(lobby_id,*it) ;
return lobby_id ;
}
void p3ChatService::unsubscribeChatLobby(const ChatLobbyId& id)

View File

@ -159,6 +159,7 @@ class p3ChatService: public p3Service, public p3Config, public pqiMonitor
bool setNickNameForChatLobby(const ChatLobbyId& lobby_id,const std::string& nick) ;
void unsubscribeChatLobby(const ChatLobbyId& lobby_id) ;
bool getNickNameForChatLobby(const ChatLobbyId& lobby_id,std::string& nick) ;
ChatLobbyId createChatLobby(const std::string& lobby_name,const std::list<std::string>& invited_friends) ;
protected:
/************* from p3Config *******************/
@ -210,7 +211,6 @@ class p3ChatService: public p3Service, public p3Config, public pqiMonitor
void handleRecvLobbyInvite(RsChatLobbyInviteItem*) ;
bool acceptLobbyInvite(const ChatLobbyId&) ;
void denyLobbyInvite(const ChatLobbyId&) ;
void createChatLobby(const std::string& lobby_name,const std::list<std::string>& invited_friends) ;
RsChatAvatarItem *makeOwnAvatarItem() ;
RsChatStatusItem *makeOwnCustomStateStringItem() ;

View File

@ -349,7 +349,7 @@ void FriendList::peerTreeWidgetCostumPopupMenu()
mnu->addAction(inviteToLobbyAction);
}
mnu->addAction(QIcon(IMAGE_CHAT),tr("create new")) ;
mnu->addAction(QIcon(IMAGE_CHAT),tr("create new"),this,SLOT(createchatlobby())) ;
contextMnu.addAction(QIcon(IMAGE_MSG), tr("Message Friend"), this, SLOT(msgfriend()));
@ -1414,6 +1414,26 @@ void FriendList::inviteToLobby()
rsMsgs->invitePeerToLobby(ChatLobbyId(QString::fromStdString(lobby_id).toULongLong()), peer_id);
}
void FriendList::createchatlobby()
{
QTreeWidgetItem *c = getCurrentPeer();
if (c == NULL)
return;
std::list<std::string> friend_list ;
std::string peer_id = getRsId(c) ;
friend_list.push_back(peer_id) ;
std::string lobby_name = "New lobby (Plz add the code to select this name at creation time)" ;
// add to group
ChatLobbyId id = rsMsgs->createChatLobby(lobby_name, friend_list);
std::cerr << "gui: Created chat lobby " << std::hex << id << std::endl ;
}
void FriendList::addToGroup()
{
QTreeWidgetItem *c = getCurrentPeer();

View File

@ -124,6 +124,7 @@ private slots:
void removeGroup();
void inviteToLobby();
void createchatlobby();
};
#endif // FRIENDLIST_H