2018-11-09 23:56:00 +01:00
|
|
|
//
|
2018-12-31 23:02:34 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2019
|
2018-11-09 23:56:00 +01:00
|
|
|
//
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
//
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "td/telegram/CallId.h"
|
2018-12-11 21:18:58 +01:00
|
|
|
#include "td/telegram/DialogId.h"
|
2018-11-09 23:56:00 +01:00
|
|
|
#include "td/telegram/MessageId.h"
|
2018-11-15 16:58:33 +01:00
|
|
|
#include "td/telegram/td_api.h"
|
2018-11-09 23:56:00 +01:00
|
|
|
|
|
|
|
#include "td/utils/common.h"
|
|
|
|
#include "td/utils/StringBuilder.h"
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
|
|
|
class NotificationType {
|
|
|
|
public:
|
|
|
|
NotificationType() = default;
|
|
|
|
NotificationType(const NotificationType &) = delete;
|
|
|
|
NotificationType &operator=(const NotificationType &) = delete;
|
|
|
|
NotificationType(NotificationType &&) = delete;
|
|
|
|
NotificationType &operator=(NotificationType &&) = delete;
|
|
|
|
|
|
|
|
virtual ~NotificationType() {
|
|
|
|
}
|
|
|
|
|
2018-11-15 17:09:01 +01:00
|
|
|
virtual bool can_be_delayed() const = 0;
|
|
|
|
|
2018-11-20 15:08:44 +01:00
|
|
|
virtual MessageId get_message_id() const = 0;
|
|
|
|
|
2018-11-15 16:58:33 +01:00
|
|
|
virtual td_api::object_ptr<td_api::NotificationType> get_notification_type_object(DialogId dialog_id) const = 0;
|
|
|
|
|
2018-11-09 23:56:00 +01:00
|
|
|
virtual StringBuilder &to_string_builder(StringBuilder &string_builder) const = 0;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// append only
|
|
|
|
enum class Type : int32 { Message, SecretChat, Call };
|
|
|
|
|
|
|
|
virtual Type get_type() const = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
inline StringBuilder &operator<<(StringBuilder &string_builder, const NotificationType ¬ification_type) {
|
|
|
|
return notification_type.to_string_builder(string_builder);
|
|
|
|
}
|
|
|
|
|
2019-03-20 03:57:36 +01:00
|
|
|
inline StringBuilder &operator<<(StringBuilder &string_builder, const unique_ptr<NotificationType> ¬ification_type) {
|
|
|
|
if (notification_type == nullptr) {
|
|
|
|
return string_builder << "null";
|
|
|
|
}
|
|
|
|
return string_builder << *notification_type;
|
|
|
|
}
|
|
|
|
|
2018-11-09 23:56:00 +01:00
|
|
|
unique_ptr<NotificationType> create_new_message_notification(MessageId message_id);
|
|
|
|
|
|
|
|
unique_ptr<NotificationType> create_new_secret_chat_notification();
|
|
|
|
|
|
|
|
unique_ptr<NotificationType> create_new_call_notification(CallId call_id);
|
|
|
|
|
|
|
|
} // namespace td
|