added sasl auth

This commit is contained in:
fourtf
2019-09-15 13:15:29 +02:00
parent 22ca20ad2a
commit a390649d0f
5 changed files with 29 additions and 19 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ class QAbstractTableModel;
namespace chatterino {
enum class IrcAuthType { Anonymous, Custom, Pass };
enum class IrcAuthType { Anonymous, Custom, Pass, Sasl };
struct IrcServerData {
QString host;
+18 -15
View File
@@ -63,23 +63,26 @@ void IrcServer::initializeConnection(IrcConnection *connection,
connection->setRealName(this->data_->real.isEmpty() ? this->data_->user
: this->data_->nick);
if (this->data_->authType == IrcAuthType::Pass)
switch (this->data_->authType)
{
this->data_->getPassword(
this, [conn = new QObjectRef(connection) /* can't copy */,
this](const QString &password) mutable {
if (*conn)
{
(*conn)->setPassword(password);
this->open(Both);
}
case IrcAuthType::Sasl:
connection->setSaslMechanism("PLAIN");
[[fallthrough]];
case IrcAuthType::Pass:
this->data_->getPassword(
this, [conn = new QObjectRef(connection) /* can't copy */,
this](const QString &password) mutable {
if (*conn)
{
(*conn)->setPassword(password);
this->open(Both);
}
delete conn;
});
}
else
{
this->open(Both);
delete conn;
});
break;
default:
this->open(Both);
}
}
-2
View File
@@ -43,8 +43,6 @@ TwitchIrcServer::TwitchIrcServer()
, mentionsChannel(new Channel("/mentions", Channel::Type::TwitchMentions))
, watchingChannel(Channel::getEmpty(), Channel::Type::TwitchWatching)
{
qDebug() << "init TwitchServer";
this->pubsub = new PubSub;
// getSettings()->twitchSeperateWriteConnection.connect([this](auto, auto) {