[PD2] Server done?
Co-authored-by: tsousa111 <tiagao2001@hotmail.com>
This commit is contained in:
parent
08a73a4f76
commit
49a29e43a7
66 changed files with 2777 additions and 5 deletions
|
@ -90,7 +90,7 @@ func (ds DataStore) GetMessage(toUID string, position int) protocol.Packet {
|
|||
err := row.Scan(&serverMessage.FromUID, &serverMessage.ToUID, &serverMessage.Subject, &serverMessage.Body, &serverMessage.Timestamp)
|
||||
if err == sql.ErrNoRows {
|
||||
log.Printf("No message with NUM %v for UID %v\n", position, toUID)
|
||||
errorMessage := fmt.Sprintf("MSG SERVICE: unknown message!")
|
||||
errorMessage := fmt.Sprintln("MSG SERVICE: unknown message!")
|
||||
return protocol.NewReportErrorPacket(errorMessage)
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ func (ds DataStore) userExists(uid string) bool {
|
|||
err := ds.db.QueryRow(query, uid).Scan(&count)
|
||||
if err != nil || count == 0 {
|
||||
log.Printf("user with UID %v does not exist\n", uid)
|
||||
return false
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@ import (
|
|||
"log"
|
||||
)
|
||||
|
||||
//TODO: LOGGING SYSTEM
|
||||
|
||||
func clientHandler(connection networking.Connection[protocol.Packet], dataStore DataStore) {
|
||||
defer connection.Conn.Close()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue