aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-05-21 13:58:47 +0200
committerdec05eba <dec05eba@protonmail.com>2018-05-21 14:00:09 +0200
commitc47ec545d87e622aa950e653e4f91721d79bb049 (patch)
treee74c2ba840d7d32a4d20e73f4d318f0f3a8b5c44 /include
parent8052fe6d6170ccbec9052b89e331ae786c69ee05 (diff)
Add command to change avatar and channel name
Fix bug where application crashes when deleting message, improve url parsing for messages
Diffstat (limited to 'include')
-rw-r--r--include/Channel.hpp8
-rw-r--r--include/Command.hpp3
-rw-r--r--include/Message.hpp2
3 files changed, 11 insertions, 2 deletions
diff --git a/include/Channel.hpp b/include/Channel.hpp
index 26b5286..5f5699e 100644
--- a/include/Channel.hpp
+++ b/include/Channel.hpp
@@ -26,7 +26,9 @@ namespace dchat
ADD_MESSAGE,
EDIT_MESSAGE,
DELETE_MESSAGE,
- NICKNAME_CHANGE
+ NICKNAME_CHANGE,
+ CHANGE_AVATAR,
+ CHANGE_CHANNEL_NAME
};
class Channel
@@ -49,6 +51,7 @@ namespace dchat
// If timestamp is 0, then current time is used
void addLocalMessage(const std::string &msg, User *owner, u64 timestampSeconds = 0);
void addLocalMessage(const std::string &msg, User *owner, u64 timestampSeconds, const odhtdb::Hash &id);
+ void addSystemMessage(const std::string &msg, bool plainText = true);
void addMessage(const std::string &msg);
void deleteLocalMessage(const odhtdb::Hash &id, const odhtdb::Signature::PublicKey &requestedByUser);
void deleteMessage(const odhtdb::Hash &id, const odhtdb::Signature::PublicKey &requestedByUser);
@@ -57,6 +60,9 @@ namespace dchat
bool addUser(const odhtdb::Signature::PublicKey &userId, const odhtdb::DataView &groupId);
void replaceLocalUser(OnlineLocalUser *newOnlineLocalUser);
void changeNick(const std::string &newNick);
+ void setAvatar(const std::string &newAvatarUrl);
+ void setNameLocally(const std::string &name);
+ void setName(const std::string &name);
void processEvent(const sf::Event &event, Cache &cache);
void draw(sf::RenderWindow &window, Cache &cache);
diff --git a/include/Command.hpp b/include/Command.hpp
index fe8a947..fe08664 100644
--- a/include/Command.hpp
+++ b/include/Command.hpp
@@ -3,6 +3,7 @@
#include <vector>
#include <string>
#include <functional>
+#include <unordered_map>
namespace dchat
{
@@ -13,5 +14,7 @@ namespace dchat
public:
static bool add(const std::string &cmd, CommandHandlerFunc handlerFunc);
static bool call(const std::string &cmd, const std::vector<std::string> &args);
+
+ static const std::unordered_map<std::string, CommandHandlerFunc>& getCommands();
};
}
diff --git a/include/Message.hpp b/include/Message.hpp
index a2d67e8..2327a0b 100644
--- a/include/Message.hpp
+++ b/include/Message.hpp
@@ -18,7 +18,7 @@ namespace dchat
};
// If timestamp is 0, then timestamp is not used
- Message(User *user, const std::string &text, u64 timestampSeconds = 0);
+ Message(User *user, const std::string &text, u64 timestampSeconds = 0, bool plainText = false);
const User *user;
Text text;