mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
good ol' fashioned refactoring
This commit is contained in:
parent
c7298c55b9
commit
c5c7469cf0
@ -29,6 +29,7 @@ func NewChannel(s *Server, name string) *Channel {
|
||||
name: name,
|
||||
server: s,
|
||||
}
|
||||
s.channels[name] = channel
|
||||
return channel
|
||||
}
|
||||
|
||||
@ -37,8 +38,7 @@ func (channel *Channel) IsEmpty() bool {
|
||||
}
|
||||
|
||||
func (channel *Channel) Names(client *Client) {
|
||||
client.MultilineReply(channel.Nicks(), RPL_NAMREPLY,
|
||||
"= %s :%s", channel.name)
|
||||
client.RplNamReply(channel)
|
||||
client.RplEndOfNames(channel)
|
||||
}
|
||||
|
||||
|
10
irc/reply.go
10
irc/reply.go
@ -308,6 +308,16 @@ func (target *Client) RplListEnd(server *Server) {
|
||||
":End of LIST")
|
||||
}
|
||||
|
||||
func (target *Client) RplNamReply(channel *Channel) {
|
||||
target.MultilineReply(channel.Nicks(), RPL_NAMREPLY,
|
||||
"= %s :%s", channel)
|
||||
}
|
||||
|
||||
func (target *Client) RplWhoisChannels(client *Client) {
|
||||
target.MultilineReply(client.WhoisChannelsNames(), RPL_WHOISCHANNELS,
|
||||
"%s :%s", client.Nick())
|
||||
}
|
||||
|
||||
//
|
||||
// errors (also numeric)
|
||||
//
|
||||
|
@ -390,7 +390,6 @@ func (m *JoinCommand) HandleServer(s *Server) {
|
||||
channel := s.channels[name]
|
||||
if channel == nil {
|
||||
channel = NewChannel(s, name)
|
||||
s.channels[name] = channel
|
||||
}
|
||||
channel.Join(client, key)
|
||||
}
|
||||
@ -528,8 +527,7 @@ func (m *WhoisCommand) HandleServer(server *Server) {
|
||||
client.RplWhoisOperator(mclient)
|
||||
}
|
||||
client.RplWhoisIdle(mclient)
|
||||
client.MultilineReply(mclient.WhoisChannelsNames(), RPL_WHOISCHANNELS,
|
||||
"%s :%s", mclient.Nick())
|
||||
client.RplWhoisChannels(mclient)
|
||||
client.RplEndOfWhois()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user