File tree Expand file tree Collapse file tree 3 files changed +18
-14
lines changed Expand file tree Collapse file tree 3 files changed +18
-14
lines changed Original file line number Diff line number Diff line change 1
1
package chat
2
2
3
3
import (
4
- "time"
5
-
6
4
"github.com/shazow/ssh-chat/chat/message"
7
5
"github.com/shazow/ssh-chat/set"
8
6
)
@@ -16,16 +14,10 @@ type roomMember struct {
16
14
type Member interface {
17
15
message.Author
18
16
19
- SetName (string )
20
-
21
17
Config () message.UserConfig
22
18
SetConfig (message.UserConfig )
23
19
24
20
Send (message.Message ) error
25
21
26
- Joined () time.Time
27
- ReplyTo () message.Author
28
- SetReplyTo (message.Author )
29
- Prompt () string
30
- SetHighlight (string ) error
22
+ SetName (string )
31
23
}
Original file line number Diff line number Diff line change @@ -2,13 +2,15 @@ package sshchat
2
2
3
3
import (
4
4
"sync"
5
+ "time"
5
6
6
7
"github.com/shazow/ssh-chat/chat"
8
+ "github.com/shazow/ssh-chat/chat/message"
7
9
"github.com/shazow/ssh-chat/sshd"
8
10
)
9
11
10
12
type client struct {
11
- chat. Member
13
+ UserMember
12
14
sync.Mutex
13
15
conns []sshd.Connection
14
16
}
@@ -25,9 +27,19 @@ func (cl *client) Close() error {
25
27
return nil
26
28
}
27
29
28
- type User interface {
30
+ type UserMember interface {
29
31
chat.Member
30
32
33
+ Joined () time.Time
34
+ Prompt () string
35
+ ReplyTo () message.Author
36
+ SetHighlight (string ) error
37
+ SetReplyTo (message.Author )
38
+ }
39
+
40
+ type User interface {
41
+ UserMember
42
+
31
43
Connections () []sshd.Connection
32
44
Close () error
33
45
}
Original file line number Diff line number Diff line change @@ -77,8 +77,8 @@ func (h *Host) Connect(term *sshd.Terminal) {
77
77
requestedName := term .Conn .Name ()
78
78
screen := message .BufferedScreen (requestedName , term )
79
79
user := & client {
80
- Member : screen ,
81
- conns : []sshd.Connection {term .Conn },
80
+ UserMember : screen ,
81
+ conns : []sshd.Connection {term .Conn },
82
82
}
83
83
84
84
h .mu .Lock ()
@@ -316,7 +316,7 @@ func (h *Host) InitCommands(c *chat.Commands) {
316
316
return errors .New ("must specify message" )
317
317
}
318
318
319
- target := msg .From ().(chat. Member ).ReplyTo ()
319
+ target := msg .From ().(UserMember ).ReplyTo ()
320
320
if target == nil {
321
321
return errors .New ("no message to reply to" )
322
322
}
You can’t perform that action at this time.
0 commit comments