api_common.cpp 936 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #include "api/api_common.h"
  8. #include "base/qt/qt_key_modifiers.h"
  9. #include "data/data_histories.h"
  10. #include "data/data_thread.h"
  11. #include "history/history.h"
  12. namespace Api {
  13. SendAction::SendAction(
  14. not_null<Data::Thread*> thread,
  15. SendOptions options)
  16. : history(thread->owningHistory())
  17. , options(options)
  18. , replyTo({ .messageId = { history->peer->id, thread->topicRootId() } }) {
  19. replyTo.topicRootId = replyTo.messageId.msg;
  20. }
  21. SendOptions DefaultSendWhenOnlineOptions() {
  22. return {
  23. .scheduled = kScheduledUntilOnlineTimestamp,
  24. .silent = base::IsCtrlPressed(),
  25. };
  26. }
  27. MTPInputReplyTo SendAction::mtpReplyTo() const {
  28. return Data::ReplyToForMTP(history, replyTo);
  29. }
  30. } // namespace Api