diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2022-01-10 18:35:45 +0100 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2022-01-10 18:35:45 +0100 |
commit | ba8fe8ba1afa40046b209b1ae8ba290a09c90050 (patch) | |
tree | 80ee3ea303848719036765a36af49200abc851c3 | |
parent | 382213363a709fc3a2f4dd2248985a83cea99020 (diff) | |
download | libgnunetchat-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.h | 9 | ||||
-rw-r--r-- | src/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 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 | */ | ||
787 | const char* | ||
788 | GNUNET_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 | ||
958 | const char* | ||
959 | GNUNET_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 | |||
956 | const struct GNUNET_HashCode* | 968 | const struct GNUNET_HashCode* |
957 | GNUNET_CHAT_file_get_hash (const struct GNUNET_CHAT_File *file) | 969 | GNUNET_CHAT_file_get_hash (const struct GNUNET_CHAT_File *file) |
958 | { | 970 | { |