2017-01-03 21:19:33 +01:00
|
|
|
#ifndef IRCMANAGER_H
|
|
|
|
#define IRCMANAGER_H
|
|
|
|
|
|
|
|
#define TWITCH_MAX_MESSAGELENGTH 500
|
|
|
|
|
|
|
|
#include "IrcMessage"
|
2017-01-11 18:52:09 +01:00
|
|
|
#include "QMap"
|
2017-01-03 21:19:33 +01:00
|
|
|
#include "QMutex"
|
2017-01-04 15:12:31 +01:00
|
|
|
#include "QString"
|
|
|
|
#include "account.h"
|
2017-01-05 16:07:20 +01:00
|
|
|
#include "message.h"
|
2017-01-11 18:52:09 +01:00
|
|
|
#include "qnetworkaccessmanager.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);
|
2017-01-11 18:52:09 +01:00
|
|
|
bool tryAddIgnoredUser(QString const &username, QString &errorMessage);
|
2017-01-04 15:12:31 +01:00
|
|
|
void addIgnoredUser(QString const &username);
|
2017-01-11 18:52:09 +01:00
|
|
|
bool tryRemoveIgnoredUser(QString const &username, QString &errorMessage);
|
2017-01-04 15:12:31 +01:00
|
|
|
void removeIgnoredUser(QString const &username);
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
static Account *account;
|
|
|
|
|
|
|
|
static QNetworkAccessManager &
|
|
|
|
accessManager()
|
|
|
|
{
|
2017-01-11 19:33:46 +01:00
|
|
|
return m_accessManager;
|
2017-01-11 18:52:09 +01:00
|
|
|
}
|
2017-01-04 15:12:31 +01:00
|
|
|
|
2017-01-03 21:19:33 +01:00
|
|
|
private:
|
|
|
|
IrcManager();
|
|
|
|
|
2017-01-11 19:33:46 +01:00
|
|
|
static QMap<QString, bool> twitchBlockedUsers;
|
|
|
|
static QMutex twitchBlockedUsersMutex;
|
2017-01-04 15:12:31 +01:00
|
|
|
|
2017-01-11 19:33:46 +01:00
|
|
|
static QNetworkAccessManager m_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-11 18:52:09 +01:00
|
|
|
static IrcConnection *connection;
|
2017-01-11 19:33:46 +01:00
|
|
|
static QMutex connectionMutex;
|
2017-01-03 21:19:33 +01:00
|
|
|
static long connectionIteration;
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
static void messageReceived(IrcMessage *message);
|
|
|
|
static void privateMessageReceived(IrcPrivateMessage *message);
|
2017-01-03 21:19:33 +01:00
|
|
|
};
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
#endif // IRCMANAGER_H
|