mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Fix stubs and move some tests to http_common
This commit is contained in:
parent
be62b446f7
commit
1bb6cecee6
@ -126,7 +126,6 @@ unittest_sources = \
|
||||
tests/unittests/log/stub_log.c \
|
||||
tests/unittests/database/stub_database.c \
|
||||
tests/unittests/config/stub_accounts.c \
|
||||
tests/unittests/tools/stub_http_common.c \
|
||||
tests/unittests/tools/stub_http_upload.c \
|
||||
tests/unittests/tools/stub_http_download.c \
|
||||
tests/unittests/tools/stub_aesgcm_download.c \
|
||||
@ -156,7 +155,7 @@ unittest_sources = \
|
||||
tests/unittests/test_cmd_disconnect.c tests/unittests/test_cmd_disconnect.h \
|
||||
tests/unittests/test_callbacks.c tests/unittests/test_callbacks.h \
|
||||
tests/unittests/test_plugins_disco.c tests/unittests/test_plugins_disco.h \
|
||||
tests/unittests/test_http_download.c tests/unittests/test_http_download.h \
|
||||
tests/unittests/test_http_common.c tests/unittests/test_http_common.h \
|
||||
tests/unittests/unittests.c
|
||||
|
||||
functionaltest_sources = \
|
||||
|
@ -64,35 +64,31 @@ http_basename_from_url(const char* url)
|
||||
}
|
||||
|
||||
void
|
||||
http_print_transfer_update(ProfWin* window, char* url,
|
||||
const char* fmt, ...)
|
||||
http_print_transfer_update(ProfWin* window, char* url, const char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
char* msg;
|
||||
if (vasprintf(&msg, fmt, args) == -1) {
|
||||
msg = strdup(FALLBACK_MSG);
|
||||
}
|
||||
GString* msg = g_string_new(FALLBACK_MSG);
|
||||
g_string_vprintf(msg, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
win_update_entry_message(window, url, msg);
|
||||
free(msg);
|
||||
win_update_entry_message(window, url, msg->str);
|
||||
|
||||
g_string_free(msg, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
http_print_transfer(ProfWin* window, char* url,
|
||||
const char* fmt, ...)
|
||||
http_print_transfer(ProfWin* window, char* url, const char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
char* msg;
|
||||
if (vasprintf(&msg, fmt, args) == -1) {
|
||||
msg = strdup(FALLBACK_MSG);
|
||||
}
|
||||
GString* msg = g_string_new(FALLBACK_MSG);
|
||||
g_string_vprintf(msg, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
win_print_http_transfer(window, msg, url);
|
||||
free(msg);
|
||||
win_print_http_transfer(window, msg->str, url);
|
||||
|
||||
g_string_free(msg, TRUE);
|
||||
}
|
||||
|
@ -36,8 +36,6 @@
|
||||
#ifndef TOOLS_HTTP_COMMON_H
|
||||
#define TOOLS_HTTP_COMMON_H
|
||||
|
||||
#define _GNU_SOURCE 1
|
||||
|
||||
#include "ui/window.h"
|
||||
|
||||
char* http_basename_from_url(const char* url);
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "tools/http_download.h"
|
||||
#include "tools/http_common.c"
|
||||
|
||||
typedef struct
|
||||
{
|
@ -15,9 +15,13 @@ typedef struct aesgcm_download_t
|
||||
HTTPDownload* http_dl;
|
||||
} AESGCMDownload;
|
||||
|
||||
void* aesgcm_file_get(void* userdata);
|
||||
void*
|
||||
aesgcm_file_get(void* userdata)
|
||||
{
|
||||
return NULL;
|
||||
};
|
||||
|
||||
void aesgcm_download_cancel_processes(ProfWin* window);
|
||||
void aesgcm_download_add_download(AESGCMDownload* download);
|
||||
void aesgcm_download_cancel_processes(ProfWin* window){};
|
||||
void aesgcm_download_add_download(AESGCMDownload* download){};
|
||||
|
||||
#endif
|
||||
|
@ -1,16 +0,0 @@
|
||||
#ifndef TOOLS_HTTP_COMMON_H
|
||||
#define TOOLS_HTTP_COMMON_H
|
||||
|
||||
typedef struct prof_win_t ProfWin;
|
||||
|
||||
char*
|
||||
http_basename_from_url(const char* url)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void http_print_transfer(ProfWin* window, char* url, const char* fmt, ...);
|
||||
void http_print_transfer_update(ProfWin* window, char* url,
|
||||
const char* fmt, ...);
|
||||
|
||||
#endif
|
@ -18,9 +18,4 @@ typedef struct http_download_t
|
||||
int cancel;
|
||||
} HTTPDownload;
|
||||
|
||||
void* http_file_get(void* userdata);
|
||||
|
||||
void http_download_cancel_processes(ProfWin* window);
|
||||
void http_download_add_download(HTTPDownload* download);
|
||||
|
||||
#endif
|
||||
|
@ -20,8 +20,6 @@ typedef struct http_upload_t
|
||||
int cancel;
|
||||
} HTTPUpload;
|
||||
|
||||
//GSList *upload_processes;
|
||||
|
||||
void*
|
||||
http_file_put(void* userdata)
|
||||
{
|
||||
@ -33,6 +31,7 @@ file_mime_type(const char* const file_name)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
off_t
|
||||
file_size(const char* const file_name)
|
||||
{
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include "test_form.h"
|
||||
#include "test_callbacks.h"
|
||||
#include "test_plugins_disco.h"
|
||||
#include "test_http_download.h"
|
||||
#include "test_http_common.h"
|
||||
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
|
Loading…
x
Reference in New Issue
Block a user