diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2021-07-25 11:14:02 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2021-07-25 11:14:02 -0700 |
| commit | f7e36225dd16fe1d2428f53eccd4a16dff453a34 (patch) | |
| tree | 54f2bd6762c1e02a39d1039ada696f9cc56725d8 /client.go | |
| parent | bf290335ef0742721a915102187168ed04236c55 (diff) | |
FIx icon ID
Diffstat (limited to 'client.go')
| -rw-r--r-- | client.go | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -44,6 +44,12 @@ type ClientPrefs struct { Tracker string `yaml:"Tracker"` } +func (cp *ClientPrefs) IconBytes() []byte { + iconBytes := make([]byte, 2) + binary.BigEndian.PutUint16(iconBytes, uint16(cp.IconID)) + return iconBytes +} + func readConfig(cfgPath string) (*ClientPrefs, error) { fh, err := os.Open(cfgPath) if err != nil { @@ -717,7 +723,7 @@ func handleClientTranShowAgreement(c *Client, t *Transaction) (res []Transaction *NewTransaction( tranAgreed, nil, NewField(fieldUserName, []byte(c.pref.Username)), - NewField(fieldUserIconID, *c.Icon), + NewField(fieldUserIconID, c.pref.IconBytes()), NewField(fieldUserFlags, []byte{0x00, 0x00}), NewField(fieldOptions, []byte{0x00, 0x00}), ), @@ -726,7 +732,7 @@ func handleClientTranShowAgreement(c *Client, t *Transaction) (res []Transaction c.UI.Pages.HidePage("agreement") c.UI.App.SetFocus(c.UI.chatInput) } else { - c.Disconnect() + _ = c.Disconnect() c.UI.Pages.SwitchToPage("home") } }, @@ -838,7 +844,7 @@ func (c *Client) LogIn(login string, password string) error { *NewTransaction( tranLogin, nil, NewField(fieldUserName, []byte(c.pref.Username)), - NewField(fieldUserIconID, []byte{0x07, 0xd1}), + NewField(fieldUserIconID, c.pref.IconBytes()), NewField(fieldUserLogin, []byte(NegatedUserString([]byte(login)))), NewField(fieldUserPassword, []byte(NegatedUserString([]byte(password)))), NewField(fieldVersion, []byte{0, 2}), |