2017-01-03 21:19:33 +01:00
|
|
|
#ifndef IRCMANAGER_H
|
|
|
|
#define IRCMANAGER_H
|
|
|
|
|
|
|
|
#define TWITCH_MAX_MESSAGELENGTH 500
|
|
|
|
|
2017-01-04 15:12:31 +01:00
|
|
|
#include "account.h"
|
2017-01-05 16:07:20 +01:00
|
|
|
#include "message.h"
|
2017-01-16 03:15:07 +01:00
|
|
|
|
|
|
|
#include <IrcMessage>
|
|
|
|
#include <QMap>
|
|
|
|
#include <QMutex>
|
|
|
|
#include <QNetworkAccessManager>
|
|
|
|
#include <QString>
|
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-17 00:15:44 +01:00
|
|
|
static void joinChannel(const QString &channel);
|
|
|
|
|
|
|
|
static void partChannel(const QString &channel);
|
|
|
|
|
2017-01-03 21:19:33 +01:00
|
|
|
private:
|
|
|
|
IrcManager();
|
|
|
|
|
2017-01-17 00:15:44 +01:00
|
|
|
static QMap<QString, bool> m_twitchBlockedUsers;
|
|
|
|
static QMutex m_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-17 00:15:44 +01:00
|
|
|
static IrcConnection *m_connection;
|
|
|
|
static QMutex m_connectionMutex;
|
|
|
|
static long m_connectionIteration;
|
2017-01-03 21:19:33 +01:00
|
|
|
|
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
|