ui: finished (kinda) file upload

This commit is contained in:
2026-01-22 16:26:36 +02:00
parent 346ded71bc
commit 50952f324d
10 changed files with 88 additions and 30 deletions
+8 -9
View File
@@ -14,7 +14,7 @@
void ask_uname_and_password(params_t *params);
void ask_register(params_t *params, char *email);
#define PRINT_SRV_MESSAGE(q_args) \
#define PRINT_SRV_MESSAGE(q_args, l_len, line) \
if (q_args->server_message.size > 0) { \
q_args->state = S_PRINT_SERVER_MESSAGE; \
q_args->next_server_command = malloc(l_len + 1); \
@@ -36,7 +36,7 @@ int process_server_command(char *line, int l_len, query_args_t *q_args) {
/* LOGIN */
if (!strncmp(line, "login>", ws_pos)) {
if (q_args->server_message.size > 0) {
PRINT_SRV_MESSAGE(q_args);
PRINT_SRV_MESSAGE(q_args, l_len, line);
}
if (q_args->params->uname != NULL && q_args->params->pass != NULL) {
write(params->sd, q_args->params->uname, strlen(q_args->params->uname));
@@ -110,13 +110,12 @@ int process_server_command(char *line, int l_len, query_args_t *q_args) {
strncat(q_args->server_message.text, line, l_len);
q_args->server_message.text[q_args->server_message.size + l_len] = 0;
}
} else {
/* char buf[INBUFSIZE + sizeof("server: ")] = "server: ";
strcat(buf, line);
write(STDOUT_FILENO, buf, l_len + sizeof("server: "));
if (q_args->state == WAIT_CLIENT) {
print_prompt(q_args->params);
} */
char *end_char = strchr(q_args->server_message.text, '\04'); /* Search for the end of the notification */
if (end_char != NULL) {
*end_char = '\0'; /* Don't show this symbol */
q_args->state = S_PRINT_SERVER_MESSAGE;
q_args->server_message.size--;
}
}
return 0;