Fix deprecation warning for notifications
This commit is contained in:
parent
8f846434b9
commit
b01e8c8ee4
@ -744,14 +744,6 @@ void JsonRPCServerImplementation::sendNotification(const QVariantMap ¶ms)
|
|||||||
notification.insert("id", m_notificationId++);
|
notification.insert("id", m_notificationId++);
|
||||||
notification.insert("notification", handler->name() + "." + method.name());
|
notification.insert("notification", handler->name() + "." + method.name());
|
||||||
|
|
||||||
// Add deprecation warning if necessary
|
|
||||||
if (m_api.value("notifications").toMap().value(handler->name() + '.' + method.name()).toMap().contains("deprecated")) {
|
|
||||||
QString deprecationMessage = m_api.value("notifications").toMap().value(handler->name() + '.' + method.name()).toMap().value("deprecated").toString();
|
|
||||||
qCWarning(dcJsonRpc()) << "Client uses deprecated API. Please update client implementation!";
|
|
||||||
qCWarning(dcJsonRpc()) << handler->name() + '.' + method.name() + ':' << deprecationMessage;
|
|
||||||
notification.insert("deprecationWarning", deprecationMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (const QUuid &clientId, m_clientNotifications.keys()) {
|
foreach (const QUuid &clientId, m_clientNotifications.keys()) {
|
||||||
|
|
||||||
// Check if this client wants to be notified
|
// Check if this client wants to be notified
|
||||||
@ -759,6 +751,14 @@ void JsonRPCServerImplementation::sendNotification(const QVariantMap ¶ms)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add deprecation warning if necessary
|
||||||
|
if (m_api.value("notifications").toMap().value(handler->name() + '.' + method.name()).toMap().contains("deprecated")) {
|
||||||
|
QString deprecationMessage = m_api.value("notifications").toMap().value(handler->name() + '.' + method.name()).toMap().value("deprecated").toString();
|
||||||
|
qCWarning(dcJsonRpc()) << "Client" << clientId << "uses deprecated API. Please update client implementation!";
|
||||||
|
qCWarning(dcJsonRpc()) << handler->name() + '.' + method.name() + ':' << deprecationMessage;
|
||||||
|
notification.insert("deprecationWarning", deprecationMessage);
|
||||||
|
}
|
||||||
|
|
||||||
QLocale locale = m_clientLocales.value(clientId);
|
QLocale locale = m_clientLocales.value(clientId);
|
||||||
QVariantMap translatedParams = handler->translateNotification(method.name(), params, locale);
|
QVariantMap translatedParams = handler->translateNotification(method.name(), params, locale);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user