aboutsummaryrefslogtreecommitdiff
path: root/include/ChatWindow.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/ChatWindow.hpp')
-rw-r--r--include/ChatWindow.hpp26
1 files changed, 11 insertions, 15 deletions
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 <dchat/Room.hpp>
#include <gtkmm/label.h>
#include <gtkmm/togglebutton.h>
#include <gtkmm/grid.h>
@@ -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> room);
+ void addMessage(const RoomAddMessageRequest &request);
+ void addUser(std::shared_ptr<Room> room, std::shared_ptr<User> 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<ChannelData> channelDataById;
- int channelCount;
- std::vector<User*> users;
-
- ChatMessage *lastMessage;
+ odhtdb::MapHash<RoomData> roomDataById;
+ odhtdb::MapHash<ChatMessage*> messageById;
int chatPrevNumLines;
+ int roomCount;
+ std::shared_ptr<Room> currentRoom;
};
} \ No newline at end of file