mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -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/log/stub_log.c \
|
||||||
tests/unittests/database/stub_database.c \
|
tests/unittests/database/stub_database.c \
|
||||||
tests/unittests/config/stub_accounts.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_upload.c \
|
||||||
tests/unittests/tools/stub_http_download.c \
|
tests/unittests/tools/stub_http_download.c \
|
||||||
tests/unittests/tools/stub_aesgcm_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_cmd_disconnect.c tests/unittests/test_cmd_disconnect.h \
|
||||||
tests/unittests/test_callbacks.c tests/unittests/test_callbacks.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_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
|
tests/unittests/unittests.c
|
||||||
|
|
||||||
functionaltest_sources = \
|
functionaltest_sources = \
|
||||||
|
@ -64,35 +64,31 @@ http_basename_from_url(const char* url)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
http_print_transfer_update(ProfWin* window, char* url,
|
http_print_transfer_update(ProfWin* window, char* url, const char* fmt, ...)
|
||||||
const char* fmt, ...)
|
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
char* msg;
|
GString* msg = g_string_new(FALLBACK_MSG);
|
||||||
if (vasprintf(&msg, fmt, args) == -1) {
|
g_string_vprintf(msg, fmt, args);
|
||||||
msg = strdup(FALLBACK_MSG);
|
|
||||||
}
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
win_update_entry_message(window, url, msg);
|
win_update_entry_message(window, url, msg->str);
|
||||||
free(msg);
|
|
||||||
|
g_string_free(msg, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
http_print_transfer(ProfWin* window, char* url,
|
http_print_transfer(ProfWin* window, char* url, const char* fmt, ...)
|
||||||
const char* fmt, ...)
|
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
char* msg;
|
GString* msg = g_string_new(FALLBACK_MSG);
|
||||||
if (vasprintf(&msg, fmt, args) == -1) {
|
g_string_vprintf(msg, fmt, args);
|
||||||
msg = strdup(FALLBACK_MSG);
|
|
||||||
}
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
win_print_http_transfer(window, msg, url);
|
win_print_http_transfer(window, msg->str, url);
|
||||||
free(msg);
|
|
||||||
|
g_string_free(msg, TRUE);
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,6 @@
|
|||||||
#ifndef TOOLS_HTTP_COMMON_H
|
#ifndef TOOLS_HTTP_COMMON_H
|
||||||
#define TOOLS_HTTP_COMMON_H
|
#define TOOLS_HTTP_COMMON_H
|
||||||
|
|
||||||
#define _GNU_SOURCE 1
|
|
||||||
|
|
||||||
#include "ui/window.h"
|
#include "ui/window.h"
|
||||||
|
|
||||||
char* http_basename_from_url(const char* url);
|
char* http_basename_from_url(const char* url);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "tools/http_download.h"
|
#include "tools/http_common.c"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
@ -15,9 +15,13 @@ typedef struct aesgcm_download_t
|
|||||||
HTTPDownload* http_dl;
|
HTTPDownload* http_dl;
|
||||||
} AESGCMDownload;
|
} 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_cancel_processes(ProfWin* window){};
|
||||||
void aesgcm_download_add_download(AESGCMDownload* download);
|
void aesgcm_download_add_download(AESGCMDownload* download){};
|
||||||
|
|
||||||
#endif
|
#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;
|
int cancel;
|
||||||
} HTTPDownload;
|
} HTTPDownload;
|
||||||
|
|
||||||
void* http_file_get(void* userdata);
|
|
||||||
|
|
||||||
void http_download_cancel_processes(ProfWin* window);
|
|
||||||
void http_download_add_download(HTTPDownload* download);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,8 +20,6 @@ typedef struct http_upload_t
|
|||||||
int cancel;
|
int cancel;
|
||||||
} HTTPUpload;
|
} HTTPUpload;
|
||||||
|
|
||||||
//GSList *upload_processes;
|
|
||||||
|
|
||||||
void*
|
void*
|
||||||
http_file_put(void* userdata)
|
http_file_put(void* userdata)
|
||||||
{
|
{
|
||||||
@ -33,6 +31,7 @@ file_mime_type(const char* const file_name)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
off_t
|
off_t
|
||||||
file_size(const char* const file_name)
|
file_size(const char* const file_name)
|
||||||
{
|
{
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include "test_form.h"
|
#include "test_form.h"
|
||||||
#include "test_callbacks.h"
|
#include "test_callbacks.h"
|
||||||
#include "test_plugins_disco.h"
|
#include "test_plugins_disco.h"
|
||||||
#include "test_http_download.h"
|
#include "test_http_common.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char* argv[])
|
main(int argc, char* argv[])
|
||||||
|
Loading…
Reference in New Issue
Block a user