fixes for TUI

This commit is contained in:
2026-01-22 16:28:04 +02:00
parent 9c135ca9a8
commit b3070f612a
3 changed files with 8 additions and 3 deletions
+3 -1
View File
@@ -7,9 +7,11 @@
- [x] Get files in FS by their hash - [x] Get files in FS by their hash
- [x] Registration - [x] Registration
- [x] Encrypt passwords in DB - [x] Encrypt passwords in DB
- [ ] Registration: Error when username or email is already used
- [ ] Check correctness of email
- [ ] Message to admin - [ ] Message to admin
- [x] Advanced folder structure in the storage - [x] Advanced folder structure in the storage
- [ ] File encryption - [ ] File encryption
- [ ] Connection encryption - [ ] Connection encryption
- [ ] Advanced rights for files
- [ ] Multithreading - [ ] Multithreading
+4 -1
View File
@@ -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) { void perform_session_action(session *sess, char *line, server_data_t *s_d) {
int state = sess->state; int state = sess->state;
int res; int res;
char response[INBUFSIZE];
uint32_t response_len = 0;
/* while (sess->buf_used) { */ /* while (sess->buf_used) { */
switch (state) { switch (state) {
case OP_LOGIN_USR: 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); res = file_upload_description(sess, line, s_d);
if (res) { if (res) {
if (db_save_file(sess)) { 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); clear_file_from_sess(sess);
session_send_string(sess, "File is saved!\n");
sess->state = OP_WAIT; sess->state = OP_WAIT;
} else { } else {
// TODO: error case // TODO: error case
+1 -1
View File
@@ -85,7 +85,7 @@ int process_error(session *sess) {
return 1; return 1;
break; break;
case LOGIN: 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->state = OP_LOGIN_USR;
sess->reason = NO_REASON; sess->reason = NO_REASON;
session_send_string(sess, "login_again> "); session_send_string(sess, "login_again> ");