added bool return value to denyLobbyInvite() and marked overriding methods in p3msgs accordingly

This commit is contained in:
csoler 2021-08-29 21:15:52 +02:00
parent 448b00f95a
commit e22c5c9702
5 changed files with 65 additions and 62 deletions

View File

@ -1513,7 +1513,7 @@ ChatLobbyVirtualPeerId DistributedChatService::makeVirtualPeerId(ChatLobbyId lob
} }
void DistributedChatService::denyLobbyInvite(const ChatLobbyId& lobby_id) bool DistributedChatService::denyLobbyInvite(const ChatLobbyId& lobby_id)
{ {
RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/ RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
@ -1525,10 +1525,12 @@ void DistributedChatService::denyLobbyInvite(const ChatLobbyId& lobby_id)
if(it == _lobby_invites_queue.end()) if(it == _lobby_invites_queue.end())
{ {
std::cerr << " (EE) lobby invite not in cache!!" << std::endl; std::cerr << " (EE) lobby invite not in cache!!" << std::endl;
return ; return false;
} }
_lobby_invites_queue.erase(it) ; _lobby_invites_queue.erase(it) ;
return true;
} }
bool DistributedChatService::joinVisibleChatLobby(const ChatLobbyId& lobby_id,const RsGxsId& gxs_id) bool DistributedChatService::joinVisibleChatLobby(const ChatLobbyId& lobby_id,const RsGxsId& gxs_id)

View File

@ -61,7 +61,7 @@ class DistributedChatService
void getChatLobbyList(std::list<ChatLobbyId>& clids) ; void getChatLobbyList(std::list<ChatLobbyId>& clids) ;
bool getChatLobbyInfo(const ChatLobbyId& id,ChatLobbyInfo& clinfo) ; bool getChatLobbyInfo(const ChatLobbyId& id,ChatLobbyInfo& clinfo) ;
bool acceptLobbyInvite(const ChatLobbyId& id,const RsGxsId& identity) ; bool acceptLobbyInvite(const ChatLobbyId& id,const RsGxsId& identity) ;
void denyLobbyInvite(const ChatLobbyId& id) ; bool denyLobbyInvite(const ChatLobbyId& id) ;
void getPendingChatLobbyInvites(std::list<ChatLobbyInvite>& invites) ; void getPendingChatLobbyInvites(std::list<ChatLobbyInvite>& invites) ;
void invitePeerToLobby(const ChatLobbyId&, const RsPeerId& peer_id,bool connexion_challenge = false) ; void invitePeerToLobby(const ChatLobbyId&, const RsPeerId& peer_id,bool connexion_challenge = false) ;
void unsubscribeChatLobby(const ChatLobbyId& lobby_id) ; void unsubscribeChatLobby(const ChatLobbyId& lobby_id) ;

View File

