From 0469c43a45310b6b92eb704773e3a34beb57f288 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 1 Nov 2018 07:17:49 +0100 Subject: Move room code to dchat_core, add ability to send messages --- include/ChatWindow.hpp | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'include/ChatWindow.hpp') diff --git a/include/ChatWindow.hpp b/include/ChatWindow.hpp index 0b58506..988b225 100644 --- a/include/ChatWindow.hpp +++ b/include/ChatWindow.hpp @@ -1,6 +1,6 @@ #pragma once -#include "User.hpp" +#include #include #include #include @@ -20,13 +20,11 @@ namespace dchat { public: ChatWindow(); - void addChannel(const odhtdb::Hash &nodeHash); - void addLocalMessage(const odhtdb::Hash &channelId, const odhtdb::Signature::PublicKey &userPublicKey, uint32_t timestampSeconds, Glib::ustring msg); - void addUser(const odhtdb::Signature::PublicKey &userPublicKey); - void setUserNickname(const odhtdb::Signature::PublicKey &userPublicKey, const Glib::ustring &name); - - // Returns nullptr if user with @publicKey is not found - User* getUserByPublicKey(const odhtdb::Signature::PublicKey &publicKey) const; + void addRoom(std::shared_ptr room); + void addMessage(const RoomAddMessageRequest &request); + void addUser(std::shared_ptr room, std::shared_ptr user); + void setUserNickname(const UserChangeNicknameRequest &request); + void scrollToBottom(); private: void setupTopBar(); void setupLeftPanel(Gtk::Paned *sidePanels); @@ -42,17 +40,15 @@ namespace dchat Gtk::Grid messageAreaLayout; Gtk::TextView chatInput; - struct ChannelData + struct RoomData { Gtk::ToggleButton *button; - int messageCount; }; - odhtdb::MapHash channelDataById; - int channelCount; - std::vector users; - - ChatMessage *lastMessage; + odhtdb::MapHash roomDataById; + odhtdb::MapHash messageById; int chatPrevNumLines; + int roomCount; + std::shared_ptr currentRoom; }; } \ No newline at end of file -- cgit v1.2.3