initial commit

This commit is contained in:
Jeremy Latt 2012-04-07 11:44:59 -07:00
commit a427e2bb47
6 changed files with 175 additions and 0 deletions

28
src/irc/client.go Normal file
View file

@ -0,0 +1,28 @@
package irc
import (
"net"
)
type Client struct {
conn net.Conn
ch chan Message
}
func NewClient(conn net.Conn) *Client {
return &Client{conn, NewMessageChan(NewStringChan(conn))}
}
// Write messages from the client to the server.
func (c *Client) Communicate(server chan Message) {
for message := range c.ch {
message.client = c
server <- message
}
c.Close()
}
func (c *Client) Close() {
c.conn.Close()
}