chats.h (2166B)
1 /* 2 This file is part of GNUnet. 3 Copyright (C) 2022--2024 GNUnet e.V. 4 5 GNUnet is free software: you can redistribute it and/or modify it 6 under the terms of the GNU Affero General Public License as published 7 by the Free Software Foundation, either version 3 of the License, 8 or (at your option) any later version. 9 10 GNUnet is distributed in the hope that it will be useful, but 11 WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Affero General Public License for more details. 14 15 You should have received a copy of the GNU Affero General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18 SPDX-License-Identifier: AGPL3.0-or-later 19 */ 20 /* 21 * @author Tobias Frisch 22 * @file ui/chats.h 23 */ 24 25 #ifndef UI_CHATS_H_ 26 #define UI_CHATS_H_ 27 28 #include <stdlib.h> 29 #include <curses.h> 30 31 #include <gnunet/gnunet_chat_lib.h> 32 #include <gnunet/gnunet_util_lib.h> 33 34 #include "chat_open_dialog.h" 35 #include "lobby_create_dialog.h" 36 #include "lobby_enter_dialog.h" 37 38 struct MESSENGER_Application; 39 40 /** 41 * @struct UI_CHATS_Handle 42 */ 43 typedef struct UI_CHATS_Handle 44 { 45 WINDOW *window; 46 47 int line_prev; 48 int line_next; 49 50 int line_index; 51 int line_offset; 52 int line_selected; 53 54 struct GNUNET_CHAT_Context *selected; 55 56 UI_CHAT_OPEN_DIALOG_Handle open_dialog; 57 UI_LOBBY_CREATE_DIALOG_Handle create_dialog; 58 UI_LOBBY_ENTER_DIALOG_Handle enter_dialog; 59 } UI_CHATS_Handle; 60 61 #define UI_CHATS_ROWS_MIN 8 62 #define UI_CHATS_COLS_MIN 30 63 64 /** 65 * Processes the current key event by the view 66 * to show the list of available chats. 67 * 68 * @param[in,out] chats Chats view 69 * @param[in,out] app Application handle 70 * @param[in] key Key 71 */ 72 void 73 chats_event(UI_CHATS_Handle *chats, 74 struct MESSENGER_Application *app, 75 int key); 76 77 /** 78 * Prints the content of the view to show 79 * the list of available chats to its selected 80 * window view on screen. 81 * 82 * @param[in,out] chats Chats view 83 * @param[in] app Application handle 84 */ 85 void 86 chats_print(UI_CHATS_Handle *chats, 87 struct MESSENGER_Application *app); 88 89 #endif /* UI_CHATS_H_ */