ClienteTFG/session_manager.cpp

26 lines
623 B
C++

#include "session_manager.h"
#include "read_uses.h"
session_manager::session_manager(conexion* con)
{
this->con=con;
}
bool session_manager::loggin(std::string username, std::string passwd){
return this->con->check_pass(username, passwd);
}
int session_manager::install_command(std::string package){
read_uses uses(package);
this->con->write_string(package);
if(uses.exist_file()){
this->con->write_string("y");
this->con->write_string(*uses.get_uses());
}else{
this->con->write_string("n");
}
std::string buffer;
this->con->read_string(buffer,2);
return atoi(buffer.data());
}