/* This file is part of GNUnet. Copyright (C) 2021--2022 GNUnet e.V. GNUnet is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . SPDX-License-Identifier: AGPL3.0-or-later */ /* * @author Tobias Frisch * @file ui/message.h */ #ifndef UI_MESSAGE_H_ #define UI_MESSAGE_H_ #include #include #include #include typedef struct MESSENGER_Application MESSENGER_Application; typedef enum UI_MESSAGE_Type { UI_MESSAGE_DEFAULT = 0, UI_MESSAGE_SENT = 1, UI_MESSAGE_STATUS = 2 } UI_MESSAGE_Type; typedef struct UI_MESSAGE_Handle { UI_MESSAGE_Type type; struct GNUNET_TIME_Absolute timestamp; const struct GNUNET_CHAT_Message *msg; GtkBuilder *builder [2]; GtkWidget *message_box; HdyAvatar *sender_avatar; GtkLabel *sender_label; GtkRevealer *deny_revealer; GtkRevealer *accept_revealer; GtkButton *deny_button; GtkButton *accept_button; GtkLabel *timestamp_label; GtkImage *read_receipt_image; GtkStack *content_stack; GtkLabel *text_label; GtkRevealer *file_revealer; GtkLabel *filename_label; GtkProgressBar *file_progress_bar; GtkButton *file_button; GtkImage *file_status_image; GtkDrawingArea *preview_drawing_area; GtkWidget *whisper_box; GdkPixbuf *preview_image; GdkPixbufAnimation *preview_animation; GdkPixbufAnimationIter *preview_animation_iter; guint redraw_animation; } UI_MESSAGE_Handle; /** * Allocates and creates a new message handle * to represent a message for a given messenger * application by selected message type. * * @param app Messenger application * @param type Message type * @return New message handle */ UI_MESSAGE_Handle* ui_message_new(MESSENGER_Application *app, UI_MESSAGE_Type type); /** * Refreshes the visual state of the read receipt * from a given message handle. * * @param handle Message handle */ void ui_message_refresh(UI_MESSAGE_Handle *handle); /** * Updates a given message handle with the * current data from a messenger application * and a selected chat message. * * @param handle Message handle * @param app Messenger application * @param message Chat message */ void ui_message_update(UI_MESSAGE_Handle *handle, MESSENGER_Application *app, const struct GNUNET_CHAT_Message *message); /** * Frees its resources and destroys a given * message handle. * * @param handle Message handle */ void ui_message_delete(UI_MESSAGE_Handle *handle); #endif /* UI_MESSAGE_H_ */