From 9d84d5d8e7f61a02c01eef021ea5e8b2f49dcf8f Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 28 Apr 2018 15:31:27 +0200 Subject: Connect channels to database, currently only locally --- include/Channel.hpp | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'include/Channel.hpp') diff --git a/include/Channel.hpp b/include/Channel.hpp index 4bdb4b5..6f5495f 100644 --- a/include/Channel.hpp +++ b/include/Channel.hpp @@ -4,25 +4,45 @@ #include "Chatbar.hpp" #include "User.hpp" #include "Channel.hpp" +#include +#include +#include + +namespace odhtdb +{ + class Database; +} namespace dchat { class Channel { public: - Channel(const std::string &name); - ~Channel(); + Channel(const std::string &name, const odhtdb::DatabaseNode &databaseNodeInfo = odhtdb::DatabaseNode(), User *localUser = nullptr, odhtdb::Database *database = nullptr); + virtual ~Channel(); User* getLocalUser(); MessageBoard& getMessageBoard(); + const std::string& getName() const; + const std::vector getUsers() const; + User* getUserByPublicKey(const odhtdb::Signature::PublicKey &publicKey); + + void addLocalMessage(const std::string &msg, User *owner); + void addMessage(const std::string &msg); + void addUser(User *user); void processEvent(const sf::Event &event); void draw(sf::RenderWindow &window, Cache &cache); - private: + protected: + odhtdb::Database *database; + odhtdb::DatabaseNode databaseNodeInfo; + std::string name; MessageBoard messageBoard; Chatbar chatbar; - OfflineUser localOfflineUser; - std::string name; + User *localUser; + SystemUser systemUser; + std::vector users; + odhtdb::Signature::MapPublicKey publicKeyOnlineUsersMap; }; } -- cgit v1.2.3