@ -906,8 +906,9 @@ virtual void getOwnAvatarData(unsigned char *& data,int& size) = 0 ;
* @brief denyLobbyInvite deny a chat lobby invite * @brief denyLobbyInvite deny a chat lobby invite
* @jsonapi{development} * @jsonapi{development}
* @param[in] id chat lobby id you were invited into * @param[in] id chat lobby id you were invited into
*/ * @return true on success
virtual void denyLobbyInvite(const ChatLobbyId &id) = 0 ; */
virtual bool denyLobbyInvite(const ChatLobbyId &id) = 0 ;
/** /**
* @brief getPendingChatLobbyInvites get a list of all pending chat lobby invites * @brief getPendingChatLobbyInvites get a list of all pending chat lobby invites

View File

@ -530,9 +530,9 @@ bool p3Msgs::acceptLobbyInvite(const ChatLobbyId& id,const RsGxsId& gxs_id)
{ {
return mChatSrv->acceptLobbyInvite(id,gxs_id) ; return mChatSrv->acceptLobbyInvite(id,gxs_id) ;
} }
void p3Msgs::denyLobbyInvite(const ChatLobbyId& id) bool p3Msgs::denyLobbyInvite(const ChatLobbyId& id)
{ {
mChatSrv->denyLobbyInvite(id) ; return mChatSrv->denyLobbyInvite(id) ;
} }
void p3Msgs::getPendingChatLobbyInvites(std::list<ChatLobbyInvite>& invites) void p3Msgs::getPendingChatLobbyInvites(std::list<ChatLobbyInvite>& invites)
{ {

View File

@ -64,66 +64,66 @@ public:
/*! /*!
* @param msgList ref to list summarising client's msgs * @param msgList ref to list summarising client's msgs
*/ */
virtual bool getMessageSummaries(std::list<Rs::Msgs::MsgInfoSummary> &msgList); virtual bool getMessageSummaries(std::list<Rs::Msgs::MsgInfoSummary> &msgList)override ;
virtual bool getMessage(const std::string &mId, Rs::Msgs::MessageInfo &msg); virtual bool getMessage(const std::string &mId, Rs::Msgs::MessageInfo &msg)override ;
virtual void getMessageCount(uint32_t &nInbox, uint32_t &nInboxNew, uint32_t &nOutbox, uint32_t &nDraftbox, uint32_t &nSentbox, uint32_t &nTrashbox); virtual void getMessageCount(uint32_t &nInbox, uint32_t &nInboxNew, uint32_t &nOutbox, uint32_t &nDraftbox, uint32_t &nSentbox, uint32_t &nTrashbox)override ;
RS_DEPRECATED_FOR(sendMail) RS_DEPRECATED_FOR(sendMail)
virtual bool MessageSend(Rs::Msgs::MessageInfo &info); virtual bool MessageSend(Rs::Msgs::MessageInfo &info)override ;
virtual bool SystemMessage(const std::string &title, const std::string &message, uint32_t systemFlag); virtual bool SystemMessage(const std::string &title, const std::string &message, uint32_t systemFlag)override ;
virtual bool MessageToDraft(Rs::Msgs::MessageInfo &info, const std::string &msgParentId); virtual bool MessageToDraft(Rs::Msgs::MessageInfo &info, const std::string &msgParentId)override ;
virtual bool MessageToTrash(const std::string &mid, bool bTrash); virtual bool MessageToTrash(const std::string &mid, bool bTrash)override ;
virtual bool MessageDelete(const std::string &mid); virtual bool MessageDelete(const std::string &mid)override ;
virtual bool MessageRead(const std::string &mid, bool unreadByUser); virtual bool MessageRead(const std::string &mid, bool unreadByUser)override ;
virtual bool MessageReplied(const std::string &mid, bool replied); virtual bool MessageReplied(const std::string &mid, bool replied)override ;
virtual bool MessageForwarded(const std::string &mid, bool forwarded); virtual bool MessageForwarded(const std::string &mid, bool forwarded)override ;
virtual bool MessageStar(const std::string &mid, bool star); virtual bool MessageStar(const std::string &mid, bool star)override ;
virtual bool MessageJunk(const std::string &mid, bool junk); virtual bool MessageJunk(const std::string &mid, bool junk)override ;
virtual bool MessageLoadEmbeddedImages(const std::string &mid, bool load); virtual bool MessageLoadEmbeddedImages(const std::string &mid, bool load)override ;
virtual bool getMsgParentId(const std::string &msgId, std::string &msgParentId); virtual bool getMsgParentId(const std::string &msgId, std::string &msgParentId)override ;
virtual bool getMessageTagTypes(Rs::Msgs::MsgTagType& tags); virtual bool getMessageTagTypes(Rs::Msgs::MsgTagType& tags)override ;
virtual bool setMessageTagType(uint32_t tagId, std::string& text, uint32_t rgb_color); virtual bool setMessageTagType(uint32_t tagId, std::string& text, uint32_t rgb_color)override ;
virtual bool removeMessageTagType(uint32_t tagId); virtual bool removeMessageTagType(uint32_t tagId)override ;
virtual bool getMessageTag(const std::string &msgId, Rs::Msgs::MsgTagInfo& info); virtual bool getMessageTag(const std::string &msgId, Rs::Msgs::MsgTagInfo& info)override ;
/* set == false && tagId == 0 --> remove all */ /* set == false && tagId == 0 --> remove all */
virtual bool setMessageTag(const std::string &msgId, uint32_t tagId, bool set); virtual bool setMessageTag(const std::string &msgId, uint32_t tagId, bool set)override ;
virtual bool resetMessageStandardTagTypes(Rs::Msgs::MsgTagType& tags); virtual bool resetMessageStandardTagTypes(Rs::Msgs::MsgTagType& tags)override ;
virtual uint32_t getDistantMessagingPermissionFlags() ; virtual uint32_t getDistantMessagingPermissionFlags() override ;
virtual void setDistantMessagingPermissionFlags(uint32_t flags) ; virtual void setDistantMessagingPermissionFlags(uint32_t flags) override ;
/*! /*!
* gets avatar from peer, image data in jpeg format * gets avatar from peer, image data in jpeg format
*/ */
virtual void getAvatarData(const RsPeerId& pid,unsigned char *& data,int& size); virtual void getAvatarData(const RsPeerId& pid,unsigned char *& data,int& size)override ;
/*! /*!
* sets clients avatar, image data should be in jpeg format * sets clients avatar, image data should be in jpeg format
*/ */
virtual void setOwnAvatarData(const unsigned char *data,int size); virtual void setOwnAvatarData(const unsigned char *data,int size)override ;
/*! /*!
* retrieve clients avatar, image data in jpeg format * retrieve clients avatar, image data in jpeg format
*/ */
virtual void getOwnAvatarData(unsigned char *& data,int& size); virtual void getOwnAvatarData(unsigned char *& data,int& size)override ;
/*! /*!
* sets clients custom status (e.g. "i'm tired") * sets clients custom status (e.g. "i'm tired")
*/ */
virtual void setCustomStateString(const std::string& status_string) ; virtual void setCustomStateString(const std::string& status_string) override ;
/*! /*!
* retrieves client's custom status * retrieves client's custom status
*/ */
virtual std::string getCustomStateString() ; virtual std::string getCustomStateString() override ;
/*! /*!
* retrieves peer's custom status * retrieves peer's custom status
*/ */
virtual std::string getCustomStateString(const RsPeerId& peer_id) ; virtual std::string getCustomStateString(const RsPeerId& peer_id) override ;
/*! /*!
@ -132,56 +132,56 @@ public:
* @param msg the message * @param msg the message
* @see ChatId * @see ChatId
*/ */
virtual bool sendChat(ChatId destination, std::string msg) ; virtual bool sendChat(ChatId destination, std::string msg) override ;
/*! /*!
* Return the max message size for security forwarding * Return the max message size for security forwarding
*/ */
virtual uint32_t getMaxMessageSecuritySize(int type); virtual uint32_t getMaxMessageSecuritySize(int type)override ;
/*! /*!
* sends immediate status string to a specific peer, e.g. in a private chat * sends immediate status string to a specific peer, e.g. in a private chat
* @param chat_id chat id to send status string to * @param chat_id chat id to send status string to
* @param status_string immediate status to send * @param status_string immediate status to send
*/ */
virtual void sendStatusString(const ChatId& id, const std::string& status_string) ; virtual void sendStatusString(const ChatId& id, const std::string& status_string) override ;
/** /**
* @brief clearChatLobby: Signal chat was cleared by GUI. * @brief clearChatLobby: Signal chat was cleared by GUI.
* @param id: Chat id cleared. * @param id: Chat id cleared.
*/ */
virtual void clearChatLobby(const ChatId &id); virtual void clearChatLobby(const ChatId &id)override ;
/****************************************/ /****************************************/
virtual bool joinVisibleChatLobby(const ChatLobbyId& id, const RsGxsId &own_id) ; virtual bool joinVisibleChatLobby(const ChatLobbyId& id, const RsGxsId &own_id) override ;
virtual void getListOfNearbyChatLobbies(std::vector<VisibleChatLobbyRecord>& public_lobbies) ; virtual void getListOfNearbyChatLobbies(std::vector<VisibleChatLobbyRecord>& public_lobbies) override ;
virtual void getChatLobbyList(std::list<ChatLobbyId>& cl_list) ; virtual void getChatLobbyList(std::list<ChatLobbyId>& cl_list) override ;
virtual bool getChatLobbyInfo(const ChatLobbyId& id,ChatLobbyInfo& info) ; virtual bool getChatLobbyInfo(const ChatLobbyId& id,ChatLobbyInfo& info) override ;
virtual void invitePeerToLobby(const ChatLobbyId&, const RsPeerId&) ; virtual void invitePeerToLobby(const ChatLobbyId&, const RsPeerId&) override ;
virtual bool acceptLobbyInvite(const ChatLobbyId& id, const RsGxsId &gxs_id) ; virtual bool acceptLobbyInvite(const ChatLobbyId& id, const RsGxsId &gxs_id) override ;
virtual void denyLobbyInvite(const ChatLobbyId& id) ; virtual bool denyLobbyInvite(const ChatLobbyId& id) override ;
virtual void getPendingChatLobbyInvites(std::list<ChatLobbyInvite>& invites) ; virtual void getPendingChatLobbyInvites(std::list<ChatLobbyInvite>& invites) override ;
virtual void unsubscribeChatLobby(const ChatLobbyId& lobby_id) ; virtual void unsubscribeChatLobby(const ChatLobbyId& lobby_id) override ;
virtual void sendLobbyStatusPeerLeaving(const ChatLobbyId& lobby_id); virtual void sendLobbyStatusPeerLeaving(const ChatLobbyId& lobby_id)override ;
virtual bool setIdentityForChatLobby(const ChatLobbyId& lobby_id,const RsGxsId&) ; virtual bool setIdentityForChatLobby(const ChatLobbyId& lobby_id,const RsGxsId&) override ;
virtual bool getIdentityForChatLobby(const ChatLobbyId&,RsGxsId& nick) ; virtual bool getIdentityForChatLobby(const ChatLobbyId&,RsGxsId& nick) override ;
virtual bool setDefaultIdentityForChatLobby(const RsGxsId&) ; virtual bool setDefaultIdentityForChatLobby(const RsGxsId&) override ;
virtual void getDefaultIdentityForChatLobby(RsGxsId& nick) ; virtual void getDefaultIdentityForChatLobby(RsGxsId& nick) override ;
virtual void setLobbyAutoSubscribe(const ChatLobbyId& lobby_id, const bool autoSubscribe); virtual void setLobbyAutoSubscribe(const ChatLobbyId& lobby_id, const bool autoSubscribe)override ;
virtual bool getLobbyAutoSubscribe(const ChatLobbyId& lobby_id); virtual bool getLobbyAutoSubscribe(const ChatLobbyId& lobby_id)override ;
virtual ChatLobbyId createChatLobby(const std::string& lobby_name,const RsGxsId& lobby_identity,const std::string& lobby_topic,const std::set<RsPeerId>& invited_friends,ChatLobbyFlags privacy_type) ; virtual ChatLobbyId createChatLobby(const std::string& lobby_name,const RsGxsId& lobby_identity,const std::string& lobby_topic,const std::set<RsPeerId>& invited_friends,ChatLobbyFlags privacy_type) override ;
virtual bool initiateDistantChatConnexion( virtual bool initiateDistantChatConnexion(
const RsGxsId& to_gxs_id, const RsGxsId& from_gxs_id, const RsGxsId& to_gxs_id, const RsGxsId& from_gxs_id,
DistantChatPeerId &pid, uint32_t& error_code, DistantChatPeerId &pid, uint32_t& error_code,
bool notify = true ); bool notify = true )override ;
virtual bool getDistantChatStatus(const DistantChatPeerId& gxs_id,DistantChatPeerInfo& info); virtual bool getDistantChatStatus(const DistantChatPeerId& gxs_id,DistantChatPeerInfo& info)override ;
virtual bool closeDistantChatConnexion(const DistantChatPeerId &pid) ; virtual bool closeDistantChatConnexion(const DistantChatPeerId &pid) override ;
virtual uint32_t getDistantChatPermissionFlags() ; virtual uint32_t getDistantChatPermissionFlags() override ;
virtual bool setDistantChatPermissionFlags(uint32_t flags) ; virtual bool setDistantChatPermissionFlags(uint32_t flags) override ;
private: private: