mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-11-29 11:56:37 -05:00
Add a checker which prevents of adding your own gpg_id.
Add an inactive friends list based on last seen Unix timestamp. Add a method of removing a specific peer based on peer_id. As fas as I know, the same pgp_id will discorvery themself and add online subnodes automaticlly even you remove one of them their just keep coming back, but if you accidently add your own peer_id on the WebUI, the peer list will show two identical PGP names and its subnodes, untill the retroshare gets restarted. And this modification don't add the same peer_id as long as it belongs to your current node, it doesn't mean you can't add your new nodes with the same pgp_id but different peer_id. Honor the Allman indent style
This commit is contained in:
parent
66bf1884a8
commit
f348558077
2 changed files with 518 additions and 291 deletions
|
|
@ -34,22 +34,22 @@ namespace resource_api
|
|||
class PeersHandler: public ResourceRouter, NotifyClient, Tickable, public UnreadMsgNotify
|
||||
{
|
||||
public:
|
||||
PeersHandler(StateTokenServer* sts, RsNotify* notify, RsPeers* peers, RsMsgs* msgs);
|
||||
virtual ~PeersHandler();
|
||||
PeersHandler(StateTokenServer* sts, RsNotify* notify, RsPeers* peers, RsMsgs* msgs);
|
||||
virtual ~PeersHandler();
|
||||
|
||||
// from NotifyClient
|
||||
// note: this may get called from foreign threads
|
||||
virtual void notifyListChange(int list, int type); // friends list change
|
||||
// from NotifyClient
|
||||
// note: this may get called from foreign threads
|
||||
virtual void notifyListChange(int list, int type); // friends list change
|
||||
virtual void notifyPeerStatusChanged(const std::string& /*peer_id*/, uint32_t /*state*/);
|
||||
virtual void notifyPeerHasNewAvatar(std::string /*peer_id*/);
|
||||
virtual void notifyPeerHasNewAvatar(std::string /*peer_id*/);
|
||||
|
||||
// from Tickable
|
||||
virtual void tick();
|
||||
// from Tickable
|
||||
virtual void tick();
|
||||
|
||||
// from UnreadMsgNotify
|
||||
// ChatHandler calls this to tell us about unreadmsgs
|
||||
// this allows to merge unread msgs info with the peers list
|
||||
virtual void notifyUnreadMsgCountChanged(const RsPeerId& peer, uint32_t count);
|
||||
// from UnreadMsgNotify
|
||||
// ChatHandler calls this to tell us about unreadmsgs
|
||||
// this allows to merge unread msgs info with the peers list
|
||||
virtual void notifyUnreadMsgCountChanged(const RsPeerId& peer, uint32_t count);
|
||||
|
||||
private:
|
||||
void handleWildcard(Request& req, Response& resp);
|
||||
|
|
@ -72,24 +72,26 @@ private:
|
|||
|
||||
void handleGetNodeOptions(Request& req, Response& resp);
|
||||
void handleSetNodeOptions(Request& req, Response& resp);
|
||||
|
||||
void handleRemoveNode(Request &req, Response &resp);
|
||||
void handleGetInactiveUsers(Request &req, Response &resp);
|
||||
// a helper which ensures proper mutex locking
|
||||
StateToken getCurrentStateToken();
|
||||
|
||||
// a helper which ensures proper mutex locking
|
||||
StateToken getCurrentStateToken();
|
||||
StateTokenServer* mStateTokenServer;
|
||||
RsNotify* mNotify;
|
||||
RsPeers* mRsPeers;
|
||||
RsMsgs* mRsMsgs; // required for avatar data
|
||||
|
||||
StateTokenServer* mStateTokenServer;
|
||||
RsNotify* mNotify;
|
||||
RsPeers* mRsPeers;
|
||||
RsMsgs* mRsMsgs; // required for avatar data
|
||||
|
||||
std::list<RsPeerId> mOnlinePeers;
|
||||
std::list<RsPeerId> mOnlinePeers;
|
||||
uint32_t status;
|
||||
std::string custom_state_string;
|
||||
|
||||
RsMutex mMtx;
|
||||
StateToken mStateToken; // mutex protected
|
||||
RsMutex mMtx;
|
||||
StateToken mStateToken; // mutex protected
|
||||
StateToken mStringStateToken; // mutex protected
|
||||
StateToken mCustomStateToken; // mutex protected
|
||||
|
||||
std::map<RsPeerId, uint32_t> mUnreadMsgsCounts;
|
||||
std::map<RsPeerId, uint32_t> mUnreadMsgsCounts;
|
||||
};
|
||||
} // namespace resource_api
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue