Commit e4085aed authored by Peter Simonsson's avatar Peter Simonsson

Disable WHO requests for twitch.tv servers

twitch.tv's IRC servers doesn't  have support for the WHO command so  let's
disable all WHO requests for servers that requests twitch.tv capabilities

BUG: 340748
parent 7d2899b4
......@@ -2305,6 +2305,9 @@ void Channel::scheduleAutoWho(int msec)
// If this is called mid-interval (e.g. due to the ENDOFWHO from a manual WHO)
// it will reset the interval to avoid cutting it short.
if (m_server->whoRequestsDisabled())
return;
if (m_whoTimer.isActive())
m_whoTimer.stop();
......
......@@ -90,6 +90,7 @@ Server::Server(QObject* parent, ConnectionSettings& settings) : QObject(parent)
m_autoJoin = false;
m_capabilities = NoCapabilies;
m_whoRequestsDisabled = false;
initCapablityNames();
m_nickIndices.clear();
......@@ -769,6 +770,14 @@ void Server::capInitiateNegotiation(const QString &availableCaps)
{
requestCaps.append (nameValue[0]);
}
// HACK: twitch.tv's IRC server doesn't handle WHO so
// let's disable all WHO requests for servers that has
// twitch.tv capabilities
if(nameValue[0].startsWith("twitch.tv"))
{
m_whoRequestsDisabled = true;
}
}
if(!requestCaps.isEmpty())
......@@ -2037,6 +2046,9 @@ void Server::requestWhois(const QString& nickname)
void Server::requestWho(const QString& channel)
{
if(m_whoRequestsDisabled)
return;
m_inputFilter.setAutomaticRequest(QStringLiteral("WHO"), channel, true);
QString command(QStringLiteral("WHO ") + channel);
......@@ -2053,6 +2065,9 @@ void Server::requestWho(const QString& channel)
void Server::requestUserhost(const QString& nicks)
{
if(m_whoRequestsDisabled)
return;
const QStringList nicksList = nicks.split(QLatin1Char(' '), QString::SkipEmptyParts);
for(QStringList::ConstIterator it=nicksList.constBegin() ; it!=nicksList.constEnd() ; ++it)
m_inputFilter.setAutomaticRequest(QStringLiteral("USERHOST"), *it, true);
......@@ -4194,8 +4209,11 @@ void Server::sendPing()
//queue :-)
QStringList ql;
ql << QStringLiteral("PING LAG") + QTime::currentTime().toString(QStringLiteral("hhmmss"));
getInputFilter()->setAutomaticRequest(QStringLiteral("WHO"), getNickname(), true);
ql << QStringLiteral("WHO ") + getNickname();
if(!m_whoRequestsDisabled)
{
getInputFilter()->setAutomaticRequest(QStringLiteral("WHO"), getNickname(), true);
ql << QStringLiteral("WHO ") + getNickname();
}
queueList(ql, HighPriority);
m_lagTime.start();
......
......@@ -404,6 +404,7 @@ class Server : public QObject
void setHasWHOX(bool state) { m_capabilities.setFlag(WHOX, state); }
CapabilityFlags capabilities() const { return m_capabilities; }
bool whoRequestsDisabled() const { return m_whoRequestsDisabled; }
// IRCQueueManager
bool validQueue(QueuePriority priority); ///< is this queue index valid?
......@@ -875,6 +876,8 @@ class Server : public QObject
CapabilityFlags m_capabilities;
QHash<QString, CapabilityFlag> m_capabilityNames;
bool m_whoRequestsDisabled;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(Server::CapModifiers)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment