[PD2] Relatorio final
Co-authored-by: tsousa111 <tiagao2001@hotmail.com>
This commit is contained in:
parent
a8a1c21e8e
commit
9951c4b9da
5 changed files with 51 additions and 38 deletions
|
@ -30,6 +30,11 @@ func Run() {
|
|||
if flag.NArg() == 0 {
|
||||
log.Fatalln("No command provided. Use 'help' for instructions.")
|
||||
}
|
||||
command := flag.Arg(0)
|
||||
if command == "help"{
|
||||
showHelp()
|
||||
return
|
||||
}
|
||||
//Get user KeyStore
|
||||
password := readStdin("Insert keystore passphrase")
|
||||
clientKeyStore, err := cryptoUtils.LoadKeyStore(userFile, password)
|
||||
|
@ -43,7 +48,6 @@ func Run() {
|
|||
printError("no pseudonym field on my certificate")
|
||||
os.Exit(1)
|
||||
}
|
||||
command := flag.Arg(0)
|
||||
// Check if token is in memory
|
||||
var token string
|
||||
if command != "login" && command != "register" {
|
||||
|
@ -142,7 +146,7 @@ func Run() {
|
|||
printError(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
printInfo("Registered successfully")
|
||||
printInfo("Registered successfully")
|
||||
case "login":
|
||||
if flag.NArg() != 1 {
|
||||
printError("MSG SERVICE: command error!")
|
||||
|
@ -172,16 +176,14 @@ func Run() {
|
|||
printError(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
printInfo("Login was successful")
|
||||
printInfo("Login was successful")
|
||||
|
||||
case "logout":
|
||||
err := os.Remove(tokenFolder + myUID)
|
||||
if err != nil {
|
||||
printError(err.Error())
|
||||
}
|
||||
printInfo("Logout was successful")
|
||||
case "help":
|
||||
showHelp()
|
||||
case "logout":
|
||||
err := os.Remove(tokenFolder + myUID)
|
||||
if err != nil {
|
||||
printError(err.Error())
|
||||
}
|
||||
printInfo("Logout was successful")
|
||||
|
||||
default:
|
||||
printError("MSG SERVICE: command error!")
|
||||
|
@ -494,10 +496,10 @@ func getUnreadMessagesInfo(keyStore cryptoUtils.KeyStore, page int, pageSize int
|
|||
}
|
||||
parsedURL = parsedURL.JoinPath("queue")
|
||||
|
||||
query := parsedURL.Query()
|
||||
query.Set("page", fmt.Sprint(page))
|
||||
query.Set("pagesize", fmt.Sprint(pageSize))
|
||||
parsedURL.RawQuery = query.Encode()
|
||||
query := parsedURL.Query()
|
||||
query.Set("page", fmt.Sprint(page))
|
||||
query.Set("pagesize", fmt.Sprint(pageSize))
|
||||
parsedURL.RawQuery = query.Encode()
|
||||
|
||||
req, err := http.NewRequest("GET", parsedURL.String(), nil)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue