aboutsummaryrefslogtreecommitdiff
path: root/include/dchat/Room.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/dchat/Room.hpp')
-rw-r--r--include/dchat/Room.hpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/dchat/Room.hpp b/include/dchat/Room.hpp
index 6980bfc..56b60e5 100644
--- a/include/dchat/Room.hpp
+++ b/include/dchat/Room.hpp
@@ -39,11 +39,13 @@ namespace dchat
std::shared_ptr<User> getUserByPublicKey(const odhtdb::Signature::PublicKey &userPublicKey);
// Returns null if group doesn't exist in room
std::shared_ptr<Group> getGroupById(const odhtdb::DataView groupId);
- void setLocalUser(std::shared_ptr<User> user, std::shared_ptr<odhtdb::Signature::KeyPair> keyPair);
void setAvatarUrl(const std::string &url);
void setNickname(const std::string &nickname);
void publishMessage(const std::string &msg);
+ const odhtdb::Signature::MapPublicKey<std::shared_ptr<User>>& getUsers() const { return userByPublicKey; }
+ const std::vector<std::shared_ptr<RoomMessage>>& getMessages() const { return messages; }
+
Rooms *rooms;
std::shared_ptr<odhtdb::Hash> id;
std::shared_ptr<odhtdb::OwnedByteArray> encryptionKey;
@@ -55,6 +57,8 @@ namespace dchat
// TODO: Move to private when we have proper support for groups
std::vector<std::shared_ptr<Group>> groups;
private:
+ void setLocalUser(std::shared_ptr<User> user, std::shared_ptr<odhtdb::Signature::KeyPair> keyPair);
+ private:
odhtdb::Signature::MapPublicKey<std::shared_ptr<User>> userByPublicKey;
// Used for local users
odhtdb::Signature::MapPublicKey<std::shared_ptr<odhtdb::Signature::KeyPair>> publicKeyToKeyPairMap;
@@ -152,6 +156,9 @@ namespace dchat
void requestJoinRoom(const std::string &inviteKey, const std::string &message);
std::shared_ptr<odhtdb::Database> database;
+
+ const odhtdb::MapHash<std::shared_ptr<Room>>& getRooms() const { return roomById; }
+ bool isLoggedIn() const { return loggedIn; }
private:
Rooms(const char *address, u16 port, RoomCallbackFuncs callbackFuncs);
void createNodeCallbackFunc(const odhtdb::DatabaseCreateNodeRequest &request);