- derived new class of PopupChatDialog to handle chat lobbies

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-ChatLobby@4694 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2011-11-27 21:04:10 +00:00
parent f4e41b3247
commit 6c93253050
11 changed files with 209 additions and 913 deletions

View file

@ -230,6 +230,9 @@ virtual void getOwnAvatarData(unsigned char *& data,int& size) = 0 ;
virtual void getChatLobbyList(std::list<ChatLobbyInfo>& cl_info) = 0;
virtual void invitePeerToLobby(const ChatLobbyId& lobby_id,const std::string& peer_id) = 0;
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 ;
/****************************************/
@ -237,3 +240,4 @@ virtual void invitePeerToLobby(const ChatLobbyId& lobby_id,const std::string& pe
#endif

View file

@ -272,5 +272,17 @@ void p3Msgs::invitePeerToLobby(const ChatLobbyId& lobby_id, const std::string& p
{
mChatSrv->invitePeerToLobby(lobby_id,peer_id) ;
}
void p3Msgs::unsubscribeChatLobby(const ChatLobbyId& lobby_id)
{
mChatSrv->unsubscribeChatLobby(lobby_id) ;
}
bool p3Msgs::setNickNameForChatLobby(const ChatLobbyId& lobby_id,const std::string& nick)
{
return mChatSrv->setNickNameForChatLobby(lobby_id,nick) ;
}
bool p3Msgs::getNickNameForChatLobby(const ChatLobbyId& lobby_id,std::string& nick_name)
{
return mChatSrv->getNickNameForChatLobby(lobby_id,nick_name) ;
}

View file

@ -170,6 +170,10 @@ class p3Msgs: public RsMsgs
virtual bool sendLobbyChat(const std::wstring&, const ChatLobbyId&) ;
virtual void getChatLobbyList(std::list<ChatLobbyInfo, std::allocator<ChatLobbyInfo> >&) ;
virtual void invitePeerToLobby(const ChatLobbyId&, const std::string&) ;
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) ;
private:

View file

@ -1378,3 +1378,43 @@ void p3ChatService::createChatLobby(const std::string& lobby_name,const std::lis
invitePeerToLobby(lobby_id,*it) ;
}
void p3ChatService::unsubscribeChatLobby(const ChatLobbyId& id)
{
RsStackMutex stack(mChatMtx); /********** STACK LOCKED MTX ******/
// send a lobby leaving packet. To be implemented.
}
bool p3ChatService::getNickNameForChatLobby(const ChatLobbyId& lobby_id,std::string& nick)
{
RsStackMutex stack(mChatMtx); /********** STACK LOCKED MTX ******/
std::cerr << "getting nickname for chat lobby "<< std::hex << lobby_id << std::dec << std::endl;
std::map<ChatLobbyId,ChatLobbyEntry>::iterator it = _chat_lobbys.find(lobby_id) ;
if(it == _chat_lobbys.end())
{
std::cerr << " (EE) lobby does not exist!!" << std::endl;
return false ;
}
nick = it->second.nick_name ;
return true ;
}
bool p3ChatService::setNickNameForChatLobby(const ChatLobbyId& lobby_id,const std::string& nick)
{
RsStackMutex stack(mChatMtx); /********** STACK LOCKED MTX ******/
std::cerr << "Changing nickname for chat lobby " << std::hex << lobby_id << std::dec << " to " << nick << std::endl;
std::map<ChatLobbyId,ChatLobbyEntry>::iterator it = _chat_lobbys.find(lobby_id) ;
if(it == _chat_lobbys.end())
{
std::cerr << " (EE) lobby does not exist!!" << std::endl;
return false;
}
it->second.nick_name = nick ;
return true ;
}

View file

@ -156,9 +156,9 @@ class p3ChatService: public p3Service, public p3Config, public pqiMonitor
bool sendLobbyChat(const std::wstring&, const ChatLobbyId&) ;
void getChatLobbyList(std::list<ChatLobbyInfo, std::allocator<ChatLobbyInfo> >&) ;
void invitePeerToLobby(const ChatLobbyId&, const std::string&) ;
void setLobbyNickName(const ChatLobbyNickName&) ;
const ChatLobbyNickName& lobbyNickName() const ;
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) ;
protected:
/************* from p3Config *******************/