diff options
author | Michael Vetter <jubalh@iodoru.org> | 2020-04-17 10:05:09 +0200 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2020-04-17 10:05:09 +0200 |
commit | 9be7d29f1b8ab55fd377beeb9a5d31a4b32bf416 (patch) | |
tree | d975e1a7e8c00ff31350766d619da2aa03cba188 /src/tools | |
parent | 00fc0e2e8d02d830e44b3c28973661d8e5411b7b (diff) | |
download | profani-tty-9be7d29f1b8ab55fd377beeb9a5d31a4b32bf416.tar.gz |
Don't expose upload_processes
That's actually not good practise. Realized this when checking for multiple symbol definition in issue mentioned below. Regards https://github.com/profanity-im/profanity/issues/1314
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/http_upload.c | 21 | ||||
-rw-r--r-- | src/tools/http_upload.h | 5 |
2 files changed, 24 insertions, 2 deletions
diff --git a/src/tools/http_upload.c b/src/tools/http_upload.c index 79ed006c..f126a72d 100644 --- a/src/tools/http_upload.c +++ b/src/tools/http_upload.c @@ -65,6 +65,7 @@ struct curl_data_t { size_t size; }; +GSList *upload_processes = NULL; static int _xferinfo(void *userdata, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) @@ -332,3 +333,23 @@ off_t file_size(const char* const filename) stat(filename, &st); return st.st_size; } + +void +http_upload_cancel_processes(ProfWin *window) +{ + GSList *upload_process = upload_processes; + while (upload_process) { + HTTPUpload *upload = upload_process->data; + if (upload->window == window) { + upload->cancel = 1; + break; + } + upload_process = g_slist_next(upload_process); + } +} + +void +http_upload_add_upload(HTTPUpload *upload) +{ + upload_processes = g_slist_append(upload_processes, upload); +} diff --git a/src/tools/http_upload.h b/src/tools/http_upload.h index b9b46ca7..60b1ea82 100644 --- a/src/tools/http_upload.h +++ b/src/tools/http_upload.h @@ -57,11 +57,12 @@ typedef struct http_upload_t { int cancel; } HTTPUpload; -GSList *upload_processes; - void* http_file_put(void *userdata); char* file_mime_type(const char* const file_name); off_t file_size(const char* const file_name); +void http_upload_cancel_processes(ProfWin *window); +void http_upload_add_upload(HTTPUpload *upload); + #endif |