Finish remove user implementation

This commit is contained in:
2020-05-26 01:37:34 +02:00
parent 2783e385a4
commit b0c78dde76
7 changed files with 23 additions and 1 deletions

View File

@@ -42,6 +42,8 @@ void session_manager::start_dialog(){
this->send_user_info();
}else if(strcmp(buffer,"cusr")==0){
this->create_user();
}else if(strcmp(buffer,"rusr")==0){
this->remove_user();
}else if((strcmp(buffer,"exit")==0)||(n_read==0)){
break;
}
@@ -135,6 +137,8 @@ void session_manager::create_user(){
char* user=new char[256];
char* pass=new char[256];
char* admin=new char[256];
//basura
this->read_data(user, 256);
this->read_data(user, 256);
this->read_data(pass, 256);
this->read_data(admin, 256);
@@ -144,6 +148,13 @@ void session_manager::create_user(){
delete [] (admin);
}
void session_manager::remove_user(){
char *buffer=new char[256];
this->read_data(buffer,256);
this->read_data(buffer,256);
this->data->remove_user(std::string(buffer));
}
int session_manager::read_data(char* input, int size){
return read(this->fd, input, size);
}