From 8157f7e9ae97f8b33a82d0953bbf7bc9c01c51ec Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 31 Mar 2019 01:02:13 +0300 Subject: [PATCH] Simplify process_message_push_notification. GitOrigin-RevId: fe47e80dfaa1af38969bdf0c1532a083a7fd3d60 --- td/telegram/NotificationManager.cpp | 20 ++++++++++---------- td/telegram/NotificationManager.h | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/td/telegram/NotificationManager.cpp b/td/telegram/NotificationManager.cpp index 891dd2177..d3492a566 100644 --- a/td/telegram/NotificationManager.cpp +++ b/td/telegram/NotificationManager.cpp @@ -2927,15 +2927,6 @@ Status NotificationManager::process_push_notification_payload(string payload) { // chat title for CHAT_*, CHANNEL_*, ENCRYPTED_MESSAGE and PINNED_*, sender name for MESSAGE_* and CONTACT_JOINED loc_args.erase(loc_args.begin()); - return process_message_push_notification(dialog_id, MessageId(server_message_id), random_id, sender_user_id, - std::move(sender_name), sent_date, contains_mention, is_silent, - std::move(loc_key), std::move(loc_args)); -} - -Status NotificationManager::process_message_push_notification(DialogId dialog_id, MessageId message_id, int64 random_id, - UserId sender_user_id, string sender_name, int32 date, - bool contains_mention, bool is_silent, string loc_key, - vector loc_args) { if (loc_args.size() > 1) { return Status::Error("Receive too much arguments"); } @@ -2945,6 +2936,15 @@ Status NotificationManager::process_message_push_notification(DialogId dialog_id arg = std::move(loc_args[0]); } + return process_message_push_notification(dialog_id, MessageId(server_message_id), random_id, sender_user_id, + std::move(sender_name), sent_date, contains_mention, is_silent, + std::move(loc_key), std::move(arg)); +} + +Status NotificationManager::process_message_push_notification(DialogId dialog_id, MessageId message_id, int64 random_id, + UserId sender_user_id, string sender_name, int32 date, + bool contains_mention, bool is_silent, string loc_key, + string arg) { auto is_pinned = begins_with(loc_key, "PINNED_"); auto r_info = td_->messages_manager_->get_message_push_notification_info( dialog_id, message_id, random_id, sender_user_id, date, contains_mention, is_pinned); @@ -2989,7 +2989,7 @@ Status NotificationManager::process_message_push_notification(DialogId dialog_id auto settings_dialog_id = info.settings_dialog_id; VLOG(notifications) << "Add message push notification of type " << loc_key << " for " << message_id << "/" << random_id << " in " << dialog_id << ", sent by " << sender_user_id << " at " << date - << " with args " << loc_args << " to " << group_id << " of type " << group_type + << " with arg " << arg << " to " << group_id << " of type " << group_type << " with settings from " << settings_dialog_id; add_notification( diff --git a/td/telegram/NotificationManager.h b/td/telegram/NotificationManager.h index 75aded04f..227ab725b 100644 --- a/td/telegram/NotificationManager.h +++ b/td/telegram/NotificationManager.h @@ -272,7 +272,7 @@ class NotificationManager : public Actor { Status process_message_push_notification(DialogId dialog_id, MessageId message_id, int64 random_id, UserId sender_user_id, string sender_name, int32 date, bool contains_mention, - bool is_silent, string loc_key, vector loc_args); + bool is_silent, string loc_key, string arg); void after_get_difference_impl();