2017-01-03 21:19:33 +01:00
|
|
|
#ifndef IRCMANAGER_H
|
|
|
|
#define IRCMANAGER_H
|
|
|
|
|
|
|
|
#define TWITCH_MAX_MESSAGELENGTH 500
|
|
|
|
|
|
|
|
#include "IrcMessage"
|
|
|
|
#include "QMutex"
|
2017-01-04 15:12:31 +01:00
|
|
|
#include "QString"
|
|
|
|
#include "QMap"
|
|
|
|
#include "account.h"
|
|
|
|
#include "qnetworkaccessmanager.h"
|
2017-01-05 16:07:20 +01:00
|
|
|
#include "message.h"
|
2017-01-03 21:19:33 +01:00
|
|
|
|
|
|
|
class IrcManager
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static void connect();
|
|
|
|
static void disconnect();
|
|
|
|
|
2017-01-04 15:12:31 +01:00
|
|
|
static const QString defaultClientId;
|
|
|
|
|
|
|
|
bool isTwitchBlockedUser(QString const &username);
|
|
|
|
bool tryAddIgnoredUser(QString const &username, QString& errorMessage);
|
|
|
|
void addIgnoredUser(QString const &username);
|
|
|
|
bool tryRemoveIgnoredUser(QString const &username, QString& errorMessage);
|
|
|
|
void removeIgnoredUser(QString const &username);
|
|
|
|
|
|
|
|
static Account* account;
|
|
|
|
|
2017-01-03 21:19:33 +01:00
|
|
|
private:
|
|
|
|
IrcManager();
|
|
|
|
|
2017-01-04 15:12:31 +01:00
|
|
|
static QMap<QString, bool>* twitchBlockedUsers;
|
|
|
|
static QMutex* twitchBlockedUsersMutex;
|
|
|
|
|
|
|
|
static QNetworkAccessManager* accessManager;
|
2017-01-03 21:19:33 +01:00
|
|
|
|
2017-01-04 15:12:31 +01:00
|
|
|
static void beginConnecting();
|
2017-01-03 22:08:20 +01:00
|
|
|
|
2017-01-03 21:19:33 +01:00
|
|
|
static IrcConnection* connection;
|
|
|
|
static QMutex* connectionMutex;
|
|
|
|
static long connectionIteration;
|
|
|
|
|
|
|
|
static void messageReceived(IrcMessage* message);
|
|
|
|
static void privateMessageReceived(IrcPrivateMessage* message);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // IRCMANAGER_H
|