aboutsummaryrefslogtreecommitdiff
path: root/include/Channel.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-04-28 15:31:27 +0200
committerdec05eba <dec05eba@protonmail.com>2018-04-28 15:31:33 +0200
commit9d84d5d8e7f61a02c01eef021ea5e8b2f49dcf8f (patch)
treec680f1d77e09d8333299d4098b0093240e138f91 /include/Channel.hpp
parent3b03f87070d91f63f0dc3c7152723727781dcccf (diff)
Connect channels to database, currently only locally
Diffstat (limited to 'include/Channel.hpp')
-rw-r--r--include/Channel.hpp30
1 files changed, 25 insertions, 5 deletions
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 <vector>
+#include <odhtdb/DatabaseNode.hpp>
+#include <odhtdb/Signature.hpp>
+
+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<User*> 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<User*> users;
+ odhtdb::Signature::MapPublicKey<OnlineUser*> publicKeyOnlineUsersMap;
};
}