1
0
Fork 0
forked from External/ergo

Move main into the right location; fix a lot of channel messages.

This commit is contained in:
Jeremy Latt 2012-12-11 22:34:22 -08:00
parent 78e741af3b
commit 5acc36409a
8 changed files with 49 additions and 39 deletions

View file

@ -21,8 +21,8 @@ type BasicReply struct {
}
func (reply *BasicReply) String(client *Client) string {
prefix := fmt.Sprintf(":%s %s %s ", reply.source.Id(), reply.code, client.Nick())
return prefix + reply.message
return fmt.Sprintf(":%s %s %s %s\r\n", reply.source.Id(), reply.code, client.Nick(),
reply.message)
}
type ChannelReply struct {
@ -31,8 +31,8 @@ type ChannelReply struct {
}
func (reply *ChannelReply) String(client *Client) string {
prefix := fmt.Sprintf(":%s %s %s ", reply.source.Id(), reply.code, reply.channel.name)
return prefix + reply.message
return fmt.Sprintf(":%s %s %s %s\r\n", reply.source.Id(), reply.code, reply.channel.name,
reply.message)
}
func NewReply(source Identifier, code string, message string) *BasicReply {
@ -99,11 +99,11 @@ func RplPart(channel *Channel, client *Client, message string) Reply {
}
func RplNoTopic(channel *Channel) Reply {
return &ChannelReply{NewReply(channel.server, RPL_NOTOPIC, ":No topic is set"), channel}
return NewReply(channel.server, RPL_NOTOPIC, channel.name+" :No topic is set")
}
func RplTopic(channel *Channel) Reply {
return &ChannelReply{NewReply(channel.server, RPL_TOPIC, ":"+channel.topic), channel}
return NewReply(channel.server, RPL_TOPIC, fmt.Sprintf("%s :%s", channel.name, channel.topic))
}
// server info
@ -119,7 +119,7 @@ func RplEndOfNames(source Identifier) Reply {
}
func RplPong(server *Server) Reply {
return NewReply(server, RPL_PONG, "")
return NewReply(server, RPL_PONG, server.Id())
}
// server functions