diff --git a/qml/pages/OverviewPage.qml b/qml/pages/OverviewPage.qml index ecbccad..8b33e8d 100644 --- a/qml/pages/OverviewPage.qml +++ b/qml/pages/OverviewPage.qml @@ -223,6 +223,21 @@ Page { pageStack.push(Qt.resolvedUrl("../pages/ChatPage.qml"), { "chatInformation" : display }); } + menu: ContextMenu { + MenuItem { + onClicked: { + var newNotificationSettings = display.notification_settings; + if (newNotificationSettings.mute_for > 0) { + newNotificationSettings.mute_for = 0; + } else { + newNotificationSettings.mute_for = 666666; + } + tdLibWrapper.setChatNotificationSettings(display.id, newNotificationSettings); + } + text: display.notification_settings.mute_for > 0 ? qsTr("Unmute Chat") : qsTr("Mute Chat") + } + } + Connections { target: chatListModel onChatChanged: { diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index 5150636..03fffbe 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -90,6 +90,7 @@ void TDLibWrapper::sendRequest(const QVariantMap &requestObject) { qDebug() << "[TDLibWrapper] Sending request to TD Lib, object type name: " << requestObject.value("@type").toString(); QJsonDocument requestDocument = QJsonDocument::fromVariant(requestObject); + qDebug().noquote() << requestDocument.toJson(); td_json_client_send(this->tdLibClient, requestDocument.toJson().constData()); } @@ -227,7 +228,7 @@ void TDLibWrapper::getMessage(const QString &chatId, const QString &messageId) void TDLibWrapper::setOptionInteger(const QString &optionName, const int &optionValue) { - qDebug() << "[TDLibWrapper] Setting integet option " << optionName << optionValue; + qDebug() << "[TDLibWrapper] Setting integer option " << optionName << optionValue; QVariantMap requestObject; requestObject.insert("@type", "setOption"); requestObject.insert("name", optionName); @@ -238,6 +239,16 @@ void TDLibWrapper::setOptionInteger(const QString &optionName, const int &option this->sendRequest(requestObject); } +void TDLibWrapper::setChatNotificationSettings(const QString &chatId, const QVariantMap ¬ificationSettings) +{ + qDebug() << "[TDLibWrapper] Notification settings for chat " << chatId << notificationSettings; + QVariantMap requestObject; + requestObject.insert("@type", "setChatNotificationSettings"); + requestObject.insert("chat_id", chatId); + requestObject.insert("notification_settings", notificationSettings); + this->sendRequest(requestObject); +} + QVariantMap TDLibWrapper::getUserInformation() { return this->userInformation; diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h index d652cb0..0c55d28 100644 --- a/src/tdlibwrapper.h +++ b/src/tdlibwrapper.h @@ -89,6 +89,7 @@ public: Q_INVOKABLE void sendTextMessage(const QString &chatId, const QString &message, const QString &replyToMessageId = "0"); Q_INVOKABLE void getMessage(const QString &chatId, const QString &messageId); Q_INVOKABLE void setOptionInteger(const QString &optionName, const int &optionValue); + Q_INVOKABLE void setChatNotificationSettings(const QString &chatId, const QVariantMap ¬ificationSettings); signals: void versionDetected(const QString &version); diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 05a055e..abe71bc 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -358,6 +358,14 @@ Loading chat list... Lade Chatliste... + + Unmute Chat + + + + Mute Chat + + VideoPage diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index f847d9a..01fb2f6 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -358,6 +358,14 @@ Loading chat list... + + Unmute Chat + + + + Mute Chat + + VideoPage