mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
added sasl auth
This commit is contained in:
parent
22ca20ad2a
commit
a390649d0f
5 changed files with 29 additions and 19 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -40,6 +40,8 @@ IrcConnectionEditor::IrcConnectionEditor(const IrcServerData &data, bool isAdd,
|
|||
return 1;
|
||||
case IrcAuthType::Pass:
|
||||
return 2;
|
||||
case IrcAuthType::Sasl:
|
||||
return 3;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
@ -83,6 +85,8 @@ IrcServerData IrcConnectionEditor::data()
|
|||
return IrcAuthType::Custom;
|
||||
case 2:
|
||||
return IrcAuthType::Pass;
|
||||
case 3:
|
||||
return IrcAuthType::Sasl;
|
||||
default:
|
||||
return IrcAuthType::Anonymous;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>264</width>
|
||||
<width>329</width>
|
||||
<height>414</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -158,6 +158,11 @@
|
|||
<string>Server Password (/PASS $password)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>SASL</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
|
|
Loading…
Reference in a new issue