From b3070f612a9ac06a9a3399fbe2e1c74d7a96ff42 Mon Sep 17 00:00:00 2001 From: Alexander Zhylin Date: Thu, 22 Jan 2026 16:28:04 +0200 Subject: [PATCH] fixes for TUI --- TODO.md | 4 +++- src/session.c | 5 ++++- src/user.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/TODO.md b/TODO.md index ceb5cc4..9803114 100644 --- a/TODO.md +++ b/TODO.md @@ -7,9 +7,11 @@ - [x] Get files in FS by their hash - [x] Registration - [x] Encrypt passwords in DB +- [ ] Registration: Error when username or email is already used +- [ ] Check correctness of email - [ ] Message to admin - [x] Advanced folder structure in the storage - [ ] File encryption - [ ] Connection encryption - +- [ ] Advanced rights for files - [ ] Multithreading \ No newline at end of file diff --git a/src/session.c b/src/session.c index 54a8841..4d70ebe 100644 --- a/src/session.c +++ b/src/session.c @@ -127,6 +127,8 @@ int query_extract_from_buf(session *sess, char **output_line) { void perform_session_action(session *sess, char *line, server_data_t *s_d) { int state = sess->state; int res; + char response[INBUFSIZE]; + uint32_t response_len = 0; /* while (sess->buf_used) { */ switch (state) { case OP_LOGIN_USR: @@ -148,8 +150,9 @@ void perform_session_action(session *sess, char *line, server_data_t *s_d) { res = file_upload_description(sess, line, s_d); if (res) { if (db_save_file(sess)) { + response_len = sprintf(response, "File \"%s\" is saved!\04\n", sess->file->name); + write(sess->sd, response, response_len+1); clear_file_from_sess(sess); - session_send_string(sess, "File is saved!\n"); sess->state = OP_WAIT; } else { // TODO: error case diff --git a/src/user.c b/src/user.c index 709c43b..66ca3e6 100644 --- a/src/user.c +++ b/src/user.c @@ -85,7 +85,7 @@ int process_error(session *sess) { return 1; break; case LOGIN: - session_send_string(sess, "Can't find the user with such credentials\n"); + session_send_string(sess, "Can't find the user with such credentials\04\n"); sess->state = OP_LOGIN_USR; sess->reason = NO_REASON; session_send_string(sess, "login_again> ");