aboutsummaryrefslogtreecommitdiff
path: root/include/Channel.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-08-08 23:17:10 +0200
committerdec05eba <dec05eba@protonmail.com>2018-08-08 23:17:14 +0200
commit06f30543730c372226c398c11b3de0213d711d13 (patch)
treed6229ff224a9e7e5457c856747c2f8726e7a3868 /include/Channel.hpp
parent26edc563cb0ba1a9fb35507e7f32d2d43a845e68 (diff)
Add support for discord
Diffstat (limited to 'include/Channel.hpp')
-rw-r--r--include/Channel.hpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/include/Channel.hpp b/include/Channel.hpp
index af6cbf2..663b163 100644
--- a/include/Channel.hpp
+++ b/include/Channel.hpp
@@ -5,7 +5,10 @@
#include "User.hpp"
#include "Channel.hpp"
#include "types.hpp"
+#include "Suggestions.hpp"
+#include "../bridge/DiscordService.hpp"
#include <vector>
+#include <unordered_map>
#include <SFML/System/Clock.hpp>
#include <odhtdb/DatabaseNode.hpp>
#include <odhtdb/Signature.hpp>
@@ -28,7 +31,9 @@ namespace dchat
DELETE_MESSAGE,
NICKNAME_CHANGE,
CHANGE_AVATAR,
- CHANGE_CHANNEL_NAME
+ CHANGE_CHANNEL_NAME,
+
+ ADD_DISCORD_MESSAGE
};
class Channel
@@ -44,7 +49,7 @@ namespace dchat
MessageBoard& getMessageBoard();
const std::string& getName() const;
- const std::vector<User*> getUsers() const;
+ const std::vector<User*>& getUsers() const;
OnlineUser* getUserByPublicKey(const odhtdb::Signature::PublicKey &publicKey);
const odhtdb::DatabaseNode& getNodeInfo() const;
Message* getLatestMessage();
@@ -52,8 +57,10 @@ 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 addLocalDiscordMessage(const std::string &discordUserName, u64 discordUserId, 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 addDiscordMessage(const std::string &discordUserName, u64 discordUserId, 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);
@@ -64,6 +71,9 @@ namespace dchat
void setAvatar(const std::string &newAvatarUrl);
void setNameLocally(const std::string &name);
void setName(const std::string &name);
+
+ // Returns -1 on failure
+ int getUserLowestPermissionLevel(OnlineUser *user) const;
void processEvent(const sf::Event &event, Cache &cache);
void draw(sf::RenderWindow &window, Cache &cache);
@@ -71,6 +81,9 @@ namespace dchat
void update();
// Returns 0 if we are offline
u32 getSyncedTimestampUtcInSec();
+
+ const std::vector<BridgeService*>& getBridgeServices() const;
+ DiscordService* getDiscordService();
static void setCurrent(Channel *channel);
static Channel* getCurrent();
@@ -82,12 +95,16 @@ namespace dchat
std::string name;
MessageBoard messageBoard;
Chatbar chatbar;
+ Suggestions suggestions;
User *localUser;
SystemUser systemUser;
std::vector<User*> users;
+ std::unordered_map<u64, OnlineDiscordUser*> discordUserById;
odhtdb::Signature::MapPublicKey<OnlineUser*> publicKeyOnlineUsersMap;
dht::InfoHash pingKey;
std::future<size_t> pingListener;
sf::Clock pingTimer;
+
+ std::vector<BridgeService*> bridgeServices;
};
}