From c2841e19c227f9c0f7cef3023e012c5c80f6def4 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 3 May 2018 13:16:04 +0200 Subject: Support different types of channel data. Add nickname change command --- include/Channel.hpp | 10 +++++++++- include/User.hpp | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'include') 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 #include #include @@ -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 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; }; -- cgit v1.2.3