[PD2] Code almost all done. Need to add logout and change help message
Co-authored-by: tsousa111 <tiagao2001@hotmail.com>
This commit is contained in:
parent
e2c3d75223
commit
6f8219d991
12 changed files with 123 additions and 212 deletions
|
@ -80,7 +80,7 @@ func (ds DataStore) CreateTables() error {
|
|||
|
||||
func (ds DataStore) GetMessage(toUID string, position int) (*protocol.AnswerGetMsg, error) {
|
||||
|
||||
var serverMessage protocol.AnswerGetMsg
|
||||
serverMessage := new(protocol.AnswerGetMsg)
|
||||
query := `
|
||||
SELECT fromUID, toUID, subject, body, timestamp
|
||||
FROM messages
|
||||
|
@ -189,7 +189,7 @@ func (ds DataStore) AddMessageToQueue(fromUID string, message protocol.SendMsg)
|
|||
return nil
|
||||
}
|
||||
|
||||
func (ds DataStore) GetUserCertificate(uid string) (protocol.AnswerGetUserCert,error) {
|
||||
func (ds DataStore) GetUserCertificate(uid string) (protocol.AnswerGetUserCert, error) {
|
||||
query := `
|
||||
SELECT userCert
|
||||
FROM users
|
||||
|
@ -202,9 +202,9 @@ func (ds DataStore) GetUserCertificate(uid string) (protocol.AnswerGetUserCert,e
|
|||
if err == sql.ErrNoRows {
|
||||
errorMessage := fmt.Sprintf("No certificate for UID %v found in the database", uid)
|
||||
log.Println(errorMessage)
|
||||
return protocol.AnswerGetUserCert{},errors.New(errorMessage)
|
||||
return protocol.AnswerGetUserCert{}, errors.New(errorMessage)
|
||||
}
|
||||
return protocol.NewAnswerGetUserCert(uid, userCertBytes),nil
|
||||
return protocol.NewAnswerGetUserCert(uid, userCertBytes), nil
|
||||
}
|
||||
|
||||
func (ds DataStore) userExists(uid string) bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue