hide link preview image if in streamer mode

This commit is contained in:
fourtf
2020-08-22 15:27:42 +02:00
parent 7d0602de47
commit 459e483c62
2 changed files with 20 additions and 1 deletions
+18
View File
@@ -10,6 +10,8 @@
namespace chatterino {
constexpr int cooldownInS = 10;
const QStringList &broadcastingBinaries()
{
#ifdef USEWINSDK
@@ -25,6 +27,17 @@ bool isInStreamerMode()
#ifdef USEWINSDK
if (IsWindowsVistaOrGreater())
{
static bool cache = false;
static QDateTime time = QDateTime();
if (time.isValid() &&
time.addSecs(cooldownInS) > QDateTime::currentDateTime())
{
return cache;
}
time = QDateTime::currentDateTime();
WTS_PROCESS_INFO *pWPIs = nullptr;
DWORD dwProcCount = 0;
@@ -38,12 +51,17 @@ bool isInStreamerMode()
reinterpret_cast<char16_t *>(pWPIs[i].pProcessName));
if (broadcastingBinaries().contains(processName))
{
cache = true;
return true;
}
}
}
if (pWPIs)
WTSFreeMemory(pWPIs);
cache = false;
}
#endif