mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Add echo-message support for IRC (#4157)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
parent
49eb5c90cf
commit
8627d6c919
|
@ -83,6 +83,7 @@
|
|||
- Minor: Add settings tooltips. (#3437)
|
||||
- Minor: Add setting to limit message input length. (#3418)
|
||||
- Minor: Make built-in commands work in IRC channels. (#4160)
|
||||
- Minor: Add support for `echo-message` capabilities for IRC. (#4157)
|
||||
- Minor: Improved look of tabs when using a layout other than top. (#3925, #4152)
|
||||
- Bugfix: Fixed channels with two leading `#`s not being usable on IRC (#4154)
|
||||
- Bugfix: Fixed `Add new account` dialog causing main chatterino window to be non movable. (#4121)
|
||||
|
|
|
@ -38,7 +38,10 @@ void IrcChannel::sendMessage(const QString &message)
|
|||
if (this->server() != nullptr)
|
||||
{
|
||||
this->server()->sendMessage(this->getName(), message);
|
||||
|
||||
if (this->server()->hasEcho())
|
||||
{
|
||||
return;
|
||||
}
|
||||
MessageBuilder builder;
|
||||
|
||||
builder
|
||||
|
|
|
@ -111,6 +111,15 @@ void IrcServer::initializeConnectionSignals(IrcConnection *connection,
|
|||
}
|
||||
}
|
||||
});
|
||||
QObject::connect(connection,
|
||||
&Communi::IrcConnection::capabilityMessageReceived, this,
|
||||
[this](Communi::IrcCapabilityMessage *message) {
|
||||
const QStringList caps = message->capabilities();
|
||||
if (caps.contains("echo-message"))
|
||||
{
|
||||
this->hasEcho_ = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void IrcServer::initializeConnection(IrcConnection *connection,
|
||||
|
@ -127,6 +136,7 @@ void IrcServer::initializeConnection(IrcConnection *connection,
|
|||
: this->data_->nick);
|
||||
connection->setRealName(this->data_->real.isEmpty() ? this->data_->user
|
||||
: this->data_->nick);
|
||||
connection->network()->setRequestedCapabilities({"echo-message"});
|
||||
|
||||
if (getSettings()->enableExperimentalIrc)
|
||||
{
|
||||
|
@ -289,4 +299,9 @@ void IrcServer::readConnectionMessageReceived(Communi::IrcMessage *message)
|
|||
}
|
||||
}
|
||||
|
||||
bool IrcServer::hasEcho() const
|
||||
{
|
||||
return this->hasEcho_;
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
|
|
@ -20,6 +20,8 @@ public:
|
|||
const QString &nick();
|
||||
const QString &userFriendlyIdentifier();
|
||||
|
||||
bool hasEcho() const;
|
||||
|
||||
// AbstractIrcServer interface
|
||||
protected:
|
||||
void initializeConnectionSignals(IrcConnection *connection,
|
||||
|
@ -36,6 +38,8 @@ protected:
|
|||
private:
|
||||
// pointer so we don't have to circle include Irc2.hpp
|
||||
IrcServerData *data_;
|
||||
|
||||
bool hasEcho_{false};
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
|
Loading…
Reference in a new issue