messenger-cli

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

chat.h (2527B)


      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 chat.h
     23  */
     24 
     25 #ifndef CHAT_H_
     26 #define CHAT_H_
     27 
     28 #include <gnunet/gnunet_chat_lib.h>
     29 #include <gnunet/gnunet_util_lib.h>
     30 
     31 struct MESSENGER_Application;
     32 
     33 /**
     34  * @struct MESSENGER_Chat
     35  */
     36 typedef struct MESSENGER_Chat
     37 {
     38   struct GNUNET_CHAT_Handle *handle;
     39   struct GNUNET_CHAT_Context *context;
     40 
     41   struct GNUNET_SCHEDULER_Task *idle;
     42 
     43   bool show_members;
     44   bool quit;
     45 } MESSENGER_Chat;
     46 
     47 /**
     48  * Starts the processing of the given applications
     49  * chat handle.
     50  *
     51  * @param[out] chat Application chat handle
     52  * @param[in,out] app Application handle
     53  * @param[in] cfg Configuration
     54  */
     55 void
     56 chat_start(MESSENGER_Chat *chat,
     57            struct MESSENGER_Application *app,
     58            const struct GNUNET_CONFIGURATION_Handle *cfg);
     59 
     60 /**
     61  * Stops the processing of the given applications
     62  * chat handle.
     63  *
     64  * @param[in,out] chat Application chat handle
     65  */
     66 void
     67 chat_stop(MESSENGER_Chat *chat);
     68 
     69 /**
     70  * Updates the layout of the applications views depending
     71  * on the main windows resolution and the current state
     72  * of the applications chat handle.
     73  *
     74  * @param[in] chat Application chat handle
     75  * @param[out] app Application handle
     76  */
     77 void
     78 chat_update_layout(MESSENGER_Chat *chat,
     79                    struct MESSENGER_Application *app);
     80 
     81 /**
     82  * Processes a chat message to update the list of
     83  * required resources to handle visual representation
     84  * of current members in a chat or the messages.
     85  *
     86  * @param[in,out] chat Application chat handle
     87  * @param[in] context Chat context of the message
     88  * @param[in] message Chat message
     89  */
     90 void
     91 chat_process_message(MESSENGER_Chat *chat,
     92                      struct GNUNET_CHAT_Context *context,
     93                      struct GNUNET_CHAT_Message *message);
     94 
     95 #endif /* CHAT_H_ */