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

View file

@ -10,7 +10,7 @@ class QAbstractTableModel;
namespace chatterino { namespace chatterino {
enum class IrcAuthType { Anonymous, Custom, Pass }; enum class IrcAuthType { Anonymous, Custom, Pass, Sasl };
struct IrcServerData { struct IrcServerData {
QString host; QString host;

View file

@ -63,8 +63,12 @@ void IrcServer::initializeConnection(IrcConnection *connection,
connection->setRealName(this->data_->real.isEmpty() ? this->data_->user connection->setRealName(this->data_->real.isEmpty() ? this->data_->user
: this->data_->nick); : this->data_->nick);
if (this->data_->authType == IrcAuthType::Pass) switch (this->data_->authType)
{ {
case IrcAuthType::Sasl:
connection->setSaslMechanism("PLAIN");
[[fallthrough]];
case IrcAuthType::Pass:
this->data_->getPassword( this->data_->getPassword(
this, [conn = new QObjectRef(connection) /* can't copy */, this, [conn = new QObjectRef(connection) /* can't copy */,
this](const QString &password) mutable { this](const QString &password) mutable {
@ -76,9 +80,8 @@ void IrcServer::initializeConnection(IrcConnection *connection,
delete conn; delete conn;
}); });
} break;
else default:
{
this->open(Both); this->open(Both);
} }
} }

View file

@ -43,8 +43,6 @@ TwitchIrcServer::TwitchIrcServer()
, mentionsChannel(new Channel("/mentions", Channel::Type::TwitchMentions)) , mentionsChannel(new Channel("/mentions", Channel::Type::TwitchMentions))
, watchingChannel(Channel::getEmpty(), Channel::Type::TwitchWatching) , watchingChannel(Channel::getEmpty(), Channel::Type::TwitchWatching)
{ {
qDebug() << "init TwitchServer";
this->pubsub = new PubSub; this->pubsub = new PubSub;
// getSettings()->twitchSeperateWriteConnection.connect([this](auto, auto) { // getSettings()->twitchSeperateWriteConnection.connect([this](auto, auto) {

View file

@ -40,6 +40,8 @@ IrcConnectionEditor::IrcConnectionEditor(const IrcServerData &data, bool isAdd,
return 1; return 1;
case IrcAuthType::Pass: case IrcAuthType::Pass:
return 2; return 2;
case IrcAuthType::Sasl:
return 3;
default: default:
return 0; return 0;
} }
@ -83,6 +85,8 @@ IrcServerData IrcConnectionEditor::data()
return IrcAuthType::Custom; return IrcAuthType::Custom;
case 2: case 2:
return IrcAuthType::Pass; return IrcAuthType::Pass;
case 3:
return IrcAuthType::Sasl;
default: default:
return IrcAuthType::Anonymous; return IrcAuthType::Anonymous;
} }

View file

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>264</width> <width>329</width>
<height>414</height> <height>414</height>
</rect> </rect>
</property> </property>
@ -158,6 +158,11 @@
<string>Server Password (/PASS $password)</string> <string>Server Password (/PASS $password)</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>SASL</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="10" column="0"> <item row="10" column="0">