mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-22 20:09:41 +01:00
Fix privmsg.
This commit is contained in:
parent
32bee68407
commit
26ef45290a
@ -334,20 +334,17 @@ func (m *PrivMsgMessage) TargetIsChannel() bool {
|
|||||||
|
|
||||||
func (m *PrivMsgMessage) Handle(s *Server, c *Client) {
|
func (m *PrivMsgMessage) Handle(s *Server, c *Client) {
|
||||||
if m.TargetIsChannel() {
|
if m.TargetIsChannel() {
|
||||||
channel := s.channels[m.target]
|
if channel := s.channels[m.target]; channel != nil {
|
||||||
if channel != nil {
|
|
||||||
channel.PrivMsg(c, m.message)
|
channel.PrivMsg(c, m.message)
|
||||||
|
return
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if client := s.nicks[m.target]; client != nil {
|
||||||
|
client.send <- RplPrivMsg(c, m.message)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
c.send <- ErrNoSuchNick(s, m.target)
|
c.send <- ErrNoSuchNick(s, m.target)
|
||||||
}
|
|
||||||
} else {
|
|
||||||
client := s.nicks[m.target]
|
|
||||||
if client != nil {
|
|
||||||
client.send <- RplPrivMsg(client, m.message)
|
|
||||||
} else {
|
|
||||||
c.send <- ErrNoSuchNick(s, m.target)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TOPIC [newtopic]
|
// TOPIC [newtopic]
|
||||||
|
@ -102,7 +102,7 @@ func (s *Server) ChangeNick(c *Client, newNick string) {
|
|||||||
if c.nick != "" {
|
if c.nick != "" {
|
||||||
delete(s.nicks, c.nick)
|
delete(s.nicks, c.nick)
|
||||||
}
|
}
|
||||||
s.nicks[c.nick] = c
|
s.nicks[newNick] = c
|
||||||
|
|
||||||
s.SendToInterestedClients(c, RplNick(c, newNick))
|
s.SendToInterestedClients(c, RplNick(c, newNick))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user