mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-08-04 21:16:21 +00:00
Run make format on rebase
This commit is contained in:
@@ -4807,8 +4807,10 @@ cmd_disco(ProfWin* window, const char* const command, gchar** args)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
char *_add_omemo_stream(int *fd, FILE **fh, char **err) {
|
||||
#ifdef HAVE_OMEMO
|
||||
char*
|
||||
_add_omemo_stream(int* fd, FILE** fh, char** err)
|
||||
{
|
||||
// Create temporary file for writing ciphertext.
|
||||
int tmpfd;
|
||||
char* tmpname = NULL;
|
||||
@@ -4843,6 +4845,7 @@ char *_add_omemo_stream(int *fd, FILE **fh, char **err) {
|
||||
|
||||
return fragment;
|
||||
}
|
||||
#endif
|
||||
|
||||
gboolean
|
||||
cmd_sendfile(ProfWin* window, const char* const command, gchar** args)
|
||||
@@ -4925,18 +4928,6 @@ cmd_sendfile(ProfWin* window, const char* const command, gchar** args)
|
||||
cons_show_error("Unsupported window for file transmission.");
|
||||
goto out;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WIN_PRIVATE:
|
||||
{
|
||||
//we don't support encryption in private muc windows
|
||||
break;
|
||||
}
|
||||
default:
|
||||
cons_show_error("Unsupported window for file transmission.");
|
||||
free(filename);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HTTPUpload* upload = malloc(sizeof(HTTPUpload));
|
||||
upload->window = window;
|
||||
@@ -9124,7 +9115,7 @@ cmd_url_open(ProfWin* window, const char* const command, gchar** args)
|
||||
g_strfreev(suffix_cmd_pref);
|
||||
|
||||
gchar* scheme = g_uri_parse_scheme(args[1]);
|
||||
if( 0 == g_strcmp0(scheme, OMEMO_AESGCM_URL_SCHEME)) {
|
||||
if (0 == g_strcmp0(scheme, "aesgcm")) {
|
||||
require_save = true;
|
||||
}
|
||||
g_free(scheme);
|
||||
@@ -9163,8 +9154,9 @@ cmd_url_open(ProfWin* window, const char* const command, gchar** args)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void _url_save_fallback_method(ProfWin *window, const char *url, const char *filename) {
|
||||
void
|
||||
_url_save_fallback_method(ProfWin* window, const char* url, const char* filename)
|
||||
{
|
||||
FILE* fh = fopen(filename, "wb");
|
||||
if (!fh) {
|
||||
cons_show_error("Cannot open file '%s' for writing.", filename);
|
||||
@@ -9180,7 +9172,9 @@ void _url_save_fallback_method(ProfWin *window, const char *url, const char *fil
|
||||
http_download_add_download(download);
|
||||
}
|
||||
|
||||
void _url_save_external_method(const char *scheme_cmd, const char *url, const char *filename) {
|
||||
void
|
||||
_url_save_external_method(const char* scheme_cmd, const char* url, const char* filename)
|
||||
{
|
||||
gchar** argv = g_strsplit(scheme_cmd, " ", 0);
|
||||
|
||||
guint num_args = 0;
|
||||
@@ -9202,7 +9196,9 @@ void _url_save_external_method(const char *scheme_cmd, const char *url, const ch
|
||||
}
|
||||
}
|
||||
|
||||
char *_make_unique_filename(const char *filename) {
|
||||
char*
|
||||
_make_unique_filename(const char* filename)
|
||||
{
|
||||
char* unique = strdup(filename);
|
||||
|
||||
unsigned int i = 0;
|
||||
@@ -9224,9 +9220,7 @@ char *_make_unique_filename(const char *filename) {
|
||||
gboolean
|
||||
cmd_url_save(ProfWin* window, const char* const command, gchar** args)
|
||||
{
|
||||
if (window->type != WIN_CHAT &&
|
||||
window->type != WIN_MUC &&
|
||||
window->type != WIN_PRIVATE) {
|
||||
if (window->type != WIN_CHAT && window->type != WIN_MUC && window->type != WIN_PRIVATE) {
|
||||
cons_show_error("`/url save` is not supported in this window.");
|
||||
return TRUE;
|
||||
}
|
||||
@@ -9284,7 +9278,7 @@ cmd_url_save(ProfWin *window, const char *const command, gchar **args)
|
||||
if (scheme_cmd == NULL) {
|
||||
if (g_strcmp0(scheme, "http") == 0
|
||||
|| g_strcmp0(scheme, "https") == 0
|
||||
|| g_strcmp0(scheme, OMEMO_AESGCM_URL_SCHEME) == 0) {
|
||||
|| g_strcmp0(scheme, "aesgcm") == 0) {
|
||||
_url_save_fallback_method(window, url, filename);
|
||||
} else {
|
||||
cons_show_error("No download method defined for the scheme '%s'.", scheme);
|
||||
|
||||
@@ -1790,8 +1790,7 @@ _save_prefs(void)
|
||||
static const char*
|
||||
_get_group(preference_t pref)
|
||||
{
|
||||
switch (pref)
|
||||
{
|
||||
switch (pref) {
|
||||
case PREF_CLEAR_PERSIST_HISTORY:
|
||||
case PREF_SPLASH:
|
||||
case PREF_BEEP:
|
||||
@@ -1937,8 +1936,7 @@ _get_group(preference_t pref)
|
||||
static const char*
|
||||
_get_key(preference_t pref)
|
||||
{
|
||||
switch (pref)
|
||||
{
|
||||
switch (pref) {
|
||||
case PREF_CLEAR_PERSIST_HISTORY:
|
||||
return "clear.persist_history";
|
||||
case PREF_SPLASH:
|
||||
|
||||
@@ -377,8 +377,10 @@ out:
|
||||
return res;
|
||||
}
|
||||
|
||||
int aes256gcm_crypt_file(FILE *in, FILE *out, off_t file_size,
|
||||
unsigned char key[], unsigned char nonce[], bool encrypt) {
|
||||
int
|
||||
aes256gcm_crypt_file(FILE* in, FILE* out, off_t file_size,
|
||||
unsigned char key[], unsigned char nonce[], bool encrypt)
|
||||
{
|
||||
|
||||
if (!gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) {
|
||||
fputs("libgcrypt has not been initialized\n", stderr);
|
||||
@@ -463,7 +465,9 @@ out:
|
||||
return res;
|
||||
}
|
||||
|
||||
char *aes256gcm_create_secure_fragment(unsigned char *key, unsigned char *nonce) {
|
||||
char*
|
||||
aes256gcm_create_secure_fragment(unsigned char* key, unsigned char* nonce)
|
||||
{
|
||||
int key_size = AES256_GCM_KEY_LENGTH;
|
||||
int nonce_size = AES256_GCM_NONCE_LENGTH;
|
||||
|
||||
|
||||
@@ -1654,12 +1654,15 @@ _generate_signed_pre_key(void)
|
||||
SIGNAL_UNREF(signed_pre_key);
|
||||
}
|
||||
|
||||
|
||||
void omemo_free(void *a) {
|
||||
void
|
||||
omemo_free(void* a)
|
||||
{
|
||||
gcry_free(a);
|
||||
}
|
||||
|
||||
char *omemo_encrypt_file(FILE *in, FILE *out, off_t file_size, int *gcry_res) {
|
||||
char*
|
||||
omemo_encrypt_file(FILE* in, FILE* out, off_t file_size, int* gcry_res)
|
||||
{
|
||||
unsigned char* key = gcry_random_bytes_secure(
|
||||
AES256_GCM_KEY_LENGTH,
|
||||
GCRY_VERY_STRONG_RANDOM);
|
||||
|
||||
@@ -219,7 +219,9 @@ http_download_add_download(HTTPDownload *download)
|
||||
download_processes = g_slist_append(download_processes, download);
|
||||
}
|
||||
|
||||
char *http_basename_from_url(const char *url) {
|
||||
char*
|
||||
http_basename_from_url(const char* url)
|
||||
{
|
||||
const char* default_name = "index.html";
|
||||
|
||||
GFile* file = g_file_new_for_uri(url);
|
||||
|
||||
@@ -46,7 +46,8 @@
|
||||
|
||||
#include "ui/win_types.h"
|
||||
|
||||
typedef struct http_download_t {
|
||||
typedef struct http_download_t
|
||||
{
|
||||
char* url;
|
||||
FILE* filehandle;
|
||||
curl_off_t bytes_received;
|
||||
|
||||
@@ -128,7 +128,9 @@ _data_callback(void* ptr, size_t size, size_t nmemb, void* data)
|
||||
return realsize;
|
||||
}
|
||||
|
||||
int format_alt_url(char *original_url, char *new_scheme, char *new_fragment, char **new_url) {
|
||||
int
|
||||
format_alt_url(char* original_url, char* new_scheme, char* new_fragment, char** new_url)
|
||||
{
|
||||
int ret = 0;
|
||||
CURLU* h = curl_url();
|
||||
|
||||
@@ -361,7 +363,8 @@ file_mime_type(const char* const filename)
|
||||
return out_mime_type;
|
||||
}
|
||||
|
||||
off_t file_size(int filedes)
|
||||
off_t
|
||||
file_size(int filedes)
|
||||
{
|
||||
struct stat st;
|
||||
fstat(filedes, &st);
|
||||
|
||||
@@ -45,7 +45,8 @@
|
||||
|
||||
#include "ui/win_types.h"
|
||||
|
||||
typedef struct http_upload_t {
|
||||
typedef struct http_upload_t
|
||||
{
|
||||
char* filename;
|
||||
FILE* filehandle;
|
||||
off_t filesize;
|
||||
|
||||
@@ -2192,7 +2192,7 @@ cons_show_omemo_prefs(void)
|
||||
cons_show("OMEMO char (/omemo char) : %s", ch);
|
||||
free(ch);
|
||||
|
||||
cons_alert();
|
||||
cons_alert(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -79,15 +79,38 @@ omemo_own_fingerprint(gboolean formatted)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void omemo_start_muc_sessions(const char *const roomjid) {}
|
||||
void omemo_start_session(const char *const barejid) {}
|
||||
void omemo_trust(const char *const jid, const char *const fingerprint_formatted) {}
|
||||
void omemo_untrust(const char *const jid, const char *const fingerprint_formatted) {}
|
||||
void omemo_devicelist_publish(GList *device_list) {}
|
||||
void omemo_publish_crypto_materials(void) {}
|
||||
void omemo_start_sessions(void) {}
|
||||
void
|
||||
omemo_start_muc_sessions(const char* const roomjid)
|
||||
{
|
||||
}
|
||||
void
|
||||
omemo_start_session(const char* const barejid)
|
||||
{
|
||||
}
|
||||
void
|
||||
omemo_trust(const char* const jid, const char* const fingerprint_formatted)
|
||||
{
|
||||
}
|
||||
void
|
||||
omemo_untrust(const char* const jid, const char* const fingerprint_formatted)
|
||||
{
|
||||
}
|
||||
void
|
||||
omemo_devicelist_publish(GList* device_list)
|
||||
{
|
||||
}
|
||||
void
|
||||
omemo_publish_crypto_materials(void)
|
||||
{
|
||||
}
|
||||
void
|
||||
omemo_start_sessions(void)
|
||||
{
|
||||
}
|
||||
|
||||
char *omemo_encrypt_file(FILE *in, FILE *out, off_t file_size, int *gcry_res) {
|
||||
char*
|
||||
omemo_encrypt_file(FILE* in, FILE* out, off_t file_size, int* gcry_res)
|
||||
{
|
||||
return NULL;
|
||||
};
|
||||
void omemo_free(void* a){};
|
||||
|
||||
@@ -10,12 +10,15 @@
|
||||
|
||||
#include "tools/http_download.h"
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
char* url;
|
||||
char* basename;
|
||||
} url_test_t;
|
||||
|
||||
void http_basename_from_url_td(void **state) {
|
||||
void
|
||||
http_basename_from_url_td(void** state)
|
||||
{
|
||||
int num_tests = 11;
|
||||
url_test_t tests[] = {
|
||||
(url_test_t){
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
typedef struct prof_win_t ProfWin;
|
||||
|
||||
typedef struct http_download_t {
|
||||
typedef struct http_download_t
|
||||
{
|
||||
char* url;
|
||||
char* filename;
|
||||
char* directory;
|
||||
@@ -17,7 +18,6 @@ typedef struct http_download_t {
|
||||
int cancel;
|
||||
} HTTPDownload;
|
||||
|
||||
|
||||
void* http_file_get(void* userdata);
|
||||
|
||||
void http_download_cancel_processes(ProfWin* window);
|
||||
|
||||
@@ -236,97 +236,16 @@ ui_contact_online(char* barejid, Resource* resource, GDateTime* last_activity)
|
||||
check_expected(last_activity);
|
||||
}
|
||||
|
||||
void ui_contact_typing(const char * const barejid, const char * const resource) {}
|
||||
void chatwin_incoming_msg(ProfChatWin *chatwin, ProfMessage *message, gboolean win_created) {}
|
||||
void chatwin_receipt_received(ProfChatWin *chatwin, const char * const id) {}
|
||||
|
||||
void privwin_incoming_msg(ProfPrivateWin *privatewin, ProfMessage *message) {}
|
||||
|
||||
void ui_disconnected(void) {}
|
||||
void chatwin_recipient_gone(ProfChatWin *chatwin) {}
|
||||
|
||||
void chatwin_outgoing_msg(ProfChatWin *chatwin, const char *const message, char *id, prof_enc_t enc_mode, gboolean request_receipt, const char *const replace_id) {}
|
||||
void chatwin_outgoing_carbon(ProfChatWin *chatwin, ProfMessage *message) {}
|
||||
void privwin_outgoing_msg(ProfPrivateWin *privwin, const char * const message) {}
|
||||
|
||||
void privwin_occupant_offline(ProfPrivateWin *privwin) {}
|
||||
void privwin_occupant_kicked(ProfPrivateWin *privwin, const char *const actor, const char *const reason) {}
|
||||
void privwin_occupant_banned(ProfPrivateWin *privwin, const char *const actor, const char *const reason) {}
|
||||
void privwin_occupant_online(ProfPrivateWin *privwin) {}
|
||||
void privwin_message_occupant_offline(ProfPrivateWin *privwin) {}
|
||||
|
||||
void privwin_message_left_room(ProfPrivateWin *privwin) {}
|
||||
|
||||
void ui_room_join(const char * const roomjid, gboolean focus) {}
|
||||
void ui_switch_to_room(const char * const roomjid) {}
|
||||
|
||||
void mucwin_role_change(ProfMucWin *mucwin, const char * const role, const char * const actor,
|
||||
const char * const reason) {}
|
||||
void mucwin_affiliation_change(ProfMucWin *mucwin, const char * const affiliation, const char * const actor,
|
||||
const char * const reason) {}
|
||||
void mucwin_role_and_affiliation_change(ProfMucWin *mucwin, const char * const role,
|
||||
const char * const affiliation, const char * const actor, const char * const reason) {}
|
||||
void mucwin_occupant_role_change(ProfMucWin *mucwin, const char * const nick, const char * const role,
|
||||
const char * const actor, const char * const reason) {}
|
||||
void mucwin_occupant_affiliation_change(ProfMucWin *mucwin, const char * const nick, const char * const affiliation,
|
||||
const char * const actor, const char * const reason) {}
|
||||
void mucwin_occupant_role_and_affiliation_change(ProfMucWin *mucwin, const char * const nick, const char * const role,
|
||||
const char * const affiliation, const char * const actor, const char * const reason) {}
|
||||
void mucwin_roster(ProfMucWin *mucwin, GList *occupants, const char * const presence) {}
|
||||
void mucwin_history(ProfMucWin *mucwin, const ProfMessage *const message) {}
|
||||
void mucwin_incoming_msg(ProfMucWin *mucwin, const ProfMessage *const message, GSList *mentions, GList *triggers, gboolean filter_reflection) {}
|
||||
void mucwin_outgoing_msg(ProfMucWin *mucwin, const char *const message, const char *const id, prof_enc_t enc_mode, const char *const replace_id) {}
|
||||
void mucwin_subject(ProfMucWin *mucwin, const char * const nick, const char * const subject) {}
|
||||
void mucwin_requires_config(ProfMucWin *mucwin) {}
|
||||
void ui_room_destroy(const char * const roomjid) {}
|
||||
void mucwin_info(ProfMucWin *mucwin) {}
|
||||
void mucwin_show_role_list(ProfMucWin *mucwin, muc_role_t role) {}
|
||||
void mucwin_show_affiliation_list(ProfMucWin *mucwin, muc_affiliation_t affiliation) {}
|
||||
void mucwin_room_info_error(ProfMucWin *mucwin, const char * const error) {}
|
||||
void mucwin_room_disco_info(ProfMucWin *mucwin, GSList *identities, GSList *features) {}
|
||||
void ui_room_destroyed(const char * const roomjid, const char * const reason, const char * const new_jid,
|
||||
const char * const password) {}
|
||||
void ui_room_kicked(const char * const roomjid, const char * const actor, const char * const reason) {}
|
||||
void mucwin_occupant_kicked(ProfMucWin *mucwin, const char * const nick, const char * const actor,
|
||||
const char * const reason) {}
|
||||
void ui_room_banned(const char * const roomjid, const char * const actor, const char * const reason) {}
|
||||
void mucwin_occupant_banned(ProfMucWin *mucwin, const char * const nick, const char * const actor,
|
||||
const char * const reason) {}
|
||||
void ui_leave_room(const char * const roomjid) {}
|
||||
void mucwin_broadcast(ProfMucWin *mucwin, const char * const message) {}
|
||||
void mucwin_occupant_offline(ProfMucWin *mucwin, const char * const nick) {}
|
||||
void mucwin_occupant_online(ProfMucWin *mucwin, const char * const nick, const char * const roles,
|
||||
const char * const affiliation, const char * const show, const char * const status) {}
|
||||
void mucwin_occupant_nick_change(ProfMucWin *mucwin, const char * const old_nick, const char * const nick) {}
|
||||
void mucwin_nick_change(ProfMucWin *mucwin, const char * const nick) {}
|
||||
void mucwin_occupant_presence(ProfMucWin *mucwin, const char * const nick, const char * const show,
|
||||
const char * const status) {}
|
||||
void mucwin_update_occupants(ProfMucWin *mucwin) {}
|
||||
void mucwin_show_occupants(ProfMucWin *mucwin) {}
|
||||
void mucwin_hide_occupants(ProfMucWin *mucwin) {}
|
||||
void mucwin_set_enctext(ProfMucWin *mucwin, const char *const enctext) {}
|
||||
void mucwin_unset_enctext(ProfMucWin *mucwin) {}
|
||||
void mucwin_set_message_char(ProfMucWin *mucwin, const char *const ch) {}
|
||||
void mucwin_unset_message_char(ProfMucWin *mucwin) {}
|
||||
|
||||
void win_update_entry_message(ProfWin *window, const char *const id, const char *const message) {};
|
||||
void win_mark_received(ProfWin *window, const char *const id) {};
|
||||
void win_print_http_transfer(ProfWin *window, const char *const message, char *url) {};
|
||||
|
||||
void ui_show_roster(void) {}
|
||||
void ui_hide_roster(void) {}
|
||||
void ui_roster_add(const char * const barejid, const char * const name) {}
|
||||
void ui_roster_remove(const char * const barejid) {}
|
||||
void ui_contact_already_in_group(const char * const contact, const char * const group) {}
|
||||
void ui_contact_not_in_group(const char * const contact, const char * const group) {}
|
||||
void ui_group_added(const char * const contact, const char * const group) {}
|
||||
void ui_group_removed(const char * const contact, const char * const group) {}
|
||||
void chatwin_contact_online(ProfChatWin *chatwin, Resource *resource, GDateTime *last_activity) {}
|
||||
void chatwin_contact_offline(ProfChatWin *chatwin, char *resource, char *status) {}
|
||||
|
||||
void ui_contact_offline(char *barejid, char *resource, char *status) {}
|
||||
|
||||
void ui_handle_recipient_error(const char * const recipient, const char * const err_msg)
|
||||
void
|
||||
ui_contact_typing(const char* const barejid, const char* const resource)
|
||||
{
|
||||
}
|
||||
void
|
||||
chatwin_incoming_msg(ProfChatWin* chatwin, ProfMessage* message, gboolean win_created)
|
||||
{
|
||||
}
|
||||
void
|
||||
chatwin_receipt_received(ProfChatWin* chatwin, const char* const id)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -552,6 +471,10 @@ mucwin_unset_message_char(ProfMucWin* mucwin)
|
||||
{
|
||||
}
|
||||
|
||||
void win_update_entry_message(ProfWin* window, const char* const id, const char* const message){};
|
||||
void win_mark_received(ProfWin* window, const char* const id){};
|
||||
void win_print_http_transfer(ProfWin* window, const char* const message, char* url){};
|
||||
|
||||
void
|
||||
ui_show_roster(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user