aboutsummaryrefslogtreecommitdiff
path: root/src/gnunet_chat_file.c
blob: e58066b1b32f52da1dae2829109ed3b33ecae0be (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * @author Tobias Frisch
 * @file gnunet_chat_file.c
 */

#include "gnunet_chat_lib.h"
#include "gnunet_chat_file.h"

void
GNUNET_CHAT_file_start_download (struct GNUNET_CHAT_File *file)
{
  if (!file)
    return;

  struct GNUNET_FS_Handle *handle;
  const char *path = ""; // TODO: path = download_directory + filename

  GNUNET_FS_download_start(
      handle,
      file->uri,
      NULL,
      path,
      NULL,
      0,
      0,
      0,
      GNUNET_FS_DOWNLOAD_OPTION_NONE,
      NULL,
      NULL
  );
}

void
GNUNET_CHAT_file_pause_download (struct GNUNET_CHAT_File *file)
{
  if (!file)
    return;

  GNUNET_FS_download_suspend(file->context);
}

void
GNUNET_CHAT_file_resume_download (struct GNUNET_CHAT_File *file)
{
  if (!file)
    return;

  GNUNET_FS_download_resume(file->context);
}

void
GNUNET_CHAT_file_stop_download (struct GNUNET_CHAT_File *file)
{
  if (!file)
    return;

  GNUNET_FS_download_stop(file, GNUNET_YES);
}