From 55d3d6e946dee12dc1d21cb65022a8ee5ff8e70f Mon Sep 17 00:00:00 2001 From: Jeremy Latt Date: Sat, 8 Feb 2014 23:51:51 -0800 Subject: [PATCH] don't overwrite base command --- irc/client.go | 2 +- irc/commands.go | 6 +++--- irc/server.go | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/irc/client.go b/irc/client.go index 39f3dfd8..33dfbac1 100644 --- a/irc/client.go +++ b/irc/client.go @@ -55,7 +55,7 @@ func (c *Client) readConn(recv <-chan string) { continue } - m.SetBase(c) + m.SetClient(c) c.server.commands <- m } } diff --git a/irc/commands.go b/irc/commands.go index 750edd41..9884f717 100644 --- a/irc/commands.go +++ b/irc/commands.go @@ -9,7 +9,7 @@ import ( type editableCommand interface { Command - SetBase(*Client) + SetClient(*Client) } type parseCommandFunc func([]string) (editableCommand, error) @@ -42,8 +42,8 @@ func (command *BaseCommand) Client() *Client { return command.client } -func (command *BaseCommand) SetBase(c *Client) { - *command = BaseCommand{c} +func (command *BaseCommand) SetClient(c *Client) { + command.client = c } func (command *BaseCommand) Source() Identifier { diff --git a/irc/server.go b/irc/server.go index f78a42eb..5ea4fb51 100644 --- a/irc/server.go +++ b/irc/server.go @@ -202,9 +202,8 @@ func (m *JoinCommand) HandleServer(s *Server) { c := m.Client() if m.zero { - cmd := &PartCommand{ - BaseCommand: BaseCommand{c}, - } + cmd := &PartCommand{} + cmd.SetClient(c) for channel := range c.channels { channel.commands <- cmd }