From 431c1dcded16649c10331b9dc4e57f20067cea0b Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 1 May 2018 13:27:52 +0200 Subject: Add 'add user', 'join channel'. Improve scrolling. Added locks --- include/Channel.hpp | 9 ++++++++- include/MessageBoard.hpp | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/Channel.hpp b/include/Channel.hpp index 5650eb1..be6e7c7 100644 --- a/include/Channel.hpp +++ b/include/Channel.hpp @@ -7,6 +7,7 @@ #include #include #include +#include namespace odhtdb { @@ -20,18 +21,24 @@ namespace dchat public: Channel(const std::string &name, const odhtdb::DatabaseNode &databaseNodeInfo = odhtdb::DatabaseNode(), User *localUser = nullptr, odhtdb::Database *database = nullptr); virtual ~Channel(); + Channel(const Channel& other) = delete; + Channel& operator = (const Channel &other) = delete; User* getLocalUser(); + SystemUser* getSystemUser(); MessageBoard& getMessageBoard(); const std::string& getName() const; const std::vector getUsers() const; User* getUserByPublicKey(const odhtdb::Signature::PublicKey &publicKey); + std::shared_ptr getId(); // If timestamp is 0, then timestamp is not used void addLocalMessage(const std::string &msg, User *owner, u64 timestampSeconds = 0); void addMessage(const std::string &msg); - void addUser(User *user); + void addUserLocally(User *user); + bool addUser(const odhtdb::Signature::PublicKey &userId, const std::string &groupId); + void replaceLocalUser(User *newLocalUser); void processEvent(const sf::Event &event); void draw(sf::RenderWindow &window, Cache &cache); diff --git a/include/MessageBoard.hpp b/include/MessageBoard.hpp index 739f161..e84396d 100644 --- a/include/MessageBoard.hpp +++ b/include/MessageBoard.hpp @@ -36,5 +36,6 @@ namespace dchat double scrollSpeed; sf::Clock frameTimer; double totalHeight; + bool scrollToBottom; }; } -- cgit v1.2.3