refactoring; modal window init

This commit is contained in:
2025-11-27 17:19:02 +02:00
parent c524ece546
commit fd73fa7628
23 changed files with 252 additions and 47 deletions
+7 -27
View File
@@ -1,3 +1,6 @@
#ifndef MAIN_H
#define MAIN_H
#include <stddef.h>
#include "types.h"
@@ -6,6 +9,7 @@
#define LISTEN_QLEN 32
#define INBUFSIZE 1024
#define DOWNLOADS_DIR "./Downloads"
#define DIALOGUE_TITLE 64
typedef struct params {
unsigned short port;
@@ -29,8 +33,9 @@ enum state {
STATE_UPLOAD_FILE,
STATE_UPLOAD_REQUESTED,
STATE_ASK_USER_BEFORE_LOGIN,
ERR,
STATE_ERR,
};
typedef struct p_file {
char *name;
size_t size;
@@ -63,29 +68,4 @@ typedef struct query_args {
params_t *params;
} query_args_t;
void init_params(params_t *restrict);
void analyze_args(int argc, char *argv[], params_t *restrict);
void get_missing_params(params_t *restrict);
void connect_to_server(int sd, params_t *params);
int init_client();
void close_session(int sd);
void wait_register(query_args_t *q_args);
int process_query(query_args_t *query_args, file_args_t *file_args);
void query_loop(int sd, params_t *);
int query_extract_from_buf(char *buf, int *buf_used, char **output_line);
int process_client_command(char *line, int l_len, query_args_t *q_args);
int process_server_command(char *line, int l_len, query_args_t *q_args);
void ask_register(params_t *params, char *email);
void clear_params(params_t *params);
/* file processor */
void file_list(file_args_t *f_args, query_args_t *q_args);
void file_download(file_args_t *f_args, query_args_t *q_args);
void file_select(file_args_t *fargs, query_args_t *q_args);
void init_file_args(file_args_t *fargs);
int file_upload_request(char *, query_args_t *q_args);
int file_upload_start(query_args_t *q_args);
int file_upload(query_args_t *q_args);
void print_prompt(params_t *params);
#endif