mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Notifications: correct IP address formatting
This commit is contained in:
parent
3b0cf02574
commit
c3346f9192
10
Utils.cpp
10
Utils.cpp
@ -386,10 +386,12 @@ void Utils::SysTrayNotify(QString &text,
|
||||
}
|
||||
|
||||
QString Utils::FormatIPAddress(QHostAddress &addr) {
|
||||
if (addr.protocol() == QAbstractSocket::IPv4Protocol)
|
||||
QString v4addr = addr.toString().replace("::fff:", "");
|
||||
|
||||
return addr.toString();
|
||||
QRegExp v4regex("(::ffff:)(((\\d).){3})", Qt::CaseInsensitive);
|
||||
QString addrString = addr.toString();
|
||||
if (addrString.contains(v4regex)) {
|
||||
addrString = QHostAddress(addr.toIPv4Address()).toString();
|
||||
}
|
||||
return addrString;
|
||||
}
|
||||
|
||||
const char* Utils::GetRecordingFolder() {
|
||||
|
@ -103,7 +103,7 @@ void WSServer::onNewConnection() {
|
||||
|
||||
QString msg = QString(obs_module_text("OBSWebsocket.ConnectNotify.ClientIP"))
|
||||
+ QString(" ")
|
||||
+ clientAddr.toString();
|
||||
+ Utils::FormatIPAddress(clientAddr);
|
||||
|
||||
Utils::SysTrayNotify(msg,
|
||||
QSystemTrayIcon::Information,
|
||||
@ -138,7 +138,7 @@ void WSServer::onSocketDisconnected() {
|
||||
|
||||
QString msg = QString(obs_module_text("OBSWebsocket.ConnectNotify.ClientIP"))
|
||||
+ QString(" ")
|
||||
+ clientAddr.toString();
|
||||
+ Utils::FormatIPAddress(clientAddr);
|
||||
|
||||
Utils::SysTrayNotify(msg,
|
||||
QSystemTrayIcon::Information,
|
||||
|
Loading…
x
Reference in New Issue
Block a user