aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2022-01-10 18:35:45 +0100
committerTheJackiMonster <thejackimonster@gmail.com>2022-01-10 18:35:45 +0100
commitba8fe8ba1afa40046b209b1ae8ba290a09c90050 (patch)
tree80ee3ea303848719036765a36af49200abc851c3
parent382213363a709fc3a2f4dd2248985a83cea99020 (diff)
downloadlibgnunetchat-ba8fe8ba1afa40046b209b1ae8ba290a09c90050.tar.gz
libgnunetchat-ba8fe8ba1afa40046b209b1ae8ba290a09c90050.zip
Implemented function to get a files name
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r--include/gnunet_chat_lib.h9
-rw-r--r--src/gnunet_chat_lib.c12
2 files changed, 21 insertions, 0 deletions
diff --git a/include/gnunet_chat_lib.h b/include/gnunet_chat_lib.h
index 785d3ff..d15af55 100644
--- 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,
779 struct GNUNET_TIME_Relative delay); 779 struct GNUNET_TIME_Relative delay);
780 780
781/** 781/**
782 * Returns the name of a given <i>file</i> handle.
783 *
784 * @param[in] file File handle
785 * @return The file name of file
786 */
787const char*
788GNUNET_CHAT_file_get_name (const struct GNUNET_CHAT_File *file);
789
790/**
782 * Returns the hash of a given <i>file</i> handle. 791 * Returns the hash of a given <i>file</i> handle.
783 * 792 *
784 * @param[in] file File handle 793 * @param[in] file File handle
diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c
index 05590a0..adf0eff 100644
--- 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)
897 897
898 if (GNUNET_CHAT_FLAG_WARNING == message->flag) 898 if (GNUNET_CHAT_FLAG_WARNING == message->flag)
899 return message->warning; 899 return message->warning;
900 if (GNUNET_MESSENGER_KIND_FILE == message->msg->header.kind)
901 return message->msg->body.file.name;
900 if (GNUNET_MESSENGER_KIND_TEXT != message->msg->header.kind) 902 if (GNUNET_MESSENGER_KIND_TEXT != message->msg->header.kind)
901 return NULL; 903 return NULL;
902 904
@@ -953,6 +955,16 @@ GNUNET_CHAT_message_delete (const struct GNUNET_CHAT_Message *message,
953} 955}
954 956
955 957
958const char*
959GNUNET_CHAT_file_get_name (const struct GNUNET_CHAT_File *file)
960{
961 if (!file)
962 return NULL;
963
964 return file->name;
965}
966
967
956const struct GNUNET_HashCode* 968const struct GNUNET_HashCode*
957GNUNET_CHAT_file_get_hash (const struct GNUNET_CHAT_File *file) 969GNUNET_CHAT_file_get_hash (const struct GNUNET_CHAT_File *file)
958{ 970{