How ayugram/ayugramdesktop works
This project is a full-featured, cross‐platform desktop Telegram client that builds on and customizes the Telegram Desktop codebase. The goals (as described in the README) include features such as enhanced ghost mode, message history, anti-recall functionality, font and appearance customization, streamer mode, local “Telegram Premium” functionality, and improved media previews among others. The project is written in C++ and uses CMake for its build system, along with several third‐party libraries (such as “JSON for Modern C++”, SQLite, ffmpeg, and others) and custom platform integration code for Windows, macOS, and Linux.
Main Architectural Components
a. User Interface (UI) Layer:
• This includes everything related to dialogs, chats, settings, menus, media views, and widgets. It is organized into multiple modules under “Telegram/SourceFiles/ui” as well as subdirectories like “dialogs”, “chat”, “widgets”, and “window”.
b. Core Application Logic:
• The core logic resides in directories like “Telegram/SourceFiles/core”, “main”, “logs”, “data”, “storage” and “support”. This layer encapsulates the business logic for handling chats, user sessions, message processing, history, state management, and utility services.
• A block for “Core Engine” that orchestrates the application’s behavior.
c. Network & Communication (MTProto Layer):
• The “Telegram/SourceFiles/mtproto” directory contains the network communication layer, including MTProto connection handling, encryption (e.g., mtproto_auth_key), session management, and low-level messaging.
• A distinct “Network/MTProto Module” which interfaces with both the core engine and the remote Telegram API servers.
d. Media & Data Processing:
• Media processing is spread across “Telegram/SourceFiles/media”, “ffmpeg”, and related folders. This includes audio, video, image media processing, streaming, and document handling.
• A “Media Management” or “Multimedia Processing” component should be drawn that interacts with both the UI (for media playback/display) and core layers (for media preloading and caching).
e. Storage, Database & Local Data:
• Data persistence and caching (e.g., messages history, user profiles, settings) are handled by components in “data”, “storage” and possibly through SQLite bindings present in the project.
• A “Local Database / Persistence” module that feeds data to the core layer.
f. Platform Abstraction/Integration:
• Platform-specific folders like “Telegram/SourceFiles/platform” (with subfolders for linux, mac, win) provide operating system–focused integrations like file utilities, notifications, window management, and custom UI behavior.
g. Build, Configuration & Third‐Party Libraries:
• Critical build scripts are in “CMakeLists.txt”, the “cmake” folder, and the “build” directory.
• Third‑party components like JSON, SQLite, ffmpeg, and additional libraries (eg. lib_lottie, lib_qr) which are linked into various modules.
Relationships and Interactions
• The UI sends user input to the Core Engine.
• The Core Engine processes the logic and retrieves/stores data in the persistence layer.
• The Network/MTProto module communicates with remote Telegram servers and passes incoming/outgoing messages to the Core Engine.
• The Media module handles media rendering and passes media data between storage and the UI.
• The Platform Abstraction Layer provides OS-specific services (notifications, file operations, session management) that are used by the core and UI layers.
• The Build & Dependency block influences nearly every module by providing necessary libraries via the build system.
Architectural Patterns and Technologies
– Note the modular separation where the application is divided into multiple components (UI, Core, MTProto, Media, Storage, Platform Integration).
– Emphasize abstraction layers (e.g., platform abstraction), decoupling of UI and business logic, and separation between network communication and application logic.
– Identify the “plugin” or “extensibility” points in settings, customization of fonts/themes, and potentially localized resources (language files under “Telegram/Resources/langs”).
– Mention that build and integration are centrally managed via CMake, with directory structures clearly reflecting the separation of concerns.