libgnunetchat

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

commit ba8fe8ba1afa40046b209b1ae8ba290a09c90050
parent 382213363a709fc3a2f4dd2248985a83cea99020
Author: TheJackiMonster <thejackimonster@gmail.com>
Date:   Mon, 10 Jan 2022 18:35:45 +0100

Implemented function to get a files name

Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>

Diffstat:
Minclude/gnunet_chat_lib.h | 9+++++++++
Msrc/gnunet_chat_lib.c | 12++++++++++++
2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/include/gnunet_chat_lib.h b/include/gnunet_chat_lib.h @@ -779,6 +779,15 @@ GNUNET_CHAT_message_delete (const struct GNUNET_CHAT_Message *message, struct GNUNET_TIME_Relative delay); /** + * Returns the name of a given <i>file</i> handle. + * + * @param[in] file File handle + * @return The file name of file + */ +const char* +GNUNET_CHAT_file_get_name (const struct GNUNET_CHAT_File *file); + +/** * Returns the hash of a given <i>file</i> handle. * * @param[in] file File handle diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c @@ -897,6 +897,8 @@ GNUNET_CHAT_message_get_text (const struct GNUNET_CHAT_Message *message) if (GNUNET_CHAT_FLAG_WARNING == message->flag) return message->warning; + if (GNUNET_MESSENGER_KIND_FILE == message->msg->header.kind) + return message->msg->body.file.name; if (GNUNET_MESSENGER_KIND_TEXT != message->msg->header.kind) return NULL; @@ -953,6 +955,16 @@ GNUNET_CHAT_message_delete (const struct GNUNET_CHAT_Message *message, } +const char* +GNUNET_CHAT_file_get_name (const struct GNUNET_CHAT_File *file) +{ + if (!file) + return NULL; + + return file->name; +} + + const struct GNUNET_HashCode* GNUNET_CHAT_file_get_hash (const struct GNUNET_CHAT_File *file) {