mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 14:16:16 -04:00
Preparation for mute Peers in the Chat Lobby.
RS_CHAT_LOBBY_EVENT_PEER_CHANGE_NICKNAME is send, when changing nickname, so the blocklist can be updated (in future). This will never wort for 100% as discussed in the developer forum, but should stop the most spam. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5150 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
22a8e6f3c9
commit
22bfcb62bc
7 changed files with 82 additions and 6 deletions
|
@ -251,6 +251,7 @@ virtual bool clearPrivateChatQueue(bool incoming, const std::string& id) = 0;
|
|||
virtual void sendStatusString(const std::string& id,const std::string& status_string) = 0 ;
|
||||
virtual void sendGroupChatStatusString(const std::string& status_string) = 0 ;
|
||||
|
||||
|
||||
virtual void setCustomStateString(const std::string& status_string) = 0 ;
|
||||
virtual std::string getCustomStateString() = 0 ;
|
||||
virtual std::string getCustomStateString(const std::string& peer_id) = 0 ;
|
||||
|
@ -262,6 +263,11 @@ virtual void setOwnAvatarData(const unsigned char *data,int size) = 0 ;
|
|||
virtual void getOwnAvatarData(unsigned char *& data,int& size) = 0 ;
|
||||
|
||||
virtual bool joinPublicChatLobby(const ChatLobbyId& lobby_id) = 0 ;
|
||||
|
||||
|
||||
virtual bool sendLobbyStatusPeerChangedNickname(const ChatLobbyId& lobby_id) = 0 ;
|
||||
|
||||
|
||||
virtual bool isLobbyId(const std::string& virtual_peer_id,ChatLobbyId& lobby_id) = 0;
|
||||
virtual bool getVirtualPeerId(const ChatLobbyId& lobby_id,std::string& vpid) = 0;
|
||||
virtual void getChatLobbyList(std::list<ChatLobbyInfo>& cl_info) = 0;
|
||||
|
|
|
@ -308,6 +308,12 @@ bool p3Msgs::joinPublicChatLobby(const ChatLobbyId& lobby_id)
|
|||
return mChatSrv->joinPublicChatLobby(lobby_id) ;
|
||||
}
|
||||
|
||||
bool p3Msgs::sendLobbyStatusPeerChangedNickname(const ChatLobbyId& lobby_id)
|
||||
{
|
||||
return mChatSrv->sendLobbyStatusPeerChangedNickname(lobby_id) ;
|
||||
}
|
||||
|
||||
|
||||
void p3Msgs::getListOfNearbyChatLobbies(std::vector<PublicChatLobbyRecord>& public_lobbies)
|
||||
{
|
||||
mChatSrv->getListOfNearbyChatLobbies(public_lobbies) ;
|
||||
|
|
|
@ -170,6 +170,9 @@ class p3Msgs: public RsMsgs
|
|||
|
||||
|
||||
virtual bool joinPublicChatLobby(const ChatLobbyId& id) ;
|
||||
|
||||
virtual bool sendLobbyStatusPeerChangedNickname(const ChatLobbyId& id) ;
|
||||
|
||||
virtual void getListOfNearbyChatLobbies(std::vector<PublicChatLobbyRecord>& public_lobbies) ;
|
||||
virtual bool getVirtualPeerId(const ChatLobbyId& id,std::string& vpid) ;
|
||||
virtual bool isLobbyId(const std::string& virtual_peer_id,ChatLobbyId& lobby_id) ;
|
||||
|
|
|
@ -372,6 +372,7 @@ bool p3ChatService::isLobbyId(const std::string& id,ChatLobbyId& lobby_id)
|
|||
return false ;
|
||||
}
|
||||
|
||||
|
||||
bool p3ChatService::sendPrivateChat(const std::string &id, const std::wstring &msg)
|
||||
{
|
||||
// look into ID. Is it a peer, or a chat lobby?
|
||||
|
@ -1768,6 +1769,22 @@ void p3ChatService::sendLobbyStatusString(const ChatLobbyId& lobby_id,const std:
|
|||
{
|
||||
sendLobbyStatusItem(lobby_id,RS_CHAT_LOBBY_EVENT_PEER_STATUS,status_string) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inform other Clients of a nickname change
|
||||
*
|
||||
* as example for updating their ChatLobby Blocklist for muted peers
|
||||
* */
|
||||
bool p3ChatService::sendLobbyStatusPeerChangedNickname(const ChatLobbyId& lobby_id)
|
||||
{
|
||||
std::string nick ;
|
||||
getNickNameForChatLobby(lobby_id,nick) ;
|
||||
|
||||
sendLobbyStatusItem(lobby_id,RS_CHAT_LOBBY_EVENT_PEER_CHANGE_NICKNAME,nick) ;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void p3ChatService::sendLobbyStatusPeerLiving(const ChatLobbyId& lobby_id)
|
||||
{
|
||||
std::string nick ;
|
||||
|
@ -2426,6 +2443,7 @@ bool p3ChatService::setNickNameForChatLobby(const ChatLobbyId& lobby_id,const st
|
|||
{
|
||||
RsStackMutex stack(mChatMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "Changing nickname for chat lobby " << std::hex << lobby_id << std::dec << " to " << nick << std::endl;
|
||||
#endif
|
||||
|
@ -2437,6 +2455,10 @@ bool p3ChatService::setNickNameForChatLobby(const ChatLobbyId& lobby_id,const st
|
|||
return false;
|
||||
}
|
||||
|
||||
// // inform other user about name change
|
||||
// sendLobbyStatusPeerChangedNickname(lobby_id);
|
||||
|
||||
|
||||
it->second.nick_name = nick ;
|
||||
return true ;
|
||||
}
|
||||
|
|
|
@ -76,6 +76,8 @@ class p3ChatService: public p3Service, public p3Config, public pqiMonitor
|
|||
*/
|
||||
bool sendPrivateChat(const std::string &id, const std::wstring &msg);
|
||||
|
||||
bool sendLobbyStatusPeerChangedNickname(const ChatLobbyId& lobby_id) ;
|
||||
|
||||
/*!
|
||||
* can be used to send 'immediate' status msgs, these status updates are meant for immediate use by peer (not saved by rs)
|
||||
* e.g currently used to update user when a peer 'is typing' during a chat
|
||||
|
@ -241,6 +243,7 @@ class p3ChatService: public p3Service, public p3Config, public pqiMonitor
|
|||
|
||||
void sendLobbyStatusItem(const ChatLobbyId&, int type, const std::string& status_string) ;
|
||||
void sendLobbyStatusPeerLiving(const ChatLobbyId& lobby_id) ;
|
||||
|
||||
void sendLobbyStatusNewPeer(const ChatLobbyId& lobby_id) ;
|
||||
void sendLobbyStatusKeepAlive(const ChatLobbyId&) ;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue