ui: finished (kinda) file upload
This commit is contained in:
+8
-9
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user