messenger-cli

Command-line user interface for GNUnet Messenger
Log | Files | Refs | README | LICENSE

chats.h (2152B)


      1 /*
      2    This file is part of GNUnet.
      3    Copyright (C) 2022--2024, 2026 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 <curses.h>
     29 
     30 #include <gnunet/gnunet_chat_lib.h>
     31 #include <gnunet/gnunet_util_lib.h>
     32 
     33 #include "chat_open_dialog.h"
     34 #include "lobby_create_dialog.h"
     35 #include "lobby_enter_dialog.h"
     36 
     37 struct MESSENGER_Application;
     38 
     39 /**
     40  * @struct UI_CHATS_Handle
     41  */
     42 typedef struct UI_CHATS_Handle
     43 {
     44   WINDOW *window;
     45 
     46   int line_prev;
     47   int line_next;
     48 
     49   int line_index;
     50   int line_offset;
     51   int line_selected;
     52 
     53   struct GNUNET_CHAT_Context *selected;
     54 
     55   UI_CHAT_OPEN_DIALOG_Handle open_dialog;
     56   UI_LOBBY_CREATE_DIALOG_Handle create_dialog;
     57   UI_LOBBY_ENTER_DIALOG_Handle enter_dialog;
     58 } UI_CHATS_Handle;
     59 
     60 #define UI_CHATS_ROWS_MIN 8
     61 #define UI_CHATS_COLS_MIN 30
     62 
     63 /**
     64  * Processes the current key event by the view
     65  * to show the list of available chats.
     66  *
     67  * @param[in,out] chats Chats view
     68  * @param[in,out] app Application handle
     69  * @param[in] key Key
     70  */
     71 void
     72 chats_event(UI_CHATS_Handle *chats,
     73             struct MESSENGER_Application *app,
     74             int key);
     75 
     76 /**
     77  * Prints the content of the view to show
     78  * the list of available chats to its selected
     79  * window view on screen.
     80  *
     81  * @param[in,out] chats Chats view
     82  * @param[in] app Application handle
     83  */
     84 void
     85 chats_print(UI_CHATS_Handle *chats,
     86             struct MESSENGER_Application *app);
     87 
     88 #endif /* UI_CHATS_H_ */