3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-22 18:52:41 +01:00

send initial nick message to source client

This commit is contained in:
Jeremy Latt 2014-02-11 14:32:17 -08:00
parent 0e07b29010
commit aac0efebee
4 changed files with 13 additions and 8 deletions

View File

@ -66,7 +66,7 @@ func (channel *Channel) Reply(reply Reply) error {
func (channel *Channel) receiveCommands(commands <-chan ChannelCommand) {
for command := range commands {
if DEBUG_CHANNEL {
log.Printf("%s → %s : %s", command.Source(), channel, command)
log.Printf("%s → %s %s", command.Source(), channel, command)
}
command.HandleChannel(channel)
}
@ -75,7 +75,7 @@ func (channel *Channel) receiveCommands(commands <-chan ChannelCommand) {
func (channel *Channel) receiveReplies(replies <-chan Reply) {
for reply := range replies {
if DEBUG_CHANNEL {
log.Printf("%s ← %s : %s", channel, reply.Source(), reply)
log.Printf("%s ← %s %s", channel, reply.Source(), reply)
}
for client := range channel.members {
if reply.Source() != Identifier(client) {

View File

@ -93,7 +93,7 @@ func (c *Client) readConn(recv <-chan string) {
func (c *Client) writeConn(write chan<- string, replies <-chan Reply) {
for reply := range replies {
if DEBUG_CLIENT {
log.Printf("%s ← %s : %s", c, reply.Source(), reply)
log.Printf("%s ← %s %s", c, reply.Source(), reply)
}
reply.Format(c, write)
}
@ -136,7 +136,7 @@ func (client *Client) InterestedClients() ClientSet {
clients := make(ClientSet)
for channel := range client.channels {
for member := range channel.members {
clients[member] = true
clients.Add(member)
}
}
return clients

View File

@ -33,7 +33,10 @@ func NewStringReply(source Identifier, code string,
message := fmt.Sprintf(format, args...)
fullMessage := fmt.Sprintf(":%s %s %s", source.Id(), code, message)
return &StringReply{
BaseReply: &BaseReply{source, fullMessage},
BaseReply: &BaseReply{
source: source,
message: fullMessage,
},
code: code,
}
}

View File

@ -48,7 +48,7 @@ func NewServer(config *Config) *Server {
func (server *Server) receiveCommands(commands <-chan Command) {
for command := range commands {
if DEBUG_SERVER {
log.Printf("%s → %s : %s", command.Client(), server, command)
log.Printf("%s → %s %s", command.Client(), server, command)
}
client := command.Client()
client.Touch()
@ -205,7 +205,9 @@ func (m *NickCommand) HandleServer(s *Server) {
c.nick = m.nickname
}
reply := RplNick(c, m.nickname)
for iclient := range c.InterestedClients() {
iclients := c.InterestedClients()
iclients.Add(c)
for iclient := range iclients {
iclient.Reply(reply)
}