diff options
Diffstat (limited to 'src/gnunet_chat_lib.c')
-rw-r--r-- | src/gnunet_chat_lib.c | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c index f455549..8be813b 100644 --- a/src/gnunet_chat_lib.c +++ b/src/gnunet_chat_lib.c | |||
@@ -26,7 +26,6 @@ | |||
26 | 26 | ||
27 | #include <limits.h> | 27 | #include <limits.h> |
28 | 28 | ||
29 | #include "gnunet_chat_config.h" | ||
30 | #include "gnunet_chat_contact.h" | 29 | #include "gnunet_chat_contact.h" |
31 | #include "gnunet_chat_context.h" | 30 | #include "gnunet_chat_context.h" |
32 | #include "gnunet_chat_file.h" | 31 | #include "gnunet_chat_file.h" |
@@ -489,7 +488,9 @@ GNUNET_CHAT_context_send_file (struct GNUNET_CHAT_Context *context, | |||
489 | return GNUNET_SYSERR; | 488 | return GNUNET_SYSERR; |
490 | 489 | ||
491 | char *filename; | 490 | char *filename; |
492 | util_get_filename (context->handle->directory, &hash, &filename); | 491 | util_get_filename ( |
492 | context->handle->directory, "files", &hash, &filename | ||
493 | ); | ||
493 | 494 | ||
494 | if ((GNUNET_OK != GNUNET_DISK_directory_create_for_file(filename)) || | 495 | if ((GNUNET_OK != GNUNET_DISK_directory_create_for_file(filename)) || |
495 | (GNUNET_OK != GNUNET_DISK_file_copy(path, filename))) | 496 | (GNUNET_OK != GNUNET_DISK_file_copy(path, filename))) |
@@ -670,6 +671,32 @@ GNUNET_CHAT_message_get_sender (const struct GNUNET_CHAT_Message *message) | |||
670 | 671 | ||
671 | 672 | ||
672 | int | 673 | int |
674 | GNUNET_CHAT_message_is_sent (const struct GNUNET_CHAT_Message *message) | ||
675 | { | ||
676 | if (!message) | ||
677 | return GNUNET_SYSERR; | ||
678 | |||
679 | if (message->flags & GNUNET_MESSENGER_FLAG_SENT) | ||
680 | return GNUNET_YES; | ||
681 | else | ||
682 | return GNUNET_NO; | ||
683 | } | ||
684 | |||
685 | |||
686 | int | ||
687 | GNUNET_CHAT_message_is_private (const struct GNUNET_CHAT_Message *message) | ||
688 | { | ||
689 | if (!message) | ||
690 | return GNUNET_SYSERR; | ||
691 | |||
692 | if (message->flags & GNUNET_MESSENGER_FLAG_PRIVATE) | ||
693 | return GNUNET_YES; | ||
694 | else | ||
695 | return GNUNET_NO; | ||
696 | } | ||
697 | |||
698 | |||
699 | int | ||
673 | GNUNET_CHAT_message_get_read_receipt (const struct GNUNET_CHAT_Message *message, | 700 | GNUNET_CHAT_message_get_read_receipt (const struct GNUNET_CHAT_Message *message, |
674 | GNUNET_CHAT_MessageReadReceiptCallback callback, | 701 | GNUNET_CHAT_MessageReadReceiptCallback callback, |
675 | void *cls) | 702 | void *cls) |
@@ -765,7 +792,9 @@ GNUNET_CHAT_file_get_size (const struct GNUNET_CHAT_File *file) | |||
765 | return GNUNET_FS_uri_chk_get_file_size(file->uri); | 792 | return GNUNET_FS_uri_chk_get_file_size(file->uri); |
766 | 793 | ||
767 | char *filename; | 794 | char *filename; |
768 | util_get_filename (file->handle->directory, &(file->hash), &filename); | 795 | util_get_filename ( |
796 | file->handle->directory, "files", &(file->hash), &filename | ||
797 | ); | ||
769 | 798 | ||
770 | uint64_t size; | 799 | uint64_t size; |
771 | if (GNUNET_OK != GNUNET_DISK_file_size(filename, &size, GNUNET_NO, GNUNET_YES)) | 800 | if (GNUNET_OK != GNUNET_DISK_file_size(filename, &size, GNUNET_NO, GNUNET_YES)) |
@@ -783,7 +812,9 @@ GNUNET_CHAT_file_is_local (const struct GNUNET_CHAT_File *file) | |||
783 | return GNUNET_SYSERR; | 812 | return GNUNET_SYSERR; |
784 | 813 | ||
785 | char *filename; | 814 | char *filename; |
786 | util_get_filename (file->handle->directory, &(file->hash), &filename); | 815 | util_get_filename ( |
816 | file->handle->directory, "files", &(file->hash), &filename | ||
817 | ); | ||
787 | 818 | ||
788 | int result = GNUNET_DISK_file_test(filename); | 819 | int result = GNUNET_DISK_file_test(filename); |
789 | 820 | ||
@@ -809,7 +840,9 @@ GNUNET_CHAT_file_start_download (struct GNUNET_CHAT_File *file, | |||
809 | const uint64_t size = GNUNET_FS_uri_chk_get_file_size(file->uri); | 840 | const uint64_t size = GNUNET_FS_uri_chk_get_file_size(file->uri); |
810 | 841 | ||
811 | char *filename; | 842 | char *filename; |
812 | util_get_filename (file->handle->directory, &(file->hash), &filename); | 843 | util_get_filename ( |
844 | file->handle->directory, "files", &(file->hash), &filename | ||
845 | ); | ||
813 | 846 | ||
814 | uint64_t offset; | 847 | uint64_t offset; |
815 | if (GNUNET_OK != GNUNET_DISK_file_size(filename, &offset, GNUNET_NO, GNUNET_YES)) | 848 | if (GNUNET_OK != GNUNET_DISK_file_size(filename, &offset, GNUNET_NO, GNUNET_YES)) |
@@ -890,7 +923,9 @@ GNUNET_CHAT_file_unindex (struct GNUNET_CHAT_File *file) | |||
890 | return GNUNET_OK; | 923 | return GNUNET_OK; |
891 | 924 | ||
892 | char *filename; | 925 | char *filename; |
893 | util_get_filename (file->handle->directory, &(file->hash), &filename); | 926 | util_get_filename ( |
927 | file->handle->directory, "files", &(file->hash), &filename | ||
928 | ); | ||
894 | 929 | ||
895 | file->unindex = GNUNET_FS_unindex_start( | 930 | file->unindex = GNUNET_FS_unindex_start( |
896 | file->handle->fs, filename, file | 931 | file->handle->fs, filename, file |