]> git.r.bdr.sh - rbdr/mobius/blobdiff - hotline/server.go
patch: v0.5.3
[rbdr/mobius] / hotline / server.go
index 768433bc60b253f853c3b944580467e150344fc5..014824b6a7d0c9a6942f6531d764b782dfbd7ba9 100644 (file)
@@ -1,6 +1,7 @@
 package hotline
 
 import (
+       "bytes"
        "context"
        "encoding/binary"
        "errors"
@@ -31,6 +32,8 @@ const (
        trackerUpdateFrequency = 300 // time in seconds between tracker re-registration
 )
 
+var nostalgiaVersion = []byte{0, 0, 2, 0x2c} // version ID used by the Nostalgia client
+
 type Server struct {
        Port          int
        Accounts      map[string]*Account
@@ -362,8 +365,6 @@ func (s *Server) UpdateUser(login, newLogin, name, password string, access []byt
        s.mux.Lock()
        defer s.mux.Unlock()
 
-       fmt.Printf("login: %v, newLogin: %v: ", login, newLogin)
-
        // update renames the user login
        if login != newLogin {
                err := os.Rename(s.ConfigDir+"Users/"+login+".yaml", s.ConfigDir+"Users/"+newLogin+".yaml")
@@ -571,8 +572,8 @@ func (s *Server) handleNewConnection(conn net.Conn, remoteAddr string) error {
        // Show agreement to client
        c.Server.outbox <- *NewTransaction(tranShowAgreement, c.ID, NewField(fieldData, s.Agreement))
 
-       // assume simplified hotline v1.2.3 login flow that does not require agreement
-       if *c.Version == nil {
+       // Used simplified hotline v1.2.3 login flow for clients that do not send login info in tranAgreed
+       if *c.Version == nil || bytes.Equal(*c.Version, nostalgiaVersion) {
                c.Agreed = true
 
                c.notifyOthers(