aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/dchat/Room.hpp13
-rw-r--r--include/dchat/User.hpp1
2 files changed, 14 insertions, 0 deletions
diff --git a/include/dchat/Room.hpp b/include/dchat/Room.hpp
index a39f2f0..9eef4de 100644
--- a/include/dchat/Room.hpp
+++ b/include/dchat/Room.hpp
@@ -39,6 +39,8 @@ namespace dchat
// 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);
Rooms *rooms;
@@ -71,6 +73,15 @@ namespace dchat
std::string newNickname;
};
+ struct UserChangeAvatarRequest
+ {
+ std::shared_ptr<Room> room;
+ std::shared_ptr<User> user;
+ uint32_t timestampSeconds;
+ bool loadedFromCache;
+ std::string url;
+ };
+
struct RoomChangeNameRequest
{
std::shared_ptr<Room> room;
@@ -103,6 +114,7 @@ namespace dchat
using RoomAddUserCallbackFunc = std::function<void(const RoomAddUserRequest &request)>;
using RoomAddMessageCallbackFunc = std::function<void(const RoomAddMessageRequest &request)>;
using UserChangeNicknameCallbackFunc = std::function<void(const UserChangeNicknameRequest &request)>;
+ using UserChangeAvatarCallbackFunc = std::function<void(const UserChangeAvatarRequest &request)>;
using ChangeRoomNameCallbackFunc = std::function<void(const RoomChangeNameRequest &request)>;
using ReceiveInviteUserCallbackFunc = std::function<void(const InviteUserRequest &request)>;
struct RoomCallbackFuncs
@@ -112,6 +124,7 @@ namespace dchat
RoomAddUserCallbackFunc addUserCallbackFunc;
RoomAddMessageCallbackFunc addMessageCallbackFunc;
UserChangeNicknameCallbackFunc userChangeNicknameCallbackFunc;
+ UserChangeAvatarCallbackFunc userChangeAvatarCallbackFunc;
ChangeRoomNameCallbackFunc changeRoomNameCallbackFunc;
ReceiveInviteUserCallbackFunc receiveInviteUserCallbackFunc;
};
diff --git a/include/dchat/User.hpp b/include/dchat/User.hpp
index 245197f..9d22cb3 100644
--- a/include/dchat/User.hpp
+++ b/include/dchat/User.hpp
@@ -14,6 +14,7 @@ namespace dchat
User(const odhtdb::Signature::PublicKey &_publicKey) : publicKey(_publicKey), userdata(nullptr) {}
const odhtdb::Signature::PublicKey publicKey;
std::string nickname;
+ std::string avatarUrl;
std::vector<std::shared_ptr<Group>> groups;
void *userdata;
};