3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-26 05:49:25 +01:00

Fix privmsg.

This commit is contained in:
Jeremy Latt 2012-12-12 23:33:09 -08:00
parent 2cbf65564e
commit b7ed55d45c
2 changed files with 10 additions and 12 deletions

View File

@ -383,7 +383,7 @@ func (m *PrivMsgMessage) Handle(s *Server, c *Client) {
} }
} else { } else {
if client := s.nicks[m.target]; client != nil { if client := s.nicks[m.target]; client != nil {
client.send <- RplPrivMsg(c, m.message) client.send <- RplPrivMsg(c, client, m.message)
return return
} }
} }

View File

@ -42,10 +42,10 @@ func (reply *NumericReply) String(client *Client) string {
reply.message) reply.message)
} }
// messaging // messaging replies
func RplPrivMsg(source *Client, message string) Reply { func RplPrivMsg(source *Client, target *Client, message string) Reply {
return NewNumericReply(source, RPL_PRIVMSG, ":"+message) return NewBasicReply(source, RPL_PRIVMSG, fmt.Sprintf("%s :%s", target, message))
} }
func RplNick(client *Client, newNick string) Reply { func RplNick(client *Client, newNick string) Reply {
@ -72,7 +72,11 @@ func RplQuit(client *Client, message string) Reply {
return NewBasicReply(client, RPL_QUIT, ":"+message) return NewBasicReply(client, RPL_QUIT, ":"+message)
} }
// Server Info func RplInviteMsg(channel *Channel, inviter *Client) Reply {
return NewBasicReply(inviter, RPL_INVITE, channel.name)
}
// numeric replies
func RplWelcome(source Identifier, client *Client) Reply { func RplWelcome(source Identifier, client *Client) Reply {
return NewNumericReply(source, RPL_WELCOME, return NewNumericReply(source, RPL_WELCOME,
@ -98,8 +102,6 @@ func RplUModeIs(server *Server, client *Client) Reply {
return NewNumericReply(server, RPL_UMODEIS, client.UModeString()) return NewNumericReply(server, RPL_UMODEIS, client.UModeString())
} }
// numeric replies
func RplNoTopic(channel *Channel) Reply { func RplNoTopic(channel *Channel) Reply {
return NewNumericReply(channel.server, RPL_NOTOPIC, channel.name+" :No topic is set") return NewNumericReply(channel.server, RPL_NOTOPIC, channel.name+" :No topic is set")
} }
@ -108,10 +110,6 @@ func RplTopic(channel *Channel) Reply {
return NewNumericReply(channel.server, RPL_TOPIC, fmt.Sprintf("%s :%s", channel.name, channel.topic)) return NewNumericReply(channel.server, RPL_TOPIC, fmt.Sprintf("%s :%s", channel.name, channel.topic))
} }
func RplInviteMsg(channel *Channel, inviter *Client) Reply {
return NewNumericReply(inviter, RPL_INVITE, channel.name)
}
func RplInvitingMsg(channel *Channel, invitee *Client) Reply { func RplInvitingMsg(channel *Channel, invitee *Client) Reply {
return NewNumericReply(channel.server, RPL_INVITING, return NewNumericReply(channel.server, RPL_INVITING,
fmt.Sprintf("%s %s", channel.name, invitee.Nick())) fmt.Sprintf("%s %s", channel.name, invitee.Nick()))
@ -131,7 +129,7 @@ func RplYoureOper(server *Server) Reply {
return NewNumericReply(server, RPL_YOUREOPER, ":You are now an IRC operator") return NewNumericReply(server, RPL_YOUREOPER, ":You are now an IRC operator")
} }
// errors // errors (also numeric)
func ErrAlreadyRegistered(source Identifier) Reply { func ErrAlreadyRegistered(source Identifier) Reply {
return NewNumericReply(source, ERR_ALREADYREGISTRED, ":You may not reregister") return NewNumericReply(source, ERR_ALREADYREGISTRED, ":You may not reregister")