libgnunetchat

library for GNUnet Messenger
Log | Files | Refs | README | LICENSE

gnunet_chat_invitation.h (2191B)


      1 /*
      2    This file is part of GNUnet.
      3    Copyright (C) 2021--2025 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 gnunet_chat_invitation.h
     23  */
     24 
     25 #ifndef GNUNET_CHAT_INVITATION_H_
     26 #define GNUNET_CHAT_INVITATION_H_
     27 
     28 #include <gnunet/gnunet_messenger_service.h>
     29 #include <gnunet/gnunet_scheduler_lib.h>
     30 #include <gnunet/gnunet_util_lib.h>
     31 
     32 struct GNUNET_CHAT_Context;
     33 
     34 struct GNUNET_CHAT_Invitation
     35 {
     36   struct GNUNET_CHAT_Context *context;
     37   struct GNUNET_SCHEDULER_Task *task;
     38 
     39   struct GNUNET_HashCode hash;
     40 
     41   union GNUNET_MESSENGER_RoomKey key;
     42   GNUNET_PEER_Id door;
     43 };
     44 
     45 /**
     46  * Creates a chat invitation from an invite body in a
     47  * <i>message</i> with a selected chat <i>context</i>.
     48  *
     49  * @param[in,out] context Chat context
     50  * @param[in] message Invite message body
     51  * @return New chat invitation
     52  */
     53 struct GNUNET_CHAT_Invitation*
     54 invitation_create_from_message (struct GNUNET_CHAT_Context *context,
     55                                 const struct GNUNET_HashCode *hash,
     56 				                        const struct GNUNET_MESSENGER_MessageInvite *message);
     57 
     58 /**
     59  * Destroys a chat <i>invitation</i> and frees its memory.
     60  *
     61  * @param[in,out] invitation Chat invitation
     62  */
     63 void
     64 invitation_destroy (struct GNUNET_CHAT_Invitation *invitation);
     65 
     66 /**
     67  * Updates a chat <i>invitation</i> for applications to
     68  * notice any status changes.
     69  *
     70  * @param[in,out] invitation Chat invitation
     71  */
     72 void
     73 invitation_update (struct GNUNET_CHAT_Invitation *invitation);
     74 
     75 #endif /* GNUNET_CHAT_INVITATION_H_ */