2017-06-07 10:09:24 +02:00
|
|
|
#pragma once
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2017-06-11 09:31:45 +02:00
|
|
|
#include "channel.hpp"
|
2017-06-15 23:13:01 +02:00
|
|
|
#include "channeldata.hpp"
|
2017-09-16 00:05:06 +02:00
|
|
|
#include "twitch/twitchchannel.hpp"
|
2017-06-15 23:13:01 +02:00
|
|
|
|
|
|
|
#include <map>
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
namespace chatterino {
|
2017-12-31 22:58:35 +01:00
|
|
|
namespace singletons {
|
2017-06-13 21:13:58 +02:00
|
|
|
class IrcManager;
|
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
class ChannelManager
|
|
|
|
{
|
2017-12-31 00:50:07 +01:00
|
|
|
explicit ChannelManager();
|
2017-12-17 17:49:32 +01:00
|
|
|
|
2017-12-31 00:50:07 +01:00
|
|
|
public:
|
|
|
|
static ChannelManager &getInstance();
|
2017-09-17 04:36:48 +02:00
|
|
|
|
2017-06-11 11:36:42 +02:00
|
|
|
const std::vector<std::shared_ptr<Channel>> getItems();
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2017-12-31 00:50:07 +01:00
|
|
|
std::shared_ptr<Channel> addTwitchChannel(const QString &channel);
|
|
|
|
std::shared_ptr<Channel> getTwitchChannel(const QString &channel);
|
2017-09-16 00:05:06 +02:00
|
|
|
void removeTwitchChannel(const QString &channel);
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2017-06-15 23:13:01 +02:00
|
|
|
const std::string &getUserID(const std::string &username);
|
|
|
|
|
2017-12-31 00:50:07 +01:00
|
|
|
void doOnAll(std::function<void(std::shared_ptr<Channel>)> func);
|
2017-12-16 18:11:36 +01:00
|
|
|
|
2017-07-23 09:53:50 +02:00
|
|
|
// Special channels
|
2017-12-31 00:50:07 +01:00
|
|
|
const std::shared_ptr<Channel> whispersChannel;
|
|
|
|
const std::shared_ptr<Channel> mentionsChannel;
|
|
|
|
const std::shared_ptr<Channel> emptyChannel;
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2017-07-23 09:53:50 +02:00
|
|
|
private:
|
2017-06-15 23:13:01 +02:00
|
|
|
std::map<std::string, std::string> usernameToID;
|
|
|
|
std::map<std::string, ChannelData> channelDatas;
|
|
|
|
|
2017-07-23 09:53:50 +02:00
|
|
|
QMutex channelsMutex;
|
2017-09-16 00:05:06 +02:00
|
|
|
QMap<QString, std::tuple<std::shared_ptr<twitch::TwitchChannel>, int>> twitchChannels;
|
2017-12-31 00:50:07 +01:00
|
|
|
|
|
|
|
pajlada::Signals::Signal<const QString &> ircJoin;
|
|
|
|
pajlada::Signals::Signal<const QString &> ircPart;
|
|
|
|
|
2017-12-31 22:58:35 +01:00
|
|
|
friend class singletons::IrcManager;
|
2017-04-12 17:46:44 +02:00
|
|
|
};
|
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
} // namespace chatterino
|
2017-12-31 22:58:35 +01:00
|
|
|
}
|