mirror of
https://github.com/ergochat/ergo.git
synced 2025-06-07 07:17:29 +02:00
send initial nick message to source client
This commit is contained in:
parent
0e07b29010
commit
aac0efebee
@ -66,7 +66,7 @@ func (channel *Channel) Reply(reply Reply) error {
|
|||||||
func (channel *Channel) receiveCommands(commands <-chan ChannelCommand) {
|
func (channel *Channel) receiveCommands(commands <-chan ChannelCommand) {
|
||||||
for command := range commands {
|
for command := range commands {
|
||||||
if DEBUG_CHANNEL {
|
if DEBUG_CHANNEL {
|
||||||
log.Printf("%s → %s : %s", command.Source(), channel, command)
|
log.Printf("%s → %s %s", command.Source(), channel, command)
|
||||||
}
|
}
|
||||||
command.HandleChannel(channel)
|
command.HandleChannel(channel)
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ func (channel *Channel) receiveCommands(commands <-chan ChannelCommand) {
|
|||||||
func (channel *Channel) receiveReplies(replies <-chan Reply) {
|
func (channel *Channel) receiveReplies(replies <-chan Reply) {
|
||||||
for reply := range replies {
|
for reply := range replies {
|
||||||
if DEBUG_CHANNEL {
|
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 {
|
for client := range channel.members {
|
||||||
if reply.Source() != Identifier(client) {
|
if reply.Source() != Identifier(client) {
|
||||||
|
@ -93,7 +93,7 @@ func (c *Client) readConn(recv <-chan string) {
|
|||||||
func (c *Client) writeConn(write chan<- string, replies <-chan Reply) {
|
func (c *Client) writeConn(write chan<- string, replies <-chan Reply) {
|
||||||
for reply := range replies {
|
for reply := range replies {
|
||||||
if DEBUG_CLIENT {
|
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)
|
reply.Format(c, write)
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ func (client *Client) InterestedClients() ClientSet {
|
|||||||
clients := make(ClientSet)
|
clients := make(ClientSet)
|
||||||
for channel := range client.channels {
|
for channel := range client.channels {
|
||||||
for member := range channel.members {
|
for member := range channel.members {
|
||||||
clients[member] = true
|
clients.Add(member)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return clients
|
return clients
|
||||||
|
@ -33,7 +33,10 @@ func NewStringReply(source Identifier, code string,
|
|||||||
message := fmt.Sprintf(format, args...)
|
message := fmt.Sprintf(format, args...)
|
||||||
fullMessage := fmt.Sprintf(":%s %s %s", source.Id(), code, message)
|
fullMessage := fmt.Sprintf(":%s %s %s", source.Id(), code, message)
|
||||||
return &StringReply{
|
return &StringReply{
|
||||||
BaseReply: &BaseReply{source, fullMessage},
|
BaseReply: &BaseReply{
|
||||||
|
source: source,
|
||||||
|
message: fullMessage,
|
||||||
|
},
|
||||||
code: code,
|
code: code,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ func NewServer(config *Config) *Server {
|
|||||||
func (server *Server) receiveCommands(commands <-chan Command) {
|
func (server *Server) receiveCommands(commands <-chan Command) {
|
||||||
for command := range commands {
|
for command := range commands {
|
||||||
if DEBUG_SERVER {
|
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 := command.Client()
|
||||||
client.Touch()
|
client.Touch()
|
||||||
@ -205,7 +205,9 @@ func (m *NickCommand) HandleServer(s *Server) {
|
|||||||
c.nick = m.nickname
|
c.nick = m.nickname
|
||||||
}
|
}
|
||||||
reply := RplNick(c, 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)
|
iclient.Reply(reply)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user