File tree Expand file tree Collapse file tree 6 files changed +13
-16
lines changed Expand file tree Collapse file tree 6 files changed +13
-16
lines changed Original file line number Diff line number Diff line change 11/build
2+ /vendor
23host_key
34host_key.pub
45ssh-chat
Original file line number Diff line number Diff line change @@ -156,10 +156,10 @@ func InitCommands(c *Commands) {
156156 }
157157
158158 oldID := member .ID ()
159- member .SetID ( SanitizeName ( args [0 ]) )
159+ member .SetName ( args [0 ])
160160 err := room .Rename (oldID , member )
161161 if err != nil {
162- member .SetID (oldID )
162+ member .SetName (oldID )
163163 return err
164164 }
165165 return nil
Original file line number Diff line number Diff line change @@ -13,9 +13,9 @@ type roomMember struct {
1313
1414type Member interface {
1515 ID () string
16- SetID (string )
1716
1817 Name () string
18+ SetName (string )
1919
2020 Config () message.UserConfig
2121 SetConfig (message.UserConfig )
Original file line number Diff line number Diff line change @@ -3,8 +3,8 @@ package message
33// Identifier is an interface that can uniquely identify itself.
44type Identifier interface {
55 ID () string
6- SetID (string )
76 Name () string
7+ SetName (string )
88}
99
1010// SimpleID is a simple Identifier implementation used for testing.
@@ -15,12 +15,12 @@ func (i SimpleID) ID() string {
1515 return string (i )
1616}
1717
18- // SetID is a no-op
19- func (i SimpleID ) SetID (s string ) {
20- // no-op
21- }
22-
2318// Name returns the ID
2419func (i SimpleID ) Name () string {
2520 return i .ID ()
2621}
22+
23+ // SetName is a no-op
24+ func (i SimpleID ) SetName (s string ) {
25+ // no-op
26+ }
Original file line number Diff line number Diff line change @@ -65,8 +65,8 @@ func (u *User) SetConfig(cfg UserConfig) {
6565}
6666
6767// Rename the user with a new Identifier.
68- func (u * User ) SetID ( id string ) {
69- u .Identifier .SetID ( id )
68+ func (u * User ) SetName ( name string ) {
69+ u .Identifier .SetName ( name )
7070 u .setColorIdx (rand .Int ())
7171}
7272
Original file line number Diff line number Diff line change @@ -30,12 +30,8 @@ func (i Identity) ID() string {
3030 return i .id
3131}
3232
33- func (i * Identity ) SetID (id string ) {
34- i .id = id
35- }
36-
3733func (i * Identity ) SetName (name string ) {
38- i .SetID (name )
34+ i .id = chat . SanitizeName (name )
3935}
4036
4137func (i Identity ) Name () string {
You can’t perform that action at this time.
0 commit comments