aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-05-03 13:16:04 +0200
committerdec05eba <dec05eba@protonmail.com>2018-05-03 13:16:10 +0200
commitc2841e19c227f9c0f7cef3023e012c5c80f6def4 (patch)
treeb29328141537e54d5d53d1636c7d6c1b20ec72f9 /include
parent9bb631f1e1861c63f38125fffb91081c98a1cfcc (diff)
Support different types of channel data. Add nickname change command
Diffstat (limited to 'include')
-rw-r--r--include/Channel.hpp10
-rw-r--r--include/User.hpp1
2 files changed, 10 insertions, 1 deletions
diff --git a/include/Channel.hpp b/include/Channel.hpp
index 535cce5..17128fd 100644
--- a/include/Channel.hpp
+++ b/include/Channel.hpp
@@ -4,6 +4,7 @@
#include "Chatbar.hpp"
#include "User.hpp"
#include "Channel.hpp"
+#include "types.hpp"
#include <vector>
#include <odhtdb/DatabaseNode.hpp>
#include <odhtdb/Signature.hpp>
@@ -16,6 +17,12 @@ namespace odhtdb
namespace dchat
{
+ enum class ChannelDataType : u8
+ {
+ MESSAGE,
+ NICKNAME_CHANGE
+ };
+
class Channel
{
public:
@@ -30,7 +37,7 @@ namespace dchat
const std::string& getName() const;
const std::vector<User*> getUsers() const;
- User* getUserByPublicKey(const odhtdb::Signature::PublicKey &publicKey);
+ OnlineUser* getUserByPublicKey(const odhtdb::Signature::PublicKey &publicKey);
const odhtdb::DatabaseNode& getNodeInfo() const;
// If timestamp is 0, then timestamp is not used
@@ -39,6 +46,7 @@ namespace dchat
void addUserLocally(User *user);
bool addUser(const odhtdb::Signature::PublicKey &userId, const std::string &groupId);
void replaceLocalUser(User *newLocalUser);
+ void changeNick(const std::string &newNick);
void processEvent(const sf::Event &event);
void draw(sf::RenderWindow &window, Cache &cache);
diff --git a/include/User.hpp b/include/User.hpp
index e9e334a..821be6f 100644
--- a/include/User.hpp
+++ b/include/User.hpp
@@ -32,6 +32,7 @@ namespace dchat
OnlineUser(const odhtdb::User *databaseUser);
virtual const std::string& getName() const override;
+ std::string name;
const odhtdb::User *databaseUser;
};