ircconnection and about page
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
#include "messages/limitedqueuesnapshot.hpp"
|
||||
#include "messages/message.hpp"
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
using namespace chatterino::messages;
|
||||
|
||||
namespace chatterino {
|
||||
@@ -13,14 +15,14 @@ namespace irc {
|
||||
AbstractIrcServer::AbstractIrcServer()
|
||||
{
|
||||
// Initialize the connections
|
||||
this->writeConnection.reset(new Communi::IrcConnection);
|
||||
this->writeConnection.reset(new IrcConnection);
|
||||
this->writeConnection->moveToThread(QCoreApplication::instance()->thread());
|
||||
|
||||
QObject::connect(this->writeConnection.get(), &Communi::IrcConnection::messageReceived,
|
||||
[this](auto msg) { this->writeConnectionMessageReceived(msg); });
|
||||
|
||||
// Listen to read connection message signals
|
||||
this->readConnection.reset(new Communi::IrcConnection);
|
||||
this->readConnection.reset(new IrcConnection);
|
||||
this->readConnection->moveToThread(QCoreApplication::instance()->thread());
|
||||
|
||||
QObject::connect(this->readConnection.get(), &Communi::IrcConnection::messageReceived,
|
||||
@@ -33,7 +35,7 @@ AbstractIrcServer::AbstractIrcServer()
|
||||
[this] { this->onDisconnected(); });
|
||||
}
|
||||
|
||||
Communi::IrcConnection *AbstractIrcServer::getReadConnection() const
|
||||
IrcConnection *AbstractIrcServer::getReadConnection() const
|
||||
{
|
||||
return this->readConnection.get();
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
#include "channel.hpp"
|
||||
|
||||
#include <IrcConnection>
|
||||
#include <IrcMessage>
|
||||
#include <pajlada/signals/signal.hpp>
|
||||
#include <providers/irc/ircconnection2.hpp>
|
||||
|
||||
#include <functional>
|
||||
#include <mutex>
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
virtual ~AbstractIrcServer() = default;
|
||||
|
||||
// connection
|
||||
Communi::IrcConnection *getReadConnection() const;
|
||||
IrcConnection *getReadConnection() const;
|
||||
|
||||
void connect();
|
||||
void disconnect();
|
||||
@@ -43,8 +43,7 @@ public:
|
||||
protected:
|
||||
AbstractIrcServer();
|
||||
|
||||
virtual void initializeConnection(Communi::IrcConnection *connection, bool isRead,
|
||||
bool isWrite) = 0;
|
||||
virtual void initializeConnection(IrcConnection *connection, bool isRead, bool isWrite) = 0;
|
||||
virtual std::shared_ptr<Channel> createChannel(const QString &channelName) = 0;
|
||||
|
||||
virtual void privateMessageReceived(Communi::IrcPrivateMessage *message);
|
||||
@@ -64,10 +63,12 @@ protected:
|
||||
private:
|
||||
void initConnection();
|
||||
|
||||
std::unique_ptr<Communi::IrcConnection> writeConnection = nullptr;
|
||||
std::unique_ptr<Communi::IrcConnection> readConnection = nullptr;
|
||||
std::unique_ptr<IrcConnection> writeConnection = nullptr;
|
||||
std::unique_ptr<IrcConnection> readConnection = nullptr;
|
||||
|
||||
std::mutex connectionMutex;
|
||||
|
||||
QTimer pingTimer;
|
||||
};
|
||||
|
||||
} // namespace irc
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "ircconnection2.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
namespace providers {
|
||||
namespace irc {
|
||||
|
||||
IrcConnection::IrcConnection(QObject *parent)
|
||||
: Communi::IrcConnection(parent)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace irc
|
||||
} // namespace providers
|
||||
} // namespace chatterino
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <IrcConnection>
|
||||
|
||||
namespace chatterino {
|
||||
namespace providers {
|
||||
namespace irc {
|
||||
|
||||
class IrcConnection : public Communi::IrcConnection
|
||||
{
|
||||
public:
|
||||
IrcConnection(QObject *parent = nullptr);
|
||||
};
|
||||
|
||||
} // namespace irc
|
||||
} // namespace providers
|
||||
} // namespace chatterino
|
||||
Reference in New Issue
Block a user