Silent Notifications in Telegram
Posted: Wednesday 12 December 2018 21:37
Hello,
I wanted to have silent notifications with the Telegram service. It's possible with Telegram API to send messages that does not produce sound or screen notifications when they are received, by adding the 'disable_notification' parameter.
In order to do that, I've patched the notifications/NotificationTelegram.cpp file to pass this parameter when the priority is low :
Doing that, I've found a bug with Blocky when sending notification to a dedicated service with Priority and Sound. I've corrected it by adding 2 lines :
Do you think the patchs are good enough to be implemented? What is the process to propose these modifications?
I wanted to have silent notifications with the Telegram service. It's possible with Telegram API to send messages that does not produce sound or screen notifications when they are received, by adding the 'disable_notification' parameter.
In order to do that, I've patched the notifications/NotificationTelegram.cpp file to pass this parameter when the priority is low :
Code: Select all
@@ -46,6 +46,8 @@
json["chat_id"] = _chatid;
json["text"] = CURLEncode::URLDecode(Text);
//json["body"] = CURLEncode::URLDecode(Text);
+ if ( Priority < 0 )
+ json["disable_notification"] = 1;
sPostData = jsonWriter.write(json);
//Add the required Content Type
Code: Select all
@@ -2496,6 +2496,8 @@
}
else if (aParam.size() == 5)
{
+ priority = aParam[2];
+ sound = aParam[3];
subsystem = aParam[4];
}
m_sql.AddTaskItem(_tTaskItem::SendNotification(0, subject, body, std::string(""), atoi(priority.c_str()), sound, subsystem));