]> git.r.bdr.sh - rbdr/mobius/blobdiff - hotline/client.go
Update goreleaser config
[rbdr/mobius] / hotline / client.go
index 3353095d2688cab8121748d6da258d965661bb98..3969e2633e6667f56f15995705998fd33e7945a6 100644 (file)
@@ -290,7 +290,7 @@ func handleGetFileNameList(ctx context.Context, c *Client, t *Transaction) (res
 
        for _, f := range t.Fields {
                var fn FileNameWithInfo
 
        for _, f := range t.Fields {
                var fn FileNameWithInfo
-               err = fn.UnmarshalBinary(f.Data)
+               _, err = fn.Write(f.Data)
                if err != nil {
                        return nil, nil
                }
                if err != nil {
                        return nil, nil
                }
@@ -405,11 +405,12 @@ func handleClientGetUserNameList(ctx context.Context, c *Client, t *Transaction)
                // fields, but shxd sneaks in FieldChatSubject (115) so it's important to filter explicitly for the expected
                // field type.  Probably a good idea to do everywhere.
                if bytes.Equal(field.ID, []byte{0x01, 0x2c}) {
                // fields, but shxd sneaks in FieldChatSubject (115) so it's important to filter explicitly for the expected
                // field type.  Probably a good idea to do everywhere.
                if bytes.Equal(field.ID, []byte{0x01, 0x2c}) {
-                       u, err := ReadUser(field.Data)
-                       if err != nil {
-                               return res, err
+                       var user User
+                       if _, err := user.Write(field.Data); err != nil {
+                               return res, fmt.Errorf("unable to read user data: %w", err)
                        }
                        }
-                       users = append(users, *u)
+
+                       users = append(users, user)
                }
        }
        c.UserList = users
                }
        }
        c.UserList = users
@@ -580,8 +581,8 @@ func (c *Client) LogIn(login string, password string) error {
                        TranLogin, nil,
                        NewField(FieldUserName, []byte(c.Pref.Username)),
                        NewField(FieldUserIconID, c.Pref.IconBytes()),
                        TranLogin, nil,
                        NewField(FieldUserName, []byte(c.Pref.Username)),
                        NewField(FieldUserIconID, c.Pref.IconBytes()),
-                       NewField(FieldUserLogin, negateString([]byte(login))),
-                       NewField(FieldUserPassword, negateString([]byte(password))),
+                       NewField(FieldUserLogin, encodeString([]byte(login))),
+                       NewField(FieldUserPassword, encodeString([]byte(password))),
                ),
        )
 }
                ),
        )
 }
@@ -649,7 +650,6 @@ func (c *Client) Disconnect() error {
        return c.Connection.Close()
 }
 
        return c.Connection.Close()
 }
 
-
 func (c *Client) HandleTransactions(ctx context.Context) error {
        // Create a new scanner for parsing incoming bytes into transaction tokens
        scanner := bufio.NewScanner(c.Connection)
 func (c *Client) HandleTransactions(ctx context.Context) error {
        // Create a new scanner for parsing incoming bytes into transaction tokens
        scanner := bufio.NewScanner(c.Connection)