| 
									
										
										
										
											2018-06-02 17:29:21 +03:00
										 |  |  | /*
 | 
					
						
							|  |  |  | This file is part of Telegram Desktop, | 
					
						
							|  |  |  | the official desktop application for the Telegram messaging service. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | For license and copyright information please follow this link: | 
					
						
							|  |  |  | https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
 | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "base/flags.h"
 | 
					
						
							|  |  |  | #include "base/flat_map.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Export { | 
					
						
							| 
									
										
										
										
											2018-06-09 14:51:22 +03:00
										 |  |  | namespace Output { | 
					
						
							|  |  |  | enum class Format; | 
					
						
							|  |  |  | } // namespace Output
 | 
					
						
							| 
									
										
										
										
											2018-06-02 17:29:21 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | struct MediaSettings { | 
					
						
							| 
									
										
										
										
											2018-06-22 22:32:00 +01:00
										 |  |  | 	bool validate() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-02 17:29:21 +03:00
										 |  |  | 	enum class Type { | 
					
						
							| 
									
										
										
										
											2018-06-15 21:56:17 +03:00
										 |  |  | 		Photo        = 0x01, | 
					
						
							|  |  |  | 		Video        = 0x02, | 
					
						
							|  |  |  | 		VoiceMessage = 0x04, | 
					
						
							|  |  |  | 		VideoMessage = 0x08, | 
					
						
							|  |  |  | 		Sticker      = 0x10, | 
					
						
							|  |  |  | 		GIF          = 0x20, | 
					
						
							|  |  |  | 		File         = 0x40, | 
					
						
							| 
									
										
										
										
											2018-06-22 22:32:00 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		MediaMask    = Photo | Video | VoiceMessage | VideoMessage, | 
					
						
							|  |  |  | 		AllMask      = MediaMask | Sticker | GIF | File, | 
					
						
							| 
									
										
										
										
											2018-06-02 17:29:21 +03:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 	using Types = base::flags<Type>; | 
					
						
							|  |  |  | 	friend inline constexpr auto is_flag_type(Type) { return true; }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	Types types = DefaultTypes(); | 
					
						
							|  |  |  | 	int sizeLimit = 8 * 1024 * 1024; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	static inline Types DefaultTypes() { | 
					
						
							|  |  |  | 		return Type::Photo; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct Settings { | 
					
						
							| 
									
										
										
										
											2018-06-22 22:32:00 +01:00
										 |  |  | 	bool validate() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-02 17:29:21 +03:00
										 |  |  | 	enum class Type { | 
					
						
							| 
									
										
										
										
											2018-06-21 15:01:27 +01:00
										 |  |  | 		PersonalInfo        = 0x001, | 
					
						
							|  |  |  | 		Userpics            = 0x002, | 
					
						
							|  |  |  | 		Contacts            = 0x004, | 
					
						
							|  |  |  | 		Sessions            = 0x008, | 
					
						
							| 
									
										
										
										
											2018-06-24 01:33:47 +01:00
										 |  |  | 		OtherData           = 0x010, | 
					
						
							|  |  |  | 		PersonalChats       = 0x020, | 
					
						
							|  |  |  | 		BotChats            = 0x040, | 
					
						
							|  |  |  | 		PrivateGroups       = 0x080, | 
					
						
							|  |  |  | 		PublicGroups        = 0x100, | 
					
						
							|  |  |  | 		PrivateChannels     = 0x200, | 
					
						
							|  |  |  | 		PublicChannels      = 0x400, | 
					
						
							| 
									
										
										
										
											2018-06-18 22:52:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-21 15:01:27 +01:00
										 |  |  | 		GroupsMask          = PrivateGroups | PublicGroups, | 
					
						
							|  |  |  | 		ChannelsMask        = PrivateChannels | PublicChannels, | 
					
						
							|  |  |  | 		GroupsChannelsMask  = GroupsMask | ChannelsMask, | 
					
						
							|  |  |  | 		NonChannelChatsMask = PersonalChats | BotChats | PrivateGroups, | 
					
						
							|  |  |  | 		AnyChatsMask        = PersonalChats | BotChats | GroupsChannelsMask, | 
					
						
							| 
									
										
										
										
											2018-06-22 22:32:00 +01:00
										 |  |  | 		NonChatsMask        = PersonalInfo | Userpics | Contacts | Sessions, | 
					
						
							| 
									
										
										
										
											2018-06-24 01:33:47 +01:00
										 |  |  | 		AllMask             = NonChatsMask | OtherData | AnyChatsMask, | 
					
						
							| 
									
										
										
										
											2018-06-02 17:29:21 +03:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 	using Types = base::flags<Type>; | 
					
						
							|  |  |  | 	friend inline constexpr auto is_flag_type(Type) { return true; }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	QString path; | 
					
						
							| 
									
										
										
										
											2018-09-19 15:56:08 +03:00
										 |  |  | 	bool forceSubPath = false; | 
					
						
							| 
									
										
										
										
											2018-06-09 14:51:22 +03:00
										 |  |  | 	Output::Format format = Output::Format(); | 
					
						
							| 
									
										
										
										
											2018-06-02 17:29:21 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	Types types = DefaultTypes(); | 
					
						
							| 
									
										
										
										
											2018-06-13 16:12:36 +03:00
										 |  |  | 	Types fullChats = DefaultFullChats(); | 
					
						
							| 
									
										
										
										
											2018-06-15 21:56:17 +03:00
										 |  |  | 	MediaSettings media; | 
					
						
							| 
									
										
										
										
											2018-06-02 17:29:21 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-23 16:11:56 +03:00
										 |  |  | 	MTPInputPeer singlePeer = MTP_inputPeerEmpty(); | 
					
						
							| 
									
										
										
										
											2018-10-06 14:06:07 +03:00
										 |  |  | 	TimeId singlePeerFrom = 0; | 
					
						
							|  |  |  | 	TimeId singlePeerTill = 0; | 
					
						
							| 
									
										
										
										
											2018-07-23 16:11:56 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-23 00:18:43 +01:00
										 |  |  | 	TimeId availableAt = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-23 16:11:56 +03:00
										 |  |  | 	bool onlySinglePeer() const { | 
					
						
							|  |  |  | 		return singlePeer.type() != mtpc_inputPeerEmpty; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-02 17:29:21 +03:00
										 |  |  | 	static inline Types DefaultTypes() { | 
					
						
							|  |  |  | 		return Type::PersonalInfo | 
					
						
							| 
									
										
										
										
											2018-06-09 14:51:22 +03:00
										 |  |  | 			| Type::Userpics | 
					
						
							| 
									
										
										
										
											2018-06-02 17:29:21 +03:00
										 |  |  | 			| Type::Contacts | 
					
						
							| 
									
										
										
										
											2018-06-14 21:34:53 +03:00
										 |  |  | 			| Type::PersonalChats | 
					
						
							|  |  |  | 			| Type::PrivateGroups; | 
					
						
							| 
									
										
										
										
											2018-06-02 17:29:21 +03:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-13 16:12:36 +03:00
										 |  |  | 	static inline Types DefaultFullChats() { | 
					
						
							| 
									
										
										
										
											2018-06-17 13:47:47 +01:00
										 |  |  | 		return Type::PersonalChats | 
					
						
							|  |  |  | 			| Type::BotChats; | 
					
						
							| 
									
										
										
										
											2018-06-13 16:12:36 +03:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-02 17:29:21 +03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-24 03:06:11 +01:00
										 |  |  | struct Environment { | 
					
						
							|  |  |  | 	QString internalLinksDomain; | 
					
						
							|  |  |  | 	QByteArray aboutTelegram; | 
					
						
							|  |  |  | 	QByteArray aboutContacts; | 
					
						
							|  |  |  | 	QByteArray aboutFrequent; | 
					
						
							|  |  |  | 	QByteArray aboutSessions; | 
					
						
							|  |  |  | 	QByteArray aboutWebSessions; | 
					
						
							|  |  |  | 	QByteArray aboutChats; | 
					
						
							|  |  |  | 	QByteArray aboutLeftChats; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-02 17:29:21 +03:00
										 |  |  | } // namespace Export
 |