messenger-cli

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

accounts.h (2093B)


      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/accounts.h
     23  */
     24 
     25 #ifndef UI_ACCOUNTS_H_
     26 #define UI_ACCOUNTS_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 "account_create_dialog.h"
     35 
     36 struct MESSENGER_Application;
     37 
     38 /**
     39  * @struct UI_ACCOUNTS_Handle
     40  */
     41 typedef struct UI_ACCOUNTS_Handle
     42 {
     43   WINDOW *window;
     44 
     45   int line_prev;
     46   int line_next;
     47 
     48   int line_index;
     49   int line_offset;
     50   int line_selected;
     51 
     52   struct GNUNET_CHAT_Account *selected;
     53 
     54   UI_ACCOUNT_CREATE_DIALOG_Handle create_dialog;
     55 } UI_ACCOUNTS_Handle;
     56 
     57 #define UI_ACCOUNTS_ROWS_MIN 5
     58 #define UI_ACCOUNTS_COLS_MIN 30
     59 
     60 /**
     61  * Processes the current key event by the view
     62  * to show the list of chat accounts.
     63  *
     64  * @param[in,out] accounts Chat accounts view
     65  * @param[in,out] app Application handle
     66  * @param[in] key Key
     67  */
     68 void
     69 accounts_event(UI_ACCOUNTS_Handle *accounts,
     70                struct MESSENGER_Application *app,
     71                int key);
     72 
     73 /**
     74  * Prints the content of the view to show
     75  * the list of chat accounts to its selected
     76  * window view on screen.
     77  *
     78  * @param[in,out] accounts Chat accounts view
     79  * @param[in] app Application handle
     80  */
     81 void
     82 accounts_print(UI_ACCOUNTS_Handle *accounts,
     83                struct MESSENGER_Application *app);
     84 
     85 #endif /* UI_ACCOUNTS_H_ */