diff --git a/chat/member.go b/chat/member.go index 1ce6ffe..1c27ee6 100644 --- a/chat/member.go +++ b/chat/member.go @@ -1,8 +1,6 @@ package chat import ( - "time" - "github.com/shazow/ssh-chat/chat/message" "github.com/shazow/ssh-chat/set" ) @@ -16,16 +14,10 @@ type roomMember struct { type Member interface { message.Author - SetName(string) - Config() message.UserConfig SetConfig(message.UserConfig) Send(message.Message) error - Joined() time.Time - ReplyTo() message.Author - SetReplyTo(message.Author) - Prompt() string - SetHighlight(string) error + SetName(string) } diff --git a/client.go b/client.go index 5428719..b43d571 100644 --- a/client.go +++ b/client.go @@ -2,13 +2,15 @@ package sshchat import ( "sync" + "time" "github.com/shazow/ssh-chat/chat" + "github.com/shazow/ssh-chat/chat/message" "github.com/shazow/ssh-chat/sshd" ) type client struct { - chat.Member + UserMember sync.Mutex conns []sshd.Connection } @@ -25,9 +27,19 @@ func (cl *client) Close() error { return nil } -type User interface { +type UserMember interface { chat.Member + Joined() time.Time + Prompt() string + ReplyTo() message.Author + SetHighlight(string) error + SetReplyTo(message.Author) +} + +type User interface { + UserMember + Connections() []sshd.Connection Close() error } diff --git a/host.go b/host.go index bb35505..4bf97b2 100644 --- a/host.go +++ b/host.go @@ -77,8 +77,8 @@ func (h *Host) Connect(term *sshd.Terminal) { requestedName := term.Conn.Name() screen := message.BufferedScreen(requestedName, term) user := &client{ - Member: screen, - conns: []sshd.Connection{term.Conn}, + UserMember: screen, + conns: []sshd.Connection{term.Conn}, } h.mu.Lock() @@ -316,7 +316,7 @@ func (h *Host) InitCommands(c *chat.Commands) { return errors.New("must specify message") } - target := msg.From().(chat.Member).ReplyTo() + target := msg.From().(UserMember).ReplyTo() if target == nil { return errors.New("no message to reply to") }